http://stackoverflow.com/a/27020821
answers question: http://stackoverflow.com/q/27020447
score: 1
upvote count: 1
has body: 1) Adding a duplicate into a Set does not do anything (it returns false immediately, and contents of the Set are not affected), regardless of particular implementation, be it a HashSet, a TreeSet or a LinkedHashSet. 2) Check out LinkedHashMap, it is, probably, the closest to what you want. It has a boolean argument to the constructor, that lets you specify whether you want it to use "insertion-order" (false) or "access-order". The former is the same as LinkedHashSet, the latter will "bump" the key up if you re-insert it, and also if you look it up: Map&lt;String, Integer&gt; map = new LinkedHashMap(10, 0.75, true); map.put("foo", 1); map.put("bar", 2); System.out.println(map.keySet().iterator().next()); // prints "bar" map.put("foo", 1); System.out.println(map.keySet().iterator().next()); // prints "foo" map.get("bar"); System.out.println(map.keySet().iterator().next()); // prints "bar"
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27020447
type: Answer

java
tags question: http://stackoverflow.com/q/27051435
tags question: http://stackoverflow.com/q/27003242
tags question: http://stackoverflow.com/q/27075593
tags question: http://stackoverflow.com/q/27123909
tags question: http://stackoverflow.com/q/27132622
tags question: http://stackoverflow.com/q/27024861
tags question: http://stackoverflow.com/q/27087037
tags question: http://stackoverflow.com/q/26995126
tags question: http://stackoverflow.com/q/27083084
tags question: http://stackoverflow.com/q/27093831
tags question: http://stackoverflow.com/q/27126382
tags question: http://stackoverflow.com/q/26999158
tags question: http://stackoverflow.com/q/27089278
tags question: http://stackoverflow.com/q/27106475
tags question: http://stackoverflow.com/q/27147325
tags question: http://stackoverflow.com/q/27103001
tags question: http://stackoverflow.com/q/27086598
tags question: http://stackoverflow.com/q/27029839
tags question: http://stackoverflow.com/q/27078488
tags question: http://stackoverflow.com/q/27052681
tags question: http://stackoverflow.com/q/27123772
tags question: http://stackoverflow.com/q/27046709
tags question: http://stackoverflow.com/q/27081058
tags question: http://stackoverflow.com/q/27006178
tags question: http://stackoverflow.com/q/27025766
tags question: http://stackoverflow.com/q/27029211
tags question: http://stackoverflow.com/q/27130534
tags question: http://stackoverflow.com/q/27045736
tags question: http://stackoverflow.com/q/27086548
tags question: http://stackoverflow.com/q/27021918
tags question: http://stackoverflow.com/q/26993055
tags question: http://stackoverflow.com/q/27135326
tags question: http://stackoverflow.com/q/27079949
tags question: http://stackoverflow.com/q/27034113
tags question: http://stackoverflow.com/q/27123668
tags question: http://stackoverflow.com/q/27100224
tags question: http://stackoverflow.com/q/27087321
tags question: http://stackoverflow.com/q/27003473
tags question: http://stackoverflow.com/q/27101780
tags question: http://stackoverflow.com/q/27111372
tags question: http://stackoverflow.com/q/27148735
tags question: http://stackoverflow.com/q/27034218
tags question: http://stackoverflow.com/q/27051092
tags question: http://stackoverflow.com/q/27033957
tags question: http://stackoverflow.com/q/27113073
tags question: http://stackoverflow.com/q/27115986
tags question: http://stackoverflow.com/q/27036326
tags question: http://stackoverflow.com/q/27041182
tags question: http://stackoverflow.com/q/27041407
tags question: http://stackoverflow.com/q/26996224
tags question: http://stackoverflow.com/q/27149585
tags question: http://stackoverflow.com/q/27115938
tags question: http://stackoverflow.com/q/27089043
tags question: http://stackoverflow.com/q/27104589
tags question: http://stackoverflow.com/q/27097153
tags question: http://stackoverflow.com/q/27131991
tags question: http://stackoverflow.com/q/27129457
tags question: http://stackoverflow.com/q/27017772
tags question: http://stackoverflow.com/q/27069055
tags question: http://stackoverflow.com/q/27147494
tags question: http://stackoverflow.com/q/27060902
tags question: http://stackoverflow.com/q/27038812
tags question: http://stackoverflow.com/q/27141038
tags question: http://stackoverflow.com/q/27131722
tags question: http://stackoverflow.com/q/27143553
tags question: http://stackoverflow.com/q/26992908
tags question: http://stackoverflow.com/q/27029881
tags question: http://stackoverflow.com/q/27102384
tags question: http://stackoverflow.com/q/27118136
tags question: http://stackoverflow.com/q/27008344
tags question: http://stackoverflow.com/q/27090843
tags question: http://stackoverflow.com/q/27062497
tags question: http://stackoverflow.com/q/27088404
tags question: http://stackoverflow.com/q/27147341
tags question: http://stackoverflow.com/q/27053149
tags question: http://stackoverflow.com/q/27012567
tags question: http://stackoverflow.com/q/27023963
tags question: http://stackoverflow.com/q/27097474
tags question: http://stackoverflow.com/q/27115374
tags question: http://stackoverflow.com/q/27119140

jhipster
tag name: jhipster
tags question: http://stackoverflow.com/q/27034885
type: Tag
tags question: http://stackoverflow.com/q/27057679
tags question: http://stackoverflow.com/q/27084150
tags question: http://stackoverflow.com/q/27069674

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/27034028
tags question: http://stackoverflow.com/q/27055322
type: Tag
tags question: http://stackoverflow.com/q/27119243
tags question: http://stackoverflow.com/q/27043875
tag name: csv
tags question: http://stackoverflow.com/q/27046064
tags question: http://stackoverflow.com/q/27088108
tags question: http://stackoverflow.com/q/27058249
tags question: http://stackoverflow.com/q/27000406
tags question: http://stackoverflow.com/q/27017291
tags question: http://stackoverflow.com/q/27148735
tags question: http://stackoverflow.com/q/27026107
tags question: http://stackoverflow.com/q/27060828
tags question: http://stackoverflow.com/q/27094410
tags question: http://stackoverflow.com/q/27136059
tags question: http://stackoverflow.com/q/27094990
tags question: http://stackoverflow.com/q/27140730

http://stackoverflow.com/a/27127044
has body: I prefer the first one. It can always be used without thinking of new names such as aName. Moreover, this is how, for instance, eclipse generates setters.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27126658

http://stackoverflow.com/q/27140250
has answer: http://stackoverflow.com/a/27140275
has answer: http://stackoverflow.com/a/27143127
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42778154
score: 1
tagged with: java
has body: I'm stuck trying to come up with a regex to match a pattern in java stack trace. This regex should identify all numbers in a string except the line number corresponding to the java class. For example str = "(SomeName.java:470) This is the 1st string out of a total of 50 string:345" I want to write a regex which identifies 1, 50 and 345 and not 470. I came up with one but it quite doesn't does it for me - "(?&lt;!.java:)[\d]*". This gets 70 instead of 470 and the reason is self explanatory. Can you please help me with modifying the above regex to match the pattern from the example?
has title: Regex - stack trace - match all numbers except java class line number
type: Question
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/27140332
favorite count: 0
answer count: 3
tagged with: regex

http://stackoverflow.com/comment/42611605
has text: Are you sure that the ResultSet class contains the username property ?!!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27046572
score: 0

http://stackoverflow.com/comment/42590382
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27034650
has text: BorderLayout has 5th areas, you can to put only one JComponent to the one of areas (actually you uses CENTER == frame.add(t); ), have to use another area (doesn't resized proportionally in BOrderLayout) or another LayoutManager

http://stackoverflow.com/q/27105232
has body: When you set up an eclipse plugin preference page, is it possible to add some sort of text or a separator line between the FieldEditors? @Override protected void createFieldEditors() { addField( new SomeFieldEditor(....)); addField( new SomeFieldEditor(....)); }
answer count: 1
tagged with: user-interface
tagged with: eclipse-plugin
score: 0
tagged with: preferences
accepted answer: http://stackoverflow.com/a/27105688
type: AnsweredQuestion
has title: Eclipse-Plugin: Separator Line between FieldEditor possible?
tagged with: java
has answer: http://stackoverflow.com/a/27105688
tagged with: eclipse
type: Question

http://stackoverflow.com/a/27113154
has comment: http://stackoverflow.com/comment/42729095
has comment: http://stackoverflow.com/comment/42729322
type: Answer
has comment: http://stackoverflow.com/comment/42729163
has body: Typically, you would use synchronization to accomplish this. The simplest form of this would be to synchronize the method itself. public synchronized ReentrantReadWriteLock getLock(String tableName) { However, if you are concerned about performance I would consider the following approach which uses a synchronized block, but only if the initial lock isn't found. public ReentrantReadWriteLock getLock(String tableName) { ReentrantReadWriteLock lock = locksMap.get(tableName); if (lock != null) { return lock; } synchronized(locksMap) { lock = locksMap.get(tableName); if (lock == null) { lock = new ReentrantReadWriteLock(); locksMap.put(tableName, lock); } } return lock; }
has comment: http://stackoverflow.com/comment/42729292
answers question: http://stackoverflow.com/q/27113045
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42760647
has text: Can you provide a Code Example of what you have right now?
score: 2
comment on: http://stackoverflow.com/q/27130897
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42543404
type: QuestionComment
type: Comment
score: 2
has text: Care to show your POM? At least the minimal configuration showing the dependencies in question is necessary to help troubleshoot the problem.
comment on: http://stackoverflow.com/q/27005659

http://stackoverflow.com/a/27019141
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27018424
downvote count: 0
has comment: http://stackoverflow.com/comment/42566720
has body: First: you probably want to have: Map&lt;String, Double&gt; mapObj = HashMap&lt;&gt;(); mapObj.put("a1", 3.58654); mapObj.put("a2", 4.1567); mapObj.put("a3", 4.2546); mapObj.put("a4", 4.1567); // Repeated value And then you want a reverse lookup with nearest value. For that it would be nice to have all entries sorted by value. This cannot be a Set because of a value occuring multiple times. List&lt;Map.Entry&lt;String, Double&gt;&gt; entries = new ArrayList&lt;&gt;(mapObj.entrySet()); Comparator&lt;Map.Entry&lt;String, Double&gt;&gt; cmp = (lhs, rhs) -&gt; Double.compare(lhs.getValue(), rhs.getValue()); Collections.sort(entries, cmp); I know of no data structure in Java that combines this. Though there probably is. To not lose information I use the Map.Entry, key-value pair. That needs a Comparator on the values. For shortness, I have borrowed from Java 8 syntax here. Now search: Map.Entry&lt;String, Double&gt; nearest(double value) { int index = Collections.binarySearch(entries, cmp); if (index &lt; 0) { // Not found index = -index + 1; // The insertion position Map.Entry&lt;String, Double&gt; before = index != 0 ? entries.get(i - 1) : null; Map.Entry&lt;String, Double&gt; after = index &lt; entries.size() ? entries.get(i) : null; if (before == null &amp;&amp; after == null) { return null; } else if (before == null) { return after; } else if (after == null) { return before; } return value - before.getValue() &lt; after.getValue() - value ? before : after; } return entries.get(index); } To find a sub list of values inside a delta, one would need to use the index. Now every search costs ²log N, which is acceptable.

http://stackoverflow.com/a/27010971
accepted answer of: http://stackoverflow.com/q/27010898
answers question: http://stackoverflow.com/q/27010898
has body: The packager is telling you that the file META-INF/NOTICE appears in more than one jar file (which creates a conflict) and therefore cannot be included. To solve that problem, add this section to your build.gradle (you might already have an android closure, in which case add just the packagingOptions part): android { packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' } } Your particular problem is about the NOTICE file but I suspect that you might also run into problems with LICENSE and DEPENDENCIES.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/27137124
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: While get-by-key operations (like load().type(...).id(...)) are strongly consistent by default, queries are eventually consistent. Here's more information: https://cloud.google.com/developers/articles/balancing-strong-and-eventual-consistency-with-google-cloud-datastore/
answers question: http://stackoverflow.com/q/27126867

http://stackoverflow.com/comment/42559344
score: 1
has text: The answer to every single "which is faster, this code or this code" ever is "profile them and see".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27017017

http://stackoverflow.com/comment/42553357
score: 0
comment on: http://stackoverflow.com/a/27013627
has text: When `serverSorting: true` is added in grid for KendoUI, data for sorting is send in `sort[0][field]:prodId` format.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27050762
score: 0
type: Answer
has body: You can verify if you still staying in your login page, and if you do - to attempt re-login again. For example, you got LoginPageObject in return after unsuccessful login attempt. For example, "trivial" solution: while(loginPageObject != null){ loginPageObject = loginPageObject.attemptToLogin(); }
answers question: http://stackoverflow.com/q/27035065

http://stackoverflow.com/comment/42518098
has text: Wrong: https://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html#setString%28int,%20java.lang.String%29
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/26993658
type: Comment

http://stackoverflow.com/comment/42736134
has text: @VinceEmigh many thanks for your comment! I will reword my question in a further way to discuss more the algorithm required to make this system in practice !
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27116475

http://stackoverflow.com/q/27086357
answer count: 2
tagged with: for-loop
tagged with: statements
accepted answer: http://stackoverflow.com/a/27086372
has title: What is wrong with for loop syntax?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27086421
has answer: http://stackoverflow.com/a/27086421
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/27086372
has body: I have this piece of code down here - the PlayingDeck class. It's not done, as you see, but what happens is that on line 17, Right under the for loop, I get an error message saying the PlayingCard declaration and initialization isn't a statement. Why so? When I add the curly brackets to the for loop with just that same statement, the error message disappears. Could someone please explain why? All I need are two brackets, one at the start and one at the end of the for loop...? Thank you Code that does not compile -------- public class PlayingDeck { static int numberOfCards; static { numberOfCards = 52; } PlayingCard[] playingDeckArray; PlayingDeck() { playingDeckArray = new PlayingCard[numberOfCards]; for (int currentCardNumber = 0; currentCardNumber &gt; 51; currentCardNumber++) PlayingCard currentCard = playingDeckArray[currentCardNumber]; } public static void main(String[] args) { } } Code that Compiles ----- public class PlayingDeck { static int numberOfCards; static { numberOfCards = 52; } PlayingCard[] playingDeckArray; PlayingDeck() { playingDeckArray = new PlayingCard[numberOfCards]; for (int currentCardNumber = 0; currentCardNumber &gt; 51; currentCardNumber++){ PlayingCard currentCard = playingDeckArray[currentCardNumber]; } } public static void main(String[] args) { } }
score: 0

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/27046674
tags question: http://stackoverflow.com/q/27017772
tags question: http://stackoverflow.com/q/27136131
tag name: jfreechart
tags question: http://stackoverflow.com/q/27115009
tags question: http://stackoverflow.com/q/27008897

http://stackoverflow.com/a/27101529
answers question: http://stackoverflow.com/q/27098294
type: Answer
upvote count: 1
has body: Your question is not about Object Orientated Programming, but programming and algorithms in general. A program does only what it is instructed to do, otherwise it is not a program. We can imagine that real-world like interactions between cats and dogs can be programmed, just like anything else. Programming is about translating real world algorithms and properties into lines of codes. However, we can agree for now, that a real and physical world cannot be created just by writing lines of codes. Maybe in the future, with breakthrough in holographic and quantum computing, we will be able to create real cats and dogs with some lines of code..
score: 1
downvote count: 0

http://stackoverflow.com/q/27078267
tagged with: mysql
type: Question
has title: Caused by: java.sql.SQLException: Access denied
score: 0
has comment: http://stackoverflow.com/comment/42667143
has comment: http://stackoverflow.com/comment/42666826
linked to: http://stackoverflow.com/q/19533441
type: UnansweredQuestion
tagged with: mysql-error-1064
has comment: http://stackoverflow.com/comment/42667242
has body: I have a Java application and I want to access my local database which is a MySQL database, but I have this exception: Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) I tried to execute this command from MySQL command line client: mysql&gt; GRANT ALL PRIVILEGES ON mydb.* TO 'root'@'localhost' IDENTIFIED BY 'myPass'; But it didn't solve my problem and the exception still appears. This my connection configuration "database.properties" file: jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc\:mysql\://localhost\:3306/mydb jdbc.username=root jdbc.password=myPass
has comment: http://stackoverflow.com/comment/42667002
has comment: http://stackoverflow.com/comment/42670442
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42667290

http://stackoverflow.com/q/27064977
tagged with: java
has comment: http://stackoverflow.com/comment/42644843
tagged with: date
has comment: http://stackoverflow.com/comment/42643584
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42643944
has title: java.text.ParseException: Unparseable date: "11/11/2014"
answer count: 1
has answer: http://stackoverflow.com/a/27065046
has body: I am trying to get the difference betweek to dates String start_date, end_date; System.out.println("Date Format: MM/DD/YYYY hh:mm:ss (24-hour format)"); System.out.print("Start Date and Time: "); start_date = cin.next(); System.out.print("End Date and Time: "); end_date = cin2.next(); SimpleDateFormat date_format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); Date date1 = null, date2 = null; try { date1 = date_format.parse(start_date); date2 = date_format.parse(end_date);long diff = date1.getTime() - date2.getTime(); long diffSeconds = diff / 1000 % 60; long diffMinutes = diff / (60 * 1000) % 60; long diffHours = diff / (60 * 60 * 1000) % 24; long diffDays = diff / (24 * 60 * 60 * 1000); System.out.print(diffDays + " days, "); System.out.print(diffHours + " hours, "); System.out.print(diffMinutes + " minutes, "); System.out.print(diffSeconds + " seconds."); } catch(Exception ex) { System.out.println(ex); } I keep on getting this error Date Format: MM/DD/YYYY hh:mm:ss (24-hour format) Start Date and Time: 11/11/2014 11:11:11 End Date and Time: 11/21/2014 11:11:11 java.text.ParseException: Unparseable date: "11/11/2014" please help me
has comment: http://stackoverflow.com/comment/42643661
type: UnansweredQuestion

http://stackoverflow.com/q/27133314
has answer: http://stackoverflow.com/a/27134065
has body: I wonder what is the best way(if possible) to separate app into multiple independent parts. For example if you have 3 separate units that do different stuff, and you may have 2 different apps that combine 2/3 of this parts, how would you do it? I'm coming from windows background, where in Visual Studio, you can have multiple independent projects under one solution, and then you can reuse them where you need it. Can you have this in android? I know I can put things under different packages, but not sure how would do separation of resources. Is there any difference between using Eclipse or Android studio for this purpose? Any guidance or resource would be very helpful :)
answer count: 3
has answer: http://stackoverflow.com/a/27133835
downvote count: 0
has comment: http://stackoverflow.com/comment/42995762
favorite count: 0
linked to: http://stackoverflow.com/q/226977
tagged with: android
upvote count: 1
tagged with: design-patterns
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27133835
score: 1
has title: Android multi project app structure
tagged with: java
tagged with: reusability
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/27133918
type: Question
linked to: http://stackoverflow.com/q/10830135
has answer: http://stackoverflow.com/a/27133918

http://stackoverflow.com/comment/42660988
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27074334
has text: That was perfect, thanks. Corey

http://stackoverflow.com/q/27133112
has comment: http://stackoverflow.com/comment/42811576
score: 0
has title: Callback timing
has comment: http://stackoverflow.com/comment/42767960
tagged with: callback
has comment: http://stackoverflow.com/comment/42771102
type: UnansweredQuestion
tagged with: android
has body: Hey everyone happy upcoming turkey day !. So I am trying to implement a search manager class that handles all searching for this android app using a parse backend and ran into an interesting problem. Here is the method that should call the search managers search function public void SearchForLostItems(){ String searchtext = mSearchView.getQuery().toString(); List&lt;ParseObject&gt; foundposts = mSearchManager.BasicSearch(searchtext); //if we found a matching post go to the post details if(parseObjects != null){ //Try to get our found posts count if there is more than one match than list them for the user and let them browse try { //if there is only one match then go ahead to the post if(parseObjects.size() == 1){ ParseObject foundpost = parseObjects.get(0); Post post = new Post(foundpost.getObjectId(), ""); GoToFoundPost(post); } } catch (ArrayIndexOutOfBoundsException ex) { e.printStackTrace(); } } } else { e.printStackTrace(); } } }); } And here is the implementation in search manager //Basic search for when someone searches by text, should accept some search text and returhn amatched list of parse objects public List&lt;ParseObject&gt;BasicSearch(String searchtext){ final List&lt;ParseObject&gt; PostsHolder = null; //Do a search for all posts that contain the search text ParseQuery&lt;ParseObject&gt; foundposts = new ParseQuery&lt;ParseObject&gt;(ParseConstants.CLASS_POSTS); // get the whole class foundposts.whereEqualTo(ParseConstants.POST_TITLE,searchtext); // filter the results based on the search text foundposts.findInBackground(new FindCallback&lt;ParseObject&gt;() { //call the find in background routine to convert the results to a list @Override public void done(List&lt;ParseObject&gt; parseObjects, ParseException e) { if(e == null){ PostsHolder.addAll(parseObjects); Log.d("Posts Added", "true"); } else { e.printStackTrace(); } } }); return PostsHolder; } I think this issue is because the function returns before the callback is complete but I am not sure fo…
has comment: http://stackoverflow.com/comment/42774167
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42782097
type: Question

http://stackoverflow.com/comment/46793485
score: 0
type: Comment
comment on: http://stackoverflow.com/a/29297123
type: AnswerComment
has text: base64 encoding for image is gross.

http://stackoverflow.com/comment/42667493
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27078702
has text: The text is saying that `private` methods are `final`, not otherwise. So, *Final methods cannot be overriden, but they can be called from a subclass* is a misunderstanding. The second statement is correct.

http://stackoverflow.com/comment/42586492
comment on: http://stackoverflow.com/q/27020639
score: 0
type: Comment
type: QuestionComment
has text: Why don't you simply remove or comment out @Ignore?

http://stackoverflow.com/q/27087372
tagged with: tomcat
has title: Dependency management on tomcat server
has body: I have a java web application which is deployed on several servers. The project uses maven dependency management tool. The war file that is created after including all the dependencies is quite large. If I use scope "provided" for all dependencies, the war fail created is quite small. I want to use the latter war file for deployment and manage dependencies on the remote servers itself. I can add a folder containing those dependencies to all the servers and include it in the tomcat class path but if in future I add another dependency I will have to add that dependency to all the servers. Please suggest a workaround.
has comment: http://stackoverflow.com/comment/42683591
has comment: http://stackoverflow.com/comment/42682957
type: UnansweredQuestion
tagged with: maven
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42685274
type: Question
has comment: http://stackoverflow.com/comment/42685449

http://stackoverflow.com/a/38831489
has body: You can create a variable in the pom.xml : org.apache.maven.plugins maven-surefire-plugin ${version.maven-surefire-plugin} <systemPropertyVariables> <arquillianResourcesXml> ${project.basedir}/src/test/resources/resources-glassfish-embedded/glassfish-resources.xml </arquillianResourcesXml> </systemPropertyVariables> and in the arquillian.xml file : ${arquillianResourcesXml} worked for me.
answers question: http://stackoverflow.com/q/27092755
score: 0
type: Answer

http://stackoverflow.com/q/27130534
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/27132289
accepted answer: http://stackoverflow.com/a/27132289
has comment: http://stackoverflow.com/comment/42760620
has title: Using Map<Integer,Integer> by taking the input from a user
upvote count: 1
has comment: http://stackoverflow.com/comment/42761061
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/42764431
has comment: http://stackoverflow.com/comment/42759997
tagged with: integer
favorite count: 0
has comment: http://stackoverflow.com/comment/42760451
tagged with: dictionary
has body: I have a question about Maps, from the type Integer,Integer. I made a mistake by solving a problem based on &lt;Integer,Integer&gt; map on &lt;String,String&gt;, the end result was correct however, the order of numbers was not descending. That would be solved if I chose Integer instead of Strings. How can I take the input from the user and assign it to keys/values of my map when it is Map&lt;Integer, Integer&gt;? I used substring() and indexOf() to make my old map but for integers I couldn't find a way import java.util.*; import java.io.*; import type.lib.*; public class MapTesting { public static void main(String[] args) { PrintStream output = new PrintStream(System.out); Scanner input = new Scanner(System.in); Map&lt;String,String&gt; normal = new HashMap&lt;String,String&gt;(); output.println("Enter your map, one key-value pair per line,"); output.println("comma-separated. Use empty line as sentinel."); for ( String entry = input.nextLine(); entry.length() !=0; entry = input.nextLine()) { int comma = entry.indexOf(","); String key = entry.substring(0,comma); String value = entry.substring(comma+1); normal.put(key,value); } output.println("The input map is:"); output.println(normal); Map&lt;String,String&gt; reverse = new HashMap&lt;String,String&gt;(); boolean distinct = true; for (Map.Entry&lt;String,String&gt; entry : normal.entrySet()) { String keyY = entry.getKey(); String valueE = entry.getValue(); String existingReverseValue = reverse.get(valueE); if (existingReverseValue != null) { int currentValue = Integer.parseInt(existingReverseValue); int potentialNewValue = Integer.parseInt(keyY); if ( potentialNewValue &lt; currentValue) { reverse.put(valueE,keyY); } } else { reverse.put(valueE,keyY); } } output.println("The inverted map [using the smaller key as a tie breaker]:"); output.println(reverse); } }
type: AnsweredQuestion

http://stackoverflow.com/a/27123302
downvote count: 1
has body: Some of the reasons have already been pointed out. For example, the fact that "...(Almost) All operations on byte, short will promote these primitives to int". However, the obvious next question would be: WHY are these types promoted to int? So to go one level deeper: The answer may simply be related to the Java Virtual Machine Instruction Set. As summarized in the Table in the Java Virtual Machine Specification, all integral arithmetic operations, like adding, dividing and others, are only available for the type int and the type long, and not for the smaller types. (An aside: The smaller types (byte and short) are basically only intended for arrays. An array like new byte[1000] will take 1000 bytes, and an array like new int[1000] will take 4000 bytes) Now, of course, one could say that "...the obvious next question would be: WHY are these instructions only offered for int (and long)?". One reason is mentioned in the JVM Spec mentioned above: If each typed instruction supported all of the Java Virtual Machine's run-time data types, there would be more instructions than could be represented in a byte Additionally, the Java Virtual Machine can be considered as an abstraction of a real processor. And introducing dedicated Arithmetic Logic Unit for smaller types would not be worth the effort: It would need additional transistors, but it still could only execute one addition in one clock cycle. The dominant architecture when the JVM was designed was 32bits, just right for a 32bit int. (The operations that involve a 64bit long value are implemented as a special case). (Note: The last paragraph is a bit oversimplified, considering possible vectorization etc., but should give the basic idea without diving too deep into processor design topics) EDIT: A short addendum, focussing on the example from the question, but in an more general sense: One could also ask whether it would not be beneficial to store fields using the smaller types. For example, one might think that memory…
has comment: http://stackoverflow.com/comment/77674010
has comment: http://stackoverflow.com/comment/77679908
upvote count: 174
has comment: http://stackoverflow.com/comment/42870879
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27122610
answers question: http://stackoverflow.com/q/27122610
score: 173

http://stackoverflow.com/comment/42705477
has text: Jon, right now I've created new Restaurant() instance at outside of the method. But still I get the same error.
comment on: http://stackoverflow.com/a/27100504
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42744210
score: 0
type: Comment
type: QuestionComment
has text: There is a LibraryServerImpl class which is an implementation of the LibraryServer remote class, and MemberImpl which is an implementation of the Member remote class. These both have main methods with nothing in it. Would this potentially cause a problem, since neither main method (server or client) have anything in their main method. Despite this, I dont feel like it should say assertionError when it should still be creating a LIbraryServer object
comment on: http://stackoverflow.com/q/27120070

http://stackoverflow.com/comment/42520646
score: 2
has text: In this case we know it's 9. What other rules can be applied to elements?
comment on: http://stackoverflow.com/q/26995084
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27062811
has comment: http://stackoverflow.com/comment/42645919
has comment: http://stackoverflow.com/comment/42644541
type: Question
has comment: http://stackoverflow.com/comment/42639781
tagged with: hibernate
has body: ´m trying to aply a Criteria.Restriction to a query with Projections. My code is: ProjectionList projections = Projections.projectionList().add(Projections.property("mId").as("mId")); projections.add(Projections.property("mDate").as("mDate")); Criteria criteria = mSession.createCriteria(MailAgroseguro.class) .add(Restrictions.between("mDate", dateMin, dateMax)) .setProjection(projections) .setResultTransformer(new AliasToBeanNestedResultTransformer(ObjectClass.class)); listObjectClass = (List&lt;ObjectClass&gt;)criteria.list(); Edit: The ObjectClass.java: public class ObjectClass { private Integer mId; private String mDate; } And the error is: Hibernate: select this_.mId as y0_, this_.mDate as y1_ from objectclass this_ where y1_ between ? and ? [INFO] 2014-11-21 16:59:24,554 - org.hibernate.util.JDBCExceptionReporter -25221 [JavaFX Application Thread] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1054, SQLState: 42S22 [INFO] 2014-11-21 16:59:24,554 - org.hibernate.util.JDBCExceptionReporter -25221 [JavaFX Application Thread] ERROR org.hibernate.util.JDBCExceptionReporter - Unknown column 'y1_' in 'where clause' If I don´t add the Restriction or the Projections works fine! Edited2: updated Error Thanks to everyone!
has comment: http://stackoverflow.com/comment/42645598
score: 0
has title: Hibertate Criteria with Projections
has comment: http://stackoverflow.com/comment/42641603
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/42657662
score: 2
comment on: http://stackoverflow.com/q/27072751
has text: If you get errors like `cannot find symbol`, then always read the [JavaDoc](https://docs.oracle.com/javase/7/docs/api/index.html?java/lang/Character.html) of the used class first. This is much faster and easier, than creating a question on Stackoverflow.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27084595
has body: I've played around with arrays and arrayLists. Sorting is a breeze with arrayLists but I can not say the same with arrays. You have to make a for loop and filter the results and it's a pain. As far as I can see arrayList are just a better version of arrays. So why use arrays? Is there something they can do better.
type: Question
has answer: http://stackoverflow.com/a/27084627
duplicate of: http://stackoverflow.com/q/717218
upvote count: 0
score: -2
answer count: 1
linked to: http://stackoverflow.com/q/717218
favorite count: 0
has comment: http://stackoverflow.com/comment/42678150
has comment: http://stackoverflow.com/comment/42678139
type: UnansweredQuestion
downvote count: 2
tagged with: java
has title: In Java, why use a array over an arrayList

http://stackoverflow.com/comment/42962662
score: 0
comment on: http://stackoverflow.com/a/27145949
type: Comment
has text: You have to remove the elements that you want to remove from their container( panel p)! You should mark this answer as solved, and create a new question, because it's out of topic.
type: AnswerComment

http://stackoverflow.com/comment/42581867
comment on: http://stackoverflow.com/a/27027855
score: 0
type: AnswerComment
type: Comment
has text: @vanatic I added a JComboBox controlling the cardlayout to show it working. You can remove this very easily, but it illustrates that the CardLayout is working.

http://stackoverflow.com/a/27068056
answers question: http://stackoverflow.com/q/27067970
has body: Simply add the nojsoncallback param https://api.flickr.com/services/rest/?method=flickr.photos.search&amp;api_key=2ef592bfddc86f508550184ec706a2fc&amp;tags=gent&amp;per_page=2&amp;format=json&amp;nojsoncallback=1 You can find it documented here https://www.flickr.com/services/api/response.json.html
accepted answer of: http://stackoverflow.com/q/27067970
has comment: http://stackoverflow.com/comment/42688777
has comment: http://stackoverflow.com/comment/42762123
type: AcceptedAnswer
downvote count: 0
score: 13
type: Answer
upvote count: 13
has comment: http://stackoverflow.com/comment/42649616

http://stackoverflow.com/q/27031938
has answer: http://stackoverflow.com/a/27052465
tagged with: java
answer count: 1
tagged with: jpa
tagged with: tomcat
has body: Have a jar module with entities and daos (openjpa) and a web module which wires those up to controllers with spring. Tests in the jar module run fine but when trying to use daos in the web module, getting this error: [2014-11-20 15:12:00,692] - openjpa.Runtime An error occurred while registering a ClassTransformer with PersistenceUnitInfo: name 'analytics-persistence-unit', root URL [file:/C:/work/tools/tomcat/webapps/events/WEB-INF/lib/analytics-1.0-SNAPSHOT.jar]. The error is logged along with this warning. Load-time class transformation will not be available. java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy13.addTransformer(Unknown Source) at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:168) at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at…
type: UnansweredQuestion
tagged with: spring
has title: Cannot apply class transformer without LoadTimeWeaver specified
score: 0
tagged with: openjpa
type: Question

junit-runner
tag name: junit-runner
type: Tag
tags question: http://stackoverflow.com/q/27101973

http://stackoverflow.com/a/27090299
has comment: http://stackoverflow.com/comment/42749390
has comment: http://stackoverflow.com/comment/43748407
has body: Disclaimer: I'm the Chairman of CAS and founder of CAS in the cloud (https://www.casinthecloud.com). I'm the creator of the pac4j library as well. It seems that Yahoo returns a 404 error page instead of getting the user profiel. It says: "Will be right back...". Does it work now?
has comment: http://stackoverflow.com/comment/42720602
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42903591
has comment: http://stackoverflow.com/comment/42888159
has comment: http://stackoverflow.com/comment/43349777
has comment: http://stackoverflow.com/comment/43391093
has comment: http://stackoverflow.com/comment/43732957
answers question: http://stackoverflow.com/q/27079056
has comment: http://stackoverflow.com/comment/43747968

http://stackoverflow.com/q/27037896
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27165037
accepted answer: http://stackoverflow.com/a/27165037
type: Question
has body: By no means am I a Jackon/JSON wizard, which is probably evident from the following issue I'm running into: I have 2 possible data structures I'm receiving. The first one is called amountTransaction: { "amountTransaction": { "clientCorrelator":"54321", "endUserId":"tel:+16309700001" } } Which is represented by the following Java object: @JsonIgnoreProperties(ignoreUnknown = true) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonTypeName(value = "amountTransaction") @JsonInclude(JsonInclude.Include.NON_NULL) public class AmountTransaction { private String clientCorrelator; private String endUserId; ... } However the amountTransaction object also appears as child element of the paymentTransactionNotification object: { "paymentTransactionNotification": { "amountTransaction": { "clientCorrelator": "54321", "endUserId": "tel:+16309700001" } } } ..which I thought would be represented by: @JsonIgnoreProperties(ignoreUnknown = true) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonTypeName(value = "paymentTransactionNotification") @JsonInclude(JsonInclude.Include.NON_NULL) public class PaymentTransactionNotification { private AmountTransaction amountTransaction; ... } Parsing the JSON with the amountTransaction object alone works fine. It's a pretty straightforward example of a WRAPPER_OBJECT. However when trying to parse the JSON for the paymentTransactionNotification, I'm getting an exception indicating that it can't properly deal with the amountTransaction as element of the paymentTransactionNotification: com.fasterxml.jackson.databind.JsonMappingException: Could not resolve type id 'clientCorrelator' into a subtype of [simple type, class com.sf.oneapi.pojos.AmountTransaction] Any thoughts on how I can properly annotate this so my code can properly deal with both stand alone, as well as encapsulated amountTransaction objects?
score: 10
has title: Nesting multiple levels of Jackson WRAPPER_OBJECTs
tagged with: jackson
has comment: http://stackoverflow.com/comment/42735565
tagged with: wrapper
answer count: 1
favorite count: 0
upvote count: 10
linked to: http://stackoverflow.com/q/48433294
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/42550963
type: Comment
has text: @shrbisht , yes when you add a new widget (buttons, edit text, etc) and you want to use it in you activity, first of all, the layout must be charged before you can bind it. And the binding `btn_sign_up = (Button) findViewById(R.id.btn_sign_up)` must be done always if you want to use the widget. If you don't do it, the app try to search the functionality and never will know it because doesn't have any reference to the widget.
comment on: http://stackoverflow.com/a/27002025
type: AnswerComment
score: 0

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

http://stackoverflow.com/q/27152279
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/42799478
type: Question
has comment: http://stackoverflow.com/comment/42799162
score: 0
tagged with: java
tagged with: swt
tagged with: eclipse
has body: I have two Composites. The first one works fine. I do a resize on the Composite and it behaves correctly. I am doing the same thing on the 2nd Composite but it disappears. Maybe something inside the Composite is causing this behavior? Code: @Override public void createPartControl(final Composite parent) { parent.setLayout(new RowLayout(SWT.VERTICAL)); final Composite composite = new Composite(parent, SWT.NONE); composite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { composite.setSize(parent.getSize()); } }); composite.setLayoutData(new RowData(622, 34)); composite.setLayout(new GridLayout(3, false)); Label lblPolicy = new Label(composite, SWT.NONE); lblPolicy.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblPolicy.setText("Policy:"); text = new Text(composite, SWT.BORDER); GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_text.widthHint = 566; text.setLayoutData(gd_text); Label lblNewLabel = new Label(composite, SWT.NONE); lblNewLabel.setText("X"); final Composite composite_1 = new Composite(parent, SWT.NONE); //FIXME THIS RESIZE CAUSES EVERYTHING IN THE COMPOSITE TO DISAPPEAR composite_1.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { composite_1.setSize(parent.getSize()); } }); composite_1.setLayout(new GridLayout(2, false)); composite_1.setLayoutData(new RowData(624, 166)); Group grpGrid = new Group(composite_1, SWT.NONE); grpGrid.setText("Grid"); GridData gd_grpGrid = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_grpGrid.widthHint = 180; gd_grpGrid.heightHint = 109; grpGrid.setLayoutData(gd_grpGrid); Label lblSegment = new Label(grpGrid, SWT.NONE); lblSegment.setText("Segment:"); Label lblLifecycle = new Label(grpGrid, SWT.NONE); lblLifecycle.setText("Lifecycle:"); Combo combo = new Combo(grpGrid, SWT.NONE); Combo combo_1 = new Combo(grpGrid, SWT.NONE); Group grpStore = new Group(composite_1, SWT.NON…
type: UnansweredQuestion
has title: Disappearing Composite on resize
answer count: 0
has comment: http://stackoverflow.com/comment/42799236

http://stackoverflow.com/comment/42716735
score: 0
type: AnswerComment
type: Comment
has text: Another quick question-since you specified that the new array will not be replacing the array in the main method-how do you think i should solve this problem? Since the method is supposed to be returning an int and its supposed to be printing out the intersection?
comment on: http://stackoverflow.com/a/27022867

http://stackoverflow.com/comment/42730904
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27114001
score: 0
has text: What is the type of that exception?

http://stackoverflow.com/q/27072340
upvote count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27652035
accepted answer: http://stackoverflow.com/a/27652035
type: Question
has body: I heard multiple times that putting gc.log on NFS volume is terrible idea because it might cause gc pauses to be longer. Is it still the case with current jdk (8u25)?
tagged with: performance
score: 4
has comment: http://stackoverflow.com/comment/42657525
tagged with: nfs
downvote count: 0
has title: Is gc.log writing asynchronous? safe to put gc.log on NFS mount?
answer count: 1
favorite count: 0
tagged with: garbage-collection

generics
tags question: http://stackoverflow.com/q/27028192
tags question: http://stackoverflow.com/q/27052384
tags question: http://stackoverflow.com/q/26992514
tags question: http://stackoverflow.com/q/27001554
tags question: http://stackoverflow.com/q/27038329
tags question: http://stackoverflow.com/q/27023185
tags question: http://stackoverflow.com/q/27142662
tags question: http://stackoverflow.com/q/27072961
type: Tag
tags question: http://stackoverflow.com/q/27098993
tags question: http://stackoverflow.com/q/27013301
tags question: http://stackoverflow.com/q/27148930
tags question: http://stackoverflow.com/q/27034325
tags question: http://stackoverflow.com/q/27049170
tags question: http://stackoverflow.com/q/27087698
tags question: http://stackoverflow.com/q/27044992
tags question: http://stackoverflow.com/q/27099994
tags question: http://stackoverflow.com/q/27075287
tags question: http://stackoverflow.com/q/27031244
tags question: http://stackoverflow.com/q/27132154
tags question: http://stackoverflow.com/q/27035554
tags question: http://stackoverflow.com/q/27077045
tags question: http://stackoverflow.com/q/27007993
tags question: http://stackoverflow.com/q/27088511
tags question: http://stackoverflow.com/q/27093068
tags question: http://stackoverflow.com/q/27116445
tags question: http://stackoverflow.com/q/27066063
tags question: http://stackoverflow.com/q/27133142
tags question: http://stackoverflow.com/q/27100474
tags question: http://stackoverflow.com/q/27085737
tags question: http://stackoverflow.com/q/27130394
tags question: http://stackoverflow.com/q/27031639
tags question: http://stackoverflow.com/q/27019889
tags question: http://stackoverflow.com/q/27137428
tags question: http://stackoverflow.com/q/27029606
tags question: http://stackoverflow.com/q/27107117
tags question: http://stackoverflow.com/q/27096728
tags question: http://stackoverflow.com/q/27045782
tags question: http://stackoverflow.com/q/27056988
tags question: http://stackoverflow.com/q/27146294
tags question: http://stackoverflow.com/q/27105299
tags question: http://stackoverflow.com/q/27070715
tag name: generics
tags question: http://stackoverflow.com/q/27076322
tags question: http://stackoverflow.com/q/27028400
tags question: http://stackoverflow.com/q/27041694
tags question: http://stackoverflow.com/q/27139861
tags question: http://stackoverflow.com/q/27129518

http://stackoverflow.com/q/27065393
score: 0
type: UnansweredQuestion
has body: I am trying to learn a source code of a tutorial I saw on the Internet (looks somewhat outdated). In the Applet class, I get an error from add(string, Component) part. The method add(String, Component) in the type Container is not applicable for the arguments (String, ChatClient) Why can't I use add in below code? import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; public class ClientApplet extends Applet { public void init() { String host = getParameter( "host" ); int port = Integer.parseInt( getParameter( "port" ) ); ChatClient client = new ChatClient(host,port); setLayout( new BorderLayout() ); add(client, "Center" ); } }
tagged with: java
has answer: http://stackoverflow.com/a/27065514
tagged with: eclipse
has title: Applet error: The method add(String, Component) in the type Container is not applicable
type: Question
answer count: 1
tagged with: applet

http://stackoverflow.com/q/27049004
score: 0
has answer: http://stackoverflow.com/a/30592468
has body: We are using IBM ContentManager v8. I am looking for the correct syntax to find all documents uploaded to CM, after a specific date. I would like to use the document or object creation time stamp, which is an internal attribute of every document uploaded to CM. Our backend database for CM is DB2. From the example, I see that we can use /&lt;item_type&gt; [ICMCHECKEDOUT/@ICMCHKOUTTS > "2013-11-20-12.00.00.000000"] for example, to find all documents that were checked out after the specified date. Is there an internal attribute for the time on which the object was added to CM.? If yes, what is the syntax.? FYI:- DKLobICM.getCreatedTimestamp() method returns the exact time the object was added to CM. But I need a way to use this timestamp in my query. Rgds, Raj.
type: UnansweredQuestion
has title: IBM ContentManager v8 - Query Syntax to search documents by its creation date
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/45940403
answer count: 2
tagged with: db2-content-manager

http://stackoverflow.com/comment/42704716
type: QuestionComment
has text: May be what you thrown at method level exception package is different than the expected package. Have a broad eye on the package name for PolicyException class!!
score: 0
comment on: http://stackoverflow.com/q/27100099
type: Comment

http://stackoverflow.com/comment/42747627
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27123156
has text: Post Your XML of layout and AndroidManifest
score: 0

http://stackoverflow.com/comment/42666707
type: AnswerComment
has text: @hagubear I understand this, the whole stream of comments is a misunderstanding. I copied an error owlstead made in the original post without realizing it while commenting on a different but related point and it made me look bad. Three people have been by to tell me so :(. It was an honest mistake, I swear!
type: Comment
comment on: http://stackoverflow.com/a/27077847
score: 0

http://stackoverflow.com/comment/42669965
comment on: http://stackoverflow.com/q/27079644
has text: @JamesKanze: The term "[jagged arrays](http://msdn.microsoft.com/en-us/library/2s05feca.aspx)" is used loosely to refer to arrays of arrays. There are a lot of articles confirming that jagged arrays perform faster than two-dimensional ones in C# due to optimizations by the compiler and the CLR; see [Skeet's post](http://stackoverflow.com/a/468873).
score: 0
type: QuestionComment
type: Comment

android
tags question: http://stackoverflow.com/q/27129060
tags question: http://stackoverflow.com/q/27047526
tags question: http://stackoverflow.com/q/27104094
tags question: http://stackoverflow.com/q/27077161
tags question: http://stackoverflow.com/q/27055646
tags question: http://stackoverflow.com/q/26996492
tags question: http://stackoverflow.com/q/27068653
tags question: http://stackoverflow.com/q/27148861
tags question: http://stackoverflow.com/q/27049754
tags question: http://stackoverflow.com/q/27134407
tags question: http://stackoverflow.com/q/27089945
tags question: http://stackoverflow.com/q/27028878
tags question: http://stackoverflow.com/q/26993759
tags question: http://stackoverflow.com/q/27134216
tags question: http://stackoverflow.com/q/27084901
tags question: http://stackoverflow.com/q/27102059
tags question: http://stackoverflow.com/q/27005501
tags question: http://stackoverflow.com/q/27012581
tags question: http://stackoverflow.com/q/27069061
tags question: http://stackoverflow.com/q/27088175
tags question: http://stackoverflow.com/q/27008471
tags question: http://stackoverflow.com/q/26992333
tags question: http://stackoverflow.com/q/27015751
tags question: http://stackoverflow.com/q/27041384
tags question: http://stackoverflow.com/q/27033650
tags question: http://stackoverflow.com/q/27127236
tags question: http://stackoverflow.com/q/27112715
tags question: http://stackoverflow.com/q/27071700
tags question: http://stackoverflow.com/q/26992383
tags question: http://stackoverflow.com/q/27109216
tags question: http://stackoverflow.com/q/27088173
tags question: http://stackoverflow.com/q/27086324
tags question: http://stackoverflow.com/q/27033509
tags question: http://stackoverflow.com/q/27103529
tags question: http://stackoverflow.com/q/26996698
tags question: http://stackoverflow.com/q/27118603
tags question: http://stackoverflow.com/q/27103877
tags question: http://stackoverflow.com/q/26995802
tags question: http://stackoverflow.com/q/27044660
tags question: http://stackoverflow.com/q/27108344
tags question: http://stackoverflow.com/q/27140849
tags question: http://stackoverflow.com/q/27034010
tags question: http://stackoverflow.com/q/27081413
tags question: http://stackoverflow.com/q/26994220
tags question: http://stackoverflow.com/q/27028423
tags question: http://stackoverflow.com/q/27038197
tags question: http://stackoverflow.com/q/27133325
tags question: http://stackoverflow.com/q/27136037
tags question: http://stackoverflow.com/q/27064878
tags question: http://stackoverflow.com/q/27040353
tags question: http://stackoverflow.com/q/27034897
tags question: http://stackoverflow.com/q/27017233
tags question: http://stackoverflow.com/q/27011828
tags question: http://stackoverflow.com/q/27102478
tags question: http://stackoverflow.com/q/27087242
tags question: http://stackoverflow.com/q/27067114
tags question: http://stackoverflow.com/q/27118276
tags question: http://stackoverflow.com/q/27148599
tags question: http://stackoverflow.com/q/27078825
tags question: http://stackoverflow.com/q/27012537
tags question: http://stackoverflow.com/q/27107016
tags question: http://stackoverflow.com/q/27075280
tags question: http://stackoverflow.com/q/27083034
tags question: http://stackoverflow.com/q/27130840
tags question: http://stackoverflow.com/q/27100634
tags question: http://stackoverflow.com/q/27144581
tags question: http://stackoverflow.com/q/27088653
tags question: http://stackoverflow.com/q/27053628
tags question: http://stackoverflow.com/q/27045009
tags question: http://stackoverflow.com/q/27092699
tags question: http://stackoverflow.com/q/27085561
tags question: http://stackoverflow.com/q/27001971
tags question: http://stackoverflow.com/q/27131479
tags question: http://stackoverflow.com/q/26998390
tags question: http://stackoverflow.com/q/27144253
tags question: http://stackoverflow.com/q/27086690
tags question: http://stackoverflow.com/q/27033580
tags question: http://stackoverflow.com/q/27115967
tags question: http://stackoverflow.com/q/27035269
tags question: http://stackoverflow.com/q/27010898

http://stackoverflow.com/comment/42737648
type: Comment
type: QuestionComment
score: 4
has text: Why would changing each element in the array be "a waste of time" and "take forever"? Just try it.
comment on: http://stackoverflow.com/q/27117712

http://stackoverflow.com/comment/42729609
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27113327
score: 1
has text: You shouldn't use `equals` in the way you've described. It breaks the contract of [`Comparator#equals`](https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html#equals-java.lang.Object-), which should only return true if the ordering is the same.

http://stackoverflow.com/q/27011921
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27011967
tagged with: jtextfield
accepted answer: http://stackoverflow.com/a/27011967
tagged with: java
possible better answer: http://stackoverflow.com/a/27012013
has answer: http://stackoverflow.com/a/27012013
type: AnsweredQuestion
has title: Outputting the value from a JTextField using .getText()
has body: I'm setting up a simple program that collects your name and then returns it in the console. The window opens successfully but when I enter text into 'jTextFieldPlayerName' and press 'continue' The console prints 'Your name is: null'. I am trying to make the console print out what you entered in 'jTextFieldPlayerName' (ex. Your name is: CrashDive) rather than 'Your name is: null'. -Thanks package bin; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class main extends JPanel implements ActionListener { protected JLabel text1; protected JButton continue; protected JTextField jTextFieldPlayerName; protected String playerName; public main() { text1 = new JLabel("&lt;html&gt;&lt;center&gt;Before we can start we need to know your name.&lt;br&gt;&lt;html&gt;"); startText1.setVerticalTextPosition(JLabel.TOP); startText1.setHorizontalTextPosition(JLabel.CENTER); jTextFieldPlayerName = new JTextField(); jTextFieldPlayerName.setPreferredSize(new Dimension(300,20)); continue = new JButton("Continue"); continue.setMnemonic(KeyEvent.VK_D); continue.addActionListener(this); continue.setVerticalTextPosition(AbstractButton.CENTER); continue.setHorizontalTextPosition(AbstractButton.CENTER); add(text1); add(jTextFieldPlayerName); add(continue); String playerName = jTextFieldPlayerName.getText(); } public void actionPerformed(ActionEvent evt) { Object src = evt.getSource(); if (src == startText1Continue &amp;&amp; jTextFieldPlayerName.getText().length() &gt; 0) { System.out.println("Your name is: " +playerName); } } private static void createAndShowGUI() { JFrame frame = new JFrame("Test Game"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); main newContentPane = new main(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); frame.setSize(1400, 700); frame.setVisible(true); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }

http://stackoverflow.com/comment/42737176
type: QuestionComment
type: Comment
score: 1
has text: I can't find anything that looks obviously wrong. However, an array of 100000 may too many inversions to fit in an it. Maybe try using long instead?
comment on: http://stackoverflow.com/q/27117379

http://stackoverflow.com/a/27109215
has comment: http://stackoverflow.com/comment/42722066
answers question: http://stackoverflow.com/q/27108501
has comment: http://stackoverflow.com/comment/42723812
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/42726022
has body: Of course after Network.clientCommand is null, nothing more is sent — that's what you told it to do: if((receive = receiveStream.readLine()) != null) { System.out.println(receive); } According to the JavaDoc, readLine() returns A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached Not "null if there's a pause in transmission". If it hasn't yet seen a full line, or the end of the stream (socket disconnection), well, then it's not done yet. It waits until it gets the full line of input before it goes to the next line of your code. But how do you know if you should wait for a message to come in, or send out the next one? You can't. You can't depend on when or if anything will arrive from the other side. What happens when both sides have nothing to send? They both start waiting to receive. What happens when one side gets something new to send? Well, once it receives something, it'll send it. But that never happens! What you can do, is call readLine() in a separate thread. See the JavaDocs for Thread and the Java Tutorial Lesson "Concurrency". And if you're using Swing for your GUI, also see the Java Tutorial Lesson "Concurrency in Swing".
has comment: http://stackoverflow.com/comment/42753677
score: 2
accepted answer of: http://stackoverflow.com/q/27108501
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27034183
type: Question
has answer: http://stackoverflow.com/a/27046407
tagged with: mule
tagged with: mule-studio
score: 0
has answer: http://stackoverflow.com/a/27052864
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42623366
has title: Unable to start mule-standalone-3.5.0 server in my local system
has body: I am unable to start mule standalone server 3.5.0. in my Windows7 PC. My java version installed is "1.6.0_45" and it is 64 bit. I have set the Path, JAVA_HOME, MULE_HOME environment variables in system settings. While starting the mule server by running mule.exe from bin folder I am getting the following error. Can you please anyone suggest me to get rid of this error. C:\Applications\mule-standalone-3.5.0\bin&gt;mule MULE_HOME is set to C:\Applications\mule-standalone-3.5.0 Running in console/foreground mode by default, use Ctrl-C to exit... --&gt; Wrapper Started as Console Launching a JVM... java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Exception in thread "main" JVM exited while loading the application. CTRL-C trapped. Shutting down. &lt;-- Wrapper Stopped Terminate batch job (Y/N)?
tagged with: java

http://stackoverflow.com/comment/42555660
comment on: http://stackoverflow.com/q/27014776
has text: Make sure you have a proper web.xml. Check the version, it should be at least 2.5...
score: 2
type: Comment
type: QuestionComment

cordova
tags question: http://stackoverflow.com/q/27065309
tag name: cordova
tags question: http://stackoverflow.com/q/27102958
tags question: http://stackoverflow.com/q/27121027
type: Tag
tags question: http://stackoverflow.com/q/27079019

http://stackoverflow.com/comment/42802579
type: AnswerComment
type: Comment
has text: Hey Petr, it was resolved. i restarted my wifi which caused change in IP address... Above is the correct solution for this. Thanks Man :) !
comment on: http://stackoverflow.com/a/27142383
score: 0

http://stackoverflow.com/a/27055400
has body: Try a int returning method that modifies x instead of a void method that just affects the s variable, like this: class Test { static int s; public static void main (String [] args) { Test p = new Test(); p.start(); System.out.println(s); } void start() { int x = 7; x = twice(x); System.out.print (x + " "); } int twice (int value) { int result = value* 2; s = result; return result; } } Since java is pass-by-value for primitives (such as int, boolean, etc) and pass-by-reference for Objects you must return something, take a look at this blog that explains some more about that
answers question: http://stackoverflow.com/q/27055269
score: 0
type: Answer

http://stackoverflow.com/q/27083124
has title: Using Scanner to display entire line if the line contains any part of a string match (Java)
tagged with: file-search
type: AnsweredQuestion
tagged with: java
tagged with: computer-forensics
has answer: http://stackoverflow.com/a/27083320
type: Question
answer count: 1
tagged with: arraylist
score: 0
accepted answer: http://stackoverflow.com/a/27083320
has body: so I am working on this a project that analyzes hex dumps for specific file signatures. The problem I am having is when trying to analyze dumps that are large in size 16+ GB, I get a OutOfMemoryError: Java heap space error. So my thought is to redesign the algorithm I am using. Right now my code looks something similar to: public class Test { private static ArrayList&lt;String&gt; JPGHeaders = new ArrayList&lt;String&gt;(); private static ArrayList&lt;String&gt; JPGTrailers = new ArrayList&lt;String&gt;(); private static ArrayList&lt;String&gt; entireTextFile = new ArrayList&lt;String&gt;(); public static void main (String[] args) { Scanner scanner = new Scanner(new File("C:\\HexAnalyser\\HexDump\\fileTest.txt")); while (scanner.hasNextLine()) { entireTextFile.add(scanner.nextLine()); } for (String line : entireTextFile) { if(line.contains(Constants.JPGHEADER)) { JPGHeaders.add(line); } if(line.contains(Constants.JPGTRAILER)) { JPGTrailers.add(line); } } } } so it's adding the entire file to the entireTextFile ArrayList and then searching that ArrayList for the specific file headers and trailers. For those of you who don't know what a typical hex dump looks like, its similar to: 0012be0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0012bf0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0012c00: ffd8 ffe0 0010 4a46 4946 0001 0201 0050 ......JFIF.....P 0012c10: 0050 0000 ffed 166e 5068 6f74 6f73 686f .P.....nPhotosho 0012c20: 7020 332e 3000 3842 494d 03ed 0000 0000 p 3.0.8BIM...... 0012c30: 0010 0050 0000 0001 0001 0050 0000 0001 ...P.......P.... 0012c40: 0001 3842 494d 040d 0000 0000 0004 0000 ..8BIM.......... 0012c50: 002d 3842 494d 03f3 0000 0000 0008 0000 .-8BIM.......... since the header for a JPEG is "ffd8 ffe0", the only line I would want to be added to my JPGHeaders ArrayList is : 0012c00: ffd8 ffe0 0010 4a46 4946 0001 0201 0050 ......JFIF.....P I know this is similar to grep in Linux, but I'm doing this for a java project done in eclips…
tagged with: hexdump

http://stackoverflow.com/q/26998680
has answer: http://stackoverflow.com/a/26999028
type: Question
tagged with: java
has body: What are the main differences between using finish() and super.finish() in Java? When can/should you use one over the other?
has answer: http://stackoverflow.com/a/26998731
score: 0
answer count: 2
tagged with: difference
has comment: http://stackoverflow.com/comment/42527727
tagged with: android
accepted answer: http://stackoverflow.com/a/26998731
has title: Difference between finish() and super.finish() in Java?
type: AnsweredQuestion
tagged with: super
possible better answer: http://stackoverflow.com/a/26999028

http://stackoverflow.com/a/27078458
accepted answer of: http://stackoverflow.com/q/27078118
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42668564
score: 1
has body: I am posting this as an answer as I cannot comment (&lt;50 rep). It would a lot more helpful if you could post only the relevant part of the code, since it makes it easier for us guys to find a problem. Also, I would suggest using BoxLayout if you just want to display a single column instead of Grid Layout(from your question). Also, since sideWindow is a JFrame I don't think it can be added to another JFrame using the add method. To do that, make sideWindow a JPanel and make the necessary changes. Or if you want it to open in a new window, make a new class for it and then call it's constructor to start it up.
has comment: http://stackoverflow.com/comment/76008080
has comment: http://stackoverflow.com/comment/42668530
answers question: http://stackoverflow.com/q/27078118
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27016890
has answer: http://stackoverflow.com/a/27017292
tagged with: java
has body: I would like to invoke a new activity the moment the user enter exactly 4 digits of code into an editText box. how can i catch the exact moment the user enter the 4 and last digit and immediately invoke an action that checks if the code is valid. Thanks, Gil.
type: Question
accepted answer: http://stackoverflow.com/a/27017292
has answer: http://stackoverflow.com/a/27017008
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27017143
favorite count: 0
has answer: http://stackoverflow.com/a/27016966
upvote count: 2
answer count: 5
has title: how to invoke a new activity the moment the user enter exactly 4 digits of code into an editText box
tagged with: android
possible better answer: http://stackoverflow.com/a/27016966
has answer: http://stackoverflow.com/a/27017055
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42559416

http://stackoverflow.com/q/26995802
tagged with: android
tagged with: webview
answer count: 0
has body: My first screen is an activity to fill up a server information, once the user saves that information , a webview will be launched with external webpage related to that server for authentication purpose. User provides login details and if the authentication is successful, I want to show a different screen which I want to handle in postlogin . Is there a way to detect that user has finished authentication in webview? This is what I am trying in my code public void onCreate(Bundle savedInstanceState){ this.setContentView(R.layout.launchwv); url = getIntent().getStringExtra("loginURL"); urlWebView = (WebView) this.findViewById(R.id.browserWebview); urlWebView.setWebViewClient(new WebViewClient(){ @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error){ handler.proceed(); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url){ if(url.contains(getResources().getString(R.string.loginTitle))) { Uri uri = Uri.parse(url); String result = "SampleString"; mIntent.putExtra("return_value", result); setResult(RESULT_OK, mIntent); finish(); return true; } return false; } }); urlWebView.getSettings().setBuiltInZoomControls(true); urlWebView.getSettings().setJavaScriptEnabled(true); urlWebView.loadUrl(url); } public void onFinish(View v){ //Read result string from mIntent and do Post login activity }
has comment: http://stackoverflow.com/comment/42522278
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42526292
has title: calling Post Login activity from webview
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42640883
has text: It doesn't help that "today" isn't a point in time. A short but complete program demonstrating the problem would make it a lot easier to help you. It's also not clear *how* you're using `Time` objects...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27063409
score: 0

http://stackoverflow.com/q/27110563
favorite count: 0
score: 19
has answer: http://stackoverflow.com/a/27110703
has answer: http://stackoverflow.com/a/27110776
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27110684
has answer: http://stackoverflow.com/a/67301586
has comment: http://stackoverflow.com/comment/42726295
type: Question
has answer: http://stackoverflow.com/a/27110677
possible better answer: http://stackoverflow.com/a/67301586
has answer: http://stackoverflow.com/a/27110684
has comment: http://stackoverflow.com/comment/93448772
upvote count: 19
tagged with: substring
has answer: http://stackoverflow.com/a/27110930
answer count: 7
has title: How can I check if a string has a substring from a List?
has answer: http://stackoverflow.com/a/27110857
tagged with: iteration
has body: I am looking for the best way to check if a string contains a substring from a list of keywords. For example, I create a list like this: List&lt;String&gt; keywords = new ArrayList&lt;&gt;(); keywords.add("mary"); keywords.add("lamb"); String s1 = "mary is a good girl"; String s2 = "she likes travelling"; String s1 has "mary" from the keywords, but string s2 does not have it. So, I would like to define a method: boolean containsAKeyword(String str, List&lt;String&gt; keywords) Where containsAKeyword(s1, keywords) would return true but containsAKeyword(s2, keywords) would return false. I can return true even if there is a single substring match. I know I can just iterate over the keywords list and call str.contains() on each item in the list, but I was wondering if there is a better way to iterate over the complete list (avoid O(n) complexity) or if Java provides any built-in methods for this.

http://stackoverflow.com/q/27004819
accepted answer: http://stackoverflow.com/a/27094014
possible better answer: http://stackoverflow.com/a/27005742
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has body: Please help me, I'm having serious trobules with Eclipse for the second time. I'm following a guide and in these last days my Eclipse used to work fine (and was heavy 600 mb), now after the updates I did recommended by the guided, it downloaded a lot of things for hours and my folder now is 12.6 GBs (and it's pretty uncofortable since I'm on a not too large SSD). The problem is that the old ADT worked, after the update every project gives errors, like there is no Android SDK. The console gives me this error [2014-11-18 22:37:33 - DDMS] DDMS files not found: C:\Users\Ruggiero\Desktop\Ruggiero\android_dev_environment\sdk\tools\hprof-conv.exe If it can help you, when I run Eclipse it shows me this error message Now, the most obvious thing would be "just press Check for updates". When I do it, it says me there are no updates. So I go for "Install new software" and after I go to the link (official Google link) and try to install the updates it gives me this error error2 http://s7.postimg.org/h5r1gaa63/eclipseerror2.png] Please do not flag as duplicate as I already searched on the web and StackOverflow too and even if I found similar troubles, no one was equal or really close to mine.
tagged with: adt
has title: ADT Eclipse SDK troubles - No DDMS found
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27094014
has answer: http://stackoverflow.com/a/27005742
has answer: http://stackoverflow.com/a/27006244
tagged with: android

http://stackoverflow.com/comment/42745598
comment on: http://stackoverflow.com/q/27121651
has text: @, so what do you mean `getMigrationItems` is not called? Have you log a break point inside?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/27083589
tagged with: file
type: Question
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/27083617
has body: I want to be able to read four lines from a txt file each time a button is pressed until there are no more lines to be read. When I press the button the first time, the first four lines are read. The problem is that when I press the button the second time it won't read the next four lines. The txt file looks like this one two three four five six seven eight should I not be creating a BufferedReader every time I press the button? public void fnext() { try { BufferedReader br = new BufferedReader(new FileReader(fr)); if(!br.ready()) { br.close(); JOptionPane.showMessageDialog(null, "No more data"); } text = br.readLine() + " "; text += br.readLine() + " "; text += br.readLine() + " "; text += br.readLine() + " "; br.readLine(); p.setText(text); } catch (IOException ex) { Logger.getLogger(FileHandler.class.getName()).log(Level.SEVERE, null, ex); } }
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42676365
upvote count: 2
accepted answer: http://stackoverflow.com/a/27083617
has title: How to read lines from txt file after button press in Java
tagged with: jbutton
type: AnsweredQuestion
score: 2
tagged with: java

dbvisualizer
tag name: dbvisualizer
type: Tag
tags question: http://stackoverflow.com/q/27096363

http://stackoverflow.com/q/27003065
has answer: http://stackoverflow.com/a/27004663
accepted answer: http://stackoverflow.com/a/27004663
has body: In cwac-camera, I can override useFrontFacingCamera() to get either of the cameras on my device. @Override public boolean useFrontFacingCamera() { } This is working fine, as long as I configure it before the host is built. But once the host is built and the preview is started, the event is not raised anymore and the camera therefore does not change. What is the correct way to switch the camera while the preview is running? I have tried to use restartPreview() which does not work because the preview is not actually stopped when restartPreview() is called. I cannot call stopPreview() because it is private. I saw there is a PreviewStrategy interface which might be there to cater for this functionality, but it's not documented and I don't understand how it's used. Sure I could tear everything down and set it up from scratch, but I guess that's not the way it should be done. Can anybody shed light please. PS: This is not a complaint about the documentation of the library. Not many other libraries are documented so thoroughly. It's just missing and/or I am to stupid to use it ;-(
score: 0
answer count: 1
tagged with: cwac-camera
tagged with: commonsware-cwac
tagged with: android
type: AnsweredQuestion
tagged with: java
has title: Attach a different camera to host while it is running
type: Question

http://stackoverflow.com/q/27139100
has answer: http://stackoverflow.com/a/27794096
tagged with: java
upvote count: 11
type: Question
has answer: http://stackoverflow.com/a/31333768
tagged with: spring-batch-admin
favorite count: 0
tagged with: spring-batch
answer count: 5
possible better answer: http://stackoverflow.com/a/31333768
has body: According to the documentation spring batch admin is very easy to embed into the existing application. Simply copying web.xml and index.jsp then adding needed dependencies is enough getting it to work. But if I want to use it in an existing spring boot project it getting worse. According to this example the configuration is a bit hacky but it works. UNTIL I try to use @EnableBatchProcessing annotation in my configuriton bean. Then I get the following exception. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobBuilders' defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.batch.core.configuration.annotation.JobBuilderFactory org.springframework.batch.core.configuration.annotation.AbstractBatchConfiguration.jobBuilders() throws java.lang.Exception] threw exception; nested exception is java.lang.ClassCastException: org.springframework.batch.core.repository.support.JobRepositoryFactoryBean$$EnhancerBySpringCGLIB$$49fa0273 cannot be cast to org.springframework.batch.core.repository.JobRepository at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:597) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1095) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:990) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) a…
has title: Is there a way to integrate spring-batch-admin and spring-boot properly?
downvote count: 0
has answer: http://stackoverflow.com/a/30301509
has answer: http://stackoverflow.com/a/27153572
tagged with: spring
accepted answer: http://stackoverflow.com/a/27153572
score: 11
has comment: http://stackoverflow.com/comment/50151549
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28999490

http://stackoverflow.com/comment/42665511
score: 0
type: Comment
has text: @user3323950 You're welcome. What was the error? A for loop without initialization and increment (i.e. for(;condition;)) should be equivalent to a while loop. I accepted your edit anyway, since it's clearer this way.
type: AnswerComment
comment on: http://stackoverflow.com/a/27077485

http://stackoverflow.com/q/27147660
accepted answer: http://stackoverflow.com/a/27163192
linked to: http://stackoverflow.com/q/4312553
type: AnsweredQuestion
tagged with: maven
type: Question
upvote count: 12
has body: I have a project with two seperate modules that uses sqlline and another library(say OtherLib) that depends on jline. However on different versions. External Libraries Module1 uses Sqlline depends on jline 2.10 Module2 uses OtherLib depends on jline 0.9.94 And the two versions are incompatible. Therefore I have set the classpaths such that Module1 will search in $HOME/lib/module1 folder first and Module2 in $HOME/lib folder first. Is there a way to specify maven to download the artifact to a source directory first(say ../resources/lib) and then copy it to package during packaging time in assembly.xml? I know that for copying from source directory the following code can be used. ../resources/lib ${HOME}/lib/module1 755 644 *.jar Also to get maven to download the dependency I can use (for Module2) <dependencySets> false ${HOME}/lib 755 644 jline:jline:jar:0.9.94 <dependencySets> How can I make sure jline:jline:jar:2.10 is downloaded to ../resources/lib folder first?
has answer: http://stackoverflow.com/a/27163192
has answer: http://stackoverflow.com/a/27151367
has comment: http://stackoverflow.com/comment/42791632
tagged with: java
has comment: http://stackoverflow.com/comment/42792263
score: 12
possible better answer: http://stackoverflow.com/a/27151367
answer count: 2
has comment: http://stackoverflow.com/comment/42795333
downvote count: 0
favorite count: 0
has title: Maven project depending on two versions of the same artifact

http://stackoverflow.com/comment/42536394
has text: @ajb computerOrder collection his made up of objets from the Product class. For example ram extends computerParts . ComputerParts extends Product. And computerOrder had ram stored in it
comment on: http://stackoverflow.com/q/27002415
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42772348
score: 0
type: AnswerComment
type: Comment
has text: When I try out this code, the only output I get to the console after having passed the correct parameters into the method and having printed it is this: practicalSessions_24_11_2014.Student@15db9742 Am I doing something wrong?
comment on: http://stackoverflow.com/a/27136902

http://stackoverflow.com/a/27031270
answers question: http://stackoverflow.com/q/27031228
downvote count: 0
has body: Call it.remove() instead of box.remove(p).
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/a/27047987
type: Answer
has body: You state: I have overridden the equals method in my object. You need to also override the hashCode() method, and its contract should be that if two objects are equal, then their hashCodes also must be equal, although the converse is not necessarily true in that it is possible and allowed for two objects to have the hash code and not be equal, although this is something that should be avoided if possible.
score: 8
has comment: http://stackoverflow.com/comment/42614042
has comment: http://stackoverflow.com/comment/42614079
answers question: http://stackoverflow.com/q/27047978
downvote count: 0
upvote count: 8

http://stackoverflow.com/comment/42780132
type: QuestionComment
has text: I added OS and JVM info as well
comment on: http://stackoverflow.com/q/27137494
score: 0
type: Comment

http://stackoverflow.com/a/27057606
type: Answer
has body: You can try what the Vaibs suggested in the linked answer, but for that you would have to move the root-context.xml in src/main/resources. If you want to keep it in place, load it like this ConfigurableApplicationContext ap = new ClassPathXmlApplicationContext("file:src/main/webapp/WEB-INF/spring/root-context.xml");
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27056319
answers question: http://stackoverflow.com/q/27056319
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27040951
has comment: http://stackoverflow.com/comment/42602031
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42601148
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27078494
has body: I have a service class which has a method: public void setDataSource(DynaFormReportFilterBean filterBean,Map parameterValues,List<Map<String,Object>> dynaFormStatusList) I have created an Aspect class using @Aspect and i am using @AfterReturning("execution(* org.bio.reports.service.jasper.DynaFormDataSourceReportService.setDataSource(..)) && args(bean,parameterValues,dynaFormStatusList)") to call a method public void afterReportAction(JoinPoint jp, final AbstractBean bean, final Map parameterValues, final List<Map<String, Object>> dynaFormStatusList) {//----Code here------//}` When i run the code the Aspect class is not getting called. here is the application-context entry: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <aop:aspectj-autoproxy> <aop:include name="addressBookAuditLogAspect" /> <aop:include name="inventoryAuditLogAspect" /> <aop:include name="dynaAuditLogAspect" /> <aop:include name="questionAuditLogAspect" /> <aop:include name="reportAuditLogAspect" /> </aop:aspectj-autoproxy> <property name="corePoolSize" value="10" /> <property name="maxPoolSize" value="25" /> <property name="queueCapacity" value="100" /> <property name="taskExecutor" ref="businessLogExecutor" /> <property name="bioExtensionDataDAO" ref="bioExtensionDataDAO" /> <property name="taskExecutor1" r…
has comment: http://stackoverflow.com/comment/42601290
tagged with: java
has title: Aspect not getting called from Service class
type: Question
tagged with: aop

http://stackoverflow.com/a/27136287
has body: If you're always using the same domain, you don't need regular expressions. str = str.replace("http://myHost:8080", "");
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27136217

http://stackoverflow.com/q/27041182
downvote count: 0
tagged with: securitymanager
favorite count: 0
has body: If I set a security manager, for example: private static class SecManager extends SecurityManager { ... } With: System.setSecurityManager(new SecManager()); Which permission can I use (or rather prevent), to stop code further down the line setting the security manager again, with elevated permissions. I am looking for a method like: private static class SecManager extends SecurityManager { @Override public void checkSetSecurityManager(SecurityManager manager){ throw new AccessControlException("Not allowed to set new security Manager); } } But of course, the checkSetSecurityManager doesn't exist, so i'm not sure exactly what to look for or how to deny that permission. I would like to use the security manager to allow me to run some untrusted code, but I obviously don't want that code to be able to set it's own security manager. I did consider doing this at the OS level (create a new user for each bit of code), but that seems a little overkill. Instead, I run my own java main, which sets a security manager, then runs the untrusted code within the same JVM. I have made sure their code cannot start new processes already (as this would circumvent the security manager), but I need to make sure they cannot override the existing security manager. I also use checkWrite and checkRead to make sure the code can only read/write in a certain dir. Any help is much appreciated. Thanks,
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27041412
type: Question
has title: Security manager java stop override
accepted answer: http://stackoverflow.com/a/27041412
score: 4
upvote count: 4
answer count: 1

http://stackoverflow.com/comment/111962124
has text: This is also a Solution but it does not seem to work always. I had even casted my ids as varchar but the issue did not go away until I didn't use @Ebrahim Amini Sharifi Solution
type: Comment
comment on: http://stackoverflow.com/a/28980937
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42705849
type: AnswerComment
has text: k means Use or do not use kernel density
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27099338

http://stackoverflow.com/comment/42779958
comment on: http://stackoverflow.com/q/27141310
type: QuestionComment
has text: The Exception class already has a `getMessage()` method. Why not just use it?
score: 1
type: Comment

http://stackoverflow.com/q/27071128
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
linked to: http://stackoverflow.com/q/8899323
has answer: http://stackoverflow.com/a/27071618
type: Question
linked to: http://stackoverflow.com/q/12545744
accepted answer: http://stackoverflow.com/a/27071618
has title: Draw and move a circle in Java
answer count: 2
tagged with: user-interface
downvote count: 0
possible better answer: http://stackoverflow.com/a/27071403
favorite count: 0
has answer: http://stackoverflow.com/a/27071403
upvote count: 2
has body: I'm using Swing to create a small GUI in Java. All I am trying to get it to do is take an ArrayListof Circles and draw them. I've run into two problems: 1) I have to call my draw method repeatedly before it draws the circle. If I just call my draw method once nothing happens, I get a blank drawing. If I call it in a loop that runs for less than 30 milliseconds it only draws the first of two circles that I want to draw. Finally, if I call it for more than 30 milliseconds it draws both circles I am trying to draw. and 2) When I move one of the circles, I get a "flicker" on the drawing. I'm not too familiar with Swing programming. I've looked at sample code and watched a few videos - and what I have looks right to me. But I figure I must have messed something up, because it doesn't look like this in the videos I've watched. Here is my GUI class: package gui; import draw.*; import java.util.List; import javax.swing.*; public class GUI extends JFrame { private CirclePainter drawingBoard = new CirclePainter(); public GUI() { setSize(500, 500); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setVisible(true); this.add(drawingBoard); drawingBoard.setVisible(true); } public void draw(List&lt;Circle&gt; circles) { drawingBoard.paintComponent(drawingBoard.getGraphics(), circles); } } my CirclePainter class package gui; import draw.Circle; import javax.swing.*; import java.awt.*; import java.util.List; class CirclePainter extends JPanel { public void paintComponent(Graphics graphics, List&lt;Circle&gt; circles) { super.paintComponent(graphics); for(Circle circle : circles) graphics.fillOval(circle.getX(), circle.getY(), circle.getRadius() * 2, circle.getRadius() * 2); } } EDIT: redacted some code since this is for a school project. The remaining code should be enough for someone visiting in the future to still understand the question.
tagged with: jframe
tagged with: swing

http://stackoverflow.com/comment/42675738
score: 2
has text: Youre attempting to replace a `String` literal "null" in `fileData` which is not the same as `null` - the lack of an assigned value. Even if `null` was used it would not work as an `NPE` would result...
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27083165

http://stackoverflow.com/q/27055350
tagged with: java
tagged with: swing
type: Question
has body: So im trying to display a grid of bitmap tiles on a window. I have a for loop that is populating the array of JLabels and using .setLocation() to define their position. The problem is that when the frame is displayed, they seem to totally ignore the location that ive set for them. Heres my code so far. public static void main(String[] args) throws IOException { JFrame mainFrame = new JFrame("game.demo"); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); mainFrame.setSize(512, 512); JPanel mainPanel = new JPanel(); BufferedImage desTile16Image = ImageIO.read(new File("assets//desert_tile_16x.bmp")); ImageIcon desTile16Icon = new ImageIcon(desTile16Image); JLabel[][] map = new JLabel[32][32]; for (int x = 0; x &lt; 32; x++) { System.out.print(x + "\n"); map[x][0] = new JLabel(); map[x][0].setIcon(desTile16Icon); map[x][0].setLocation(x * 16, 0); mainPanel.add(map[x][0]); } //mainFrame.pack(); mainFrame.add(mainPanel); mainFrame.setContentPane(mainPanel); mainFrame.setVisible(true); } any help would be greatly appreciated, thanks in advance.
score: 0
has answer: http://stackoverflow.com/a/27055387
answer count: 1
has title: Using .setLocation() dosent seem to be working for JLabel
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/q/27066001
accepted answer: http://stackoverflow.com/a/27092001
has body: I'm trying to wrap my head around Hystrix and after reading their docs, still have a question about its usage patterns. For one, I don't understand the use case for when to use their Asynchronous execution vs. their Reactive execution. The only difference I can see is that Asynchronous execution is always non-blocking, whereas Reactive can either be blocking or non-blocking. So I guess my real question is: What's the difference between Synchronous and Blocking Reactive execution?; and What's the difference between Asynchronous and Non-Blocking Reactive execution?
score: 9
type: Question
has title: Hystrix Execution Patterns
tagged with: hystrix
tagged with: reactive-programming
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/27092001
upvote count: 9
tagged with: fault-tolerance
type: AnsweredQuestion
downvote count: 0
tagged with: asynchronous
favorite count: 0

http://stackoverflow.com/comment/67231437
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27102600
has text: @Elipticalview Thanks for mentioning :)
score: 0

http://stackoverflow.com/q/27065814
linked to: http://stackoverflow.com/q/26987791
favorite count: 0
has body: I've been tasked with having the user input 10 numbers and then ultimately outputting the averages of both the even and odd numbers separately. So I'm really close to figuring this one out, but when I run the code I get the error java.lang.ArithmeticException: / by zero. I know what this means, but I can't figure out a way to fix it. Even when I put the even/oddAverage calculations within the Averages method it's still not correct. Here's the code: public class Averages { static int[] numbers = new int[10]; static int i = 0; static int oddSum = 0; static int evenSum = 0; static int oddCount = 0; static int evenCount = 0; static double oddAverage = 0; static double evenAverage = 0; public static void Averages() { for (i = 0; i &lt; numbers.length; i++) { if (i % 2 == 0) { evenCount++; evenSum = evenSum + i; } else { oddCount++; oddSum = oddSum + i; } } } public static void getEven() { evenAverage = evenSum / evenCount; System.out.println("\nThe average of the even numbers is: " + evenAverage + "."); } public static void getOdd() { oddAverage = oddSum / oddCount; System.out.println("\nThe average of the odd numbers is: " + oddAverage + "."); } } And the main: import java.util.Scanner; public class AveragesTester { public static void main (String [] args) { Scanner input = new Scanner(System.in); int i = 0; System.out.println("\nPlease input " + 10 + " numbers."); for (i = 0; i &lt; Averages.numbers.length; i++){ Averages.numbers[i] = input.nextInt(); } Averages.getEven(); Averages.getOdd(); } } Before you mark this as a duplicate, I attempted to fix the code using the one mentioned above this question to no avail.
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/26987791
has comment: http://stackoverflow.com/comment/42645187
has comment: http://stackoverflow.com/comment/42645254
tagged with: java
has title: Averages of Evens/Odds using Array
upvote count: 1
tagged with: methods
downvote count: 1
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/27065880
score: 0
answer count: 1

http://stackoverflow.com/q/27027104
has comment: http://stackoverflow.com/comment/42577510
has title: How can I create a method without parameters in java?
type: Question
has answer: http://stackoverflow.com/a/27027150
score: -1
downvote count: 2
has comment: http://stackoverflow.com/comment/42577332
answer count: 3
has comment: http://stackoverflow.com/comment/42577394
has answer: http://stackoverflow.com/a/27027222
upvote count: 1
has comment: http://stackoverflow.com/comment/42577306
has body: I've been trying to write some code in java and I have some lines that I write in a lot of places(exactly the same). I want to replace those lines everywhere with a method. Is that possible ? For example public fill() { x=x+1; if( x == sizeX){ y=y-1; x=0; } } Those variables x,y,size are defined outside the method. I also tried with public void , void and a lot of other combinations that I could find. Is it possible what I am trying to do in java ?
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42577642
has comment: http://stackoverflow.com/comment/42577349
has comment: http://stackoverflow.com/comment/42577450
favorite count: 0
has answer: http://stackoverflow.com/a/27027255

http://stackoverflow.com/q/27083205
tagged with: bufferedreader
duplicate of: http://stackoverflow.com/q/1625234
has answer: http://stackoverflow.com/a/27083256
has body: I am in trouble finding how to read a text file and then write a new line after the ones that were before on the file. Like (current file) 1234 Albert (edited file) 1234 Albert 1223 Dave for this, i am using this code without success. String suma=""; String verify=""; BufferedReader br=new BufferedReader(new FileReader("C:\\Users\\Beto\\Desktop\\registrocuentas.txt")); BufferedWriter bw= new BufferedWriter(new FileWriter("C:\\Users\\Beto\\Desktop\\registrocuentas.txt")); while((verify=br.readLine())!=null){ suma=suma+" "+verify; System.out.println(suma); } suma=suma+" "+cuenta+"."+nombre+apellidoPaterno+apellidoMaterno; String split[]=suma.split(" "); int c=split.length; for(int i=0;i&lt;c;i++){ bw.write(split[i]); } bw.close(); br.close(); Currently the edited file erases the old entry, making the file looks like this (current result of my code for edited file) 1223 Dave
score: -1
tagged with: text-files
favorite count: 0
tagged with: file-handling
type: UnansweredQuestion
has title: Appending a new line in a previous created text file in java
has answer: http://stackoverflow.com/a/27083259
tagged with: bufferedwriter
tagged with: java
downvote count: 1
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/1625234
has comment: http://stackoverflow.com/comment/42675619
upvote count: 0

http://stackoverflow.com/comment/42656383
has text: @BackSlash The instant downvote made my day. I wonder why. This is a serious question, I just phrased it allegorically.
score: 0
comment on: http://stackoverflow.com/q/27071994
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/65470781
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27013834
has text: Why using a Socket? Why not an HttpURLConnection?

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

http://stackoverflow.com/comment/42708172
has text: Yes but will you get back \t when you reverse?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/27101938
type: QuestionComment

http://stackoverflow.com/q/27135559
tagged with: javascript
has comment: http://stackoverflow.com/comment/42769369
tagged with: ajax
score: 0
has comment: http://stackoverflow.com/comment/42769471
has comment: http://stackoverflow.com/comment/42769362
answer count: 1
has comment: http://stackoverflow.com/comment/42769510
has answer: http://stackoverflow.com/a/27135911
has title: Java servlet doGet() not refreshing after first call
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42769449
has comment: http://stackoverflow.com/comment/42769413
accepted answer: http://stackoverflow.com/a/27135911
tagged with: servlets
has comment: http://stackoverflow.com/comment/42769382
type: Question
has body: I am making AJAX calls to a Java servlet at a set interval. Inside the doGet it querys a DB, puts the results in JSON format, and returns them. This works great on the first try (when the page is first loaded or refreshed) but at every ajax call after it returns the same data as the first call even if things were added. Servlet: @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("in"); Connection con = null; Statement stmt = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection( DB_URL, USER, PASS); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("Select * from chatroom"); JSONObject jsonPosts = new JSONObject(); JSONArray postList = new JSONArray(); JSONObject post; while (rs.next()) { post = new JSONObject(); post.put("user", rs.getString("user")); post.put("text", rs.getString("text")); post.put("time", rs.getString("time")); postList.add(post); } System.out.println(postList.toString()); response.setContentType("application/json"); response.getWriter().write(postList.toString()); stmt.close(); con.close(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException sqe) { sqe.printStackTrace(); } } Javascript: setInterval(function () { getChat(); }, 6000); function getChat() { var posts; $.ajax({ type: "GET", url: "getChat", data: "position=hi", datatype: "json", success: function (data) { for (var i = 0; i &lt; data.length; i++) { $("#chatWindow").append(data[i].text + "&lt;br/&gt;"); } } }); }

http://stackoverflow.com/comment/42780330
type: Comment
has text: Good one, and I guess the reason it does not compile is because the java compiler parses every string?
type: AnswerComment
comment on: http://stackoverflow.com/a/27141538
score: 0

http://stackoverflow.com/a/27078612
downvote count: 0
has body: Incrementing y, x times There'll be no errors for any A and B. In the "worst" case, the loop won't be executed and the initial value of y will be printed Irrelevant I don't understand your title, there's nothing to do with String[] args here. I'm unsure what's the purpose of this code, even for learning purposes..
upvote count: 2
has comment: http://stackoverflow.com/comment/42675639
answers question: http://stackoverflow.com/q/27078535
type: Answer
score: 2

http://stackoverflow.com/q/27089543
has comment: http://stackoverflow.com/comment/42686722
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: spring
has body: Hi need help on adding gradle in eclipes. I tried to install new software in eclipes update site but i kept on having this error Cannot complete the install because one or more required items could not be found. Software being installed: Spring UAA Integration (optional) 3.6.2.201410090827-RELEASE (org.springframework.ide.eclipse.uaa.feature.feature.group 3.6.2.201410090827-RELEASE) Missing requirement: Spring UAA Integration 3.6.2.201410090827-RELEASE (org.springframework.ide.eclipse.uaa 3.6.2.201410090827-RELEASE) requires 'package com.google.protobuf 0.0.0' but it could not be found Cannot satisfy dependency: From: Spring UAA Integration (optional) 3.6.2.201410090827-RELEASE (org.springframework.ide.eclipse.uaa.feature.feature.group 3.6.2.201410090827-RELEASE) To: org.springframework.ide.eclipse.uaa [3.6.2.201410090827-RELEASE] I've already tried to add additional update sites to satisfy some dependencies. by exporting this (http://dist.springsource.com/release/TOOLS/composite/e3.7/bookmarks.xml) but still kept on getting the same error.please help me with this.
tagged with: android-gradle-plugin
tagged with: libgdx
tagged with: java
tagged with: eclipse
has title: Cannot install Gradle in Eclipse
type: Question
has comment: http://stackoverflow.com/comment/42689446

http://stackoverflow.com/comment/42716253
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27106079
type: Comment
has text: Does reflection work in this jvm?

http://stackoverflow.com/a/27085061
type: Answer
accepted answer of: http://stackoverflow.com/q/27084764
score: 0
has body: !alunos[numAl][0].equalsIgnoreCase("FIM")) will never evaluate how you want. When the condition is evaluated, alunos[numAl][0] is always checking against a NULL entry, because you've incremented numAl. The reason the YODA condition did something different for you is because "FIM" doesn't equal NULL, which means !"FIM".equalsIgnoreCase(alunos[numAl][0]); will always evaluate to TRUE, so the loop continues based solely on the .length() condition. Try this: public static int lerInformação(String[][] alunos, int numAl) { do { System.out.print("Nome do Aluno: "); alunos[numAl][0] = ler.next(); System.out.print("Número do Aluno: "); ler.nextLine(); alunos[numAl][1] = ler.next(); numAl++; } while(numAl &lt; alunos.length &amp;&amp; (!alunos[numAl-1][0].equalsIgnoreCase("FIM"))); //numAl - 1, instead. return numAl; } By using numAl - 1 you're checking against the most recent user input, which happened before you incremented numAl. However, a better solution would be: public static int lerInformação(String[][] alunos, int numAl) { do { System.out.print("Nome do Aluno: "); alunos[numAl][0] = ler.next(); if(alunos[numAl][0].equalsIgnoreCase("FIM") { break; } System.out.print("Número do Aluno: "); ler.nextLine(); alunos[numAl][1] = ler.next(); numAl++; } while(numAl &lt; alunos.length); return numAl; } This way, you don't keep running unnecessary code(such as prompting for Numero do Aluno), once the user has entered FIM. The break will exit the loop immediately. However, you'll still have to address the fact that you're storing a command (FIM), inside the user-generated array of alunos, which is bad practice. You can solve that for updating the relevant code to something like: String userInput = ler.next(); if(userInput.equalsIgnoreCase("FIM") { break; } else { alunos[numAl][0] = userInput; }
answers question: http://stackoverflow.com/q/27084764
type: AcceptedAnswer

http://stackoverflow.com/q/27133796
favorite count: 0
has answer: http://stackoverflow.com/a/27134083
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42766359
has answer: http://stackoverflow.com/a/27133956
has title: How to count all alphabetical characters in array?
upvote count: 1
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27133956
tagged with: nested-loops
downvote count: 0
tagged with: counter
accepted answer: http://stackoverflow.com/a/27134083
has comment: http://stackoverflow.com/comment/42766328
has body: So basically my objective is to make a program that takes the user input and reverses it and prints the inverse character back to user as an encoded message. Right now i need to print the statistics of the user entered string. How do i count the amount of occurrences of different letters from the user string. I have this so far. import java.util.*; public class SecretCodeMachine { public static void main(String[]args) { //object accessing the non static methods SecretCodeMachine a = new SecretCodeMachine(); //input stream Scanner in = new Scanner (System.in); Scanner i = new Scanner (System.in); //prompt the user System.out.println("Please input your secret message."); String input = in.nextLine(); //calls the encodedMessage() method; equals the return value to varaible String encodedMessage = a.encodeMessage(input); //message and prompt System.out.println("Encoded message: " + encodedMessage); System.out.println("Enter the code in here to get the original message back."); String input2 = i.nextLine(); //if statements saying that if the input equals the encoed message... if (input2.equals(encodedMessage)) { //print this System.out.println("Original Message: " + input); } else { //prints when doesnt equal System.out.println("Message not found."); } //closes the input stream i.close(); in.close(); } //method for encoding the string from array public String encodeMessage(String pass) { //passes the parameter string and puts it in an array () char[] toArray = pass.toCharArray(); for (int i = 0; i &lt; toArray.length; i++) { //does the lower case characters if (toArray[i] &gt;= 'a' &amp;&amp; toArray[i] &lt;= 'z') { if (toArray[i] - 'a' &lt;= 13) toArray[i] = (char) ('z' - (toArray[i] - 'a')); else toArray[i] = (char) ('a' + ('z' - toArray[i])); } //does the upper case characters else if(toArray[i] &gt;= 'A' &amp;&amp; toArray[i] &lt;= 'Z') { if (toArray[i] - 'A' &lt;= 13) toArray[i] = (char) ('Z' - (toArray[i] - 'A')); else toArray[i] = (char) ('A' + ('Z' - toArray[i]))…

http://stackoverflow.com/q/27049874
possible better answer: http://stackoverflow.com/a/67853955
upvote count: 17
favorite count: 0
has body: As a student, i read nearly all spring documentation. As far as i understood that spring is configuration monster. Annotation based or Xml based, it doesn't matter but what i really don't understand is what is the difference between transaction manager and entity manager. If we have injected entityManager on Dao layer, why do we need transaction manager on service layer or vice versa. If we inject transaction manager(that wraps entitymanager) why do we need to inject entitymanager on DaoLayer. For JPARepositories, i don't even need to inject any manager. Spring does everything for me(i don't really understand mechanics). My another question is for JPARepositories Spring uses entityManager or transactionManager?
has answer: http://stackoverflow.com/a/27050235
accepted answer: http://stackoverflow.com/a/27050235
tagged with: spring
has title: What is the difference between Transaction manager and Entity Manager
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: spring-data
has answer: http://stackoverflow.com/a/67853955
score: 17
type: Question
tagged with: jpa
answer count: 2

http://stackoverflow.com/q/27069097
has body: Hopefully I can clearly ask my question this time, I embarrassed myself with my last question so I had to delete it. This snippet is from a logger I am writing for my app. When I wrote this in Eclipse Luna, I was given no errors on the try() statement I made below, but when I plug the code into Android Studio, I am given an "Incompatible types" error. It states that the type found was "java.io.BufferedReader", and expected is "java.lang.AutoCloseable". What am I missing? File filePointer = new File(logFile); boolean bool = false; bool = filePointer.exists(); String ls = System.getProperty("line.separator"); if(bool == true) { try (BufferedReader br = new BufferedReader(new FileReader(logFile))) { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while(line != null){ sb.append(line); sb.append(ls); line = br.readLine(); } copiedFile = sb.toString(); } finally{ br.close(); } }
has comment: http://stackoverflow.com/comment/42652192
tagged with: android
has comment: http://stackoverflow.com/comment/42652565
has answer: http://stackoverflow.com/a/27069995
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/27069995
answer count: 1
tagged with: bufferedreader
type: AnsweredQuestion
downvote count: 0
has title: Android BufferedReader try-with-resources
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/27118850
type: Question
has title: Append String to native Java array
tagged with: native
possible better answer: http://stackoverflow.com/a/27118905
has answer: http://stackoverflow.com/a/27118887
has answer: http://stackoverflow.com/a/27118954
upvote count: 1
tagged with: arrays
downvote count: 0
tagged with: string
has body: Is there a more elegant way (preferably in the SDK) which will take an existing array of N String objects and append another String so that the array now has N+1 String objects? See below how I did it. import java.util.Arrays; public class StringArrayAppend { /** * @param args */ public static void main(String[] args) { String[] selectionArgs={"3","2"}; //Is there a SDK method to Arrays.append(selectionArgs,"1");? int newSize=selectionArgs.length+1; int indexNewElem=selectionArgs.length; String[] selectionArgs2=new String[newSize]; System.arraycopy(selectionArgs, 0, selectionArgs2, 0, selectionArgs.length); selectionArgs2[indexNewElem]="1"; selectionArgs=selectionArgs2; selectionArgs2=null; System.out.println("selectionArgs="+Arrays.toString(selectionArgs)); } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/27118960
has answer: http://stackoverflow.com/a/27118905
answer count: 4
tagged with: append
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27118960
score: 1
tagged with: java

http://stackoverflow.com/comment/42626634
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27055072
has text: well in docs its mentioned as `and/or` behaviour for `@Profile("a","b")`. Isn't that what you are looking for? docs - `Likewise, if a @Component or @Configuration class is marked with @Profile({"p1", "p2"}), that class will not be registered/processed unless profiles 'p1' and/or 'p2' have been activated.`
type: Comment

http://stackoverflow.com/q/27117531
has answer: http://stackoverflow.com/a/27117554
has body: I have a method like this: public static void main(String[] args) { Map&lt;String, Long&gt; var = Files.walk(Paths.get("text"), number) .filter(path -&gt; !Files.isDirectory(path)) .map(Path::getFileName) .map(Object::toString) .filter(fileName -&gt; fileName.contains(".")) .map(fileName -&gt; fileName.substring(fileName.lastIndexOf(".") + 1)) .collect(Collectors.groupingBy( extension -&gt; extension, Collectors.counting() ) ); System.out.println(var); } As we know, output will be like: {text=1, text=2} Is it possible to change the output to: text = 1 text = 2 I want to have some more freedom, e. g. remove brackets and commas, add new lines after number etc.
type: Question
answer count: 2
has title: How to modify Map's output style?
tagged with: pretty-print
has answer: http://stackoverflow.com/a/27117621
score: 0
tagged with: dictionary
accepted answer: http://stackoverflow.com/a/27117621
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42737355
possible better answer: http://stackoverflow.com/a/27117554
tagged with: java

http://stackoverflow.com/a/27011859
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27011764
type: Answer
has body: You could try a pattern such as "\\s*(\\S+)\\s+(\\d+)". That would be any optional whitepace followed by a group of non-whitespace characters then any (consecutive) whitespace and finally a group of digits. Like this, String in = " what 893"; Pattern p = Pattern.compile("\\s*(\\S+)\\s+(\\d+)"); Matcher m = p.matcher(in); if (m.matches()) { System.out.printf("%s %s%n", m.group(1), m.group(2)); } Output is what 893
accepted answer of: http://stackoverflow.com/q/27011764
score: 1

http://stackoverflow.com/comment/68353708
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27136049
type: Comment
has text: Red5 Pro has sample code here for their version https://github.com/red5pro/red5pro-server-examples/blob/master/red5prolive/Red5ProLive/src/com/red5pro/live/Red5ProLive.java

http://stackoverflow.com/a/27241342
answers question: http://stackoverflow.com/q/27113536
has body: We use baseUrl = 'http://admin:password@yourwebsite.com' style of authenticating for our internal app. We did at one stage use a proxy and also tried Robot but it had sometimes caused issues with existing libraries used by Webdriver and found this more to be less problematic. If you are using IE :@ will not work. You can however turn on this feature using Group policy and reg-edit. Please be aware this is a security issue. If this is not your preferred way I can dig out the old code for you. I used a similar answer as per this question
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/42725486
has text: If "the rank value is 0, then the frequency is Infinity", but nobody should care, as the loop terminates before Infinity can get used.
comment on: http://stackoverflow.com/a/27108222
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/49182121
score: 0
type: Comment
has text: @Deleet What didn't work?
comment on: http://stackoverflow.com/a/27143549
type: AnswerComment

http://stackoverflow.com/q/27018591
linked to: http://stackoverflow.com/q/9921676
linked to: http://stackoverflow.com/q/2367398
type: AnsweredQuestion
tagged with: syntax
tagged with: java
has answer: http://stackoverflow.com/a/27018652
has title: Notation " Class<?>... "
type: Question
has answer: http://stackoverflow.com/a/27018698
accepted answer: http://stackoverflow.com/a/27018698
score: 0
answer count: 3
has body: I have to work with an existing code, and I didnt find what this notation meant : Class&lt;?&gt;... For instance, it is used in the method : public static &lt;T&gt; HashSet&lt;ConstraintViolation&lt;T&gt;&gt; validate(Validator validator, T resource, Class&lt;?&gt;... groups) { return (HashSet&lt;ConstraintViolation&lt;T&gt;&gt;) validator.validate(resource, groups); } And called like this : HashSet&lt;ConstraintViolation&lt;EntryDTO&gt;&gt; l = ValidationTools.validate(this.validator, entryDTO); Does it mean that "groups" is optionnal ? I found this interesting topic : What does Class&lt;?&gt; mean in Java? but it doesnt really answer my question... Thanks for your answers =)
possible better answer: http://stackoverflow.com/a/27018652
has answer: http://stackoverflow.com/a/27018924

http://stackoverflow.com/comment/42575446
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27024948
has text: Edited my answer. Make sure everything goes in a form. This will make a POST request to the server at the same URL that the page is displayed as. You can change the `action` attribute of the form for a different URL.
type: AnswerComment

http://stackoverflow.com/q/27045417
has body: To manage preferences of my swt/jface application, I'm using org.eclipse.jface.preference I have 3 nodes in the preference window: //Creation of the nodes PreferenceNode one = new PreferenceNode("one", new PreferencePage1()); PreferenceNode two = new PreferenceNode("two", new PreferencePage2()); PreferenceNode three = new PreferenceNode("three", new PreferencePage3()); //Creation of the manager PreferenceManager mgr = new PreferenceManager(); mgr.addToRoot(one); mgr.addToRoot(two); two.add(three); //Show the preference dialog PreferenceDialog myPreferenceDialog = new PreferenceDialog(null, mgr); The node three is a subnode of the node two. How can I expand the node two in the tree of the PreferenceNode?
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27046084
score: 0
has answer: http://stackoverflow.com/a/27046084
has title: How to automatically expand all nodes of a PreferenceManager
tagged with: swt
tagged with: jface

http://stackoverflow.com/comment/42555906
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27015024
type: AnswerComment
has text: Where does it say the complexity is O(n)? It depends on what's actually implementing the interface. A HashSet would be O(1)

http://stackoverflow.com/a/45944443
has body: Update your BIRT version. And use the XLSX format than XLS.
type: Answer
answers question: http://stackoverflow.com/q/27038234
has comment: http://stackoverflow.com/comment/78847945
score: 0

servlets
tags question: http://stackoverflow.com/q/27139932
tags question: http://stackoverflow.com/q/27105447
tags question: http://stackoverflow.com/q/27133851
tags question: http://stackoverflow.com/q/27101872
tags question: http://stackoverflow.com/q/27009878
tags question: http://stackoverflow.com/q/26992958
tags question: http://stackoverflow.com/q/27124851
tags question: http://stackoverflow.com/q/27134743
tags question: http://stackoverflow.com/q/27022741
tags question: http://stackoverflow.com/q/27142491
tags question: http://stackoverflow.com/q/27046572
tags question: http://stackoverflow.com/q/27135559
tags question: http://stackoverflow.com/q/27065293
tags question: http://stackoverflow.com/q/27034508
tags question: http://stackoverflow.com/q/27123154
tags question: http://stackoverflow.com/q/27059384
tags question: http://stackoverflow.com/q/27059519
tags question: http://stackoverflow.com/q/26999368
tags question: http://stackoverflow.com/q/27056148
tags question: http://stackoverflow.com/q/27051818
tags question: http://stackoverflow.com/q/27090246
tags question: http://stackoverflow.com/q/27141025
tags question: http://stackoverflow.com/q/27003759
tags question: http://stackoverflow.com/q/27059114
tags question: http://stackoverflow.com/q/27043399
tags question: http://stackoverflow.com/q/27073759
tags question: http://stackoverflow.com/q/27004346
tags question: http://stackoverflow.com/q/27115309
tags question: http://stackoverflow.com/q/27050460
tags question: http://stackoverflow.com/q/27034676
tags question: http://stackoverflow.com/q/27040389
tags question: http://stackoverflow.com/q/26992222
tags question: http://stackoverflow.com/q/27071280
tags question: http://stackoverflow.com/q/27114463
tags question: http://stackoverflow.com/q/27146823
tags question: http://stackoverflow.com/q/27018494
tags question: http://stackoverflow.com/q/26994321
tags question: http://stackoverflow.com/q/27061949
tags question: http://stackoverflow.com/q/27033396
tags question: http://stackoverflow.com/q/27115407
tags question: http://stackoverflow.com/q/27098445
tags question: http://stackoverflow.com/q/27145341
tags question: http://stackoverflow.com/q/27051122
tags question: http://stackoverflow.com/q/27066311
tags question: http://stackoverflow.com/q/27096301
tags question: http://stackoverflow.com/q/27019231
tags question: http://stackoverflow.com/q/27020783
tags question: http://stackoverflow.com/q/27130429
tags question: http://stackoverflow.com/q/27149605
tags question: http://stackoverflow.com/q/27127893
tags question: http://stackoverflow.com/q/27055347
tags question: http://stackoverflow.com/q/26995116
tags question: http://stackoverflow.com/q/27102207
tags question: http://stackoverflow.com/q/27061467
tags question: http://stackoverflow.com/q/27076705
tags question: http://stackoverflow.com/q/27090034
tags question: http://stackoverflow.com/q/27014771
tags question: http://stackoverflow.com/q/27081261
tags question: http://stackoverflow.com/q/27144604
tags question: http://stackoverflow.com/q/27071635
tags question: http://stackoverflow.com/q/26994555
tags question: http://stackoverflow.com/q/27099141
tags question: http://stackoverflow.com/q/27084347
tags question: http://stackoverflow.com/q/27012200
tags question: http://stackoverflow.com/q/27005506
tags question: http://stackoverflow.com/q/27143454
tags question: http://stackoverflow.com/q/27044330
tags question: http://stackoverflow.com/q/27094803
tags question: http://stackoverflow.com/q/27045303
tags question: http://stackoverflow.com/q/27124498
tags question: http://stackoverflow.com/q/27054569
tags question: http://stackoverflow.com/q/27110577
tags question: http://stackoverflow.com/q/27144432
tags question: http://stackoverflow.com/q/27147973
tags question: http://stackoverflow.com/q/27018729
tags question: http://stackoverflow.com/q/27009365
tags question: http://stackoverflow.com/q/27032602
tag name: servlets
tags question: http://stackoverflow.com/q/26995126
tags question: http://stackoverflow.com/q/27113073

http://stackoverflow.com/comment/42583358
type: AnswerComment
type: Comment
has text: could you explain more what you mean by if you are thinking about how to test the code?
comment on: http://stackoverflow.com/a/27030410
score: 0

http://stackoverflow.com/comment/42681154
type: AnswerComment
type: Comment
has text: ok lol. thanks for the answer, i got it running just now with no errors. i just put the filereader code in `main()` and made all variables of the code `static`.
comment on: http://stackoverflow.com/a/27086277
score: 0

http://stackoverflow.com/comment/43613101
has text: this would work for the first level of directories...if i wanted to group the directories further..i would have to use the function again on the results of the first function call....recursion, right_?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27067181
type: Comment

http://stackoverflow.com/q/27034113
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42589332
tagged with: jpa
possible better answer: http://stackoverflow.com/a/27034287
has answer: http://stackoverflow.com/a/27034319
has comment: http://stackoverflow.com/comment/42589085
has title: Spring MVC JPA exception org.hibernate.exception.SQLGrammarException
tagged with: spring
has answer: http://stackoverflow.com/a/27034287
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42589130
has answer: http://stackoverflow.com/a/27034354
accepted answer: http://stackoverflow.com/a/27034354
tagged with: mysql
type: Question
has body: I'm new to Spring JPA stuff. I'm learning now. I got weird error while trying to insert data in mysql database. I made sure that I have a the table and database setup correctly as same as my mysql&gt; show columns in empolyee in test; | Field | Type | Null | Key | Default | Extra | | id | int(6) | NO | PRI | NULL | auto_increment | eid | int(6) | YES | | NULL | | | name | varchar(40) | NO | | NULL | | | role | varchar(20) | YES | | NULL | | My entity class:- @Entity public class Employee extends AbstractPersistable&lt;Long&gt; { private int eid; private String name; private String role; public Employee(){ } public Employee(int aeid, String aname, String arole){ eid=aeid; name = aname; role = arole; } } Error:- HTTP Status 500 - Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.SQLGrammarException: Table 'test.employee' doesn't exist; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Table 'test.employee' doesn't exist
tagged with: java

http://stackoverflow.com/a/27002049
has body: You have to implement your custom Android View and handle touch events by your own + making animations. Or use this.
answers question: http://stackoverflow.com/q/27001971
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42534083
accepted answer of: http://stackoverflow.com/q/27001971

http://stackoverflow.com/comment/42699242
type: Comment
type: QuestionComment
has text: It works for me, `JFileChooser` may take several seconds to load, you might need to give it some time...
comment on: http://stackoverflow.com/q/27096819
score: 0

http://stackoverflow.com/q/26993101
tagged with: java
score: 48
accepted answer: http://stackoverflow.com/a/26993233
has answer: http://stackoverflow.com/a/70576201
type: AnsweredQuestion
tagged with: environment-variables
has answer: http://stackoverflow.com/a/64459399
has answer: http://stackoverflow.com/a/51216874
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/64459399
has answer: http://stackoverflow.com/a/50346234
type: Question
has comment: http://stackoverflow.com/comment/42517323
has answer: http://stackoverflow.com/a/79290493
tagged with: windows
upvote count: 48
tagged with: cmd
has comment: http://stackoverflow.com/comment/42517173
linked to: http://stackoverflow.com/q/171588
has answer: http://stackoverflow.com/a/26993233
has answer: http://stackoverflow.com/a/69848663
has body: I'm working on few projects and some of them are using different JDK. Switching between JDK versions is not comfortable. So I was wondering if there is any easy way to change it? I found 2 ways, which should solve this problem, but it doesn't work. First solution is creating a bat files like this: @echo off echo Setting JAVA_HOME set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_72 echo setting PATH set PATH=C:\Program Files\Java\jdk1.7.0_72\bin;%PATH% echo Display java version java -version pause And after running this bat, I see right version of Java. But when I close this CMD and open a new one and type "java -version" it says that I still have 1.8.0_25. So it doesn't work. Second solution which I found is an application from this site. And it also doesn't work. The same effect as in the first solution. Any ideas? Because changing JAVA_HOME and PAHT by: Win + Pause -> Advanced System Settings -> Environment Variables -> and editing these variables, is terrible way...
has answer: http://stackoverflow.com/a/72389151
has title: Switching between different JDK versions in Windows
has answer: http://stackoverflow.com/a/78638721
answer count: 9

http://stackoverflow.com/q/26991928
accepted answer: http://stackoverflow.com/a/26994366
has body: i have a source viewer. In this, i need to shift multiple lines to right, when tab is pressed and remove tab, on these lines, when Shift+Tab is pressed. Below is my code. I m not sure how to proceed further. Can you please suggest how this can be done. public class MyViewer extends SourceViewer { public MyViewer(final Composite parent, final int styles) { super(parent, null, styles); final Font font = JFaceResources.getFont(MyConstants.EDITOR_TEXT_FONT); getTextWidget().setFont(font); getTextWidget().addTraverseListener(new TraverseListener() { public void keyTraversed(final TraverseEvent e) { if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) { if (areMultipleLinesSelected()) { e.doit = true; final ITextSelection textSelection = (ITextSelection) FastCodeTemplateViewer.this.getSelection(); //what to do after this, to apply, SHIFT_LEFT or SHIFT_RIGHT, on the selected content } }); @Override public void setDocument(final IDocument document) { ... } @Override public void setHyperlinkPresenter(final IHyperlinkPresenter hyperlinkPresenter) throws IllegalStateException { ... } }
tagged with: eclipse-plugin
score: 0
answer count: 1
tagged with: swt
type: AnsweredQuestion
tagged with: java
has title: apply shift_right or shift_left on multiple lines
has answer: http://stackoverflow.com/a/26994366
type: Question

http://stackoverflow.com/comment/42587929
has text: All i want is to save these two objects, which refers to eachother as fast as possible.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27019431
type: Comment

http://stackoverflow.com/a/27019101
has comment: http://stackoverflow.com/comment/42563648
accepted answer of: http://stackoverflow.com/q/27017672
upvote count: 3
answers question: http://stackoverflow.com/q/27017672
has body: Double click to open server configuration Click to open dialog below finally add or edit your vm arguments.
has comment: http://stackoverflow.com/comment/42563172
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42565121
type: Answer
score: 3

http://stackoverflow.com/comment/42751352
comment on: http://stackoverflow.com/q/27125669
score: 0
type: QuestionComment
type: Comment
has text: Solutions in xpath are welcome! I have an xml doc, i want to extract only a content of that tag with all the tag inside it. I try with no result

http://stackoverflow.com/comment/42524263
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26996679
has text: also you are not writing your json anywhere else than the console....

http://stackoverflow.com/comment/42664028
type: AnswerComment
has text: Thanks all! Really need this
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27076601

http://stackoverflow.com/comment/42593829
type: QuestionComment
has text: Not really two-tier because my whole work is N*W. (N is the number of runnables and W is the work that each runnable does.) If I decrease N to 8, I'll simply increase W accordingly. I can still do the W amount work in a runnable as a whole piece. But if my N is 1000000, I have to create that many runnables and collect result from all these runnables.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27036521

sql
tags question: http://stackoverflow.com/q/27124427
tags question: http://stackoverflow.com/q/27021697
tags question: http://stackoverflow.com/q/27053097
tags question: http://stackoverflow.com/q/27084204
tags question: http://stackoverflow.com/q/27044702
tags question: http://stackoverflow.com/q/27050989
tags question: http://stackoverflow.com/q/27037998
tags question: http://stackoverflow.com/q/27115919
tags question: http://stackoverflow.com/q/27051522
tags question: http://stackoverflow.com/q/27130764
tags question: http://stackoverflow.com/q/27095713
tags question: http://stackoverflow.com/q/27052433
tags question: http://stackoverflow.com/q/27055361
tags question: http://stackoverflow.com/q/27063063
tags question: http://stackoverflow.com/q/27070310
tags question: http://stackoverflow.com/q/27057953
tag name: sql
tags question: http://stackoverflow.com/q/27064828
type: Tag
tags question: http://stackoverflow.com/q/27083920
tags question: http://stackoverflow.com/q/27029211
tags question: http://stackoverflow.com/q/27024644
tags question: http://stackoverflow.com/q/27032445
tags question: http://stackoverflow.com/q/27085451
tags question: http://stackoverflow.com/q/27067908
tags question: http://stackoverflow.com/q/27060563
tags question: http://stackoverflow.com/q/27098545
tags question: http://stackoverflow.com/q/27065520
tags question: http://stackoverflow.com/q/26993563
tags question: http://stackoverflow.com/q/27036998
tags question: http://stackoverflow.com/q/27078774
tags question: http://stackoverflow.com/q/27002213
tags question: http://stackoverflow.com/q/27146105
tags question: http://stackoverflow.com/q/27057900
tags question: http://stackoverflow.com/q/27000220
tags question: http://stackoverflow.com/q/27065576
tags question: http://stackoverflow.com/q/27035000
tags question: http://stackoverflow.com/q/27014516
tags question: http://stackoverflow.com/q/27059266
tags question: http://stackoverflow.com/q/27148017
tags question: http://stackoverflow.com/q/27015630
tags question: http://stackoverflow.com/q/27098301
tags question: http://stackoverflow.com/q/27060849

http://stackoverflow.com/comment/42530682
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26999934
score: 0
has text: What is the url you are testing? If you replace `*.xhtml` with `*.jsf` in `web.xml` and change your url to `http://<context_root>/<your_page>.jsf`, does that work?

http://stackoverflow.com/comment/119020576
has text: @paradocslover it was https://mvnrepository.com/artifact/commons-collections/commons-collections/3.2.2
type: Comment
score: 1
comment on: http://stackoverflow.com/a/54594677
type: AnswerComment

http://stackoverflow.com/comment/42711928
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27102229
has text: The TitledPane will be created within a method called after the Stage is shown (stage.setOnShown). So everything should be good? Didn't know about ScenicView. I'll try it with that.

http://stackoverflow.com/q/27147857
has comment: http://stackoverflow.com/comment/42837148
has comment: http://stackoverflow.com/comment/42928474
has comment: http://stackoverflow.com/comment/42835296
has answer: http://stackoverflow.com/a/27150484
has comment: http://stackoverflow.com/comment/42928885
has title: dropdown functionality not working in selenium webdriver
score: 0
has comment: http://stackoverflow.com/comment/42837006
answer count: 1
has comment: http://stackoverflow.com/comment/42928758
has comment: http://stackoverflow.com/comment/42836747
has comment: http://stackoverflow.com/comment/42796936
has comment: http://stackoverflow.com/comment/42836923
has comment: http://stackoverflow.com/comment/42836778
has comment: http://stackoverflow.com/comment/42795151
has body: I have an issue when attempting to click on an element from a drop-down menu, when running a test in Selenium. So, as per the below screenshot, I am hovering over 'Reports', then 'Asset Management', then 'Terminated Report: Pending'. Clicking on the 'Terminated Report: Pending' option should take me to the appropriate page I've written the following code in WebDriver to do this: public static void terminatedReportPendingFocus(InternetExplorerDriver driver) { WebElement terminatedReportPendingFocus = driver.findElement(By.xpath("//a[contains(@href,'GetTerminatedPendingReport')]")); terminatedReportPendingFocus.click(); } I didn't see any issues with this, given that I had used similar code in order to access the 'Terminated Report: Pending' page. However, for some reason when I run the test, whilst the browser initially focuses on the element I want, it then loses focus and drops down to the 'Collections' drop down and selects a page with a completely different href to the one I selected in the code. Can anyone help as to what the reason might be? Many thanks ASSET MANAGEMENT IMPLEMENTATION public static void assetManagementFocus(InternetExplorerDriver driver) { WebElement assetManagementFocus = driver.findElement(By.xpath(".//*[text()='Asset Management']")); Actions hoverOnReportWindow = new Actions(driver); hoverOnReportWindow.moveToElement(assetManagementFocus).build().perform(); assetManagementFocus.click(); } COMPLETE IMPLEMENTATION OF CODE public class optionFocusControls { //REPORTS TAB public static void reportWindowFocus(InternetExplorerDriver driver) { WebElement reportWindowFocus = driver.findElement(By.linkText("Reports")); Actions hoverOnReportText = new Actions(driver); hoverOnReportText.moveToElement(reportWindowFocus).build().perform(); } public static void assetManagementFocus(InternetExplorerDriver driver) { WebElement assetManagementFocus = driver.findElement(By.xpath(".//*[text()='Asset Management']")); Actions hoverOnReportWindow = new Actions(dr…
has comment: http://stackoverflow.com/comment/42797030
has comment: http://stackoverflow.com/comment/42929282
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42930176
has comment: http://stackoverflow.com/comment/42834879
has comment: http://stackoverflow.com/comment/42795524
has comment: http://stackoverflow.com/comment/42929939
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/42930131
has comment: http://stackoverflow.com/comment/42928315
accepted answer: http://stackoverflow.com/a/27150484
tagged with: webdriver
type: Question
has comment: http://stackoverflow.com/comment/42795880
has comment: http://stackoverflow.com/comment/42928666
has comment: http://stackoverflow.com/comment/42836183
has comment: http://stackoverflow.com/comment/42797148
has comment: http://stackoverflow.com/comment/42797299

http://stackoverflow.com/q/27135446
favorite count: 0
has comment: http://stackoverflow.com/comment/42770377
type: Question
has answer: http://stackoverflow.com/a/27142337
has body: I am using StringUtils from the apache commons library to check the # of matches of a substring within the source code of an html page. I have converted the page source using the webdriver command: String pageSource = driver.getPageSource(); The code I am using to find # of matches is: int cloudfCount = StringUtils.countMatches(pageSource, "cloudfront"); System.out.println("There are " + cloudfCount + " instances of cloudf text found within the page source."); When I perform the check manually, I get 2 matches. Which is what I am expecting. But when I use the above code in an automated Selenium script, I am getting 5 results. Any thoughts/ideas on where I'm going wrong? Thank you.
has comment: http://stackoverflow.com/comment/42770703
score: -1
tagged with: selenium-webdriver
has title: Why would StringUtils return the incorrect # of matches of a substring?
has comment: http://stackoverflow.com/comment/42769306
answer count: 1
downvote count: 1
tagged with: java
type: UnansweredQuestion
tagged with: apache-stringutils
upvote count: 0

deadlock
tags question: http://stackoverflow.com/q/27126915
tags question: http://stackoverflow.com/q/27094247
tag name: deadlock
type: Tag
tags question: http://stackoverflow.com/q/27013496

http://stackoverflow.com/q/27046642
upvote count: 21
has answer: http://stackoverflow.com/a/52230106
type: Question
has answer: http://stackoverflow.com/a/27047388
tagged with: junit
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27433508
accepted answer: http://stackoverflow.com/a/27433508
answer count: 5
has answer: http://stackoverflow.com/a/28609688
tagged with: android
has title: Access file in JUnit test in Gradle environment
has body: Right now I have got a Java library which has a test class. In that class I want to access some files located on my hard disk. The build.gradle looks like this: apply plugin: 'java' dependencies { testCompile 'junit:junit:4.11' } My file is under java_lib/src/test/assets/file.xml and the Java class is under java_lib/src/test/java/&lt;package_name&gt;.java Therefore I execute final InputStream resourceAsStream = this.getClass().getResourceAsStream("assets/file.xml"); Unfortunately I get null back. What am I doing wrong?
has answer: http://stackoverflow.com/a/27421352
type: AnsweredQuestion
score: 21
possible better answer: http://stackoverflow.com/a/27047388
tagged with: java

http://stackoverflow.com/a/27062457
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27062311
score: 1
upvote count: 1
has body: I wouldn't use interface to store constant as having static members into an interface (and implementing that interface) is a bad practice and there is even a name for it, the Constant Interface Antipattern, see [Effective Java][1], Item 17: The constant interface pattern is a poor use of interfaces. That a class uses some constants internally is an implementation detail. Implementing a constant interface causes this implementation detail to leak into the class's exported API. It is of no consequence to the users of a class that the class implements a constant interface. In fact, it may even confuse them. Worse, it represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a nonfinal class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface. I would personally go for enum and if needed i could even use it to have error code or add relevant field/method as well.

http://stackoverflow.com/q/27001710
tagged with: ssh-keys
has body: I'm using Jsch for executing ssh commands. When I pass private key it works well, but I need it to work without private key passing (it was already copied there). So in console I can ssh to this server without anything. But Jsch throws Auth Fail. How can I do it ? Session session = jSch.getSession(server); session.setConfig("StrictHostKeyChecking", "no"); session.setConfig("UserKnownHostsFile", "/dev/null"); session.connect(connectTimeout);
has title: jsch auth fail without private key
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27001854
tagged with: jsch
accepted answer: http://stackoverflow.com/a/27001854
tagged with: ssh
type: AnsweredQuestion
tagged with: java
tagged with: openssh
type: Question

http://stackoverflow.com/comment/42609021
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27045009
has text: Thanks for the comment, forgot that API keys are in the manifest. Do you have a suggestion on a solution? I am new to debugging, so any help will be appreciated.
type: Comment

http://stackoverflow.com/a/27115457
score: 0
answers question: http://stackoverflow.com/q/27115374
type: Answer
has body: You could use a loop. If a valid response is entered, break out of the loop. Otherwise, keep looping. Example: while(true){ &lt;get input here&gt; if(thick==3){ &lt;do stuff&gt; break; } else if(...){ &lt;do stuff&gt; break; } ... else{ &lt;do stuff&gt; } }

http://stackoverflow.com/comment/42672328
comment on: http://stackoverflow.com/a/27076454
type: Comment
has text: In my case the `Supplier` captures `input` from the outer code block, but yes this is more explicit.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42725418
type: QuestionComment
has text: @EmilLundin Then I guess the whole purpose of DTOs is to shift data in expensive REMOTE calls. Thanks.
score: 0
comment on: http://stackoverflow.com/q/27103432
type: Comment

http://stackoverflow.com/comment/42597423
comment on: http://stackoverflow.com/a/27038672
type: Comment
has text: @b__,Glad to help you.
score: 1
type: AnswerComment

etl
tags question: http://stackoverflow.com/q/27108075
type: Tag
tag name: etl

http://stackoverflow.com/q/27076978
type: UnansweredQuestion
has body: I am back again in search of a solution to one of the best online solution centers. @Path("/user/service") public class UserFeedService { String status = "status_idle"; String errorStatus = "ok"; @POST @Path("/register") @Produces("application/json") public String register() { if (!status.equals("status_running")) { registerUser(); return errorStatus ; } return status ; } public void resgisterUser() { synchronized { status = "status_running" } //code below } } The code above is a sample code of the restful service that I am working on which is being called from my vaadin application on click of a button. Now what I want is that when a user clicks on the button the first time the web service is called and the status is set to "status_running" , in case the user clicks on the button again while the previous service call is still in progress ,the service should return "status_running" which will be displayed to the user. But the code above always returns errorStatus and not status as expected on multiple clicks on the button. So am I doing something wrong here or it is how the browser works, that is it waits for the first call to the service on click of the button to finish and then invokes
score: 2
upvote count: 2
type: Question
has title: How Browser Handles Multiple clicks on the Action Button
tagged with: java
answer count: 1
downvote count: 0
tagged with: jax-rs
tagged with: web
has comment: http://stackoverflow.com/comment/42666269
has comment: http://stackoverflow.com/comment/42759974
favorite count: 0
has answer: http://stackoverflow.com/a/27128748
tagged with: rest

http://stackoverflow.com/comment/42755835
comment on: http://stackoverflow.com/a/27109984
score: 0
type: AnswerComment
type: Comment
has text: Okay I think there is a problem in GWT SDM the Scheduler works different on desktop and mobile here is a demo project for that: https://github.com/confile/GWT-2.7-Scheduler-Test

http://stackoverflow.com/a/27089259
has comment: http://stackoverflow.com/comment/42685888
answers question: http://stackoverflow.com/q/27089181
has comment: http://stackoverflow.com/comment/42686454
downvote count: 0
has comment: http://stackoverflow.com/comment/42685812
has body: Thread.sleep on the UI Thread is a bad idea. Use an handler: private Handler mHandler = new Handler(): private class MyRunnable implmenets Runanble { private final static int MAX_INT = 20; private int mCounter = 0; @Override public void run() { if (mCounter == 20) { mHandler.removeCallbacks(this); return; } mytexts.setText(" " + mCounter); mCounter++; mHandler.postDelayed(this, 2000); } } and in your create, after you initialze your views, call mHandler.postDelayed(new MyRunnable(), 2000);
type: Answer
has comment: http://stackoverflow.com/comment/42685947
score: 1
upvote count: 1

http://stackoverflow.com/comment/42694344
type: QuestionComment
comment on: http://stackoverflow.com/q/27086168
type: Comment
has text: It's usual to use a matrix. Libraries such as opengl help you create them for cameras with a method called 'look at'.
score: 0

http://stackoverflow.com/a/27027822
has comment: http://stackoverflow.com/comment/42578657
downvote count: 0
score: 1
has body: There is simple solution in Groovy to keep the configuration in properties, it's a ConfigSlurper. Have a look into ConfigSlurper sample { foo = "default_foo" bar = "default_bar" } environments { development { sample { foo = "dev_foo" } } test { sample { bar = "test_bar" } } } def config = new ConfigSlurper("development").parse(new File('Sample.groovy').toURL()) assert config.sample.foo == "dev_foo" assert config.sample.bar == "default_bar" config = new ConfigSlurper("test").parse(new File('Sample.groovy').toURL()) assert config.sample.foo == "default_foo" assert config.sample.bar == "test_bar" Hope this is what you are looking for.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27027581
has comment: http://stackoverflow.com/comment/42578645

http://stackoverflow.com/q/27047322
type: Question
has title: How do I create a list where each element has a name and several lists within the element?
answer count: 1
accepted answer: http://stackoverflow.com/a/27047379
score: 0
has comment: http://stackoverflow.com/comment/42612959
has comment: http://stackoverflow.com/comment/42612777
tagged with: nested-lists
has body: I am trying to write a program in java that allows me to add courses to a list and within each course element, I can add a list of assignments such as homework, exams, etc. Within each assignment I will have "homework 1" grade, "homework 2" grade, etc... How do I implement this in java? Its hard to explain what I wish to do so hopefully this will help: Courses: History: Homework: Homework 1 89 Homework 2 98 Exams: Exam 1 90 Exam 2 87 Science: Homework: Homework 1 88 Exams: Exam 1 86 So, a list of courses, with each course having a list of assignments, with each assignment having a list of grades. Thanks, Zach
type: AnsweredQuestion
tagged with: list
has answer: http://stackoverflow.com/a/27047379
has comment: http://stackoverflow.com/comment/42612794
tagged with: java
has comment: http://stackoverflow.com/comment/42612876

http://stackoverflow.com/q/27050149
has comment: http://stackoverflow.com/comment/42617830
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/27050322
has comment: http://stackoverflow.com/comment/42618051
tagged with: arraylist
upvote count: 0
answer count: 1
has title: ArrayList .add method missing
has body: Hello I have the following problem: I want to create an arraylist and want to add some items. But somehow the .add Method is not there. import java.util.ArrayList; public class Chairing{ private int numbers; ArrayList&lt;Chairs&gt;myList = new ArrayList&lt;Chairs&gt;(); myList.add(5,new Chairset("10")); } public class Chair{ int price; String info; public Chair(int price, Chairset c){ this.price = price; info = c.getInfo(); } } public class Chairset{ String info; public Chairset(String id){ id = info; } } For some Reasons I can't add something in my new ArrayList. The constructor for Chair needs a price and an object Chairset. Chairset needs an id.
favorite count: 0
accepted answer: http://stackoverflow.com/a/27050322
has comment: http://stackoverflow.com/comment/42617872
has comment: http://stackoverflow.com/comment/42617860
score: -3
has comment: http://stackoverflow.com/comment/42617915
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42617799
has comment: http://stackoverflow.com/comment/42617828

http://stackoverflow.com/q/27054172
has answer: http://stackoverflow.com/a/27054246
tagged with: list
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27054294
has body: The code below gives me a compiling error. It says I should have initialised v somewhere before using it in the second loop while in the first loop everything seems fine. I thought maybe it will implicitly initialised to 0. Appreciate any feedback on this. Also, What is the best practice in such cases. public static void main(String[] args) { ArrayList&lt;Integer&gt; list=new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt;[] list2=(ArrayList&lt;Integer&gt;[])new ArrayList[10]; for(int v:list) System.out.println(v); for(int v:list2[v]) System.out.println(v); }
answer count: 4
tagged with: arrays
type: UnansweredQuestion
has title: Why the following code gives an error
has answer: http://stackoverflow.com/a/27054417
type: Question
has answer: http://stackoverflow.com/a/27054455

http://stackoverflow.com/comment/42724830
comment on: http://stackoverflow.com/a/27110556
has text: About reading material, I recommend the javadoc of [`LambdaMetaFactory`](https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/LambdaMetafactory.html) as a great starting point.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42733951
type: AnswerComment
comment on: http://stackoverflow.com/a/27115564
has text: Thanks for watchin my back.
type: Comment
score: 2

http://stackoverflow.com/comment/42650370
has text: the second answer has code to extend the component. I have not tested this. edited answer to include it.
type: AnswerComment
comment on: http://stackoverflow.com/a/27067303
score: 0
type: Comment

http://stackoverflow.com/a/27118198
has comment: http://stackoverflow.com/comment/42738529
answers question: http://stackoverflow.com/q/27117925
score: 0
type: Answer
has body: Two ways to go about this: 1) As stated already, look at the System.out.format directory. It has a wide availability of methods to format your output 2) Change the spacing in a manual way, where the spacing depends on the amount of characters in the number to the left.

http://stackoverflow.com/a/27011077
has body: You have add to cart button so on clicking on it you can have Ajax call and use appropriate request mapping in controller. Add to cart item? In Javascript, you can pass parameter and give type as POST for ajax request. JavaScript code function addItemToCard(itemNo,targetURL){ $.ajax(function(){ url:targetURL, type:"POST", data:"itemNumber":itemNo, success:function(response){ alert("Added successfully"); } }); }
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27010706
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/42679326
has text: Have you tried using a fully qualified path to the file? You can try testing for the file's existence using [File#exists()](https://docs.oracle.com/javase/7/docs/api/java/io/File.html#exists())
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27085098
type: Comment

http://stackoverflow.com/q/27063892
has body: I am trying to validate a json when deserialize it using constraints annotations but it doesn't seem to work. for example import com.fasterxml.jackson.annotation.JsonProperty; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; public class SimpleFooRequest { @NotNull @JsonProperty(value = "count") @Min(value = 100,message = "must be min 10") private Integer count; @NotNull private String name; public String getName() {return name; } public void setName(String name) { this.name = name; } public Integer getCount() {return count;} public void setCount(Integer count) {this.count = count;} } when trying to unmarshal the json @Test public void testFooRequest() throws Exception { String fooJson = {"count":-10} ObjectMapper mapper = new ObjectMapper() SimpleFooRequest request = mapper.readValue(fooJson,SimpleFooRequest.class); assert request.getCount().equals(-10);//expected fail but it pass !!! } it seems to pass although I expected that the assertion will fail due to the count min value limitation . I also tried to put the annotations on the setters but got same results I have &lt;mvc:annotation-driven /&gt; and hibernate-validator-4.3.1.Final.jar in my dependencies I know that I can create custom validator but I thought that for simple validations I can use the annotations . what do I need to do to make it work ?
type: Question
has answer: http://stackoverflow.com/a/27065401
score: 10
has title: validating json using constraints annotations is not working
tagged with: java
accepted answer: http://stackoverflow.com/a/27065401
tagged with: http://stackoverflow.com/tag/json
answer count: 2
possible better answer: http://stackoverflow.com/a/35681613
upvote count: 10
has answer: http://stackoverflow.com/a/35681613
tagged with: jackson
type: AnsweredQuestion
tagged with: validation
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42683991
type: QuestionComment
has text: Simple answer, use a real CSV parsing library. [OpenCSV](http://opencsv.sourceforge.net/), for example, is excellent.
score: 0
comment on: http://stackoverflow.com/q/27088108
type: Comment

http://stackoverflow.com/comment/42706568
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27100618
has text: @use please explain what you mean

http://stackoverflow.com/comment/42627495
comment on: http://stackoverflow.com/a/27048547
type: Comment
has text: I am using the delta importer with the last_update timestamp also. I fetches all data that has got changed before 30 min or something.But that query is also taking timeout.This is mainly because i have like 15 tables doing left joins in the mysql delta import query. So Is there anything I can do it by batches???
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42715906
type: Comment
has text: Meh. I'll just do what you said and look at it later. Thanks.
comment on: http://stackoverflow.com/a/27106068
score: 0
type: AnswerComment

http://stackoverflow.com/q/27055159
tagged with: java
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/42626804
has comment: http://stackoverflow.com/comment/42626772
score: 0
linked to: http://stackoverflow.com/q/13110716
has comment: http://stackoverflow.com/comment/42626686
has comment: http://stackoverflow.com/comment/42627314
type: UnansweredQuestion
has title: open a file with windows default program when a user clicks a link to text file on webpage
has body: I am writing a web application in java. When a user clicks on a link on my web page, I want that the file should be opened in default program of user. I dont want that file to be opened in browser. till now, when i click link, the file downloads. here is my code : Click here to download
answer count: 0

http://stackoverflow.com/a/27120350
answers question: http://stackoverflow.com/q/27120183
type: Answer
accepted answer of: http://stackoverflow.com/q/27120183
has comment: http://stackoverflow.com/comment/42742739
score: 0
has body: Try like this using Handler, It may work. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_alert); wm = (WifiManager) getSystemService(WIFI_SERVICE); Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { if(!wm.isWifiEnabled()) { runOnUiThread(new Runnable() { public void run() { if(pd == null) pd = ProgressDialog.show(this, "Network Error!!", "Network not found.Please make sure there is presence of any kind of network connection!!"); } }); }else{ runOnUiThread(new Runnable() { public void run() { if(pd != null) pd.dismiss(); Intent in=new Intent(Alert.this,WebPageView.class); startActivity(in); } }); } handler.postDelayed(this, 5000); //now is every 2 minutes } }, 5000); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42742602

http://stackoverflow.com/a/27006951
type: Answer
has body: This is how it should be class Main { public static void main(String args[]) { int num1=1; int num2=2; int num1=3; Input f = new Input(); f.inputting(num1, num2, num3); } } Also, you should use ELSE IF!, if not, it could enters the 3 ifs... if (number1 &gt; number2) { int temp = number1; number1 = number2; number2 = temp; } else if (number2 &gt; number3) { int temp = number2; number2 = number3; number3 = temp; } else if (number1 &gt; number2) { int temp = number1; number1 = number2; number2 = temp; }
score: 0
answers question: http://stackoverflow.com/q/27006715

http://stackoverflow.com/q/27074226
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/6865538
has body: I have installed mysql in my computer.and also have jetty.. My requirement:- I have a database student with table name ari; ari table is:- +----+-------+ | id | name | +----+-------+ | 22 | Sandy | +----+-------+ from My Android program I want to fetch it from database..I have done this:- MainActivity.java public class MainActivity extends Activity { private static final String url = "jdbc:mysql://localhost:3306/student"; private static final String user = "root"; private static final String pass = "root"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); testDB(); } public void testDB() { TextView tv = (TextView)this.findViewById(R.id.textView1); try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url, user, pass); String result = "Database connection success\n"; Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select * from ari"); ResultSetMetaData rsmd = rs.getMetaData(); while(rs.next()) { result += rsmd.getColumnName(1) + ": " + rs.getInt(1) + "\n"; result += rsmd.getColumnName(2) + ": " + rs.getString(2) + "\n"; } tv.setText(result); } catch(Exception e) { e.printStackTrace(); tv.setText(e.toString()); } } } and activity_main.xml is:-- <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> and the manifext file is:--- <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.INTERNET" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> But the problem is when I run that program in my android phone or emulator it is showing that:-- com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not crea…
type: UnansweredQuestion
tagged with: android
has title: Connect to mysql database in Android with java
has comment: http://stackoverflow.com/comment/42660178
has comment: http://stackoverflow.com/comment/42660224
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42660199
linked to: http://stackoverflow.com/q/19486119
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/42660137
type: Question
has answer: http://stackoverflow.com/a/27074337
has comment: http://stackoverflow.com/comment/42660136
has comment: http://stackoverflow.com/comment/42660235
linked to: http://stackoverflow.com/q/11105529
has comment: http://stackoverflow.com/comment/42660206
answer count: 1
duplicate of: http://stackoverflow.com/q/11105529

http://stackoverflow.com/comment/42628223
has text: To read property from user home means out of the context path use real path to file
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27056096

http://stackoverflow.com/a/45229538
score: 4
has comment: http://stackoverflow.com/comment/77915605
has comment: http://stackoverflow.com/comment/131817451
upvote count: 4
has comment: http://stackoverflow.com/comment/77910819
has comment: http://stackoverflow.com/comment/77759980
downvote count: 0
has comment: http://stackoverflow.com/comment/77957428
type: Answer
answers question: http://stackoverflow.com/q/27034897
has comment: http://stackoverflow.com/comment/131812960
has body: It is pretty simple Init section JavaScriptInterface jsInterface = new JavaScriptInterface(this); webView.getSettings().setJavaScriptEnabled(true); webView.addJavascriptInterface(jsInterface, "JSInterface"); JavaScriptInterface public class JavaScriptInterface { private Activity activity; public JavaScriptInterface(Activity activiy) { this.activity = activiy; } @JavascriptInterface public void putData(byte[] bytes){ //do whatever } } Js section &lt;script&gt; function putAnyBinaryArray(arr) { var uint8 = Uint8Array.from(arr); window.JSInterface.putData(uint8); }; &lt;/script&gt; TypedArray.from polyfill if need : https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from
has comment: http://stackoverflow.com/comment/77759986
has comment: http://stackoverflow.com/comment/77926135
has comment: http://stackoverflow.com/comment/77895900

http://stackoverflow.com/a/27256475
has body: So turns out this is made possible by adding a FilterExpression to the query (introduced recently in this blog post) I had seen this in the DynamoDB documentation but hadn't upgraded to the latest AWS Java SDK :( Using my above example this would look like: Map&lt;String, AttributeValue&gt; expressionAttributeValues = new HashMap&lt;String, AttributeValue&gt;(); expressionAttributeValues.put(":val1", new AttributeValue().withS("someValue1")); expressionAttributeValues.put(":val2", new AttributeValue().withS("someValue2")); DynamoDBQueryExpression&lt;Item&gt; queryExpression = new DynamoDBQueryExpression&lt;Item&gt;() .withHashKeyValues(itemKey) .withFilterExpression("COLUMN_1 &lt;&gt; :val1 AND COLUMN_1 &lt;&gt; :val2") .withExpressionAttributeValues(expressionAttributeValues) .withLimit(pPageSize); Thanks AWS Support!
type: AcceptedAnswer
type: Answer
upvote count: 27
downvote count: 0
has comment: http://stackoverflow.com/comment/59571715
answers question: http://stackoverflow.com/q/27135725
score: 27
accepted answer of: http://stackoverflow.com/q/27135725

http://stackoverflow.com/comment/42738513
comment on: http://stackoverflow.com/q/27118220
score: 0
type: Comment
type: QuestionComment
has text: I cannot currently compile. Is this an effective way?

http://stackoverflow.com/comment/42585877
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27031130
has text: Making `getInstance()` non-static means not using the Singleton pattern, as you would then need an instance of the singleton to call `getInstance()`.
score: 0

http://stackoverflow.com/a/27142291
has comment: http://stackoverflow.com/comment/42793346
score: -1
has comment: http://stackoverflow.com/comment/42803087
has comment: http://stackoverflow.com/comment/42818736
downvote count: 1
has comment: http://stackoverflow.com/comment/42793822
has comment: http://stackoverflow.com/comment/42800394
type: Answer
answers question: http://stackoverflow.com/q/27142046
has comment: http://stackoverflow.com/comment/42781699
upvote count: 0
has body: Yes , you can possibly tokenize the string characters . Use charAt(int index) to tokenize the string characters. You can see the example code below : - for(int i=0 ; i&lt;stringNameOrg.length ; i++) { if(stringNameOrg.charAt(i) != stringNameNew.charAt(i))) //considering both strings are of same size { //do stuff } }
has comment: http://stackoverflow.com/comment/42793508

http://stackoverflow.com/q/27102131
downvote count: 0
has title: Using highchart SVG images with Selenium
favorite count: 0
accepted answer: http://stackoverflow.com/a/27102879
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/svg
tagged with: selenium
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27102650
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27102879
has body: I'm after some help when running a Selenium test in java where I have SVG high chart images on a page. The issue I have is that I am having trouble getting selenium to recognise each element on the high chart, and in turn clicking on them to fire off another event. I've attached a screenshot below, which I hope highlights what I am trying to do I don't think the HTML snippet is clear on the screen shot, so I have outlined this below: Created with Highcharts 3.0.4 <defs> <rect rx="5" ry="5" fill="#FFFFFF" x="0" y="0" width="588" height="300"> <g class="highcharts-grid" zIndex="1"> <g class="highcharts-grid" zIndex="1"> <g class="highcharts-axis" zIndex="2"> <g class="highcharts-axis" zIndex="2"> <g class="highcharts-series-group" zIndex="3"> <g class="highcharts-series highcharts-tracker" visibility="visible" zIndex="0.1" transform="translate(62,51) scale(1 1)" style="cursor:pointer;" clip-path="url(#highcharts-1)"> <rect fill="#ECB631" x="26.5" y="52.5" width="49" height="121" stroke="#FFFFFF" stroke-width="1" rx="0" ry="0"> <rect fill="#ECB631" x="130.5" y="150.5" width="49" height="23" stroke="#FFFFFF" stroke-width="1" rx="0" ry="0"> <rect fill="#ECB631" x="233.5" y="168.5" width="49" height="5" stroke="#FFFFFF" stroke-width="1" rx="0" ry="0"> <rect fill="#ECB631" x="336.5" y="162.5" width="49" height="11" stroke="#FFFFFF" stroke-width="1" rx="0" ry="0"> <rect fill="#ECB631" x="439.5" y="17.5" width="49" height="156" stroke="#FFFFFF" stroke-width="1" rx="0" ry="0"> </g> <g class="highcharts-markers" visibility="visible" zIndex="0.1" transform="translate(62,51) scale(1 1)"> </g> Essentially, I want to click on the 'Instruct Agents' highchart, which will then fire off an event and allow me to continue with my test. If anyone can provide some help to set me on my way, I'd appreciate it. CODE SNIPPET public static void terminatedReportCompletedBarGraphSelect(InternetExplorerDriver driver) { WebElement parent = driver.findElement(By.className("highcharts-series-group")…
possible better answer: http://stackoverflow.com/a/27102650
answer count: 2
tagged with: highcharts

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/27005509
tags question: http://stackoverflow.com/q/27082599
tags question: http://stackoverflow.com/q/27014730
tags question: http://stackoverflow.com/q/27122447
tags question: http://stackoverflow.com/q/27035715
tags question: http://stackoverflow.com/q/27128638
tags question: http://stackoverflow.com/q/27133161
tags question: http://stackoverflow.com/q/27043414
tags question: http://stackoverflow.com/q/27064634
tags question: http://stackoverflow.com/q/27121592
tags question: http://stackoverflow.com/q/27059469
tags question: http://stackoverflow.com/q/26992252
tags question: http://stackoverflow.com/q/27057150
tags question: http://stackoverflow.com/q/26993203
tags question: http://stackoverflow.com/q/27063892
tags question: http://stackoverflow.com/q/27043619
tags question: http://stackoverflow.com/q/27007679
tags question: http://stackoverflow.com/q/27007034
tags question: http://stackoverflow.com/q/27150077
tags question: http://stackoverflow.com/q/27126839
tags question: http://stackoverflow.com/q/27129922
tags question: http://stackoverflow.com/q/27098535
tags question: http://stackoverflow.com/q/26992338
tags question: http://stackoverflow.com/q/27024361
tags question: http://stackoverflow.com/q/27006158
tags question: http://stackoverflow.com/q/27146185
tags question: http://stackoverflow.com/q/27009768
tags question: http://stackoverflow.com/q/27093856
tags question: http://stackoverflow.com/q/27009878
tags question: http://stackoverflow.com/q/27079494
tags question: http://stackoverflow.com/q/27131722
tags question: http://stackoverflow.com/q/27019151
tags question: http://stackoverflow.com/q/27119177
tags question: http://stackoverflow.com/q/27080231
tags question: http://stackoverflow.com/q/27109953
type: Tag
tags question: http://stackoverflow.com/q/27071871
tags question: http://stackoverflow.com/q/27143092
tags question: http://stackoverflow.com/q/27030898
tags question: http://stackoverflow.com/q/27047654
tags question: http://stackoverflow.com/q/27090833
tags question: http://stackoverflow.com/q/27059815
tags question: http://stackoverflow.com/q/27103015
tags question: http://stackoverflow.com/q/27056075
tags question: http://stackoverflow.com/q/27144700
tags question: http://stackoverflow.com/q/26997252
tags question: http://stackoverflow.com/q/26995461
tags question: http://stackoverflow.com/q/27111143
tags question: http://stackoverflow.com/q/27119243
tags question: http://stackoverflow.com/q/27108965
tags question: http://stackoverflow.com/q/27003081
tags question: http://stackoverflow.com/q/27053463
tags question: http://stackoverflow.com/q/27018429
tags question: http://stackoverflow.com/q/27044614
tags question: http://stackoverflow.com/q/27104197
tags question: http://stackoverflow.com/q/27021629
tags question: http://stackoverflow.com/q/27039511
tags question: http://stackoverflow.com/q/27091834
tags question: http://stackoverflow.com/q/27092828
tags question: http://stackoverflow.com/q/27061189
tags question: http://stackoverflow.com/q/27133797
tags question: http://stackoverflow.com/q/27014417
tags question: http://stackoverflow.com/q/27059808
tags question: http://stackoverflow.com/q/27071656
tags question: http://stackoverflow.com/q/27060730
tags question: http://stackoverflow.com/q/27013063
tags question: http://stackoverflow.com/q/27026815
tags question: http://stackoverflow.com/q/27107449
tags question: http://stackoverflow.com/q/27136604
tags question: http://stackoverflow.com/q/27064044
tags question: http://stackoverflow.com/q/27146518
tags question: http://stackoverflow.com/q/27141534
tag name: json
tags question: http://stackoverflow.com/q/27037695
tags question: http://stackoverflow.com/q/27078578
tags question: http://stackoverflow.com/q/27068490
tags question: http://stackoverflow.com/q/27049841
tags question: http://stackoverflow.com/q/27041544
tags question: http://stackoverflow.com/q/26992383
tags question: http://stackoverflow.com/q/27037896

http://stackoverflow.com/q/27099559
tagged with: java
tagged with: hibernate
has title: processEqualityExpression() : No expression to process! in hql
tagged with: hql
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27100301
favorite count: 0
tagged with: sql-server
accepted answer: http://stackoverflow.com/a/27100301
upvote count: 1
tagged with: spring
type: Question
type: AnsweredQuestion
has body: i have a below query it executing and provide the exact result in mssql server. SELECT count(Distinct(DATEPART(wk,spentDate))) FROM tblTimesheet where TimesheetStatus = 'Pending' and Approver = 6 I wrote the equivalent criteria for the above query below Query query = sessionfactory.getCurrentSession().createQuery("SELECT count(Distinct(DATEPART(wk,spentDate))) FROM TblTimesheet where timesheetStatus =:status and tblUserDetailsByApprover =:app"); query.setParameter("app", user); query.setParameter("status","Pending"); List results = query.list(); logger.info("size"+results.size()); But i am getting the below exception 2014-11-24 12:50:48,310 ERROR org.hibernate.hql.PARSER.reportError:33 - line 1:22: unexpected token: ( 2014-11-24 12:38:11,502 WARN org.hibernate.hql.ast.HqlParser.processEqualityExpression:203 - processEqualityExpression() : No expression to process! 2014-11-24 12:38:11,503 INFO com.uniphore.timesheet.controller.ApproveTimesheetController.getTimesheet:53 - Messageunexpected token: ( near line 1, column 22 [SELECT count(Distinct(DATEPART(wk,spentDate))) FROM com.uniphore.timesheet.domain.TblTimesheet where timesheetStatus =:status and tblUserDetailsByApprover =:app] How to resolve this exception. Any help will be greatly appreciated!!!
score: 1

http://stackoverflow.com/q/27078118
has title: Why is my GridLayout not working? (JPanel in JFrame)
downvote count: 1
type: Question
upvote count: 0
tagged with: layout
has comment: http://stackoverflow.com/comment/42666497
has comment: http://stackoverflow.com/comment/42666652
has answer: http://stackoverflow.com/a/27078458
answer count: 1
favorite count: 0
score: -1
accepted answer: http://stackoverflow.com/a/27078458
tagged with: swing
tagged with: grid
has body: So I got bored and wanted to make a little commando prompt in Java. At the moment I'm remaking the ls-command from the Bash-Shell on Linux. Since the command prompt itself is just a small window I have to show the result of the ls-command in a separate window, I thought a little list with all the files in the directory (which is what ls does) popping up on the right of the prompt would be nice. I just called it sideWindow and made it JFrame, because I failed when I tried to make it a Dialog. As tutorials suggest, I add a JPanel and set its Layout to Grid, having only one column because I want the sideWindow to basically show a list of all the files in a directory, one file under the other. So the number of rows depends on the number of files in that directory, and so does the size of the Frame. But for some reason that window doesn't show at all, I didn't even set a location where it would show up yet. I bet it's a really stupid mistake coming from my inexperience but I just can't figure it out. My code might be too confusing and stupid, but I hope someone can tell what my mistake is. The important part is the ls-method I guess. Thanks in Advance! Here's the code: import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.net.URI; import java.io.*; public class CommandPrompt extends JFrame implements KeyListener{ /** * */ private static final long serialVersionUID = 1231231; JTextField eingabe = new JTextField(); Desktop desktop = Desktop.getDesktop(); JLabel path = new JLabel(); String pathName = "/"; public CommandPrompt() { setTitle("Colamanndo"); setSize(402,88); setResizable(false); setLayout(null); setBackground(Color.black); eingabe.setToolTipText("Ich mag Cola"); eingabe.setSize(399,30); eingabe.setLocation(1,1); eingabe.setBackground(Color.black); eingabe.setForeground(Color.green); eingabe.addKeyListener(this); add(eingabe); path.setText(pathName); path.setToolTipText("Tu ich wirklich"); path.setSize(399,30); path.setLocation(3,24); add(…
type: AnsweredQuestion
tagged with: java
tagged with: jpanel

http://stackoverflow.com/a/27099116
has comment: http://stackoverflow.com/comment/42740870
type: Answer
has comment: http://stackoverflow.com/comment/42741702
has comment: http://stackoverflow.com/comment/42741527
has comment: http://stackoverflow.com/comment/42719502
has body: As pointed by other answers, I tried to check that even new threads are being created or not, by printing some message at the start of thread task as shown: Thread t = new Thread(new Runnable() { public void run() { System.out.println("New Thread Started"); try{ GetRowForEntityURL(entityID); // Downloads page, processes it and updates the global DSs }catch(Exception e) { System.out.println("Ignored: " + entityID + " Error: " + e.getMessage()); } } }); And it seemed to be single threaded (not a good way to concretely say the conclusion, but I am stating this, as had they been processed in parallel, the corresponding message for each thread should have been printed instantaneously but what happened was one message used to get printed then it used to take a lot time, which must be the processing time, and then after the lag second message used to be printed). So, it was clear that the program was single threaded. I checked again for writing Multithreaded code and then, I realized the mistake: Instead of calling T.run(), we need to call T.start(). This made the code Multithreaded, which I can verify from the instantaneous printing of message. But now, as told by @EJP and @edharned, server is responding with Error codes, but that is a different problem. Correct Code for calling a method in a separate Parallel Thread: ArrayList&lt;Thread&gt; threads = new ArrayList&lt;&gt;(); // Store the thread IDs so that you can join them back - basically it means that your main thread should wait for the parallel threads to complete the task they have been assigned to. while ((entityURL = br.readLine()) != null) { String entityID = entityURL.replace("http://dbpedia.org/resource/", ""); Thread t = new Thread(new Runnable() { public void run() { try{ // Call any Function that you want to be executed in the parallel thread GetRowForEntityURL(entityID); // Downloads page, processes it and updates the global DSs }catch(Exception e) { System.out.println("Ignored: " + entityID + " Error: " +…
score: 0
answers question: http://stackoverflow.com/q/27086986

http://stackoverflow.com/a/27074720
downvote count: 0
answers question: http://stackoverflow.com/q/27074646
has body: For your type of given input example, I would probably match vs splitting. String s = "AM2 + 'G - D08 - 28 - 14 .xlsx]General Inputs'"; Pattern p = Pattern.compile("'[^']*'|[^ '+*/-]+"); Matcher m = p.matcher(s); while (m.find()) { System.out.println(m.group()); } Output AM2 'G - D08 - 28 - 14 .xlsx]General Inputs'
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/42627358
has text: `java.lang.NoClassDefFoundError / java.lang.ClassNotFoundException`. The container is unable to locate the class `ConfigurationException` from the `org.apache.commons.configuration` package at run-time. Make sure you did not misplace the required dependencies.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27055347

http://stackoverflow.com/q/27000957
has title: Rendering multiple (simple)animation crashes with: ConcurrentModificationException
tagged with: hashmap
tagged with: java
type: Question
answer count: 2
tagged with: event-handling
tagged with: awt
score: 0
tagged with: concurrentmodification
has answer: http://stackoverflow.com/a/27005115
has body: I'm trying to render simple animations using java.awt(simple explosion on a mouse click at the cursor location). First my Animation class: package animation; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Animation { private BufferedImage spriteSheet; private int currentStateNum; private int spriteSize; private int spritsInWidth; // number of sprites in one row of the spritesheet private long startTime; private long delay; // delay between each sprite private long sicleTime; private long lifeTime; private boolean alive; public Animation(String spriteSheetPath, int spriteSize, int spritsCount, int spritsInWidth, long delay, long lifeTime) { try { this.spriteSheet = ImageIO.read(new File(spriteSheetPath)); this.currentStateNum = 0; this.spriteSize = spriteSize; this.delay = delay; this.spritsInWidth = spritsInWidth; this.sicleTime = delay * spritsCount; this.lifeTime = lifeTime; this.alive = true; this.startTime = System.currentTimeMillis(); } catch (IOException e) { e.printStackTrace(); } } public BufferedImage getCurrentState() { int x = (currentStateNum % spritsInWidth) * spriteSize; int y = (currentStateNum / spritsInWidth) * spriteSize; return spriteSheet.getSubimage(x, y, spriteSize, spriteSize); } public void update() { long currTime = System.currentTimeMillis(); long passedTime = currTime - startTime; alive = passedTime &lt; lifeTime; long currSicleTime = passedTime % sicleTime; currentStateNum = (int) (currSicleTime / delay); } public boolean isAlive() { return alive; } } Now my first attempt of actually rendering the animation looks something like: import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferStrategy; import javax.swing.JFrame; import animation.Animation; public class Main { public static void main(String[] args) { JFrame fram…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32853453

http://stackoverflow.com/comment/42668534
type: Comment
type: QuestionComment
score: 1
has text: " I get a series of exceptions." --> *which* series of exceptions. Be detailed and specific please. Also, your screenshot clearly shows the the advice is to use single *forward* slashes, yet in the path you run you are using *backward* slashes. Change the slashes - even if that doesn't work either, it at least clearly shows that you have followed the obvious advice.
comment on: http://stackoverflow.com/q/27078893

http://stackoverflow.com/comment/42531337
type: QuestionComment
comment on: http://stackoverflow.com/q/27000173
has text: possible duplicate of [java convert to int](http://stackoverflow.com/questions/9670723/java-convert-to-int)
score: 0
type: Comment

http://stackoverflow.com/a/27054311
score: 0
has body: You can use below code. String is immutable so you have to store returned value. String finish = new String(); finish = finish.concat("Any Value"); Using StringBuilder or StringBuffer you can do this way StringBuilder finish = new StringBuilder(); finish.append(state); StringBuffer finish = new StringBuffer(); finish.append(state);
has comment: http://stackoverflow.com/comment/42625356
type: Answer
answers question: http://stackoverflow.com/q/27054215
has comment: http://stackoverflow.com/comment/42625324

swing
tags question: http://stackoverflow.com/q/27084009
tags question: http://stackoverflow.com/q/27006178
tags question: http://stackoverflow.com/q/27135326
tags question: http://stackoverflow.com/q/27079949
tags question: http://stackoverflow.com/q/27034218
tags question: http://stackoverflow.com/q/27053149
tags question: http://stackoverflow.com/q/27067356
tags question: http://stackoverflow.com/q/27027220
tags question: http://stackoverflow.com/q/26996912
tags question: http://stackoverflow.com/q/27145591
tags question: http://stackoverflow.com/q/27078522
tags question: http://stackoverflow.com/q/27025230
tags question: http://stackoverflow.com/q/27049130
tags question: http://stackoverflow.com/q/27117159
tags question: http://stackoverflow.com/q/27104121
tags question: http://stackoverflow.com/q/27077372
tags question: http://stackoverflow.com/q/27051970
tags question: http://stackoverflow.com/q/27002072
tags question: http://stackoverflow.com/q/27131358
tags question: http://stackoverflow.com/q/27104715
tags question: http://stackoverflow.com/q/27075493
tags question: http://stackoverflow.com/q/27085977
tags question: http://stackoverflow.com/q/27031308
tags question: http://stackoverflow.com/q/27129155
tags question: http://stackoverflow.com/q/27107367
tags question: http://stackoverflow.com/q/27041955
tags question: http://stackoverflow.com/q/27037528
tags question: http://stackoverflow.com/q/27086725
tags question: http://stackoverflow.com/q/27011203
tags question: http://stackoverflow.com/q/27062078
tags question: http://stackoverflow.com/q/27032479
tags question: http://stackoverflow.com/q/27052523
tags question: http://stackoverflow.com/q/27010518
tags question: http://stackoverflow.com/q/27062486
tags question: http://stackoverflow.com/q/27124940
tags question: http://stackoverflow.com/q/27152303
tags question: http://stackoverflow.com/q/26995239
tags question: http://stackoverflow.com/q/27141021
tags question: http://stackoverflow.com/q/27149832
tags question: http://stackoverflow.com/q/27115888
tags question: http://stackoverflow.com/q/27073254
tags question: http://stackoverflow.com/q/27069913
tags question: http://stackoverflow.com/q/27057132
tags question: http://stackoverflow.com/q/27136131
tags question: http://stackoverflow.com/q/27084273
tags question: http://stackoverflow.com/q/26994202
tags question: http://stackoverflow.com/q/27049473
tags question: http://stackoverflow.com/q/27059625
tags question: http://stackoverflow.com/q/27046979
tags question: http://stackoverflow.com/q/27016659
tags question: http://stackoverflow.com/q/27128491
tags question: http://stackoverflow.com/q/27104627
tags question: http://stackoverflow.com/q/27021807
tags question: http://stackoverflow.com/q/27063017
tags question: http://stackoverflow.com/q/27146086
tags question: http://stackoverflow.com/q/27065607
tags question: http://stackoverflow.com/q/27106622
tags question: http://stackoverflow.com/q/27107648
tags question: http://stackoverflow.com/q/26994707
tags question: http://stackoverflow.com/q/27077508
tags question: http://stackoverflow.com/q/27009494
tags question: http://stackoverflow.com/q/26996828
tags question: http://stackoverflow.com/q/27040758
tags question: http://stackoverflow.com/q/27011939
tags question: http://stackoverflow.com/q/27031805
tags question: http://stackoverflow.com/q/27114197
tags question: http://stackoverflow.com/q/27103957
tags question: http://stackoverflow.com/q/27031148
tags question: http://stackoverflow.com/q/27043333
tags question: http://stackoverflow.com/q/27057872
tags question: http://stackoverflow.com/q/27045174
tags question: http://stackoverflow.com/q/27092472
tags question: http://stackoverflow.com/q/27146168
tags question: http://stackoverflow.com/q/27034593
tags question: http://stackoverflow.com/q/27146593
tags question: http://stackoverflow.com/q/27089290
tags question: http://stackoverflow.com/q/27086067
tags question: http://stackoverflow.com/q/27120135
tags question: http://stackoverflow.com/q/27150095
tags question: http://stackoverflow.com/q/27094716

http://stackoverflow.com/comment/42608203
type: AnswerComment
type: Comment
has text: @RobertHarvey Before asking how does JDK do/is there, take a look at the source yourself (e.g. AtomicInteger.compareAndSet()). Then you can answer the first of your questions yourself, and the second becomes kind of superflous.
score: 0
comment on: http://stackoverflow.com/a/27044073

http://stackoverflow.com/comment/42623255
has text: please edit in the last 10 or so lines of the stack trace from the exception
comment on: http://stackoverflow.com/q/27052898
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27121384
accepted answer: http://stackoverflow.com/a/27125863
score: 2
type: AnsweredQuestion
has title: javafx how to disable one item in checkboxTreeItem?
upvote count: 2
tagged with: java
tagged with: javafx
tagged with: treeview
has answer: http://stackoverflow.com/a/57367803
type: Question
has comment: http://stackoverflow.com/comment/42748980
has answer: http://stackoverflow.com/a/27143649
possible better answer: http://stackoverflow.com/a/57367803
tagged with: treeviewitem
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/30160726
answer count: 4
has body: I am new to JavaFX and I am having a problem in checkbox Tree View. I want to disable one item inside root value **Serial No but as per JavaFX documentation, it seems that it is not possible. I have disabled click effect cbTreeViewdisable(treeItems, 3) Is there any way to grey out any one value (or set an id) so that user knows it is disabled. private TreeView&lt;String&gt; cbTreeView; @Override public void start(Stage primaryStage) { StackPane root = new StackPane(); cbTreeView = new TreeView(); CheckboxTreeItem&lt;String&gt; rootItem = new CheckboxTreeItem("Serial No."); final CheckboxTreeItem[] treeItems = new CheckboxTreeItem[6]; for (int i = 0; i &lt; 6; i++) { treeItems[i] = new CheckboxTreeItem(""+i+""); rootItem.getChildren().addAll(treeItems[i]); } root.setExpanded(true); CheckboxTreeItem rootItem2 = new CheckboxTreeItem("child1"); final CheckboxTreeItem[] treeItems2 = new CheckboxTreeItem[6]; for (int i = 0; i &lt; 6; i++) { treeItems2[i] = new CheckboxTreeItem(""+i+""); rootItem2.getChildren().addAll(treeItems2[i]); } cbTreeView.setRoot(rootItem); cbTreeView.setCellFactory(CheckboxTreeCell.&lt;String&gt;forTreeView()); rootItem.getChildren().set(2,rootItem2); cbTreeViewdisable(treeItems, 3); //rest of code imports css and draws stage which is not relevant to my question } private void cbTreeViewdisable(final CheckboxTreeItem[] treeItems, final int id) { treeItems[id].setIndependent(Boolean.TRUE); treeItems[id].setValue(treeItems[id].getValue().toString()+" Note: you can't select this!)"); treeItems[id].selectedProperty().addListener(new ChangeListener&lt;Boolean&gt;() { @Override public void changed(ObservableValue&lt;? extends Boolean&gt; observable, Boolean oldvalue, Boolean newvalue) { Platform.runLater(new Runnable() { @Override public void run() { treeItems[id].setSelected(Boolean.FALSE); }
has answer: http://stackoverflow.com/a/27125863

http://stackoverflow.com/comment/42632671
type: AnswerComment
type: Comment
has text: i tried this method and it resulted in the same way like interceptor..logout method of `SecurityContextLogoutHandler` is called even before the Listener which already destroys the session....
comment on: http://stackoverflow.com/a/27058643
score: 0

http://stackoverflow.com/q/27078208
has comment: http://stackoverflow.com/comment/42667412
tagged with: java
has comment: http://stackoverflow.com/comment/42703536
has comment: http://stackoverflow.com/comment/42689718
type: Question
has comment: http://stackoverflow.com/comment/42811261
has comment: http://stackoverflow.com/comment/42674447
has title: Java multicast client server
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has body: I try to create a program which is based on client/server communication. In this program I have several clients and several servers. At the beginning of the program some clients go up, and wait for new connections from different servers. When the first server goes up, I want him to know who is the clients that are available in the network, and then it begins to communicate with all these clients in tcp protocol (ServerSocket). However, if a new clients goes up, this server should know about it. The same happens when new servers go up. My first think, is to use multicast commnication. The client will send every 5 seconds a broadcast to the networks and the servers will listen to these messages. My broblem is how to combine these two methods (multicast and tcp) in order to built this program. Should I use two differnet ports one for the multicast, and one for the tcp protocol? Is it possible to allow the server\client to listen for different communication (multicast or tcp) with treads? I just need a litle push, and some basic code in order to begin this... EDIT: OK, I succeeded to built a multicast comunication. The agent goes up, and send every 5 seconds its name. the server goes up, and receives the agent's broadcast. If a new agent goes up, the server know about it. The code look like this: Agent code: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; import java.util.Scanner; public class Agent { private static int portMulticasting = 1004; private DatagramSocket socket; private boolean broadcast = true; private String group = "230.0.0.1"; //group address private int delay = 5000; public Agent(){ try{ socket = new DatagramSocket(); System.out.println("agent ready"); } catch (SocketException e){ e.printStackTrace(); Sy…
answer count: 0
score: 0
tagged with: tcp

recursion
tags question: http://stackoverflow.com/q/27085827
type: Tag
tags question: http://stackoverflow.com/q/27077068
tags question: http://stackoverflow.com/q/27043922
tags question: http://stackoverflow.com/q/27025766
tags question: http://stackoverflow.com/q/27141280
tags question: http://stackoverflow.com/q/26999824
tags question: http://stackoverflow.com/q/27111318
tag name: recursion
tags question: http://stackoverflow.com/q/27068012
tags question: http://stackoverflow.com/q/27094763
tags question: http://stackoverflow.com/q/27119528
tags question: http://stackoverflow.com/q/27094614
tags question: http://stackoverflow.com/q/27139229
tags question: http://stackoverflow.com/q/27095081
tags question: http://stackoverflow.com/q/27109981
tags question: http://stackoverflow.com/q/27118479
tags question: http://stackoverflow.com/q/27049547
tags question: http://stackoverflow.com/q/27078952
tags question: http://stackoverflow.com/q/27034555
tags question: http://stackoverflow.com/q/27094335
tags question: http://stackoverflow.com/q/27041517
tags question: http://stackoverflow.com/q/27073081
tags question: http://stackoverflow.com/q/27104464
tags question: http://stackoverflow.com/q/27048588
tags question: http://stackoverflow.com/q/27113184
tags question: http://stackoverflow.com/q/27092905
tags question: http://stackoverflow.com/q/27005534
tags question: http://stackoverflow.com/q/27029983
tags question: http://stackoverflow.com/q/27006314
tags question: http://stackoverflow.com/q/27018398

http://stackoverflow.com/comment/42694404
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27086168
has text: >_< This is actually for a programming competition that doesn't allow external resources.
score: 0

http://stackoverflow.com/q/27036908
has body: I have a loggers.config file that specifies a custom file handler to format log messages to a file. The handler wont work unless a create a default file with the specified file pattern. It then creates a new file with a 0 appended to it as specified by the pattern and starts logging to that. How can I get it to log to a file without specifying a default file first. Here is the logging file: handlers=com.daniel.logging.MyFileHandler # Default global logging level. # This specifies which kinds of events are logged across # all loggers. For any given facility this global level # can be overriden by a facility specific level # Note that the ConsoleHandler also has a separate level # setting to limit messages printed to the console. .level= INFO com.daniel.logging.MyFileHandler.level=INFO # Naming style for the output file: com.daniel.logging.MyFileHandler.pattern=daniel%g.log # Limiting size of output file in bytes -defaulted to 1MB: com.daniel.logging.MyFileHandler.limit=1MB # Number of output files to cycle through, by appending an # integer to the base file name: com.daniel.logging.MyFileHandler.count=10 # Style of output (Simple or XML): com.daniel.logging.MyFileHandler.formatter=com.daniel.logging.MyLogFormatter # Limit the message that are printed on the console to INFO and above. java.util.logging.ConsoleHandler.level = INFO java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter In the installer (this is an application logging properties file there was a file created there is a line specifying the logger.config file as logger.properties. A couple of lines later a file was created and the command CMD [@] >> default_file 2>&amp;1. I am not sure what that line does (I'm quite new to bash)
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/42616802
tagged with: logging
type: Question
linked to: http://stackoverflow.com/q/22447430
has comment: http://stackoverflow.com/comment/42617397
tagged with: java
has title: File Handler doesn't start working until i have a file created
has comment: http://stackoverflow.com/comment/42605614
has answer: http://stackoverflow.com/a/27050925
tagged with: filehandler
answer count: 1
tagged with: config

http://stackoverflow.com/a/27028459
answers question: http://stackoverflow.com/q/27028230
has body: Nothing is wrong with your code. Respect the type when you are entering your data. Do not enter a double while you are expecting an integer, etc. You can get around this type of error by applying defensive coding where you only accept data from the user when it complies with the expected value. public static void main(String[] arg) { Scanner keyboard = new Scanner(System.in); System.out.println( "What city is the capital of Germany?" ); keyboard.nextLine(); System.out.println( "What is 6 divided by 2?" ); boolean isNotCorrect = true; while(isNotCorrect){ isNotCorrect = true; try { Integer.valueOf(keyboard.nextLine()); isNotCorrect = false; } catch (NumberFormatException nfe) { System.out.println( "Enter an integer value" ); } } System.out.println( "What is your favorite number between 0.0 and 1.0?" ); isNotCorrect = true; while(isNotCorrect){ try { Double.valueOf(keyboard.nextLine()); isNotCorrect = false; } catch (NumberFormatException nfe) { System.out.println( "Enter a double value" ); } } System.out.println( "Is there anything else you would like to tell me?" ); keyboard.next(); }
score: 0
type: Answer

http://stackoverflow.com/q/27094804
score: 0
answer count: 2
tagged with: apache
has title: How to use BicubicSplineInterpolator in Apache Commons Math?
has answer: http://stackoverflow.com/a/27118192
tagged with: interpolation
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40477321
has body: I have three arrays x,y and value. for each x,y , f(x,y) = value; I did not understand how to use the BicubicSplineInterpolator class. I need to find values for different x and y Here is a link to the class http://commons.apache.org/proper/commons-math/javadocs/api-3.3/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.html TIA
tagged with: java
type: Question

http://stackoverflow.com/comment/42576693
score: 1
has text: `KeyListener` will only be activated if the component it is registered to is focusable AND has focus. If the UI has some other component (like a button or textfield) then this will not work.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27026516

http://stackoverflow.com/q/27068178
score: 0
tagged with: spring-ioc
answer count: 3
accepted answer: http://stackoverflow.com/a/27070608
tagged with: spring
has title: Having Spring's IoC container instantiate beans with zero config (like Google Guice's behaviour)
type: AnsweredQuestion
has body: I have a hobby-project which I would like to migrate to Spring. As an example I have the following classes: public class OtherBean { public void printMessage() { System.out.println("Message from OtherBean"); } } public class InjectInMe { @Inject OtherBean otherBean; public void callMethodInOtherBean() { otherBean.printMessage(); } } However as I read the documentation, I must annotate all classes to be managed by Spring with an annotation like @Component (or others that are similar). Running it with the following code: public class SpringTest { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.refresh(); InjectInMe bean = context.getBean(InjectInMe.class); bean.callMethodInOtherBean(); } } Gives me the error: Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [somepackage.InjectInMe] is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:371) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968) at somepackage.SpringTest.main(SpringTest.java:10) My question is: is there a way to make Spring manage any class I ask the ApplicationContext to instantiate without me having to register them in an Annotated Config (or XML config)? In Guice I can just inject into the class public class GuiceTest { static public class GuiceConfig extends AbstractModule { @Override protected void configure() {} } public static void main(String[] args) { Injector injector = Guice.createInjector(new GuiceConfig()); InjectInMe bean = injector.getInstance(InjectInMe.class); bean.callMethodInOtherBean(); } } Gives me the output: Message from OtherBean Is there anyway I can make Spring work like Guice? As in m…
tagged with: java
has answer: http://stackoverflow.com/a/27068333
type: Question
tagged with: guice
possible better answer: http://stackoverflow.com/a/27068231
has answer: http://stackoverflow.com/a/27070608
has answer: http://stackoverflow.com/a/27068231

http://stackoverflow.com/comment/63615802
has text: The day will come when Google decided to kill off the link. So my future self will stumble on your answer and wondering, what was your answer actually?
type: Comment
comment on: http://stackoverflow.com/a/27267095
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42782077
type: Comment
has text: Before I leave do you have any advice to fix my drop method ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27142095

http://stackoverflow.com/q/27047044
type: UnansweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/46337021
has title: Download a zip file using Selenium WebDriver in Java - Download Popup is coming always
type: Question
tagged with: automation
has body: Using the following code I am downloading a file from a website , I am using Firefox 32.0.3 with Selenium jar with version- 2.43. FirefoxProfile firefoxProfile = new FirefoxProfile(); firefoxProfile.setPreference("browser.download.folderList",2); firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false); firefoxProfile.setPreference("browser.helperApps.alwaysAsk.force", false); firefoxProfile.setPreference("browser.download.dir","C:\\RDM_Files"); firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/zip;application/octet-stream;application/x-zip;application/x-zip-compressed"); firefoxProfile.setPreference("plugin.disable_full_page_plugin_for_types", "application/zip"); WebDriver driver = new FirefoxDriver(firefoxProfile); I checked the MIME type of my file being downloaded is application/zip. Every time I try download the file a I get a window asking to either open the file or save it. I searched Stackoverflow.com &amp; found post related to handle a .pdf file but not a zip file. Please help
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/29787683

http://stackoverflow.com/comment/99708823
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27114816
has text: What's the point in declaring parameters in the function header like this -> `static <K, V> void orderByValue`? I just don't get it... isn't this syntax normally used for parametrized types? This chunk doesn't seem to have anything to parametrize, as far as I know... can somebody explain it, please?

http://stackoverflow.com/comment/42541644
type: Comment
type: QuestionComment
has text: I just ran your code and seems to work OK (not great). However, what you need to do is to make your `MouseListener` a class that every single button can use (you don't want to create multiple, identical, anonymous listeners that do the same thing). Then add independent instances of the listener to each button.
score: 0
comment on: http://stackoverflow.com/q/27006029

http://stackoverflow.com/comment/42670343
type: AnswerComment
comment on: http://stackoverflow.com/a/27080073
type: Comment
has text: I agree with @ursa on this point. It would be much better to have a separate `Comparator` for the area comparison. On the other hand, if this is a class assignment and the instructor has told them to do it this way, there's not much you can do. Except maybe override `equals` to be an area comparison.
score: 0

http://stackoverflow.com/q/27067970
possible better answer: http://stackoverflow.com/a/52968464
has title: GSON parsing with Retrofit parsing Flickr JSON response
favorite count: 0
accepted answer: http://stackoverflow.com/a/27068056
score: 5
type: AnsweredQuestion
has body: I seem to have the following problem. I'm using retrofit to get a JSON file and parse it into java object. The URL i'm considering is: https://api.flickr.com/services/rest/?method=flickr.photos.search&amp;api_key=2ef592bfddc86f508550184ec706a2fc&amp;tags=gent&amp;per_page=2&amp;format=json which replies with : jsonFlickrApi({"photos":{"page":1,"pages":130008,"perpage":2,"total":"260016","photo":[{"id":"15817874286","owner":"36687364@N07","secret":"e480e6fe0c","server":"7475","farm":8,"title":"3D visualisatie","ispublic":1,"isfriend":0,"isfamily":0},{"id":"15817785516","owner":"36687364@N07","secret":"132f12dff1","server":"7496","farm":8,"title":"schetsontwerp","ispublic":1,"isfriend":0,"isfamily":0}]},"stat":"ok"}) I believe the problem lies in the jsonFlickrApi in front of the response. When executing the following code: @GET("/rest/") void getPhotos(@Query("method") String method,@Query("api_key") String apiKey,@Query("tags") String tags,@Query("per_page")String perPage,@Query("format") String format, Callback&lt;FlickrResult&gt; data); and flickerRestAPI.getPhotos("flickr.photos.search","2ef592bfddc86f508550184ec706a2fc","gent","10","json",new Callback&lt;FlickrResult&gt;() { @Override public void success(FlickrResult photos, Response response) { Log.i(TAG, " " + photos.toString()); } @Override public void failure(RetrofitError error) { Log.e(TAG,"Failed"); Log.e(TAG," " +error.getUrl()); Log.e(TAG," "+error.getMessage()); } }); } I get 11-21 19:15:54.476 12058-12058/be.hogent.festivalproject E/MainActivity﹕ com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ The wrapper classes I'm using are: public class FlickrResult { @SerializedName("photos") public FlickrPhotos photos; } public class FlickrPhotos { public int page; public String pages; public int perpage; public String total; public ArrayList&lt;FlickrPhoto&gt; photo; public String stat;} public class FlickrPhoto { public String…
tagged with: java
tagged with: gson
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27068056
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/52968464
tagged with: retrofit
tagged with: android

http://stackoverflow.com/q/27094610
tagged with: java
type: Question
tagged with: sbt
has answer: http://stackoverflow.com/a/27097500
has answer: http://stackoverflow.com/a/49663337
possible better answer: http://stackoverflow.com/a/72744574
has answer: http://stackoverflow.com/a/72744574
has answer: http://stackoverflow.com/a/27095198
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27095198
tagged with: scala
score: 34
answer count: 4
upvote count: 34
type: AnsweredQuestion
has title: where to find downloaded library of sbt?
has body: Where does sbt put the downloaded jar? I'm trying to ask sbt to download all dependencies and put them under lib/ directory so I can use them with the ScalaIDE, however after I ran sbt compile successfully I don't know where to find these downloaded .jars

http://stackoverflow.com/comment/42685964
type: QuestionComment
score: 0
has text: @Muhammad Yes problem is Size of image is bigger how resize it according to jlabel
type: Comment
comment on: http://stackoverflow.com/q/27089290

http://stackoverflow.com/comment/42728815
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27068785
score: 0
has text: @fonkap Thanks for your reply. Tomcat server and testcase both prints out same 'repository/com/sun/xml/bind/jaxb-impl/2.1.11/jaxb-impl-2.1.11.jar'. Testcase was failing during spring container startup. To make it work i disabled bean loading and just printed this statement to check which jar is in preference.

http://stackoverflow.com/q/27014981
score: 0
answer count: 1
tagged with: amazon-web-services
tagged with: tomcat
has answer: http://stackoverflow.com/a/27782890
type: UnansweredQuestion
has body: i am trying to deploy a java webapp/tomcat using AWS opsworks, but i am not finding any cookbooks which configures tomcat on ec2 and then deploy my java app. can someone please provide me with the custom cookbook for that. I need both the link to the application and the custom cookbook. actually i am trying to do it with the cloud formation template. My cloud formation template "myStack": { "Type": "AWS::OpsWorks::Stack", "Properties": { "CustomCookbooksSource": { "Type": "git", **"Url": "xxx (url for the cookbook)"** } } } -- "myApp": { "Type": "AWS::OpsWorks::App", "Properties": { "StackId": { "Ref": "myStack" }, "Type": "java", "Name": { "Ref": "AppName" }, "AppSource": { "Type": "git", **"Url": "xxx (url for the java app)",** "Revision": "version2" }, "Attributes": { "DocumentRoot": "web" } } } **shows where the changes are required.
type: Question
tagged with: cookbook
tagged with: java
has title: Custom cook book to deploy java app on tomcat using AWS CLoudFormation template
tagged with: aws-opsworks

http://stackoverflow.com/comment/42568700
comment on: http://stackoverflow.com/a/27021957
type: Comment
score: 0
type: AnswerComment
has text: let me give you a better insight suppose your array is something like : array[26][] now whenever you encounter a word, fetch its first alphabets ascii value, if it is <=90 add 32 in it and then subtract 97, this will take care of both small and capital alphabets and access the array was i clear?

http://stackoverflow.com/q/27040086
has body: I am now using the new BLE api in android developing. Basic idea is using bluetooth scanning result to inflate the recyclerview(list); I followed the BLE guide on google developer Now I have two problem: 1. onBatchScanResults listener is never triggered, butonScanResult works well, is that because the scanner only sense 1 sensor nearby? my BLE scanner is much slower compared with other applications. The following is the two core functions' code snippet. private void scanBLE(boolean enable) { final BluetoothLeScanner mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner(); if (enable) { mScanning = true; mBluetoothLeScanner.startScan(mScanCallback); } else { if (mScanning) { mScanning = false; mBluetoothLeScanner.stopScan(mScanCallback); } } Log.i(TAG, "now the scanning state is" + mScanning); } // Device scan callback. private ScanCallback mScanCallback = new ScanCallback() { public void onScanResult(int callbackType, android.bluetooth.le.ScanResult result) { addBeaconTolist(result, beaconsList); mAdapter.notifyDataSetChanged(); }; public void onScanFailed(int errorCode) { Log.i(TAG, "error code is:" + errorCode); }; public void onBatchScanResults(java.util.List&lt;android.bluetooth.le.ScanResult&gt; results) { Log.i(TAG, "event linstener is called!!!!"); Log.i(TAG, "batch result are:" + results); beaconsList.clear(); for (int i = 0; i &lt; results.size(); i++) { ScanResult result = results.get(i); addBeaconTolist(result, beaconsList); } mAdapter.notifyDataSetChanged(); }; }; in MainFragment is like following: beaconsList = new ArrayList&lt;BeaconsInfo&gt;(); mAdapter = new BeaconsAdapter(beaconsList); mRecyclerView.setAdapter(mAdapter); scannBLE(true);
type: Question
score: 8
answer count: 2
downvote count: 0
tagged with: callback
has answer: http://stackoverflow.com/a/27041981
tagged with: ibeacon
favorite count: 0
upvote count: 8
has title: onBatchScanResults is not called in Android BLE
tagged with: android
possible better answer: http://stackoverflow.com/a/49146346
type: AnsweredQuestion
tagged with: bluetooth-lowenergy
has answer: http://stackoverflow.com/a/49146346
linked to: http://stackoverflow.com/q/26441785
tagged with: java
accepted answer: http://stackoverflow.com/a/27041981

http://stackoverflow.com/comment/42577708
comment on: http://stackoverflow.com/a/27027222
score: 0
type: AnswerComment
type: Comment
has text: just add "void" before fill, it should work..

http://stackoverflow.com/a/27014881
downvote count: 0
type: Answer
has body: big+2 will overflow as big is max. value while (long) big not long bigger = (long) big +2 will work for you as it will treat big as long instead of integer. So make a cast of float to it.
upvote count: 3
answers question: http://stackoverflow.com/q/27014753
accepted answer of: http://stackoverflow.com/q/27014753
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/27016413
has answer: http://stackoverflow.com/a/27016544
tagged with: string
has title: Java extract integers from a string containing delimiters and range symbols
possible better answer: http://stackoverflow.com/a/27016622
has answer: http://stackoverflow.com/a/27016622
has body: Is there a library that can help me split a String to integers by delimiters and range marks? for instance values="32,38,42-48,84" output: int[] = 32,38,42,43,44,45,46,47,48,84
answer count: 4
has answer: http://stackoverflow.com/a/27016844
accepted answer: http://stackoverflow.com/a/27016544
tagged with: java
type: AnsweredQuestion
tagged with: split
has comment: http://stackoverflow.com/comment/42558230
has comment: http://stackoverflow.com/comment/42558236
type: Question
score: 0
has answer: http://stackoverflow.com/a/27016545

http://stackoverflow.com/q/27118136
accepted answer: http://stackoverflow.com/a/27118494
has title: Why can my Scanner classes compile, but not execute? (Java)
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42738614
has body: I'm using BlueJ. I have a program that uses the Scanner without any issues in the same project. I have another program that compiles, but does not execute. On the BlueJ project screen it shows "Work indicator: indicates when virtual machine is executing". Here is my code which I don't think is incorrect. import java.util.Scanner; public class Testing { public static void main( String[] args) { Scanner scan = new Scanner( System.in ); double radius = scan.nextDouble(); double circumference = (2*Math.PI*radius); double area = (Math.PI*radius*radius); System.out.println(circumference); System.out.println(area); } } I've tried changing the name of the scanner( ex. scan ) to that of the class that works, and it didn't fix it. I'm not getting any errors at all. I also made a new class where you simply input something into the Scanner and it prints it out onto the screen, and it doesn't work either. Help? EDIT: I just needed to add System.out.println( "Enter Radius: " ); before the scan.nextDouble() for the terminal window to pop up. Thank you.
type: Question
tagged with: execute
has comment: http://stackoverflow.com/comment/42738546
tagged with: compilation
has comment: http://stackoverflow.com/comment/42738286
has comment: http://stackoverflow.com/comment/42738344
tagged with: bluej
has answer: http://stackoverflow.com/a/27118494
score: 0
answer count: 1

http://stackoverflow.com/q/27002423
has answer: http://stackoverflow.com/a/69400079
tagged with: web
favorite count: 0
tagged with: scala
has body: I'm unsuccessfully trying to adjust sbt build for the existiing Scala project which previously worked fine but any docs was left. It seems that incorrect URL is substituted to resolve dependancy for "sbt.jar"... Inside my_project dir: ear application.xml web-logic-application.xml project target config-classes *.class src main java package(java-utils) scala package(scala) my_app.properties spring.xml ... webapp WEB-INF web.xml test scala resources build.sbt my_project/build.sbt: name := "my_project" organization := "my.app" version := "1.0" scalaVersion := "2.10.2" ... libraryDependencies += ... C:\Users\svc\ .sbt\repositories: [repositories] local maven-central typesafe: http://repo.typesafe.com/typesafe/releases/ typesafe-snapshots: http://repo.typesafe.com/typesafe/snapshots/ C:\Users\svc\ .sbt\0.13.5\plugins\plugins.sbt: resolvers += "typesave" at "http://repo.typesafe.com/typesafe/releases" addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0") addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "0.4.2") C:\Program Files (x86)\sbt\conf\sbtconfig.txt (wasn't changed after sbt installation on local PC): # Set the java args to high */ -Xmx512M -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=128m # Set the extra SBT options */ -Dsbt.log.format=true Log shows: Getting org.scala-sbt sbt 0.13.5 ... :: problems summary :: :::: WARNINGS module not found: org.scala-sbt#sbt;0.13.5 ==== local: tried C:\Users\svc\.ivy2\local\org.scala-sbt\sbt\0.13.5\ivys\ivy.xml -- artifact org.scala-sbt#sbt;0.13.5!sbt.jar: C:\Users\svc\.ivy2\local\org.scala-sbt\sbt\0.13.5\jars\sbt.jar ==== Maven Central: tried http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.pom -- artifact org.scala-sbt#sbt;0.13.5!sbt.jar: http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar ==== typesafe: tried http://repo.typesafe.com/typesafe/releases/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.pom -- artifact org.scala-sbt#sbt;0.13.5!sbt.jar: http://repo.typesafe.com/typesafe/…
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27041223
downvote count: 0
score: 7
tagged with: java
has title: sbt build failed - module not found: org.scala-sbt#sbt;0.13.5
type: Question
has answer: http://stackoverflow.com/a/27004762
has answer: http://stackoverflow.com/a/27041223
tagged with: sbt
has answer: http://stackoverflow.com/a/32252251
linked to: http://stackoverflow.com/q/59763435
possible better answer: http://stackoverflow.com/a/32252251
upvote count: 7

http://stackoverflow.com/q/27039514
tagged with: java
linked to: http://stackoverflow.com/q/8916398
has comment: http://stackoverflow.com/comment/42599933
tagged with: jaxb
type: Question
upvote count: 6
has title: How to customize property name in JAXB?
has comment: http://stackoverflow.com/comment/42598538
answer count: 1
has comment: http://stackoverflow.com/comment/42599904
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/27040283
accepted answer: http://stackoverflow.com/a/27040283
score: 6
has body: I am using JAXB to generate java classes based on some XSD schemas. For an element such as: &lt;xsd:element name="REC_LOC" type="xsd:string" minOccurs="1"/&gt; jaxb generates the following code: @XmlElement(name = "REC_LOC", required = true) protected String recloc; public String getRECLOC() { return recloc; } /** * Sets the value of the recloc property. * * @param value * allowed object is * {@link String } * */ public void setRECLOC(String value) { this.recloc = value; } The problem is that we need to use some proprietary XML tools that rely on the naming convention of the getter/setter methods. For example, for the field REC_LOC they expect methods called getRecLoc(String value) and setRecLoc(), instead of getRECLOC(). Is there any way to customise the method names generated by jaxb?
tagged with: xsd
has comment: http://stackoverflow.com/comment/42600141
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/4394134

http://stackoverflow.com/comment/42636999
type: Comment
comment on: http://stackoverflow.com/q/27059021
has text: Yes it is: http://www.tutorialspoint.com/hibernate/hibernate_criteria_queries.htm
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42592471
has text: I am looking for a more general pattern / best practice. I somehow have the sense that "old" java libs make heavy use of method overloads with do(boolean activateX, boolean activateY, int someParam) which can result in signatures like do(boolean,boolean,int) where you have to read the sourcecode (and you have to have it ;) ) - where "newer" libs are more like doWithXAndY(int param) - hope I could make myself clear.
type: Comment
comment on: http://stackoverflow.com/a/27035774
type: AnswerComment
score: 1

http://stackoverflow.com/a/27089216
has comment: http://stackoverflow.com/comment/42693345
accepted answer of: http://stackoverflow.com/q/27086255
score: 2
answers question: http://stackoverflow.com/q/27086255
downvote count: 0
has body: This is likely due to the fact that that project was integrated into GNU classpath. That means that the last signed provider was for 1.4. Up to 1.5 you had to create signed versions of your libraries for each Java version, so one for 1.4 is probably not compatible with 1.5 and higher (check for instance the bouncy class library, which has separate downloads for each version of Java up to 1.5). Furthermore, the certificate may have expired. Please use cryptographic libraries that are actually maintained. There should be no need for GNU crypto in the first place.
has comment: http://stackoverflow.com/comment/42691931
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/a/65952329
answers question: http://stackoverflow.com/q/26992908
has body: If you imported properly and added jar files such as poi and poi-ooxml and still facing issues then try this version its work ... and hope your issues will solved. org.apache.poi poi 3.17 org.apache.poi poi-ooxml 3.17
score: 0
type: Answer

http://stackoverflow.com/a/27137206
downvote count: 1
has comment: http://stackoverflow.com/comment/42803986
answers question: http://stackoverflow.com/q/27133260
type: Answer
has body: You need to add the proper equals and hashCode implementations in your Tag class. Using the name property to distinguish between different Tags is a good idea. Since Post.tags is a Set, it will discard duplicates prior to flushing the collection, so you shouldn't get the constraint violation. @Entity public class Tag { @Id Long id; String name; @Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(); hcb.append(name); return hcb.toHashCode(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Tag)) { return false; } Tag that = (Tag) obj; EqualsBuilder eb = new EqualsBuilder(); eb.append(name, that.name); return eb.isEquals(); } }
has comment: http://stackoverflow.com/comment/125906569
upvote count: 2
score: 1

http://stackoverflow.com/comment/42614969
type: Comment
comment on: http://stackoverflow.com/q/27048301
type: QuestionComment
score: 1
has text: android.app.Activity has no such method

http://stackoverflow.com/comment/42551466
score: 0
comment on: http://stackoverflow.com/q/27012147
type: QuestionComment
has text: And what is happened now?
type: Comment

http://stackoverflow.com/q/27055072
has answer: http://stackoverflow.com/a/27056846
has comment: http://stackoverflow.com/comment/42626845
has answer: http://stackoverflow.com/a/34352740
has answer: http://stackoverflow.com/a/36307348
upvote count: 53
downvote count: 0
answer count: 7
has title: Spring: How to do AND in Profiles?
favorite count: 0
possible better answer: http://stackoverflow.com/a/52856411
has answer: http://stackoverflow.com/a/36319834
has comment: http://stackoverflow.com/comment/42658682
has answer: http://stackoverflow.com/a/52856411
accepted answer: http://stackoverflow.com/a/27056846
has comment: http://stackoverflow.com/comment/42627060
tagged with: spring
type: AnsweredQuestion
tagged with: spring-profiles
score: 53
has answer: http://stackoverflow.com/a/39161939
tagged with: java
has answer: http://stackoverflow.com/a/32648213
has comment: http://stackoverflow.com/comment/42626824
type: Question
has comment: http://stackoverflow.com/comment/42626634
has body: Spring Profile annotation allows you to select profiles. However if you read documentation it only allows you to select more than one profile with OR operation. If you specify @Profile("A", "B") then your bean will be up if either profile A or profile B is active. Our use case is different we want to support TEST and PROD versions of multiple configurations. Therefore sometimes we want to autowire the bean only if both profiles TEST and CONFIG1 are active. Is there any way to do it with Spring? What would be the simplest way?

http://stackoverflow.com/comment/42591970
type: QuestionComment
comment on: http://stackoverflow.com/q/27030332
has text: @wonhee: Ah yes, good point.
score: 0
type: Comment

http://stackoverflow.com/a/27151662
upvote count: 2
answers question: http://stackoverflow.com/q/27151432
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: There is no duck typing in Java as it is in Python. You can use reflection to find if the class has a method you want to call but it is really a hassle. It looks like that Class&lt;?&gt; aClass = object.getClass(); try { Method method = aClass.getMethod("methodName", argType1, argType2); method.invoke(arg1, arg2) } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); } It is also not possible in every environment. If security manager is enabled your code should have sufficient rights to execute the code above. That also adds substantial work.
score: 2
accepted answer of: http://stackoverflow.com/q/27151432

http://stackoverflow.com/a/26997556
has body: configuration.yml is expected to be in the working directory i.e. on the filesystem, because this is how you try to read it. If you want to read it from jar file or from classpath in general you need to use getResource or getResourceAstream methods. (please see this similar question and answer) EIDT If you want to read the config from a resource inside your jar then you might want to configure your application to use UrlConfigurationSourceProvider instead of FileConfigurationSourceProvider and pass it the URL which you can obtain from getResource, the open method of the underlying interface expects a String as parameter, so you will need to use URL#toString on the result of getResource.
answers question: http://stackoverflow.com/q/26997430
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26997430
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/42756231
downvote count: 0
has comment: http://stackoverflow.com/comment/59646335
score: 3
has comment: http://stackoverflow.com/comment/42749409

http://stackoverflow.com/a/27130772
has comment: http://stackoverflow.com/comment/42760605
downvote count: 1
has comment: http://stackoverflow.com/comment/42760937
upvote count: 0
score: -1
has body: Have you tried using a ArrayList&lt;StringBuilder&gt; combination? Or Vector&lt;StringBuffer&gt; (if it needs to be thread safe). Basically build your output first, then display the results when done.
has comment: http://stackoverflow.com/comment/42761133
has comment: http://stackoverflow.com/comment/42760473
has comment: http://stackoverflow.com/comment/42760554
type: Answer
has comment: http://stackoverflow.com/comment/42783285
answers question: http://stackoverflow.com/q/27130718

http://stackoverflow.com/a/27111684
has comment: http://stackoverflow.com/comment/42726768
accepted answer of: http://stackoverflow.com/q/27109899
downvote count: 0
answers question: http://stackoverflow.com/q/27109899
has body: Sure: pass the HttpServletRequest as argument, and use request.getParameterMap() to access all the parameters and their values.
has comment: http://stackoverflow.com/comment/81149013
type: AcceptedAnswer
upvote count: 6
type: Answer
score: 6

http://stackoverflow.com/q/27039670
tagged with: java
has body: Hi i'm trying to integrate mybatis with my spring application. I'm using following jars mybatis-3.2.8.jar mybatis-spring-1.2.2.jar spring-beans-3.2.4.RELEASE.jar spring-context-3.2.4.RELEASE.jar spring-context-support-3.2.4.RELEASE.jar spring-core-3.2.4.RELEASE.jar spring-expression-3.2.4.RELEASE.jar spring-jdbc-3.2.4.RELEASE.jar I get the following on running my sample java file : Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [Spring-config.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException. Can anybody tell me which version of mybatis and mybatis-spring jars to be used so that i can solve this problem.
upvote count: 1
type: Question
tagged with: configuration
tagged with: mybatis
has answer: http://stackoverflow.com/a/27039743
has title: Which version of mybatis and mybatis-spring jar should be used with spring 3.2.4?
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 1

http://stackoverflow.com/q/27070032
favorite count: 0
type: Question
tagged with: regex
tagged with: capturing-group
tagged with: parentheses
has answer: http://stackoverflow.com/a/27070115
upvote count: 1
answer count: 1
tagged with: java
type: UnansweredQuestion
has title: Regex and capturing parenthesis
downvote count: 0
has body: I'm trying to understand how capturing parenthesis work for regex but I don't get it... My code was : Pattern pattern = Pattern.compile("ab"); Matcher m = pattern.matcher("abc"); while (m.find()) { for (int i = 0; i &lt; m.groupCount(); i++) { System.out.println(m.group(i)); } } so i had no display at all. What i understood was that i need a capturing parenthesis to remember the matching result and to display it. So i did : Pattern pattern = Pattern.compile("(ab)"); Matcher m = pattern.matcher("abc"); And i had the expected display : ab Then i wanted to remember and display only a part of the matching result, so i did : Pattern pattern = Pattern.compile("(a)b"); Matcher m = pattern.matcher("abc"); I was expecting to have : a, but i had : ab why ?
score: 1

http://stackoverflow.com/comment/42739654
has text: granted on the second part - input of 3 should print 4 rows - my mistake
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27118211

http://stackoverflow.com/q/27016453
tagged with: java
possible better answer: http://stackoverflow.com/a/27016959
tagged with: maven
type: Question
type: AnsweredQuestion
has title: Maven multi-project library dependency
has answer: http://stackoverflow.com/a/27016742
answer count: 2
tagged with: ear
has body: I have the enterprise project (*.ear), what packaged by maven. Ear file have include many files: final.ear |-lib |-META-INF |--web.war |--bla-bla.jar |--web-bla.war Each file (jar, war) packaged by maven. 1) How put all required libraries from all files (war, jar) into final.ear/lib? 2) How group libraries from /lib, for example: lib/axis, lib/logging?
accepted answer: http://stackoverflow.com/a/27016742
has answer: http://stackoverflow.com/a/27016959
score: 0

http://stackoverflow.com/comment/42986582
comment on: http://stackoverflow.com/a/27202391
type: Comment
type: AnswerComment
has text: Thanks it looks like the computer I am on does not support GL3
score: 0

http://stackoverflow.com/comment/42756686
type: QuestionComment
comment on: http://stackoverflow.com/q/27128714
score: 0
has text: check the syntax of main method in docs
type: Comment

http://stackoverflow.com/q/27081675
score: -2
has answer: http://stackoverflow.com/a/27082204
accepted answer: http://stackoverflow.com/a/27082204
answer count: 2
has title: A button can save the user input and access it later? with java
favorite count: 0
possible better answer: http://stackoverflow.com/a/27081769
tagged with: input
has comment: http://stackoverflow.com/comment/42672830
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
tagged with: save
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/42672954
has body: you think that question it's silly but it's hard for me beacause i'm just a bigenner on java and i search from it hours. Please how i can do that note that i'm using netbeans 8 and thank you!
type: Question
has answer: http://stackoverflow.com/a/27081769

http://stackoverflow.com/comment/42898507
has text: This is excellent. You really thought about everything, even concurrency. Why do you suggest storing the Date as an int timestamp? I need to print dates in a readable format and there is no getter for Date in class Message, so its value won't be modified.
type: AnswerComment
comment on: http://stackoverflow.com/a/27084301
score: 0
type: Comment

http://stackoverflow.com/q/27101780
has answer: http://stackoverflow.com/a/27101865
accepted answer: http://stackoverflow.com/a/27101865
has comment: http://stackoverflow.com/comment/42707878
upvote count: 2
has title: Singelton in Spring with Autowired field
answer count: 1
tagged with: applicationcontext
has comment: http://stackoverflow.com/comment/42707891
favorite count: 0
linked to: http://stackoverflow.com/q/11324372
score: 2
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/10938529
tagged with: spring
tagged with: autowired
type: Question
has body: I am facing the problem of needing a certain instance of a class which is Autowired. I have the following Architecture: My application context: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="test.DELETEME" annotation-config="true" /&gt; &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /&gt; &lt;bean id="mainGUI" class="test.DELETEME.MainWindow" /&gt; &lt;/beans&gt; Here I inject the application context: import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Singleton { /** * Application Context */ private static ApplicationContext ctx; public static void main(String[] args) { ctx = new ClassPathXmlApplicationContext("applicationContext_Test.xml"); MainWindow gui = ctx.getBean("mainGUI", MainWindow.class); gui.start(); } } Furthermore, I am wirering my GUI together. @Component public class MainWindow extends JFrame { /** * UUID */ private static final long serialVersionUID = -4931876787108249107L; public static JTabbedPane tabbedPane; @Autowired private static ResultsTabPanel resu…
tagged with: java

http://stackoverflow.com/comment/42569708
comment on: http://stackoverflow.com/q/27022627
has text: @WeatherVane _char in C is signed._ This is not necessarily true.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27146738
has body: Today I had a strange experience when using a for loop in Java, which I really can't explain. That's my code snippet: List&lt;String[]&gt; list; .... for (String[] tmp : list.get(0)) { ... } This code snippet isn't compiling, because list.get(0) is returning a String an not an array of Strings. But why?
has answer: http://stackoverflow.com/a/27146760
tagged with: list
tagged with: compiler-errors
tagged with: java
has answer: http://stackoverflow.com/a/27146820
type: Question
has answer: http://stackoverflow.com/a/27146758
tagged with: arrays
has title: Java for-loop and compile error due to wrong datatype
has answer: http://stackoverflow.com/a/27146790
score: 0
tagged with: iterator
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27146836

http://stackoverflow.com/a/27071618
has comment: http://stackoverflow.com/comment/42655925
score: 4
accepted answer of: http://stackoverflow.com/q/27071128
upvote count: 4
has body: Building on your code and the suggestions from Hovercraft Full Of Eels, a small step in the right direction could be taken with these modifications to the GUI and CirclePainter classes: // GUI.draw public void draw(List&lt;Circle&gt; circles) { // drawingBoard.paintComponent(drawingBoard.getGraphics(), circles); drawingBoard.setCircles(circles); drawingBoard.repaint(); } class CirclePainter extends JPanel { // public void paintComponent(Graphics graphics, List&lt;Circle&gt; circles) // { // super.paintComponent(graphics); // for(Circle circle : circles) // graphics.fillOval(circle.getX(), circle.getY(), circle.getRadius() * 2, circle.getRadius() * 2); // } private List&lt;Circle&gt; circles; public void setCircles(final List&lt;Circle&gt; circles) { this.circles = circles; } @Override protected void paintComponent(final Graphics graphics) { super.paintComponent(graphics); for (Circle circle : circles) graphics.fillOval(circle.getX(), circle.getY(), circle.getRadius() * 2, circle.getRadius() * 2); } } This way, you might not have fixed all the fundamental issues, but you get your program to work with only minor changes. And Swing is a very nice library that can be much fun to learn more about.
answers question: http://stackoverflow.com/q/27071128
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42656164
type: Answer
has comment: http://stackoverflow.com/comment/42656221

http://stackoverflow.com/comment/42822290
has text: no not working with anyString too..it breaks at when().thenReturn
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27126937
type: Comment

http://stackoverflow.com/q/27071596
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42656818
has comment: http://stackoverflow.com/comment/42658134
has comment: http://stackoverflow.com/comment/42657009
has comment: http://stackoverflow.com/comment/42657002
tagged with: java
has comment: http://stackoverflow.com/comment/42657105
has comment: http://stackoverflow.com/comment/42657021
downvote count: 1
has comment: http://stackoverflow.com/comment/42657001
type: Question
has title: insertAtRank Vector algorithm
tagged with: vector
upvote count: 0
tagged with: arrays
score: -1
answer count: 1
has body: I'm trying to write a program for college to insert elements into a vector-based array. However, my insertAtRank and removeAtRank methods don't appear to be working. Any help is greatly appreciated. Here is my code so far: public class ArrayVector implements Vector { int n ; Object[] A ; Object element ; public ArrayVector() { A = new Object[10] ; n = 0 ; } public int size() { return n; } public boolean isEmpty() { return n == 0; } public Object elemAtRank(int rank) throws RankOutOfBoundsException { return A[rank]; } public Object replaceAtRank(int rank, Object element) throws RankOutOfBoundsException { A[rank] = element ; return element; } public String toString() { int size = size(); String output = "" + size + "\t"; for (int i = 0 ; i &lt; size ; i++){ output += A[i] + " "; } return output; } public void insertAtRank(int rank, Object element) throws RankOutOfBoundsException { for ( int i = n ; i &lt; rank ; n--){ A[i] = A[i+1] ; } A[rank] = element ; n++ ; } public Object removeAtRank(int rank) throws RankOutOfBoundsException { element = A[rank]; for ( int i = rank ; i &lt; n-2 ; rank++){ A[i] = A[i+1] ; } n = n-1 ; return element ; } public static void main(String[] args) throws RankOutOfBoundsException { ArrayVector newArray = new ArrayVector() ; System.out.println (newArray.toString()) ; newArray.insertAtRank(0, "c"); System.out.println (newArray.toString()) ; newArray.insertAtRank(1, "a"); System.out.println (newArray.toString()) ; newArray.removeAtRank(0) ; System.out.println (newArray.toString()) ; newArray.insertAtRank(2, "t"); System.out.println (newArray.toString()) ; } }
has answer: http://stackoverflow.com/a/27072336

http://stackoverflow.com/q/27139258
type: AnsweredQuestion
tagged with: java
tagged with: gora
tagged with: maven
has title: Eclipse maven build compiler failure - no stacktrace
type: Question
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/42776668
accepted answer: http://stackoverflow.com/a/27141612
answer count: 1
has answer: http://stackoverflow.com/a/27141612
has body: I'm trying to build Apache Gora, which you can find here and I've downloaded it as a modular apache maven project. When I try to build gora with an execute maven from eclipse with the install goal I get the following error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project gora-compiler: Compilation failure -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project gora-compiler: Compilation failure It also tells me the following: [INFO] Changes detected - recompiling the module! [INFO] Compiling 2 source files to C:\Users\pmgbe_000\git\gora\gora-compiler\target\classes [WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment. [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Apache Gora ....................................... SUCCESS [10:08 min] [INFO] Apache Gora :: Compiler ........................... FAILURE [ 27.690 s] [INFO] Apache Gora :: Compiler-CLI ....................... SKIPPED [INFO] Apache Gora :: Shims Hadoop ....................... SKIPPED /////// OTHER MODULES ALSO SKIPPED ////// But, if I re-run the install without a workspace clean in the next run it builds correctly the Compiler module. If I re-run again the following module gets a success and so on. I can't make heads or tails of what's happening here.

http://stackoverflow.com/a/27077837
has body: You dont need replaceAll method as you are not using regex. Instead you could work with replace api like below: String mapDir = "D:\\mapping\\specialists\\ts_gpc\\"; String test = "foo: &lt;mapDir&gt; -bar"; System.out.println(test.replace("&lt;mapDir&gt;", mapDir));
has comment: http://stackoverflow.com/comment/42666041
answers question: http://stackoverflow.com/q/27077796
type: AcceptedAnswer
downvote count: 0
score: 6
accepted answer of: http://stackoverflow.com/q/27077796
type: Answer
upvote count: 6

http://stackoverflow.com/a/27061643
type: Answer
has body: Well, I don't understand why you want to do something like this? There is not one simple answer to that. Probably working solution would be something like this public void Important() { if (runningCode == false) { runningCode = true; //Do lots of stuff runningCode = false; } else { // stop current code from execution runningCode = false; Important(); } But you must figure your own code to stop current execution as it may result in broken state of objects etc...
answers question: http://stackoverflow.com/q/27061491
has comment: http://stackoverflow.com/comment/42637525
score: 0

http://stackoverflow.com/comment/42519426
type: Comment
has text: Off course, import everything which is necessary for your project.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26993876

http://stackoverflow.com/comment/42530491
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27000113
has text: Ranges of what? Do you want to break the possible grade range into "buckets" (e.g. 0 - 29, 30 - 59, etc.) and keep a running count of the grades in each bucket?
score: 0

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/27023980
tags question: http://stackoverflow.com/q/27111825
tags question: http://stackoverflow.com/q/27072076
type: Tag
tags question: http://stackoverflow.com/q/27133327
tags question: http://stackoverflow.com/q/27092522
tags question: http://stackoverflow.com/q/27048996
tags question: http://stackoverflow.com/q/27086168
tags question: http://stackoverflow.com/q/27034650
tags question: http://stackoverflow.com/q/27145591
tags question: http://stackoverflow.com/q/27138867
tags question: http://stackoverflow.com/q/26997893
tags question: http://stackoverflow.com/q/27129493
tags question: http://stackoverflow.com/q/27033691
tags question: http://stackoverflow.com/q/27138969
tags question: http://stackoverflow.com/q/27041689

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

http://stackoverflow.com/a/27192732
answers question: http://stackoverflow.com/q/27110214
type: Answer
has body: Finally resolved this error by, uninstalled eclipse.Download a eclipse http://developer.android.com/sdk/index.html and updated libgdx by new version
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27110214

http://stackoverflow.com/q/27129778
answer count: 1
has answer: http://stackoverflow.com/a/27130726
accepted answer: http://stackoverflow.com/a/27130726
has comment: http://stackoverflow.com/comment/42758822
tagged with: sockets
tagged with: x509certificate
type: AnsweredQuestion
tagged with: java
has title: Create digital certificate in java
type: Question
tagged with: client-server
tagged with: ssl
has body: I have a client / server program that must do the following: The client creates a digital certificate and sign it from the server. I wonder how can I create that certificate in the client (using java)? and then send it to the server (via socket) to sign it. Then, any client want to communicate with another client, it get its digital certificate and verify it signed from the server.
score: 0

http://stackoverflow.com/comment/42809447
type: Comment
comment on: http://stackoverflow.com/q/27135331
has text: @univise Thank you for both of us, User can see .jar file this mean this application installed client side, and directly connect to the database server from client pc. As Univise mentioned I will try to encrypt configuration files!
score: 0
type: QuestionComment

http://stackoverflow.com/q/27148861
has answer: http://stackoverflow.com/a/27149081
tagged with: java
tagged with: inputstream
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42792879
has comment: http://stackoverflow.com/comment/42792677
type: Question
has body: i am getting error while reading stream. Stream also contain images along with string data.My code is, static String convertStreamToString(java.io.InputStream is) { Reader reader = new InputStreamReader(is); BufferedReader r = new BufferedReader(reader); StringBuilder total = new StringBuilder(); String line = null; try { while ((line = r.readLine()) != null) { total.append(line); } } catch (IOException e) { e.printStackTrace(); } System.out.println(total); return line; } In while loop it results in consol as its heap memory is increasing and at last give error "out of memory" Hopes for your suggestion
answer count: 2
has comment: http://stackoverflow.com/comment/42794437
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/27149342
score: 0
tagged with: android
type: UnansweredQuestion
has title: Buffer reader using input stream gives Out of Memory Error Android Java

http://stackoverflow.com/comment/42701366
has text: No there is no such thing. I'm just trying to learn Spring and there is no any Authentication protocol
comment on: http://stackoverflow.com/q/27098177
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27049708
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42629322
accepted answer of: http://stackoverflow.com/q/27049473
answers question: http://stackoverflow.com/q/27049473
has comment: http://stackoverflow.com/comment/42705914
type: Answer
has comment: http://stackoverflow.com/comment/42642631
has comment: http://stackoverflow.com/comment/42629347
has comment: http://stackoverflow.com/comment/42619629
has comment: http://stackoverflow.com/comment/42627964
score: 4
has body: The problem is that I am not populating Jlist with Domain Well DO populate JList with Domain. Perhaps something like this: public class MyListCellRenderer extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component cell = null; if (value instanceof Domain) { Domain domain = (Domain)value; int status = domain.getStatus(); String naziv = domain.getNaziv(); cell = super.getListCellRendererComponent(list, naziv, // note this... index, isSelected, cellHasFocus); if (status &gt; 0) { // or whatever... cell.setBackground(STATUS_ON_COLOR); } else { cell.setBackground(STATUS_OFF_COLOR); } } } return cell; }
has comment: http://stackoverflow.com/comment/42629874

http://stackoverflow.com/comment/42676925
type: Comment
has text: @Rok do you get this error from java or from the os?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27083752

http://stackoverflow.com/q/27151408
accepted answer: http://stackoverflow.com/a/27165247
has body: I have the following Java code to save new entry to MongoDB if the entry is not in DB. I run it in Java Timer for every 2 seconds. MongoClient mongoClient = null; try { mongoClient = new MongoClient("localhost", 27017); } catch (UnknownHostException e) { e.printStackTrace(); } DB db = mongoClient.getDB("testdb"); DBCollection coll = db.getCollection("testcollection"); // Search for existing entries BasicDBObject query = new BasicDBObject("link", entry_url); DBCursor cursor = coll.find(query); try { // If it is a new entry, insert if (cursor.hasNext() == false) { // Insert new entry BasicDBObject doc = new BasicDBObject("link", entry_url) .append("a_time", accept_time).append( "p_time", formatter.format(date)); coll.insert(doc); } } finally { cursor.close(); } The problem is after several minutes, there is a com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting}] from mongoDB. It refers to cursor.hasNext(). Any suggestions for this problem? Exception in thread "Timer-0" com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting}] at com.mongodb.BaseCluster.getDescription(BaseCluster.java:128) at com.mongodb.DBTCPConnector.getClusterDescription(DBTCPConnector.java:396) at com.mongodb.DBTCPConnector.getType(DBTCPConnector.java:569) at com.mongodb.DBTCPConnector.isMongosConnection(DBTCPConnector.java:370) at com.mongodb.Mongo.isMongosConnection(Mongo.java:623) at com.mongodb.DBCursor._check(DBCursor.java:494) at com.mongodb.DBCursor._hasNext(DBCursor.java:621) at com.mongodb.DBCursor.hasNext(DBCursor.java:657) The Timer implementation try { Timer timer = new Timer(); timer.schedule(new STimer(), 0, 2 * 1000); } catch (Exception e) { e.printStackTrace(); } Based on the comments below, I clos…
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42822641
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/27165247
has title: Timed out Exception in Mongodb using Java driver
has comment: http://stackoverflow.com/comment/42797739
has comment: http://stackoverflow.com/comment/42797918
answer count: 1

http://stackoverflow.com/comment/42677338
score: 0
type: Comment
type: QuestionComment
has text: @keyser I just started coding so I haven't reached that chapter yet :P but could you explain more about how to keep track of non-nulls? Also what does this total mean? will it be used in the average formula?
comment on: http://stackoverflow.com/q/27084093

http://stackoverflow.com/comment/120116063
has text: but thats not happening in my case...my application spawns 400 threads a t a time and when the run functions is completed...then main thread again pull data and spawn 400 child threads... but the application gives OOM(Unable to create Native Thread) after 18-20 hours of running...
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27064500

http://stackoverflow.com/comment/42625865
type: Comment
has text: @RogueBaneling Could you help me with it?
comment on: http://stackoverflow.com/a/27054103
score: 0
type: AnswerComment

http://stackoverflow.com/q/27055646
linked to: http://stackoverflow.com/q/27223838
has body: I have a String like file:///android_asset/GwyXUyisyq. I want to extract the GwyXUyisyq from the rest of the string. The value will change in every instance, but the file:///android_asset/ will always remain fixed. What regex can I use to achieve the same?
has title: Regex to extract value from link
tagged with: android
has answer: http://stackoverflow.com/a/27055679
accepted answer: http://stackoverflow.com/a/27055679
tagged with: regex
has comment: http://stackoverflow.com/comment/42627371
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42627363
tagged with: java
type: Question
score: 0
answer count: 1

http://stackoverflow.com/a/27136535
score: 3
accepted answer of: http://stackoverflow.com/q/27136517
answers question: http://stackoverflow.com/q/27136517
upvote count: 3
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: You could consider using an EmptyBorder, for example... JLabel nameLabel= new JLabel("Name"); nameLabel.setBorder(new EmptyBorder(0, 20, 0, 0)); nameLabel.setText("Hello my name is tom."); add(nameLabel, BorderLayout.CENTER); Have a look at How to Use Borders for more details

http://stackoverflow.com/q/27079721
has answer: http://stackoverflow.com/a/27079744
has answer: http://stackoverflow.com/a/27079753
has body: The task is: Write an method printArray. It shall take an int array as parameter. It shall write every int in the array on a row (system out print) If the parameter is null, nothing shall be written. In my code I get this message: The method println(boolean) in the type PrintStream is not applicable for the arguments (void). MY CLASS: public class Upg9_tenta { public static void printArray(int arr[]){ int i = 0; while(i&lt;arr.length){ System.out.print(arr[i]); i++; } } } MY MAIN: public class Upg9_tentamain { public static void main (String []args){ int []arr = {1, 3, 8, 6}; Upg9_tenta.printArray(arr); System.out.println(Upg9_tenta.printArray(arr)); } }
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27079909
type: UnansweredQuestion
tagged with: java
has title: method with int array as parameter
type: Question

http://stackoverflow.com/q/27005695
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42541433
tagged with: jpanel
has body: I have two classes. I try to move circle. When I type a break statement in Game.java it draws a circle for me without movement. That's fine. However when I want to move circle(by deleting break it displays nothing. I dont know how to debug that. I found out program is not going inside paint method when I use while without break; statement. Can anybody also tell me the way how to debug problem like that. Thanks in advance App.java import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class App extends JFrame { App() { JFrame jf = new JFrame(); JPanel jp = new JPanel(); jf.add(jp); jp.setLayout(new BorderLayout()); jf.setSize(500, 500); jf.setTitle("Chain Reactor Game"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setVisible(true); Game game = new Game(); jp.add(game, BorderLayout.CENTER); MenuBar menuBar = new MenuBar(); jf.setJMenuBar(menuBar.createMenuBar()); } public static void main(String[] args) { /* * oracle recommendation to run swing applications in special thread * they suggest it during thread implementation */ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new App(); } }); } } Game.java import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import javax.swing.JPanel; public class Game extends JPanel { private static final long serialVersionUID = 1L; int x = 0; int y = 0; @Override public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); System.out.println("im goint to filloval now"); g2d.fillOval(x, y, 30, 30); } public Game() { while(true) { moveBall(); repaint(); try { System.out.println("inside thread"); Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } break; // if i delete this line it not drawing. Why is that ? } } private …
has comment: http://stackoverflow.com/comment/42540757
possible better answer: http://stackoverflow.com/a/27005838
has answer: http://stackoverflow.com/a/27005727
has answer: http://stackoverflow.com/a/27005838
score: 0
answer count: 3
tagged with: thread-sleep
accepted answer: http://stackoverflow.com/a/27005727
tagged with: paint
has answer: http://stackoverflow.com/a/27005863
tagged with: swing
has title: paint method not working inside while loop in swing
type: Question

http://stackoverflow.com/q/27081889
accepted answer: http://stackoverflow.com/a/27083047
has answer: http://stackoverflow.com/a/27082246
has title: printing out the day of the week in Java
has comment: http://stackoverflow.com/comment/139221497
linked to: http://stackoverflow.com/q/3300290
has comment: http://stackoverflow.com/comment/42673197
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27082246
tagged with: math
tagged with: java
type: Question
has body: Im trying to get my program to print out the day of any given date using functions that I have to write and declare, although for the early dates of the month the program doesnt seem to print the write day. The equation in the dayOfTheWeek function, w, was given to us to calculate for the day, although for the 'floor' code to be used i had to create another 'private static' function for reasons im not quite sure of, any reason as to why would be great as well as any reason for why my program isnt returning the right day for certain dates. here's my code, any help would be greatly appreciated :) import java.util.Scanner; import javax.swing.JOptionPane; public class DayOfTheWeek { public static final int SEPTEMBER_APRIL_JUNE_NOVEMBER_DAYS = 30; public static final int REST_OF_YEAR_DAYS = 31; public static final int LEAP_YEAR_FEB = 29; public static final int NORMAL_FEB = 28; public static final int MONTHS = 12; public static void main(String[] args) { try { String input = JOptionPane.showInputDialog("Enter date (day/month/year):"); Scanner scanner = new Scanner( input ); scanner.useDelimiter("/"); int day = scanner.nextInt(); int month = scanner.nextInt(); int year = scanner.nextInt(); scanner.close(); String numberEnding = numberEnding (day); String dayEnding = day + numberEnding; String monthName = monthName (month); String dayName = dayOfTheWeek (day, month, year); if (validDate(day, month, year)) { JOptionPane.showMessageDialog(null, dayName + " " + dayEnding + " " + monthName + " " + year + " is a valid date."); } else { JOptionPane.showMessageDialog(null, "" + dayEnding + " " + monthName + " " + year + " is not a valid date.", "Error", JOptionPane.ERROR_MESSAGE); } } catch (NullPointerException exception) { } catch (java.util.NoSuchElementException exception) { JOptionPane.showMessageDialog(null, "No number entered. \nPlease restart and try again.", "Error", JOptionPane.ERROR_MESSAGE); } } public static boolean validDate( int day, int month, int year ) { return …
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27083047

http://stackoverflow.com/a/27099842
downvote count: 0
score: 28
has comment: http://stackoverflow.com/comment/107977432
has comment: http://stackoverflow.com/comment/50553488
type: Answer
has body: JAX-RS uses implementations of MessageBodyReader and MessageBodyWriter to serialize/deserialize to and from differen media types. You can read more at JAX-RS Entity Providers. You can write your own to handle the serializion/derialization of your protobuf objects. Then just register the provider(s) with the application, either explicitly or implicitly through discovery. Example widgets.proto package widget; option java_package = "protobuf.example"; option java_outer_classname = "WidgetsProtoc"; message Widget { required string id = 1; required string name = 2; } message WidgetList { repeated Widget widget = 1; } When this is compiled, I will be left with a WidgetsProtoc class with static inner Widget and WidgetList classes. WidgetResource import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; import protobuf.example.WidgetsProtoc.Widget; import protobuf.example.WidgetsProtoc.WidgetList; @Path("/widgets") public class WidgetResource { @GET @Produces("application/protobuf") public Response getAllWidgets() { Widget widget1 = Widget.newBuilder().setId("1").setName("widget 1").build(); Widget widget2 = Widget.newBuilder().setId("2").setName("widget 2").build(); WidgetList list = WidgetList.newBuilder() .addWidget(widget1).addWidget(widget2).build(); return Response.ok(list).build(); } @POST @Consumes("application/protobuf") public Response postAWidget(Widget widget) { StringBuilder builder = new StringBuilder("Saving Widget \n"); builder.append("ID: ").append(widget.getId()).append("\n"); builder.append("Name: ").append(widget.getName()).append("\n"); return Response.created(null).entity(builder.toString()).build(); } } You'll notice the use of the "application/protobuf" media type. This isn't a standard media type, but there is a draft in the working. Also the Guava library has define this media type as MediaType.PROTOBUF, which translates to "application/proto…
has comment: http://stackoverflow.com/comment/42740461
has comment: http://stackoverflow.com/comment/50557201
has comment: http://stackoverflow.com/comment/129356077
has comment: http://stackoverflow.com/comment/107617451
accepted answer of: http://stackoverflow.com/q/27092387
upvote count: 28
has comment: http://stackoverflow.com/comment/107616754
answers question: http://stackoverflow.com/q/27092387
has comment: http://stackoverflow.com/comment/42728792
has comment: http://stackoverflow.com/comment/50759366
has comment: http://stackoverflow.com/comment/107605570
type: AcceptedAnswer

http://stackoverflow.com/comment/42591679
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27032795
has text: @AdrianShum, the insertion order that i am talking about is the order in which you add to the batch (using java api add) not at the db level. As this question is order of execution of statements in batch.
score: 0

http://stackoverflow.com/q/27060563
score: 44
linked to: http://stackoverflow.com/q/5738181
upvote count: 44
has comment: http://stackoverflow.com/comment/42869869
has comment: http://stackoverflow.com/comment/42636243
type: Question
has comment: http://stackoverflow.com/comment/42866741
downvote count: 0
has body: I am trying to enable logs using my JDBC program by connecting to Oracle database in eclipse IDE. I have gone through this SO post JDBC logging to file then I have created below java program and running it from my eclipse IDE, but I was not able to see any logs generated by the JDBC driver classes. import java.io.File; import java.io.FileInputStream; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import java.util.logging.LogManager; import java.util.logging.Logger; public class Logging { static Logger log = Logger.getLogger(Logging.class.toString()); static Connection con = null; public static void main(String[] args) throws SQLException, ClassNotFoundException { System.setProperty("oracle.jdbc.Trace", Boolean.TRUE.toString()); System.setProperty("java.util.logging.config.file", "OracleLog.properties"); log.info("Test Message"); enableLogging(false); getConnection(); closeConnection(); } static private void enableLogging(boolean logDriver) { try { oracle.jdbc.driver.OracleLog.setTrace(true); // compute the ObjectName String loader = Thread.currentThread().getContextClassLoader() .toString().replaceAll("[,=:\"]+", ""); javax.management.ObjectName name = new javax.management.ObjectName( "com.oracle.jdbc:type=diagnosability,name=" + loader); // get the MBean server javax.management.MBeanServer mbs = java.lang.management.ManagementFactory .getPlatformMBeanServer(); // find out if logging is enabled or not System.out.println("LoggingEnabled = " + mbs.getAttribute(name, "LoggingEnabled")); // enable logging mbs.setAttribute(name, new javax.management.Attribute( "LoggingEnabled", true)); File propFile = new File("path/to/properties"); LogManager logManager = LogManager.getLogManager(); logManager.readConfiguration(new FileInputStream(propFile)); if (logDriver) { DriverManager.setLogWriter(new PrintWriter(System.err)); } } catch (Exception e) { e.printStackTrace(); } } public …
possible better answer: http://stackoverflow.com/a/27242910
has answer: http://stackoverflow.com/a/36999087
has comment: http://stackoverflow.com/comment/42781012
tagged with: oracle-database
has answer: http://stackoverflow.com/a/27242910
tagged with: sql
has title: How to enable logging for SQL statements when using JDBC
has comment: http://stackoverflow.com/comment/42865693
tagged with: jdbc
has answer: http://stackoverflow.com/a/40491028
has comment: http://stackoverflow.com/comment/42867720
favorite count: 0
has comment: http://stackoverflow.com/comment/42636101
has comment: http://stackoverflow.com/comment/42757805
answer count: 5
linked to: http://stackoverflow.com/q/37088759
tagged with: logging
has answer: http://stackoverflow.com/a/59973531
accepted answer: http://stackoverflow.com/a/36999087
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27060691
linked to: http://stackoverflow.com/q/69533236
has comment: http://stackoverflow.com/comment/42635826
tagged with: java
has comment: http://stackoverflow.com/comment/42636568

http://stackoverflow.com/comment/42559490
type: Comment
has text: @user3774047 please mention a test case.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27012524

http://stackoverflow.com/comment/42713814
comment on: http://stackoverflow.com/q/27105076
has text: Thanks you EpicPandaForce u are right :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28679264
score: 7
has body: My problem was due to conflicting versions of javassist in my project's (transitive) dependencies. What I did was search for all dependencies that put old version of javassist in the build, then exclude them. For example: org.hibernate hibernate-entitymanager 3.5.1-Final provided javassist javassist
has comment: http://stackoverflow.com/comment/74673887
accepted answer of: http://stackoverflow.com/q/27136752
upvote count: 7
answers question: http://stackoverflow.com/q/27136752
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/74673739
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42793248
score: 0
type: AnswerComment
type: Comment
has text: Piyush still i haven't found a solution. If i uncheck those two then i am getting NoClassDefFoundError exception.
comment on: http://stackoverflow.com/a/27149175

http://stackoverflow.com/q/27114974
has comment: http://stackoverflow.com/comment/42740200
downvote count: 0
tagged with: jax-rs
score: 7
has answer: http://stackoverflow.com/a/27141563
favorite count: 0
tagged with: resteasy
has title: JAX-RS default @Produces
type: UnansweredQuestion
tagged with: jetty
tagged with: web-services
upvote count: 7
has body: Is there an application-wide way of the defaulting the @Produces annotation on all JAX-RS /resources? I have a lot of classes that produce web services. Rather than put @Produces({"application/json", "application/xml"}) on every one of them, I'd like to do it in a central place. That way I can add future producers in one place instead of having to modify every class. I'm currently using Resteasy with Jetty.
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/43077914
answer count: 2

http://stackoverflow.com/comment/42731990
type: QuestionComment
comment on: http://stackoverflow.com/q/27114463
has text: Maybe you want to look for URL rewriters.
score: 0
type: Comment

tomcat
tags question: http://stackoverflow.com/q/27115614
tags question: http://stackoverflow.com/q/27020819
tags question: http://stackoverflow.com/q/26999647
tags question: http://stackoverflow.com/q/27024672
tags question: http://stackoverflow.com/q/27031938
tags question: http://stackoverflow.com/q/27132766
tags question: http://stackoverflow.com/q/27104503
tags question: http://stackoverflow.com/q/27071630
tags question: http://stackoverflow.com/q/26995698
tags question: http://stackoverflow.com/q/27090165
tags question: http://stackoverflow.com/q/27023473
tags question: http://stackoverflow.com/q/27050023
tags question: http://stackoverflow.com/q/27069135
tags question: http://stackoverflow.com/q/27129435
tags question: http://stackoverflow.com/q/27056663
tags question: http://stackoverflow.com/q/27005020
tags question: http://stackoverflow.com/q/27121366
tags question: http://stackoverflow.com/q/26992017
tags question: http://stackoverflow.com/q/27118495
tags question: http://stackoverflow.com/q/27114001
tags question: http://stackoverflow.com/q/27047309
tags question: http://stackoverflow.com/q/27034676
tags question: http://stackoverflow.com/q/27123600
tags question: http://stackoverflow.com/q/27094295
tags question: http://stackoverflow.com/q/26996636
tags question: http://stackoverflow.com/q/27060160
tags question: http://stackoverflow.com/q/27017781
tags question: http://stackoverflow.com/q/27064044
tags question: http://stackoverflow.com/q/27113031
tags question: http://stackoverflow.com/q/27059781
tags question: http://stackoverflow.com/q/27071802
tag name: tomcat
tags question: http://stackoverflow.com/q/27001452
tags question: http://stackoverflow.com/q/27133396
tags question: http://stackoverflow.com/q/27046892
tags question: http://stackoverflow.com/q/27058991
tags question: http://stackoverflow.com/q/27121413
tags question: http://stackoverflow.com/q/27017676
tags question: http://stackoverflow.com/q/27101338
tags question: http://stackoverflow.com/q/27056148
tags question: http://stackoverflow.com/q/27034905
tags question: http://stackoverflow.com/q/27039211
tags question: http://stackoverflow.com/q/27088960
tags question: http://stackoverflow.com/q/27004346
tags question: http://stackoverflow.com/q/27151964
tags question: http://stackoverflow.com/q/27092103
tags question: http://stackoverflow.com/q/27130910
tags question: http://stackoverflow.com/q/27035174
tags question: http://stackoverflow.com/q/27061209
tags question: http://stackoverflow.com/q/27081261
tags question: http://stackoverflow.com/q/27108374
tags question: http://stackoverflow.com/q/27071280
tags question: http://stackoverflow.com/q/27108202
tags question: http://stackoverflow.com/q/27052402
tags question: http://stackoverflow.com/q/27075903
tags question: http://stackoverflow.com/q/27063864
type: Tag
tags question: http://stackoverflow.com/q/27066311
tags question: http://stackoverflow.com/q/27096301
tags question: http://stackoverflow.com/q/26994248
tags question: http://stackoverflow.com/q/27019231
tags question: http://stackoverflow.com/q/27079048
tags question: http://stackoverflow.com/q/27002968
tags question: http://stackoverflow.com/q/27014942
tags question: http://stackoverflow.com/q/27130429
tags question: http://stackoverflow.com/q/27042571
tags question: http://stackoverflow.com/q/27149605
tags question: http://stackoverflow.com/q/27013468
tags question: http://stackoverflow.com/q/27145627
tags question: http://stackoverflow.com/q/27151479
tags question: http://stackoverflow.com/q/27040498
tags question: http://stackoverflow.com/q/27024861
tags question: http://stackoverflow.com/q/26999175
tags question: http://stackoverflow.com/q/27014771
tags question: http://stackoverflow.com/q/27087372
tags question: http://stackoverflow.com/q/27036206
tags question: http://stackoverflow.com/q/27014981
tags question: http://stackoverflow.com/q/27098095
tags question: http://stackoverflow.com/q/27118296
tags question: http://stackoverflow.com/q/27099141

design-by-contract
tags question: http://stackoverflow.com/q/27073042
type: Tag
tag name: design-by-contract

http://stackoverflow.com/comment/60780104
score: 5
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27002913
has text: That's correct, but when you look at the documentation you will see that this boolean informs wether or not "this set changed as a result of the call". After this change you can adres the Set and you'll notice it has the results you expected.

http://stackoverflow.com/comment/42693067
has text: Thank you, it works but i down know what is the diffrence
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27093607
score: 0

http://stackoverflow.com/comment/42612272
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27047010
has text: You've got two `input = kbReader.nextLine()` in your loop. That doesn't make sense!!! You should probably take the first one outside (before the beginning of) the loop. Alternatively, you can place the exit-condition immediately after the first input-scan, and get rid of the second input-scan.

http://stackoverflow.com/q/27064619
favorite count: 0
type: UnansweredQuestion
downvote count: 1
tagged with: java
score: -1
type: Question
upvote count: 0
tagged with: azure-mobile-services
has title: Azure Mobile Services for Android, how to use abstract classes as a table
has body: So I'm currently having an issue with using an abstract class as a table, lets say I have this class public abstract class Profile { String id; String email; String password; String FirstName; String LastName; String PhoneNumber; //getters/setters below } And I have this other class as a concrete class for Profile public class Student extends Profile { public Student(String id, String email, String password, String FirstName, String LastName, String PhoneNumber) { this.id = id; this.email = email; this.password = password; this.FirstName = FirstName; this.LastName = LastName; this.PhoneNumber = PhoneNumber; } } This isssue is that I have a Profile table in my database, but I cannot create an instance of a MobileServiceTable&lt;&gt; in my code because it is an abstract class and will throw this exception "The class type used for creating a MobileServiceTable must be a concrete class" So what is the best way of going around this? Obviously my Profile abstract class has all the information I need to create a database table, but I can't instantiate the table as MobileServiceTable&lt;Profile&gt; profileTable = mClient.getTable(Profile.class) because it is abstract and will throw the exception. I've tried casting it to a student such as MobileServiceTable&lt;Student&gt; studentTable = mClient.getTable(Student.class) but that doesn't work since there isn't a Student table in my database, plus it says I need Student.class to use a unique id field as well, but that should be taken care of by the Profile class. Has anyone come across this before?
tagged with: abstract-class
has answer: http://stackoverflow.com/a/27324503
tagged with: azure
tagged with: android
answer count: 1

http://stackoverflow.com/q/27113501
has answer: http://stackoverflow.com/a/44583316
has answer: http://stackoverflow.com/a/67421020
type: UnansweredQuestion
tagged with: apache-camel
has title: org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed
has comment: http://stackoverflow.com/comment/42737477
score: 11
has comment: http://stackoverflow.com/comment/42774069
downvote count: 0
has answer: http://stackoverflow.com/a/27134992
has comment: http://stackoverflow.com/comment/42747203
has comment: http://stackoverflow.com/comment/108459418
favorite count: 0
type: Question
answer count: 4
has answer: http://stackoverflow.com/a/78505226
upvote count: 11
tagged with: activemq-classic
has body: I am using apache's activemq for queueing. We have started to see the following exception very often when writing things to the queue: Caused by: org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed: at org.apache.activemq.transport.AbstractInactivityMonitor.doOnewaySend(AbstractInactivityMonitor.java:282) at org.apache.activemq.transport.AbstractInactivityMonitor.oneway(AbstractInactivityMonitor.java:271) at org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:85) at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:104) at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68) at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81) at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86) at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1366) I can't figure out what could be causing this-- or even, frankly, where to start debugging what is causing this. Here is the queue set up code: camelContext = new DefaultCamelContext(); camelContext.setErrorHandlerBuilder(new LoggingErrorHandlerBuilder()); camelContext.getShutdownStrategy().setTimeout(SHUTDOWN_TIMEOUT_SECONDS); routePolicy = new RoutePolicy(); routePolicy.setCamelContext(camelContext); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); connectionFactory.setBrokerURL(queueUri); // use a pooled connection factory between the module and the queue pooledConnectionFactory = new PooledConnectionFactory(connectionFactory); // how many connections should there be in the session pool? pooledConnectionFactory.setMaxConnections(this.maxConnections); pooledConnectionFactory.setMaximumActiveSessionPerConnection(this.maxActiveSessionPerConnection); pooledConnectionFactory.setCreateConnectionOnStartup(true); pooledConnectionFactory.setBlockIfSessionPoolIsFull(false); JmsConfiguration j…
tagged with: java

http://stackoverflow.com/comment/42654870
has text: I've tried to implement it into the code and it compiles but the output image is the same as the original. Here's the way I've called it else if (function.equals("-tile")) { I'm declareing an array and calling it into the method. String inputFileName = args[1]; String outputFileName = args[2]; int [][] imageArr = readGrayscaleImage(inputFileName); int [][] tileArr = tile(imageArr); writeGrayscaleImage(outputFileName, tileArr); }
comment on: http://stackoverflow.com/a/27070782
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42654041
comment on: http://stackoverflow.com/q/27070627
has text: No, I don't have one. Sorry.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27059356
possible better answer: http://stackoverflow.com/a/30398212
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27069113
answer count: 2
tagged with: qtp
has comment: http://stackoverflow.com/comment/42651041
score: 0
has answer: http://stackoverflow.com/a/30398212
accepted answer: http://stackoverflow.com/a/27069113
has body: I am new to the java,I have experience in QTP. In the QTP we have inputbox built-in function. so at runtime while developing program we can give input value using inputbox function. So, I am looking for similar method in the java.Can you please help me any built in method is available in the java? Thanks in advance for your help.
has title: I am looking for QTP containing inputbox kind of method in java

batik
tags question: http://stackoverflow.com/q/27046674
type: Tag
tags question: http://stackoverflow.com/q/27073621
tag name: batik

http://stackoverflow.com/q/27010800
type: Question
has comment: http://stackoverflow.com/comment/42549189
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42548788
favorite count: 0
has answer: http://stackoverflow.com/a/27013568
has body: I am trying to write data on excel file. But each time I execute the program new file gets created with new data I even tried FileOutputStream(File file, true), but excel file throws error "Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded." Below is the code I am trying . Thank you in advance . class ExcelDemo { public static void main(String[] args) throws FileNotFoundException, IOException { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet sheet = workbook.createSheet("Employee Data1"); Map&lt;String, Object[]&gt; data = new TreeMap&lt;String, Object[]&gt;(); Set&lt;String&gt; keyset = data.keySet(); int rownum = 0; data.put("1", new Object[]{"ID", "NAME", "LASTNAME", "AGE"}); data.put("2", new Object[]{1, "Amit", "Shukla", "12"}); data.put("3", new Object[]{2, "Lokesh", "Gupta", "13"}); data.put("4", new Object[]{3, "John", "Adwards", "14"}); data.put("5", new Object[]{4, "Brian", "Schultz", "15"}); data.put("6", new Object[]{5, "Amit", "Shukla", "12"}); for (String key : keyset) { Row row = sheet.createRow(rownum++); Object[] objArr = data.get(key); int cellnum = 0; for (Object obj : objArr) { Cell cell = row.createCell(cellnum++); if (obj instanceof String) { cell.setCellValue((String) obj); } else if (obj instanceof Integer) { cell.setCellValue((Integer) obj); } } } try { //Write the workbook in file system FileOutputStream out = new FileOutputStream("G:\\demo.xlsx", true); workbook.write(out); out.flush(); out.close(); System.out.println("demo.xlsx written successfully on disk."); } catch (Exception e) { e.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/42548713
has comment: http://stackoverflow.com/comment/42549095
linked to: http://stackoverflow.com/q/16292939
has title: Java - Appending data to same Excel file with FileOutputStream
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42582692
has comment: http://stackoverflow.com/comment/42548847
has comment: http://stackoverflow.com/comment/42548938
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42549094

mysql
tags question: http://stackoverflow.com/q/27062661
tags question: http://stackoverflow.com/q/27071904
tags question: http://stackoverflow.com/q/27096232
tags question: http://stackoverflow.com/q/27145424
tags question: http://stackoverflow.com/q/27035000
tags question: http://stackoverflow.com/q/27094056
tags question: http://stackoverflow.com/q/27085364
tags question: http://stackoverflow.com/q/27111439
tags question: http://stackoverflow.com/q/27060702
tags question: http://stackoverflow.com/q/27106711
tags question: http://stackoverflow.com/q/27135123
tag name: mysql
tags question: http://stackoverflow.com/q/27051818
tags question: http://stackoverflow.com/q/27037059
tags question: http://stackoverflow.com/q/27138175
tags question: http://stackoverflow.com/q/27090246
tags question: http://stackoverflow.com/q/27146759
tags question: http://stackoverflow.com/q/27084037
tags question: http://stackoverflow.com/q/27071627
tags question: http://stackoverflow.com/q/27105082
tags question: http://stackoverflow.com/q/27059379
tags question: http://stackoverflow.com/q/27078267
tags question: http://stackoverflow.com/q/27096917
tags question: http://stackoverflow.com/q/27141811
tags question: http://stackoverflow.com/q/27046329
tags question: http://stackoverflow.com/q/27050935
tags question: http://stackoverflow.com/q/27074226
tags question: http://stackoverflow.com/q/27011015
tags question: http://stackoverflow.com/q/27126915
tags question: http://stackoverflow.com/q/27023935
tags question: http://stackoverflow.com/q/27150247
tags question: http://stackoverflow.com/q/27022423
tags question: http://stackoverflow.com/q/27001714
tags question: http://stackoverflow.com/q/27027005
tags question: http://stackoverflow.com/q/27075946
tags question: http://stackoverflow.com/q/27123370
tags question: http://stackoverflow.com/q/27123521
tags question: http://stackoverflow.com/q/27011330
tags question: http://stackoverflow.com/q/27145592
tags question: http://stackoverflow.com/q/27023157
tags question: http://stackoverflow.com/q/27000486
tags question: http://stackoverflow.com/q/27084150
tags question: http://stackoverflow.com/q/26993451
tags question: http://stackoverflow.com/q/27102735
tags question: http://stackoverflow.com/q/27042571
tags question: http://stackoverflow.com/q/27075760
tags question: http://stackoverflow.com/q/27077075
tags question: http://stackoverflow.com/q/27030462
tags question: http://stackoverflow.com/q/27034113
tags question: http://stackoverflow.com/q/27073624
tags question: http://stackoverflow.com/q/27102600
tags question: http://stackoverflow.com/q/27076705
tags question: http://stackoverflow.com/q/27054792
tags question: http://stackoverflow.com/q/27113909
tags question: http://stackoverflow.com/q/27024644
tags question: http://stackoverflow.com/q/27146006
tags question: http://stackoverflow.com/q/27102265
tags question: http://stackoverflow.com/q/27002256
tags question: http://stackoverflow.com/q/27113689
tags question: http://stackoverflow.com/q/27085451
tags question: http://stackoverflow.com/q/27012436
tags question: http://stackoverflow.com/q/27012200
tags question: http://stackoverflow.com/q/27011076
type: Tag
tags question: http://stackoverflow.com/q/27034359
tags question: http://stackoverflow.com/q/27130812
tags question: http://stackoverflow.com/q/27147567
tags question: http://stackoverflow.com/q/27144132
tags question: http://stackoverflow.com/q/27059021
tags question: http://stackoverflow.com/q/27087699
tags question: http://stackoverflow.com/q/27049742
tags question: http://stackoverflow.com/q/27098516
tags question: http://stackoverflow.com/q/27078016
tags question: http://stackoverflow.com/q/27097661
tags question: http://stackoverflow.com/q/27039305
tags question: http://stackoverflow.com/q/27088627
tags question: http://stackoverflow.com/q/27017369
tags question: http://stackoverflow.com/q/27099486
tags question: http://stackoverflow.com/q/27077527
tags question: http://stackoverflow.com/q/27049130

http://stackoverflow.com/comment/42723489
comment on: http://stackoverflow.com/q/27110214
score: 0
type: Comment
type: QuestionComment
has text: Did you tried this : http://stackoverflow.com/questions/4710107/where-can-i-find-older-versions-of-eclipse-adt

http://stackoverflow.com/comment/42575217
score: 2
has text: I don't understand your question. Are you misunderstanding how you pass arguments to method invocation expressions? Do you not understand syntax?
comment on: http://stackoverflow.com/q/27025985
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42740969
type: QuestionComment
comment on: http://stackoverflow.com/q/27119727
has text: shoe me complete string, where you want to display, on UI, because with Sting as above, it i s working and displaying with syso fine
score: 0
type: Comment

http://stackoverflow.com/a/27443095
has body: Finally, I had to settle down with following approach. Though I am not sure if its a good approach. I created a SqlSessionFactory by providing DataSource with dynamic Username, Password and Database. public SqlSessionFactory build() throws IOException, SQLException { OracleDataSource dataSource = new OracleDataSource(); dataSource.setURL(this.dbUrl); dataSource.setUser(this.dbUsername); dataSource.setPassword(this.dbPassword); dataSource.setDriverType(properties.getProperty("db.driver")); TransactionFactory transactionFactory = new JdbcTransactionFactory(); Environment environment = new Environment(properties.getProperty("db.environment"), transactionFactory, dataSource); Configuration configuration = new Configuration(environment); configuration.addMappers("com.app.dao"); SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(configuration); // final test connection to db sessionFactory.openSession().getConnection(); return sessionFactory; } Then I am getting one SqlSession out of factory: SqlSession session = sessionFactory.openSession(); and I am setting it across Vaadin session :(, so that it would be available throughout session. Hence I can use it whenever I need by taking it from session. UI.getCurrent().getSession().setAttribute(SqlSession.class,session); I am discarding it when logout: UI.getCurrent().getSession().setAttribute(SqlSession.class, null); I feel its dirty and may create memory issue. but didn't find any other easy solution. Please feel free to comment or answer.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27148589
answers question: http://stackoverflow.com/q/27148589
type: AcceptedAnswer

http://stackoverflow.com/comment/42713342
comment on: http://stackoverflow.com/a/27102229
score: 0
type: AnswerComment
has text: Still get a NPE. I'll update the question with some code and CSS I use.
type: Comment

http://stackoverflow.com/q/27005919
has title: ResourceResolverFactory is NULL (Adobe Experience Manager AEM)
score: 4
favorite count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27065315
tagged with: aem
has body: I am trying to get a reference to the ResourceResolver from the ResourceResolverFactory as follows: @Reference private ResourceResolverFactory resourceResolverFactory; public void someMethod() { Map&lt;String, Object&gt; authenticationMap = new HashMap&lt;String, Object&gt;(); authenticationMap.put(ResourceResolverFactory.USER, "user"); authenticationMap.put(ResourceResolverFactory.PASSWORD, "pwd"); //This line returns NullPointerException ResourceResolver resourceResolver = resourceResolverFactory.getResourceResolver(authenticationMap); } Can someone please tell me what I am doing wrong? The AEM API version v6.0.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27065315
has comment: http://stackoverflow.com/comment/42563598
tagged with: java
has comment: http://stackoverflow.com/comment/42542285
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/42570144
has comment: http://stackoverflow.com/comment/42549921
downvote count: 0

http://stackoverflow.com/q/26993120
has answer: http://stackoverflow.com/a/27002292
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: cdi
upvote count: 1
accepted answer: http://stackoverflow.com/a/27002292
type: AnsweredQuestion
has body: I'm trying to implement a simple guestbook. When user clicks "Submit", the UnregisteredUserPost CDI bean is supposed to be instantiated. However, instead I get the following exception: javax.servlet.ServletException: /guestbook.xhtml @11,57 value="#{unregisteredUserPost.name}": Target Unreachable, identifier 'unregisteredUserPost' resolved to null I will appreaciate if you help me to find the root cause of the problem. guestbook.xhtml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"&gt; &lt;h:head&gt; &lt;title&gt;#{msg.page_title}&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="css.css"/&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;h:form&gt; &lt;h:outputText value="#{msg.your_name}&amp;#160;"/&gt; &lt;h:inputText value="#{unregisteredUserPost.name}"/&gt; &lt;br/&gt;&lt;br/&gt; &lt;h:outputText value="#{msg.your_msg}"/&gt; &lt;br/&gt; &lt;h:inputTextarea rows="5" cols="100" value="#{unregisteredUserPost.content}"/&gt; &lt;br/&gt;&lt;br/&gt; &lt;h:commandButton value="#{msg.submit}" action="#{unregisteredUserPost}"/&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/html&gt; UnregisteredUserPost.java package learning.javaee.guestbook; import java.time.OffsetDateTime; import javax.enterprise.context.SessionScoped; import javax.inject.Named; @Named @SessionScoped public class UnregisteredUserPost extends AbstractPost { private String name; private OffsetDateTime dateTime; public UnregisteredUserPost() {} public String getName() { return name; } public void setName(String name) { this.name = name; } public OffsetDateTime getDateTime() { return dateTime; } public void setDateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; } } AbstractPost.java package learning.javaee.guestbook; import java.io.Serializable; import java.util.logging.Logger; import javax.inject.Inject; import javax.inject.Named; import javax.interceptor.AroundConstruct; import javax.interceptor.I…
has title: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'unregisteredUserPost' resolved to null
tagged with: jsf
tagged with: java
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/42517490

http://stackoverflow.com/comment/42618385
comment on: http://stackoverflow.com/q/27050344
has text: you mean `this.mContext` ?
score: 0
type: QuestionComment
type: Comment

audio-streaming
tags question: http://stackoverflow.com/q/27125625
tag name: audio-streaming
type: Tag

http://stackoverflow.com/comment/83838087
score: 0
type: Comment
has text: Thank you for your feed back [@PedroSequeira](https://stackoverflow.com/users/5698678/pedro-sequeira), I will try improve my answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/39964854

http://stackoverflow.com/comment/42694606
comment on: http://stackoverflow.com/a/27094388
score: 0
type: AnswerComment
type: Comment
has text: I can't understand your "because your for loop never goes past the first candidate".. Can you describe it a little bit more, please

http://stackoverflow.com/a/27146352
score: 5
type: Answer
answers question: http://stackoverflow.com/q/27134936
upvote count: 6
has comment: http://stackoverflow.com/comment/42811653
downvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27134936
has body: because you don't have API level 9 in your SDK. Download &amp; install it through Android SDK Manager. Also, don't forget to click obsolete :)

http://stackoverflow.com/q/27019352
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42563299
upvote count: 1
has title: Overriding Function in Polymorphism with different return type
has comment: http://stackoverflow.com/comment/42563378
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42563467
has answer: http://stackoverflow.com/a/27019498
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42563761
downvote count: 0
has body: Take a look into following code and help me understanding why the return type of "mf.display" is Object Type. Though "mf" is of "MyFather" type but still return type of "mf.display()" must be Integer type class MyFather { Object display() { System.out.println(1000); return 1000; } } class MySon extends MyFather { @Override Integer display() { System.out.println(500); return 500; } } public class TestInheritance { public static void main(String[] args) { MyFather mf = new MySon(); Integer myInt = mf.display(); // Error.Type mismatch cannot convert from Object to // Integer } }
favorite count: 0
has answer: http://stackoverflow.com/a/27019871

http://stackoverflow.com/q/27094597
has body: I need to fill in a matrix (a table) for my java assignment. I'm not sure where to start could someone please help me set it up. Thank you
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42695051
has title: Filling in a matrix in java
tagged with: java
downvote count: 3
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27094676
score: -2
has comment: http://stackoverflow.com/comment/42695041
possible better answer: http://stackoverflow.com/a/27094753
answer count: 2
has answer: http://stackoverflow.com/a/27094753
favorite count: 0
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/27094676

native-activity
tags question: http://stackoverflow.com/q/27102614
tag name: native-activity
type: Tag

http://stackoverflow.com/a/26999974
downvote count: 1
has comment: http://stackoverflow.com/comment/42530613
has comment: http://stackoverflow.com/comment/42530605
answers question: http://stackoverflow.com/q/26999888
has body: Since you are not going to have to modify this code later with more units, I would suggest you a ternary operator : String s = cbTwo.getValue(); showAnswer.setText(s.equals("Celsius") ? fahr.fahrenheitToCelsius() : s.equals("Farenheit") ? fahr.fahrenheitToFahrenheit() : kelvin.kelvinToKelvin()); Note that it is not exactly equivalent, in the case that s does not match any of thestrings you have in your if statements.
has comment: http://stackoverflow.com/comment/42530859
type: Answer
has comment: http://stackoverflow.com/comment/42530667
upvote count: 2
score: 1

http://stackoverflow.com/a/27066430
downvote count: 0
type: Answer
upvote count: 1
has body: You actually have three problems with the EL expression: &lt;c:if ${sessionScope.Staff.getStatus() == sessionScope.Staff.financial_staff_status} &gt; The conditional expression to be evaluated should be within the mandatory test attribute The property status should be accessed as Staff.status as it already has a public getter method The property financial_staff_status requires a public getter method in class StaffData. EL is strict with javabeans compliance of object classes and how properties are accessed (must be via a public getter) Additionally, its not strictly necessary to qualify the scope of an attribute, unless you have multiple attributes with the same name in different scopes or wish to be explicit for clarity. The different scopes will be searched starting with the narrowest (pageScope) through to the widest (applicationScope). Having added the public getter for the financial_staff_status property to your class, the expression should be: &lt;c:if test="${sessionScope.Staff.status == sessionScope.Staff.financial_staff_status}"&gt; or simply: &lt;c:if test="${Staff.status == Staff.financial_staff_status}"&gt;
has comment: http://stackoverflow.com/comment/42654962
score: 1
accepted answer of: http://stackoverflow.com/q/27054792
answers question: http://stackoverflow.com/q/27054792
has comment: http://stackoverflow.com/comment/42689075
type: AcceptedAnswer

http://stackoverflow.com/comment/42698184
type: AnswerComment
score: 0
type: Comment
has text: It print out invalid twice and then the number. Do I do it in the main method. Right before I called it?
comment on: http://stackoverflow.com/a/27096339

http://stackoverflow.com/a/27077184
accepted answer of: http://stackoverflow.com/q/27077101
answers question: http://stackoverflow.com/q/27077101
upvote count: 4
score: 3
type: AcceptedAnswer
type: Answer
has body: Your encoded strings differ in that the java former includes 2 newline characters '\n' at the end while the latter only has one. You can tell by typing e.g. echo dGVzdAo= | base64 --decode | od -c
has comment: http://stackoverflow.com/comment/42665057
downvote count: 1

xwpf
tags question: http://stackoverflow.com/q/27128317
type: Tag
tag name: xwpf

http://stackoverflow.com/comment/42685922
comment on: http://stackoverflow.com/q/27089290
score: 0
type: Comment
type: QuestionComment
has text: @Muhammad yes kindly see the code I am using jLabel15 for displaying the image

http://stackoverflow.com/comment/42802868
score: 0
has text: try adding `@Qualifier("userDaoImpl")` above the `autowired` `setUserDao` method.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27139886

http://stackoverflow.com/comment/42529751
score: 1
has text: You can refer to this post http://stackoverflow.com/questions/507602/how-can-i-initialize-a-static-map or this one http://stackoverflow.com/questions/6802483/how-to-directly-initialize-a-hashmap-in-a-literal-way
comment on: http://stackoverflow.com/q/26999663
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27031565
type: Question
has comment: http://stackoverflow.com/comment/42585716
upvote count: 2
favorite count: 0
has title: different color on Action Bar MenuItem in different configurations programmatically
tagged with: colors
has body: I want to set different colors to text of MenuItem that are in action bar and in different configurations - landscape and portrait. I figured one way to that was have different colors set in Color and Color-land.I've made a custom theme in styles as follows and then set the color black in color resource and white in color-land resource. This would work as the activity will be created when the configuration changes. However in my activity when the activity is created first an AlertDialog appears which leads to a REST api call and a ProgressDialog follows while the data is fetched from the server. The problem lies in here when i would change the configuration the activity will be recreated and i will get the AlertDialog again. if i set in the manifest <activity android:configChanges="orientation" /> the color of the menu item won't change because the activity is never created again but it will avoid the AlertDialog and would maintain the activity state. I am looking for a way to change the MenuItem Text color in the onConfigurationChanged event. is there some way to do it?
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0
downvote count: 0
tagged with: java

http://stackoverflow.com/a/27038789
upvote count: 2
has body: Yes you could. Create your customized annotation say @Logger @Retention(RUNTIME)//will be used at runtime, so retain till runtime @Target(FIELD)//field level annotation public @interface Logger { } Annotate your Logger field as @Logger in the beans which get's injected by Spring. @Logger private Logger logger; Here you could use slf4j logger but upto you as you can directly use log4j etc. See how i annotated logger here. This is within the bean which gets created by Spring. Use of Spring lifecycle interface called BeanPostProcessor and in method postProcessBeforeInitialization, using reflection utils class, to inject the logger. public class LoggerInjector implements BeanPostProcessor { /** * Return the bean itself. */ public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException { return bean; } /** * For all beans before initialization, inject the logger using slf4j. * @param bean * @param beanName * @return returns same bean by injecting logger. */ public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException { ReflectionUtils.doWithFields(bean.getClass(), new FieldCallback() { public void doWith(final Field field) throws IllegalArgumentException, IllegalAccessException { ReflectionUtils.makeAccessible(field); if (field.getAnnotation(Logger.class) != null) { if (field.get(bean) == null) { final Logger logger = LoggerFactory.getLogger(bean.getClass()); field.set(bean, logger); } } } }); return bean; } } Once done, let spring know that you have a logger injector like: &lt;bean id="loggerInjector" class="com.mypackage.LoggerInjector"/&gt;
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27038694

http://stackoverflow.com/a/27095561
has body: Because you can't update the callers array reference from your method (and you don't need to). Instead iterate half-way through the list and swap each element with the position like, public static void reverse(int[] list) { for (int i = 0; i &lt; list.length / 2; i++) { int t = list[(list.length - 1) - i]; list[(list.length - 1) - i] = list[i]; list[i] = t; } } Also, you could print your array with Arrays.toString(int[]) like public static void main(String[] args) { int[] list = { 1, 2, 3, 4, 5 }; reverse(list); System.out.println(Arrays.toString(list)); } Output is [5, 4, 3, 2, 1]
answers question: http://stackoverflow.com/q/27095520
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/26998977
has answer: http://stackoverflow.com/a/26999822
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/26999108
has answer: http://stackoverflow.com/a/26999448
downvote count: 0
has answer: http://stackoverflow.com/a/26999090
has comment: http://stackoverflow.com/comment/42528388
has body: I am trying to figure out how this Java method calculates a prime number but something is confusing me. public static boolean isPrime(int number){ for(int divisor =2; divisor &lt;= number / 2; divisor++){ if (number % divisor ==0){ return false; } } return true; } As you see in the second line in the for loop it shows divisor &lt;= number /2 instead of divisor &lt;= number. Can anyone tell me the reason for that?
has comment: http://stackoverflow.com/comment/42529138
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26999025
upvote count: 1
tagged with: primes
accepted answer: http://stackoverflow.com/a/26999025
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26999038
tagged with: math
tagged with: java
possible better answer: http://stackoverflow.com/a/26999043
has answer: http://stackoverflow.com/a/26999043
has title: the method to calculate prime number
has answer: http://stackoverflow.com/a/26999266

http://stackoverflow.com/q/27151982
has answer: http://stackoverflow.com/a/27152377
type: Question
possible better answer: http://stackoverflow.com/a/27152112
has comment: http://stackoverflow.com/comment/42798509
has comment: http://stackoverflow.com/comment/42798592
tagged with: arrays
has body: Define a positive number to be isolated if none of the digits in its square are in its cube. For example 69 is n isolated number because 163*163 = 26569 and 163*163*163 = 4330747 and the square does not contain any of the digits 0, 3, 4 and 7 which are the digits used in the cube. On the other hand 162 is not an isolated number because 162*162=26244 and 162*162*162 = 4251528 and the digits 2 and 4 which appear in the square are also in the cube. Write a function named isIsolated that returns 1 if its argument is an isolated number, it returns 0 if its not an isolated number and it returns -1 if it cannot determine whether it is isolated or not. I have tried this: public static int isIsolated (int n) { int square = n*n; int cube = n*n*n; int[] a = new int[7]; int[] b = new int[7]; if(n &lt; 2097151 || n&gt;1){ for(int i=6;i&gt;=0;i--){ int k = square % 10; int l = cube % 10; a[i]= k; b[j]=l; square = square/10; cube = cube/10; } for(int j=a.length-1;j&gt;=0;j++) { for(int m=0;m&lt;j;m++) { if(a[j] == b[m]) return 0; else return 1; } } } return -1; } but its not working as expected. I am a beginner pls help me.
score: 0
has title: java check if digits in square of a number are not in its cube
has answer: http://stackoverflow.com/a/64402590
has comment: http://stackoverflow.com/comment/42798704
has comment: http://stackoverflow.com/comment/42800077
has comment: http://stackoverflow.com/comment/42798799
has comment: http://stackoverflow.com/comment/42798918
has answer: http://stackoverflow.com/a/27152112
answer count: 5
has comment: http://stackoverflow.com/comment/42798784
accepted answer: http://stackoverflow.com/a/27152690
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42798642
has answer: http://stackoverflow.com/a/27152305
tagged with: java
has answer: http://stackoverflow.com/a/27152690

http://stackoverflow.com/comment/42724306
comment on: http://stackoverflow.com/q/27067417
score: 0
has text: Was my answer helpful to you?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42765595
has text: So that is a safe cast, because I'm sure that the class of `source` is `S`, right?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27133355
type: AnswerComment

http://stackoverflow.com/comment/54818569
type: Comment
has text: You dont need a rooted device to download db to the development PC.
comment on: http://stackoverflow.com/a/27005118
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42671166
comment on: http://stackoverflow.com/a/27080487
type: Comment
has text: If you correct getbLeague() to getBLeague() it should work, similarly for getBName(). If you add the property accessor methods it's generally better: see the java docs for PropertyValueFactory, for example.
score: 0
type: AnswerComment

gravity
tags question: http://stackoverflow.com/q/27030711
type: Tag
tag name: gravity

http://stackoverflow.com/comment/46812429
type: Comment
score: 0
type: AnswerComment
has text: " 'ls: /user/hduser/shakespeare/': No such file or directory " - is this a different error ? Did you add a latest guava version as a managed dependency in eclipse ?
comment on: http://stackoverflow.com/a/28993419

http://stackoverflow.com/q/27032016
tagged with: guidewire
has answer: http://stackoverflow.com/a/27169549
has body: I'm using Guidewire development Studio (IntelliJ-based IDE), and it is very slow when handling big text files (~ 1500 lines and above). I tried with an out-of-the-box community IntelliJ as well, but meet the same problem. When I open those files, it takes 1 second to type a character, even when I see clearly that the used memory is still plenty (1441 MB/ 3959 MB). Also, it quickly suck up all the memory if I open multiple files (I allocate 4GB just for IntelliJ). Intellisense and other automatic stuff is painfully slow as well. I love IntelliJ, but working in those condition is just so hard. Is there any way to work around this problem? I have thought of some alternatives, like: Edit big files on another editor (eg: Notepad++), then reload it on IntelliJ Open another small file, copy your bit of code there, edit it, then copy it back. It would help because Intellisense and code highlight is maintained, however it is troublesome I did turn off all unnecessary plugins, only leaving those necessary, but nothing improved much. I am also wondering if I can "embed" some of outside editor in IntelliJ? Like Notepad++, Notepad2 for example? I did my homework and google around but find no plugins/ configuration that allow to do that. How can I work with big files in IntelliJ (without going mad)? UPDATE: Through my research I learn that IntelliJ can break for very large files (like 20mb) or so on. But my file isn't that big. It just have about 100KB - 1MB, but it's very long text. UPDATE 2 After trying increase the heap memory as Sajidkhan advise (I changed both idea64.vmoptions and idea.vmoptions), I realize that somehow IntelliJ doesn't take the change. The memory heap is stuck at maximum 3GB. On another note, the slow performance can be perceived when the system uses only around ~1GB of heap memory, so I think the problem doesn't relate to memory issue.
has comment: http://stackoverflow.com/comment/42587245
upvote count: 13
tagged with: java
has answer: http://stackoverflow.com/a/27032079
has comment: http://stackoverflow.com/comment/42829787
downvote count: 1
type: Question
score: 12
has comment: http://stackoverflow.com/comment/42585997
has comment: http://stackoverflow.com/comment/138342891
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/42587156
has title: IntelliJ is very slow when handling big files
has comment: http://stackoverflow.com/comment/42587190
answer count: 3
tagged with: intellij-plugin
has comment: http://stackoverflow.com/comment/42585853
favorite count: 0
has answer: http://stackoverflow.com/a/42178740
type: UnansweredQuestion

http://stackoverflow.com/comment/97711604
comment on: http://stackoverflow.com/a/27112836
type: Comment
has text: @FredericBrégier I have a better version of the question here. https://stackoverflow.com/questions/55463519/netty-proxy-server-not-returning-response-from-handlers
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42899954
type: AnswerComment
type: Comment
has text: @Opetion do not know, that person had that error and fix well, one thing I can think of is that maybe, windows may not be able to shed casesensitve mistake, and whoever finds it is OpenGL and launches exception, as if anything ever goes wrong so mirare me that, if I was in windows :) P.S : if you want to delete any comments to not leave, very dirty this haha.
comment on: http://stackoverflow.com/a/27117023
score: 1

http://stackoverflow.com/q/27051491
has answer: http://stackoverflow.com/a/27270979
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: session
accepted answer: http://stackoverflow.com/a/27270979
tagged with: ssl
has title: Android: Sending multiple messages over a sslsocket connection
score: 0
answer count: 1
tagged with: sockets
tagged with: android
has body: I have android client and C++ server with working ssl (TLS) connection. But for every message I have to open new ssl session and so on. Can I send multiple messages over one ssl socket? How? I have tried reuse my one-message working code as below. BufferedWriter w = new BufferedWriter(new OutputStreamWriter(sslSocket.getOutputStream())); w.write(request, 0, request.length()); w.flush(); // this works (server got data) BufferedReader r = new BufferedReader(new InputStreamReader(sslSocket.getInputStream())); StringBuilder response = new StringBuilder(); String actRecieved = null; while ((actRecieved = r.readLine()) != null) { response.append(actRecieved); } Log.d("TEST", "one: " + response.toString()); // this works (server send data, I read it) request = "some special request 2"; w.write(request, 0, request.length()); w.flush(); // this does not work, no data went to server, but no error occured actRecieved = null; response = new StringBuilder(); while ((actRecieved = r.readLine()) != null) { response.append(actRecieved); } Log.d("TEST", "two: " + response.toString()); // this does not work as well, because server is not send any data So, where is the problem? Can anyone tell me? Update I have just found out that 2 write requests will reach the server when I don't read from stream. Is there any problem with using input and output stream mutliple-times from one socket? Should I use two sockets - one for read and one for write? Help anybody.

http://stackoverflow.com/comment/42748728
type: QuestionComment
comment on: http://stackoverflow.com/q/27123120
type: Comment
score: 0
has text: can you append also the request url that the button sends to the server? Is it a post or get?

http://stackoverflow.com/comment/42966660
score: 0
type: Comment
has text: Actually what is causing the problem are two calls in ChildService's reproduceNonUniqueObjectException: - getParentById and - getChildById. First call of getParentById is not related to the problem. The problem is that these other two calls are in same transaction. I have similar situation in my project code, where we are getting parent object and then child object in same transaction. This is working in Hibernate 3 and not working in Hibernate 4. So I was wondering why is this working in Hibernate 3 and throwing exception in Hibernate 4.
comment on: http://stackoverflow.com/a/27220356
type: AnswerComment

http://stackoverflow.com/q/27037570
has body: I've read Java EE documentation and for me is unclear one thing. According to API, the only way to find another Session is a code like this: (assuming that we've identifier of other session): import javax.websocket.Session; ... private static Session findOtherSessionById(Session user, String id) { for (Session session : user.getOpenSessions()) { if (id.equals(session.getId())) { return session; } } return null; } But when we've thousands of users, this code is a performance bottleneck. So, is there a way to get Session by id fast without using own ConcurrentHashMap for this? Or maybe some application server has undocummented feature for this (for me Wildfly would be great)?
has comment: http://stackoverflow.com/comment/69093584
favorite count: 0
type: Question
score: 5
has comment: http://stackoverflow.com/comment/69085930
has comment: http://stackoverflow.com/comment/68050557
linked to: http://stackoverflow.com/q/27815056
tagged with: java
tagged with: java-ee-7
answer count: 1
has title: Find websocket session by id in Java EE 7
tagged with: jakarta-ee
tagged with: performance
upvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27045235
tagged with: websocket
downvote count: 0

http://stackoverflow.com/q/27145341
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/5243754
tagged with: session
tagged with: java
has answer: http://stackoverflow.com/a/27145400
has answer: http://stackoverflow.com/a/27145463
tagged with: servlets
answer count: 3
possible better answer: http://stackoverflow.com/a/27145400
tagged with: jsp
accepted answer: http://stackoverflow.com/a/27145463
linked to: http://stackoverflow.com/q/3177733
type: AnsweredQuestion
has body: I have the following problem. Into the service() method of a custom servlet that implement the HttpServlet interface I put an array of custom object into the session, in this way: // The collection that have to be shown in a table inside the JSP view: SalDettaglio[] salDettaglio = this.getSalDettaglioList(); HttpSession session = req.getSession(false); session.setAttribute("salDettaglio", salDettaglio); Then I want to retrieve this array salDettaglio into my JSP page. So I am trying to do something like this: &lt;%@ page import="com.myproject.xmlns.EDILM.SalReport.SalDettaglio" %&gt; &lt;!-- showSalwf.jsp --&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;% out.println("TEST SALWF"); SalDettaglio[] salDettaglio = request.getParameter("salDettaglio"); %&gt; &lt;/body&gt; &lt;/html&gt; The problem is that an error occur on this line: SalDettaglio[] salDettaglio = request.getParameter("salDettaglio"); The IDE say to me that: Incompatible types. Required: com.myproject.xmlns.EDILM.SalReport.SalDettaglio[] Found: java.lang.String Why? How can I solve this issue?
has answer: http://stackoverflow.com/a/27145421
score: 0
has title: How can I retrieve an array put in session from a JSP page?

http://stackoverflow.com/comment/42879588
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27090448
type: AnswerComment
has text: I think I need more reps to upvote you. I'll be sure to come back once I have this ability.

http://stackoverflow.com/comment/69984528
comment on: http://stackoverflow.com/q/26992383
score: 0
has text: I get the solution to my problem .The problem is that ,I want to touch main thread from background thread . In Asyntask a)onPreExecute(),onpostExecute() is works on main thread b)Doinbackground() Work on background Thread .
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27116478
answers question: http://stackoverflow.com/q/27116477
score: 0
has body: According to https://code.google.com/p/objectify-appengine/wiki/Entities#Maps, I must declare the Map in the following way because the Map's key is not a String: @Stringify(com.googlecode.objectify.stringifier.KeyStringifier.class) public Map&lt;Date, Double&gt; timeseries;
has comment: http://stackoverflow.com/comment/42773231
type: Answer
has comment: http://stackoverflow.com/comment/42809262
has comment: http://stackoverflow.com/comment/42772127

http://stackoverflow.com/q/27041832
has comment: http://stackoverflow.com/comment/42605903
score: 1
tagged with: java
has title: Logback SMTPAppender mixes up mails
tagged with: logback
has comment: http://stackoverflow.com/comment/42665966
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/22383166
favorite count: 0
answer count: 0
tagged with: smtpappender
type: UnansweredQuestion
upvote count: 1
has body: I do issue 10 error messages using this code: final Logger log = LoggerFactory.getLogger("myLogger"); for(int i = 0; i<10; i++) log.error("myMessage" + i); I configured logback.xml (see bottom) to write to console and to send emails. Console says: 17:56:21.172 [http-bio-8443-exec-1] ERROR myLogger - myMessage0 17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage1 17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage2 17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage3 17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage4 17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage5 17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage6 17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage7 17:56:21.175 [http-bio-8443-exec-1] ERROR myLogger - myMessage8 17:56:21.175 [http-bio-8443-exec-1] ERROR myLogger - myMessage9 which is perfect. Also ch.qos.logback.classic.ViewStatusMessagesServlet shows my emails with 10 rows saying INFO | SMTPAppender | About to send out SMTP message "ERROR myLogger myMessageNNN" to [xxx@xxx.yyy.com] with N in 0 to 9, but the order of emails is shuffled to 7-0-9-2-8-1-4-3-5-6, which is still ok. But unfortunatly, in my email account I find 10 equal emails, all with subject "ERROR myLogger myMessage8" and body ERROR myLogger myMessage6 So instead of sending 10 emails, one of them is sent 10 times. Even worse, subject and body of that email do not correspond to each other. All 10 emails do have exactly the same Message-ID. I tried this with logback 1.1.2, 1.1.1, and 1.1.0 (fetched from mvnrepository) and it always shows the same behaviour. I tried it with two different smtp servers of my employer, and I did access both via Thunderbird and SquirrelMail, but this makes no difference. If I do a "Thread.sleep(1000)" before each log.error, everything works as expected and the emails are perfectly fine. %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n ERROR xxx.yyy.com xxx@xxx.yyy.co…

http://stackoverflow.com/comment/42556143
type: Comment
has text: I checked window--preferences--java--compiler as well.. The add line numbers check box is checked in classfile generation tab
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27015181

http://stackoverflow.com/q/27025395
has title: How to find a String not surrounded by pipes in a pipe delimited file?
has comment: http://stackoverflow.com/comment/42574241
tagged with: regex-negation
type: Question
has comment: http://stackoverflow.com/comment/42574327
tagged with: java
has answer: http://stackoverflow.com/a/27025501
score: 0
answer count: 2
tagged with: regex-lookarounds
has answer: http://stackoverflow.com/a/27025519
accepted answer: http://stackoverflow.com/a/27025501
has body: I am trying to find a regex that will match any pair of double quotes, that does not have exactly one pipe in front of it, and one pipe after it. Here is the example line: 1||1|0|0|1|0|""|0|0|||""|""Billy""|"Johnson"| In this line I would want to match the pairs of double quotes in front of and behind the word Billy. The regex I tried is: [^|]""[^|] Which seems straightforward enough, but fails to match how I would think. Is there a regex that will match those? (Specifically I will be trying to replace those quotes in Java using String.replaceAll(), but a general regex solution would be fine at getting me started in the right direction.)
tagged with: regex
possible better answer: http://stackoverflow.com/a/27025519
type: AnsweredQuestion

http://stackoverflow.com/comment/42794785
comment on: http://stackoverflow.com/q/27149815
has text: how can i calculate it...something like more 1 minute ... and what about the time whene it don't work withe this same code !!!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27091025
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42688730
tagged with: android
has body: I'm developing an app for Android using Android studio. I have two activities; the first one to configure the app (it must appear only the first time that app is launched), the second activity is to log in to the app. The problem is: I want to show the "config activity" at the first launch, and after that the "login activity" must appear, but I don't know how to do this. I tried to put a conditional into the "config activity" to force the second (login) to put it to work. But it doesn't work. Can you explain me some things about this topic?
has title: How to avoid to open an activity on android?
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27091069

http://stackoverflow.com/comment/43100313
type: Comment
comment on: http://stackoverflow.com/a/27049667
has text: @dic19: This was meant as a way to support a "My computer" root object with multiple drives (C:\, D:\, etc.) below it. How could you do that with the standard `DefaultTreeModel` when the "My computer" root does not really exists as a directory and it does not have the drives as its children?
type: AnswerComment
score: 0

http://stackoverflow.com/q/27100231
has answer: http://stackoverflow.com/a/27100380
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/18791645
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/42704967
has comment: http://stackoverflow.com/comment/42705011
has answer: http://stackoverflow.com/a/27100476
has body: So I have class: public class CustomUserDetailService implements UserDetailsService { @Autowired private EmployeeRepository employeeRepository; @Override public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException { Employee employee = employeeRepository.readEmployee(s); if(employee != null) { List&lt;GrantedAuthority&gt; authorities = new ArrayList&lt;&gt;(); authorities.add(new SimpleGrantedAuthority(employee.getRole().name())); //how to save employee login and user id???? return new User(employee.getLogin(), employee.getPassword(),true, true, true, true, authorities) }else { throw new UsernameNotFoundException("Can't locate employee '" + s + "'"); } } } And class in which I use the stored data: public class CurrentEmployeeParam { public static Long getCurrentEmployeeId(){ // how to get saved employee login and id??? String employeeId = //something return Long.parseLong(employeeId); } So how to saved employee info and get employee info from any point in the program?
has title: How to use session in Spring for save user info
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/19699922
has comment: http://stackoverflow.com/comment/42705057

http://stackoverflow.com/q/27143122
has comment: http://stackoverflow.com/comment/42785661
has comment: http://stackoverflow.com/comment/42783027
has comment: http://stackoverflow.com/comment/42786245
has comment: http://stackoverflow.com/comment/42785763
favorite count: 0
tagged with: threadpoolexecutor
has answer: http://stackoverflow.com/a/27172212
has answer: http://stackoverflow.com/a/27146330
tagged with: priority-queue
has comment: http://stackoverflow.com/comment/42782921
has comment: http://stackoverflow.com/comment/42786156
has comment: http://stackoverflow.com/comment/42783121
has answer: http://stackoverflow.com/a/27228138
has comment: http://stackoverflow.com/comment/42785239
has body: Guys I'm in bit dilemma between Tree Set and Thread Pool Executor Following is the scenario : First Approach I have to use structure which has tasks in it with priorities of each task.Now based on treeset constructor(with comparator interface) I can compare task on priorities and based on that, tasks are ordered properly. Now after that, tasks should processed in order of priority through iteration of tree set and execute each task one by one. Second Approach second approach is to do some sort of logic building and use core functionality of Thread pool executor and for this I had taken inspiration from this link and I had achieved my requirements with this approach also which will choose high priority task first and execute it first and same way it will execute all the tasks. Now my confusion here is which one is best to use in term of performance costs, flexibility(increase/decrease threads) etc and why should I opt for it? Any suggestions and answers are highly appreciated.
possible better answer: http://stackoverflow.com/a/27146330
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42783910
tagged with: java
tagged with: multithreading
has title: Best approach: tree set structure vs thread pool executor
tagged with: collections
has comment: http://stackoverflow.com/comment/42783063
has comment: http://stackoverflow.com/comment/42785862
type: Question
has comment: http://stackoverflow.com/comment/42785139
has comment: http://stackoverflow.com/comment/42783267
has comment: http://stackoverflow.com/comment/42785290
accepted answer: http://stackoverflow.com/a/27172212
has comment: http://stackoverflow.com/comment/42785070
answer count: 3
has comment: http://stackoverflow.com/comment/42785712
upvote count: 1

ipv4
tags question: http://stackoverflow.com/q/27018360
type: Tag
tag name: ipv4

http://stackoverflow.com/comment/42799352
type: Comment
has text: also please note that class names should start with an uppercase letter and variables and methods always with a lowercase letter, according to the java coding standards
comment on: http://stackoverflow.com/a/27152355
score: 0
type: AnswerComment

http://stackoverflow.com/q/27076126
tagged with: java
has comment: http://stackoverflow.com/comment/42663276
tagged with: eclipse
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/42663239
score: 2
has comment: http://stackoverflow.com/comment/42663719
has answer: http://stackoverflow.com/a/27086043
has comment: http://stackoverflow.com/comment/42667018
has body: I created hello world android application in eclipse with just one java main activity and one xml layout file without any images in drawable folder ,i removed all the themes from values with default theme.When i saw size of source code it was 2.9 mb in size, and apk file size was 380 kb.But when i opened sample android application in eclipse after running it i checked the file size of source it was 390 kb and apk size was 58 kb,and it had 6 java files in src folder with 3 xml files in layout and couple of images in drawable folder.How come hello world program with nothing be so large than notepad application.I am using eclipse juno as editor.If any one knows the answer please help me.
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/42663572
favorite count: 0
type: UnansweredQuestion
has title: how sample android source codes are smaller than hello world android source code in eclipse?
downvote count: 2

http://stackoverflow.com/comment/79563609
has text: Use real clock with `Clock.fixed` instead of mocking!
score: 17
comment on: http://stackoverflow.com/a/27068139
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27078047
has answer: http://stackoverflow.com/a/27078092
tagged with: hashmap
has title: Changing Hashcode in runtime
score: 0
accepted answer: http://stackoverflow.com/a/27078090
answer count: 3
has answer: http://stackoverflow.com/a/27078141
has body: Everybody knows that it's better to use an immutable class as key in HashMap, and if we change object state then the JVM recalculates the hash code for that object. Can someone make example where after changing the state of an object its hashcode changes? (in runtime)
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27078090
possible better answer: http://stackoverflow.com/a/27078092
type: Question

http://stackoverflow.com/comment/42554204
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27013971
score: 0
has text: What is unclear in the javadoc? What does your test show?

http://stackoverflow.com/comment/42616131
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27048107
type: Comment
has text: Great Point. The Custom Error page solution would make a great blog post or dare I say... a video. :)

http://stackoverflow.com/comment/42536644
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27003221
has text: Can you please give an example of what you meant by "a standard month/day/year format"?
score: 0

http://stackoverflow.com/comment/42709695
comment on: http://stackoverflow.com/a/27101865
has text: You can autowire this dependency in any class managed by Spring and so retrieve the instance.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/42553992
type: AnswerComment
score: 0
type: Comment
has text: thanks for the help but this way we have to define the numericals for each and every number which is not possible. Suppose we need to find out two third of two thousand, we cannot do that.
comment on: http://stackoverflow.com/a/27013994

http://stackoverflow.com/q/27138841
accepted answer: http://stackoverflow.com/a/27141290
answer count: 1
tagged with: scrollpane
type: AnsweredQuestion
has title: libGDX ScrollPane slightly scrolls back automatically when I scroll to the bottom
tagged with: libgdx
has body: I want to create a ScrollPane with several button inside. The ScrollPane must scrolls vertically. I encounter 2 problems when I scroll to the bottom : 1) Even if I scroll to the maximum, the last button doesn't display fully, a small part is missing at the bottom. 2) When I release the mouse button, after scrolling to the bottom, the ScrollPane scrolls back a little and the last button is not displayed anymore. I wasn't able to find anything related to these problem on google. How can I force the ScrollPane to display fully the last button when I scroll to the bottom ? How can I prevent the ScrollPan to scrolls back after releasing the mouse button ? Here is a link to a picture illustrating the problem. Here is the code I used : public class ShopScreen implements Screen{ final MyGdxGame game; OrthographicCamera camera; Stage stage; ScrollPane scrollPane; Table table; Texture texture1, texture2, texture3, texture4, texture5, texture6; ImageButton button1, button2, button3, button4, button5, button6; public ShopScreen(final MyGdxGame gam){ game = gam; Constants.ecran = EcranEnum.Shop; camera = new OrthographicCamera(); camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); stage = new Stage(); table = new Table(); scrollPane = new ScrollPane(table); texture1 = new Texture(Gdx.files.internal("Images/Option1.png")); texture2 = new Texture(Gdx.files.internal("Images/Option2.png")); texture3 = new Texture(Gdx.files.internal("Images/Option3.png")); texture4 = new Texture(Gdx.files.internal("Images/Option4.png")); texture5 = new Texture(Gdx.files.internal("Images/Option5.png")); texture6 = new Texture(Gdx.files.internal("Images/Option6.png")); button1 = new ImageButton(new Image(texture1).getDrawable()); button2 = new ImageButton(new Image(texture2).getDrawable()); button3 = new ImageButton(new Image(texture3).getDrawable()); button4 = new ImageButton(new Image(texture4).getDrawable()); button5 = new ImageButton(new Image(texture5).getDrawable()); butt…
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27141290
score: 0

http://stackoverflow.com/q/27021799
has answer: http://stackoverflow.com/a/27021948
tagged with: java
has body: I know I could go through a for loop like this (see code) and i could also add to the array in the same fashion but is there a quicker way. I don't want to use any other java API as i want to practice array's. Would using a hash function allow me to store my variables quicker and then find a certain word quicker? edit: The problem is when using 10,000+ words the delay increases larger than 1ms Thanks :) int count = 0; for(int i = 0; i &lt; array.length; i++) if(array[i].equals(word)) count++;
type: Question
tagged with: arrays
score: 0
answer count: 3
tagged with: hash-function
has title: Quickest way of storing and accessing Strings in an array
tagged with: hash
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27021977
has answer: http://stackoverflow.com/a/27021957

http://stackoverflow.com/q/27130269
type: Question
has title: my BufferedReader character input loop program keeps running forever
tagged with: infinite-loop
has body: I wrote a program which prints out the characters of the sentence (or word) wrote by the user to the console. I thought that the program will end after I gave the first input. But it didn't and kept taking inputs and printing it even after it printed the first sentence. Can you explain me why it happened so? I am new to this. Here is the program: import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; /* * This program prints out the characters written in the console * line by line. */ public class ReaderProgram { public static void main(String args[]) throws IOException{ char c; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); do{ //reads character and stores it in c c = (char) br.read(); //prints out c System.out.println(c); }while(c != -1); //'while' checks if c is -1 (-1 means end of the stream) } } Output is shown here (Input to console is show like this): Epic E p i c Dream D r e a m
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27130299
linked to: http://stackoverflow.com/q/3197025
has comment: http://stackoverflow.com/comment/42759574
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42760181
has comment: http://stackoverflow.com/comment/42761546
tagged with: java
tagged with: inputstream

http://stackoverflow.com/comment/42682709
comment on: http://stackoverflow.com/q/27086844
has text: This is off-topic, but Guava (among many other great features) provides that. See Iterables and FluentIterable: http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/collect/FluentIterable.html
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27018091
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27018152
answer count: 1
has comment: http://stackoverflow.com/comment/42561197
type: UnansweredQuestion
has title: Modifying all the string primitives in a JSON structure
has body: In Java, given a textual representation of a JSON object, how can I apply a function only to leaves that are strings? For example, converting all the string values to upper case: Input: { "name": "john", "address": { "street": "elm", "number": 4 }, "children": ["george", "paul"] } Output: { "name": "JOHN", "address": { "street": "ELM" "number": 4 }, "children": ["GEORGE", "PAUL"] }
type: Question
has comment: http://stackoverflow.com/comment/42561339

http://stackoverflow.com/comment/42568477
comment on: http://stackoverflow.com/q/27021429
has text: Edit on the post: test input added
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42712740
comment on: http://stackoverflow.com/q/27104715
type: Comment
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example).
score: 2

http://stackoverflow.com/a/27141116
has comment: http://stackoverflow.com/comment/42782764
score: 0
has body: You need to understands the basics of java variable scope http://www.java-made-easy.com/variable-scope.html
type: Answer
answers question: http://stackoverflow.com/q/27141033
has comment: http://stackoverflow.com/comment/42782904
upvote count: 1
has comment: http://stackoverflow.com/comment/42779837
downvote count: 1

http://stackoverflow.com/a/27083025
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: The documentation assumes that you already know SQL. This particular query would be written as: SELECT _id, Name, Lat, Lng, Bear, BoomWidth, Comments, Zoom FROM MyTable WHERE Name = (FIELDSELECTION) This means that the comparison must go into the selection parameter: mDB.query(DATABASE_TABLE, new String[] { FIELD_ROW_ID, FIELD_NAME, FIELD_LAT , FIELD_LNG, FIELD_BEAR, FIELD_BOOMWIDTH, FIELD_COMMENTS, FIELD_ZOOM }, FIELD_NAME + " = ?", new String[] { FIELDSELECTION }, null, null, null);
accepted answer of: http://stackoverflow.com/q/27079377
answers question: http://stackoverflow.com/q/27079377
score: 1

http://stackoverflow.com/q/27077068
has comment: http://stackoverflow.com/comment/42664944
has answer: http://stackoverflow.com/a/27077155
answer count: 4
has comment: http://stackoverflow.com/comment/42664692
type: UnansweredQuestion
has title: Printing Array with recurse in java
has answer: http://stackoverflow.com/a/27077154
tagged with: recursion
tagged with: java
type: Question
has body: i want to print an array with recurse in java, but the only parameter is the array itself. is it possible? public static void printintArr(int[] a)
tagged with: arrays
has answer: http://stackoverflow.com/a/27077167
has comment: http://stackoverflow.com/comment/42664832
score: 0
has answer: http://stackoverflow.com/a/27077638

http://stackoverflow.com/q/27117367
accepted answer: http://stackoverflow.com/a/27118358
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I've been posed a problem along the lines of Santa's workshop where numerous things have to happen before presents can be delivered. One such requirement is that eleven elves successfully manufacture 100 presents. My main class looks like this: public class Main { public volatile int toyList = 100; public int getToyList() { return toyList; } public void setToyList(int toyList) { this.toyList = toyList; } public static void main(String[] args){ Main main = new Main(); ... Elf elfOne = new Elf("Jim", main); Elf elfTwo = new Elf("John", main); Elf elfThree = new Elf("Eamonn", main); Elf elfFour = new Elf("Eoin", main); Elf elfFive = new Elf("Ronan", main); Elf elfSix = new Elf("Seamus", main); Elf elfSeven = new Elf("Rebecca", main); Elf elfEight = new Elf("Orla", main); Elf elfNine = new Elf("Tina", main); Elf elfTen = new Elf("Filly", main); Elf elfEleven = new Elf("Jess", main); ... elfOne.start(); elfTwo.start(); elfThree.start(); elfFour.start(); elfFive.start(); elfSix.start(); elfSeven.start(); elfEight.start(); elfNine.start(); elfTen.start(); elfEleven.start(); } and my Elf class looks like this: public class Elf extends Thread{ Semaphore semaphore = new Semaphore(11); Random rng = new Random(); String name; Main main; public Elf(String name, Main main){ this.name = name; this.main = main; } public void run(){ while(true){ try { semaphore.acquire(); makeToy(); } catch (InterruptedException e) { e.printStackTrace(); } finally { semaphore.release(); } } } private void makeToy() throws InterruptedException{ if (main.getToyList() != 0){ if(rng.nextInt(99) &lt;= 4){ //5% chance to fail System.out.println(name + " failed in making a toy!"); }else{ main.setToyList(main.getToyList() - 1); System.out.println(name + " created a toy! Toys remaining: " + main.getToyList()); } } else { wakeSanta(); } } private void wakeSanta() throws InterruptedException { } } A sample output I get is: ... Eamonn created a toy! Toys remaining: 6 Jim created a toy! Toys remaining: 7 Eoin cr…
favorite count: 0
type: Question
has title: How to use semaphores correctly
tagged with: semaphore
tagged with: java
answer count: 2
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/27118358
tagged with: concurrency
possible better answer: http://stackoverflow.com/a/27118671
has answer: http://stackoverflow.com/a/27118671
has comment: http://stackoverflow.com/comment/42747852

spring
tags question: http://stackoverflow.com/q/27042365
tags question: http://stackoverflow.com/q/27072758
tags question: http://stackoverflow.com/q/26996613
tags question: http://stackoverflow.com/q/27069720
tags question: http://stackoverflow.com/q/27040684
tags question: http://stackoverflow.com/q/27063362
tags question: http://stackoverflow.com/q/27064210
tags question: http://stackoverflow.com/q/27102375
tags question: http://stackoverflow.com/q/27075842
tags question: http://stackoverflow.com/q/26997791
tags question: http://stackoverflow.com/q/27040951
tags question: http://stackoverflow.com/q/26998563
tags question: http://stackoverflow.com/q/26993833
tags question: http://stackoverflow.com/q/27019244
tags question: http://stackoverflow.com/q/27061358
tags question: http://stackoverflow.com/q/27148556
tags question: http://stackoverflow.com/q/27078799
tags question: http://stackoverflow.com/q/27020702
tags question: http://stackoverflow.com/q/27133002
tags question: http://stackoverflow.com/q/27091748
tags question: http://stackoverflow.com/q/27129922
tags question: http://stackoverflow.com/q/27011681
tags question: http://stackoverflow.com/q/27130958
tags question: http://stackoverflow.com/q/27141058
tags question: http://stackoverflow.com/q/27122212
tags question: http://stackoverflow.com/q/27125572
tags question: http://stackoverflow.com/q/27063575
tags question: http://stackoverflow.com/q/27121366
tags question: http://stackoverflow.com/q/27151308
tags question: http://stackoverflow.com/q/27071184
tags question: http://stackoverflow.com/q/27071978
tags question: http://stackoverflow.com/q/27091784
tags question: http://stackoverflow.com/q/27139121
tags question: http://stackoverflow.com/q/27063121
tags question: http://stackoverflow.com/q/27127647
tags question: http://stackoverflow.com/q/27060757
tags question: http://stackoverflow.com/q/27139886
tags question: http://stackoverflow.com/q/27031938
tags question: http://stackoverflow.com/q/27131143
tags question: http://stackoverflow.com/q/27101048
tags question: http://stackoverflow.com/q/27050210
tags question: http://stackoverflow.com/q/27023119
tags question: http://stackoverflow.com/q/27124427
tags question: http://stackoverflow.com/q/27047309
tags question: http://stackoverflow.com/q/27076623
tags question: http://stackoverflow.com/q/27004587
tags question: http://stackoverflow.com/q/27060730
tags question: http://stackoverflow.com/q/27132766
tags question: http://stackoverflow.com/q/27017495
tags question: http://stackoverflow.com/q/27146549
tags question: http://stackoverflow.com/q/27014435
tags question: http://stackoverflow.com/q/27134144
tags question: http://stackoverflow.com/q/26993364
tags question: http://stackoverflow.com/q/27085866
tags question: http://stackoverflow.com/q/27070950
tags question: http://stackoverflow.com/q/27106762
tags question: http://stackoverflow.com/q/27080231
tags question: http://stackoverflow.com/q/27145424
tags question: http://stackoverflow.com/q/27139100
type: Tag
tags question: http://stackoverflow.com/q/27089165
tags question: http://stackoverflow.com/q/27142376
tags question: http://stackoverflow.com/q/27098177
tags question: http://stackoverflow.com/q/27010305
tags question: http://stackoverflow.com/q/27059342
tags question: http://stackoverflow.com/q/27091418
tags question: http://stackoverflow.com/q/27068785
tags question: http://stackoverflow.com/q/27053365
tags question: http://stackoverflow.com/q/27109768
tags question: http://stackoverflow.com/q/27132348
tags question: http://stackoverflow.com/q/27073953
tags question: http://stackoverflow.com/q/27145927
tags question: http://stackoverflow.com/q/27062538
tags question: http://stackoverflow.com/q/27136877
tags question: http://stackoverflow.com/q/27123182
tags question: http://stackoverflow.com/q/27128667
tags question: http://stackoverflow.com/q/27015077
tags question: http://stackoverflow.com/q/27147851
tags question: http://stackoverflow.com/q/27129310
tags question: http://stackoverflow.com/q/27084567

http://stackoverflow.com/comment/42731973
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27102624
has text: Aye I meant xml config in jboss-standalone.xml :p

http://stackoverflow.com/q/27139657
downvote count: 1
tagged with: android-5.0-lollipop
type: Question
has title: Android PopupMenu elevation issue
has answer: http://stackoverflow.com/a/27898561
upvote count: 2
answer count: 1
tagged with: android-menu
favorite count: 0
has body: When setting the elevation on a PopupMenu in android I get garbage around the menu, as show below. My Activity's Theme is setting popupMenuStyle: @style/PopupMenu I am creating this menu in code: PopupMenu popup = new PopupMenu(itemView.getContext(), myButton); MenuInflater inflater = popup.getMenuInflater(); inflater.inflate(R.menu.popup_menu, popup.getMenu()); popup.show(); Does anyone know of a fix? Is this a bug?
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java

http://stackoverflow.com/comment/42552186
type: QuestionComment
has text: @huidube: I orientated myself on your comment, where you said "ProcessPanel.setLabelAndImage()". I finally solved the problem and will answer the question on my own later.
score: 1
comment on: http://stackoverflow.com/q/26994202
type: Comment

http://stackoverflow.com/comment/42683508
score: 4
has text: If that's the case I would recommend staying away from talking directly MySQL at all from those places (if a user is reverse engineer the way the app is connecting will be able to issue arbitrary queries). Instead, you can build a backend that (1) exposes an API that allows only certain operations and (2) properly authenticates the users (OAuth2 for example).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27050935

http://stackoverflow.com/a/27077383
type: Answer
answers question: http://stackoverflow.com/q/27077346
accepted answer of: http://stackoverflow.com/q/27077346
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: getWindow() and requestWindowFeature() are methods of Activity not Context. Pass a reference of the Activity to your class / method. public void hideBars(Activity activity) { //HIDING TOP TITLE TAB activity.requestWindowFeature(Window.FEATURE_NO_TITLE); //HIDING TOP TOOL BAR activity.getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); }

http://stackoverflow.com/comment/80716798
comment on: http://stackoverflow.com/a/27079911
type: AnswerComment
type: Comment
score: 1
has text: @H.Aqjn "It should be placed in the top level deployment, in META-INF (or WEB-INF for web deployments)"

http://stackoverflow.com/comment/42686855
score: 0
has text: @AndrewBarber: You are right. It just bothered me that there was talk about some kind of record for the quickest marking as duplicate, when at the same time the marking had been done wrong. And yes, this is probably a duplicate of something else, but the point is in referencing the right duplicate (so the poster actually receives a reference to an answer).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27034711

http://stackoverflow.com/q/27107117
has comment: http://stackoverflow.com/comment/42722913
has comment: http://stackoverflow.com/comment/42722687
has comment: http://stackoverflow.com/comment/42726830
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42718152
has comment: http://stackoverflow.com/comment/42717582
has answer: http://stackoverflow.com/a/27107311
score: 0
has comment: http://stackoverflow.com/comment/42717989
has comment: http://stackoverflow.com/comment/42717896
has body: I have an abstract class (Candy) with a generic collection (Flavors). Candy has a factory method to produce concrete instances of itself. It also has methods to get an instance of the generic flavor appropriate to the concrete candy and to add the flavor to its collection. I know the getter is working, because if I cast the flavor from the CandyStore, the methods unique to the concrete flavor work fine. But the very last line, the addFlavor(flavor), errs (Eclipse) on me. The error is: "The method addFlavor(capture#5-of ? extends IFlavor) in the type ICandy is not applicable for the arguments (IFlavor)." Can anyone explain what is going on? Interface: public interface ICandy &lt;Flavor extends IFlavor&gt; { public Flavor getFlavorForCandy(); public void addFlavor(Flavor flavor); } Abstract Class: public abstract class AbstractCandy&lt;Flavor extends IFlavor&gt; implements ICandy&lt;Flavor&gt; { public static ICandy&lt;? extends IFlavor&gt; buildCandy(String flavor){ if(flavor.equals("Jolly Rancher") return new JolRanchCandy(); } public Flavor getFlavorForCandy() { return (Flavor) new CandyFlavor(); } public void addFlavor(Flavor flavor) { ... //implemented } } Concrete Class: public class JolRanchCandy extends AbstractCandy&lt;JolRanchFlavor&gt; { ... //implemented } Used By: public class CandyStore { private ICandy&lt;? extends IFlavor&gt; candy; private IFlavor flavor; public void createCandy() { candy = AbstractCandy.buildCandy("Jolly Rancher"); flavor = candy.getFlavorForCandy(); //returns a JolRanchFlavor flavor.setName("Apple"); //etc for creating flavor candy.addFlavor(flavor); //no luck } } Edit: For clarity, JolRanchFlavor extends CandyFlavor implements IJolRanchFlavor and CandyFlavor implements IFlavor.
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/42717780
tagged with: interface
has comment: http://stackoverflow.com/comment/42717748
has comment: http://stackoverflow.com/comment/42718803
accepted answer: http://stackoverflow.com/a/27107311
upvote count: 1
tagged with: collections
downvote count: 1
has title: Using Factory Method to Create Generics
has comment: http://stackoverflow.com/comment/42718710
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42725366
tagged with: factory-method
tagged with: java

http://stackoverflow.com/a/27139043
has comment: http://stackoverflow.com/comment/42779628
downvote count: 0
has comment: http://stackoverflow.com/comment/42783103
has comment: http://stackoverflow.com/comment/42780207
type: Answer
has comment: http://stackoverflow.com/comment/42775949
has comment: http://stackoverflow.com/comment/42782180
upvote count: 2
has body: Ok, this is closer. You need to check the high bit, then shift, then exclusive-or the polynomial if the high bit was a one. You are doing the shift after, which is obviously wrong since it guarantees that the answer always has a low bit of zero. Update for edited answer: The code is now correct. However you are entering the polynomial incorrectly on the website you linked. The actual polynomial has an x16 term as well. Put in that leading one. Update for another edit: You do not calculate a CRC for each pair of bytes separately. Instead you continue to process the CRC with more bytes. Before the first step, you exclusive-ored the initial CRC, zero, with the two bytes (though you may not realize you did that). Just keep doing that with the intermediate CRCs.
score: 2
has comment: http://stackoverflow.com/comment/42776368
has comment: http://stackoverflow.com/comment/42780685
answers question: http://stackoverflow.com/q/27138839

http://stackoverflow.com/a/27066808
answers question: http://stackoverflow.com/q/27065892
type: AcceptedAnswer
type: Answer
has body: In the javadoc 1 of org.apache.log4j.HTMLLayout states: The LocationInfo option takes a boolean value. By default, it is set to false which means there will be no location information output by this layout. If the the option is set to true, then the file name and line number of the statement at the origin of the log statement will be output. So, you just need to set it to true. Therefore, the configuration of your appender could be similar to: &lt;appender name="log" class="org.apache.log4j.FileAppender"&gt; &lt;param name="file" value="log4j.html"/&gt; &lt;param name="threshold" value="debug"/&gt; &lt;param name="immediateFlush" value="true"/&gt; &lt;param name="append" value="false"/&gt; &lt;layout class="org.apache.log4j.HTMLLayout"&gt; &lt;param name="Title" value="false"/&gt; &lt;param name="LocationInfo" value="true"/&gt; &lt;/layout&gt; &lt;/appender&gt; Notes https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/HTMLLayout.html
score: 0
accepted answer of: http://stackoverflow.com/q/27065892

http://stackoverflow.com/q/27065075
type: AnsweredQuestion
tagged with: cxf
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27131889
has body: I get the error when generating web service. I have a simple class that i want to create web service. I am using CXF 2.7 and Tomcat 7 version. org.apache.cxf.tools.common.ToolException: Fail to load class :RequestLimit at org.apache.cxf.tools.util.AnnotationUtil.loadClass(AnnotationUtil.java:88) at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.getServiceClass(JavaToWSDLProcessor.java:284) at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.getServiceBuilder(JavaToWSDLProcessor.java:181) at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.process(JavaToWSDLProcessor.java:100) at org.apache.cxf.tools.java2ws.JavaToWSContainer.processWSDL(JavaToWSContainer.java:110) at org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer.java:75) at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103) at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:58) at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:40) at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:77) at org.apache.cxf.tools.java2ws.JavaToWS.main(JavaToWS.java:45)
accepted answer: http://stackoverflow.com/a/27131889
answer count: 1
has title: JavaToWS Error while generating web service with CXF
tagged with: web-services

http://stackoverflow.com/q/27108033
has answer: http://stackoverflow.com/a/27108556
type: Question
has body: I have a homework that specifies to add to an existent project a generic repository layer. The problem that i face is the following. My repository should encapsulate a map that stores the data. What I have until now is the following: public interface IDObject&lt;T&gt; { public Comparable&lt;T&gt; getID(); } public class Person implements IDObject&lt;String&gt; { private String cnp; private String name; private String age; public Person(String cnp, String name, String age) { this.cnp = cnp; this.name = name; this.age = age; } public void setName(String name) { this.name = name; } public void setCNP(String cnp) { this.cnp = cnp; } public void setAge(String age) { this.age = age; } public String getName() { return name; } public String getCNP() { return cnp; } public String getAge() {return age; } public String toString() { return cnp + "-" + name + "-" + age; } @Override public Comparable&lt;String&gt; getID() { return getCNP(); } //basically the unique identifier } public class Repository&lt;T extends IDObject&lt;?????????&gt;&gt;{ private IMap map; public Repository() { map = new Map&lt;???????, T&gt;(); } ... } So my problem appears in Repository class. I want to store persons so I will do something like Repository&lt;Person&gt; repo = new Repository&lt;Person&gt;(); But the problem is I don't know how to construct the map in the Repository constructor. In other words I don't know the type of the key. I want the Person's cnp to be the key(which is of Type String), but if I force the map to define the keys as Strings, my repository is no longer generic, because if I want to add some Animal objects that have the key as an integer , the map should be like map = new Map&lt;Integer, T&gt;();. So the question is how can I still use a construction like Repository&lt;Person&gt; repo = new Repository&lt;Person&gt;(); using the fact that Objects that are stored in a repository implement IDObject and knowing that a repository encapsulates a map which stores the data? How shou…
answer count: 1
accepted answer: http://stackoverflow.com/a/27108556
score: 0
has comment: http://stackoverflow.com/comment/42721216
has title: Generic repository using map
has comment: http://stackoverflow.com/comment/42719541
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27083376
tagged with: wildfly
has answer: http://stackoverflow.com/a/27085189
upvote count: 1
tagged with: java
answer count: 1
has title: Wildfly JAX-RS questiona about Produces
accepted answer: http://stackoverflow.com/a/27085189
tagged with: wildfly-8
has body: I tried official samples. And trying to use: curl http://localhost:8080/wildfly-helloworld-rs/rest/ -H 'accept:application/xml' curl http://localhost:8080/wildfly-helloworld-rs/rest/ -H 'accept:application/json' Both request return me xml representation: Hello World! I even tried to add this: @GET @Path("/") @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.TEXT_PLAIN) public String getHelloWorldText() { return helloService.createHelloMessage("World"); } It's anyway always returns xml representation. EDIT: From linked example @Path("/") public class HelloWorld { @Inject HelloService helloService; @GET @Path("/") @Produces({ "application/json" }) public JsonObject getHelloWorldJSON() { return Json.createObjectBuilder() .add("result", helloService.createHelloMessage("World")) .build(); } @GET @Path("/") @Produces({ "application/xml" }) public String getHelloWorldXML() { return " " + helloService.createHelloMessage("World") + " "; } } public class HelloService { String createHelloMessage(String name) { return "Hello " + name + "!"; } }
type: AnsweredQuestion
downvote count: 0
tagged with: jax-rs
score: 1
favorite count: 0
tagged with: rest
type: Question

http://stackoverflow.com/comment/42748348
has text: Thank you so much, this is really helpful. In your code, nLowPeriodInSamples and nHiPeriodInSamples couldn't just be set as 4500 and 20 straight away? And in the double array(samples) I can use the AudioRecord, right? Also, what exactly is bestIndices[i]?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27123449

http://stackoverflow.com/comment/107256698
type: Comment
score: 4
has text: you must compare strings with equal method, not !=
comment on: http://stackoverflow.com/a/48530841
type: AnswerComment

http://stackoverflow.com/a/27081947
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42691364
accepted answer of: http://stackoverflow.com/q/27075864
answers question: http://stackoverflow.com/q/27075864
type: Answer
score: 11
upvote count: 11
has body: The querydsl equivalent for COUNT(*) is Wildcard.count.

http://stackoverflow.com/comment/42668593
type: Comment
type: AnswerComment
has text: So you are saying I should have a separate class (like `TopKProcessor`) that is going to encapsulate every action that I would want to take on an RDD (like `reduce()`, `reduceByKey()` etc.)?
comment on: http://stackoverflow.com/a/27077499
score: 0

http://stackoverflow.com/comment/42692353
has text: @Andrew Thompson I'm using netbeans like a gui editor. And I will not use cardlayout because it isn't the thing i need
comment on: http://stackoverflow.com/q/27090959
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42764132
has text: Note that `toBinaryString` removes leading zeros, so the actual length of the result string will vary. Also note that `print` will be called 6 times, and the outputs will all be smashed together. This means that it's impossible to look at the output and tell where one binary string starts and the other ends. That's usually not what you want (but who knows, maybe it is).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27132659
type: QuestionComment

http://stackoverflow.com/q/27027017
has body: I'll try to be as clear as possible :) I would like to add an activity (let's call it X not to do confusions) to an app in order to do this when the app start : First of all, start my activity X and show the layout that contains a button. The OnClickListener of the button starts the main activity of the original app. I have the activity X in an eclypse project, so i can turn my java files to smali. I have the app in smali files + a yml file (by backsmaling). How can i turn the main activity of the app to a normal activity ? How can i add my activity X to the app ? Which folder of the smali folder ? Do I need to change something in the yml file ? What happens for the xml files ? Any kind of help will be very appreciated ! :)
has answer: http://stackoverflow.com/a/27027791
score: 0
tagged with: smali
accepted answer: http://stackoverflow.com/a/27027791
type: AnsweredQuestion
has title: How to add some stuff from java files to smali files?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42578539
has comment: http://stackoverflow.com/comment/42578068
tagged with: android
answer count: 1

http://stackoverflow.com/a/27018219
answers question: http://stackoverflow.com/q/27017355
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42562655
accepted answer of: http://stackoverflow.com/q/27017355
upvote count: 1
score: 1
has body: Why do you want to use a switch instead of the if statements you already have in your code? Since you can select the four checkboxes independently from each other, a switch is not the best solution here. You have four checkboxes, so there are 2^4 = 16 possible "check patterns": int pattern = (cb1.isSelected() ? 0b0001 : 0) | (cb2.isSelected() ? 0b0010 : 0) | (cb3.isSelected() ? 0b0100 : 0) | (cb4.isSelected() ? 0b1000 : 0); switch (pattern) { case 0b0001: // code for when only checkbox 1 is checked break; ... case 0b0011: // code for when checkbox 1 and checkbox 2 are checked break; ... case 0b1011: // code for when only checkbox 1, 2 and 4 are checked break; ... } If you use a switch, you would need 16 cases. In contrast, you only need 4 if statements: if (checkbox 1 is checked) { // code for when checkbox 1 is checked } if (checkbox 2 is checked) { // code for when checkbox 2 is checked } ... Note that these are 4 independent if statements, no else ifs there.

http://stackoverflow.com/q/27140409
downvote count: 0
answer count: 1
tagged with: connector
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27210504
has body: I'm doing essentially the same thing as the original poster of this question. In my case, I'm trying to run the Sun/Oracle JPDA example programs in Eclipse Kepler on OS X 10.8.5, with Oracle jdk1.7.0_72. However, the documentation for those examples seems to assume they will be run from the command line. I want to use com.sun.jdi.connect.LaunchingConnector to launch the debuggee program. It requires arguments of class Map &lt;String, Argument>. One of the map entries has key "main" and its associated object contains a String that is the debuggee main class name. In my case, that is "debuggee.DebuggerTest". The program that invokes the launch has main class "debugger.TraceLaunch". My Eclipse project has the default structure, so there is a folder named "classes" with a subfolder for each package. In my case, those are "com", "debugger", and "debuggee". The "com" package includes all the classes from "Example JDI Applications". I am using "VMLauncher", referenced in the post cited above, to do the launching. The launch fails; it reports that my main class "debuggee.DebuggerTest" cannot be found. It also fails if I try to include the full path as part of my main class name. If I open a terminal and export a CLASSPATH variable that specifies the "classes" folder inside my Eclipse project (and the JDI library), I can launch the debuggee with the command "java debuggee.DebuggerTest" and it runs correctly. I can also launch the debugger with the command "java debugger.TraceLaunch", and it in turn successfully launches the debuggee. This suggests that VMLauncher is doing all the right things. So it seems that the problem is that somewhere deep in the examples packages or the JDI packages from Oracle's "tools.jar", the LaunchingConnector invokes a command line launcher. It seems to be of class SunCommandLineLauncher. That launcher seems to assume a classpath. The launcher arguments don't seem to be documented, so I don't know if there is an option to specify a classpath. The…
tagged with: classpath
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/27210504
tagged with: java
score: 4
linked to: http://stackoverflow.com/q/21654255
upvote count: 4
tagged with: launching
has title: How do I specify the classpath for a JDI launching connector; using Eclipse?

http://stackoverflow.com/q/27014771
answer count: 1
has body: I am new to configuring Tomcat server, mapping Java web application paths. I got an Apache CXF web service which is using the following web.xml file. <?xml version="1.0" encoding="UTF-8"?> KiiktatServices webszolgáltatás (Apache CXF) Apache CXF Endpoint cxf cxf org.apache.cxf.transport.servlet.CXFServlet static-welcome-file /services.html static-resources-list /services.html 1 cxf /* default /css/* default /js/* 60 By default Apache CXF webservice provides a uniform webservices description page which I need to change to a more informative, styled page. There is a possibility to provide az init-param to CXF which takes a static-welcome-file. I mapped the CXF servlet to <Tomcat Context path>/* as the above web.xml code section shows. I also have some static CSS, JS resources which I had to map to default servlet to make it work, when I mapped it to cxf servlet it not worked. When I start this combination on localhost Windows Tomcat 7.0.56 server in Eclipse, it appends a trailing slash to the end of the contextpath and thus services.html shows up with CSS, JS perfectly. After this I create a WAR from project. There is a (WebContent/)META-INF/context.xml bundled into the WAR, but I also got a separate context.xml (named as the WAR's name) in conf/Catalina/localhost/{war.name}.xml that takes precedence over the bundled-in context.xml where I reference database connections, for the purpose of virtual hosting. But I not defined docBase, nor path in <Context>'s, so they are not relevant. When I deploy this WAR to a Tomcat-7.0.28 on a Debian, it will not put the trailing slash at the end of the path. The services.html static-html-page still shows but the JS, CSS is broken. After I manually put a trailing slash the page shows properly. There are commented sections in the web.xml, those are part of another solution. There I am mapping the webservice to /services/* to cxf servlet, and not using its built in static-welcome-file init-parameter. Also, I am using welcome-file for d…
accepted answer: http://stackoverflow.com/a/27027081
linked to: http://stackoverflow.com/q/7852396
tagged with: web-services
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/27027081
tagged with: tomcat
has title: tomcat 7.0.56 windows (eclipse) trailing slash appended; tomcat 7.0.28 linux (deployed war) trailing slash not appended
score: 0

http://stackoverflow.com/comment/42565758
score: 2
comment on: http://stackoverflow.com/a/27017238
type: Comment
has text: @Abhishek `replace` is a special case [equivalent to](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/java/lang/String.java#String.replace%28java.lang.CharSequence%2Cjava.lang.CharSequence%29) quoting the input before calling `replaceAll`. What you need is `replaceAll("[?.,()]", "")`.
type: AnswerComment

http://stackoverflow.com/q/27088438
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42684769
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27088637
has comment: http://stackoverflow.com/comment/42684735
has answer: http://stackoverflow.com/a/27092057
has comment: http://stackoverflow.com/comment/42684695
has title: Exceptions in Thread
tagged with: java
has comment: http://stackoverflow.com/comment/42689744
has comment: http://stackoverflow.com/comment/42684842
downvote count: 5
type: UnansweredQuestion
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/42684536
has body: StackOverflow, Hello! I can't figure out why Eclipse keeps erroring me with this: Console: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at myPanel.paintComponent(Animatia.java:59) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at javax.swing.JLayeredPane.paint(Unknown Source) at javax.swing.JComponent.paintChildren(Unknown Source) at javax.swing.JComponent.paintToOffscreen(Unknown Source) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) at sun.awt.SunGraphicsCallback.runComponents(Unknown Source) at java.awt.Container.paint(Unknown Source) at java.awt.Window.paint(Unknown Source) at javax.swing.RepaintManager$3.run(Unknown Source) at javax.swing.RepaintManager$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.access$1100(Unknown Source) at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPr…
favorite count: 0

http://stackoverflow.com/comment/42682566
score: 0
type: AnswerComment
type: Comment
has text: How does it explain the `ArrayIndexOutOfBoundsException` ?
comment on: http://stackoverflow.com/a/27087193

http://stackoverflow.com/a/27082339
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: The Oracle documentation for the ANYDATA class explains how to create an ANYDATA object: NUMBER number = new NUMBER(12345); ANYDATA myAnyDataObject = ANYDATA.convertDatum(number); To pass the created value to a stored procedure, use CallableStatement.setObject: CallableStatement cstmt = conn.prepareCall("{call anydata_proc(?)}"); cstmt.setObject(1, myAnyDataObject); cstmt.execute();
answers question: http://stackoverflow.com/q/27062896
accepted answer of: http://stackoverflow.com/q/27062896

http://stackoverflow.com/comment/42701531
type: QuestionComment
comment on: http://stackoverflow.com/q/27098272
type: Comment
has text: *"find all points of a circle"*, circles have an unlimited number of points.
score: 1

http://stackoverflow.com/comment/42639048
has text: We can move cargo to any wagon? or just to connected?
comment on: http://stackoverflow.com/q/27062497
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27008165
has comment: http://stackoverflow.com/comment/42545430
downvote count: 1
linked to: http://stackoverflow.com/q/10348125
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42545088
has comment: http://stackoverflow.com/comment/42544976
score: 0
has comment: http://stackoverflow.com/comment/42545002
has comment: http://stackoverflow.com/comment/42545188
answer count: 1
favorite count: 0
has body: I have added flag "FLAG_ACTIVITY_NEW_TASK", yet I keep getting runtime error "Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag." Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Shared via app |"+title); shareIntent.putExtra(Intent.EXTRA_TEXT, Link); startActivity(Intent.createChooser(shareIntent, "Share link!")); I know I can use this code in an Activity, but is there a way to share directly through a service?
type: UnansweredQuestion
tagged with: android
has title: How to startActivity with ACTION_SEND Intent from inside an Android Service?
has comment: http://stackoverflow.com/comment/42544942
has comment: http://stackoverflow.com/comment/42545051
has answer: http://stackoverflow.com/a/36412856
has comment: http://stackoverflow.com/comment/42544869
upvote count: 1
tagged with: android-intent
has comment: http://stackoverflow.com/comment/42545037

http://stackoverflow.com/comment/42632160
score: 1
has text: @EpicPandaForce No, he shouldn't.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27058488

http://stackoverflow.com/comment/42578068
has text: It sounds to me like you are trying to add to an application you haven't created by decompiling the `.apk` file. If you have access to the java files, why not just edit those and recompile?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27027017
type: Comment

http://stackoverflow.com/comment/42583035
has text: Please try to add your liked stuff into the question itself, links may break an render the question and its answers useless for future readers.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27030021
type: Comment

http://stackoverflow.com/a/27107539
type: Answer
has comment: http://stackoverflow.com/comment/42968704
accepted answer of: http://stackoverflow.com/q/27101934
has comment: http://stackoverflow.com/comment/42798812
answers question: http://stackoverflow.com/q/27101934
score: 5
type: AcceptedAnswer
upvote count: 5
has comment: http://stackoverflow.com/comment/42796766
downvote count: 0
has comment: http://stackoverflow.com/comment/42933873
has body: You can use various technologies eg: JMS dynamic queues Extended LMAX disruptor ( eg. https://github.com/hicolour/disruptor-ext) but from the high availability and scalability reasons you should use Akka Akka The starting point for your implementation will be Consistent Hashing routing algorithm built into Akka - in simple words this type of routing logic selects consistent route based on a provided key. Routes comparing to your problem description are acceptors. Router actor comes in two distinct flavors, which gives you flexible mechanism to deploy new acceptors in your infrastructure. Pool - The router creates routees as child actors and removes them from the router if they terminate. Group - The routee actors are created externally to the router and the router sends messages to the specified path using actor selection, without watching for termination. First of all please read Akka routing documentation to get better understanding of routing implementation in the Akka framework: http://doc.akka.io/docs/akka/2.3.7/java/routing.html You can also check this article about scalable and high available systems design: http://prochera.com/blog/2014/07/15/building-a-scalable-and-highly-available-reactive-applications-with-akka-load-balancing-revisited/ Q1 Is it possible for Actor to know his route (his hash key)? Actor may know what key is currently handled, because it may be just part of the message - but you shouldn't build cross-messages logic/state based on this key. Message: import akka.routing.ConsistentHashingRouter.ConsistentHashable class Message(key : String) extends ConsistentHashable with Serializable { override def consistentHashKey(): AnyRef = key } Actor: import akka.actor.{Actor, ActorLogging} class EchoActor extends Actor with ActorLogging { log.info("Actor created {}", self.path.name) def receive = { case message: Message =&gt; log.info("Received message {} in actor {}", message.consistentHashKey(), self.path.name) case _ =&gt; log.error("Received unsup…

http://stackoverflow.com/q/27010105
has comment: http://stackoverflow.com/comment/42547803
has comment: http://stackoverflow.com/comment/42547537
type: Question
has title: Writing to excel documents with an android app
tagged with: java
has answer: http://stackoverflow.com/a/27010356
score: 0
has body: So this is probably a dumb question but can an android app that runs on an android device write to excel documents using apache poi? I havent been able to find any tutorials online that say specifically. I have found java tutorials that make a simple workbook and it creates a xls document just fine. if i put that same code into an android application i get 11-18 23:02:10.311: D/AndroidRuntime(12615): Shutting down VM 11-18 23:02:10.311: W/dalvikvm(12615): threadid=1: thread exiting with uncaught exception (group=0x41643d40) 11-18 23:02:10.314: E/AndroidRuntime(12615): FATAL EXCEPTION: main 11-18 23:02:10.314: E/AndroidRuntime(12615): Process: com.example.prtmanager, PID: 12615 11-18 23:02:10.314: E/AndroidRuntime(12615): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.prtmanager/com.example.prtmanager.MainActivity}: java.lang.ClassCastException: com.example.prtmanager.MainActivity cannot be cast to android.app.Activity 11-18 23:02:10.314: E/AndroidRuntime(12615): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2135) 11-18 23:02:10.314: E/AndroidRuntime(12615): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 11-18 23:02:10.314: E/AndroidRuntime(12615): at android.app.ActivityThread.access$800(ActivityThread.java:139) 11-18 23:02:10.314: E/AndroidRuntime(12615): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) 11-18 23:02:10.314: E/AndroidRuntime(12615): at android.os.Handler.dispatchMessage(Handler.java:102) 11-18 23:02:10.314: E/AndroidRuntime(12615): at android.os.Looper.loop(Looper.java:136) 11-18 23:02:10.314: E/AndroidRuntime(12615): at android.app.ActivityThread.main(ActivityThread.java:5102) 11-18 23:02:10.314: E/AndroidRuntime(12615): at java.lang.reflect.Method.invokeNative(Native Method) 11-18 23:02:10.314: E/AndroidRuntime(12615): at java.lang.reflect.Method.invoke(Method.java:515) 11-18 23:02:10.314: E/AndroidRuntime(12615): at com.android.inte…
has comment: http://stackoverflow.com/comment/42547510
has comment: http://stackoverflow.com/comment/42547582
answer count: 1
has comment: http://stackoverflow.com/comment/42547521
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/42589324
type: QuestionComment
has text: You want to keep the classes separate, but they have to access each others implementation details? Seems like a conceptual mistake at first.
comment on: http://stackoverflow.com/q/27034218
score: 0
type: Comment

http://stackoverflow.com/a/27101865
has body: As said by the error message: Autowired annotation is not supported on static fields So you can't autowire a static dependency. Thus, you need to remove the static or to create a non-static setter on wich you will autowire the resultsTabPane from Spring and which will set the static variable: @Autowired public void setResultsTabPanel (ResultsTabPanel resultsTabPane){ MainWindow.resultsTabPane = resultsTabPane; }
has comment: http://stackoverflow.com/comment/42708117
upvote count: 2
has comment: http://stackoverflow.com/comment/42708528
has comment: http://stackoverflow.com/comment/42709695
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27101780
answers question: http://stackoverflow.com/q/27101780
has comment: http://stackoverflow.com/comment/42707861
has comment: http://stackoverflow.com/comment/42707901
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27034650
type: Question
tagged with: graphics
tagged with: object
has comment: http://stackoverflow.com/comment/42594993
has comment: http://stackoverflow.com/comment/42590151
has comment: http://stackoverflow.com/comment/42592347
score: 0
has body: Im trying to make a game that one object is trying to chase the other. However in the JFrame only 1 object is showing. Can you help me please? The main class: package catchbutterfly; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; import java.util.Random; public class CatchButterFly extends JPanel implements ActionListener, KeyListener { Timer tm = new Timer(5, this); Random generator = new Random(); int x = 400, y = 800, velX = 0, velY = 0; public static void main(String[] args) { JFrame frame = new JFrame("Catch The ButterFly"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = (int) screenSize.getWidth(); int height = (int) screenSize.getHeight(); frame.setSize(width, height); frame.setVisible(true); JPanel panel = new JPanel(); Graphics g = panel.getGraphics(); Catcher t = new Catcher(); Butterfly fly = new Butterfly(); frame.add(t); frame.add(fly); } public void actionPerformed(ActionEvent e) { } public void keyTyped(KeyEvent e) { } public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { } } The oval class that moves with keyboard inputs: package catchbutterfly; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; import java.util.Random; public class Catcher extends JPanel implements ActionListener, KeyListener{ Timer tm = new Timer(5, this); Random generator = new Random(); int x = 400, y = 800, velX = 0, velY = 0; public Cat…
answer count: 1
has comment: http://stackoverflow.com/comment/42593000
has comment: http://stackoverflow.com/comment/42591030
has comment: http://stackoverflow.com/comment/42592444
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27039074
has comment: http://stackoverflow.com/comment/42590382
has comment: http://stackoverflow.com/comment/42590181
has comment: http://stackoverflow.com/comment/42592510
tagged with: java
has comment: http://stackoverflow.com/comment/42597183
has title: Java Trying to add 2 objects in a JFrame but only 1 is showing
has comment: http://stackoverflow.com/comment/42590277
tagged with: swing

http://stackoverflow.com/comment/42782022
comment on: http://stackoverflow.com/q/27142551
type: QuestionComment
has text: Thread priority is highly dependent on the OS and what user is running the program. What OS?
score: 0
type: Comment

http://stackoverflow.com/comment/42537241
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27003715
has text: Then do that. Create a new `Setting` object with the password, name, and lastname. Add the object to the `HashMap`.
type: Comment

http://stackoverflow.com/q/27013903
has title: Ormlite join foreign columns
answer count: 0
downvote count: 0
tagged with: join
score: 1
tagged with: java
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/42560691
has comment: http://stackoverflow.com/comment/42559480
upvote count: 1
favorite count: 0
tagged with: ormlite
has body: I have following datatable: @DatabaseTable public class TABLE_NAME { ... @DatabaseField(foreign = true, foreignAutoRefresh = true) private User createdUser; @DatabaseField(foreign = true, foreignAutoRefresh = true) private User updatedUser; .... } and how can I write following join query with ormlite? select t.* from TABLE_NAME as t LEFT join User as cu on (cu.id=t.createdUser.id) LEFT join User as uu on (uu.id=t.updatedUser.id) where cu.userName="XXyy" Thanks in advance.
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/27140143
has comment: http://stackoverflow.com/comment/42806919
answers question: http://stackoverflow.com/q/27130679
has comment: http://stackoverflow.com/comment/42815453
has comment: http://stackoverflow.com/comment/42807348
has comment: http://stackoverflow.com/comment/42807787
has comment: http://stackoverflow.com/comment/75556307
score: 5
has comment: http://stackoverflow.com/comment/42807662
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/93039937
has comment: http://stackoverflow.com/comment/42791709
upvote count: 5
has comment: http://stackoverflow.com/comment/42801597
accepted answer of: http://stackoverflow.com/q/27130679
has body: To find the reason for the double firing of the listener, I've done some debugging, following the layoutChildren calls. Long story short: for every click on the Add Book button, there are not two, but three changes in itemProperty(). To find out, add some printing to console on the listener and the updateItem method: itemProperty().addListener((obs,oldv,newv)-&gt;{ System.out.println("change: "+getIndex()+", newv "+(newv != null?newv.getIsbn():"null")+", oldv: "+(oldv != null?oldv.getIsbn():"null")); } protected void updateItem(Book item, boolean empty){ super.updateItem(item, empty); System.out.println("update item: "+(item!=null?item.getIsbn():"null")); } For the first book "123", this is the trace: update item: null change: 0, newv 123, oldv: null update item: 123 change: -1, newv null, oldv: 123 update item: null update item: null change: 0, newv 123, oldv: null update item: 123 The first change happens as expected due to the creation of a new cell. But once it's created, this is followed by a call to VirtualFlow.releaseCell() with index -1, and finally all the cells are rebuilt all over again with addLeadingCells() and addTrailingCells() in VirtualFlow.layoutChildren(). So by design, these calls can't be avoided, what means the animation shouldn't be in the listener if you want to make sure it's only called once. ANIMATION I've come with a solution that implies getting the cell and run the animation: addButton.setOnAction((event)-&gt;{ data.add(new Book(String.valueOf(newBookIndex++),"test")); VirtualFlow vf=(VirtualFlow)lv.lookup(".virtual-flow"); BookCell cell = (BookCell)vf.getCell(lv.getItems().size()-1); cell.runAnimation(); }); This is not very advisable since uses VirtualFlow, private API. This can be avoided by looking for the CSS selector indexed-cells instead: addButton.setOnAction((event)-&gt;{ data.add(new Book(String.valueOf(newBookIndex),"test")); lv.lookupAll(".indexed-cell").stream() .map(n-&gt;(BookCell)n) .filter(c-&gt;c.getBook().getIsbn().eq…
type: Answer
has comment: http://stackoverflow.com/comment/93040109

http://stackoverflow.com/q/27006675
has body: i am making a university project assignment and i am trying to calculate the days between two dates, but so far i did not achieved anything. The problem is: I receive two strings in this format "NNNN@AAAA-MM-DD" and i need to check if the dates are alright and all of that. I already made the methods to do it and they are working. The problem is that i cant figure it out how to see the days between without the use of calendar method or date or any type of those ones. Thanks ;)
has comment: http://stackoverflow.com/comment/42543723
has comment: http://stackoverflow.com/comment/42542348
has comment: http://stackoverflow.com/comment/42542412
answer count: 1
has comment: http://stackoverflow.com/comment/42542323
has title: Calculate Days Between Dates "JAVA"
favorite count: 0
has comment: http://stackoverflow.com/comment/42542434
has comment: http://stackoverflow.com/comment/42544675
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/42542441
has comment: http://stackoverflow.com/comment/42542528
linked to: http://stackoverflow.com/q/1555262
has answer: http://stackoverflow.com/a/27006742
linked to: http://stackoverflow.com/q/26858419
duplicate of: http://stackoverflow.com/q/1555262
tagged with: java
linked to: http://stackoverflow.com/q/12851934
type: Question
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/42542298

http://stackoverflow.com/a/27094591
has body: Read the file once. Store the words in a List&lt;String&gt; words like, static List&lt;String&gt; getWords(String fileName) { List&lt;String&gt; al = new ArrayList&lt;&gt;(); File file = new File(fileName); try (Scanner scanner = new Scanner(file);) { while (scanner.hasNext()) { String line = scanner.next(); al.add(line); } } catch (FileNotFoundException e) { e.printStackTrace(); } return al; } static final List&lt;String&gt; words = getWords("word_list.txt"); Then your method can iterate words as many times as you like (and be called without re-reading words) which should fix your performance issues. Finally, I would suggest try-with-resources like public static void print(String str, String str1, String str2) throws java.io.IOException { // output file name try (FileWriter output = new FileWriter("result.txt", true); PrintWriter write = new PrintWriter(new BufferedWriter(output))) { write.println("TEL: " + str); for (String line : words) { if (isMatch(str, line)) write.printf("%s : %s %n", str, line); } for (String line : words) { if (isMatch(str1, line)) write.printf("%s : %s %n", str1, line); } for (String line : words) { if (isMatch(str2, line)) write.printf("%s : %s %n", str2, line); } write.println("--------"); } } Edit It would be less efficient (you asked for more remember) but you could read it into a String (once) and then use a Scanner(String) like static String readFile(String fileName) { StringBuilder sb = new StringBuilder(); File file = new File(fileName); try (Scanner scanner = new Scanner(file);) { while (scanner.hasNext()) { String line = scanner.next(); sb.append(line).append(System.lineSeparator()); } } catch (FileNotFoundException e) { e.printStackTrace(); } return sb.toString(); } static final String words = readFile("word_list.txt"); public static void print(String str, String str1, String str2) throws java.io.IOException { // output file name try (FileWriter output = new FileWriter("result.txt", true); PrintWriter write = new PrintWriter(new…
has comment: http://stackoverflow.com/comment/42695265
accepted answer of: http://stackoverflow.com/q/27094475
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42695094
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27094475

http://stackoverflow.com/comment/42553819
type: Comment
has text: OK, I'll post an alternative
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27013627

http://stackoverflow.com/comment/43042835
comment on: http://stackoverflow.com/q/27056603
has text: This question appears to be off-topic because it should be addressed to Twilio support
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42552972
score: 1
comment on: http://stackoverflow.com/q/27013118
type: QuestionComment
has text: I modified your example to avoid code duplication, by introducing a `finally` block (which I think is better, but not really relevant in this case). Ran it with no problems. No memory leaks, from what I can see. I even tried to force it by using `-Xmx16m` command line option. Maybe you need a specific Java version, parameters or a special JPEG to reproduce the issue?
type: Comment

http://stackoverflow.com/a/27099645
answers question: http://stackoverflow.com/q/27099486
has body: What you are experiencing is the normal behavior of saveOrUpdate, and can not be changed easily. What you should should ideally do is; Get Login by userId Change only the Songs list Call saveOrUpdate
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42703767
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42625671
comment on: http://stackoverflow.com/q/27054437
has text: @Elliott Frisch I was having a strange bug, and I was completely sure it was caused because of referencing a object in the main class. I spent well around and hour experimenting with it. After I read some responses I found my mistake. But the whole point of posting the thread was because this idea has been on my mind for around half a year now.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42705168
comment on: http://stackoverflow.com/q/27099795
has text: So I have a m.Engage(this) running before the barrier which starts a for loop which loops increment times. I wanted the loop to go until a certain percentage for his thread, wait and then continue looping until another barrier, 4 times before it hits 100% and I have updated my code.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42536967
type: QuestionComment
has text: Yes, I'll have another layout to the landscape ! But you are right, data does not change, I'll cache it! But the textview is null, not the list ! I debugged and double checked it ! Thanks
type: Comment
comment on: http://stackoverflow.com/q/27002200
score: 0

http://stackoverflow.com/q/27095763
linked to: http://stackoverflow.com/q/17794728
has comment: http://stackoverflow.com/comment/42698180
favorite count: 0
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/42698242
has title: NoSuchMethodError: registerAutoProxyCreatorIfNecessary with Spring 4, Hibernate 4 and Maven 3
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27096751
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/27096751
has body: I tried to configure Hibernate and Spring but I can't resolve this error: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary. I tried some solutions without success. I need you're help! I followed this tutorial: http://websystique.com/spring/spring4-hibernate4-mysql-maven-integration-example-using-annotations/ Here is some information: Stacktrace Nov 23, 2014 6:16:55 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@13f17c9e: startup date [Sun Nov 23 18:16:55 EST 2014]; root of context hierarchy Nov 23, 2014 6:16:55 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [spring-config.xml] Nov 23, 2014 6:16:56 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [hibernate-config.xml] Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:hibernate-config.xml] Offending resource: class path resource [spring-config.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [hibernate-config.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Ljava/lang/Object;)V at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76) at or…
downvote count: 0
answer count: 1

http://stackoverflow.com/q/27148599
type: Question
accepted answer: http://stackoverflow.com/a/27150064
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42792953
tagged with: android
has title: Creating *.aar library
has body: Hi I'm a new in Android development and using Android studio. I need to create *.aar lib. I created New Android library project (empty for now). How to generate *.aar file from it? Can you explain by steps? Has read a lot of topics but still unsuccessful. Thanks.
has comment: http://stackoverflow.com/comment/42793540
has comment: http://stackoverflow.com/comment/42793427
favorite count: 0
tagged with: android-studio
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/42792663
linked to: http://stackoverflow.com/q/24309950
has comment: http://stackoverflow.com/comment/42792997
tagged with: aar
has comment: http://stackoverflow.com/comment/42792983
tagged with: java
has answer: http://stackoverflow.com/a/27150064
has comment: http://stackoverflow.com/comment/42792893
has comment: http://stackoverflow.com/comment/42793299
score: 2
possible better answer: http://stackoverflow.com/a/27448632
has comment: http://stackoverflow.com/comment/42793466
has comment: http://stackoverflow.com/comment/42793505
downvote count: 0
has answer: http://stackoverflow.com/a/27448632

netbeans
tags question: http://stackoverflow.com/q/27095244
tags question: http://stackoverflow.com/q/27093387
tags question: http://stackoverflow.com/q/27091396
tags question: http://stackoverflow.com/q/27092755
tags question: http://stackoverflow.com/q/27149828
tags question: http://stackoverflow.com/q/27125483
tags question: http://stackoverflow.com/q/27081410
tags question: http://stackoverflow.com/q/26996028
tags question: http://stackoverflow.com/q/27132078
tags question: http://stackoverflow.com/q/27008906
tags question: http://stackoverflow.com/q/27093791
tags question: http://stackoverflow.com/q/27035009
tags question: http://stackoverflow.com/q/27036118
tags question: http://stackoverflow.com/q/27144996
tags question: http://stackoverflow.com/q/27140106
tags question: http://stackoverflow.com/q/27070199
tags question: http://stackoverflow.com/q/27004411
tags question: http://stackoverflow.com/q/27117377
tags question: http://stackoverflow.com/q/27079409
tags question: http://stackoverflow.com/q/27110110
tags question: http://stackoverflow.com/q/27092231
tags question: http://stackoverflow.com/q/27079644
tags question: http://stackoverflow.com/q/27094091
tags question: http://stackoverflow.com/q/26996073
tags question: http://stackoverflow.com/q/27029036
tags question: http://stackoverflow.com/q/26996353
tags question: http://stackoverflow.com/q/27127789
tags question: http://stackoverflow.com/q/27084764
type: Tag
tags question: http://stackoverflow.com/q/27036185
tags question: http://stackoverflow.com/q/26994176
tags question: http://stackoverflow.com/q/27019183
tags question: http://stackoverflow.com/q/27103325
tags question: http://stackoverflow.com/q/27151703
tags question: http://stackoverflow.com/q/27070937
tags question: http://stackoverflow.com/q/27078016
tags question: http://stackoverflow.com/q/27093104
tags question: http://stackoverflow.com/q/27046766
tags question: http://stackoverflow.com/q/27129983
tags question: http://stackoverflow.com/q/27032445
tags question: http://stackoverflow.com/q/27106950
tags question: http://stackoverflow.com/q/27115614
tags question: http://stackoverflow.com/q/27026282
tags question: http://stackoverflow.com/q/27031805
tags question: http://stackoverflow.com/q/27084443
tags question: http://stackoverflow.com/q/27119444
tags question: http://stackoverflow.com/q/27147341
tags question: http://stackoverflow.com/q/27070163
tags question: http://stackoverflow.com/q/27145405
tags question: http://stackoverflow.com/q/27062486
tag name: netbeans
tags question: http://stackoverflow.com/q/27081675
tags question: http://stackoverflow.com/q/27084131
tags question: http://stackoverflow.com/q/27020609
tags question: http://stackoverflow.com/q/27070750
tags question: http://stackoverflow.com/q/27100099
tags question: http://stackoverflow.com/q/27128394
tags question: http://stackoverflow.com/q/27019855
tags question: http://stackoverflow.com/q/27105082
tags question: http://stackoverflow.com/q/27125630
tags question: http://stackoverflow.com/q/27132692

http://stackoverflow.com/q/27040088
favorite count: 0
has comment: http://stackoverflow.com/comment/42605354
type: UnansweredQuestion
has title: Spring JMS - autowire JmsTemplate bean failed
has comment: http://stackoverflow.com/comment/42607497
tagged with: jmstemplate
tagged with: spring-mvc
score: 3
answer count: 0
upvote count: 3
tagged with: java
has body: I set up JMS application based on the http://bsnyderblog.blogspot.com/2010/02/using-spring-jmstemplate-to-send-jms.html However I cannot start tomcat because I've got following exeption: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsSender': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jms.core.JmsTemplate pl.zleek.test.jms.JmsSender.jmsTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.jms.core.JmsTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} My JmsSender class: package pl.zleek.test.jms; @Component public class JmsSender { @Autowired private JmsTemplate jmsTemplate; public void sendMessage(final String msg) throws JMSException { jmsTemplate.send(new MessageCreator() { @Override public Message createMessage(Session session) throws JMSException { return session.createTextMessage(msg); } }); } } My bean configuration: &lt;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:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xmlns:jms="http://www.springframework.org/schema/jms" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt; &lt;context:compone…
type: Question
has comment: http://stackoverflow.com/comment/42600576
has comment: http://stackoverflow.com/comment/42609052
has comment: http://stackoverflow.com/comment/42637982
has comment: http://stackoverflow.com/comment/42626562
downvote count: 0
has comment: http://stackoverflow.com/comment/42600218
tagged with: jms

http://stackoverflow.com/comment/100256284
comment on: http://stackoverflow.com/a/56845946
score: 1
has text: this is more a comment than an answer (the question was _how_ not which-lib)
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27049882
has comment: http://stackoverflow.com/comment/42637208
type: Answer
answers question: http://stackoverflow.com/q/27039249
accepted answer of: http://stackoverflow.com/q/27039249
has body: If you are using a version equal or higher to JBoss 7.2 (EAP 6.1), you can use the Log4j appenders as custom handlers (check this issue). eg. &lt;custom-handler name="server" class="org.apache.log4j.net.SocketAppender" module="org.apache.log4j"&gt; &lt;level name="INFO"/&gt; &lt;formatter&gt; &lt;pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/&gt; &lt;/formatter&gt; &lt;properties&gt; &lt;property name="RemoteHost" value="10.10.10.10"/&gt; &lt;property name="Port" value="1234"/&gt; &lt;property name="LocationInfo" value="true"/&gt; &lt;property name="ReconnectionDelay" value="10000"/&gt; &lt;/properties&gt; &lt;/custom-handler&gt; In other case the only one way to make it work in JBoss AS 7 is to develop a custom java.util.logging.Handler for SocketAppender. Take a look in Creating a custom logging handler in JBOSS as 7.1.0 Final and Custom log handlers on 7.0.1 to create your custom log handler and then delegate them to Log4jAppenderHandler. eg (sample code): import java.util.Collections; import java.util.logging.Filter; import java.util.logging.Formatter; import java.util.logging.Handler; import java.util.logging.LogRecord; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.net.SocketAppender; import org.apache.log4j.net.SyslogAppender; import org.apache.log4j.spi.LocationInfo; import org.apache.log4j.spi.LoggingEvent; import org.apache.log4j.spi.ThrowableInformation; import org.jboss.logmanager.ExtLogRecord; import org.jboss.logmanager.log4j.handlers.Log4jAppenderHandler; public class SocketHandler extends Handler { private final Log4jAppenderHandler log4j = new Log4jAppenderHandler(new SocketAppender()); @Override public void publish(LogRecord record) { if (record == null) { return; } ExtLogRecord extRecord; if (record instanceof ExtLogRecord) { extRecord = (ExtLogRecord) record; } else { extRecord = ExtLogRecord.wrap(record); } if (isLoggable(record)) { LoggingEvent event = new LoggingEvent(extRecord.getLo…
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/27125675
score: 0
has comment: http://stackoverflow.com/comment/42770173
has comment: http://stackoverflow.com/comment/42751452
tagged with: jboss7.x
tagged with: osgi
has comment: http://stackoverflow.com/comment/42849959
type: UnansweredQuestion
answer count: 0
tagged with: java
has title: OSGi bundle with other OSGi bundle as dependencies
has comment: http://stackoverflow.com/comment/42752146
type: Question
has body: I have a project where it has many OSGI bundles with one web (.war). Some OSGi have other OSGi as dependencies and war uses all OSGi as dependencies. Problem. When I redeploy one of the OSGi bundles then dependent OSGi gets stopped, also war gets unregistered. Is there any way that after redeploy, dependent OSGi and war get refreshed (redeploy) automatically? I am using JBOSS EAP 7.3.0 application server. Exception is : 11:01:14,238 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."W.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."W.war".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment "W.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_55] Caused by: java.lang.NullPointerException at org.jboss.as.jpa.processor.JPAInterceptorProcessor.deploy(JPAInterceptorProcessor.java:52) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] ... 5 more
linked to: http://stackoverflow.com/q/11559980

http://stackoverflow.com/a/30040523
downvote count: 0
score: 2
upvote count: 2
has body: I found the reason why mybatis needs serializable object. Normally, when you do not use &lt;cache /&gt; tag, everything works fine without implementing serializable interface. The reason is that mybatis need to read/write object via serialization. This link may help https://mybatis.github.io/mybatis-3/sqlmap-xml.html
type: Answer
answers question: http://stackoverflow.com/q/27016507

http://stackoverflow.com/a/27095544
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27093436
downvote count: 0
has body: This code: byte[] str = bytes.toString().getBytes("UTF-8"); ret = new String(str, "UTF-8"); will just return a string of the form "[B@nnnnnn", because char[] doesn't override Object.toString(). The double conversion doesn't accomplish anything useful either. And of course the char[] array should be called chars, not bytes. It should be: return new String(chars, 0, in, "UTF-8"); // or UTF-16 or whatever you determine I assume that sinput is a BufferedReader around the input stream? Otherwise your code doesn't compile.
type: Answer

http://stackoverflow.com/comment/42640107
score: 0
type: Comment
type: QuestionComment
has text: Expose server file system details to *who*?
comment on: http://stackoverflow.com/q/27049450

http://stackoverflow.com/q/27119444
tagged with: netbeans-8
tagged with: netbeans-platform
has body: In Netbeans 8.0 I have a project with multiple modules. I want one module to open a file chooser for audio files that the app will play using javax.sound.sampled library. I use AudioSystem.getAudioFileTypes() to get the file types that can be used and see that there are only 3 available ('wav', 'au' and 'aif') but I'd also like to be able to deal with mp3, ogg and flac. So I downloaded the SPIs for the codecs I need. All the documentation tells me that I need only put the jars into the classpath and the codecs will become available to Java's sound library. In my project I want more than one module to be able to use these libraries, so I created module wrappers for them. So, for example, I have in my project one module called jflac-1.3-jdk which wraps two jars: jflac-1.3-jdk1.4.jar and jflac-1.3.jar then I make the module that is going to open the file chooser depend on these modules that wrap jars. Still there are only the same 3 file types available. What am I missing? Here is the code in the top component of the module that depends on the wrapper modules: private static String[] audioFileExtensions; static { AudioFileFormat.Type[] formatTypes = AudioSystem.getAudioFileTypes(); audioFileExtensions = new String[formatTypes.length]; for (int i = 0; i &lt; formatTypes.length; i++) { audioFileExtensions[i] = formatTypes[i].getExtension(); } } I use the debugger in this code to see that the file types I want aren't available.
answer count: 1
tagged with: netbeans
type: UnansweredQuestion
tagged with: audio
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/27182184
type: Question
linked to: http://stackoverflow.com/q/16633244
linked to: http://stackoverflow.com/q/3142515
has title: Why wont my added SPI jars register in my Netbeans Platform project?
has answer: http://stackoverflow.com/a/27121551

maven
tags question: http://stackoverflow.com/q/26996353
tags question: http://stackoverflow.com/q/27026169
tags question: http://stackoverflow.com/q/27097852
tags question: http://stackoverflow.com/q/27077054
tags question: http://stackoverflow.com/q/26991921
tags question: http://stackoverflow.com/q/27070318
tags question: http://stackoverflow.com/q/27008158
type: Tag
tags question: http://stackoverflow.com/q/27015236
tags question: http://stackoverflow.com/q/27045415
tags question: http://stackoverflow.com/q/27068723
tags question: http://stackoverflow.com/q/27071994
tags question: http://stackoverflow.com/q/27066953
tags question: http://stackoverflow.com/q/27034739
tags question: http://stackoverflow.com/q/27103325
tags question: http://stackoverflow.com/q/27035389
tags question: http://stackoverflow.com/q/27015856
tags question: http://stackoverflow.com/q/27125521
tags question: http://stackoverflow.com/q/27126718
tags question: http://stackoverflow.com/q/27147660
tags question: http://stackoverflow.com/q/27014942
tags question: http://stackoverflow.com/q/27071431
tags question: http://stackoverflow.com/q/27010487
tags question: http://stackoverflow.com/q/27054320
tags question: http://stackoverflow.com/q/27066037
tags question: http://stackoverflow.com/q/27145627
tags question: http://stackoverflow.com/q/27059855
tags question: http://stackoverflow.com/q/27064801
tags question: http://stackoverflow.com/q/27128142
tags question: http://stackoverflow.com/q/27036326
tags question: http://stackoverflow.com/q/27141038
tags question: http://stackoverflow.com/q/27102384
tags question: http://stackoverflow.com/q/27024974
tags question: http://stackoverflow.com/q/27087372
tags question: http://stackoverflow.com/q/27005479
tags question: http://stackoverflow.com/q/27002084
tags question: http://stackoverflow.com/q/27088157
tags question: http://stackoverflow.com/q/27016053
tags question: http://stackoverflow.com/q/27068654
tags question: http://stackoverflow.com/q/26996407
tags question: http://stackoverflow.com/q/27139893
tags question: http://stackoverflow.com/q/27041741
tags question: http://stackoverflow.com/q/27046031
tags question: http://stackoverflow.com/q/27138744
tags question: http://stackoverflow.com/q/27133012
tags question: http://stackoverflow.com/q/27021192
tags question: http://stackoverflow.com/q/27070242
tags question: http://stackoverflow.com/q/27077089
tags question: http://stackoverflow.com/q/27148556
tags question: http://stackoverflow.com/q/27016409
tags question: http://stackoverflow.com/q/27129922
tags question: http://stackoverflow.com/q/27076512
tags question: http://stackoverflow.com/q/27064399
tags question: http://stackoverflow.com/q/27147413
tags question: http://stackoverflow.com/q/27089466
tags question: http://stackoverflow.com/q/27061036
tags question: http://stackoverflow.com/q/27015933
tags question: http://stackoverflow.com/q/27027045
tags question: http://stackoverflow.com/q/27036263
tags question: http://stackoverflow.com/q/27113137
tags question: http://stackoverflow.com/q/27062043
tags question: http://stackoverflow.com/q/27080018
tags question: http://stackoverflow.com/q/27140135
tags question: http://stackoverflow.com/q/27151146
tags question: http://stackoverflow.com/q/27017394
tags question: http://stackoverflow.com/q/27014551
tags question: http://stackoverflow.com/q/27099683
tags question: http://stackoverflow.com/q/27040411
tags question: http://stackoverflow.com/q/26995644
tags question: http://stackoverflow.com/q/26995698
tags question: http://stackoverflow.com/q/27070163
tags question: http://stackoverflow.com/q/27151447
tags question: http://stackoverflow.com/q/27129203
tags question: http://stackoverflow.com/q/27057481
tags question: http://stackoverflow.com/q/27068785
tags question: http://stackoverflow.com/q/27084934
tags question: http://stackoverflow.com/q/27072537
tags question: http://stackoverflow.com/q/27129732
tags question: http://stackoverflow.com/q/27000782
tags question: http://stackoverflow.com/q/27101338

http://stackoverflow.com/a/27054218
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27054185
type: Answer
has body: You are printing the first number then sorting from within the loop. You should sort the numbers once, before the loop begins. Change your printNumbers method to this: public static int printNumbers(int[] count) { // Sort Numbers Arrays.sort(count); // Print loop for (int i=0; i&lt;count.length; i++) { System.out.println(count[i]); } return count.length; }
upvote count: 1

http://stackoverflow.com/comment/42740842
type: QuestionComment
has text: @Elltz : String getqn = GetConvo.getqn(activity); I have added all the lines that was mentioned
score: 1
comment on: http://stackoverflow.com/q/27104094
type: Comment

http://stackoverflow.com/comment/42728131
type: QuestionComment
has text: First thing of all, change `==` to `.equals`, programmers will cry if they see it (I cried while I was writing this comment).
score: 2
comment on: http://stackoverflow.com/q/27112685
type: Comment

http://stackoverflow.com/q/27116016
has comment: http://stackoverflow.com/comment/42734616
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27116512
has title: ArrayIndexOutOfBoundsException: -1
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/42734776
has answer: http://stackoverflow.com/a/27116288
type: Question
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/42734728
has comment: http://stackoverflow.com/comment/42734832
score: 0
has body: So I am writing a code with a 2D array to arrange it like a square table say 10 by 10. It is filled with Xs and Os and blanks. A threshold is entered and if a percentage of indexes around the X or O are also Xs or Os are greater than the threshold than the spot is satisfied, if not it is unsatisfied. I have been able to print the table fine, but then I tried to do the satisfying part and I got an array index out of bounds exception. I have an idea of what this means but not sure how to get my code working properly, although I fear I would have to redesign it. Another thing is, I am not sure if I did the booleans right. public class CellSim{ public static void main(String[] args){ char [][] tissue = new char [10][10]; int threshold = 30; assignCellTypes(tissue, 50, 25); printTissue(tissue); System.out.println(); boolean boardSat = true; boardSat = boardSatisfied(tissue, threshold); if( boardSat == false){ System.out.println( "board is not satisfied");} if( boardSat == true){ System.out.println("board is satisfied");} } public static void printTissue(char[][] tissue){ for(int row = 0;row &lt; tissue.length;row++){ for(int col = 0;col &lt; tissue[row].length;col++){ System.out.print(tissue[row][col] + "\t"); } System.out.println(); } } public static void assignCellTypes(char[][] tissue, int percentBlank, int percentX){ int n = (tissue.length) * (tissue.length); percentBlank = (int) Math.ceil(n * (percentBlank * .01)); percentX = (int) Math.ceil((n - percentBlank) * (percentX * .01)); int percentO = (int) Math.ceil(n - percentBlank - percentX); for( int i = 0; i &lt; percentBlank; i++){ while(percentBlank &gt; 0){ int randCell = randInt(0, 9); int randCell2 = randInt(0, 9); if(tissue[randCell][randCell2] == '\u0000'){ tissue[randCell][randCell2] = ' '; break; } } } for( int i = 0; i &lt; percentX; i++){ while(percentX &gt; 0){ int randCell = randInt(0, 9); int randCell2 = randInt(0, 9); if(tissue[randCell][randCell2] == '\u0000'){ tissue[randCell][randCell2] = 'X'; brea…

http://stackoverflow.com/a/27055590
has body: That's because you don't have consumer running in a loop like a thread should be. It just runs for once and see's that there are no elements in queue (which might be true if say consumer was the thread that ran first) and then exits safely from the thread. To begin with try something in your consumer's run method like and then fine tune it if you need: while (true) { if (deque.isEmpty()) { System.out.println("No elements in queue"); } else { System.out.println("consumed " + deque.removeLast());//note get will still have queue populated so remove seems better? try { Thread.sleep(100); } catch (InterruptedException ex) { } } } By the way, you are unnecessary creating instance of dequeue in your producer and consumer. You could just remove the instantiation i.e. from Deque&lt;Integer&gt; deque = new LinkedList&lt;Integer&gt;(); To Deque&lt;Integer&gt; deque; if you just want to display last element from within a thread (You could just do it from main method though), then you could do it by calling join method as below (so it lets producer complete and then start consumer thread) in your main method: public static void main(String args[]) throws InterruptedException { Deque&lt;Integer&gt; deque = new LinkedList&lt;Integer&gt;(); InsertingThread it = new InsertingThread(deque); ReadingThread1 rt = new ReadingThread1(deque); it.start(); it.join(); rt.start(); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42627604
has comment: http://stackoverflow.com/comment/42627635
type: Answer
accepted answer of: http://stackoverflow.com/q/27055533
has comment: http://stackoverflow.com/comment/42627413
upvote count: 1
has comment: http://stackoverflow.com/comment/42627517
score: 1
answers question: http://stackoverflow.com/q/27055533

http://stackoverflow.com/comment/65379986
type: AnswerComment
comment on: http://stackoverflow.com/a/27012830
type: Comment
has text: Interesting, I just downloaded jdk-8u102-windows-x64.exe directly from the Oracle's website. The contents are: .rsrc [Dir] .data .pdata .rdata .reloc .text CERTIFICATE It's just as described in the 32-bit version.
score: 2

http://stackoverflow.com/a/27020596
answers question: http://stackoverflow.com/q/27015751
score: 0
type: Answer
has body: From the wording of your question, this is not possible. Xamarin does offer the ability to create 'bindings' between C# and Objective C/Java static libraries and has a section on the Developer documentation on doing so (Objective C Bindings or Java Wrappers). The key part is that this is for static libraries and not for general application functionality i.e. user interactions. You will need to weigh up the benefit between migrating the disparate projects to a shared Xamarin solution whereby you will enjoy the code sharing (especially with the Xamarin Forms offering) or simply writing the functionality into separate libraries for the different platforms. Good luck

http://stackoverflow.com/q/26993506
tagged with: rest
has comment: http://stackoverflow.com/comment/42518135
has comment: http://stackoverflow.com/comment/42517971
answer count: 1
tagged with: google-tasks
has answer: http://stackoverflow.com/a/27006277
tagged with: oauth
has body: This week I had a small program to develop, I needed to create a Web Application(using a Java Servlet on localhost), this Web App is required to do the following: Obtain and show issues from public organizations from GitHub Obtain authentication thru OpenID Connect(OAuth 2.0) Create a Google Task on the default tasklist from an issue using REST Note: I can only use HTTP, no jar libs The first part was easy, just had to make the request to the GitHub API and parse the JSON, no problem here The second part was somewhat easy, I had to create a new Client ID in Google Developer Console, where I'd set the callback and receive the code on it, I'll put it here just in case I'm doing something wrong with it: Login.java ... public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { System.out.println("--New login request was received --"); resp.setStatus(302); resp.setHeader("Location", GoogleStuff.AUTH_LINK); } ... callback.java ... public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { Cookie c = new Cookie("googleCode", req.getParameter("code")); c.setMaxAge(60*60); //1 Hour //Example code received from Google //4/6POIUYwZA3tFCnX_2feRDGiPMQOU7At8HyfOzemMkOY.wtiPpsElo8wZoiIBeR5Q2m9sqEaFkwI resp.addCookie(c); resp.setStatus(302); resp.setHeader("Location","searchOrg"); } ... My problem comes on the third part, I get the response code 401(Not Authorized) from Google, I'm sure I'm doing something wrong, but I don't really know what is wrong. This is probably all wrong, so bear with it :p Note: To get the API Key I used the Google Developer Console and created a key for Browsers GoogleStuff.java ... public static String AUTH_LINK = "https://accounts.google.com/o/oauth2/auth?"+ "scope=https://www.googleapis.com/auth/tasks&amp;"+ "redirect_uri=http://localhost:5005/callback&amp;"+ "response_type=code&amp;" + "client_id=" + FirstHttpServer.CLIENT_ID + "&amp;approval_prompt=force"; ... public static void addTask(Issue…
type: UnansweredQuestion
tagged with: java
has title: Unable to authenticate with Google Tasks - Homework
type: Question
score: 0

http://stackoverflow.com/comment/42625108
comment on: http://stackoverflow.com/q/27054215
score: 0
has text: Could you post the error you are getting? Also, the first phrase is somewhat confuse, consider making it clearer.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42681778
score: 0
comment on: http://stackoverflow.com/q/27086548
has text: what I am looking for == JList(with.Horizontal...), something similair is derived part of JFileChooser
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27053007
type: Answer
has body: Tip #1: Initialize the array with 0. That way, when you process the file, all you have to worry about is to replace the index locations with the digits obtained from your file. Tip #2: You have to do some repeated division by 10 and modulus operation to extract the digits from the number (or binary shift if you prefer). For example, to split the the digits from '27', you can do 27 % 10 (7) and 27 / 10 (2). The key here is to store the result as int. After all, each digit is a whole number (not a floating point number). For number of greater magnitude, you will need to discard the process digit position so that the number gets smaller. You will now when you are done when the quotient of the division is equal to zero. Therefore, you can say in pseudo-code: DIVIDE number by 10 WHILE number > 0 (something like that) Tip #3, you will have to iterate in reverse to store the digits in the array. If the array has a length of 50, you will start with LENGTH-1 and count down to ZER0. Tip #4: Use an array of ints not an array of Strings if the problem allows you to. Use Integer.parseInt(String s) to convert the numeric String to a primitive int.
upvote count: 1
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/27052681

apache
tags question: http://stackoverflow.com/q/27088975
tags question: http://stackoverflow.com/q/27137189
tag name: apache
tags question: http://stackoverflow.com/q/27115614
tags question: http://stackoverflow.com/q/27084837
tags question: http://stackoverflow.com/q/27013932
tags question: http://stackoverflow.com/q/27017905
tags question: http://stackoverflow.com/q/27030566
tags question: http://stackoverflow.com/q/27057819
tags question: http://stackoverflow.com/q/27001382
tags question: http://stackoverflow.com/q/27001414
tags question: http://stackoverflow.com/q/27134158
tags question: http://stackoverflow.com/q/27050820
tags question: http://stackoverflow.com/q/27049841
tags question: http://stackoverflow.com/q/27004893
tags question: http://stackoverflow.com/q/27038274
tags question: http://stackoverflow.com/q/27094046
tags question: http://stackoverflow.com/q/27033019
tags question: http://stackoverflow.com/q/27094804
type: Tag
tags question: http://stackoverflow.com/q/27040498
tags question: http://stackoverflow.com/q/27088169
tags question: http://stackoverflow.com/q/27081567

http://stackoverflow.com/comment/42704647
type: AnswerComment
comment on: http://stackoverflow.com/a/27087973
score: 0
type: Comment
has text: @EJP-Soory if I have hurted you through my words. I am pretty inexperienced in front of you as I am still a student of 20 and still learning. But,what I quoted was just to help OP about his issue. I appreciate your answer and now even +1'ing this. Please forgive me if I have hurted you through comments OR through indirect remarks. But,I believe neither I did that, and nor it was my intention...

http://stackoverflow.com/q/27093545
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27093716
accepted answer: http://stackoverflow.com/a/27093716
tagged with: ognl
tagged with: jsp
tagged with: struts2
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
answer count: 1
favorite count: 0
has body: I want to hide a table on load of a page and hide it on click of a button on that page.I have created a property of type String in Action class named as "displayTablle" and assigned it a value "none" by default.So that when this page is opened by calling action,this property will be none and following code used in table tag should hide the table: &lt;table border="true" id="dataTable" style="display:"&lt;s:hidden id="disTable" name = "displayTable" value="%{displayTable}"/&gt;;"&gt; &lt;s:submit value="Fetch Data" align="center" action="displayDataAction" /&gt; Then on click of Fetch Data button, I am setting value of this property to blank string i.e " ", so that table will be displayed, But I am stuck with the syntax and &lt;s:hidden&gt; is not getting bound properly, as when I open the page, last part of the table tag's code i.e ;"&gt; is getting printed as is. Can anybody suggest, what should be the right syntax to bind s:hidden in html table tag? Can we do it like this?
has title: Using Struts tag within HTML tag for hiding/displaying table
type: AnsweredQuestion

http://stackoverflow.com/comment/42758630
has text: yes.. I have tried .. and its not working.. I am trying to run the batch through command prompt from Java..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27129347

http://stackoverflow.com/q/27010305
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27025224
accepted answer: http://stackoverflow.com/a/27025224
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question
has body: Spring Batch has MultiResourceItemReader to process set of files i want to know that what happens if job fails for ex if there 10 files to read and skip limit is 20. suppose 5 files already processed and while reading 6th file if skip limit exceeds 20 during the reading of file then it will skip that file only and move to next file or whole job will be failed ?. i want to know skip limit is used for each file its read or whole set of files
has title: MultiResourceItemReader what happened if Job fails
tagged with: spring-batch

http://stackoverflow.com/comment/43195246
type: Comment
comment on: http://stackoverflow.com/q/27113417
has text: Can you create a controller class for your FXML and import your FocusedTextField class in the code for it?
score: 0
type: QuestionComment

plsql
tags question: http://stackoverflow.com/q/27051271
tags question: http://stackoverflow.com/q/27104815
tags question: http://stackoverflow.com/q/27062896
tags question: http://stackoverflow.com/q/26996632
tags question: http://stackoverflow.com/q/27023475
type: Tag
tags question: http://stackoverflow.com/q/27130764
tags question: http://stackoverflow.com/q/27052014
tags question: http://stackoverflow.com/q/27029391
tag name: plsql

http://stackoverflow.com/comment/42638677
comment on: http://stackoverflow.com/q/27061985
score: 0
has text: Thanks, now how do i merge these values into a second map?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27097065
has title: Sorting array and printing out
answer count: 1
has comment: http://stackoverflow.com/comment/42699493
has comment: http://stackoverflow.com/comment/42699479
type: AnsweredQuestion
type: Question
has body: I am about to sort a 2d array. However there is a certain way of doing this. (Times of running it through, before proceeding to next row) As you can see, what I have done here, is that I am first sorting row 0, whereafter I am incrementing Before I increment the row, I let it sort the columns math.pow(m[j].length, 2). Is this correct? Furthermore, is there a smart way of printing out a 2D array from a void method, without using a for loop. The Arrays.tostring doesn't help me much ? public static void sort(int m[][]) { int j = 0; for (int k = 0; k &lt; Math.pow(m[j].length, 2); k++) { for (int i = 0; i &lt; m[k].length - 1; i++) { if (m[i][j] &gt; m[i + 1][j]) { int temp = m[i][j]; m[i][j] = m[i + 1][j]; m[i + 1][j] = m[i][j]; } } } System.out.print("The array is " + Arrays.toString(m)); }
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/27097099
accepted answer: http://stackoverflow.com/a/27097099

http://stackoverflow.com/comment/42635814
type: QuestionComment
has text: Check whether you have the `MySql-Connector-5.0.8.jar` under Libraries. If it not there might broken ref , try to add it with the project
comment on: http://stackoverflow.com/q/27060702
score: 0
type: Comment

http://stackoverflow.com/q/27131875
tagged with: eclipse
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27136372
tagged with: tfs
type: AnsweredQuestion
has body: I've been asked a question by one of our developers here. They are asking whether it is possible for a selenium test suite to be tied in with a TFS build in visual studio to the test server? So that way, as soon as a build is done it can kick off a run of the regression test suite, directly after that. Bear in mind that my scripts have been written in Eclipse, NOT Visual Studio, so I'm not sure if this will cause restrictions.
tagged with: java
tagged with: selenium
has title: Integrating Selenium Test Suite (Eclipse) with TFS
type: Question
accepted answer: http://stackoverflow.com/a/27136372
tagged with: visual-studio-2012

http://stackoverflow.com/a/36999087
answers question: http://stackoverflow.com/q/27060563
has body: If you are using Spring framework, then the datasource-proxy framework is very convenient. You can basically wrap around any DataSource and just add the logging behavior. If you're using Java EE, then P6spy is a good alternative: Behind the scenes, p6spy provides the statement interceptor at the Driver level, which is much more convenient for Java EE applications because the DataSource is provided by the application server.
downvote count: 1
has comment: http://stackoverflow.com/comment/105109813
upvote count: 20
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/105110083
accepted answer of: http://stackoverflow.com/q/27060563
type: Answer
score: 19
has comment: http://stackoverflow.com/comment/137139546

http://stackoverflow.com/comment/42553608
comment on: http://stackoverflow.com/q/27013367
type: Comment
has text: And which API are you planing to use in order to talk to the modem via USB? Which protocol does that modem support?
type: QuestionComment
score: 0

http://stackoverflow.com/q/27030586
answer count: 2
has answer: http://stackoverflow.com/a/27031130
possible better answer: http://stackoverflow.com/a/27031130
has comment: http://stackoverflow.com/comment/42584022
tagged with: android
has answer: http://stackoverflow.com/a/27031050
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42583981
has body: I am trying to refactor some of my request manager classes that share duplicate code: public class PayoutChargesManager&lt;T&gt; extends BaseManager&lt;T&gt;{ private static PayoutChargesManager instance = null; public static synchronized PayoutChargesManager getInstance() { if (instance == null) { instance = new PayoutChargesManager(); } return instance; } } public class PayoutChargesInDayManager&lt;T&gt; extends BaseManager&lt;T&gt; { private static PayoutChargesInDayManager instance = null; public static synchronized PayoutChargesInDayManager getInstance() { if (instance == null) { instance = new PayoutChargesInDayManager(); } return instance; } } public class OrdersHistoryManager&lt;T&gt; extends BaseManager&lt;T&gt; { private static OrdersHistoryManager instance = null; public static synchronized OrdersHistoryManager getInstance() { if (instance == null) { instance = new OrdersHistoryManager(); } return instance; } } I am trying to only have one copy of getInstance() in my BaseManager, and have PayoutChargesManager, PayoutChargesInDayManager and OrdersHistoryManager reuse it, but I am having some trouble implementing it. public class BaseManager&lt;T&gt; implements OnApiCallListener { private static BaseManager&lt;T&gt; instance = null; public static synchronized BaseManager&lt;T&gt; getInstance() { if (instance == null) { instance = new BaseManager()&lt;T&gt;; } return instance; } } How do I implement this correctly?
tagged with: java
type: Question
has title: Refactoring singleton classes that share similar function into a Base class - problems with generics
accepted answer: http://stackoverflow.com/a/27031050
score: 0

http://stackoverflow.com/comment/42592929
comment on: http://stackoverflow.com/q/27028288
score: 0
type: Comment
type: QuestionComment
has text: There are 4 DN and 1 NN in my cluster. By "only master is actve", I mean that only NN and 1 DN (on same machine as of NN)of my cluster are "ON".

http://stackoverflow.com/a/27111723
has comment: http://stackoverflow.com/comment/42726459
has body: The problem is your array is initialized with nulls at every location. You should initialize it with values in your constructor if you don't want the values to be null. Also in your print statement you are not printing all the elements only the first 10 elements of the first 10 rows. Since you declare it at the global level: private Slot[][] array = new Slot[12][12]; every position array[number][number] will have null as its initial value. You could initialize in your constructor like: public Grid(){ for(int i = 0 ; i &lt; 12 ; i++){ for(int j = 0 ; j &lt; 12 ; j++){ array[i][j] = new Slot(0, 0); } } } public Slot(int id, int status){ this.id = id; this.status = status; }
type: Answer
answers question: http://stackoverflow.com/q/27111631
has comment: http://stackoverflow.com/comment/42726383
has comment: http://stackoverflow.com/comment/42726333
score: 0

http://stackoverflow.com/comment/42593387
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27036426
has text: so .. the problem not from allocated memory ..!!
type: AnswerComment

http://stackoverflow.com/q/27151335
type: UnansweredQuestion
tagged with: soap
upvote count: 1
tagged with: web-services
has body: we have a webservice that gets the next SOAP message. I'm posting only the header that it's the important part for our problem. <SOAP-ENV:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" SOAP-ENV:mustUnderstand="1"> <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-65E18DC0CA7D9A38B214168992655731">THE_CERTIFICATE</wsse:BinarySecurityToken> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="SIG-65E18DC0CA7D9A38B214168992656685"> <ds:SignedInfo> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="SOAP-ENV"/> </ds:CanonicalizationMethod> <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <ds:Reference URI="#id-65E18DC0CA7D9A38B214168992656044"> <ds:Transforms> <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList=""/> </ds:Transform> </ds:Transforms> <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> <ds:DigestValue>DIGEST_VALUE</ds:DigestValue> </ds:Reference> </ds:SignedInfo> <ds:SignatureValue>THE_SIGNATURE</ds:SignatureValue> <ds:KeyInfo Id="KI-65E18DC0CA7D9A38B214168992655892"> <wsse:SecurityTokenReference wsu:Id="STR-65E18DC0CA7D9A38B214168992655893"> <wsse:Reference URI="#X509-65E18DC0CA7D9A38B214168992655731" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/> </wsse:SecurityTokenReference> </ds:KeyInfo> </ds:Signature> </wsse:Security> The certificate used to sign the petition is validated b…
tagged with: spring-ws
score: 1
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/27164403
has title: Spring-WS validate Signature and extract SOAP-Header in Endpoint
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42695955
type: QuestionComment
has text: Do you know about the `split` method of the `String` class?
score: 1
comment on: http://stackoverflow.com/q/27095087
type: Comment

http://stackoverflow.com/comment/42690086
type: QuestionComment
comment on: http://stackoverflow.com/q/27063733
score: 0
has text: can anyone help me with this problem???
type: Comment

http://stackoverflow.com/comment/42729151
score: 1
has text: That is probably the worlds's most vague title ever...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27112883

http://stackoverflow.com/comment/42803087
type: Comment
has text: Would the diffutils from Google serve my need here? Thanks
comment on: http://stackoverflow.com/a/27142291
type: AnswerComment
score: 0

http://stackoverflow.com/q/27025089
tagged with: database
tagged with: dao
type: Question
has answer: http://stackoverflow.com/a/27029573
answer count: 1
downvote count: 0
favorite count: 0
tagged with: postgresql
tagged with: rest
has title: Create a rest service to call and execute a postgres function
has comment: http://stackoverflow.com/comment/42574438
accepted answer: http://stackoverflow.com/a/27029573
has body: I have a postgres function written currently called do_function(), It does not return anything. I am creating a button on my web page that by pressing it will execute this function on the data base. Is the following a good way to do this? I get an error: No Dialect mapping for JDBC type: 1111 Currently I have in the RS: @GET @Path("/doFunction") public void doFunction(@Context HttpServletRequest request) { getDao().doFunction; } In the DAO: @Transactional public void doFunction() { Session session = (Session) entityManager.getDelegate(); SQLQuery query = session.createSQLQuery("SELECT * FROM do_function()"); query.uniqueResult(); }
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/27062232
has comment: http://stackoverflow.com/comment/42705961
has comment: http://stackoverflow.com/comment/60371383
accepted answer of: http://stackoverflow.com/q/27061209
type: AcceptedAnswer
downvote count: 0
has body: You are making it way to complex. Just add spring.http.multipart.maxFileSize to your application.properties file and well that is it. No need to use xml or explicitly define a MultipartResolver. spring.http.multipart.maxFileSize=10MB This is explained in the section about file uploads in the Spring Boot Reference Guide. For all properties check the MultipartProperties class. The other properties supported are spring.http.multipart.location, spring.http.multipart.maxRequestSize and spring.http.multipart.fileSizeThreshold. The ClassNotFoundException is due to the fact that Spring Boot uses the default Servlet 3.0 support for file uploads NOT commons-fileupload. So if you want to use that, you would have to explicitly add the dependency for it. And ofcourse the spring.http.multipart.* properties don't work anymore in that case.
has comment: http://stackoverflow.com/comment/62629920
type: Answer
has comment: http://stackoverflow.com/comment/50991553
upvote count: 54
has comment: http://stackoverflow.com/comment/54627597
answers question: http://stackoverflow.com/q/27061209
has comment: http://stackoverflow.com/comment/63195746
score: 54
has comment: http://stackoverflow.com/comment/69245387

http://stackoverflow.com/comment/42755316
has text: can you please tell how to mock client?
comment on: http://stackoverflow.com/q/27126510
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27007883
answers question: http://stackoverflow.com/q/27007628
has body: dir /b /s "C:\MineRunner 2.0\Data\ServerFiles\*.jar /b returns just the file names (delete this part if you need the full path) /s searches recursively, so it looks through every folder inside ServerFiles for .jar files
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27007628

http://stackoverflow.com/comment/42547953
score: 0
type: Comment
has text: @Rah its not the issue in my code, you are doing something wrong, please check it out.
type: AnswerComment
comment on: http://stackoverflow.com/a/27009860

http://stackoverflow.com/a/53545847
has body: You can use com.alibaba fastjson 1.2.13 To create a JSON object: @Test public void whenGenerateJson_thanGenerationCorrect() throws ParseException { JSONArray jsonArray = new JSONArray(); for (int i = 0; i < 2; i++) { JSONObject jsonObject = new JSONObject(); jsonObject.put("AGE", 10); jsonObject.put("FULL NAME", "Doe " + i); jsonObject.put("DATE OF BIRTH", "2016/12/12 12:12:12"); jsonArray.add(jsonObject); } String jsonOutput = jsonArray.toJSONString(); } Add the annotations to your POJO class like so: @JSONField(name = "DATE OF BIRTH") private String dateOfBirth; etc... Then you can simply use: @Test public void whenJson_thanConvertToObjectCorrect() { Person person = new Person(20, "John", "Doe", new Date()); String jsonObject = JSON.toJSONString(person); Person newPerson = JSON.parseObject(jsonObject, Person.class); assertEquals(newPerson.getAge(), 0); // if we set serialize to false assertEquals(newPerson.getFullName(), listOfPersons.get(0).getFullName()); } You can find a more complete tutorial on the following site: https://www.baeldung.com/fastjson
answers question: http://stackoverflow.com/q/27036857
score: 0
type: Answer

http://stackoverflow.com/a/26996174
upvote count: 2
has body: Per someone way smarter than me on the subject: This is an issue that has just come up with the release of CentOS6.6 as it uses a newer version of gtk2 than CentOS6.5. Eclipse detects this and erroneously assumes it can use the cairo graphics API which is either not available or not at the expected version. It's actually a bug within the Eclipse Version used by the v1.10 and v1.9 series REDHAWK IDE. Information about the issue can be found on this eclipse forum. Eclipse has since fixed the issue within it's latest code base. The easiest fix for 1.10 and 1.9 users is to apply the fix mentioned within the forum post. Navigate to the directory which contains your eclipse executable (REDHAWK IDE executable) and there should be a configuration file called "eclipse.ini". Add the following parameter to the list of declared options: -Dorg.eclipse.swt.internal.gtk.cairoGraphics=false This will disable the use of cairo graphics, which were not being used in the first place.
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26994888

http://stackoverflow.com/q/26992171
tagged with: java
has answer: http://stackoverflow.com/a/26992212
type: Question
answer count: 2
has title: Why is the reference passing in this code not working?
has answer: http://stackoverflow.com/a/26992234
score: 0
accepted answer: http://stackoverflow.com/a/26992212
possible better answer: http://stackoverflow.com/a/26992234
has body: this is driving me crazy because it makes no sense. In the following program, the b variable is not correctly set. b is supposed to be passed by copy, but because b is a reference to an object, this should work correctly, but it doesn't. public class A { private B b; public void foo() { System.out.println("the value of b is : " + b); bar(b); System.out.println(b.getName()); } private void bar(B b){ if (b == null) b = new B(); b.setName("me"); } public class B { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } public class MainTest { public static void main(String args[]) { A a = new A(); a.foo(); } } After execution I get this error: the value of b is : null Exception in thread "main" java.lang.NullPointerException at test.A.foo(A.java:12) at test.MainTest.main(MainTest.java:6)
type: AnsweredQuestion

http://stackoverflow.com/a/27078749
type: Answer
answers question: http://stackoverflow.com/q/27078735
has comment: http://stackoverflow.com/comment/42667721
has body: You have defined the constructor to take one parameter, but you are trying to call it with zero parameters. So, you can either remove the parameter from the constructor definition: public DiceArray() { ... } or you can use the parameter: int[] num = new int[5]; DiceArray myDice = new DiceArray(num);
score: 0

http://stackoverflow.com/comment/42597191
type: Comment
has text: Dude you are awesome, I was struggling with this for quite a while.. Any tips on how to navigate between pair of strings (Q/A) ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27038672

http://stackoverflow.com/a/27062258
score: 1
has body: Previously, when the .html files were placed within the WebContent, and not within a folder inside WebContent, the mappings corresponding to the servlet in web.xml was as mentioned below: sendRedirect1 org.javatpoint.MySearcherOnSendRedirect sendRedirect1 /searchOnSendRedirect where the /searchOnSendRedirect within /searchOnSendRedirect is pointing to the servlet invoked when pressing the submit button in a form element in a .html file Now, whenever we create a folder within WebContent and place some .html files, the url-pattern needs to be changed as reflected below: /javaTpoint/searchOnSendRedirect where javaTpoint is the name of the folder created within WebContent.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27045303
answers question: http://stackoverflow.com/q/27045303
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42756712
comment on: http://stackoverflow.com/q/27128675
has text: Have you tried `cmd /c c:/Users/Subhan/Desktop index.htm` alone, I mean in your cmd.exe? Does it work?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/27046892
has body: I have a Grails application with a websocket endpoint that works perfectly fine in development. I am trying to deploy to Tomcat, but for some reason every time I deploy I receive the following stacktrace from Tomcat: SEVERE: Exception sending context initialized event to listener instance of class my.package.MyServletChatListenerAnnotated javax.websocket.DeploymentException: Multiple Endpoints may not be deployed to the same path [/chatroomServerEndpoint] at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:207) at org.apache.tomcat.websocket.server.WsServerContainer.addEndpoint(WsServerContainer.java:271) at javax.websocket.server.ServerContainer$addEndpoint.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at grails.websocket.example.MyServletChatListenerAnnotated.contextInitialized(MyServletChatListenerAnnotated.groovy:36) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1668) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(…
tagged with: servletcontextlistener
type: AnsweredQuestion
score: 1
tagged with: java
has title: javax.websocket.DeploymentException when deploying Grails application to Tomcat
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27047331
tagged with: tomcat
tagged with: grails
upvote count: 1
has answer: http://stackoverflow.com/a/27047331
favorite count: 0
downvote count: 0
tagged with: spring

http://stackoverflow.com/comment/42724675
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27109862
has text: @dasLort Could you set this as label, just to check that values are passed OK `itemLabel="#{myEnum.toString()} == #{fb.aktionTxt}"`? Also, check client and server logs to see if there is somthing relevant

http://stackoverflow.com/a/27149097
type: Answer
answers question: http://stackoverflow.com/q/27148817
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27148817
score: 1
has body: Don't throw a NumberFormatException, because there was nothing wrong with the format if the string - it was simply out of range. The standard, and correct, exception to throw is IllegalArgumentException with a message. And as a general rule (which applies here), you shouldn't catch an excrotion, but do nothing with it. Try this: public void setId(String id) { if (Integer.parseInt(id) &lt; 1){ throw new IllegalArgumentException("id must be greater than zero:" id); } this.id = id; } Also: removed the int variable since you don't use it exception for comparing removed the try catch - just let the exception bubble out. If the client passed bad dara that's their problem
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27129974
has body: Create a variable for remembering whether a card has been drawn or not static boolean[][] drawn = new boolean[4][13]; Then replace the bit where you draw the card with: do { a = (int)(Math.floor(suits.size() * Math.random())); d = (int)(Math.floor(cards.size() * Math.random())); } while (drawn[a][d]); drawn[a][d] = true; Finally, remove the two lines where you are shuffling your two collections. Math.random will provide you a random card. Collections.shuffle(suits); Collections.shuffle(cards);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27129465

http://stackoverflow.com/a/27019669
type: AcceptedAnswer
downvote count: 0
has body: Path is used in a new proccess. It doesn't used to find your command. You can try the next solution. Run cmd.exe (bash etc.) and then run your command. Example: public class Test { public static void main(String[] args) throws IOException { ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/C", "start", "mystuff.exe"); Map&lt;String, String&gt; envs = pb.environment(); System.out.println(envs.get("Path")); envs.put("Path", "C:\\mystuff"); pb.redirectErrorStream(); pb.start(); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/26992165
answers question: http://stackoverflow.com/q/26992165
score: 15
upvote count: 15

http://stackoverflow.com/a/27029500
accepted answer of: http://stackoverflow.com/q/27006275
type: Answer
answers question: http://stackoverflow.com/q/27006275
downvote count: 0
score: 1
has body: Your position might not be correct because the screen location isn't necessarily the right location to draw onto using your OrthographicCamera, try using the unproject first. E.g: Vector3 mousePos = new Vector3( Gdx.input.getX(), (Gdx.graphics.getHeight()-Gdx.input.getY()), 0); //Get the mouse-x and y like in your code cam.unproject(mousePos); //Unproject it to get the correct camera position this.crosshair.setPosition(mousePos.x, mousePos.y); //Set the position Plus you need to make sure your floating batch is set to the projection matrix of the camera, add the following code: floatingBatch.setProjectionMatrix(cam.combined);
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42652565
score: 0
type: QuestionComment
has text: My "Source Compatibility" is set to 1.7. Also, the JDK I'm using is 1.8.0. Relevant?
type: Comment
comment on: http://stackoverflow.com/q/27069097

http://stackoverflow.com/comment/42646492
has text: `http.sendPost(url, postParams); String result = http.GetPageContent(courseURL);`. Wrong. Remove the second statement. Instead read now from the inputstream like is done in the second function.
comment on: http://stackoverflow.com/q/27065815
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27126100
answers question: http://stackoverflow.com/q/27125845
has comment: http://stackoverflow.com/comment/42752234
accepted answer of: http://stackoverflow.com/q/27125845
has body: in.nextInt() reads only the int value not the newline character after that. So that newline will be read by your in.nextLine() so your first index is empty. To eliminate this problem add a dummy in.nextLine() after reading the int. int numberOfLines = in.nextInt(); in.nextLine(); Another method is to use nextLine() instead of nextInt() to read the and parse the input to int. int numberOfLines = Integer.parseInt(in.nextLine());
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42752356
type: Answer
has comment: http://stackoverflow.com/comment/42752479

http://stackoverflow.com/a/27075263
type: Answer
has comment: http://stackoverflow.com/comment/42685916
accepted answer of: http://stackoverflow.com/q/27074952
answers question: http://stackoverflow.com/q/27074952
type: AcceptedAnswer
has body: From that perspective, it does sound like a contradiction. My view is that the focus was on making the collection type safe to any (generic) object. Speaking in your terms and in the scope of your example, you can make a list specific to any (generic) object. You have an older post discussing it in more details Why are generics called generics?. By the way if you find it to be an exact duplicate you can mark you question so.
score: 0

http://stackoverflow.com/comment/42792748
comment on: http://stackoverflow.com/q/27148701
has text: I would add abstract method to AbstractEvent and move processing code to events
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42710436
type: QuestionComment
has text: sorry really I' don't know how GUI builder/designer works
comment on: http://stackoverflow.com/q/27062486
score: 0
type: Comment

http://stackoverflow.com/comment/42597429
comment on: http://stackoverflow.com/a/27038672
type: AnswerComment
has text: Working on it as we speak
type: Comment
score: 0

http://stackoverflow.com/a/27073709
score: 1
answers question: http://stackoverflow.com/q/27073624
has comment: http://stackoverflow.com/comment/42659420
has comment: http://stackoverflow.com/comment/42659413
has body: C:\Program Files\MySQL\MySQL Connector J\mysql-connector-java-5.1.34-bin.jar; Your CLASSPATH seems to be not having . that is the current working directory where the DBDemo would be there. So add . also to your CLASSPATH. After that your CLASSPATH will be like .;C:\Program Files\MySQL\MySQL Connector J\mysql-connector-java-5.1.34-bin.jar; EDIT Also try extracting the contents of mysql-connector-java-5.1.34-bin.jar into a folder and change the CLASSPATH according to that.
upvote count: 1
has comment: http://stackoverflow.com/comment/42659568
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/42659480

http://stackoverflow.com/q/27003473
has body: I want to recognize at runtime whether my JUnit tests are being run from ant or not. The reason for this is, if it's being run from ant, I want to log information to a log file, else I just want to write to standard out.
type: Question
tagged with: ant
has comment: http://stackoverflow.com/comment/42536665
has comment: http://stackoverflow.com/comment/42536490
score: 0
answer count: 2
tagged with: junit
has comment: http://stackoverflow.com/comment/42536539
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42536580
linked to: http://stackoverflow.com/q/5521311
has title: Is there a way to tell whether a JUnit test is being run from Ant?
has answer: http://stackoverflow.com/a/27004330
has answer: http://stackoverflow.com/a/27003764
tagged with: java

http://stackoverflow.com/a/27175323
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: There is a Java binding for OpenCL called JOCL (OpenCL tasks can run on GPU). I don't know much about RootBeer. Whatever the solution you choose, you will need to download the appropriate OpenCL driver from your GPU manufacturer (Nvidia, AMD or Intel). Note that the AMD driver can also use your CPU to execute the OpenCL kernels in SIMD mode and will work on any CPU.
has comment: http://stackoverflow.com/comment/42851673
answers question: http://stackoverflow.com/q/27121369

http://stackoverflow.com/q/27096363
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/44141533
has body: I have created database with my own program and it appeared as mydatabase.mv.db file. But when I tried to access the same database with DbVisualizer, with apparently same parameters, it created two files mydatabase.lock.db and celebrity.h2.db and didn't see tables, created in the program. What was the incompatibility? UPDATE both setups are follows:
linked to: http://stackoverflow.com/q/2442867
has comment: http://stackoverflow.com/comment/42698190
has answer: http://stackoverflow.com/a/79283046
answer count: 4
type: AnsweredQuestion
tagged with: dbvisualizer
tagged with: java
tagged with: h2
has comment: http://stackoverflow.com/comment/42748828
has comment: http://stackoverflow.com/comment/42698103
score: 17
has answer: http://stackoverflow.com/a/27100675
accepted answer: http://stackoverflow.com/a/27100675
type: Question
possible better answer: http://stackoverflow.com/a/44141533
has answer: http://stackoverflow.com/a/74222043
tagged with: persistence
has title: How to access *.mv.db file of H2 database?
upvote count: 18

http://stackoverflow.com/q/27125056
type: UnansweredQuestion
upvote count: 1
tagged with: orientdb
has answer: http://stackoverflow.com/a/27134294
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has title: Update query not working with eval() funtion and parametes in OrientDB
has body: In my project i'm using Orientdb, some problem in update query. int amt = 100; int recordsUpdated = db.command(new OCommandSQL("update A set id = eval('id - "+ amt +"') where eval('id - "+amt+"') &gt; 0")).execute(); this is working fine. but, int recordsUpdated = db.command(new OCommandSQL("update A set id = eval('id - ?') where eval('id - ?') &gt; 0")).execute(100,100); or Map&lt;String,Object&gt; params = new HashMap&lt;String,Object&gt;(); params.put("amt", "100"); int recordsUpdated = db.command(new OCommandSQL("update A set id = eval('id - :amt') where eval('id - :amt') &gt; 0")).execute(params); is not working. please help me to make work.
favorite count: 0

http://stackoverflow.com/comment/42615943
type: QuestionComment
has text: A way to optimize your whole app will be by using a connection pool instead of creating physical database connections manually. This will incredibly enhance your app.
comment on: http://stackoverflow.com/q/27049130
score: 0
type: Comment

http://stackoverflow.com/q/27061467
has comment: http://stackoverflow.com/comment/42637551
score: 0
has comment: http://stackoverflow.com/comment/42637673
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/34925437
has body: I have a spring boot application. Packaged as a war file, such that the contents are as follows static org - springframework - boot -loader - SpringClasses META-INF - MANIFEST.MF - maven -my.group.id - my-artifact-id - pom.xml &amp; pom.properties WEB-INF - lib (contains all jars) - classes (my main application's classes) - some other stuff - web.xml - main-servlet.xml Where web.xml and main-servlet.xml are the configuration xml's I tried, from the springBoot application doing as follows: @EnableWebMvc @EnableAutoConfiguration @Configuration @ImportResource({ "classpath:main-servlet.xml"}) public class FakeAppBooter { public static void main(String args[]) { SpringApplication.run(FakeAppBooter.class, args); System.out.println("Test"); } public DispatcherServlet mvcDispatcherServlet() { XmlWebApplicationContext ctx = new XmlWebApplicationContext(); ctx.setConfigLocation("classpath:main-servlet.xml"); DispatcherServlet dispatcherServlet = new DispatcherServlet(ctx); return dispatcherServlet; } @Bean public ServletRegistrationBean mvcServletRegistrationBean() { ServletRegistrationBean bean = new ServletRegistrationBean(); bean.setServlet(mvcDispatcherServlet()); ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); list.add("/"); bean.setUrlMappings(list); return bean; } } However on startup I get : Caused by: java.io.FileNotFoundException: class path resource [main-servlet.xml] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:329) ... 25 more I need these to define the servlets for my application. what should I do?
tagged with: spring
accepted answer: http://stackoverflow.com/a/34925437
type: Question
type: AnsweredQuestion
tagged with: spring-boot
has title: SpringBoot WEB-INF not loaded
tagged with: java
has comment: http://stackoverflow.com/comment/42637914
tagged with: servlets
has answer: http://stackoverflow.com/a/78843426
answer count: 2
possible better answer: http://stackoverflow.com/a/78843426

http://stackoverflow.com/comment/42638949
type: Comment
type: QuestionComment
has text: @dasLort thanks, MihaiC already solved my problem.
score: 0
comment on: http://stackoverflow.com/q/27060759

http://stackoverflow.com/q/27077346
has answer: http://stackoverflow.com/a/27077383
has body: I am trying to access requestWindowFeature() from another Class called MyFunctions here is my MyFunctions Class public class MyFunctions { Context context; public MyFunctions(Context c) { c = context; } public void hideBars(Context context) { //HIDING TOP TITLE TAB context.requestWindowFeature(Window.FEATURE_NO_TITLE); //HIDING TOP TOOL BAR context.getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } } but it showing an error like this What should i do to access requestWindowFeature() and getWindow() from another class ? Best answer will be apreciated!
type: Question
has title: call 'requestWindowFeature' from another Class
score: 0
accepted answer: http://stackoverflow.com/a/27077383
tagged with: android
answer count: 1
tagged with: android-activity
tagged with: android-context
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26995219
downvote count: 2
has body: I'm new to coding. I want to try out a few things using java with eclipse. In this programm the user should be able to use a few commands. For example a command called "add". So when the user is typing "add 15 -200" the programm should call the add method and give it those to parameters. Sadly I have no idea how to properly read the integers and give them the "add" method. I just don't see how to devide the "add" string from the integers. Please help! Thanks in advance! Take care
type: Question
upvote count: 0
score: -2
has title: Deviding strings and integers of user input
has answer: http://stackoverflow.com/a/26995428
answer count: 1
has comment: http://stackoverflow.com/comment/42520921
tagged with: string
favorite count: 0
tagged with: integer
type: UnansweredQuestion
tagged with: input
tagged with: java

http://stackoverflow.com/comment/42622658
has text: Thanks for your awnsers![Here's what I meant](http://i.imgur.com/oSdFHeI.png?1). When I click on the "D3788" in the image I should be able to edit it to anything else... `Table.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent e) { if (!construction) { Table.setValueAt(Table.getModel().getValueAt(e.getFirstRow(),e.getColumn()), e.getFirstRow(), e.getColumn()); Table.repaint(Table.getCellRect(e.getFirstRow(), e.getColumn(), false)); Table.putClientProperty("terminatedEditOnFocusLost", true); } } }); `
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27052658

http://stackoverflow.com/comment/42725198
has text: so where does this "authorities" tie back to. and how would i figure out what the other options were?
type: AnswerComment
comment on: http://stackoverflow.com/a/27109387
score: 0
type: Comment

http://stackoverflow.com/q/27146973
has comment: http://stackoverflow.com/comment/42789416
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27149305
has body: Out of all the sorting algorithm like Insertion,MergeSort,QuickSort,BubbleSort and many more.Which one of these is the most time and memory efficient?
has title: Most time efficient sorting algorithm for Java 8?
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/42789465
type: Question
tagged with: arrays
tagged with: sorting
downvote count: 4
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/42789398
has answer: http://stackoverflow.com/a/27147046
favorite count: 0

http://stackoverflow.com/q/27085431
has answer: http://stackoverflow.com/a/27092536
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/27088286
has answer: http://stackoverflow.com/a/27086524
downvote count: 0
has title: JavaFX ToggleButton Shadow
favorite count: 0
has body: Hello Fellow StackOverflow Users, this is my first post/question and hopefully i'm not violating any rules/ect. Unfortunately I am unable to post a picture, but I will put this here for a reference. https://i.sstatic.net/nOPAL.jpg (Before Button Click) OT: On the picture above, I am attempting to make the button's background completely transparent besides the text. https://i.sstatic.net/duocU.jpg (After Button Click) Everything works out until I click the button then shadows appear on the side. Here is what I have tried... CSS .toggle-button { -fx-text-fill: black; -fx-base: transparent; -fx-background: transparent; -fx-focus-color: transparent; -fx-border-color: transparent; -fx-effect: null; } .toggle-button:selected { -fx-text-fill: black; -fx-base: transparent; -fx-background: transparent; -fx-focus-color: transparent; -fx-border-color: transparent; -fx-effect: null; } The java code is just a plain simple application with a ToggleButton. Special Thanks in Advance! - Bart
answer count: 4
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/77502013
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/27096111
has comment: http://stackoverflow.com/comment/43081993
has comment: http://stackoverflow.com/comment/42824074
type: Answer
has comment: http://stackoverflow.com/comment/42824632
has comment: http://stackoverflow.com/comment/42737514
has body: Maven can delegate to other languages inside the POM. You could use GMaven and write that logic in Groovy. Or the Ant Run plugin to write that logic in Ant. At that point, you have the steps to: Get a list of zip files in that folder Sort them Skip first three and delete others You also probably want to have a profile so this only happens on your build server and not locally. Or points to a different location locally.
answers question: http://stackoverflow.com/q/27077792
score: 0
has comment: http://stackoverflow.com/comment/42703448
has comment: http://stackoverflow.com/comment/42703364

http://stackoverflow.com/comment/42824856
comment on: http://stackoverflow.com/a/27164221
type: Comment
has text: No, it isn't a 'way to control client-side connections'. It is a way to control *new,* *incoming* connections, *at the server-side.* Client-side connections that already exist are not controlled by this mechanism, and the OP's objective of denying service when the sever is saturated is not met. Specifically, to use your own meaningless wording, it does not control 'too much RMI client-connection-request', as this is not a unitary concept. A single connection can service multiple requests, via connection-pooling at the client. Your answer and comment exhibit zero comprehension of that.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42713871
has text: So you say if I use spring aop in my class, add an aspect and a pointcut to a specific method, and then someone else will take that library (checked in from maven) and adds another aspect and a pointcut to the same method, everything will be ok?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27104938

http://stackoverflow.com/comment/42525027
type: Comment
comment on: http://stackoverflow.com/q/26997083
type: QuestionComment
has text: Looks like a *too broad* question. You should reverse the question : batch is easier that a UI, so imagine what kind of interaction you want, with what interface (text only, local GUI, web, etc ...) and simply use worker thread(s) to perform the tasks.
score: 0

http://stackoverflow.com/comment/42730833
score: 2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27114007
has text: @FredLarson: When it hits the `break` statement, presumably...

http://stackoverflow.com/a/27100776
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27100215
has comment: http://stackoverflow.com/comment/42748138
has comment: http://stackoverflow.com/comment/42739121
upvote count: 1
has body: Try this one. It is working. Put this in Oncreate timer = new Timer(); timer.schedule(hourlyTask, 0l, 3000); Put this outside oncreate TimerTask hourlyTask = new TimerTask() { public void run() { hand.sendEmptyMessage(1); } }; @SuppressLint("HandlerLeak") Handler hand = new Handler() { public void handleMessage(android.os.Message msg) { if (msg.what == 1) { arrlist.add("1"); arrlist.add("2"); arrlist.add("3"); ListView listview = (ListView) findViewById(R.id.list); ListviewAdapter adapter = new ListviewAdapter(Sample.this, arrlist); listview.setAdapter(adapter); } } };

http://stackoverflow.com/q/27094091
has comment: http://stackoverflow.com/comment/42694182
score: 1
tagged with: java
type: Question
has body: Currently my NetBeans 8.0 has been doing the strangest thing. I have a multimodule project. Usually I did not even have to have the projects opened or even downloaded, if the modules were in maven repository. Currently, some of my modules however need to be opened and built, so that "target" folder is in the project directory filled with classes. If it is not, I get a NoClassDefFoundError. The error looks like this: Exception in thread "main" java.lang.NoClassDefFoundError: SOME/CLASS/THAT/IS/EXPECTED/IN/TARGET/FOLDER/OF/SOME/MODULE/THAT/IS/A/DEPENDENCY at ... Caused by: java.lang.ClassNotFoundException: com.example.SOME.CLASS.THAT.IS.EXPECTED.IN.TARGET.FOLDER.OF.SOME.MODULE.THAT.IS.A.DEPENDENCY at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 2 more My POM looks like this: some parent 0.9-SNAPSHOT scm:svn:https://someconnection org.apache.maven.plugins maven-release-plugin sometagbase/tags junit junit myModuleGroupId somModule1 1.2.1-SNAPSHOT jar ...... many of these here Why does it suddenly require a target folder with classes? Is it not supposed to get them from the dependencies? From the repository?
answer count: 1
has comment: http://stackoverflow.com/comment/42831567
downvote count: 0
has answer: http://stackoverflow.com/a/72188404
has title: NoClassDefFoundError on Maven dependency if target folder is not present
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
upvote count: 1
tagged with: maven

http://stackoverflow.com/a/27058994
accepted answer of: http://stackoverflow.com/q/27058904
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
has body: Reason is when you enter the marks, you press say 56&lt;enter>. Your API nextInt just reads 56 and leaves enter which gets consumed by nextLine api. Inorder to avoid this, just before your sysout below: System.out.println("Enter another mark? Yes or No: "); Type the following line: scan.nextLine(); So that your &lt;enter> gets consumed by this api and you can successfully move forward reading user input Yes/No.
answers question: http://stackoverflow.com/q/27058904
score: 2

http://stackoverflow.com/a/27136277
has body: Everything in java is a pointer. This means that copying an array they way you are implementing it creata indeed a pointer to a new array, but the elements in the arrays point to the elements in the old array, thus making modifying them via methods affect both arrays. In order for that not to happen, you must implement a deep-cloning mechanism to clone the elements of the original array, and insert the newly created clones into the new array. Modifying a clone will not affect the original element, because they point to different addresses in the heap.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27136139

http://stackoverflow.com/comment/42730725
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27113877
has text: I would try writing out the bytes into a new file, just for debugging purposes, and see if other image viewers can open the file. My current guess would be that something goes wrong when dealing with the bytes before they are passed to the shown method.
score: 0

http://stackoverflow.com/comment/42725763
has text: Saw that - not a lot of information on command line options - other than the /s (silent). Surprising that they took away the help feature.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27111151
type: Comment

http://stackoverflow.com/comment/42691528
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27092649
type: Comment
has text: @fishinear Ones you click on buttonBuscar, the first button btnPago1 gets enabled. and when you click it, it gets disabled and the btnPago2 gets enabled. And that happens with all the buttons until the last button is clicked

http://stackoverflow.com/a/27032909
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42595610
has comment: http://stackoverflow.com/comment/42596974
accepted answer of: http://stackoverflow.com/q/27032746
has comment: http://stackoverflow.com/comment/42587251
type: Answer
has comment: http://stackoverflow.com/comment/42595673
has body: EDIT The below link describes the cause of this problem http://yfrankfeng.blogspot.in/2012/07/java-mail-does-not-set-subject-problem.html Check if there is a dependency org.apache.openejb Try setting the charset of the subject message.setSubject(subject,"utf-8");
has comment: http://stackoverflow.com/comment/42596839
has comment: http://stackoverflow.com/comment/42592535
upvote count: 1
has comment: http://stackoverflow.com/comment/42593046
has comment: http://stackoverflow.com/comment/42588894
score: 1
has comment: http://stackoverflow.com/comment/42591470
answers question: http://stackoverflow.com/q/27032746
has comment: http://stackoverflow.com/comment/42595995
has comment: http://stackoverflow.com/comment/42587226

http://stackoverflow.com/comment/42541514
comment on: http://stackoverflow.com/q/27006158
score: 0
type: Comment
type: QuestionComment
has text: Your `UserAuthRequest` pojo doesn't match the JSON you give it, structurally.

http://stackoverflow.com/comment/42788985
type: AnswerComment
has text: but here i'm supposed enter only 5 numbers but it is giving me an option to enter 6th(The first is ignored).
type: Comment
comment on: http://stackoverflow.com/a/27145820
score: 0

http://stackoverflow.com/a/27134866
downvote count: 0
score: 1
has body: I would use apache commons BeanUtils.copyProperties(toBean, fromBean); I wouldn't add a method to the class itself unless its really needed on every object. BeanUtils seem appropriate as it appears like something needed only in a specific situation. In case that you really need the behaviour on every object, than implementing a copy constructor is a way to go
upvote count: 1
answers question: http://stackoverflow.com/q/27134754
type: Answer

http://stackoverflow.com/comment/42783573
comment on: http://stackoverflow.com/q/27136825
has text: Also check that the signature of the action methods is Object methodName()
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27094217
has answer: http://stackoverflow.com/a/27170956
has comment: http://stackoverflow.com/comment/42703137
has body: I have java legacy code which loads a groovy script and adds two properties into the loaded class. It works fine with groovy 1.7.0 but when I try to upgrade groovy to the version 1.8.0 or later it causes stable error "General error during class generation: -1 java.lang.ArrayIndexOutOfBoundsException: -1". I’ve tried using groovy-all jar but result was the same with either Spring 2.5.6 or 3.2.11. Below is a maven dependency: org.codehaus.groovy groovy-all 1.8.9 A short test which reproduces the error. It’s interesting that error doesn’t occur when adding a simple property (attrSingle) but only when adding a list (attrList). EDITED (added getting of the properties) import groovy.lang.*; import org.codehaus.groovy.ast.*; import org.codehaus.groovy.ast.expr.*; import org.codehaus.groovy.ast.stmt.ExpressionStatement; import org.codehaus.groovy.classgen.GeneratorContext; import org.codehaus.groovy.control.*; import org.junit.Test; import java.security.CodeSource; import java.util.*; import static org.junit.Assert.assertTrue; public class TestGroovyAutonomous { @Test public void testParsing() throws Exception { SimpleCustomizedGroovyClassLoader customizedGroovyClassLoader = new SimpleCustomizedGroovyClassLoader(new GroovyClassLoader()); Class<?> groovyClass; try { groovyClass = customizedGroovyClassLoader.parseClass(new GroovyCodeSource( "{fact -> fact.a != null}", customizedGroovyClassLoader.generateScriptName(), "/scriptSandbox")); } catch (Exception e) { System.out.println("Error loading class"); throw e; } assertTrue(groovyClass != null); GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(); Boolean attrSingle = (Boolean) groovyObject.getProperty("attrSingle"); System.out.println("Single=" + attrSingle); List<String> attrList = new ArrayList<String>(); Object[] objects = (Object[]) groovyObject.getProperty("attrList"); for (Object o : objects) attrList.add((String) o); System.out.println("List=" + attrList); } class SimpleCustomizedGroovyClassLoader ext…
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42695273
has answer: http://stackoverflow.com/a/27115326
tagged with: java
has title: ArrayIndexOutOfBoundsException when adding property to a groovy class
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27115326
has comment: http://stackoverflow.com/comment/42719416
possible better answer: http://stackoverflow.com/a/27170956
tagged with: groovy
type: Question

http://stackoverflow.com/q/26994489
has answer: http://stackoverflow.com/a/26994526
has comment: http://stackoverflow.com/comment/42519967
possible better answer: http://stackoverflow.com/a/26994622
has title: Incorrect output with counting
tagged with: input
has comment: http://stackoverflow.com/comment/42519614
answer count: 4
has answer: http://stackoverflow.com/a/26994639
accepted answer: http://stackoverflow.com/a/26994639
type: AnsweredQuestion
tagged with: java
tagged with: output
has comment: http://stackoverflow.com/comment/42519725
has body: I was coding on a program that would keep on accepting numbers until the user enters -1. Then it would display the number of items that are divisible by 9; using a special property- sum of digits of numbers that are divisible by 9, are themselves divisible by 9. I have been told to rely on a heavily modular approach. Simple input, no arrays. There is no compilation errors and stuff, but the value of count is always wrong. For instance, if I input 18,18,4,4,2,5,19,36,-1, the expected output is 3, but the output comes out as 4. I have no clue why. I have tried count++ and ++count, they yield the same output. Where am I going wrong? import java.util.Scanner; public class Div{ static Scanner sc = new Scanner(System.in); boolean run = true; static int n = 0; static int count = 0; public static void main(String[] args){ Div a = new Div(); a.accept(); a.display(); } void accept(){ while (run){ System.out.println("Enter the number"); n = sc.nextInt(); if (isDivisibleByNine(n)){ count = count + 1; } if (n == -1){ run = false; } } } static int sumOfDigits(int a){ int m = a; int sum = 0; while (m&gt;0){ sum = sum + (m%10); m /= 10; } return sum; } static boolean isDivisibleByNine(int x){ if (sumOfDigits(x)%9==0){ return true; } else { return false; } } void display(){ System.out.println("The total number of numbers that are divisible are: " + count); } }
type: Question
has answer: http://stackoverflow.com/a/26994622
has answer: http://stackoverflow.com/a/26994671
score: 0

http://stackoverflow.com/a/59697270
score: 2
answers question: http://stackoverflow.com/q/27020702
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/108146075
upvote count: 2
has body: Following @Thanh Nguyen Van approach: I stumbled upon the same problem while developing my backend with Spring Boot and OAuth2. The problem I encountered was that, if multiple devices shared the same tokens, once one device refreshed the token, the other device would be clueless and, long story short, both devices entered in a token refresh frenzy. My solution was to replace the default AuthenticationKeyGenerator with a custom implementation which overrides DefaultAuthenticationKeyGenerator and adds a new parameter client_instance_id in the key generator mixture. My mobile clients would then send this parameter which has to be unique across app installs (iOS or Android). This is not a special requirement, since most mobile apps already track the application instance in some form. public class EnhancedAuthenticationKeyGenerator extends DefaultAuthenticationKeyGenerator { public static final String PARAM_CLIENT_INSTANCE_ID = "client_instance_id"; private static final String KEY_SUPER_KEY = "super_key"; private static final String KEY_CLIENT_INSTANCE_ID = PARAM_CLIENT_INSTANCE_ID; @Override public String extractKey(final OAuth2Authentication authentication) { final String superKey = super.extractKey(authentication); final OAuth2Request authorizationRequest = authentication.getOAuth2Request(); final Map&lt;String, String&gt; requestParameters = authorizationRequest.getRequestParameters(); final String clientInstanceId = requestParameters != null ? requestParameters.get(PARAM_CLIENT_INSTANCE_ID) : null; if (clientInstanceId == null || clientInstanceId.length() == 0) { return superKey; } final Map&lt;String, String&gt; values = new LinkedHashMap&lt;&gt;(2); values.put(KEY_SUPER_KEY, superKey); values.put(KEY_CLIENT_INSTANCE_ID, clientInstanceId); return generateKey(values); } } which you would then inject in a similar manner: final JdbcTokenStore tokenStore = new JdbcTokenStore(mDataSource); tokenStore.setAuthenticationKeyGenerator(new EnhancedAuthenticationKeyGenerator()…

http://stackoverflow.com/comment/42607579
has text: org.apache.hadoop.hive.ql.metadata.HiveException: Unable to execute method public org.apache.hadoop.io.LongWritable com.vm.hive.udf.Factorial.evaluate(org.apache.hadoop.io.LongWritable) on object com.vm.hive.udf.Factorial@1c6f1c6f of class com.vm.hive.udf.Factorial with arguments {39514210:org.apache.hadoop.io.LongWritable} of size 1
comment on: http://stackoverflow.com/q/27044130
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42643478
has text: tried return redirect(controllers.routes.Application.index()); same result
score: 0
comment on: http://stackoverflow.com/q/27063562
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27102207
has comment: http://stackoverflow.com/comment/42708483
score: 2
has comment: http://stackoverflow.com/comment/42708450
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42708480
tagged with: java
has title: Call from java Main class from servlet Application
has comment: http://stackoverflow.com/comment/42708511
has answer: http://stackoverflow.com/a/56961087
type: Question
has body: I Have two applications.One is Standalone application.Another one is web Application (Servlet App). Here I want to Call Java Application From Servlet Application.So can You Guys Suggest Me or Can i have one app for this one.So that i will implement in my application. In this Application I have created Jar file of Stand alone Application After that What to do ?
accepted answer: http://stackoverflow.com/a/27102332
has comment: http://stackoverflow.com/comment/42708396
tagged with: servlets
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/27102332
possible better answer: http://stackoverflow.com/a/56961087
favorite count: 0
has comment: http://stackoverflow.com/comment/42708581
has comment: http://stackoverflow.com/comment/42708388

http://stackoverflow.com/comment/42765767
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27120009
has text: Hmm this does not to seem to work, the image saved to the gallery is poor quality still

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

http://stackoverflow.com/q/27121894
has body: I'm stuck with an issue that is, I have a JFrame with 2 JPanels added in it as showed in Figure : in figure above, one JPanel have some JButtons and second JPanel have some form fields, I want to change/(remove old and add new JPanel) when I click on JButtons in first JPanel accordingly as shown bellow : I have code snippet : myPanel.clickListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { MainFrame.this.getContentPane().remove(((BorderLayout)getLayout()).getLayoutComponent(BorderLayout.CENTER)); MainFrame.this.getContentPane().add(twoPanel, BorderLayout.CENTER); MainFrame.this.invalidate(); MainFrame.this.validate(); } }); myPanel.clickListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { MainFrame.this.getContentPane().remove(((BorderLayout)getLayout()).getLayoutComponent(BorderLayout.CENTER)); MainFrame.this.getContentPane().add(customerPanel, BorderLayout.CENTER); MainFrame.this.invalidate(); MainFrame.this.validate(); } }); MainFrame.this.setMaximumSize(new Dimension(600, 550)); MainFrame.this.setMinimumSize(new Dimension(599, 549)); MainFrame.this.setSize(600, 550); MainFrame.this.setResizable(false); MainFrame.this.setVisible(true); } }); through above code I'm able to add new JPanel but unable to remove first JPanel.
has comment: http://stackoverflow.com/comment/42744815
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
type: Question
linked to: http://stackoverflow.com/q/7229226
answer count: 1
has comment: http://stackoverflow.com/comment/42744799
has title: could not remove/add jpanel in jframe
score: 0
linked to: http://stackoverflow.com/q/5665156
has comment: http://stackoverflow.com/comment/42744681
tagged with: jframe
has comment: http://stackoverflow.com/comment/42744963
has answer: http://stackoverflow.com/a/27122152
accepted answer: http://stackoverflow.com/a/27122152
tagged with: swing

http://stackoverflow.com/comment/42532745
comment on: http://stackoverflow.com/a/27000931
type: AnswerComment
score: 0
type: Comment
has text: Doesn't matter where you want to put the `main` method as long as you only have one `main`. But, I see you already have `main` in your `VendingMachine` class, so just leave it that way. Just create separate class for `Foods`, `Drinks`, and `Snacks`

http://stackoverflow.com/q/27030183
has answer: http://stackoverflow.com/a/30691441
has answer: http://stackoverflow.com/a/51620681
answer count: 7
favorite count: 0
score: 47
tagged with: toolbar
has answer: http://stackoverflow.com/a/51976158
tagged with: android
has answer: http://stackoverflow.com/a/27030262
has answer: http://stackoverflow.com/a/77508292
type: AnsweredQuestion
downvote count: 0
has body: I want to set up my toolbar as an actionbar, but since your toolbar is a layoutelement it has to be in your layout. Now my layout is in my fragment. I added the toolbar in my layout and I call it within my fragment: //Toolbar Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar); It works because I can set the title and so on but now I want it to react as a actionbar because I want to have this actually. setDisplayHomeAsUpEnabled(true) To do that I have to change the toolbar to an actionbar: setSupportActionBar(toolbar); That doesn't work in my fragment ... Can anybody help me to get my toolbar to work as an actionbar in a fragment.
tagged with: android-actionbar
tagged with: fragment
type: Question
upvote count: 47
possible better answer: http://stackoverflow.com/a/35031317
has answer: http://stackoverflow.com/a/35031317
tagged with: java
has answer: http://stackoverflow.com/a/32858049
accepted answer: http://stackoverflow.com/a/32858049
has title: Set up toolbar as actionbar in fragment

http://stackoverflow.com/comment/42572865
score: 0
type: QuestionComment
type: Comment
has text: You should not put brackets after variable declarations: `static Circle c1;` with no brackets. Those brackets are being used as initialization blocks; not as scopes for those specific variables. You need to initialize your variables with objects by doing `c1 = new Circle()`. You can then set the state of that object using that variable. Also, `double x` shouldnt be static, or else all circles will share the same `x` value. Tons of problems here :s
comment on: http://stackoverflow.com/q/27024507

http://stackoverflow.com/comment/42533802
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27001959
has text: The `Date` object has no relation to the `TimeZone` of the `Calendar` object that created it.
type: Comment

http://stackoverflow.com/comment/42777142
comment on: http://stackoverflow.com/q/27139615
type: QuestionComment
has text: Well, what it does is check if the code in question is allowed to create a new class loader (which is a security-relevant operation). Are you asking how you can set this permission?
score: 0
type: Comment

http://stackoverflow.com/q/27044300
has answer: http://stackoverflow.com/a/27045020
type: AnsweredQuestion
has title: How to open a Jframe which is in another class as a constructor with actionListener?
possible better answer: http://stackoverflow.com/a/27045182
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/27045020
answer count: 2
downvote count: 0
favorite count: 0
has body: Basically I have 1 main class which extends JFrame and implements ActionListener and i have created a window which is my main window. Now I wanted to make another window which opens when I click a button on the main window. So to do this I created another class which extends JFrame and created another window. Now I am unsure how to set it so that the new window I created opens when I click a button in the main window. I have my actionPerformed in that main class. Im not sure what statement would make my window pop up.
has answer: http://stackoverflow.com/a/27045182

http://stackoverflow.com/comment/61461242
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26999663
has text: http://stackoverflow.com/questions/36951414/initialize-a-map-hashmap-in-java/36951468#36951468
score: 0

http://stackoverflow.com/comment/133597054
type: Comment
comment on: http://stackoverflow.com/a/27009484
type: AnswerComment
has text: is this applicable even within the same system?
score: 0

http://stackoverflow.com/comment/42638455
type: QuestionComment
comment on: http://stackoverflow.com/q/27061967
has text: @ChrisK By recognizing that the handler is busy and creating and cloning the handler. Now that I think about it maybe I should clone the handler every time the event is fired :)
score: 0
type: Comment

http://stackoverflow.com/comment/42762750
score: 0
type: Comment
has text: [Spring XD](http://projects.spring.io/spring-xd/) has kafka [source](https://github.com/spring-projects/spring-xd/tree/master/modules/source/kafka/) and [sink](https://github.com/spring-projects/spring-xd/tree/master/modules/sink/kafka/) modules that use the adapters.
comment on: http://stackoverflow.com/a/27130491
type: AnswerComment

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

http://stackoverflow.com/a/27134190
answers question: http://stackoverflow.com/q/27134144
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: So why are you not using the second parameter in the query? You have "?1" for the first parameter twice.
accepted answer of: http://stackoverflow.com/q/27134144
type: Answer

http://stackoverflow.com/comment/42558391
type: QuestionComment
has text: What if you use readAttributes instead? That will return all the file's metadata so you can check that the file Java is reading really is the one you think it is.
comment on: http://stackoverflow.com/q/27016467
score: 1
type: Comment

http://stackoverflow.com/comment/42646979
comment on: http://stackoverflow.com/q/27066603
has text: LOOL oh didn't notice that, its suppose to be a part of loveletter :') @Marshall Tigerus
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42763832
has text: What have you tried? Just off the top of my head, a function that would check the GCD of your numerators and denominators and return the fraction if mod = 0 would probably accomplish this.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27132494

http://stackoverflow.com/q/27010986
favorite count: 0
type: UnansweredQuestion
has title: Raw Data Decoding
downvote count: 1
tagged with: java
has body: I have a coloumn in oracle DB of RAW type. I want to decode the values in them to understand what is there in it. Can I do this using java. Please help. One of the sample values in that coloumn is as follows. 1F8B0800000000000000ED5C5B73E23A127E9F5FA1F5BE64EA9CF8824D0294431501E60C3B93CBC6CCECEC4C4D51C608D089B17D6C01A1B6F6BF6FCB16BEC580212499AACD4BC0B2D4EA565FD4FD4944C70BEC501490D185200BC832E985501190133E8D4C8AE15156B453453955AA7DA5DE90E5867A266A9AF29BACC28380E8CA639D84A63EC341604E7053FFDB8F76A7D56FFDB8C64B449C809A8E85913B4697B7DDCFC8F35D0B3A224111613471082530CD089DFC1D09B7D13B03FB0B62E13BFCD71C07B4F7F50EBEB52EDB466FE6D9BC8BF05EFCF9B3A94BF19C522848534FC973E9DDFA962C2A5C2C25140BFEDAE610DB1702674440DE5AFAA7CA3BB0FC4109AEFAFE4A162B19AE2A3157D45F5DDAAE758F4EB4EAFB356F89242FC4A281FFD24435C3A21AB3383389834ED47A9ABFB54CAFC11F4CBB24F778053CAA9AAC2AEAE9A577672DE4D375BF539000AC9071560D65D16259EEB085C902672D6EBB1895126270B2A30D26CD18B76D34F6DD19F24C9F3AD82F65FC42766946989AC40E9269DFE98544E0E32A983475361572CC1970BD81AD8799ED048D87805C08534ABD86242D974B71A98AAE3F912AB2AC48DFAE3E1BD614CFCCD3B56783FC85D40E23168F1AED1EC53BC71DC32711076371461DD17267129091B68A6ADCB46E4FBBD7ED984610520E44781DB8A617CECABE48D8B1DC11712692D07C8790DE766733D781BF9EEB806106AC119AAF8C9ED1B9BE9ECF4AB11611119ABF55CEE4FA59A52E57CFB4335D8A8970A25C02981CDA86602BFBD0EE7FBBFED4EEFDB3F3A967743FE9529E169FE2C61F61BF0356DF2733BC17FDB493D44227A97ED7A50CBDF51C5EDBED75F622FEFD0A4885C3380D033B40784F2AE044BAB41E196A4F2A529FDE1BC1573226105588EBF0197BA33EF879939B4FAFA34BBC65FDFAAB69CF715E85EBE670B2C774756E8621A1DB2FC6C753A3DBEFF7AEFF307429FD8A75EDE0C0F289170E6DBBCE984CE63E463D8762DFC114199852D066A04BE98EEFF462BB87F0C1A24073C36B1E29C2301347976C04A6EE85D027D406572D1B8C5B4150498271250EC6D1C6528D83F11F9872CADBE2AF9A8DBF4A51FCFDE28DC2A46261FAC41CDA18719677C6CFB05B33FA58DBD88161918F4A59E9B640169046240F0C09A80F1A159A5C4528AB235DE24CF2CF5DCAEA71867A9D6369ECEC453496E27BA7DA92BECDD4F75757205F50880029FED20FBB74C7357F0D7BF6B19477BEA7F2B48…
score: -1
type: Question
tagged with: encoding
upvote count: 0
has answer: http://stackoverflow.com/a/27011174
answer count: 1
tagged with: raw-data

http://stackoverflow.com/a/27098559
score: 0
has body: If you are running your app in your phone, obviously it needs to connect to your PC's ip address. Not localhost. And your PC and your phone needs to be in the same network. E.g. jdbc:mysql://your-pc-ip-address:3306/student
type: Answer
has comment: http://stackoverflow.com/comment/42702729
answers question: http://stackoverflow.com/q/27098516

http://stackoverflow.com/comment/42790091
has text: But do you have any ideas why my notification will just disappear by itself after few seconds? As I cannot concatenate the string, if I do not do that, everything works fine
type: AnswerComment
comment on: http://stackoverflow.com/a/27147377
score: 0
type: Comment

http://stackoverflow.com/a/27004032
has comment: http://stackoverflow.com/comment/73715720
accepted answer of: http://stackoverflow.com/q/27003920
type: AcceptedAnswer
downvote count: 0
score: 54
answers question: http://stackoverflow.com/q/27003920
has body: It is quite easy... Download the JDK as a tarball from Oracle (a simple google search will yield the link). Unzip it somewhere in your $HOME (for instance, $HOME/jdk). Set JAVA_HOME to the path of the root JDK install; then prepend $JAVA_HOME/bin to your PATH. And off you go. Here I have a particular setting insofar as I run three different major versions of the JDK: 6, 7, 8. For instance, here is my source file for setting the current shell to use Java 8: $ cat ~/.jdk/8 export JAVA_HOME=/opt/sunjdk/1.8/current export PATH="$JAVA_HOME/bin:$PATH" And in /opt/sunjdk/1.8 (given that /opt/sunjdk is writable by my user hence I don't need to be root): $ ls -l /opt/sunjdk/1.8/* -d lrwxrwxrwx 1 fge fge 11 Oct 30 10:09 /opt/sunjdk/1.8/current -&gt; jdk1.8.0_25 drwxr-xr-x 1 fge fge 274 Mar 18 2014 /opt/sunjdk/1.8/jdk1.8.0_05 drwxr-xr-x 1 fge fge 274 Sep 18 02:44 /opt/sunjdk/1.8/jdk1.8.0_25 (and yes, I was root to begin with so as to grant write permissions for /opt/sunjdk to "my" user; if you have no such liberty, just create another directory in your home)
type: Answer
upvote count: 54

http://stackoverflow.com/comment/42676928
type: QuestionComment
type: Comment
has text: Are you trying to write a recursive method? How does `a = (x - y); quo++';` compute the quotient? I can see that it might within a for loop (or a recursive call), but I'm not totally sure I would call that "manual division", what are you going to do when you try and divide 1 billion by 2?
comment on: http://stackoverflow.com/q/27083913
score: 0

http://stackoverflow.com/q/27052014
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27186263
type: Question
has title: unable to print values of oracle.sql.ARRAY
tagged with: java
upvote count: 1
tagged with: oracle11g
answer count: 1
accepted answer: http://stackoverflow.com/a/27186263
has body: I am getting a list of StudentIds as a List&lt;String&gt; I convert that to a String[] later, String[] studentIdArray = null; if (list!= null) { // StudentList studentIdArray = list.toArray(new String[list.size()]); // printed studentIdArray and print the values. its fine } Then an arrayDescriptor is declared to map the Java String[] to the PLSQL Table of RAW which is defined as STUDENT_ID_TYPE ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor("STUDENT_ID_TYPE", connection); Now I get the oracle.sql.ARRAY out of it, ARRAY studentArray = new ARRAY(arrayDescriptor, connection, studentIdArray); I am unable to find how to print the values in studentArray, although when I print studentArray.length(), it returns as 1, which I feel correct. BUt When this array is passed to my PLSQL procedure, I get custom exception. edit: when i use the dump(), it just dumps as element[0] = [B@438620c7
tagged with: plsql
type: AnsweredQuestion

http://stackoverflow.com/comment/42555283
comment on: http://stackoverflow.com/q/27014753
has text: It's doing integer addition first (associativity of = from R to L) and then assigning to long. You may want to type cast and use that statement as long bigger = (long) big + 2;
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27022260
has comment: http://stackoverflow.com/comment/42572676
has comment: http://stackoverflow.com/comment/42576115
has comment: http://stackoverflow.com/comment/42613205
upvote count: 1
has body: I get the standard OS dialog asking for an application (with Java 7 and Windows 8). If you get access denied, it is probably because the user running the Java program has no right to open the file. Test app: public class DesktopOpenFile { public static void main(String[] args) { openFile("huhu.orttr"); } private static void openFile(String path) { try { File file = new File(path); if (file.exists()) { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(file); } else { System.out.println("Awt Desktop is not supported"); } } else { System.out.println("DesktopOpenFile::openFile: file = " + file.getAbsolutePath() + (file.exists() ? " - exists" : " - does not exist!")); } } catch (IOException ex) { ex.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/42570411
has comment: http://stackoverflow.com/comment/42603928
type: Answer
has comment: http://stackoverflow.com/comment/42605624
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27021434

http://stackoverflow.com/q/27094397
tagged with: java
type: Question
has title: Calculating Area and Circumference of a circle using a point class
tagged with: point
tagged with: class
score: 0
accepted answer: http://stackoverflow.com/a/27094421
answer count: 1
has comment: http://stackoverflow.com/comment/42694923
has answer: http://stackoverflow.com/a/27094421
tagged with: constructor
type: AnsweredQuestion
has body: I initially wrote the following Point class: public class Point { private double x; private double y; public Point (double x, double y) { this.x = x; this.y = y; } } I tried to use the point class as a way of storing the origin of a circle so that later on I could calculate if 2 circles intersect: public class Circle { double radius; Point origin; public Circle (Point origin, double radius) { this.radius = radius; this.origin = origin; } public double circumfurence (double radius) { return 2 * radius * Math.PI; } public double area (double radius) { return Math.PI * radius * radius; } public static void main(String[] args) { Circle c = new Circle((3.0,3.0), 3.0); System.out.println(c.area()); System.out.println(c.circumfurence()); } } However, when I try to compile the two files I get the following error: Circle.java:20: error: ')' expected Circle c = new Circle((3.0,3.0), 3.0); ^ If I remove the brackets around (3.0,3.0) I get this error: Circle.java:20: error: constructor Circle in class Circle cannot be applied to given types; Circle c = new Circle(3.0,3.0, 3.0); ^ required: Point,double found: double,double,double reason: actual and formal argument lists differ in length EDIT: Thanks but I still get the error: Circle.java:21: error: method area in class Circle cannot be applied to given types; System.out.println(c.area()); ^ required: double found: no arguments reason: actual and formal argument lists differ in length

http://stackoverflow.com/comment/42534204
score: 1
has text: @TarunChaudhary: No, IST is UTC+05:30. (GMT and UTC are equivalent, for the purposes of this discussion - but it's generally better to talk about UTC to avoid confusing things with the UK time zone, which observes GMT for half the year.)
type: AnswerComment
comment on: http://stackoverflow.com/a/27002052
type: Comment

http://stackoverflow.com/q/27113689
tagged with: jdbc
has comment: http://stackoverflow.com/comment/42732618
tagged with: java.util.scanner
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42732584
has comment: http://stackoverflow.com/comment/42733160
tagged with: java
has comment: http://stackoverflow.com/comment/42732345
tagged with: mysql
has answer: http://stackoverflow.com/a/27113821
has comment: http://stackoverflow.com/comment/42730316
has body: I am currently trying to scan and parse the file that is not in sql format. I am trying to input all the data into the SQL table but for some reason every time i run the program, i get the error saying unknown column 'what' in 'field list.' So the neither of the data goes through. 'what' is one of the names that is on the text. The table currently has 11 columns. I know I am parsing or scanning it wrong but I cannot figure out where. Here is my code: public class parseTable { public parseTable (String name) throws FileNotFoundException { File file = new File(name); parse(file); } private void parse(File file) throws FileNotFoundException { Connection conn = null; Statement stmt = null; ResultSet rs = null; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); String connectionUrl = "jdbc:mysql://localhost:3306/"; String connectionUser = ""; String connectionPassword = ""; conn = DriverManager.getConnection(connectionUrl, connectionUser, connectionPassword); stmt = conn.createStatement(); Scanner scan = new Scanner(file); String[] rowInfo = new String[11]; int count = 0; while(scan.hasNextLine()){ //String data = scan.nextLine(); Scanner lineScan = new Scanner(scan.nextLine()); while(lineScan.hasNext()){ String words = lineScan.next(); if(count &lt; 11){ rowInfo[count] = words; count++; } else if(count == 11 &amp;&amp; words.equals("States")){ rowInfo[count - 1] = rowInfo[count - 1] + " " + words; } else{ String query = ""; for(int i = 0; i &lt; rowInfo.length; i++) { if(query.equals("")) { query = rowInfo[i]; } else if(i == 9){ query = query + "," + rowInfo[i]; } else if(rowInfo[i].equals(null)){ query = query + ", " + "NULL"; } else query = query + ", " + "'" + rowInfo[i] + "'"; } stmt.executeUpdate("INSERT INTO dup VALUES(" + query + ")"); count = 0; rowInfo = new String[11]; } } } } catch (Exception e) { e.printStackTrace(); } finally { try { if (rs != null) rs.close(); } catch (SQLException e) { e.printStackTrace(); } try { if (stmt != null) stmt.close(); }…
has comment: http://stackoverflow.com/comment/42732258
has title: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException UNKNOWN COLUMN
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/42739540
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27107231
has text: oh I misunderstood then.. sorry :(

http://stackoverflow.com/q/27146105
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27146521
has body: So the problem. I need some mechanism to block entities in data source. For example if someone open some article in writing mode then others can't open this article in writing mode, but only in reading mode. I see only two methods: in table create some column (ex:isBlocked) and marked it as blocked use EJB singleton and keep in array opened articles id. What is better? What are the other ways to solve such problem?
tagged with: java
tagged with: mysql
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/27146521
has title: Best practices to lock entities/rows in data source with EJB
tagged with: ejb
score: 0
tagged with: sql
answer count: 1

http://stackoverflow.com/a/27222084
score: 2
has body: One way you can try reducing number of classes is to not use B-I notation. For example, club B-facility and I-facility into facility. Of course, another way it to use a bigger memory machine.
answers question: http://stackoverflow.com/q/27134622
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42738453
type: Comment
comment on: http://stackoverflow.com/a/27117621
score: 0
has text: @chrylis Creating subclasses to do new things is the whole idea behind Object Oriented design concepts. If you wanted to change the `toString` behavior then you subclass and override `toString`. It has no other effect on the parent class's functionality or the code in place. Given that `Map` is an interface, there would be no code change necessary. Doing it like this answer suggests, free form violates OO design practices by putting logic belonging to the `Map` outside of the class representing the `Map`.
type: AnswerComment

http://stackoverflow.com/comment/42844442
type: Comment
comment on: http://stackoverflow.com/a/27045604
type: AnswerComment
has text: `results.getTotal()` does not execute `SELECT FOUND_ROWS()`, see [issue](https://github.com/querydsl/querydsl/issues/1060). Waiting for solution.
score: 0

http://stackoverflow.com/comment/42647379
type: QuestionComment
comment on: http://stackoverflow.com/q/27066975
score: 0
has text: What is teamsize set too? does that even compile?Your for loop condition is wrong it should be teamsize -1 not --1.
type: Comment

http://stackoverflow.com/comment/42522125
score: 0
has text: Put your comment as an answer, because it worked :). I wanna approve your answer. :)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26995295

elasticsearch-java-api
tag name: elasticsearch-java-api
type: Tag
tags question: http://stackoverflow.com/q/27150656
tags question: http://stackoverflow.com/q/27000472

http://stackoverflow.com/a/27115163
upvote count: 1
score: 1
has body: Each item in the ListStore corresponds to a row in the grid - as such, you need to put data in the grid. You should be able to easily iterate over the list of MyObject instances and convert them into MyObjectRow instances - which could even contain a reference to the 'real' MyObject instance for easier editing/updating. However, since it is a Set, you'll want to be careful - sets have no order! This means you might not get value3-1, value3-2 value3-3, but they could arrive in any order. Strongly consider using a List instead of order matters to you at all. With a List then, you could have MyObjectRow look like this: public class MyObjectRow { private MyObject wrapped; private int index; //... public String getParam1() { return wrapped.getParam1(); } public String getParam2() { return wrapped.getParam2(); } public String getParam3() { return wrapped.getParam3().get(index); } } Then, for each MyObject, make N MyObjectRow, where N is the number of items in param3.
has comment: http://stackoverflow.com/comment/42735785
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27097856
answers question: http://stackoverflow.com/q/27097856
downvote count: 0
has comment: http://stackoverflow.com/comment/42735155
type: Answer

http://stackoverflow.com/q/27038274
tagged with: spring
accepted answer: http://stackoverflow.com/a/27039209
tagged with: cxf
tagged with: java
upvote count: 1
answer count: 1
has title: Restricting max file size per resource
type: AnsweredQuestion
tagged with: apache
downvote count: 0
tagged with: jax-rs
score: 1
has body: I am using Apache-cxf (JAX-RS) coupled with spring framework. I have the following sample code in my beans.xml. <jaxrs:server id="services" address="${http.server}"> <jaxrs:properties> <entry key="attachment-max-size" value="1024" /> </jaxrs:properties> <jaxrs:serviceBeans> <lookup-method name="createEmployeeCollectionResource" bean="employeeCollectionResource" /> ... ...other beans ... </jaxrs:serviceBeans> </jaxrs:server> I also have the following code <lookup-method name="createNewEmployeeResource" bean="employeeResource" /> I have set the max file size during upload as 1KB for all the services in general. How can I restrict the attachment-max-size for few beans in particular? Example - 5MB for few beans and 2MB for few others etc
favorite count: 0
has answer: http://stackoverflow.com/a/27039209
type: Question

http://stackoverflow.com/q/27093754
type: Question
has comment: http://stackoverflow.com/comment/42693535
has answer: http://stackoverflow.com/a/27093904
answer count: 1
has comment: http://stackoverflow.com/comment/42693465
score: 0
has title: Implementing the Strategy Pattern for my specific issue
has comment: http://stackoverflow.com/comment/42693574
accepted answer: http://stackoverflow.com/a/27093904
tagged with: strategy-pattern
tagged with: design-patterns
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42693472
has body: For a school assignment I have a to implement the Strategy Pattern and I fully understand the pattern with the interface and the context that depending on what is asked gets the proper Strategy but I just can't seem to figure out how to implement it with my specific problem. The problem: Give the design of a solution (with a UML-classdiagram) which solves following problem: A system administers a few cooks (using a class cook for this). Some of these cooks need different things than others in order to prepare themselves for a cooking session, this way the cooks distinguish amongst others and are able to serve different settings. The system is used by a chain of restaurants that works with a lot of cooks. It is important to compose the right set of cooks based on a limited combination of preparations, it should be fairly easy to remove cooks of a certain type or add new ones. Your solution should be able to show different steps after calling the method prepare() on a cook. Some examples: cook Jeroen just needs to ‘put an apron on’, this is also what most others cooks do. But cook Christian needs to ‘put an apron on, take a collection of knifes and set some classical music on’. And the cooks Nini and Leo need to ‘open a beer and set some hardrock on’. Beware: some of the actions require interaction with other classes (they don’t have to be included explicitly in your solution), so it is not sufficient to just add a String-attribute ‘preparation’! My guess is that the preperation is thet Strategy interface and the different kinds of preperations are ConcreteStrategies (per example found here: http://upload.wikimedia.org/wikipedia/commons/3/39/Strategy_Pattern_in_UML.png) and the cook is the context in this example Hope you can shed some light on it for me (i'd prefer a hint towards te correct direction instead of a full solution) Edit: Replaced my explenation of the problem and inserted the original text
tagged with: java

http://stackoverflow.com/q/27037759
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42627143
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42626244
has comment: http://stackoverflow.com/comment/42596249
has comment: http://stackoverflow.com/comment/42595665
has comment: http://stackoverflow.com/comment/56732506
has body: I want to create UDF in pig using tika for processing image in the HDFS. Below is my code, but I'm getting ClassNotFound exception public String exec(Tuple input) throws ExecException, IOException { try { if (input == null || input.size() == 0 || input.get(0) == null) { return null; } } catch (ExecException ex) { Logger.getLogger(Check.class.getName()).log(Level.SEVERE, null, ex); } String s=""; ByteArrayInputStream b = (ByteArrayInputStream)input.get(0); ContentHandler contenthandler = new BodyContentHandler(); Metadata metadata = new Metadata(); Parser parser = new AutoDetectParser(); ParseContext parseCtx = new ParseContext(); try { parser.parse(b, contenthandler, metadata,parseCtx); } catch (SAXException ex) { Logger.getLogger(Check.class.getName()).log(Level.SEVERE, null, ex); } catch (TikaException ex) { Logger.getLogger(Check.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("Mime: " + metadata.get(Metadata.CONTENT_TYPE)); return metadata.get(Metadata.CONTENT_TYPE); } Input is image file which is stored in hdfs in unknown format. Output I need the output as type of the file. But I am Getting TikaException and java Class not found exception for the above code. Error 2014-11-21 12:00:56,417 [main] INFO org.apache.pig.backend.hadoop.executionengi ne.mapReduceLayer.MapReduceLauncher - Failed! 2014-11-21 12:00:56,483 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 10 66: Unable to open iterator for alias f. Backend error : java.lang.ClassNotFound Exception: org.apache.tika.exception.TikaException PigScript a= load '/image.jpeg' as x; b= group a all; f= foreach b generate package.check(a) If anyone know the solution for above problem. Please guide me as soon as possible.
tagged with: apache-pig
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/34495085
type: Question
tagged with: apache-tika
has answer: http://stackoverflow.com/a/27595421
has title: To Create udf in pig for image processing
tagged with: hadoop
score: 2
answer count: 1

http://stackoverflow.com/q/27121592
has comment: http://stackoverflow.com/comment/42744148
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42745182
has title: Incorrect JSON format with Jackson and JaxB Annotation Module
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/42745148
has comment: http://stackoverflow.com/comment/42744742
has comment: http://stackoverflow.com/comment/42745047
tagged with: jackson
has comment: http://stackoverflow.com/comment/42744861
has body: Very weird problem with Jackson and JaxB Annotation. See the issue with incorrect JSON format. public interface All { } @XmlJavaTypeAdapter(value=AnyAdapter.class, type=Any.class) public interface Any { public boolean isKnown(); } @XmlJavaTypeAdapter(value=AnyAdapter.class, type=Any.class) public abstract class Known implements Any { @Override @XmlTransient public boolean isKnown() { return false; } public Known(String type) { super(); this.type = type; } String type; public String getType() { return type; } public void setType(String type) { this.type = type; } public abstract void validate(); } @XmlRootElement public class Resource extends Known implements All{ public Resource(Integer resourceId, String resourceName) { super("Resource"); this.resourceId = resourceId; this.resourceName = resourceName; } public Integer getResourceId() { return resourceId; } public void setResourceId(Integer resourceId) { this.resourceId = resourceId; } public String getResourceName() { return resourceName; } public void setResourceName(String resourceName) { this.resourceName = resourceName; } Integer resourceId; String resourceName; @Override public void validate() { } } @XmlRootElement public class ResourceList extends Known{ public ResourceList(String name) { super("ResourceList"); this.name = name; } List&lt;All&gt; resourceList; String name; @XmlElements({ @XmlElement(name="resource", type=Resource.class), }) public List&lt;All&gt; getResourceList() { return resourceList; } public void setResourceList(List&lt;All&gt; resourceList) { this.resourceList = resourceList; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public void validate() { } } public class JacksonJaxbAdapterImpl { public ObjectMapper initializeJackson() { ObjectMapper mapper = new ObjectMapper(); mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); mapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); mapper.configure(Serial…
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/42712140
comment on: http://stackoverflow.com/q/27104094
has text: what's line 21 in your application class
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27106361
tagged with: mysql
has comment: http://stackoverflow.com/comment/42718427
type: Question
tagged with: java
tagged with: hibernate
has title: Hibernate foreign key of type String issue
has comment: http://stackoverflow.com/comment/42716475
answer count: 1
has body: i am trying to connect two tables in a one to one mapping by declaring a first table column (of type String) as foreign key to the second table. So here are my main two hibernate entities: Primary entity StudyDetails: @Entity @Table(name="StudyDetails") public class StudyDetails { @Id @GeneratedValue(strategy = IDENTITY) @Column(name="Id") private Integer id; @Column(name="InternalID", unique = true, nullable = false) private String internalId; @Column(name="StudyInstanceUID", unique = true) private String studyInstanceUID; @Column(name="LastUploadedDate") @Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime") private DateTime lastUploadedDate; @Column(name="IsProcessed") private boolean isProcessed; @Column(name="IsUploaded") private boolean isUploaded; and the second one DicomSeriesMeta: @Entity @Table(name="DicomSeriesMeta") public class DicomSeriesMeta { @Id @GeneratedValue(strategy = IDENTITY) @Column(name="Id") private Integer id; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name="InternalID", referencedColumnName="InternalID") private StudyDetails studyDetails; public StudyDetails getStudyDetails() { return studyDetails; } public void setStudyDetails (StudyDetails studyDetails) { this.studyDetails = studyDetails; } @Column(name="PatientID") private String patientID; @Column(name="IssuerOfPatientID") private String issuerOfPatientID; @Column(name="PatientSex") private String patientSex; @Column(name="PatientName") private String patientName; @Column(name="PatientBirthDate") private String patientBirthDate; ... } I would like to have StudyDetails.InternalID as foreign key to table DicomSeriesMeta ... It is a unique id of type String generated with a particular algorithm. I am trying to save a DicomSeriesMeta object in database like: .... DicomSeriesMeta dicomSeriesMeta = new DicomSeriesMeta(); dicomSeriesMeta.setPatientID(patientID); dicomSeriesMeta.setIssuerOfPatientID(issuerOfPatientID); dicomSeriesMeta.setPatientSex(patientSex); dicomSerie…
has answer: http://stackoverflow.com/a/27106513
has comment: http://stackoverflow.com/comment/42716732
has comment: http://stackoverflow.com/comment/42716026
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42716546
has comment: http://stackoverflow.com/comment/42716650
tagged with: hibernate-mapping
has comment: http://stackoverflow.com/comment/42716231
score: 0

http://stackoverflow.com/comment/42523938
has text: getResource() in your example isn't the same as getResourceAsStream()
comment on: http://stackoverflow.com/a/26995760
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27020453
has answer: http://stackoverflow.com/a/27020568
has answer: http://stackoverflow.com/a/27020557
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27020514
tagged with: java
type: Question
has title: Having converting and getting data problems
score: 0
answer count: 3
has body: I wrote a program that calculates Acceleration. This is how it looks: http://prntscr.com/57yngo when you press that button it show a dialog message that is a part of JOptionPane. The data you enter in fields are Strings I convert them to double by doing : double name = Double.valueOf(String); The problem is if you inserted a String value instead of a double value in the fields you and pressed the button that sends the acceleration total the program badly crash. I really need a solution to fix that! If you said why did you set the inserted value as String I will answer that this is the only way to do the Textfieldname.gettext(); If you knew a way to get a double only from a text field please tell me it.
favorite count: 0

http://stackoverflow.com/comment/42570761
score: 0
has text: @AndreasWederbrand yes, but this controller has 10+ methods and I those methods can be (and will be) added with each new version. So I am looking for some better solution.
type: Comment
comment on: http://stackoverflow.com/q/27023299
type: QuestionComment

http://stackoverflow.com/comment/42583379
score: 0
type: AnswerComment
type: Comment
has text: @KickButtowski I thought you were talking about testing. I couldn't figure out why else you'd want to generate a random number for this problem.
comment on: http://stackoverflow.com/a/27030410

http://stackoverflow.com/q/27073240
score: 0
has answer: http://stackoverflow.com/a/27073449
accepted answer: http://stackoverflow.com/a/27073449
has title: Java file placement
possible better answer: http://stackoverflow.com/a/27073274
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42658469
tagged with: java
has body: When I learned Java, I put my all my files in the bin folder of my JDK folder. Then I compile my code in the command prompt I have to change the directory so that it goes to the bin folder. It looks like this:C:\Users\MdDaddyJr\Desktop\jdk1.7.0_51\bin&gt;. Have I been putting the files in the wrong place the whole time? I am not using any IDEs.
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42658474
has answer: http://stackoverflow.com/a/27073274
linked to: http://stackoverflow.com/q/533102

http://stackoverflow.com/comment/64896987
has text: I think you can try extents `DefaultAuthorizationRequest` to implement this method. But you need to deal with `OAuth2RequestFactory`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27035736
type: AnswerComment

http://stackoverflow.com/a/27141344
has body: Not sure of glassfish. But in our case, we have a series of commands in order to stop and restart a server. Do the following: Create a bat file say abc.bat containing commands like below: kill - all - tasks stop - server SLEEP 10 --&gt; Number of seconds taken by the server to stop. You can put more value for safety. start - myserver Create a java say ServerStopStart.java using process. Process p = Runtime.getRuntime().exec(TRIGGER_MY_BATCH_FILE); Using crontab or some other scheduling mechanism, schedule to run the ServerStopStart.java at mid-night or any other appropriate time when user load is NIL.
upvote count: 3
score: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27141248
accepted answer of: http://stackoverflow.com/q/27141248
type: Answer
downvote count: 1

http://stackoverflow.com/comment/42606854
comment on: http://stackoverflow.com/q/27043702
has text: It's unclear what you are asking, you use velocity to produce html markup in java which I presume you send to a client. What do you mean by **selected**? where does it happen?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42599084
has text: Documentation is key, when it comes to methods with a lot of arguments. When you introduce a new method for literally every argument, this does not improve things. Instead of having one method with many arguments you will have many methods with very little arguments. You are just shifting the problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/27035774
score: 0
type: Comment

http://stackoverflow.com/q/26998984
possible better answer: http://stackoverflow.com/a/26999181
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26999181
upvote count: 1
has answer: http://stackoverflow.com/a/26999077
accepted answer: http://stackoverflow.com/a/26999077
favorite count: 0
has comment: http://stackoverflow.com/comment/42528254
has body: Is there any other class which and be use like java.util.stream.IntStream (of java 8) in java 6 I wanted to achieve List&lt;Integer&gt; list = IntStream.of(intArray).boxed().collect(Collectors.toList()); how it is possible in java 6 or below
downvote count: 0
has title: is IntStream class in JDK 1.6?
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/42672666
type: AnswerComment
has text: Thanks for the link, this makes sense: "As I mentioned before the class’ body is the primary constructor"
type: Comment
comment on: http://stackoverflow.com/a/27081560
score: 0

http://stackoverflow.com/a/27038698
type: Answer
has comment: http://stackoverflow.com/comment/42597399
answers question: http://stackoverflow.com/q/27038321
upvote count: 1
has body: You should compare strings : string front = getActivity().getResources().getString(R.string.fc_front); string back = getActivity().getResources().getString(R.string.fc_back); if (answerText.getText().toString().compareTo (front) == 0 ) { //do something } else if (answerText.getText().toString().compareTo (back) == 0 ) { // do something else } Do not compare strings using equals, use compareTo instead. You should remove the switch case and use this if/else instead.
score: 1
has comment: http://stackoverflow.com/comment/42597314
has comment: http://stackoverflow.com/comment/42611778
downvote count: 0

http://stackoverflow.com/comment/42768628
has text: Ok Greg, but I haven't got where I should bind this snippet. Should I create a new class? Or include it in the Part's class? Thanks
type: Comment
comment on: http://stackoverflow.com/a/27134021
type: AnswerComment
score: 0

http://stackoverflow.com/q/27054628
tagged with: android-viewpager
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42626620
has body: I am writing an application where I using PageViewer to show infinite client using solution available here. In my case I have to update this already added child from other event say from [onPageState][2], using following code: PageFragment scr = (PageFragment) mPagerAdapter.getItem(mPager.getCurrentItem()); but it returning IllegalStateException that say, Fragment already Active. I checked with this but I am not getting it. EDIT: Fragment child add code: It's at very beginning, I create first list of fragment: for (int i = 0; i &lt; 5 ; i++) { PageFragment fragment = new PageFragment(); Bundle bundle = new Bundle(); bundle.putInt("page", i); fragment.setArguments(bundle); pageList.add(fragment); } EDIT2: Here the line fragment.setArguments(..) causing error, why? and this is adapter implementation: private class PagerAdapter extends FragmentStatePagerAdapter { public PagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { int _pos = position % 5; PageFragment fragment = pageList.get(_pos); Bundle bundle = new Bundle(); bundle.putInt("page", position); fragment.setArguments(bundle); return fragment; } @Override public int getCount() { return MAX_CARD_PAGES; } } Any suggestion.
tagged with: android
has title: java.lang.IllegalStateException: Fragment already active at View Pager
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42625887
linked to: http://stackoverflow.com/q/29194026
tagged with: android-fragments
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/54157924
linked to: http://stackoverflow.com/q/18588944
upvote count: 1

http://stackoverflow.com/a/27109427
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27109031
score: 1
downvote count: 0
has body: (moved from comment, since it seemed to be helpful) Add a private method and call it from both case 1 and default, that way you won't have duplicated code.

http://stackoverflow.com/q/27028878
type: AnsweredQuestion
tagged with: instance
tagged with: android-fragments
tagged with: java
has title: How Can newInstance() Work If There Is No Constructor Written?
type: Question
tagged with: instantiation
has body: I've come across an interesting snippet of Java code. I researched what newInstance() is, and it's meant to be a way to avoid calling a constructor and create a new instance of an object. But looking at the example code I don't understand one thing: Why is there no constructor needed? public class SimpleContentFragment extends WebViewFragment { protected static SimpleContentFragment newInstance(String file) { SimpleContentFragment f=new SimpleContentFragment(); Bundle args=new Bundle(); args.putString(KEY_FILE, file); f.setArguments(args); return(f); } } No where else in this code is there a constructor created. There is no public SimpleContentFragment() { // Required empty public constructor } as I would expect. So could you clarify what is going on in the static method with newInstance? How come it can call new SimpleContentFragment() when the constructor was never written?
has answer: http://stackoverflow.com/a/27028911
score: 0
answer count: 1
tagged with: android
accepted answer: http://stackoverflow.com/a/27028911

http://stackoverflow.com/q/27107449
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42718168
score: -2
has comment: http://stackoverflow.com/comment/42718269
has answer: http://stackoverflow.com/a/27107675
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/42718822
favorite count: 0
tagged with: android
has title: Extract JSON TypeMismatch Error Message
has comment: http://stackoverflow.com/comment/42718237
has body: I was having some problem when trying to extract data from JSON. Basically, this is my JSON format: http://www.onemap.sg/API/services.svc/route/solve?token=qo/s2TnSUmfLz+32CvLC4RMVkzEFYjxqyti1KhByvEacEdMWBpCuSSQ+IFRT84QjGPBCuz/cBom8PfSm3GjEsGc8PkdEEOEr&amp;routeStops=18304.68,36152.73;27985.4,34115&amp;routemode=DRIVE&amp;avoidERP=0&amp;routeOption=shortest And here is the codes: public void getDirection(Event eventModel){ String eventX = eventModel.getEventX(); Log.i("X", eventX); String eventY = eventModel.getEventY(); Log.i("Y", eventY); SimpleLineSymbol lineSymbol = new SimpleLineSymbol( Color.GREEN, 3, SimpleLineSymbol.STYLE.DASH); List pointArr = null; String page; JSONArray jsonArray; try { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("http://www.onemap.sg/API/services.svc/route/solve?token=qo/s2TnSUmfLz+32CvLC4RMVkzEFYjxqyti1KhByvEacEdMWBpCuSSQ+IFRT84QjGPBCuz/cBom8PfSm3GjEsGc8PkdEEOEr&amp;routeStops=18304.68,36152.73;" + eventX + "," + eventY + "&amp;routemode=DRIVE&amp;avoidERP=0&amp;routeOption=shortes"); HttpResponse response = client.execute(request); HttpEntity entity = response.getEntity(); String responseString = EntityUtils.toString(entity, "UTF-8"); page = responseString ; try { JSONObject jsonObject = new JSONObject(page); jsonArray = jsonObject.getJSONArray("routes"); Log.i("Array", jsonArray.toString()); JSONObject features = jsonArray.getJSONObject(3); //String geometry = features.getString("geometry"); JSONArray paths = features.getJSONArray("paths"); int length = paths.length(); for (int i = 0; i &lt; length; i++) { JSONObject attribute = paths.getJSONObject(i); String path = attribute.getString("paths"); pointArr.add(path); /*path = path.replace("\"", ""); path = path.replace("\"", ""); String[] arr = path.split(";"); for (int j = 0; j &lt; arr.length; j++) { String[] point = arr[j].split(","); pointArr.add(point); }*/ } Graphic lineGraphic = new Graphic((Geometry) pointArr, lineSymbol); graphicsLayer.addGrap…
upvote count: 0
has comment: http://stackoverflow.com/comment/42718210

http://stackoverflow.com/a/27092874
accepted answer of: http://stackoverflow.com/q/27092828
has comment: http://stackoverflow.com/comment/42692852
has comment: http://stackoverflow.com/comment/42691761
answers question: http://stackoverflow.com/q/27092828
has comment: http://stackoverflow.com/comment/42692901
has comment: http://stackoverflow.com/comment/42693192
has comment: http://stackoverflow.com/comment/42692450
has comment: http://stackoverflow.com/comment/42692728
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42692742
upvote count: 2
has comment: http://stackoverflow.com/comment/42692124
has comment: http://stackoverflow.com/comment/42692419
type: Answer
has body: It is expected. From what your class says, the JSON should look like: { "CODE": "012", "USER": { "MT_TIME": "1412882760", "MT_VALUE": "319", } } But the user field in the JSON you showed is inside an array. If this means that what you expect is a list of users instead of just one user, then replace your field in the POJO with a List&lt;User&gt;; otherwise, fix the JSON.
score: 2

http://stackoverflow.com/comment/42539041
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27004423
has text: If you could put the full class here that would make solving much quicker, rather than changing it bit by bit
score: 0

http://stackoverflow.com/a/27107136
has comment: http://stackoverflow.com/comment/42732768
has comment: http://stackoverflow.com/comment/42733616
score: 1
has body: If you want all records from the table, just do "Select * from table". The only reason to retrieve in chunks is if there is some intermediate place for the data: e.g. if you are showing it on the screen, or storing it in memory. If you are simply reading from one and inserting to another, just read everything from the first.You will not get any better performance by trying to retrieve in batches. If there is a difference, it will be negative. Frame your query in a way that brings back everything. The JDBC software will handle all the other breaking-up and reconstituting that you need. However, you should batch the update/insert side of things. The set-up would create two statements on the two connections: Statement stmt = null; ResultSet rs = null; PreparedStatement insStmt = null; stmt = conDb1.createStatement(); insStmt = conDb2.prepareStament("insert into tgt_db2_table (?,?,?,?,?......etc. ?,?) "); rs = stmt.executeQuery("select * from src_db1_table"); Then, loop over the select as normal, but use batching on the target. int batchedRecordCount = 0; while (rs.next()) { System.out.println(rs.getString("MyColumn")); //Here you read values from the cursor and set them to the insStmt ... String field1 = rs.getString(1); String field2 = rs.getString(2); int field3 = rs.getInt(3); //--- etc. insStmt.setString(1, field1); insStmt.setString(2, field2); insStmt.setInt(3, field3); //----- etc. for all the fields batchedRecordCount++; insStmt.addBatch(); if (batchRecordCount &gt; 1000) { insStmt.executeBatch(); } } if (batchRecordCount &gt; 0) { //Finish of the final (partial) set of records insStmt.executeBatch(); } //Close resources...
downvote count: 0
has comment: http://stackoverflow.com/comment/42727212
has comment: http://stackoverflow.com/comment/42728545
has comment: http://stackoverflow.com/comment/42723153
answers question: http://stackoverflow.com/q/27070310
has comment: http://stackoverflow.com/comment/42729057
has comment: http://stackoverflow.com/comment/42731269
type: Answer
has comment: http://stackoverflow.com/comment/42721874
has comment: http://stackoverflow.com/comment/42727006
upvote count: 1
has comment: http://stackoverflow.com/comment/42768866

http://stackoverflow.com/comment/42667180
has text: You just have one thread or expecting more and are you sure you want static method's?
type: QuestionComment
comment on: http://stackoverflow.com/q/27078481
type: Comment
score: 2

http://stackoverflow.com/q/27092632
type: UnansweredQuestion
tagged with: rest
has title: Jax-rs 405 error on put
tagged with: http://stackoverflow.com/tag/html
tagged with: jax-rs
has body: I use this method to update some resource @PUT @Path("/Updatemember/{nom}/{ape}/{afi}/{nac}") @Produces(MediaType.TEXT_PLAIN) public String Updatemember(@PathParam("nom")String nombre, @PathParam("ape")String apellido, @PathParam("afi")String afiliacion, @PathParam("nac")String nacionalidad) throws SQLException { Miembro.update(nombre, apellido, afiliacion, nacionalidad); return "Se han actualizado los datos del miembro"; } But i get a 405 error when i try to invoke it .Should I pass the parameters on the path or how I should do to make it work? If I use @GET instead of @PUT works correctly.
type: Question
has comment: http://stackoverflow.com/comment/42700223
tagged with: put
has comment: http://stackoverflow.com/comment/42691597
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42693601
answer count: 0

http://stackoverflow.com/q/27090344
type: AnsweredQuestion
downvote count: 0
type: Question
has title: Java - Internalisation issue
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27090403
has body: I have been given the following code in order to internationalise a program, allowing me to use multiple languages depending on what the user chooses. import java.util.*; public class I18NSample { static public void main(String[] args) { String language, country; if (args.length != 2) { // default is English-language language = new String("en"); country = new String("US"); } else { language = new String(args[0]); country = new String(args[1]); } Locale currentLocale = new Locale(language, country); ResourceBundle messages = ResourceBundle.getBundle("MessagesBundle", currentLocale); System.out.println(messages.getString("greetings")); System.out.println(messages.getString("inquiry")); System.out.println(messages.getString("farewell")); } } This is my MessagesBundle file: greetings = Hello. farewell = Goodbye. inquiry = How are you? However when implementing this code in my program, I am not able to use the messages.getString function in other classes, and I need this code in my main as it takes String[] arguments. Is there anyway around this?
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42698288
has comment: http://stackoverflow.com/comment/42687606
favorite count: 0
has answer: http://stackoverflow.com/a/27090401
accepted answer: http://stackoverflow.com/a/27090401
has answer: http://stackoverflow.com/a/27090403

http://stackoverflow.com/comment/42628037
type: Comment
comment on: http://stackoverflow.com/a/27039519
type: AnswerComment
has text: This a good start. And I probably will post a follow up question on how to measure certain things. But what I might like to see in an answer to this question, is more detail on the RMI thread. Why exactly these threads produce so much objects. Can it be disabled. What exactly is its purpose...
score: 0

http://stackoverflow.com/q/27037358
upvote count: 1
score: 1
tagged with: java
tagged with: eclipse
type: Question
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
has body: I am using Eclipse Mars and working on my Semester J2EE Project , Many times when i start eclipse the WEB.XML get empty and a null pointer error is shown,And only this shows : &lt;xml&gt;... Fortunately i saved all XML entries into a different notepad file and i copy paste all from there, But it's happening only with that project not with other's, it's almost 3 month i am working on the application so can't delete or modify it ... Please help if someone having the Same Problem ...
has title: Web.xml data getting deleted Automatically from eclipse Mars Project folder

http://stackoverflow.com/comment/42768091
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27134873
has text: Looks like your team is trying to reduce memory usage. Apart of that, I'm not aware what else could be.

http://stackoverflow.com/a/27018158
score: 2
answers question: http://stackoverflow.com/q/27013866
downvote count: 0
type: AcceptedAnswer
has body: The main thing you need to consider is whether you'll need to shard at all. The entire StackExchange network (not just StackOverflow -- all the network) runs off of 2 Redis servers (one of which I'm pretty sure only exists for redundancy), which it uses very aggressively. Take a look at http://nickcraver.com/blog/2013/11/22/what-it-takes-to-run-stack-overflow/ Redis is absurdly fast (and remarkably space-efficient), with only one caveat: deleting an entire list/set/sorted set/hash is O(n), where n is the number of elements it contains. As long as you don't do that (operations like RPOP, BRPOP, BRPOPLPUSH, etc. don't count -- those are constant time), you should be golden. TLDR: Unless you're planning to go bigger than StackOverflow, you won't need to shard, especially for a simple job queue.
upvote count: 2
has comment: http://stackoverflow.com/comment/42563656
type: Answer
accepted answer of: http://stackoverflow.com/q/27013866

http://stackoverflow.com/comment/43158708
type: Comment
comment on: http://stackoverflow.com/a/27262908
type: AnswerComment
has text: I have been following the advice you have given me but came across a problem. For console menu, I need it to be more in depth e.g. 1. Create account. And within that is where you input account id, account name etc. I been told I should use switch, do, while.
score: 0

http://stackoverflow.com/a/27020576
type: Answer
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27018494
has body: No, you don't want to inject an instance into the servlet. Instead, you can use the @EJB annotation on the servlet class itself to declare a reference without injecting: @EJB(name="LoginRemote", beanInterface = LoginRemote.class) public class MyServlet { You can use @EJBs if you want to declare multiple references in the same servlet. (Note that when using the annotation on a field as in your example, the beanInterface parameter is redundant with the field type, but it is required when using the class-level annotation class.)
answers question: http://stackoverflow.com/q/27018494

http://stackoverflow.com/comment/42536750
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27003551
has text: If you're having a problem sending an image, then include the code that sends the image! (not just the code that reads it). Also an Image is very definitely not encoded with "ISO-8859-1"!

http://stackoverflow.com/q/27129969
has comment: http://stackoverflow.com/comment/42760232
has body: I've got a set of JAXB generated classes and some of the classes have setter methods which accepts "Object" as the parameter. For example: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name="Car", propOrder = { "defaultCar" } public class Car { @XmlElement(name = "DefaultCar") protected Object defaultcar; public void setDefaultCar(Object value) { this.defaultCar = value; } After I've created instances of these classes in my code, I call the setter methods passing in the required value. Although the method's parameter is Object, the values are most likely to be strings (I've got no control over how it is defined). However, to keep things consistent, I cast the string to Object so that it matches the method's parameter type. The code looks something like this: Object value = "Old Banger"; Method method = aCar.getClass().getMethod("setDefaultCar", Object.class); method.invoke(aCar, value); When I marshall the Java objects, I get the following within the resulting XML, just in front of the value of the string: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" I've read somewhere about mismatching data types between the method's parameter type and what has been passed to it. In my case the method parameter being "Object" but I'm passing in a string to it (although I've cast it to Object). I've also seen this post and it looks similar to my problem: "xsi:type" and "xmlns:xsi" in generated xml by JAXB However, it doesn't help me overcome my problem. Is there a way to remove these references to xmlns:xsi and xsi:type? Thx
has answer: http://stackoverflow.com/a/27131830
linked to: http://stackoverflow.com/q/20679163
score: 7
tagged with: eclipse
answer count: 3
upvote count: 7
tagged with: moxy
favorite count: 0
has answer: http://stackoverflow.com/a/27132335
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42761334
has title: How to remove xmlns:xsi and xsi:type from JAXB marshalled XML file
tagged with: jaxb
has answer: http://stackoverflow.com/a/27130402
type: Question

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

http://stackoverflow.com/a/27143998
score: 0
type: Answer
has body: Try below regex : ((\$|£)\d+\s|(\$|£)\d+-(\$|£)\d+\s)
answers question: http://stackoverflow.com/q/27130897

http://stackoverflow.com/q/27065118
has comment: http://stackoverflow.com/comment/42645075
tagged with: nosql
upvote count: 2
answer count: 2
has body: I use my logs to extract very useful information like: In this period of time how many are the users of my application ? Or in this period of time, what type of services are called the most ? Almost all the information I extract depend on the time-stamp so I wonder if it is a good idea to use it as index? I wonder also which type of database I use to store my logs? I need a high performance for writing but I also need a good execution time for my analysis. Note that if I add time-stamp as index for 80GB, indexes size will be 12GB. Thanks for helping.
tagged with: indexing
has comment: http://stackoverflow.com/comment/42644897
has answer: http://stackoverflow.com/a/27065213
tagged with: java
has title: Is it a good idea to use the timestamp as an index for loggings?
type: UnansweredQuestion
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27069041
type: Question

http://stackoverflow.com/comment/111008266
comment on: http://stackoverflow.com/q/27112024
score: 0
has text: You can't reuse an `HttpURLConnection`. You have to create a new one.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26996617
downvote count: 0
answers question: http://stackoverflow.com/q/26996517
has comment: http://stackoverflow.com/comment/42524121
has comment: http://stackoverflow.com/comment/42526352
has body: you can save that option in SharedPreference and in your MainActivity's onCreate method change for saved value and then you can finish() your MainActivity and start SecondActivity put this in your onCreate method: SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); if (sharedPreferences.getBoolean("startFromSecondActivity", false)) { Intent intent = new Intent(this, SecondActivity.class); startActivity(intent); finish(); } and put this in your Button's onClick method : SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean("startFromSecondActivity", true); editor.commit();
type: Answer
has comment: http://stackoverflow.com/comment/42538998
has comment: http://stackoverflow.com/comment/42539799
score: 3
accepted answer of: http://stackoverflow.com/q/26996517
upvote count: 3
has comment: http://stackoverflow.com/comment/42995705
has comment: http://stackoverflow.com/comment/47847424
has comment: http://stackoverflow.com/comment/42526481
type: AcceptedAnswer

http://stackoverflow.com/comment/42618817
type: QuestionComment
score: 1
has text: Yes it's because if one of the part contains a number, you set your boolean variable to true. Your better bet is probably to set firstHalf and secondHalf as true, then in your for loop if it's not a number, set the boolean variable to false and break the loop. If you are familiar with regular expressions, you could use matches with a regex saying "match 4 digits - 4 digits"
comment on: http://stackoverflow.com/q/27050681
type: Comment

http://stackoverflow.com/a/27000810
has comment: http://stackoverflow.com/comment/42532116
has comment: http://stackoverflow.com/comment/42532214
score: 1
has comment: http://stackoverflow.com/comment/42535546
has comment: http://stackoverflow.com/comment/42535798
has body: Here is your merged function readAndWrite(): public static void readAndWrite() { FileReader fileReader = null; BufferedReader bufferedReader = null; FileOutputStream outputStream = null; PrintWriter printWriter = null; String InputFileName, OutputFileName; String nextLine; clrscr(); // Prompt user for input filename System.out.println("Please enter the name of the file that is to be READ (e.g. aFile.txt: "); InputFileName = Genio.getString(); // Prompt user for output filename System.out.println("Please enter the name of the file that is to be WRITTEN (e.g. bFile.txt: "); OutputFileName = Genio.getString(); try { // Open input file fileReader = new FileReader(InputFileName); bufferedReader = new BufferedReader(fileReader); // Open output file outputStream = new FileOutputStream(OutputFileName); printWriter = new PrintWriter(outputStream); // Read a line nextLine = bufferedReader.readLine(); // While there are lines in the input file while (nextLine != null) { // Print it to screen System.out.println(nextLine); // Write it to the output file + a new-line printWriter.write(nextLine+"\n"); // Read a line nextLine = bufferedReader.readLine(); } // Close the input file bufferedReader.close(); // Close the output file printWriter.close(); } catch (IOException e) { System.out.println("Sorry, there has been a problem opening or reading from the file"); e.printStackTrace(); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { System.out.println("An error occurred when attempting to close the file"); } } if(printWriter != null) { printWriter.close(); } } } Let me know whether it works or not Happy coding :) -Charlie
has comment: http://stackoverflow.com/comment/42532308
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42532601
has comment: http://stackoverflow.com/comment/42532177
answers question: http://stackoverflow.com/q/27000019
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27000019

http://stackoverflow.com/comment/42595182
score: 0
comment on: http://stackoverflow.com/q/27035200
has text: @Mourice with mine i want the button to stay pressed/selected untill another button is clicked then it returns to it normal state
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42621438
has text: I dont know how to term this, but I am using swing controls in netbeans. mySpinnerControl is my swing control with that variable name. I get the control at the pallete pane of netbeans..
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27035299

http://stackoverflow.com/comment/42622956
type: Comment
type: QuestionComment
has text: Is the recursive call that fails calculatePath?
comment on: http://stackoverflow.com/q/27052898
score: 0

http://stackoverflow.com/a/27054913
has body: Just an overview: An object represents a real life entity lets say for example a car, A car has some properties like it has wheels,a steering,a gearbox and much more, the same way it has some behaviors like it moves forward, steers left, steers right and it stops. All the things mentioned above related to the car when brought down to an Object oriented programming approach will look like, We make a class Car and the properties(wheels,a steering,a gearbox etc) are defined as variables inside that class and the behaviors(moves forward, steers left, steers right) are defined as functions in that class.There's no hard and fast rule relating OOP you just have to make it feel logically as Real Life as possible for instance in your case the Subscription Class has all the information related to the subscription and the Customer has a subscription so the viewSubscription()method should come inside Customer Class as a Private field because it should fetch and display the subscription information related to a particular customer. modifyCustomer() as it involves modifying the data fields of the Customer class so this too will come inside the customer class as all the modification of the field values should probably be done inside the class containing the fields.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27054064
upvote count: 1

http://stackoverflow.com/comment/42773833
has text: Helping would indeed be easier if you mentioned which part of the process gives you trouble - downloading the file when you get to it? Traversing remote directiories? Traversing recursively? Preserving folder structure?
comment on: http://stackoverflow.com/q/27137447
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42700127
score: 0
has text: it is not `docType` it is `dogType`.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27097435

http://stackoverflow.com/q/27138952
tagged with: java
score: 0
answer count: 1
has body: In my mobile application I wish to start programatically an Fragment over parent activity. For this in my activity class I use for OnClickListener anonym instance (for some button) this code: fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(android.R.id.content, settingsFragment); fragmentTransaction.commit(); Class of my fragment extends android.support.v4.app.Fragment. In xml file from res/layout folder I use RelativeLayout. Finally I want to look like in below drawing. The problem is that when it starts fragment covering the entire screen, that parent activity. How do I resize as desired?
has answer: http://stackoverflow.com/a/27138994
has title: Resizing dimensions of the fragment
type: UnansweredQuestion
tagged with: android
tagged with: android-activity
type: Question
tagged with: android-layout
tagged with: android-fragments

http://stackoverflow.com/comment/42832814
type: QuestionComment
comment on: http://stackoverflow.com/q/27151043
has text: ok, you have `socketService = ...` in `onServiceConnected`, right? this is line 84 in you pastebin output, then in the very next line call `createPlayer(playerName)` - it will be line 85, i don't know where playerName comes from you need to get it from somewhere, probably from Intent extras as your code says
score: 0
type: Comment

http://stackoverflow.com/a/27202391
type: Answer
has comment: http://stackoverflow.com/comment/42986582
has body: The easiest way I've found to debug these kinds of things is to get a GLProfile and print it as a string -- this way, you can easily see whether or not your system actually supports a specific version. You can do this with something like: GLProfile glp = GLProfile.get(GLProfile.GL3); final GLCapabilitiesImmutable glcaps = (GLCapabilitiesImmutable) new GLCapabilities(glp); final GLCapabilities tGLCapabilities = new GLCapabilities(glp); System.out.println("System Capabilities:" + glcaps.toString()); System.out.println("Profile Details: " + glp.toString()); System.out.println("Is GL3 Supported?: " + glp.isGL3());
answers question: http://stackoverflow.com/q/27129846
score: 0

http://stackoverflow.com/q/27152110
has answer: http://stackoverflow.com/a/27152219
has body: Suppose I have an abstract class public abstract class Foo and a single constructor public Foo() { } Given that this constructor must have been called from the construction of a child class, is there a way of recovering the name of that child class within the Foo constructor? I'd rather not do something evil with the stack trace.
favorite count: 0
has comment: http://stackoverflow.com/comment/42798824
accepted answer: http://stackoverflow.com/a/27152243
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27152219
has answer: http://stackoverflow.com/a/27152307
tagged with: java
has answer: http://stackoverflow.com/a/27152156
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27152551
has answer: http://stackoverflow.com/a/27152243
has title: Getting the name of a child class within the base class constructor
downvote count: 0
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/27152492

http://stackoverflow.com/comment/42766432
type: QuestionComment
has text: Highly advise against generating images in servlets. The image should already exist on the file system or in a database; not only is it inefficient to do this in the servlet, but some servers do not have graphics cards or a GraphicsEnvironment, so your graphics operations may fail.
comment on: http://stackoverflow.com/q/27133851
score: 0
type: Comment

http://stackoverflow.com/q/27001554
has comment: http://stackoverflow.com/comment/42533180
has title: Java generics list
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42533370
tagged with: generics
type: AnsweredQuestion
has body: I know following is true. List&lt;? extends Number&gt; aNumberSuperList = new ArrayList&lt;&gt;(); List&lt;? extends Integer&gt; aIntegerSuperList = new ArrayList&lt;&gt;(); aNumberSuperList = aIntegerSuperList; But what type of objects can be added to such a list. List&lt;? extends Number&gt; aNumberSuperList2 = new ArrayList&lt;&gt;(); aNumberSuperList2.add(???)
has answer: http://stackoverflow.com/a/27001650
accepted answer: http://stackoverflow.com/a/27001650
type: Question
linked to: http://stackoverflow.com/q/2776975
has comment: http://stackoverflow.com/comment/42533122
has comment: http://stackoverflow.com/comment/42534316
tagged with: java
has comment: http://stackoverflow.com/comment/42533112

http://stackoverflow.com/comment/42690590
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27081920
has text: I'm on Mac OS X 10.8. I've tried the one for Linux and it gave the same result as before.
score: 0

http://stackoverflow.com/a/28318640
answers question: http://stackoverflow.com/q/27125051
accepted answer of: http://stackoverflow.com/q/27125051
score: 0
type: AcceptedAnswer
has body: I did it through Word Macro itself. Was easier. Bloew code should give you an idea : Sub iterateNumberedList() Dim oList As Paragraph Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst ' go to beginning of doc ' for each paragraph For Each oList In ActiveDocument.Paragraphs ' is it a numbered list of level 1 ? If oList.Range.ListFormat.ListType = 4 And oList.Range.ListFormat.ListLevelNumber = 1 Then ' move one line above list item Selection.MoveUp unit:=wdLine, Count:=1 ' insert heading text Selection.Range.Text = "Heading " &amp; vbCr ' format heading text with style 'Heading 1' Selection.Range.Style = "Heading 1" ' move down two paragraphs Selection.MoveDown unit:=wdParagraph, Count:=2 End If Next End Sub
type: Answer

http://stackoverflow.com/comment/42593471
type: AnswerComment
comment on: http://stackoverflow.com/a/27036307
has text: @StanislavLukyanov wrong, you can; you just have to remind that varargs is just a syntactic sugar for an array
type: Comment
score: 0

http://stackoverflow.com/q/27037089
has comment: http://stackoverflow.com/comment/42594644
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42594348
has answer: http://stackoverflow.com/a/27037324
score: 0
tagged with: multithreading
has body: public class server implements Runnable { private static final int initialize_server_Port = 8080 ; private static final int store_server_Port = 8181; private static final int search_server_Port = 8282; private static String tname ; private static InetAddress address ; protected static Hashtable&lt;String , InetAddress&gt; file_location = new Hashtable&lt;String ,InetAddress&gt;(); server(String tname){ this.tname = tname ; } public void run(){ try{ if("storeRecords".equals(tname)) storeRecord();}catch(IOException e ){ System.out.println("error: unable to create store socket"); } try{ if("searchRecords".equals(tname)) searchRecord();}catch(IOException e){ System.out.println(e); } // if("search".equals(tname)) // searchRecord(); } public void start(){ Thread thread = new Thread(this , tname ); thread.start(); } public static void storeRecord() throws IOException{ System.out.println("store out"); DatagramSocket serverSocket = new DatagramSocket(store_server_Port); byte[] receiveData = new byte[1024]; byte[] sendData = new byte[1024]; while(true){ DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); serverSocket.receive(receivePacket); String file = new String( receivePacket.getData()); file = file.trim(); System.out.println("RECEIVED: " + file); InetAddress IPAddress = receivePacket.getAddress(); address = IPAddress; int port = receivePacket.getPort(); System.out.println(file); file_location.put(file , IPAddress); String confirmation= "Successfully uploaded"; sendData = confirmation.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port); serverSocket.send(sendPacket); } } public static void searchRecord() throws IOException{ System.out.println("search out"); byte[] receiveData = new byte[1024]; byte[] sendData = new byte[1024]; DatagramSocket serverSocket = new DatagramSocket(search_server_Port); while(true){ DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);…
answer count: 1
accepted answer: http://stackoverflow.com/a/27037324
has title: Java - creating threads for different tasks
has comment: http://stackoverflow.com/comment/42594455
tagged with: java

http://stackoverflow.com/a/27189211
type: Answer
answers question: http://stackoverflow.com/q/27138188
has comment: http://stackoverflow.com/comment/42898095
has comment: http://stackoverflow.com/comment/42877215
accepted answer of: http://stackoverflow.com/q/27138188
score: 0
type: AcceptedAnswer
has body: I think the easiest solution is to explicitly check the source and target rows as white pawns can only move two forward from the second rank, so your logic becomes (for white): if( sourceRow+1 == targetRow || sourceRow == 2 &amp;&amp; targetRow == 4) { Obviously you will also need to check that (sourceColumn, 3) is also empty.
has comment: http://stackoverflow.com/comment/42887059

http://stackoverflow.com/a/45506857
has comment: http://stackoverflow.com/comment/96879286
score: 25
has body: Ok, so following a chat with Google engineering and after reading the code I've reached the following conclusions. Passing binary data efficiently is impossible It is impossible to pass binary data efficiently between JavaScript and Java through a @JavascriptInterface: On the Java side: @JavascriptInterface void onBytes(byte[] bytes) { // bytes available here } And on the JavaScript side: var byteArray = new Uint8Array(buffer); var arr = new Uint8Array(byteArray.length); for(var i = 0; i &lt; byteArray.length; i++) { arr[i] = byteArray[i]; } javaObject.onBytes(arr); In the code above (from my old answer) and in Alex's - the conversion performed for the array is brutal: case JavaType::TypeArray: if (value-&gt;IsType(base::Value::Type::DICTIONARY)) { result.l = CoerceJavaScriptDictionaryToArray( env, value, target_type, object_refs, error); } else if (value-&gt;IsType(base::Value::Type::LIST)) { result.l = CoerceJavaScriptListToArray( env, value, target_type, object_refs, error); } else { result.l = NULL; } break; Which in turn coerces every array element to a Java object: for (jsize i = 0; i &lt; length; ++i) { const base::Value* value_element = null_value.get(); list_value-&gt;Get(i, &amp;value_element); jvalue element = CoerceJavaScriptValueToJavaValue( env, value_element, target_inner_type, false, object_refs, error); SetArrayElement(env, result, target_inner_type, i, element); So, for a 1024 * 1024 * 10 Uint8Array - ten million Java objects are created and destroyed on each pass resulting in 10 seconds of CPU time on my emulator. Creating an HTTP server One thing we tried was creating an HTTP server and POSTing the result to it via an XMLHttpRequest. This worked - but ended up costing about 200ms of latency and also introduced a nasty memory leak. MessageChannels are slow Android API 23 added support for MessageChannels, which can be used via createWebMessageChannel() as shown in this answer. This is very slow, still serializes with GIN (like the @JavascriptInter…
downvote count: 0
has comment: http://stackoverflow.com/comment/96878171
answers question: http://stackoverflow.com/q/27034897
has comment: http://stackoverflow.com/comment/96877479
has comment: http://stackoverflow.com/comment/94331205
has comment: http://stackoverflow.com/comment/88315495
upvote count: 25
has comment: http://stackoverflow.com/comment/88323370
has comment: http://stackoverflow.com/comment/123400884
has comment: http://stackoverflow.com/comment/96883139
has comment: http://stackoverflow.com/comment/105531029
has comment: http://stackoverflow.com/comment/123247248
has comment: http://stackoverflow.com/comment/88334787
has comment: http://stackoverflow.com/comment/107052454
has comment: http://stackoverflow.com/comment/77974406
type: Answer
has comment: http://stackoverflow.com/comment/123247459

http://stackoverflow.com/comment/42653710
has text: you want to get an item from table or what? could u be specific
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27067488
type: Comment

http://stackoverflow.com/q/27092522
has comment: http://stackoverflow.com/comment/42691178
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: graphics
tagged with: java
tagged with: drawstring
has comment: http://stackoverflow.com/comment/42691351
has comment: http://stackoverflow.com/comment/42691432
score: 0
tagged with: newline
has title: How to get drawStrings on new lines
has body: So, I have this String(snippet below) which has a fair amount of information highscoreString += (i + 1) + ".\t\n" + scores.get(i).getName() + "\t\t\n" + scores.get(i).getScore() + "\n"; which is inside this method public String getHighscoreString() { String highscoreString = ""; int max = 10; ArrayList&lt;Score&gt; scores; scores = getScores(); int i = 0; int x = scores.size(); if (x &gt; max) { x = max; } while (i &lt; x ) { highscoreString += (i + 1) + ".\t\n" + scores.get(i).getName() + "\t\t\n" + scores.get(i).getScore() + "\n"; i++; } return highscoreString; } And what I am trying to do, is put that information in a g.drawString(); which I can do easily, but what I cannot do is, to go onto a new line once it gets to the end of that highscoreString(first snippet shown). This is what I've done so far using the g.drawString() method g.setFont(new Font("Century Gothic", Font.BOLD, 10)); g.drawString("" + hsm.getHighscoreString(), 40, 310); Even if I put \n at the end of the highscoreString, it wont end the line... I'm aware of the fact that I can use this method to make new lines void drawString(Graphics g, String text, int x, int y) { for (String line : text.split("\n")) g.drawString(line, x, y += g.getFontMetrics().getHeight()); } But, how would I be able to split the highscoreString?

http://stackoverflow.com/a/27082632
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27079644
score: 1
has body: One way to determine if it's array bounds checking, or at least determine if array bounds checking is part of the problem, would be to remove some of the index calculations. For example: static void floyd_warshallSingle() { int i, j, k; for (k = 0; k &lt; n; ++k) { var distk = dist[k]; for (i = 0; i &lt; n; ++i) { var disti = dist[i]; for (j = 0; j &lt; n; ++j) if ((i != j) &amp;&amp; (disti[k] * distk[j] != 0)) if ((disti[j] == 0) || disti[k] + distk[j] &lt; disti[j]) disti[j] = disti[k] + distk[j]; } } } Here all I've done is use distk as a reference to dist[k]. I suspect the compiler is already doing that optimization, which is likely how you realized the performance gain you got when you went from a rectangular array to a jagged array. But it's worth checking out. Also, you said that you're running without the debugger attached. I assume you're also running a release build? And are all three programs (C++, Java, and C#) running the same bitness? That is, are they all 64 bit executables? All 32 bit executables? Be careful with C#, because the "Prefer 32-bit" flag could be turned on in the project options. That could cause you to run in 32-bit mode when you're compiling with "Any CPU", even on a 64-bit system.
answers question: http://stackoverflow.com/q/27079644
has comment: http://stackoverflow.com/comment/42683517
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/134959507
has text: I overlooked that this doesn't go in application.yml -- don't be like me. Wouldn't compile.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29361057
type: Comment

http://stackoverflow.com/comment/42751555
has text: "java.lang.RuntimeException: Uncompatible source code - Erroneous tree type: <any>
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27125606
type: AnswerComment

http://stackoverflow.com/a/72357305
has body: When you use a new keyword the string doesnot go to string pool. For example when you do String c = new String("David"); String d = new String("David"); Here you will have two reference variables c and d both pointing to two different objects having same value "David". But when you do String a ="Rahul"; here "Rahul" lives in the string pool. Now again if you do String b= "Rahul"; first Java will search if there is "Rahul" living in the string pool, and there is. So now reference variable b will point to the same "Rahul" living in the string pool. So here you have reference variable "a" and "b" both pointing to the same "Rahul" in the string pool. But since strings are immutable changing "a" won't have any impact on "b" or vice versa. So you can use any one you like based on your need and requirement
type: Answer
answers question: http://stackoverflow.com/q/27055171
score: 0

http://stackoverflow.com/comment/42650880
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27068653
score: 0
has text: This is usually caused by a linker error when building. Usually because a library wasn't added properly. Sometimes simply rebuilding fixes it. http://stackoverflow.com/questions/2247998/noclassdeffounderror-eclipse-and-android

http://stackoverflow.com/comment/42732701
score: 0
type: Comment
has text: Thank you everyone especially @drewmoore. The simplest stuff is what really kills me in this class, but I do love it!
type: AnswerComment
comment on: http://stackoverflow.com/a/27114693

http://stackoverflow.com/comment/42533651
score: 3
type: AnswerComment
has text: You're correct but your answer is missing the keyword. *Scope*.
comment on: http://stackoverflow.com/a/27001841
type: Comment

http://stackoverflow.com/comment/42685371
score: 0
type: Comment
type: QuestionComment
has text: Remove `mail.smtp.starttls.enable=true` and try again. Maybe their SMTP server sucks and doesn't support SSL.
comment on: http://stackoverflow.com/q/27087321

http://stackoverflow.com/comment/42741543
type: Comment
type: QuestionComment
has text: What about the buttons?
comment on: http://stackoverflow.com/q/27120135
score: 0

http://stackoverflow.com/comment/42615756
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27048608
has text: Well the code relevant to this feature are really just those two lines I posted in OP. I get the fontHeight and then I set the height of the Empty Space.
score: 0

http://stackoverflow.com/a/26993392
type: Answer
answers question: http://stackoverflow.com/q/26993282
has body: Your list you are iterating through is probably modified somewhere else since it's not local (you declare and initialise it somewhere else). Either make it local, pass its copy to the method or use CopyOnWriteArrayList (https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CopyOnWriteArrayList.html)
score: 0

http://stackoverflow.com/q/27100337
type: Question
has answer: http://stackoverflow.com/a/27100372
answer count: 2
has comment: http://stackoverflow.com/comment/42705109
accepted answer: http://stackoverflow.com/a/27100668
has title: How can I Make Single Application for web and desktop in JAVA
has comment: http://stackoverflow.com/comment/42705194
tagged with: desktop
score: 0
has comment: http://stackoverflow.com/comment/42705234
tagged with: web
has comment: http://stackoverflow.com/comment/42705063
has comment: http://stackoverflow.com/comment/42705327
has comment: http://stackoverflow.com/comment/42704933
has answer: http://stackoverflow.com/a/27100668
has comment: http://stackoverflow.com/comment/42704969
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42705173
has comment: http://stackoverflow.com/comment/42705118
tagged with: java
tagged with: javafx
tagged with: cross-platform
possible better answer: http://stackoverflow.com/a/27100372
has body: I need to make a cross platform application than can run on MAC, Windows, Linux and also on web. Can JAVA be used for this? If yes then what type of JAVA project and what architecture should I use? And also need to implement MVC. My Application will store data on local pc and will also have same interface on web. And both platforms will keep in sync!

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

http://stackoverflow.com/q/27129155
answer count: 1
has body: I'm trying to add a DocumentListener class to my JComboBox dropdowns but I'm getting an error message right of the box. It let me create the class but I'm getting an error on the JComboBox where I'm adding/making the class. Error message: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method add(Component) in the type Container is not applicable for the arguments (CountyDocumentListener) at test.TestGUI.(TestGUI.java:52) at test.TestGUI.main(TestGUI.java:20) The goal is to make and add an autocomplete to all the dropdowns using documentlistener. Obviously the arrays will be alot bigger hence im trying to make autocomplete happen. Can I do this with DocumentListener or is there another way? If so do I need a seperate doculistener class for all the dropdowns or how should I organize all this? (I don't want to use anything like SwingX, I want to make it myself). public class TestGUI extends JFrame implements ActionListener { private JPanel content; String[] county = { " ", "Orange", "Placer", "Napa", "LA", "Kings" }; String[] muni = { " ", "Anaheim", "Agoura Hills", "Auburn", "Avalon", "Calistoga" }; String[] place = { " ", "Berkeley", "Calistoga", "El Toro", "Glendale", "Corcoran" }; public static void main(String[] args) { TestGUI frame = new TestGUI(); frame.pack(); frame.setVisible(true); } @SuppressWarnings("rawtypes") public TestGUI() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); content = new JPanel(); content.setLayout(new BorderLayout()); setContentPane(content); JPanel rightPanel = new JPanel(); content.add(rightPanel, BorderLayout.EAST); rightPanel.add(new TriGoButton()); JPanel leftPanel = new JPanel(); content.add(leftPanel, BorderLayout.WEST); JPanel centerPanel = new JPanel(); content.add(centerPanel, BorderLayout.CENTER); centerPanel.setLayout(new GridLayout(3, 3, 0, 20)); JLabel countyLbl = new JLabel("County"); centerPanel.add(countyLbl); JComboBox countyDropDown = new JComboBox(county)…
type: AnsweredQuestion
tagged with: user-interface
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27129468
tagged with: documentlistener
favorite count: 0
tagged with: jcombobox
has title: Adding a DocumentListener to a JCombobox
has comment: http://stackoverflow.com/comment/42757827
type: Question
tagged with: swing
has comment: http://stackoverflow.com/comment/42758110
has comment: http://stackoverflow.com/comment/42757527
tagged with: java
accepted answer: http://stackoverflow.com/a/27129468
upvote count: 1

http://stackoverflow.com/comment/42664944
comment on: http://stackoverflow.com/q/27077068
score: 0
type: Comment
type: QuestionComment
has text: @JBNizet I suppose that would also be the answer to "I have too much CPU power, how do I print an array in `O(n^2)`?". Although, funnily enough, this _is_ the solution for a cons-list.

http://stackoverflow.com/q/27000196
has title: weblogic 10.0 +jdk 1.5
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27000456
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: weblogic
has body: Can we build a REST based web service using WEBLOGIC 10.0 and JDK 1.5? I have already CREATED with weblogic 12 C AND JDK 1.7 WORKS perfectly but this is an old application and we need add a module where we are passing an XML to TIPCO [they prefer REST here] and in-turn receiving an XML from them.
has answer: http://stackoverflow.com/a/27000456
answer count: 1

http://stackoverflow.com/q/27026169
downvote count: 0
has answer: http://stackoverflow.com/a/27026499
accepted answer: http://stackoverflow.com/a/27026499
tagged with: java
type: Question
has title: Maven ignoring JAVA_HOME on OSX?
has answer: http://stackoverflow.com/a/36701610
upvote count: 14
answer count: 2
has body: For some reason Maven is ignoring JAVA_HOME on OSX. I recently upgraded from java 8 build 11 to java 8 build 25 and removed 11 because of a bug fix in 25. I have updated JAVA_HOME: :~ &gt; echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home java and javac both report the correct version: :~ &gt; java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) :~ &gt; javac -version javac 1.8.0_25 libexec is correct: :~ &gt; /usr/libexec/java_home /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home the CurrentJDK symlink is correct: :~ &gt; ls -la /System/Library/Frameworks/JavaVM.framework/Versions/ total 64 drwxr-xr-x 11 root wheel 374B Nov 19 14:35 ./ drwxr-xr-x 12 root wheel 408B Sep 23 14:29 ../ lrwxr-xr-x 1 root wheel 10B Jul 28 14:50 1.4@ -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B Jul 28 14:50 1.4.2@ -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B Jul 28 14:50 1.5@ -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B Jul 28 14:50 1.5.0@ -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B Jul 28 14:50 1.6@ -&gt; CurrentJDK lrwxr-xr-x 1 root wheel 10B Jul 28 14:50 1.6.0@ -&gt; CurrentJDK drwxr-xr-x 8 root wheel 272B Jul 29 18:41 A/ lrwxr-xr-x 1 root wheel 1B Jul 28 14:50 Current@ -&gt; A lrwxr-xr-x 1 root wheel 58B Nov 19 14:35 CurrentJDK@ -&gt; /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents But Maven is still trying to hit 1.8.0_11: :~ &gt; mvn -version Error: JAVA_HOME is not defined correctly. We cannot execute /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/bin/java Running OSX Mavericks. Any idea why Maven is ignoring JAVA_HOME?
tagged with: macos
favorite count: 0
possible better answer: http://stackoverflow.com/a/36701610
tagged with: maven
score: 14
type: AnsweredQuestion

collections
tags question: http://stackoverflow.com/q/27045951
tags question: http://stackoverflow.com/q/27010610
tags question: http://stackoverflow.com/q/27087693
tags question: http://stackoverflow.com/q/27151711
tags question: http://stackoverflow.com/q/27129556
tags question: http://stackoverflow.com/q/26992353
tags question: http://stackoverflow.com/q/27120181
tags question: http://stackoverflow.com/q/27073302
tags question: http://stackoverflow.com/q/27002415
tags question: http://stackoverflow.com/q/27034189
tags question: http://stackoverflow.com/q/27105790
type: Tag
tags question: http://stackoverflow.com/q/27150421
tags question: http://stackoverflow.com/q/27093001
tags question: http://stackoverflow.com/q/27127392
tags question: http://stackoverflow.com/q/27014989
tags question: http://stackoverflow.com/q/27093104
tags question: http://stackoverflow.com/q/27117732
tags question: http://stackoverflow.com/q/27107745
tag name: collections
tags question: http://stackoverflow.com/q/27134873
tags question: http://stackoverflow.com/q/27138895
tags question: http://stackoverflow.com/q/27123996
tags question: http://stackoverflow.com/q/27143122
tags question: http://stackoverflow.com/q/27105745
tags question: http://stackoverflow.com/q/27122988
tags question: http://stackoverflow.com/q/27107117
tags question: http://stackoverflow.com/q/26995607

http://stackoverflow.com/comment/42534355
type: Comment
type: QuestionComment
score: 1
has text: change to `System.out.print(ExampleArray[i][j]+" ");` instead of using `println`. And remove `i` from, `System.out.println()`;
comment on: http://stackoverflow.com/q/27002246

http://stackoverflow.com/q/27005967
has comment: http://stackoverflow.com/comment/42541391
has comment: http://stackoverflow.com/comment/47106243
tagged with: android
answer count: 1
linked to: http://stackoverflow.com/q/8231059
tagged with: jreddit
favorite count: 0
has comment: http://stackoverflow.com/comment/42541256
tagged with: android-studio
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/49916412
has answer: http://stackoverflow.com/a/30216653
score: 2
tagged with: java
has body: I'm attempting to build an android app in Android Studio that integrates the jReddit Java Wrapper. I've cloned the git repository, added a build.gradle file, added the proper dependencies and referenced the jReddit module in my android app's project structure. I'm able to create any of the objects in the jReddit library, but I cannot use any of the methods for those objects. I get a "Cannot resolve symbol 'xxx'" when I try to use a method. Currently the project structure is set up like below: Project Title App src libs jReddit src libs So the app's code is in the src folder and any .jar dependencies are in the libs folder. The jReddit project has in it's build.gradle file "apply plugin: 'java'" and is listed as a dependency in the app's build.gradle file. Finally the libs folder in the jReddit project tree has the jars that IT depends on (which are also referenced in its respective build gradle). Ultimately, everything compiles nicely, is imported nicely (in the app source code), there are no errors instantiating a new object from the jReddit library, but when I go to do anything with that object, Android Studio cannot find any methods. See the screen shots below to see what I'm talking about: https://i.sstatic.net/IJ4N2.png I'm completely dumbfounded with what to do here. I've never encountered anything like this. Does anyone have any suggestions?
type: Question
has comment: http://stackoverflow.com/comment/49913870
downvote count: 0
has title: Library properly imported (compiles and import statements are correct), but object cannot access it's methods

http://stackoverflow.com/q/27030332
score: 30
tagged with: c++
has title: solutions to resolve enum field naming restriction in Google protobuf due to C++
tagged with: serialization
has comment: http://stackoverflow.com/comment/42583061
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42591970
has comment: http://stackoverflow.com/comment/42583020
tagged with: enums
tagged with: java
has answer: http://stackoverflow.com/a/27051712
has comment: http://stackoverflow.com/comment/42582965
type: Question
has body: As you might know, when you define enums in Google protobuf either with global scope or in same message, you can't define enum field name to be same if enums are sibling. Even if you are going to generate Java code with proto file, protoc complains about it and doens't generate any code with following message. "XXX" is already defined in "your.package.name". Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it. Therefore, "XXX" must be unique within "your.package.name", not just within "your_enum_name". so, which means you should do something like wrapping the colliding enums with message. Pros : well... protoc doesn't fail? Cons : generate code is going to have one extra static wrapper class so that it will increase SerDes cost a little bit + naming seems long enough. e.g, CURRENCY.NAMESPACE(wrapper message name).USD or use prefix for the field, so if your conflicting field name is UNKNOWN and it's in CURRENCY, it's going to be CURRENCY.CURRENCY_UNKNOWN or something like that. Pros : simple Cons : as ugly as #1, inconsistency with existing enum field naming that doesn't have any prefix. or Just don't use Enum. Use string type. Pros : simple, don't need to define fallback enum field like UNKNOWN = 1 as default. Cons : losing benefit of having enum. Seems like C++ 11 supports better enums that doesn't have this issue, but unfortunately latest protoc doesn't support it, and we can't simply ask other consumers to switch their side to use C++ if they are not using it. So, it's going to be choosing less worse solution rather than best solution, and probably we are going to use #2 at this point. Does anyone have same experience and tell me what was your solution and how is it ended up?
answer count: 1
downvote count: 0
upvote count: 30
tagged with: protocol-buffers
favorite count: 0

points
tag name: points
tags question: http://stackoverflow.com/q/27095731
tags question: http://stackoverflow.com/q/27083477
type: Tag
tags question: http://stackoverflow.com/q/27103771

datetime
tags question: http://stackoverflow.com/q/27068467
tags question: http://stackoverflow.com/q/27019789
tags question: http://stackoverflow.com/q/27057095
tags question: http://stackoverflow.com/q/27105008
tag name: datetime
tags question: http://stackoverflow.com/q/27033965
tags question: http://stackoverflow.com/q/27065163
tags question: http://stackoverflow.com/q/27011842
tags question: http://stackoverflow.com/q/27146146
tags question: http://stackoverflow.com/q/27082097
type: Tag
tags question: http://stackoverflow.com/q/27075760
tags question: http://stackoverflow.com/q/27078536

http://stackoverflow.com/a/27033064
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27033028
type: Answer
downvote count: 0
has body: Use a ListIterator, which allows you to make changes to the list through which you are iterating. The code you use is almost indentical in use to an iterator, but removing elements has to be done explicitly using the remove() method of the iterator. e.g. Iterator itr = tasked.iterator(); while(itr.hasNext()) { Villager e = itr.next(); if(!e.hasTask()) { itr.remove(); } }
score: 1
answers question: http://stackoverflow.com/q/27033028
upvote count: 1

http://stackoverflow.com/q/27083477
has comment: http://stackoverflow.com/comment/42676107
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: object
accepted answer: http://stackoverflow.com/a/27083521
tagged with: java
tagged with: encapsulation
has body: I am trying to create a method to calculate the distance between two Point objects: public class Point { private double x; private double y; public Point (double x, double y) { this.x = x; this.y = y; } private static void main (String[] args) { Point p1 = new Point(5.0,6.0); Point p2 = new Point(2.0,2.0); double distance = Math.sqrt((p1.getX() - p2.getX()) * (p1.getX() - p2.getX()) + (p1.getY() - p2.getY()) * (p1.getY() - p2.getY())); System.out.println(distance); } } When I try to compile it I keep on getting the error saying: Point.java:16: error: cannot find symbol double distance = Math.sqrt((p1.getX() - p2.getX()) * (p1.getX() - p2.getX()) + ^
tagged with: points
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27083521
has title: Calculating the distance between 2 points using getY() and getX()

http://stackoverflow.com/q/27086284
answer count: 1
score: 0
tagged with: javafx-8
has body: How would I go about cutting this giant string? I need the data of the first ID," preferably for the string output to be: "id":1,"name":"site1","has_doneit":true,"destination":"4613" Is this possible? Or if not any other ways of grabbing the name:"site1" and the has_doneit:true would be perfectly fine. {"needs_complete":true,"has_done":true,"sites":[ {"id":1,"name":"site1","has_doneit":true,"destination":"4613"},{"id":2,"name":"site2","has_doneit":true,"destination":"4613"},{"id":3,"name":"site3","has_doneit":true,"destination":"4339"},{"id":4,"name":"site4","has_doneit":true,"destination":"4340"},{"id":5,"name":"site5","has_doneit":true,"destination":"4341"}, {"id":6,"name":"site6","has_doneit":true,"destination":"4622"},{"id":7,"name":"site7","has_doneit":true,"destination":"4623"},{"id":8,"name":"site8","has_doneit":true,"destination":"4828"}, {"id":9,"name":"site9","has_doneit":true,"destination":"4829"},{"id":10,"name":"site10","has_doneit":true,"destination":"4861"}]}
has title: How would I split this string?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27086346
linked to: http://stackoverflow.com/q/16574482
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/27086346
type: Question
has comment: http://stackoverflow.com/comment/42681147

http://stackoverflow.com/q/27077268
has body: is it possible to simply make 360 degree movement in java(swing) without any game engine? all I have is this attempt: public class Game extends JPanel implements Runnable { int x = 300; int y = 500; float angle = 30; Game game; public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new Game()); frame.setSize(600, 600); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public Game() { setSize(600, 600); Thread thread = new Thread(this); thread.start(); } @Override public void paint(Graphics g) { g.setColor(Color.WHITE); g.drawRect(0, 0, 600, 600); g.setColor(Color.CYAN); g.fillOval(x, y, 10, 10); g.dispose(); } @Override public void run() { while(true) { angle += -0.1; x += Math.sin(angle); y--; repaint(); try { Thread.sleep(50); } catch (InterruptedException ex) {} } } } as you can see in following picture, I don't know how to handle movement rotating, this is the output: image http://screenshot.cz/GOXE3/mvm.jpg
answer count: 4
tagged with: rotateanimation
accepted answer: http://stackoverflow.com/a/27077449
upvote count: 2
has answer: http://stackoverflow.com/a/27077612
tagged with: swing
has answer: http://stackoverflow.com/a/27077502
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27077612
tagged with: java
type: Question
tagged with: rotation
has comment: http://stackoverflow.com/comment/42665139
score: 2
has answer: http://stackoverflow.com/a/27077449
downvote count: 0
has answer: http://stackoverflow.com/a/27077451
favorite count: 0
has title: 360 degree movement example in java

http://stackoverflow.com/comment/42702686
type: AnswerComment
has text: @getgoodatprogramming what do you get from ` HttpEntity entity = response.getEntity();` ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27095208

http://stackoverflow.com/comment/42525387
has text: In simple words , the Class class object have nothing to do with the static members?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26997261

http://stackoverflow.com/comment/42560111
type: Comment
has text: I don't know if I improved or not situation, I copied DDMS files from old sdk folder, now it just doesn't recognize android SDK ("just"), so gives error on every class, is there a way to resolve?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27006244

reference
tags question: http://stackoverflow.com/q/27070075
type: Tag
tags question: http://stackoverflow.com/q/27035648
tags question: http://stackoverflow.com/q/27004190
tags question: http://stackoverflow.com/q/27088276
tag name: reference

http://stackoverflow.com/comment/42723924
comment on: http://stackoverflow.com/a/27096843
has text: @EvanDark My apologies then, that wasn't my intention. And there's really no need to use trapezoids since neither is a good approximation; the idea is just to show it is an integral. Anyhow, this is getting to be a little too extended of a conversation so let's leave it at this. If you feel my question is still not presented well please edit it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42762282
comment on: http://stackoverflow.com/q/27131549
has text: what does your stack trace show?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42676311
has text: Simple printed output for the data in the array but organized into a table. That is what my parameters are.
comment on: http://stackoverflow.com/q/27083345
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42574013
comment on: http://stackoverflow.com/a/27025031
has text: It is ok to delete it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42669042
type: AnswerComment
type: Comment
has text: Yes now I don't need to set a null click listener for title, so that's seems less hacky. However as each text has a specific listener, I would like to keep the logic in the adapter instead of moving it to my fragment class. Don't you know why setting the click listener disable this animation? Is there any way to set the click listener on my item directly?
score: 1
comment on: http://stackoverflow.com/a/27079535

http://stackoverflow.com/comment/107617451
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27099842
has text: @N.M.N The writer and reader are used for the client also. Look at my example and try to understand it. I haven't use Protobuf in a while so I forgot how everything works. All I have is this complete example that I put together to answer this question. Look at the documentation links if you are unsure about anything. Make sure to register the provider with the client.

http://stackoverflow.com/a/27141635
has body: You should use main class , I have executed your code and its running fine when we use main class public class Tester { public static void main(String[] args) { Automobile myBmw = new Automobile(24); myBmw.fill(20); myBmw.takeTrip(100); myBmw.reportFuel(); } } And if you dont want to use main() , then you should use a method for it public void testME() { Automobile myBmw = new Automobile(24); myBmw.fill(20.0); myBmw.takeTrip(100); myBmw.reportFuel(); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27141578

http://stackoverflow.com/q/27107648
has title: Cell renderer and the lost focus
has body: I am using a JTable and in order to change the format of numbers. I have extended the DefaultTableRenderer class. In the method getTableCellRenderedComponent, I retrun a new JLabel with the proper format. My problem is by doing this the rectangle (border) that underlines the cell which has the focus has disappeared. Is there a way to get the default border displayed whenever a cell has the focus with my custom render?
tagged with: swing
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27108408
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27108268
accepted answer: http://stackoverflow.com/a/27108268
has comment: http://stackoverflow.com/comment/42718510
tagged with: jtable
score: 0
possible better answer: http://stackoverflow.com/a/27108408

http://stackoverflow.com/q/27050357
has comment: http://stackoverflow.com/comment/42618221
has answer: http://stackoverflow.com/a/27050619
tagged with: android
linked to: http://stackoverflow.com/q/3226495
type: AnsweredQuestion
tagged with: java
tagged with: system.exit
has answer: http://stackoverflow.com/a/27050527
type: Question
accepted answer: http://stackoverflow.com/a/27050527
possible better answer: http://stackoverflow.com/a/27050619
tagged with: quit
score: 4
has comment: http://stackoverflow.com/comment/42618461
answer count: 2
downvote count: 1
has title: Force quit of Android App using System.exit(0) doesn't work
has comment: http://stackoverflow.com/comment/42618247
linked to: http://stackoverflow.com/q/2042222
favorite count: 0
upvote count: 5
has body: when I try to quit my Android application by overwriting the function for the back-button of Android devices and "System.exit(0)", this doesn't work. I have an activity named "LoginActivity" and an activity named "OverviewActivity". When I start an intent in OverviewActivity to switch to LoginActivity, this works. Intent changeViewIntent = new Intent(OverviewActivity.this, LoginActivity.class); startActivity(changeViewIntent); Now I am in LoginActivity and there is the overwritten method: @Override public void onBackPressed() { System.exit(0); } But when I press the back-key (e.g. in the device simulator) the screen is blank for a millisecond and then it goes back to the OverviewActivity. Why is this happening? I just want to force the close when the back-key is pressed. History disabling for the OverviewActivity in the manifest is no option, because there are several ways to access the OverviewActivity from other activities. Maybe there is an idea? Android 4 is minimium requirement, so it doesn't have to work on lower versions.. Thanks!

http://stackoverflow.com/q/27003920
has answer: http://stackoverflow.com/a/27004043
score: 34
tagged with: linux
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27004043
has answer: http://stackoverflow.com/a/27004032
favorite count: 0
tagged with: root
type: Question
has body: I need java 1.7 and server has only got 1.6. I have no root privileges. I tried to google out something but it seems like nobody was doing it. Can I somehow compile it or get ready binaries so I could put those into my PATH. Could you help? System is Redhat.
has answer: http://stackoverflow.com/a/57443778
upvote count: 34
has title: How to install java locally - no root - on linux, if possible?
has answer: http://stackoverflow.com/a/47558905
accepted answer: http://stackoverflow.com/a/27004032
has comment: http://stackoverflow.com/comment/42537582
has comment: http://stackoverflow.com/comment/42537442
tagged with: java
answer count: 4
downvote count: 0

http://stackoverflow.com/q/27070711
type: Question
has title: Why is EJB remotely accessible and Servlet not
has body: I was trying to understand the difference between EJB and Servlet (I know both are conceptually different, EJB is a piece of Java Code with some rules and Servlet is something that accepts and processes HTTP requests) But I found that one of the difference between the two is also: Ejbs allows Remote Accessing. Servlet/jsp's does not allow remote accessing I do not understand the above difference. Why an EJB can be remotely accessible and Servlet not.
has answer: http://stackoverflow.com/a/27071423
score: 0
answer count: 1
tagged with: java
linked to: http://stackoverflow.com/q/3164822
tagged with: servlets
tagged with: ejb
type: UnansweredQuestion

http://stackoverflow.com/a/31160935
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27036118
has body: I had the same problem and I found out that this is bug that NetBeans have not solved yet.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27036118

http://stackoverflow.com/comment/42745457
has text: I figured out that the only thing changing is the `widthProperty` of the `TitledPane`. Everything else stays. So I tried working with a listener on the `widthProperty` of the `TitledPane` with `setGraphicTextGap(getWidth() - nodesWidth)` but the result is the same. The width is also growing when I resize the columns of the `TableView` within the `TitledPane`.
type: Comment
comment on: http://stackoverflow.com/a/27105817
score: 0
type: AnswerComment

http://stackoverflow.com/comment/44032203
has text: I've been studying this a bit more. The "anchor" notation in the OP's diagram is specified in 1.4 but not in 2.x. I did a bit of analyzing of the Namespace metamodel and it looks like the way to go is to put a namespace property on the containing class, put a composition diamond on the containing class's association end, and put the {subsets namespace} property on the nested class end. The subsets property implements the visibility this quote describes. See [this](http://stackoverflow.com/questions/27797531/how-to-represent-the-nested-class-of-c-in-uml/27810986#27810986) for more.
comment on: http://stackoverflow.com/a/27155273
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27049080
has comment: http://stackoverflow.com/comment/42616979
has comment: http://stackoverflow.com/comment/42641010
score: 1
has comment: http://stackoverflow.com/comment/42618554
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42618637
has comment: http://stackoverflow.com/comment/42644700
has comment: http://stackoverflow.com/comment/42646698
type: Answer
has body: Yes, you will need to make your own thread for this. Probably the simplest thing to do is to copy the entire body of your current deleteAll() method to the run() method of a new class, that extends Thread. Assuming you've called that class DeleteAllThread, you'd then replace your method above with @Override public void deleteAll() { new DeleteAllThread().start(); }
has comment: http://stackoverflow.com/comment/42615854
has comment: http://stackoverflow.com/comment/42617128
accepted answer of: http://stackoverflow.com/q/27048905
has comment: http://stackoverflow.com/comment/42645762
answers question: http://stackoverflow.com/q/27048905
has comment: http://stackoverflow.com/comment/42616331

http://stackoverflow.com/q/27102481
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: Java Optional<T> questions, am I doing this right?
has comment: http://stackoverflow.com/comment/42711548
tagged with: option-type
type: Question
has answer: http://stackoverflow.com/a/27102553
has answer: http://stackoverflow.com/a/27102626
possible better answer: http://stackoverflow.com/a/27102553
answer count: 3
downvote count: 0
favorite count: 0
has body: I've had a "Bad habit" of tossing null into places, such as enumerators when something doesn't exist. Example: private enum Foo { NULL(1, null, 2), NOT_NULL(3, new Bar(), 4); private int a, c; private Bar b; Foo(int a, Bar b, int c) { this.a = a; this.b = b; this.c = c; } } So now I'm trying to convert my code to use Optional&lt;T&gt; Like everyone is suggesting, but I'm not sure if I'm doing it correctly. Here's my code (Trimmed enum): public static enum Difficulty { EASY, MEDIUM, HARD } public static enum SlayerTasks { NONE(0, Optional.empty(), Optional.empty(), Optional.empty()), NPC(1, Optional.of(Difficulty.EASY), Optional.of("That one place."), Optional.of(1)); private int taskId; private Optional&lt;Difficulty&gt; difficulty; private Optional&lt;String&gt; location; private Optional&lt;Integer&gt; npcId; SlayerTasks(int taskId, Optional&lt;Difficulty&gt; difficulty, Optional&lt;String&gt; location, Optional&lt;Integer&gt; npcId) { this.taskId = taskId; this.difficulty = difficulty; this.location = location; this.npcId = npcId; } public int getTaskId() { return taskId; } public Difficulty getDifficulty() { return difficulty.get(); } public String getLocation() { return location.get(); } public int getNpcId() { return npcId.get(); } } What's bothering me is the documentation referring to #get() found here where it states: If a value is present in this Optional, returns the value, otherwise throws NoSuchElementException. So, I figured that in order to prevent this I would wrap the getter in #isPresent(), but then I couldn't figure out how to return empty. Is this the correct way to do things, or am I missing something? I'm not looking for a "Fix", I'm looking for information on efficiency and proper practices.
has answer: http://stackoverflow.com/a/27102653
tagged with: java-8
accepted answer: http://stackoverflow.com/a/27102626

http://stackoverflow.com/q/27117167
favorite count: 0
upvote count: 5
type: UnansweredQuestion
tagged with: maven
tagged with: parent-pom
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27120470
has answer: http://stackoverflow.com/a/27119724
type: Question
score: 5
has title: Maven -- is there a command to download the parent poms of all dependency jars?
has body: I know we can download the dependency jars... but can we download the parent poms of all dependency jars? For example Project A brings in library B as dependency, but library B has parent pom C.xml. I want to find a command that downloads all pom.xml in Bs and C.xml. ideally if C.xml has another parent pom D.xml, I want to download that too.
has answer: http://stackoverflow.com/a/27120857
answer count: 3
tagged with: pom.xml

http://stackoverflow.com/a/27024308
answers question: http://stackoverflow.com/q/27023409
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27023409
type: Answer
upvote count: 3
has body: You create a SparkContext instance by providing a configuration to the class constructor. Therefore, if you want to use that instance in another part of your program, you need to pass that same reference in some way. Passing the context around as a parameter to the jobs is a valid option and would be my preferred way. Make sure you make that parameter transient to avoid it being 'caught' by a closure. You could also use a classical 'Singleton' pattern using a class that encapsulates the context creation and provides a static method to get the singleton reference. In all cases, you need to provide the ctx sharing mechanism that fits your specific needs.
score: 3

http://stackoverflow.com/a/27046651
type: Answer
has comment: http://stackoverflow.com/comment/42612551
has comment: http://stackoverflow.com/comment/42612119
score: 1
upvote count: 1
has body: Its very hard to create a class at run time when you don't know the number of fields and their data types. You could do two passes though, in the first pass figure out a schema and create classes accordingly and populate in the second pass. Basically you would need to keep track of the field names, their datatypes and a keep a fallback datatype (eg. a subset of records for a particular field might be int and then suddenly you might discover a long). Personally, I don't think making schemas at runtime provides a very clean solution. A map of maps might have been a better way to deal it. Just my two cents.
accepted answer of: http://stackoverflow.com/q/27046064
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27046064

multidimensional-array
tags question: http://stackoverflow.com/q/27067289
tags question: http://stackoverflow.com/q/27001415
tags question: http://stackoverflow.com/q/27093386
tags question: http://stackoverflow.com/q/27091763
tags question: http://stackoverflow.com/q/27028889
tags question: http://stackoverflow.com/q/27050523
tags question: http://stackoverflow.com/q/27054794
tags question: http://stackoverflow.com/q/27109083
tags question: http://stackoverflow.com/q/27032139
type: Tag
tags question: http://stackoverflow.com/q/27094597
tags question: http://stackoverflow.com/q/27133169
tags question: http://stackoverflow.com/q/27091875
tags question: http://stackoverflow.com/q/27090467
tags question: http://stackoverflow.com/q/27033394
tags question: http://stackoverflow.com/q/27152125
tags question: http://stackoverflow.com/q/27053138
tags question: http://stackoverflow.com/q/27134247
tags question: http://stackoverflow.com/q/27012927
tags question: http://stackoverflow.com/q/27079607
tags question: http://stackoverflow.com/q/27084764
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/27098719

http://stackoverflow.com/comment/42525994
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26997281
has text: So you think validating in each controller is a better solution? Thinking about a developer that forgets to add @Valid annotation make me feel dizzy

http://stackoverflow.com/q/27141811
type: Question
has title: How the connection pool works
score: 0
answer count: 1
has body: I am working on spring based application where I manage connection pool to manage connection between MySQL and Java application. Connection pool configuration looks like this: &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" &gt; &lt;property name="driverClassName" value="${database.driver}" /&gt; &lt;property name="url" value="${database.url}" /&gt; &lt;property name="username" value="${database.user}" /&gt; &lt;property name="password" value="${database.password}" /&gt; &lt;property name="initialSize" value="20" /&gt; &lt;property name="maxActive" value="100" /&gt; &lt;property name="maxIdle" value="50" /&gt; &lt;property name="minIdle" value="10" /&gt; &lt;/bean&gt; Now my questions are: 1) I have two different applications having the same configuration, then how many connection pool will mysql maintain, it will one for all application having maxactive1=100 or it will based on per application. In my case 2* 100 = 200(maxactive). 2) what can be best maxactive value if i have 500 requests in 1 sec?
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27142338
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/42763102
comment on: http://stackoverflow.com/q/27132154
type: Comment
type: QuestionComment
score: 1
has text: how will it add entries without knowing the value type?

http://stackoverflow.com/a/27008583
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42576378
answers question: http://stackoverflow.com/q/27008335
has comment: http://stackoverflow.com/comment/42632268
has body: You could put line debugging before and after each set of for loops for example, you could do this: System.out.println("starting for loop on line: " + Thread.currentThread().getStackTrace()[1].getLineNumber()); for (int i = 0; i &lt; WIDTH; i++) { for (int j = 0; j &lt; HEIGHT; j++) { // Your Code is here } } System.out.println("I am at line: " + Thread.currentThread().getStackTrace()[1].getLineNumber()); When one of the outputs doesn't show you will know what isn't finishing.

google-glass
tags question: http://stackoverflow.com/q/27033580
tag name: google-glass
type: Tag
tags question: http://stackoverflow.com/q/27091820
tags question: http://stackoverflow.com/q/27138028
tags question: http://stackoverflow.com/q/27035264
tags question: http://stackoverflow.com/q/27129486
tags question: http://stackoverflow.com/q/27013063
tags question: http://stackoverflow.com/q/27102167

http://stackoverflow.com/q/27017781
tagged with: logging
type: AnsweredQuestion
has title: Change logging level in Tomcat at runtime?
upvote count: 3
tagged with: java
has body: I am using JULI logging framework in current Tomcat 7, providing a webapp specific logging.properties in my WEB-INF/classes folder. Now I am looking for a way to change the log level of a logger at runtime. I found several sources saying that changing the level of a logger at runtime might be possible via MBean Server. Unfortunately the appropriate MBean "java.util.logging.Logging" does not list my webapp specific logger, so I cannot execute the method "setLoggerLevel". Does anyone know how to accomplish this? Thanks for any hints - excluding those suggesting to use log4j, that is... ;-)
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/27019605
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/27019605

http://stackoverflow.com/a/41650126
upvote count: 1
score: 1
downvote count: 0
has body: I struggled a lot with this problem, due to building microservices with Dropwizard. Eventually I found out that I had my build properties in the wrong pom file (The main service's pom.xml). So, even though the other packages are more like libraries, I were not able to use the Java 8 syntax. When I refactored the build plugin into the "global" .pom.xml" file, all child containers were able to use the new syntax. May help someone having issues with multi-container projects
answers question: http://stackoverflow.com/q/27037657
type: Answer

http://stackoverflow.com/q/27139409
type: AnsweredQuestion
has title: Java constructor cannot find symbol error ' = new'
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27139459
has answer: http://stackoverflow.com/a/27139459
score: 0
accepted answer: http://stackoverflow.com/a/27139460
has comment: http://stackoverflow.com/comment/42776726
has body: I am trying to initialize one Java class from within a conditional in another class - I want MarsRovers to initialize Rover. I am getting a 'cannot find symbol' error when I try to initialize a Rover object from MarsRovers. I am new to Java so I have a feeling it has something to do with the scope of plateauCoords and inputLines. I've tried other solutions I've seen on here, but they aren't working for my problem (like making my variables public). The goal is to eventually make a new Rover as long as inputLines % 2 is equal to 0 (with an until loop). Here is the MarsRover code: import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class MarsRover { public static void main(String []args) throws FileNotFoundException { Scanner console = new Scanner(System.in); System.out.println("Mars rover is ready for input, please enter name of input file: "); String filename = console.nextLine(); console.close(); List&lt;String&gt; inputLines = new ArrayList&lt;String&gt;(); Scanner scanner = new Scanner(new File(filename)); scanner.useDelimiter("\n"); while(scanner.hasNext()){ inputLines.add(scanner.next()); } String plateauCoords = inputLines.get(0); inputLines.remove(0); scanner.close(); System.out.println(inputLines); if(inputLines.size() % 2 == 0) { MarsRover rover = new Rover(plateauCoords, inputLines); } else { System.out.println("Your directions are not formatted correctly"); } } } And here is the Rover code: import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class Rover { public Rover(String platCoords, String[] input) { System.out.println("INSIDE ROVER"); } } When I compile MarsRovers.java, I get this error: MarsRover.java:27: cannot find symbol symbol : constructor Rover(java.lang.String,java.util.List&lt;java.lang.String&gt;) location: class Rover MarsRover rover = new Rover(plateauCoords, inputLines); ^ 1 error
tagged with: constructor
tagged with: cannot-find-symbol
has answer: http://stackoverflow.com/a/27139460

http://stackoverflow.com/comment/42785824
comment on: http://stackoverflow.com/a/27143983
type: AnswerComment
has text: i use the log4j-over-slf4j-1.7.5.jar, could this be a problem?
score: 0
type: Comment

http://stackoverflow.com/comment/42625524
score: 2
comment on: http://stackoverflow.com/q/27054408
has text: 1) `process = Runtime.getRuntime().exec("IDK WHAT GOES HERE");` That should go well. See also [When Runtime.exec() won't](http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html) for many good tips on creating and handling a process correctly. Then ignore it refers to `exec` and use a `ProcessBuilder` to create the process. 2) Please use code formatting for code and code snippets, structured documents like HTML/XML or input/output. To do that, select the text and click the `{}` button at the top of the message posting editing form.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27079494
score: 0
has comment: http://stackoverflow.com/comment/42669118
answer count: 1
has comment: http://stackoverflow.com/comment/42669014
has comment: http://stackoverflow.com/comment/42669199
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42668992
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Good evening, I'm sorry for my english. I want to try to deduce, using a link from json in the console. Sometimes is used json-simple-1.1.1.jar. I do not understand what the problem is, writes Exception in thread "main" java.lang.NullPointerException at kkkkkkkkkkkk.main.main (main.java:34) private static final String filePath = "http://ksupulse.tk/get_all.php"; public static void main(String[] args) throws org.json.simple.parser.ParseException { try { URL serverAddress = new URL(filePath); HttpURLConnection connection = (HttpURLConnection) serverAddress.openConnection(); connection.connect(); int rc = connection.getResponseCode(); if(rc == 200) { String line = null; BufferedReader reader = new BufferedReader(new java.io.InputStreamReader(connection.getInputStream())); StringBuilder sb = new StringBuilder(); while((line = reader.readLine()) != null) sb.append(line + '\n'); JSONObject obj = (JSONObject) JSONValue.parse(sb.toString()); //error JSONArray array = (JSONArray) obj.get("response"); //&lt;-------err this line for(int i = 0; i &lt; array.size(); i++) { JSONObject list = (JSONObject) ((JSONObject)array.get(i)).get("list"); System.out.println(list.get("id")+": "+list.get("name")); } } else { System.out.println("Connect error"); } connection.disconnect(); } catch (java.net.MalformedURLException e) { e.printStackTrace(); } catch (java.net.ProtocolException e) { e.printStackTrace(); } catch (java.io.IOException e) { e.printStackTrace(); } }
has title: Download JSON from URL(java)
has answer: http://stackoverflow.com/a/27079717
accepted answer: http://stackoverflow.com/a/27079717

http://stackoverflow.com/a/27107525
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42718187
has body: Use lookaround: String regex = "(?<=\\s)([a-zA-Z]+)(?=\\s)"; ... text = text.replaceAll(regex, " $1 ");
upvote count: 2
answers question: http://stackoverflow.com/q/27107484
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27107484

http://stackoverflow.com/comment/42794829
score: 4
type: Comment
has text: can you post what you have done so far.
type: QuestionComment
comment on: http://stackoverflow.com/q/27150125

http://stackoverflow.com/a/27085981
has comment: http://stackoverflow.com/comment/42681036
answers question: http://stackoverflow.com/q/27085877
has body: You should wait until the JQuery.active retuns 0. Mine is written in c#. Addition to this, we can also wait for a specific element that you know will satisfy your wait criteria. You can use fluentWait or write your custom wait to wait until the element exists. public void WaitForAjax() { var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(15)); wait.Until(d =&gt; (bool)(d as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0")); } EDIT: Java version public void waitForAjaxLoad(WebDriver driver) throws InterruptedException{ JavascriptExecutor executor = (JavascriptExecutor)driver; if((Boolean) executor.executeScript("return window.jQuery != undefined")){ while(!(Boolean) executor.executeScript("return jQuery.active == 0")){ Thread.sleep(1000); } } return; } Directly taken from here
score: 0
has comment: http://stackoverflow.com/comment/42680836
type: Answer

http://stackoverflow.com/a/27110109
type: Answer
answers question: http://stackoverflow.com/q/27109981
score: 2
upvote count: 2
has body: Your error is there : if(digits.length()==0) p.println(prefix); String s=keypad(digits.charAt(0)); Without a return statement in the if or an else to wrap the following the last line will be executed even with an empty string, resulting in this exception.
downvote count: 0

http://stackoverflow.com/q/27107535
has comment: http://stackoverflow.com/comment/42742335
has answer: http://stackoverflow.com/a/27107916
linked to: http://stackoverflow.com/q/10072914
has comment: http://stackoverflow.com/comment/42748613
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/42724398
has body: I'm using a method that calculates the next Monday from a given date string. public static String getStartOfNextWeek(String DATE){ String format = "dd.MM.yyyy";SimpleDateFormat df = new SimpleDateFormat(format); Date date = null; try { date = df.parse(DATE); } catch (ParseException e) { e.printStackTrace(); } Calendar cal = Calendar.getInstance(); cal.setTime(date); int week = cal.get(Calendar.WEEK_OF_YEAR); int year = cal.get(Calendar.YEAR); Calendar calendar = new GregorianCalendar(); calendar.clear(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.WEEK_OF_YEAR, week); //add 8 days to get next weeks Monday calendar.add(Calendar.DAY_OF_WEEK, 8); Date startDate = calendar.getTime(); SimpleDateFormat df2 = new SimpleDateFormat("dd.MM.yyyy"); String start = df2.format(startDate); return start; This work perfectly fine over a single calendar year, but when I'm passing a value that spans two calendar years problems arise. For example: input: 15.12.2014 output: 22.12.2014 CORRECT input: 22.12.2014 output: 29.12.2014 CORRECT input: 29.12.2014 output: 6.1.2014 INCORRECT I realize where the mistake is located, since it takes WEEK_OF_YEAR as "1", but YEAR as "2014", so the output is technically correct. Just wrong for my purpose. How would i best tell the calendar object that i want the next monday in week 1, but 2015?
tagged with: calendar
has answer: http://stackoverflow.com/a/27120709
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/48697062
linked to: http://stackoverflow.com/q/9612328
has title: Issue with Calendar calculation that spans 2 calendar years
accepted answer: http://stackoverflow.com/a/27120709
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26754164
type: Question
possible better answer: http://stackoverflow.com/a/27107916
linked to: http://stackoverflow.com/q/7565356

android-activity
tags question: http://stackoverflow.com/q/27080444
tags question: http://stackoverflow.com/q/27008310
tags question: http://stackoverflow.com/q/27081875
tags question: http://stackoverflow.com/q/27082999
tags question: http://stackoverflow.com/q/27062320
tags question: http://stackoverflow.com/q/26997163
tags question: http://stackoverflow.com/q/27028865
tags question: http://stackoverflow.com/q/27143875
tags question: http://stackoverflow.com/q/27044265
tags question: http://stackoverflow.com/q/26994262
tag name: android-activity
tags question: http://stackoverflow.com/q/27068849
tags question: http://stackoverflow.com/q/27064340
tags question: http://stackoverflow.com/q/27061491
tags question: http://stackoverflow.com/q/27132390
tags question: http://stackoverflow.com/q/27110187
tags question: http://stackoverflow.com/q/27140584
tags question: http://stackoverflow.com/q/27079867
tags question: http://stackoverflow.com/q/27013131
tags question: http://stackoverflow.com/q/27018781
tags question: http://stackoverflow.com/q/27080326
tags question: http://stackoverflow.com/q/27093124
tags question: http://stackoverflow.com/q/27046612
tags question: http://stackoverflow.com/q/27138952
type: Tag
tags question: http://stackoverflow.com/q/27077346

http://stackoverflow.com/q/27076336
has title: how to dynamically change the position of buttons
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27079570
tagged with: android
has comment: http://stackoverflow.com/comment/42664227
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: android-layout
has body: I have a MainActivity initially empty with an action bar. Clicking on the "plus" in the action bar,I open a DialogFragment with an EditText and two buttons, "cancel" and "continue". I can not post a picture because I do not have enough reputation, but when I click on "continue" I create two buttons; one positioned at the top right of the layout of MainActivity and the other, just below the previous one, on the left. What I would like is that every time I click on "continue", I can create two buttons positioned according to the same pattern that I explained earlier. This is the code I've written but it does not work as I would like. MainActivity public class MainActivity extends FragmentActivity implements IProjectDialFrag { private ProjectDialogFragment projectDialFrag = new ProjectDialogFragment(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.action_settings: //TODO return true; case R.id.filters: Intent intent1 = new Intent(MainActivity.this, FiltersActivity.class); startActivity(intent1); return true; case R.id.action_new: return true; case R.id.add_button: Intent intent2 = new Intent(MainActivity.this, ButtonsActivity.class); startActivity(intent2); return true; case R.id.add_project: projectDialFrag.show(getFragmentManager(), "projectDialog"); return true; default: return super.onOptionsItemSelected(item); } } @Override public void onDialogNegativeClick(DialogFragment dialog) { return; } @Override public void onDialogPositiveClick(DialogFragment dialog) { EditText editText = (EditText) dialog.getDialog().findViewById(R.id.project_name); String projectName = editText.getText().t…
has comment: http://stackoverflow.com/comment/42666062
has answer: http://stackoverflow.com/a/27145688
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/71179897
tagged with: button
has comment: http://stackoverflow.com/comment/42663600
has answer: http://stackoverflow.com/a/27078625
has comment: http://stackoverflow.com/comment/42663599
favorite count: 0

http://stackoverflow.com/q/27075992
has body: Here is my code. When output printing that print white space between paragraphs also. How can I remove white spaces between paragraphs and then I want to store sentence by sentence in array list. public static void main(String[] args) { try { String url = "http://www.divaina.com/"; System.setProperty("http.proxyHost", "cache.mrt.ac.lk"); System.setProperty("http.proxyPort", "3128"); Document doc = Jsoup.connect(url).timeout(10000).get(); Elements paragraphs = doc.select("p"); for(Element p : paragraphs){ System.out.println(p.text());} } catch (IOException ex) { ex.printStackTrace(); } } When I'm directly adding content into database white spaces also adding it. How can I remove those white spaces between paragraphs? Actually I want to read content of web page and line by line adding to the database. Is there any other proper way to do it?
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27076028
has answer: http://stackoverflow.com/a/27076028
has title: How to remove white spaces between paragraph in Jsoup output paragraphs?
has answer: http://stackoverflow.com/a/27077239
type: AnsweredQuestion
tagged with: java
tagged with: whitespace
accepted answer: http://stackoverflow.com/a/27077239
type: Question
tagged with: jsoup

http://stackoverflow.com/q/27071044
has answer: http://stackoverflow.com/a/27072111
favorite count: 0
has comment: http://stackoverflow.com/comment/42654980
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42655200
has answer: http://stackoverflow.com/a/27071486
has comment: http://stackoverflow.com/comment/42654977
has comment: http://stackoverflow.com/comment/42654921
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: stored-procedures
has comment: http://stackoverflow.com/comment/42654704
has body: I need to create Stored procedure dynamically,from my code of Java.I searched for any kind of example but can't find anything.In the internet I found a lot of examples of how to run stored procedure,but I need to create it from my code.What I tried to do is : StringBuilder strbuild=new StringBuilder(); strbuild.append("USE [ARGOS] \n"); strbuild.append("GO\n"); strbuild.append("SET ANSI_NULLS ON\n"); strbuild.append("GO\n"); strbuild.append("SET QUOTED_IDENTIFIER ON\n"); strbuild.append("GO\n"); strbuild.append("CREATE PROCEDURE [dbo].[sptest10] \n"); strbuild.append("as select *\n"); strbuild.append("FROM [ARGOSCOPE].[dbo].[TableTmp2] \n"); strbuild.append("GO\n"); Statement stmt = myconnection.createStatement(); ResultSet rs = stmt.executeQuery(strbuild.toString()); But it doesn't work.Any suggestions?
has comment: http://stackoverflow.com/comment/42654822
has title: Create Stored procedure dynamically by Java in MS SQL server 2012
has comment: http://stackoverflow.com/comment/42654997
tagged with: sql-server
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/42586552
comment on: http://stackoverflow.com/q/27032318
score: 0
type: Comment
type: QuestionComment
has text: @Sachini nope its actually file_location through out my code, i didnt copy and paste, thats why i messed up

http://stackoverflow.com/comment/42702672
has text: `Foo<T>` must be an `interface` not a `class`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27098993
score: 1

http://stackoverflow.com/q/27053702
has body: Here's the necessary code. I'm trying to use two different views for rows within the same listview. I want one set of arraylist to be inflated as row, and then another. But what happens is the rows get inflated one upon another. Code : @Override public int getItemViewType(int position) { if (position &lt; (mContactsNumber.size())) { a = 0; return a; } else { a = 1; return a; } } @Override public int getViewTypeCount() { return 2; } @Override public View getView(int i, View view, ViewGroup viewGroup) { final int pos = i; int type = getItemViewType(i); View v = view; if (view == null) { switch (type) { case 0: v = mInflater.inflate(R.layout.contacts_row, null); name = (TextView) v.findViewById(R.id.contact_name); name.setText(mContactsNames.get(i)); break; case 1: v = mInflater.inflate(R.layout.manual_row, null); mManual = (TextView) v.findViewById(R.id.manual_number); mSwitch = (SwitchCompat) v.findViewById(R.id.manual_switch); mManual.setText(mPermanentManual.get(i)); mSwitch.setTag(i); try { if (mManualList.contains(mPermanentManual.get(i))) { mSwitch.setChecked(true); } } catch (Exception e) { e.printStackTrace(); } break; } return v; }
accepted answer: http://stackoverflow.com/a/27053822
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has title: Rows in ListView inflating one upon another
answer count: 1
has answer: http://stackoverflow.com/a/27053822
has comment: http://stackoverflow.com/comment/42626825
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/27087362
type: Answer
has body: getText() returns null because the currently selected XML entry (don't read tag or element) doesn't have any text. This is because the currently selected XML entry is of the type: opening tag. What you should do is call next() so the XML parser selects the next XML entry which is of the type: text. The XML entry after another next call will be of the type: closing tag.
accepted answer of: http://stackoverflow.com/q/27087203
answers question: http://stackoverflow.com/q/27087203
score: 0
type: AcceptedAnswer

shell
tags question: http://stackoverflow.com/q/27077101
tags question: http://stackoverflow.com/q/27045979
tag name: shell
tags question: http://stackoverflow.com/q/27054044
tags question: http://stackoverflow.com/q/27040512
tags question: http://stackoverflow.com/q/27064871
tags question: http://stackoverflow.com/q/27146736
type: Tag
tags question: http://stackoverflow.com/q/27028791
tags question: http://stackoverflow.com/q/27052106
tags question: http://stackoverflow.com/q/27020819

http://stackoverflow.com/q/27142662
has body: If I write the Java method public static void f(int... x) { for (int a: x) { System.out.println(a); } } then I can call this method via f(1, 2, 3); as well as f(new int[]{1, 2, 3}); and both calls are treated exactly the same. However, the two calls Arrays.asList(1, 2, 3) // (a) produces a three-element Integer list and Arrays.asList(new int[]{1, 2, 3}) // (b) produces a one-element list of Integer arrays are not treated the same. The section on evaluating arguments in the JLS states "The final formal parameter of m necessarily has type T[] for some T" so why isn't the "final formal parameter" in case (b) above not an integer array which would create a three-element list, like case (a)? The only thing I can think of is that Arrays.asList is generic, and something about type compatibility (mentioned in JLS Section 15.12.4.2) is at play here, but I can't quite put my finger on the actual sentence in the JLS that makes the two cases different. The commentary in the JLS talks about the need to craft these semantics carefully in order to handle the interplay between "parameterized types and array types that occurs in a Java Virtual Machine with erased generics" but what we end up is my function f and Arrays.asList appearing to behave inconsistent. In the former case I can "unpack" or "pack" my args and all is the same; in the latter case, the two cases are different. How is this explained in language-lawyer terms?
type: Question
answer count: 2
tagged with: arrays
downvote count: 0
favorite count: 0
has title: How can one explain this seemingly inconsistent Java varargs behavior?
upvote count: 8
tagged with: generics
tagged with: variadic-functions
score: 8
has answer: http://stackoverflow.com/a/27142794
has answer: http://stackoverflow.com/a/27142810
accepted answer: http://stackoverflow.com/a/27142794
has comment: http://stackoverflow.com/comment/42792984
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27142810

http://stackoverflow.com/q/27105745
has comment: http://stackoverflow.com/comment/42715012
accepted answer: http://stackoverflow.com/a/27105897
has comment: http://stackoverflow.com/comment/42715053
has answer: http://stackoverflow.com/a/27105932
score: 0
has answer: http://stackoverflow.com/a/27105891
has comment: http://stackoverflow.com/comment/42714837
has body: What it comes down to is I'm attempting to construct a List&lt;T&gt; from the java.util.List package based on an enumerator, but here's the catch- I don't want the first value to be in the list. The way that I've come up with doing this... Well... It can't be a good thing. Here's the code I'm using: Arrays.asList(Arrays.asList(MyEnum.values()).remove(0)); This effectively creates a List&lt;> from my enum, and removes the first value, then tries to create another list with the created list. This may actually be the correct way to do it, but just looking at it is screaming "Inefficient". I showed it to a few people on a forum that I'm a member of and they all said how ugly it was, and laughed; However not a single one of them could/would provide a better way to go about doing it.
has comment: http://stackoverflow.com/comment/42714947
has comment: http://stackoverflow.com/comment/42714921
has title: Constructing a List<T> from an Enum
tagged with: collections
has comment: http://stackoverflow.com/comment/42714969
answer count: 4
has answer: http://stackoverflow.com/a/27107880
has comment: http://stackoverflow.com/comment/42715073
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42715061
possible better answer: http://stackoverflow.com/a/27105891
tagged with: java
has comment: http://stackoverflow.com/comment/42714750
has comment: http://stackoverflow.com/comment/42714779
type: Question
has comment: http://stackoverflow.com/comment/42714912
has answer: http://stackoverflow.com/a/27105897

http://stackoverflow.com/a/34830478
has comment: http://stackoverflow.com/comment/101048419
has body: i modified the application-prod.yml and set up the connection string of the mysql in that way: url: jdbc:mysql://127.0.0.1:3306/databasename?user=root&amp;password=rootpassword&amp;useUnicode=true&amp;characterEncoding=utf8 and works ok
type: Answer
answers question: http://stackoverflow.com/q/27084150
score: 1
downvote count: 3
upvote count: 4

http://stackoverflow.com/q/27142551
has comment: http://stackoverflow.com/comment/42782421
has comment: http://stackoverflow.com/comment/42781918
score: 1
tagged with: java
tagged with: thread-priority
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27152445
downvote count: 0
has body: i made a program using Thread priority and i got the same number of clicks for both thread with priority 1 and thread with priority 10 , its confusing why i am getting this class clicker implements Runnable { int click = 0; Thread t; private volatile boolean running = true; public clicker(int p) { t = new Thread(this); t.setPriority(p); } public void run() { while (running) { click++; } } public void stop() { running = false; } public void start() { t.start(); } } class hilopri { public static void main(String args[]) { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); clicker hi = new clicker(1); clicker lo = new clicker(10); lo.start(); hi.start(); try { Thread.sleep(10000); } catch (InterruptedException e) { System.out.println("Main thread interrupted."); } lo.stop(); hi.stop(); // Wait for child threads to terminate. try { hi.t.join(); lo.t.join(); } catch (InterruptedException e) { System.out.println("InterruptedException caught"); } System.out.println("Low-priority thread: " + lo.click); System.out.println("High-priority thread: " + hi.click); } } the output is almost the same regardless of the priority Low-priority thread: 322141133 High-priority thread: 477591649
favorite count: 0
tagged with: interface
has title: Thread priority does not work as expected?
has comment: http://stackoverflow.com/comment/42782022
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/27142605

http://stackoverflow.com/comment/42678259
type: Comment
has text: Tab spacing isn't something platform-specific. It is up to the editor or gui component configuration to determine how tabs are rendered as far as i know. I guess you could use spaces instead if you need fixed size of the indent everywhere.
comment on: http://stackoverflow.com/a/27084448
score: 1
type: AnswerComment

http://stackoverflow.com/q/27001610
has answer: http://stackoverflow.com/a/35759327
type: Question
has body: I'm getting to know Java 8 Stream API and I am unsure how to signal to a consumer of a stream that the stream is completed. In my case the results of the stream-pipeline will be written in batches to a database or published on a messaging service. In such cases the stream-pipeline should invoke a method to "flush" and "close" the endpoints once the stream is closed. I had a bit of exposure to the Observable pattern as implemented in RxJava and remember the Observer#onComplete method is used there for this purpose. On the other hand Java 8 Consumer only exposes an accept method but no way to "close" it. Digging in the library I found a sub-interface of Consumer called Sink which offers an end method, but it's not public. Finally I thought of implementing a Collector which seems to be the most flexible consumer of a stream, but isn't there any simpler option?
possible better answer: http://stackoverflow.com/a/27002214
has title: Java 8 equivalent of (RxJava) Observable#onComplete()
has answer: http://stackoverflow.com/a/27002214
has answer: http://stackoverflow.com/a/27003112
score: 2
downvote count: 0
favorite count: 0
tagged with: rx-java
has comment: http://stackoverflow.com/comment/42533737
has comment: http://stackoverflow.com/comment/42566955
tagged with: java-8
accepted answer: http://stackoverflow.com/a/27003112
answer count: 4
type: AnsweredQuestion
tagged with: java-stream
has answer: http://stackoverflow.com/a/57286671
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/42740474
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27118717
has text: thanks yts... i could do it with the way you showed me as well.. just trying both...
type: AnswerComment

http://stackoverflow.com/a/26997101
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26996939
answers question: http://stackoverflow.com/q/26996939
has body: Without the text file, it is hard to guess, but I suppose there is a blank line at the end of the file. You could prevent this error by chaning the inner loop to while (in.hasNext()) { inName = in.next(); //Use next() to read string names.add(inName); } I hope it helps.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/50048980
type: AnswerComment
comment on: http://stackoverflow.com/a/27127139
type: Comment
score: 0
has text: That's the title of the question, not the question itself. But what is wrong with the solution outlined in the comments? Why would I duplicate the solution already provided in the comments below the question?

http://stackoverflow.com/q/27106079
has title: Get content from outputstream
tagged with: outputstream
has answer: http://stackoverflow.com/a/27106719
type: Question
has comment: http://stackoverflow.com/comment/42716135
has answer: http://stackoverflow.com/a/27106223
has comment: http://stackoverflow.com/comment/42716399
has comment: http://stackoverflow.com/comment/42715977
has comment: http://stackoverflow.com/comment/42715493
has body: I am using a really old Java version and i am missing a lot of classes. The system runs on an embedded platform. There is a class to execute system commands, but the output from the command is discarded. Is there anyway to cache or get this output another way? There is another java application that is not coded by us that we interact with. This application starts a test and output the results in the shell. We are not able to edit the source code of that application. Any suggestions?
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/8708342
tagged with: output
has answer: http://stackoverflow.com/a/27106599
has comment: http://stackoverflow.com/comment/42716253
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27106240
tagged with: caching
has comment: http://stackoverflow.com/comment/42715712

http://stackoverflow.com/a/27045050
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/27044988
has body: I think first you need to replace row == "top" and other string comparision using String.equals(String) methods

http://stackoverflow.com/a/26997839
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26992163
type: Answer
has body: I don't know any specific frameworks that support your requirements but I can think of two approaches how you can implement it on your own or integrate it in existing web frameworks. OSGI: The Apache Felix FileInstall module can automatically install and start OSGi bundles that are dropped into monitored directories. In theory, with the right server and http support modules, you can drop in your webapp bundle jar files and the OSGi container will deploy them and route all requests to the paths specified in the webapps web.xml file to your plugin. In practice you have to learn a lot about OSGi beforehand and possible experiment a lot with different implementations of the OSGi specifications. OSGi sounds good for the features you want and certainly can do the job well, but it might be overkill if your project is small. SPI: If you want to go for something (much) simpler, take a look at the SPI (Service Provider Interface) API. You need to implement most features by hand with SPI though. There is no plugin lifecycle like in OSGi, but that's ok if you only want to deploy and don't plan to undeploy. You need to implement dynamic loading of jars yourself, for example like described in this question. I don't know about Spring MVC, but you should actually be able to integrate this approach any web framework that supports dynamic addition of pages after the framework has been started. The main application would need to register all installed webapp services in the web framework and add them in the menu group. The webapps could load the site layout, menu, assets etc. from the main application and add their own content and functionality, preferably using some DI framework for all of this.
score: 1
accepted answer of: http://stackoverflow.com/q/26992163
upvote count: 1

http://stackoverflow.com/comment/42760015
score: 0
type: AnswerComment
type: Comment
has text: @JimMischel: You might have a point, and I did consider that something might have been lost in translation (whether language-to-language or interviewer-to-community). However, I stand firm on my point that digits only ever exist in a string representation of a number. Sopel's answer operates on digits, but it is still doing a DIY-`toString`. And that if the interviewer ever mentioned the local equivalent of "binary number" instead of the local equivalent of "numeric" or "mathematical", it can't be anything but a red herring or bloody stupidity, unless they actually wanted binary digits sorted.
comment on: http://stackoverflow.com/a/27120080

http://stackoverflow.com/comment/43343997
score: 0
type: Comment
has text: I already tried the public ip of my host in the listen_address. I didn't try to change the seeds but it could be the issue. I saw failure around ring at the client side. I'll try to change this ASAP and keep you posted. Thx
comment on: http://stackoverflow.com/a/27349838
type: AnswerComment

http://stackoverflow.com/comment/63695394
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27074031
has text: If anyone has any idea how to fix this, I am all ears. The -clearPersistedState flag works, but obviously all my changes to a perspective are lost. This is a behavior that my users will not appreciate. If I take out the clearPersistedState flag, my alterations are preserved, but none of my e4 menu items show. I am going to need to use the compatibility layer.
score: 0

playframework-2.0
tags question: http://stackoverflow.com/q/27064044
tags question: http://stackoverflow.com/q/27063562
type: Tag
tags question: http://stackoverflow.com/q/27138744
tag name: playframework-2.0
tags question: http://stackoverflow.com/q/27145055
tags question: http://stackoverflow.com/q/27063439

http://stackoverflow.com/q/27102167
tagged with: google-glass
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
answer count: 0
tagged with: android-hardware
tagged with: java
has title: Custom Zoom On Google Glass, Image captured is not what preview shows
tagged with: google-gdk
type: Question
tagged with: android-camera
has body: So I successfully implemented my own zoom feature on the Google Glass because right now Google did not add this feature. It looks like so: @Override public boolean onFling( MotionEvent e1, MotionEvent e2, float velocityX, float velocityY ) { Camera.Parameters parameters = mCamera.getParameters(); parameters.setPreviewFpsRange(30000, 30000); int zoom = parameters.getZoom(); if ( velocityX &lt; 0.0f ) { zoom -= 10; if ( zoom &lt; 0 ) zoom = 0; } else if ( velocityX &gt; 0.0f ) { zoom += 10; if ( zoom &gt; parameters.getMaxZoom() ) zoom = parameters.getMaxZoom(); } mCamera.startSmoothZoom(zoom); return false; } Then I detect if the surface changed and call a preview function to update the preview on the screen: private void initPreview(int width, int height) { if ( mCamera != null &amp;&amp; mPreviewHolder.getSurface() != null) { try { mCamera.setPreviewDisplay(mPreviewHolder); } catch (Throwable t) { Log.e(TAG, "Exception in initPreview()", t); Toast.makeText(CameraZoom.this, t.getMessage(), Toast.LENGTH_LONG).show(); } if ( !mCameraConfigured ) { Camera.Parameters parameters = mCamera.getParameters(); parameters.setPreviewFpsRange(30000, 30000); parameters.setPreviewSize(1920, 1080); // hard coded the largest size for now mCamera.setParameters(parameters); mCamera.enableShutterSound(true); mCamera.setZoomChangeListener(this); mCameraConfigured = true; } } } The problem is when I call the camera to take the picture, it takes a picture of the preview that is significantly above where the preview is at. The height is not getting set to the preview parameters or something I am not sure. This is is the call to capture: public void onClick(View v) { mCamera.takePicture(null, null, capturedIt); } and captureIt is just a PictureCallback. So in summary the image in the preview is not the one being captured by the camera. Any help would be much appreciated.

http://stackoverflow.com/comment/42740811
comment on: http://stackoverflow.com/q/27119494
type: QuestionComment
has text: You don't necessarily need to 'put' it in a bundle. You can create a 'setter' as @Ammar suggested and it should be ideally called anytime before `beginTransaction()` gets called
type: Comment
score: 2

http://stackoverflow.com/a/27146024
has body: You can get it from Session, and you can get Session from EntityManager. // EntityManagerImpl is from package org.eclipse.persistence.internal.jpa Session session = ((EntityManagerImpl) entityManager).getActiveSession(); Project project = session.getProject();
type: Answer
answers question: http://stackoverflow.com/q/27138272
has comment: http://stackoverflow.com/comment/42809323
score: 0

http://stackoverflow.com/comment/42723153
has text: You know your environment best, but if you are simply pulling and inserting, I cannot see where the memory is being used even if you have billions of rows. Do you mean the database-process itself will use too much memory with a query that brings everything back? Or do you mean your program?
comment on: http://stackoverflow.com/a/27107136
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27054370
has comment: http://stackoverflow.com/comment/42625329
accepted answer of: http://stackoverflow.com/q/27054320
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42625425
has comment: http://stackoverflow.com/comment/42625785
has comment: http://stackoverflow.com/comment/42625529
has body: For sharing this code with others you can try using in-memory h2 database &lt;property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test;DB_CLOSE_DELAY=1000"/&gt;
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27054320

http://stackoverflow.com/comment/42762724
comment on: http://stackoverflow.com/q/27131836
type: Comment
type: QuestionComment
has text: I understand that part but how do you 'draw' the card? is it a graphical card? is it plain text? please provide some sort of example code of your GUI, what have you tried thus far?
score: 0

http://stackoverflow.com/q/26999132
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/27001647
has title: Groovy read feature methods with reflection
has comment: http://stackoverflow.com/comment/42528977
has comment: http://stackoverflow.com/comment/42529306
tagged with: reflection
upvote count: 3
answer count: 1
tagged with: spock
tagged with: java
has comment: http://stackoverflow.com/comment/42565047
has answer: http://stackoverflow.com/a/27001647
tagged with: groovy
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has body: I am trying to use reflection to read fields and methods from a groovy class. Everything works great expect my feature methods like this: def "do something"(){ // } Using reflection I cannot find this "method name". Is there any way to read these feature methods by reflection? Thanks in advance!

http://stackoverflow.com/q/27141129
tagged with: java
has title: How to create two column and with auto number in jasper report to excel?
type: Question
tagged with: jasper-reports
has body: Hello i have a problem to create report that need to display as two column, but my output is like this the focus is the auto numbering value, anyone could help me??
has answer: http://stackoverflow.com/a/27141375
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/42625627
type: QuestionComment
comment on: http://stackoverflow.com/q/27054437
has text: @Honor I would suggest you refactor so that those aren't global. You haven't posted any relevant code, and your question was is it possible? I think yes, but what happened when you ran it? Basically, what are you really asking?
score: 0
type: Comment

classloader
tags question: http://stackoverflow.com/q/27141270
tags question: http://stackoverflow.com/q/27048214
tags question: http://stackoverflow.com/q/27071941
tags question: http://stackoverflow.com/q/27071280
type: Tag
tags question: http://stackoverflow.com/q/27115371
tags question: http://stackoverflow.com/q/27066726
tags question: http://stackoverflow.com/q/27099241
tag name: classloader

loops
tags question: http://stackoverflow.com/q/27073572
tags question: http://stackoverflow.com/q/27112226
tags question: http://stackoverflow.com/q/27076758
tags question: http://stackoverflow.com/q/27025431
tags question: http://stackoverflow.com/q/27085007
tags question: http://stackoverflow.com/q/27117586
tags question: http://stackoverflow.com/q/27128394
tags question: http://stackoverflow.com/q/27073852
tags question: http://stackoverflow.com/q/27118483
tags question: http://stackoverflow.com/q/27079176
tags question: http://stackoverflow.com/q/27089020
tags question: http://stackoverflow.com/q/27137067
tags question: http://stackoverflow.com/q/27114661
tags question: http://stackoverflow.com/q/27008335
tags question: http://stackoverflow.com/q/27006670
tags question: http://stackoverflow.com/q/27098113
tags question: http://stackoverflow.com/q/27050696
type: Tag
tags question: http://stackoverflow.com/q/27036653
tags question: http://stackoverflow.com/q/27038502
tags question: http://stackoverflow.com/q/27058904
tags question: http://stackoverflow.com/q/27096016
tags question: http://stackoverflow.com/q/27139567
tags question: http://stackoverflow.com/q/27002146
tags question: http://stackoverflow.com/q/27042301
tags question: http://stackoverflow.com/q/27008937
tags question: http://stackoverflow.com/q/27115374
tags question: http://stackoverflow.com/q/27086357
tags question: http://stackoverflow.com/q/27138328
tags question: http://stackoverflow.com/q/27019788
tags question: http://stackoverflow.com/q/26995374
tags question: http://stackoverflow.com/q/27028457
tags question: http://stackoverflow.com/q/27071517
tags question: http://stackoverflow.com/q/27125457
tags question: http://stackoverflow.com/q/27092100
tag name: loops
tags question: http://stackoverflow.com/q/27031896
tags question: http://stackoverflow.com/q/27008835
tags question: http://stackoverflow.com/q/27112685
tags question: http://stackoverflow.com/q/27050757
tags question: http://stackoverflow.com/q/27141280
tags question: http://stackoverflow.com/q/27034264
tags question: http://stackoverflow.com/q/27024540
tags question: http://stackoverflow.com/q/26997040
tags question: http://stackoverflow.com/q/26997893
tags question: http://stackoverflow.com/q/27145854
tags question: http://stackoverflow.com/q/27011023
tags question: http://stackoverflow.com/q/27117589
tags question: http://stackoverflow.com/q/27019726

http://stackoverflow.com/a/50637937
has body: A complete standalone code to download all files recursively from an FTP folder: private static void downloadFolder( FTPClient ftpClient, String remotePath, String localPath) throws IOException { System.out.println("Downloading folder " + remotePath + " to " + localPath); FTPFile[] remoteFiles = ftpClient.listFiles(remotePath); for (FTPFile remoteFile : remoteFiles) { if (!remoteFile.getName().equals(".") &amp;&amp; !remoteFile.getName().equals("..")) { String remoteFilePath = remotePath + "/" + remoteFile.getName(); String localFilePath = localPath + "/" + remoteFile.getName(); if (remoteFile.isDirectory()) { new File(localFilePath).mkdirs(); downloadFolder(ftpClient, remoteFilePath, localFilePath); } else { System.out.println("Downloading file " + remoteFilePath + " to " + localFilePath); OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(localFilePath)); if (!ftpClient.retrieveFile(remoteFilePath, outputStream)) { System.out.println("Failed to download file " + remoteFilePath); } outputStream.close(); } } } }
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27137447

http://stackoverflow.com/q/27060890
answer count: 5
has title: Unknow symbol in while loop of java
accepted answer: http://stackoverflow.com/a/27060905
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27060905
type: Question
possible better answer: http://stackoverflow.com/a/27060938
has answer: http://stackoverflow.com/a/27060977
has body: I am reading some codes and I saw someone wrote while (T--&gt;0) I dont know what that means, I mean what the symbol --&gt; stand for. I am just beginner ,so sorry if my question is stupid
downvote count: 0
has answer: http://stackoverflow.com/a/27060929
favorite count: 0
has answer: http://stackoverflow.com/a/27060919
has answer: http://stackoverflow.com/a/27060938

http://stackoverflow.com/q/27070108
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44308169
score: 2
downvote count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/42657171
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/42661830
tagged with: encryption
tagged with: android
tagged with: cryptography
has body: I am trying to implement client-server architecture between Android device(client) and Java server (my laptop works as a normal server). I am trying to implement RSA algorithm to encrypt data sent by client and decrypt at the server. While sending I am first changing encrypted data to Base 64 string as : Client: byte[] dataToEncrypt = temp.getBytes(StandardCharsets.UTF_8); //temp is a String byte[] encryptedData = null; Cipher cipher = Cipher.getInstance("RSA"); //cipher.init(Cipher.ENCRYPT_MODE, serverPubKey); cipher.init(Cipher.ENCRYPT_MODE, pubKey); encryptedData = cipher.doFinal(dataToEncrypt); String cipherStr = Base64.encodeToString(encryptedData,Base64.DEFAULT); I send cipherStrto server where I am using following code to decrypt it. Server: byte[] decryptedData = null; System.out.println("Before Decryption:"); System.out.println(tmp); byte [] byteArray = Base64.decode(tmp); try { privKey = pair.getPrivate(); // System.out.println("PRIVATE KEY IN FUNCTION"+privKey); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, privKey); // System.out.println(new String(byteArray, StandardCharsets.UTF_8)); decryptedData = cipher.doFinal(byteArray); System.out.println("Decrypted Data: "); sentToDB = new String(decryptedData, StandardCharsets.UTF_8); } However, at the server end, I am receiving BadPaddingException Error: javax.crypto.BadPaddingException: Decryption error at sun.security.rsa.RSAPadding.unpadV15(Unknown Source) at sun.security.rsa.RSAPadding.unpad(Unknown Source) at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:363) at com.sun.crypto.provider.RSACipher.engineDoFinal(RSACipher.java:389) at javax.crypto.Cipher.doFinal(Cipher.java:2121) at sslservefr.simplesslserver$clientThread.run(simplesslserver.java:175) java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at sslservefr.simplesslserver$clientThread.run(simplesslserver.java:198) Can anyone please …
has comment: http://stackoverflow.com/comment/42978211
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/21190369
has title: Encrypt in Android - Decrypt in Java

http://stackoverflow.com/q/27020819
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42576549
has comment: http://stackoverflow.com/comment/42566262
has comment: http://stackoverflow.com/comment/42567019
tagged with: tomcat
score: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/42571793
tagged with: apache-commons-httpclient
tagged with: shell
has comment: http://stackoverflow.com/comment/42571216
answer count: 0
has title: Using HTTPClient to connect to site on same server - getting Connection refused
type: UnansweredQuestion
has body: I have a tomcat 5.0 server running various applications on a Unix server. On this same server, I have a shell script that uses org.apache.commons.httpclient and connect to a URL on one of the applications. This has worked for years. I have moved the applications to a Virtual Linux server and Tomcat 6.0. Now when I run the shell script, I get: java.net.ConnectException: Connection refused When I update the URL to an application on a different server, my shell scrip completes successfully. Why can’t I run my shell script and access the website running on the same server? And what can I do to make this work?
has comment: http://stackoverflow.com/comment/42571771

http://stackoverflow.com/a/27120076
has body: If you use Sigma notation, you can come up with the following:
type: Answer
answers question: http://stackoverflow.com/q/27095204
score: 0

http://stackoverflow.com/comment/42644242
type: AnswerComment
score: 0
type: Comment
has text: Actually I use MongoDB, but I wonder if it is the best for my use case.
comment on: http://stackoverflow.com/a/27065213

http://stackoverflow.com/q/27070724
type: Question
downvote count: 0
tagged with: ssl
tagged with: ssl-certificate
has body: Class KeyStore has a method called setCertificateEntry(alias, certificate). Most client examples I see use "ca" as the alias name. Is the server asking for "ca" automatically during the client-server handshake? What really would happen if I use "abc" instead of "ca?" Regards.
accepted answer: http://stackoverflow.com/a/27072660
tagged with: android
answer count: 1
score: 1
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has title: How is the alias name used in Java KeyStore class?
has answer: http://stackoverflow.com/a/27072660
tagged with: java

http://stackoverflow.com/a/71411722
score: 1
has body: If, like me, you're finally getting around to upgrading to log4j2 – because of the log4shell vulnerability – and you are accustomed to DailyRollingFileAppender rolling over at midnight, you should make that: <TimeBasedTriggeringPolicy modulate="true" />
answers question: http://stackoverflow.com/q/27043492
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42639172
type: QuestionComment
has text: From their sample tutorials they say:"The best way to maintain volley core objects and request queue is, making them global by creating a singleton class which extends Application object."
comment on: http://stackoverflow.com/q/27062188
score: 0
type: Comment

http://stackoverflow.com/a/27030986
type: Answer
has comment: http://stackoverflow.com/comment/42584049
answers question: http://stackoverflow.com/q/27030898
downvote count: 0
score: 1
has body: That is not a valid json, you are looking for something like this i suppose, first show us what you have tried so far, we cant give a helpful answer if you havent tried anything first "studentsInfo": { "students": [ { "name": "aaa", "age": 21, "qualification": "B.E" }, { "name": "aaa", "age": 21, "qualification": "B.E" }, { "name": "aaa", "age": 21, "qualification": "B.E" } ] } Then read a little about Jackson it can do the mapping for you
upvote count: 1
has comment: http://stackoverflow.com/comment/42584094

http://stackoverflow.com/q/27089196
has comment: http://stackoverflow.com/comment/42685816
answer count: 2
accepted answer: http://stackoverflow.com/a/27089242
has comment: http://stackoverflow.com/comment/42707108
has comment: http://stackoverflow.com/comment/42685780
downvote count: 0
favorite count: 0
tagged with: atomic
tagged with: scjp
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42698414
has comment: http://stackoverflow.com/comment/42685973
type: AnsweredQuestion
has title: Is id = 1 - id atomic?
score: 73
tagged with: java
has answer: http://stackoverflow.com/a/27089242
upvote count: 73
has comment: http://stackoverflow.com/comment/42704224
possible better answer: http://stackoverflow.com/a/27179049
type: Question
has answer: http://stackoverflow.com/a/27179049
has body: From page 291 of OCP Java SE 6 Programmer Practice Exams, question 25: public class Stone implements Runnable { static int id = 1; public void run() { id = 1 - id; if (id == 0) pick(); else release(); } private static synchronized void pick() { System.out.print("P "); System.out.print("Q "); } private synchronized void release() { System.out.print("R "); System.out.print("S "); } public static void main(String[] args) { Stone st = new Stone(); new Thread(st).start(); new Thread(st).start(); } } One of the answers is: The output could be P Q P Q I marked this answer as correct. My reasoning: We are starting two threads. First one enters run(). According to JLS 15.26.1, it firstly evaluates 1 - id. Result is 0. It is stored on the thread's stack. We are just about to save that 0 to static id, but... Boom, scheduler chooses the second thread to run. So, the second thread enters run(). Static id is still 1, so he executes method pick(). P Q is printed. Scheduler chooses first thread to run. It takes 0 from its stack and saves to static id. So, the first thread also executes pick() and prints P Q. However, in the book it's written that this answer is incorrect: It is incorrect because the line id = 1 - id swaps the value of id between 0 and 1. There is no chance for the same method to be executed twice. I don't agree. I think there is some chance for the scenario I presented above. Such swap is not atomic. Am I wrong?
tagged with: swap

decode
tags question: http://stackoverflow.com/q/27123411
type: Tag
tag name: decode
tags question: http://stackoverflow.com/q/27151092

http://stackoverflow.com/comment/139230726
has text: documentation link please
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/67301586

http://stackoverflow.com/comment/42612794
type: Comment
comment on: http://stackoverflow.com/q/27047322
type: QuestionComment
score: 0
has text: What about this specifically confuses you? Where's your attempt?

http://stackoverflow.com/a/27101188
score: 1
upvote count: 1
has body: You have indeed interpreted the Excel formula correctly, but there are three things that stop your code from being "correct Java". Expressions like "P", "F" and so on don't really have any effect sitting by themselves between { and }. The thing about the Excel formula is that it actually has a value; and that's something that a series of Java if and else statements don't actually have. If you want a value, you could either write all of this as a Java method that returns a value, or you could use the ternary operator ? : to create a single expression with the value that you desire. To compare strings in Java, you almost always want to use the equals method, instead of the == operator. The reason is that two different String objects might have the same value; but in this case, == will return false for them, but equals will return true. It's not clear what type R3 is. At one point, you treat it as if its type were String, and at another point, you treat it as a numeric variable. Unlike Excel formulas, any expression in Java has a well defined data type. Translating the formula into a Java expression, and being careful of these three issues, we get something like this. d3.equals("Feather") ? ((i3 &gt; 1000 || r3.equals("n/a")) ? "" : w3.equals("F") ? "F" : (i3 &lt;= 1000 &amp;&amp; Integer.parseInt(r3) &gt; 8) ? "F" : "P" ) : "" But this is a bit hard to read, because there are too many ternary operators. Most people would prefer to write this as a method, something like this. public String excelFormula(String d3, int i3, String r3, String w3) { if (d3.equals("Feather")) { if (i3 &gt; 1000 || r3.equals("n/a")) { return ""; } else if (w3.equals("F")) { return "F"; } else if (i3 &lt;= 1000 &amp;&amp; Integer.parseInt(r3) &gt; 8) { return "F"; } else { return "P"; } } else { return ""; } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27098584
type: Answer
accepted answer of: http://stackoverflow.com/q/27098584

http://stackoverflow.com/q/27083395
tagged with: methods
has title: How to use a method to a JOptionPane.showInputDialog in main with arrays?
type: Question
tagged with: arrays
score: 0
answer count: 1
has body: I have an assignment to create a program where I need a series of methods that are called from main which are passed arrays. I have 3 arrays. I need to create a program which should have the arrays declared in the main and passed as arguments to methods. All arrays should be passed as an argument to a method which asks for input. So basically 2 methods including main. Right now, my code looks a little like this, but it doesn't do what I need. class testArrayMethod { public static void main(String [] params) { String[] array1 = {"Test1","Test2","Test3","Test4","Test5"}; String[] array2 = {"1tseT","2tseT","3tseT","4tseT","5tseT"}; int[] array3 = {5,10,15,20,25}; JOptionPane.showMessageDialog(null, "Yes or No?"); JOptionPane.showInputDialog(null, array_input(array1,array2,array3)); System.exit(0); } public static String array_input(String[] a, String[] b, int[] c) { String q = ""; for (int i=0; i&lt;a.length; i++) { q += "Array 1: " + a[i] + "\n" + "Array 2: " + b[i] + "\n" + "Array 3: " + c[i] + "\n"; } return q; } } Right now it prints all of the array information on to a single InputDialog, but I need it to print to 5 different ones, I need some sort of different loop mechanism I guess? This is a university assignment so if you can somehow explain it to me without simply doing it I would really be glad, I want to understand and learn this.
has answer: http://stackoverflow.com/a/27084293
accepted answer: http://stackoverflow.com/a/27084293
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27083700
has answer: http://stackoverflow.com/a/27083752
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27083772
accepted answer: http://stackoverflow.com/a/27083772
tagged with: cmd
upvote count: 1
has title: Reading file passed in cmd
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27083752
has body: i have problem which is probably easy but in can't figure it out. I'm writing simple java program called task1 to read a file and calculate some values. I run this program in cmd like this: cmd: java task1 calculate Word "calculate" after "task1" is an argument which start my method to calculate some values. But i would like to calculate some values in a file called values.txt. My problem is that i don't know how to write my code to that read file. This file is passed as argument in cmd like that: cmd: java task1 calculate &lt; values.txt hope, you can understand my problem. It Would be awesome if you can just tell me how to print this values in my file if(args.length == 0) { System.out.println("Insert some arguments"); } else if(args[0].equals("calculate")) { //here i would like to read my file (values.txt) } I appreciate your help and i am sorry for my bad English.
type: Question
answer count: 2

http://stackoverflow.com/q/27019343
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27024334
tagged with: android
has body: I'm porting my application to the new Android L. The app works fine except for the Overflow menu that have a glitch as you can see from the photos. Anyone know how to fix it? Thanks
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27024334
tagged with: android-5.0-lollipop
type: Question
has title: Android L shadow on overflow menu glitch
score: 3

http://stackoverflow.com/a/27077032
has body: It doesn't seem that the Ant script is calling java the same way as the batch file. The exec task is calling the following command: java -jar ${src.dir}/r-js/lib/rhino/js.jar ${src.dir}/r-js/lib/closure/compiler.jar ${src.dir}/r-js/dist/r.js -o ${src.dir}/r-js/build.js which is clearly different than the one in the .bat file, i.e. the jars are not being added to the classpath properly. In Ant, you can simply use the java task to run a Java class. Try using the following: &lt;java classname="org.mozilla.javascript.tools.shell.Main" failonerror="true"&gt; &lt;arg path="${src.dir}/r-js/dist/r.js" /&gt; &lt;arg value="-o"/&gt; &lt;arg path="${src.dir}/r-js/build.js" /&gt; &lt;classpath&gt; &lt;pathelement location="${src.dir}/r-js/lib/rhino/js.jar" /&gt; &lt;pathelement location="${src.dir}/r-js/lib/closure/compiler.jar" /&gt; &lt;/classpath&gt; &lt;/java&gt;
answers question: http://stackoverflow.com/q/27076840
score: 0
accepted answer of: http://stackoverflow.com/q/27076840
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27146271
answer count: 4
has answer: http://stackoverflow.com/a/32949449
favorite count: 0
has answer: http://stackoverflow.com/a/41505625
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/33399538
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/32949449
has body: Here's what I did: Downloaded Apache ZooKeeper 3.4.6 (.tar file), extracted to C:\cygwin\home\user\zookeeper-3.4.6\ Ran ant at the root of the ZooKeeper folder (C:\cygwin\home\user\zookeeper-3.4.6) Navigated to C:\cygwin\home\user\zookeeper-3.4.6\contrib\ZooInspector\ Ran ant, and I get the following error: Output: Buildfile: C:\cygwin\home\Jean\zookeeper-3.4.6\contrib\ZooInspector\build.xml BUILD FAILED C:\cygwin\home\user\zookeeper-3.4.6\contrib\ZooInspector\build.xml:19: Cannot find C:\cygwin\home\user\zookeeper-3.4.6\contrib\build-contrib.xml imported from C:\cygwin\home\user\zookeeper-3.4.6\contrib\ZooInspector\build.xml Total time: 0 seconds This leaves me with no .cmd or .sh file to execute. How come the build-contrib.xml file isn't there? Also, I noticed that there seems to be an already-compiled ZooInspector JAR file: zookeeper-3.4.6-ZooInspector.jar. However, attempting to run it with the following command yields failure too: $ java -cp zookeeper-3.4.6-ZooInspector.jar:lib/* org.apache.zookeeper.inspector.ZooInspector Error: Could not find or load main class org.apache.zookeeper.inspector.ZooInspector This is a bit frustrating -- setting up the ZooKeeper server was straightforward but for some reason I just can't figure out how to run this standalone GUI. What am I missing?
type: Question
tagged with: apache-zookeeper
downvote count: 0
has answer: http://stackoverflow.com/a/32541708
has title: How to run ZooInspector from Windows
tagged with: windows
has answer: http://stackoverflow.com/a/33399538

http://stackoverflow.com/a/27077485
accepted answer of: http://stackoverflow.com/q/27077199
score: 2
answers question: http://stackoverflow.com/q/27077199
has comment: http://stackoverflow.com/comment/42665511
has body: What you need is a single loop that increments all 4 counters, and prints 1-4 asterisks in the same line in each iteration. int i = 0; int j = 0; int k = 0; int l = 0; System.out.println("0-29 30-39 40-69 70-100"); while (i&lt;starsfrom0to29 || j &lt; starsfrom30to39 || k &lt; starsfrom40to69 || l &lt; starsfrom70to100) { if (i&lt;starsfrom0to29) { System.out.print(" * "); i++; } else { System.out.print(" "); } if (j&lt;starsfrom30to39) { System.out.print(" * "); j++; } else { System.out.print(" "); } if (k&lt;starsfrom40to69) { System.out.print(" * "); k++; } else { System.out.print(" "); } if (l&lt;starsfrom70to100) { System.out.println(" * "); l++; } else { System.out.println(""); } }
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42665442

http://stackoverflow.com/comment/42603621
comment on: http://stackoverflow.com/a/27040061
type: Comment
score: 0
type: AnswerComment
has text: this is not using jsp from other project, but redirecting to other view (which under the hood uses this jsp), but it is redirect

char
tags question: http://stackoverflow.com/q/27134247
tags question: http://stackoverflow.com/q/27121815
tags question: http://stackoverflow.com/q/27042715
tags question: http://stackoverflow.com/q/27021039
tags question: http://stackoverflow.com/q/27129181
type: Tag
tags question: http://stackoverflow.com/q/27089124
tags question: http://stackoverflow.com/q/27070031
tags question: http://stackoverflow.com/q/27079976
tags question: http://stackoverflow.com/q/27035215
tags question: http://stackoverflow.com/q/27117712
tags question: http://stackoverflow.com/q/27022630
tags question: http://stackoverflow.com/q/27071427
tags question: http://stackoverflow.com/q/27008908
tags question: http://stackoverflow.com/q/27147499
tags question: http://stackoverflow.com/q/27098713
tag name: char
tags question: http://stackoverflow.com/q/27044674
tags question: http://stackoverflow.com/q/27009184
tags question: http://stackoverflow.com/q/27059203
tags question: http://stackoverflow.com/q/27091181

http://stackoverflow.com/a/27144065
downvote count: 1
answers question: http://stackoverflow.com/q/27143951
has body: No. Because if you could directly access private fields of super class, those fields would not be private.
upvote count: 2
type: Answer
score: 1

http://stackoverflow.com/a/27025448
type: Answer
accepted answer of: http://stackoverflow.com/q/27025336
answers question: http://stackoverflow.com/q/27025336
has body: Try this Spinner spinner1; String table; List&lt;String&gt; list; String selectedItem=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main1); toggleButton1 = (ToggleButton) findViewById(R.id.toggleButton1); spinner1 = (Spinner) findViewById(R.id.spinner1); list = new ArrayList&lt;String&gt;(); list.add("Table 1"); list.add("Table 2"); list.add("Table 3"); ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter(dataAdapter); spinner1.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { selectedItem=spinner1.getSelectedItem().toString(); } public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } }); //startButton is connected to button1 on the screen Button startButton = (Button) findViewById(R.id.button1); //Listens for when the start button is clicked startButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { //Calls the secondActivity method //thirdActivity(); Intent intent=new Intent(getApplicationContext(),SecondActivity.class); intent.putExtra("selectedItem",selectedItem); startActivity(intent); } }); } Second Activity Intent launch = getIntent(); list = launch.getStringExtra("selectedItem"); displayTable = (TextView) findViewById(R.id.textView6); displayTable.setText(list);
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/27146006
tagged with: java
tagged with: mysql
tagged with: eclipse
has body: I am really stuck with this problem so I would be glad is someone could help me out! I made a login page in java and created a MYSQL connection inside. The code works fine if you try to login the first time but after you logout and try to login again I get this error: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed. This is my code: import java.sql.*; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; public static Connection conn = connectionDb.getInstance().getConnection(); public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // get username and pass from the html page. response.setContentType("text/html"); PrintWriter out = response.getWriter(); String userName = request.getParameter("username"); String password = request.getParameter("userpass"); // put the username and variables in the getset. getset sets = new getset(); sets.setUserName(userName); sets.setPassword(password); // send the data to the database try { DbManager.Read(sets); // if the userinfo is correct following actions will perform: if (DbManager.authentication == true) { HttpSession session = request.getSession(); session.setAttribute("user", ""); // setting session to expiry in 30 mins session.setMaxInactiveInterval(30 * 60); Cookie username = new Cookie("user", userName); response.addCookie(username); response.sendRedirect("MyAccount.jsp"); DbManager.authentication = false; // if the userinfo wasn't correct the following actions will perform: } else if (DbManager.authentication == false)…
has comment: http://stackoverflow.com/comment/42791021
has comment: http://stackoverflow.com/comment/42788062
answer count: 1
has answer: http://stackoverflow.com/a/27146056
tagged with: database-connection
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42787623
has comment: http://stackoverflow.com/comment/42789562
type: Question
has title: Java MYSQL error No operations allowed after connection closed

http://stackoverflow.com/q/27031748
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/27031806
has body: I have a cloud application which uses git and maven, so the source code is uploaded by Eclipse using GIT, and the required libraries are downloaded to the server by maven. But I have one library not in maven, it's downloaded as a source and also run time jar, xxx.jar and xxx-source.jar. When I upload the source, the reference libraries are not uploaded to the server, so the compile will fail on the server. I could unzip it and package in the source folder and upload altogether. However, is there a simpler way just to put the source.jar as part of the project so Eclipse can upload that jar file as part of the project to the GIT server? and then the server will use that jar for compile?
downvote count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/567996
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: How to make xxx-source.jar available for project
tagged with: maven
has comment: http://stackoverflow.com/comment/42585489
tagged with: git
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/567996

tostring
tags question: http://stackoverflow.com/q/27131035
tags question: http://stackoverflow.com/q/27007749
tags question: http://stackoverflow.com/q/27118951
tag name: tostring
type: Tag
tags question: http://stackoverflow.com/q/27084803
tags question: http://stackoverflow.com/q/27046592
tags question: http://stackoverflow.com/q/27143951
tags question: http://stackoverflow.com/q/27097623
tags question: http://stackoverflow.com/q/27084148

http://stackoverflow.com/q/27000113
downvote count: 3
has title: Java 'for' loop with range
type: Question
possible better answer: http://stackoverflow.com/a/27000336
tagged with: for-loop
has answer: http://stackoverflow.com/a/27000391
has comment: http://stackoverflow.com/comment/42530591
has comment: http://stackoverflow.com/comment/42530491
has comment: http://stackoverflow.com/comment/42530760
has answer: http://stackoverflow.com/a/27000504
answer count: 3
tagged with: range
has body: I am working on a basic program (console). The program should allow the user to enter in various marks, until the mark entered exceeds 100. At this point the program should display a histogram. Each star represents a student who achieved a module mark in the range shown. This is an example of the output. 0 - 29 xxx 30 - 39 xxxxx 40 - 69 xxxxxxx 70 - 100 xxxx 20 students in total. As the user enters each mark, there ought to be a counter that increases in value and print the total number of marks entered. I want to make sure that the program is as efficient as possible but also understandable Code Working with @Dici on collabedit I have an amazing answer to my question: public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] ranges = { 0,29,39,69,100 }; int[] inRange = new int[ranges.length - 1]; int mark; do { System.out.println("Enter Mark:"); mark = sc.nextInt(); for (int j=1 ; j&lt;ranges.length ; j++) if (ranges[j-1] &lt;= mark &amp;&amp; mark &lt;= ranges[j]) { inRange[j-1]++; break; } } while (mark &lt;= 100); System.out.println(Arrays.toString(inRange)); String s = "The number of students that have scored between %d and %d is: "; int k = 0; for (int i=0 ; i&lt;ranges.length - 1 ; i++) { System.out.print(String.format(s,ranges[i] + k,ranges[i + 1])); for (int r = 0; r&lt;inRange[i] ; r++) System.out.print("*"); System.out.println(); k = 1; } sc.close(); Thank you again for your amazing help!
has comment: http://stackoverflow.com/comment/42531594
has comment: http://stackoverflow.com/comment/42531285
favorite count: 0
score: -1
accepted answer: http://stackoverflow.com/a/27000504
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27000336
has comment: http://stackoverflow.com/comment/42530864
tagged with: java
has comment: http://stackoverflow.com/comment/42532054

http://stackoverflow.com/q/27086092
has answer: http://stackoverflow.com/a/27086248
accepted answer: http://stackoverflow.com/a/27086248
tagged with: java.util.scanner
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27086202
downvote count: 0
tagged with: java
type: Question
has title: Scan all integers on a line into an ArrayList
answer count: 2
has body: I am trying to scan a line of Integers from a txt file and store them within an ArrayList. My question is simple, how can I do this? This is what I have public static void main(String[] args) throws FileNotFoundException { ArrayList&lt;Integer&gt; coinTypes = new ArrayList&lt;Integer&gt;(); Integer i ; File f = new File (args[0]); Scanner input = new Scanner(f); i = input.nextInt() ; input.nextLine(); while(input.hasNextInt()) { if(input.hasNextLine()) { coinTypes.add(i); } if(input.hasNextLine()) { change = input.nextInt(); System.out.println("Found change"); //used for debugging System.out.println("Change: " + change); } } System.out.println(coinTypes); } } Why doesn't what I have work? INPUT: java homework5 hwk5sample1.txt OUTPUT: Found change Change: 143 [1] Txt file: // Coins available in the USA, given in cents. Change for $1.43? 1 5 10 25 50 100 143 WANT: Change: 143 [1, 5, 10, 25, 50, 100]
has comment: http://stackoverflow.com/comment/42680787
tagged with: arraylist
upvote count: 3
possible better answer: http://stackoverflow.com/a/27086202
favorite count: 0

http://stackoverflow.com/comment/42586168
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27032139
score: 0
has text: That helps me with populating the 2d array, but what I need to do is first populate the first column "weight", and then populate each row, obviously skipping the first column that was just populated.

http://stackoverflow.com/a/27046436
downvote count: 0
upvote count: 2
has body: After sifting around a lot, I figured out I can do the following. maven-antrun-plugin ant-contrib ant-contrib 1.0b3 org.tigris.antelope antelopetasks 3.4.1 rename_files process-resources <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath" /> <taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" classpathref="maven.plugin.classpath" /> <typedef name="trim" classname="ise.antelope.tasks.typedefs.string.Trim" classpathref="maven.plugin.classpath" /> <typedef name="lastindexof" classname="ise.antelope.tasks.typedefs.string.LastIndexOf" classpathref="maven.plugin.classpath" /> <typedef name="substring" classname="ise.antelope.tasks.typedefs.string.Substring" classpathref="maven.plugin.classpath" /> <typedef name="listfiles" classname="ise.antelope.tasks.typedefs.file.FileList" classpathref="maven.plugin.classpath" /> <taskdef name="fileutil" classname="ise.antelope.tasks.FileUtilTask" classpathref="maven.plugin.classpath" /> run Just have to use classpathref and point to maven.plugin.classpath in the task defn. Hope this helps someone else in the future.
answers question: http://stackoverflow.com/q/27045415
type: Answer
score: 2

http://stackoverflow.com/comment/42785523
score: 0
type: Comment
type: QuestionComment
has text: javax.script needs a ScriptEngine but default engines can be different among platforms (JVM version or OS Windows, *ix, OSX), so I will need to add a dependency to an engine like Rhino for JS, Groovy or anything else. I don't need a full-featured library but a simple expression parser and evaluator.
comment on: http://stackoverflow.com/q/27143699

http://stackoverflow.com/q/27119780
linked to: http://stackoverflow.com/q/4216745
has body: I have a timestamp which I have retrieved from database. For ex: Timestamp acceptedDate = 2014-10-27 13:39:50; Now I want to get time part of the timestamp in a different variable and date part of the timestamp in a different variable and also the time should be a 12 hour clock. How can achieve this?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42741842
has comment: http://stackoverflow.com/comment/42740897
score: -1
has comment: http://stackoverflow.com/comment/42741846
linked to: http://stackoverflow.com/q/7492423
has title: Getting Time and Date separately from timestamp
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27120176
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/42740905
tagged with: java

http://stackoverflow.com/comment/42703584
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27098892
type: Comment
has text: how can i do it with using JXMonthView

http://stackoverflow.com/q/27062091
type: Question
has answer: http://stackoverflow.com/a/27132654
tagged with: apache-kafka
has title: Storm and Kafka: Increasing amount of open file descriptors
upvote count: 2
answer count: 1
favorite count: 0
tagged with: exception
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: apache-storm
has body: I currently have a problem using Kafka with Storm. Until some days ago I used a windows computer but now swticthed to using a mac. My Kafka Queue is filled with approx. 4,8 million messages. Now what happen is, that after approx. 4600 processed messages I got 10240 open file descriptors which I don't get rid of. When I reached 10240 open file descriptors, Storm tries to open a zookeeper file and fails with: java.io.FileNotFoundException: /var/folders/2p/3xcy9hp10gd852_06v0dzg440000gn/T/c5a2bffa-ff9a-4093-9002-79cee98385dc/workers/5a809959-53b7-48f4-848e-ed585007d9ed/heartbeats/1416569332681 (Too many open files) at java.io.FileOutputStream.open(Native Method) ~[na:1.8.0_25] at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:213) ~[na:1.8.0_25] at org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:367) ~[commons-io-2.4.jar:2.4] at org.apache.commons.io.FileUtils.writeByteArrayToFile(FileUtils.java:2094) ~[commons-io-2.4.jar:2.4] at org.apache.commons.io.FileUtils.writeByteArrayToFile(FileUtils.java:2078) ~[commons-io-2.4.jar:2.4] at backtype.storm.utils.LocalState.persist(LocalState.java:86) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubating] at backtype.storm.utils.LocalState.put(LocalState.java:66) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubating] at backtype.storm.daemon.worker$do_heartbeat.invoke(worker.clj:68) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubating] at backtype.storm.daemon.worker$fn__4527$exec_fn__1096__auto____4528$heartbeat_fn__4529.invoke(worker.clj:357) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubating] at backtype.storm.timer$schedule_recurring$this__1639.invoke(timer.clj:99) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubating] at backtype.storm.timer$mk_timer$fn__1622$fn__1623.invoke(timer.clj:50) ~[storm-core-0.9.2-incubating.jar:0.9.2-incubating] at backtype.storm.timer$mk_timer$fn__1622.invoke(timer.clj:42) [storm-core-0.9.2-incubating.jar:0.9.2-incubating] at clojure.lang.AFn.run(AFn.java:24) [clojure-1.5.1.jar:n…

http://stackoverflow.com/comment/42684529
comment on: http://stackoverflow.com/q/27088175
score: 1
has text: Handler will help you in to call operation in a background thread.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42548823
type: QuestionComment
has text: What does the `queryResults` collection contain exactly?
comment on: http://stackoverflow.com/q/27010610
score: 0
type: Comment

http://stackoverflow.com/q/27017451
accepted answer: http://stackoverflow.com/a/27063796
tagged with: oracle-rules
tagged with: java
type: Question
has title: How to add new AdfBcFactTypes in oracle rules file
answer count: 1
has body: I have a Oracle rules file: MyDeparmentRules.rules I have some AdfBcFactType nodes with propertys: <AdfBcFactType id="J}my.project.depart.model.gri.views.GRDetalesDeclaracionsVVO"> my.project.depart.model.gri.views.GRDetalesDeclarationsVVO Detales true 2362 viewRowImpl ViewRowImpl true 2362 J}my.project.depart.model.gri.views.GRDetalesDeclarationsVVORowImpl B}nil my.project.depart.model.gri.views.GRDetalesDeclarationsVVORowImpl B}nil true true true false B}nil false false <Property ....................... How do I add new AdfBcFactType-s for new view objects? How do I add new property-s for these AdfBcFactTypes?
score: 0
tagged with: oracle-database
has answer: http://stackoverflow.com/a/27063796
tagged with: oracle-adf
type: AnsweredQuestion

http://stackoverflow.com/comment/42721879
type: AnswerComment
comment on: http://stackoverflow.com/a/27108962
type: Comment
has text: This does not work because my window is loaded and I only change dom elements. I am using GWTP. So the load event will not fire again.
score: 0

scrollpane
tags question: http://stackoverflow.com/q/27138841
type: Tag
tag name: scrollpane

http://stackoverflow.com/a/27143302
score: 0
has body: Android supports gestures. To use this support your application must use the view "GestureOverlayView". In this view you place your other views. &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="match_parent" android:layout_height="match_parent" &gt; &lt;TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/hello"/&gt; &lt;/LinearLayout&gt; import java.util.ArrayList; import android.app.Activity; import android.gesture.Gesture; import android.gesture.GestureLibraries; import android.gesture.GestureLibrary; import android.gesture.GestureOverlayView; import android.gesture.GestureOverlayView.OnGesturePerformedListener; import android.gesture.Prediction; import android.os.Bundle; import android.view.View; import android.widget.Toast; public class GestureTest extends Activity implements OnGesturePerformedListener { private GestureLibrary gestureLib; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GestureOverlayView gestureOverlayView = new GestureOverlayView(this); View inflate = getLayoutInflater().inflate(R.layout.main, null); gestureOverlayView.addView(inflate); gestureOverlayView.addOnGesturePerformedListener(this); gestureLib = GestureLibraries.fromRawResource(this, R.raw.gestures); if (!gestureLib.load()) { finish(); } setContentView(gestureOverlayView); } @Override public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) { ArrayList&lt;Prediction&gt; predictions = gestureLib.recognize(gesture); for (Prediction prediction : predictions) { if (prediction.score &gt; 1.0) { Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT) .show(); } } } }
type: Answer
answers question: http://stackoverflow.com/q/27143214

http://stackoverflow.com/q/27065597
has comment: http://stackoverflow.com/comment/42644910
score: -2
tagged with: java
downvote count: 2
tagged with: printing
has body: Hey sorry for the bad formatting. I am in a java class and don't know how to pass the bank account data into one show value method if someone could help that would be great!what i am not understanding is how to call the same method but pass different bank accounts into it.I thought i could just call showData(a); but this was not working. Please help!! `/** * Write a description of class TestBankAccount here. * * @author (your name) * @version (a version number or a date) */ import java.util.Scanner; public class TestBankAccount { public static void main(String[] args) { int AccountNumber; String name; double balance; double NewBalance; bankAccount newAccount = new bankAccount(); newAccount = getData(newAccount); bankAccount newAccount2 = new bankAccount(); newAccount2 = getData(newAccount); bankAccount newAccount3 = new bankAccount(); newAccount3 = getData(newAccount); bankAccount newAccount4 = new bankAccount(); } public static bankAccount getData(bankAccount s) { int AccountNum; String ownerName; double AccountBalance; Scanner stan = new Scanner(System.in); System.out.print("Enter Account Number "); AccountNum = stan.nextInt(); stan.nextLine(); System.out.print("Enter owner name "); ownerName = stan.nextLine(); System.out.println("Enter Account Balance: "); AccountBalance = stan.nextDouble(); s.setAccountNumber(AccountNum); s.setName(ownerName); s.setBalance(AccountBalance); s.setNewBalance(AccountBalance); return s; } public static void showData(bankAccount a) { System.out.println("The account number is: "); System.out.println(a.getAccountNumber()); System.out.println("The owner name is: "); System.out.println(a.getName()); System.out.println("The balance is: "); System.out.println(a.getNewBalance()); System.out.println(a.explanation()); } }`
answer count: 1
tagged with: variables
tagged with: println
favorite count: 0
has title: Show Data Method
has answer: http://stackoverflow.com/a/27066064
upvote count: 0
type: UnansweredQuestion
tagged with: methods
has comment: http://stackoverflow.com/comment/42645156
type: Question

http://stackoverflow.com/comment/42793575
comment on: http://stackoverflow.com/a/27147854
has text: more on "why Java allows this way of calling " because think in real world anything that is known to template must also be implicitly known to the object created using that template. isn't it.Hence, IMO, Java devs have deliberately allowed it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27036677
type: Question
accepted answer: http://stackoverflow.com/a/27037408
answer count: 2
score: 2
has body: I am at the beginning with GUI programming in JFace/SWT. Before I worked with an normal SWT window (http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.wb.ercp.doc.user%2Fhtml%2Fwizards%2FeRCP%2Fapplication_window.html) and today I've tried the JFace Application Window for the first time. Now I want to set a minimum size of this window.. In SWT it worked with shell.setMinimumSize(100,100) but in my the org.eclipse.jface.window.ApplicationWindow there is no such method.. I've tried this.createShell().setMinimumSize(100, 100); (my implementation "public class MainView extends ApplicationWindow {") but it doesn't work. this.getShell() returns null. By the way, I searched for a good documentation about JFace in gernal, for now especially for the Application Window. But I couldn't find anything really good and extensive. The documentation in SWT, especially JFace is very dispairing.. Too bad, because there are nice features in it. What are your experiences?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27037368
has title: Minimum size of JFace application window
tagged with: jface
has answer: http://stackoverflow.com/a/27037408
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27037368
upvote count: 2
tagged with: java
tagged with: swt

http://stackoverflow.com/a/27118592
score: 3
has body: You need to provide the base, or radix, of two if you want to parse a binary value. long foo = Long.parseLong(bin, 2); You can see an example on the Java doc page: parseLong("1100110", 2) returns 102L. Without the radix, it uses base-10, and 1032 won't fit into a long. Keep in mind that, for a 32-character bit string, this will give you the unsigned variant. If you want the signed variant in a long, you can use: if (foo &gt; 0x7fffffffL) foo = -(0x100000000L - foo); afterwards to adjust it Or you can forcefully cast it to an integer if that's suitable: int foo = (int)Long.parseLong(bin,2); The requirement that Integer.parseInt() be given a signed number means that it's unsuitable as-is for 32-character binary strings with a leftmost 1-bit.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27118569
answers question: http://stackoverflow.com/q/27118569

http://stackoverflow.com/q/27052608
has comment: http://stackoverflow.com/comment/42627666
linked to: http://stackoverflow.com/q/3425688
has comment: http://stackoverflow.com/comment/42627654
score: 0
tagged with: linux
answer count: 1
accepted answer: http://stackoverflow.com/a/27057619
has comment: http://stackoverflow.com/comment/42627156
type: AnsweredQuestion
has title: data node namespaceID issue
has answer: http://stackoverflow.com/a/27057619
tagged with: java
type: Question
tagged with: hadoop
linked to: http://stackoverflow.com/q/18300940
has body: I've successfully installed HADOOP for one user. When I installed HADOOP for another user, the data node is missing. The log file for data node shows: 2014-11-21 06:28:30,774 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists! 2014-11-21 06:28:32,161 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs in /home/test/work/hadoopdata/dfs/data: namenode namespaceID = 1488453240; datanode namespaceID = 2050828596 One solution is to clear the "dfs" directory and then run the HADOOP again. But how to solve this problem with another method, i.e. resolving the namespace ID. I searched in the net but did not found any clear solution for this. My OS is Ubuntu 14.04.
has comment: http://stackoverflow.com/comment/42626343

http://stackoverflow.com/a/27103502
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27102546
type: Answer
accepted answer of: http://stackoverflow.com/q/27102546
score: 0
has body: Start by overriding the getToolTipText(MouseEvent) event of the JTable. public String getToolTipText(MouseEvent e) { String toolTipText = null; Get the cell coordinates for the given mouse location... Point p = e.getPoint(); // MouseEvent int col = columnAtPoint(p); int row = rowAtPoint(p); Get the cells current size, this way we know what the current constraints are... Rectangle bounds = getCellRect(row, col, false); Get the renderer for the cell, based on the current value for the cell from the model... Object value = getValueAt(row, col); Component comp = prepareRenderer(getCellRenderer(row, col), row, col); Compare the preferred size of the renderer component against the cell size... if (comp.getPreferredSize().width &gt; bounds.width) { toolTipText = comp.getToolTipText(); } Return the tool tip... return toolTipText; }

http://stackoverflow.com/comment/42685602
type: QuestionComment
has text: I don't see any array of characters.
score: 0
comment on: http://stackoverflow.com/q/27089124
type: Comment

http://stackoverflow.com/comment/42663933
type: QuestionComment
has text: I am sorry I am a noob on gradle (and on Android Studio) - Where should the jars be in that case? And I have to write in the build.gradle of the app something like dependencies { compile '...' }, right?
type: Comment
comment on: http://stackoverflow.com/q/27076391
score: 0

http://stackoverflow.com/q/27084443
tagged with: netbeans
tagged with: tabs
downvote count: 0
has comment: http://stackoverflow.com/comment/76392329
has title: Set 4 space Tab in Netbeans?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27099230
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/47564907
favorite count: 0
upvote count: 5
has body: The tab button is moving 8 spaces but I would like for it to move 4 spaces.
type: UnansweredQuestion
tagged with: space

http://stackoverflow.com/comment/42632335
comment on: http://stackoverflow.com/q/27058622
score: 0
has text: You are not clear, XMPP server is a different entity and GCM is different.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27132382
score: 0
tagged with: types
tagged with: arrays
answer count: 1
has body: I have a function in my c code, whose definition is below: void myfunct(double *xx, double *yy, double *si, double *ded, double *limit, double *al, double *bl, double *cl, int ndat, const char *path, int plenght, int error,int pgamodell,int converter, double backnoise); When I execute this c program in gcc, it executes and gives me the required output. (It is working fine!) Now, my task is to use this c code in java, so for it I am using JNA. But I am having a problem with the path parameter of this function. On my java side I am sending this parameter in the following manner: String p = "E:/Development/dir/"; char[] path = p.toCharArray(); // and sending this path in the function call But on the c program, I have debugged and found that it gets path with only one character i.e "path=E". I guess the reason is that in java char array is 16-bit but in c it is 8-bit. Kindly help me in solving this problem as I am new to JNA, thanks in advance for your time.
tagged with: jna
accepted answer: http://stackoverflow.com/a/27134179
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42765111
tagged with: java
has title: How do I convert 16-bit char array to 8-bit char array and send to c code using JNA?
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/27134179
type: Question

http://stackoverflow.com/comment/42632878
type: QuestionComment
comment on: http://stackoverflow.com/q/27058092
has text: @GangadharB see my answer below , if that suits
score: 0
type: Comment

http://stackoverflow.com/a/26996363
type: Answer
answers question: http://stackoverflow.com/q/26996224
score: 0
has body: You have to read the actual lenght of a file not a directory. According to the documentation : The return value is unspecified if this pathname denotes a directory. Return the length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist. Some operating systems may return 0L for pathnames denoting system-dependent entities such as devices or pipes.

http://stackoverflow.com/comment/42710333
has text: How exactly would I do this I never did this before.
type: AnswerComment
comment on: http://stackoverflow.com/a/27102900
score: 0
type: Comment

http://stackoverflow.com/comment/42688132
score: 0
comment on: http://stackoverflow.com/a/27089762
type: Comment
has text: yeah you are right. I'm using reused data. That's why I need reset(). However i'm not sure about the error. I was too stupid to close streams on the server side so maybe that was a reason.. it looks like it works fine now. i'll check on other machine later.
type: AnswerComment

http://stackoverflow.com/a/27035379
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27032365
has body: This problem arises most commonly when there are multiple versions of the ASM JAR on the runtime classpath. ASM used to be a popular library and therefore many other libraries have historically depended on it. However, when the runtime classpath contains multiple versions of the ASM JAR, only one is version of the JAR is loaded (which one is loaded varies by platform). You need to scan your runtime classpath and ensure that there is only version of the ASM JAR. Be warned though, ASM is a very notorious library and although the latest version of the library should work generally, in many cases that may not work. You will have to try different versions of ASM until you find one that works for all the libraries you are using.

http://stackoverflow.com/a/27094308
upvote count: 2
has body: youtrack_initd.template from youtrack tutorial is missing #!/bin/sh on the top of the file. After adding this line "Exec format error" does not occur anymore.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27093072

http://stackoverflow.com/comment/42539143
score: 1
has text: `NullPointerException` probably means that you are accessing an object that is `null`. Could you post more of your code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27004623

http://stackoverflow.com/comment/42752233
type: Comment
score: 0
type: QuestionComment
has text: I think it might be related to the transaction handling in the Junit method. The parent can only be inserted if the child is already in the database (after a commit). That would explain why it works on your "real" application an not here. Can you share your application.xml file?
comment on: http://stackoverflow.com/q/27112784

http://stackoverflow.com/comment/42681394
comment on: http://stackoverflow.com/a/27085878
type: AnswerComment
has text: please accept my answer if it solved your problem and if you have another problem, ask new question! :)
score: 0
type: Comment

http://stackoverflow.com/comment/54444291
comment on: http://stackoverflow.com/q/27013748
score: 4
type: Comment
has text: There is no sense in vandalizing your own post, you will just have your account banned. And someone will always roll it back within seconds.
type: QuestionComment

http://stackoverflow.com/a/27067191
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42648004
type: Answer
accepted answer of: http://stackoverflow.com/q/27067114
score: 3
answers question: http://stackoverflow.com/q/27067114
has body: setColor requires int type but this.color is not int, you try to set the color object instead of int value. public native void setColor(int color);

http://stackoverflow.com/comment/42594033
has text: when i tried to add 1 it print 47
comment on: http://stackoverflow.com/a/27036803
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/39180585
has body: Before I write for JSpinner let me tell you to use Date function as below. Date d1 = new Date(0); Calendar cl = Calendar. getInstance(); cl.setTime(d1); System.out.println("today is " + d1.toString()); Then there is JSpinner which can be used as follows.Changing the format to only "dd" can give you the date.To manipulate it convert it using integer parser(the commented out lines). SimpleDateFormat formaterD = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String spinnerDate=formaterD.format(testSpin.getValue()); //int z=Integer.parseInt(spinnerValue); System.out.println(spinnerDate); //System.out.println("Date in integer format:"+z); //To err is Human!Please comment if I'm wrong.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27035009

http://stackoverflow.com/comment/73680801
type: Comment
has text: Worked for me too, Don't explicitly add mockito. Let powermock download and resolve the dependency based on it's version.
comment on: http://stackoverflow.com/a/39669045
score: 1
type: AnswerComment

http://stackoverflow.com/q/27058941
tagged with: spring-aop
accepted answer: http://stackoverflow.com/a/27151721
has body: Hi All in my Spring application i have used AutoWired NamedParameterJdbcTemplate. @Autowired NamedParameterJdbcTemplate namedParametersJdbcTemplate; in my rest-servlet.xml <property name="jndiName" value="java:comp/env/jdbc/mylfrdb"/> It working fine. No i have to use performance intercepter with Spring AOP. So i added following thing in my rest-servlet.xml <aop:config > <aop:pointcut expression="@target(org.springframework.stereotype.Service)" id="allServices"/> <aop:advisor pointcut-ref="allServices" advice-ref="perfMonitor"/> </aop:config> So i got error like this. Can not set org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate field com.lfr.dao.impl.FlatAdvertiseDaoImpl.namedParametersJdbcTemplate to com.sun.proxy.$Proxy15 So i refered this question and tried to implement 2nd solution give is by using CGLIB and <aop:config proxy-target-class="true" > No i am getting this error Could not generate CGLIB subclass of class [class org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
answer count: 1
has answer: http://stackoverflow.com/a/27151721
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: cglib
has title: NamedParameterJdbcTemplate and CGlib in Spring AOP
score: 0

http://stackoverflow.com/a/27050307
has comment: http://stackoverflow.com/comment/42618452
has body: Spring's MVC stack requires that the MultipartResolver bean be called multipartResolver. Change your @Bean method to @Bean public CommonsMultipartResolver multipartResolver(){ or @Bean(name = "multipartResolver") public CommonsMultipartResolver commonsMultipartResolver(){
type: AcceptedAnswer
downvote count: 0
upvote count: 34
accepted answer of: http://stackoverflow.com/q/27050018
type: Answer
answers question: http://stackoverflow.com/q/27050018
has comment: http://stackoverflow.com/comment/42618258
has comment: http://stackoverflow.com/comment/45094841
has comment: http://stackoverflow.com/comment/42618291
score: 34

http://stackoverflow.com/q/27109374
has answer: http://stackoverflow.com/a/27127229
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
possible better answer: http://stackoverflow.com/a/27186951
has comment: http://stackoverflow.com/comment/42721837
has answer: http://stackoverflow.com/a/27186951
has comment: http://stackoverflow.com/comment/42721955
has comment: http://stackoverflow.com/comment/42722059
has comment: http://stackoverflow.com/comment/42722056
linked to: http://stackoverflow.com/q/3312102
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27127229
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has title: SWT Button - Remove button background
has comment: http://stackoverflow.com/comment/42722072
has answer: http://stackoverflow.com/a/27189699
has body: I have a button that looks like this: I want to remove the button background.. That is, the image will be the button. Here is my code: Button button = new Button(shell, SWT.NONE); button.setToolTipText("Email Settings..."); button.setImage(SWTResourceManager.getImage(Settings.class, "settings1616.png")); button.setBounds(494, 26, 28, 25); I have tried.. button.setBackground(null); button.setBackgroundImage(null); But it does not remove anything. Thanks!
has comment: http://stackoverflow.com/comment/42721805
answer count: 3

http://stackoverflow.com/comment/42526932
comment on: http://stackoverflow.com/a/26996323
score: 1
type: AnswerComment
has text: Ah great - thanks for your fantastic answer. Been wondering that for a while..!
type: Comment

http://stackoverflow.com/a/27008821
has body: In java regex , to match a literal \ symbol, you need to escape it three times. (?i) case insensitive modifier and this [\\\\/] matches a literal backslash or forward slash. "(?i)^[a-z]:\\\\.*" EXample: System.out.println("C:\\temp".matches("(?i)[a-z]:\\\\.*")); // true System.out.println("C:/temp".matches("(?i)[a-z]:[\\\\/].*")); // true
score: 0
answers question: http://stackoverflow.com/q/27008786
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42545701
accepted answer of: http://stackoverflow.com/q/27008786
has comment: http://stackoverflow.com/comment/42545973

http://stackoverflow.com/q/27029391
has body: I am calling the following PL/SQL procedure using JDBC. One of parameters is of type IN OUT. PROCEDURE update_emp_commpct(emp_id IN employees.employee_id%type , new_comm_pct_incr IN OUT employees.commission_pct%type); I was curious to know if this type of parameter should be treated differently from the other types. A post in this forum pointed me to this oracle doc: Its says the following For INOUT parameters, it is good practice to register the output parameter before setting its input value. Why is registering the output before setting it input value a good practice ? Can someone elaborate on this ? I tried both ways and the result is the same. Also it says: INOUT parameters map to an array of the parameter type in Java I fail to understand this. Why does IN OUT parameter map to Array parameter in Java ? Am I missing something here ? In the code that I tried out below I mapped it to java.sql.Numeric. public float updateEmpCommpct(int empId , float incrementVal) { Connection conn = null; CallableStatement callStmt = null; float newCommPct = -1f; try { // Registering the JDBC Driver // Class.forName(JDBC_DRIVER_ORACLE); // Creating a database connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PWD); // Creating a sql string String callProc = "{ call HR.EMP_PKG.update_emp_commpct(? , ?)}"; // Create a callable statement callStmt = conn.prepareCall(callProc); // Bind Values to the IN parameters callStmt.setInt(1, empId); // Dealing with IN/OUT parameter // (1) Register the OUT parameter first callStmt.registerOutParameter(2, java.sql.Types.NUMERIC); // (2) Now bind a value to it callStmt.setFloat(2, incrementVal); // Execute the callable statement callStmt.execute(); // Get the value of the OUT parameter newCommPct = callStmt.getFloat(2); System.out.println("Employee with Id : "+ empId + " has his commission percentage updated to: " + newCommPct); } catch (SQLException se) { System.out.println("Exception occured in the database"); System.out.println("Ex…
has comment: http://stackoverflow.com/comment/42590835
tagged with: plsql
linked to: http://stackoverflow.com/q/19641333
score: 0
tagged with: procedure
tagged with: jdbc
has title: Dealing with PLSQL "IN OUT" parameter in JDBC
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42605532
type: Question
tagged with: parameters
tagged with: java

http://stackoverflow.com/comment/42569259
type: Comment
comment on: http://stackoverflow.com/a/27008483
type: AnswerComment
has text: @Frank - I just updated the answer with something that should fix the compiler error. That's what I get for being a C# developer instead of Java. I assumed that Java could infer the type of the array from the generics. Unfortunately `toArray` without a generator return `Object[]`.
score: 0

http://stackoverflow.com/comment/42528595
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26998681
has text: Your question is awfully unclear, you are using terminology "unsigned 64 bit long" (which does not exist in java) without clearly defining purpose, expected input and output. Also, try asking a *clear* question; don't make the reader *guess* the question.

http://stackoverflow.com/q/27114521
score: 5
answer count: 1
favorite count: 0
has title: What is the best way to "roll back" changes?
upvote count: 5
has comment: http://stackoverflow.com/comment/42731974
tagged with: atomic
has comment: http://stackoverflow.com/comment/42733010
type: AnsweredQuestion
has body: Alright, so I have a Spring application that takes in a Network Representation and boots up virtual machines to represent the network that was passed in. It uses a low level API to bring up the VMs, there is no database involved. What I need to figure out how to do is handle the situation where a user submits a 10 node (or any number) network model and the application goes through and builds up the network (starting VMs), if a node fails to startup I want to be able to react to that. I would like to be able to roll back my changes (i.e destroy all nodes that were created). I've been told that I need to look into "Transactions" but I am unsure whether or not that applies to this scenario when I'm not using a database. As a side note, I do have logic to take down nodes if a user sends in that request. My question is -- how do I handle this? Also, is this the best stack overflow for this question?
downvote count: 0
tagged with: spring
type: Question
has answer: http://stackoverflow.com/a/27115023
accepted answer: http://stackoverflow.com/a/27115023
has comment: http://stackoverflow.com/comment/42733446
tagged with: transactions
tagged with: java

http://stackoverflow.com/q/26993231
favorite count: 0
tagged with: primitive-types
linked to: http://stackoverflow.com/q/788433
has comment: http://stackoverflow.com/comment/42519861
has comment: http://stackoverflow.com/comment/42520192
type: UnansweredQuestion
upvote count: 6
has answer: http://stackoverflow.com/a/26996169
linked to: http://stackoverflow.com/q/2721546
has title: How to write mockito matcher for byte[]?
has comment: http://stackoverflow.com/comment/42526941
tagged with: java
score: 6
has body: I need a complex Matcher for byte[]. The code below does not compile since argThat returns Byte[]. Is there a way to write a dedicated Matcher for an array of primitive types? verify(communicator).post(Matchers.argThat(new ArgumentMatcher&lt;Byte[]&gt;() { @Override public boolean matches(Object argument) { // do complex investigation of byte array return false; } }));
has comment: http://stackoverflow.com/comment/42521104
type: Question
has comment: http://stackoverflow.com/comment/42530909
tagged with: matcher
linked to: http://stackoverflow.com/q/517751
tagged with: mockito
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42519743

http://stackoverflow.com/comment/42552518
has text: @hossayni Java isn't one of them. Each array is an independent object.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27012969

http://stackoverflow.com/q/27135488
has comment: http://stackoverflow.com/comment/42769376
has comment: http://stackoverflow.com/comment/42769457
has body: In first loop I am looping through variable rgname which is [Monthly,Quarterly,Yearly]. Now,I created another method called listDir. If I pass variable value here folder = new File(reportFolderPath + reportPath + "/"+ rgname); and later to the method listDir it will return list of array like as shown below. List&lt;ReportGroup&gt; reportGroupList = new ArrayList&lt;ReportGroup&gt;(); for (String rgname : reportGroupNames) { ReportGroup rg = new ReportGroup(); rg.setReportGroupName(rgname);// Report Name such as // Monthly,Quarterly and // Yearly folder = new File(reportFolderPath + reportPath + "/"+ rgname); List&lt;ReportInfo&gt; reportList = new ArrayList&lt;ReportInfo&gt;(); List&lt;String&gt; reportDescription=listDir(folder); for(String reportDescr:reportDescription){ System.out.println("*****************Test***************" +reportDescr); rg.setReportDescr(reportDescr); } rg.setReportList(reportList); reportGroupList.add(rg); report.setReportGroupList(reportGroupList); } } Second Method returns the arraylist: public static List&lt;String&gt; listDir(final File folder) { List&lt;String&gt; dirArray = new ArrayList&lt;String&gt;(); for (final File fi : folder.listFiles()) { if (fi.isDirectory()) { dirArray.add(fi.getName()); } } return dirArray; } The Output should be like this: Monthly -Jan -Feb -Continue Quarterly -First Quarter -Second continue Second method returns this value and this is what it prints when doing System.out.println(reportDescription); [539_January_2013, 540_February_2013, 541_March_2013, 542_April_2013, 543_May_2013, 544_June_2013, 545_July_2013, 546_August_2013, 547_September_2013, 548_October_2013, 549_November_2013, 550_December_2013, 587_January_2014] [551_First_Quarter_2013, 554_Second_Quarter_2013, 557_Third_Quarter_2013, 560_Fourth_Quarter_2013] [123_Year_2010]
has title: Why it is only adding last element of arraylist? or Possible solution?
has comment: http://stackoverflow.com/comment/42770578
score: 0
has comment: http://stackoverflow.com/comment/42771029
possible better answer: http://stackoverflow.com/a/27135549
answer count: 3
has comment: http://stackoverflow.com/comment/42770519
has comment: http://stackoverflow.com/comment/42771599
has comment: http://stackoverflow.com/comment/42769371
has answer: http://stackoverflow.com/a/27137071
has comment: http://stackoverflow.com/comment/42769542
has comment: http://stackoverflow.com/comment/42770857
has comment: http://stackoverflow.com/comment/42770778
has comment: http://stackoverflow.com/comment/42771385
has comment: http://stackoverflow.com/comment/42770469
has comment: http://stackoverflow.com/comment/42770872
has comment: http://stackoverflow.com/comment/42770228
has answer: http://stackoverflow.com/a/27136344
has comment: http://stackoverflow.com/comment/42771080
has comment: http://stackoverflow.com/comment/42771454
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42770061
has comment: http://stackoverflow.com/comment/42770149
tagged with: java
has comment: http://stackoverflow.com/comment/42770320
has comment: http://stackoverflow.com/comment/42769350
accepted answer: http://stackoverflow.com/a/27137071
type: Question
has comment: http://stackoverflow.com/comment/42771626
has comment: http://stackoverflow.com/comment/42771287
has answer: http://stackoverflow.com/a/27135549

http://stackoverflow.com/q/27097852
has title: Maven integration in eclipse: Missing requirement
has answer: http://stackoverflow.com/a/27099023
tagged with: java
accepted answer: http://stackoverflow.com/a/27099023
tagged with: maven
upvote count: 1
tagged with: m2e
answer count: 1
has body: When I try to install this message comes up Software being installed: m2e - Maven Integration for Eclipse (includes Incubating components) 1.5.0.20140606-0033 (org.eclipse.m2e.feature.feature.group 1.5.0.20140606-0033) Missing requirement: Maven Integration for Eclipse (Editors) 1.5.0.20140606-0033 (org.eclipse.m2e.editor 1.5.0.20140606-0033) requires 'bundle
tagged with: eclipse
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/comment/42541127
score: 0
comment on: http://stackoverflow.com/a/27005914
type: Comment
type: AnswerComment
has text: I write result like that System.out.println(db.isLoginFree("logass"));

http://stackoverflow.com/q/27107972
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27108193
score: 0
answer count: 1
tagged with: design-view
tagged with: scrolledcomposite
type: AnsweredQuestion
has title: How can I scroll a ScrolledComposited in Eclipse SWT Design view?
tagged with: java
tagged with: swt
has body: I have a Composite that is nested in a ScrolledComposite. The ScrolledComposite works fine when running but I am wanting to find a way to be able to edit content in the Design view that falls beneath the ScrolledComposite height. As of now I have to re-size my entire window (drag it down to view the components), edit the content, then size the window back. I don't want to have to do this each time though. Does anyone know of a workaround for this?
type: Question
has answer: http://stackoverflow.com/a/27108193

http://stackoverflow.com/comment/42548420
comment on: http://stackoverflow.com/q/27009596
has text: `q.maxWait` returns something you need to use, like this: `System.out.println("result: " + q.maxWait(arrival, service));`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27010518
tagged with: windows
has comment: http://stackoverflow.com/comment/42569835
has comment: http://stackoverflow.com/comment/42556805
has comment: http://stackoverflow.com/comment/42560277
has title: Parts of JComponents incompatible with Ubuntu?
score: 0
has body: I have a program that outputs the calculation result in a JFrame that contains a JPanel (for extensibility), which contains a JLabel, which displays the said output (which is a string). I found JLabel's default font to be rather small and hard to read, and so increased the font size and replaced it with a Windows specific font, but didn't think much of it since I checked with a font that doesn't exist, and noticed the program worked fine even if the font doesn't exist. (on both Windows 7 and 8) However, when run on Ubuntu, the result was a JFrame that was the minimal size. So now I'm wondering if this is an example of some incompatibility on JVM, or a problem with the copy of Ubuntu it was run on. The following code should replicate the problem on Ubuntu (or maybe Linux in general) if this is a JVM issue. import java.awt.BorderLayout; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Main { public Main(){ JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel lbl = new JLabel("SOME TEXT"); lbl.setFont(new Font("font that doesnt exist", Font.PLAIN, 20)); JPanel pnl = new JPanel(); pnl.add(lbl); frame.add(pnl, BorderLayout.CENTER); frame.setVisible(true); frame.pack(); frame.setLocationRelativeTo(null); } public static void main (String[] args) { Main main = new Main(); } } PS the Ubuntu computer is not mine, so I can't exactly test as I want
has comment: http://stackoverflow.com/comment/42548172
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/42550012
has comment: http://stackoverflow.com/comment/42548634
has comment: http://stackoverflow.com/comment/42553424
linked to: http://stackoverflow.com/q/7187989
has comment: http://stackoverflow.com/comment/42548705
tagged with: java
has comment: http://stackoverflow.com/comment/42556833
has comment: http://stackoverflow.com/comment/42548148
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27024377
has comment: http://stackoverflow.com/comment/42556352
has comment: http://stackoverflow.com/comment/42550673
tagged with: compatibility
tagged with: linux
type: Question
has comment: http://stackoverflow.com/comment/42558716

http://stackoverflow.com/comment/42677704
type: QuestionComment
has text: hagubear - yes that was a typo.
score: 0
comment on: http://stackoverflow.com/q/27084225
type: Comment

http://stackoverflow.com/q/27114528
has answer: http://stackoverflow.com/a/27115522
has body: I am running into an issue where eH is only being executed once and I am not sure what is wrong. I read the javadocs on the Timeline and I don't see where I am going wrong. Hopefully an extra pair of eyes could see what is wrong. Thanks. import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.util.Duration; public class Demo extends Application { GridPane gp = new GridPane(); Label label1 = new Label("Label 1"); Label label2 = new Label("Label 2"); Label label3 = new Label("Label 3"); Label label4 = new Label("Label 4"); Scene scene; VBox vbox = new VBox(); VBox vbox2 = new VBox(); Image image = new Image("image.png"); ImageView iv = new ImageView(); Rectangle first = new Rectangle(0, 0, 50, 50); Rectangle second = new Rectangle(0, 0, 50, 50); Rectangle third = new Rectangle(0, 0, 50, 50); Rectangle forth = new Rectangle(0, 0, 50, 50); Button b1 = new Button("Enter1"); public void start(Stage primaryStage) { vbox.setSpacing(10); vbox.getChildren().addAll(label1, label2, label3, label4); gp.add(vbox, 0, 0); vbox2.getChildren().addAll(b1,new Button("Enter2"), new Button("Enter3"),new Button("Enter4"),new Button("Enter5") ); gp.add(vbox2, 1, 0); iv.setImage(image); //iv.setFitWidth(700); //iv.setFitHeight(300); iv.setPreserveRatio(true); iv.setSmooth(true); iv.setCache(true); gp.add(iv, 3, 0); first.setFill(Color.BLACK); second.setFill(Color.WHITE); third.setFill(Color.WHITE); forth.setFill(Color.BLACK); gp.add(first, 4, 0); gp.add(second, 5, 0); gp.add(third, 4, 1); gp.add(forth, 5, 1); boolean x = false; Even…
has comment: http://stackoverflow.com/comment/42733678
type: UnansweredQuestion
tagged with: java
tagged with: javafx
has title: Can someone tell me why this animation is only being executed once? (Javafx)
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/42588400
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27021957
has text: @Michael: Yes there would be a lot of cases to consider if we start using non-English letters :)
score: 0

http://stackoverflow.com/comment/42794337
type: Comment
has text: See though the answer from `OldCurmudgeon`. According to it, seems you have an upper-level design flaw in your approach to this problem.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27149067

http://stackoverflow.com/a/56563232
score: 1
has comment: http://stackoverflow.com/comment/108152780
upvote count: 1
downvote count: 0
has body: Since version 4.3 there is a new parameter languageTagCompliant which enables languageTag parsing CookieLocaleResolver cookieLocaleResolver = new CookieLocaleResolver(); cookieLocaleResolver.setLanguageTagCompliant(true);
type: Answer
answers question: http://stackoverflow.com/q/27073953

http://stackoverflow.com/q/26999603
has body: In my fragment1 I add view like this: CheckBox chb = (CheckBox)new CheckBox(getActivity()); linearLayout.addView(chb); When I load fragment2 to activity's container and then return back to fragment1, there is no added view. Thanks for help.
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42573962
type: Question
has title: Add view to Fragment programmatically Android
score: 0
has comment: http://stackoverflow.com/comment/42549504
has comment: http://stackoverflow.com/comment/46911831
has comment: http://stackoverflow.com/comment/42533503
type: UnansweredQuestion
tagged with: android
tagged with: fragment

http://stackoverflow.com/a/27087412
upvote count: 2
has comment: http://stackoverflow.com/comment/42682996
answers question: http://stackoverflow.com/q/27087229
has comment: http://stackoverflow.com/comment/42683006
type: Answer
score: 2
downvote count: 0
has body: In Java,as soon as you create an array,basically of primitive types like int,byte,etc. which you mentioned here, all the array elements are automatically initialised with the value 0. Hence, the talk of non-null elements end here. All these elements don't point to null in case of primitive data-types,but in case of reference datatypes, these values point to null unless explicitly specified OR unless the coder forces it to do by assigning to some other parameters. Though,even that would result to run-time exception in Java. So,prevent the use of reference data-types in such way without initialisation as it'd result in NUllPointerException. For reference datatypes,we do String sarray[]={"Hello","World"}; // see here array initialised,else would have produced NullPointerException for(int i=0;i&lt;sarray.length;array++){ // do Something } Hence,for primitive datatypes in Java, we always do for(int i=0;i&lt;array.length;array++){ // do Something } This will always probably be the way of accessing array elements in Java where by definition,all the elements will constitute an array and hence, Effective size of Array in Java = Actual size of Array in Java
has comment: http://stackoverflow.com/comment/42682926
has comment: http://stackoverflow.com/comment/42682976
has comment: http://stackoverflow.com/comment/42682950

http://stackoverflow.com/a/27067850
type: AcceptedAnswer
has body: The problem was apparently with the casting mechanism at line remainder_array[index_counter] = (int) (Sequence[index_counter]%n); The cast rounded the integer down from a double, so the remainders turned out to be different in the two arrays. I couldn't use long since it doesn't have as much memory capacity. So instead I used the BigInteger class to the Sequence array, and that solved the problem.
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27053705
answers question: http://stackoverflow.com/q/27053705
upvote count: 1

http://stackoverflow.com/comment/42674418
comment on: http://stackoverflow.com/q/27081635
type: QuestionComment
type: Comment
has text: You did it several times in servlet and jsp, also are you sure you have the same session while redirecting?
score: 0

rtmp
tag name: rtmp
tags question: http://stackoverflow.com/q/27128127
tags question: http://stackoverflow.com/q/27126707
type: Tag

opennlp
type: Tag
tags question: http://stackoverflow.com/q/27146213
tag name: opennlp

homebrew
tags question: http://stackoverflow.com/q/27031262
tag name: homebrew
type: Tag

http://stackoverflow.com/a/27256922
has comment: http://stackoverflow.com/comment/43054241
score: 0
answers question: http://stackoverflow.com/q/27113417
has body: You are missing the assignment of the classpath in the fxml for the Scene Builder to pick up the Class file. If you are using Eclipse, then the classpath will point to your bin directory. FooDialog.fxml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import custom.*?&gt; &lt;?import custom.FocusedTextField?&gt; &lt;?import java.lang.*?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;?scenebuilder-classpath-element ../../bin?&gt; &lt;AnchorPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2"&gt; &lt;children&gt; &lt;FocusedTextField fx:id="fooField" /&gt; &lt;FocusedTextField fx:id="barField" /&gt; &lt;/children&gt; &lt;/AnchorPane&gt; FocusedTextField.java package custom; import javafx.beans.property.StringProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.control.TextField; public class FocusedTextField extends TextField { public void setStringProperty(final StringProperty stringProperty) { focusedProperty().addListener(new ChangeListener&lt;Boolean&gt;() { @Override public void changed(ObservableValue&lt;? extends Boolean&gt; observable, Boolean oldValue, Boolean newValue) { stringProperty .setValue(getText()); } }); } } In your case, you can use the package that you want. Just keep in mind that classpath is a relative path, so if your fxml is in src/de/foo/bar/gui/FooDialog.fxml. Then the classpath will be &lt;?scenebuilder-classpath-element ../../../../../bin?&gt;
type: Answer

http://stackoverflow.com/comment/42737219
type: QuestionComment
has text: @KickButtowski That should be an answer
score: 0
comment on: http://stackoverflow.com/q/27117159
type: Comment

http://stackoverflow.com/q/27122149
tagged with: serialization
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27124075
has comment: http://stackoverflow.com/comment/42746543
tagged with: android
has body: I have an activity which has an object of type mqttQndroidClient. this object i would like to pass it to another activity. To achieve this i read about how to solve such issue and the soltion i found was to create a class that implements serializable as shown below, and i did the following: client = new mqttAndroidClient(..,...,..,..,); Intent i = new Intent(act_1.this, act_2.class) clientObject = clientObj = new (CLIENT_OBJ_KEY, client); Bundle b = new Bundle(); b.putSerializable(CLIENT_OBJ_KEY, clientOb.getObjValue()); But eclipse underscore the b.putSerializable(CLIENT_OBJ_KEY, clientObjValue()); with red, it seems i did not cretae a serializable object correctly. and the clientObject class that implements serializable, looks as below: public class ClientObject implements Serializable { private String objectKey; private MqttAndroidClient objectValue; public ClientObject(String objectKey, MqttAndroidClient objectValue) { this.objectKey = objectKey; this.objectValue = objectValue; } public void setObjKey(String objectKey) { this.objectKey = objectKey; } public String getObjKey() { return this.objectKey; } public void setObjValue(MqttAndroidClient objValue) { this.objectValue = objValue; } public MqttAndroidClient getObjValue() { return this.objectValue; } }
has comment: http://stackoverflow.com/comment/42746714
has comment: http://stackoverflow.com/comment/42745655
has title: How to create Serializable object and pass to bundle.putSerializable(key, value)
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42745368
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27122316
tagged with: bundle

http://stackoverflow.com/comment/42853137
has text: For accessing GSA through 8000 port, you have to enable "HTTP (i.e. non SSL) Admin Console and Version Manager" under system setting on your GSA admin console.
comment on: http://stackoverflow.com/a/27170443
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/28168481
downvote count: 0
score: 6
type: Answer
accepted answer of: http://stackoverflow.com/q/27024884
has comment: http://stackoverflow.com/comment/89730960
answers question: http://stackoverflow.com/q/27024884
has body: I realize that this question is 2 months old, but since it came up in Google, I guess I would post an answer for future googlers :) GL_FRAMEBUFFER_SRGB seems to only be available on OpenGL desktop, and through extensions on OpenGLES 2.0. But through experimentations (I'm currently working on this subject) I realized that on OpenGLES 3.x, whenever the texture underlying a frame buffer has an sRGB format, colors are correctly (and automatically) converted to sRGB when writing to the frame buffer. So you don't need to use GL_FRAMEBUFFER_SRGB to enable sRGB conversion when rendering to an sRGB texture. Now if you write directly to the back buffer, you might have options to enable sRGB writes, but that would be controlled on the application side (for instance on Windows it's a flag that you specify when creating your context through wgl if I'm not mistaken) Unfortunately I can't confirm this since in the framework I'm working on, I don't have access to this part.
upvote count: 6
has comment: http://stackoverflow.com/comment/97840198
type: AcceptedAnswer

http://stackoverflow.com/comment/42622449
type: Comment
has text: Thanks for a response, this is what I thought also, but after looking in my jar spring-web is already present.
type: AnswerComment
comment on: http://stackoverflow.com/a/27037197
score: 0

http://stackoverflow.com/q/27079482
tagged with: performance
has comment: http://stackoverflow.com/comment/42669316
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27079541
type: Question
has comment: http://stackoverflow.com/comment/42668989
possible better answer: http://stackoverflow.com/a/27079541
has answer: http://stackoverflow.com/a/27079528
accepted answer: http://stackoverflow.com/a/27079528
has body: What is better use in order to check if object is null. To check if the object is null or to set a flag for it. By saying better im looking for performance (faster and safer). public class A { Object test; boolean isTestObjectSet; public A(Object test) { this.test = test; isTestObjectSet = true; } public A() { } public void doSomething() { if(test != null) //do something //VS if(isTestObjectSet) //do something } }
score: 0
answer count: 2
has title: Effective way to test if object is null

http://stackoverflow.com/comment/42677783
comment on: http://stackoverflow.com/q/27084319
type: Comment
type: QuestionComment
score: 2
has text: You shouldn't be manipulating visible swing components directly in the `main` method, only on the event dispatch thread. Try wrapping the code that touches the GUI inside `SwingUtilities.invokeLater` to move it onto the EDT.

http://stackoverflow.com/comment/42757895
score: 1
type: QuestionComment
has text: No I didnt say that you convert in into file, since you already have data as XML just store it as BLOB. Yes, Hibernate is capable of handling it.
comment on: http://stackoverflow.com/q/27113909
type: Comment

http://stackoverflow.com/comment/42817533
score: 0
comment on: http://stackoverflow.com/q/27070169
type: Comment
type: QuestionComment
has text: So have you found any of the answers useful?

http://stackoverflow.com/a/27105650
type: Answer
has comment: http://stackoverflow.com/comment/42715286
answers question: http://stackoverflow.com/q/27105528
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27105528
has comment: http://stackoverflow.com/comment/42714854
has body: You can start an Indeterminate Progress Dialog (unCancelable) at OnPreExecute and then dismiss it in onPostExecute And if you don't want the code to get started executing before the asyncTask gets Completed, just put that code in onPostExecute method of AsyncTask
has comment: http://stackoverflow.com/comment/42714711
has comment: http://stackoverflow.com/comment/42715231
has comment: http://stackoverflow.com/comment/42743958
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42714942
has comment: http://stackoverflow.com/comment/42715063
has comment: http://stackoverflow.com/comment/42714647

http://stackoverflow.com/a/27000909
type: Answer
answers question: http://stackoverflow.com/q/27000788
has comment: http://stackoverflow.com/comment/42532030
score: 2
upvote count: 2
downvote count: 0
has body: If you are open to using List&lt;String&gt; in place of String[] arrays, you could do partitioning in a very economical way: List&lt;String&gt; subList = Arrays.asList(receipts).subList(from, to); This approach does not make a copy of your array, providing a read-only view into the original array of receipts. static final int LIMIT = 10; public static void process(List&lt;String&gt; small) { if (small.size() &gt; LIMIT) { System.out.print("Array is too big: "+small.size()); return; } for (String s : small) { System.out.print(s+" "); } System.out.println(); } public static void processBig(String[] receipts) { int numChunks = ((receipts.length+LIMIT-1)/LIMIT); int from = 0; int to = LIMIT; List&lt;String&gt; bigList = Arrays.asList(receipts); for (int i = 0 ; i != numChunks ; i++) { List&lt;String&gt; subList = bigList.subList(from, to); process(subList); from += LIMIT; to += LIMIT; if (to &gt;= receipts.length) { to = receipts.length; } } } Demo. The consequences of taking this approach are that the changes made to the original array elements become "visible" through the view, and that you cannot change the resultant subList in any way.

http://stackoverflow.com/a/27031392
has body: There is no way of declaring a static variable which can only be used within a single method. It is not part of the Java syntax. You could do this at your class level with final static modifiers. It will be initialized to a static constant on the class and since it is final, cannot be changed once set: public class MyClass { private static final int myVar = 2; ... } From Oracle's documentation The static modifier, in combination with the final modifier, is also used to define constants. The final modifier indicates that the value of this field cannot change.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27031300
has comment: http://stackoverflow.com/comment/42584931

storage
tag name: storage
type: Tag
tags question: http://stackoverflow.com/q/27040533
tags question: http://stackoverflow.com/q/27134411

http://stackoverflow.com/comment/42552021
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27012086
score: 0
has text: I appreciate your response, but sir, houseTableDb and other are different in the way that they access different tables in database, i just want a method signature like // callee(JPanel p, JTable t, some method reference to use instead of houseTableDb){}..

http://stackoverflow.com/comment/42607063
comment on: http://stackoverflow.com/q/27042880
type: Comment
type: QuestionComment
score: 0
has text: The server may override your logging reference. Tipically any EE server do that prefering the logging configuration via its management tool, like WebSphere Admin Console or JBOSS `logging.xml`

http://stackoverflow.com/a/27792152
has body: I've gone with POST_MARSHALL. This way the MDC is still in context when the outputs go through marshall phase and it still works as an outFaultInterceptor, too.
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27133695
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/99738747
answers question: http://stackoverflow.com/q/27133695
upvote count: 3

http://stackoverflow.com/a/27086410
score: -1
has body: The first one isn't good because println only accepts one argument. The second one doesn't work because you can't add a String and an int. You should first call print on the String, and then println on the int. System.out.print("Age "); System.out.println(student1.getAge());
upvote count: 0
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/27086389

http://stackoverflow.com/comment/42562409
type: AnswerComment
type: Comment
has text: With the two dependencies you have posted in your Maven pom.xml, it should have pulled in _all_ these.. 1) `jersey-multipart-1.9` 2) `jersey-server-1.9` 3) `asm-3.1` 4) `jersey-core-1.9` 5) `mime-pull-1.6`. These are all needed
comment on: http://stackoverflow.com/a/27016556
score: 0

http://stackoverflow.com/q/27095731
type: Question
has answer: http://stackoverflow.com/a/27095781
type: AnsweredQuestion
tagged with: java
has body: I created a class that can find the distance between two points and the value of the midpoint between them: public class Point { private double x; private double y; public Point (double x, double y) { this.x = x; this.y = y; } public double getX() { return x; } public void setX(double x) { this.x = x; } public double getY() { return y; } public void setY(double y) { this.y = y; } public static void main (String[] args) { Point p1 = new Point(1,1); Point p2 = new Point(4,5); System.out.println("The distance between p1 and p2 is: " + distance(p1, p2)); System.out.println("The midpoint of p1 and p2 is: " + findMidpoint(p1, p2)); } public static double distance(Point p1, Point p2) { return Math.sqrt((p1.getX() - p2.getX()) * (p1.getX() - p2.getX()) + (p1.getY() - p2.getY()) * (p1.getY() - p2.getY())); } public static Point findMidpoint (Point p1, Point p2) { return new Point((p1.getX() + p2.getX()) / 2, (p1.getY() + p2.getY()) / 2); } } This code compiles fine but when I run it, it gives the output: The distance between p1 and p2 is: 5.0 The midpoint of p1 and p2 is: Point@15db9742 It gives the same value for the midpoint regardless of the values of p1 and p2. I want to output the midpoint in the format "(x,y)". Could somebody also explain why I was forced to make the distance and findMidpoint methods static?
answer count: 3
has answer: http://stackoverflow.com/a/27095795
tagged with: points
has title: Print the value of a Point to the terminal
tagged with: static
score: 0
has comment: http://stackoverflow.com/comment/42697082
possible better answer: http://stackoverflow.com/a/27095795
has answer: http://stackoverflow.com/a/27095797
accepted answer: http://stackoverflow.com/a/27095797

http://stackoverflow.com/a/26995947
answers question: http://stackoverflow.com/q/26995472
upvote count: 7
score: 7
downvote count: 0
type: Answer
has body: First java text, String/char/Reader/Writer is internally Unicode, so it can combine all scripts. This is a major difference with for instance C/C++ where there is no such standard. Now System.in is an InputStream for historical reasons. That needs an indication of encoding used. Scanner sc = new Scanner(System.in, "Windows-1251"); The above explicitly sets the conversion for System.in to Cyrillic. Without this optional parameter the default encoding is taken. If that was not changed by the software, it would be the platform encoding. So this might have been correct too. Now text is correct, containing the Cyrillic from System.in as Unicode. You would get the UTF-8 bytes as: byte[] bytes = text.getBytes(StandardCharsets.UTF_8); The old "recoding" of text was wrong; drop this line. in fact not all Windows-1251 bytes are valid UTF-8 multi-byte sequences. String result = text; System.out.println(result); System.out is a PrintStream, a rather rarely used historic class. It prints using the default platform encoding. More or less rely on it, that the default encoding is correct. System.out.println(result); For printing to an UTF-8 encoded file: byte[] bytes = ("\uFEFF" + text).getBytes(StandardCharsets.UTF_8); Path path = Paths.get("C:/Temp/test.txt"); Files.writeAllBytes(path, bytes); Here I have added a Unicode BOM character in front, so Windows Notepad may recognize the encoding as UTF-8. In general one should evade using a BOM. It is a zero-width space (=invisible) and plays havoc with all kind of formats: CSV, XML, file concatenation, cut-copy-paste.

http://stackoverflow.com/a/38396621
has body: A little late to the party, but I believe would be able to achieve what you wanted with an Answer. The following will call a real method (methodOnA), whenever the mock method (methodOnB) is called: doAnswer(new Answer&lt;Void&gt;() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { realObjectA.methodOnA() return null; } }).when(mockObjectB).methodOnB();
score: 1
answers question: http://stackoverflow.com/q/27036440
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/27124152
has body: Hi all, Im trying to build all the jpa entities out of a legacy database. I have a recurrent problem: some "main" entities have a collection of "translations", where the primary key is the key of the "main" + the "language" identifier. Languages are stored on the database and on an Enum to ease their treatment. The JPA implementation im using is Hibernate 4. Hereunder, the current implementation: Main: (Message) @Entity @Table(name="MESSAGES") @NamedQueries({ public class Message implements Serializable { @Id @SequenceGenerator(name="MESSAGES_MESSAGEID_GENERATOR", sequenceName="SEQ_MSG_messageID") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="MESSAGES_MESSAGEID_GENERATOR") @Column(name="messageId") private long id; @OneToMany(mappedBy="message", fetch=FetchType.EAGER) private Set&lt;MessageDesc&gt; descriptions; } Translation: (MessageDesc) @Entity @Table(name="MESSAGEDESCS") public class MessageDesc implements Serializable, Translatable { @EmbeddedId private MessageDescPK id; @NotNull @Enumerated(EnumType.ORDINAL) @Column(name = "LANGUAGEID") private LanguageEnum language; @NotNull @ManyToOne @JoinColumn(name="MESSAGEID") private Message message; } Translation Compound Key: (MessageDescPK) @Embeddable public class MessageDescPK implements Serializable { @Column(name="messageid", nullable = false, insertable = false) private long message; @Column(name="languageid", nullable = false, insertable = false) private int language; } Language: (LanguageEnum) public enum LanguageEnum { FRENCH(0, "FR"), DUTCH(1, "NL"); private int id; private String desc; } The problem is, when trying to persist a Main (Message) entity with some Translations on the descriptions and those translations having the Language and the Message setted, I keep receiving the following exception: org.springframework.orm.jpa.JpaSystemException: org.hibernate.id.IdentifierGenerationException: null id generated for:class something.persistence.entity.message.MessageDesc; nested exception is ja…
type: Question
type: AnsweredQuestion
score: 3
tagged with: enums
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: jpa
has title: JPA compound key with foreign key and enum
favorite count: 0
upvote count: 3
tagged with: compound-key
downvote count: 0
has answer: http://stackoverflow.com/a/30484460
accepted answer: http://stackoverflow.com/a/30484460

http://stackoverflow.com/comment/42743886
type: AnswerComment
comment on: http://stackoverflow.com/a/27113821
type: Comment
has text: That is not required, it is only necessary in some corner cases like using keywords as column names.
score: 0

http://stackoverflow.com/comment/42782716
score: 0
type: Comment
has text: yes it does, see the comments "if I use add I am facing the same problem of last added object overriding the initially added objects"
type: AnswerComment
comment on: http://stackoverflow.com/a/27142993

http://stackoverflow.com/a/27076029
answers question: http://stackoverflow.com/q/27075848
has body: Your problem are the 2 scanners. Because a scanner work with an iterator, that keep the position inside the given inputstream (in this case), when you instantiate the 2 scanners, they both set their iterator at the same position into the stream, then you use "w.nextLine();", and the first scanner advances trough the stream returning the first line, as you wish, but the second scanner, that you haven't used, is still at the beginning of the stream, so basically when you use n.nextInt();, the scanner tries to parse your name as int, and it's strange that it doesn't throws an InputMismatchException, as it should do ("https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextInt%28%29"). Rework your code as @Sarthak Mittal suggested and it should work. PS: keep in mind indentation, it's important, really
type: Answer
score: 0

http://stackoverflow.com/comment/42797082
has text: Avoiding attributes leads to huge XML structures, they are unavoidable.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27148879

http://stackoverflow.com/comment/42781935
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27142491
has text: google and read about `http client for java`

http://stackoverflow.com/comment/42660866
comment on: http://stackoverflow.com/a/27074559
score: 1
type: AnswerComment
has text: @dandavis yeah, and I'll bet their regexes were about as readable as Egyptian hieroglyphics... :) :) :)
type: Comment

http://stackoverflow.com/comment/46657630
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28993419
type: AnswerComment
has text: `export HADOOP_USER_CLASSPATH_FIRST=true` in hadoop script is reflected nowhere, so when I set `export HADOOP_USER_CLASSPATH_FIRST=true` explicitly from terminal, I can't access the hdfs files from hadoop application. Like when I try to list the files from hduser, I get this error `'ls: /user/hduser/shakespeare/': No such file or directory`. If I unset the variable, things are normal again, but same guava issue.

http://stackoverflow.com/q/26993350
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42541773
tagged with: multithreading
has body: I have the following code, which is executed within threads. Code Explanation: 1.Each Thread polls a Media Object from the LinkedBlockingDeque and does something with it. 2.When the LinkedBlockingDeque is emptied, a single thread must fetchMoreMedia. 3.This goes on until another Thread sets the DONE variable to true. static final private LinkedBlockingDeque&lt;Media&gt; lbDeque = new LinkedBlockingDeque&lt;Media&gt;(LIMIT); static final private int LIMIT = 100; public void run(){ Media media = null; while (!DONE) { if ( (media = lbDeque.poll()) != null ) { // do stuff } else { synchronized(lbDeque){ if( lbDeque.size() == 0 ){ fetchMoreMedia(LIMIT); } } } } } // LIMIT is used as a param for readability reasons private void fetchMoreMedia(int LIMIT){ // this method populates the LinkedBlockingDeque 'lbDeque' // inserting LIMIT values for(int i=0; i &lt; LIMIT; i++) { lbDeque.add(new MyObject()); } } My current code works correctly, since it makes sure that only one thread updates the LinkedBlockingDeque each time it is emptied, by checking its size in the synchronized block. But I feel that this is not efficient enough or the best way to do it. Could you please point out better way/ways (that would not need to check for the LinkedBlockingDeque's size) to ensure thread confinement in this case? or mistakes in my way of thinking? Thank you.
tagged with: java
has title: How can I achieve thread confinement more efficiently?
type: Question
score: 0
tagged with: synchronization
has comment: http://stackoverflow.com/comment/42550787

http://stackoverflow.com/q/27063429
score: 1
has body: Hi all, for my Hadoop environment, I'm trying to setup CentOS clients to act as datanodes with the Ambari management system. However, I'm running into the problem during the startup of the datanodes, here is the error log: Fail: Execution of 'mkdir -p /tmp/HDP-artifacts/ ; curl -kf --retry 10 http://sandbox.hortonworks.com:8080/resources//jdk-7u45-linux-x64.tar.gz -o /tmp/HDP-artifacts//jdk- 7u45-linux-x64.tar.gz' returned 22. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 404 Not Found So I believe that there's a problem where the client can't obtain the .tar.gz file from the Ambari server. Is there a workaround for this? I was think maybe I could just download the file from the web and stick it into the sandbox, but I don't know where the resource directory is for the sandbox. What I've tried so far: 1.) rebooting the entire environment 2.) making changes within the python code to curl out to the web 3.) manualy installing the same jdk version on each client But none of the above solutions have worked for me.. Any help is appreciated, thanks.
tagged with: java
upvote count: 1
type: Question
has title: Ambari resource dir?
tagged with: hadoop
has answer: http://stackoverflow.com/a/27069096
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27069096
type: AnsweredQuestion

http://stackoverflow.com/a/27040061
has comment: http://stackoverflow.com/comment/42613299
has comment: http://stackoverflow.com/comment/42603621
type: Answer
has comment: http://stackoverflow.com/comment/42603863
score: 0
has body: This should be possible. See some examples here: http://www.jonathanhui.com/spring-web-flow-web-flow-definiation In your case you probably want to use something like the following: &lt;view-state id="bye" view="externalRedirect:serverRelative:projectB/someJSP"&gt; Although as I guess you would want to end the flow at this point then the following might be better: &lt;action-state id="checkingvalues"&gt; &lt;evaluate expression="somethingIsthere" /&gt; &lt;transition on="success" to="hello" /&gt; &lt;transition on="error" to="bye" /&gt; &lt;/action-state&gt; &lt;end-state id="bye" view="externalRedirect:serverRelative:projectB/someJSP"/&gt;
answers question: http://stackoverflow.com/q/27039111

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/27139893
tags question: http://stackoverflow.com/q/27126376

http://stackoverflow.com/comment/42754480
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27127561
has text: Which is line 57 in your code? Exception is occurring at `line 57`.
score: 0

http://stackoverflow.com/comment/42744552
type: Comment
comment on: http://stackoverflow.com/a/27121409
has text: @TerryStorm I cant get you. Can you be please clear about your case.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42515699
score: 0
comment on: http://stackoverflow.com/q/26992252
type: Comment
type: QuestionComment
has text: What type/class do you want to use for `govId=023402084`? That looks like a tuple to me, rather than a primitive.

http://stackoverflow.com/comment/42720153
comment on: http://stackoverflow.com/q/27106762
has text: What is the error found on the queue manager error log (AMQERR01.LOG). If you are connecting to a qmgr version 7 and below, try removing the user and password from jmsConnectionFactory.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43019772
comment on: http://stackoverflow.com/a/27218086
has text: @schmoofer You're supposed to be able to get the AudioQueue instance by passing the AudioQueuePtr into AudioQueue.newInput, and then calling mQueuePtr.get(). However, that is causing my app to crash and I'm stuck at that point. I asked a question about that here as well, but no one has been able to answer it yet: [link](http://stackoverflow.com/questions/27239166/robovm-app-crashes-on-ptr-get)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27106814
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42716986
accepted answer: http://stackoverflow.com/a/27106932
has comment: http://stackoverflow.com/comment/42717170
type: AnsweredQuestion
has body: The below code is not searching properly... Please help as soon as possible.. import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; class Car{ public int speed; public Car(int speed){ this.speed = speed; } } class Compare implements Comparator&lt;Car&gt;{ public int compare(Car C1, Car C2) { if(C1.speed &lt; C2.speed) return -1; else return 1; } } public class Main{ public static void main(String[] args){ Car c ; ArrayList&lt;Car&gt; a = new ArrayList&lt;Car&gt;(); for(int i = 0 ; i &lt; 5 ; i++){ a.add(new Car(i)); } Collections.sort(a, new Compare()); System.out.println(Collections.binarySearch(a, new Car(0), new Compare())); } } I'm getting the output as some negative numbers.
tagged with: java
downvote count: 2
type: Question
has title: Collections.binarySearch returning negetive integers
score: -2
has answer: http://stackoverflow.com/a/27106932
upvote count: 0

http://stackoverflow.com/comment/42826540
comment on: http://stackoverflow.com/a/27154241
type: Comment
has text: Is spring XD using the same libraries as Spring Integration does? Becaouse I ran it under Spring boot using Spring Integration. check at my git: https://github.com/IdanFridman/CalcMicroService/blob/master/src/main/resources/integration-context-kafka.xml
type: AnswerComment
score: 0

http://stackoverflow.com/q/27081044
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42671741
has comment: http://stackoverflow.com/comment/42671657
has comment: http://stackoverflow.com/comment/42671851
has title: Java Open in Browser isn't working (in Chrome only)
tagged with: java
has comment: http://stackoverflow.com/comment/42671606
has answer: http://stackoverflow.com/a/74211224
type: Question
has comment: http://stackoverflow.com/comment/42671599
has comment: http://stackoverflow.com/comment/42671644
has comment: http://stackoverflow.com/comment/42671681
score: 4
upvote count: 4
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42671714
has comment: http://stackoverflow.com/comment/42672524
has body: This code couldn't be any simpler. However, it does nothing (other than output my print statement). I'm in a desktop Java application with Chrome set as the default browser. What am I missing? Thanks! String url = "https://www.google.com/"; try { if (java.awt.Desktop.isDesktopSupported()) System.out.println("yes"); else System.out.println("no"); java.awt.Desktop.getDesktop().browse(java.net.URI.create(url)); System.out.println("here"); } catch (IOException e) { System.err.println("exception thrown"); e.printStackTrace(); } System.out.println("done"); My exact output is this: yes here done EDIT: I switched my default browser from Chrome to Firefox, and now it works. Why won't Chrome respond to this?
favorite count: 0
has answer: http://stackoverflow.com/a/36241564

http://stackoverflow.com/comment/43108565
type: QuestionComment
has text: If you feel that it's important to clearly emphasize that this class is private, consider using a stereotype such as <<private>>. You simply document what your stereotype means, and there you are. Stereotypes are the "official" way to extend the UML specification, and the point about them that is sometimes missed is that anyone can use them to extend the UML any way they like. The fact that some stereotypes ("<<abstract>>" for example) have found their way into general use doesn't change this.
type: Comment
comment on: http://stackoverflow.com/q/27146519
score: 0

http://stackoverflow.com/comment/42793303
type: Comment
comment on: http://stackoverflow.com/a/27149175
has text: Yes it is checked as you said.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42608403
comment on: http://stackoverflow.com/a/27044647
has text: Is there anything else I should set? Cause it's still not working :(
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27064500
answers question: http://stackoverflow.com/q/27064433
downvote count: 0
has comment: http://stackoverflow.com/comment/120116239
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/120116364
has comment: http://stackoverflow.com/comment/120116063
accepted answer of: http://stackoverflow.com/q/27064433
has body: A thread is not a Java object. It is a native resource (thread of execution). The thread will be "removed from memory" as soon as it has finished running its code. From Java's perspective, the thread is dead as soon as its run() method completes. As for the Thread instance in charge of a particular thread of execution, it behaves just like any other Java object and is reclaimable by the Garbage Collector as soon as no references to it exist (and the underlying thread is not alive).
type: AcceptedAnswer

http://stackoverflow.com/q/27055752
tagged with: java
has answer: http://stackoverflow.com/a/27055823
has body: I have controller that executes some commands according to command name, taken from url. The main point is in not to use if and switch clauses. As I know there are ONLY two ways how to do it - 1) command pattern 2) reflection. //Command pattern class Controller{ private HashMap&lt;String,Command&gt; commands; public void executeCommand(String commandName){ commands.get(commandName).execute(); } ... } //reflection class Controller{ public void readCommand(){ .... } public void executeCommand(String commandName){ this.getClass().getMethod(commandName+"Command").invoke(this); } ... } So the questios: Which one is better? Is it normal in one application to let developers use one of the methods they want. Are there other ways?
has comment: http://stackoverflow.com/comment/42627862
linked to: http://stackoverflow.com/q/2015549
has answer: http://stackoverflow.com/a/35343452
upvote count: 7
has answer: http://stackoverflow.com/a/74842936
possible better answer: http://stackoverflow.com/a/27057073
has answer: http://stackoverflow.com/a/27057073
favorite count: 0
linked to: http://stackoverflow.com/q/37628
has title: Command pattern vs reflection
answer count: 4
has comment: http://stackoverflow.com/comment/42627782
downvote count: 0
accepted answer: http://stackoverflow.com/a/27055823
tagged with: design-patterns
type: Question
type: AnsweredQuestion
tagged with: command-pattern
tagged with: reflection
score: 7

http://stackoverflow.com/q/27090637
type: Question
linked to: http://stackoverflow.com/q/26955595
has comment: http://stackoverflow.com/comment/42695469
has body: I'm trying find out how to communicate with a PHP FastCGI server using Java Sockets. However google is of no help at all. I've read that the FastCGI protocol is a binary one, but that's all I know of it. I need to send the following: A HTTP request The document root (i.e. the root directory, which may change depending on host) The file to parse (which may be located in a virtual directory, Although I'm not sure about this one, it might be better to send the virtual root as doc root) How do I send a HTTP request I received in my Java application to PHP FastCGI using sockets (java.net.Socket)? (assuming the server is already running)
score: 0
tagged with: fastcgi
has comment: http://stackoverflow.com/comment/42690528
type: UnansweredQuestion
tagged with: sockets
tagged with: php
answer count: 0
tagged with: java
has title: Java FastCGI Socket (How do I communicate with a FastCGI server?)

http://stackoverflow.com/comment/43204504
comment on: http://stackoverflow.com/a/27067303
has text: Hi MihaiC, please check this http://stackoverflow.com/questions/27337800/java-timer-countdown-jtable
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27008786
has body: I am trying to determine if a path is absolute or not using regex (Pattern and Matcher classes. My requirements are: path should start with any character followed by ":" and "\" (e.g C:) it could start with "\" it could start with "/" I wrote this regex expresion: "^((?i)[a-z]):\\.*" but that doesn't seem to work. I cannot use path.isAbsolute because I need a platform independent way of detecting absolute path. Could you tell me what is wrong with that expression? Thanks
tagged with: regex
possible better answer: http://stackoverflow.com/a/27008840
has comment: http://stackoverflow.com/comment/42545834
has answer: http://stackoverflow.com/a/27008821
has comment: http://stackoverflow.com/comment/42545655
upvote count: 2
tagged with: java
has title: check if path is absolute or not using regex
has comment: http://stackoverflow.com/comment/42545698
accepted answer: http://stackoverflow.com/a/27008821
linked to: http://stackoverflow.com/q/23765399
has comment: http://stackoverflow.com/comment/42545944
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27008840
has comment: http://stackoverflow.com/comment/42545661
type: Question
answer count: 2

http://stackoverflow.com/comment/42676889
comment on: http://stackoverflow.com/q/27083913
type: Comment
type: QuestionComment
score: 2
has text: What is this supposed to do, and why do you call divide() in checkComplete? Every time you call `divide()` `quo` is increased by one. Why?

http://stackoverflow.com/comment/42722995
type: QuestionComment
has text: Seems like you're trying to read the first character of an empty string... your code may miss a test for empty string... Or now that there is the code : a return statement or an else...
score: 1
comment on: http://stackoverflow.com/q/27109981
type: Comment

http://stackoverflow.com/q/27042715
has comment: http://stackoverflow.com/comment/42604689
tagged with: variables
accepted answer: http://stackoverflow.com/a/27043131
score: 0
has answer: http://stackoverflow.com/a/27043134
tagged with: char
has comment: http://stackoverflow.com/comment/42605089
has comment: http://stackoverflow.com/comment/42604996
has body: I have a program that is supposed to read in a series of strings subtract a numeric key from their ascii value and print out the decoded words. There is an issue in my logic somewhere. Any thoughts? import java.util.*; import java.io.*; public class MsgDecoder { public static void main(String[] args) throws Exception { Scanner input1 = new Scanner(new File("data5b.txt")); String word, temp, newMsg = ""; word = input1.next(); while(input1.hasNext()) { temp = decoder(input1, word); newMsg = newMsg + " " + temp; word = input1.next(); } System.out.println(newMsg); } static String decoder(Scanner in, String w) throws Exception { String temp = ""; char c; int key; Scanner altInput = new Scanner(new File("data5a.txt")); key = altInput.nextInt(); for(int i = 0; i &lt; w.length(); i++) { c = w.charAt(i); c = Character.toLowerCase(c); if(c &gt; 96 &amp;&amp; c &lt; 123) { c = (char)(c - key); } temp = temp + "" + Character.toString(c); } return temp; } } and here are the two data files data5a.txt 9 data5b.txt Xwuh cqn vnmrxlan jan jufjhb jc cqnra knbc Cqn zdrlt kaxfw oxg sdvynm xena cqn ujih mxp Anjurch rb cqn vdamna xo j knjdcrodu cqnxah kh j pjwp xo dpuh ojlcb Fqx hxd pxwwj cx ljuu, pqxbckdbcnab Cx naa rb qdvjw, kdc cx anjuuh oxdu cqrwpb dy anzdranb j lxvydcna Cx kn xa Wxc cx kn cqjc rb cqn zdnbcrxw Adunb jan vjmn oxa cqn pdrmjwln xo frbn vnw jwm cqn xknmrnwln xo oxxub Hxd ljw wnena dwmnanbcrvjcn cqn bcdyrmrch xo cqn pnwnaju ydkurl Cqxbn fqx frbq cx jyynja frbn jvxwp oxxub, jvxwp cqn frbn bnnv oxxurbq stop
tagged with: string
possible better answer: http://stackoverflow.com/a/27043148
has answer: http://stackoverflow.com/a/27043148
has title: Basic Java decoder program not passing correct values?
answer count: 4
has answer: http://stackoverflow.com/a/27043107
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27043131
has comment: http://stackoverflow.com/comment/42604790
has comment: http://stackoverflow.com/comment/42604924
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42604838
has comment: http://stackoverflow.com/comment/42605148
has comment: http://stackoverflow.com/comment/42604819
has comment: http://stackoverflow.com/comment/42604628

hibernate
tags question: http://stackoverflow.com/q/27057867
tags question: http://stackoverflow.com/q/27124152
tags question: http://stackoverflow.com/q/27113794
tags question: http://stackoverflow.com/q/27112784
tags question: http://stackoverflow.com/q/27115639
tags question: http://stackoverflow.com/q/27014249
tags question: http://stackoverflow.com/q/27099559
tags question: http://stackoverflow.com/q/27092371
tags question: http://stackoverflow.com/q/27113909
tags question: http://stackoverflow.com/q/27040439
tags question: http://stackoverflow.com/q/26992591
tags question: http://stackoverflow.com/q/27102265
tags question: http://stackoverflow.com/q/27127674
tags question: http://stackoverflow.com/q/27069253
tags question: http://stackoverflow.com/q/27012459
tags question: http://stackoverflow.com/q/27032018
tags question: http://stackoverflow.com/q/27013353
tags question: http://stackoverflow.com/q/27150079
tags question: http://stackoverflow.com/q/27074104
tags question: http://stackoverflow.com/q/27122605
tags question: http://stackoverflow.com/q/27046165
tags question: http://stackoverflow.com/q/27066098
tags question: http://stackoverflow.com/q/27126075
tags question: http://stackoverflow.com/q/27014267
tags question: http://stackoverflow.com/q/27077054
tags question: http://stackoverflow.com/q/27098978
tags question: http://stackoverflow.com/q/27011076
tags question: http://stackoverflow.com/q/27003268
tags question: http://stackoverflow.com/q/27048704
tags question: http://stackoverflow.com/q/27093714
tags question: http://stackoverflow.com/q/27034359
tags question: http://stackoverflow.com/q/27020545
tags question: http://stackoverflow.com/q/27092709
tags question: http://stackoverflow.com/q/27123370
tags question: http://stackoverflow.com/q/27121242
tags question: http://stackoverflow.com/q/27089986
tags question: http://stackoverflow.com/q/27059021
tags question: http://stackoverflow.com/q/27087699
tags question: http://stackoverflow.com/q/27145592
tags question: http://stackoverflow.com/q/27125521
tags question: http://stackoverflow.com/q/27099234
tags question: http://stackoverflow.com/q/27101380
tags question: http://stackoverflow.com/q/27014942
tags question: http://stackoverflow.com/q/27045464
tags question: http://stackoverflow.com/q/27079075
tags question: http://stackoverflow.com/q/27074613
tags question: http://stackoverflow.com/q/27063326
tags question: http://stackoverflow.com/q/27152357
tags question: http://stackoverflow.com/q/27119677
tags question: http://stackoverflow.com/q/27067856
tags question: http://stackoverflow.com/q/27083354
tags question: http://stackoverflow.com/q/27089278
tag name: hibernate
tags question: http://stackoverflow.com/q/27071630
tags question: http://stackoverflow.com/q/27099486
tags question: http://stackoverflow.com/q/27080241
tags question: http://stackoverflow.com/q/27016778
tags question: http://stackoverflow.com/q/27024765
tags question: http://stackoverflow.com/q/26999642
tags question: http://stackoverflow.com/q/27041945
tags question: http://stackoverflow.com/q/27067685
tags question: http://stackoverflow.com/q/27086725
tags question: http://stackoverflow.com/q/27038134
tags question: http://stackoverflow.com/q/27072758
tags question: http://stackoverflow.com/q/27070234
tags question: http://stackoverflow.com/q/26994534
tags question: http://stackoverflow.com/q/27098545
tags question: http://stackoverflow.com/q/27143255
tags question: http://stackoverflow.com/q/27041484
tags question: http://stackoverflow.com/q/27089466
tags question: http://stackoverflow.com/q/27125572
tags question: http://stackoverflow.com/q/27088089
tags question: http://stackoverflow.com/q/27019263
tags question: http://stackoverflow.com/q/27079257
tags question: http://stackoverflow.com/q/27078774
tags question: http://stackoverflow.com/q/27032365
tags question: http://stackoverflow.com/q/27037955
tags question: http://stackoverflow.com/q/27101048
tags question: http://stackoverflow.com/q/27145331
tags question: http://stackoverflow.com/q/27124427

http://stackoverflow.com/q/27100917
tagged with: multithreading
tagged with: socketexception
downvote count: 1
accepted answer: http://stackoverflow.com/a/27101226
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42707073
has body: My code is as follows. When request comes, server creates two threads (producer-consumer pattern): ... while(true) { Socket clientSocket = server.accept(); System.out.println("Got connection!"); Thread consumerThread = new Thread(new ConsumerThread(sharedQueue, clientSocket)); Thread producerThread = new Thread(new ProducerThread(sharedQueue, clientSocket)); consumerThread.start(); producerThread.start(); } ... Consumer thread reads what client sent and producer thread responds back. Consumer: @Override public void run() { try { while (true) { in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); // read, do actions } } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } finally { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } } Producer: @Override public void run() { try { out = new PrintStream(clientSocket.getOutputStream(), true); // some actions out.println("something"); } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { out.close(); clientSocket.close(); } catch (IOException e) { e.printStackTrace(); } } But in server I get following error: java.net.SocketException: Socket closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:150) at java.net.SocketInputStream.read(SocketInputStream.java:121) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:161) at java.io.BufferedReader.readLine(BufferedReader.java:324) at java.io.BufferedReader.readLine(BufferedReader.java:389) at ee.ut.ds.server.ConsumerThread.run(ConsumerThread.java:30) at java.lang.Thread.run(Thread.java:745) What might cause this? I e…
answer count: 3
has answer: http://stackoverflow.com/a/27101068
favorite count: 0
has title: multithreaded TCP server: java.net.SocketException: Socket closed
tagged with: sockets
possible better answer: http://stackoverflow.com/a/27100995
has answer: http://stackoverflow.com/a/27101226
upvote count: 2
has answer: http://stackoverflow.com/a/27100995
score: 1
tagged with: tcp
tagged with: java

http://stackoverflow.com/comment/42642379
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27062394
has text: Yes I know you can solve this but I find it strange Java can only load one resource at a time. And I want if possible an other solution to this.
score: 0

http://stackoverflow.com/q/26998681
accepted answer: http://stackoverflow.com/a/26999235
has body: I need to generate max value for unsigned 64 bit long in java, using bitwise shift. So here is my function: public static final boolean isMaxLimitMiss(int bitsCount, BigDecimal value, int signum) { if (signum == 0) { BigDecimal val = new BigDecimal(Long.valueOf((1 &lt;&lt; (bitsCount)) - 1)); return Long.compareUnsigned(value.longValue(), val.longValue()) &gt; 0 ? true : false; } return value.compareTo(new BigDecimal((1L &lt;&lt; (bitsCount - 1)) - 1)) &gt; 0 ? true : false; } It just checks that value is in range for max value that bitsCount provides. It works fine for signed data. In case 64 bit, and for unsigned (Yes, there are no unsigned long in java. I trying to simulate it) - it is incorrect. ((1 &lt;&lt; (bitsCount)) - 1 evaluates to 0 How can I pass value = 2^64 - 1 into BigDecimal constructor?
has comment: http://stackoverflow.com/comment/42528595
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42528720
has comment: http://stackoverflow.com/comment/42529190
type: AnsweredQuestion
tagged with: java
tagged with: bit-manipulation
upvote count: 1
downvote count: 1
has title: Bitwise shift to get max unsigned value
type: Question
has answer: http://stackoverflow.com/a/26999235

randomaccessfile
tags question: http://stackoverflow.com/q/27114503
tag name: randomaccessfile
tags question: http://stackoverflow.com/q/27130206
type: Tag

http://stackoverflow.com/a/27128122
score: 5
accepted answer of: http://stackoverflow.com/q/27115364
has comment: http://stackoverflow.com/comment/42765417
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42767031
answers question: http://stackoverflow.com/q/27115364
upvote count: 5
has comment: http://stackoverflow.com/comment/64517606
has body: JAXB doesn't consider any empty element to be a valid representation of null. If you introspect the indentifier property of type String you'll see it is "" after you unmarshal the empty element. The two valid representations of null are: Missing element, corresponds to minOccurs="0" in the XML Schema. This is the default behaviour. xsi:nil="true" on the element. This corresponds to nillable="true" in the XML Schema. If you annotate your property with @XmlElement(nillable=true) you will get this behaviour. UPDATE Thanks for your answer. On point 2, I have annotated my property with @XmlElement(nillable = true) in the class above, but I haven't got the behaviour you describe in my XML. Does your answer mean that, in the production of any XML that should be null, the attribute xsi:nil needs to explicitly be set to true? When you have @XmlElement(nillable=true) the expectation is that the corresponding XML element has the xsi:nil attribute set to true like the following: &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;person&gt; &lt;id xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/&gt; &lt;/person&gt; I'm happy with the idea that the Identifier element is an empty String, not null, but the id element, because it's an Integer should be null, not 0, right? You can definitely make that argument. With the JAXB RI if you change your Integer property to Long you will see the behaviour you are looking for.
type: Answer
has comment: http://stackoverflow.com/comment/111637768
has comment: http://stackoverflow.com/comment/42772240

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/27151764
tags question: http://stackoverflow.com/q/27037651
tags question: http://stackoverflow.com/q/27112820
type: Tag
tags question: http://stackoverflow.com/q/27018138
tags question: http://stackoverflow.com/q/27054628

http://stackoverflow.com/a/27051383
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Just invoke name() method. See below example: import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; ; public class JacksonTest { public static void main(String[] args) throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); mapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, true); Pojo pojo = new Pojo(); pojo.userStatus = UserStatus.Activated; String json = mapper.writeValueAsString(pojo); System.out.println(json); Pojo deserializedPojo = mapper.readValue(json, Pojo.class); System.out.println("--"); System.out.println(deserializedPojo); } public static class Pojo { public UserStatus userStatus; @Override public String toString() { return userStatus.name(); } } @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public enum UserStatus { Unregistered, Activated, Deactivated, Locked; @JsonValue public String toValue() { return name(); } } } Above program prints: { "userStatus" : "Activated" } -- Activated
type: Answer
accepted answer of: http://stackoverflow.com/q/27049465
upvote count: 1
answers question: http://stackoverflow.com/q/27049465

http://stackoverflow.com/a/58123107
has body: More examples :) I had the same problem. I create time slots with interface Slot and using it in the application As example: Schedule schedule = new Schedule(myduration, unit); schedule.add(date1, slot1); schedule.add(date2, slot2); schedule.get(date1, slot1); schedule.indexOf(date1, slot1); schedule.remove(date1, slot1); schedule.set(date1, index, slot1); More details in github https://github.com/illineya/schedule
answers question: http://stackoverflow.com/q/27046368
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42714554
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27103517
has text: @SME_Dev of course, mine error was thinking that `@ApplicationScoped` is, thanks for the comment BTW

http://stackoverflow.com/comment/42558015
comment on: http://stackoverflow.com/q/27016242
score: 0
type: Comment
type: QuestionComment
has text: By that do you mean the method which adds the values to the list? Also we have to make our list clss

http://stackoverflow.com/comment/42636453
has text: I will go through ur link, thanks a lot for ur help, will ask doubts if I am still confused
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27059847

http://stackoverflow.com/comment/42546174
has text: Your suggestion really helped me Sir
comment on: http://stackoverflow.com/q/26992174
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27122725
has body: You can try this for User (remove reference to User in Status) public class User { @OneToOne @JoinColumn(name = "frn_user_id", insertable = false, updateable = false) private Status status; // ... } insertable = false, updateable = false should instruct Hibernate to look for frn_user_id in target table (Status).
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/27122605
type: Answer
score: 2

hbase
tags question: http://stackoverflow.com/q/27009660
tags question: http://stackoverflow.com/q/27055233
tags question: http://stackoverflow.com/q/27064373
tags question: http://stackoverflow.com/q/27128142
type: Tag
tag name: hbase
tags question: http://stackoverflow.com/q/27097905

http://stackoverflow.com/a/27142945
downvote count: 0
score: 1
has body: You have way too much code for such a simple task. In pseudo code: for each char in name1 remove 1 occurrence of that char from name2 In java, not much more than the pseudo: for (int i = 0; i &lt; name1.length(); i++) name2 = name2.replaceFirst(name1.substring(i, i + 1), ""); That's all the code you need for the character manipulation as stated. Edit: I just realised it can be done much more neatly: for (String letter : name1.split("(?&lt;=.)")) name2 = name2.replaceFirst(letter, ""); The regex passed to split splits after each letter - neatly giving an array of letters as strings.
answers question: http://stackoverflow.com/q/27141833
upvote count: 1
type: Answer

http://stackoverflow.com/q/27114764
has body: Background I'm working on an Android app that controls the screen rotation. The app is available on the Google Play store. To control the screen rotation, the app disables system auto rotation and changes the values of USER_ROTATION. The source code is available via Mercurial/hg. Problem While the app works fine on my phone, a rooted Sony Xperia M, it crashes on a friend's Samsung Galaxy S3 running Android 4.3. The crash occurs outside of my code, so I don't get a crash report in the Google Play Store, and the stack trace only shows external code that I don't have access to. java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL at android.os.Parcel.readException(Parcel.java:1431) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137) at android.content.ContentProviderProxy.call(ContentProviderNative.java:602) at android.provider.Settings$NameValueCache.getStringForUser(Settings.java:934) at android.provider.Settings$System.getStringForUser(Settings.java:1162) at android.provider.Settings$System.getIntForUser(Settings.java:1232) at com.android.internal.policy.impl.WindowOrientationListener$ScreenOrientationEventListenerImpl.onSensorChanged(WindowOrientationListener.java:501) at android.hardware.SystemSensorManager$SensorE This stack trace implies that the system auto rotation is still running. It also shows the OS code is trying to read an int system setting as a particular user after receiving a screen orientation change event. So I suspect the problem is related to me disabling ACCELEROMETER_ROTATION or changing USER_ROTATION, both of which are int system settings. Troubleshooting I checked other questions about this error. Most of them only explain what the error means without providing any solution. I couldn't find any with the …
upvote count: 2
tagged with: android
tagged with: securityexception
tagged with: samsung-mobile
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27146874
tagged with: java
has comment: http://stackoverflow.com/comment/42732828
has comment: http://stackoverflow.com/comment/42735484
type: Question
has title: SecurityException: Permission Denial
accepted answer: http://stackoverflow.com/a/27146874
answer count: 1
downvote count: 0
tagged with: android-4.3-jelly-bean
has comment: http://stackoverflow.com/comment/42732901
has comment: http://stackoverflow.com/comment/42733048
favorite count: 0

http://stackoverflow.com/comment/42792935
type: Comment
has text: @Kamini could you please update the question providing more information on the `pusher.json` handling code? e.g. fetching the query parameters.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27146139

http://stackoverflow.com/q/27028221
has title: How to find the floor and remainder of a fraction in Java?
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/27028222
has body: Given integers 'a' and 'b', I would like a method that returns the floor and remainder of a / b such that: a / b = floor + remainder / |b| (where |b| is the absolute value of b), and 0 &lt;= remainder &lt; |b|. For example, 5/3 = 1 + 2/3. Here's an attempt that works only for positive a and b: public static long[] floorAndRemainder(long a, long b) { long floor = a / b; long remainder = a % b; return new long[] { floor, remainder }; } I need a function that works for all positive and negative numerators and denominators. For example, -5/3 = -2 + 1/3 5/-3 = -2 + 1/3 -5/-3 = 1 + 2/3
tagged with: math
tagged with: java
upvote count: 2
has answer: http://stackoverflow.com/a/27028222
tagged with: function
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27045786
answer count: 1
downvote count: 1
favorite count: 0
score: 0
has body: Can someone explain the behavior of the following code? In particular why does the forEach in the stream change the original List?: import java.util.ArrayList; import java.util.List; public class foreachIssue { class justanInt { public int anint; public justanInt(int t){ anint=t; } } public static void main(String[] args){ new foreachIssue(); } public foreachIssue(){ System.out.println("The Stream Output:"); List&lt;justanInt&gt; lst = new ArrayList&lt;&gt;(); justanInt j1=new justanInt(2); justanInt j2=new justanInt(5); lst.add(j1);lst.add(j2); lst.stream() .map((s)-&gt;{ s.anint=s.anint*s.anint; return s; }) .forEach((s)-&gt;System.out.println("Anything")); System.out.println(" lst after the stream:"); for(justanInt il:lst) System.out.println(il.anint); List&lt;justanInt&gt; lst1 = new ArrayList&lt;&gt;(); justanInt j3=new justanInt(2); justanInt j4=new justanInt(5); lst1.add(j3);lst1.add(j4); lst1.stream() .map((s)-&gt;{ s.anint=s.anint*s.anint; return s; }); System.out.println(" lst1 after the stream without forEach:"); for(justanInt il:lst1) System.out.println(il.anint); } } The output is: The Stream Output: Anything Anything lst after the stream: 4 25 lst1 after the stream without forEach: 2 5
has comment: http://stackoverflow.com/comment/42661041
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42610666
tagged with: java-8
has answer: http://stackoverflow.com/a/27046015
tagged with: java-stream
tagged with: java
type: Question
has title: Possible Java1.8 stream anomaly
has comment: http://stackoverflow.com/comment/42616167
upvote count: 1

http://stackoverflow.com/a/27151885
type: Answer
answers question: http://stackoverflow.com/q/27044940
has body: Try this : @RequestMapping(method = RequestMethod.PUT) public Person registerPerson(@RequestBody Person user) throws Exception { //some Logic }
score: 0

http://stackoverflow.com/a/27143923
downvote count: 2
upvote count: 4
has body: ' ' has ascii code 32. When you use arr[i] + ' ' you convert second operand to integer and add to first operand.
answers question: http://stackoverflow.com/q/27143860
type: Answer
score: 2

assertions
tags question: http://stackoverflow.com/q/27047314
tags question: http://stackoverflow.com/q/27120070
type: Tag
tag name: assertions

http://stackoverflow.com/a/27002153
has comment: http://stackoverflow.com/comment/42535261
has comment: http://stackoverflow.com/comment/42535666
score: 20
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26999642
upvote count: 20
answers question: http://stackoverflow.com/q/26999642
has body: @Proxy(lazy=false) will disable the default lazy loading for a particular entity. This means you always get the initialized entity whenever this entity is being referenced from other entities. Using this annotation is usually a "code smell". If I were you, I would remove it and simply load all entity associations using the JOIN FETCH directive.
has comment: http://stackoverflow.com/comment/42535944
type: Answer
has comment: http://stackoverflow.com/comment/42535844
has comment: http://stackoverflow.com/comment/42535557
downvote count: 0

http://stackoverflow.com/q/27146736
has answer: http://stackoverflow.com/a/27147328
answer count: 1
tagged with: shell
accepted answer: http://stackoverflow.com/a/27147328
has title: Connect to streams additional to STDIN, STDOUT and STDERR from Java
tagged with: process
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has body: In a Java process which is started by a native process (Yate telephony engine's extmodule) through a shell script, it is possible to connect to STDIN and STDOUT to communicate with the process and write log messages to STDERR. The description of Yate's extmodule however mentions two additional file descriptors 3 and 4: The external user application or script comunicates with the module trough several file descriptors: 0 (stdin) - Carries commands and notifications from engine to application 1 (stdout) - Carries commands and answers from application to the engine 2 (stderr) - Has the usual meaning of reporting errors and is directed to the engine's stderr or logfile 3 (optional) - Transports audio data from the engine to the application 4 (optional) - Transports audio data from the application to the engine File descriptors 3 and 4 are open only for audio capable applications. Is it possible at all to connect to those optional file descriptors and if yes, how? I know I can use System.in, System.out and System.err for 0, 1, and 2 but what about the additional ones?

http://stackoverflow.com/comment/42630026
comment on: http://stackoverflow.com/q/27042880
type: Comment
type: QuestionComment
score: 0
has text: Hi Artem, I tried connecting to that ftp server and manually fetching a file to local. The connection was pretty stable. I launch the application on tomcat locally and on server in same time, new files have been synchronized to local directory but server received nothing. It seemed like ftp adapter is disable somehow on server side.

pdfbox
tag name: pdfbox
type: Tag
tags question: http://stackoverflow.com/q/26994748

http://stackoverflow.com/comment/42569750
type: AnswerComment
comment on: http://stackoverflow.com/a/27022557
type: Comment
has text: Here I found a bunch of links http://stackoverflow.com/questions/5238175/how-can-i-use-java-to-download-a-video-file-from-http-urlvideo-streaming-link http://stackoverflow.com/questions/2498359/downloading-you-tube-videos http://stackoverflow.com/questions/9964218/downloading-embedded-videos Use everything legibly
score: 0

http://stackoverflow.com/q/27053933
answer count: 1
has title: SWT texts not properly aligned in gridlayout
score: 0
has body: When I added the two Text controls (dUsername and dPassword), they are not properly aligned. Please refer the screen capture attached. The two Text controls added next to the combo should be placed under their respective label headings. However, I am not able to find the cause of the improper alignment. it would be of great help if I could get any pointers regarding the same. public void createControl(Composite Parent) { Composite container = new Composite(Parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 10; layout.verticalSpacing = 20; layout.horizontalSpacing = 15; GridData gd1 = new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1); createLabelSection(container,gd1); getARowForEach(container,gd1); } private void getARowForEach(Composite container, GridData grid) { while (some condition) { String dString = (String) dIterator.next(); addControls(dString, container, grid); } } private void addControls(String dvString, Composite container, GridData grid) { Button checkBox = setCheckBoxText(container, null); String dvLabel = dvString; getLabelCaption(container,dvLabel); Combo hostCombo = setComboText(container); Text dUsername = new Text(container, SWT.NONE); Text dPassword = new Text(container, SWT.PASSWORD); } public Button setCheckBoxText(Composite container, Label label){ Button checkBox = new Button(container, SWT.CHECK); GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1); checkBox.setLayoutData(gd); checkBox.setSelection(true); return checkBox; } public Label getLabelCaption(Composite container, String caption){ Label label = new Label(container, SWT.NONE); GridData grid = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1); label.setLayoutData(grid); label.setText(caption); return label; } public Combo setComboText(Composite container){ Combo combo = new Combo(container, SWT.READ_ONLY); GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2,…
tagged with: swt
has answer: http://stackoverflow.com/a/27061166
accepted answer: http://stackoverflow.com/a/27061166
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42701579
type: AnswerComment
has text: Spring Beans should not have mutable state. All state is built at initialization time. The mutable state is encapsulated in request/response data.
type: Comment
comment on: http://stackoverflow.com/a/27087747
score: 0

http://stackoverflow.com/q/27143936
has comment: http://stackoverflow.com/comment/120976435
has comment: http://stackoverflow.com/comment/42784449
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42785317
type: Question
accepted answer: http://stackoverflow.com/a/27144625
has title: Serialize Java List to XML using Jackson XML mapper
has comment: http://stackoverflow.com/comment/42784402
downvote count: 0
tagged with: pojo
has answer: http://stackoverflow.com/a/46134797
tagged with: jackson
upvote count: 30
answer count: 3
possible better answer: http://stackoverflow.com/a/46134797
score: 30
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xmlmapper
has body: Hi I need to create an XML from JAVA using Jackson-dataformat XMLMapper. The XML should be like 1 Mighty Pulpo austin TX Hong Kong Hong Kong But I get it always like with an extra "< addresses> < /addresses>" tag. 1 Mighty Pulpo austin TX Hong Kong Hong Kong I am using below code to create XML JaxbAnnotationModule jaxbAnnotationModule = new JaxbAnnotationModule(); XmlMapper mapper = new XmlMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.registerModule(jaxbAnnotationModule); mapper.registerModule(new GuavaModule()); String xml = mapper.writeValueAsString(customer); System.out.println(xml); Please can some one help me? How can I remove the extra tag please. I have tried to use @XmlElement but it does not help help. TIA!!
has answer: http://stackoverflow.com/a/39823051
has answer: http://stackoverflow.com/a/27144625

http://stackoverflow.com/comment/42975889
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27059473
has text: The error "date: org.joda.time.LocalDate is not a supported property type." indicates, that the type (Java class) of the property with name "date" is not allowed as a property of an Entity. This is a technical problem (or better a restriction by the app engine) and has nothing to do with default time zones. Using the Joda DateTime class will cause exactly the same problem!

http://stackoverflow.com/comment/42679412
has text: did you also remove this specific controller - @RepositoryRestResource exposes its own set of endpoints
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27082236
type: AnswerComment

http://stackoverflow.com/q/27087699
has comment: http://stackoverflow.com/comment/42683933
linked to: http://stackoverflow.com/q/8882382
has body: I am getting the following error: Caused by: org.hibernate.HibernateException: Missing column: member_assignable_id in aguil.membership I find this unusual as I simply copied the pattern from an earlier implementation (changed some names around, but still mostly the same). The following is my setup for my entity classes: @Entity @Inheritance(strategy = InheritanceType.JOINED) @Table(name = "assignable", uniqueConstraints = @UniqueConstraint(columnNames = {"alias"})) public abstract class Assignable { private Long assignableId; private String alias; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "assignable_id") public Long getAssignableId() { return assignableId; } public void setAssignableId(Long assignableId) { this.assignableId = assignableId; } @Column(name = "alias", nullable = false) public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } } @Entity @Table(name = "team") public class Team extends Assignable { private Set<Membership> memberships; @OneToMany(mappedBy = "team") public Set<Membership> getMemberships() { return memberships; } public void setMemberships(Set<Membership> memberships) { this.memberships = memberships; } } @Entity @Table(name = "person", uniqueConstraints = { @UniqueConstraint(columnNames = {"email"}), @UniqueConstraint(columnNames = {"username"}) }) public class Person extends Assignable { private String username; private String firstName; private String lastName; private String email; private String password; private Set<Membership> memberships; @Column(name = "username", nullable = false) public String getUsername() { return username; } public void setUsername(String firstName) { this.username = username; } @Column(name = "first_name", nullable = false) public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @Column(name = "last_name", nullable = false) public String getLastName() { return lastNam…
has answer: http://stackoverflow.com/a/27088490
has comment: http://stackoverflow.com/comment/42684009
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
tagged with: jpa
answer count: 1
score: 0
has title: Missing column in JPA even if it exists

http://stackoverflow.com/a/27118887
type: Answer
answers question: http://stackoverflow.com/q/27118850
score: 1
upvote count: 1
has body: Nothing in the JDK, I am afraid. You could pull in Commons Lang, or just make a helper method (like the one in your current code) yourself. You can simplify the code a little by making use of Arrays#copyOf (which allows the copy to be one element longer than the original). No matter how you do it, you will end up with a new array. Since arrays cannot be resized, there is no other way.
has comment: http://stackoverflow.com/comment/42739653
downvote count: 0

http://stackoverflow.com/comment/42652596
has text: I understand what and why you were suggesting me to do, but I'm afraid that I will not be able generate the code of this converter :/ I just tried to make it but it did not really work..
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27069112

http://stackoverflow.com/q/27102958
answer count: 1
score: 0
tagged with: java
has body: I'm sorry for the long post, but I think this is the only way to explain whats happening... I'm looking for help after a lot of research with no answers... A big problem I think... So this web app schedule a local notification based on a time picker that the users interact with.. I'm using cordova and jquery mobile multi-page system... It changes from page to page by div IDs, the navigation looks like this: index.html, index.html#page2, index.html#page3.. The local notification is a java plugin for cordova Katzer Local Plugin. The plugin only works inside the onDeviceReady function and the jquery mobile does not, like this... document.addEventListener('deviceready', onDeviceReady, false); /* JQUERY MOBILE HERE */ $(document).on("pagecreate", "#home", function(event) { $("a#btnpage2").click(function (e) { e.stopImmediatePropagation(); e.preventDefault(); $( "#page2" ).pagecontainer( "change"); // change to #page2 }); }); $(document).on("pagecreate", "#page2", function(event) { console.log("#page2 created"); }); function onDeviceReady(){ /* NOTIFICATION PLUGIN HERE */ //create notification var msg = "notification message"; window.plugin.notification.local.add({ id: 'notif', date: dateobject, message: msg, json: JSON.stringify({ test: msg }), title: 'Title', autoCancel: true, ongoing: false }); //onclick event notification window.plugin.notification.local.onclick = function (notif, state, json) { var msg = JSON.parse(json).test; $( "#notificationPage" ).pagecontainer( "change", { text: msg} ); //pass data and change to #page2 } //ontrigger notification window.plugin.notification.local.ontrigger = function (notif, state, json) { var msg = JSON.parse(json).test; } } When the notification is fired, and when I click it, it should change the page to #notificationPage. The problem is that the command inside onclick, does not work even when I click the notification with the app running, it throws this error: Uncaugh Error: cannot call methods on pagecontainer prior to initial…
tagged with: javascript
type: UnansweredQuestion
tagged with: jquery
has answer: http://stackoverflow.com/a/28866840
tagged with: android
has title: Cordova Jquery Mobile Local Notification onclick change page
tagged with: cordova
type: Question

http://stackoverflow.com/q/27128675
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27129090
type: Question
has body: I'm working on executing cmd commands via Java and i got this piece of code which is working fine for me. import java.io.IOException; public class Exec { public static void main(String args[]){ try { Process p = Runtime.getRuntime().exec("cmd /c start notepad.exe"); System.out.println("Command Executed!"); } catch (IOException e) { e.printStackTrace(); } } } Now this snippet just starts notepad.exe, but i want to execute some commands including paths etc for example Process p = Runtime.getRuntime().exec("cmd /c c:/Users/Subhan/Desktop index.htm"); In this case it does nothing. It doesn't even throws any kind of exception. So how to do that? And i'm just looking forward to set up environmental variables through some cmd command is it possible?
has comment: http://stackoverflow.com/comment/42756993
has comment: http://stackoverflow.com/comment/42756712
upvote count: 1
tagged with: environment-variables
answer count: 1
tagged with: cmd
favorite count: 0
type: UnansweredQuestion
has title: Executing CMD long commands via Java

data-structures
tags question: http://stackoverflow.com/q/27027323
tag name: data-structures
tags question: http://stackoverflow.com/q/27009596
tags question: http://stackoverflow.com/q/27004830
tags question: http://stackoverflow.com/q/27089615
tags question: http://stackoverflow.com/q/27115961
tags question: http://stackoverflow.com/q/27056799
tags question: http://stackoverflow.com/q/27103448
tags question: http://stackoverflow.com/q/27077616
tags question: http://stackoverflow.com/q/27120181
tags question: http://stackoverflow.com/q/27017735
tags question: http://stackoverflow.com/q/27072961
type: Tag
tags question: http://stackoverflow.com/q/27142596
tags question: http://stackoverflow.com/q/27102490
tags question: http://stackoverflow.com/q/27023896
tags question: http://stackoverflow.com/q/27073872
tags question: http://stackoverflow.com/q/27092858

http://stackoverflow.com/comment/42672647
has text: Okay, the question is, do you want a `Certificate` like an X509Certificate, or do you want to use this as a client authentication mechanism using a PKCS12 file? If you have a PKCS12 file, then you need the corresponding private key to create a PKCS12 file out of the private key and the X509Certificate. I'm not sure what you mean by "individual trusted keys", the whole point of a chain of trust is that the CA signs the X509Certificate, and if the CA is trusted, then so are all the certificates. For this, there is a CA which provides the X509Certificate by signing the PKCS10 CSR.
comment on: http://stackoverflow.com/q/27081174
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27013063
has body: I'm trying do re-adapt simple weather app (http://code.tutsplus.com/tutorials/create-a-weather-app-on-android--cms-21587) to Google Glass, it returns a json object on Android and works, but in my google glass when I want to use the getCity function, I have a null pointer exception error. My getCity function is the same as the one in SimpleWeatherApp public String getCity(){ return prefs.getString("city", "Jerusalem, IL"); } Theres is 3 Java Files, 2 Class and 1 Activity. Citypreference , to return the city and get city. RemoteFetch to get the Json Object Main activity to build view for the google glass and show the information that I need. I can share to you the whole project if you want more informations. here's a part of my MainActivity content private View buildView() { CardBuilder card = new CardBuilder(this, CardBuilder.Layout.TEXT); card.setText(R.string.open_weather_maps_app_id); //updateWeatherData(new CityPreference(getActivity()).getCity()); updateWeatherData(new CityPreference().getCity()); return card.getView(); } private void updateWeatherData(final String city){ new Thread(){ public void run(){ final JSONObject json = RemoteFetch.getJSON(MainActivity.this.getApplicationContext(),city); if(json == null){ handler.post(new Runnable(){ public void run(){ Toast.makeText(MainActivity.this, MainActivity.this.getString(R.string.place_not_found), = SO JSON NULL Toast.LENGTH_LONG).show(); } }); } else { handler.post(new Runnable(){ public void run(){ renderWeather(json); } }); } } }.start(); } So that's mean my json object is null. For the remotefetch.java you can find it in the SimpleWeatherApp link on the top of my post
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42552368
tagged with: google-gdk
type: Question
linked to: http://stackoverflow.com/q/218384
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42552389
has title: Google Glass SimpleWeatherApp getCity function return null
tagged with: google-glass
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27013236

http://stackoverflow.com/comment/42770554
type: Comment
type: QuestionComment
has text: the problem is in your XML file, post it too
comment on: http://stackoverflow.com/q/27136143
score: 0

http://stackoverflow.com/comment/42694457
score: 0
has text: Apart of what @GordThompson added, you're executing batch statements from 1 to 1. And you can reuse your `PreparedStatement`, there's no need to close it on every iteration of your `while` loop.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27094056

http://stackoverflow.com/q/27001225
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27027254
tagged with: java
tagged with: cluster-computing
type: Question
linked to: http://stackoverflow.com/q/6771541
tagged with: spring-batch
has title: How to see all jobs in a cluster using Spring Batch?
answer count: 2
downvote count: 0
favorite count: 0
tagged with: spring-xd
has body: I'm trying to determine all the things I need to consider when deploying jobs to a clustered environment. I'm not concerned about parallel processing or other scaling things at the moment; I'm more interested in how I make everything act as if it was running on a single server. So for I've determined that triggering a job should be done via messaging. The thing that's throwing me for a loop right now is how to utilize something like the Spring Batch Admin UI (even if it's a hand rolled solution) in a clustered deployment. Getting the job information from a JobExplorer seems like one of the keys. Is Will Schipp's spring-batch-cluster project the answer, or is there a more agreed upon community answer? Or do I not even need to worry because the JobRepository will be pulling from a shared database? Or do I need to publish job execution info to a message queue to update the separate Job Repositories? Are there other things I should be concerned about, like the jobIncrementers? BTW, if it wasn't clear that I'm a total noob to Spring batch, let it now be known :-)
has answer: http://stackoverflow.com/a/27025023
upvote count: 2
has answer: http://stackoverflow.com/a/27027254
tagged with: spring
accepted answer: http://stackoverflow.com/a/27025023

remote-desktop
tags question: http://stackoverflow.com/q/27110855
tag name: remote-desktop
type: Tag

http://stackoverflow.com/comment/42577757
type: Comment
has text: On the question regarding the user\password prompt, I found it to be something router related, as I access an internal ip with an external address. From outside the net I get 404 resources not found is I write ip/appName in the url bar
type: QuestionComment
comment on: http://stackoverflow.com/q/27024672
score: 0

http://stackoverflow.com/a/27125699
answers question: http://stackoverflow.com/q/27123182
has comment: http://stackoverflow.com/comment/42975947
downvote count: 0
has comment: http://stackoverflow.com/comment/42753594
has body: Drop the formLogin(). You need to maintain the mindset that REST is supposed to be stateless. Logging in with a form this way, is not purely REST. You can create a fine masked filter with Spring security chains like this (randomly just added stuff to create a more complete. Spring Security works by filters, which means that you need to create an actual filter before it kicks in. Specifically you need to authorize requests before matching them to paths. http.authorizeRequests() .antMatchers("/login").permitAll() .antMatchers("/say/user/").hasRole("USER") .antMatchers("/say/admin").hasRole("ADMIN") .anyRequest().authenticated(); The code above should be self explaining. If not, I will try to elaborate on it. As for token based login, this is a good idea, but you should not roll your own. Spring has great Oauth support and getting started securing your REST API with it is awesome. This tutorial explains it in great detail and should help you further in building better API's as well. http://spring.io/guides/tutorials/bookmarks/ Also make sure you have a look at Fowler's writings on REST here http://martinfowler.com/articles/richardsonMaturityModel.html
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/a/27128793
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27128604
downvote count: 0
has body: This is a very weird implementation, and very un-object oriented. You should have an Enemy class with the members that are currently in the Enemies class. Your Enemies class should contain a List&lt;Enemy&gt; variable, which contains an instance for each Enemy. Then your enemyDecided method would be as simple as : public Enemy enemyDecided(int choice) { return enemies.get(choice); }

http://stackoverflow.com/comment/42601573
type: Comment
has text: How does using the File make this any better than the other answers using the substring/lastIndexOf technique?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27041140

http://stackoverflow.com/comment/42844251
type: AnswerComment
score: 0
type: Comment
has text: I removed my own handling code from that notification class i posted. So it won't output anything. Did you add some handling code yourself?
comment on: http://stackoverflow.com/a/27129723

http://stackoverflow.com/q/27002818
has comment: http://stackoverflow.com/comment/42550306
has answer: http://stackoverflow.com/a/27003277
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42537339
tagged with: java
has comment: http://stackoverflow.com/comment/42536101
has title: Where OpenCSV creates the .csv files?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42535350
type: Question
has comment: http://stackoverflow.com/comment/42535655
has comment: http://stackoverflow.com/comment/42535376
has body: I'm working with opencsv librarie in Eclipse and when I write something in a .csv I don't know in which folder is created. I should say that I need that the .csv file is not deleted when i turn off the app, so I can store in the assets folder, right? My code is this: try { String csv = "data.csv"; CSVWriter writer = new CSVWriter(new FileWriter(csv)); //Create record String [] record = "hello,world".split(","); //Write the record to file writer.writeNext(record); //close the writer writer.close(); } catch (IOException e) {}
has comment: http://stackoverflow.com/comment/42536847
score: 0
answer count: 1
tagged with: directory
tagged with: opencsv
has comment: http://stackoverflow.com/comment/42535763

http://stackoverflow.com/comment/42981340
comment on: http://stackoverflow.com/q/27022107
has text: I added Xalan 2.7.1 directly to the classpath and it works now. So there has to be a problem with the internal version of Xalan. I didn't really want to do that but i don't think i can work around that bug. Thanks for your help anyway.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42664638
type: Comment
comment on: http://stackoverflow.com/a/27076942
has text: But how do i pass the string or value made in Fragment 1 to activity? How do i pass it onto the `public String message;`??
score: 0
type: AnswerComment

http://stackoverflow.com/q/27070663
tagged with: gwt
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: https
type: Question
tagged with: google-visualization
accepted answer: http://stackoverflow.com/a/27071008
tagged with: javascript
has title: How to load GWT Visualization API over HTTPS
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm trying to load the GWT Visualization Api to draw a chart like so: Runnable onLoadCallback = new Runnable() { public void run() { LineChart chart = new LineChart(createTable(), createOptions()); MyPage.this.add(chart); } }; VisualizationUtils.loadVisualizationApi(onLoadCallback, LineChart.PACKAGE); This works fine running locally, but over an application server, run() is never fired. I get the following error in my browser console: Mixed Content: The page at 'https://mysite.myorg.com/mypage' was loaded over HTTPS, but requested an insecure script 'http://www.google.com/jsapi?callback=__gwt_AjaxLoader_onLoad'. This request has been blocked; the content must be served over HTTPS. I can't find anything in the Visualization documentation to force VisualizationUtils to load the API over HTTPS. Can anyone help me with this?
upvote count: 2
has answer: http://stackoverflow.com/a/27071008

hibernate-mapping
tags question: http://stackoverflow.com/q/27001714
tags question: http://stackoverflow.com/q/27112784
tag name: hibernate-mapping
tags question: http://stackoverflow.com/q/27026887
tags question: http://stackoverflow.com/q/27090348
type: Tag
tags question: http://stackoverflow.com/q/27016778
tags question: http://stackoverflow.com/q/27125572
tags question: http://stackoverflow.com/q/27106361
tags question: http://stackoverflow.com/q/27019263
tags question: http://stackoverflow.com/q/27062797

http://stackoverflow.com/comment/42672245
type: AnswerComment
comment on: http://stackoverflow.com/a/27067303
score: 0
type: Comment
has text: glad to hear it :) good luck with your project

http://stackoverflow.com/q/27127392
has comment: http://stackoverflow.com/comment/42754208
has comment: http://stackoverflow.com/comment/42754203
type: AnsweredQuestion
has title: Why doesn't Java have a putIfAbsent(key, supplier) method in Map?
tagged with: collections
type: Question
accepted answer: http://stackoverflow.com/a/27127481
upvote count: 20
tagged with: java
score: 20
has answer: http://stackoverflow.com/a/55168066
answer count: 2
has comment: http://stackoverflow.com/comment/42754241
downvote count: 0
possible better answer: http://stackoverflow.com/a/55168066
favorite count: 0
has answer: http://stackoverflow.com/a/27127481
has comment: http://stackoverflow.com/comment/42754185
has body: I just recently found myself wanting a version of putIfAbsent(...) in java.util.Map that you can supply some kind of factory method to, to instantiate an Object if it's not already present. This would simplify a lot of code. Here is my modified interface: import java.util.Map; import java.util.function.Supplier; /** * Extension of the Map Interface for a different approach on having putIfAbsent * * @author Martin Braun */ public interface SupplierMap&lt;K, V&gt; extends Map&lt;K, V&gt; { public default V putIfAbsent(K key, Supplier&lt;V&gt; supplier) { V value = this.get(key); if(value == null) { this.put(key, value = supplier.get()); } return value; } } Now my question: Is there another (easier) way of doing this or have I just overlooked something in the Java API?
tagged with: dictionary

http://stackoverflow.com/comment/42657354
type: QuestionComment
has text: Another minecraft-cubic guy nah...
score: 0
comment on: http://stackoverflow.com/q/27071391
type: Comment

http://stackoverflow.com/q/27019151
has comment: http://stackoverflow.com/comment/42564536
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42565385
tagged with: android-fragments
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
upvote count: 1
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/27020539
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27020539
tagged with: service
has title: Service losing bind (mBoundService = null)
has comment: http://stackoverflow.com/comment/42565268
has body: I've got a working version with a Fragment pasing json string to the main activity which has a tcp socket service bound to it: Main_Activity: ... private ServiceConnection mConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { mBoundService = ((Socket_Service.LocalBinder) service).getService(); } @Override public void onServiceDisconnected(ComponentName name) { mBoundService = null; Log.d("TCP Client: Main_Activity", "onServiceDisconnected called!"); } }; ... public void writeByte(String jsonObject) { if (mBoundService != null) { mBoundService.sendMessage(jsonObject); } } ... Fragment: ... Main_Activity activity = (Main_Activity) getActivity(); activity.writeByte(jsonObject.toString()); ... --------------------------------------------------------------------------------------------- I'd like to create a separate class (no fragment) to create the json string, pass it to the Main_Activity which passes it to the service. I did that, but it's not working, because mBoundService gets the value "null" and cant pass anything to the service anymore. Fragment: JSON pwmJASON = new JSON(); pwmJASON.cratePWMJSON(PWM1,PWM2,PWM3,PWM4,PWM5,PWM6,PWM7); JSON.class: package de.l.LED.control.background; import android.app.Fragment; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import de.l.LED.control.Main_Activity; public class JSON extends Main_Activity{ public void cratePWMJSON(int PWM1, int PWM2, int PWM3, int PWM4, int PWM5, int PWM6, int PWM7){ JSONObject jsonObject = new JSONObject(); JSONArray jsonArray = new JSONArray(); try { //jsonArray.put(""); jsonArray.put(PWM1 * 64); jsonArray.put(PWM2 * 64); jsonArray.put(PWM3 * 64); jsonArray.put(PWM4 * 64); jsonArray.put(PWM5 * 64); jsonArray.put(PWM6 * 64); jsonArray.put(PWM7 * 64); jsonObject.put("PWMs", jsonArray); } catch (JSONException e) { e.printStackTrace(); } Log.d("JSO", "Received JSON String: " + …
has comment: http://stackoverflow.com/comment/42564464

http://stackoverflow.com/a/46035266
upvote count: 5
type: Answer
has body: For those trying to achieve this in kafka v0.10.2.1 and running into issues with serialization error 'java.io.StreamCorruptedException: invalid stream header: 3139322E' following is a sample working code with the needful imports. import org.I0Itec.zkclient.ZkClient; import org.I0Itec.zkclient.ZkConnection; import org.I0Itec.zkclient.exception.ZkMarshallingError; import org.I0Itec.zkclient.serialize.ZkSerializer; import org.apache.kafka.clients.consumer.KafkaConsumer; import org.apache.kafka.common.PartitionInfo; import kafka.admin.AdminUtils; import kafka.admin.RackAwareMode; import kafka.utils.ZKStringSerializer; import kafka.utils.ZkUtils; public static void createTopic(String topicName, int numPartitions, int numReplication) { ZkClient zkClient = null; ZkUtils zkUtils = null; try { String zookeeperHosts = "199.98.916.902:2181"; // If multiple zookeeper then -&gt; String zookeeperHosts = "192.168.20.1:2181,192.168.20.2:2181"; int sessionTimeOutInMs = 15 * 1000; // 15 secs int connectionTimeOutInMs = 10 * 1000; // 10 secs zkClient = new ZkClient(zookeeperHosts, sessionTimeOutInMs, connectionTimeOutInMs); //Ref: https://gist.github.com/jjkoshy/3842975 zkClient.setZkSerializer(new ZkSerializer() { @Override public byte[] serialize(Object o) throws ZkMarshallingError { return ZKStringSerializer.serialize(o); } @Override public Object deserialize(byte[] bytes) throws ZkMarshallingError { return ZKStringSerializer.deserialize(bytes); } }); zkUtils = new ZkUtils(zkClient, new ZkConnection(zookeeperHosts), false); int noOfPartitions = 2; int noOfReplication = 3; Properties topicConfiguration = new Properties(); AdminUtils.createTopic(zkUtils, topicName, noOfPartitions, noOfReplication, topicConfiguration, RackAwareMode.Enforced$.MODULE$); } catch (Exception ex) { ex.printStackTrace(); } finally { if (zkClient != null) { zkClient.close(); } } }
answers question: http://stackoverflow.com/q/27036923
score: 5
downvote count: 0

http://stackoverflow.com/comment/121955454
score: 1
type: AnswerComment
type: Comment
has text: Careful, I don't believe this approach will work with animated GIFs as I think `getPixelReader()` returns `null` in that case.
comment on: http://stackoverflow.com/a/42946424

http://stackoverflow.com/a/27123158
score: 1
has body: You need SimpleDateFormat pendingmesstime2=new SimpleDateFormat("dd MMM yyyy HH:mm"); The date format string has to be in the same format as the string you're trying to parse. You've specified something of the form 25/11/2014 14:41, rather than 25 Nov 2014 14:41. There's also something weird going on with the conversion from StringBuffer to String: you're ending up with a few extra spaces at the beginning for some reason. I can only assume this is a result of something you haven't shown us. (It looks as though you haven't copied and pasted exactly from your source, because there's at least a typo with the pendingmesstime variable name in the last line.)
answers question: http://stackoverflow.com/q/27123089
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27123089
type: Answer
upvote count: 1

http://stackoverflow.com/q/27058846
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42632927
tagged with: chat
has comment: http://stackoverflow.com/comment/42632845
answer count: 2
accepted answer: http://stackoverflow.com/a/27059128
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27059280
has answer: http://stackoverflow.com/a/27059128
has body: i'm having trouble to connect TWO clients. is it bcoz i am using DataOutputStream and DataInputStream instead of BufferedReader and PrintWritter? For some reason, it just dont connect to each other even if i set the server sockets and sockets to be interconnected through localhost and port 8000. i could not send messages between these two clients. But, yes, they can connect to the server. However, I want my clients to communicate each other instead so that it works like an online chat. Server Side: import java.io.*; import java.net.*; import java.util.*; import java.awt.*; import javax.swing.*; public class Server extends JFrame { // Text area for displaying contents private static JTextArea jta = new JTextArea(); public static void main(String[] args) { new Server(); } public Server() { setLayout(new BorderLayout()); add(new JScrollPane(jta), BorderLayout.CENTER); setTitle("Server"); setSize(500, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); // It is necessary to show the frame here! // Place text area on the frame try { // Create a server socket ServerSocket serverSocket = new ServerSocket(8000); jta.append("Server started at " + new Date() + '\n'); try { while (true) { new Handler(serverSocket.accept()).start(); } } finally { serverSocket.close(); } } catch(IOException ex) { System.err.println(ex); } } public static class Handler extends Thread{ Socket socket; DataInputStream inputFromClient; DataOutputStream outputToClient; public Handler(Socket socket){ this.socket = socket; } public void run(){ // Listen for a connection request //Socket socket = serverSocket.accept(); try{ // Create data input and output streams inputFromClient = new DataInputStream(socket.getInputStream()); outputToClient = new DataOutputStream(socket.getOutputStream()); while (true) { // Receive data from the client String message =inputFromClient.readUTF(); System.out.println("Server: Receive input"); jta.append("Word received from client: " + message + '\n'); // …
tagged with: socketserver
type: AnsweredQuestion
has title: Why cant both my client communicate to each other? (java server socket)
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27059280

http://stackoverflow.com/q/27147413
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27156059
favorite count: 0
accepted answer: http://stackoverflow.com/a/27156059
has body: At our company, we are migrating our old ivy repository to Nexus. After uploading our own artifacts to Nexus, I tried downloading a few projects' dependencies to test the setup, but I'm failing with spring-web. Let me explain how. Here is the ivy-settings.xml file pointing only to our local Nexus installation &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;ivysettings&gt; &lt;settings defaultResolver="default" /&gt; &lt;resolvers&gt; &lt;ibiblio name="nexus" m2compatible="true" root="http://nexus.local/nexus/content/repositories/central/" /&gt; &lt;ibiblio name="our-nexus" m2compatible="true" root="http://nexus/nexus/content/repositories/repo" /&gt; &lt;chain name="default" returnFirst="true"&gt; &lt;resolver ref="our-nexus" /&gt; &lt;resolver ref="nexus" /&gt; &lt;/chain&gt; &lt;/resolvers&gt; &lt;/ivysettings&gt; In one of our projects we use Spring Web, but not all of its dependencies, so I declared &lt;dependency org="org.springframework" name="spring-web" rev="3.0.5.RELEASE" transitive="false" /&gt; This worked fine when using Ivy repository. However today I can't perform an &lt;ivy:retrieve&gt; task because it can't find com.caucho#hessian#3.2.1 &lt;ivy:report&gt; task says that such version of hessian is required by spring-web 3.2.11.RELEASE But I have declared transitive="false"!!! Why isn't it working? What am I missing/messing?
linked to: http://stackoverflow.com/q/22150359
tagged with: nexus
upvote count: 1
tagged with: maven
type: AnsweredQuestion
has title: Ivy's transitive="false" gets simply ignored when downloading from Nexus
score: 1
tagged with: java
tagged with: ivy
type: Question

http://stackoverflow.com/comment/42605435
comment on: http://stackoverflow.com/a/27041304
type: Comment
has text: You can do it, but it is a good practice to pass parameters, it helps preventing SQL Injection (not quite sure... someone correct me if I'm wrong, please). Also, looking at the code I've posted, building the string this way may be a potential security flaw. Try doing it statically, using a flag to define the column name. E.g `if (foo_flag) s= "column_1"` (...)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42545932
type: Comment
comment on: http://stackoverflow.com/a/27005379
score: 0
type: AnswerComment
has text: the RoundRobin router makes a lot of sense to me. what do you mean by slow reads? Of course the co-ordination of the counter actors uses some time but this should amortise itself when 1 million actors are counted?

http://stackoverflow.com/comment/42625205
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27049742
has text: @MichaelMinella, note that those are not used in the where clause, but rather in a subselect. Do you think for some reason that that would cause the issue I am having with the _id field? I realize I could change that to a join instead of a subselect and use a where clause, but I have many additional sub selects that can't be made into joins that I've removed for the sake of trying to reduce confusion. The query is tested and works. Like I said, page 1 functions fine and it isn't until page 2 where the WHERE clause automatically gets added, that the named _id param isn't bound. Thank you again!

http://stackoverflow.com/a/27091562
score: 2
has comment: http://stackoverflow.com/comment/43613242
has comment: http://stackoverflow.com/comment/43612932
has comment: http://stackoverflow.com/comment/43612970
has body: Suggestions: Use the Swing GUI library, not AWT. You will want to draw in a class that extends JPanel Override the JPanel's protected void paintComponent(Graphics g) method, and do your drawing inside of this method. Be sure to call the super's method: super.paintComponent(g) inside of your override. Then display the JPanel inside of whatever top-level Swing window that you desire, but it a JApplet, JFrame, JDialog, or inside of another JPanel if this is required. You can add this drawing JPanel to your applet in the JApplet's init() method simply via add(myDrawingJPanel); Regarding: is it possible to use applet without extending Applet class? No I don't think so. If you want to create a GUI and display it inside of a JApplet or Applet, then you must override the class, and in particular override its init() method, and add your GUI to the applet there. For more specific help, consider providing more information and code with your question. Edit Regarding your edit: this is a console application and I want to keep it like that, but I also want to draw the rectangle when calling draw method, the shape class isn't needed, it's just an abstract class and doesn't have implemented methods. in summery I want to use an applet to draw the rectangle while keeping my application a console one(except drawing).any help ? Again, if you want to draw something and display it, you need a GUI and so might as well create and display a stand-alone GUI such as a JFrame or JDialog or at the minimum a JPanel in a JOptionPane. Again, you cannot and should not use an applet in any of this. Period. My previous recommendations still stand.
has comment: http://stackoverflow.com/comment/43613275
has comment: http://stackoverflow.com/comment/43613148
accepted answer of: http://stackoverflow.com/q/27091328
has comment: http://stackoverflow.com/comment/43613272
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42704889
answers question: http://stackoverflow.com/q/27091328
has comment: http://stackoverflow.com/comment/43613310
type: Answer
has comment: http://stackoverflow.com/comment/43612984
upvote count: 2

keystroke
type: Tag
tags question: http://stackoverflow.com/q/27106204
tag name: keystroke
tags question: http://stackoverflow.com/q/27151177

http://stackoverflow.com/q/27147760
tagged with: jakarta-ee
has body: Because I have some generics which need to be passed to the newly produced object, I am creating a producer. But while producer works, the EntityManager is not injected because producer creates an instance with operator new instead of using CDI. How can I produce an object with CDI support? The code: Qualifier: @Qualifier @Retention(RUNTIME) @Target( { FIELD, TYPE, METHOD }) public @interface Multiselector { Class&lt;? extends Dbo&gt; clazz(); } Producer: @SessionScoped public class MultiselectorProducer implements Serializable { @Produces @Multiselector(clazz = SpecialDbo.class) public MultiselectorService&lt;SpecialDbo&gt; produce() { return new MultiselectorService&lt;SpecialDbo&gt;(SpecialDbo.class); } } Service class: @Stateful @LocalBean public class MultiselectorService&lt;T extends Dbo&gt; implements Serializable { @Inject private EntityManager em; private List&lt;T&gt; itemList; public MultiselectorService() { } public MultiselectorService(Class&lt;? extends Dbo&gt; clazz) { itemList = em.createQuery("some Sql String", clazz); } .... } NOTE: The EntityManager is a custom crud service which is otherwise injected correctly Any improvement suggestions over the code are welcome. Thanks!
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27148286
tagged with: cdi
has title: Java EE CDI - producing beans with injected fields
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27148286
type: Question

http://stackoverflow.com/comment/42773030
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27137428
type: QuestionComment
has text: I'm almost certain your `AbstractA` type is generic.

http://stackoverflow.com/q/27053365
tagged with: spring
answer count: 1
tagged with: java
upvote count: 7
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27054715
tagged with: elasticsearch
tagged with: spring-data-elasticsearch
score: 7
has body: Does anybody know what's Java Config equivalent of : &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:elasticsearch="http://www.springframework.org/schema/data/elasticsearch" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.0.xsd"&gt; &lt;elasticsearch:transport-client id="client" cluster-nodes="localhost:9300,someip:9300" /&gt; &lt;/beans&gt; I specifically want to use nodeBuilder() to do it.
favorite count: 0
type: Question
has title: Spring Data ElasticSearch TransportClient Java Config

http://stackoverflow.com/q/27118304
answer count: 2
has body: It compiles, just that it doesn't initialize the while (choice = false) so whatever ans was entered, it wouldn't show "Invalid input, enter a, b, c: " and reiterate. import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String ans; boolean choice; System.out.print("Enter a, b, c: "); ans = kb.nextLine(); choice = isValidChoice(ans); while (choice = false) { System.out.print("Invalid input, enter a, b, c: "); ans = kb.nextLine(); choice = isValidChoice(ans); } if (choice = true) { System.out.println("Your input was " + ans); } } public static boolean isValidChoice(String choice) { if (choice.equalsIgnoreCase("a") || choice.equalsIgnoreCase("a") || choice.equalsIgnoreCase("a")) { return true; } else { return false; } } }
tagged with: while-loop
has answer: http://stackoverflow.com/a/27118410
tagged with: return
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27118416
has title: Boolean Method does not return false
has comment: http://stackoverflow.com/comment/42738540
tagged with: java
has comment: http://stackoverflow.com/comment/42738836
type: Question
tagged with: if-statement
tagged with: boolean
score: 0

http://stackoverflow.com/q/27136812
score: 0
has comment: http://stackoverflow.com/comment/42772498
has body: How would I go about getting the return value from this piece of code? It doesn't let me use the return function within my FOR loop, and I don't know how to proceed. It should return an object stored in the Array List al (which was declared in my main method) but I am unable to get the method to correctly return the Student object. Any tips? public static Student getStudentByNumber(int number1, ArrayList&lt;Student&gt; al) { for(Iterator&lt;Student&gt; it = al.iterator(); it.hasNext();) { if(number1 == it.next().getStudentNumber()) { return it.next(); } else { return null; } } }
has comment: http://stackoverflow.com/comment/42772710
has comment: http://stackoverflow.com/comment/42771874
possible better answer: http://stackoverflow.com/a/27136856
has comment: http://stackoverflow.com/comment/42773769
accepted answer: http://stackoverflow.com/a/27136902
tagged with: return
has answer: http://stackoverflow.com/a/27136856
linked to: http://stackoverflow.com/q/36707
has comment: http://stackoverflow.com/comment/42772154
has comment: http://stackoverflow.com/comment/42772413
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42772038
has title: How can I incorporate my return method with this snippet of code? (Java, Eclipse)
has comment: http://stackoverflow.com/comment/42772230
has answer: http://stackoverflow.com/a/27136902
tagged with: function
tagged with: class

http://stackoverflow.com/comment/42670899
score: 0
comment on: http://stackoverflow.com/q/27079644
type: Comment
type: QuestionComment
has text: Also, there is a reason why two-dimensional arrays may be slower: they require multiplication to compute the address of the array elements. It could be the case that the CPU architecture is less efficient at performing multiplication than resolving an additional pointer reference.

http://stackoverflow.com/comment/42571162
score: 0
type: Comment
has text: actually i tried without the cast too. I get the same result.
type: QuestionComment
comment on: http://stackoverflow.com/q/27023475

http://stackoverflow.com/q/27116627
favorite count: 0
tagged with: linux
has title: using raspberry pi usb to communicate with other device
answer count: 0
type: UnansweredQuestion
tagged with: java
upvote count: 1
has body: I am trying to using raspberry pi usb to communicate with other devices, however I encountered a problem when trying to open the port. The trace log from console is as follows: 11/24/14 13:56:48.641 + DLSUSBScale: Scale claim 11/24/14 13:56:48.641 + DLSUSBScale: Device claim 11/24/14 13:56:48.641 + DLSObjectFactory: createPort() 11/24/14 13:56:48.642 - DLSObjectFactory: createPort() - LinuxUSB 11/24/14 13:56:48.642 + DLSUsbJavax: openPort 11/24/14 13:56:48.642 + DLSUsbQuery: findDevice 11/24/14 13:56:48.642 = DLSUsbQuery: gettingUsbServices 11/24/14 13:56:48.643 *ERR* DLSUsbJavax: 0x80000001, Error while loading shared library libJavaxUsb.so: /home/pi/Desktop/dls/javaPOS/SupportJars/libJavaxUsb.so: /home/pi/Desktop/dls/JavaPOS/SupportJars/libJavaxUsb.so: cannot open shared object file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform) 11/24/14 13:56:48.643 - DLSUsbJavax: openPort: false 11/24/14 13:56:48.643 *ERR* DLSUSBScale: Error opening port 11/24/14 13:56:48.643 *ERR* DLSScaleService: claim: 1110x80000004, Port open error 11/24/14 13:56:53.949 + DLSScaleService: getDataEventEnabled: false 11/24/14 13:56:53.949 - DLSScaleService: getDataEventEnabled 11/24/14 13:56:53.950 + DLSScaleService: getAsyncMode: false 11/24/14 13:56:53.950 - DLSScaleService: getAsyncMode I do not know what is the problem and how can I figure it out. And someone suggest me to load the USB-HID driver in Linux system (in my situation, it is raspbian). But I do not know where to download the USB-HID driver and how to load it. By the way, I install Java on raspberry pi through: sudo apt-get update &amp;&amp; sudo apt-get install oracle-java7-jdk Thx for your help!
type: Question
tagged with: raspbian
has comment: http://stackoverflow.com/comment/42736232
has comment: http://stackoverflow.com/comment/42735840
tagged with: arm
tagged with: raspberry-pi
downvote count: 0
score: 1

http://stackoverflow.com/comment/42765519
comment on: http://stackoverflow.com/q/27133236
score: 0
has text: sorry I misunderstood your question the first time reading it :)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27020627
has comment: http://stackoverflow.com/comment/42591918
has body: First you need a TextView where the values from timer will be displayed. I have an example of a countdown timer with value display: private TextView remainingTimeDisplay; private int timerProgressStatus; remainingTimeDisplay = (TextView) findViewById(R.id.remainingTimeDisplay); private void setQuizTimer(int time) { final int actualTime = time*1000; CountDownTimer gameCountDownTimer = new CountDownTimer(actualTime, 1000) { int totalTime = actualTime; @Override public void onTick(long millisUntilFinished) { /*Display time left in a textview*/ long millis =String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(millis), TimeUnit.MILLISECONDS.toMinutes(millis) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(millis)), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis))); remainingTimeDisplay.setText(hms); /*Progress bar display values*/ timerProgressStatus = (int)(( totalTime - millisUntilFinished ) /(double)totalTime * 100); timerProgressBar.setProgress(timerProgressStatus); } @Override public void onFinish() { Toast.makeText(QuestionActivity.this,"Countdown Ended",Toast.LENGTH_SHORT).show(); } }.start(); } When you want to use this method you only need to call the it with the number of secounds. Ex: For 10 secounds setQuizTimer(10); The output will be 09:59, hope this helps.
score: 0
answers question: http://stackoverflow.com/q/27020021
type: Answer
has comment: http://stackoverflow.com/comment/42672441
has comment: http://stackoverflow.com/comment/42565793
has comment: http://stackoverflow.com/comment/42577121

http://stackoverflow.com/comment/42564309
has text: thanks! but it doesnt work... i think we are too close. Should i declare something above that? Create a new pattern object? or compile the regular expression? i have seen some examples and i am really confused..
type: AnswerComment
comment on: http://stackoverflow.com/a/27018117
score: 0
type: Comment

http://stackoverflow.com/comment/42980607
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27116590
type: AnswerComment
has text: Thank you for this configuration setting. I can think of other ways this can help me. Cheers

bitmap
tags question: http://stackoverflow.com/q/27113337
tags question: http://stackoverflow.com/q/27119525
type: Tag
tags question: http://stackoverflow.com/q/27147379
tags question: http://stackoverflow.com/q/27045104
tag name: bitmap
tags question: http://stackoverflow.com/q/27010197

http://stackoverflow.com/q/27033394
has body: I am trying to move the false element in 2d array to a different blank space in element 'X*''O'' ''X''O*' 'O''O'' '' ''X' 'O'' ''X''X''O*' 'X'' '' ''X''X' 'X''X''O*''X''O*' the elements marked with * are false elements. I want to move those false cells to look like this. In other word move all the false elements to blank space in the array ' ''O''X''X'' ' 'O''O''O'' ''X' 'O''O''X''X'' ' 'X''O''O''X''X' 'X''X'' ''X'' ' This is what I have so far but not getting the result, it only moves one element not all the false elements. And when I try to put break in outer loop it does not work. Any tips please, this is my code so far: char temp = ' '; char[][] arr = new char[tissue.length][tissue[0].length]; for (int i = 0; i &lt; tissue.length; i++) for (int j = 0; j &lt; tissue[i].length; j++){ if (isSatisfied(tissue, i, j, threshold) arr[i][j] = tissue[i][j]; if ( !isSatisfied(tissue, i, j, threshold)) { temp = tissue[i][j]; breakloop: for (int k = 0; k &lt; tissue.length; k++) for (int l = 0; l &lt; tissue[k].length; l++) if (tissue[k][l] == ' ') { tissue[i][j] = arr[k][l]; arr[k][l] = temp; break breakloop; } } }
has comment: http://stackoverflow.com/comment/42588096
type: AnsweredQuestion
favorite count: 0
has title: Moving elements in array
accepted answer: http://stackoverflow.com/a/27034652
tagged with: multidimensional-array
type: Question
answer count: 1
tagged with: java
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42589088
has comment: http://stackoverflow.com/comment/42605271
has answer: http://stackoverflow.com/a/27034652
tagged with: arrays

http://stackoverflow.com/a/27136434
has comment: http://stackoverflow.com/comment/42771128
has comment: http://stackoverflow.com/comment/42771328
has body: There is no way to do operator overloading, eg: T number = new T(); number * 5; in Java. I don't know why, but you just can't. Instead, try doing; static &lt;T&gt; T foo(T number) { return new T(number.getInt()*2); } or something to that effect. Hope it helps. &quot;+&quot; operator for Java-classes EDIT: To expand on what was mentioned in the comments about using Integer i = 5;, this is a feature of Java called autoboxing/unboxing. When you do: Integer i = 5; i = i * 4; int n = i; Java is really doing: Integer i = new Integer(5); i = new Integer(i.intValue() * 4); int n = i.intValue();
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42771395
answers question: http://stackoverflow.com/q/27136286
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42554228
comment on: http://stackoverflow.com/a/27013236
has text: Thanks for your answers, I get No Weather data found,so that's the Json object that appers to be null.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27043427
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42605875
answer count: 4
favorite count: 0
has body: I have a Date . I want to copy its time only, excluding the date. I then need to insert the time into another date. Is there a easy way to do this?. I cant change the Date datatype. I can do, getHour(),getMinutes() etc however this is long winded. is there a clearner version that i could use ? or perhaps other library's like apache commons to set/get date time (have not spotten anything so far).
has comment: http://stackoverflow.com/comment/42605866
upvote count: 1
accepted answer: http://stackoverflow.com/a/27043596
tagged with: java
has answer: http://stackoverflow.com/a/27043813
has comment: http://stackoverflow.com/comment/42605910
tagged with: date
has comment: http://stackoverflow.com/comment/42605977
possible better answer: http://stackoverflow.com/a/27043600
has answer: http://stackoverflow.com/a/27043600
has title: setting and getting time from Date in java
tagged with: java-7
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27045508
has answer: http://stackoverflow.com/a/27043596
has comment: http://stackoverflow.com/comment/42605834
type: Question

http://stackoverflow.com/q/27090411
has comment: http://stackoverflow.com/comment/42778130
score: 0
tagged with: box-api
tagged with: box
has comment: http://stackoverflow.com/comment/42778157
type: UnansweredQuestion
tagged with: email-client
tagged with: java
has answer: http://stackoverflow.com/a/36436796
has title: Java: How do I get user's email with box api v2
type: Question
tagged with: boxapiv2
answer count: 1
has body: I building a java desktop app, It can download and upload files with box.com I've added a few libraries in https://github.com/box/box-java-sdk-v2/tree/master/BoxJavaLibraryV2/libs It worked, but I need i get user's email to manage account. I can't find example in github.com/box/box-java-sdk-v2 To get it. Thank for your reading, i'm so sorry for my bad english.

http://stackoverflow.com/comment/42652098
has text: Why would one machine have '/dev/' act properly but the other not? At least what I have seen, the issue is machine/configuration based.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27068843
type: Comment

http://stackoverflow.com/comment/42794124
score: 2
has text: NullPointerException is probably the easiest of all Java exceptions to debug. Learn how to debug. Start by actually reading the exception information you get.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27149706

http://stackoverflow.com/comment/42643425
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27064828
has text: Does not work and it is there for security reasons :)

http://stackoverflow.com/q/27134159
downvote count: 1
tagged with: jfilechooser
type: Question
has body: So, I am trying to save data created in my java program to a new file that the user chooses using JFILECHOOSER. I got the program to select the save file, but then as it goes to write the data to the file, i get this error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at q1.Heaps.countOccurance(Heaps.java:131) at q1.Heaps.save(Heaps.java:155) at q1.createGui$Save.actionPerformed(Gui.java:219) 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.AbstractButton.doClick(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.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.doIntersect…
score: -1
accepted answer: http://stackoverflow.com/a/27134724
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27134724
type: AnsweredQuestion
tagged with: java
tagged with: save
has title: Saving Files in Java

http://stackoverflow.com/q/27121242
tagged with: oracle-database
has title: Hibernate Criteria in Clause with 2 conditions in 1 Query
has comment: http://stackoverflow.com/comment/42743450
has answer: http://stackoverflow.com/a/27127089
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has body: How do i acheive the following SQL Query using Hibernate Criteria Query: select * from Table1 where (A,B) in (select A,B from Table2)
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42753559
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/27137247
has comment: http://stackoverflow.com/comment/42772578
has comment: http://stackoverflow.com/comment/42772740
has answer: http://stackoverflow.com/a/27137355
has answer: http://stackoverflow.com/a/27137357
accepted answer: http://stackoverflow.com/a/27137357
has body: For example I have a parent class: public class Parent { public String getString() { return ""; } } And a group of subclasses override getString() and return the same result: public class Child1 extends Parent { @Override public String getString() { return "return a string"; } } public class Child2 extends Parent { @Override public String getString() { return "return a string"; } } public class Child3 extends Parent { @Override public String getString() { return "return a string"; } } Another group of subclasses return the same result too: public class Child4 extends Parent { @Override public String getString() { return "return nothing"; } } public class Child5 extends Parent { @Override public String getString() { return "return nothing"; } } public class Child6 extends Parent { @Override public String getString() { return "return nothing"; } } So the result is, I have to write the same implementation for overriding getString() many time. Is there any better way than this ? Thank you very much for any reply.
upvote count: 2
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/42772785
has comment: http://stackoverflow.com/comment/42772763
has answer: http://stackoverflow.com/a/27137395
has comment: http://stackoverflow.com/comment/42772567
score: 2
type: AnsweredQuestion
tagged with: oop
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27137395
has title: How to avoid repetition when overriding a method?
type: Question

http://stackoverflow.com/q/27099241
tagged with: java
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/27099341
has comment: http://stackoverflow.com/comment/42703039
downvote count: 1
has body: I have a same class belonging to 2 different packages. package x1.y1.Class packgage x2.y2.Class Is it possible that if I am invoking a x1.y1.Class via classloader, x2.y2.Class loads instead?
favorite count: 0
possible better answer: http://stackoverflow.com/a/27099341
tagged with: classloader
has title: Java Classloading
has comment: http://stackoverflow.com/comment/42703057
has comment: http://stackoverflow.com/comment/42703092
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27099268
accepted answer: http://stackoverflow.com/a/27099268
score: 1

http://stackoverflow.com/comment/42804023
type: QuestionComment
comment on: http://stackoverflow.com/q/27137189
has text: Unfortunately, that did not work. In case anyone is interested, I am running Apache Tomcat/7.0.52. These settings did not work: sslEnabledProtocols="TLSv1.1+TLSv1.2" OR sslEnabledProtocols="TLSv1.1,TLSv1.2" OR sslProtocol="TLSv1.2" OR sslProtocols="TLSv1.2" These setting do not appear to stay set for the entire execution of the JVM, they are most likely for the server endpoint itself
score: 0
type: Comment

http://stackoverflow.com/q/27034508
has body: Servlet.service() for servlet LoginController threw exception java.lang.ClassNotFoundException: Decoder.BASE64Encoder try{ String pass=request.getParameter("password"); String plainData=pass,cipherText,decryptedText; KeyGenerator keyGen = KeyGenerator.getInstance("AES"); keyGen.init(128); SecretKey secretKey = keyGen.generateKey(); Cipher aesCipher = Cipher.getInstance("AES"); aesCipher.init(Cipher.ENCRYPT_MODE,secretKey); byte[] byteDataToEncrypt = plainData.getBytes(); byte[] byteCipherText = aesCipher.doFinal(byteDataToEncrypt); cipherText=new BASE64Encoder().encode(byteCipherText); System.out.println("cipherText"+cipherText); ld=new LoginDao(); String encryptedpass=ld.validatepass(cipherText); System.out.println(); } catch(Exception ex){ }
has title: Servlet.service() for servlet LoginController threw exception java.lang.ClassNotFoundException: Decoder.BASE64Encoder
has answer: http://stackoverflow.com/a/27034595
accepted answer: http://stackoverflow.com/a/27034595
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
tagged with: servlets
type: Question
answer count: 1
score: 0

http://stackoverflow.com/a/27051646
upvote count: 1
has body: Character 200b is a zero-width space. You might be best just re-typing some or all of your SQL to get rid of it, because it can be difficult to find and delete otherwise.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27051522
type: Answer

http://stackoverflow.com/comment/42707661
comment on: http://stackoverflow.com/a/27100618
type: Comment
has text: I'd like to send you a screenshot, it will be more clear but I can't add a picture because I do not have enough reputation or something. What I am trying to explain is when I finish typing on the first field and want to go on the second field, the cursor is going to the second field, coming back to the first, coming back to the second, etc.. without me taping on anything. so what is wrong in the code i edit?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42674088
type: QuestionComment
comment on: http://stackoverflow.com/q/27082097
has text: Jim - you are right. 30 should stay at 30, no change. Only when between 31-60.
score: 0
type: Comment

http://stackoverflow.com/q/27098155
tagged with: java
tagged with: unused-variables
upvote count: 1
has comment: http://stackoverflow.com/comment/42703472
type: Question
has comment: http://stackoverflow.com/comment/42701315
has answer: http://stackoverflow.com/a/27098206
tagged with: eclipse
answer count: 2
downvote count: 0
has title: Automatically remove unused parameters from constructor (Eclipse, Java)
favorite count: 0
possible better answer: http://stackoverflow.com/a/27098208
has comment: http://stackoverflow.com/comment/42701370
accepted answer: http://stackoverflow.com/a/27098206
has answer: http://stackoverflow.com/a/27098208
has comment: http://stackoverflow.com/comment/42701320
has body: I have a bunch of classes which contain constructors with unused parameters. For example this one: class Book { String author; String title; public Book(String author, String title, int numberOfPages) { this.author = author; this.title = title; } } Does Eclipse offer any way of automatically removing these unused parameters over multiple files? Removing them manually would take hours.
tagged with: parameters
type: AnsweredQuestion
score: 1

arrays
tags question: http://stackoverflow.com/q/27006314
tags question: http://stackoverflow.com/q/27139750
tags question: http://stackoverflow.com/q/27097372
tags question: http://stackoverflow.com/q/27009045
tags question: http://stackoverflow.com/q/27024724
tags question: http://stackoverflow.com/q/27008414
tags question: http://stackoverflow.com/q/27028457
tags question: http://stackoverflow.com/q/27103945
tags question: http://stackoverflow.com/q/27083395
tags question: http://stackoverflow.com/q/27019783
tags question: http://stackoverflow.com/q/27093150
tags question: http://stackoverflow.com/q/27093375
tags question: http://stackoverflow.com/q/27032693
tags question: http://stackoverflow.com/q/27137259
tags question: http://stackoverflow.com/q/27151465
tags question: http://stackoverflow.com/q/27016004
tags question: http://stackoverflow.com/q/27048854
tags question: http://stackoverflow.com/q/27087881
tags question: http://stackoverflow.com/q/27089124
tags question: http://stackoverflow.com/q/27152495
tags question: http://stackoverflow.com/q/27009112
tags question: http://stackoverflow.com/q/27042426
type: Tag
tags question: http://stackoverflow.com/q/27009151
tags question: http://stackoverflow.com/q/27095023
tags question: http://stackoverflow.com/q/27116186
tags question: http://stackoverflow.com/q/27095652
tags question: http://stackoverflow.com/q/27144534
tags question: http://stackoverflow.com/q/27039007
tags question: http://stackoverflow.com/q/27032235
tags question: http://stackoverflow.com/q/27095380
tags question: http://stackoverflow.com/q/27069377
tags question: http://stackoverflow.com/q/27066603
tags question: http://stackoverflow.com/q/27088857
tags question: http://stackoverflow.com/q/27077068
tags question: http://stackoverflow.com/q/27031896
tags question: http://stackoverflow.com/q/27070802
tags question: http://stackoverflow.com/q/27098556
tags question: http://stackoverflow.com/q/27150321
tags question: http://stackoverflow.com/q/27065814
tags question: http://stackoverflow.com/q/27106851
tags question: http://stackoverflow.com/q/27021053
tags question: http://stackoverflow.com/q/27009373
tags question: http://stackoverflow.com/q/27098719
tags question: http://stackoverflow.com/q/26999241
tags question: http://stackoverflow.com/q/27084803
tags question: http://stackoverflow.com/q/27066534
tags question: http://stackoverflow.com/q/27093659
tags question: http://stackoverflow.com/q/27052540
tags question: http://stackoverflow.com/q/27066541
tags question: http://stackoverflow.com/q/27128470
tags question: http://stackoverflow.com/q/27087180
tags question: http://stackoverflow.com/q/27087037
tags question: http://stackoverflow.com/q/27052681
tags question: http://stackoverflow.com/q/27097153
tags question: http://stackoverflow.com/q/27029881
tags question: http://stackoverflow.com/q/27106063
tags question: http://stackoverflow.com/q/27129465
tags question: http://stackoverflow.com/q/27026710
tags question: http://stackoverflow.com/q/27126112
tags question: http://stackoverflow.com/q/27094475
tags question: http://stackoverflow.com/q/26995084
tags question: http://stackoverflow.com/q/27077162
tags question: http://stackoverflow.com/q/27031390
tags question: http://stackoverflow.com/q/27004190
tags question: http://stackoverflow.com/q/27123296
tags question: http://stackoverflow.com/q/27093386
tags question: http://stackoverflow.com/q/27031218
tags question: http://stackoverflow.com/q/27035715
tags question: http://stackoverflow.com/q/27044000
tags question: http://stackoverflow.com/q/27049353
tags question: http://stackoverflow.com/q/27054172
tags question: http://stackoverflow.com/q/27058254
tags question: http://stackoverflow.com/q/27017438
tags question: http://stackoverflow.com/q/27000788
tags question: http://stackoverflow.com/q/27084414
tags question: http://stackoverflow.com/q/27031464
tags question: http://stackoverflow.com/q/27035536
tags question: http://stackoverflow.com/q/27114432
tags question: http://stackoverflow.com/q/27046592

http://stackoverflow.com/a/27092380
score: 0
answers question: http://stackoverflow.com/q/27091996
type: Answer
has body: I think the problem with the dataArray may be its consumed for first adapter try to set separate array in grid and check

http://stackoverflow.com/a/27051041
type: Answer
has body: If you submitting a streaming job to hadoop cluster you have to specify the location of the mapper and reducer on the local filesystem using -file command line parameter so that hadoop will copy the files to all Mappers and Reducers so they have access to python scripts. So, try something like this: hadoop har /path/to/hadoop-streaming.jar \ -Dmapred.reduce.tasks=1 -input /path/to/input -output /path/to/output -mapper /path/to/mapper.py -reducer /path/to/reducer.py -file /path/to/mapper.py -file /path/to/reducer.py Make sure to replace the path's to all the parameters. Parameters -input, -output are paths in HDFS while other paths will be from local filesystem from where you are launching the job.
accepted answer of: http://stackoverflow.com/q/27048981
score: 0
answers question: http://stackoverflow.com/q/27048981
type: AcceptedAnswer

http://stackoverflow.com/q/27081918
has body: I relaunch the child process every time than i need to obtain a random number, but i think that it can be done using outPutStream but i don't know how. I saw the others post but i don't found nothing relevant for my problem. I don't want to use sockets. Main Process. public class ejercicio7 { public static void main(String [] args){ boolean cerrado = false; try { while(!cerrado){ String entrada = JOptionPane.showInputDialog(null, "Introduce una entrada"); Process proceso = Runtime.getRuntime().exec("java -jar C:\\Users\\Cristian\\Desktop\\java\\numeros.jar \"" + entrada+"\""); BufferedReader br = new BufferedReader(new InputStreamReader(proceso.getInputStream())); String texto; while((texto = br.readLine()) !=null){ if(Boolean.parseBoolean(texto)){ cerrado = true; }else{ System.out.println(texto); } } br.close(); proceso.destroy(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Child Process. public static void main(String[] args) { if(args.length &lt;=0 &amp;&amp; args[0].length() == 0){ System.out.println("No se ha introducido una entrada"); }else{ if(!args[0].equalsIgnoreCase("fin")){ System.out.println(Math.round(Math.random() * 10)); }else{ System.out.println("true"); } } } }
answer count: 1
downvote count: 0
tagged with: outputstream
favorite count: 0
accepted answer: http://stackoverflow.com/a/27082158
has title: Java - How to send a value to child process using outputstream?
has comment: http://stackoverflow.com/comment/42673372
has comment: http://stackoverflow.com/comment/42674573
has answer: http://stackoverflow.com/a/27082158
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: process
tagged with: inputstream
type: Question

http://stackoverflow.com/q/27133231
favorite count: 0
linked to: http://stackoverflow.com/q/19960893
has answer: http://stackoverflow.com/a/43560339
possible better answer: http://stackoverflow.com/a/27133557
score: 6
has comment: http://stackoverflow.com/comment/42765134
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42765641
tagged with: java
linked to: http://stackoverflow.com/q/26305295
tagged with: jboss
type: Question
has answer: http://stackoverflow.com/a/27133642
linked to: http://stackoverflow.com/q/7828987
tagged with: dependency-injection
has body: I have the following scenario in my code base: //this bean, which will be injected, //is not annotated public class HelperUtil { //only default constructor with no args public void doThis(String _in) { //... } public void doThat() { //... } } In the below class we do the injection: @Named @Stateless public class BusinessManager { @PersistenceContext(unitName = "default") private EntityManager em; @Inject private HelperUtil helperUtil ; //... } Q1: When is the instance of HelperUtil which will be injected actually initialized by calling the default constructor? Is it done when the first client into which it is injected (like BusinessManager) is instantiated when the app server (in my case JBoss) starts (and that one will be initialized by the container because it is annotated as @Stateless)? Q2: In the above exhibit, will HelperUtil remain a singleton as long as no client other than the container asks for an instance by calling the constructor directly and not obtaining an instance via DI? Q3: What is the advantage of using DI and @Inject in this case vs. simply calling the constructor directly (HelperUtil helper = new HelperUtil();)?
downvote count: 0
tagged with: cdi
answer count: 3
has title: When is injected bean actually initialized?
has answer: http://stackoverflow.com/a/27133557
accepted answer: http://stackoverflow.com/a/27133642
upvote count: 6

http://stackoverflow.com/q/27087693
upvote count: 2
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27087694
accepted answer: http://stackoverflow.com/a/27087694
has body: I'm working on a program in which I will need to frequently truncate the beginning of a list, by just a few indices. (Sometimes, only one.) Then, the new list must be passed on to another method, which will likely end up doing the same thing. Obviously I want this to be done as efficiently as possible. There is an obvious answer in the way of functionality: for(int i = «intended index»; i &lt; list.size(); i++) newList.add(list.get(i)); nextMethod(newList); However, the theta notation is rather horrific. I would prefer something like: List newList = list.subset(«intended index», list.size()); But I can't find anything like that. I have the feeling that maximum and minimum list indexes might be handled by pointers. Is there such a method in, say, Collections, which will allow me to create a list that references a subset of the exact same data? Or should I give up on that and focus on changing some other part of my algorithm? Or is a List the wrong collection to use?
score: 2
has comment: http://stackoverflow.com/comment/42683268
tagged with: collections
has title: Is there a quicker method for returning a sublist after a certain index of a list in Java?
type: Question
type: AnsweredQuestion
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/42683267

http://stackoverflow.com/a/27149795
has body: This statement: ObjectOutputStream objectOS = new ObjectOutputStream(new FileOutputStream("ClassList.data")); ... overwrites the existing file with an empty file. You then try to read an object from that empty file. You should read first, then open the file for output. I'd actually break this code into separate methods: Read assignment (open, read, close) Process assignment (no IO) Write assignment (open, writem, close) Also note that: if (found = true) doesn't do what you want it to. It will assign to found, and then always execute the body of the if block. You want: if (found == true) or better yet if (found)
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27149699
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27149699
type: Answer
score: 1

http://stackoverflow.com/q/26997430
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/42525572
has comment: http://stackoverflow.com/comment/42754900
accepted answer: http://stackoverflow.com/a/26997556
linked to: http://stackoverflow.com/q/15086020
upvote count: 4
has comment: http://stackoverflow.com/comment/42525934
tagged with: jakarta-ee
type: AnsweredQuestion
has body: I have build a jar file of classes and configuration files. The configuration.yml file is located in root of the jar. When I try to run the application using the following command: java -jar target/drop-wizard-0.0.1-SNAPSHOT.jar server configuration.yml I get the exception below. How can I specify file located in jar from command prompt? Exception in thread "main" java.io.FileNotFoundException: File configuration.yml not found &lt;br&gt; at io.dropwizard.configuration.FileConfigurationSourceProvider.open(FileConfigurationSourceProvider.java:14)&lt;br&gt; at io.dropwizard.configuration.ConfigurationFactory.build(ConfigurationFactory.java:75)&lt;br&gt; at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:114)&lt;br&gt; at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:63)&lt;br&gt; at io.dropwizard.cli.Cli.run(Cli.java:70)&lt;br&gt; at io.dropwizard.Application.run(Application.java:72)&lt;br&gt; at com.flightnetwork.dropwizard.example.HelloWorldApplication.main(HelloWorldApplication.java:10)&lt;br&gt;
has title: java.io.FileNotFoundException: File configuration.yml not found
downvote count: 0
has answer: http://stackoverflow.com/a/26997556
tagged with: java
has answer: http://stackoverflow.com/a/27124785
type: Question
has answer: http://stackoverflow.com/a/26997552
possible better answer: http://stackoverflow.com/a/38452615
score: 4
has answer: http://stackoverflow.com/a/38452615
tagged with: dropwizard

xquery
tags question: http://stackoverflow.com/q/27010058
type: Tag
tag name: xquery
tags question: http://stackoverflow.com/q/27099672

http://stackoverflow.com/a/27026558
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42590625
answers question: http://stackoverflow.com/q/27023473
downvote count: 0
has body: I believe this has been answered before in a slightly different form: Tomcat 7 returns "304 Not Modified" on modified/non existent resource However, since you are probably only generating your PNG files once (or maybe not very often), you have IMO a valid use case. Since Tomcat does do caching, I think that you might want to consider using cachingAllowed="false" on your <Context>. Note that you will likely observe a slight performance drop since Tomcat will be going to the disk for every static request instead of consulting its cache. You also have the option of writing your own servlet to serve the auto-generated PNG files directly from the disk. It can be complicated to write your own static-resource servlet with all the bells and whistles that Tomcat's DefaultServlet supports, but you can skip a lot of that and just always serve the whole file regardless of what the clients requests.
score: 1

http://stackoverflow.com/q/27142773
has answer: http://stackoverflow.com/a/27142813
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/42782382
has comment: http://stackoverflow.com/comment/42782353
favorite count: 0
has comment: http://stackoverflow.com/comment/42782350
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27143357
has answer: http://stackoverflow.com/a/27142812
has answer: http://stackoverflow.com/a/27142823
has title: how to get minimum index number in arraylist java?
answer count: 4
upvote count: 0
tagged with: java
has body: i m using this code for getting index number but i can't get minimum index number for(String it : list1){ index = list.indexOf(it); System.out.println("\n index1 : " +it); } for(String it1 : list1){ index1 = list.indexOf(it1); System.out.println("\nindex2 : " +it1); }
type: Question

http://stackoverflow.com/comment/62809852
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27154241
type: Comment
has text: I am hardly able to find much documentation on spring integration kafka, but this answer helped me out immensely! Thank you so much, you rock!

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/27000957
type: Tag

http://stackoverflow.com/q/27043760
type: Question
has body: I have a Jasig CAS 3.5.2.1 version and two separate applications (let's say app-A and app-B) authenticating their users over CAS server (using pac4j-play-cas-client). Assume that a user signs in to app-A and then signs in to app-B using different service tickets. When the user signs out from app-A, I expect CAS server to send logout callback to both app-A and app-B logout callback services. But it seems CAS server only sends logout callback to app-A. Single Singout configuration on my CAS server is as follows: &gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" &gt; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &gt; xmlns:p="http://www.springframework.org/schema/p" &gt; xmlns:util="http://www.springframework.org/schema/util" &gt; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd &gt; http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"&gt; &gt; &lt;description&gt; &gt; Argument Extractors are what are used to translate HTTP requests into requests of the appropriate protocol (i.e. CAS, &gt; SAML, SAML2, &gt; OpenId, etc.). By default CAS and SAML are enabled. &gt; &lt;/description&gt; &gt; &lt;bean &gt; id="casArgumentExtractor" &gt; class="org.jasig.cas.web.support.CasArgumentExtractor" &gt; p:httpClient-ref="noRedirectHttpClient" &gt; p:disableSingleSignOut="${slo.callbacks.disabled:false}" /&gt; &gt; &gt; &lt;bean id="samlArgumentExtractor" class="org.jasig.cas.web.support.SamlArgumentExtractor" &gt; p:httpClient-ref="noRedirectHttpClient" &gt; p:disableSingleSignOut="${slo.callbacks.disabled:false}" /&gt; &gt; &gt; &lt;util:list id="argumentExtractors"&gt; &gt; &lt;ref bean="casArgumentExtractor" /&gt; &gt; &lt;ref bean="samlArgumentExtractor" /&gt; &gt; &lt;/util:list&gt; &lt;/beans&gt; Am I missing a point, why couldn't I get a logout callback for app-B?
has answer: http://stackoverflow.com/a/27055225
has title: CAS Single Logout Issue
answer count: 1
downvote count: 0
tagged with: cas
favorite count: 0
tagged with: jasig
accepted answer: http://stackoverflow.com/a/27055225
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java

matrix
tags question: http://stackoverflow.com/q/26995166
tags question: http://stackoverflow.com/q/27012927
tag name: matrix
tags question: http://stackoverflow.com/q/27063294
tags question: http://stackoverflow.com/q/27089073
tags question: http://stackoverflow.com/q/27028889
tags question: http://stackoverflow.com/q/27094614
tags question: http://stackoverflow.com/q/27131673
tags question: http://stackoverflow.com/q/27056799
tags question: http://stackoverflow.com/q/27114636
tags question: http://stackoverflow.com/q/26996818
tags question: http://stackoverflow.com/q/27152369
tags question: http://stackoverflow.com/q/27003743
tags question: http://stackoverflow.com/q/27093546
type: Tag

http://stackoverflow.com/q/27136531
has answer: http://stackoverflow.com/a/27136572
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/42771316
has comment: http://stackoverflow.com/comment/42771803
has comment: http://stackoverflow.com/comment/42771548
has title: Block functions from library from being used?
has comment: http://stackoverflow.com/comment/42771296
possible better answer: http://stackoverflow.com/a/27136572
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42771322
accepted answer: http://stackoverflow.com/a/27136893
tagged with: java
type: Question
has body: I'm working on a project with others and they keep calling ArrayList.add() without doing checks that are critical to the program, so I'm wondering is there a way to block use of the .add() method without removing it from the library.
answer count: 2
has answer: http://stackoverflow.com/a/27136893
has comment: http://stackoverflow.com/comment/42771694

http://stackoverflow.com/q/27115364
downvote count: 0
has answer: http://stackoverflow.com/a/27128122
has comment: http://stackoverflow.com/comment/42743596
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 3
has title: Casting null java.lang.Integer from JAXB produces 0, not null
upvote count: 3
tagged with: java
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/27128122
has body: I have the following XML: <Identifier/> TEST TEST <Title>MR M Produced by serialising the following class: package anonymised.packagename; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "Id", "Identifier", "Surname", "Forename1", "Forename2", "Title", "Sex" }) @XmlRootElement(name = "person") public class person{ @XmlElement(name = "id", nillable=true) protected Integer Id; public Integer getId(){ return Id; } public void setId(Integer value){ this.Id = value; } @XmlElement(name = "Identifier", nillable=true) protected String Identifier; public String getIdentifier(){ return Identifier; } public void setIdentifier(String value){ this.Identifier = value; } @XmlElement(name = "Surname", nillable=true) protected String Surname; public String getSurname(){ return Surname; } public void setSurname(String value){ this.Surname = value; } @XmlElement(name = "Forename1", nillable=true) protected String Forename1; public String getForename1(){ return Forename1; } public void setForename1(String value){ this.Forename1 = value; } @XmlElement(name = "Forename2", nillable=true) protected String Forename2; public String getForename2(){ return Forename2; } public void setForename2(String value){ this.Forename2 = value; } @XmlElement(name = "Title", nillable=true) protected String Title; public String getTitle(){ return Title; } public void setTitle(String value){ this.Title = value; } @XmlElement(name = "Gender", nillable=true) protected String Gender; public String getGender(){ return Gender; } public void setGender(String value){ this.Gender = value; } } I used the "set" methods on the object and JAXB serialisation to produce the XML above, choosing java.lang.Integer objects pre…
type: Question
tagged with: casting

http://stackoverflow.com/comment/42605349
type: QuestionComment
comment on: http://stackoverflow.com/q/27043132
has text: You will want to learn Swing Threading rules: [Lesson: Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/) and make sure that your network connections work in a background thread. You also do not want empty catch blocks as that is a recipe for disaster. At the very least print your stack traces, i.e., `e.printStackTrace()` inside of `catch(..... e)`.
score: 1
type: Comment

http://stackoverflow.com/comment/42525154
has text: You can use Jackson to map object. Possible Answer here http://stackoverflow.com/questions/6019562/parsing-json-in-spring-mvc-using-jackson-json
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26997252
score: 0

http://stackoverflow.com/comment/42666363
type: Comment
comment on: http://stackoverflow.com/a/27043738
has text: Package of MyClass is "com.foo.controller". Although, all the Spring generated logs with "INFO" level are also getting appended in the file.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42545639
has text: FYI: Code snippets only really apply to questions that are HTML/Javascript based.
type: AnswerComment
comment on: http://stackoverflow.com/a/27008793
score: 0
type: Comment

http://stackoverflow.com/a/27047891
has body: the way to find the length of an array is fields.length
type: Answer
upvote count: 2
downvote count: 2
answers question: http://stackoverflow.com/q/27047843
has comment: http://stackoverflow.com/comment/42613987
has comment: http://stackoverflow.com/comment/42613801
score: 0
has comment: http://stackoverflow.com/comment/42613889

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/27056603
tags question: http://stackoverflow.com/q/27112808
type: Tag

http://stackoverflow.com/a/27067155
has body: Struts2 implicitly performs a basic type conversion to a known types, double and long are these types. So, you don't need a convertor to convert these types. But if you need a custom implementation of the type converter you may try The action: private Double doubleValue; public Double getDoubleValue() { return doubleValue; } @TypeConversion(converter = "com.struts.conversion.DoubleConverter") public void setDoubleValue(Double doubleValue) { this.doubleValue = doubleValue; } DoubleConverter.java: public class DoubleConverter extends StrutsTypeConverter { @Override public Object convertFromString(Map context, String[] values, Class toClass) { Object o = null; try { o = Double.valueOf(values[0]); } catch (NumberFormatException e){} return o; } @Override public String convertToString(Map context, Object o) { return o==null?"":o.toString(); } } The @TypeConversion annotation is to a property which type is converted. I have applied it on property of type Double, but you may try to apply your converter on property of type XYZ like @TypeConversion(converter = "com.struts.conversion.YourNumberConverter") public void setValue(XYZ value) { this.value = value; } When converter is invoked you should get all values as String[] including isNumber and value.
answers question: http://stackoverflow.com/q/27059938
type: Answer
score: 0

http://stackoverflow.com/comment/42582696
comment on: http://stackoverflow.com/q/27030021
has text: What's the actual content of the file `KenKen.dat` ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27138899
has title: getting started with jensembl
tagged with: field
type: UnansweredQuestion
tagged with: bioinformatics
has answer: http://stackoverflow.com/a/27138947
tagged with: java
type: Question
has body: I'm starting a very small project with JEnsembl and I'm not used to trying out new API's. I was wondering why this was running into problems: DBRegistry reg = DBRegistry.createUninitializedRegistryForDataSource(DataSource.ENSEMBLDB); In Eclipse, ENSEMBLDB cannot be resolved to a field. I was wondering how to fix this, since it seems like ENSEMBLDB is the default for the datasource. What should I be writing that is different? Thanks so much!
score: 0
answer count: 1

http://stackoverflow.com/a/27084811
has body: You might take a look at http://www.openstack.org/ wich can give you this infrastructure. If you're looking for a professional solution you can search for google cloud or amazonws.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27084314

http://stackoverflow.com/a/27104776
score: 0
type: Answer
has body: This two row aren't correct clstmt.setString(2, "fixedDate"); clstmt.setString(3, "timestr"); if in sql they are Date type try this: clstmt.setDate(2, java.sql.Date(fixedDate.getTime())); clstmt.setDate(3, java.sql.Date.valueOf(timestr));
has comment: http://stackoverflow.com/comment/42713273
answers question: http://stackoverflow.com/q/27104098
has comment: http://stackoverflow.com/comment/42713668
has comment: http://stackoverflow.com/comment/42713425
has comment: http://stackoverflow.com/comment/42713041

http://stackoverflow.com/q/27134676
tagged with: accelerometer
has title: Accelerometer data, Z-axis gives wrong data?
answer count: 1
accepted answer: http://stackoverflow.com/a/27134837
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27134837
has body: I have an app for saving accelerometer and gyroscope and some other sensors data. But accelerometer data from Z axis is wrong, so big... sometimes even X and Y data are not near 0 as they should be but near 2-3... Z axis gives me data near 10 ... Is there any error in code or ? Any idea ? data sample: 0|19:57:55:584|-0.08912659|-0.015655518|9.652756 1|19:57:55:653|-0.021209717|0.008834839|9.677216 2|19:57:55:704|-0.035308838|0.032958984|9.677216 3|19:57:55:753|-0.035308838|0.048065186|9.658646 4|19:57:55:855|-0.015686035|0.012008667|9.666275 5|19:57:55:906|-0.027709961|-0.006378174|9.6380005 6|19:57:55:955|-0.0539093|-0.04698181|9.582184 7|19:57:56:057|-0.05491638|-0.0053100586|9.64032 8|19:57:56:109|-0.0789032|0.020812988|9.684845 9|19:57:56:164|-0.16851807|-0.02734375|9.640045 10|19:57:56:258|-0.10827637|-0.035888672|9.696838 11|19:57:56:308|-0.09414673|-0.038009644|9.72084 12|19:57:56:358|-0.0569458|-0.030395508|9.680252 13|19:57:56:459|-0.06288147|-0.0049591064|9.663452 14|19:57:56:509|-0.047302246|-0.015167236|9.665237 15|19:57:56:563|-0.11026001|0.006500244|9.676056 Code: @Override public void onSensorChanged(SensorEvent event) { float x = event.values[0]; float y = event.values[1]; float z = event.values[2]; SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss:SSS"); String s = time.format(new java.util.Date()); try { writer.write(i+"|"+s+"|"+x+"|"+y+"|"+z+"\n"); } catch (IOException e) { e.printStackTrace(); } i++; }
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/27152033
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27150656
has body: the fields are not responding as fields.... with hit.getSource() i got my information
score: 1
answers question: http://stackoverflow.com/q/27150656
type: AcceptedAnswer

http://stackoverflow.com/q/27055361
type: Question
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/27055453
tagged with: arraylist
has answer: http://stackoverflow.com/a/27057050
answer count: 3
tagged with: oracle-database
tagged with: sql
has title: java.sql.SQLException: Fail to convert to internal representation: while passing ArrayList to Oracle.sql.ARRAY
favorite count: 0
possible better answer: http://stackoverflow.com/a/27055872
has answer: http://stackoverflow.com/a/27055872
accepted answer: http://stackoverflow.com/a/27055453
type: AnsweredQuestion
score: 3
has body: Hi this is my code List&lt;String&gt; listA = new ArrayList&lt;String&gt;(0); String[] arrA = new String[100]; listA.add("aaa"); listA.add("bbb"); arrA[0]="aaa"; arrA[1]="bbb"; conn = DriverManager.getConnection(URL, USER, PASS); oracle.jdbc.OracleConnection oraConn = (oracle.jdbc.OracleConnection) conn; ArrayDescriptor des = ArrayDescriptor.createDescriptor("ARRAY_TABLE", oraConn); //***************** ARRAY array_to_pass1 = new ARRAY(des, conn, arrA );//* exception CallableStatement cstm = (OracleCallableStatement) conn.prepareCall("{call xyz.procedure1(?,?)}"); cstm.setArray(1, array_to_pass1); cstm.setInt(2, 1); this is working fine but when I pass listA instead of arrA to ARRAY constructor..it is throwing above sql exception.. I want to pass Arraylist instead of string[] array
upvote count: 3
tagged with: java

http://stackoverflow.com/q/27113389
has comment: http://stackoverflow.com/comment/42729535
has answer: http://stackoverflow.com/a/27113822
has answer: http://stackoverflow.com/a/27113644
has comment: http://stackoverflow.com/comment/42729596
tagged with: java
has body: Good day, I have a .csv file with data as shown below, I want to be able to search the file. The file is divided into Regno,ModuleCode and exam Mark. how can I search the file when supplied with a Regno and ModuleCode. This file is Unique in the sense that there is no unique column. Please help. Regno,ModuleCode,ExamMark 1334599, CE152-4-SP, 54.5 1332141, CE153-4-AU, 43.8 1398559, CE162-4-SP, 55.3 1334667, CE141-4-AU, 51.3 1335181, CE162-4-SP, 62.5 1332141, CE154-4-SP, 63.1 1335167, CE154-4-SP, 43.0 1365678, CE155-4-SP, 28.9 1334863, CE155-4-SP, 39.7 1334703, CE101-4-SP, 56.8 1335167, CE161-4-AU, 46.9 1365678, CE153-4-AU, 15.6 1334718, CE141-4-AU, 61.7 1394001, CE151-4-AU, 41.4 1334768, CE163-4-AU, 42.7 1334863, CE152-4-SP, 46.3 1334592, CE155-4-SP, 52.7 1383431, CE161-4-AU, 49.8 1398559, CE151-4-AU, 54.7 1334599, CE155-4-SP, 77.6 1334768, CE101-4-SP, 60.4 1334599, CE153-4-AU, 71.7 1383260, CE153-4-AU, 70.3 1334718, CE153-4-AU, 58.6 1334863, CE153-4-AU, 29.5 1334718, CE152-4-SP, 73.7 1394001, CE101-4-SP, 24.0 1383260, CE152-4-SP, 55.3 1374567, CE142-4-AU, 72.1 1383260, CE151-4-AU, 67.2 1394001, CE161-4-AU, 72.7 1398559, CE161-4-AU, 68.6 1332141, CE151-4-AU, 65.5 1383260, CE101-4-SP, 64.4 1334703, CE162-4-SP, 96.4 1398559, CE142-4-AU, 48.5 1334768, CE155-4-SP, 37.3 1332568, CE155-4-SP, 66.9 1334718, CE154-4-SP, 56.8 1364569, CE141-4-AU, 62.4 1334568, CE162-4-SP, 38.3 1334599, CE161-4-AU, 86.5 1334667, CE155-4-SP, 31.7 1334592, CE141-4-AU, 56.2 1334592, CE152-4-SP, 95.8 1334568, CE161-4-AU, 25.7 1383431, CE151-4-AU, 66.2 1394001, CE155-4-SP, 44.7 1332141, CE161-4-AU, 57.8 1332568, CE153-4-AU, 62.0 1334568, CE164-4-SP, 37.1 1334718, CE161-4-AU, 86.0 1354564, CE155-4-SP, 51.3 1364569, CE154-4-SP, 29.8 1334768, CE151-4-AU, 22.3 1383431, CE141-4-AU, 59.0 1398559, CE163-4-AU, 56.5 1365678, CE142-4-AU, 43.2 1374567, CE155-4-SP, 48.5 1394001, CE153-4-AU, 58.2 1374567, CE162-4-SP, 47.2 1354564, CE162-4-SP, 45.6 1334863, CE141-4-AU, 43.5 1334667, CE151-4-AU, 44.3 1394001, CE15…
has comment: http://stackoverflow.com/comment/42729647
has title: Reading from a .csv file with java
linked to: http://stackoverflow.com/q/3908012
has comment: http://stackoverflow.com/comment/42729696
upvote count: 0
has comment: http://stackoverflow.com/comment/42729650
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42729623
type: Question
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/42729534
has comment: http://stackoverflow.com/comment/42729695
answer count: 2
downvote count: 2

http://stackoverflow.com/a/27009834
type: Answer
score: 3
answers question: http://stackoverflow.com/q/27008553
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27008553
has body: Unless the variable is volatile, the JITC is free to do whatever it wants as long as it can prove that you're not overwriting the field in the meantime (without volatile, it doesn't care about what other threads do). If you use no local variable, it will do it for you. It could also do it the other way, but I can hardly imagine any case when it makes sense (it could, when you run out of registers). So it doesn't matter for performance(*), but for readability, the local is nearly always better, so go for it. (*) On Android, the situation may differ as it's not as smart as server class JVM.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42738953
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27118556
score: 0
has text: now it is unclear what you are asking

http://stackoverflow.com/comment/42742602
comment on: http://stackoverflow.com/a/27120350
score: 0
type: AnswerComment
has text: in the interval of 5 sec it crashes continuously and opens itself and again crashes as in a loop
type: Comment

http://stackoverflow.com/q/27008471
upvote count: 1
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/27008992
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42545697
answer count: 1
has body: So I have an app that uses a surface view that runs a separate thread for the UI. It was taken almost directly from the Lunar Landing sample app. The app also uses Bluetooth service on another thread but I am sure that this is not related to the problem because I can disable bluetooth all together and it still happens. The problem in my app is that the app when closed and then reopened does not start running the UI thread afterthread.start() except it throws an error. In the Lunar example they have thread.start() in the onSurfaceCreated method. The problem is when I restart my app (it calls onPause then onSurfaceDestroy) the thread is already running and I get an error when I try to start it. My code for onSurfaceCreated, onPause, onResume and onSurfaceDestroyed is all the same as the example. I know I can use if (this.getState() == Thread.State.NEW) { but that seems like it will mask some of my other issues. I want to master the activity life cycle. My question is how does the Lunar Lander stop the thread? And why is mine not stopping with the same code and running at the onSurfaceCreated method. Obviously I am missing something. As far as I know in the Lunar example the only thing that is called on the thread on a destroy is thread.join(). Edit 3: Here is the Lunar Lander Example Code if needed. So these are the three override methods in my surfaceview... @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { Log.d(TAG, "surfaceCreated"); // start the bluetooth service thread.startBluetoothService(); // start the game //if (this.getState() == Thread.State.NEW) { Log.d(TAG, "thread start"); // start running the thread this.start(); //} Log.d(TAG, "running to true"); // release the thread lock setRunning(true); } // surfaceChanged is called at least once after surfaceCreated @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Log.d(TAG, "surfaceChanged"); // reset the surface size thread.setSurfaceSize(width, …
has title: IllegalThreadExeption for running thread in surfaceView, specific to Lunar Lander example
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42545418
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/q/27100634
type: Question
has comment: http://stackoverflow.com/comment/42706388
tagged with: rounding
tagged with: java
has comment: http://stackoverflow.com/comment/42706062
has body: public View getView(int position, View convertView, ViewGroup parent) { View row; row = inflater.inflate(R.layout.item_view, parent, false); round = row.getResources().getDrawable(R.drawable.round); Random rnd = new Random(); int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)); LayerDrawable bgDrawable = (LayerDrawable)row.findViewById(R.id.imgColor).getBackground(); final GradientDrawable shape = (GradientDrawable) bgDrawable.findDrawableByLayerId(R.id.round_id); shape.setColor(color); return row; } This is part of a class that extends BaseAdapter, I am trying to generate random colors and have it placed inside a circle, this is placed in a listView that's why I'm creating an adapter. The error is found in this line of code: final GradientDrawable shape = (GradientDrawable) bgDrawable.findDrawableByLayerId(R.id.round_id); LogCat: 11-24 08:09:51.997 2438-2438/com.example.den.assignment02 E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.den.assignment02, PID: 2438 java.lang.NullPointerException at com.example.den.assignment02.CustomAdapter.getView(CustomAdapter.java:62) at android.widget.AbsListView.obtainView(AbsListView.java:2263) at android.widget.ListView.measureHeightOfChildren(ListView.java:1263) at android.widget.ListView.onMeasure(ListView.java:1175) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16497) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125) at com.android.internal.widget.ActionBarOverlayLayout…
score: 0
has comment: http://stackoverflow.com/comment/42705802
has comment: http://stackoverflow.com/comment/42706235
has title: Randomize Shape Color using BaseAdapter
tagged with: android
tagged with: drawable
tagged with: view
linked to: http://stackoverflow.com/q/8018435
answer count: 0
has comment: http://stackoverflow.com/comment/42705481
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42705954
linked to: http://stackoverflow.com/q/8976836

http://stackoverflow.com/comment/42688172
comment on: http://stackoverflow.com/q/27081454
score: 0
type: Comment
type: QuestionComment
has text: already put the full coding here

http://stackoverflow.com/q/27115102
upvote count: 1
tagged with: bufferedimage
type: Question
accepted answer: http://stackoverflow.com/a/27116557
tagged with: java
has comment: http://stackoverflow.com/comment/42733280
has answer: http://stackoverflow.com/a/27116557
answer count: 1
downvote count: 0
has title: Serializing an ArrayList of Objects with BufferedImages
favorite count: 0
has comment: http://stackoverflow.com/comment/42733081
tagged with: serialization
type: AnsweredQuestion
has body: I'm trying to save a game state by serializing a game object that contains an ArrayList of enemies. Each of the items on the ArrayList is an object, and each of those objects contains a BufferedImage to represent the enemy. Java throws an error that the BufferedImages aren't serializable. All the solutions I've found say to just create a new object and fill it with all the data except the images, but I'm not sure how possible that is with the List set up. public void saveGame(){ GamePanel game = new GamePanel(); game.enemyList = enemyList; game.player = new Player(this.getWidth(), this.getHeight()); game.player.setScore(player.getScore()); game.player.setPos(player.getX(), player.getY()); try{ FileOutputStream fileOut = new FileOutputStream("savegame.txt"); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(game); out.close(); fileOut.close(); }catch(IOException ex){ ex.printStackTrace(); } } Thanks!
score: 1

http://stackoverflow.com/comment/42619081
score: 0
type: QuestionComment
has text: You can call `printmessage(ans1[rand], input);` in every case ...
type: Comment
comment on: http://stackoverflow.com/q/27050652

http://stackoverflow.com/q/27132065
possible better answer: http://stackoverflow.com/a/52430799
has body: I'm trying to create a checkbutton in SWT but the SWT.CHECK only has two values: marked or unmarked. I'd like my checkbox to have three values: unspecified, yes and no. yes would be a V mark and no would be a X mark. How should I go about doing that? Should I create a regular button that (when clicked) changes the text inside and create a circular beaviour to change from nil->v->x->nil->... ? thank you
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/27133470
has comment: http://stackoverflow.com/comment/42767198
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/52430799
tagged with: java
has title: Create a 3 value checkbutton on SWT (unspecified, yes, no)
tagged with: swt
has answer: http://stackoverflow.com/a/27133470
upvote count: 1
type: Question

http://stackoverflow.com/comment/42579945
has text: You set it as a property of the bean: <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
comment on: http://stackoverflow.com/a/27027743
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27102967
tagged with: java
type: Question
has title: No component found with scheme: smtp
tagged with: apache-camel
upvote count: 2
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/27117635
has body: I've added camel-mail maven dependency (as proposed), still getting No component found with scheme: smtp It is working in test but not at runtime. What I'm missing?
tagged with: osgi
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/27105219
downvote count: 0

http://stackoverflow.com/q/27035700
downvote count: 0
has answer: http://stackoverflow.com/a/27126640
accepted answer: http://stackoverflow.com/a/27126640
has title: WS-Security with Apache Camel and Spring-WS
favorite count: 0
has body: I'm currently writing a webservice server in Camel, and need to implement WS-Security (encrypt/sign). In other projects i've used Spring-WS, so i figured i'd use Camel's implementation as well. I figured i'd just configure a Wss4jSecurityInterceptor, but when i try implement it, i find that the entire org.springframework.ws.soap.security.* namespace is missing from the spring-ws package. Is WS-Security only supported with Apache CXF ? Edit: Here's how i've setup the route: from("spring-ws:rootqname:{http://schemas.somewhere.dk/}operation?endpointMapping=#endpointMapping") .setExchangePattern(ExchangePattern.InOut) .process(MyProcessor) .to("jms:queue:test.out");
has comment: http://stackoverflow.com/comment/42598150
tagged with: spring
type: AnsweredQuestion
tagged with: spring-ws
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: apache-camel
answer count: 1

http://stackoverflow.com/q/27128667
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/28428556
has title: AJAX JSON data retrieve (Portlet+Liferay+JSON+Spring)
has body: What I want to do is, just post data to server and get data from server by using JSON &amp; AJAX. I am converting legacy non AJAX project to AJAX. It is a liferay portlet spring ibatis jquery project. Form submission was success and I could not be able to retrieve data from server as JSON. I used spring-mvc-jquery-autocomplete-example sample to learn jackson for JSON. It was very easy no need me to even think about JSON. I just copy-paste two jar files in my build path and annotate @ResponseBody to my method. But still response is full html page. Why? JSP code here &lt;portlet:actionURL var="formAction"&gt; &lt;portlet:param name="action" value="submit"/&gt; &lt;/portlet:actionURL&gt; &lt;c:set var="formPortletNamespace"&gt;form&lt;portlet:namespace/&gt;&lt;/c:set&gt; &lt;form:form method="post" action="${formAction}" commandName="uiState" id="${formPortletNamespace}" cssClass="travelInsurancePortletForm jqCustomStyle" autocomplete="off"&gt; &lt;% /* Selected action as a parameter */ %&gt; &lt;input type="hidden" name="portletAction" id="portletAction"/&gt; &lt;form:hidden path="quote.quotingWebApp" /&gt; JS code here.This code submit the form to server function doPortletAction(actionName) { jQuery('form#form&lt;portlet:namespace/&gt; input#portletAction').val(actionName); jQuery('form#form&lt;portlet:namespace/&gt; input#&lt;portlet:namespace/&gt;-posted').val('true'); //jQuery('form#form&lt;portlet:namespace/&gt;').submit(); jQuery.ajax({ url: jQuery('#form&lt;portlet:namespace/&gt;').attr("action"), type: 'POST', datatype:'json', data: jQuery('#form&lt;portlet:namespace/&gt;').serialize(), success: onAjaxSubmitReturn }); } Controller coding @Controller @RequestMapping("VIEW") public class MyController{ @ActionMapping(params="portletAction=myAction") public @ResponseBody UiState myAction( PortletSession session, ActionResponse response, @RequestParam(value="endDate", required=false) Date endDate, @ModelAttribute("uiState") UiState requestUiState, BindingResult err…
tagged with: java
type: Question
upvote count: 4
tagged with: liferay
downvote count: 0
score: 4
favorite count: 0
tagged with: ajax
tagged with: portlet
answer count: 1
has comment: http://stackoverflow.com/comment/42924238
has comment: http://stackoverflow.com/comment/42763996

http://stackoverflow.com/q/27040554
has body: I'm trying to half the input if it % 12 == 0, but if it isn't then you multiply it by 3 and add 1 onto the sum. The question that I'm working off is: https://i.sstatic.net/lOxQs.png With the code I have currently(which is below), if I enter 12, like in the question I start off with 6, but then the results begin to go wrong and then they go insanely wrong with values in the millions and negative millions etc. import java.util.*; public class sheet12t3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter a number: "); int aNumber = Integer.parseInt(in.nextLine()); hailstone(aNumber); } public static void hailstone(int x) { int count = 1; int max = 0; String results = "Hailstone series for the number " + x + " is "; while (x &gt;= 1) { if (x % 12 == 0) x = x / 2; else x = 3 * x + 1; count++; results += + x + ", "; if (x &gt; max) max = x; } results += "a total of " + count + " numbers in this sequence with a maximum value of " + max; System.out.print(results); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27040906
score: 1
tagged with: java
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/27040906
tagged with: if-statement
has answer: http://stackoverflow.com/a/27040644
accepted answer: http://stackoverflow.com/a/27040644
answer count: 2
tagged with: random
tagged with: while-loop
downvote count: 1
favorite count: 0
tagged with: input
has title: Having trouble with a while loop that gets a certain series of numbers from an input

http://stackoverflow.com/comment/42786106
comment on: http://stackoverflow.com/q/27143699
type: Comment
has text: Or maybe I' m wrong. Is "Javascript" always provided as a ScriptEngine by default whatever the OS and the Java version (1.6+) ?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42749487
comment on: http://stackoverflow.com/a/27115555
score: 0
has text: can some one help me with this ?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42613130
type: Comment
has text: Since you are using `final`, does that mean you are loading them in the declaration, like this: `public static Texture BOX = new Texture("texturefile.png");`? That would explain your problem. All the static final members of your Gui class will get loaded only the first time any one of the members is accessed (which triggers loading of the Gui class). So the first time you access anything in Gui, it will suddenly have to initialize all the static members, so if you are one-lining them like this, the app will pause to load all those textures declared in Gui.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27046410

http://stackoverflow.com/q/27136390
tagged with: gps
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42795322
has comment: http://stackoverflow.com/comment/42771970
accepted answer: http://stackoverflow.com/a/27241861
has comment: http://stackoverflow.com/comment/42771496
has answer: http://stackoverflow.com/a/27241861
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42772336
has body: I have an application that uses both GPS and Network location providers. When I turn on the GPS , I'm recording the locatin data to an arraylist. Then I'm drawing my GPS track with a button. But the problem is when program goes background I can't get any location data. So the lines being drawed dashed. I'm removing both of the providers under onStop() function. But when I removed that order its just stopping again. How can I get data even on background ?
type: Question
has title: How can I get GPS data even on background on Android?
tagged with: android
has comment: http://stackoverflow.com/comment/42771232

http://stackoverflow.com/q/27040148
possible better answer: http://stackoverflow.com/a/27040280
has answer: http://stackoverflow.com/a/27040337
has body: ImgSet[0] = new ImageIcon("bandeira-portugal.png", "Portugal"); ImgSet[1] = new ImageIcon("south_korea-32.png", "South_Korea"); ImgSet[2] = new ImageIcon("China-icon.png", "China"); ImgSet[3] = new ImageIcon("Japan.png", "Japan"); This is my code for the image icons. I am getting the error message "java.lang.NullPointerException"! Can you please tell me how to fix it? My picture files are in the program folder! Yes I did set the variable ImgSet if that's got anything to do with it. private Icon[] ImgSet;
tagged with: imageicon
answer count: 3
has answer: http://stackoverflow.com/a/27040280
has title: java.lang.NullPointerException error message
has comment: http://stackoverflow.com/comment/42599665
favorite count: 0
has comment: http://stackoverflow.com/comment/42599588
downvote count: 5
score: -4
duplicate of: http://stackoverflow.com/q/218384
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/27040203
accepted answer: http://stackoverflow.com/a/27040203
tagged with: java
has comment: http://stackoverflow.com/comment/42599594
type: Question
upvote count: 1

http://stackoverflow.com/a/27013884
type: Answer
downvote count: 0
score: 5
type: AcceptedAnswer
has body: I figured it out. It has to be like this: Mockito.verify(instance).myMethod(Mockito.anySet()); The parentheses were wrongly placed.
accepted answer of: http://stackoverflow.com/q/27013660
upvote count: 5
answers question: http://stackoverflow.com/q/27013660

http://stackoverflow.com/q/27149476
type: UnansweredQuestion
tagged with: maven
tagged with: java-8
downvote count: 0
has answer: http://stackoverflow.com/a/27149517
score: 1
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has body: I am aware that similar questions has been asked in the past, but I couldn't found my answer in it. I am using Eclipse Luna and upgraded to java 8 (build 0.25). The JAVA_HOME points to java 8 and also it's part of the Windows Classpath. After the upgrade, maven compile shows some Ambiguous method calls that didn't show up in java 7. The problem is that these errors aren't shown in Eclipse and I can't find why. I removed all jre's in eclipse and removed/added the java 8 jdk, but still no luck. Also Eclipse is using the java 8 environment for compiler errors/warnings. With maven I use the "plexus-compiler-javac" compiler, snapshot 2-4. I also tried without the plexus compiler and with version 2.0, but no luck. Any idea what this could be? My Pom snippet: org.apache.maven.plugins maven-compiler-plugin 3.2 org.codehaus.plexus plexus-compiler-javac <!--version>2.0</version--> 2.4-SNAPSHOT true 1.8 1.8 false utf-8 256m 1024m
upvote count: 1
has answer: http://stackoverflow.com/a/27393071
has title: Compile errors with Maven but not in Eclipse after upgrade from java 1.7 to 1.8
has comment: http://stackoverflow.com/comment/42797347
favorite count: 0
has comment: http://stackoverflow.com/comment/42795854
has comment: http://stackoverflow.com/comment/42795533
has comment: http://stackoverflow.com/comment/42793695
tagged with: eclipse-luna

http://stackoverflow.com/a/26994965
upvote count: 3
score: 3
has body: Here the sample code for web application activity_layout.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;WebView android:id="@+id/google" android:layout_width="fill_parent" android:layout_height="fill_parent"/&gt; &lt;/RelativeLayout&gt; Main class public class MainActivity extends Activity { private WebView webView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_layout); webView = (WebView) findViewById(R.id.google); startWebView("https://www.google.com/"); } @SuppressLint("SetJavaScriptEnabled") private void startWebView(String url) { webView.setWebViewClient(new WebViewClient() { ProgressDialog progressDialog; public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } public void onLoadResource (WebView view, String url) { if (progressDialog == null) { progressDialog = new ProgressDialog(MainActivity.this); progressDialog.setMessage("Loading..."); progressDialog.show(); } } public void onPageFinished(WebView view, String url) { try { if (progressDialog.isShowing()) { progressDialog.dismiss(); progressDialog = null; } } catch(Exception exception) { exception.printStackTrace(); } } }); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.setScrollbarFadingEnabled(false); webView.getSettings().setBuiltInZoomControls(true); webView.loadUrl(url); } @Override public void onBackPressed() { if(webView.canGoBack()) { webView.goBack(); } else { super.onBackPressed(); } } } use this permission in your AndroidManifest.xml &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
downvote count: 0
has comment: http://stackoverflow.com/comment/42556721
answers question: http://stackoverflow.com/q/26993826
has comment: http://stackoverflow.com/comment/42560390
type: Answer

http://stackoverflow.com/comment/42612638
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27032402
has text: Thanks. I am sorry I should have been more clear while posting the question. I already fixed the out of memory issue by adding a argLine param for maven surefire plugin in my pom.xml. Now out of memory doesn't happen. I was trying to ask how to address a problem when someone else runs the tests and end up with out of memory errors on their machine and cause the tests not to rollback. Any suggestions? I am editing my original question now. Please check.
type: Comment

javafx
tags question: http://stackoverflow.com/q/27140962
tags question: http://stackoverflow.com/q/27083027
type: Tag
tags question: http://stackoverflow.com/q/27038443
tags question: http://stackoverflow.com/q/27095429
tags question: http://stackoverflow.com/q/27047651
tags question: http://stackoverflow.com/q/27039349
tags question: http://stackoverflow.com/q/26999322
tags question: http://stackoverflow.com/q/27020877
tags question: http://stackoverflow.com/q/27070937
tags question: http://stackoverflow.com/q/27145847
tags question: http://stackoverflow.com/q/27089627
tags question: http://stackoverflow.com/q/27079062
tags question: http://stackoverflow.com/q/27095481
tags question: http://stackoverflow.com/q/27132257
tags question: http://stackoverflow.com/q/27086284
tags question: http://stackoverflow.com/q/27031365
tags question: http://stackoverflow.com/q/27128031
tags question: http://stackoverflow.com/q/27059701
tags question: http://stackoverflow.com/q/27064911
tags question: http://stackoverflow.com/q/27006707
tags question: http://stackoverflow.com/q/27052927
tags question: http://stackoverflow.com/q/27114336
tags question: http://stackoverflow.com/q/27053689
tags question: http://stackoverflow.com/q/27145140
tag name: javafx
tags question: http://stackoverflow.com/q/27150414
tags question: http://stackoverflow.com/q/27135568
tags question: http://stackoverflow.com/q/27077749
tags question: http://stackoverflow.com/q/26997008
tags question: http://stackoverflow.com/q/27031344
tags question: http://stackoverflow.com/q/27047447
tags question: http://stackoverflow.com/q/27054672
tags question: http://stackoverflow.com/q/27134163
tags question: http://stackoverflow.com/q/27135749
tags question: http://stackoverflow.com/q/27100337
tags question: http://stackoverflow.com/q/27125117
tags question: http://stackoverflow.com/q/27015463
tags question: http://stackoverflow.com/q/26999305
tags question: http://stackoverflow.com/q/27113417
tags question: http://stackoverflow.com/q/27150608
tags question: http://stackoverflow.com/q/27118872
tags question: http://stackoverflow.com/q/27064975
tags question: http://stackoverflow.com/q/27071068
tags question: http://stackoverflow.com/q/27080442
tags question: http://stackoverflow.com/q/27014609
tags question: http://stackoverflow.com/q/26994886
tags question: http://stackoverflow.com/q/27130679
tags question: http://stackoverflow.com/q/27149828
tags question: http://stackoverflow.com/q/27093201
tags question: http://stackoverflow.com/q/27114528
tags question: http://stackoverflow.com/q/27034189
tags question: http://stackoverflow.com/q/27130987
tags question: http://stackoverflow.com/q/27121384
tags question: http://stackoverflow.com/q/27009389
tags question: http://stackoverflow.com/q/27085431
tags question: http://stackoverflow.com/q/27128301
tags question: http://stackoverflow.com/q/27110468
tags question: http://stackoverflow.com/q/27117949
tags question: http://stackoverflow.com/q/27011760
tags question: http://stackoverflow.com/q/27130489

http://stackoverflow.com/a/27053567
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27032214
type: Answer
answers question: http://stackoverflow.com/q/27032214
has body: If you care about pause time you can try concurrent collector -XX:+UseConcMarkSweepGC. For your heap size and core number I wound expect pauses in 50-100ms range.

hashmap
tags question: http://stackoverflow.com/q/27031986
tags question: http://stackoverflow.com/q/27128247
tags question: http://stackoverflow.com/q/27120079
tags question: http://stackoverflow.com/q/27003715
tags question: http://stackoverflow.com/q/27104259
tags question: http://stackoverflow.com/q/27069566
tags question: http://stackoverflow.com/q/27031294
tags question: http://stackoverflow.com/q/27146294
tags question: http://stackoverflow.com/q/27071419
tags question: http://stackoverflow.com/q/27113045
tags question: http://stackoverflow.com/q/27081127
tags question: http://stackoverflow.com/q/27126105
tags question: http://stackoverflow.com/q/27119525
tags question: http://stackoverflow.com/q/27030021
type: Tag
tags question: http://stackoverflow.com/q/27037103
tags question: http://stackoverflow.com/q/27073872
tags question: http://stackoverflow.com/q/27076604
tags question: http://stackoverflow.com/q/27147325
tags question: http://stackoverflow.com/q/27143444
tags question: http://stackoverflow.com/q/27018424
tags question: http://stackoverflow.com/q/27131679
tags question: http://stackoverflow.com/q/27002933
tags question: http://stackoverflow.com/q/27000957
tags question: http://stackoverflow.com/q/27085327
tags question: http://stackoverflow.com/q/27073754
tags question: http://stackoverflow.com/q/27130534
tags question: http://stackoverflow.com/q/27149585
tag name: hashmap
tags question: http://stackoverflow.com/q/27078121
tags question: http://stackoverflow.com/q/27134163
tags question: http://stackoverflow.com/q/27148120
tags question: http://stackoverflow.com/q/26999663
tags question: http://stackoverflow.com/q/27078047
tags question: http://stackoverflow.com/q/27056217
tags question: http://stackoverflow.com/q/27100895
tags question: http://stackoverflow.com/q/27141685

http://stackoverflow.com/q/27046305
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42610950
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27046417
possible better answer: http://stackoverflow.com/a/27046364
has answer: http://stackoverflow.com/a/27046399
has answer: http://stackoverflow.com/a/27046488
has answer: http://stackoverflow.com/a/27046366
accepted answer: http://stackoverflow.com/a/27046366
has title: How to find the first word of a sentence for only three different options
score: 0
has body: I can have these three kind of Strings ALPHA_whatever_1234567 BETA_whateverDifferent_7654321 GAMMA_anotherOption_1237654 I want to extract from the Strings the beginning of them, whether is ALPHA, BETA or GAMMA. So, for example, I would like to get: ALPHA_whatever_1234567 -&gt; ALPHA BETA_whateverDifferent_7654321 -&gt; BETA GAMMA_anotherOption_1237654 -&gt; GAMMA I want to use Regular Expression, and I tried something like this private static final Pattern PATTERN = Pattern.compile("(.*)_.*"); But it doesn't work for some Strings. I recover the beginning by Matcher m = PATTERN.matcher(string); m.find(1); I also tried this Pattern: private static final Pattern PATTERN = Pattern.compile("([ALPHA]|[BETA]|[GAMMA])_.*"); But it returns only the first character of the String. What am I doing wrong?
has comment: http://stackoverflow.com/comment/42611717
answer count: 5
has answer: http://stackoverflow.com/a/27046364
tagged with: regex

http://stackoverflow.com/comment/43633659
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27153572
has text: If you're feeling adventurous, the current SNAPSHOTs should have the fixes in it to crudely support java config. I'll be polishing it up a bit before the M1 release.
type: AnswerComment

http://stackoverflow.com/q/27036440
has answer: http://stackoverflow.com/a/38396621
score: 0
answer count: 3
has body: i am trying to write Unittests for a MAS. Therefore i have to mock the agent an agent is communicating with. Here is an example of what i am trying to do at the moment. I have an agent A which is the one that i want to test. He calls B.method(arg) on an other agent B, which is mocked in my case. Normally B would call A.method(arg1, arg2, arg3). I am new to Mockito and doesn't know a lot about its possibilities. Is it possible to do something like when(mock.method).thenCall(A.method)? Thanks for your help!
has comment: http://stackoverflow.com/comment/42593332
has comment: http://stackoverflow.com/comment/42593321
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27036526
has comment: http://stackoverflow.com/comment/42612972
tagged with: java
has comment: http://stackoverflow.com/comment/42594046
tagged with: unit-testing
type: Question
tagged with: mockito
has title: How to mock a method call with Mockito
has answer: http://stackoverflow.com/a/27036573

http://stackoverflow.com/comment/42746238
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27119459
has text: What about persistance.xml and entity.java class?

http://stackoverflow.com/q/27042426
has title: Android creates incorrect array list with method Arrays.asList
has comment: http://stackoverflow.com/comment/42724637
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27042512
has answer: http://stackoverflow.com/a/27043130
type: Question
possible better answer: http://stackoverflow.com/a/27042512
tagged with: java
score: 0
answer count: 2
has body: i have array int[] pressed= new int[]{1,2,3}; List pS = Arrays.asList(pressed); i expect what pS will contains array of integers with 1,2,3 values, but it contains array with one element which is a array of {1,2,3}
tagged with: arrays
accepted answer: http://stackoverflow.com/a/27043130

http://stackoverflow.com/comment/42748610
score: 1
comment on: http://stackoverflow.com/q/27123411
has text: Text is cyrillic "Радио "Мир" - Первое Доброе Радио" but in wrong encoding. Looks like a Unicode variant, but I cannot say exactly until I see the string in hexadecimal codes. Could you provide it please?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27073299
has answer: http://stackoverflow.com/a/27073364
answer count: 4
has comment: http://stackoverflow.com/comment/42658603
has comment: http://stackoverflow.com/comment/42658616
has body: So I am writing a menu based program, and I am stuck in one part. Here's my code: public static void main(String [] args) throws FileNotFoundException { switch (menu()) { case 1: System.out.println("Stub 1"); menu(); break; case 2: System.out.println("Stub 2"); menu(); break; case 3: System.out.println("Stub 3"); menu(); break; case 4: System.out.println("Program Terminated"); break; } } public static int menu() { System.out.println("Choose a task number from the following: "); System.out.println("\t1. - See histogram of name's popularity"); System.out.println("\t2. - Compare two names in a specific decade"); System.out.println("\t3. - Show what name had a specific rank for a certain decade"); System.out.println("\t4. - Exit program"); int opt = 0; int option = getInt(input,"Enter number (1-4): ", 1, 4); if (option == 1) { opt = 1; } else if (option == 2) { opt = 2; } else if (option == 3) { opt = 3; } else { opt = 4; } return opt; } My question is, how can I get the menu to 'reset' after an option is pressed. For example, I choose 1, the program performs the action and after it's done, it shows the options menu again until I press 4 to terminate it. The getInt method in my code simply returns an int between 1 and 4.
tagged with: while-loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42658620
has title: Looping through a switch statement
has answer: http://stackoverflow.com/a/27073341
accepted answer: http://stackoverflow.com/a/27073364
type: Question
possible better answer: http://stackoverflow.com/a/27073332
has answer: http://stackoverflow.com/a/27073332
has comment: http://stackoverflow.com/comment/42658577
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27073338
linked to: http://stackoverflow.com/q/2979383
tagged with: switch-statement

http://stackoverflow.com/q/27035156
has comment: http://stackoverflow.com/comment/42591268
type: Question
has comment: http://stackoverflow.com/comment/42591555
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42591089
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27035343
tagged with: android
has body: Whenever I scroll down in my android app, I get a nullpointerexception on line 79 linear.addView(holder.rbg); I tried several solutions but none of them seem to work, since I don't use an inflater because I have no idea how it works. I can provide you my XML file but the only thing inside it is a linearlayout. private class MyAdapter extends ArrayAdapter&lt;String&gt; { public MyAdapter(Context context, String[] strings) { super(context, -1, -1, strings); } @Override public View getView(int position, View convertView, ViewGroup parent) { //trying to reuse a recycled view ViewHolder holder; View v = convertView; LinearLayout linear = new LinearLayout(Bouwonderdeel.this); if (v == null) { holder = new ViewHolder(); linear.setLayoutParams(new AbsListView.LayoutParams( AbsListView.LayoutParams.WRAP_CONTENT, AbsListView.LayoutParams.WRAP_CONTENT)); linear.setId(50); holder.tv = new TextView(Bouwonderdeel.this); holder.tv.setId(100); holder.rbg = new RadioGroup(Bouwonderdeel.this); holder.rbg.setId(200); holder.rbg.setOrientation(LinearLayout.HORIZONTAL); holder.rbg.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { } }); //Make the list Items containing radiobuttons en textviews. for (int i = 0; i &lt; 5; i++) { holder.rName = new RadioButton (Bouwonderdeel.this); holder.rbg.addView(holder.rName); } } else{ holder = (ViewHolder) v.getTag(); } linear.addView(holder.rbg); linear.addView(holder.tv); holder.tv.setText(super.getItem(position)); return linear; } } static class ViewHolder{ RadioButton rName; RadioGroup rbg; TextView tv; } http://shrib.com/4RBAO1Ia
has comment: http://stackoverflow.com/comment/42591187
has title: Nullpointerexception custom Adapter at getview no inflater
tagged with: java

http://stackoverflow.com/comment/42631201
has text: Show us how `getTarget` fills the List or preferably a [minimal, verifiable example](http://stackoverflow.com/help/mcve).
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27056292

http://stackoverflow.com/comment/42779691
has text: I don't recommend using it in production, but you could try an obfuscator like yGuard, look at the logs to see what it did, and use that to remove unnecessary code.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27141038

http://stackoverflow.com/q/27134753
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42777574
has comment: http://stackoverflow.com/comment/42810583
tagged with: java
has title: Best Timer Designs for Java2D video games
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27135587
has body: I am building a Java2D video game with multiple sprites updating on the screen at once, and was looking for feedback with regard to best way to handle updates via use of Timers. I was looking for feedback on best way to handle Timer design that would update locations of each Sprite. Currently, the way I have been doing it, is I have one Timer. When it expires, I update the position of each Sprite. I only ever Update Sprite location by 1 pixel, to keep motion smooth. If something was to update slower that then rest of the Sprite, I update it's position say on every 3 or 5th call of a getImage() call (used to get the current icon image of the sprite). Now with this approach, all updates are dependent on the main timer, and the Sprites sort of update in relation to each other. So if I wanted to speed up the game, I just update the refresh rate of the main timer. However, I don't know if this is the best approach. Would it be better to put each object on it's own timer, but would that cause other issues? Maybe cause problems for the main paint() method? Was just looking for feedback on a good design technique for this.
answer count: 2
score: 1
has answer: http://stackoverflow.com/a/27134940
favorite count: 0
tagged with: java-2d
tagged with: timer
upvote count: 2

http://stackoverflow.com/q/27033019
tagged with: webserver
has body: I have a web server which forwards the dynamic requests with .htm to tomcat (connected using mod_jk) and static resources are served from Apache web server. Consider the following spring controller which process login.htm @RequestMapping(method = {org.springframework.web.bind.annotation.RequestMethod.POST}, value = {"login.htm"}) public ModelAndView showLoginPage(HttpServletRequest request, HttpServletResponse response) throws Exception { return new ModelAndView("login"); } Corresponding viewresolver is as follows: &lt;!bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="prefix" value="/" /&gt; &lt;property name="suffix" value=".html" /&gt; &lt;/bean&gt; This is searching for a file login.html within the tomcat context. But the static login.html reside on htdocs folder of apache (under same domain). Can anybody please tell me how can the view be resolved from web server?
score: 0
has title: spring view resolver for HTML + redirect to apache web server
answer count: 1
has answer: http://stackoverflow.com/a/27036059
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: model-view-controller
tagged with: java
type: Question
tagged with: apache

list
tags question: http://stackoverflow.com/q/27140585
type: Tag
tags question: http://stackoverflow.com/q/27021920
tags question: http://stackoverflow.com/q/27095429
tags question: http://stackoverflow.com/q/27048588
tags question: http://stackoverflow.com/q/27013301
tags question: http://stackoverflow.com/q/27127865
tags question: http://stackoverflow.com/q/27146738
tags question: http://stackoverflow.com/q/27016242
tags question: http://stackoverflow.com/q/27130973
tags question: http://stackoverflow.com/q/27146259
tags question: http://stackoverflow.com/q/27092110
tags question: http://stackoverflow.com/q/27046621
tags question: http://stackoverflow.com/q/27151960
tags question: http://stackoverflow.com/q/27000897
tags question: http://stackoverflow.com/q/26995166
tag name: list
tags question: http://stackoverflow.com/q/27098295
tags question: http://stackoverflow.com/q/27035215
tags question: http://stackoverflow.com/q/27115415
tags question: http://stackoverflow.com/q/27142534
tags question: http://stackoverflow.com/q/27031228
tags question: http://stackoverflow.com/q/27031639
tags question: http://stackoverflow.com/q/27051466
tags question: http://stackoverflow.com/q/27054172
tags question: http://stackoverflow.com/q/27111318
tags question: http://stackoverflow.com/q/26999693
tags question: http://stackoverflow.com/q/27133236
tags question: http://stackoverflow.com/q/27115292
tags question: http://stackoverflow.com/q/27130511
tags question: http://stackoverflow.com/q/27129556
tags question: http://stackoverflow.com/q/27135801
tags question: http://stackoverflow.com/q/27137428
tags question: http://stackoverflow.com/q/27017735
tags question: http://stackoverflow.com/q/27084074
tags question: http://stackoverflow.com/q/27097051
tags question: http://stackoverflow.com/q/27087693
tags question: http://stackoverflow.com/q/27030926
tags question: http://stackoverflow.com/q/27067498
tags question: http://stackoverflow.com/q/27067746
tags question: http://stackoverflow.com/q/27090835
tags question: http://stackoverflow.com/q/27047322
tags question: http://stackoverflow.com/q/27002882
tags question: http://stackoverflow.com/q/27052384
tags question: http://stackoverflow.com/q/27084154

http://stackoverflow.com/comment/46254330
has text: Hey Vishnu Prathish, I followed your instruction but still the same thing. When I change to `hduser` and see `echo $HADOOP_CLASSPATH`, it's blank.
type: Comment
comment on: http://stackoverflow.com/a/28993419
score: 0
type: AnswerComment

http://stackoverflow.com/q/27135226
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42768784
has body: I have an application which stores students, courses, what they are studying etc. The application is connected to a SQL database. I have no problem inserting or searching for stuff in the database through my application. But I still haven't figured out a way to delete rows in the tables through my application, in an easy way. I can, just like searching and inserting, use userinput in order to delete a row (example JTextFields) but I'd like an easier way. So I've figured out that if I add a popupmenu to my table, then I can rightclick a row and make it show "Delete row", as shown here But now, I'd like to get the information in that row so I can send it to my frame, controller and later on database but I have no idea how. In this example I'd like to get "Lars" in a String and "12" in a int variable as you might imagine. So far I have created the code which does the thing in the picture. I've removed some code so it's easier to see what I'm getting at here. Any help is appreciated! table = new JTable(studentTableModel); popup = new JPopupMenu(); JMenuItem removeItem = new JMenuItem("Delete student"); popup.add(removeItem); table.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { int row = table.rowAtPoint(e.getPoint()); table.getSelectionModel().setSelectionInterval(row, row); if(e.getButton() == MouseEvent.BUTTON3) { popup.show(table, e.getX(), e.getY()); } } }); removeItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int row = table.getSelectedRow(); if(studentTableListener != null) { studentTableListener.rowDeleted(row); studentTableModel.fireTableRowsDeleted(row, row); } } });`
has comment: http://stackoverflow.com/comment/42768871
tagged with: jdbc
has title: How to get information from a JTable row when clicking on it with mouse?
tagged with: mouselistener
type: UnansweredQuestion
tagged with: delete-row
type: Question
has comment: http://stackoverflow.com/comment/42771037
tagged with: java
has answer: http://stackoverflow.com/a/27135579
tagged with: jtable

http://stackoverflow.com/a/27078315
type: Answer
has comment: http://stackoverflow.com/comment/42666855
answers question: http://stackoverflow.com/q/27078231
has comment: http://stackoverflow.com/comment/42666921
has body: It still won't work, there'll be an out of bounds exception. The error lies in the line pt[ind] = (char) s;
score: 0

http://stackoverflow.com/a/27099755
type: Answer
score: 7
has comment: http://stackoverflow.com/comment/42977823
upvote count: 7
has comment: http://stackoverflow.com/comment/42972516
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27098665
has body: In your code, what you need to do is to open two different session factory for different databases. For example: Configuration configA=new Configuration();//use the default hibernate.cgf.xml file Congiruration configB=new Configuration.configure('/hibernate_db2.cfg.xml') // use hibernate_db2.cfg.xml under root folder. SessionFactory sfa=configA.buildSessionFactory(); SessionFactory sfb=configB.buildSessionFactory(); Now, you open different session using different db.
accepted answer of: http://stackoverflow.com/q/27098665

http://stackoverflow.com/q/27042070
favorite count: 0
has comment: http://stackoverflow.com/comment/42603838
has comment: http://stackoverflow.com/comment/42603570
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27042260
tagged with: java
downvote count: 2
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/1431551
tagged with: pipe
score: -1
has title: Java: read from unnamed Pipe
has body: I have a command that gives a list of files (like find). For each of those files i want to do something in Java: find ./files &lt;some restrictions&gt; | java -jar processor.jar how can i read from this unnamed / anonymous Pipe?
accepted answer: http://stackoverflow.com/a/27042260
answer count: 1

http://stackoverflow.com/a/27806188
downvote count: 0
has body: I figured out an easy way to setup a test workspace and wanted to share it with you (even though this means answering my own question): Open Eclipse and create a new workspace somewhere on the disc Add some sample projects to the new workspace Open an Eclipse instance which holds the Plug-in Test code In the JUnit Plug-in Test Launch Configuration, go to the Main tab Specify the workspace created in 1) and populated in 2) Run the test, which will start with the specified workspace and all projects in it
type: Answer
accepted answer of: http://stackoverflow.com/q/27088926
upvote count: 3
answers question: http://stackoverflow.com/q/27088926
score: 3
type: AcceptedAnswer

http://stackoverflow.com/a/61071550
type: Answer
has body: instead of onMouseClicked you should use onAction
answers question: http://stackoverflow.com/q/27079062
score: 0

http://stackoverflow.com/q/27015213
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42556690
has answer: http://stackoverflow.com/a/27015783
tagged with: dependencies
has answer: http://stackoverflow.com/a/27016556
has comment: http://stackoverflow.com/comment/42557943
type: UnansweredQuestion
tagged with: server
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/42556872
has comment: http://stackoverflow.com/comment/42557117
type: Question
has title: jersey server missing dependencies
score: 0
has comment: http://stackoverflow.com/comment/42556973
answer count: 2
has body: I'm using this code: import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; @Path("/files") public class JerseyFileUpload { private static final String SERVER_UPLOAD_LOCATION_FOLDER = "C://Users/nikos/Desktop/Upload_Files/"; /** * Upload a File */ @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile( @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition contentDispositionHeader) { String filePath = SERVER_UPLOAD_LOCATION_FOLDER + contentDispositionHeader.getFileName(); // save the file to the server saveFile(fileInputStream, filePath); String output = "File saved to server location : " + filePath; return Response.status(200).entity(output).build(); } // save uploaded file to a defined location on the server private void saveFile(InputStream uploadedInputStream, String serverLocation) { try { OutputStream outpuStream = new FileOutputStream(new File( serverLocation)); int read = 0; byte[] bytes = new byte[1024]; outpuStream = new FileOutputStream(new File(serverLocation)); while ((read = uploadedInputStream.read(bytes)) != -1) { outpuStream.write(bytes, 0, read); } outpuStream.flush(); outpuStream.close(); } catch (IOException e) { e.printStackTrace(); } } } When I try to run it on Apache Tomcat I get these error messages: SEVERE: The following errors and warnings have been detected with resource and/or provider classes: SEVERE: Missing dependency for method public javax.ws.rs.core.Response com.javacodegeeks.enterprise.rest.jersey.JerseyFileUpload.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at i…
linked to: http://stackoverflow.com/q/15909978
tagged with: jersey

http://stackoverflow.com/comment/42710982
comment on: http://stackoverflow.com/a/27101385
type: AnswerComment
type: Comment
has text: http://camel.apache.org/cxf-tomcat-example.html - I don't know what fixed it. I think the problem was that I had cxf:bean:handlerName instead of cxf:handlerName
score: 1

http://stackoverflow.com/a/27097263
type: Answer
has body: You'll need a for-loop, you'll need to check each character of the phrase, String#charAt should help. If the character is not a space, you would append an ? to the template, otherwise you'll need to append a space... See The for Statement for more details... StringBuilder sb = new StringBuilder(sPhrase.length()); for (int index = 0; index &lt; sPhrase.length(); index++) { if (sPhrase.charAt(index) != ' ') { sb.append("?"); } else { sb.append(" "); } } sTemplate = sb.toString(); Equally you could use... StringBuilder sb = new StringBuilder(sPhrase.length()); for (char c : sPhrase.toCharArray()) { if (c != ' ')) { sb.append("?"); } else { sb.append(" "); } } sTemplate = sb.toString(); But I thought the first one would be easier to understand...
answers question: http://stackoverflow.com/q/27097240
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/q/26992691
type: Question
tagged with: java
score: 0
tagged with: abstract-syntax-tree
has answer: http://stackoverflow.com/a/27035687
answer count: 1
has comment: http://stackoverflow.com/comment/42516661
favorite count: 0
has title: Generate Java Source Code for Abstract Syntax Tree
linked to: http://stackoverflow.com/q/5832412
has body: I had generated AST of java grammer using Antlr. I had made some alterations in the AST, Now I need to write the AST as Java File at a particular location. Could any one suggest me the available ways to do the same. Thanks in Advance!
type: UnansweredQuestion
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/27128672
answers question: http://stackoverflow.com/q/27128604
score: 1
upvote count: 1
has body: You are missing return from a method that you are calling. So instead of public void enemyDecided(int choice){ Use public Enemies enemyDecided(int choice){ And at the end of the method add return this;
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42654060
has text: The problem is in the line recType = RecordType.valueOf(reader.getNextRecord()); It seems that the reader.getNextRecord() is returning null. But I'll need the input file to find where the error is
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27070523

http://stackoverflow.com/q/27144604
has title: How can I put an object (definied into a servlet) into a session to use it into a JSP page?
possible better answer: http://stackoverflow.com/a/27144922
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/27144922
accepted answer: http://stackoverflow.com/a/27144762
favorite count: 0
linked to: http://stackoverflow.com/q/5766521
has answer: http://stackoverflow.com/a/27144799
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42786179
upvote count: 1
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/27144762
tagged with: session
tagged with: servlets
has body: this is my first time that I work on a J2EE project and I have the following problem: I have the following servlet that implement the HttpServlet interface. public class Salwf extends HttpServlet { private String msg = StringUtils.EMPTY; public void init(ServletConfig config) throws ServletException { super.init(config); StandardConfigurationFactory standardConfigurationFactory = new StandardConfigurationFactory(); try { standardConfigurationFactory.init(); } catch (ConfigurationException e) { throw new ServletException(e); } ConfigurationFactory.setInstance(standardConfigurationFactory); } public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { LoggerMDC.setup(req, res); Logger logger = (Logger) Logger.getStdLogger(Monitoraggio.class); // do not declare 'logger' as static field in order to work with MDC String service = req.getParameter("serv"); char serviceId = Utility.getServizio(req.getParameter("serv")); // The collection that have to be shown in a table inside the JSP view: SalDettaglio[] salDettaglio = this.getSalDettaglioList(); gotoPage(ConfigurationFactory.getPropertiesPages().getProperty("pagina_salwf"), req, res); //String paginaDaLanciare = lanciaServizio(serviceId, req, res); } /* private String lanciaServizio(char num_servizio, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Logger logger = (Logger) Logger.getStdLogger(Monitoraggio.class); // do not declare 'logger' as static field in order to work with MDC HttpSession session; } */ private void gotoPage(String address, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Logger logger = (Logger) Logger.getStdLogger(Monitoraggio.class); // do not declare 'logger' as static field in order to work with MDC logger.debug("gotoPage() | address: " + address); ServletContext ctx = getServletConfig().getServletContext(); RequestDispatcher dispatcher = ctx.getRequestDispatcher(address)…
answer count: 3

http://stackoverflow.com/a/26992540
answers question: http://stackoverflow.com/q/26992514
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/26992514
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can use any identifier as the parameter name, however using a single letter is less confusing as it less likely to be mistaken for a class name. Oracle's Generic types tutorial has the following recommendation: By convention, type parameter names are single, uppercase letters. This stands in sharp contrast to the variable naming conventions that you already know about, and with good reason: Without this convention, it would be difficult to tell the difference between a type variable and an ordinary class or interface name. The most commonly used type parameter names are: E - Element (used extensively by the Java Collections Framework) K - Key N - Number T - Type V - Value S,U,V etc. - 2nd, 3rd, 4th types

http://stackoverflow.com/comment/42591245
comment on: http://stackoverflow.com/a/27035182
has text: When I run The Application The frame is small in size,then maximize my frame,The textarea size is not expand.Fixed with the given rows and columns.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27041542
type: Answer
has comment: http://stackoverflow.com/comment/42602398
score: 2
has body: Use boolean result = "éasdfasdf".substring(0,1).equals("é") And it will give expected result! The reason is simple - using '==' you compare objects by reference, not by value. So equals() solves this problem
answers question: http://stackoverflow.com/q/27041504
has comment: http://stackoverflow.com/comment/42603502
has comment: http://stackoverflow.com/comment/42603908
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/42616622
has comment: http://stackoverflow.com/comment/42602313
has comment: http://stackoverflow.com/comment/42604172

http://stackoverflow.com/comment/42714034
type: QuestionComment
score: 1
has text: Agree on the practice of extending HashMap. This class is designed to map keys efficiently to values. Unless this is also the main purpose of your Subscriber class then extending HashMap suggests poor design. Remember, extends indicates an "is-a" relationship; unless it makes sense to say "Subscriber is a HashMap" then it's probably the wrong design. I suspect "Subscriber has a HashMap" is more appropriate.
comment on: http://stackoverflow.com/q/27104259
type: Comment

http://stackoverflow.com/a/27021076
has comment: http://stackoverflow.com/comment/42570236
has body: new Font(fontNameSet, fontSizeSet, Font.PLAIN) This has the arguments in the wrong order. It should be: new Font(fontNameSet, Font.PLAIN, fontSizeSet) Also, as mentioned in a comment: scroll.setFont(new Font(fontNameSet, fontSizeSet, Font.PLAIN)); Should be: texty.setFont(new Font(fontNameSet, Font.PLAIN, fontSizeSet));
upvote count: 4
answers question: http://stackoverflow.com/q/27016675
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/27016675
type: Answer

ascii
tags question: http://stackoverflow.com/q/27082328
tags question: http://stackoverflow.com/q/27082605
type: Tag
tag name: ascii

http://stackoverflow.com/comment/44485913
score: 0
type: AnswerComment
has text: I'm going to accept your answer as you were the only one answering. I wasn't able to convert the code, so I decided to implement an algorithm from a paper regarding this subject.
type: Comment
comment on: http://stackoverflow.com/a/27571995

http://stackoverflow.com/a/27067090
has comment: http://stackoverflow.com/comment/56155108
has comment: http://stackoverflow.com/comment/42647714
has comment: http://stackoverflow.com/comment/56152065
type: Answer
has comment: http://stackoverflow.com/comment/56152008
has comment: http://stackoverflow.com/comment/42647949
accepted answer of: http://stackoverflow.com/q/27067049
has comment: http://stackoverflow.com/comment/42647772
has comment: http://stackoverflow.com/comment/42648096
upvote count: 75
answers question: http://stackoverflow.com/q/27067049
has comment: http://stackoverflow.com/comment/42647642
has comment: http://stackoverflow.com/comment/42648215
has comment: http://stackoverflow.com/comment/42648284
score: 73
has comment: http://stackoverflow.com/comment/42648103
downvote count: 2
type: AcceptedAnswer
has body: I don't want to add a Clock argument to the method because the real code shouldn't be concerned with passing in a clock. No... but you might want to consider it as a constructor parameter. Basically you're saying that your class needs a clock with which to work... so that's a dependency. Treat it as you would any other dependency, and inject it either in a constructor or via a method. (I personally favour constructor injection, but YMMV.) As soon as you stop thinking of it as something you can easily construct yourself, and start thinking of it as "just another dependency" then you can use familiar techniques. (I'm assuming you're comfortable with dependency injection in general, admittedly.)

http://stackoverflow.com/comment/42730647
type: Comment
type: QuestionComment
score: 1
has text: Technically, @OliverCharlesworth is correct if you look at the syntax of the `if` statement. `else if` is not part of the syntax; an `else` is succeeded by another statement, that can be a block or another `if`. It's really just a matter of how we think about it. There _are_ languages where this is not true (Ada, Perl), where the `if` part of an "else if" part is _not_ just a nested statement, syntactically.
comment on: http://stackoverflow.com/q/27113608

http://stackoverflow.com/q/27065045
has title: Creating Button with Image in eclipse not working
has body: I am trying to create a button with an image. The API can be found here. Here is my code: Button settings = new Button(swpContainer, SWT.PUSH); settings.setText("Settings"); settings.setImage(new Image(null, "/myProject/icons/settings.png")); And here is the exception I am getting.. org.eclipse.swt.SWTException: i/o error (java.io.FileNotFoundException: \myProject\icons\settings.png (The system cannot find the path specified)) I am right clicking the image in eclipse and getting the path from the properties. Any help will be greatly appreciated!
has answer: http://stackoverflow.com/a/27119892
tagged with: eclipse-plugin
answer count: 3
linked to: http://stackoverflow.com/q/3844307
accepted answer: http://stackoverflow.com/a/27119892
score: 0
has answer: http://stackoverflow.com/a/27065776
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27065776
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/27149776
type: Question

http://stackoverflow.com/a/27117851
type: Answer
has body: I figured it out. Thanks to everyone for their helpful comments (what is it with people and commenting here, by the way? how come people write everything that could go in an answer in the comments instead?) Rather than calling .showConfirmDialog(this, ...) (where this is my JPanel subclass), I needed to call .showConfirmDialog(parent, ...) (where parent is my JFrame subclass). Then, I added a WindowStateListener on the JFrame to detect state changes and reset the window state.
downvote count: 0
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27116614
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27116614

http://stackoverflow.com/q/27120811
has comment: http://stackoverflow.com/comment/42742731
type: Question
answer count: 2
score: 2
downvote count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/42742691
linked to: http://stackoverflow.com/q/24965194
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/27121994
has title: Nashorn access non-static Java method
has answer: http://stackoverflow.com/a/27121994
has answer: http://stackoverflow.com/a/27340325
tagged with: nashorn
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42743047
has body: In Java 7 (1.7), I could access a Java method from JavaScript by running this: ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript"); jse.eval("importClass(net.apocalypselabs.symat.Functions);"); jse.eval("SyMAT_Functions = new net.apocalypselabs.symat.Functions();"); String input = "notify(\"Foo\");"; // This is user input jse.eval("with(SyMAT_Functions){ "+input+" }"); Which would run the notify() function from the Functions java class: public class Functions { private Object someObjectThatCannotBeStatic; public void notify(Object message) { JOptionPane.showMessageDialog(null, message.toString()); } /* Lots more functions in here, several working with the same non-static variable */ } How do I access the Functions class in Java 1.8 with the Nashorn engine? My goal is to run different code for the first snippet if the user has Java 1.8, while still allowing people with 1.7 to use the app. I've tried http://www.doublecloud.org/2014/04/java-8-new-features-nashorn-javascript-engine/ , https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/api.html , and How to instantiate a Java class in JavaScript using Nashorn? without luck. None of them seem to allow me the same thing as Java 1.7 did, instead assuming I only want to access static functions and objects. The most common error I get: I start with... ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript"); jse.eval("var SyMAT_Functions;with (new JavaImporter(Packages.net.apocalypselabs.symat)) {" + "SyMAT_Functions = new Functions();}"); ...then... jse.eval("with(SyMAT_Functions){ "+input+" }"); ...spits out... TypeError: Cannot apply "with" to non script object in &lt;eval&gt; at line number 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27340325

http://stackoverflow.com/comment/42806368
type: AnswerComment
type: Comment
has text: If I use createNativeQuery, I obtain an exception because the method is a function, not a procedure
comment on: http://stackoverflow.com/a/27133976
score: 0

http://stackoverflow.com/a/27087142
score: 1
upvote count: 1
downvote count: 0
has body: Use an Executor with a threadpool size of 1 to test out the single threaded speed. Then increase the poolsize to see how it affects the time. Then notice how the performance actually weakens when you have a pool the size of 500 due to all the context switching that's happening.
type: Answer
answers question: http://stackoverflow.com/q/27086986

http://stackoverflow.com/q/27151177
tagged with: java
has comment: http://stackoverflow.com/comment/42800314
has body: Is there any default way in Java to translate KeyStroke to readable String except manual parsing? KeyStroke ke = KeyStroke.getKeyStroke("ctrl released 1"); System.out.println(ke.toString()) Print result: ctrl released 1 Expected: Ctrl+1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/27299831
has title: Readable KeyStroke
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42800393
tagged with: keystroke
favorite count: 0
has comment: http://stackoverflow.com/comment/42796992
has comment: http://stackoverflow.com/comment/42797009
accepted answer: http://stackoverflow.com/a/27299831
type: AnsweredQuestion
score: 3
upvote count: 3

http://stackoverflow.com/comment/42556781
type: Comment
type: QuestionComment
has text: Try to use `PreparedStatement.setInputStream()` instead of `setBlob()`
score: 0
comment on: http://stackoverflow.com/q/27015630

http://stackoverflow.com/a/27024923
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27024824
answers question: http://stackoverflow.com/q/27024824
type: Answer
has comment: http://stackoverflow.com/comment/42573664
has comment: http://stackoverflow.com/comment/42574146
has comment: http://stackoverflow.com/comment/42574144
upvote count: 4
has body: The finally block is used for code that must always run, whether an error condition (exception) occurred or not. The code in the finally block is run after the try block completes and, if a caught exception occurred, after the corresponding catch block completes. It should always run, even if an uncaught exception occurred in the try or catch block (Except if you got System.exit(0) in try block, because it will turn down the application before going to the finally block). So your answer is 2. 30
downvote count: 0
score: 4

http://stackoverflow.com/q/27091396
tagged with: remote-server
has title: How can i share Java project on ftp server using Netbeans?
downvote count: 0
answer count: 1
favorite count: 0
tagged with: shared-hosting
type: UnansweredQuestion
has body: I have an FTP host and I want to upload a Java project to a remote server using NetBeans, but it doesn't give the remote server option with Java projects - it works with PHP but not Java. Is there any resource available that could help me solve this problem?
tagged with: ftp
tagged with: netbeans
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27092326
upvote count: 1
type: Question

http://stackoverflow.com/q/27127715
score: 4
upvote count: 4
tagged with: jscrollpane
answer count: 1
tagged with: user-interface
downvote count: 0
tagged with: panel
favorite count: 0
type: UnansweredQuestion
tagged with: java
has title: Can't add component to panel in scrollPane in java
type: Question
has answer: http://stackoverflow.com/a/27128568
has body: I'm working in desktop application in Java. I put a scroll pane and put a panel inside it to add a Label called name and an empty TextField and a button called more. What I want is when the button is clicked, a new Label and a TextField shall appear under the first Label and TextField, but nothing appears. Here is my code for the button: private void moreActionPerformed(java.awt.event.ActionEvent evt) { JLabel nameLabel = new JLabel("Name :"); JPanel panel = new JPanel(); i++; nameLabel.setBounds( child_namelabel.getX(), child_namelabel.getY() + 35 * i, child_namelabel.getWidth(), child_namelabel.getHeight()); panel.add(nameLabel); children.add(panel); }

http://stackoverflow.com/comment/42646208
type: Comment
comment on: http://stackoverflow.com/q/27065680
has text: @Selvin i didnt forgot to place the tmx file in the asset and its tmx not xml because its a from tiled
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42828413
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27147524
has text: the only issue i was having was the one i said. Do you think u can send me the full version of the code ur using incase im inputing it wrong or somthing?

http://stackoverflow.com/comment/42562648
has text: It's ugly, but after you call startActivity the first time (in your code), you can try calling finish(), and startActivity once again (adding my two lines to the end of your code). That being said, refreshing based on onResume may be something to look into.
type: Comment
comment on: http://stackoverflow.com/a/27018894
score: 0
type: AnswerComment

http://stackoverflow.com/q/27054266
has body: I'm currently learning Java and I had a question regarding some code that we say in class today, I was wondering if anybody could tell me why the following code outputs 5 and 33 as opposed to just two 33's. Aren't we assigning the value of d2 to d1 in the modify function? public class AClass { Date d1 = new Date (5L); Date d2 = new Date (33L); void modify ( Date x, Date y) { x=y; } public static void main (String[] args) { new AClass(); } AClass () { modify(d1,d2); System.out.println(d1.getTime()); System.out.println(d2.getTime()); } }
tagged with: java
linked to: http://stackoverflow.com/q/40480
type: Question
has comment: http://stackoverflow.com/comment/42626847
duplicate of: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/42625191
has comment: http://stackoverflow.com/comment/42626668
has comment: http://stackoverflow.com/comment/42626661
score: 0
has title: Class & Constructor Output
tagged with: assign
tagged with: constructor
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42625399
has comment: http://stackoverflow.com/comment/42625487
has comment: http://stackoverflow.com/comment/42626718
has comment: http://stackoverflow.com/comment/42627610
has comment: http://stackoverflow.com/comment/42625400
answer count: 0

datetimepicker
type: Tag
tag name: datetimepicker
tags question: http://stackoverflow.com/q/27053276

http://stackoverflow.com/comment/42705982
has text: I don't quite understand why this question is being upvoted.
comment on: http://stackoverflow.com/q/27100474
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42552611
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27013103
has text: this is only for unmarshalling.
score: 0

http://stackoverflow.com/comment/42561790
score: 0
type: Comment
type: QuestionComment
has text: If you want to sort on hiragana, just find all code points for each letter. Then sorting should be a piece of cake. They may look like symbols to you, but they're just unicode or utf-8 code points to the machine. Then you just need to figure out how you want to treat katakana.
comment on: http://stackoverflow.com/q/27018434

concurrency
tags question: http://stackoverflow.com/q/27117347
tag name: concurrency
tags question: http://stackoverflow.com/q/27117367
tags question: http://stackoverflow.com/q/27054182
tags question: http://stackoverflow.com/q/27044102
tags question: http://stackoverflow.com/q/26994080
tags question: http://stackoverflow.com/q/27122988
tags question: http://stackoverflow.com/q/27082556
tags question: http://stackoverflow.com/q/27032656
tags question: http://stackoverflow.com/q/27138602
tags question: http://stackoverflow.com/q/27036521
tags question: http://stackoverflow.com/q/27025958
tags question: http://stackoverflow.com/q/27043567
tags question: http://stackoverflow.com/q/27124664
tags question: http://stackoverflow.com/q/27119966
tags question: http://stackoverflow.com/q/27005481
tags question: http://stackoverflow.com/q/27101978
tags question: http://stackoverflow.com/q/27113045
tags question: http://stackoverflow.com/q/27104021
tags question: http://stackoverflow.com/q/27140179
tags question: http://stackoverflow.com/q/27133521
tags question: http://stackoverflow.com/q/27058828
type: Tag
tags question: http://stackoverflow.com/q/27030458
tags question: http://stackoverflow.com/q/27065455

http://stackoverflow.com/comment/42544594
type: Comment
has text: @AndrewBarber I guess the OP knows this and is asking how
type: QuestionComment
comment on: http://stackoverflow.com/q/27008051
score: 0

http://stackoverflow.com/comment/42551958
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27012551
type: Comment
has text: @XiaoRun Do you have spring-tx jar in your project? If yes. Please check it added to build path or not.

http://stackoverflow.com/comment/42799523
has text: sir by valWord then phraseWord.
comment on: http://stackoverflow.com/q/27151960
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27026427
answers question: http://stackoverflow.com/q/27016053
type: Answer
has body: The problem was an @AssociationOverride annotation with a wrong @JoinColumn name. I guess the error message should have been more clearer.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27016053

http://stackoverflow.com/comment/42597222
score: 0
type: Comment
has text: I had duplicated "The inserted numbers are are:" part which i now removed. Check and see if that helps.
type: AnswerComment
comment on: http://stackoverflow.com/a/27038587

http://stackoverflow.com/a/27034558
has body: Try to analyse the instances / object creation in your RAM with jvisualvm, it usually tells you right away if you are leaking or not. (It's a GUI, do not panic ;-) ) Doc -> https://docs.oracle.com/javase/6/docs/technotes/tools/share/jvisualvm.html It's a profiler, so it will show you where you spend time, how many instances of your classes you have and basically what's going on IN your app while it is running. It's installed by default with the official oracle jdk on linux! If the memory usage is almost constant but on the edge, try to increase you heap (-Xmx2G for example)
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27033954
upvote count: 1

http://stackoverflow.com/comment/42670902
comment on: http://stackoverflow.com/q/27079662
type: Comment
type: QuestionComment
score: 0
has text: Thank you @JonSkeet. I went ahead and updated my code and only included one button. Still very new to this website. Thank you for all the advice.

http://stackoverflow.com/comment/42645785
comment on: http://stackoverflow.com/q/27064210
score: 0
type: QuestionComment
has text: @castling thanks I'll take a look at that. In the mean time I have included also the weblogic-ejb-jar.xml file which shows the `jndi-name` value as `com.dteco.cpm.process.CounterpartyHandlerHome`
type: Comment

http://stackoverflow.com/q/27121550
has answer: http://stackoverflow.com/a/27146948
score: 0
answer count: 1
has body: I'm trying to implement Collision detection using Rectangles for my game but can't seem to get it to work. Bullets are updated when pressing space every frame so they move across the screen. Apparently so I've been told on here, the collisionbox moves with it as well. I'm getting this by using sprite.getBoundingBox() which sets a datafield Rectangle to this value for each instance. I have two Arraylists, one holding instances of Monsters and one holding instances of Bullets. They all have collisionRectangles associated with them. I'm calling the checkCollisions() method from my main render loop every frame as long as there's something in the bullets or monsters arraylist. /*this handles collisions between bullets and enemies*/ public static void checkCollisions(){ for (int i = 0; i &lt; Main.currentBullets.size(); i++){ for (int k = 0; k &lt; Main.currentMonsters.size(); k++){ if (Intersector.overlaps(Main.currentBullets.get(i).collisionBoxBullet, Main.currentMonsters.get(k).collisionBoxMonster)){ System.out.println("Boom headshot"); } } } Shouldn't this do Boom Headshot every time it overlaps? Instead it always seems to keep evaluating to true. Why does it keep evaluating to true and writing boom headshot?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42782326
has title: Collision detection Libgdx rectangles
tagged with: game-physics
has comment: http://stackoverflow.com/comment/42778189
tagged with: java
has comment: http://stackoverflow.com/comment/42746510
tagged with: eclipse
type: Question
tagged with: libgdx

http://stackoverflow.com/comment/42777574
score: 0
has text: Why are you not using a game engine, such as libgdx? You wouldn't need to reinvent the wheel...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27134753

http://stackoverflow.com/comment/42716812
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27106673
has text: didnt get it I said try it in if (result == JOptionPane.YES_OPTION){ } ....

http://stackoverflow.com/comment/42793692
comment on: http://stackoverflow.com/a/27148512
has text: updated the question.I also gone through your blog..but unable to resolve my issue..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42746762
has text: Maybe your application is not generating enough garbage. Try launching it with very low memory values (e.g. `-Xms2m -Xmx64m`) for force GC to run.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/27122916
type: AnswerComment

http://stackoverflow.com/comment/42663704
type: QuestionComment
has text: Ok, from what I see and you provided it is because getInstance throws exception, checkout my answer and let me if it is your problem.
comment on: http://stackoverflow.com/q/27076314
score: 0
type: Comment

clr
type: Tag
tags question: http://stackoverflow.com/q/27025968
tag name: clr

http://stackoverflow.com/q/27102384
has body: From command line I can execute mvn clean install deploy with out any extra configuration with maven-3.2.2. So there is no doubt about configuration of maven setting. My private repository http://maven.medicom.com.sa/maven2/releases accessible via maven although there is an basic http authentication enabled. As bellow is snapshot of setting.xml files. While I tried it with Jenkins Maven plugins its unable to access http://maven.medicom.com.sa/maven2/releases repository due to basic http authentication. medicom Authorization Basic bXE2ZX46bXVkaXMhcB== medicom.plugins Authorization Basic bXE2ZX46bXVkaXMhcB== medicom.releases medicom.releases !false medicom http://maven.medicom.com.sa/maven2/releases true false medicom.plugins http://maven.medicom.com.sa/maven2/releases true false
tagged with: jenkins
type: UnansweredQuestion
tagged with: maven
tagged with: jakarta-ee
tagged with: java
tagged with: jenkins-plugins
type: Question
score: 0
has title: Why Jenkins Maven build failed due to HTTP Basic Authentication?
answer count: 1
has answer: http://stackoverflow.com/a/27118170
has comment: http://stackoverflow.com/comment/42719685

http://stackoverflow.com/q/27014792
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27014966
linked to: http://stackoverflow.com/q/4958913
type: Question
answer count: 2
downvote count: 0
tagged with: polymorphism
tagged with: arraylist
favorite count: 0
tagged with: return-type
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27015084
has title: Java arraylist and polymorphism
has body: Recently I find some questions about java. 1 【A】 ArrayList dates = new ArrayList(); dates.add(new Date()); dates.add(new String()); 【B】 ArrayList&lt;Date&gt; dates = new ArrayList&lt;Date&gt;(); dates.add(new Date()); dates.add(new String()); Do these two pieces have compilation errors? I guess there should be something wrong with add(new String()) but can't make sense clearly. I cannot find the mistake in this arraylist, is the return type of dates.get() wrong? ArrayList dates = new ArrayList(); dates.add(new Date()); Date date = dates.get(0); what if I use this (below)? ArrayList&lt;Date&gt; dates = new ArrayList&lt;Date&gt;(); dates.add(new Date()); Date date = dates.get(0); If Student is the subtype of the Person, then which are legal? Person p = new Student(); Student s = new Person(); List&lt;Person&gt; lp = new ArrayList&lt;Student&gt;(); List&lt;Student&gt; ls = new ArrayList&lt;Person&gt;(); I was struggled with these questions for two days so I really need somebody to give me some explanation. thanks in advance
score: 3

http://stackoverflow.com/comment/42760820
type: Comment
type: QuestionComment
has text: Can you please include the complete code that you tried?
score: 1
comment on: http://stackoverflow.com/q/27130978

r.java-file
tags question: http://stackoverflow.com/q/27128636
type: Tag
tags question: http://stackoverflow.com/q/27071539
tag name: r.java-file
tags question: http://stackoverflow.com/q/27046730

http://stackoverflow.com/a/27037460
score: 1
has comment: http://stackoverflow.com/comment/42706686
downvote count: 0
has comment: http://stackoverflow.com/comment/42707674
has body: maybe this code helps. It will compute fibonacci numbers using a fork-join pool. With fork-join we can recursively subdivide a problem and combine the results of each recursion level. Threoretically, we could recurse down to fib(0) in the fork-join pool, but this would be inefficient. Therefore, we introduce a recursion limit where we stop subdividing the task and compute the rest in the current task. This code will record the time taken for fib(x) and compute the single-threaded time for each fib(n) for n up to x. For each recursion limit, it will measure how many tasks were created and how long each ran, on average. Usually, the sweet spot is a task sizes above 1µs, but then our simple fibonacci tasks here need almost no memory/cache. For more data-intensive tasks with higher cache pollution, the switch is more expensive and concurrent tasks may pollute shared caches. import java.util.concurrent.*; import java.util.concurrent.atomic.*; public class FibonacciFork extends RecursiveTask&lt;Long&gt; { private static final long serialVersionUID = 1L; public FibonacciFork( long n) { super(); this.n = n; } static ForkJoinPool fjp = new ForkJoinPool( Runtime.getRuntime().availableProcessors()); static long fibonacci0( long n) { if ( n &lt; 2) { return n; } return fibonacci0( n - 1) + fibonacci0( n - 2); } static int rekLimit = 8; private static long stealCount; long n; private long forkCount; private static AtomicLong forks = new AtomicLong( 0); static class Result { long durMS; int rekLimit; } public static void main( String[] args) { int fiboArg = 49; BenchLogger.sysinfo( "Warmup"); long singleNS[] = getSingleThreadNanos( 20, 5e9); BenchLogger.sysinfo( "Warmup complete"); singleNS = getSingleThreadNanos( fiboArg, 1e9); BenchLogger.sysinfo( "Single Thread Times complete"); Result[] results = new Result[ fiboArg + 1]; for ( int rekLimit = 2; rekLimit &lt;= fiboArg; rekLimit++) { results[ rekLimit] = new Result(); runWithRecursionLimit( rekLimit, fiboArg, singleNS[ rekLimi…
type: Answer
answers question: http://stackoverflow.com/q/27036521
upvote count: 1

http://stackoverflow.com/comment/42671031
type: AnswerComment
score: 0
has text: @deng the Client originally only listened for a message from the server after sending its own message. With this change it is always listening for messages and can receive even when it did not send anything.
type: Comment
comment on: http://stackoverflow.com/a/27059128

http://stackoverflow.com/comment/42779536
comment on: http://stackoverflow.com/q/27141032
score: 1
type: Comment
type: QuestionComment
has text: First, don't use `MouseListener`s with `JButton`s. You could create a custom button model which doesn't allow it to be turned off, so, once selected, it's state remains selected (until you reset it), that way you can use the selected/unselected icon properties.

http://stackoverflow.com/q/27146259
possible better answer: http://stackoverflow.com/a/27146331
has answer: http://stackoverflow.com/a/27146331
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27146373
tagged with: android
answer count: 4
type: AnsweredQuestion
tagged with: list
score: 1
tagged with: java
tagged with: multithreading
has title: The final local variable cannot be assigned, since it is defined in an enclosing type java
has comment: http://stackoverflow.com/comment/42788459
upvote count: 1
has comment: http://stackoverflow.com/comment/42788056
linked to: http://stackoverflow.com/q/27249535
type: Question
accepted answer: http://stackoverflow.com/a/27146373
has answer: http://stackoverflow.com/a/27146445
has answer: http://stackoverflow.com/a/27146326
has body: I have created class childList that implements an interface `GetChildList`` like below: package com.example.hakslogin; import java.util.ArrayList; import java.util.List; import com.example.hakslogin.GetChildList; import com.example.hakslogin.HandleJSON; public class childList implements GetChildList { private HandleJSON obj; public String urlString = "http://192.168.x.xx:xxxx/getdb"; public void callFetchJSONChild(){ HandleJSON obj = new HandleJSON(urlString); List&lt;String&gt; list = obj.fetchJSONChild(this); } @Override public void onGetChildList(List&lt;String&gt; list) { // here your work with list //List&lt;String&gt; child = new ArrayList&lt;String&gt;(); obj = new HandleJSON(urlString); list = obj.fetchJSONChild(this); } } I have a method fetchJSONChild() like below: List&lt;String&gt; child = new ArrayList&lt;String&gt;(); public void fetchJSONChild(final GetChildList callBack){ final String[] str = new String[3]; // final List&lt;String&gt; child = new ArrayList&lt;String&gt;(); Thread thread = new Thread(new Runnable(){ @Override public void run() { try { URL url = new URL("http://192.168.x.xx:xxxx/childform_list/0.0.0.0/8069/new_db/admin/123456"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(30000 /* milliseconds */); conn.setConnectTimeout(50000 /* milliseconds */); conn.setRequestMethod("GET"); conn.setRequestProperty("User-Agent", "GYUserAgentAndroid"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoInput(true); conn.setUseCaches (false); // Starts the query if (Build.VERSION.SDK != null &amp;&amp; Build.VERSION.SDK_INT &gt; 13) { conn.setRequestProperty("Connection", "close"); } conn.connect(); System.out.println("Before url.openStream()"); InputStream stream = conn.getInputStream();//.openStream(); System.out.println("After url.openStream()"); String data = convertStreamToString(stream); // for example String data = "1,2,3"; child.addAll(Arrays.asList(data.split(","))); readAndParseJS…
has comment: http://stackoverflow.com/comment/42788622

http://stackoverflow.com/q/27024401
has title: Eclipse IDE Note: This element has no attached source and the Javadoc could not be found in the attached Javadoc
answer count: 1
has answer: http://stackoverflow.com/a/27024635
score: 0
has body: Eclipse IDE Error Message on API method hover. Note: This element has no attached source and the Javadoc could not be found in the attached Javadoc. I know there are many similar posts but I have Googled and browsed on here for over an hour and still the problem persists. Everything seems to be in order but still getting this very annoying message. Please help. Screenshot: http://pbrd.co/14MAeG8
accepted answer: http://stackoverflow.com/a/27024635
type: AnsweredQuestion
tagged with: java
tagged with: javadoc
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/42700267
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27097474
has text: Use `ProcessBuilder` and change the start directory to reflect the location of the file you are trying to execute...
score: 0

http://stackoverflow.com/a/27150365
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27150321
has body: The problem is that with the loop, written like this, you assume that the nested arrays are all of length of 4 (and they are not). You'd better do: for (int i=0; i &lt; array1.length;i++) { for (int j=0; j &lt; array1[i].length;j++) { ... } }
accepted answer of: http://stackoverflow.com/q/27150321

http://stackoverflow.com/comment/42734884
has text: Does your `getPassthruSecInfo()` actually return `null`? Or does it return an empty string, e.g. ""?
score: 0
comment on: http://stackoverflow.com/q/27115952
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42678932
type: QuestionComment
type: Comment
has text: thanks :D, I will try to restructure the code
comment on: http://stackoverflow.com/q/27084821
score: 0

http://stackoverflow.com/a/27168826
accepted answer of: http://stackoverflow.com/q/27109423
has body: Oh - my - god The database value is |CURSOR_LEER |(20 chars) with an underscore while my enum uses a hyphen. How could neither me, my colleague or anybody reading this not see this for so long >.&lt;
answers question: http://stackoverflow.com/q/27109423
has comment: http://stackoverflow.com/comment/42829626
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42738063
type: QuestionComment
has text: Here is one more in SO- http://stackoverflow.com/questions/15274874/how-does-java-string-being-immutable-increase-security
comment on: http://stackoverflow.com/q/27117948
score: 0
type: Comment

http://stackoverflow.com/q/27069055
has answer: http://stackoverflow.com/a/27069213
type: UnansweredQuestion
has body: Basically, I'm wondering if there is a secure equivalent to opening a file and then using Files.setPosixFilesPermissions to "r--------"? Doing it in step creates a window in which the permissions are incorrect, which I would like to avoid.
tagged with: java
type: Question
has title: Open a new file in Java with desired Unix permissions?
has comment: http://stackoverflow.com/comment/42651341
score: 0
answer count: 1

http://stackoverflow.com/comment/42564931
score: 0
comment on: http://stackoverflow.com/q/27020057
has text: By using Runtime.getRuntime().totalMemory() and Runtime.getRuntime().freeMemory()
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27045238
downvote count: 0
score: 2
has body: That's how to do: int drawableResId = getResources().getIdentifier("my_drawable", "drawable", getPackageName()); Bitmap bitmap = BitmapFactory.decodeResource(getActivity().getResources(), drawableResId); You can also do the same with views and strings: int viewResId = getResources().getIdentifier("my_view", "id", getPackageName()); int stringResId = getResources().getIdentifier("my_string", "string", getPackageName());
has comment: http://stackoverflow.com/comment/42610379
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27045104
answers question: http://stackoverflow.com/q/27045104

http://stackoverflow.com/q/27117764
has answer: http://stackoverflow.com/a/27117792
has title: Try , finally execution flow when return is in try block
has body: When try , finally combination is used, in try if there is a return statement.Why is finally block executed first? class Palindrome { public static void main(String args[]) { System.out.println(Palindrome.test()); } public static int test() { try { //return 0; return 100; } finally { System.out.println("finally trumps return."); } } } In the above code please tell me the flow of execution. I know that finally will be executed mandatorily after the try block.But in try block, return staatement will take the control to main class. In that case how will the control come to finally block?
has comment: http://stackoverflow.com/comment/42737794
tagged with: java
has answer: http://stackoverflow.com/a/27118180
upvote count: 1
has comment: http://stackoverflow.com/comment/42737877
tagged with: try-catch
has comment: http://stackoverflow.com/comment/42737709
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/27117831
downvote count: 0
has comment: http://stackoverflow.com/comment/42737889
score: 1
tagged with: finally
favorite count: 0
has answer: http://stackoverflow.com/a/27117795
tagged with: return
type: Question

http://stackoverflow.com/comment/42562688
comment on: http://stackoverflow.com/a/27016556
type: AnswerComment
has text: How exactly are you building the project? How did you create it?
score: 0
type: Comment

http://stackoverflow.com/q/27086324
tagged with: android-edittext
accepted answer: http://stackoverflow.com/a/27088825
has comment: http://stackoverflow.com/comment/42805550
tagged with: java
has title: Put Textview Value Into Editext
has comment: http://stackoverflow.com/comment/42681336
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27086616
score: 0
has answer: http://stackoverflow.com/a/27086616
tagged with: android
tagged with: textview
tagged with: nfc
has body: I'm creating an nfc reader. I followed the tutorial and it work well. The result will show the value in the nfc tag eg; 123456 in a Textview. How can I change the result to put in the Editview? I already try but still, not luck. MainActivity.java package net.vrallev.android.nfc.demo; import java.io.UnsupportedEncodingException; import java.util.Arrays; import android.app.Activity; import android.app.PendingIntent; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter.MalformedMimeTypeException; import android.nfc.NdefMessage; import android.nfc.NdefRecord; import android.nfc.NfcAdapter; import android.nfc.Tag; import android.nfc.tech.Ndef; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.widget.TextView; import android.widget.Toast; /** * Activity for reading data from an NDEF Tag. * * @author Ralf Wondratschek * */ public class MainActivity extends Activity { public static final String MIME_TEXT_PLAIN = "text/plain"; public static final String TAG = "NfcDemo"; private TextView mTextView; private NfcAdapter mNfcAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTextView = (TextView) findViewById(R.id.textView_explanation); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null) { // Stop here, we definitely need NFC Toast.makeText(this, "This device doesn't support NFC.", Toast.LENGTH_LONG).show(); finish(); return; } if (!mNfcAdapter.isEnabled()) { mTextView.setText("NFC is disabled."); } else { mTextView.setText(R.string.explanation); } handleIntent(getIntent()); } @Override protected void onResume() { super.onResume(); /* * It's important, that the activity is in the foreground (resumed). Otherwise * an IllegalStateException is thrown. */ setupForegroundDispatch(this, mNfcAdapter); } @Override protected void onPause() { /* * Call this before onPause, oth…
has answer: http://stackoverflow.com/a/27088825
has comment: http://stackoverflow.com/comment/42681135
type: AnsweredQuestion

http://stackoverflow.com/q/27127634
score: -1
has title: TableModel cannot be cast to javax.swing.table.DefaultTableModel
tagged with: tablemodel
tagged with: abstracttablemodel
tagged with: java
downvote count: 2
upvote count: 1
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/27127719
tagged with: jtable
type: AnsweredQuestion
has body: I want to clear my custom TableModel and get the following exception: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: com.Test.gui.results.ResultTableModel cannot be cast to javax.swing.table.DefaultTableModel I want to clear my model like that: DefaultTableModel model = (DefaultTableModel) resultTable.getModel(); model.setRowCount(0); That is my ResultsTableModel: public class ResultTableModel extends AbstractTableModel { /** * UUID */ private static final long serialVersionUID = -8928042813952799089L; private String[] columnNames = {"Customer", "Test1"}; private List&lt;TestData&gt; resultList = new ArrayList&lt;TestData&gt;(); private TestData rs; public ResultTableModel(List&lt;TestData&gt; resultList){ this.resultList=resultList; } @Override public int getRowCount() { return resultList.size(); } /** * get Value at */ public Object getValueAt(int row, int col) { TestData r = resultList.get(row); switch (col) { case 0: return r.getCustomer(); case 1: return r.getEquity(); case 2: return r.getCyclicalRiskMarketAvg(); case 3: return r.getDscr_1(); case 4: return r.getDscr_2(); case 5: return r.getDscr_3(); case 6: return r.getDscr_4(); case 7: return r.getDscr_5(); case 8: return r.getDscr_6(); case 9: return r.getDscr_7(); case 10: return r.getDscr_8(); case 11: return r.getDscr_9(); case 12: return r.getDscr_10(); case 13: return r.getLtv_1(); case 14: return r.getLtv_2(); case 15: return r.getLtv_3(); case 16: return r.getLtv_4(); case 17: return r.getLtv_5(); case 18: return r.getLtv_6(); case 19: return r.getLtv_7(); case 20: return r.getLtv_8(); case 21: return r.getLtv_9(); case 22: return r.getLtv_10(); default: break; } fireTableDataChanged(); return null; } public void setTestData(TestData rd){ resultList.add(rd); fireTableRowsInserted(resultList.size()-1, resultList.size()-1); } @Override public String getColumnName(int index) { return columnNames[index]; } @Override public int getColumnCount() { return columnNames.length; } /** * @r…
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/27127719

http://stackoverflow.com/q/26994951
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
has body: Is there any annotation available in jersey API to achieve request filtration based on header value? The same is achieved in spring like @RequestMapping(value = "/test", method = RequestMethod.POST, headers = {"version=v1.1"})
tagged with: jersey-client
type: Question
tagged with: jersey
score: 0
answer count: 1
has title: jerssey anotation to filter request based on header value
has answer: http://stackoverflow.com/a/27012644
tagged with: jersey-1.0

http://stackoverflow.com/q/27119446
tagged with: java
answer count: 1
has body: I have imported the musicbrainzws2-java library into my project and I have been reading through the documentation that MusicBrainz has on their web service. It is very confusing though. I was wondering if someone could help me understand how to navigate through the MusicBrainz data base. I don't understand the terminology and my main goal of using the database is to gather the mbid's for various songs. Right now this is what I have. public static void main(String[] args) { ArtistSearchFilterWs2 filter = new ArtistSearchFilterWs2(); filter.setArtistName("Lindsey Stirling"); filter.setLimit((long) 100); filter.setMinScore((long) 0); filter.setOffset((long) 0); ArtistSearchWs2 search = new ArtistSearchWs2(filter); List&lt;ArtistResultWs2&gt; result = search.getFullList(); /* for(ArtistResultWs2 artist : result) { System.out.println(artist.getArtist().getName() + " " + i); i++; if(artist.getArtist().getName() == "Lindsey Stirling") { System.out.println(artist.getArtist().getName() + " " + i); break; } } */ String artistName = result.get(0).getArtist().getName(); System.out.println(artistName); List&lt;ReleaseWs2&gt; releases = result.get(0).getArtist().getReleaseList().getReleases(); System.out.println(releases.size()); for(ReleaseWs2 release : releases) { System.out.println(release.getTitle()); } For some reason it says that there are 0 releases for the artist Lindsey Stirling and on top of that I don't know how to search for a specific song based off of an artist and album
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27145944
has comment: http://stackoverflow.com/comment/42767242
has title: Locating the mbid for various tracks with musicbrainzws2-java
type: Question
linked to: http://stackoverflow.com/q/21805965
tagged with: musicbrainz
score: 0

http://stackoverflow.com/a/27095059
type: Answer
has comment: http://stackoverflow.com/comment/42696675
has comment: http://stackoverflow.com/comment/42696143
has body: Your main issue is that you're not setting a proper delimiter. After initialising the Scanner do inputFile.useDelimiter("\n") to set the delimiter to a line-break - the default is whitespace. You can then read a String using inputFile.next() and an int using inputFile.nextInt() without any problems.
answers question: http://stackoverflow.com/q/27094926
has comment: http://stackoverflow.com/comment/42696269
score: 0
has comment: http://stackoverflow.com/comment/42695931

http://stackoverflow.com/comment/42584639
has text: @chrylis: The question being posed in the linked duplicate is of a different nature than the one being posed here. I don't feel that this is a duplicate question.
type: Comment
comment on: http://stackoverflow.com/q/27031228
score: 0
type: QuestionComment

http://stackoverflow.com/a/26993080
type: Answer
has comment: http://stackoverflow.com/comment/42517148
has comment: http://stackoverflow.com/comment/42517201
has comment: http://stackoverflow.com/comment/42517549
score: 2
answers question: http://stackoverflow.com/q/26993055
has comment: http://stackoverflow.com/comment/42517670
has comment: http://stackoverflow.com/comment/42517799
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26993055
has body: To make a call, private void performDial(String numberString) { if (!numberString.equals("")) { Uri number = Uri.parse("tel:" + numberString); Intent dial = new Intent(Intent.ACTION_CALL, number); startActivity(dial); } } Add this permission into manifest. &lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt; refer this. To show a custom dialer screen,Write a receiver for outgoing call public class OutgoingCallReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent intent) { //this will receive the outgoing call } } add these to Manifest &lt;uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" /&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt; &lt;receiver android:name=.OutgoingCallReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.NEW_OUTGOING_CALL" /&gt; &lt;/intent-filter&gt; To show a view on top of the Dialer app when it launches, use this code inside the broadcast receiver private WindowManager wm; private static LinearLayout ly1; private WindowManager.LayoutParams params1; // onReceive function of the Broadcast Receiver public void onReceive(Context arg0, Intent arg1) { String state = arg1.getStringExtra(TelephonyManager.EXTRA_STATE); // Adds a view on top of the dialer app when it launches. if(state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)){ wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); params1 = new WindowManager.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT | WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSPARENT); params1.height = 75; params1.width = 512; params1.x = 265; params1.y = 400; params1.format = PixelFormat.TRANSLUCENT; ly1 = new LinearLayout(context); ly1.setBackgroundColor(Color.BLACK); ly…
has comment: http://stackoverflow.com/comment/42517161
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42517432
has comment: http://stackoverflow.com/comment/42517084

http://stackoverflow.com/comment/42517799
score: 0
type: Comment
has text: Your last sentence was what I needed to know, that bit to access hardware and dial the number! Thanks
comment on: http://stackoverflow.com/a/26993080
type: AnswerComment

http://stackoverflow.com/comment/42646285
type: QuestionComment
comment on: http://stackoverflow.com/q/27065680
score: 2
has text: @323go i read it. i just dont know how to solve it. you guys are so rude. i just said im new in game devt. geez
type: Comment

http://stackoverflow.com/q/27148735
has comment: http://stackoverflow.com/comment/42792781
type: AnsweredQuestion
has title: Return only CSV files from ftp server
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27149166
accepted answer: http://stackoverflow.com/a/27149166
possible better answer: http://stackoverflow.com/a/39265035
score: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/csv
tagged with: ftp
has body: I have this working method which lists files from a ftp server, but I want to modify it to use it to download only csv files from the server. Here's the method: private static void printFileDetails(FTPFile[] files) { DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (FTPFile file : files) { String details = file.getName(); if (file.isDirectory()) { details = "[" + details + "]"; } details += "\t\t" + file.getSize(); details += "\t\t" + dateFormater.format(file.getTimestamp().getTime()); System.out.println(details); } } This is what I tried: private static ArrayList&lt;String[]&gt; CsvFiles(FTPFile[] files) { // get list of files on given path for (FTPFile file : files) { String details = file.getName(); //String[] CsvFiles; ArrayList&lt;String&gt; CsvFiles = new ArrayList&lt;&gt;(); CsvFiles.add(details); } return CsvFiles[]; } At the return CsvFiles[]; netbeans is showing '.class' expected error, but that's not the only problem, I'm not even sure if the whole method is correct. Any help would be much appreciated.
has answer: http://stackoverflow.com/a/27148880
has answer: http://stackoverflow.com/a/39265035

http://stackoverflow.com/a/55560390
answers question: http://stackoverflow.com/q/27084666
has body: you can test if the request &amp; response working correctly by : PrintWriter writer=response.getWriter(); writer.write("This is my post"); , you must have a html form for submitting a &amp; b values. check there action and methods are correct,or restart the server and try again..
score: 0
type: Answer

http://stackoverflow.com/a/27012061
type: Answer
accepted answer of: http://stackoverflow.com/q/27011874
answers question: http://stackoverflow.com/q/27011874
score: 3
upvote count: 3
has body: You are explicitly requesting a zipped stream: conn.addRequestProperty("Accept-Encoding", "gzip,deflate"); Remove that line to remove the compression. Compression is different from encryption fortunately, it doesn't require you to supply a key.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42550730

http://stackoverflow.com/q/27003026
answer count: 1
has answer: http://stackoverflow.com/a/27616924
has body: I have a native JVMTI agent that I attach with the Java Attach API. The agent basically just runs Agent_OnAttach and then exists. I would like to pass information from the agent to the VM that attached the agent. Even just writing to stdout of the VM that attached the agent would be fine. I'm aware that I could use out of band means like sockets or named pipes but I'm looking for something built in.
score: 0
tagged with: jvmti
tagged with: java-attach-api
has title: JVMTI communicate with attaching vm
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/42590570
has text: see : http://stackoverflow.com/questions/2641111/where-is-android-os-systemproperties
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27034848
score: 1

http://stackoverflow.com/comment/42720900
type: Comment
type: QuestionComment
has text: You might want to take a look at JSON Parsing library like GSON or Jackson2. GSON might be easier for you to implement. This will help you a lot.
comment on: http://stackoverflow.com/q/27108965
score: 0

http://stackoverflow.com/a/27095992
has body: this is the basic solution... you still need to filter the results of getCount for alphabet chars only but that pretty much it public class LetterCounter { public LetterCounter() { hash = new int[255]; for (int i = 0; i &lt; hash.length(); i++) hash[i] = 0; } private int[] hash; public int getCount(char letter) { return hash[(int)letter)]; } public void process(String string) { for (int i = 0; i &lt; string.length(); i++) { hash[(int)string.charAt(i)]++; } } }
answers question: http://stackoverflow.com/q/27095582
score: 0
type: Answer

http://stackoverflow.com/a/27121675
type: Answer
score: 1
upvote count: 1
has body: CursorWindow has 1 row 1 column. and you are accessing column number 1. which doesn't exist. change 1 to become 0. temp_title = (cursor.getString(0));
downvote count: 0
answers question: http://stackoverflow.com/q/27121469

http://stackoverflow.com/comment/42603908
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27041542
type: AnswerComment
has text: Don't doubt - I've tried it. It goes ok on my system and, for example, here: http://ideone.com/

http://stackoverflow.com/comment/42682926
type: Comment
score: 1
type: AnswerComment
has text: The elements don't point to null because they can't, so the sentence about "unless explicitly specified" makes no sense. You can't assign `null` to an int, period.
comment on: http://stackoverflow.com/a/27087412

http://stackoverflow.com/a/27117795
has body: What do you mean by "first"? The finally runs before execution leaves the method. When else should it run? It is, after all, part of the method. But if you have int x = 1; try{ return x; } finally { x = x + 1; } then the method will still return 1. So the return statement does get executed before the finally block in a way (to determine the return value). If the question is why the finally block is executed at all, well, that's what they are for: To "finally" run after the "try" block is done, no matter what. But in try block, return statement will take the control to main class. In that case how will the control come to finally block? How? Well, that's just how the language (and runtime) work. Before control flow is returned to the calling method, the finally block is executed. It technically even has the option to change the return value (by having its own return statement), but that is highly discouraged.
upvote count: 7
has comment: http://stackoverflow.com/comment/42737868
score: 7
has comment: http://stackoverflow.com/comment/42737976
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42737999
has comment: http://stackoverflow.com/comment/42737948
has comment: http://stackoverflow.com/comment/42737938
answers question: http://stackoverflow.com/q/27117764

http://stackoverflow.com/a/27073934
type: Answer
answers question: http://stackoverflow.com/q/27073097
score: 0
has body: RestEasy has the CorsFilter. But since you are using Glassfish, you are most likely using Jersey. Jersey doesn't seem to have any such class we can use. That said, the CorsFilter for RestEasy implements ContainterRequestFilter and ContainerResponseFilter (Note, this is a Jersey 2.x (JAX-RS 2.0) feature). See Filters and Interceptors for more information You can also see the source code for the CorsFilter here at GrepCode. You'll basically want to implements something similar to that class, then register it is as a singleton with the application.

http://stackoverflow.com/a/27091589
has body: /* * It is multi-line comment in Java * */ /** * It is a Javadoc. Can be found above methods and Class definitions. * * */ Here is a excerpt from Wikipedia regarding Javadoc: A Javadoc comment is set off from code by standard multi-line comment tags /* and */. The opening tag (called begin-comment delimiter), has an extra asterisk, as in /**. The first paragraph is a description of the method documented. Following the description are a varying number of descriptive tags, signifying: The parameters of the method (@param) What the method returns (@return) Any exceptions the method may throw (@throws) Other less-common tags such as @see (a "see also" tag) Class level Javadoc Example: /** * @author Firstname Lastname &lt;address @ example.com&gt; * @version 1.6 (current version number of program) * @since 2010-03-31 (the version of the package this class was first added to) */ public class Test { // class body } Method level Javadoc Example: /** * Short one line description. * &lt;p&gt; * Longer description. If there were any, it would be * here. * &lt;p&gt; * And even more explanations to follow in consecutive * paragraphs separated by HTML paragraph breaks. * * @param variable Description text text text. * @return Description text text text. */ public int methodName (...) { // method body with a return statement }
answers question: http://stackoverflow.com/q/27091506
type: AcceptedAnswer
score: 8
accepted answer of: http://stackoverflow.com/q/27091506
type: Answer
downvote count: 0
upvote count: 8

http://stackoverflow.com/a/27012562
type: Answer
answers question: http://stackoverflow.com/q/27012415
has body: I suggest int j = i + 1, also i &lt; words.length - 1 like for (int i = 0; i &lt; words.length - 1; i++) { for (int j = i + 1; j &lt; words.length; j++) { // Nothing changed below this line... int result = words[i].compareTo(words[j]); if (result &gt; 0) { T temp = words[i]; words[i] = words[j]; words[j] = temp; } } }
accepted answer of: http://stackoverflow.com/q/27012415
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/27096062
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42699805
has comment: http://stackoverflow.com/comment/42700377
has comment: http://stackoverflow.com/comment/42700189
has comment: http://stackoverflow.com/comment/42700336
has comment: http://stackoverflow.com/comment/42700050
score: 0
has body: package rizki; import java.io.*; import java.sql.*; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "downloadServlet2", urlPatterns = {"/downloadServlet2"}) public class downloadServlet2 extends HttpServlet { static ResultSet result; static Connection con; static PreparedStatement stat; static Statement st, st2; private static String dataSourceName="odbcMySql"; private static String dbURL="jdbc:odbc:"+dataSourceName; private static String dbUser="root"; private static String dbPass="085219236994"; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { String id=request.getParameter("file_id"); String filePath=""; String fileName=""; String completeFile=""; String sql="select FileName,lokasi from savedFile where id= ?"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection(dbURL,dbUser,dbPass); stat=con.prepareStatement(sql); stat.setString(1, id); result=stat.executeQuery(); if (result.next()) { fileName = result.getString(1); filePath=result.getString(2); } completeFile=filePath+File.separator+fileName; File downloadFile = new File(completeFile); if(downloadFile.exists()){ int length = 0; ServletContext context = getServletContext(); // gets MIME type of the file String mimeType = context.getMimeType(completeFile); if (mimeType == null) { // set to binary type if MIME mapping not found mimeType = "application/octet-stream"; } System.out.println("MIME type: " + mimeType); // modifies response response.setContentType(mimeType); response.setContentLength((int) downloadFile.length()); // forces download String header…
type: Answer
answers question: http://stackoverflow.com/q/27090246
has comment: http://stackoverflow.com/comment/42699940
has comment: http://stackoverflow.com/comment/42700123

http://stackoverflow.com/comment/42563449
type: AnswerComment
comment on: http://stackoverflow.com/a/27019287
type: Comment
score: 2
has text: So there's this thing called Google....

http://stackoverflow.com/comment/42892163
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27091151
has text: Noway! It gives me java.lang.IllegalStateException: Could not execute method of the activity :( with both (Dir and Dirs)...

http://stackoverflow.com/q/27098665
score: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27099755
type: Question
has answer: http://stackoverflow.com/a/45676068
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27099755
has body: I have to configure two database on same project by configuring two CFG file, I tried but it is always use the first configuration file, May i know how can i use two database on same project
possible better answer: http://stackoverflow.com/a/45676068
answer count: 2
has title: How to configure two database in Hibernate

http://stackoverflow.com/a/27043265
has body: You asked: "I want to know if there is a better way of doing this". There is a better way. You should consider creating a class called Record that contains the data (name, last name, job, and ID), and create an ArrayList. Then, instead of using index locations (and potentially grab the wrong data item), you could use the Record getter methods to get the data item you need (and perhaps store it in a different list). Step 1: Create a Record class: public class Record { private String firstName; private String lastName; private String job; private String id; // TODO add constructor(s), getters and setters } Step 2: Create a list of Records (this is an better alternative that create a list having the information in different index locations. That way, each set of name, last name, job, and ID will be self-contained which is way better than disjointed in different index locations in a list. ArrayList<Record> records = new ArrayList<Record>(); Step 3: Instead of using index locations (and potentially grab the wrong data item), you could use the Record getter methods to get the data item you need (and perhaps store it in a different list). ArrayList<String> names = new ArrayList<String>(); ArrayList<String> jobs = new ArrayList<String>(); ... names.add(records.getLastName() + ", " + records.getFirstName()); jobs.add(records.getJob()); Alternatively, and maybe a better solution, you could use a Map to store this information. For example, a job ID could be the key in a Map that returns a job description and who has been assigned to perform it. Job IDs have to be unique. Adding IDs to a list can be duplicated, because the List interface doesn't restrict entering duplicate data. If you use a Map, they keys are guaranteed to be unique. The value being returned from the Map could be a Record object (or some other kind) that contains the name of the person and the job the person is responsible for. Since values can be duplicates, you can have a person performing multiple jobs, whi…
type: Answer
answers question: http://stackoverflow.com/q/27042301
score: 0
accepted answer of: http://stackoverflow.com/q/27042301
type: AcceptedAnswer

http://stackoverflow.com/a/27099230
downvote count: 0
type: Answer
has body: To make Netbeans tab for 4 spaces: press "Tools" -> "Options" -> "Editor" -> "Formatting". There should be a text field "Tab size" to set the tabbing size (see image bellow).
has comment: http://stackoverflow.com/comment/118020119
upvote count: 5
answers question: http://stackoverflow.com/q/27084443
score: 5

http://stackoverflow.com/q/27122300
tagged with: java
linked to: http://stackoverflow.com/q/1250643
type: Question
has comment: http://stackoverflow.com/comment/42746871
has answer: http://stackoverflow.com/a/27122716
has answer: http://stackoverflow.com/a/27122650
score: 0
has comment: http://stackoverflow.com/comment/42745824
has title: Producer Consumer Main Thread exits while other threads are running
tagged with: executorservice
has answer: http://stackoverflow.com/a/27122493
answer count: 4
has body: My Code snippet: public class ProducerConsumerTest { public static void main(String[] args) { ArrayBlockingQueue&lt;String&gt; sharedQueue = new ArrayBlockingQueue&lt;String&gt;(20, true); ExecutorService consumerService = Executors.newFixedThreadPool(5); ExecutorService producerService = Executors.newSingleThreadExecutor(); Future future=producerService.submit(new Producer(sharedQueue)); consumerService.execute(new Consumer(sharedQueue)); consumerService.execute(new Consumer(sharedQueue)); consumerService.execute(new Consumer(sharedQueue)); consumerService.execute(new Consumer(sharedQueue)); consumerService.execute(new Consumer(sharedQueue)); } } How to make the main thread wait for other threads ? The problem I am facing is that I don't know the name of the threads created by ExecutorService, that's why I cannot use join(). eg: t1.join() in main().
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42746197
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42745909
has answer: http://stackoverflow.com/a/27122510
has comment: http://stackoverflow.com/comment/42745467
duplicate of: http://stackoverflow.com/q/1250643
tagged with: threadpool

http://stackoverflow.com/comment/42708078
has text: what if hello<tab>world? What if my string contains just a space? Although i wasn't the interviewer there but they certainly look for exception/edge case handling.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27101938
type: Comment

http://stackoverflow.com/comment/42762257
has text: A key is "found" when compare() returns 0. Your compare never returns 0, so no key is ever found to be deleted.
comment on: http://stackoverflow.com/q/27131679
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27020959
tagged with: vector
has answer: http://stackoverflow.com/a/27021257
downvote count: 0
accepted answer: http://stackoverflow.com/a/27021126
has body: I am trying to resize a Vector of ints but when I use setSize, it is setting the capacity of the Vector to something I'm not passing into setSize. I assume I'm not understanding something about the setSize function but I can't for the life of me figure it out. System.out.printf("Capacity now: %d\n", timeline.capacity()); timeline.setSize(5); System.out.printf("Capacity now: %d\n", timeline.capacity()) This bit of code returns: Capacity now: 4 Capacity now: 8 If it matters, the original Vector of ints contains: 0111 Can a Vector size only be doubled? EDIT: Ok, I set every .capacity() to .size() and everything is working smoothly. It worked perfectly with all .capacity() with a different test case so that problem had never even occurred to me.
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/27021169
type: AnsweredQuestion
has title: Vector.setSize and Vector.capacity returning different things
upvote count: 2
has answer: http://stackoverflow.com/a/27021126
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/27021257
answer count: 3

gmail
type: Tag
tags question: http://stackoverflow.com/q/27128478
tags question: http://stackoverflow.com/q/27143877
tag name: gmail

http://stackoverflow.com/a/27112886
has comment: http://stackoverflow.com/comment/42728658
answers question: http://stackoverflow.com/q/27112768
type: Answer
upvote count: 1
downvote count: 1
score: 0
has body: You can use this MessageFormat.format(str, list); where the str=hello {1} welcome to {2}. you are enrolled in {3} and the just pass the values in the list

http://stackoverflow.com/comment/42734491
type: Comment
type: QuestionComment
has text: @SajanChandran I added the specific class. Again, constructor takes 0 seconds, whereas the line takes 1.5~ seconds. Let me know if you need more information!
comment on: http://stackoverflow.com/q/27102059
score: 0

http://stackoverflow.com/comment/108766327
has text: Yes, I think it is always quicker. Mapping takes time and, btw, is superfluous here. Which doesn't mean there are no faster non-lambda solutions — the creation of the stream needs extra time. Nevertheless, the speed advantage for an accustomed solution in the present example should be of a more homeopathic nature.
type: Comment
comment on: http://stackoverflow.com/a/57254855
score: 0
type: AnswerComment

http://stackoverflow.com/a/27102430
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27102375
answers question: http://stackoverflow.com/q/27102375
type: Answer
score: 1
upvote count: 1
has body: SEVERE: Parse error in application web.xml file at file:/C:/Users/user1/.IntelliJIdea13/system/tomcat/Unnamed_WebApp/conf/web.xml org.xml.sax.SAXParseException; systemId: file:/C:/Users/user1/.IntelliJIdea13/system/tomcat/Unnamed_WebApp/conf/web.xml; lineNumber: 104; columnNumber: 13; Error at (104, 13) : org.apache.catalina.deploy.WebXml addServlet Caused by: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet Go to your WEB-INf/lib and remove catalina.*.jar, then restart your tomcat. or incase of maven project mention its scope as provided provided Note : The solution is generic , please post your web.xml if the issue perists
type: AcceptedAnswer

http://stackoverflow.com/q/27139568
answer count: 3
has answer: http://stackoverflow.com/a/27156790
has body: I'm currently developing a custom ORM framework and utilising ASM to dynamically generate sub classes at runtime. The generation process seems to complete OK, however when I try to instantiate the resulting class I'm getting a "NoClassDefFoundError". The error seems to pertain to the Super class rather then the actual subclass. Here is an excerpt from the subclass generation method: private Class generateProxyClass(Class anEntitySuperClass, List&lt;Field&gt; fieldsToIntercept) throws ClassNotFoundException{ String entitySuperClassName = this.convertToInternalName(anEntitySuperClass.getName()); //String entityProxySubClassName = "com/flux/dynamic/".concat(anEntitySuperClass.getSimpleName()).concat("Proxy"); String entityProxySubClassName = anEntitySuperClass.getSimpleName().concat("Proxy"); ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); cw.visit(V1_6,ACC_PUBLIC+ACC_SUPER,entityProxySubClassName,null,entitySuperClassName,null); cw.visitSource(entityProxySubClassName.concat(".java"),null); //create constructor MethodVisitor mv = cw.visitMethod(ACC_PUBLIC,"&lt;init&gt;","()V",null,null); mv.visitCode(); //have our consturctor initailise its super class. mv.visitVarInsn(ALOAD,0); mv.visitMethodInsn(INVOKESPECIAL,entitySuperClassName,"&lt;init&gt;","()V"); mv.visitInsn(RETURN); mv.visitMaxs(0,0); mv.visitEnd(); this.generateAndAppendProxyAccessorMethods(anEntitySuperClass,fieldsToIntercept, cw); cw.visitEnd(); //at this point our class should be fully generated an include all required fields. next we //convert the class to a byte array and pass it in to our helper method to load an //actual class from the byte array. return this.loadProxyClass(cw.toByteArray(),entityProxySubClassName); } The "loadProxyClass" method called above is a helper method that basically instantiates and calls a custom ClassLoader in order to load the dynamically created class: /**loads the generated proxy class from the provided bytes. */ private Class loadProxyClass(byte[] aGenerated…
tagged with: java
tagged with: instrumentation
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27156790
has answer: http://stackoverflow.com/a/27147745
type: Question
has answer: http://stackoverflow.com/a/27147733
tagged with: java-bytecode-asm
possible better answer: http://stackoverflow.com/a/27147733
has title: Dynamically creating a subclass at runtime
score: 0

http://stackoverflow.com/comment/42601676
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27031120
type: Comment
has text: That does not work..Configuration.addresource does not work as addresource is not static.

http://stackoverflow.com/comment/90224670
score: 3
has text: If you only want to see the SQL statements, use `oracle.jdbc.level = CONFIG` instead. `FINEST` will flood you with lot of messages.
type: AnswerComment
comment on: http://stackoverflow.com/a/40491028
type: Comment

http://stackoverflow.com/comment/42761266
has text: Wow, that helps a lot! Thanks so much, once you point that out it's really obvious.
type: Comment
comment on: http://stackoverflow.com/a/27131060
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42605334
score: 0
type: QuestionComment
has text: Thanks for replying , what i want to do is to make my program make the WINDOS to open all files that .jpeg with my program automatically
type: Comment
comment on: http://stackoverflow.com/q/27042937

http://stackoverflow.com/a/27045418
has comment: http://stackoverflow.com/comment/42610987
has comment: http://stackoverflow.com/comment/42610019
has comment: http://stackoverflow.com/comment/42610800
score: 5
upvote count: 5
has body: In java, \ is an escape character. So: The \\ is actually a single \. And therefore that part of the string reads like this: (\d+), which as per regex definition means "1 or more digits" :)
accepted answer of: http://stackoverflow.com/q/27045393
answers question: http://stackoverflow.com/q/27045393
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42610591
type: Answer
has comment: http://stackoverflow.com/comment/42609608
has comment: http://stackoverflow.com/comment/42609929
has comment: http://stackoverflow.com/comment/42611299

http://stackoverflow.com/a/27023456
score: 0
answers question: http://stackoverflow.com/q/27023222
has comment: http://stackoverflow.com/comment/42571347
has comment: http://stackoverflow.com/comment/42571253
type: Answer
has comment: http://stackoverflow.com/comment/42571661
has comment: http://stackoverflow.com/comment/42571392
has body: Open your command terminal and run /usr/libexec/java_home The output from that command is where you should set eclipse's JRE_HOME. Example output /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

http://stackoverflow.com/q/27129203
type: UnansweredQuestion
tagged with: e4
has title: Maven dependencies in p2 project
has comment: http://stackoverflow.com/comment/42938097
tagged with: maven
has answer: http://stackoverflow.com/a/27797735
type: Question
has answer: http://stackoverflow.com/a/27129490
has body: Let's consider the following projects: Project1: uses Eclipse P2 Target Definition for dependencies Project2: uses Maven repositories for dependencies The problem: project1 requires a dependency which is present in project2 which comes from a Maven repository (and is not available in p2). My workaround up to now is that I am exporting project2 as a jar with dependencies. Then, I add this jar to project1 and can access the dependency from there. How could I do this in a better way?
tagged with: java
tagged with: p2
tagged with: rcp
score: 0
answer count: 2

http://stackoverflow.com/a/27135579
type: Answer
has comment: http://stackoverflow.com/comment/42775313
answers question: http://stackoverflow.com/q/27135226
score: 0
has comment: http://stackoverflow.com/comment/42772867
has comment: http://stackoverflow.com/comment/42773134
has comment: http://stackoverflow.com/comment/42773389
has body: There's a few ways to handle this. ArrayList You can declare a final ArrayList to keep track of the students. This allows you to keep track of individual students as they get deleted. The downside is that you can't undo a delete, so you'd have to clear the array and reset the model or it would not represent the database properly. final ArrayList&lt;Student&gt; list = new ArrayList&lt;Student&gt;(); removeItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int row = table.getSelectedRow(); if(studentTableListener != null) { Student student = new Student(); student.setName(studentTableModel.getValueAt(...)); //get the values from the row and fill a Student object list.add(student); studentTableListener.rowDeleted(row); studentTableModel.fireTableRowsDeleted(row, row); } } }); Then, you could iterate through the list whenever you propagate to the database. for(Student s : list) { //do call to delete s from database } And afterwards, clear the list. list.clear(); Undo Events A tutorial can be found here for how to implement an undoable JTable, which is more complex. This would allow you to roll back deletes and changes. I don't have the specific code related to this (it's significantly larger, but supports the JTable much better). However, you'd basically create your own UndoAction for row deletes, and have it store the row being deleted. Whenever you do a delete, you'd store a RowDeleteUndo event that stores an array of all the values you deleted. You can then override the toString() method or create a new method to get all the values out in a Student object. Then, when you commit, you take the stack from the undo tree and iterate through it backwards (it's last-in-first-out by default) and commit in that order if you want to mirror the user's operations.
has comment: http://stackoverflow.com/comment/42774289
has comment: http://stackoverflow.com/comment/42774190

http://stackoverflow.com/q/27117522
has body: Hi i want my method to search for a book via an id and return the title, the method works perfectly when i printLn but i need it to be returned instead i am getting an error : incompatible types unexpected return value, what do i need to do ? EDit i have now changed the void to string however i am still getting an error : missing return value Thanks in advance. public void returnByBookID(int enterBookId) { Iterator&lt;Book&gt; it = books.iterator(); while(it.hasNext()) { Book books = it.next(); if(books.idNumber == (enterBookId)){ return books.title ; } } }
tagged with: bluej
possible better answer: http://stackoverflow.com/a/27117542
has answer: http://stackoverflow.com/a/27117542
favorite count: 0
tagged with: return
upvote count: 1
has title: Beginners Java Blue J returning a String in a method
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27117600
tagged with: methods
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27117600
downvote count: 0

http://stackoverflow.com/comment/42687999
type: QuestionComment
comment on: http://stackoverflow.com/q/27084579
has text: @Strobes The new code may run into a deadlock, see the edit to my answer for a way to prevent this
score: 0
type: Comment

http://stackoverflow.com/comment/42686447
score: 0
comment on: http://stackoverflow.com/q/27089165
type: Comment
type: QuestionComment
has text: I change to gmail and all works. Thanks.

http://stackoverflow.com/q/27124931
tagged with: java-8
tagged with: aes
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42750156
downvote count: 0
tagged with: java
has body: We instantiate the cipher with the following statement: Cipher cipher = Cipher.getInstance("AES"); SecretKeySpec key = new SecretKeySpec(cipherKey, "AES"); This works in java 7 (1.7_45) but no longer works in Java 8 (1.8_25). We pass the cipher to a CipherInputStream and use the streams to read/write data. The actual exception occurs during close. EDIT: A quick look at the JDK code shows that the BadPaddingException is rethrown and in 7 it was ignored: JDK 7: CipherInputStream.close: try { this.cipher.doFinal(); } catch (BadPaddingException var2) { ; } catch (IllegalBlockSizeException var3) { ; } JDK 8: CipherInputStream.close: try { if(!this.done) { this.cipher.doFinal(); } } catch (IllegalBlockSizeException | BadPaddingException var2) { if(this.read) { throw new IOException(var2); } } The question is how to avoid a BadPaddingException in the first place? EDIT 2: After doing some research and experimentation we came to the following test program: public final class CipherSpike2 { private static final byte[] SECRET_KEY = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; public static void main(String[] args) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IOException { encryptDecrypt(511); encryptDecrypt(512); } private static void encryptDecrypt(int i) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IOException { byte[] clearText = generateClearText(i); System.out.println("Clear text length: " + clearText.length); ByteArrayOutputStream bos = new ByteArrayOutputStream(); CipherOutputStream cos = new CipherOutputStream(bos, getCipher(Cipher.ENCRYPT_MODE)); cos.write(clearText); cos.close(); final byte[] content = bos.toByteArray(); System.out.println("written bytes: " + content.length); CipherInputStream inputStream = new CipherInputStream(new ByteArrayInputStream(content), getCipher(Cipher.DECRYPT_MODE)); inputStream.read(); inputStream.close(); } private static byte[] generateClearText(int…
has comment: http://stackoverflow.com/comment/42749977
has comment: http://stackoverflow.com/comment/42786116
type: Question
has answer: http://stackoverflow.com/a/29681521
accepted answer: http://stackoverflow.com/a/29681521
score: 10
has comment: http://stackoverflow.com/comment/42761545
answer count: 2
has comment: http://stackoverflow.com/comment/42805024
has comment: http://stackoverflow.com/comment/42777897
has title: Java 7 -> Java 8: AES Causes exception: "BadPaddingException: Given final block not properly padded" in conjunction with BufferedReader & ZipStreams
favorite count: 0
has comment: http://stackoverflow.com/comment/42751257
possible better answer: http://stackoverflow.com/a/27125402
tagged with: encryption
upvote count: 10
has answer: http://stackoverflow.com/a/27125402

http://stackoverflow.com/a/27000384
has comment: http://stackoverflow.com/comment/64408413
score: 24
upvote count: 24
has comment: http://stackoverflow.com/comment/108288112
type: AcceptedAnswer
downvote count: 0
has body: I remembered seeing someone answer this question in the Cassandra user mailing list a short while back, but I cannot find the exact message right now. Ironically, Cassandra Evangelist Rebecca Mills just posted an article that addresses this issue (Things you should be doing when using Cassandra drivers...points #13 and #22). But the answer is "yes" that in some cases, multiple, parallel queries would be faster than using an IN. The underlying reason can be found in the DataStax SELECT documentation. When not to use IN ...Using IN can degrade performance because usually many nodes must be queried. For example, in a single, local data center cluster with 30 nodes, a replication factor of 3, and a consistency level of LOCAL_QUORUM, a single key query goes out to two nodes, but if the query uses the IN condition, the number of nodes being queried are most likely even higher, up to 20 nodes depending on where the keys fall in the token range. So based on that, it would seem that this becomes more of a problem as your cluster gets larger. Therefore, the best way to solve this problem (and not have to use IN at all) would be to rethink your data model for this query. Without knowing too much about your schema, perhaps there are attributes (column values) that are shared by ticket IDs 1, 2, 3, and 4. Maybe using something like level or group (if tickets are for a particular venue) or maybe even an event (id), instead. Basically, while using a unique, high-cardinality identifier to partition your data sounds like a good idea, it actually makes it harder to query your data (in Cassandra) later on. If you could come up with a different column to partition your data on, that would certainly help you in this case. Regardless, creating a new, specific column family (table) to handle queries for those rows is going to be a better approach than using IN or multiple queries.
accepted answer of: http://stackoverflow.com/q/26999098
has comment: http://stackoverflow.com/comment/45531952
answers question: http://stackoverflow.com/q/26999098
type: Answer
has comment: http://stackoverflow.com/comment/108288446
has comment: http://stackoverflow.com/comment/108289889
has comment: http://stackoverflow.com/comment/45531702

http://stackoverflow.com/q/27146593
answer count: 2
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/27147168
has title: JLabel multiline with escape for HTML tags to display
tagged with: java
has body: I want to add multiline label in the panel. jLabelTagInfo = new javax.swing.JLabel(); jLabelTagInfo.setText("Replace the tags with "); But the Label looks like It goes out of Panel. When I use HTML tags in it, the tags are gone: jLabelTagInfo.setText(" Replace the tags with "); How to escape tags so that it will display in JLabel?
downvote count: 0
has answer: http://stackoverflow.com/a/27147109
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: multiline
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27147168
possible better answer: http://stackoverflow.com/a/27147109
tagged with: jlabel
type: Question

http://stackoverflow.com/a/27049306
answers question: http://stackoverflow.com/q/27049144
has body: Since it's a GET, your parameter needs to be in the query string, similar to how you are passing in "text". So at the end of your URL: ?text=somthing&amp;PRICE_EDIT=somethingElse
score: 0
type: Answer

http://stackoverflow.com/q/27080018
score: 1
tagged with: java
has body: I'm trying to install maven on my macbook OS X 10.10. It looked a bit complicated so I've find this step by step tutorial (https://www.youtube.com/watch?v=ghIvOYDs0BM) which looked very easy. The only problem was that: echo $JAVA_HOME didn't show anything although I do have JDK installed. java -version returns java version "1.8.0_25" I tried to set $JAVA_HOME manually but it didn't helped. So I went to the /usr/ or usr/lib/ where java should be located, nothing's here and spotlight even doesn't find "JVM" Can anyone help me how to set $JAVA_HOME correctly? thanks!
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27081107
favorite count: 0
has title: setting $JAVA_HOME and installing JDK
type: AnsweredQuestion
tagged with: java-home
tagged with: maven
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27081107

http://stackoverflow.com/comment/42631296
comment on: http://stackoverflow.com/a/27044073
type: AnswerComment
type: Comment
has text: @DanGetz As I understood the problem the question is: the difference between basic synchronization mechanism provided by OS (PThreads) and the basic synchronization mechanism provided Java.
score: 0

http://stackoverflow.com/comment/42534250
type: Comment
type: QuestionComment
has text: just moved the groovy class to src/main/groovy (no other changes) and still get the exact same error.
score: 0
comment on: http://stackoverflow.com/q/27002084

http://stackoverflow.com/a/27086827
upvote count: 0
score: -1
type: Answer
has body: If you just need a tool that gives you much flexibility in drawing complex graphs, then I see Graphviz is the best option available as it has many features and well-documented. The down side of this is that you need to write the graph files (.dot format) yourself. This isn't difficult and you can even automate it. Assuming you already have installed Graphviz and dot command located in /usr/local/bin/dot, then you can simply run this within your java program String dot="digraph{ a-&gt;b b-&gt;c a-&gt;c }"; BufferedWriter br=new BufferedWriter(new FileWriter("test.dot")); br.write(dot); br.flush(); br.close(); Runtime.getRuntime().exec("/usr/local/bin/dot -Tpdf test.dot -o dotTest.pdf" ); This will output pdf file. Other formats are also possible (i.e. gif, png ..etc).
answers question: http://stackoverflow.com/q/27081494
downvote count: 1

http://stackoverflow.com/comment/42832782
has text: am i suppose to import anything???? it says it cannot resolve "namefield" etc....
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27155343

http://stackoverflow.com/comment/42629632
has text: ou should provide more details, for example - at least the RTSP session commands before the error occurs (DESCRIBE, SETUP?). Are you sure the track is available, since you have pasted only the response, not the request.
comment on: http://stackoverflow.com/q/27055077
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27026107
has comment: http://stackoverflow.com/comment/42575486
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/27026839
possible better answer: http://stackoverflow.com/a/27026162
has comment: http://stackoverflow.com/comment/42575563
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42575720
has comment: http://stackoverflow.com/comment/42575501
score: 0
tagged with: java
tagged with: filewriter
tagged with: file
tagged with: printwriter
upvote count: 1
downvote count: 1
has title: PrintWriter appending lines after every execution (Not refreshing the file)
has comment: http://stackoverflow.com/comment/42575679
type: Question
has comment: http://stackoverflow.com/comment/42575442
has comment: http://stackoverflow.com/comment/42576416
has comment: http://stackoverflow.com/comment/42575616
accepted answer: http://stackoverflow.com/a/27026839
has comment: http://stackoverflow.com/comment/42575939
has body: I am pretty new to java, I am writing data to a file. My code looks like this: File file= new File("model/file.csv"); FileOutputStream writer=null; try { writer = new FileOutputStream(file, true); } catch (IOException e) { e.printStackTrace(); } PrintWriter pw=null; pw = new PrintWriter(writer); try { for (int j=0;j&lt; 24; j++) pw.format("%.3f%n",MyData); } finally { pw.close(); } Output: 1 2 3 4 But when I run the program for the second time my output file looks like this: Output: 1 2 3 4 1 2 3 4 Ok I figured that writer = new FileOutputStream(file, true); means that it appends, but I want the file to be refreshed and not contain data from the previous program execution. And also flush doesn't help.
has comment: http://stackoverflow.com/comment/42575657
answer count: 2
has comment: http://stackoverflow.com/comment/42575797
has comment: http://stackoverflow.com/comment/42576805
has comment: http://stackoverflow.com/comment/42576060
favorite count: 0
has answer: http://stackoverflow.com/a/27026162

http://stackoverflow.com/q/27144581
has title: Is accessing a local variable is much more efficient than accessing a field in ART?
tagged with: java
type: Question
tagged with: android-runtime
has comment: http://stackoverflow.com/comment/42786638
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
has body: I've read this here: Accessing a local variable is much more efficient than accessing a field in the Dalvik VM And Android has used ART since the 4.4 release. Is accessing a local variable since 4.4 much more efficient than accessing a field in ART?
answer count: 0

http://stackoverflow.com/comment/42521371
comment on: http://stackoverflow.com/a/26995386
type: AnswerComment
has text: private DynUnitSplinerenderer localXYLineAndShapeRenderer = new DynUnitSplinerenderer(50) { @Override public void setCurrentSeriesUnit(int series, String unit) { super.setCurrentSeriesUnit(series, unit); //To change body of generated methods, choose Tools | Templates. _updateCurveUnitWhenRendererUnitChanged(); } };
score: 0
type: Comment

http://stackoverflow.com/a/27123251
has comment: http://stackoverflow.com/comment/42747109
has comment: http://stackoverflow.com/comment/42747168
has body: Returning true in that last line of yours might solve your problem. Returning false means that the onTouch has been used completely and won't entertain any further touch events
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27123211

http://stackoverflow.com/a/27080128
has comment: http://stackoverflow.com/comment/42683741
has comment: http://stackoverflow.com/comment/42715558
downvote count: 0
has comment: http://stackoverflow.com/comment/42670803
has comment: http://stackoverflow.com/comment/42813300
has body: There are two parts to this. First, you need to import the jar. This can be done at runtime using a slight hack with reflection: import java.io.File; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; public void importJar(File file) { Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); addURL.setAccessible(True); addURL.invoke(URLClassLoader.getSystemClassLoader(), new Object[] {file.toURI().toURL()}); } Now you can import a jar at runtime. If you simply have the path to the jar, you can easily convert it to a File: importJar(new File("path/to/jar")); Second, you need to find the classes defined in your jar. There does not appear to be a built-in way to do this, so you'll have to manually examine the jar itself for classes. import java.lang.Class; import java.util.ArrayList; import java.util.Enumeration; import java.util.jar.JarFile; import java.util.jar.JarEntry; public List&lt;Class&lt;?&gt;&gt; findJarClasses(File file) { ArrayList&lt;Class&lt;?&gt;&gt; classes = new ArrayList&lt;Class&lt;?&gt;&gt;(); JarFile jar = new JarFile(file); Enumeration&lt;JarEntry&gt; entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String name = entry.getName(); if (name.endsWith(".class")) { name = name.substring(0, name.lastIndexOf('.')); Class&lt;?&gt; cls = Class.forName(name); classes.add(cls); } } return classes; } Finally, you can iterate over the classes to determine if any of them implement your desired interface. File jarFile = new File("path/to/Games.jar"); importJar(jarFile); List&lt;Class&lt;?&gt;&gt; classes = findJarClasses(jarFile); for (Class&lt;?&gt; cls : classes) { if (cls.isInstance(YourInterface.class)) { // Instantiate class. YearInterface obj = (YourInterface)cls.newInstance(); // Call `loaded()` method. obj.loaded(); } }
answers question: http://stackoverflow.com/q/27078224
has comment: http://stackoverflow.com/comment/42807075
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42670405
type: Answer

http://stackoverflow.com/q/27106673
has body: I have a java application, want to close the GUI with confirmation window to close the application for example:- frmViperManufacturingRecord.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frmViperManufacturingRecord.addWindowListener( new WindowAdapter(){ public void windowClosing(WindowEvent e){ JFrame frame = (JFrame)e.getSource(); int result = JOptionPane.showConfirmDialog(frame, "Are you sure you want to close the application?", "Please Confirm",JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }); This is working fine, when I press the window close (x) button, but I want to bring this event to a button to perform the action 'On Click', since I am newbie finding difficulties to bring it inside the 'actionPerformed' So far I have tried the code below and it didn't work... //close window button JButton btnCloseWindow = new JButton("Close Window"); btnCloseWindow.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //frmViperManufacturingRecord.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //frmViperManufacturingRecord.dispose(); //System.exit(0); JFrame frame = (JFrame)e.getSource(); int result = JOptionPane.showConfirmDialog(frame, "Are you sure you want to close the application?", "Please Confirm",JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }); Please give me some directions on this, thanks
type: Question
tagged with: user-interface
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27107146
has answer: http://stackoverflow.com/a/27106789
possible better answer: http://stackoverflow.com/a/27106766
has answer: http://stackoverflow.com/a/27106766
tagged with: swing
has title: On button click, close the application Java GUI
has comment: http://stackoverflow.com/comment/42716730
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42717404
has comment: http://stackoverflow.com/comment/42716812
accepted answer: http://stackoverflow.com/a/27106789

http://stackoverflow.com/q/27052446
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/42624066
type: UnansweredQuestion
tagged with: selenium
has answer: http://stackoverflow.com/a/27053204
tagged with: java
has body: I'm new to automation, and programming, for the most part. I have a test script where I have to verify the presence of certain elements within a page I am testing. At the moment, I have multiple try/catch blocks to test each individual element, but for the sake of code readability, I'd like to have one "helper" method, in which I can call against the various elements. This is what I have so far.... Where would I place this "helper" method? Would it be placed outside of the main method? Ideally, I would like for it to be placed within the same Java class file as my test script. package automationFramework; import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; public class Serp34Check { private static WebDriver driver = null; public static void main(String[] args) { // Create a new instance of the Firefox driver driver = new FirefoxDriver(); //Put a Implicit wait, this means that any search for elements on the page could take the time the implicit wait is set for before throwing exception driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); //Launch the TestURL -- !!! This must be changed prior to adding script to story driver.get("&lt;URL TO TEST&gt;"); //Output list of navigation links found within the page System.out.println("These are the links found within the SERP's Navigation bar:"); WebElement navBar = driver.findElement(By.id("topnav")); List&lt;WebElement&gt; navigationLinks = navBar.findElements(By.tagName("li")); int navLinksListSize = navigationLinks.size(); for(int i=0; i&lt;navLinksListSize; i++) { String sValue = navigationLinks.get(i).getText(); System.out.println(sValue); } //check for pricegrabber feed try { WebElement priceGrabber = driver.findElement(By.xpath("//div[contains(@class, 'pricegrabber_cont_block')]")); if(priceGrabber != null) System.out.println("Pricegrabber feed is Present"); }catch(Exceptio…
type: Question
has title: Selenium/Java:Where does the “helper” method get placed within a test script?

http://stackoverflow.com/a/27054526
type: Answer
answers question: http://stackoverflow.com/q/27054437
score: 0
has body: It is ok to access it but if you are using threading them make sure that multiple threads are not writting at the same time on that variable. In such cases you can use synchronize block for write operation, or you can use locking mechanism. There is also one suggestion on this. make that variable private and use getter and setter to access it to limit the visibility and misuse.

http://stackoverflow.com/q/27113327
has comment: http://stackoverflow.com/comment/42729470
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42729587
has answer: http://stackoverflow.com/a/27114261
score: 0
tagged with: comparator
has comment: http://stackoverflow.com/comment/42729609
has comment: http://stackoverflow.com/comment/42729539
answer count: 1
tagged with: equals
has body: Pre-TL;DR: Need to see if a comparator is an instance of (or equal to) another comparator, even if it is reversed. Hello, I think this problem is very simple but I am just thinking too much into it. I have a program that allows a user to sort lists by different comparators. The user can choose ascending or descending order. Since comparators are by default in ascending order, all I do to achieve descending order is create a new reversed comparator: Comparator newReversedCMP = Collections.reverseOrder(Comparator originalComp) Another part of the program saves the last comparator used so that the user can sort or view the last comparator used. Let's say I have comparators dealing with names and salaries and a method that returns what it deals with, for example: if (lastCMPUsed.equals(new NameComparator()){ return "Name"; } if (lastCMPUsed.equals(new SalaryComparator()){ return "Salary"; } Sorry for the long intro but my issue is that I also want to return "Name" or "Salary" even if it's a reverse of the original Name or Salary comparator. If lastCMPUsed is a reversedOrder CMP, then it does not find them equal. I have tried this but with no success: //lastCMPUsed = Collections.reversedOrder(new NameComparator()); if (lastCMPUsed.equals(Collections.reverseOrder(new NameComparator()) return "Name"; This does not return "Name" and sees them as not equal. My equals method in each comparator is a simple instanceof check. Thanks for reading.
tagged with: reverse
accepted answer: http://stackoverflow.com/a/27114261
type: AnsweredQuestion
has title: How to check equality of reversed comparator and original?

http://stackoverflow.com/q/27083821
duplicate of: http://stackoverflow.com/q/212321
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27083842
has body: Is there a convenient way of subtracting different units of time using the Calendar class? I am making a timer that counts down for multiple hours and prints the time to the console in hours, minutes, and seconds. I don't want to use any libraries such as Joda Time in this program. I also want to use the Calendar class, and not the Date class, unless it is too difficult. This is my current code and it only prints the remaining time in seconds: import java.awt.*; import java.util.*; public class ClickWhen { public static void main(String[] args) throws AWTException { int minGoal = 30; int hourGoal = 6+12; Calendar time = Calendar.getInstance(); int minute = time.get(Calendar.MINUTE); int hour = time.get(Calendar.HOUR_OF_DAY); int second = time.get(Calendar.SECOND); int sRemaining = (minGoal*60+hourGoal*3600)-(second+minute*60+hour*3600); boolean isGoing = true; Robot r = new Robot(); while(isGoing) { r.delay(1000); time = Calendar.getInstance(); minute = time.get(Calendar.MINUTE); hour = time.get(Calendar.HOUR_OF_DAY); second = time.get(Calendar.SECOND); if(hour &gt;= hourGoal &amp;&amp; minute &gt;= minGoal) { // do something isGoing = false; } if(hour &gt;= 12) { System.out.println(hour-12+":"+minute+":"+second+" P.M."); } if(hour &lt; 12) { System.out.println(hour+":"+minute+":"+second+" A.M."); } sRemaining--; System.out.println("Seconds Remaining: "+sRemaining); } } } This is my first question on Stack Overflow, so how did I do?
upvote count: 1
tagged with: calendar
type: Question
accepted answer: http://stackoverflow.com/a/27083842
has title: How do you subtract different units of time using Calendar
answer count: 1
downvote count: 0
favorite count: 0
tagged with: timer
tagged with: time
linked to: http://stackoverflow.com/q/212321
tagged with: subtraction
type: AnsweredQuestion

http://stackoverflow.com/a/27074532
answers question: http://stackoverflow.com/q/27074474
has comment: http://stackoverflow.com/comment/42660732
has body: There is no such operator in Java. The closest thing I can think of, that Java supports, is Yoda conditions which would allow you to check for a value against a constant like if ("test".equals(str)) instead of if (str != null &amp;&amp; str.equals("test"))
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42660829
type: Answer
has comment: http://stackoverflow.com/comment/42661050
upvote count: 1

http://stackoverflow.com/comment/42790535
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27147490
has text: My project dynamic web project in eclipse inside the WebContent folder i kept index.html file
score: 0

http://stackoverflow.com/q/27128957
has comment: http://stackoverflow.com/comment/42758092
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42757167
has comment: http://stackoverflow.com/comment/42836878
has comment: http://stackoverflow.com/comment/42765733
has comment: http://stackoverflow.com/comment/42758230
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42757182
has comment: http://stackoverflow.com/comment/42757833
has body: I have a class which has this property: byte[] image; It also has a getter and setter which I believe are properly implemented: public byte[] getImage(){ return image; } public void setImage(byte[] image){ this.image = image; } However I still get the following error message after building and deploying: Invalid property 'image' of bean class [com.winstant.boma2.formdata.content.CarouselFormData]: Bean property 'image' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? STACK TRACE: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.springframework.beans.NotReadablePropertyException: Invalid property 'image' of bean class [com.winstant.boma2.formdata.content.CarouselFormData]: Bean property 'image' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.WEB_002dINF.views.content.add_002dcarousel_jsp._jspService(add_002dcarousel_jsp.java:221) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992) org.sprin…
has comment: http://stackoverflow.com/comment/42757511
type: Question
has title: java byte[] type property not readable or has an invalid getter method
tagged with: getter
score: 0
tagged with: byte

http://stackoverflow.com/q/27047321
type: Question
linked to: http://stackoverflow.com/q/9310927
has comment: http://stackoverflow.com/comment/42614586
has comment: http://stackoverflow.com/comment/42617185
score: 5
has comment: http://stackoverflow.com/comment/42870567
has comment: http://stackoverflow.com/comment/42960088
has comment: http://stackoverflow.com/comment/42613240
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/42885050
has body: We have an annotation on a function as follows public class AnInterfaceImpl implements AnInterface { @FairThreadUsageByEntity(entityName = "XYXYXYX", numberOfThreads = 1) public Report getReport(final String One, final String Two) { //implementation. } } public interface AnInterface { String BEAN_NAME = "AnInterface"; //used for injection in spring. Report getReport(final String One, final String two); } Spring configuration: &lt;aop:aspectj-autoproxy /&gt; &lt;bean class="com.amazon.utils.fairthreadusage.aspect.FairThreadUsageByEntityAdvice" /&gt; The annotation is implemented as an aspect. Basic functionality is to limit the number of thread used by a particular type of functionality, let us say download. Below is the code for annotation FairThreadUsageByEntity: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface FairThreadUsageByEntity { public String entityName(); public int numberOfThreads(); } @Aspect public class FairThreadUsageByEntityAdvice extends FairThreadUsageBase { @Around("@annotation(fairUsage)") public Object fairThreadUsageByEntity(final ProceedingJoinPoint pjp, final FairThreadUsageByEntity fairUsage) throws Throwable { //Implementation } } The annotation does not work somehow. I am using AspectJWeaver 1.7 and java 1.7. Let me know if anything else is needed. Any help appreciated. EDIT: Adding controller as well which call getReport function public class ReportDownloadRootController extends BaseRootController { public static final String REQUEST_MAPPING_REPORT_DOWNLOAD = "/hz/inventory/addproducts/status/report"; public static final String PARAM_REFERENCE_ID = "reference_id"; private AnInterface anInterface; @RequestMapping(REQUEST_MAPPING_REPORT_DOWNLOAD) public void execute(@RequestParam(value = PARAM_REFERENCE_ID, required = true) final String referenceId, final HttpServletRequest request, final HttpServletResponse response) { try { Report report = AnInterface.getReport(referenceId, getContext().getMerchantId()); /…
has comment: http://stackoverflow.com/comment/42905990
tagged with: aspectj
has comment: http://stackoverflow.com/comment/42885142
has answer: http://stackoverflow.com/a/27207127
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42883629
has comment: http://stackoverflow.com/comment/42615265
favorite count: 0
has comment: http://stackoverflow.com/comment/42957621
tagged with: spring-aop
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/42617299
has title: Aspects not getting executed
has comment: http://stackoverflow.com/comment/42613284
has comment: http://stackoverflow.com/comment/42887458
has comment: http://stackoverflow.com/comment/42883655

http://stackoverflow.com/a/27093526
has comment: http://stackoverflow.com/comment/42692841
has body: Yes, it's possible. For example (you'd have to tailor it depending on the exact result you want to achieve) public static String[][] convertTo2D( String[] arr, int x, int y ) { //if ( arr.length != x * y ) throw new IllegalArgumentException(); String[][] ret = new String[x][y]; for( int i_x = 0, i = 0; i_x &lt; x; i_x++ ) for( int i_y = 0; i_y &lt; y; i_y++, i++ ) { //if ( i &gt;= arr.length ) return ret; ret[i_x][i_y] = arr[i]; } return ret; }
score: 0
answers question: http://stackoverflow.com/q/27093386
type: Answer

http://stackoverflow.com/a/45781976
has body: I tweaked the studio.vmoptions file when I followed a method in making it run faster and it stopped working showing the same JDK error.. I did most of the fix mentioned above and none worked for me. What worked for me though was deleting the studio.vmoptions file and everything was great again.
answers question: http://stackoverflow.com/q/27082189
type: Answer
score: 0

http://stackoverflow.com/comment/42692205
comment on: http://stackoverflow.com/q/27082966
type: QuestionComment
type: Comment
score: 1
has text: Thank you guys, the idea of bubbleSort was ideal. I did some changes in my code. Applied your idea and it seems it works!

http://stackoverflow.com/comment/42543661
comment on: http://stackoverflow.com/q/27007421
score: 0
type: Comment
type: QuestionComment
has text: @ElliottFrisch I'm not sure of your question, but iVal is the variable that holds the user input from 1-8.

http://stackoverflow.com/q/27119618
has body: I used Jackson to serialize a Map&lt;Class&lt;?&gt;, BaseClass&gt;. There are multiple subclasses of BaseClass, and each one is properly annotated to be serialized/deserialized by Jackson. Is it possible to invoke ObjectMapper.readValue(file, Subclass.class) and get a Subclass instance back? If so, how do I avoid this exception? com.fasterxml.jackson.databind.JsonMappingException: Can not find a (Map) Key deserializer for type [simple type, class java.lang.Class&lt;java.lang.Object&gt;] at com.fasterxml.jackson.databind.deser.DeserializerCache._handleUnknownKeyDeserializer(DeserializerCache.java:578) at com.fasterxml.jackson.databind.deser.DeserializerCache.findKeyDeserializer(DeserializerCache.java:168) at com.fasterxml.jackson.databind.DeserializationContext.findKeyDeserializer(DeserializationContext.java:404) at com.fasterxml.jackson.databind.deser.std.MapDeserializer.createContextual(MapDeserializer.java:231) at com.fasterxml.jackson.databind.DeserializationContext.handleSecondaryContextualization(DeserializationContext.java:581) at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:369) at com.fasterxml.jackson.databind.deser.std.StdDeserializer.findDeserializer(StdDeserializer.java:842) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:514) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:292) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:241) at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142) at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:381) at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:3154) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3047…
upvote count: 3
tagged with: java
has title: Can not find a (Map) Key deserializer for type [simple type, class java.lang.Class<java.lang.Object>]
type: Question
tagged with: jackson
has answer: http://stackoverflow.com/a/31975476
linked to: http://stackoverflow.com/q/10329706
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/31975476
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/27099486
has title: How to avoid saveOrUpdate on all the columns hibernate
score: 0
has body: Hi i have a class login: public class Login { @Id @GeneratedValue @Column(name = "user_id") private int userId; @Column(name = "user_name", nullable=false ) private String userName; @Column(name = "password", nullable=false ) private String password; @ManyToMany @JoinTable(name = "user_songs_mapping", joinColumns = @JoinColumn(name = " user_id", referencedColumnName = "user_id"), inverseJoinColumns = @JoinColumn(name = "song_id", referencedColumnName = "song_id")) private List&lt;Song&gt; songs; } When I have to add songs to it, I create a Login object and set the List songs,username,password and userId and say session.saveOrUpdate(login).I want only the user_id and song_id to be mapped in the ,mapping table(user_songs_mapping), But what is happening is, every time the password,username are getting updated. How can I avoid this ?
possible better answer: http://stackoverflow.com/a/27099645
has answer: http://stackoverflow.com/a/27099645
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27099640
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
accepted answer: http://stackoverflow.com/a/27099640
answer count: 2

http://stackoverflow.com/q/27093387
tagged with: jakarta-ee
answer count: 2
score: 4
tagged with: glassfish
has title: Can't create glassfish-web.xml in my web project (Glassfish/Netbeans)
has answer: http://stackoverflow.com/a/30128774
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 4
has answer: http://stackoverflow.com/a/27093553
accepted answer: http://stackoverflow.com/a/27093553
type: AnsweredQuestion
tagged with: netbeans
has body: I have a Java project that uses Java EE 7 and Glassfish 4.1 When I add a new Glassfish Descriptor to the project (via the right-click menu), it doesn't give me the ability to change the name of the xml file. It forces it to be sun-web.xml which is an old legacy format. I'm trying to use glassfish-web.xml. How can I make it add the correct file?
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/30128774
type: Question

http://stackoverflow.com/comment/42735066
comment on: http://stackoverflow.com/a/27115945
type: AnswerComment
score: 0
type: Comment
has text: can you please explain more? I just don't know how to use AsyncTask

http://stackoverflow.com/comment/42688330
type: AnswerComment
comment on: http://stackoverflow.com/a/27086122
has text: This is correct. The `Semaphore` must be applied to the shared resource. The `Chopstick` is what is being shared, not the `Philosopher`. Remember, the problem is that two `Philosopher` objects are trying to access the same resource; the `Chopstick`. If you leave it up to each `Philosopher` to decide when it is OK to get the `Chopstick`, each one will most likely be greedy and deny access to it (each `Philosopher` wants to keep on eating). If you let the resource to dictate when it is OK to be used, the problem is resolved.
type: Comment
score: 1

http://stackoverflow.com/q/27140649
downvote count: 0
accepted answer: http://stackoverflow.com/a/27140922
has body: SOLVED this is what I did so far: class triangle { public static void main (String[] args) { System.out.println("Provide three side lengths - 000 to terminate."); int a = In.getInt(); int b = In.getInt(); int c = In.getInt(); String output1 =""; String output2 =""; while(a!=0 &amp;&amp; b!=0 &amp;&amp; c!=0) { int biggest = Math.max(a, Math.max(b,c)); int smallest = Math.min(a, Math.min(b,c)); int middle = 0; if(a!=biggest &amp;&amp; a!=smallest) middle = a; if(b!=biggest &amp;&amp; b!=smallest) middle = b; if(c!=biggest &amp;&amp; c!=smallest) middle = c; if(a==b &amp;&amp; a==c &amp;&amp; b==c) { output1 = "equilateral"; } if((a==b &amp;&amp; a!=c) || (a==c &amp;&amp; a!=b) || (b==c &amp;&amp; b!=a)) { output1 = "isosceles"; } if(a!=b &amp;&amp; a!=c &amp;&amp; b!=c) { output1 = "scalene"; } int angle = (middle*middle) + (smallest*smallest); int angle2 = (biggest*biggest); if(angle == angle2) { output2="right"; } if(angle &gt; angle2) { output2="acute"; } if(angle &lt; angle2) { output2="obtuse"; } System.out.println(output1 + " and " + output2); a = In.getInt(); b = In.getInt(); c = In.getInt(); if(a==0 &amp;&amp; b==0 &amp;&amp; c==0) { System.out.println("Thanks for using the program"); break; } } } } My problem is that when I enter 5,2,5 it should be isosceles and acute but it comes out as isosceles and obtuse, and when I type 5,5,5 it comes out equilateral and right. The only one that works is if I enter 3,5,4 it will come out as scalene and right. I been at this for a while and my math looks correct. Can anyone help?
tagged with: while-loop
favorite count: 0
has answer: http://stackoverflow.com/a/27140922
has answer: http://stackoverflow.com/a/27140703
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: Programming about finding the triangle
answer count: 2
possible better answer: http://stackoverflow.com/a/27140703

http://stackoverflow.com/a/27026846
answers question: http://stackoverflow.com/q/27025766
has body: why don't you just do this: import java.util.*; public class NumDigits { public static void main(String[]args) { int num; Scanner input = new Scanner(System.in); num = input.nextInt(); input.close(); System.out.print(numDigits(num)); } public static int numDigits(int num) { if ((num/10) == 0) {return 1;} else { return 1 + numDigits(num/10); } } } this way the "num/10" is in the recursive method not the main method, and the zero problem is solved.
score: 0
type: Answer

http://stackoverflow.com/a/27140332
score: 1
has comment: http://stackoverflow.com/comment/42778343
upvote count: 1
has body: You can modify your lookbehind assertion as follows. (?&lt;!java:)\b\d+ Live Demo
answers question: http://stackoverflow.com/q/27140250
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42723615
type: Comment
has text: @MichaelGoldstein: My main problem was, that you presented the code as "solution". It's a good way to explain how the Riemann Summs work, but it's not a good code. even just applying an 1/2 weight to both ends improves the estimation quite a bit (Using trapezoids, rather than rectangles).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27096843

http://stackoverflow.com/q/27119140
tagged with: multithreading
has answer: http://stackoverflow.com/a/27120666
has title: loop in service thread doesn't break after client close socket
type: Question
score: 0
answer count: 2
has body: I'm beginner learning socket programming and trying to implement simple Sinatra-like library in Java. The while loop is conditioned on client socket is closed or not while(!this.client.isClosed()), so far it is work responds to minimal request like "GET / HTTP/1.1" until client closed connection and while loop going infinity loop and take all cpu cycle, i also had tried to add additional condition checking availability InputStream of client is return -1 (which mean is closed ?), while(!this.client.isClosed() &amp;&amp; (reader.available() != -1)). WebServer.java public void start(){ try{ while(true){ // accept and add incoming socket connection to client bulks this.clients.put(++requestNumber, this.server.accept()); // service client request in Service thread Service service = new Service(this); service.start(); } } catch(IOException ioe){ System.out.println(ioe.getMessage()); } finally{ // TODO: close server socket here } }// end start Service.java @Override public void run(){ while(!this.client.isClosed()){ System.out.println("read request"); // parse http request this.parser.parse(); String method = this.parser.getMethod(); String path = this.parser.getPath(); String httpVer = this.parser.getHttpVersion(); System.out.println("[METHOD] : "+method); System.out.println("[PATH] : "+path); System.out.println("[HTTP VERSION] : "+httpVer); // match request with specified handler in handlers bulk for(RequestHandler handler:this.server.handlers){ if(handler.getMethod().equals(method)){ if(handler.getPath().equals(path)){ System.out.println("send response\n============="); // serve request handler.handle(this.reader, this.writer); } } }// end for loop // debug only try{Thread.currentThread().sleep(3000);}catch(InterruptedException ie){} }// end while loop // not get executed after client disconnect System.out.println("exit service thread"); // remove client socket in client sockets bulk server.clients.remove(requestId); }// end run HttpParser.java // start HttpParser publi…
has answer: http://stackoverflow.com/a/27119390
type: UnansweredQuestion
tagged with: sockets
tagged with: java

http://stackoverflow.com/comment/42781192
type: Comment
comment on: http://stackoverflow.com/a/27141914
type: AnswerComment
score: 0
has text: where should I initialize hallway? I set currentRoom = hallway. What else do I need to do so currentRoom is not null?

http://stackoverflow.com/a/27014072
upvote count: 1
answers question: http://stackoverflow.com/q/27012774
has body: Should use: SolrQuery parameters = new SolrQuery(); query.setQuery("first_name:qwe2 OR last_name:qwe2"); query.setFields("id","first_name","last_name","email"); QueryResponse response = null; try { response = solrServer.query(parameters); } catch (SolrServerException e) {/* */ } SolrDocumentList list = response.getResults();
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/27127026
has body: There is a no issue about good and bad. You can choose any way from two which is convenient to you. There is a no difference. But i prefer case ONE because there is a no need to remember two different variable names for one thing.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27126658
type: Answer
score: 1

http://stackoverflow.com/q/27132169
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8600972
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42763386
has answer: http://stackoverflow.com/a/27133323
has answer: http://stackoverflow.com/a/38037394
upvote count: 6
has comment: http://stackoverflow.com/comment/42764391
favorite count: 0
has comment: http://stackoverflow.com/comment/42764222
has answer: http://stackoverflow.com/a/27132287
accepted answer: http://stackoverflow.com/a/27132287
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/42764109
possible better answer: http://stackoverflow.com/a/27132376
has answer: http://stackoverflow.com/a/27132376
answer count: 4
downvote count: 0
has body: While running my Java code in Eclipse IDE, I got the error: Exception in thread "D3D Screen Updater" Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space I searched for this error and tried solutions described here and here, but they did not work. I changed these parameters in eclipse.ini: --launcher.XXMaxPermSize 512M -Xms40m -Xmx512m to: --launcher.XXMaxPermSize 1024M -Xms512m -Xmx2048m EDIT: I changed this parameters at Run Configurations: But I still get the same error. Am I missing something?
score: 6
has title: Can't solve "Java heap space" error in eclipse
type: Question

http://stackoverflow.com/a/27795335
has comment: http://stackoverflow.com/comment/71849749
score: 14
answers question: http://stackoverflow.com/q/27151943
has body: You need to create a function which extracts the sorting key from each element. Example from our code final JavaRDD&lt;Something&gt; stage2 = stage1.sortBy( new Function&lt;Something, Long&gt;() { private static final long serialVersionUID = 1L; @Override public Long call( Something value ) throws Exception { return value.getTime(); } }, true, 1 );
has comment: http://stackoverflow.com/comment/46560202
upvote count: 14
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/71540187
has comment: http://stackoverflow.com/comment/67804431
type: Answer
has comment: http://stackoverflow.com/comment/46672419
has comment: http://stackoverflow.com/comment/71497239
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27151943

http://stackoverflow.com/a/36831499
type: Answer
has comment: http://stackoverflow.com/comment/77975179
upvote count: 1
answers question: http://stackoverflow.com/q/27024471
score: 1
has comment: http://stackoverflow.com/comment/74514519
downvote count: 0
has body: got same issue , fixed after I commented the line &lt;setproxy proxyhost="&lt;ip&gt;" proxyport="&lt;port&gt;"/&gt;

http://stackoverflow.com/comment/42628096
has text: The Postgres driver by default, buffers the complete result in memory. You can change that through the JDBC API, but I don't know if you can do that through Hibernate: http://jdbc.postgresql.org/documentation/93/query.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27051866

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/27096163
tags question: http://stackoverflow.com/q/27094306
tags question: http://stackoverflow.com/q/27001501

http://stackoverflow.com/a/48819904
score: 0
type: Answer
has body: //Accept minutes from user and return time in HH:MM:SS format private String convertTime(long time) { String finalTime = ""; long hour = (time%(24*60)) / 60; long minutes = (time%(24*60)) % 60; long seconds = time / (24*3600); finalTime = String.format("%02d:%02d:%02d", TimeUnit.HOURS.toHours(hour) , TimeUnit.MINUTES.toMinutes(minutes), TimeUnit.SECONDS.toSeconds(seconds)); return finalTime; }
answers question: http://stackoverflow.com/q/27060759

http://stackoverflow.com/comment/42591200
type: QuestionComment
comment on: http://stackoverflow.com/q/27034677
has text: it comes back as sdfsdfsdfsdf error (FileNotFOund)
score: 0
type: Comment

sensors
type: Tag
tags question: http://stackoverflow.com/q/27084142
tags question: http://stackoverflow.com/q/27065692
tag name: sensors

http://stackoverflow.com/a/27068509
upvote count: 10
type: AcceptedAnswer
downvote count: 0
score: 10
accepted answer of: http://stackoverflow.com/q/27068467
answers question: http://stackoverflow.com/q/27068467
type: Answer
has body: X is used for ISO 8601 time zone in SimpleDateFormat, not Z Correct format is "yyyy-MM-dd'T'HH:mm:ss.SSSX"
has comment: http://stackoverflow.com/comment/42650218
has comment: http://stackoverflow.com/comment/87617769

http://stackoverflow.com/comment/42573317
comment on: http://stackoverflow.com/q/27024861
type: Comment
type: QuestionComment
score: 1
has text: The connections aren't `close`(d) when you use a pool; they go back to the pool. Eventually (if the connection is unused long enough), the database assumes that connection is bad and closes it. You'll need to look into your pool configuration options for solutions.

http://stackoverflow.com/a/27140894
has body: Ok I figured it out - I ended up using embeddable method instead based on this guys excellent tutorial here He goes through 3 major ways to implement many to many assosiations - a simple junction only table, a junction table (with additional fields) which is the method I needed to implement, and finally a less popular method where the class is mapped as a component.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27125572
answers question: http://stackoverflow.com/q/27125572
type: AcceptedAnswer

http://stackoverflow.com/q/27109768
score: 1
tagged with: java
has title: mockito : mock method call with parameters by reflection
type: Question
has answer: http://stackoverflow.com/a/27118812
tagged with: mockito
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42730646
has comment: http://stackoverflow.com/comment/42722660
accepted answer: http://stackoverflow.com/a/27118812
favorite count: 0
has comment: http://stackoverflow.com/comment/42731567
has body: I'm using mockito and developping with java6 and spring. I'm working on a test API for some developpers and I propose a few methods for mocking objects and methods (it's a legacy code...). Now, I want to replace all this things by mockito but I always propose a test API. So, I developped some methods using mockito. I have an old method with two parameters (String). A first parameter is a mocked service id and its method with parameters. And the second parameter is the returned Object. Example : mockReturnObject("myServiceId.myMethod(String, Integer)", myReturnedObject); Now, I want to use mock, when and thenReturn mockito methods, and I don't see how... Perhaps with reflection but with "when" method it's impossible because mockito need the effective method. How can I do that ? thanks.
upvote count: 1
tagged with: spring
tagged with: unit-testing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42729357
has comment: http://stackoverflow.com/comment/42723288

http://stackoverflow.com/comment/42710116
has text: Thank you very much Bart, you're my hero. :-)
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27090699

http://stackoverflow.com/a/27147046
has body: Depends on the size of the data you are using, however Merge sort is theoretically the quickest on average (from the selection you have given on large unordered data), however you can read more about this here, in the comparison section
has comment: http://stackoverflow.com/comment/42789696
upvote count: 1
has comment: http://stackoverflow.com/comment/42789613
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27146973
type: Answer

http://stackoverflow.com/a/27002065
answers question: http://stackoverflow.com/q/27001824
score: 2
has body: Your way of doing it seems like absolutely ok. But if you saying: "However, this method call tends to take a relatively long time to run" You can have follow problems : Network, connection issue Are you sure that download each file in separate thread? If you are using multithreading for that, be sure that VM args -XmsYYYYM and -XmxYYYYM configured well, because if not you can face problem , that your processor not using all cores. I have faced this problem some time ago.
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/27021434
has answer: http://stackoverflow.com/a/27022600
type: UnansweredQuestion
has title: How to open file with unsupported file extension using Java Code via the Desktop?
has body: I have a program which reads in a file path or URI and launches what ever the file or URI via the Desktop. The problem i'm running in to is unsupported file extensions. The odd thing is the error I get when it fails to open the file isnt what I would expect. The error reads java.io.IOException: Failed to open file:/C:/Users/angel/Desktop/test.test. Error message: Access is denied. at sun.awt.windows.WDesktopPeer.ShellExecute(WDesktopPeer.java:77) at sun.awt.windows.WDesktopPeer.open(WDesktopPeer.java:54) at java.awt.Desktop.open(Desktop.java:272) at desktopopenfile.DesktopOpenFile.openFile(DesktopOpenFile.java:24) at desktopopenfile.DesktopOpenFile.main(DesktopOpenFile.java:15) I would think the error would be more along the lines of file extension unsupported. I can verify the file extension in the other program that feeds the database which this supports but I was wondering if there was a way to allow the user to pick an application to open an unsupported file with. My ideal solution would work similar to when you attempt to open an unsupported file in windows it ask you what program you'd like to use to open it or search the web. I would have been good if I had gotten that option using my code below. The idea is I want to be able to open any file type via a URI or file path. Currently my code works with .pdf, .xml, .pptx, and word files. Any suggestions would be awesome. /** * Checks if a file or URI is included in the message and if so opens it via * the Desktop */ private void checkMessage() { // check to make sure the data model and time model are set if (dataModel == null || timeModel == null) { return; } int selectedIndex = jTable.convertRowIndexToModel(jTable.getSelectedRow()); if (selectedIndex != -1) { IntData intData = dataModel.getData(selectedIndex); IceData iceData = ((IceData) intData); if (iceData != null) { if (iceData.getMessage() != null) { String message = iceData.getMessage(); if (message != null) { if (message.contains("file://")) { String pat…
tagged with: java
type: Question
answer count: 2
score: 0
tagged with: linux
has answer: http://stackoverflow.com/a/27022260
tagged with: windows

http://stackoverflow.com/comment/42697400
comment on: http://stackoverflow.com/q/27095947
type: Comment
type: QuestionComment
has text: *"I have had error after error"* - Like what?
score: 1

http://stackoverflow.com/a/27076571
score: 7
answers question: http://stackoverflow.com/q/27076539
type: Answer
upvote count: 7
downvote count: 0
has body: Silly me! Turns out that it does not like the appended f so removing them (1.0f to 1.0 etc) solved the problem.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27076539

http://stackoverflow.com/q/27103968
tagged with: split
answer count: 1
has body: I need to create a program that is able to detect syntax error in C language programming. Let's say the grammar should be printf("statement"); How could I create an interface that is able to detect if there's any error in the coding? The output should be "Syntax error!Please try again" or "Well done!No syntax error" My teacher advice me to use stringtokenizer. Can anyone help me with this? I dont mind if the user need to space for each input such as: **printf** (space) **("** (space) **statement** (space) **")** (space) **;**
has title: read split input by space enter by user in textfield
has answer: http://stackoverflow.com/a/27104008
tagged with: input
tagged with: space
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42712229
tagged with: java
tagged with: http://stackoverflow.com/tag/c
type: Question
score: 0

http://stackoverflow.com/q/27050275
has body: I have an applet that's only purpose is to create a box and each time it's painted it changes color. Right now it is not changing color at all, it simply creates a random background color to start and sticks with it whenever painted but I need it to change. Any help on what I'm doing wrong would be appreciated. import java.applet.*; import java.awt.*; import java.util.*; public class AppletSubClass2 extends Applet { public void init() { System.err.println("Hello from AnAppletSubClass.init"); setBackground(color); } public void paint(Graphics g) { System.err.println("Hello from .paint!This time the applet will change colors when painted"); setBackground(new Color(randomNum1, randomNum2, randomNum3)); } Random rand = new Random(); int randomNum1 = rand.nextInt(251); int randomNum2 = rand.nextInt(251); int randomNum3 = rand.nextInt(251); Color color = new Color(randomNum1, randomNum2, randomNum3); }
linked to: http://stackoverflow.com/q/6255106
has answer: http://stackoverflow.com/a/27050477
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27051504
has comment: http://stackoverflow.com/comment/42655847
has comment: http://stackoverflow.com/comment/42655981
tagged with: java
has answer: http://stackoverflow.com/a/27050558
has title: Java Applet Changed With Paint
possible better answer: http://stackoverflow.com/a/27050477
type: Question
tagged with: awt
has comment: http://stackoverflow.com/comment/42655607
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27051504
tagged with: applet

http://stackoverflow.com/tag/svg
tags question: http://stackoverflow.com/q/27102131
tags question: http://stackoverflow.com/q/27129894
tags question: http://stackoverflow.com/q/27073621
tag name: svg
tags question: http://stackoverflow.com/q/27111692
tags question: http://stackoverflow.com/q/27046674
type: Tag

http://stackoverflow.com/q/27008137
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42548225
type: AnsweredQuestion
has title: Is it possible to style a java application?
upvote count: 2
has answer: http://stackoverflow.com/a/27009259
has comment: http://stackoverflow.com/comment/42546358
score: 1
tagged with: java
tagged with: look-and-feel
has body: I'm making a java application that is very large and I am going about stupid ways to uneffectively style windows, buttons, inputs, etc. is there a way I could universally adjust the style of all components like making my own look and feel.
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27009259
has comment: http://stackoverflow.com/comment/42544616
has comment: http://stackoverflow.com/comment/42544620

http://stackoverflow.com/q/27141701
answer count: 3
has answer: http://stackoverflow.com/a/27141750
has answer: http://stackoverflow.com/a/27141726
upvote count: 2
has comment: http://stackoverflow.com/comment/42780609
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/13543457
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42780695
has body: Is there a way to use names as indexes in arrays? like ary["name"]="ABCD"; ary["age"]="20"; System.out.println(ary["name"] + " " + ary["age"]);
downvote count: 4
possible better answer: http://stackoverflow.com/a/27141726
score: -2
has answer: http://stackoverflow.com/a/27141736
tagged with: arrays
favorite count: 0
accepted answer: http://stackoverflow.com/a/27141750
has title: Is there a way to use string names as indexes in java arrays?

http://stackoverflow.com/comment/42762653
has text: @ElliottFrisch I had to update the last comment it was vague.
type: Comment
comment on: http://stackoverflow.com/a/27131060
score: 0
type: AnswerComment

http://stackoverflow.com/q/27117159
has answer: http://stackoverflow.com/a/27117680
accepted answer: http://stackoverflow.com/a/27117680
type: AnsweredQuestion
has body: For a school project, I have been working on a Minesweeper game. It is essentially going to be a clone of the game, but right now, when I try to add the action listeners for the JButtons, I get a nullpointerexception. Any help? Here is my code: import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JOptionPane; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.GridLayout; import java.awt.Dimension; import java.util.Random; public class Grid { public static int c, d; //Necessary for the allowance of usage within the listeners from lines 47 - 68. JFrame frame = new JFrame(); public static boolean[][] isBomb; public static int bombProbability; public static JButton[][] grid; Random Bomb = new Random(); public Grid(int width, int length){ bombProbability = (int) Double.parseDouble(JOptionPane.showInputDialog("Input the likeliness of a bomb:")); frame.setLayout(new GridLayout(width, length)); grid = new JButton[width][length]; isBomb = new boolean[width + 2][length + 2]; for(int a = 1; a &lt;= length; a++){ for(int b = 1; b &lt;= width; b++){ grid[a][b] = new JButton(); frame.add(grid[a][b]); if((Bomb.nextInt(99) + 1) &lt;= bombProbability){ isBomb[a][b] = true; grid[a][b].setText(String.valueOf(isBomb[a][b])); //Delete this before final product } } } frame.setTitle("Minesweeper!"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setMinimumSize(new Dimension(500, 500)); frame.pack(); frame.setVisible(true); for(c = 0; c &lt; length; c++){ for(d = 0; d &lt; width; d++){ grid[c][d].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(isBomb[c][d] == true){ JOptionPane.showMessageDialog(null, "BOOM! You're DEAD!"); System.exit(0); } else{ indexCells(c,d); } } }); } } } public static void indexCells(int c,int d){ int[][] nearbyBombs = new int[c+2][d+2]; for (int i = 1; i &lt;= c; i++){ for (int j = …
upvote count: 0
has comment: http://stackoverflow.com/comment/42737017
has comment: http://stackoverflow.com/comment/42847374
tagged with: swing
tagged with: jbutton
type: Question
has comment: http://stackoverflow.com/comment/42737248
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/42736976
score: -2
tagged with: java
downvote count: 2
has title: Null Pointer Exception in Array when adding ActionListener
has comment: http://stackoverflow.com/comment/42736764
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42736651
has comment: http://stackoverflow.com/comment/42737219
has comment: http://stackoverflow.com/comment/42736716
tagged with: nullpointerexception

http://stackoverflow.com/a/27136705
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/27123131
has body: A kind of, but not exactly. String constants are created and interned during constant pool resolution. This happens upon the first execution of LDC bytecode that loads a string literal. After the first execution the JVM replaces JVM_CONSTANT_UnresolvedString constant pool tag with JVM_CONSTANT_String tag so that the next time LDC will take an existing string instead of creating a new one. No. The first use of "Test" will create a new string object. Then new String("Test") will create the second object. Yes, using HotSpot Serviceability Agent. Here is an example.
upvote count: 5

http://stackoverflow.com/a/27118099
answers question: http://stackoverflow.com/q/27117511
score: 0
has comment: http://stackoverflow.com/comment/42775077
has comment: http://stackoverflow.com/comment/42739773
has comment: http://stackoverflow.com/comment/44538392
has body: You might try passing a List&lt;MyComplexObject&gt; instead of an array of them. If that doesn't work, you might try List&lt;List&lt;String&gt;&gt; instead of either.
type: Answer
has comment: http://stackoverflow.com/comment/42739812
has comment: http://stackoverflow.com/comment/44512078

http://stackoverflow.com/comment/42789353
has text: Thanks Pankaj, I got to know this can be handled on portlet level as well. we have to set some tag in portlet.xml or some file I am not sure. Do you have any idea how to avoid such message on portlet mode.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27143007

http://stackoverflow.com/comment/42563722
has text: Maybe you have a bad execution plan for query which includes `r`; if you're on 10g I'd wonder about bind variable peeking, particularly if it's intermittent. Can you check the execution plans for both queries (using the same bind values)?
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27018186

http://stackoverflow.com/q/27026482
tagged with: syntax
tagged with: java
possible better answer: http://stackoverflow.com/a/27026615
has answer: http://stackoverflow.com/a/27026615
type: Question
has body: I am a newbie following the book 'Head First Java', and following one of the projects in the book. I ran into an error on the last line of the main method - "The method checkYourself(String) is undefined for the type String" class dotcom{ int [] Locationcells; int hits = 0; public String checkYourself(String guess){ int guess1 = Integer.parseInt(guess); String result = "miss"; for(int cell : Locationcells){ if(guess1 == cell){ result = "hit"; hits = hits + 1; break; } } if (hits == Locationcells.length){ result = "kill"; } System.out.println(result); return result; } public void setCellLocations(int []locs){ Locationcells = locs; } } public class SimpleDotComGame { public static void main(String[] args) { dotcom dotMan = new dotcom(); int locations [] = {3,4,5}; dotMan.setCellLocations(locations); String userguess = "2"; String result = userguess.checkYourself(userguess); } }
has answer: http://stackoverflow.com/a/27026616
has answer: http://stackoverflow.com/a/27026537
upvote count: 0
has comment: http://stackoverflow.com/comment/42576184
has comment: http://stackoverflow.com/comment/42576179
answer count: 3
score: -2
has title: Getting "The method is undefined for the type String"
favorite count: 0
accepted answer: http://stackoverflow.com/a/27026537
has comment: http://stackoverflow.com/comment/42576213
downvote count: 2
has comment: http://stackoverflow.com/comment/42576135
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42576269

http://stackoverflow.com/comment/42557924
comment on: http://stackoverflow.com/q/27016242
has text: could you share the code which generates the list in the first place? also the list class that you are using
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/42655012
score: 1
comment on: http://stackoverflow.com/q/27070764
has text: There are two different `contains`: The one on Collection (including lists) finds matching (identical) objects; the one on String finds matching substrings.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42544473
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27007993
has text: I'm getting a different compile-time error - there isn't a no-arg constructor for `Wood` so it's blowing up on that.

http://stackoverflow.com/comment/42795723
type: AnswerComment
has text: We will have to start our comments saying "Plus one." instead of +1 :o) @mKorbel
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27149876

http://stackoverflow.com/comment/69841628
comment on: http://stackoverflow.com/q/27026183
has text: @user2938723 Please be gentle enough to accept an answer or update the thread.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27050820
has comment: http://stackoverflow.com/comment/42619395
has answer: http://stackoverflow.com/a/46461889
has title: running hive 0.12 with error of slf4j
tagged with: apache
has body: Logging initialized using configuration in jar:file:/usr/local/hive/lib/hive-common-0.12.0.jar!/hive-log4j.properties SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12- 1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/local/hive/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] hive>
favorite count: 0
accepted answer: http://stackoverflow.com/a/35911574
answer count: 5
has answer: http://stackoverflow.com/a/29333537
has comment: http://stackoverflow.com/comment/42619197
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35911574
downvote count: 0
tagged with: java
upvote count: 8
tagged with: hive
type: Question
possible better answer: http://stackoverflow.com/a/41789082
has answer: http://stackoverflow.com/a/27054604
has answer: http://stackoverflow.com/a/41789082
tagged with: ubuntu-14.04

http://stackoverflow.com/comment/42552680
comment on: http://stackoverflow.com/q/27013103
type: Comment
type: QuestionComment
has text: Why don't you set this values in the JAXB object prior to marshalling?
score: 0

http://stackoverflow.com/comment/42767101
comment on: http://stackoverflow.com/q/27091714
score: 0
type: QuestionComment
type: Comment
has text: The first bark just tells you what the interval will be added to. Example: First bar is at 0, then all the other barks will in the pattern of 4. 0, 4, 8, 12... if the first bark was at 1, then all the barks would be at 5, 9, 13...

http://stackoverflow.com/q/26997893
possible better answer: http://stackoverflow.com/a/26997991
favorite count: 0
has title: Java: time delay
tagged with: timer
answer count: 4
has answer: http://stackoverflow.com/a/26998010
upvote count: 0
has answer: http://stackoverflow.com/a/26997991
tagged with: loops
has body: I'm trying to paint some points on image. Not all at once but one by one with delay few ms? I tried use timer but it only delays only the start of drawing. Here is my code, what is wrong? ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent ae) { try { Scanner in = new Scanner(new File("file.txt")); while (in.hasNext()) { String f = in.nextLine(); String[] tokens = f.split(" "); Map&lt;String,String&gt; map = new HashMap&lt;&gt;(); map.put(tokens[3],tokens[4]); int x=Integer.parseInt(tokens[3]); int y=Integer.parseInt(tokens[4]); Graphics g1 = bg.getGraphics(); g1.drawImage(scaled, x, y, null); g1.dispose(); label.repaint(); } }catch ( FileNotFoundException | NumberFormatException i) { } } }; Timer timer = new Timer(500, listener); timer.start();
has comment: http://stackoverflow.com/comment/42526500
tagged with: graphics
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42526473
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26998018
has comment: http://stackoverflow.com/comment/42526344
type: Question
has answer: http://stackoverflow.com/a/26998105
accepted answer: http://stackoverflow.com/a/26998105
tagged with: user-interface
downvote count: 1

http://stackoverflow.com/comment/42800150
type: QuestionComment
comment on: http://stackoverflow.com/q/27152735
score: 0
has text: @Haeri you're welcome. Why this question doesn't look like SO material is because of what Ted Hopp said: it's not about programming, it's about setting the right program to open a specific file type in [any] OS. You probably also want to narrow it down to each OS or just do the research - plenty of material to look for already there.
type: Comment

http://stackoverflow.com/q/27131272
has comment: http://stackoverflow.com/comment/42764040
has title: How to use a JNI lib, with associated libs, at an arbitrary location?
tagged with: macos
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27131749
tagged with: java-native-interface
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: environment-variables
has answer: http://stackoverflow.com/a/40178478
has body: We have an app that sometimes is installed with an associated app. Both may be installed separately, at different times, and neither is usually in the OS Path environment setting. IF both apps are installed, the one I'm working on needs to use a JNI library from the other app. This library uses a dozen or so other native libs. While I can FIND the JNI lib, I can't seem to find a way to use it without requiring the user to change their system setup. I've found the (hacky) technique to add the JNI lib to the java.library.path, I've been unable to find any way of updating the native Path so the JNI lib can find it's associated libs. The only things that have worked so far are to: Add the folder that the JNI and associated files are in to the OS path before launching our app. Launch our app so the Current Working Directory is the JNI lib folder. Neither of which makes for a hassle-free user experience. So, is there any way for a Java app to modify it's own environment Path so the JNI lib can find it's associated native libs? (currently testing on Win7, will also need to support OS/X)
has comment: http://stackoverflow.com/comment/42762135
linked to: http://stackoverflow.com/q/903530
tagged with: windows

http://stackoverflow.com/q/27078002
tagged with: java
has body: In this video drawing() method is called in main class. When we remove drawing() in the main method it still draws the shape. How can we avoid this situation ? shapes class: import java.awt.*; import javax.swing.*; public class shapes{ public static void main(String[] args){ JFrame frame = new JFrame("Test"); frame.setVisible(true); frame.setSize(400,200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); draw object = new draw(); frame.add(object); object.drawing(); } } Draw class: import java.awt.*; import javax.swing.*; public class draw extends JPanel{ public void drawing(){ repaint(); } public void paintComponent(){ super.paintComponent(g); g.setColor(Color.BLUE); g.fillRect(10,15,100,100); } }
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27078275
tagged with: paintcomponent
tagged with: repaint
type: AnsweredQuestion
tagged with: paint
has title: How to call java paintComponent using repaint
score: 1
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/27078275

http://stackoverflow.com/comment/42652104
score: 0
has text: Iteration on a HashMap is not particularly bad if you also need quick uniqueness checks. I'd say ConcurrentHashMap for the whole collection.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27069566

http://stackoverflow.com/q/27115993
tagged with: java
has comment: http://stackoverflow.com/comment/42735374
has body: I'm building Rest webservice and I would like to have the best performance. I was thinking about using Scala. I read in some sources that it's faster than java. Is there any way to achieve better performance mixing java &amp; Scala, when my project use maven? I found maven-scala-plugin but still don't know what is an influence on performance.
type: Question
has comment: http://stackoverflow.com/comment/42734874
tagged with: performance
has comment: http://stackoverflow.com/comment/42734902
score: -1
has title: Performance of Java combined with Scala project
has comment: http://stackoverflow.com/comment/42734612
answer count: 2
has comment: http://stackoverflow.com/comment/42734609
downvote count: 1
tagged with: maven-3
favorite count: 0
linked to: http://stackoverflow.com/q/27038803
has comment: http://stackoverflow.com/comment/42737691
has answer: http://stackoverflow.com/a/27116626
tagged with: scala
has answer: http://stackoverflow.com/a/27116190
accepted answer: http://stackoverflow.com/a/27116190
possible better answer: http://stackoverflow.com/a/27116626
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42734971
upvote count: 0

http://stackoverflow.com/q/27140383
type: AnsweredQuestion
tagged with: constructor
downvote count: 0
possible better answer: http://stackoverflow.com/a/27140478
has answer: http://stackoverflow.com/a/27140478
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27140511
upvote count: 1
has answer: http://stackoverflow.com/a/27140575
favorite count: 0
has title: Concerning multiple constructors in Java
has answer: http://stackoverflow.com/a/27140530
accepted answer: http://stackoverflow.com/a/27140530
answer count: 4
has body: I have a question about multiple instances of a constructor in Java. My assignment is to receive two fractions and then multiply and divide those fractions. I am unsure as to how to go about having separate values for the instances of the class objects themselves. Here is the sample code of where I am having the issue: import java.util.Scanner; public class TextLab05 { static int num1, den1; // numerator and denominator of the 1st rational number static int num2, den2; // numerator and denominator of the 2nd rational number public static void main (String args[]) { enterData(); Rational r1 = new Rational(num1,den1); Rational r2 = new Rational(num2,den2); } } class Rational { private int firstNum; // entered numerator private int firstDen; // entered denominator private int num; // reduced numerator private int den; // reduced denominator public Rational() { } public Rational(int n, int d) { n = TextLab05.num1; d = TextLab05.den1; //Here specifically is where I am having comprehension issues. How can I include num2 and den2 if I only have int n and int d? } } If this is hard to understand out of context, here is the entire starting code I was given: import java.util.Scanner; public class TextLab05 { static int num1, den1; // numerator and denominator of the 1st rational number static int num2, den2; // numerator and denominator of the 2nd rational number public static void main (String args[]) { enterData(); Rational r1 = new Rational(num1,den1); Rational r2 = new Rational(num2,den2); Rational r3 = new Rational(); r3.multiply(r1,r2); System.out.println("\n\n" + r1.getOriginal() + " * " + r2.getOriginal() + " = " + r3.getRational()); r3.divide(r1,r2); System.out.println("\n" + r1.getOriginal() + " / " + r2.getOriginal() + " = " + r3.getRational()); // 100 Point Version Only // r3.add(r1,r2); // System.out.println("\n" + r1.getOriginal() + " + " + r2.getOriginal() + " = " + r3.getRational()); // r3.subtract(r1,r2); // System.out.println("\n" + r1.getOriginal() + " - " …

http://stackoverflow.com/comment/42651299
score: 0
type: Comment
type: QuestionComment
has text: An `import` statement simply makes it possible for you to use the simple name of a type (or its member), as opposed to the fully qualified type name.
comment on: http://stackoverflow.com/q/27069118

http://stackoverflow.com/comment/42715386
type: Comment
type: QuestionComment
score: 0
has text: read more here: http://xml.silmaril.ie/specials.html
comment on: http://stackoverflow.com/q/27105943

http://stackoverflow.com/comment/42526815
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26996565
has text: Is the weblogic using a different jdk version? and if so is the class part of that jdk's endorsed lib or rt folder?

http://stackoverflow.com/a/27049031
score: 2
has body: You never add MainPanel to the applet itself. i.e., add(MainPanel); Also, since MainPanel uses BorderLayout, you will need to add the subPanels with a BorderLayout.XXX constant. i.e., change this: MainPanel.add(buttonPanel); MainPanel.add(calcPanel); MainPanel.add(textPanel); to: MainPanel.add(buttonPanel, BorderLayout.CENTER); MainPanel.add(calcPanel, BorderLayout.PAGE_END); // wherever you want to add this MainPanel.add(textPanel, BorderLayout.PAGE_START); Note that your code can be simplified greatly by using arrays or Lists. Or could simplify it in other ways, for instance: public void assumingCorrectNumberFormats(ActionEvent e) throws DivideByZeroException { String actionCommand = e.getActionCommand(); String numbers = "1234567890"; if (numbers.contains(actionCommand)) { operand.append(actionCommand); // if you need to work with it as a number int num = Integer.parseInt(actionCommand); } Myself, I'd use a different ActionListeners for different functionality, for instance one ActionListener for numeric and . entry buttons and another one for the operation buttons.
accepted answer of: http://stackoverflow.com/q/27048996
downvote count: 0
has comment: http://stackoverflow.com/comment/42615783
type: AcceptedAnswer
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27048996

http://stackoverflow.com/comment/42759820
comment on: http://stackoverflow.com/a/27120080
type: AnswerComment
has text: @JimMischel - Even I cannot deny their approach as they were Lead programmers of the company.I think you are right. I should try this way.
score: 0
type: Comment

http://stackoverflow.com/a/27144596
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27132766
has body: I solved my problem by adding swagger-ui resources to src\main\webapp\docs I also added &lt;mvc:default-servlet-handler/&gt; To pom.xml Now I can access swagger UI under: http://localhost:8080/myapp/docs/
has comment: http://stackoverflow.com/comment/68412732
answers question: http://stackoverflow.com/q/27132766
has comment: http://stackoverflow.com/comment/52568892
type: Answer
has comment: http://stackoverflow.com/comment/45925403
upvote count: 1
has comment: http://stackoverflow.com/comment/45900587
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/27140921
type: Answer
has body: The Cassandra on "10.6.1.244" doesn't seem listening on port 9160 for Thrift client. You can confirm this by telnet 10.6.1.244 9160. If you see "Connection refused" message, then your Cassandra is not listening on the port number. Please check your Cassandra configuration.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27130321
upvote count: 2
has comment: http://stackoverflow.com/comment/42779519

http://stackoverflow.com/a/27042315
accepted answer of: http://stackoverflow.com/q/27042245
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42793775
has comment: http://stackoverflow.com/comment/42832203
type: Answer
has comment: http://stackoverflow.com/comment/42828143
has body: Try something like this BasicDBObject query = new BasicDBObject(); query.put("date", BasicDBObjectBuilder.start("$gte", fromDate).add("$lte", toDate).get()); collection.find(query).sort(new BasicDBObject("date", -1));
has comment: http://stackoverflow.com/comment/42604010
score: 3
has comment: http://stackoverflow.com/comment/42604278
upvote count: 3
has comment: http://stackoverflow.com/comment/42603817
answers question: http://stackoverflow.com/q/27042245

http://stackoverflow.com/q/27147973
tagged with: web-applications
tagged with: httprequest
has title: How to pass the session Id as part of request Header?
tagged with: servlets
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27149516
has body: At present i am passing the session id in request URL like below to enter in to existing session from one of the client String urlStr = "/App1/MyApp.do;jsessionid=someSessionId"; Properties reply = new Properties(); URL url = new URL(urlStr); URLConnection conn = url.openConnection(); conn.getInputStream() What i want is passing the session Id in request header instead of passing it as url parameter.Any ideas?
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27149516
tagged with: java
score: 0

http://stackoverflow.com/comment/42848197
score: 0
comment on: http://stackoverflow.com/a/27138704
type: Comment
has text: Thanks. I already check that the stream is not empty, and don't think there could be null elements, but I guess your approach will always be better. I'll look at it tomorrow.
type: AnswerComment

http://stackoverflow.com/comment/42779917
has text: Have you benchmarked it to see how much of a difference it makes?
type: Comment
comment on: http://stackoverflow.com/q/27032656
score: 0
type: QuestionComment

http://stackoverflow.com/a/27133177
answers question: http://stackoverflow.com/q/27132824
has comment: http://stackoverflow.com/comment/42765028
type: Answer
has body: If the ordering is defined as a calculation in SQL, then I think you'll have to requery. (The cursor will not dynamically recalculate the "ORDER BY" clause, this happens at query time in SQL). Alternatively, you could change your adapter to one backed by a list instead of a cursor, and implement a Comparator to sort the data. Then notify the adapter that the data has changed. Assuming each row in the list is backed by an object of type Item: Collections.sort(listOfItems,new Comparator&lt;Item&gt;(){ public int compare(Item i1, Item i2){ /* Compare your items here. Return * -1 if i1 &lt; i2 * 0 if i1 = i2 * 1 if i1 &gt; i2 */ }});
score: 0

http://stackoverflow.com/q/27084901
type: Question
tagged with: java
score: 0
answer count: 1
has body: I'm using Parse.com and my app is supposed to let users sign up and login. They are able to sign up, at which point I see that they get stored on the Parse database, but when I try using the same username and password on my login activity, it says it does not exist. After the user signs up though, it goes into the MainActivity, up until you sign out, then you can't log back in. Any help? Here is my SignUp Activity public class SignupActivity extends ActionBarActivity { EditText mName, mUsername, mEmail, mPassword, mPasswordConfirm; Button mSignup, mCancel; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_signup); getActionBar().setDisplayHomeAsUpEnabled(true); mName = (EditText) findViewById(R.id.name); mUsername = (EditText) findViewById(R.id.username); mEmail = (EditText) findViewById(R.id.email); mPassword = (EditText) findViewById(R.id.password); mPasswordConfirm = (EditText) findViewById(R.id.confirm_password); mSignup = (Button) findViewById(R.id.signup_button); mSignup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String username = mUsername.getText().toString().trim(); final String email = mEmail.getText().toString().trim(); final String password = mPassword.getText().toString().trim(); final String confirmedPassword = mPasswordConfirm.getText().toString().trim(); final String name = mName.getText().toString().trim(); if(username.isEmpty() || email.isEmpty() || password.isEmpty()){ AlertDialog.Builder builder = new AlertDialog.Builder(SignupActivity.this); builder.setMessage("Item missing in Signup Fields") .setPositiveButton("Ok", null) .setTitle("Error Message"); AlertDialog dialog = builder.create(); dialog.show(); } else if(!confirmPass(password, confirmedPassword)){ AlertDialog.Builder builder = new AlertDialog.Builder(SignupActivity.this); builder.setMessage("Pass…
tagged with: android
has answer: http://stackoverflow.com/a/27085292
has title: Users not able to sign in using Parse
tagged with: parse-platform
type: UnansweredQuestion

http://stackoverflow.com/comment/42577465
has text: And Excel. And Basic (including VB). And Pascal (including Delphi). And probably others too :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/27027147
score: 0
type: Comment

http://stackoverflow.com/comment/42737228
score: 0
has text: possible duplicate of [Generating a Random Number between 1 and 10 Java](http://stackoverflow.com/questions/20389890/generating-a-random-number-between-1-and-10-java)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27117193

http://stackoverflow.com/comment/42594737
type: Comment
comment on: http://stackoverflow.com/a/27037153
score: 0
type: AnswerComment
has text: private by itself does not protect a field : it can still be accessed through reflexion (what IDE debuggers do ...)

http://stackoverflow.com/q/27046064
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27046874
answer count: 3
has answer: http://stackoverflow.com/a/27046874
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/27046651
type: AnsweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42610639
type: Question
accepted answer: http://stackoverflow.com/a/27046651
score: 1
has comment: http://stackoverflow.com/comment/42610884
tagged with: java
has answer: http://stackoverflow.com/a/27049657
has title: Java how to store data from different CSV files
has body: I wonder how to generate a class holding the values of the fields from a csv file does not establish a rigid number of fields. I read about generating classes using CodeModel, but after completing the program can not be compiled specifically to take a job with a .csv file, it needs to work on the fly. Some files have 22 fields and the other 40. The simplest solution would be to create a class with 50 fields and fill them in a for loop. Example file: Colname1; colname2; colname3........... 2014-23-11;22;22;22;23;4;4;5; 2014-23-11;32;22;22;23;4;4;5; 2014-23-11;62;52;22;23;4;4;5; 2014-23-11;28;22;22;93;4;4;5;

http://stackoverflow.com/a/27041304
type: Answer
has body: You cannot pass a column name to the PreparedStatement. What you could do to overcome this is change it in the string. try { PreparedStatement prepStmt = conn.prepareStatement( "UPDATE week SET " + s + " =? WHERE id&gt;=? AND id&lt;=?"); prepStmt.setFloat(1, x); prepStmt.setInt(2, c); prepStmt.setInt(3, d); prepStmt.executeUpdate(); } catch(SQLException e) { System.err.println("Error during data update"); e.printStackTrace(); }
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42605066
answers question: http://stackoverflow.com/q/27041163
has comment: http://stackoverflow.com/comment/42604779
has comment: http://stackoverflow.com/comment/42605435
accepted answer of: http://stackoverflow.com/q/27041163
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42635970
has text: yes it is under library..should i add the dependency for MySql in POM.xml..?
comment on: http://stackoverflow.com/q/27060702
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42627655
type: Comment
comment on: http://stackoverflow.com/a/27034533
has text: Thanks that actually worked and also I forgot to write the class name in class path.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42746110
has text: No, Java *never* uses pass-by-reference. It *always* uses pass-by-value, but the value passed for class types - including arrays - is a reference. There's a big difference between "pass a reference by value" and "pass an object by reference". Please don't add to the confusion of others by conflating the two.
type: AnswerComment
comment on: http://stackoverflow.com/a/27122639
type: Comment
score: 1

http://stackoverflow.com/a/27105646
has body: You're constantly changing the sync object on which all threads are supposed to be synchronized. So, effectively, they aren't synchronized at all. Make your sync variable final, as every lock should be, and you'll see that your code doesn't compile anymore. Solution: synchronize on another, final object, or use an AtomicInteger and change its value, or synchronize on this (i.e. make the method synchronized).
downvote count: 0
upvote count: 6
answers question: http://stackoverflow.com/q/27105544
type: Answer
score: 6

http://stackoverflow.com/a/27054715
has comment: http://stackoverflow.com/comment/42633088
has comment: http://stackoverflow.com/comment/42653250
has body: Take a look into Spring Data documentations for ElasticSearch: @Configuration @EnableElasticsearchRepositories(basePackages = "org/springframework/data/elasticsearch/repositories") static class Config { @Value("${esearch.port}") int port; @Value("${esearch.host}") String hostname; @Bean public ElasticsearchOperations elasticsearchTemplate() { return new ElasticsearchTemplate(client()); } @Bean public Client client(){ TransportClient client= new TransportClient(); TransportAddress address = new InetSocketTransportAddress(hostname, port); client.addTransportAddress(address); return client; } } Elasticsearch Repositories 2.1.2 Annotation based configuration The Spring Data Elasticsearch repositories support cannot only be activated through an XML namespace but also using an annotation through JavaConfig.
has comment: http://stackoverflow.com/comment/65693498
score: 12
has comment: http://stackoverflow.com/comment/42631262
upvote count: 12
answers question: http://stackoverflow.com/q/27053365
downvote count: 0
has comment: http://stackoverflow.com/comment/42633004
type: Answer

http://stackoverflow.com/comment/42697929
score: 0
comment on: http://stackoverflow.com/q/27096214
has text: @EJP Ah that's unfortunate, is there a package for another language that you know of which would do the job? I'm open to using something other than Java if need be.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42712292
type: Comment
comment on: http://stackoverflow.com/q/27104295
score: 0
type: QuestionComment
has text: yes Boann the tex is fixed the only part that can change is the numbers 32-2 or 42-25 and what i need is the first part of numbers before in this case "-2" and "-25"

http://stackoverflow.com/q/27072076
score: 0
tagged with: polar-coordinates
accepted answer: http://stackoverflow.com/a/27072364
has comment: http://stackoverflow.com/comment/42656488
answer count: 1
has comment: http://stackoverflow.com/comment/42656515
tagged with: animation
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27072364
tagged with: java
has comment: http://stackoverflow.com/comment/42656538
has comment: http://stackoverflow.com/comment/42659968
type: Question
tagged with: graphics
has body: I've got a problem couse I need to move my ball and it just stand still. I've succed moving it with a simple function (x=x+1) but when it comes to radians it just doesnt work. I've read some posts here and I thought I'm making it in the right way, but its obvious I've missed something :) Here is my Ball class: public class Ball { int x = 0; int y = 0; int rightleft = 1; int updown = 1; private static final int sizeBall = 30; float angle = 120; float angleInRadians = (float) (angle*Math.PI/180); private Main main; public Ball(Main main){ this.main=main; } // That function should move my ball void move() { x = (int) (x + Math.cos(angleInRadians)); y= (int) (x+Math.sin(angleInRadians)); } void paint(Graphics2D g) { g.setColor(Color.red); g.fillOval(x, y, sizeBall, sizeBall); } public Rectangle getSize(){ return new Rectangle(x,y,sizeBall,sizeBall); } } And here is my Main class: public class Main extends JPanel { Ball ball = new Ball(this); private void moveBall() throws InterruptedException{ ball.move(); } public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ball.paint(g2d); } public static void main(String[] args) throws InterruptedException { // TODO code application logic here JFrame okno = new JFrame("TEST"); Main main = new Main(); okno.add(main); okno.setSize(500,500); okno.setVisible(true); okno.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); while(true){ main.moveBall(); main.repaint(); Thread.sleep(10); } } } Do you know where is my mistake?
has title: How to move an object using radians?

http://stackoverflow.com/comment/42532720
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27000751
has text: Good point, and very nicely demonstrated with the pictures +1

http://stackoverflow.com/q/27086548
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27086830
upvote count: 3
tagged with: swing
tagged with: jfilechooser
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42681778
tagged with: java
has comment: http://stackoverflow.com/comment/42681954
has body: I am in need of a java file system browser without all the buttons and fields. Does swing have any components that can do this ? If not are there any third party components that can help me with this ? JFileChooser What I am looking for In hindsight the question is vague. The JList style view of the component is not exactly what I am looking for. I just need a file browser which will fire an event when user selects something. Whether it is a JList style browser or a tree style brower is secondary. I see there are ways I can code this myself, the reason for posting a question here is to see if there are components that do this already.
has comment: http://stackoverflow.com/comment/42681786
has answer: http://stackoverflow.com/a/27086830
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42681979
has title: Java File browser

http://stackoverflow.com/q/26992215
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/42515522
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42515686
has comment: http://stackoverflow.com/comment/42521258
possible better answer: http://stackoverflow.com/a/27013257
has answer: http://stackoverflow.com/a/27013257
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42593466
tagged with: android
has answer: http://stackoverflow.com/a/27038622
tagged with: android-alertdialog
upvote count: 2
has comment: http://stackoverflow.com/comment/42564214
has title: ArrayIndexOutOfBoundsException / passing arraylist from alertdialog to activity
has body: I have an alertdialog with multiple choices, I store the user's choices on an ArrayList of strings, and I want to pass the stored arraylist to the host activity (I will use the array's elements to query my database).. When i run my app, i get an ArrayIndexOutOfBoundsException (may be the index is -1..), I'm not sure if it's the loop, or if i did not pass the arraylist correctly from the alertdialog... can you guys take a look ? here is my function : public void onOkay(ArrayList&lt;String&gt; selected) { StringBuilder stringBuilder = new StringBuilder(); if (selected.size() != 0) { for (int i = 0; i &lt; selected.size(); i++) { String categories = selected_items_array[selected.indexOf(i)]; stringBuilder = stringBuilder.append(" " + categories); } Toast.makeText(this, "You have selected: " + stringBuilder.toString(), Toast.LENGTH_SHORT).show(); } } logcat : java.lang.ArrayIndexOutOfBoundsException: length=6; index=-1 at com.hichamridouane.smartshop.MainActivity.onOkay(MainActivity.java:164) at com.hichamridouane.smartshop.TimelineSettings$2.onClick(TimelineSettings.java:71) here is my dialogfragment class. and here is my host activity.(as I said, i'm not sure if i'm passing correctly the arraylist to the host activity) thanks !
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27038622
score: 1
tagged with: java

http://stackoverflow.com/comment/42604854
type: Comment
has text: Check the link I added.
type: AnswerComment
comment on: http://stackoverflow.com/a/27030545
score: 0

http://stackoverflow.com/a/27103874
has body: Based on your diagram and example, you want a rectangle with vertical and horizontal sides. If you look at your current example, all you did was take x1 and y2 for one of the points, and x2/y1 for the other point. So, given Points p1 and p2, you could do as follows: Point p3 = new Point(p1.x, p2.y); Point p4 = new Point(p2.x, p1.y); Of course, if you do not have Point objects you can just use the numbers as variables accordingly.
score: 1
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42711642
accepted answer of: http://stackoverflow.com/q/27103771
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27103771

http://stackoverflow.com/q/27025708
has body: I created a webservice called calculator, an interface, an implementation class, and annotated it, and I was trying to create the service and the WSDL. Then I get the following Error. Not sure if it's a facet error or an error in the version of JAXWS from WAS 8.0? Tried to resolve it but couldn't find resources on the web as well. ** Here's the CODE** //Interface: package com.pp; import javax.jws.WebMethod; import javax.jws.WebService; @WebService public interface Calculator { @WebMethod public int add(int var1, int var2); } //Implementation Class: package com.pp; import javax.jws.WebService; @WebService(endpointInterface=" com.pp.Calculator") public class CalculatorImpl implements Calculator { @Override public int add(int var1, int var2) { // TODO Auto-generated method stub return var1+var2; } } ERROR: Errors occurred during wsgen. Errors occurred during wsgen. error: compilation failed, errors should have been reported Note: ap round: 1 Problem encountered during annotation processing; see stacktrace below for more information. com.ibm.jtc.jax.tools.ws.processor.modeler.ModelerException: [failed to localize] The endpointInterface class com.pp.Calculator could not be found() at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceAP.onError(Unknown Source) at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.getEndpointInterfaceDecl(Unknown Source) at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(Unknown Source) at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(Unknown Source) at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(Unknown Source) at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(Unknown Source) at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(Unknown Source) at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceAP.pro…
tagged with: wsdl
has title: Webservices: [failed to localize] The endpointInterface class Calculator could not be found()
answer count: 0
type: UnansweredQuestion
tagged with: web-services
tagged with: ibm-was
tagged with: java
tagged with: jax-ws
type: Question
upvote count: 4
downvote count: 0
score: 4
favorite count: 0

http://stackoverflow.com/comment/42852325
type: Comment
has text: thanks for trying. I've posted a [new question](http://stackoverflow.com/questions/27182184/how-do-i-use-serviceloader-in-a-netbeans-platform-project-to-add-spis) as you suggested.
comment on: http://stackoverflow.com/a/27121551
type: AnswerComment
score: 0

http://stackoverflow.com/q/27060193
type: Question
tagged with: jakarta-ee
answer count: 1
has body: I have a Java EE application where I require a high performant microservice to consume JMS messages with message driven beans. The service gives out and releases reservations for postal codes and persists these in the database. Since the service should be high performant I want to make it a parallel process. Giving out reservations for a single postal code could cause race conditions, so this is where I want to avoid parallel reservations on a single postal code. This means I need a lock on only specific reservations, or I need to make sure that my threads will never be accessing the same postal codes at the same time. Either for reserving or releasing reservations. For the project I MUST use Java EE 7, and I prefer avoiding spring. What is the best way to go about this, purely relying on JEE7?
score: 0
has comment: http://stackoverflow.com/comment/42636535
has answer: http://stackoverflow.com/a/27166367
has title: Sharded parallelisation in Java EE
tagged with: java-ee-7
tagged with: parallel-processing
type: AnsweredQuestion
tagged with: java
tagged with: message-driven-bean
has comment: http://stackoverflow.com/comment/42634999
accepted answer: http://stackoverflow.com/a/27166367

javasound
tags question: http://stackoverflow.com/q/27013748
tags question: http://stackoverflow.com/q/27097049
type: Tag
tags question: http://stackoverflow.com/q/27125625
tags question: http://stackoverflow.com/q/27146979
tag name: javasound

http://stackoverflow.com/a/27028297
has comment: http://stackoverflow.com/comment/42652221
has comment: http://stackoverflow.com/comment/42652021
has comment: http://stackoverflow.com/comment/42652431
has comment: http://stackoverflow.com/comment/42580352
has comment: http://stackoverflow.com/comment/42579597
has comment: http://stackoverflow.com/comment/42653467
score: 0
has comment: http://stackoverflow.com/comment/42653288
has comment: http://stackoverflow.com/comment/42579641
has comment: http://stackoverflow.com/comment/42589915
has comment: http://stackoverflow.com/comment/42579829
has comment: http://stackoverflow.com/comment/42652141
has comment: http://stackoverflow.com/comment/42624814
answers question: http://stackoverflow.com/q/27028033
has comment: http://stackoverflow.com/comment/42651768
has comment: http://stackoverflow.com/comment/42625133
type: Answer
has comment: http://stackoverflow.com/comment/42580199
has body: There is no code in your example for actually collecting input, which leads me to believe you are not familiar with getting user input in Java. The Scanner class is a convenient way to handle this, and you can read more on that here: Java Scanner Tutorial. You can use Scanner's nextLine() function to get a line of user input. For example: Scanner kb = new Scanner(); String userInput = kb.nextLine(); int length = country.length; for(int i = 0; i &lt; length; i++) { if(userInput.equals(country[i])) { System.out.println(userInput + "'s " + " population is: " + population[i]); } } EDIT: You can place this inside some method, perhaps searchPopulation(String country), and call it inside a loop in main such as: while(userChoice == true) { System.out.println("Please enter a country: "); String userInput = kb.nextLine(); searchPopulation(userInput); //Check if the user would like to keep going here } Of course, you would have to modify the first code example so that the name of the String matches the name provided in the method declaration, and remove the user input from the first code example since you are now handling it in the while loop. EDIT: You may have something like this in your program: import java.util.Scanner; public class TestClass { static String country[] = {"United States", "Brazil", "China", "Italy", "United Kingdom", "Spain", "Japan", "Germany", "France", "Turkey", "South Africa", "Argentina"};; static int population[] = { 319111000, 203462000, 1367960000, 60783711, 64105654, 46507760, 127090000, 80767000, 66050000, 76667864, 54002000, 42669500}; public static void main(String args[]) { boolean userChoice = true; String userInput = ""; Scanner kb = new Scanner(System.in); while(userChoice == true) { System.out.println("Please enter a country: "); userInput = kb.nextLine(); searchPopulation(userInput); //Check if the user would like to keep going here } kb.close(); } public static void searchPopulation(String userInput) { int length = country.length; for(int…
has comment: http://stackoverflow.com/comment/42653238
has comment: http://stackoverflow.com/comment/42579517

http://stackoverflow.com/comment/42681169
has text: Making things static isn't the correct solution. NB You can't sleep in a paint() method. You need to use the `SwingTimer` to achedule your repaints.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27086067

http://stackoverflow.com/comment/42585832
type: AnswerComment
comment on: http://stackoverflow.com/a/27031702
has text: @DanielLaRue why don't u accept the answer. thank you!
type: Comment
score: 0

http://stackoverflow.com/a/27112918
has comment: http://stackoverflow.com/comment/42736407
answers question: http://stackoverflow.com/q/27111555
has body: &lt;entry key="list" value="application/json" /&gt; this is not valid. From the PathExtensionContentNegotiationStrategy javadocs: A ContentNegotiationStrategy that uses the path extension of the URL to determine what media types are requested. The path extension is first looked up in the map of media types provided to the constructor. If that fails, the Java Activation framework is used as a fallback mechanism. .list is not a valid media type. Its just a URL pattern. Change your @RequestMapping(value="/product.list") to @RequestMapping(value="/product") Check if you have valid Jackson libraries in your classpath.
score: 0
type: Answer

http://stackoverflow.com/a/32269921
answers question: http://stackoverflow.com/q/27114705
score: 0
has body: We had this issue with these configurations: Using CATALINA_BASE: /opt/tomcat Using CATALINA_HOME: /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME: /usr/java/jdk1.8.0_45 Using CLASSPATH: /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Server version: Apache Tomcat Server built: May 19 2015 14:58:38 UTC Server number: 8.0.23.0 OS Name: Linux OS Version: 2.6.32-431.11.2.el6.x86_64 Architecture: amd64 JVM Version: 1.8.0_45-b14 JVM Vendor: Oracle Corporation We solved it by upgrading tomcat from 8.0.23.0 to 8.0.26.0 version.
type: Answer

http://stackoverflow.com/a/27123188
score: 1
accepted answer of: http://stackoverflow.com/q/27104965
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27104965
type: Answer
has body: I've managed to resolve the issue however am unsure exactly how, one of the options below was effective so I'd recommend trying them all to anyone with a similar problem. Check the install location of rj.gd. If you for some reason, like I did, have two locations, check that the required files are in the location Eclipse is automatically selecting. If there not, put them there, however as Roman points out make sure these are correctly installed. Re-start your PC after installation, not just the program. It was one of those, so good luck.

http://stackoverflow.com/comment/42558564
type: QuestionComment
comment on: http://stackoverflow.com/q/27005481
type: Comment
score: 0
has text: What I'm playing with is intended to be some scheduling system similar to Apple's Grand Central Dispatch. So performance will be an issue, but I agree that you have a point concerning premature optimisation. Besides that do you think the algorthm is correct? Thanks for any opinions issues being pointed to.

http://stackoverflow.com/comment/42702275
comment on: http://stackoverflow.com/a/27095074
has text: Thank you for the detailed explanation about synchronization locks. The data structure is unfortunately not under my control that's why I was looking for a thread-safe way to access it. What I needed was a data structure like a ConcurrentHashMap but for specific reasons I have to stick to the custom data structure.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27000391
answers question: http://stackoverflow.com/q/27000113
type: Answer
has body: Okay. Now that makes sense. If you have a number int mark = 3; You can use an if statement if(mark &lt;= 10){ //do this }else if(mark &lt;= 20){ //do this } You can also use a switch statement, however personal preference leads me to almost always use if statements. If you want "buckets" you could use ArrayList&lt;String&gt; marksForStudent = new ArrayList&lt;&gt;(); the documentation for that is here. https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html Or, alternatively and probably what you want is a hashmap. With the student's name or other unique identifier as the key and then a collection to contain their marks. HashMap&lt;String, ArrayList&lt;String&gt;&gt; gradesForStudents = new HashMap&lt;&gt;(); gradesForStudents.put("Marc",Arrays.asList("99","98","100")); Something like that.
score: 0

http://stackoverflow.com/comment/42665493
type: AnswerComment
score: 0
type: Comment
has text: @DavidConrad `but your code will be rotating x and y around the point (0, 0)` It will rotate around the initial coordinate of `x` and `y`. And you're right, `sin` and `cos` are currently switched.
comment on: http://stackoverflow.com/a/27077451

http://stackoverflow.com/comment/42775313
type: AnswerComment
comment on: http://stackoverflow.com/a/27135579
score: 0
type: Comment
has text: @Dinco well, there is a way to get the data from the row. I don't have the application I built, but I implemented the second solution, so I know it's possible to pull the info.

http://stackoverflow.com/q/27067114
has comment: http://stackoverflow.com/comment/42647722
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27067256
has answer: http://stackoverflow.com/a/27067191
tagged with: java
has answer: http://stackoverflow.com/a/27067256
has body: I'm getting a weird error, I am unable to set the color of a paint object with a Color object, this is strange seeing as how paint.setColor(Color.RED) is valid whilst paint.setColor(this.color) is not Here is the code that I have. public class Shape{ protected GameView2 game_view; protected int x; protected int y; protected int width; protected int height; protected Color color; public Shape(GameView2 game_view, Color color, int x, int y, int width, int height) { this.game_view = game_view; this.x = x; this.y = y; this.width = width; this.height = height; this.color = color; } public void onDraw(Canvas canvas){ Paint paint = new Paint(); Rect rec = new Rect(x, y, x + width, y + height); paint.setColor(this.color); //does not work paint.setStyle(Paint.Style.FILL); canvas.drawRect(rec, paint); } } Edit: the Shape object has been declared another class called GameView, its very big so I wont paste the whole class, but when creating a Shape object this is what is done: new Shape(this, Color.BLACK, 0, 0, 100, 100) The error I get is incompatible types: Color cannot be converted to int
type: Question
has answer: http://stackoverflow.com/a/27067381
score: 0
accepted answer: http://stackoverflow.com/a/27067191
answer count: 3
has comment: http://stackoverflow.com/comment/42648893
has title: Color cannot be converted to int
tagged with: colors

substring
tags question: http://stackoverflow.com/q/27110563
tags question: http://stackoverflow.com/q/27097240
type: Tag
tags question: http://stackoverflow.com/q/27081462
tags question: http://stackoverflow.com/q/27028457
tags question: http://stackoverflow.com/q/27039970
tag name: substring

http://stackoverflow.com/comment/42792213
has text: Your question is not clear. Can you please explain more?
type: QuestionComment
comment on: http://stackoverflow.com/q/27148666
score: 1
type: Comment

http://stackoverflow.com/q/27034189
score: 0
accepted answer: http://stackoverflow.com/a/27034295
tagged with: collections
has body: Suppose you have a list of objects of a base type (in my case, NotebookEntry), and this list contains objects of various descendant types (like NotebookEntryPlainText). This master ObservableList&lt;NotebookEntry&gt; is maintained by the notebook manager, but various controls will need to create their own filtered lists from that master list - say, only plain text entries. These lists must include all entries applicable that are in the master list, but if an entry is removed from the master list, those lists must not contain it. I have come up with a binding extending ListBinding, which avoids having to implement any listeners. The binding is one-directional on purpose. The code is very simple: public class ObservableFilteredList&lt;T&gt; extends ListBinding&lt;T&gt; { private final ObservableList&lt;T&gt; masterlist; private final Predicate&lt;T&gt; predicate; public ObservableFilteredList(ObservableList&lt;T&gt; _masterlist, Predicate&lt;T&gt; _p) { masterlist = _masterlist; predicate = _p; super.bind(masterlist); } @Override public void dispose() { super.unbind(masterlist); } @Override protected ObservableList&lt;T&gt; computeValue() { return FXCollections.observableList( masterlist.parallelStream() .filter(predicate) .collect(Collectors.toList()) ); } } Is this the most elegant way to achieve this function? Is this already implemented in JDK 8? I have looked, but maybe I wasn't searching with the correct question. A sample implementation: ObservableList&lt;String&gt; sourcelist; ObservableFilteredList&lt;String&gt; filteredlist; sourcelist = FXCollections.observableArrayList(); listview_source.setItems(sourcelist); filteredlist = new ObservableFilteredList&lt;String&gt;(sourcelist, s -&gt; s.toUpperCase().startsWith("O")); listview_filtered.setItems(filteredlist); What are the downsides of this implementation?
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has title: What is the most fundamental way to maintain a filtered ObservableList?
type: Question
has answer: http://stackoverflow.com/a/27034295
answer count: 1

http://stackoverflow.com/comment/42696448
comment on: http://stackoverflow.com/q/27095312
has text: I would also suggest posing a question to help people answer.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27015109
type: Answer
score: 17
upvote count: 17
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27014609
answers question: http://stackoverflow.com/q/27014609
has body: Try this in your CSS file: .text-field { -fx-background-color: #a9a9a9 , white , white; -fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1; } .text-field:focused { -fx-background-color: #a9a9a9 , white , white; -fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1; }
has comment: http://stackoverflow.com/comment/42563920
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/73927175

http://stackoverflow.com/q/27020060
has answer: http://stackoverflow.com/a/27020153
answer count: 4
has body: My dilemma is after the user inputs a number, that number is then checked to see if it's in the array, if it is i'll let them know that is in the array along with the position of that said number. I have it to where it prompts user for the number, but after that i get the ArrayIndexOutOfBoundsException error. Here's what I have so far: int [] iGrades = new int [30]; System.out.print ("Enter the grades, when you're done input (-1) "); for (int i=0; i&lt;iGrades.length;i++) { iGrades [i]= kb.nextInt(); if (iGrades [i]&lt; 0) { break; } } System.out.print ("\nEnter a grade to check if it's in the array"); iVal = kb.nextInt(); for(int i=0; i&lt;=iGrades.length; ++i) { if(iVal == (iGrades[i])) { found = true; for(int j=0; j&lt;=iGrades.length; ++j) { iGrades[j]=j+1; } break; } } if (found == true) { System.out.println(iVal + " is in the array at position "); } else { System.out.println(iVal + " is NOT in the array."); } } Any assistance would be great.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27020137
has answer: http://stackoverflow.com/a/27020168
has answer: http://stackoverflow.com/a/27020128
tagged with: java
type: Question
score: 0
has title: How would I display the position of an element in an array?

http://stackoverflow.com/comment/42524982
has text: Simple answer: No. Bit more elaborated: yes, but not out of the box. You could run Cygwin.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26997161

http://stackoverflow.com/a/26994606
has comment: http://stackoverflow.com/comment/42522746
answers question: http://stackoverflow.com/q/26994500
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42523263
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42520144
type: Answer
has body: Accordingly to the documentation you should add this line to your persistence.xml: <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/> http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_logging_openjpa.html ADDED If you add those keys in your persistence.xml, probably the default values will be overridden. <?xml version="1.0" encoding="UTF-8"?> <property name="openjpa.jdbc.DBDictionary" value="oracle" /> <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/> <property name="openjpa.AutoDetach" value="close" /> <property name="openjpa.DetachState" value="loaded" /> <property name="openjpa.DataCache" value="false" /> <property name="openjpa.Optimistic" value="true" /> <property name="openjpa.Multithreaded" value="true" /> <property name="openjpa.TransactionMode" value="managed" /> <property name="openjpa.ConnectionFactoryMode" value="managed" /> <property name="openjpa.NontransactionalRead" value="true" /> <property name="openjpa.RestoreState" value="all" /> <property name="openjpa.ManagedRuntime" value="auto" />
accepted answer of: http://stackoverflow.com/q/26994500

http://stackoverflow.com/comment/42694323
has text: Just added the code - thanks Luiggi - is there an article/tutorial I can refer to, for using profiler?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27094056
score: 0

http://stackoverflow.com/a/27053766
score: 0
answers question: http://stackoverflow.com/q/27053701
type: Answer
has body: Code works absolutely fine, provided you enter only numbers. If you enter empty string, it will give you the error what you have posted. Might need to add a check for empty string. if(!x.isEmpty()){ A[i] = Integer.parseInt(x); } public class end { public static void main(String[] args) throws IOException { practice obj = new practice(); obj.test(); } } class practice { void test() throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); int A[] = new int[5]; String x; int a, b, c, i = 0; for (i = 0 ; i &lt; 5 ; i++) { System.out.println("Insert a number"); x = br.readLine(); A[i] = Integer.parseInt(x); } for (i = 0 ; i &lt; 5 ; i++) { System.out.println(A[i]); } } } Output Insert a number 2 Insert a number 3 Insert a number 4 Insert a number 5 Insert a number 6 User input 2 3 4 5 6

http://stackoverflow.com/a/27118331
has comment: http://stackoverflow.com/comment/42738587
has comment: http://stackoverflow.com/comment/42738656
has comment: http://stackoverflow.com/comment/42738653
has comment: http://stackoverflow.com/comment/42738651
has comment: http://stackoverflow.com/comment/42738618
has comment: http://stackoverflow.com/comment/42738628
has body: You need to instantiate State(s) in your neighborStates array. You have created an array with 7 slots, but they're all initially null. Assuming you have a default constructor, it should look something like, for (Operation o : Operation.values()){ neighborStates[i] = new State(); // ... Also, it's probably a good idea to size neighborStates based on Operation.values() State[] neighborStates = new State[Operation.values().length];
upvote count: 8
has comment: http://stackoverflow.com/comment/42738905
type: Answer
downvote count: 1
score: 7
has comment: http://stackoverflow.com/comment/42738950
answers question: http://stackoverflow.com/q/27118321
has comment: http://stackoverflow.com/comment/42738745

http://stackoverflow.com/comment/42746197
comment on: http://stackoverflow.com/q/27122300
type: Comment
type: QuestionComment
has text: What exactly ur problem definition is ? Will u update ur question with it ? So that it is more clear to answer.
score: 0

http://stackoverflow.com/q/27005954
score: 2
tagged with: java
type: Question
has body: I'm trying to create a hash in PHP store it in a database then verify the hash in Java. So far they both work fine independently from each other ... Java can hash and verify java, Php can hash and verify php, but they aren't playing nicely together despite my best efforts. I've changed the algorithm to sha1 in php to match javas PBKDF2WithHmacSHA1 - Do they match? I've used Base64.decodeBase64() from the apache commons codec library to decode the php base64_encode() function - is this ok? I'm manually removing the algorithm "sha1:" part for java for now. Here's the code, can you spot any reasons why the java implementation wouldn't be able to verify the hash produced by the php version? - I'm not getting error, it's just the verification is failing when the correct password is "password" for that hash. Part 1 ... I define all the variables for PHP, the only different variable is the algorithm in use define("PBKDF2_HASH_ALGORITHM", "sha1"); define("PBKDF2_ITERATIONS", 1000); define("PBKDF2_SALT_BYTE_SIZE", 24); define("PBKDF2_HASH_BYTE_SIZE", 24); define("HASH_SECTIONS", 4); define("HASH_ALGORITHM_INDEX", 0); define("HASH_ITERATION_INDEX", 1); define("HASH_SALT_INDEX", 2); define("HASH_PBKDF2_INDEX", 3); Part 2 ... The code to create / validate hashes in php function create_hash($password) { // format: algorithm:iterations:salt:hash $salt = base64_encode(mcrypt_create_iv(PBKDF2_SALT_BYTE_SIZE, MCRYPT_DEV_URANDOM)); return PBKDF2_HASH_ALGORITHM . ":" . PBKDF2_ITERATIONS . ":" . $salt . ":" . base64_encode(pbkdf2( PBKDF2_HASH_ALGORITHM, $password, $salt, PBKDF2_ITERATIONS, PBKDF2_HASH_BYTE_SIZE, true )); } function validate_password($password, $correct_hash) { $params = explode(":", $correct_hash); if(count($params) &lt; HASH_SECTIONS) return false; $pbkdf2 = base64_decode($params[HASH_PBKDF2_INDEX]); return slow_equals( $pbkdf2, pbkdf2( $params[HASH_ALGORITHM_INDEX], $password, $params[HASH_SALT_INDEX], (int)$params[HASH_ITERATION_INDEX], strlen($pbkdf2), true ) ); } …
has answer: http://stackoverflow.com/a/31635146
has title: Hashing between PHP and Java
answer count: 1
downvote count: 0
favorite count: 0
tagged with: hash
upvote count: 2
type: UnansweredQuestion
tagged with: php

deserialization
type: Tag
tags question: http://stackoverflow.com/q/27119177
tag name: deserialization
tags question: http://stackoverflow.com/q/27010799
tags question: http://stackoverflow.com/q/27090782
tags question: http://stackoverflow.com/q/27068490

http://stackoverflow.com/a/27091616
has comment: http://stackoverflow.com/comment/42723886
accepted answer of: http://stackoverflow.com/q/27090833
has comment: http://stackoverflow.com/comment/42724314
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42719626
has comment: http://stackoverflow.com/comment/42721263
has comment: http://stackoverflow.com/comment/42720649
has comment: http://stackoverflow.com/comment/42722102
has comment: http://stackoverflow.com/comment/42724623
type: Answer
has comment: http://stackoverflow.com/comment/42722507
has comment: http://stackoverflow.com/comment/42724280
has body: I see you have two different provider dependencies jersey-media-moxy and jersey-media-json-jackson. I've always had a problem with Maps with MOXy. I guess they don't play well. Seems you will need to use an adapter to make it play nice, as seen here from Blaise Doughan. That being said, I requested (in the comments above) to see your Server side configuration, as MOXy will auto configure itself, and take precedence over the jersey-media-json-jackson. Why, I'm not sure, this is just what I've always experienced. So I'm curious how the Server side didn't fail even before the response came back to the client. Unless you confgiure the JacksonFeature with the server application, in which you should have also configured it with the client. (This is only the case, because you also have MOXy dependency). Anyway, if you don't want to go through the hassle creating adapters, as seen in the link above, just get rid of the jersey-media-moxy dependency. jersey-media-json-jackson will also auto configure it feature. You should just use one or the other. As an aside: @Path("/getAllNews"). Path segments should be nouns, unless they are controller resources, which normally perform some action, other than normal CRUD operations (e.g. /register). The HTTP method already consists of the verb to which each CRUD action should be performed. Create - POST Retriecve - GET Update = PUT Delete - DELETE Just some semantics to consider :-) UPDATE The problem is with the New key. Jackson doesn't know how to deserialize this. Since you are willing to switch the key and value type, just change the toString to return the name in the Term class, and it should be OK.
has comment: http://stackoverflow.com/comment/42721932
has comment: http://stackoverflow.com/comment/42719767
has comment: http://stackoverflow.com/comment/42722419
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/27090833
has comment: http://stackoverflow.com/comment/42720780

http://stackoverflow.com/a/27092728
accepted answer of: http://stackoverflow.com/q/27091834
answers question: http://stackoverflow.com/q/27091834
type: AcceptedAnswer
downvote count: 0
has body: You can't test like this. What you are doing here Response response = Response.status(Response.Status.OK) .entity(entity) .type(MediaType.APPLICATION_JSON).build(); is building an outbound response. In the JAX-RS framework, after we send out a response, e.g. @GET @Produced(MediaType.APPLICATION_JSON) public Response getResponse() { ... return Response.status(Response.Status.OK) .entity(entity) .type(MediaType.APPLICATION_JSON).build(); } it still needs to through a MessageBodyWriter for the serialization to JSON. Read more about Entity Providers That being said, Jersey has a Test Framework, we can use to test our resource methods. You can find all the official examples at the Github A sample (with a few alterations): These are the minimum required Maven dependencies org.glassfish.jersey.test-framework jersey-test-framework-core 2.13 org.glassfish.jersey.test-framework.providers jersey-test-framework-provider-grizzly2 2.13 org.glassfish.jersey.media jersey-media-json-jackson 2.13 Test class public class TestJSONResource extends JerseyTest { @Override protected TestContainerFactory getTestContainerFactory() { return new GrizzlyTestContainerFactory(); } @Path("test") public static class TestResource { @GET @Produces(MediaType.APPLICATION_JSON) public Response getJson() { Map<String, String> entity = Maps.newHashMap(); entity.put("foo", "bar"); Response response = Response.status(Response.Status.OK) .entity(entity) .type(MediaType.APPLICATION_JSON).build(); return response; } } @Override protected DeploymentContext configureDeployment() { return DeploymentContext.builder(new ResourceConfig(TestResource.class)) .contextPath("context1/context2") .build(); } @Test public void testGet() { final WebTarget target = target("test"); final String s = target.request().get(String.class); System.out.println(s); } } jersey-media-json-jackson provides the MessageBodyWriter and MessageBodyReader for processing JSON, which is implicitly registered for us.
score: 8
has comment: http://stackoverflow.com/comment/42692503
upvote count: 8
has comment: http://stackoverflow.com/comment/42691628
type: Answer
has comment: http://stackoverflow.com/comment/42692063
has comment: http://stackoverflow.com/comment/42692858
has comment: http://stackoverflow.com/comment/42707535

actionlistener
tags question: http://stackoverflow.com/q/27073389
tags question: http://stackoverflow.com/q/27068818
tags question: http://stackoverflow.com/q/27117159
tags question: http://stackoverflow.com/q/27093249
tags question: http://stackoverflow.com/q/27151166
tags question: http://stackoverflow.com/q/27092649
tags question: http://stackoverflow.com/q/27039634
tags question: http://stackoverflow.com/q/27022658
tags question: http://stackoverflow.com/q/27024019
tags question: http://stackoverflow.com/q/27079662
tags question: http://stackoverflow.com/q/27026053
tags question: http://stackoverflow.com/q/27016283
tags question: http://stackoverflow.com/q/27064659
type: Tag
tags question: http://stackoverflow.com/q/27133327
tag name: actionlistener
tags question: http://stackoverflow.com/q/27098054
tags question: http://stackoverflow.com/q/27098444

http://stackoverflow.com/a/27085672
answers question: http://stackoverflow.com/q/27085385
has body: "Is thinking about: fis = RaspFrame.class.getClassLoader().getResourceAsStream("n" + number); correct?" Yes. That is (roughly speaking) the way to open a stream to a resource held in a JAR file on your classpath. (Your existing code is actually reading the files from the file system. It is presumably working from within your IDE because copies of the files are held in the IDE project directory, and the IDE is making the project directory is the "current directory" when you run the program.)
accepted answer of: http://stackoverflow.com/q/27085385
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/27069421
score: 0
has body: The problem is that you are never calling the method that creates the Listener on your Button so clicking the Button does nothing because there is no event attached to it. Add the method call to onCreate() and that should fix the issue @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.set_timer_activity); // you forgot this guy here createTimer(); } Originally, there was some run/runOnUiThread calls in onTick() but this isn't necessary as that method already runs on the UI Thread. All that did is add more points of potential problems and some overhead. CountDownTimer Docs Off-topic: Your parsings should have some error-checking such as wrapping it in a try/catch try { int time = Integer.parseInt(intervalTxt.getText().toString()) * 1000; } catch (Exception e) { // add a message to the user or do something else in case an invalid character was entered } You need to move your parsing into the onClick or it will try to parse the empty EditText contents @Override public void onClick(View v) { // move it in here int time = Integer.parseInt(intervalTxt.getText().toString()) * 1000; new CountDownTimer(time, 1000) { public void onTick(final long millisUntilFinished) {
type: Answer
accepted answer of: http://stackoverflow.com/q/27068849
has comment: http://stackoverflow.com/comment/42652145
has comment: http://stackoverflow.com/comment/42652324
has comment: http://stackoverflow.com/comment/42652411
has comment: http://stackoverflow.com/comment/42652191
has comment: http://stackoverflow.com/comment/42652435
has comment: http://stackoverflow.com/comment/42652157
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42652594
answers question: http://stackoverflow.com/q/27068849

http://stackoverflow.com/a/27102890
has body: Well I would like extend the answer by drewmoore answer little more. Extension: There is ONE point that need to be cleared. Dog doesnot bark-at cat himself. There is also a medium through which dog knows that cat is in front of him, and the medium is Mind or brain. So I can relate each's brain with the each's actionListener(). In real world brain triggers the dog to bark and in computer / program world actionListener() triggers the dog to bark..
type: Answer
has comment: http://stackoverflow.com/comment/42739425
has comment: http://stackoverflow.com/comment/42738089
has comment: http://stackoverflow.com/comment/42718782
upvote count: 1
has comment: http://stackoverflow.com/comment/42739433
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27098294

http://stackoverflow.com/comment/42682502
has text: When I do that, image is scaled only in width, not height
type: AnswerComment
comment on: http://stackoverflow.com/a/27087159
score: 0
type: Comment

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/27131612

http://stackoverflow.com/q/27036047
has comment: http://stackoverflow.com/comment/42592690
downvote count: 0
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42592874
has body: I'm trying to use a factory design pattern to instantiate objects. Although, the constructor has a varargs parameter. public class Foo implements Bar public Foo(Object... args) { } In the factory I'm trying to get the constructor like this: private Constructor&lt;Bar&gt; getConstructor(Class&lt;Bar&gt; clazz) { return clazz.getDeclaredConstructor(Object.class); } But it doesn't work. I've also tried: private Constructor&lt;Bar&gt; getConstructor(Class&lt;Bar&gt; clazz) { return clazz.getDeclaredConstructor(Object[].class); } But I'll lose the 0 parameter functionality of varargs. Is there any way to do this?
possible better answer: http://stackoverflow.com/a/27036307
has comment: http://stackoverflow.com/comment/42593043
accepted answer: http://stackoverflow.com/a/27036618
upvote count: 2
has comment: http://stackoverflow.com/comment/42592788
tagged with: variadic-functions
favorite count: 0
has answer: http://stackoverflow.com/a/27036618
has answer: http://stackoverflow.com/a/27036307
has comment: http://stackoverflow.com/comment/42592972
tagged with: design-patterns
tagged with: factory
has title: Java: varargs declared constructor
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/42517216
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26993138
type: Comment
has text: `JFrame` contains a `JRootPane`, which contains the content pane, calling `setBackground` on a `JFrame` only sets the background of the frame itself, try using `JFrame#getContentPane#setBackground`...this is also why it's normally discouraged to paint directly to a frame ;)

http://stackoverflow.com/comment/116936874
score: 1
comment on: http://stackoverflow.com/a/61897103
type: AnswerComment
type: Comment
has text: True @irshad.ahmad, and I suspect most people in 2021 arriving at this post will find it's due to missing this dependency. Is it possible to change the accepted answer, @the-nightmare?

http://stackoverflow.com/q/27137299
has body: I've spent a day trying to get Cognito working on my server. I find none of the documentation of much help as there are no clear examples of setting it all up. I have the following code on my server: BasicAWSCredentials credentials = new BasicAWSCredentials( "A**************", "+y*****************************"); AmazonCognitoIdentityClient client = new AmazonCognitoIdentityClient(credentials); GetOpenIdTokenForDeveloperIdentityRequest tokenRequest = new GetOpenIdTokenForDeveloperIdentityRequest(); tokenRequest.setIdentityPoolId("eu-west-1:be9d19a5-*******************"); HashMap<String, String> map = new HashMap<String, String>(); //Key -> Developer Provider Name used when creating the identity pool //Value -> Unique identifier of the user in your backend map.put("access.com.cbn.postref", "fred"); //Duration of the generated OpenID Connect Token tokenRequest.setLogins(map); tokenRequest.setTokenDuration(1000l); GetOpenIdTokenForDeveloperIdentityResult result = client .getOpenIdTokenForDeveloperIdentity(tokenRequest); String identityId = result.getIdentityId(); String token = result.getToken(); System.out.println("id = " + identityId + " token = " + token); I have created an IAM user and used the public and private keys in the code above. I've created an IndentityPool on Cognito with the Dev. Auth. Id as given in the code: access.com.cbn.postref. When I run this code I get an exception thus: com.amazonaws.services.cognitoidentity.model.ResourceNotFoundException: IdentityPool 'eu-west-1:be9d19a5-***********************' not found. (Service: AmazonCognitoIdentity; Status Code: 400 Generated at GetOpenIdTokenForDeveloperIdentityResult result = client .getOpenIdTokenForDeveloperIdentity(tokenRequest); I'm at a complete loss as to know how to proceed as I cannot see what I've done wrong. I did try getting the list of IdentityPools but that returns a list of 0 size.
upvote count: 6
score: 6
tagged with: amazon-cognito
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27174059
tagged with: java
has title: Amazon Cognito connection cannot find IdentityPool
has answer: http://stackoverflow.com/a/27174059
answer count: 1
downvote count: 0
tagged with: amazon-web-services
favorite count: 0
tagged with: token

http://stackoverflow.com/comment/42792407
has text: Considering I'm part of the Swagger team, I can't recommend anything else. Your architecture is just very uncommon which is why we currently don't offer support for it (two frameworks in a single project). Future versions may offer better support for it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27147869

http://stackoverflow.com/comment/42576057
type: QuestionComment
comment on: http://stackoverflow.com/q/27025958
score: 1
has text: You should also have a mechanism that flushes periodically, if something is in the queue, e.g. every 5 seconds. That is quite handy for testing/development time.
type: Comment

http://stackoverflow.com/a/27031418
score: 0
has comment: http://stackoverflow.com/comment/42594421
has body: To start with, it is not a good idea to have several weighted nested LinearaLayout's. That can lead to poor performance. Weighted layouts need to be measured twice, so when you nest them, the number of measurements increases exponentially. As far as changing the size of the bars, it depends. If you just want to change the size, you can change the view's LayoutParams. Another Option would be to use a ScaleAnimation. ScaleAnimation animation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5); animation.setDuration(ANIMATION_DURATION); animation.setFillAfter(true); myView.startAnimation(animation); The first 4 params of the scale animation are the start and end float values for x and y with 1f representing 100% of the current size. If you go this route I would recommend reading up on what setFillAfter() does, it may save you trouble down the road. For example https://stackoverflow.com/a/5888969/3430469.
type: Answer
answers question: http://stackoverflow.com/q/27030837

http://stackoverflow.com/q/27050323
accepted answer: http://stackoverflow.com/a/27050423
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: console
type: Question
tagged with: input
upvote count: 1
has title: Hide Password From Console Window Java Asterisk Password Or Block Inputted String Being Displayed
tagged with: passwords
has answer: http://stackoverflow.com/a/27050423
has answer: http://stackoverflow.com/a/27050375
tagged with: java
answer count: 3
possible better answer: http://stackoverflow.com/a/27050367
has answer: http://stackoverflow.com/a/27050367
has body: public class Login { protected static String user, pass, host; Object conn; public void Login() throws SQLException { try { Class.forName ("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println ("Could not load the driver"); } Scanner sc = new Scanner(System.in); Console console = System.console(); System.out.println("Please Enter Username"); user = sc.next(); System.out.println("Please Enter Password"); pass = sc.nextLine(); System.out.println("Please Enter Host/IP Address"); host = sc.next(); System.out.println("Attempting Log In"); Connection conn = (Connection) DriverManager.getConnection ("jdbc:mysql://"+host+":3306/chessdb", user, pass); Just bit of help, been looking around online at blocking the password being shown on the console window. Is there a simple method of either the inputted text not appearing at all or else an asterisk to cover the input of the password field only?

http://stackoverflow.com/comment/42631136
comment on: http://stackoverflow.com/q/27058022
has text: I think considering it's 2-4-8 which is 2^1, 2^2, 2^3 you should probably use Math.pow() or something similar
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27148868
has comment: http://stackoverflow.com/comment/42794419
tagged with: amazon-ec2
has body: I am using this code to send mail from inside spring application public static void main( final String[] args ) throws MessagingException { System.out.println("&lt;port&gt; &lt;username&gt; &lt;password&gt; &lt;to&gt;"); Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.mydomain.in"); props.put("mail.smtp.port", args[0].trim()); Session session = Session.getInstance(props, new javax.mail.Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(args[1].trim(),args[2].trim()); } }); Message message = new MimeMessage(session); message.setFrom(new InternetAddress(args[1].trim())); message.setRecipients(Message.RecipientType.TO,InternetAddress.parse(args[3])); message.setSubject("test mail"); message.setContent("test mail body","text/html"); Transport.send(message); } Scanerio where it works If i run it in my local system If i use it withing my spring application on my local machine If i run it alone in AWS Where it doesn't work If i use it withing my spring application on AWS it throws throws javax.mail.MessagingException'. javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: authentication failure at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:826) at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:761) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:685) at javax.mail.Service.connect(Service.java:317) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) In my actual app i m taking params as: props.put("mail.smtp.auth", env.getProperty("mail.smtp.auth").trim()); props.put("mail.smtp.starttls.enable", env.getProperty("mail.smtp.starttls.enable").trim()); props.…
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
answer count: 0
has comment: http://stackoverflow.com/comment/42792946
tagged with: java
type: Question
has title: JAVA Email not working properly
has comment: http://stackoverflow.com/comment/42792678
has comment: http://stackoverflow.com/comment/42792725
score: 0

http://stackoverflow.com/a/27074559
has comment: http://stackoverflow.com/comment/42661254
score: 1
downvote count: 2
has comment: http://stackoverflow.com/comment/42660833
has comment: http://stackoverflow.com/comment/42660760
has comment: http://stackoverflow.com/comment/42660864
has comment: http://stackoverflow.com/comment/42660768
has comment: http://stackoverflow.com/comment/42660911
has comment: http://stackoverflow.com/comment/42660890
upvote count: 3
has body: UPDATE: I'm not sure how much complexity you're expecting, but if you want it to be able to handle some tricky expression, you might as well use parser library. Supposing you're talking about javascript and you're replacing string input, do the following. "x^2".replace(/(.*)\^(\d+)/, "pow($1, $2)")
has comment: http://stackoverflow.com/comment/42660877
has comment: http://stackoverflow.com/comment/42660866
answers question: http://stackoverflow.com/q/27074529
type: Answer
has comment: http://stackoverflow.com/comment/42660756
has comment: http://stackoverflow.com/comment/42660795
has comment: http://stackoverflow.com/comment/42660749
has comment: http://stackoverflow.com/comment/42660750

http://stackoverflow.com/comment/42718183
comment on: http://stackoverflow.com/a/27067727
type: AnswerComment
score: 0
type: Comment
has text: you mean OK = OR ?:) Anyway upvoted because the efforts!

http://stackoverflow.com/comment/42793299
score: 0
comment on: http://stackoverflow.com/q/27148599
type: Comment
type: QuestionComment
has text: @pskink I added image of my tree (so I think I don't)

http://stackoverflow.com/comment/42580150
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27028184
has text: What is `userNames`? Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses

collision
tags question: http://stackoverflow.com/q/27007914
tags question: http://stackoverflow.com/q/27091077
tags question: http://stackoverflow.com/q/27082831
type: Tag
tag name: collision
tags question: http://stackoverflow.com/q/27005210
tags question: http://stackoverflow.com/q/27083959

http://stackoverflow.com/q/27120762
has answer: http://stackoverflow.com/a/27127020
has answer: http://stackoverflow.com/a/37283795
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/42105048
tagged with: emulation
has answer: http://stackoverflow.com/a/27127567
tagged with: java
has answer: http://stackoverflow.com/a/66936186
tagged with: webdriver
type: Question
has answer: http://stackoverflow.com/a/42106121
has body: How can I scroll down for the element appearance in Appium WebDriver? We are using an emulator for automation. Any suggestions/help would be appreciated.
tagged with: appium
answer count: 6
has title: Issue with scroll down in android Appium WebDriver
score: 0
has comment: http://stackoverflow.com/comment/92877188

http://stackoverflow.com/q/27050523
score: 0
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42618733
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/27050836
possible better answer: http://stackoverflow.com/a/27050755
has answer: http://stackoverflow.com/a/27050755
type: Question
type: AnsweredQuestion
has title: 2D Array Average (Java)
tagged with: java
has body: I need this method to take the middle columns of the 2D array that was made/changed in other methods, compute the average of each row (excluding the 0 index and last index), place that average in the last column of the row, then go down to the next row and repeat until there are no more rows. Basically a setup of 2 rows and 3 columns will actually have 5 columns as seen below. Weight Grade1 Grade2 Grade3 Average ---------------------------------------- 1| 4.0 5.0 5.0 5.0 -999.0 2| 5.0 10.0 10.0 10.0 -999.0 the method needs to take the Grade scores, find their average, then replace the -999.0 with the average, and then do the same for the next rows that exist(size defined by user input in another method). Here is my code for the method, I know I am fairly close, but I am making a few mistakes somewhere. public static double[][] computeCategoryAverages(double[][] scoreArray){ for(int i = 0; i &lt; scoreArray.length; i++){ double sum = 0; int numOfAssign = 0; if(i == 0){ System.out.println("The Average for the first category: "); for(int j = 1; j &lt; scoreArray[0].length-1; j++){ sum = sum + scoreArray[0][j]; numOfAssign++; } double average = sum / numOfAssign; for(int k = 0; k &lt; scoreArray.length; k++){ //sum = sum + scoreArray[i][j]; //noOfAssign++; scoreArray[k][scoreArray[k].length-1] = average; } } else{ System.out.println("The Average for the next category: "); for(int j = 1; j &lt; scoreArray[0].length-1; j++){ sum = sum + scoreArray[i][j]; numOfAssign++; } double average = sum / numOfAssign; for(int k = 0; k &lt; scoreArray.length; k++){ //sum = sum + scoreArray[i][j]; //noOfAssign++; scoreArray[k][scoreArray[k].length-1] = average; } } } return scoreArray; }
accepted answer: http://stackoverflow.com/a/27050836
tagged with: average

http://stackoverflow.com/a/68656896
score: 0
answers question: http://stackoverflow.com/q/27002882
type: Answer
has body: Set is a map underneath i was able to get the diff between two list over a million entries each wrapping it in a HashSet this is a simple code to do it. private List&lt;String&gt;notPresentMethod(final List&lt;String&gt;left,final List&lt;String&gt;right){ final Set&lt;String&gt;setIsFaster = new HashSet&lt;&gt;(right); return left.stream() .filter(((Predicate&lt;String&gt;)setIsFaster::contains).negate()) .collect(Collectors.toList()); } Using only list took over a hour and did not complete. And using this sample took Just seconds.

http://stackoverflow.com/q/27006381
accepted answer: http://stackoverflow.com/a/27006517
has answer: http://stackoverflow.com/a/27006530
tagged with: reflection
tagged with: java
type: AnsweredQuestion
upvote count: 20
downvote count: 0
has comment: http://stackoverflow.com/comment/42541786
favorite count: 0
type: Question
has body: I am using reflection to put all my class's member variables that are of type Card class into an ArrayList&lt;Card&gt; instance. How do I finish this last part (see commented line below)? ArrayList&lt;Card&gt; cardList = new ArrayList&lt;Card&gt;(); Field[] fields = this.getClass().getDeclaredFields(); for (Field field : fields) { if (field.getType() == Card.class) { //how do I convert 'field' to a 'Card' object and add it to the 'cardList' here?
has answer: http://stackoverflow.com/a/27006517
has comment: http://stackoverflow.com/comment/42541760
score: 20
answer count: 2
has title: How to cast field to specific class using reflection in java?
possible better answer: http://stackoverflow.com/a/27006530

http://stackoverflow.com/comment/42525572
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26997430
has text: First thing I will do is check file extension as they are hidden hence confusing. It might be configuration.yml.txt. Best way to check it on command prompt
score: 0

http://stackoverflow.com/comment/42706265
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27096043
has text: Checking more on this topic. I will get back to you ASAP.

http://stackoverflow.com/q/27088169
tagged with: java
type: Question
tagged with: apache
has body: I have a 2 documents 1 original and 1 edited, and then I compared them to determine those changes made. How can I get the revisions/changes as array/list?
upvote count: 2
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/docx
type: UnansweredQuestion
has title: Apache POI get the list of word document revisions
has answer: http://stackoverflow.com/a/27088316
score: 2
tagged with: apache-poi
downvote count: 0

http://stackoverflow.com/q/27071904
has comment: http://stackoverflow.com/comment/42656209
type: Question
has comment: http://stackoverflow.com/comment/42657389
tagged with: if-statement
tagged with: jsp
upvote count: 1
has title: <c: choose> condition in jsp executes all conditions
answer count: 1
downvote count: 0
favorite count: 0
tagged with: el
linked to: http://stackoverflow.com/q/27054792
accepted answer: http://stackoverflow.com/a/27073113
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27073113
score: 1
tagged with: java
tagged with: mysql
has body: I am trying to make a simple MySQL, Java JDBC web app in Netbeans. I wish to display different stuff depending on a status variable in the current session. I have tried the following method: Firstly I have the following code in a .jsp page: &lt;c:choose&gt; &lt;c:when test="${sessionScope.Staff.getStatus() == staff.default_staff_status}"&gt;Default staff&lt;/c:when&gt; &lt;c:when test="${sessionScope.Staff.getStatus() == staff.financial_staff_status}"&gt;Financial staff&lt;/c:when&gt; &lt;c:when test="${sessionScope.Staff.getStatus() == staff.legal_staff_status}"&gt;Legal staff&lt;/c:when&gt; &lt;c:otherwise&gt;Secretarial staff&lt;/c:otherwise&gt; &lt;/c:choose&gt; And secondly I have the following code in a .jsp page: &lt;c:if test = "${sessionScope.Staff.getStatus() == Staff.default_staff_status}" &gt; Default staff &lt;/c:if&gt; &lt;c:if test = "${sessionScope.Staff.getStatus() == Staff.financial_staff_status}" &gt; Financial staff &lt;/c:if&gt; &lt;c:if test = "${sessionScope.Staff.getStatus() == Staff.legal_staff_status}" &gt; Legal staff &lt;/c:if&gt; &lt;c:if test = "${sessionScope.Staff.getStatus() == Staff.secretarial_staff_status}" &gt; Secretarial staff &lt;/c:if&gt; sessionScope.Staff gives an object StaffData defined as: public class StaffData { protected final byte default_staff_status = 0; protected final byte financial_staff_status = 1; protected final byte legal_staff_status = 2; protected final byte secretarial_staff_status = 3; private byte status; //Other data StaffData() { //Constructor } //Other methods public byte getStatus() { return this.status; } public byte getDefault_staff_status() { return this.default_staff_status; } public byte getFinancial_staff_status() { return this.financial_staff_status; } public byte getLegal_staff_status() { return this.legal_staff_status; } public byte getSecretarial_staff_status() { return this.secretarial_staff_status; } } By both methods, my output is: Default staff Financial staff Legal staff Secretarial s…

http://stackoverflow.com/a/27241327
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27130623
type: Answer
answers question: http://stackoverflow.com/q/27130623
score: 2
has comment: http://stackoverflow.com/comment/42959820
has body: Java threads (in the long ago) were implemented with non-native threads called Green threads. More modern versions of Java do utilize native threads which are similar to C++ threads but are a bit more abstract. Further, there still might be a many to many relationship between Java threads and the native OS threads (see Query by Slice, Parallel Execute, and Join: A Thread Pool Pattern in Java and of course a M:N model is pretty much mandatory on Windows) in which case they are still built on native threads but they are not (necessarily) isomorphic (1:1) to native threads.
type: AcceptedAnswer

http://stackoverflow.com/comment/42632200
score: 0
has text: yeah ,I placed all jar the files in WEBINF/classes .. now it's Working.. ! thank you Tiny
comment on: http://stackoverflow.com/q/27055347
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27094071
accepted answer of: http://stackoverflow.com/q/27094036
type: Answer
answers question: http://stackoverflow.com/q/27094036
has comment: http://stackoverflow.com/comment/42694297
has body: The anonymous class instance you're passing is overriding the call(String s) method. Whatever is receiving this anonymous class instance is something that wants to make use of that call() method during its execution: it will be (somehow) constructing strings and passing them (directly or indirectly) to the call() method of whatever you've passed in. So the fact that you're not invoking the method you've defined isn't a worry: something else is doing so. This is a common use case for anonymous inner classes. A method m() expects to be passed something that implements the Blah interface, and the Blah interface has a frobnicate(String s) method in it. So we call it with m(new Blah() { public void frobnicate(String s) { //exciting code goes here to do something with s } }); and the m method will now be able to take this instance that implements Blah, and invoke frobnicate() on it. Perhaps m looks like this: public void m(Blah b) { b.frobnicate("whatever"); } Now the frobnicate() method that we wrote in our inner class is being invoked, and as it runs, the parameter s will be set to "whatever".
downvote count: 0
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42694373
upvote count: 3

http://stackoverflow.com/q/27105677
tagged with: power-law
has answer: http://stackoverflow.com/a/27108222
has comment: http://stackoverflow.com/comment/42716105
has comment: http://stackoverflow.com/comment/42715404
has title: Zipf's Law in Java for text generation - too slow
accepted answer: http://stackoverflow.com/a/27108222
type: AnsweredQuestion
tagged with: performance
has body: Hey there I'm working on a textgenerator, that should generate millions of different texts. to make the content of each text realistic I used Zipf's Law It is working well, the word distribution is correct. But the following next() function is executing very slow and since I want to generate millions of articles it has to be changed. (The while loop is the slow part) Can someone help me with this? I implemented it like this: public int next() { int rank; double frequency = 0; double dice; rank = rnd.nextInt(size); frequency = (1.0d / Math.pow(rank, this.skew)) / this.bottom; dice = rnd.nextDouble(); while (!(dice &lt; frequency) || (rank == 0)) { rank = rnd.nextInt(size); frequency = (1.0d / Math.pow(rank, this.skew)) / this.bottom; dice = rnd.nextDouble(); } return rank; } EDIT: I obtainded the code from : http://diveintodata.org/2009/09/13/zipf-distribution-generator-in-java/
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/27111610
has comment: http://stackoverflow.com/comment/42714893
type: Question
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/42715219
has answer: http://stackoverflow.com/a/47916986
answer count: 3
possible better answer: http://stackoverflow.com/a/47916986
favorite count: 0

http://stackoverflow.com/a/27148719
score: 7
has body: You can't, it's either full domain, null or all: *. Like spec says: http://www.w3.org/TR/cors/#access-control-allow-origin-response-header
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/27147737
downvote count: 1
has comment: http://stackoverflow.com/comment/92373169

http://stackoverflow.com/comment/42594889
has text: Passing id , pwd from java form to server in python service.
type: Comment
comment on: http://stackoverflow.com/q/27037102
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42563336
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27016609
has text: possible duplicate of ["Element is not currently visible and so may not be interacted" while trying to click on sub-menus](http://stackoverflow.com/questions/19679748/element-is-not-currently-visible-and-so-may-not-be-interacted-while-trying-to)

http://stackoverflow.com/q/27109158
type: Question
tagged with: perforce
has body: I have a tool what uses Perforce. When it merge a branch back to the parent, mark the project branch with checkout a text file, and submit it unchanged. This tool also use that text file, for read the actual build number. My problem is, a "/n" appeared in the text, and because it have to contain just numbers, it's a big problem. Have anyone met this problem, or this can't caused by P4C? Maybe important, I don't use P4JAVA here. Please note that I'm debugging right now, and I'm not sure the problem is here, but at the moment this seems the most probable. //&lt;path&gt; is a legit path, I just shortened the code here commandSync = "p4 -d " + getPerforceRoot() + " sync " + selectedDataBean.getP4Path() + "&lt;path&gt;/BuildNum.txt"; CommandResultBean syncCommandResult = commandExecuter.runAndGetResults(commandSync); //command executer that runs the command string in cmd commandMark = "p4 -d " + getPerforceRoot() + " edit -c " + changelistNumber + " " + selectedDataBean.getP4Path() + "&lt;path&gt;/BuildNum.txt"; CommandResultBean markCommandResult = commandExecuter.runAndGetResults(commandMark); commandSubmit = "p4 -d " + getPerforceRoot() + " submit -f submitunchanged -c " + changelistNumber; CommandResultBean submitCommandResult = commandExecuter.runAndGetResults(commandSubmit);
score: 1
has comment: http://stackoverflow.com/comment/42750179
tagged with: java
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43210622
favorite count: 0
has comment: http://stackoverflow.com/comment/42768545
has comment: http://stackoverflow.com/comment/42725659
has title: P4 edit can cause whitespace without edit?
answer count: 0
type: UnansweredQuestion
tagged with: whitespace

http://stackoverflow.com/q/27009350
has comment: http://stackoverflow.com/comment/42546465
type: Question
has body: I need to display log files in a folder, which has date and time appended to the file name ,from a particular start date to a particular end date .how would I do that please help.
has comment: http://stackoverflow.com/comment/42584702
has answer: http://stackoverflow.com/a/27009509
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42584696
has comment: http://stackoverflow.com/comment/42546461
has comment: http://stackoverflow.com/comment/42584682
has answer: http://stackoverflow.com/a/27009453
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/10609596
has title: Display log file names from a start date to end date

http://stackoverflow.com/q/26994294
has comment: http://stackoverflow.com/comment/42519295
has body: I am working on a Spring-MVC application. In this, I am trying to upload an image and save it in database. During that process, I tried to convert the binary data of the image to a String, and I noticed that the images binary data is truncated. Generally, if you take a image of 20-30kb, then in String one can see atleast 500-600 characters, I can only see 6-8. I am showing how I have implemented the image save and display. Kindly let me know what I am doing wrong.. Entity : @Entity @Table(name = "product") public class ProductBasic { @Column(name = "productimage") byte[] productimage; public byte[] getProductimage() { return productimage; } public void setProductimage(byte[] productimage) { this.productimage = productimage; } } Product service while saving. : @Transactional @Service public class ProductBasicServiceImpl implements ProductBasicService{ private ProductBasicDAO productBasicDAO; public void setProductBasicDAO(ProductBasicDAO productBasicDAO) { this.productBasicDAO = productBasicDAO; } @Override @Transactional public void addProduct(User user, ProductBasic p){ p.setProductimage(org.apache.commons.codec.binary.Base64.encodeBase64(p.getProductimage())); this.productBasicDAO.addProduct(user, p); } } Controller for sending image as bytearray : @RequestMapping(value = "/product/{id}/image") public byte[] retrieveimage(@PathVariable("id")Integer id){ ProductBasic productBasic1 = productBasicService.getProductById(id); if(productBasic1.getProductimage()==null){ System.out.println("product by id image is null"); return null; }else { System.out.println("Product by id image is not null"); byte[] data = org.apache.commons.codec.binary.Base64.decodeBase64(productBasic1.getProductimage()); // When I convert above byte[] to String using String builder and append data:image/png;bas64, I get String as "data:image/png;base64,B[jak23424==" return data; } } JSP : <form:label path="productimage"> <spring:message text="productimage"/> </form:label> <form:input type="file" pat…
linked to: http://stackoverflow.com/q/4386030
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42519665
tagged with: spring
has comment: http://stackoverflow.com/comment/42519468
has comment: http://stackoverflow.com/comment/42520281
answer count: 0
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/42519159
has comment: http://stackoverflow.com/comment/42519193
score: 0
has title: Hibernate image getting truncated while saving

http://stackoverflow.com/comment/42604754
type: AnswerComment
comment on: http://stackoverflow.com/a/27019962
type: Comment
score: 0
has text: Why downvote? I am just providing an alternative answer to people having the same question. No problem for not accepting, but why downvote?

http://stackoverflow.com/a/27000389
answers question: http://stackoverflow.com/q/27000220
has comment: http://stackoverflow.com/comment/42531199
type: AcceptedAnswer
score: 0
has body: You need to join your views on event_id like this : select vtm.*, ( select count(*) from VW_Detail vtc inner join VW_Master vtm2 on vtc.event_id = vtm2.event_id where vtc.user_id = vtm.user_id and vtc.provider_id = vtm.provider_id and vtm2.status = 'CLOSE' ) from VW_Master vtm where vtm.status = 'OPEN' or vtm.status = 'PEND'; This one is doing the job and I think despite of the subrequest it is still more efficient than the request with the cartesian product. I hope it will help.
type: Answer
accepted answer of: http://stackoverflow.com/q/27000220

http://stackoverflow.com/a/27114003
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27113608
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42730955
has body: Summary At the language level, there's no fundamental difference. What some people might call "nested if" and "multi-way if" are really just two particular configurations of nested if/else blocks. They're certainly not the only options, let alone mutually-exclusive. Detail In general, conditions can be nested arbitrarily deeply: if (a) { stuff(); if (b) { ... } else { ... } } else { moreStuff(); if (c) { ... } else { ... } } What we call "nested if" is really just this: if (a) { // Blank! if (b) { ... } else { // Blank! } } else { // Blank! } and "multi-way if" is really just this: if (a) { ... } else { // Blank! if (b) { ... } else { ... } } (Note: there is no else if construct in C.)
has comment: http://stackoverflow.com/comment/42730987

http://stackoverflow.com/q/27075280
has body: I used JSOUP to get some text from urls in my app. Its working fine most of the times but some time its not working. Like if I exit the app and reopen it then it works, sometime not. try { Document document = Jsoup .connect(url) .userAgent( "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0") .get(); Elements myin = null; myin = document.select("div.fontdef1"); desc = myin.text().toString(); } catch (IOException e) { e.printStackTrace(); } The url I used is like url=http://www..abc.com/"+data+"/ ,String data changes for each case. Does anyone have any idea?
type: Question
tagged with: jsoup
has title: JSOUP not working as expected
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42885771
answer count: 0
has comment: http://stackoverflow.com/comment/42819531
type: UnansweredQuestion
tagged with: html-parsing
has comment: http://stackoverflow.com/comment/42661949
has comment: http://stackoverflow.com/comment/42662602
has comment: http://stackoverflow.com/comment/42812713
tagged with: java

http://stackoverflow.com/comment/42678752
has text: Is the error you're asking about: `Title: Doe Firstname Mr Surname John` being out of order? Why are you assigning `name = new Name(titleRead, FNameRead, SNameRead);` and such, instead of calling your Passenger constructor?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27084803

http://stackoverflow.com/comment/42800258
type: Comment
has text: I fixed errors, app opening normally but on analytics' real time window there is no action. Still "0" visitor
comment on: http://stackoverflow.com/a/27152725
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42542382
comment on: http://stackoverflow.com/a/27006682
type: AnswerComment
score: 0
type: Comment
has text: although I am not understanding the logic that you are trying to use.

http://stackoverflow.com/comment/42562270
type: QuestionComment
has text: Several possibilites. You can either use margins on your views, or set the translation... or override onLayout/onMeasure in a custom viewgroup. Beware of clipped children!
comment on: http://stackoverflow.com/q/27018734
score: 0
type: Comment

http://stackoverflow.com/comment/42705444
comment on: http://stackoverflow.com/a/27098678
type: AnswerComment
has text: "create user 'root'@'@' identified by 'root';" are you sure that this command is correct?
score: 0
type: Comment

http://stackoverflow.com/q/27056799
has answer: http://stackoverflow.com/a/27056899
score: 1
linked to: http://stackoverflow.com/q/2246819
upvote count: 1
has answer: http://stackoverflow.com/a/27057368
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42629261
tagged with: java
has comment: http://stackoverflow.com/comment/42630655
tagged with: data-structures
type: Question
possible better answer: http://stackoverflow.com/a/27057048
has body: I'm wondering about the best way to implement a matrix in Java in which columns and rows have to be easily added/removed. Something like double[][] matrix seems quite heavy when it comes to column/row removal. I did some searches but could not find a design pattern (or so) dealing with this. Do you have any suggestion? I'm not looking for a library but more some guidelines on what is needed. I was thinking of a mix of Lists and Maps but I'm not sure that's the most efficient. This link provides a bit of help but I'm sure there is a design pattern for this, or at least a nice way to do it. Here are some more specifications: I expect the matrix to be 300x300 big in general. I need to do many manipulations though (I'm doing a heuristic that updates it a lot, hundreds times/sec), thus I can't browse it every time I want to update it. There's no maximum size but I don't expect it to be larger that 5000x5000.
answer count: 3
tagged with: matrix
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42637298
accepted answer: http://stackoverflow.com/a/27056899
has comment: http://stackoverflow.com/comment/42629533
has title: Java dynamic matrix structure
has answer: http://stackoverflow.com/a/27057048

http://stackoverflow.com/comment/42651901
type: Comment
comment on: http://stackoverflow.com/a/27068333
has text: By adding the Inject tag, you are adding some sort of annotation, thus letting Guice know what to do. The same applies to Spring, but instead of the Inject tag, you use @Autowire
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42659446
type: QuestionComment
score: 2
has text: @MLProgrammer-CiM Most of what you have said is not true. You _can_ have multiple classes per file. Subclasses do _not_ have to be "declared as static". Method privacy is unrelated to anything in the question.
comment on: http://stackoverflow.com/q/27073712
type: Comment

http://stackoverflow.com/a/27071314
type: Answer
answers question: http://stackoverflow.com/q/27070622
score: 0
has body: The getBalance() method doesn't have a return type and yet you asked it to return a value. Also try to follow the Java naming conventions, a variable name should not start with a capital letter.

http://stackoverflow.com/a/27084959
downvote count: 0
score: 1
has body: Looks like the problem, if anywhere, would be in Name::toString() or that the order of the parameters are wrong in new Name(x, y, z) String nameAndAge = "Name = " + name + ", DOB = " + dateOfBirth; But you haven't posted the Name class.
type: Answer
has comment: http://stackoverflow.com/comment/42678776
accepted answer of: http://stackoverflow.com/q/27084803
upvote count: 1
answers question: http://stackoverflow.com/q/27084803
type: AcceptedAnswer

http://stackoverflow.com/q/27016877
tagged with: java
has answer: http://stackoverflow.com/a/27017689
tagged with: apache-camel
type: Question
answer count: 2
score: 0
has title: create ProducerTemplate for dynamic uri
has body: Common ProducerTemplate usage is to declare a member and annotate with @Produce @Produce(uri = "direct:start") protected ProducerTemplate template; and use as simple as String response = (String) template.requestBody(MESSAGE_BODY); what if my uri is not known at compile time, how could I create ProducerTemplate?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27017720

http://stackoverflow.com/a/27152560
type: Answer
has body: Use Integer.parseInt(String s): int val = Integer.parseInt(jr1.get(k));
has comment: http://stackoverflow.com/comment/42799685
upvote count: 4
answers question: http://stackoverflow.com/q/27152495
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/42800409

http://stackoverflow.com/comment/42824805
comment on: http://stackoverflow.com/a/27152007
type: Comment
has text: When JVM starts with enabled debug it prints to STDOUT `Listening for transport dt_socket at address: 5555`. Since your debug is configured to suspend it should print this phrase and freeze until you connect with debugger. Does it happen when you run ant script?
score: 1
type: AnswerComment

http://stackoverflow.com/q/27049360
favorite count: 0
tagged with: osgi
upvote count: 1
answer count: 1
tagged with: bndtools
has title: How can I avoid having bnd create Private-Package entries from Bundle-ClassPath?
tagged with: java
has body: I'm trying to create a bundle that wraps a jar, and all its dependencies (about 20 other jars) and exposes an interface of my own devising. I don't want to create bundles for all the dependencies since I want to create a "sealed component" that contains the whole mess. A sample bnd file that shows the problem looks like Bundle-Version: 0.0.0.${tstamp} Export-Package: \ pub Include-Resource: lib=lib/ Bundle-ClassPath: .,lib/ant-1.9.3.jar (This is just a sample... In the real world there are about 20 entries in Bundle-Classpath) The last line being the problem. The Include-Resource entry will suck the wrapped jar and all it's dependencies into the bundle and that works great. However, adding all the jars to the Bundle-ClassPath causes bnd to add them to Private-Package. Normally I wouldn't care except that there are so many packages in the included jars that the bnd file gets HUGE, and bndtools blows up trying to create it. I've tried creating Private-Package by hand and putting it in the bnd file, but bnd just overwrites it.
has answer: http://stackoverflow.com/a/27065924
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16936310
tagged with: bnd
type: Question
has comment: http://stackoverflow.com/comment/61119674
score: 1

http://stackoverflow.com/a/27131802
accepted answer of: http://stackoverflow.com/q/27053097
has comment: http://stackoverflow.com/comment/42839598
has body: I used both your models as you posted in the above link and tested successfully. As @Andrei mentioned in his comment the problem is not in mapping, it should be the way you saving them. Following are the code snippets i used for testing. User @Entity public class User extends Model{ / ..... fields as it is in your post public User(String user_id){ this.userId = user_id; } public static Finder&lt;Long, User&gt; find = new Finder&lt;Long, User&gt;(Long.class, User.class) public static User findByUserID(String user_id){ /* Your models already in bi-directional relationship, so there is no need for external `fetch`, You can directly get `UserLegalName` object from `User` model if there is any match found on `UserLegalName` for the input. */ return find.where().eq("userId",user_id).findUnique(); } } UserLegalName @Entity public class UserLegalName extends Model { / ..... fields as it is in your post public UserLegalName(User user_id, String first_name, String last_name){ this.user = user_id; this.firstName = first_name; this.lastName = last_name; } } Controller public class TestController extends Controller { public static Result insertUser(String user_id, String fname, String lname) { User user = new User(user_id); UserLegalName legal = new UserLegalName(user,fname,lname); user.legalName = legal; user.save(); return ok(user.legalName.firstName); } public static Result getUser(String user_id) { User user = User.findByUserID(user_id); return ok(user.legalName.firstName); } } Routes GET /test/:userID/:fname/:lname controllers.TestController.insertUser(userID : String, fname : String, lname : String) GET /user/:userID controllers.TestController.getUser(userID : String)
answers question: http://stackoverflow.com/q/27053097
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42841858
has comment: http://stackoverflow.com/comment/42821750
has comment: http://stackoverflow.com/comment/42813074
type: Answer
has comment: http://stackoverflow.com/comment/42853761
score: 2
upvote count: 2

http://stackoverflow.com/comment/42717014
type: Comment
comment on: http://stackoverflow.com/q/27105160
score: 0
has text: @M.Deinum How to provide the jdbcUrl value? Should it include database schema also? Like jdbc:mysql://localhost:3306/app?
type: QuestionComment

http://stackoverflow.com/q/27105770
has comment: http://stackoverflow.com/comment/42714958
has body: I previously posted a question and now my pane displays the question and choices a-d. When user selects choice and clicks next there is no action. I want the user to choose their option, click next, have the quiz display "correct" or "incorrect", and move to the next answer. I believe my error is in the actionPeformed() method or the getSelection() method. I had to also create a new method with an array to provide the answers. I tried running debugger and getting no variables to display. Not sure how I made a mess of the code as I thought it would run as expected. Please help. If interested previous post can be found at java quiz only accessing constructor First file class Test2 extends JFrame implements ActionListener { JPanel panel; JPanel panelresult; JRadioButton choice1; JRadioButton choice2; JRadioButton choice3; JRadioButton choice4; ButtonGroup bg; JLabel question; JButton next; String[][] questions; String[][] choices; int qaid; HashMap&lt;Integer, String&gt; map; public Test2() { setTitle("Tennis Quiz"); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(430, 350); setLocation(300, 100); setResizable(false); Container cont = getContentPane(); cont.setLayout(null); cont.setBackground(Color.GRAY); bg = new ButtonGroup(); choice1 = new JRadioButton("A"); choice2 = new JRadioButton("B"); choice3 = new JRadioButton("C"); choice4 = new JRadioButton("D"); bg.add(choice1); bg.add(choice2); bg.add(choice3); bg.add(choice4); question = new JLabel("Choose a correct answer"); question.setForeground(Color.BLUE); question.setFont(new Font("Aria", Font.BOLD, 11)); next = new JButton("Next"); next.setForeground(Color.GREEN); panel = new JPanel(); panel.setBackground(Color.LIGHT_GRAY); panel.setLocation(10, 10); panel.setSize(400, 300); panel.setLayout(new GridLayout(6, 2)); panel.add(question); panel.add(choice1); panel.add(choice2); panel.add(choice3); panel.add(choice4); panel.add(next); cont.add(panel); setVisible(true); setData(); qaid = 0; readqaId(qaid); } public void…
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/42714988
has comment: http://stackoverflow.com/comment/42715011
type: Question
has answer: http://stackoverflow.com/a/27106029
tagged with: java
has comment: http://stackoverflow.com/comment/42714899
accepted answer: http://stackoverflow.com/a/27106029
answer count: 2
possible better answer: http://stackoverflow.com/a/27105914
tagged with: arrays
has title: user input choice not recognized
has answer: http://stackoverflow.com/a/27105914
linked to: http://stackoverflow.com/q/27103388

http://stackoverflow.com/comment/42615902
score: 0
type: Comment
type: AnswerComment
has text: i think it should be myclass[] myArray = new myclass[5]; ?
comment on: http://stackoverflow.com/a/27048923

http://stackoverflow.com/q/27017438
has body: In my program, I want to display an array using Scanner, i.e the user enters the array values during runtime. public class NameComparator { public static void main(String args[]) { Scanner sn = new Scanner(System.in); int n = sn.nextInt(); System.out.println("the array size is" + n); int[] a = new int[7]; for (int i = 0; i &gt;= a.length; i++) { a[i] = sn.nextInt(); System.out.println("the value of a[i]" + a[i]); } sn.close(); System.out.println("array values are"); } } Here, I have got the array size from Scanner and then using for loop to get each array value, but I don't know why the array block hasn't executed. JVM just skips the for loop. Scanner works well
has answer: http://stackoverflow.com/a/27017529
answer count: 5
has answer: http://stackoverflow.com/a/27017530
accepted answer: http://stackoverflow.com/a/27017530
has answer: http://stackoverflow.com/a/27017867
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27017591
tagged with: java
possible better answer: http://stackoverflow.com/a/27017529
type: Question
has title: java array using scanner
has answer: http://stackoverflow.com/a/27017657
score: 0
tagged with: arrays

http://stackoverflow.com/q/27081935
has comment: http://stackoverflow.com/comment/42673302
has body: I have this small piece of simple code but I don't know why I can't get it to work: tagName="Hello"; String value="Hello"; if (tagName!=null && tagName.equals(value)) { int io=0; } tagName is not null and clearly equals to value but the code never hits the line int io=0.
has comment: http://stackoverflow.com/comment/42673250
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27082017
has comment: http://stackoverflow.com/comment/42673244
tagged with: compiler-optimization
score: 0
answer count: 1
has title: String.equals don't return true even when it is
has comment: http://stackoverflow.com/comment/42673310
favorite count: 0
accepted answer: http://stackoverflow.com/a/27082017

http://stackoverflow.com/q/27086845
score: 5
has answer: http://stackoverflow.com/a/27089771
downvote count: 0
favorite count: 0
answer count: 4
has answer: http://stackoverflow.com/a/27086851
has comment: http://stackoverflow.com/comment/42681957
has answer: http://stackoverflow.com/a/27087292
possible better answer: http://stackoverflow.com/a/27086870
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27086870
tagged with: algorithm
has body: public class SumOfTwoDice { public static void main(String[] args) { int SIDES = 6; int a = 1 + (int) (Math.random() * SIDES); int b = 1 + (int) (Math.random() * SIDES); int sum = a + b; System.out.println(sum); } } I've taken this code from the book "Introduction to Programming with Java" by Sedgewick on their online website. I just have a question as to whether a or b could possibly be above 6 if by chance Math.random() is 1.0? Or am I wrong on this? 1.0 * 6 + 1 = 7?
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/27086851
has title: Java Sum Of Two Dice - Will This Code Give Above A 6?
type: Question

http://stackoverflow.com/comment/42625479
score: 0
type: QuestionComment
has text: The best way to deploy a Java desktop application is using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info).
type: Comment
comment on: http://stackoverflow.com/q/27054408

http://stackoverflow.com/comment/42715597
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27105962
has text: almas shaikh,10 should give me 'M' could you please help me.
score: 0

http://stackoverflow.com/comment/42548120
type: Comment
has text: how should i select all the other combobox in the table column when combobox selection occurs for removing the selected item
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27010291

http://stackoverflow.com/comment/42677931
score: 2
has text: You can call setUndecorated() whenever you want, **so long as** your frame is not displayable. That means that your frame must either have never been displayed, or you must call dispose first. Take a look on pasteBin at a program I wrote: http://pastebin.com/i6bBn3K7
comment on: http://stackoverflow.com/a/27084294
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42603964
type: AnswerComment
comment on: http://stackoverflow.com/a/27041442
has text: Thanks for your answer, the probelm's been fixed, but i plan to learn from your answer so if I have any more problems i can look back :)
type: Comment
score: 0

http://stackoverflow.com/comment/43004799
comment on: http://stackoverflow.com/a/27152007
has text: It says "Waiting for vm to connect at port 5555" in the Progress tab When I start debug and nothing is performed and after some time an error is occurred related with server connection.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42603549
has text: java.io.File is obsolete and should not be used anymore, as its methods do not properly report errors. Use [Path](http://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html), [Paths](http://docs.oracle.com/javase/8/docs/api/java/nio/file/Paths.html) and [Files](http://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html) instead.
type: Comment
comment on: http://stackoverflow.com/a/27041486
score: 0
type: AnswerComment

http://stackoverflow.com/q/27021697
has answer: http://stackoverflow.com/a/27022635
type: AnsweredQuestion
has title: is it possible to use between , current_date and subdate functions in hql?
type: Question
tagged with: jakarta-ee
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27022635
tagged with: hql
score: 0
tagged with: sql
has body: I want to write such hql query &lt;query name="user.by.date"&gt; FROM User as u where u.Date between subdate(now(), interval 3 day) and now() If it is wrong how can I change ? where can I see which functions hql support ? what is the difference between NOW() and CURRENT_DATE() ? Is it possible to use CURRENT_DATE() among NOW()
answer count: 1

http://stackoverflow.com/a/27038622
score: 0
accepted answer of: http://stackoverflow.com/q/26992215
answers question: http://stackoverflow.com/q/26992215
type: Answer
has body: Problem solved. Had to use Arraylists of integers in my activity and my dialogfragment. here is what i did in my DialogFragment class: public class TimelineSettings extends DialogFragment { ArrayList&lt;Integer&gt; selected_categories = new ArrayList&lt;Integer&gt;(); boolean[] itemsChecked = {false, false, false, false, false, false}; // this interface to communicate with the host activity. public interface dialoglistener { public void onOkay(ArrayList&lt;Integer&gt; selected); public void onCancel(); } dialoglistener mlistener; //this function is to instantiate the dialoglistener @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mlistener = (dialoglistener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement dialogListener"); } } My multichoice dialog : @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); for(int i=0;i&lt;itemsChecked.length;i++){ if(selected_categories.contains((String)String.valueOf(i))) itemsChecked[i]=true; } // Set the dialog title builder.setTitle("Choisissez vos paramètres") .setMultiChoiceItems(R.array.categories, itemsChecked, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int indexselected, boolean isChecked) { if (isChecked) { // If the user checked the item, add it to the selected items if(!selected_categories.contains(indexselected)){ selected_categories.add(indexselected); itemsChecked[indexselected]=true; } } else if (selected_categories.contains(indexselected)) { // Else, if the item is already in the array, remove it selected_categories.remove(indexselected); itemsChecked[indexselected]=false; } } }) // Set the action buttons .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { mlistener.onOkay(selected_categories); } }) .se…
type: AcceptedAnswer

http://stackoverflow.com/comment/42638573
score: 1
has text: "Every SecretKey has an associated algorithm name." , wouldn't that make the encryption less secure ? shouldn't key should be independent of the algorithm ? , for instance, If someone got the key, wouldn't they be able to identify the algorithm used for encryption ?
comment on: http://stackoverflow.com/a/27059672
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42583387
type: Comment
type: QuestionComment
score: 1
has text: *When you get an exception it is completely and utterly pointless to print anything that doesn't include the message from the exception.* ***Lose this habit.*** Change your `catch` block to print the entire stack trace and post it here, in your question.
comment on: http://stackoverflow.com/q/27030462

http://stackoverflow.com/comment/42759574
has text: Explain us why you think it should stop. Use the javadoc of Reader.read() to help you. Also think about the following points: what is the end of the System.in stream? What is the range of values of a char?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27130269
type: QuestionComment

http://stackoverflow.com/comment/42616144
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27046467
type: Comment
has text: I modified it to return an array.

http://stackoverflow.com/a/27066166
accepted answer of: http://stackoverflow.com/q/27066063
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Comparable&lt;T&gt; is a generic type, but you're using the raw type, losing type safety. You probably want to make your BinNode generic too, in its element type: public class BinNode&lt;T extends Comparable&lt;T&gt;&gt; { private T element; private BinNode&lt;T&gt; left; private BinNode&lt;T&gt; right; public BinNode&lt;T&gt; find(T obj) { // TODO: Handle the cases where left or right is null if (element == null) { return null; } else if (obj.compareTo(left.element) &lt; 0) { return left.find(obj); } else if (obj.compareTo(right.element) &gt; 0) { return right.find(obj); } else { return this; } } public void insert(T obj) { } } The constraint on T then ensures that elements will be comparable with each other. Note that I've also fixed your recursion - previously you were calling left.find() or right.find() but ignoring the return value.
answers question: http://stackoverflow.com/q/27066063
type: Answer

http://stackoverflow.com/comment/42793284
type: AnswerComment
comment on: http://stackoverflow.com/a/27148880
score: 0
type: Comment
has text: Thanks KeAn, but the details need to be declared as well. Also, return CsvFiles[] is still showing '.class' expected error.

http://stackoverflow.com/comment/42556425
comment on: http://stackoverflow.com/q/27014435
has text: what is signature of your controller method
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27016742
upvote count: 1
has body: Using the Maven EAR Plugin - Skinny Wars feature has worked well for me for this problem.
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42559028
answers question: http://stackoverflow.com/q/27016453
type: Answer
accepted answer of: http://stackoverflow.com/q/27016453

http://stackoverflow.com/q/27011015
tagged with: java
tagged with: mysql
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27011509
type: Question
tagged with: javascript
answer count: 2
has title: How to fetch data from database in table at every 15 minute?
has answer: http://stackoverflow.com/a/27011743
favorite count: 0
has comment: http://stackoverflow.com/comment/42548884
has body: I had store 8 days data in mysql database. I want to retrieve those data in jsp page at every 15 minute . please give some hint to resolve my problem..
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/27007107
type: Question
has answer: http://stackoverflow.com/a/44105368
has title: How to apply Simple Factory Pattern Java
linked to: http://stackoverflow.com/q/6191710
has answer: http://stackoverflow.com/a/27007371
score: -1
possible better answer: http://stackoverflow.com/a/27008787
tagged with: factory-pattern
has answer: http://stackoverflow.com/a/27008787
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/42543375
favorite count: 0
has body: I am trying ot understand how to apply a the simple factory pattern to an assigment I have but I do not understand how to do it. This is the request: Apply the Simple Factory pattern that creates the appropriate Strategy object. Remember, this is a Simple Factory pattern. Draw the UML diagram of the new design. We already implemented the strategy pattern but I do not understand how to apply the simple factory pattern to the code. I understand that the simple factory pattern is supposed to provide encapsulation for the creation of the object but I do not see how the examples I have found show how to apply to this. Any help would be appreciated. EDIT: Updated code EDIT: Changed code to make use of polymorphism package Client; import domain.Loan; import factory.StrategyFactory; import strategy.ComplexLoan; import strategy.ICapitalStrategy; public class Client { public static void main(String[] args){ Loan complexLoan = new Loan(2.2, 2, 3.3, 4.4, 5, 6, 7, StrategyFactory.getComplexStrategy()); System.out.print("hello"); } } package factory; import strategy.ComplexLoan; import strategy.ICapitalStrategy; import strategy.RevolvingLoan; import strategy.TermLoan; public class StrategyFactory { /* public static ICapitalStrategy getStrategy(String type) { if (type.equals("Complex")){ return new ComplexLoan(); } else if (type.equals("Revolving")){ return new RevolvingLoan(); } else if (type.equals("Term")){ return new TermLoan(); } return null; } */ public static ICapitalStrategy getComplexStrategy() { return new ComplexLoan(); } public static ICapitalStrategy getRevolvingStrategy() { return new RevolvingLoan(); } public static ICapitalStrategy getTermStrategy() { return new TermLoan(); } } package domain; import strategy.ICapitalStrategy; public class Loan { private ICapitalStrategy strategy; double commitment; int duration; double riskFactor; double unusedPercentage; int outstandingRiskAmount; int unusedRiskAmount; double unusedRiskFactor; double capital; public Loan(double c…
accepted answer: http://stackoverflow.com/a/27007371
tagged with: design-patterns
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1673841
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/42544951

http://stackoverflow.com/comment/42581808
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27029220
has text: Then the first method should work, as you are specifying the values the the printer should use...

http://stackoverflow.com/a/27049885
has comment: http://stackoverflow.com/comment/42618270
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42617589
has body: check your application name in manifest android:name="com.google.android.gms.version" just delete these two lines from application tag inside your manifest file android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" and put them in meta-data tag &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/&gt;
has comment: http://stackoverflow.com/comment/42618173
answers question: http://stackoverflow.com/q/27049844

http://stackoverflow.com/comment/42733212
comment on: http://stackoverflow.com/a/27114816
score: 0
type: Comment
has text: @LuiggiMendoza If you mean using a temp `TreeMap` to sort the `LinkedHashMap` (e.g. `TreeMap<...> tm = new TreeMap<>(lhm, valueComparator); lhm.clear(); lhm.putAll(tm);`), I don't really think it is a good idea. Either values then need to be unique or you need [a hack Comparator](http://stackoverflow.com/a/4702335/2891664).
type: AnswerComment

http://stackoverflow.com/a/27093058
answers question: http://stackoverflow.com/q/27093001
upvote count: 4
has comment: http://stackoverflow.com/comment/42692060
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42692191
score: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/42692398
has comment: http://stackoverflow.com/comment/42692320
accepted answer of: http://stackoverflow.com/q/27093001
has body: It would make more sense to change the constructor from: /** DO WHATEVER***/ to something like: Car(String name, String color){ this.name = name; this.color = color; } and later on to the insertion into the list: myCars.add(new Car("Geep", "Black")); myCars.add(new Car("Camry", "red")); ... In case you don't have "the details" of the cars, and you simply need to instantiate a list with 50 cars and later on "add the details" - another question raises: where do the details come from ? if you don't know it in advance it has to come from an eternal source (user-input, file, etc) and then it would make sense to run in a loop over the list and add the details: for (Car car : myCars) { String name = ... // get the details of the car from an external source String type = ... // get the details of the car from an external source car.setName(name); // of course you'll have to implement setName() and setType() car.setType(type); // which is a better practice than exposing the class members via public access }
type: Answer

http://stackoverflow.com/q/27041741
has body: I have encountered strange behaviour of nullcheck analysis under Spring tool suite 3.6.2 (Eclipse clon) on windows 7 64bit with Oracle java 8u25. The same maven project with java 7 source compatibility successfully finds NPE error in eclipse, but when I change compilation version in maven to java 1.8, the eclipse is unable to find this error. My nullcheck analysis configuration in Eclipse (Java->Compiler->Errors/Warnings->Null analysis) is: Include asserts in null analysis true Enable annotation based analysis true NotNull custom annotation is properly set to javax.validation.constraints.NotNull etc. (everything seems to be OK, as it works under java 7) My maven pom is here http://pastebin.com/pF1yJSG2 , as mentioned above when java.version in pom is 1.7 null check works, when is 1.8 null check does not work. Sample source code is: package test.nullcheckbug.core; import javax.validation.constraints.NotNull; public class Program { /** * This will fail to compile under java 7 (null analysis works in STS * 3.6.2). But under java 8 it does not show error in Eclipse Markers - * static analysis does not work ?! * * @return null which is not allowed */ @NotNull public String fail() { return null; } /** * Simple main. * * @param args * ignored args */ public static void main(String[] args) { } } Does anybody know where is problem and how to enable nullcheck to work under jdk 1.8 compatibility ? EDITED: Maven seems to be not involved. The same problem simulated on non maven project with the same source code and compatibility level of compiler set to 1.7. Is it a bug ? EDITED-2: After more examination I have found that the following difference in annotation makes difference : java.lang.annotation.ElementType.TYPE_USE , when annotation does not have this, the nullcheck is not detected under Java 8, but is detected under Java 7. But why ?! Why there is so different behaviour ?! EDITED-3: After research from MartinLippert and tested by me it seems that nullcheck API has drastica…
has comment: http://stackoverflow.com/comment/42640617
tagged with: maven
accepted answer: http://stackoverflow.com/a/28751176
type: AnsweredQuestion
has title: Null analysis in eclipse compatibility break between 7 and 8
tagged with: java
has comment: http://stackoverflow.com/comment/42640067
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42640387
score: 5
has comment: http://stackoverflow.com/comment/42633519
upvote count: 5
tagged with: sts-springsourcetoolsuite
has answer: http://stackoverflow.com/a/28751176
downvote count: 0
answer count: 1
tagged with: null-check
favorite count: 0

http://stackoverflow.com/comment/42747606
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27112784
has text: What type is `EntityManager`? I can't find any reference to `insert()` method.

http://stackoverflow.com/comment/42586013
type: Comment
comment on: http://stackoverflow.com/a/27032035
score: 0
type: AnswerComment
has text: I've added my xml file if that helps. The java code I've pasted is the entire complete code for that method. The method is simply called when a button is pressed.

http://stackoverflow.com/comment/42787665
comment on: http://stackoverflow.com/q/27098095
has text: I fix the problem by changing the port number in my MySQL's conf file to 3306. After that added a the jar file `hibernate-3.2.7.ga.jar` into my tomcat lib folder..
score: 0
type: Comment
type: QuestionComment

select
tags question: http://stackoverflow.com/q/27133007
type: Tag
tags question: http://stackoverflow.com/q/27089923
tags question: http://stackoverflow.com/q/27134554
tag name: select

http://stackoverflow.com/comment/42654710
type: QuestionComment
comment on: http://stackoverflow.com/q/27070523
has text: @Tom Complete success, that was the problem I was suppose to put brackets in. Please make this an official answer so that I can mark it. Thanks!
score: 0
type: Comment

http://stackoverflow.com/comment/42665017
type: Comment
type: QuestionComment
has text: This requirement is kind of odd. You want to split by a spacce and by a slash, but only the slash should be in the resulting array? I guess you need call the split* method two times. (* your implementation of it, that can keep the delimiter)
comment on: http://stackoverflow.com/q/27077162
score: 0

http://stackoverflow.com/q/27134158
has comment: http://stackoverflow.com/comment/42767187
has answer: http://stackoverflow.com/a/27134690
score: 0
has title: Send excel file from server-side to client-side using GWT
has comment: http://stackoverflow.com/comment/42767197
tagged with: apache-poi
has answer: http://stackoverflow.com/a/27134674
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1442893
has comment: http://stackoverflow.com/comment/42766783
type: Question
tagged with: gwt
tagged with: java
has body: I have implemented a function that let's users save content from a hashmap in an excel file. The code to do so is server-side. I want the user to be able to save the file in an optional file location on his/her own computer. I have read quite a few post on stack overflow, where specifics on how to do so is discussed. But I can't see the whole picture. Any htought on how I should tackle this problem? I am using GWT and apache poi for the excel file generation.
answer count: 2
tagged with: apache

http://stackoverflow.com/q/27129647
tagged with: ioexception
tagged with: java
has title: Android MediaPlayer create failed
answer count: 1
downvote count: 0
favorite count: 0
tagged with: media-player
has answer: http://stackoverflow.com/a/27129785
type: UnansweredQuestion
tagged with: android
score: 1
upvote count: 1
has body: My problem is the following: I want to create a really simple App, that shall play a song when i press a button. public class MainActivity extends ActionBarActivity { int counter; Button add1; Button sub1; Button sound; TextView display; MediaPlayer mySound; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); if (mySound==null){ mySound = MediaPlayer.create(this, R.raw.tetris_theme); } else { mySound.release(); } sound = (Button) findViewById(R.id.button1); display = (TextView) findViewById(R.id.textView2); sound.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //TODO Auto-generated method stub if (mySound==null){ display.setText("Error"); } else { mySound.start(); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } When I run the app and press the button "sound" it displays "Error"(since I checked whether mySound is null or not) So, I figured that meant that the mySound MediaPLayer I created is null. I checked the logcat and it showed the following: 11-25 14:27:02.900: E/MediaPlayer(1…
type: Question

http://stackoverflow.com/a/27088825
has body: Add an EditText to your layout: &lt;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; And now add this code to MainActivity class: ... public class MainActivity extends Activity { public static final String MIME_TEXT_PLAIN = "text/plain"; public static final String TAG = "NfcDemo"; private TextView mTextView; private NfcAdapter mNfcAdapter; private EditText mEditText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTextView = (TextView) findViewById(R.id.textView_explanation); mEditText = (EditText) findViewById(R.id.editText1); //Set Text View value in Edit Text mEditText.setText(mTextView.getText().toString()); ... } ...
score: 0
accepted answer of: http://stackoverflow.com/q/27086324
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27086324
type: Answer

http://stackoverflow.com/q/27079144
has answer: http://stackoverflow.com/a/27079347
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jndi
tagged with: java
type: Question
upvote count: 4
downvote count: 0
score: 4
has title: How to access windows Active Directory anonymously?
tagged with: ldap
has body: In my Java web (JBoss) application, I need to get data from Active Directory. Basically, I know the employee's userID (windows login ID), and I need to know his/her office phone number. I think the only place that contains employee's phone # is Windows Active Directory. So I tried some sample java code and try to get access to Active Directory. Here is a sample code (http://myjeeva.com/querying-active-directory-using-java.html) public ActiveDirectory(String username, String password, String domainController) { properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); properties.put(Context.PROVIDER_URL, "LDAP://" + domainController); properties.put(Context.SECURITY_PRINCIPAL, username + "@" + domainController); properties.put(Context.SECURITY_CREDENTIALS, password); // initializing active directory LDAP connection try { dirContext = new InitialDirContext(properties); } catch (NamingException e) { LOG.severe(e.getMessage()); } // default domain base for search domainBase = getDomainBase(domainController); // initializing search controls searchCtls = new SearchControls(); searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE); searchCtls.setReturningAttributes(returnAttributes); } We can see that I need to have user name and password in order to query user's data in active directory, but it is not possible for me to get all user's password. I also tried to set "password" to "none" which tried to use anonymous access, but it does not work. Does anybody know if it's possible to access Active directory anonymously? I was told in asp.net, it is possible to access active directory without providing user id and password. I am wondering it should be working in Java as well. I appreciate any help or examples. Thanks a lot.

http://stackoverflow.com/comment/42673310
type: Comment
type: QuestionComment
score: 3
has text: you are confused, the assignment certainly occurs. Now the assignment is pointless because once you leave the block, that variable goes away, so there is no point in doing that.
comment on: http://stackoverflow.com/q/27081935

http://stackoverflow.com/q/27126865
has title: Check box Click Method issue ( similar xpath) - WebDriver using java
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/27142971
has answer: http://stackoverflow.com/a/27142634
type: Question
tagged with: jquery
has answer: http://stackoverflow.com/a/27127730
score: 0
tagged with: xpath
has body: two different Div's inside the Div have an check box, so i want to click the checkbox (i.e inside the "divPatPortfolioStatusCount"), both checkbox xpath are similar (i.e By.xpath("//input[@accesskey='2']") Html Code 0, attr: {PortfolioId: Id, DescName:Name}" portfolioid="2" descname="Client-Default"> 0, attr: {StatusId: Id, DescName:Name}" statusid="2" descname="Abandoned"> my Java code WebElement statusDiv= driver.findElement(By.id("divPatPortfolioStatusCount")); WebElement checkBox = statusDiv.findElement(By.xpath("//input[@accesskey='2']")); checkBox.click(); while executing under the "divCreatePortfolio" checkbox only checked not for "divPatPortfolioStatusCount" let me know the problem with my xpath
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27128819
answer count: 4

http://stackoverflow.com/comment/42559823
comment on: http://stackoverflow.com/q/27017294
score: 0
type: Comment
type: QuestionComment
has text: Please add you code.

http://stackoverflow.com/q/27102878
answer count: 4
has answer: http://stackoverflow.com/a/47397311
type: AnsweredQuestion
tagged with: junit
has comment: http://stackoverflow.com/comment/42709804
downvote count: 0
possible better answer: http://stackoverflow.com/a/27103083
linked to: http://stackoverflow.com/q/26508628
has comment: http://stackoverflow.com/comment/42807824
favorite count: 0
has answer: http://stackoverflow.com/a/27156972
type: Question
linked to: http://stackoverflow.com/q/13687055
tagged with: spring
accepted answer: http://stackoverflow.com/a/27166769
score: 4
has comment: http://stackoverflow.com/comment/42808541
tagged with: java
has title: How to create session in Spring Junit
tagged with: unit-testing
has body: I have such layers: Spring Controller -> Services layer -> Dao Layer (JPA). I want to write test cases of services and controller. In the other Junit will invoke controller, controller will invoke services, service layer gets database information and etc.. In this case I do not want mocking, I want just to write junit test case (I must invoke service and service must get real data from database). I have only one problem, service layer get's user id from session. I get session with autowired annotation. How can I create fake session during test cases? p.s I think mock is not for me... because I do not wont to mock my service, I want to create real invoke of controller with real db data...
tagged with: spring-test
has answer: http://stackoverflow.com/a/27103083
upvote count: 4
has answer: http://stackoverflow.com/a/27166769

http://stackoverflow.com/comment/42745231
type: Comment
has text: `and i get so many error from this code` ***Which*** errors?
score: 0
comment on: http://stackoverflow.com/q/27122206
type: QuestionComment

http://stackoverflow.com/comment/42761594
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27128690
has text: This is essentially a duplicate of many of those over there -->
score: 0

http://stackoverflow.com/comment/42740905
comment on: http://stackoverflow.com/q/27119780
has text: check this out. http://stackoverflow.com/questions/7492423/how-can-i-convert-a-timestamp-into-either-date-or-datetime-object
score: 0
type: Comment
type: QuestionComment

interface
tags question: http://stackoverflow.com/q/27015236
tag name: interface
tags question: http://stackoverflow.com/q/27148930
tags question: http://stackoverflow.com/q/27069012
tags question: http://stackoverflow.com/q/27118951
tags question: http://stackoverflow.com/q/27046709
tags question: http://stackoverflow.com/q/27041930
tags question: http://stackoverflow.com/q/27150658
tags question: http://stackoverflow.com/q/27058725
tags question: http://stackoverflow.com/q/27098993
type: Tag
tags question: http://stackoverflow.com/q/27107117
tags question: http://stackoverflow.com/q/27030257
tags question: http://stackoverflow.com/q/27132172
tags question: http://stackoverflow.com/q/27067417
tags question: http://stackoverflow.com/q/27089527
tags question: http://stackoverflow.com/q/27101243
tags question: http://stackoverflow.com/q/27096561
tags question: http://stackoverflow.com/q/27142551
tags question: http://stackoverflow.com/q/27151432
tags question: http://stackoverflow.com/q/27083467

http://stackoverflow.com/a/27046960
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27038351
type: Answer
accepted answer of: http://stackoverflow.com/q/27038351
upvote count: 3
score: 3
has body: Changing JUnit output As described in this blog you can write your own test listener and print out your own messages for when tests pass or fail. public class ExecutionListener extends RunListener { ... //feel free to override other methods too /** * Called when an atomic test has finished, whether the test succeeds or fails. * */ public void testFinished(Description description) throws java.lang.Exception { System.out.println("Finished execution of test case : "+ description.getMethodName()); } /** * Called when an atomic test fails. * */ public void testFailure(Failure failure) throws java.lang.Exception { System.out.println("Execution of test case failed : "+ failure.getMessage()); } /** * Called when a test will not be run, generally because a test method is annotated with Ignore. * */ public void testIgnored(Description description) throws java.lang.Exception { System.out.println("Execution of test case ignored : "+ description.getMethodName()); } } Then write your own class with a main to run Junit (instead of running the junit.jar) public class ExecuteWithRunListener { public static void main(String[] args) { JUnitCore runner = new JUnitCore(); //Adding listener here runner.addListener(new ExecutionListener()); runner.run(TestFeatureOne.class, TestFeatureTwo.class); } } How to prevent calls from System.exit from actually exiting Your tests can use their own SecurityManager to prevent calls to System.exit from doing anything. The code below will make any calls to System.exit() throw a special Exception which we can catch in our tests to make sure we called exit and to also capture what the exit code was: public static final SecurityManager NON_EXITABLE_MANAGER = new SecurityManager(){ @Override public void checkPermission(Permission perm) { //allow everything } /** * Throws a {@link TriedToExitException} instead of exiting. * &lt;p/&gt; * {@inheritDoc} */ @Override public void checkExit(int status) { throw new TriedToExitException(status); } }; public static f…

http://stackoverflow.com/q/27063652
type: Question
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
has body: I followed the following tutorial in order to get Spring and Rest working with full security and stateless tokens. http://captechconsulting.com/blog/jens-alm/versioned-validated-and-secured-rest-services-spring-40-4 I am now trying to convert the authentications mechanism to use Active Directory (ActiveDirectoryLdapAuthenticationProvider). My issue is that I can not figure out how to get to the UserDetails so the loadUserByUsername(userName) method can be utilized. Below is method that is causing me problems, the commented line provides the user detail service to the filter but I can not figure out how to get this information using Active Directory authentication. private Filter authenticationFilter() { HeaderAuthenticationFilter headerAuthenticationFilter = new HeaderAuthenticationFilter(); //headerAuthenticationFilter.userDetailsService(userDetailsService()); headerAuthenticationFilter.headerUtil(headerUtil); return headerAuthenticationFilter; } Below is my Spring Security Configuration and utilized class. SecurityConfig @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { private static final String ACCESS_DENIED_JSON = "{\"message\":\"You are not privileged to request this resource.\", \"access-denied\":true,\"cause\":\"AUTHORIZATION_FAILURE\"}"; private static final String UNAUTHORIZED_JSON = "{\"message\":\"Full authentication is required to access this resource.\", \"access-denied\":true,\"cause\":\"NOT AUTHENTICATED\"}"; @Autowired private HeaderUtil headerUtil; // @Autowired // public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { // auth.inMemoryAuthentication(). // // withUser("user").password("password").roles("USER"). // // and(). // // withUser("admin").password("password").roles("USER", "ADMIN"); // } // @Bean public ActiveDirectoryLdapAuthenticationProvider activeDirectoryLdapAuthenticationProvider() { ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirector…
tagged with: spring
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27063856
tagged with: spring-mvc
tagged with: java
tagged with: active-directory
has title: ActiveDirectoryLdapAuthenticationProvider: Getting UserDetails

http://stackoverflow.com/q/27060620
type: Question
upvote count: 0
tagged with: button
has answer: http://stackoverflow.com/a/27060816
accepted answer: http://stackoverflow.com/a/27060706
linked to: http://stackoverflow.com/q/5869871
answer count: 4
score: -1
favorite count: 0
has title: Conflict with buttons android
tagged with: android
possible better answer: http://stackoverflow.com/a/27060799
has answer: http://stackoverflow.com/a/27060799
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27060706
has answer: http://stackoverflow.com/a/27061605
tagged with: methods
downvote count: 1
has body: I have 2 xml files, "activity_main" and "main_screen", both have 1 button each here are the xml of the buttons: The login button &lt; this button is on the first screen of my application &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/entrar" android:id="@+id/button" android:onClick="onClick" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /&gt; And the "save data button" &lt; this one is on the second screen. &lt;Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Salvar" android:id="@+id/button2" android:onClick="onClick" android:layout_marginTop="43dp" /&gt; Java code of the first button: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Editable login = editLogin.getText(); String loginTexto = login.toString(); Editable pass = editPass.getText(); String senhaTexto = pass.toString(); try{ trocaTela(); System.out.println("botao login" + R.id.button); //a.enviaDados(loginTexto, senhaTexto, textView); }catch(Exception e){ System.out.println(e.getMessage()); } } }); Java code of the second button: button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final EditText editNome = (EditText) findViewById(R.id.nomeEdit); final EditText editDestino = (EditText) findViewById(R.id.destinoEdit); final EditText editKm = (EditText) findViewById(R.id.kmEdit); final TextView textView = (TextView) findViewById(R.id.textView); //pega o texto inserido no campo da placa Editable editable = editPlaca.getText(); String placaTexto = editable.toString(); //pega o nome inserido no campo do nome Editable nomeEditable = editNome.getText(); String nomeTexto = nomeEditable.toString(); //pega o destino inserido no campo do destino Editable destinoEditable = editDestino.getText(); String destinoTexto = destinoEditable.toString(); //pega o valor inserido no campo do km Editable kmEdita…

http://stackoverflow.com/q/27024140
linked to: http://stackoverflow.com/q/27044253
has body: I am trying to set up a DataSource in liberty profile server, but I'm getting a NullPointerException (on my ds variable below) when my code tries to use it. The relevant code, and server.xml entries are below. Interestingly, if I change the jndiName to java:comp/env/jdbc/Oracle I get an IllegalArgumentException on server startup, but with the config below it doesn't even seem to try to activate the DataSource... public abstract class DAOBase { //@Resource(name = "jdbc/Oracle", type = javax.sql.DataSource.class, shareable = true, authenticationType = AuthenticationType.CONTAINER) @Resource(lookup = "jdbc/Oracle") private DataSource ds; protected Connection getConnection() throws SQLException { Connection conn = ds.getConnection(); return conn; } My server.xml config: jsp-2.2 jaxrs-1.1 localConnector-1.0 appSecurity-2.0 jpa-2.0 jdbc-4.0 jndi-1.0 <fileset dir="C:\src\main\lib" includes="ojdbc6.jar"/> <jdbcDriver id="OracleDriver" libraryRef="OracleJDBC_ID"/> <properties.oracle URL="jdbc:oracle:thin:@ldap://oid:***/opl***,cn=OracleContext,dc=****,dc=com" password="****" user="*****"/> Error in the log: [ERROR ] CWWKE0701E: [com.ibm.ws.jdbc.dataSource(200)] The modified method has thrown an exception Bundle:com.ibm.ws.jdbc(id=82) java.lang.IllegalArgumentException: J2CA8011E: Value java:comp/env/jdbc/Oracle is not supported for jndiName on dataSource at com.ibm.ws.jdbc.DataSourceService.activate(DataSourceService.java:209) at [internal classes] EDIT: The code is in the base class for our Data Access layer. We're calling this in a RESTful web service via a very plain initialization: AuditDAO auditDAO = new AuditDAO();
answer count: 1
downvote count: 0
tagged with: jdbc
has title: DataSource initialization error within liberty profile server
accepted answer: http://stackoverflow.com/a/27024719
favorite count: 0
upvote count: 1
tagged with: websphere-liberty
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: datasource
has comment: http://stackoverflow.com/comment/42572246
type: Question
has answer: http://stackoverflow.com/a/27024719

http://stackoverflow.com/q/27108287
has body: I m trying to create my first Spring application which is a simple REST webservice. I want to make EVERY responses to be JSON (in the header) and I dont know how to make it in ONE time, I mean not in all my controller methods, like a config files or something else. This is my code : @RestController public class HomeController { @RequestMapping(value = "/something/{nom}/{id}", method = RequestMethod.GET) public User hi(@PathVariable long id, @PathVariable String nom) { return new User(id, nom); } } Thanks for advance
type: AnsweredQuestion
has title: First REST Spring application
tagged with: java
has answer: http://stackoverflow.com/a/27108905
type: Question
score: 0
answer count: 1
tagged with: rest
tagged with: spring
has comment: http://stackoverflow.com/comment/42720336
has comment: http://stackoverflow.com/comment/42720672
has comment: http://stackoverflow.com/comment/42728725
accepted answer: http://stackoverflow.com/a/27108905

http://stackoverflow.com/comment/42718481
type: AnswerComment
has text: Did you try to write android:label="Linak" you should not take an error i think but not a good solution.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27107381

game-physics
tags question: http://stackoverflow.com/q/27140766
tag name: game-physics
type: Tag
tags question: http://stackoverflow.com/q/27121550
tags question: http://stackoverflow.com/q/27030711
tags question: http://stackoverflow.com/q/27125939
tags question: http://stackoverflow.com/q/27007914

http://stackoverflow.com/a/27097648
downvote count: 0
has body: Yes, you should use a for loop to iterate through the list of paychecks and print each separately, or concatenate them into a new string.
answers question: http://stackoverflow.com/q/27097623
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27097623

http://stackoverflow.com/q/27054464
tagged with: optaplanner
favorite count: 0
has body: I have been running OptaPlanner application on Linux servers which takes total 10 minutes. However, when I move it to run on Solaris server the total processing time become more than 50 minutes. And the Solaris(SPARC-T5) has more CPUs and memory than Linux(Intel). So, I am wondering is there any settings to be done to use OptaPlanner on Solaris os? What can be the possible reasons for this issue? Thanks in advance for your time and answers.
tagged with: linux
has answer: http://stackoverflow.com/a/27055667
has comment: http://stackoverflow.com/comment/42627382
has comment: http://stackoverflow.com/comment/42628761
has title: OptaPlanner on Solaris is slower 5 times than on Linux os
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/42628920
tagged with: java
has comment: http://stackoverflow.com/comment/42631503
tagged with: solaris
has comment: http://stackoverflow.com/comment/42627270
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/42651240
has text: And the value of `time`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27068849
score: 0

http://stackoverflow.com/a/27095854
answers question: http://stackoverflow.com/q/27087864
type: Answer
has body: The API is the same here - you'll get back a WebArchive, you simply need to delete the appropriate paths before you add to it again.
has comment: http://stackoverflow.com/comment/42788295
score: 0

http://stackoverflow.com/q/27084887
has comment: http://stackoverflow.com/comment/42678747
type: Question
tagged with: java
has title: How can I print the name of an object in an ArrayList?
has comment: http://stackoverflow.com/comment/42678650
score: 0
has comment: http://stackoverflow.com/comment/42678728
answer count: 1
has body: I have this code already written: import java.util.ArrayList; import java.util.List; public class TestBox { public static void main(String[]args){ ShoeBox nike = new ShoeBox(); Box present = new CandyBox(3,2,6); JewelryBox gift = new JewelryBox(); Box pictures = new ShoeBox(); Box skittles=new CandyBox(6,3,1); CandyBox dots=new CandyBox(3,2,1); Box jareds=new JewelryBox(); List&lt;Box&gt; boxes=new ArrayList&lt;Box&gt;(); boxes.add(nike); boxes.add(present); boxes.add(gift); boxes.add(pictures); boxes.add(skittles); boxes.add(dots); boxes.add(jareds); double temp=0; for (Box x:boxes) temp=temp+x.getVolume(); for (int i=0;i&lt;boxes.size();i++) System.out.println(boxes.get(i)); double count=0; for (int k=0;k&lt;boxes.size();k++) if ((boxes.get(0).getVolume())&lt;(boxes.get(k).getVolume())) count=boxes.get(k).getVolume(); System.out.println("The box with the biggest volume is the "+boxes.get((int)count)+". The dimensions of the box" + "are "+boxes.get((int)count).getLength()+" x "+boxes.get((int)count).getWidth()+" x " +boxes.get((int)count).getHeight()+"."); } } This is my tester for a class called Box. The subclasses are shown in the creations of them. What is the line of code needed to print out the name of the objects, such as skittles or jareds? I need to print the "name" of the object with the largest volume. Let's say the object "nike" has the largest volume. The print statement at the bottom of the main should say "The box with the biggest volume is the nike. The dimensions are 12 x 12 x 12."
has comment: http://stackoverflow.com/comment/42678673
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42678809
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27085027
has comment: http://stackoverflow.com/comment/42678793
has comment: http://stackoverflow.com/comment/42678709

http://stackoverflow.com/q/27060221
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/31858585
has body: I'm looking for a JSON paring library that supports comparing two JSON objects ignoring child order, checking whether first object is subset of the other
possible better answer: http://stackoverflow.com/a/27060363
has title: how to test json object1 is subset of json object2
has answer: http://stackoverflow.com/a/27060363
score: 0
answer count: 2
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31858585
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/27096529
has body: In order to determine the complexity, you are on the right track with trying to find the number of operations! What I usually do if I can't pull up the formula immediately: I find examples first. Try it out for n = 5, n = 8, n=64, n=65 and come up with the number of steps taken, and you'll see soon the pattern! The formula for number of operations you'll come up with can be very precise, but you can leave the constants out to determine the order of complexity (multipliers and additional constants), as in the end O(2n) is roughly the same as O(3n)compared to O(n^2).
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27096435

http://stackoverflow.com/q/27077792
tagged with: maven
tagged with: build
tagged with: java
type: Question
has title: Remove N day older file from an external location using pom.xml (maven) or Hudson
has answer: http://stackoverflow.com/a/27096111
score: 0
answer count: 1
tagged with: hudson
has body: To keep recently created 3 zip files from external folder location on disk and delete older zip files.Maven pom.xml are executed using Hudson use to create the zip file. How to do it using pom.xml or Hudson.
type: UnansweredQuestion

http://stackoverflow.com/q/26995166
has body: Say I have several List&lt;T&gt;s, I will put them into another list or other collections, so I don't know how many list&lt;T&gt; I have until I call List&lt;List&lt;T&gt;&gt;.size() Take below List&lt;Integer&gt; as an example: list1=[1,2] list2=[3,4] list3=[5,6] .... listn=[2*n-1,2n]; How can I get the result of list1*list2*list3*...listn as a Cartesian product? For example: list1*list2*list3 should be: [1,3,5],[1,3,6],[1,4,5],[1,4,6],[2,3,5],[2,3,6],[2,4,5],[2,4,6]
tagged with: cartesian-product
downvote count: 2
possible better answer: http://stackoverflow.com/a/27037443
score: 2
type: AnsweredQuestion
tagged with: list
tagged with: java
linked to: http://stackoverflow.com/q/32131987
has answer: http://stackoverflow.com/a/26995510
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/26995510
tagged with: algorithm
has answer: http://stackoverflow.com/a/68629936
has answer: http://stackoverflow.com/a/27037443
answer count: 3
tagged with: matrix
favorite count: 0
has title: How to get Cartesian product from multiple lists?

http://stackoverflow.com/a/29005298
accepted answer of: http://stackoverflow.com/q/27004893
type: Answer
answers question: http://stackoverflow.com/q/27004893
has body: Please correct me if I misunderstood your question. I believe you want to import whatever it is Apache River has to offer in Eclipse such that you can use classes in Apache River in your project. Correct? If yes, this is what i did - Downloaded apache-river2.2.2.bin.zip from the site you mentioned, extracted it. Created new Java Project in Eclipse with a trial class. Configured build path of this Eclipse project, and added all the jars from the /lib folder as 'External Jars'. All these jars showed up in the Referenced Libraries section in my project in Eclipse. I tried a sample line of code to see if I get classes from Apache river. for eg - LookupLocator locator = new LookupLocator(arg0); And it worked - Eclipse added import net.jini.core.discovery.LookupLocator; automatically. I checked and this class comes from the jini-core.jar Of course, if you are using other build / dependency management tools like maven/ant, this eclipse process will differ a little bit. Let me know if this worked for you.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/27096592
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27094803
has body: In your doGet or doPost method based on form type in servlet you can iterate all parameters and check if parameter starts with rata then its accepted to get all parametes names use request.getParameterNames() which will return Enumeration. Enumeration&lt;String&gt; params = request.getParameterNames(); while (params.hasMoreElements()) { String param = params.nextElement(); if(param.startsWith("rata")){ String value = request.getParameter(param); //your code here } }

annotations
tags question: http://stackoverflow.com/q/27104464
tags question: http://stackoverflow.com/q/27089275
tags question: http://stackoverflow.com/q/27005607
tags question: http://stackoverflow.com/q/27062665
tags question: http://stackoverflow.com/q/27059938
type: Tag
tags question: http://stackoverflow.com/q/27126013
tags question: http://stackoverflow.com/q/27091553
tags question: http://stackoverflow.com/q/27008351
tags question: http://stackoverflow.com/q/27130812
tags question: http://stackoverflow.com/q/26994748
tags question: http://stackoverflow.com/q/27035648
tags question: http://stackoverflow.com/q/27019902
tags question: http://stackoverflow.com/q/27140212
tags question: http://stackoverflow.com/q/27003738
tags question: http://stackoverflow.com/q/27049453
tags question: http://stackoverflow.com/q/27078799
tags question: http://stackoverflow.com/q/27017534
tag name: annotations
tags question: http://stackoverflow.com/q/27030032
tags question: http://stackoverflow.com/q/27101978
tags question: http://stackoverflow.com/q/27126275
tags question: http://stackoverflow.com/q/27066437
tags question: http://stackoverflow.com/q/27115639
tags question: http://stackoverflow.com/q/27147537
tags question: http://stackoverflow.com/q/27151906

http://stackoverflow.com/comment/42643280
type: Comment
comment on: http://stackoverflow.com/q/27063562
score: 1
has text: try `redirect(controllers.routes.App...`
type: QuestionComment

http://stackoverflow.com/q/27038432
tagged with: java
linked to: http://stackoverflow.com/q/27124859
answer count: 2
downvote count: 0
tagged with: javascript
favorite count: 0
has comment: http://stackoverflow.com/comment/42599168
has answer: http://stackoverflow.com/a/27041674
has body: I want to send the value of variable x to the contoller using jquery load() method Currently i am working like this as shown in below code and its working fine but i want to sent the value of x to the controller i am using spring mvc. &lt;script type="text/javascript"&gt; function loadXMLDoc() { $( "#bdeRightView" ).load( "${contextPath}/clusterInfoView"); } &lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('#bdeViewNew').on('changed.jstree', function(e, data) { var i, j, r = [],x; for (i = 0, j = data.selected.length; i &lt; j; i++) { r.push(data.instance.get_node(data.selected[i]).text.trim()); x = data.instance.get_node(data.selected[i]).text.trim(); if(x=="abc" || x=="xyz" || x=="pqr") { return true ; } else{ $('#treeBreadCrumbs').html(r.join(', ')); loadXMLDoc(); } } }); }); &lt;/script&gt; Now my controller code : @RequestMapping(value = "/clusterInfoView", method = RequestMethod.GET) public ModelAndView getClusterInfoView() { try{ System.out.println("inside try of controller "); // some code goes here return new ModelAndView(""); } catch (Exception ex) { ex.printStackTrace(); return new ModelAndView("errorMessage"); } } My question is how i can get the value of x in this controller method so that i can use this x as per my requirement. can any one knows how to do this? thanks in advance
possible better answer: http://stackoverflow.com/a/27038556
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27038556
linked to: http://stackoverflow.com/q/28670644
upvote count: 1
has title: how to send data and URL using jquery load method
type: Question
accepted answer: http://stackoverflow.com/a/27041674
score: 1

http://stackoverflow.com/comment/42674965
type: Comment
comment on: http://stackoverflow.com/a/27082872
has text: @JasonC Whoops, really sorry guys, I guess I'm a bit tired already. Going to edit it.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26993024
answer count: 1
has comment: http://stackoverflow.com/comment/42517350
favorite count: 0
has body: I need to insert date from a JTextField, As following: pst.setString (4, txt_date.getText()); But leaves the error: ORA-01843 NOT A VALID MONTH in oracle datatype is DATE (example: 5/30/2014) How to solve this? thanks edit: Connection conn = Connessione.ConnecrDb(); Statement stmt = null; ResultSet emps = null; SimpleDateFormat formatter = new SimpleDateFormat("dd-mm-yyyy"); String dateInString = "7-07-2014"; try { java.util.Date date = formatter.parse(dateInString); System.out.println(date); System.out.println(formatter.format(date)); } catch (ParseException e) { e.printStackTrace(); } I add this befor a try { insert ...etc
tagged with: oracle-database
upvote count: 1
tagged with: gettext
has title: Error ORA-01843 NOT A VALID MONTH When Trying to Insert
has answer: http://stackoverflow.com/a/26993170
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42517285
tagged with: java
downvote count: 1
type: Question
tagged with: date
accepted answer: http://stackoverflow.com/a/26993170
has comment: http://stackoverflow.com/comment/42517038
score: 0

http://stackoverflow.com/q/27018919
has answer: http://stackoverflow.com/a/27165540
linked to: http://stackoverflow.com/q/6060560
score: 2
tagged with: izpack
downvote count: 0
favorite count: 0
has title: Izpack installer can't run without java
upvote count: 2
accepted answer: http://stackoverflow.com/a/27165540
tagged with: windows
tagged with: exe
type: AnsweredQuestion
tagged with: installation
tagged with: java
possible better answer: http://stackoverflow.com/a/27024130
has answer: http://stackoverflow.com/a/27024130
type: Question
answer count: 2
has body: I've created a java application , and its installer with izpack , I can setup my application with out any problems when the machine has JRE , but when there is no JRE installed on the machine I get an error indicating that "Windows cannot find javaw. Make sure you typed name correcly and try again." Is there a way that I can pop up some friendly panel to user to tell him to install jre , or is there a way to bundle a jre inside the exe?

http://stackoverflow.com/q/27095582
tagged with: java.util.scanner
tagged with: java
downvote count: 1
type: Question
has body: I'm trying to find a way to make this letter counter operate, and it has to be using arrays in the letterCounter class. I'm confused on how to do this where it's concise. Here is the instruction I was given for this section: If mychar is a lowercase letter, we can find the corresponding position in our count array with a simple subtraction, like so: counts[mychar - ’a’] (That a is another magic value that you’ll eventually want to replace with a constant.) So what about uppercase letters? Use the static method Character.toLowerCase(mychar). Note: if (Character.toLowerCase(mychar) - ’a’) evaluates to something outside the range [0, 25], then mychar is not a letter of the alphabet and should be ignored. So, the process method you added earlier simply iterates over the characters in the String passed in, and increments the value in the array, for each letter. Similarly, the getCount method translates the character parameter into a position and returns the count. Make sure you understand (and later document) what this method returns when the argument is not a letter of the alphabet. Here's my code: import java.util.Scanner; public class CounterDemo { public static void main(String[] args) { LetterCounter cc = new LetterCounter(); cc.process("foo"); cc.process("supercalafrajalisticexpialadoscious"); cc.process("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"); System.out.println("There are " + cc.getCount('z') + "z's"); } } public class LetterCounter { public int getCount(char letter) { // empty method for now return 0; } public void process(String string) { // TODO Auto-generated method stub } } So would I just store 0-25 in an array and ask to return the letters if it's within that array?
tagged with: counter
score: -1
answer count: 2
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/27095651
favorite count: 0
has answer: http://stackoverflow.com/a/27095992
type: UnansweredQuestion
has title: issue counter and arrays

http://stackoverflow.com/comment/42729695
type: Comment
has text: `examRegnoArray[i+9]` ... +9? Why not +10?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27113389

http://stackoverflow.com/comment/42659706
score: 1
has text: You may also want to look at The Swing Tutorial (https://docs.oracle.com/javase/tutorial/uiswing/index.html). The way you are doing it is not good.
comment on: http://stackoverflow.com/q/27073809
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42736372
type: Comment
type: QuestionComment
score: 1
has text: thanks Juned, but the same code works on local. no compile or run-time error. i am unable to understand "actual and formal argument lists differ in length"
comment on: http://stackoverflow.com/q/27116931

http://stackoverflow.com/a/27135253
answers question: http://stackoverflow.com/q/27135132
has body: All you need to do is change System.out.println(m); to System.out.println(m.name()) : public static void main(String[] args) { for (Months m : Months.values()) { System.out.println(m.name()); // Change is in this line. } }
type: Answer
accepted answer of: http://stackoverflow.com/q/27135132
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/27043754
has comment: http://stackoverflow.com/comment/42608766
accepted answer of: http://stackoverflow.com/q/27038632
type: Answer
answers question: http://stackoverflow.com/q/27038632
has comment: http://stackoverflow.com/comment/42608038
upvote count: 4
score: 4
has body: Try defining the method to receive a Long (object) instead of long (primitive). public String findStats(Long id){}
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27015262
has answer: http://stackoverflow.com/a/67055259
has answer: http://stackoverflow.com/a/27022702
has answer: http://stackoverflow.com/a/27015535
linked to: http://stackoverflow.com/q/2637864
type: UnansweredQuestion
tagged with: spring
has body: I am studying for the Spring Core certification and I have the following doubt related how can Spring instantiate classes with private constructors (such as Singleton pattern) or how can instantiate objects from Factories (that are not the Spring context). For example I have the following singleton factory: public class AccountServiceSingleton implements AccountService { private static AccountServiceSingleton inst = new AccountServiceSingleton(); private AccountServiceSingleton() { ... } public static AccountService getInstance() { // ... return inst; } } This is a singleton factory because it build a private static object builded with a private constructor and I have a public method to get this object. So I think that the problem how can Spring build this object? depends on the fact that that the constructor is private so I can't do something like this in my Java configuration class @Confguration public class ApplicationConfig{ @Bean public AccountServiceSingleton accountServiceSingleton(){ return new AccountServiceSingleton(); } } because I can't access to the private AccountServiceSingleton() constructor. At the same time I can't use the equivalent XML configuration for the same reason. Have I understand what is the problem or am I missing something? I think that I am missing something because on the documentation I read that I can use the following 2 solutions for the previous problem: Use a @Bean method in @Configuration class: so, reading it, I think that the previous Java configuration class work...but why? XML factory-method attribute in the XML configuration, searching online I found that have to be something like this, but how can I use this to configure the previous AccountServiceSingleton bean in an XML configuration? Tnx
tagged with: design-patterns
linked to: http://stackoverflow.com/q/8249173
tagged with: factory
score: 1
tagged with: java
type: Question
has title: How can Spring instantiate cClasses with private constructors (singleton pattern) and objects from Factories?
answer count: 3
tagged with: singleton
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42556108
favorite count: 0
has comment: http://stackoverflow.com/comment/42556291

typeconverter
type: Tag
tags question: http://stackoverflow.com/q/27061162
tag name: typeconverter

http://stackoverflow.com/a/27097607
type: Answer
score: 1
upvote count: 1
has body: first,i see that you must know the return type of the function, and that the return type of the function dogType() is String[],so you must return a String array. return dogType[3];//return a String object not the String array. so you can try this: return dogType;//return a String array.
downvote count: 0
answers question: http://stackoverflow.com/q/27097372

http://stackoverflow.com/comment/42768307
comment on: http://stackoverflow.com/a/27134947
type: AnswerComment
has text: @DavidWallace possibly, yes. If the package declaration was wrong, though, then Eclipse would have mentioned it. In any case, I've added something about Eclipse's helpful lightbulbs, and either way it ought to do something useful here.
type: Comment
score: 0

http://stackoverflow.com/q/27033505
answer count: 2
tagged with: esx
has answer: http://stackoverflow.com/a/43496079
has body: In my vmware esx server, I have four vmware such as Window 7, Window XP, Window Server 2008 and Window Server 2012. And drive information for each vmware: Window 7 -> drive C - Used 2GB, Free 2GB, Total 4GB Window XP -> drive C - Used 2GB, Free 2GB, Total 4GB Window Server 2008 -> drive C - Used 2GB, Free 2GB, Total 4GB -> drive D - Used 2GB, Free 2GB, Total 4GB Window Server 2012 -> drive C - Used 2GB, Free 2GB, Total 4GB -> drive D - Used 2GB, Free 2GB, Total 4GB My question is: How do I get drive detail information (for example, Drive C, used space and free space of Window 7) by vsphere sdk? And also drive information of another 3 vmware.
tagged with: vmware
type: AnsweredQuestion
tagged with: drive
tagged with: vsphere
tagged with: java
possible better answer: http://stackoverflow.com/a/43496079
type: Question
has answer: http://stackoverflow.com/a/27118392
accepted answer: http://stackoverflow.com/a/27118392
has title: Is there any ways to get drive information of each vmware in Vmware ESX via Vsphere SDK with Java?
score: 0

http://stackoverflow.com/comment/42755737
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27118358
has text: @Ralf Thank you very much for this important information. Thinking about the similarities of semaphores and the `synchronized`-keyword has always helped me in understanding both, but it never before occurred to me that it is possible to implement a semaphore that is released by a different thread than the one acquiring it. For future reference I kept the analogy with an update based on your comment, but moved it to the bottom as it is a bit off-topic.

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/26997737
tag name: google-oauth
tags question: http://stackoverflow.com/q/27078409
tags question: http://stackoverflow.com/q/27115446

http://stackoverflow.com/comment/42634209
comment on: http://stackoverflow.com/q/27058665
type: Comment
type: QuestionComment
has text: This is a duplicate so there is no need for an answer.
score: 1

http://stackoverflow.com/comment/42516059
has text: You can check the object is null or before you append to StringBuilder. If null, you can just append a empty string ("");
comment on: http://stackoverflow.com/q/26992354
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26992017
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42594742
tagged with: rest
answer count: 0
type: UnansweredQuestion
tagged with: rmi
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42586892
type: Question
has body: I am trying to write an application layer that accepts REST service calls and executes them on an RMI server, retrieves the response and sends it back after formatting it. I am implementing the the service class with Jersey and running it on Tomcat. I have created a test RMI server running on a different VM instance and rmiregistry running on localhost as well. Now, when I call a REST URL: http://localhost:8080/Rest2RMI/rmi/getServerTime I get: java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: com.desmond.rmitest.ServerTimeImpl_Stub (no security manager: RMI class loader disabled) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at java.rmi.Naming.lookup(Unknown Source) at com.desmond.rmitest.ServiceClass.getMessage(ServiceClass.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleReq…
has title: Error while exposing RMI services as REST?
has comment: http://stackoverflow.com/comment/42593206

for-loop
tags question: http://stackoverflow.com/q/26999390
tags question: http://stackoverflow.com/q/27071427
tags question: http://stackoverflow.com/q/27008835
tags question: http://stackoverflow.com/q/27124937
tags question: http://stackoverflow.com/q/27050523
tags question: http://stackoverflow.com/q/27091875
tags question: http://stackoverflow.com/q/27072709
tags question: http://stackoverflow.com/q/27131673
tags question: http://stackoverflow.com/q/27093497
tags question: http://stackoverflow.com/q/27118479
tags question: http://stackoverflow.com/q/27019748
tag name: for-loop
tags question: http://stackoverflow.com/q/27022943
tags question: http://stackoverflow.com/q/27000113
tags question: http://stackoverflow.com/q/27007199
tags question: http://stackoverflow.com/q/27050696
tags question: http://stackoverflow.com/q/27151182
tags question: http://stackoverflow.com/q/27045951
tags question: http://stackoverflow.com/q/27053138
tags question: http://stackoverflow.com/q/27005812
tags question: http://stackoverflow.com/q/27084697
tags question: http://stackoverflow.com/q/27002146
tags question: http://stackoverflow.com/q/27097305
tags question: http://stackoverflow.com/q/27089020
tags question: http://stackoverflow.com/q/27042301
tags question: http://stackoverflow.com/q/27058022
tags question: http://stackoverflow.com/q/27001415
tags question: http://stackoverflow.com/q/27083504
tags question: http://stackoverflow.com/q/26996590
type: Tag
tags question: http://stackoverflow.com/q/27076034
tags question: http://stackoverflow.com/q/27118211
tags question: http://stackoverflow.com/q/27116186
tags question: http://stackoverflow.com/q/27064538
tags question: http://stackoverflow.com/q/27040533
tags question: http://stackoverflow.com/q/27002032
tags question: http://stackoverflow.com/q/27086357
tags question: http://stackoverflow.com/q/27130005
tags question: http://stackoverflow.com/q/27118183

http://stackoverflow.com/q/27152076
has answer: http://stackoverflow.com/a/27169414
answer count: 1
has title: Primefaces Datatable rowEditInit update components fails
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27169414
tagged with: jsf
tagged with: java
linked to: http://stackoverflow.com/q/25339056
type: Question
tagged with: primefaces
has body: I have a dataTable with cellEditors. When I start editing some line, there are 2 buttons outside the table that should change visibility. As follows: &lt;h:form id="formExigencias"&gt; &lt;p:panel id="pnlBotoes" columns="3"&gt; &lt;div class="direita"&gt; &lt;p:commandButton value="One Button to Change Visibility" rendered="#{not exigenciaMinimaBean.emAlteracao}" action="#{myBean.someAction()}" /&gt; &lt;p:commandButton value="Another Button to Change Visibility" rendered="#{exigenciaMinimaBean.emAlteracao}" action="#{myBean.someOtherAction()}" &gt; &lt;p:confirm header="Confirmação" message="OK?" icon="ui-icon-alert" /&gt; &lt;/p:commandButton&gt; &lt;p:spacer height="8px" /&gt; &lt;/div&gt; &lt;p:fieldset legend="Resultado da Pesquisa"&gt; &lt;p:dataTable id="tabelaExigencias" emptyMessage="Nenhuma exigência cadastrada." value="#{exigenciaMinimaBean.exigencias}" var="exigencia" paginator="true" rows="10" paginatorPosition="bottom" rowsPerPageTemplate="5,10,15" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowKey="#{exigencia.id}" selection="#{exigenciaMinimaBean.exigenciaEdicao}" selectionMode="single" editable="true"&gt; &lt;p:ajax event="rowEditInit" listener="#{exigenciaMinimaBean.rowEditInit}" process="@this" update=":formExigencias:pnlBotoes"/&gt; &lt;!-- declarations supressed to optimize reading --&gt; &lt;/p:dataTable&gt; &lt;/p:fieldset&gt; &lt;/p:panel&gt; &lt;p:spacer height="20px" /&gt; &lt;/h:form&gt; @ManagedBean @ViewScoped public class ExigenciaMinimaBean { public void rowEditInit(RowEditEvent evento) { emAlteracao = true; } } Here's what I've accomplished so far: If I update the panel "pnlBotoes", the buttons are correctly updated, but the row exits Editing Mode (becomes non editable again) If I update the buttons individually, no renders are changed and the table keeps its original state. Update from Backing Bean did not work. Presence of 'process="@this"…
score: 0

http://stackoverflow.com/comment/42658723
has text: My bad, neglected to realize this was java before posting. Been coding in C++ all semester for school.
comment on: http://stackoverflow.com/a/27073338
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/63783019
comment on: http://stackoverflow.com/a/33292422
type: AnswerComment
score: 0
type: Comment
has text: Thank's this was the problem with my training dataset... Some of the LIBSVN format files were having only 1 or two records i guess that is what which caused this error!

http://stackoverflow.com/comment/42677532
type: Comment
type: QuestionComment
has text: @AndrewThompson everyone is entitled to their own opinions. Apparently you know everyone's opinion here in SO. However, I go by the official documentation provided in the Oracle Java website. Yes, in there is states that Layout Managers are a better option, but they don't **strongly** discourage their use. Second, I added that as a last option for a reason. For the record, I use Layout Managers all the time, and I do encourage others to use them as well. But, I recognize that there might be cases where Absolute Positioning might be the way to go.
score: 0
comment on: http://stackoverflow.com/q/27079949

http://stackoverflow.com/a/27034569
type: Answer
has body: You need to call repaint on every single change you make. This would insure that the changes are applied. You can try to create an additional Thread with LOW_PRIORITY which works simultaneously to the GUI's one and calls repaint() and validate() methods to your main frame. Thread repainter = new Thread(new Runnable() { @Override public void run() { while (true) { // I recommend setting a condition for your panel being open/visible frame.repaint(); frame.validate(); try { Thread.sleep(30); } catch (InterruptedException ignored) { } } } }); repainter.setName("Panel repaint"); repainter.setPriority(Thread.MIN_PRIORITY); repainter.start();
score: 0
has comment: http://stackoverflow.com/comment/42590682
answers question: http://stackoverflow.com/q/27019768
has comment: http://stackoverflow.com/comment/42597336

http://stackoverflow.com/comment/42670824
type: Comment
has text: Whether your pool have 1 thread or 200, the user won't wait, since you're invoking an asynchronous method. The job will be put in a queue, waiting for a thread to execute it. The time taken to write the 200 files will probably be wmaller with one thread than with 100, because you won't have as much context switching, and because writes will be sequential rather than concurrent. I don't understand your last two sentences.
score: 1
comment on: http://stackoverflow.com/a/27076281
type: AnswerComment

http://stackoverflow.com/comment/42688090
comment on: http://stackoverflow.com/a/27090441
type: Comment
has text: Having taught this in college, what typical textbooks show is a way to create simple programs that could be initialized as an `Applet` or a `Frame` depending how they are launched. I am not sure what your professor said, but if he used **explicitly** the word inherit, he was grossly mistaken.
score: 0
type: AnswerComment

http://stackoverflow.com/a/37720106
type: Answer
has body: Okay, this might be an issue with you persistence configuration. If your models definitions are all in a separate ejb, make sure to add them in the persistence.xml in the persistence-unit
downvote count: 0
answers question: http://stackoverflow.com/q/27124427
score: 8
upvote count: 8

http://stackoverflow.com/q/27146086
type: AnsweredQuestion
has body: I am working on a Jframe netbeans IDE basically i drag and drop thing in the form i want to make a group of checkboxes at least two groups in one frame and each group has many checkboxes i want to select multiple checkbox in each group and return the value of checked boxes i have read that button group is not applicable in this situation since button group will only have one selection. Any code snippet or idea on how to do this is much appreciated. UPDATE Found this sample this is how i want my checkbox to behave only i dont want to put them in table plus there is no table component in netbeans IDE i can drag for this purpose any idea on how to do this is much appreciated
has title: select many Checkbox in a checkboxgroup java swing
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/42800716
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42801832
has answer: http://stackoverflow.com/a/27163835
score: 0
linked to: http://stackoverflow.com/q/4526779
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/13915081
has comment: http://stackoverflow.com/comment/42817293
tagged with: checkbox
accepted answer: http://stackoverflow.com/a/27163835

http://stackoverflow.com/comment/42719461
has text: I did not implement `equals` nor `hashCode`, which should be fine afaik? And I tried `ArrayList` with the same results.
comment on: http://stackoverflow.com/q/27107595
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42529335
type: Comment
type: QuestionComment
has text: But they're not comparable! An if statement executes at most once, a for/while loop potentially many times.
score: 1
comment on: http://stackoverflow.com/q/26999390

http://stackoverflow.com/q/27010668
upvote count: 1
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27015934
tagged with: install4j
type: AnsweredQuestion
downvote count: 0
score: 1
has body: Why doesn't the Mac OS X Folder media file have an option to only install the bundled JRE if the system does not have one? The Windows and Linux media files have it.
favorite count: 0
type: Question
has title: Install4j + Mac Folder: Why is there no option to install a JRE only if it's not present?
has answer: http://stackoverflow.com/a/27015934
tagged with: macos

http://stackoverflow.com/q/27105544
has answer: http://stackoverflow.com/a/27105685
tagged with: java
has title: Synchronize across threads
has answer: http://stackoverflow.com/a/27105654
has body: The following code should assure that access to "sync" is synchronized across all threads. According to the a output this is not always the case, notice how Thread-3 and Thread-4 are reading the same value of sync. Am I missing something in the code? [Thread-0] before value of sync is 0 [Thread-0] after value of sync is 1 [Thread-3] before value of sync is 1 [Thread-3] after value of sync is 2 [Thread-4] before value of sync is 1 [Thread-4] after value of sync is 3 [Thread-2] before value of sync is 3 [Thread-2] after value of sync is 4 [Thread-1] before value of sync is 4 [Thread-1] after value of sync is 5 here the code: package com.mypackage.sync; public class LocalSync implements Runnable { private Integer sync = 0; public void someMethod() { synchronized (sync) { System.out.println("[" + Thread.currentThread().getName() + "]" + " before value of sync is " + sync); sync++; System.out.println("[" + Thread.currentThread().getName() + "]" + " after value of sync is " + sync); } } @Override public void run() { someMethod(); } public static void main(String[] args) { LocalSync localSync = new LocalSync(); Thread[] threads = new Thread[5]; for (int i = 0; i &lt; threads.length; i++) { threads[i] = new Thread(localSync, "Thread-" + i); threads[i].start(); } } }
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42714414
answer count: 3
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27105646
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1

junit4
tags question: http://stackoverflow.com/q/27136752
tags question: http://stackoverflow.com/q/27125411
tags question: http://stackoverflow.com/q/27135371
tags question: http://stackoverflow.com/q/27020639
type: Tag
tags question: http://stackoverflow.com/q/27024418
tags question: http://stackoverflow.com/q/27013346
tag name: junit4

http://stackoverflow.com/a/27011306
answers question: http://stackoverflow.com/q/27011194
has body: It depends on the JVM. I think the Oracle JVM only dumps once.
type: Answer
score: 0

http://stackoverflow.com/q/27001491
type: UnansweredQuestion
has body: so basically what I am attempting to do, is to create a PDF that information can be inputted by the user of that document. and when all the information is entered, be able to click the save button below on the PDF document, and a window prompt open allowing the user to "save as" the document to a certain directory. I currently have the button working for Windows OS, and the prompt comes up to save as, however when opened on Adobe reader on an android phone and the save button is clicked, nothing happens.. is there a java script code that differs from the Windows version to what android would look like.
tagged with: http://stackoverflow.com/tag/pdf
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/27958266
score: 0
tagged with: java
has title: Filling out and Saving a PDF on android
answer count: 1

http://stackoverflow.com/comment/42781638
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27142095
has text: Alright so as of your latest edit, the take method now works, but the move method still returns null. Also when I call g.getMessage() it returns null, currentMessage is still set to null too.

http://stackoverflow.com/comment/42705823
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27100733
type: Comment
has text: yeah. figured that out after posting this. i've been trying some new logic for tihs

http://stackoverflow.com/a/27077349
has body: If you use System.out, it should appear on the logcat if you want to execute javascript code from java you can use the loadUrl method, so you can use javascript alert or console.log. Example: webView.loadUrl("javascript:alert('hello');"); or to run it on the UI Thread cordova.getActivity().runOnUiThread(new Runnable() { public void run() { webView.loadUrl("javascript:alert('hello');"); } }); or this to run on main thread cordova.getThreadPool().execute(new Runnable() { public void run() { webView.loadUrl("javascript:alert('hello');"); } });
has comment: http://stackoverflow.com/comment/42838587
has comment: http://stackoverflow.com/comment/42829238
has comment: http://stackoverflow.com/comment/42695200
has comment: http://stackoverflow.com/comment/42690491
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42827551
has comment: http://stackoverflow.com/comment/42838682
type: Answer
answers question: http://stackoverflow.com/q/27065309
has comment: http://stackoverflow.com/comment/42690533
accepted answer of: http://stackoverflow.com/q/27065309

http://stackoverflow.com/comment/42525130
score: 2
has text: You sure can do it with aspects. But I am not sure wether this is really worth the hassle.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26997281

http://stackoverflow.com/q/27059054
answer count: 2
has answer: http://stackoverflow.com/a/27059447
score: 0
has comment: http://stackoverflow.com/comment/42633083
type: UnansweredQuestion
has title: Clarification on the hierarchy of the command Interface
has answer: http://stackoverflow.com/a/27059231
tagged with: java
has body: In the following program in the class Parent the class Child implements MyInterface. Is that the reason why obj1 (Parent) instanceof MyInterface is false, while obj2 (Child) instanceof MyInterace is true? class InstanceofDemo { public static void main(String[] args) { Parent obj1 = new Parent(); Parent obj2 = new Child(); System.out.println("obj1 instanceof Parent: " + (obj1 instanceof Parent)); System.out.println("obj1 instanceof Child: " + (obj1 instanceof Child)); System.out.println("obj1 instanceof MyInterface: " + (obj1 instanceof MyInterface)); System.out.println("obj2 instanceof Parent: " + (obj2 instanceof Parent)); System.out.println("obj2 instanceof Child: " + (obj2 instanceof Child)); System.out.println("obj2 instanceof MyInterface: " + (obj2 instanceof MyInterface)); } } class Parent {} class Child extends Parent implements MyInterface {} interface MyInterface {} Gives the following output: obj1 instanceof Parent: true obj1 instanceof Child: false obj1 instanceof MyInterface: false obj2 instanceof Parent: true obj2 instanceof Child: true obj2 instanceof MyInterface: true
type: Question

http://stackoverflow.com/a/27124622
has body: This should work: private static void readFile(File fin) throws IOException { FileInputStream fis = new FileInputStream(fin); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); String line = null; while ((line = br.readLine()) != null) { if(line.length()&gt;10) System.out.println(line); } br.close(); }
score: 0
answers question: http://stackoverflow.com/q/27124519
type: Answer

http://stackoverflow.com/a/27151760
has comment: http://stackoverflow.com/comment/42799961
has comment: http://stackoverflow.com/comment/42799450
answers question: http://stackoverflow.com/q/27151690
downvote count: 0
score: 1
has body: You need a List of ArrayList. List&lt;List&lt;String&gt;&gt; lists = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; 50; i++){ lists.add(new ArrayList&lt;String&gt;()); }
has comment: http://stackoverflow.com/comment/42798282
has comment: http://stackoverflow.com/comment/42824617
type: Answer
has comment: http://stackoverflow.com/comment/42799916
has comment: http://stackoverflow.com/comment/42799380
upvote count: 1

http://stackoverflow.com/q/27050099
tagged with: android
has comment: http://stackoverflow.com/comment/42619706
type: UnansweredQuestion
tagged with: fragmentpageradapter
has body: I am having some trouble figuring out the proper way to communicate between fragments when using a FragmentPagerAdapter. For some context I have an Activity that uses the FragmentPagerAdapter to host two fragments. Fragment A has a button and when pressed it changes text in Fragment B. Everything works as expected except when I press the button after an orientation change, I get a null pointer exception on the EditText I am changing in Fragment B. After days of debugging it looks like when I call the method in Fragment B that changes the text that it is maybe an old instance of the Fragment. Here's the code: The FragmentPagerAdapter which is an inner class in my Activity: public class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter (FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { switch (i) { case 0: return fragmentA; case 1: return fragmentB; } return null; } @Override public int getCount() { return tabs.length; } @Override public CharSequence getPageTitle(int position) { return tabs[position]; } } The Fragments get instantiated in the Activities onCreate method as follows: FragmentA fragmentA; //Declared outside of onCreate FragmentB fragmentB; //Declared outside of onCreate fragmentA = FragmentA.newInstance(); fragmentB = FragmentB.newInstance(); In the Fragment that I press the button I set up an interface as follows: @Override public void onAttach(Activity activity) { super.onAttach(activity); try { testTextInterface = (TestTextInterface) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement testTextInterface"); } } Then when I press the button I have an OnClickListener that fires the following code: testTextInterface.onTextChanged("Some test text"); Which in turn calls the following method in the Activity: @Override public void onTextChanged(String testText) { fragmentB.updateText(testText); } And then finally that method in FragmentB: private void update…
tagged with: fragment
has answer: http://stackoverflow.com/a/27052583
tagged with: android-fragments
tagged with: java
linked to: http://stackoverflow.com/q/6976027
has title: Cannot communicate with Fragment correctly after orientation change
type: Question
has comment: http://stackoverflow.com/comment/42622338
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/42619654
has answer: http://stackoverflow.com/a/27053238

bluetooth-lowenergy
tags question: http://stackoverflow.com/q/27054324
tags question: http://stackoverflow.com/q/27040086
type: Tag
tags question: http://stackoverflow.com/q/27145576
tag name: bluetooth-lowenergy

http://stackoverflow.com/q/27051466
accepted answer: http://stackoverflow.com/a/27067481
tagged with: list
score: 1
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27067481
tagged with: google-drive-api
has body: I am currently integrating goggle drive with my Java web application and I have an issue while getting the list of files associated with a account. I am using https://content.googleapis.com/drive/v2/files?key={API-key} to get the list of files, but I am only getting the folders and files which are created from with in my application I am not able to get all the folders for that particular account. For the same account when I tested it through 'try it' on 'developers.google.com' I am able to get all the folders and files I am not able to understand why I am not getting all folders when I make the call from my application, should I be request for any extra permissions from google? Please help me what should I do
upvote count: 1
has title: Unable to get list of all files using google drive API
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/27226400
answers question: http://stackoverflow.com/q/27128721
score: 6
accepted answer of: http://stackoverflow.com/q/27128721
has comment: http://stackoverflow.com/comment/128257739
type: AcceptedAnswer
downvote count: 0
has body: I can see virtually no documentation about this, however having looked at the Confluence REST API Browser, I've got a working example below. You have to be a Confluence admin, or space admin for the space... POST: http://localhost:1990/confluence/rpc/json-rpc/confluenceservice-v2/getSpacePermissionSets BODY: [ "ds" ] RESPONSE: [ { "type": "SETSPACEPERMISSIONS", "spacePermissions": [ { "type": "SETSPACEPERMISSIONS", "userName": null, "groupName": "confluence-administrators" } ] }, { "type": "EXPORTSPACE", "spacePermissions": [ { "type": "EXPORTSPACE", "userName": null, "groupName": null }, { "type": "EXPORTSPACE", "userName": null, "groupName": "confluence-users" }, { "type": "EXPORTSPACE", "userName": null, "groupName": "confluence-administrators" } ] }, { "type": "SETPAGEPERMISSIONS", "spacePermissions": [ { "type": "SETPAGEPERMISSIONS", "userName": null, "groupName": "confluence-users" }, { "type": "SETPAGEPERMISSIONS", "userName": null, "groupName": "confluence-administrators" } ] }, { "type": "REMOVEMAIL", "spacePermissions": [ { "type": "REMOVEMAIL", "userName": null, "groupName": "confluence-users" }, { "type": "REMOVEMAIL", "userName": null, "groupName": "confluence-administrators" }, { "type": "REMOVEMAIL", "userName": null, "groupName": null } ] }, { "type": "REMOVEBLOG", "spacePermissions": [ { "type": "REMOVEBLOG", "userName": null, "groupName": null }, { "type": "REMOVEBLOG", "userName": null, "groupName": "confluence-users" }, { "type": "REMOVEBLOG", "userName": null, "groupName": "confluence-administrators" } ] }, { "type": "EXPORTPAGE", "spacePermissions": [ { "type": "EXPORTPAGE", "userName": null, "groupName": null }, { "type": "EXPORTPAGE", "userName": null, "groupName": "confluence-administrators" }, { "type": "EXPORTPAGE", "userName": null, "groupName": "confluence-users" } ] }, { "type": "REMOVEATTACHMENT", "spacePermissions": [ { "type": "REMOVEATTACHMENT", "userName": null, "groupName": null }, { "type": "REMOVEATTACHMENT", "userName": null, "…
type: Answer
upvote count: 6

http://stackoverflow.com/a/27145375
has comment: http://stackoverflow.com/comment/42786924
has body: Use while loop to check is cursor have data or not : cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(projection[0]); videoId = cursor.getLong(columnIndex); cursor.close(); Replace with this code : while (cursor.moveToNext()){ int columnIndex = cursor.getColumnIndex(projection[0]); videoId = cursor.getLong(columnIndex); } cursor.close();
answers question: http://stackoverflow.com/q/27145052
score: 0
type: Answer

http://stackoverflow.com/q/27060901
has title: JPanel not showing in JFrame?
accepted answer: http://stackoverflow.com/a/27064020
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42638821
tagged with: swing
has comment: http://stackoverflow.com/comment/42640594
has comment: http://stackoverflow.com/comment/42636374
has answer: http://stackoverflow.com/a/27064020
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/42637391
score: 1
tagged with: java
upvote count: 1
has body: I'm creating a mp3Tagger app in Java, using JAudioTagger http://www.jthink.net/jaudiotagger/ The app actually shows the title of the track, the number, the album, the artist, the year, the genre and the comments included in the Metadatas. It should show the artwork of the album on a JPanel in a corner of the main JFrame... But it doesn't. I think that the Jpanel doesn't work: it doesn't show neither JTextField or Button... The code: class JPanelArt extends JComponent { private static final long serialVersionUID = 1L; private Image image; public JPanelArt() { try { image = ImageIO.read(new File("res/download.jpg")); } catch (IOException e) {} } protected void paintComponent(Graphics g) { if (image == null) return; g.drawImage(image, 0, 0, null); } } Frame Class: public class Mp3TaggerFrame extends JFrame { private static final long serialVersionUID = 1L; static AudioFile mp3; private JPanel contentPane; private JPanelArt albumArt; private JLabel imageArt; private JTextField titleTrack; private JTextField artist; private JTextField album; private JTextField genre; private JTextField trackNumber; private JTextField lenght; private JTextField year; private JTextField comment; private JTextField bitRate; JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("Mp3 File", "mp3"); public void setAlbumArt(BufferedImage _image) { } public String getTitleTrack() { return titleTrack.getText(); } public void setTitleTrack(String title) { this.titleTrack.setText(title); } public String getArtist() { return artist.getText(); } public void setArtist(String artist) { this.artist.setText(artist); } public String getAlbum() { return album.getText(); } public void setAlbum(String album) { this.album.setText(album); } public String getGenre() { return genre.getText(); } public void setGenre(String genre) { this.genre.setText(genre); } public int getTrackNumber() { return Integer.valueOf(trackNumber.getText()); } public void setTrackNumber…
type: Question
has comment: http://stackoverflow.com/comment/42639295
answer count: 2
linked to: http://stackoverflow.com/q/5621338
possible better answer: http://stackoverflow.com/a/27061975
has answer: http://stackoverflow.com/a/27061975
tagged with: jpanel

http://stackoverflow.com/comment/43956108
type: Comment
comment on: http://stackoverflow.com/a/27119532
type: AnswerComment
score: 0
has text: Thanks, @tabiul. It turned out that there was a problem with the UDP server. Really appreciate your time looking into this.

http://stackoverflow.com/q/27141534
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/16749885
tagged with: struts
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27147358
tagged with: jquery
favorite count: 0
tagged with: struts2
type: Question
accepted answer: http://stackoverflow.com/a/27147358
has body: I am working on web services in struts. Now I want json object using its key value. Then I have to post something like array in response. I have no idea how to do that in Struts. I know how to do it in Servlets. So, I am using the following code I have tried, but I think it is different in Struts. JSONObject json = (JSONObject)new JSONParser().parse(jb.toString()); String key_value= json.get("key").toString(); So, how to do it in Struts. Please also tell me how to parse json array in response.
score: 0
linked to: http://stackoverflow.com/q/27057150
upvote count: 1
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42809875
has title: How to get json object using its key value in Struts?

http://stackoverflow.com/a/27111519
answers question: http://stackoverflow.com/q/27111472
has comment: http://stackoverflow.com/comment/42726159
has body: One quick solution is to use instanceof: for(Item item : items) { if(item instanceof Book) { // print it } } A more generic solution is to make the method generic, giving it a type parameter and checking if the item type is that of the specified class (or a subclass of it): public &lt;T extends Item&gt; void printItems(List&lt;Item&gt; items, Class&lt;T&gt; clazz) { for(Item item : items) { // Check if item is of the same type or a subtype of the specified class. if(clazz.isAssignableFrom(item.getClass())) { // print it } } } Then to print Book elements: printItems(itemsList, Book.class); and similarly for DVD elements: printItems(itemsList, DVD.class);
has comment: http://stackoverflow.com/comment/42725968
type: AcceptedAnswer
score: 1
type: Answer
upvote count: 2
downvote count: 1
accepted answer of: http://stackoverflow.com/q/27111472

http://stackoverflow.com/a/26997576
has body: Try without space &lt;%@ page import="action.LoginCheckAction" %&gt;
has comment: http://stackoverflow.com/comment/42525764
has comment: http://stackoverflow.com/comment/42526295
has comment: http://stackoverflow.com/comment/42526879
answers question: http://stackoverflow.com/q/26997403
score: 0
type: Answer

http://stackoverflow.com/q/27052799
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27052860
has title: Accessing objects in 2D arrays?
score: -1
possible better answer: http://stackoverflow.com/a/27052860
has answer: http://stackoverflow.com/a/27052865
answer count: 2
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27052865
type: AnsweredQuestion
tagged with: oop
tagged with: java
has comment: http://stackoverflow.com/comment/42622700
has body: I want to print out the "weight" of an item in my game. Class, "Item": public class Item { private String name; private double weight; public Item(String n, double w) { this.name = n; this.weight = w; } } In the main class I have this bit of code: public static Item[][] items = {{new Item("Dagger", 1), new Item("Sword", 5), new Item("Bullet(s)", 0), new Item("Pistol", 15)}, {new Item("Torch", 2), new Item("Shovel", 5), new Item("Pickaxe", 10)}, {new Item("Gold", 0), new Item("Potion(s)", 1)}}; How could I print the weight of dagger, for example?

http://stackoverflow.com/a/27135063
has comment: http://stackoverflow.com/comment/42768605
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27134748
has body: Try this. public void countOccurence() { for(Character ch :"abcdefghijklmnopqrstuvwxyz0123456789".toCharArray()) { BufferedReader reader = new BufferedReader(new FileReader("somefile.txt")); int ch; char charToSearch=ch; int counter=0; while((ch=reader.read()) != -1) { if(charToSearch == (char)ch) { counter++; } }; reader.close(); System.out.pritln("Character: " + charToSearch + " occurs " + counter + " times."); } }
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42768647

http://stackoverflow.com/q/27149375
tagged with: jsf
accepted answer: http://stackoverflow.com/a/27149823
upvote count: 2
score: 1
tagged with: java
has title: Java Uploaded File Name Turkish Character Issue in JSF - Primefaces
downvote count: 1
type: Question
tagged with: primefaces
has body: I use Primefaces p:fileUpload dialog. When I use some specific Turkish characters in file name like "ğ ü ş ı ö ç" I can't get them corretly and can't save the uploaded file on disc. public void handleFileUpload(FileUploadEvent event){ String newName = new String(event.getFile().getFileName("ISO-8859-1").getBytes(), "UTF-8"); or I also tried this one: String newName = new String(event.getFile().getFileName("ISO-8859-1").getBytes(), "ISO-8859-9"); How to get or convert the letters corretly? Thanks for help.
has answer: http://stackoverflow.com/a/27149823
answer count: 1
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/a/27088773
answers question: http://stackoverflow.com/q/27058249
has comment: http://stackoverflow.com/comment/54698718
has comment: http://stackoverflow.com/comment/42690905
has comment: http://stackoverflow.com/comment/42690913
has comment: http://stackoverflow.com/comment/42690880
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42689366
score: 2
has body: Try using this code: //imports import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.util.ArrayList; import java.util.List; //create the array lists to save the data private static List&lt;String&gt; readData = new ArrayList&lt;String&gt;(); private static List&lt;String&gt; readTerms = new ArrayList&lt;String&gt;(); private static List&lt;String&gt; splitData = new ArrayList&lt;String&gt;(); private static List&lt;String&gt; finalData = new ArrayList&lt;String&gt;(); public static void main(String[] args) throws Exception{ readData(); processData(); writeFinalData(); } public static void readData() throws Exception{ //create readers BufferedReader data = new BufferedReader(new FileReader(new File("Test.csv"))); BufferedReader term = new BufferedReader(new FileReader(new File("Terms.txt"))); //read the data and save it into the array lists String line; while((line = term.readLine()) != null){ readTerms.add(line); } while((line = data.readLine()) != null){ readData.add(line); } //close the readers data.close(); term.close(); } Now we have two array lists witch hold the data from the .csv file and the data from the terms file. The next step is to process this data and write it to a file. public static void processData(){ //looping through every line in the .csv file, spliting it by , and saving every piece of the data into a new array list for(String d : readData){ String[] split = d.split(","); for(int i = 0; i &lt; split.length; i++){ splitData.add(split[i]); } } //searching the .csv file for keywords for(String s : splitData){ for(String k : readTerms){ //testing if the data from the .csv file contains (or is equal to) the keyword. If true then we add it to the array list which holds the final data that will be writen back to the file if(s.contains(k)){ finalData.add(s); } } } } The last thing left to do is to write the data that matches the keywords back to a file. publi…
has comment: http://stackoverflow.com/comment/42690838
has comment: http://stackoverflow.com/comment/42689082
has comment: http://stackoverflow.com/comment/42691093
has comment: http://stackoverflow.com/comment/42689415
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27058249
has comment: http://stackoverflow.com/comment/54680237
has comment: http://stackoverflow.com/comment/42692806

http://stackoverflow.com/q/27131935
has title: Selecting items from multiple context menus
answer count: 0
type: UnansweredQuestion
has body: So here is my problem, I have two context menus bound to two buttons, they take the options from db tables. final Button bButton = (Button) findViewById(R.id.BeerButton); bButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { registerForContextMenu(bButton); openContextMenu(bButton); } }); final Button fButton = (Button) findViewById(R.id.FireButton); fButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { registerForContextMenu(fButton); openContextMenu(fButton); } }); } @Override public void onCreateContextMenu(ContextMenu cmenu, View v,ContextMenu.ContextMenuInfo cmenuInfo) { super.onCreateContextMenu(cmenu, v, cmenuInfo); if(v.getId() == R.id.BeerButton){ ContextMenu bMenu = cmenu; bMenu.setHeaderIcon(R.drawable.beer); bMenu.setHeaderTitle("What's your poison?"); List&lt;bDB&gt; bMenuContainer = bDao.queryBuilder().list(); for (bDB item : bMenuContainer) { bMenu.add(item.getName() + " " + item.getVolume() + "l " + "(" + item.getCost() + " Kč)"); } } else if(v.getId() == R.id.FireButton){ ContextMenu fMenu = cmenu; fMenu.setHeaderIcon(R.drawable.fire); fMenu.setHeaderTitle("What do you smoke?"); //blah blah pretty much the same thing } } and now to the onContextItemSelected, could you guide me how to do this part? I just need a kick-off, the rest I will handle, the data will be then written to other table for further statistics. @Override public boolean onContextItemSelected(MenuItem item) { //somebody cast your magic here, PLEASE! } return super.onContextItemSelected(item); } thanks in advance!
tagged with: contextmenu
tagged with: java
has comment: http://stackoverflow.com/comment/42763050
type: Question
has comment: http://stackoverflow.com/comment/42763447
score: 0
tagged with: android

http://stackoverflow.com/comment/42546301
type: Comment
comment on: http://stackoverflow.com/q/27009061
score: 0
has text: In catch block put this `ex.printStackTrace();` and post what exception you are getting.
type: QuestionComment

http://stackoverflow.com/a/27081955
has body: I figured it out, it was a really dumb problem. I had to change my urls.py to accept the url without the slash at the end. Plus I had to add the @csrf_exempt decorator to the function for it to work.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27081278

http://stackoverflow.com/comment/42837954
score: 0
type: AnswerComment
has text: Hehe thanks, I thought it might be something like that in the end, but did not want to believe it because I did not know what to do instead. I recently decided screw it and just created lists for every item contained in the 2d array, took me a few hours but at least now everything is working fine...
type: Comment
comment on: http://stackoverflow.com/a/27128577

http://stackoverflow.com/q/27141514
has answer: http://stackoverflow.com/a/27141531
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/27141531
upvote count: 1
type: Question
tagged with: object
has title: Accessing integers from an object of class Object
tagged with: java
has answer: http://stackoverflow.com/a/27141653
tagged with: int
answer count: 2
has body: In the code below an integer array is assigned to an object. If that's possible, why can't i access them through obj? The code compiles, but i get a ClassCastException, I have tried casting the object to String, i get the same error public class test { public static void main(String ab[]) { Object obj = new int[] {1,2,3,4,5,6,7,8,9,10}; Integer[] i = (Integer[]) obj; for( Integer c : i) System.out.println(c); } }
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/27141653
favorite count: 0

http://stackoverflow.com/comment/42644344
has text: It is a different question, you should probably post a new question.
comment on: http://stackoverflow.com/a/27064427
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27037501
tagged with: database
has comment: http://stackoverflow.com/comment/42595132
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29843673
has body: I have problem using mapDB on GWT, i found error in this line: File utilizzo = new File("saveme.db"); DB db; db = DBMaker.newFileDB(utilizzo).closeOnJvmShutdown().make(); the error is in the third line and is: nov 20, 2014 11:20:30 AM com.google.appengine.tools.development.ApiProxyLocalImpl log GRAVE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String com.sample.Doodle.client.GreetingService.greetServer(java.util.ArrayList) throws java.lang.IllegalArgumentException' threw an unexpected exception: java.lang.NoClassDefFoundError: org/mapdb/DBMaker
type: Question
possible better answer: http://stackoverflow.com/a/29843673
has title: java.lang.NoClassDefFoundError: org/mapdb/DBMaker
has comment: http://stackoverflow.com/comment/42595278
has answer: http://stackoverflow.com/a/27044852
tagged with: mapdb
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27044852
tagged with: gwt
tagged with: java

http://stackoverflow.com/comment/42761871
score: 0
has text: What is the question/what are you trying to achieve?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27131358

http://stackoverflow.com/comment/42779519
has text: Actually, this issue is caused by adding different version of the same Jar package.
comment on: http://stackoverflow.com/a/27140921
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42571336
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27023040
type: Comment
has text: You would have to loop through the list view and use listView.getChildAt(i);

http://stackoverflow.com/comment/42691946
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27092961
has text: Down voter, would you mind explain why you think this is a bad answer?
type: AnswerComment

http://stackoverflow.com/comment/42607321
comment on: http://stackoverflow.com/q/27044130
score: 0
type: Comment
type: QuestionComment
has text: I'll try, but the parameter passed by Hive is a long: 39514210:java.lang.Long

deep-copy
tags question: http://stackoverflow.com/q/27040446
tag name: deep-copy
type: Tag

http://stackoverflow.com/comment/42760894
type: Comment
type: QuestionComment
has text: Or a text field which only accepts numbers (as shown [here](http://stackoverflow.com/a/13424140/1076463))
comment on: http://stackoverflow.com/q/27128491
score: 0

http://stackoverflow.com/q/27036856
tagged with: spring-websocket
has comment: http://stackoverflow.com/comment/42626683
has comment: http://stackoverflow.com/comment/42594069
score: 0
has answer: http://stackoverflow.com/a/27037197
answer count: 1
has title: Spring 4 Websockets java.lang.NoClassDefFoundError
type: UnansweredQuestion
tagged with: jetty
tagged with: spring
has body: I'm new to spring websocket and following this tutorial.enter link description here. But I'm getting always this exception when running on jetty. Exeception. 2014-11-20 17:56:51.978::WARN: Nested in org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=http://localhost:8081/springexample/ws/586/krdp8vij/xhr; nested exception is org.springframework.web.socket.sockjs.SockJsException: Uncaught failure for request http://localhost:8081/springexample/ws/586/krdp8vij/xhr; nested exception is java.lang.NoClassDefFoundError: org/springframework/http/server/ServletServerHttpAsyncRequestControl: java.lang.NoClassDefFoundError: org/springframework/http/server/ServletServerHttpAsyncRequestControl at org.springframework.http.server.ServletServerHttpRequest.getAsyncRequestControl(ServletServerHttpRequest.java:202) at org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession.initRequest(AbstractHttpSockJsSession.java:190) at org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession.handleInitialRequest(AbstractHttpSockJsSession.java:156) at org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler.handleRequestInternal(AbstractHttpSendingTransportHandler.java:66) at org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler.handleRequest(AbstractHttpSendingTransportHandler.java:58) at org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService.handleTransportRequest(TransportHandlingSockJsService.java:254) at org.springframework.web.socket.sockjs.support.AbstractSockJsService.handleRequest(AbstractSockJsService.java:311) at org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.handleRequest(SockJsHttpRequestHandler.java:88) at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51) at org.springframework.web.servlet.DispatcherServlet.doDispatch(…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42624139

http://stackoverflow.com/q/27098536
has comment: http://stackoverflow.com/comment/42701926
has comment: http://stackoverflow.com/comment/42701924
linked to: http://stackoverflow.com/q/149274
has title: Huge performance different between HTTP and HTTPS?
tagged with: netty
has comment: http://stackoverflow.com/comment/42701966
has comment: http://stackoverflow.com/comment/43233635
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27394124
accepted answer: http://stackoverflow.com/a/27394124
has comment: http://stackoverflow.com/comment/42702111
tagged with: java
has comment: http://stackoverflow.com/comment/42702044
has comment: http://stackoverflow.com/comment/42702023
has comment: http://stackoverflow.com/comment/42702065
has body: I'm testing HttpHelloWorldServer from netty example, I do a little change is making CONTENT larger (25KB - match my reponse size in reality). And I see a huge different performent between HTTP and HTTPS version, HTTP give me about 110k req/s, HTTPS give me ~400 req/s. So what can make HTTPS such that slower? Test condition: Netty 5 ALPHA2 JDK8-64 bit ubuntu 14.04 CPU Core i7 8 thread 2.2 GHz RAM 8GB Launch example without any special JVM parameter. My benchmark use wrk with Keep-Alive enable.
type: Question
has comment: http://stackoverflow.com/comment/42701997
has comment: http://stackoverflow.com/comment/42702053
answer count: 1
has comment: http://stackoverflow.com/comment/43235206
score: 0

http://stackoverflow.com/a/27145402
has comment: http://stackoverflow.com/comment/42788719
type: Answer
has comment: http://stackoverflow.com/comment/42787793
has comment: http://stackoverflow.com/comment/42787986
upvote count: 1
has comment: http://stackoverflow.com/comment/42788501
score: 1
has comment: http://stackoverflow.com/comment/42787037
has comment: http://stackoverflow.com/comment/42788900
has body: your cursor has 0 rows. So, the line cursor.getLong(columnIndex); throws CursorIndexOutOfBoundsException. please check for null and check whether any rows exist or not. If there is no rows cursor.moveToFirst() will return false. Cursor cursor = contentResolver.query(videosUri, projection, MediaStore.Video.VideoColumns.DATA + " =?", new String[] { fileToShare }, null); if (cursor != null) { if (cursor.moveToFirst()) { int columnIndex = cursor.getColumnIndex(projection[0]); videoId = cursor.getLong(columnIndex); cursor.close(); if (videoId != -1) { videoUriStr = videosUri.toString() + "/" + videoId; } } } return videoUriStr; The MediaStore.Video.VideoColumns.DATA field holds the path for the video file. So, if you are using uri (content://mnt/sdcard/Videos/test.mp4) to fetch the file change it to file path (/mnt/sdcard/Videos/test.mp4).
downvote count: 0
answers question: http://stackoverflow.com/q/27145052
has comment: http://stackoverflow.com/comment/42787710
has comment: http://stackoverflow.com/comment/42787220

http://stackoverflow.com/comment/42741888
type: QuestionComment
has text: possible duplicate of [How can I increment a date by one day in Java?](http://stackoverflow.com/questions/428918/how-can-i-increment-a-date-by-one-day-in-java)
score: 0
comment on: http://stackoverflow.com/q/27117062
type: Comment

http://stackoverflow.com/a/27007585
has body: Error message cleary states that, Caused by: java.io.IOException: Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses. You have to configure the mapred-site.xml and core-site.xml and many other configurations you should do.. For step by step, you refer this link Hadoop V2 setup Hope this helps you.
type: Answer
downvote count: 2
has comment: http://stackoverflow.com/comment/42544201
has comment: http://stackoverflow.com/comment/42543943
upvote count: 0
score: -2
answers question: http://stackoverflow.com/q/27007018

http://stackoverflow.com/q/27145608
upvote count: 1
type: Question
has title: How to make background frame's JtextField focused?
has comment: http://stackoverflow.com/comment/42787426
downvote count: 0
has comment: http://stackoverflow.com/comment/42787079
accepted answer: http://stackoverflow.com/a/27146277
tagged with: jdialog
has comment: http://stackoverflow.com/comment/42787047
has comment: http://stackoverflow.com/comment/42787205
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42787221
has comment: http://stackoverflow.com/comment/42787145
tagged with: jframe
has comment: http://stackoverflow.com/comment/42787875
has comment: http://stackoverflow.com/comment/42787352
tagged with: swing
has body: I am stuck with a problem. I have designed a simple JFrame with 2 textboxes. At the time of loading the JFrame I also load VirtualKeyboard which is a JDialog form. The problem is now that both, the frame and the keybord, are there but in the JFrame I am not able to click on the textfields. If I close the keybord I am able to use the JFrame. How can I access the JFrame when the keyboard is opened. When the JFrame loads I am calling the JDialog as follows_ This is my JFrame: public class TestText extends javax.swing.JFrame { static KeyBoard vk; /** * Creates new form TestText */ public TestText() { initComponents(); vk = new KeyBoard(new javax.swing.JFrame(), true); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TestText().setVisible(true); vk.setLocation(30,500); vk.setVisible(true); } }); } private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; } This is my VirtualKeybord which is a JDialog: public class KeyBoard extends javax.swing.JDialog { /** * Creates new form KeyBoard */ public KeyBoard(java.awt.Frame parent, boolean modal) { super(parent, modal); setFocusableWindowState(false); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); initComponents(); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==jButton2) { try{ Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_A); } catch(Exception E){} } } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource()==jButton1) { try{ Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_TAB); } catch(Exception E){} } } private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; What do I need to change, that it is possible to access both, the keyboard and the JFrame with the textfields?
has comment: http://stackoverflow.com/comment/42786937
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27146277
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42787395

http://stackoverflow.com/q/27111692
score: 1
tagged with: java
has body: I am trying to create a service that returns SVG. The requirement is that the SVG has to work in an img tag (script tag would be a bonus) and also to avoid JavaScript. I have figured that encoding the img in BASE 64 and using it as a URI ,is my best bet. Java Servlet String imageString = g2.getSVGElement(); // creates svg html string e.g blah blah byte[] imageData = Base64.encodeBase64(imageString.getBytes()); OutputStream out = response.getOutputStream(); out.write(imageData); out.flush(); out.close(); Response from GET request data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5v= ... HTML But when I load up the page I get blank img box. I know the base64 img is correct because when I do this . . . It works fine. How can I implement this with the HTML tag above ?
upvote count: 1
has comment: http://stackoverflow.com/comment/42727064
type: Question
accepted answer: http://stackoverflow.com/a/27115001
tagged with: base64
has answer: http://stackoverflow.com/a/27115001
has comment: http://stackoverflow.com/comment/42726566
tagged with: uri
downvote count: 0
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/svg
tagged with: http://stackoverflow.com/tag/html
has title: Creating images in SVG and rendering them in HTML using Base64 encoding URI and JAVA
type: AnsweredQuestion

http://stackoverflow.com/comment/42646955
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27066505
has text: I know of his fine library and use it, but not for compression yet, I didn't find solutions for directories if I recall well, thanks for the tip however.

http://stackoverflow.com/q/27069012
has comment: http://stackoverflow.com/comment/42651134
has body: Let's see. I have to make a homework with a complicated UML diagramm. I have an interface called Q, and a class called W, which realizes the Q interface. I have another class called R, which extends from W. The question is: Does the class R realize the Q interface? Thank you guys!
has comment: http://stackoverflow.com/comment/42651185
type: Question
has comment: http://stackoverflow.com/comment/42651090
has comment: http://stackoverflow.com/comment/42651144
has answer: http://stackoverflow.com/a/27069085
has answer: http://stackoverflow.com/a/27069148
tagged with: inheritance
score: 0
answer count: 3
has title: Does an inherited class realize the interface the class's parent already realized in java?
has comment: http://stackoverflow.com/comment/42651110
possible better answer: http://stackoverflow.com/a/27069085
tagged with: interface
has answer: http://stackoverflow.com/a/27069102
accepted answer: http://stackoverflow.com/a/27069102
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20534726
tagged with: java

http://stackoverflow.com/comment/42674120
has text: @BackSlash If everything is so buggy as it seems why do we have it there in all those UI menus/views etc. Practically it doesn't work, right?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27071731

http://stackoverflow.com/a/27130559
accepted answer of: http://stackoverflow.com/q/27128440
has comment: http://stackoverflow.com/comment/42785620
type: Answer
has comment: http://stackoverflow.com/comment/42796341
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42767463
answers question: http://stackoverflow.com/q/27128440
has body: To lay out controls in the requested manner with a GridLayout in SWT you will have to group the controls of each row into a composite of their own like so: shell.setLayout( new RowLayout( SWT.VERTICAL ) ); Composite composite1 = new Composite( shell, SWT.NONE ); composite1.setLayout( new GridLayout( 2, false ) ); createLabel( composite1, "2020" ); createLabel( composite1, "808080808080" ); Composite composite2 = new Composite( shell, SWT.NONE ); composite2.setLayout( new GridLayout( 2, false ) ); createLabel( composite2, "50505050" ); createLabel( composite2, "50505050" ); private static Label createLabel( Composite parent, String text ) { Label label = new Label( parent, SWT.NONE ); label.setText( text ); return label; } However, to me a FormLayout seems more suitable to solve the given problem: shell.setLayout( new FormLayout() ); FormData leftFormData = new FormData(); leftFormData.top = new FormAttachment( 0 ); leftFormData.left = new FormAttachment( 0 ); leftFormData.right = new FormAttachment( 20 ); Label leftLabel = createLabel( shell, "2020", leftFormData ); FormData rightFormData = new FormData(); rightFormData.top = new FormAttachment( 0 ); rightFormData.left = new FormAttachment( leftLabel ); rightFormData.right = new FormAttachment( 100 ); createLabel( shell, "808080808080", rightFormData ); private static Label createLabel( Composite parent, String text, Object layoutData ) { Label label = new Label( parent, SWT.NONE ); label.setText( text ); label.setLayoutData( layoutData ); return label; } If you find the formData and formAttachment code too verbose, you may have a look at Slim Down SWT FormLayout Usage And for an in-depth discussion of SWT layouts I recommend the Understanding Layouts in SWT article.
has comment: http://stackoverflow.com/comment/42794079
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27006829
has comment: http://stackoverflow.com/comment/42542546
has body: What is the difference between: if ((x &lt;= 19 &amp; x &gt;= 13) ^ (y &lt;= 19 &amp; y &gt;= 13)) { System.out.print(true); } else { System.out.print(false); } and if (x &lt;= 19 &amp;&amp; x &gt;= 13 || y &lt;= 19 &amp;&amp; y &gt;= 13) { System.out.print(true); } else { System.out.print(false); } Could you please explain me in detail the operator ^ ?. Please provide some examples.
has comment: http://stackoverflow.com/comment/42542552
downvote count: 10
has comment: http://stackoverflow.com/comment/42542665
has answer: http://stackoverflow.com/a/27006950
accepted answer: http://stackoverflow.com/a/27006950
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42542531
type: Question
has comment: http://stackoverflow.com/comment/42542651
score: -9
has title: Please explain Java ^ operator with examples
upvote count: 1
has comment: http://stackoverflow.com/comment/42542545
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27064766
has comment: http://stackoverflow.com/comment/42643549
has comment: http://stackoverflow.com/comment/42643237
has comment: http://stackoverflow.com/comment/42643303
has comment: http://stackoverflow.com/comment/42643275
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42643298
has comment: http://stackoverflow.com/comment/42643346
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/27065422
has body: public int Neighbours(int xCoordinate, int yCoordinate) { xCoordinate -= 1; yCoordinate -= 1; int NeighbourCounter = 0; int incrementer = 0; int m1 = -1; //istart int n1 = -1; //jstart int m2 = 1; //iend int n2 = 1; //jend if (xCoordinate == 0) { m1 = 1; } if (yCoordinate == 0) { n1 = -1; } if (xCoordinate + 1 == yLen) { m2 = 0; } if (yCoordinate + 1 == xLen) { n2 = 0; } for (int xNeighbour = m1; xNeighbour &lt;= m2; xNeighbour++) { if (xNeighbour == 0) { incrementer = 2; } else { incrementer = 1; } for (int yNeighbour = n1; yNeighbour&lt;n2; yNeighbour += incrementer) { if (CurrentGen[yCoordinate + yNeighbour][xCoordinate + xNeighbour] == 1) { NeighbourCounter++; } } } return NeighbourCounter; } Is it possible to make this code more efficient? This code is for my Game of Life project, and I seem to be getting an error when I try to run this code for the next generation of the game of life. For my NextGeneration I seem to be getting an ArrayOutOfBoundsException: -2. This error occurs in the line 45.
has comment: http://stackoverflow.com/comment/42643781
tagged with: java
has comment: http://stackoverflow.com/comment/42643309
type: Question
has comment: http://stackoverflow.com/comment/42643296
has comment: http://stackoverflow.com/comment/42643334
upvote count: 0
score: -2
has title: Is there a way to make this code more efficient?
has comment: http://stackoverflow.com/comment/42643472
has comment: http://stackoverflow.com/comment/42643664

http://stackoverflow.com/a/27014083
has body: This is because result is defined in the for-loop scope. Please, format your code, and you will see that result isn't "visible" from return statement. UPDATE: Friendly remainder: you can format selected code in eclipse with a shortkey: Ctrl + Shift + F Formatted code: public static int[][] splitArrayByNum(int[] input, int number){ if (input[0]==number) for ( int i = 0 ; i &lt; input.length - 1 ; i++ ) { input[ i ] = input[ i + 1 ] ; } if ((input[(input.length)-1])==number) for ( int i = (input.length)-1 ; i &lt; input.length - 1 ; i++ ) { input[ i ] = input[ i + 1 ] ; } int count = 0; for (int i = 0; i &lt; input.length; i++) { if (input[i] == number) { count++; } int[][] result = new int[count][]; int firstindex=0; int lastindex=0; for (int j=0; j&lt;input.length; j++){ if (input[j]==number){ result[j]=Arrays.copyOfRange(input, firstindex, lastindex); firstindex=lastindex=j; } lastindex++ ; } return result ; } You may see that you don't have the method closing }, and the result is defined in the for-loop scope, and is returned from there, but I believe that you want to return the result after the for-loop, isn't it? I suppose that your code should look like this: public static int[][] splitArrayByNum(int[] input, int number){ if (input[0]==number) for ( int i = 0 ; i &lt; input.length - 1 ; i++ ) { input[ i ] = input[ i + 1 ] ; } if ((input[(input.length)-1])==number) for ( int i = (input.length)-1 ; i &lt; input.length - 1 ; i++ ) { input[ i ] = input[ i + 1 ] ; } int count = 0; for (int i = 0; i &lt; input.length; i++) /*removed bracket here*/ if (input[i] == number) { count++; } int[][] result = new int[count][]; int firstindex=0; int lastindex=0; for (int j=0; j&lt;input.length; j++){ if (input[j]==number){ result[j]=Arrays.copyOfRange(input, firstindex, lastindex); firstindex=lastindex=j; } lastindex++ ; } return result ; } also, I guess that you have a mistake in the line result[j]=Arrays.copyOfRange(input, firstindex, lastindex);. It's possible that j will b…
has comment: http://stackoverflow.com/comment/42555501
has comment: http://stackoverflow.com/comment/42554772
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42574928
type: Answer
has comment: http://stackoverflow.com/comment/42595033
has comment: http://stackoverflow.com/comment/42555269
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27013869
answers question: http://stackoverflow.com/q/27013869
score: 1

http://stackoverflow.com/q/27143678
has body: I have a unit test on some code running under Java 1.5. In Eclipse I run the test and it returns the following string with the Exception.getMessage(): The Test has Failed: java.lang.String but running it with Gradle with targetCompatibility set to 1.5 returns The Test has failed: java.lang.String cannot be cast to java.lang.Integer I am guessing the gradle junit runs under the 1.7 that gradle is running under. There doesn't seem to be a way to change this. Is there a way to make a unit test return the same string (without hacking the code) under Java 1.7 and Java 1.5 and is there any documentation that will show why this is different now?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42783766
type: Question
tagged with: junit
has comment: http://stackoverflow.com/comment/42787323
score: 0
has title: Running JUnit tests in Gradle under Java 1.5 produce different results under 1.7
tagged with: java
has comment: http://stackoverflow.com/comment/42784493
tagged with: eclipse
tagged with: gradle

http://stackoverflow.com/q/27146195
has title: How to deal with OrganizationalUnit with Spring LDAP 2.0 ODM?
has comment: http://stackoverflow.com/comment/42857946
has body: I'm migrating our LDAP client application that manages our OpenLDAP objects. This application is written in Java and currently use spring ldap 1.3. I'm currently (70%) in the process of migrating to spring ldap 2.0.2 and I'm quite happy with this new version. I've created our objects and used annotations (@Entry ...) and it works. Now here is my problem : My users are in ou=people,dc=mycompany,dc=com The user belongs to an unit base name for units is ou=units,dc=mycompany,dc=com Units are hierarchically embedded : ou=a,ou=b,ou=units or ou=e,ou=b,ou=units Here is my code: @Entry(objectClasses={"organizationalUnit", "top"}, base="ou=units") public class Unit { @Id private Name dn; @Attribute(name="ou") @DnAttribute(value="ou", index=1) private String rdn; } But this code only works for first level units ! I've found the following question and @marthursson suggests to write its own ObjectDirectoryMapper. Is this the only solution ? Edit 1 : You mean, like : @Entry(objectClasses={"organizationalUnit", "top"}, base="ou=units") public class Unit { @Id private Name dn; @Attribute(name="ou") @DnAttribute(value="ou", index=1) private String rdn; @Attribute(name="ou") @DnAttribute(value="ou", index=2) private String lvl2; @Attribute(name="ou") @DnAttribute(value="ou", index=3) private String lvl3; @Attribute(name="ou") @DnAttribute(value="ou", index=4) private String lvl4; } I get one IndexOutofBoundException if there is no value to put at index 2. Typically when I'm loading the root unit under ou=units. Edit 2 : The following function does the job : public String getRdn() { LdapName n = LdapNameBuilder.newInstance(dn.getSuffix(dn.size()-1)).build(); return n.getRdn(0).getValue().toString(); }
downvote count: 0
has comment: http://stackoverflow.com/comment/43657388
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring-ldap
linked to: http://stackoverflow.com/q/24666222
has comment: http://stackoverflow.com/comment/42824359
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42824473
has comment: http://stackoverflow.com/comment/42861533
type: Question

http://stackoverflow.com/a/27050015
downvote count: 0
has body: Car.mileage() is void, i.e., does not return anything. It needs to return something, like in: public int mileage() { return miles; }
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27049947
score: 2

http://stackoverflow.com/comment/42662439
score: 0
type: Comment
type: QuestionComment
has text: I would rename your `or` function to `firstOf` and just use it. Seems to me like a good solution.
comment on: http://stackoverflow.com/q/27074651

http://stackoverflow.com/q/27052402
has title: Spring MVC - Getting constant 404 errors on Tomcat
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42621894
has comment: http://stackoverflow.com/comment/42622118
tagged with: java
has comment: http://stackoverflow.com/comment/42622177
has comment: http://stackoverflow.com/comment/42621873
type: Question
answer count: 2
upvote count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/42621979
possible better answer: http://stackoverflow.com/a/27053446
has comment: http://stackoverflow.com/comment/42621855
tagged with: spring
has body: I've created a basic Spring MVC web app with Maven. However, I've been struggling with getting constant 404 errors when I'm accessing the /login URL. The /login URL should be mapped to the AuthController servlet and the createLoginForm() method, but unfortunately it fails and I'm ending up with a 404 error. I'm trying to figure out what is issue that is causing 404 errors and why the /login URL cannot be mapped to the servlet. Is the problem located in bad configuration of the web.xml or spring-dispatcher-servlet.xml files that prevent the URL to be mapped? When I'm accessing the / URL, then the index.jsp file is mapped and it's is working fine The login.jsp file is put outside the WEB-INF directory, in the webapp one as well as the index.jsp file. Thanks in advance. AuthController.java package com.github.wjoz.springmvcreview.auth; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller public class AuthController { @RequestMapping(value="/login", method=RequestMethod.GET) public ModelAndView createLoginForm() { ModelAndView model = new ModelAndView("login"); return model; } } web.xml <?xml version="1.0" encoding="UTF-8"?> springmvcreview index.jsp spring-dispatcher org.springframework.web.servlet.DispatcherServlet spring-dispatcher / spring-dispatcher-servlet.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:mvc="http://www.springframework.org/schema/mvc" 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…
has comment: http://stackoverflow.com/comment/42623612
has comment: http://stackoverflow.com/comment/42621807
has answer: http://stackoverflow.com/a/27053601
score: 1
has answer: http://stackoverflow.com/a/27053446
accepted answer: http://stackoverflow.com/a/27053601

http://stackoverflow.com/q/27081567
has comment: http://stackoverflow.com/comment/42672673
has comment: http://stackoverflow.com/comment/42673078
type: Question
has body: I'm using Apache's HttpClient 4.3.6 in Java and trying to use HttpPost.setHeader(String, string), but getting: The method setHeader(String, String) is undefined for the type HttpPost Here's my code // Create post request HttpPost request = new HttpPost(GAME_ANALYTICS_URL + GAME_KEY + "/design"); // Encode String content = gson.toJson(message); String hashedAuthData = DigestUtils.md2Hex((content + SECRET_KEY).getBytes()); request.setHeader("Application", hashedAuthData); I'm following a tutorial, which uses the setHeader() method. And I googled a bit but couldn't find others having the same problem, but I saw plenty of people using the setHeader() method. My import is: import org.apache.http.client.methods.HttpPost; So I'm fairly sure it's the correct one. Anyone who have any clue what could be wrong?
has comment: http://stackoverflow.com/comment/42675993
tagged with: apache
tagged with: httpclient
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27083421
has title: HttpPost doesn't contain setHeader(String, String)
accepted answer: http://stackoverflow.com/a/27083421
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/121408445
comment on: http://stackoverflow.com/a/27131342
type: AnswerComment
score: 0
type: Comment
has text: OOM => "Out Of Memory"

http://stackoverflow.com/comment/42682976
score: 1
comment on: http://stackoverflow.com/a/27087412
has text: There was nothing about strings in neither the question nor the answer. Furthermore, the OP wanted to average the values in his array, which means he really wishes them to be numeric.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27026801
has title: If I can not call a method in the onCreate() where do I call it? Android/Java
type: Question
accepted answer: http://stackoverflow.com/a/27027365
has comment: http://stackoverflow.com/comment/42577556
has comment: http://stackoverflow.com/comment/42576776
answer count: 2
has comment: http://stackoverflow.com/comment/42577314
downvote count: 0
has comment: http://stackoverflow.com/comment/42577194
favorite count: 0
has comment: http://stackoverflow.com/comment/42577578
tagged with: android
has answer: http://stackoverflow.com/a/27027365
upvote count: 1
has body: I am getting an error: "Android System services not available to Activities before onCreate()" Where else would I put my method call if I need it fired when the activity starts? public class DownloadPosters extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_download_posters); //I have a class that is storing two id's from the previouse activity. String eventid = PosterSessionData.getEventId(); String postercatid = PosterSessionData.getPosterCatId(); //This method is part of this class (should I even be extending ActionBarActivity here? new CallFileLocations().execute(null, eventid, postercatid); } The CallFileLocations() fires off an AsyncTask that gets file locations from my server. Inside the onPostExecute() I loop the results and fire an outside class that manages the download. inside onPostExecute(): for(int i = 0; i &lt; arraySize; i++) { JSONObject obj = posters.getJSONObject(i); String title = obj.getString("poster_title"); String line = "Poster: "+title+ " Rev: "+obj.getString("rev"); String link = obj.getString("poster_filepath"); String cleanLink = link.replace("\\", ""); myTextView.append(line + cleanLink + " : Go Download"); String fileName = obj.getString("poster_filename"); myTextView.append("\n"); *************************************************************** //when I added this I recieved the error. DownloadHandler file = new DownloadHandler("example.com/"+cleanLink+"/"+fileName+".pdf", title, fileName); This is the DownloadHandler which exists as its own class file public class DownloadHandler extends Activity { DownloadManager downloadManager; private String fileName; private long myDownloadReference; //private BroadcastReceiver receiverDownloadComplete; //private BroadcastReceiver receiverNotificationClicked; public DownloadHandler(String s, String title, String f) throws Exception { fileName = f+".pdf"; downloadManager = (DownloadManager)…
has comment: http://stackoverflow.com/comment/42577451
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42577497
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27027172
has answer: http://stackoverflow.com/a/27027172

http://stackoverflow.com/a/27114431
answers question: http://stackoverflow.com/q/27113877
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27113877
has body: okay, based on the discussion in the comments: You have a byte-stream which represents RGB per pixel. ImageIO.read() does, according to its Javadoc, "Return a BufferedImage as the result of decoding a supplied InputStream with an ImageReader chosen automatically from among those currently registered.". So, ImageIO.read() typically does not expect RGB pixel bytes, but an encoding as JPG or PNG. As it cannot recognize the byte-stream as a valid image encoding, it returns null. As possible solution on how to get an image from the RGB pixel bytes is then given on SO: How to convert array of bytes into Image in Java SE
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/27041969
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/27041881
has body: thread.join(); is an expression that tells the main thread to wait for thread termination. so, it only goes to the printing statement when the thread has finished. so its the right result, because thread already terminated. if you remove the join, you will see the result is true
score: 4
has comment: http://stackoverflow.com/comment/42632653
has comment: http://stackoverflow.com/comment/42661587

http://stackoverflow.com/a/27009728
has comment: http://stackoverflow.com/comment/42548190
type: Answer
accepted answer of: http://stackoverflow.com/q/27009429
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27009429
has comment: http://stackoverflow.com/comment/42547958
has comment: http://stackoverflow.com/comment/42547270
has body: The PrintWriter is not flushed. Use p.println("some string"); p.flush(); or use autoFlush PrintWriter p = new PrintWriter(fo, true); p.println("some string"); or just close it. autoFlush works for println, printf and format. See the javadoc of PrintWriter. Details The PrintWriter can be constructed either with another Writer, a File or filename or an OutputStream. In case of instantiating it using an OutputStream the javadoc says: public PrintWriter(OutputStream out) Creates a new PrintWriter, without automatic line flushing, from an existing OutputStream. This convenience constructor creates the necessary intermediate OutputStreamWriter, which will convert characters into bytes using the default character encoding. and the javadoc of OutputStreamWriter says: ... The resulting bytes are accumulated in a buffer before being written to the underlying output stream. ... EDIT So your code fo = new FileOutputStream(file); PrintWriter p = new PrintWriter(fo); will lead to this stream model +-------------+ +--------------------+ +------------------+ | PrintWriter | --------&gt; | OutputStreamWriter | -------&gt; | FileOutputStream | +-------------+ +--------------------+ +------------------+ Therefore a println will not directly write the string to the FileOutputStream p.println("some string") +-&gt; outputStreamWriter.write("some string") +--&gt; write to internal buffer (as bytes) p.flush(); +-&gt; outputStreamWriter.flush(); +--&gt; internal buffer flush +--&gt; fileOutputStream.write(bytes)
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42547342

http://stackoverflow.com/q/27087768
type: Question
has answer: http://stackoverflow.com/a/27095681
has answer: http://stackoverflow.com/a/27092489
downvote count: 0
accepted answer: http://stackoverflow.com/a/27092489
has comment: http://stackoverflow.com/comment/42685703
has body: When using CodaHale Metrics in Java or Scala code a clustered environment what are the gotchas when reporting to Graphite? If I have multiple instances of my application running and creating different metrics can Graphite cope - i.e. is reporting cumulative? For example if I have AppInstance A and B. If B has a gauge reporting 1.2 and another reporting 1.3 - what would be the result in Graphite? Will it be an average? or will one override the other. Are counters cumulative? Are timers cumulative? Or should I somehow give each instance some tag to differentiate different JVM instances?
tagged with: codahale-metrics
has title: Java/Scala Metrics - Codahale - Cluster/Mulitnode & Graphite Reporter
tagged with: metrics
answer count: 3
has answer: http://stackoverflow.com/a/27137417
favorite count: 0
tagged with: graphite
possible better answer: http://stackoverflow.com/a/27095681
tagged with: scala
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/42870879
comment on: http://stackoverflow.com/a/27123302
has text: I would guess that the logic to why operands are promoted to int is also related to the rationale used in [C and C++](http://stackoverflow.com/a/24372323/1708801)
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/39265035
has body: we can use FTPFileFilter to filter files that we want to list FTPFileFilter filter=new FTPFileFilter(){ @Override public boolean accept(FTPFile ftpFile) { return (ftpFile.isFile() &amp;&amp; ftpFile.getName().endsWith(".csv")); } }; FTPFile[] files=sessionForFtp.Files("directoryName", filter);
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/27148735
type: Answer

http://stackoverflow.com/comment/42776768
type: QuestionComment
has text: `Collections.sort` forwards to `Arrays.sort(collection.toArray())`. Which in turn uses several different algorithms depending on input type, for example [TimSort](http://en.wikipedia.org/wiki/Timsort). Or a fancy parallel fork-join sort in Java 8.
comment on: http://stackoverflow.com/q/27139265
score: 0
type: Comment

http://stackoverflow.com/q/27060394
favorite count: 0
type: Question
tagged with: wildfly
has answer: http://stackoverflow.com/a/59152764
possible better answer: http://stackoverflow.com/a/55741123
has answer: http://stackoverflow.com/a/55741123
score: 4
has body: I am getting the following exception: javax.validation.ConstraintDeclarationException: HV000151: A method overriding another method must not alter the parameter constraint configuration when deploying my application on Wildfly 8.1 server. The project is deploying and working well on a previous, JBoss 7.1 application server. Do I need to make changes to the code or could there be some problem with the configuration?
tagged with: java
has title: Javax validation exception when migrating to Wildfly 8.1
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/27127043
upvote count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27127043
tagged with: validation
tagged with: migration
has answer: http://stackoverflow.com/a/77394428

http://stackoverflow.com/comment/42671271
comment on: http://stackoverflow.com/a/27080434
has text: FWIW the calculation first starts to go awry at `n * n`. In Java, `295120061 * 295120061` correctly results in `-389577847`. In JavaScript, even with [forced integers](http://stackoverflow.com/questions/3428136/javascript-integer-math-incorrect-results), `(295120061 * 295120061) | 0` incorrectly results in `-389577840`. It compounds from there, with other similar added inaccuracies.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27049514
tagged with: selenium-webdriver
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/56844649
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/27049597
type: Question
linked to: http://stackoverflow.com/q/13482352
tagged with: firefox
has body: In the frame I'm working with, I have the following element: &lt;div class="x-grid3-cell-inner x-grid3-col-expRepCol"&gt; New session from client IP 192.168.5.3 (ST=/CC=/C=) at VIP 192.168.5.2 Listener /Common/Tomcat (Reputation=Unknown)&lt;/div&gt; As well as many other similar elements. I am trying to locate this element by partial name text and click it with the following code: String expectedText = "New session from client IP"; driver.findElement(By.className("div[class*='"+expectedText+"']")).click(); And I have also tried with cssSelector: String expectedText = "New session from client IP"; driver.findElement(By.cssSelector("div[class*='"+expectedText+"']")).click(); But WebDriver keeps throwing an exception stating it's unable to locate that element. Any suggestions as to what could be the problem?
linked to: http://stackoverflow.com/q/12403870
accepted answer: http://stackoverflow.com/a/27049597
downvote count: 0
favorite count: 0
score: 8
upvote count: 8
has answer: http://stackoverflow.com/a/78922113
possible better answer: http://stackoverflow.com/a/56844649
has answer: http://stackoverflow.com/a/27049609
answer count: 4
has title: Selenium WebDriver Finding Element by Partial Class Name

embeddable
type: Tag
tags question: http://stackoverflow.com/q/27012870
tag name: embeddable

http://stackoverflow.com/comment/42554857
has text: Could you please help me for check condition?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27012436
score: 0

http://stackoverflow.com/comment/42724124
type: Comment
score: 0
has text: @user2150250 I found this: http://stackoverflow.com/questions/12403870/how-to-escape-single-quote-in-xslt-substring-function - I hope it's useful.
type: AnswerComment
comment on: http://stackoverflow.com/a/27049597

gwt-designer
type: Tag
tag name: gwt-designer
tags question: http://stackoverflow.com/q/27008693

http://stackoverflow.com/q/27034010
has answer: http://stackoverflow.com/a/27034118
has comment: http://stackoverflow.com/comment/42595943
has comment: http://stackoverflow.com/comment/42588878
has comment: http://stackoverflow.com/comment/42589046
has comment: http://stackoverflow.com/comment/42589395
downvote count: 0
tagged with: calculator
favorite count: 0
has comment: http://stackoverflow.com/comment/42598614
tagged with: android
has title: Android App crashed and showing a white blank Screen
accepted answer: http://stackoverflow.com/a/27039486
has body: Note: Sorry if my problem may be really easy to fix, I'm a total beginner in this, I literally started learning this just 2 days ago. So anyway, I'm making this basic calculator app for androids. I built the .apk and sent it to my phone but it just shows a blank white screen and then it crashes. Here's the xml code and the java code: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:background="@drawable/numbs" &gt; &lt;TextView android:id="@+id/title" android:text="Calculator" android:textColor="#E11608" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="35sp" android:layout_gravity="top|center" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:background="#000000" /&gt; &lt;EditText android:id="@+id/value1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FFFFFF" android:inputType="number" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:ems="10" android:layout_gravity="center" android:layout_marginBottom="80dp" android:hint="Type in your next value" /&gt; &lt;EditText android:id="@+id/value2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FFFFFF" android:inputType="number" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:ems="10" android:layout_gravity="center" android:layout_marginBottom="148dp" android:hint="Type in your first value" /&gt; &lt;Button android:id="@+id/add" android:text="+" android:layout_gravity="center|left" android:onClick="onClick" /&gt; &lt;Button android:id="@+id/minus" android:text="-" android:layout_gravity="center" android:layout_marginRight="40dp" android:onClick="onClick" /&gt; &lt;Button android:id="@+id/divide" android:text="÷" android:layout_gravity="center" android:layout…
upvote count: 1
answer count: 4
possible better answer: http://stackoverflow.com/a/27034083
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27039486
has comment: http://stackoverflow.com/comment/42598843
has answer: http://stackoverflow.com/a/27034083
type: Question
has answer: http://stackoverflow.com/a/27034394

http://stackoverflow.com/comment/42697474
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27094317
score: 0
has text: possible duplicate of [How to parse dates in multiple formats using SimpleDateFormat](http://stackoverflow.com/questions/4024544/how-to-parse-dates-in-multiple-formats-using-simpledateformat)

http://stackoverflow.com/a/27145949
has comment: http://stackoverflow.com/comment/42957512
has comment: http://stackoverflow.com/comment/42825423
has comment: http://stackoverflow.com/comment/43138595
has comment: http://stackoverflow.com/comment/42854118
has comment: http://stackoverflow.com/comment/43132204
has comment: http://stackoverflow.com/comment/42962662
score: 0
has comment: http://stackoverflow.com/comment/42823310
has body: So I run your code and I change a little bit the code structure and I put comment on important points : public class Main { private JFrame jf; private Panel p; private JButton button; private Object options[]; private String[] tools = {"value1","value2"}; // here put the different values you need in your combobox //ActionListener Variables private int string1 = 170; private int string2 = 170; private int yJtf1 = 80; private int yJtf2 = 105; private int cb1y = 83; private int cb2y = 108; private int count = 0; private List&lt;JComboBox&lt;String&gt;&gt; cbs = new ArrayList&lt;JComboBox&lt;String&gt;&gt;(); //Keep References to your comboBoxs private List&lt;JTextField&gt; tfs = new ArrayList&lt;JTextField&gt;(); //Keep References to your TextFields public Main() { initView(); } //Method to create the view public void initView(){ jf = new JFrame(); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(700, 700); p = new Panel(); JTextField thingsTextField = new JTextField("", 20); thingsTextField.setBounds(75, 30, 135, 25); JTextField priceTextField = new JTextField("", 20); priceTextField.setBounds(75, 60, 135, 25); p.add(thingsTextField); p.add(priceTextField); addSection(); button = new JButton("+"); button.setBounds(350, 153, 41, 25); button.addActionListener(new ButtonClicked()); p.add(button); jf.add(p); jf.setVisible(true); //You have to call those methods to redraw the panel p.revalidate(); p.repaint(); } public static void main(String[] args) { new Main(); } //This method is called to add a section with the "Plus" Button public void addSection(){ if (count &lt; 3) { string1 += 60; string2 += 60; yJtf1 += 60; yJtf2 += 60; cb1y += 60; cb2y += 59; JTextField jtf1 = new JTextField("", 20); jtf1.setBounds(40, yJtf1, 40, 25); JTextField jtf2 = new JTextField("", 20); jtf2.setBounds(40, yJtf2, 40, 25); tfs.add(jtf1); tfs.add(jtf2); p.add(jtf1); p.add(jtf2); JComboBox&lt;String&gt; cb1 = new JComboBox&lt;&gt;(tools); cb1.setBounds(80, cb1y, 80, 20); JComboBox…
type: Answer
has comment: http://stackoverflow.com/comment/42813723
has comment: http://stackoverflow.com/comment/42788043
has comment: http://stackoverflow.com/comment/42790109
has comment: http://stackoverflow.com/comment/42846789
has comment: http://stackoverflow.com/comment/42788769
answers question: http://stackoverflow.com/q/27145591
has comment: http://stackoverflow.com/comment/42956233
has comment: http://stackoverflow.com/comment/42848062
has comment: http://stackoverflow.com/comment/42813930
has comment: http://stackoverflow.com/comment/42810803

http://stackoverflow.com/q/27011310
score: 0
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/42703372
type: UnansweredQuestion
has title: Send JUnit report to specific recipient
tagged with: maven
has body: I have configured JUnit test suite execution via maven surefire plugin which produces results on nightly bases. After each execution an email is sent to a certain DL where all the submitters are included. But I need to send a mail only to those submitters whose tests are failing. Let's say that person A has written TestA, person B has written TestB. If TestA fails, I know who is responsible for this and I want to send him a notification automatically and not to send such to person B as TestB is OK. I saw the Jenkins Email-ext+plugin. The problem is that it expects a list with email addresses, which in my case each time is different. If I am able to store the emails after each execution in a file, I could i.e. pass it to a such plugin and it could send mails to the addresses from the file. Do you know how can I do this magic? :) Maybe I can use the same plugin and put something extra in the templates? Thanks!
tagged with: java
tagged with: jenkins-plugins
type: Question
has comment: http://stackoverflow.com/comment/42581126
has answer: http://stackoverflow.com/a/29353284

heap-memory
tag name: heap-memory
type: Tag
tags question: http://stackoverflow.com/q/27034905
tags question: http://stackoverflow.com/q/27020057

http://stackoverflow.com/a/27049032
type: Answer
answers question: http://stackoverflow.com/q/27048949
score: -4
downvote count: 4
has body: Did you try replacing the underscore with &amp;#95; ?
upvote count: 0

http://stackoverflow.com/a/27001224
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26999888
has body: Your biggest issue is that you have created an n×m problem that ought to be a n+m problem. To solves this, first define a canonical unit and dissolve the problem into two steps, convert from the source unit to the canonical unit, then convert from the canonical unit to the target unit. For example, if you define kelvin to be the canonical unit, your code might resemble this: switch(inputUnit.getValue()) { case "Fahrenheit": kelvin=fahrenheitToKelvin(input); break; case "Celsius": kelvin=celsiusToKelvin(input); break; case "Kelvin": kelvin=input; break; default: throw new AssertionError(); } switch(outputUnit.getValue()) { case "Fahrenheit": output=kelvinToFahrenheit(kelvin); break; case "Celsius": output=kelvinToCelsius(kelvin); break; case "Kelvin": output=kelvin; break; default: throw new AssertionError(); } showAnswer.setText(output); I omitted string to number and number to string conversions as it should be obvious that these conversions need to be performed only once, outside the selector. This principle can be used as well, if you use enums instead of Strings or replace the switch with a Map based approach as suggested by others. But the important thing is the two-step approach that allows you to maintain n input unit to canonical plus m canonical to output unit conversions rather than n input units times m output units conversions.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42741326
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27103355
type: Comment
has text: @EJP In order to make your socket communication async and scalable, you always need a broker.

http://stackoverflow.com/comment/42629126
type: QuestionComment
type: Comment
has text: does [this](http://ankursinghal86.blogspot.jp/2014/06/authentication-with-client-certificate.html) help you
comment on: http://stackoverflow.com/q/27056261
score: 0

http://stackoverflow.com/comment/42690776
type: AnswerComment
has text: Can you post your code to create bufferedimage and display it
type: Comment
comment on: http://stackoverflow.com/a/27071488
score: 0

picketlink
tags question: http://stackoverflow.com/q/27050545
type: Tag
tag name: picketlink

http://stackoverflow.com/q/27089278
type: Question
has comment: http://stackoverflow.com/comment/42693547
tagged with: java
tagged with: hibernate
score: 0
has body: I have following mapping: @Entity @Table(name="terminal_user") public class TerminalUser { @OneToMany(mappedBy="user",fetch = FetchType.LAZY) private Set&lt;UserContent&gt; userContentSet; .... } @Entity @Table(name="user_content") public class UserContent { @ManyToOne @JoinColumn(name = "user_id") TerminalUser user; @OneToOne(mappedBy = "userContent") Content content; ... } @Entity @Table(name = "content") public class Content { @OneToOne @JoinColumn(name = "user_content_id") UserContent userContent; .... } After setting hibernate.hbm2ddl.auto to create I see following database diagram: For me relation of tables user_content and content is not one to one. It looks same as relation of terminal_user and user_content and it is one to many What do I wrong?
has comment: http://stackoverflow.com/comment/42686017
tagged with: jpa
answer count: 1
tagged with: one-to-one
has title: hibernate. OneToOne mapping in database
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42686205
tagged with: mapping
has answer: http://stackoverflow.com/a/42057836

http://stackoverflow.com/comment/42773247
comment on: http://stackoverflow.com/q/27136655
score: 0
type: Comment
type: QuestionComment
has text: Yes. Omit them, remove them, delete them, erase them, nuke them, eradicate them, trash them, wipe them [out], rub them [out], kick them [out], boot them [out], leave them out, and / or take them out. Get rid of them. Send them to the bit bucket. Throw them in the bin. Introduce them to file 13. Clear now?

http://stackoverflow.com/q/27049149
answer count: 1
downvote count: 1
favorite count: 0
tagged with: parsing
type: UnansweredQuestion
has title: Using JSOUP to read Titles from Wikipedia's "All Pages" special page
has comment: http://stackoverflow.com/comment/42619887
score: 1
tagged with: java
tagged with: wikipedia
type: Question
has answer: http://stackoverflow.com/a/29451988
tagged with: jsoup
has body: I'm trying to read and print out all of the titles listed in the English Wikipedia. It has a special page, "All pages," that shows all of the pages in alphabetical order. The issues I have : It starts with ! but I don't know where it ends.. All pages seems to keep continue through characters like Æ and I don't want those The titles are on numerous pages, so I need to reload the "next page" after I finish reading one page of titles I've not had any experience using jsoup, so I don't know what I'm doing
upvote count: 2

http://stackoverflow.com/a/26994636
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/75792322
type: Answer
has comment: http://stackoverflow.com/comment/75742075
has body: You need to tell the DateFormat to parse strictly, instead of leniently (the default): SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setLenient(false); sdf.parse("29-09-2014 20:35:27"); // Throws ParseException
accepted answer of: http://stackoverflow.com/q/26994586
answers question: http://stackoverflow.com/q/26994586
has comment: http://stackoverflow.com/comment/42521404
score: 4
has comment: http://stackoverflow.com/comment/75742252

http://stackoverflow.com/comment/42570563
score: 0
type: AnswerComment
type: Comment
has text: Ack, I knew it was something stupid. It was a Statement until they wanted a comment field in there also, and I missed that line when I converted it over. Thanks!
comment on: http://stackoverflow.com/a/27023242

http://stackoverflow.com/comment/42804406
score: 0
comment on: http://stackoverflow.com/q/27150125
type: Comment
type: QuestionComment
has text: @Denise You seem to be confusing the `long` [primitive data type](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html), [`Long`](https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html?is-external=true) class, and [long format in a string representation](https://docs.oracle.com/javase/tutorial/i18n/format/dateFormat.html) of a date-time value.

http://stackoverflow.com/q/27103745
tagged with: regex
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42711434
type: Question
accepted answer: http://stackoverflow.com/a/27103940
has answer: http://stackoverflow.com/a/27103940
score: 0
has title: java7 diamond operator convert compilation error
tagged with: java-7
answer count: 1
has comment: http://stackoverflow.com/comment/42711573
has comment: http://stackoverflow.com/comment/42711671
has body: I wanted to convert the current code to Java7 diamond operator. I have the below regular expression for finding and replace. Finding new (\w+)&lt;.+&gt; Replace: new $1&lt;&gt; The problem is it is getting replaced for anonymous classes as well. Becuase of this I get compilation error. So How do I write the regular expression which avoid inner classes?

http://stackoverflow.com/comment/42770571
score: 0
comment on: http://stackoverflow.com/q/27136143
has text: in layout of fragment view with id list is not instance of your PrettyListView
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27061138
has body: I am moving from PHP to Java and I'm a little struggled. I have this method like this that I use to get some data from MySQL database and I would like to treat the failure if no data got from database. public double getRate() { double ret; try { // do a select query PreparedStatement stmt = conn.prepareStatement("SELECT `rate` FROM `rates` LIMIT 1"); ResultSet rs = stmt.executeQuery(); // get result rs.absolute(1); ret = rs.getDouble(1); // close the resources rs.close(); stmt.close(); } // this catches only the SQL errors (if I am right) catch (SQLException ex) { ex.printStackTrace(); } // THIS IS WRONG BECAUSE "variable ret might not have been initialized" return ret; } In PHP we can return whatever in case of failure like this: &lt;?php public function getRate() { $ret = db::getOne("SELECT `rate` FROM `rates` LIMIT 1"); if ($ret) { return $ret; // row has been found, so we return it } else { return false; // row hasn't been found, so we return false --&gt; THIS is what I need to do in Java } } ?&gt; So how to treat a failure in Java methods/functions where I have nothing to return?
has answer: http://stackoverflow.com/a/27061508
has answer: http://stackoverflow.com/a/27062167
type: UnansweredQuestion
has title: Java, double returning function, what to return on failure?
tagged with: php
has answer: http://stackoverflow.com/a/27061205
has answer: http://stackoverflow.com/a/27061328
tagged with: java
has answer: http://stackoverflow.com/a/27061182
type: Question
score: 0
has answer: http://stackoverflow.com/a/27061279
has answer: http://stackoverflow.com/a/27061271
answer count: 7

http://stackoverflow.com/q/27014267
has title: EhCache Write-Behind: Removing objects after writing to Db
score: 1
tagged with: java
upvote count: 1
has body: I'm using ehcache with write-behind in order to optimize the writing to db (through hibernate). My question is how do I configure ehcache to remove from the cache an element that was just written to db? I tried several combinations of ttl and time to idle but couldnt make it work. I need that because I found out that if element x was putWithWriter and then written to db, then if I do cache.get() then in case that the x is in the cache I get x as an unmanaged entity. I know that I can set ehcache to be transnational but it comes with a cost, while in most cases I dont need it. Another reason is that I'm new to ehcache and to its configuration and right now I hope for a fast solution. Maybe I can remove them with cache.remove() in the writer, but then I'd have to explicitly lock it and it has its costs right? So can I configure ehcache to remove elements from cache right when it writes them to db? Thanks!
type: Question
tagged with: hibernate
tagged with: caching
tagged with: jpa
downvote count: 0
favorite count: 0
tagged with: ehcache
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/q/27081186
upvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/11743686
accepted answer: http://stackoverflow.com/a/27081332
answer count: 3
has body: I'm reading a string in java from a .txt file says: E 1 2 W1 (I'm having it in a string variable) now I want to cut the information into 3 variables: v1 = 1 v2 = 2 w = 1 problem is numbers could occupy more bytes in example: E 12 204 W1 how do I easily take the 2nd, 3rd and 4th words into differents vars?
score: -2
has title: Cutting information correctly from a String in Java
duplicate of: http://stackoverflow.com/q/11743686
possible better answer: http://stackoverflow.com/a/27081265
has answer: http://stackoverflow.com/a/27081284
has answer: http://stackoverflow.com/a/27081265
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27081332
tagged with: java
type: Question

http://stackoverflow.com/q/27000590
tagged with: apache-axis
type: Question
score: 0
tagged with: axis
answer count: 1
has answer: http://stackoverflow.com/a/27011123
has body: I am trying to call a WS (I am sorry, but I can't copy here the WSDL. It's confidential :\ ). My invocation is: CreateRequestResponse crr = servicioModificacion.createRequest(cr); servicioModificacion has been initialized with: servicioModificacion = new ModifyServiceServiceStub(); ModifyServiceServiceStub is: public class ModifyServiceServiceStub extends org.apache.axis2.client.Stub implements ModifyServiceService { ... } ModifyServiceServiceclass is a simple interface: public interface ModifyServiceService { ... } cr object is implemented: CreateRequest cr = new CreateRequest(); CreateRequestclass is: public class CreateRequest implements org.apache.axis2.databinding.ADBBean{ ... } Ok. So, when I launch this line, I get a org.apache.axis2.AxisFault exception with the message Unmarshalling Error:. Nothing more. I've googled many and I don't find nothing similar (similar errors has a larger message, with more info.). I've build the client with Apache Axis2: Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:34:40 IST) Anyone knows what can I do with this exception? Thanks in advance!
type: UnansweredQuestion
tagged with: web-services
has title: Unmarshalling error when I call WS
tagged with: java

http://stackoverflow.com/a/27138685
type: Answer
has comment: http://stackoverflow.com/comment/42815964
score: 1
has comment: http://stackoverflow.com/comment/42816235
answers question: http://stackoverflow.com/q/27136875
upvote count: 1
has comment: http://stackoverflow.com/comment/42817341
has comment: http://stackoverflow.com/comment/42817454
has comment: http://stackoverflow.com/comment/42817408
has comment: http://stackoverflow.com/comment/42789073
has comment: http://stackoverflow.com/comment/42790071
has comment: http://stackoverflow.com/comment/42816057
has comment: http://stackoverflow.com/comment/42788422
has comment: http://stackoverflow.com/comment/42808256
has comment: http://stackoverflow.com/comment/42817145
has comment: http://stackoverflow.com/comment/42816210
downvote count: 0
has body: First, start by taking a look at the documentation for Toolkit#addAWTEventListener Parameters: listener - the event listener. eventMask - the bitmask of event types to receive The eventMask is a bitmask of the event id's you want to receive. Okay, it's less then spectacular, but what it means is, you should be passing a or'ed list of event id's that you are interested in been notified about... Now the question becomes, what events are we interested and how do we get the id's... Well, AWTEvent contains a list of event ids that work with Toolkit, AWTEvent.WINDOW_FOCUS_EVENT_MASK and possible even AWTEvent.FOCUS_EVENT_MASK might be useful. Toolkit.getDefaultToolkit().addAWTEventListener(myTestListener, AWTEvent.WINDOW_FOCUS_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK); For example... import java.awt.AWTEvent; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.FocusEvent; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestFocus { public static void main(String[] args) { new TestFocus(); } public TestFocus() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { public TestPane() { Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (event instanceof WindowEvent) { System.out.println("WindowEvent"); Window…
has comment: http://stackoverflow.com/comment/42817944
has comment: http://stackoverflow.com/comment/42789003

http://stackoverflow.com/q/27005987
type: Question
tagged with: fingerprint
upvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/27012590
favorite count: 0
tagged with: x509
has title: Get fingerprint information of a Certification file
has body: Is there any way to get fingerprint information of a Certification file? For example I have my certRSA.cert and if I open it with windows 7 we can see all the information of the certificate (algorithm, issuer, subject, validity, public key, use of the key, FINGERPRINT...). In java I have the cert as a java object (x509Certificate): X509Certificate certRSA = X509Certificate.getInstance(CertRSA_data); And then for example we can get the public key: PublicKey pubKeyUser = certRSA.getPublicKey(); The code expose above by ZZ Coder (How to retrieve/compute an X509 certificate&#39;s thumbprint in Java?) is really good, but it calculates fingerprint and what I want is to get this information (the same way as we can get public key information, or issuer or other items) of the certificate, not calculate it. Is there any way to do this?? Any comment is greatly appreciated. Thanks so much.
has answer: http://stackoverflow.com/a/27012590
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1270703
tagged with: sha1
downvote count: 0
tagged with: java
tagged with: certificate

http://stackoverflow.com/comment/42647050
score: 0
comment on: http://stackoverflow.com/q/27065607
type: Comment
type: QuestionComment
has text: @MichaelMyers: The code without the layout works. The one with the layout displays the banner panel but not the controls panel whose object I created in the test class.

http://stackoverflow.com/a/27122420
downvote count: 0
has body: From the horse's mouth: public void run() If this thread was constructed using a separate Runnable run object, then that Runnable object's run method is called; otherwise, this method does nothing and returns public void start() Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. The run method is part of the Runnable interface, which doesn't entail usage of a separate thread for execution. A call to a Runnable.run method will be executed in the current execution context. start however is the method to call on a thread to actually launch it, and have the code in its run method to be executed asynchronously from the calling thread. For example, you could definitely override the run method of a Thread instance, and pass this instance for execution to yet another Thread instance as if it were just a simple Runnable. As you can see from the documentation cited at the beginning, the run method on the Thread class is provided for convenience: it let the jvm easily access the Runnable part of a thread without having to expose the Runnable object directly, but it also provides the programmer a way to embed the Runnable part in the thread directly, bypassing the need of a separate object.
upvote count: 2
answers question: http://stackoverflow.com/q/27119946
type: Answer
score: 2

http://stackoverflow.com/comment/42617406
type: Comment
comment on: http://stackoverflow.com/a/27048107
score: 1
has text: Seems `e.getMessage()` returns nothing in your case. You might add a string like `"Couldn't load the default values... " + e.getMessage()` so you'd get at least a visible error message. If you don't know what's the real error cause then add an additional line `e.printStackTrace();` to your catch block and look at server console for stack trace.
type: AnswerComment

http://stackoverflow.com/q/27052376
has answer: http://stackoverflow.com/a/27052473
type: Question
accepted answer: http://stackoverflow.com/a/27052473
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/19879844
tagged with: google-maps-android-api-2
has title: Google Map V2 in android phone not working
tagged with: android
type: AnsweredQuestion
tagged with: android-fragments
has body: I am facing problem in a android Google map v2 based application I ran in my phone [ Android OS, v4.2.2 (Jelly Bean) ] but error occurs. I am giving my source code below with Logcat. My phone is in Wi-Fi connected but i think the problem is in Google-Map Please Help! Thanks in Advance! Logcat: 11-21 06:40:50.672: D/jdwp(7984): sendBufferedRequest : len=0x45 11-21 06:40:50.676: W/asset(7984): AssetManager-->addDefaultAssets CIP path not exsit! 11-21 06:40:50.740: D/AndroidRuntime(7984): Shutting down VM 11-21 06:40:50.741: W/dalvikvm(7984): threadid=1: thread exiting with uncaught exception (group=0x40d8b9a8) 11-21 06:40:50.755: E/AndroidRuntime(7984): FATAL EXCEPTION: main 11-21 06:40:50.755: E/AndroidRuntime(7984): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemap/com.example.googlemap.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment 11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343) 11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) 11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.access$600(ActivityThread.java:162) 11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 11-21 06:40:50.755: E/AndroidRuntime(7984): at android.os.Handler.dispatchMessage(Handler.java:107) 11-21 06:40:50.755: E/AndroidRuntime(7984): at android.os.Looper.loop(Looper.java:194) 11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.main(ActivityThread.java:5371) 11-21 06:40:50.755: E/AndroidRuntime(7984): at java.lang.reflect.Method.invokeNative(Native Method) 11-21 06:40:50.755: E/AndroidRuntime(7984): at java.lang.reflect.Method.invoke(Method.java:525) 11-21 06:40:50.755: E/AndroidRuntime(7984): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.ru…
tagged with: java

http://stackoverflow.com/comment/42701032
has text: I tried inserting it, it's giving me an error message that says: "non-static variable this cannot be referenced from a static context"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27097946
type: Comment

http://stackoverflow.com/comment/42628040
has text: This error came while starting the server and there is no application deployed on the server. Also verified I am using the Java version 1.6.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27052864

http://stackoverflow.com/a/37506312
score: 14
answers question: http://stackoverflow.com/q/27131165
downvote count: 1
has body: In short, Metaspace size auto increases in native memory as required to load class metadata if not restricted with -XX:MaxMetaspaceSize
type: Answer
upvote count: 15

http://stackoverflow.com/comment/42690913
has text: Heh... thanks.. I'm used to JS.. Now I get the error "The type List is not generic; it cannot be parameterized with with arguments <string>
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27088773
type: AnswerComment

http://stackoverflow.com/q/27060914
upvote count: 1
tagged with: eclipse
downvote count: 1
type: Question
has title: How to compile a single JAVA file and put it back into WAR?
has comment: http://stackoverflow.com/comment/42636624
has comment: http://stackoverflow.com/comment/42639257
score: 0
has answer: http://stackoverflow.com/a/27061026
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27061007
has body: I have searched this, and there is similar situation but not an exact one. Being a beginner I need full instructions.I have the need to compile a single Java file and put it back into an existing (compiled) Java application. The source of this Java code is not available to me, therefore I cannot compile the entire project. I have decompiled a singe class file i needed, made changes to it and now want to put its corresponding class file back into the WAR. I do not want to use ANT or maven rather want to use eclipse to do the compiling. I do not know how can I resolve the dependencies my java file will have I obviously do not want to decompile entire application. I do have the WAR file Thanks!
has answer: http://stackoverflow.com/a/27062643
answer count: 4
has answer: http://stackoverflow.com/a/27062779
tagged with: java

http://stackoverflow.com/q/27042937
has comment: http://stackoverflow.com/comment/42605079
possible better answer: http://stackoverflow.com/a/27043208
has answer: http://stackoverflow.com/a/27043208
tagged with: swing
has comment: http://stackoverflow.com/comment/42605408
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42605334
score: 1
has body: How to make program i made by java know certain file types and make windows open that certain extension by it ? How i can put a picture to put it for that extension when it's the default program ? As example when i setup a FOX-IT reader it terns all PDFs files into FOX-IT reader &amp; the FOX-IT picture putted on the PDFs files also ? if there is a class that access a certain file in windows ?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42604962
answer count: 2
has title: how to make program i made by java know certain file types?
accepted answer: http://stackoverflow.com/a/27043339
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27043339

http://stackoverflow.com/comment/42654137
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27070523
has text: This input data does not work with your specified delimiter `",\n"`. If you want to read the whole line, then use `in.nextLine()` and `in.hasNextLine()`. (Edit: your program can still read that file, but it will read the whole file at once)

http://stackoverflow.com/comment/42620259
score: 0
comment on: http://stackoverflow.com/q/27051499
has text: I am guessing `Key#getencoded()` returns a `byte[]`. So, `this(key.getencoded())` is calling the third constructor in the code you show.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42783027
score: 2
comment on: http://stackoverflow.com/q/27143122
has text: Most examples with Executors that I've seen make use of Queues. Why not use `PriorityQueue` with the same comparator? Asking which is "best" is really up to your use case and work load, as there's no one answer that will always work for your particular task.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42711520
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27103932
has text: I would suggest looking at http://www.joda.org/joda-time/

http://stackoverflow.com/comment/113414136
comment on: http://stackoverflow.com/a/27056281
type: Comment
has text: Take care with int totalRows = query.getResultList().size(); you are calling again getResultList() below and this make the application slower
type: AnswerComment
score: 0

http://stackoverflow.com/q/27018781
has answer: http://stackoverflow.com/a/43905206
tagged with: java
type: Question
score: 0
answer count: 3
has title: When bringing Android activities from the stack to the front, how do I refresh (reinitialize) them? So to run onCreate again etc
has body: If I'm bringing Android activities from the stack to the front, how do I refresh them? So to run onCreate again etc. My code below, in conjunction with setting activities in the Android manifest to android:launchMode="singleTask" allows me to initiate an activity if that activity is not already active within the stack, if it is active within the stack it is then brought to the front. How do I then, if the activity is brought to the front refresh it so that onCreate is ran again etc. Intent intent = new Intent(myActivity.this, myActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent);
has comment: http://stackoverflow.com/comment/42562647
has answer: http://stackoverflow.com/a/27018894
has comment: http://stackoverflow.com/comment/42619375
tagged with: android
has answer: http://stackoverflow.com/a/27018834
tagged with: android-activity
type: UnansweredQuestion
tagged with: android-pendingintent
tagged with: android-intent

http://stackoverflow.com/q/27030898
possible better answer: http://stackoverflow.com/a/27030986
has answer: http://stackoverflow.com/a/27031022
has answer: http://stackoverflow.com/a/27030986
score: 0
has title: How do I send data based on 3 list size in JSON
has body: I have 3 input fields which is repeated 10 times. For example name,age and qualification.For first 3 rows I'am giving the value for each input fields and for the last 3 rows I'am giving the value for each input fields. I have added name, age and qualification values in an nameList, ageList and qualList object. Now I want to send this through JSON like this format. "studentsInfo": { "students": [ { "name": "aaa", "age": 21, "qualification": "B.E" }, { "name": "aaa", "age": 21, "qualification": "B.E" }, { "name": "aaa", "age": 21, "qualification": "B.E" } ] } How do I iterate these 3 Lists in a for loop. It might be a very simple question. But I feel difficulty to understand this and structuring a loop. Please give me an idea to solve this problem.
accepted answer: http://stackoverflow.com/a/27031022
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 2

http://stackoverflow.com/q/27079062
has answer: http://stackoverflow.com/a/36732432
has title: JavaFx Event argument type mismatch
upvote count: 10
tagged with: events
answer count: 4
has answer: http://stackoverflow.com/a/27079092
downvote count: 0
accepted answer: http://stackoverflow.com/a/27079092
tagged with: java
tagged with: javafx
has body: I using JavaFx for first time and I encountered a problem with events. I built a form with SceneBuilder and I add an event on .fxml and controller but it's always return with: Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch FirstScene.fxml: <URL value="@dark_style.css" /> <TableColumn text="C1" /> <TableColumn prefWidth="70.0" text="C2" /> FirstSceneController.java: public class FirstSceneController implements Initializable { @FXML private Button firstScene_newbutton; @FXML private TableView firstScene_tableView; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { } @FXML private void newButtonClick(ActionEvent event) { System.out.println("You clicked me!"); } } JavaFxApplication.java: public class JavaFXApplication extends Application { private Stage stage; @Override public void start(Stage primaryStage) { this.stage = primaryStage; try { FirstScene(); primaryStage.setTitle("FXML is Simple"); primaryStage.show(); } catch (IOException ex) { Logger.getLogger(JavaFXApplication.class.getName()).log(Level.SEVERE, null, ex); } } public void FirstScene() throws IOException { AnchorPane page = (AnchorPane) FXMLLoader.load(JavaFXApplication.class.getResource("FirstScene.fxml")); Scene scene = new Scene(page); stage.setScene(scene); } } Exception: Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Metho…
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/61071550
score: 10
has answer: http://stackoverflow.com/a/59104777
possible better answer: http://stackoverflow.com/a/36732432
favorite count: 0

http://stackoverflow.com/comment/42606580
score: 2
comment on: http://stackoverflow.com/q/27043875
has text: Create a bean that has a `Date` and a `List<Number>`. Read the line into the bean. Profit.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42793788
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65690/discussion-between-piyush-gupta-and-naveen-kumar).
type: Comment
comment on: http://stackoverflow.com/a/27149175
score: 0

http://stackoverflow.com/comment/42756012
type: Comment
has text: One more question if thats okay? I've got this all working now, but I want to call invalidateOptionsMenu() from my other class, so how would I do this. Everything I've tried has caused NullException errors. Can you recommend any other good training sources too? Sorry for this other question. Thank you
comment on: http://stackoverflow.com/a/27124438
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42603174
has text: @CraigOtis I wholeheartedly agree; I'll add that as a note to my answer.
type: Comment
comment on: http://stackoverflow.com/a/27041979
type: AnswerComment
score: 0

http://stackoverflow.com/q/27101243
has comment: http://stackoverflow.com/comment/42706668
answer count: 1
has comment: http://stackoverflow.com/comment/42706683
score: 0
tagged with: interface
type: UnansweredQuestion
has body: I have a question when i implement interface. import java.awt.*; import java.awt.geom.*; import javax.swing.*; /** An icon that has the shape of the planet Mars. */ public class MarsIcon implements Icon { /** Constructs a Mars icon of a given size. @param aSize the size of the icon */ public MarsIcon(int aSize) { size = aSize; } public int getIconWidth() { return size; } public int getIconHeight() { return size; } public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2 = (Graphics2D) g; Ellipse2D.Double planet = new Ellipse2D.Double(x, y, size, size); g2.setColor(Color.RED); g2.fill(planet); } private int size; } import javax.swing.*; public class IconTester { public static void main(String[] args) { JOptionPane.showMessageDialog( null, "Hello, Car!", "Message", JOptionPane.INFORMATION_MESSAGE, new MarsIcon(100)); System.exit(0); } } In the IconTester, i only create a MarsIcon(100). I have not call the method. But it seems that the paintIcon(;;;) is executed. How come? Are the methods called automatically?
type: Question
has answer: http://stackoverflow.com/a/27101284
has title: Interface method execution
tagged with: java

http://stackoverflow.com/comment/42738099
comment on: http://stackoverflow.com/q/27118008
score: 0
has text: something funny in the logic , I think possibly a misplaced `continue`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27115654
answers question: http://stackoverflow.com/q/27115292
type: Answer
has body: You get dd,ee,ff because when you call the same method again, it overrides the first ArrayList that is created. The best thing you could do, that I can think of, is to make your ArrayList global because currently you just keep getting rid of the previous values and create a new ArrayList with the new values you give it. Try doing something like: public class MyClass { private List&lt;String&gt; myArray; public MyClass() { myArray = new ArrayList&lt;String&gt;(); } public void syllables(wordfield) { // do whatever you need to with wordfield myArray.add(syllable); } I don't know how you've got everything laid out but this is the best solution I can think of.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27115292

http://stackoverflow.com/comment/42555972
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27014956
type: AnswerComment
has text: Thank you !! Of course, I forgot the problem of concurrent access.

http://stackoverflow.com/comment/76600551
type: AnswerComment
score: 0
has text: pleased to know that.
comment on: http://stackoverflow.com/a/29635044
type: Comment

http://stackoverflow.com/q/27132381
type: AnsweredQuestion
tagged with: validation
downvote count: 0
possible better answer: http://stackoverflow.com/a/33676191
favorite count: 0
has answer: http://stackoverflow.com/a/33676191
has title: apache commons-validator alternative for new gTLDS
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/27281078
has answer: http://stackoverflow.com/a/27306634
has comment: http://stackoverflow.com/comment/102441175
has answer: http://stackoverflow.com/a/61889930
tagged with: java
has answer: http://stackoverflow.com/a/27306596
score: 8
accepted answer: http://stackoverflow.com/a/27281078
has body: I need to validate emails and domains. I just need a formal validation, no whois or other forms of domain lookup needed. Currently I'm using apache's commons-validator v1.4.0 Unfortunately my customers use the new gTLDs, like .bike or .productions that are not yet supported by the DomainValidator class. See Apache's Jira issue for more details. Are there any sound alternatives that I may easily include in my Maven POM?
answer count: 5

http://stackoverflow.com/comment/42849552
comment on: http://stackoverflow.com/a/27154454
has text: Are you saying that `$ git pull` is not going to work unless I integrate with the tools you mentioned? Or all this works out of the box and you are just enhancing your JGit suggestion with additional info?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42744139
comment on: http://stackoverflow.com/a/27120885
type: AnswerComment
score: 0
type: Comment
has text: I really like your answer. Thanks.

http://stackoverflow.com/a/27354840
has body: It could be because input.nextLine(); is never assigned to a variable and thus returns a NullPointer. You could try: String delete = nextLine(); if you really need it. Because the next line is quite the same String userToDelete = nextLine(); if it is so, then just remove the above mentioned line.
answers question: http://stackoverflow.com/q/27066554
score: 0
type: Answer

http://stackoverflow.com/a/27394124
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27098536
answers question: http://stackoverflow.com/q/27098536
score: 0
has body: With support from netty channel, It seem that the bad performance cause by default JDK ssl implementation, Netty has a switch to use Openssl http://netty.io/wiki/forked-tomcat-native.html#wiki-h2-1, then I got a much better result.

http://stackoverflow.com/comment/42611550
type: Comment
type: QuestionComment
has text: @sreisman but how do i manage time slots ...a time slot for particular table
comment on: http://stackoverflow.com/q/27046368
score: 0

http://stackoverflow.com/a/27123683
has comment: http://stackoverflow.com/comment/42796304
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/42763761
has body: String pool as it is pool of string stored in heap for exp: String s="Test"; String s1="Test"; both gets stored in heap and refers to a single "Test" thus s1=s, while String s=new String("Test"); is an object that also get stored in heap but different form s1=s refer here
type: Answer
answers question: http://stackoverflow.com/q/27123131
score: -2

http://stackoverflow.com/comment/77799844
has text: I actually couldn't get this suggestion to work. If you read the [Android documentation](https://developer.android.com/training/appbar/setting-up.html) you will note that one of the `NoActionBar` themes must be used to prevent the app from using the native class for the action bar.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27088001

http://stackoverflow.com/comment/42669980
comment on: http://stackoverflow.com/q/27080039
has text: What kind of container (`Pane`) are you putting this in?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27042751
answers question: http://stackoverflow.com/q/27041484
score: 3
has comment: http://stackoverflow.com/comment/42626254
has comment: http://stackoverflow.com/comment/42626901
has comment: http://stackoverflow.com/comment/42626621
has comment: http://stackoverflow.com/comment/42608193
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42608398
upvote count: 3
type: Answer
has body: It's easier if you start from Login. Try this: String hql = "select song.title, song.artist, song.rating, song.composer, album.albumName, genre.genreName " + "from Login l join l.songs song " + "join song.genre genre " + "join song.album album " + "where l.userId= :userId";
accepted answer of: http://stackoverflow.com/q/27041484
downvote count: 0

http://stackoverflow.com/comment/42717898
type: AnswerComment
type: Comment
has text: Cast it to `Object` first :)
comment on: http://stackoverflow.com/a/27107190
score: 0

http://stackoverflow.com/a/27046596
answers question: http://stackoverflow.com/q/27045245
has comment: http://stackoverflow.com/comment/42617479
type: Answer
accepted answer of: http://stackoverflow.com/q/27045245
score: 2
has comment: http://stackoverflow.com/comment/51636051
upvote count: 2
has comment: http://stackoverflow.com/comment/42619117
has body: I agree with @chrylis, use the @PostConstruct on A rather than each subclass of A. (Note the spec says only 1 method may be annotated in this manner. Something like: public interface X { void addChangeListener(); } public abstract class A { X a; protected abstract X newX(); protected void setUp() {} @PostConstruct public void init() { a = newX(); a.addChangeListener(); setUp(); } } This allows forces the construction of the subclass, frees the implementors from remembering the addListener() call, while still allows them to perform class-specific initialization.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/51625715

http://stackoverflow.com/a/27117685
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42777254
score: 1
upvote count: 1
has body: Answer reformed, used List to add more and more elements without pre defined size. changed while (isDuplicate == false); to while (!isDuplicate); public static void main(String[] args) { Scanner scanner = new Scanner(System.in); List&lt;String&gt; nameOfPlayers = new ArrayList&lt;String&gt;(); boolean isDuplicate = false; int i = 0; do { System.out.println("Enter player " + (i + 1) + ": or Q for Quit"); String input = scanner.next(); if (!input.equalsIgnoreCase("Q")) { if (nameOfPlayers.contains(input)) { isDuplicate = true; } else { nameOfPlayers.add(input); isDuplicate = false; } System.out.println("CHECK : " + isDuplicate); } else { break; } i++; } while (!isDuplicate); } Enter player 1: or Q for Quit ankur CHECK : false Enter player 2: or Q for Quit singhal CHECK : false Enter player 3: or Q for Quit ankur CHECK : true
accepted answer of: http://stackoverflow.com/q/27117589
answers question: http://stackoverflow.com/q/27117589
type: AcceptedAnswer

http://stackoverflow.com/comment/42738052
type: Comment
score: 1
has text: ProcessBuilder is a library. By using ProcessBuilder we can execute the java program like we execute it from command prompt
comment on: http://stackoverflow.com/a/27117862
type: AnswerComment

http://stackoverflow.com/q/27080846
accepted answer: http://stackoverflow.com/a/27080931
answer count: 3
upvote count: 7
has title: Java path set wrongly
tagged with: windows-8
tagged with: java
has body: I have installed Java on a new system. Some random path in my C drive is automatically set for my PATH variable. Whenever I try to run Java, it shows java.exe not found in that wrong path! I'm trying to change the PATH variable using the SET command, but the new path is only getting added along with the old one. I could not run Java on the system. set PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_71\bin I've tried setting PATH variable in Windows Environment Variables list also after setting JAVA_HOME! When I type Java in cmd, i get: The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe. This path is the old unknown automatically set path. Is there any way to run Java! I'm using windows 8.
has comment: http://stackoverflow.com/comment/42671439
has answer: http://stackoverflow.com/a/27080931
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/47010900
score: 7
has answer: http://stackoverflow.com/a/47010900
has comment: http://stackoverflow.com/comment/42671354
type: Question
tagged with: windows
has answer: http://stackoverflow.com/a/27080927
has comment: http://stackoverflow.com/comment/42671366
favorite count: 0

http://stackoverflow.com/a/36022517
type: Answer
answers question: http://stackoverflow.com/q/27053276
score: 3
upvote count: 3
downvote count: 0
has body: The LGoodDatePicker library includes a good DateTimePicker component. This component allows the user to edit both the date and the time. The time can be edited with optional "spinner" style buttons, with the default "time list" button, or with both. Fair disclosure: I'm the primary developer. The DatePicker and the TimePicker classes can also be used individually, if desired. I've pasted a screenshot of the three components below, (and the demo application). The library can be installed into your Java project from the project release page. The project home page is on Github at: https://github.com/LGoodDatePicker/LGoodDatePicker .

http://stackoverflow.com/a/27099007
downvote count: 1
has body: Windows offers transactions on top of NTFS. See the description here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb968806%28v=vs.85%29.aspx It's not recommended for use at the moment and there's an extensive discussion of alternative scenarios right in MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/hh802690%28v=vs.85%29.aspx . Also if you take a definition of the filesystem, DBMS is also a kind of a filesystem and a filesystem (like NTFS or ext3) can be implemented on top (or in) DBMS as well. So Apache's statement is a bit, hmm, incorrect.
answers question: http://stackoverflow.com/q/27089198
has comment: http://stackoverflow.com/comment/42851160
has comment: http://stackoverflow.com/comment/42762360
has comment: http://stackoverflow.com/comment/42845264
score: 0
has comment: http://stackoverflow.com/comment/42741859
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42713805
type: QuestionComment
comment on: http://stackoverflow.com/q/27104944
has text: The problem for this scenario is that `T` is a type parameter of a method and therefore depends on the call site. And exact generic type meta data at the expression level is not available at runtime.
score: 1
type: Comment

http://stackoverflow.com/a/27039711
answers question: http://stackoverflow.com/q/27039511
score: 0
has body: You don't have proper mapping between your getter and setter. If you change your json to something like below, it would work: { "user": { "email":"email", "salt":"salt" }, "code":"010" } If you are getting json form third party then unfortunately, you would have to change your pojo or you could use adapter.
has comment: http://stackoverflow.com/comment/42598901
type: Answer
has comment: http://stackoverflow.com/comment/42598844

http://stackoverflow.com/comment/42660940
type: Comment
score: 0
type: AnswerComment
has text: x is the number of inputs being given. So in the loop the value of 'x' would be 2 but not 3. However I had posted the link of my question. Please do consider looking into it. If my question was not clear.
comment on: http://stackoverflow.com/a/27074214

http://stackoverflow.com/a/27004094
has comment: http://stackoverflow.com/comment/42537767
score: 6
upvote count: 6
has body: To connect in your code you use: Socket socket = new Socket(server_IP,server_Port); So you could use: Socket socket = new Socket("192.168.1.4", 5555); It looks like you have this in your code so I'm not sure what problem you're having. Don't forget that you have to setup your router to forward ports if it is located outside of your local network. http://www.wikihow.com/Set-Up-Port-Forwarding-on-a-Router Don't forget that if you are running a firewall, this can also interfere with the connection.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27003907
has comment: http://stackoverflow.com/comment/42537738
answers question: http://stackoverflow.com/q/27003907
type: Answer
has comment: http://stackoverflow.com/comment/42539012
downvote count: 0

http://stackoverflow.com/q/27151931
has body: public void selectdata(Connection conn, String database){ String table = "Mo"; // using Mo table, String comandoSql = "SELECT * FROM " + database + "."+"dbo"+ "."+ table; try { stmt = conn.createStatement(); rs = stmt.executeQuery(comandoSql); System.out.println("Command sql: "); while (rs.next()) { String DocumentName = rs.getString(2); doc1 = DocumentName; try { File file = new File("///.txt"); // path to output folder. FileWriter fileWritter = new FileWriter(file,true); BufferedWriter out = new BufferedWriter(fileWritter); out.write(doc1); out.newLine(); out.close(); } catch (IOException e1) { System.out.println("Could not write in the file"); } } } catch (SQLException e) { e.printStackTrace(); } this generates the output file but contains all the records in one file, my problem is how to generate separate file for each record don't want to do the post process in order to generate the separate files? any help?????? not fancy for scanner, because don't know how many lines will be in one record(it is a kind of multiple documents which stored into database table!!!!)
has title: How do I create separate output file for each sql record?
tagged with: sql-server
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42798649
favorite count: 0
has comment: http://stackoverflow.com/comment/42798417
type: Question
has answer: http://stackoverflow.com/a/27151995
accepted answer: http://stackoverflow.com/a/27151995
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42799967
tagged with: mysql
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/42669068
has text: You can check this https://github.com/shontauro/android-pulltorefresh-and-loadmore. It may help you.
score: 0
comment on: http://stackoverflow.com/q/27079522
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27005812
has comment: http://stackoverflow.com/comment/42540815
favorite count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27005845
tagged with: for-loop
has title: Approximation of e in java
has body: I am trying to get approximation of constant e where e = 2 + 1/2! + 1/3! + 1/4! + ....... every time I run the code I always! get 2. I would appreciate it if you could correct my code :) import java.util.Scanner; public class E { public static void main (String[] args) { Scanner scan = new Scanner (System.in); System.out.println("How many iterations"); //n = iterations int n = scan.nextInt(); long factor =1; //starts at 1 long e = 1; //e starting point for (int i=1; i&lt;=n; i++) { factor = factor * i; e += 1/factor; } System.out.println(e); } }
downvote count: 0
answer count: 1

http://stackoverflow.com/a/27073739
upvote count: 2
has body: Since "Car" has a constructor, any subclass derived from Car needs a constructor as well. So first you need to put a constructor in the Suv class. Example: class Suv extends Car { public Suv() { super( /* here you need to pass arguments to create a car */); // any other constructor code } }
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27073712
downvote count: 0

http://stackoverflow.com/q/27084567
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/27091020
tagged with: java
tagged with: caching
type: Question
has body: Spring Cache not working if called from doFilter. Note that Spring cache is working if NOT called from doFilter() (e.g if called from rest service) How can I enable cache in doFilter() ? (maybe cache is not allowed in doFilter?) @Configuration @EnableCaching public class CredentialsInjectionFilter implements javax.servlet.Filter { @Bean public CacheManager cacheManager() { SimpleCacheManager cacheManager = new SimpleCacheManager(); cacheManager.setCaches(Arrays.asList( new ConcurrentMapCache("tenants") )); return cacheManager; } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { display(5); filterChain.doFilter(servletRequest, servletResponse); } @Cacheable("tenants") public void display(int number) { // if cache working properly, code below will not execute after the first calling for(int i=0; i&lt;50; i++) { System.out.println("ramon called" +number); } }
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42692385
has title: Spring Cache not working in doFilter

http://stackoverflow.com/a/27034901
accepted answer of: http://stackoverflow.com/q/27034739
score: 0
type: Answer
has body: You Tomcat is extremly outdated. Tomcat 5.5 (Servlet 2.4) does not support the jsp expression language. See this page for an appropriate Tomcat version. Update to Tomcat 7 if you can.
answers question: http://stackoverflow.com/q/27034739
type: AcceptedAnswer

http://stackoverflow.com/q/27018842
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42562490
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/27018909
tagged with: java
has title: null pointer exception while resizing arrays
tagged with: null
tagged with: arrays
answer count: 1
tagged with: nullpointerexception
has body: I have a NullPointerException in the line "newIndexer[i].index = (int)Double.POSITIVE_INFINITY;" and I cannot figure out why. Any help is much appreciated. public void resizeIndexer(int newKey) { if (maxHeap &gt;= newKey) return; if (newKey &gt; maxHeap){ Handle[] newIndexer = new Handle[newKey + 1]; for (int i = 0; i &lt; newKey; i++){ if (i &lt; maxHeap) newIndexer[i] = this.Indexer[i]; else{ System.out.println(i); newIndexer[i].index = (int)Double.POSITIVE_INFINITY; newIndexer[i].status = false; } } maxHeap = newKey; Indexer = newIndexer; } }
has answer: http://stackoverflow.com/a/27018909

http://stackoverflow.com/comment/42758534
type: Comment
has text: Is this not possible with the normal GridLayout?
comment on: http://stackoverflow.com/a/27129266
score: 0
type: AnswerComment

http://stackoverflow.com/q/27090595
has comment: http://stackoverflow.com/comment/42688036
has comment: http://stackoverflow.com/comment/42688332
has comment: http://stackoverflow.com/comment/42688156
has comment: http://stackoverflow.com/comment/42688826
has answer: http://stackoverflow.com/a/27092106
tagged with: java
has comment: http://stackoverflow.com/comment/42688607
type: Question
has comment: http://stackoverflow.com/comment/42688063
has comment: http://stackoverflow.com/comment/42688080
has comment: http://stackoverflow.com/comment/42688169
has comment: http://stackoverflow.com/comment/42688574
has comment: http://stackoverflow.com/comment/42688649
tagged with: session
tagged with: jsp
has comment: http://stackoverflow.com/comment/42688426
has comment: http://stackoverflow.com/comment/42688292
score: 0
has comment: http://stackoverflow.com/comment/42688322
has comment: http://stackoverflow.com/comment/42688281
duplicate of: http://stackoverflow.com/q/4194207
answer count: 1
has comment: http://stackoverflow.com/comment/42688445
has body: The code of session is not working properly. I copied a link and after logout when I tried to access that link than it was working without asking a login. Here is the code of my login page on which I have created session: String user_name=request.getParameter("user_name"); String pass=request.getParameter("pass"); session.setAttribute("user_name", user_name); session.setAttribute("pass",pass); Here is the code of that page on which I have transferred my session: String user_name = (String)session.getAttribute("user_name"); Here is the code of logout page: session.setAttribute("user_name", null); session.invalidate(); response.sendRedirect("index.jsp"); response.addHeader("cache-control","no-cache");
has comment: http://stackoverflow.com/comment/42689157
linked to: http://stackoverflow.com/q/4194207
has title: Session is not working properly after sendRedirect() in JSP
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42688596

http://stackoverflow.com/comment/42798148
has text: The location you listed isn't the location of the class file, it's the location of the source file.
comment on: http://stackoverflow.com/q/27151703
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27023143
score: 0
has body: I have come up with at least three different ways to handle this. 1) I could use a @ResponseBody and return a String exactly like I do for this csv: @RequestMapping(value = "googleStoreReport", produces = "text/csv") @ResponseBody public String googleStoreReport(HttpServletRequest request, HttpServletResponse response, Model model) { List&lt;Store&gt; stores = storeService.getActiveStores(); List&lt;SapStore&gt; sapStores = sapStoreService.getAllSapStores(); response.setHeader("Content-Disposition", "attachment; filename=\"Google_Places_Bulk_Store_Upload.csv\""); response.setContentType("text/csv"); StringBuilder sb = new StringBuilder(); .... create file contents .... return sb.toString(); } 2) I could use a view as described here: (I will have to create my own version of the Spring AbstractExcelView) http://www.technicalkeeda.com/spring-tutorials/generate-excel-using-spring-mvc The approach here is to have the controller return a ModelAndView object with a List of objects containing row data. Then you have a View object that converts the List to a spreadsheet using Poi and writing the spreadsheet as a stream to the reponse object. 3) I could extend AbstractHttpMessageConverter using MappingJackson2HttpMessageConverter as a template. Instead of a ModelAndView object I return the list. The MessageConverter works the same way as the ViewResolver but works on a different part of the Request Lifecycle. (translates the List into a stream of spreadsheet data) I am mostly down to which is recommended: Extending AbstractView or AbstractHttpMessageConverter. I did find this nice post from three years ago http://java.dzone.com/articles/rest-spring but the author has the same problem I have. To make matters more confusing, Spring MVC seems to use both approaches..
answer count: 3
has title: What is the "correct" way to have a Spring MVC controller return an excel xslx spreadsheet
has answer: http://stackoverflow.com/a/27025197
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27023485
tagged with: spring
has answer: http://stackoverflow.com/a/27023332
tagged with: excel
type: Question
tagged with: spring-mvc
tagged with: java

http://stackoverflow.com/q/27088220
tagged with: antlr
has body: I'm new to ANTLR and getting familiar with ANTLR 4. How to consume only the commented section (/** ... */) from a java file(or any file) and skip the rest. I do have the following file "t.txt" :- t.txt /** @Key1("value1") @Key2("value2") */ This is the text that we need to skip. Only wanted to read the above commented section. //END_OF_FILE AND My grammar file as below:- MyGrammar.g4 grammar MyGrammar; file : (pair | LINE_COMMENT)* ; pair : ID VALUE ; ID : '@' ('A'..'Z') (~('('|'\r'|'\n') | '\\)')* ; VALUE : '(' (~('\r'|'\n'))*; COMMENT : '/**' .*? '*/'; WS : [\t\r\n]+ -&gt; skip; LINE_COMMENT : '#' ~('\r'|'\n')* ('\r'|'\n'|EOF) ; I know the COMMENT rule will read the commented section but here i'm stuck that how should skip the rest of the file content and force the antlr to read ID and value from COMMENT content only.
type: AnsweredQuestion
has title: Consume only commented (/** ..... */ )section of java file thorugh ANTLR 4 and skip the rest
answer count: 1
has comment: http://stackoverflow.com/comment/42686683
linked to: http://stackoverflow.com/q/14874689
favorite count: 0
tagged with: antlr4
type: Question
has answer: http://stackoverflow.com/a/27090699
accepted answer: http://stackoverflow.com/a/27090699
score: 0
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42627957
has text: Before this line `LatLng pos = googleMap.getCameraPosition().target;` in `onRelease()` method call `rel.removeAllViews();`
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27054822
type: QuestionComment

http://stackoverflow.com/a/27639082
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27114001
answers question: http://stackoverflow.com/q/27114001
type: Answer
has comment: http://stackoverflow.com/comment/43709892
has body: I've experienced this error before you probably have a break point set somewhere on that class In eclipse goto: Window -> Show View -> Other In the search box filter type: "Breakpoints" In this break points view look for your UserDao class and uncheck all breakpoints inside it. This will make those msgs during startup go away
upvote count: 20
score: 20

http://stackoverflow.com/a/27033871
type: Answer
answers question: http://stackoverflow.com/q/27033371
upvote count: 1
score: 1
has body: In spring MVC the model is where the controller puts anything that will be used by the view. As you want to use the date : in a link with its initial value the simpler way it to put in in the model, and directly use it in the form. Controller DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); @RequestMapping(...) public String show_the_view(Model model) { // get and format the date model.addAttribute("startdate", dateFormat.format(new Date()); ... return "view_name"; } View : Download As Excel EDIT With the code you gave in comment (and that you should have given directly in question ...), provided fiReportSearchInput.getStartDate() is a java.util.Date , it would give : @RequestMapping(value = "downloadFIReport.do", method = RequestMethod.GET) public void downloadFIBill(ModelMap model, @ModelAttribute("SpringWeb") FIReportSearchInput fiReportSearchInput, HttpServletResponse response) { System.out.println(fiReportSearchInput.getStartDate() + " " + fiReportSearchInput.getEndDate()); ModelMap.addAttribute("startdate", dateFormat.format(fiReportSearchInput.getStartDate()); ... }
downvote count: 0
has comment: http://stackoverflow.com/comment/42588883

http://stackoverflow.com/a/27069890
answers question: http://stackoverflow.com/q/27069130
has body: If you don't want to use scroll bar, use below code to show column names: pnlmain.add(table.getTableHeader(),BorderLayout.NORTH); pnlmain.add(table,BorderLayout.CENTER);
score: 0
type: Answer

http://stackoverflow.com/q/27016079
favorite count: 0
accepted answer: http://stackoverflow.com/a/27016160
has title: Java PrintWriter: Why do we handle FileNotFoundException if the file is automatically created if not found?
upvote count: 2
tagged with: file
tagged with: printwriter
has comment: http://stackoverflow.com/comment/42557580
downvote count: 1
has comment: http://stackoverflow.com/comment/42557770
type: AnsweredQuestion
has body: In the following SSCCE, I do not get a FileNotFoundException even if I delete this file from the given location/path i.e. "D:\\Eclipse Workspaces\\SAMPLES AND OTHER SNIPPETS\\SoapCallResults.txt" Rather the PrintWriter seems to create the file if it is not found. If the Printwriter creates the file if it is not found, why do we try to handle the FileNotFoundException (compiler complains if we don't surround it with try/catch or add a throws clause) when it is never going to be thrown? package com.general_tests; import java.io.FileNotFoundException; import java.io.PrintWriter; public class PrintWriterFileNotFoundExceptionTest { public static void main(String[] args) { String myName = "What ever my name is!"; PrintWriter printWriter = null; try { printWriter = new PrintWriter("D:\\Eclipse Workspaces\\SAMPLES AND OTHER SNIPPETS\\SoapCallResults.txt"); printWriter.println(myName); } catch (FileNotFoundException e) { System.out.println("FILE NOT FOUND EXCEPTION!"); e.printStackTrace(); } finally { if (printWriter != null) { printWriter.close(); } } } }
has answer: http://stackoverflow.com/a/27016144
has comment: http://stackoverflow.com/comment/42557584
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27016168
type: Question
has answer: http://stackoverflow.com/a/27016168
has answer: http://stackoverflow.com/a/27016160
answer count: 3
linked to: http://stackoverflow.com/q/6115896

http://stackoverflow.com/comment/42649042
type: Comment
comment on: http://stackoverflow.com/q/27065815
type: QuestionComment
score: 0
has text: @greenapps Hi and thanks for your time . About your first comment the http.sendPost(url, postParams); sends the post request and print the reponse from an inpustream (just to check if redirects to the new page after login). The String result = http.GetPageContent(courseURL); sends a get request to the new page and returns the response in String format using InpuStream like the other one . So both the lines are using inputstream . Correct me if am wrong . Again thanks for your time . About the second comment i was going to change this :) It was just a temporary solution.

http://stackoverflow.com/a/27049933
has body: You need to know where the image is been rendered and you need to compare the mouse point against this... One way would be to create a java.awt.Rectangle which includes the buffer... Rectangle bounds = new Rectangle(); bounds.x = x - 30; bounds.y = y - 30; bounds.width = image.getWidth(this) + 60; bounds.height = image.getHeight(this) + 60; Then check to see if the mouse point is within it's boundaries... if (bounds.contains(event.getPoint()) { // Did click image...
answers question: http://stackoverflow.com/q/27049654
score: 0
type: Answer

http://stackoverflow.com/q/27148248
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27153508
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27153508
has title: Spring MVC Application combine form using GET method and URL with path Varibles
has body: I am developing an MVC web app using spring framework. At some point I have a jsp that is listing study case objects as sown below <c:forEach items="${studycases}" var="studycase"> <a href='<spring:url value="/studycase/${studycase.study_case_number}.html"/>'> ${studycase.study_case_number} ${studycase.dateOFHospitalAdmission} ${studycase.dateOfWardAdmission} ${studycase.dateOfWardDischarge} </c:forEach> as you can see there is a spring:url that is directing to a jsp with details about the spesific study case, that is being handled by the below controller : @RequestMapping("/studycase/{studyCaseNumber}") public String detail(Model model, @PathVariable String studyCaseNumber) { model.addAttribute("studyCase", studyCaseService.findOne(studyCaseNumber)) ; model.addAttribute("measurements", measurementService.findAllOfThem(studyCaseNumber)) ; return "study-case-detail" ; } The problem is that as the study cases listed in the first jsp could be thousands I will need to make it possible for the user to enter the study_case_number of a study case in a input field and get the details of the study case having the study case number inputed . So what I am doing is this: <form action="<spring:url value="/studycase/study-case-detail2"/>" method="GET"> Study Case Number : That is being handled by an other controller and directs to an other jsp with more or less the same structure and data : @RequestMapping("/studycase/study-case-detail2") public String detail2(Model model, @RequestParam("studyCaseNumber") String std) { model.addAttribute("measurements", measurementService.findAllOfThem(std)) ; return "study-case-detail2" ; } My question is this : Is this a good way to go having different controllers and different views even if they are presenting more or less the same thing ? What are other alternatives ?? Is there any source that you can direct me to containing best practices catalogue or guide on how to handle similar situations ??
score: 0
answer count: 1
tagged with: url
tagged with: jsp
tagged with: getmethod

http://stackoverflow.com/a/27135911
accepted answer of: http://stackoverflow.com/q/27135559
score: 3
upvote count: 3
type: AcceptedAnswer
type: Answer
has body: Getting the same data when repeating the same requests usually is an issue with a cache (let it be in the browser, the server or in a proxy). Several ways of avoiding cache's effect: Disable them (generally not a good idea since it causes a performance impact). Use HTTP headers that signal to the browser that the content should not be cached / that previous cached data is stale. For AJAX, use the cache: false parameter. If all of the above fails, add a bogus parameter to the URL so the browser interprets it as a request of a different resource(v.g., url: "getChat" + (new Date()).getTime())
answers question: http://stackoverflow.com/q/27135559
downvote count: 0

http://stackoverflow.com/comment/42885142
has text: It cannot be the only aspect because it inherits from another one. So there has to be at least one more parent aspect. And I cannot elaborate on the Spring configuration issue because I have never used Spring. Can you try a very simple aspect with a pointcut like `execution(* *(..))`? It should print a lot of stuff. If it does not, it is definitely a configuration problem. I am already 90% sure anyway.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27047321

http://stackoverflow.com/q/27066881
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42647431
has comment: http://stackoverflow.com/comment/42647341
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42648639
has comment: http://stackoverflow.com/comment/42648834
has comment: http://stackoverflow.com/comment/42647479
tagged with: user-interface
has title: GUI Java Simple Calculator using ^
has body: I've made a simple calculator. What happens is I convert the user input to infixtopostfix and then evaluate it. Everything works fine except when the user does something like 3^2, the program doesn't convert it to post fix correctly. It should be converting it to 32^ but it's converting it to ^32. Could someone please explain to me what is wrong with my convert method that is causing this issue. Convert method: static String convert(String infix) { ArrayStack&lt;Character&gt; as = new ArrayStack&lt;Character&gt;(infix.length()); String post_expression = ""; int index = 0; while(index &lt; infix.length()) { char current = infix.charAt(index); if(current == ' ') { index++; continue; } else if(current == '(') { as.push(current); } else if(current == ')') { while(as.top() != '(') { post_expression += as.pop(); } as.pop(); } else if(current == '=') { index++; continue; } else if(current == '^') { post_expression += as.pop(); } else { while(!as.isEmpty() &amp;&amp; as.top() &gt; current) { post_expression += as.pop(); } as.push(current); } index++; } while(!as.isEmpty()) { post_expression += as.pop(); } return post_expression; } Complete Program: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.*; import java.io.*; class Calculator2 extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; JButton btn1 = new JButton("1"); JButton btn2 = new JButton("2"); JButton btn3 = new JButton("3"); JButton btn_add = new JButton("+"); JButton btn4 = new JButton("4"); JButton btn5 = new JButton("5"); JButton btn6 = new JButton("6"); JButton btn_sub = new JButton("-"); JButton btn7 = new JButton("7"); JButton btn8 = new JButton("8"); JButton btn9 = new JButton("9"); JButton btn_mult = new JButton("*"); JButton btn0 = new JButton("0"); JButton btn_dot = new JButton("."); JButton btn_del = new JButton("DEL"); JButton btn_div = new JButton("/"); JButton btn_lp…
has comment: http://stackoverflow.com/comment/42647345
answer count: 0

jce
tags question: http://stackoverflow.com/q/27025610
tags question: http://stackoverflow.com/q/27059587
tags question: http://stackoverflow.com/q/27001501
tags question: http://stackoverflow.com/q/27053407
type: Tag
tag name: jce

http://stackoverflow.com/q/27075903
favorite count: 0
type: UnansweredQuestion
has title: Incompatible Compliance level
tagged with: maven
tagged with: spring
has body: My spring project builds successfully when I build using intellij maven window to build it. But when I configure it to deploy in tomcat server(by setting run configurations in intellij) it gives an error as follows. Compliance level '1.4' is incompatible with target level '1.7'. A compliance level '1.7' or better is required My maven pom.xml defines compiler plugin as follows. org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.7 1.7 and my pc's JAVA_HOME is pointed to jdk 1.7 What is this error means. How to change compliance level 1.4 to 1.7 This application works well when I manually deploy it to tomcat server
answer count: 0
score: 1
tagged with: java
type: Question
tagged with: intellij-idea
downvote count: 0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42662850
upvote count: 1

http://stackoverflow.com/a/27087747
has comment: http://stackoverflow.com/comment/42700686
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27081472
has body: You are doing it all wrong. Spring Beans are singleton by default and your entities are not thread safe and neither they should ever be. Entities should be local variables bound to a Persistent Context. They are not meant to be accessed in a multi-threaded environment. Concurrency control is handled by the database and your application logic should mostly be concern about preventing lost updates through application-level repeatable reads. Your DAO and Services should be Spring singleton components. Your Entities and request bound DTOs should never be singleton. These objects are short-lived and scoped to the request that generated them. Check the Spring Data JPA docs for a solid data access layer design.
answers question: http://stackoverflow.com/q/27081472
has comment: http://stackoverflow.com/comment/42701579
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/a/27092135
answers question: http://stackoverflow.com/q/27092107
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27092107
type: Answer
upvote count: 3
score: 3
has body: The field that is private is hidden in B. But, your public methods are inherited and are accessible, and they can access the private field.

http://stackoverflow.com/a/27041944
answers question: http://stackoverflow.com/q/27041564
has comment: http://stackoverflow.com/comment/42606234
score: 0
type: Answer
has body: You should create multiple loggers that point to different files (now you have just one, that why all ends in one file). Then you can distinguish the loggers with some prefix to the package. Something like log4j.logger.file1.com.spring.something=.../define the logger log4j.logger.file2.com.spring.somethingelse=.../second logger and then when obtaining the logger use something like org.apache.log4j.Logger.getLogger("file1" + MyClass.class.getName());
has comment: http://stackoverflow.com/comment/42603596
has comment: http://stackoverflow.com/comment/42603308

http://stackoverflow.com/comment/42632870
score: 0
comment on: http://stackoverflow.com/q/27054822
has text: AS I Study the 3 link there is mDownCenterLat, mDownCenterLong ,mUpCenterLat, mUpCenterLong what is the different between mDownCenterLat, mDownCenterLong and mUpCenterLat, mUpCenterLong
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42626226
comment on: http://stackoverflow.com/q/27054623
score: 0
type: Comment
type: QuestionComment
has text: I am using following format now in javascript YYYY/MM/DD HH:mm and it prints 2014/11/21 08:00:00 , but java is not getting time java is printing 2014/11/21 00:00:00

http://stackoverflow.com/comment/42681808
comment on: http://stackoverflow.com/a/27086511
score: 0
type: AnswerComment
type: Comment
has text: my bad... I did provide a link to my servlet previously but there was no method/statemens in doGet() thats y i was confused. Thanks a ton

http://stackoverflow.com/q/27015975
upvote count: 1
has comment: http://stackoverflow.com/comment/42579724
has comment: http://stackoverflow.com/comment/42560996
type: Question
has title: DB2 ERRORCODE 4499 SQLSTATE=58009
has comment: http://stackoverflow.com/comment/42560035
has answer: http://stackoverflow.com/a/27032745
tagged with: db2
linked to: http://stackoverflow.com/q/53452440
has body: On our production application we recently become weird error from DB2: Caused by: com.ibm.websphere.ce.cm.StaleConnectionException: [jcc][t4][2055][11259][4.13.80] The database manager is not able to accept new requests, has terminated all requests in progress, or has terminated your particular request due to an error or a force interrupt. ERRORCODE=-4499, SQLSTATE=58009 This occurs when hibernate tries to select data from one big table(More than 6 milions records and 320 columns). I observed that when ResultSet lower that 10 elements, hibernate selects successfully. Our architecture: Spring 4.0.3 Hibernate 4.3.5 DB2 v10 z/Os Websphere 7.0.0.31(with JDBC V9.7FP5) This select works when I tried to executed this in Data Studio or when app is started localy from Tomcat(connected to production Data Source). I suppose that Data Source on Websphere is not corectly configured, but I tried some modifications and without results. I also tried to update JDBC Driver but that not helped. Actually I become then ERRORCODE = -1244. Ok, so now I'm looking for any help ;). I can obviously provide additional information when needed. Maybe someone fighted earlier with this problem? Thanks in advance!
answer count: 2
tagged with: websphere
downvote count: 0
has answer: http://stackoverflow.com/a/53467561
has comment: http://stackoverflow.com/comment/42563639
favorite count: 0
has comment: http://stackoverflow.com/comment/42587151
has comment: http://stackoverflow.com/comment/93811190
type: UnansweredQuestion
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/27126597
type: Question
has title: Eclipse runtime compiling?
has body: I am new in eclipse. Where is Eclipse running time after compiling ? I want to compare my two java programs. How long does it take to compile my program. I try to look at Window Console, but it only show end time after compiling. Anyone know ?
tagged with: java
tagged with: eclipse
score: 0
tagged with: runtime
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27126705

http://stackoverflow.com/comment/42695215
has text: can you give an example, please? pseudo code... i already tried to do a lot of things without sucess...
score: 0
comment on: http://stackoverflow.com/q/27094614
type: QuestionComment
type: Comment

image
tags question: http://stackoverflow.com/q/26999241
tags question: http://stackoverflow.com/q/27070714
tags question: http://stackoverflow.com/q/27118212
tags question: http://stackoverflow.com/q/27063294
tags question: http://stackoverflow.com/q/27091283
tags question: http://stackoverflow.com/q/27072983
tags question: http://stackoverflow.com/q/27125457
tags question: http://stackoverflow.com/q/27080281
tags question: http://stackoverflow.com/q/27092550
tags question: http://stackoverflow.com/q/26994748
tags question: http://stackoverflow.com/q/27034264
tags question: http://stackoverflow.com/q/27054672
tags question: http://stackoverflow.com/q/27055061
tags question: http://stackoverflow.com/q/27101931
tags question: http://stackoverflow.com/q/27029041
tags question: http://stackoverflow.com/q/27113877
tags question: http://stackoverflow.com/q/27057872
tags question: http://stackoverflow.com/q/27008838
tags question: http://stackoverflow.com/q/27096913
tags question: http://stackoverflow.com/q/27013118
tag name: image
tags question: http://stackoverflow.com/q/27086120
tags question: http://stackoverflow.com/q/26992102
tags question: http://stackoverflow.com/q/27143611
type: Tag
tags question: http://stackoverflow.com/q/27047825
tags question: http://stackoverflow.com/q/27113566

http://stackoverflow.com/q/27006400
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42541779
upvote count: 2
score: 0
downvote count: 2
has body: I have encountered an error after adding a third activity to my code. The code generating the error is the following: public void onClick(View v) { Intent callIncomeIntent = new Intent(v.getContext(), Add_Income.class); startActivityForResult(callIncomeIntent, 0); } }); Generates error : 11-18 13:59:29.137: D/libEGL(13211): loaded /vendor/lib/egl/libEGL_adreno.so 11-18 13:59:29.147: D/libEGL(13211): loaded /vendor/lib/egl/libGLESv1_CM_adreno.so 11-18 13:59:29.147: D/libEGL(13211): loaded /vendor/lib/egl/libGLESv2_adreno.so 11-18 13:59:29.157: I/Adreno-EGL(13211): &lt;qeglDrvAPI_eglInitialize:316&gt;: EGL 1.4 QUALCOMM build: (CL4169980) 11-18 13:59:29.157: I/Adreno-EGL(13211): OpenGL ES Shader Compiler Version: 17.01.10.SPL 11-18 13:59:29.157: I/Adreno-EGL(13211): Build Date: 11/04/13 Mon 11-18 13:59:29.157: I/Adreno-EGL(13211): Local Branch: 11-18 13:59:29.157: I/Adreno-EGL(13211): Remote Branch: 11-18 13:59:29.157: I/Adreno-EGL(13211): Local Patches: 11-18 13:59:29.157: I/Adreno-EGL(13211): Reconstruct Branch: 11-18 13:59:29.197: D/OpenGLRenderer(13211): Enabling debug mode 0 11-18 13:59:31.800: D/AndroidRuntime(13211): Shutting down VM 11-18 13:59:31.800: W/dalvikvm(13211): threadid=1: thread exiting with uncaught exception (group=0x415b58b0) 11-18 13:59:31.830: E/AndroidRuntime(13211): FATAL EXCEPTION: main 11-18 13:59:31.830: E/AndroidRuntime(13211): java.lang.RuntimeException: Unable to start activity ComponentInfo{tei.ptix.income_management/tei.ptix.income_management.Add_Income}: java.lang.NullPointerException 11-18 13:59:31.830: E/AndroidRuntime(13211): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2266) 11-18 13:59:31.830: E/AndroidRuntime(13211): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316) 11-18 13:59:31.830: E/AndroidRuntime(13211): at android.app.ActivityThread.access$600(ActivityThread.java:150) 11-18 13:59:31.830: E/AndroidRuntime(13211): at android.app.ActivityThread$H.handleMessage(ActivityThr…
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27006521
accepted answer: http://stackoverflow.com/a/27006521
has title: How to solve a Null Pointer Exception caused by an Intent
tagged with: android
tagged with: android-intent

http://stackoverflow.com/q/27065576
has comment: http://stackoverflow.com/comment/42644691
favorite count: 0
has comment: http://stackoverflow.com/comment/42645911
has comment: http://stackoverflow.com/comment/42644801
possible better answer: http://stackoverflow.com/a/27065742
has title: The efficient way to get a list of objects that are not in the database in Java
has answer: http://stackoverflow.com/a/27065742
upvote count: 1
type: AnsweredQuestion
score: 1
has body: Suppose I have a list of objects (ArrayList objects) and a db table for the objects, I want to find the objects which has not been stored in the my database. The objects are identified by their "id". I can think of two solutions but I do not know which one is more efficient. The first solution I think of is to construct one db query to get all objects existed in the db, and loop through the existed objects to determine the ones that is not in the db ArrayList&lt;Integer&gt; ids = new ArrayList&lt;Integer&gt;(); for(MyObject o in objects){ ids.add(o.getId()); } //I use sugar orm on Android, raw query can be seen as // "select * from my_object where id in [ id1,id2,id3 ..... ]" List&lt;MyObjectRow&gt; unwanted_objects = MyObject.find("id in (?,?,?,?,.....)",ids); //remove the query results from the original arraylist for(MyObjectRow o in unwanted_objects){ for(MyObject o1 in objects){ if(o1.getId() == o.getId()) objects.remove(o1); } } The second solution is to query existence of every object in db, and add non-existed object to result array ArrayList&lt;MyObject&gt; result_objects = new ArrayList&lt;MyObject&gt;(); boolean exist = false for(MyObject o in objects){ exist = MyObject.find("EXIST( select 1 from my_object where id = ?)", o.getId()); if(!exist){ result_objects.add(o); } } The first solution only require one query, but when loop through all founded objects, the complexity become O(n*n) The second solution constructs n db querys, but it only has a complexity of O(n) Which one may be better in terms of performance?
tagged with: java
has answer: http://stackoverflow.com/a/27066048
has comment: http://stackoverflow.com/comment/42645455
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/27066048
tagged with: sql

http://stackoverflow.com/comment/42691393
type: AnswerComment
type: Comment
score: 1
has text: There is no `Canvas.paint()` method in JavaFX.
comment on: http://stackoverflow.com/a/27083303

http://stackoverflow.com/a/27020514
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42566406
answers question: http://stackoverflow.com/q/27020453
upvote count: 1
type: Answer
has body: You have to catch NumberFormatException to handle wrong input Example: try { result = Double.valueOf(valueString); } catch (NumberFormatException e) { //show alert and clean field or something else }

http://stackoverflow.com/comment/42770099
score: 0
has text: This is likely a bug and might have been fixed, as @jewelsea pointed out. Generally, the problem with weak listeners is that they result in memory leaks if the observed object never changes. I created a [simple demo](https://gist.github.com/TomasMikula/62c6e33863f2092f27c9) of a weak listener-related memory leak in JavaFX bindings.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27135749

http://stackoverflow.com/q/27010700
answer count: 3
possible better answer: http://stackoverflow.com/a/27010930
has answer: http://stackoverflow.com/a/27010930
favorite count: 0
downvote count: 0
accepted answer: http://stackoverflow.com/a/27010726
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27010726
has answer: http://stackoverflow.com/a/27011133
has comment: http://stackoverflow.com/comment/42548454
has body: I'm trying to write a code to format a series of strings (I posted this a little bit earlier but deleted it a few minutes later because I thought I didn't put enough effort in). I'm re-posting now because I keep getting an "index out of range" error, but am unsure how to fix it. I've tried wrapping everything I could think of in "if" statements that SHOULD prevent out of range errors, but they aren't helping! Do you see what's wrong? (FYI: ExpressionTools.isOp(char) is a method that returns true or false depending on whether the character in question is an operator or not aka: +, -, *, / ) public static List&lt;String&gt; postfix = new ArrayList&lt;String&gt;(); public static String result; // the result of corrected string // corrects formating in postfix string if any errors, enters into postfix // array public static void spaces(String a, int x) { StringBuilder b = new StringBuilder(a); for (int i = x; i &lt; b.length(); i++) { if (b.charAt(i) == ' ') { while (b.charAt(i + 1) == ' ') { b.deleteCharAt(i + 1); } result = b.toString(); } if (ExpressionTools.isOp(b.charAt(i))) { if (i+1 == 0) break; else{ while (ExpressionTools.isOp(b.charAt(i + 1))){ b.insert(i+1, ' '); } } } } System.out.println(result); String r = b.toString(); postfix.add(r); }
has comment: http://stackoverflow.com/comment/42548495
upvote count: 1
has comment: http://stackoverflow.com/comment/42548455
has title: Can't get around index out of range error

http://stackoverflow.com/q/26997290
has answer: http://stackoverflow.com/a/26997905
tagged with: http://stackoverflow.com/tag/pdf
type: UnansweredQuestion
has body: As the title says, I have a PDF document which is stored locally and using Java I would like to open it on an arbitrary page. My question is much the same as this question, however the proposed solution seems rather hacky so I would prefer a more conventional answer if possible. I understand that the code shown below will not work because #page=5 should be appended to the URL in the browser and not the file path, however I'm really not sure what to try next. Any help would be much appreciated! import java.io.File; import java.io.IOException; import java.net.URL; public class OpenPdfTest { public OpenPdfTest(){ try { File myFile = new File("test.pdf"); URL url = myFile.toURI().toURL(); Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url + "#page=5"); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args){ new OpenPdfTest(); } }
tagged with: process
type: Question
tagged with: java
has title: Open a local PDF document at an arbitrary page using java
score: 0
tagged with: local
tagged with: runtime
answer count: 1
linked to: http://stackoverflow.com/q/730554

http://stackoverflow.com/q/27020003
type: Question
tagged with: network-programming
tagged with: java
has comment: http://stackoverflow.com/comment/42566549
has comment: http://stackoverflow.com/comment/42564943
has body: Is there a single property concerning a local machine that is guaranteed to be unique on both Windows and OS X regardless of what network they are attached to and is accessible from Java? For instance, the MAC address returned will change when the active NIC changes (user switches between wired and wireless), hence a MAC address does not meet the criterion. A hostname is the closest to meeting these criterion: InetAddress localhost = InetAddress.getLocalHost(); hostname = localhost.getHostName(); Though in some virtual machine environments where the VM guest is cycled nightly, the hostname can also change (we have such users).
score: 0
has comment: http://stackoverflow.com/comment/42565048
answer count: 0
type: UnansweredQuestion
has title: What localhost property is guaranteed to be unique across OSes and regardless of network?

http://stackoverflow.com/comment/42541888
comment on: http://stackoverflow.com/q/27006267
has text: Dalton , mmmm i gonna try that.. i will convert the string to a charArray and then use (.*) in every char and see what happens.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27103938
has answer: http://stackoverflow.com/a/27104196
score: 0
answer count: 1
tagged with: frame
has comment: http://stackoverflow.com/comment/42711612
has title: I am getting java.lang.ClassCastException: android.graphics.drawable.AnimationDrawable
type: UnansweredQuestion
tagged with: android
tagged with: animation
has comment: http://stackoverflow.com/comment/42711496
tagged with: java
type: Question
has body: I am getting java.lang.ClassCastException: android.graphics.drawable.AnimationDrawable protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_frame_animation); // Directory creation and unzip file DirCreation dc = new DirCreation(); dc.creation(); showedImage = (ImageView) findViewById(R.id.imageAnimation); showedImage.setBackgroundResource(R.drawable.ic_launcher); frameAnimation = (AnimationDrawable) showedImage.getBackground(); } and also I am using external source sd card as image resource ... I have used this file filename filter to fetch file from sd card and stored in string array FilenameFilter filefilter = new FilenameFilter() { public boolean accept(File dir, String name) { return (name.endsWith(".jpeg") || name.endsWith(".jpg") || name.endsWith(".png") ); } }; String[] sNamelist = pictureDirectory.list(filefilter); if (sNamelist.length == 0) { Log.d("Activity", "No pictures in directory."); return; } for (String filename : sNamelist) { Log.d("Activity", pictureDirectory + "/" +filename); frameAnimation.addFrame( Drawable.createFromPath(pictureDirectory.getPath() + "/" + filename), 210 ); } return; } picture directory is my path for sd card pictureDirectory = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/animation/"); so, now what I have to do to set this images as my resource for frame animation...
has comment: http://stackoverflow.com/comment/42712198
has comment: http://stackoverflow.com/comment/42713932

http://stackoverflow.com/comment/42659631
comment on: http://stackoverflow.com/a/27073870
type: Comment
score: 1
has text: I don't see the value added by the generics on `Item` or `Lecturer`.
type: AnswerComment

http://stackoverflow.com/comment/42586079
has text: Thank you for your help, and I found the issue as you can see in my answer, since I am using other threads to modify the socket list, and haven't synchronized them.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27029906
type: AnswerComment

http://stackoverflow.com/a/27054339
score: 1
upvote count: 1
downvote count: 0
has body: (take an..) integer and turn it into a string that can be used inside an IF ElSE How about instead don't convert it? The conditions of an if statement can work with integers, and do it more easily than strings! E.G. int x = random.nextInt(100); if (x &lt; 50) { //..
type: Answer
answers question: http://stackoverflow.com/q/27052326

http://stackoverflow.com/comment/42631269
type: QuestionComment
comment on: http://stackoverflow.com/q/27057819
score: 0
has text: `My Authorization header :` getBase64 ?
type: Comment

http://stackoverflow.com/a/27021797
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/27021537
type: AcceptedAnswer
downvote count: 0
has body: Open the Preferences and go to 'General > Appearance > Label Decorations'. Select the 'Java Type Indicator' decoration to get these.
type: Answer
answers question: http://stackoverflow.com/q/27021537

http://stackoverflow.com/comment/42841964
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27125717
has text: Could you check the runtime type of ams, and confirm that it is not an `org.eclipse.persistence.indirection.IndirectSet` and that it is a HashSet?

http://stackoverflow.com/q/27089776
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42712004
tagged with: linked-list
has comment: http://stackoverflow.com/comment/42687766
has comment: http://stackoverflow.com/comment/42686738
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42711695
has answer: http://stackoverflow.com/a/27089817
has comment: http://stackoverflow.com/comment/42686660
has body: My bubble sort does not work if i have more than 3 objects in the stack. how come? if i push a, b, c. The bubble sort will sort them: c,b,a which is correct. But if i have a,b,c,d. The bubble sort will sort them to:a,d,c,b. And if i have a,b,c,d,e. The bubble sort will sort them to: a,b,e,d,c,b. My node class: public class Stack implements StackAPI{ public Stack(){ } private Node first = null; private int size = 0; private class Node implements Comparable&lt;Node&gt;{ String item; Node next; public String getItem(){ return this.item; } public int compareTo(Node other){ if(getItem().compareTo(other.getItem()) &gt; 0){ return 1; } else if(getItem().compareTo(other.getItem()) &lt; 0){ return -1; } else return 0; } } Bubble sort function: public void bubbleSort(){ int N = size; boolean swapped = true; while(swapped == true){ Node currentNode = first; swapped = false; for(int i=0; i &lt; N-1; i++){ if(less(currentNode.next, currentNode)){ exch(currentNode); swapped = true; } currentNode = first.next; } } } The less and exch functions: private static boolean less(Comparable v, Comparable w){ return v.compareTo(w) &lt; 0; } private static void exch(Node a) { String swap = a.item; a.item = a.next.item; a.next.item = swap; }
tagged with: bubble-sort
score: -1
upvote count: 0
has title: my bubble sort wont swap when list have more than 3 objects. JAVA
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42686695

http://stackoverflow.com/comment/42548634
has text: @MadProgrammer I didn't bother with a proper implementation since the program only displays a single result. It does not take any input, neither does it need to update its output, and neither does it take a long time to compute the output.
comment on: http://stackoverflow.com/q/27010518
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42842555
has text: It is a strange behavior indeed. Could you please provide a [SSCCE](http://http://www.sscce.org/) reporoducing the problem? @Necros
comment on: http://stackoverflow.com/a/27127830
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42816150
type: QuestionComment
has text: Yeah man... @eduyayo I'm think about a 3sec expiration of this "cache". Thanks for the advice.
score: 0
comment on: http://stackoverflow.com/q/27003759
type: Comment

http://stackoverflow.com/comment/57303102
comment on: http://stackoverflow.com/a/27025023
type: Comment
score: 1
has text: I'm going to accept this as the answer for anyone who has the ability to do so. It feels like Spring has this in mind moving into the future. http://docs.spring.io/spring-xd/docs/current-SNAPSHOT/reference/html/#batch
type: AnswerComment

http://stackoverflow.com/comment/42648289
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27027568
has text: So I don't understand what is the problem. Googling "Java configuration file" has 4.4 MILLION hits. Did you try at least one of those?
score: 0

http://stackoverflow.com/comment/42747562
type: QuestionComment
comment on: http://stackoverflow.com/q/27123363
has text: 'Scanner sc= new Scanner (System.in); sc = new Scanner (new File("c:/Users/ASUS/Desktop/Numbers.txt")); while (sc.hasNext()){ int i=sc.nextInt(); System.out.print(i+" "); } sc.close(); } }'
score: 0
type: Comment

http://stackoverflow.com/comment/42674590
score: 0
has text: `if (isLong() == true)` - No. Just `if (isLong())`. And while we're at it, the indentation is wrong at `System.out.println(bookList);`.
type: Comment
comment on: http://stackoverflow.com/q/27082711
type: QuestionComment

http://stackoverflow.com/comment/42653014
type: AnswerComment
has text: Is that your own print preview code? Have you tried printing it to the printer using the example code?
type: Comment
comment on: http://stackoverflow.com/a/27033735
score: 0

http://stackoverflow.com/a/27045861
upvote count: 1
answers question: http://stackoverflow.com/q/27045578
downvote count: 0
score: 1
type: Answer
has body: One of the common ways of solving this is to keep a reference variable referencing the last Substance object that you have created. You define the variable outside the loop. Then you start parsing the lines. If the line begins with a single S, you check whether the previous value of substance is not null. If so, you add it to your list of substances. Then you create a new Substance and assign it to substance. In this way, you start a new Substance every time you hit an S line, and you put it in the list as soon as you see a new S line. In the same loop, if the line begins with SS, you parse the synonym, and use substance.addSynonym. You know at this stage that you have already created the Substance object and it is waiting in substance. It is recommended, if you are not sure your file will always start with an S, to check for null. Finally, after the loop is finished, you have a Substance object in substance which has not been committed to the list because there was no new S line. You should simply add it to the list. ArrayList&lt;Substance&gt; list = new ArrayList&lt;&gt;(); String line; Substance substance = null ; while((line = br.readLine()) != null) { if (line.startsWith("S\t")) { if ( substance != null ) { list.add( substance ); } substance = new Substance(); String[] columns = line.split("\t"); // Parse columns and store them in substance Object else if (line.startsWith("SS\t")) { Synonym synonym = new Synonym(); // Parse columns and store them in synonym Object // Add synonym to List of Synonyms of Substance if ( substance != null ) { substance.addSynonym(synonym); } } } list.add( substance );

http://stackoverflow.com/comment/42584350
type: AnswerComment
has text: Yes, basically. However the compiler decides the encoding before main is run, so the best way would be to specify encoding before running the program either changing it in the IDE(if possible) or by passing it upon execution of the program through the -encoding parameter. Also, changing the default encoding for your OS could be a possibility if neither of the above works. (Updated answer with way to get current encoding.)
comment on: http://stackoverflow.com/a/27030857
type: Comment
score: 0

http://stackoverflow.com/comment/42557817
type: QuestionComment
has text: @BenediktKöppel you should also read the linked blog entry http://blog.egilh.com/2006/06/2811aspx.html
comment on: http://stackoverflow.com/q/27015226
type: Comment
score: 1

http://stackoverflow.com/q/27116495
answer count: 2
linked to: http://stackoverflow.com/q/14763079
downvote count: 0
favorite count: 0
tagged with: python-3.x
has title: Java Command Fails in NLTK Stanford POS Tagger
type: UnansweredQuestion
tagged with: nlp
has answer: http://stackoverflow.com/a/27117107
has comment: http://stackoverflow.com/comment/42736600
upvote count: 3
tagged with: java
has body: I request your kind help and assistance in solving the error of "Java Command Fails" which keeps throwing whenever I try to tag an Arabic corpus with size of 2 megabytes. I have searched the web and stanford POS tagger mailing list. However, I did not find the solution. I read some posts on problems similar to this, and it was suggested that the memory is used out. I am not sure of that. Still I have 19GB free memory. I tried every possible solution offered, but the same error keeps showing. I have average command on Python and good command on Linux. I am using LinuxMint17 KDE 64-bit, Python3.4, NLTK alpha and Stanford POS tagger model for Arabic . This is my code: import nltk from nltk.tag.stanford import POSTagger arabic_postagger = POSTagger("/home/mohammed/postagger/models/arabic.tagger", "/home/mohammed/postagger/stanford-postagger.jar", encoding='utf-8') print("Executing tag_corpus.py...\n") # Import corpus file print("Importing data...\n") file = open("test.txt", 'r', encoding='utf-8').read() text = file.strip() print("Tagging the corpus. Please wait...\n") tagged_corpus = arabic_postagger.tag(nltk.word_tokenize(text)) IF THE CORPUS SIZE IS LESS THAN 1MB ( = 100,000 words), THERE WILL BE NO ERROR. BUT WHEN I TRY TO TAG 2MB CORPUS, THEN THE FOLLOWING ERROR MESSAGE IS SHOWN: Traceback (most recent call last): File "/home/mohammed/experiments/current/tag_corpus2.py", line 17, in &lt;module&gt; tagged_lst = arabic_postagger.tag(nltk.word_tokenize(text)) File "/usr/local/lib/python3.4/dist-packages/nltk-3.0a3-py3.4.egg/nltk/tag/stanford.py", line 59, in tag return self.batch_tag([tokens])[0] File "/usr/local/lib/python3.4/dist-packages/nltk-3.0a3-py3.4.egg/nltk/tag/stanford.py", line 81, in batch_tag stdout=PIPE, stderr=PIPE) File "/usr/local/lib/python3.4/dist-packages/nltk-3.0a3-py3.4.egg/nltk/internals.py", line 171, in java raise OSError('Java command failed!') OSError: Java command failed! I intend to tag 300 Million words to be used in my Ph.D. research proj…
type: Question
score: 3
tagged with: nltk
has answer: http://stackoverflow.com/a/55130551
tagged with: pos-tagger
has comment: http://stackoverflow.com/comment/42736744

http://stackoverflow.com/comment/42667305
has text: Yes, @joão you're right `decimal(8,3)` would only allow a max of 8 digits not matter whether the number has decimal places or not. Having said that, I guess the regex should be something like this: `^\-?(\d{0,8}|\d{0,5}\.\d{0,3})$`
type: AnswerComment
comment on: http://stackoverflow.com/a/27077762
score: 0
type: Comment

http://stackoverflow.com/q/27109769
has comment: http://stackoverflow.com/comment/42724424
tagged with: spring
has answer: http://stackoverflow.com/a/27121301
tagged with: java
has comment: http://stackoverflow.com/comment/42725229
type: Question
has answer: http://stackoverflow.com/a/27111244
answer count: 2
tagged with: spring-security
score: 0
has title: Expression in annotation using fields of class in Spring Security
tagged with: spring-el
upvote count: 1
has body: I use method level security. In class I annotated some methods, expressions use fields of this class. But I see SpEL exceptions, that I can't reference them. Here is part of code of this class. In expressions I want to use field repPrefix, but I receive exceptions that it's an unknown variable. @Component("c2rTableManager") @Scope("prototype") public class C2RTableManager implements TableManager { private final TableManager tableManager; private final String repPrefix; @Autowired private SecurityInfoService securityInfoService; public C2RTableManager(TableManager tableManager, String repository) { this.tableManager = tableManager; this.repPrefix = repository + "__"; } ...some methods @Override @PreAuthorize("hasRole('DBA') || hasPermission(repPrefix + #table, 'TABLE', 'DELETE_TABLE')") public void dropTable(String table) throws InterruptedException, IOException { tableManager.dropTable(table); } ...other methods } If I write another way, expressions AREN'T EVALUATED at all. Can't understand why. @Component("c2rTableManager") @Scope("prototype") public class C2RTableManager implements TableManager { private final TableManager tableManager; private final String repPrefix; @Autowired private SecurityInfoService securityInfoService; public C2RTableManager(TableManager tableManager, String repository) { this.tableManager = tableManager; this.repPrefix = repository + "__"; } ...some methods @Override public void dropTable(String table) throws InterruptedException, IOException { dropTable(table, repPrefix); } @PreAuthorize("hasRole('DBA') || hasPermission(#repPrefix + #table, 'TABLE', 'DELETE_TABLE')") public void dropTable(String table, String repPrefix) throws InterruptedException, IOException { tableManager.dropTable(table); } ...other methods } How can I write expressions for methods of class using values of fields of this class?
has comment: http://stackoverflow.com/comment/42728932
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42723181
type: UnansweredQuestion

http://stackoverflow.com/comment/42626507
type: AnswerComment
comment on: http://stackoverflow.com/a/27054793
type: Comment
has text: try using the default <s:date> without any format. Check out this link http://www.mkyong.com/struts2/struts-2-date-tag-example/
score: 0

http://stackoverflow.com/q/27100215
tagged with: java
has comment: http://stackoverflow.com/comment/42704829
answer count: 3
has comment: http://stackoverflow.com/comment/42705032
has title: How to populate text string in listview in defined intervals in android?
has answer: http://stackoverflow.com/a/27100625
has answer: http://stackoverflow.com/a/27100395
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42704813
has comment: http://stackoverflow.com/comment/42704923
has answer: http://stackoverflow.com/a/27100776
has body: I got stuck in one problem, I want to populate my string values from List in Listview after every 3 seconds. I wrote the below code but it gives me all my text at single shot after 9 seconds which means after completing the task. public class MainActivity extends ActionBarActivity { ArrayList&lt;String&gt; list; ListView listview; ArrayAdapter&lt;String&gt; listAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listview = (ListView) findViewById(R.id.listView); list = new ArrayList&lt;String&gt;(); list.add("1"); listAdapter(); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } list.add("2"); listAdapter.setNotifyOnChange(true); listAdapter(); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } list.add("3"); listAdapter.setNotifyOnChange(true); listAdapter(); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void listAdapter() { listview.invalidateViews(); listAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.listadapter, list); // put adapter in list view listview.setAdapter(listAdapter); listAdapter.setNotifyOnChange(true); }
has comment: http://stackoverflow.com/comment/42704976
type: Question
tagged with: android
score: 0

http://stackoverflow.com/comment/42793265
has text: I know it. But I can get the shape from physics and make a polygon with shaperenderer but how can I fill it with a texture?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27149170

http://stackoverflow.com/comment/46291063
type: Comment
comment on: http://stackoverflow.com/a/28993419
has text: Thank you Vishnu for the help. I actually create application `jar` with `maven` using normal user. Then switch to `hduser` and run the jar in target folder using command `hadoop jar target/doctorhere-engine-writer-1.0-jar-with-dependencies.jar /usr/hduser/shakespeare`. You can see the result of `hadoop classpath` above in question.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42628207
comment on: http://stackoverflow.com/q/27056064
score: 0
has text: Only custom solution. Java-EE-7/JAX-RS-2.0 will not help you with that
type: Comment
type: QuestionComment

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/27122300
tags question: http://stackoverflow.com/q/27140050

http://stackoverflow.com/q/27009038
type: Question
linked to: http://stackoverflow.com/q/1255372
has body: I have an xml as shown below. <?xml version="1.0" encoding="utf-8"?> <description /> <language /> <description /> <keywords /> <resver id="1690047800" major="50" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> <resver id="1690167421" major="68" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> <resver id="1690176842" major="71" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> <description /> <keywords /> <resver id="1690145841" major="34" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> <resver id="1690161885" major="64" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> <resver id="1690165275" major="66" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> <resver id="1690169108" major="69" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> <resver id="1690175442" major="87" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> I want to delete all <resver> elements except for the one with highest "major" attribute value. For example above major="71" is highest in the first resver group and major="87" is the highest in second resver group. So overall output looks like this: <?xml version="1.0" encoding="utf-8"?> <description /> <language /> <description /> <keywords /> <resver id="1690176842" major="71" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> <description /> <keywords /> <resver id="1690175442" major="87" minor="0" revision="0" effective-from="20010101000000" effective-to="20991231235959" workflow-step="1000" /> I thought of using JAXB to …
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27009372
has title: Delete line from xml based on condition
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27009759
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
tagged with: file
tagged with: jaxb

http://stackoverflow.com/q/27120208
type: Question
has answer: http://stackoverflow.com/a/27120401
has body: This project is supposed to have 3 separate main classes. It inputs a file of a list of countries that is sorted alphabetically, it outputs an unsorted file with lines rearranged randomly. My first main class looks like this: package assignment3; import java.io.PrintWriter; import java.io.File; import java.util.Scanner; public class Assignment3 {` public static void main(String[] args) throws Exception{ Scanner stdIn = new Scanner(new File("C:/Users/Vicki/Desktop/CountrySortedFormat.txt")); PrintWriter out = new PrintWriter("C:/Users/Vicki/Desktop/CountryUnsortedFormat.txt"); String[] line = new String[238]; while (stdIn.hasNextLine()){ for (int k = 0; k &lt;= line.length-1; k++){ line[k]=stdIn.nextLine(); out.println(line[k]); out.close(); } } } } My code doesn't have any visible problems but I tried printing out the array and got an array of "null". Am I doing something wrong? EDIT: changed PrintWriter file name to CountryUnsortedFormat
tagged with: arrays
tagged with: sorting
accepted answer: http://stackoverflow.com/a/27120401
has answer: http://stackoverflow.com/a/27120591
tagged with: printwriter
has answer: http://stackoverflow.com/a/27120421
has title: Inputting a sorted file, unsorting it, then outputting the unsorted file (Java)
answer count: 4
has answer: http://stackoverflow.com/a/27120247
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42742043
tagged with: file
possible better answer: http://stackoverflow.com/a/27120247
has comment: http://stackoverflow.com/comment/42742016

http://stackoverflow.com/a/53549177
downvote count: 0
has body: You can also use project lombok with Gson overriding toString function. It automatically includes builders, getters and setters in order to ease the data assignment like this: User user = User.builder().username("test").password("test").build(); Find below the example class: import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import com.google.gson.Gson; @Data @Builder(toBuilder = true) @AllArgsConstructor @NoArgsConstructor public class User { /* User name. */ private String username; /* Password. */ private String password; @Override public String toString() { return new Gson().toJson(this, User.class); } public static User fromJSON(String json) { return new Gson().fromJson(json, User.class); } }
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27036857

http://stackoverflow.com/q/27121680
has body: I am creating an android application and have run into a problem. There is 12 buttons. A button is to change color and then the user has one second to click the button, otherwise the button changes back to the original color and a different button changes color. I would like to repeat this until the user misses a certain amount of button clicks. I have discovered how to do the changing in colors, however I am not sure how to do an infinite loop in android or how to wait for one second. Thanks for your help. This is my first attempt at an android application.
possible better answer: http://stackoverflow.com/a/27122331
linked to: http://stackoverflow.com/q/1877417
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42744442
downvote count: 1
linked to: http://stackoverflow.com/q/22606977
type: Question
answer count: 2
has title: Waiting One Second for a button click, if button not clicked call function
has answer: http://stackoverflow.com/a/27122109
has comment: http://stackoverflow.com/comment/42744360
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27122331
favorite count: 0
accepted answer: http://stackoverflow.com/a/27122109
upvote count: 1

http://stackoverflow.com/a/27113041
has body: An arguably more elegant solution does not need get and the two-parameter add: public class abc { public static void main(String[] args) { ArrayList&lt;ArrayList&lt;Integer&gt;&gt; a = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); for(int i=0;i&lt;10;i++) { ArrayList&lt;Integer&gt; inner = new ArrayList&lt;Integer&gt;(); a.add(inner); for(int j=0;j&lt;10;j++) { inner.add(j); } } } }
answers question: http://stackoverflow.com/q/27112889
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/42673250
type: QuestionComment
type: Comment
has text: There's no output in the `if` block. Try adding a `println` statement or debug into it
comment on: http://stackoverflow.com/q/27081935
score: 0

http://stackoverflow.com/q/27026053
tagged with: keylistener
has body: I'm creating a little application that will add a tray icon if the caps lock button is pressed. I'm getting a error that I can't seem to fix. Here is my code private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { public void keyPressed(KeyEvent ke){ //removed for StackOverflow } } I'm getting the "Illegal start of expression" Error on the keyPressed Listener Now this is probably a super simple fix, I just don't know it.
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42575425
has comment: http://stackoverflow.com/comment/42576193
possible better answer: http://stackoverflow.com/a/27026516
accepted answer: http://stackoverflow.com/a/27027119
has title: KeyListener after Button Is Pressed
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27027119
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/27026516
has comment: http://stackoverflow.com/comment/42575495
has comment: http://stackoverflow.com/comment/42575819

http://stackoverflow.com/q/27052898
answer count: 1
has body: i need your help. i dont know why my code fails when the dimention is 10 and the dirty slots is 11 please help. package Strategies; import java.util.LinkedList; import java.util.Queue; import Cleaning.State; public class BFS { private int dirty; private Queue&lt;State&gt; fifo = new LinkedList&lt;State&gt;(); private String path = ""; private int num_of_expanded_states; private boolean failure = false; public BFS(State state, int dirty) { // TODO Auto-generated constructor stub this.dirty = dirty; this.num_of_expanded_states = 0; this.fifo.add(state); } public void startCleaning() { // TODO Auto-generated method stub successorFunction(fifo.element()); if(failure){ System.out.println("There is no solution under the constraint of maximum number of dirty slots"); return; } } public void successorFunction(State state){ int x,y,i; State temp = new State(state); // state.printRoom(); if(goalTest(state)){ printPath(state); return; } x = state.x; y = state.y; // checking valid moves if(x+3 &lt;= state.room.length-1){ if(y+1 &lt;= state.room.length-1){ if(state.room[x+1][y]==1 &amp;&amp; state.room[x+2][y]==1 &amp;&amp; state.room[x+3][y]==1 &amp;&amp; state.room[x+3][y+1]==1){ for(i=1;i&lt;=3;i++){ temp.room[x+i][y]=0; } temp.room[x+i-1][y+1]=0; temp.x = x+i-1; temp.y = y+1; temp.father = new State(state); temp.action = "3"; fifo.add(temp); } } temp = new State(state); if(y-1 &gt;= 0){ if(state.room[x+1][y]==1 &amp;&amp; state.room[x+2][y]==1 &amp;&amp; state.room[x+3][y]==1 &amp;&amp; state.room[x+3][y-1]==1){ for(i=1;i&lt;=3;i++){ temp.room[x+i][y]=0; } temp.room[x+i-1][y-1]=0; temp.x = x+i-1; temp.y = y-1; temp.father = new State(state); temp.action = "1"; fifo.add(temp); } } } temp = new State(state); if(x-3 &gt;= 0){ if(y+1 &lt;= state.room.length-1){ if(state.room[x-1][y]==1 &amp;&amp; state.room[x-2][y]==1 &amp;&amp; state.room[x-3][y]==1 &amp;&amp; state.room[x-3][y+1]==1){ for(i=1;i&lt;=3;i++){ temp.room[x-i][y]=0; } temp.room[x-i+1][y+1]=0; temp.x = x-i+1; temp.y …
has comment: http://stackoverflow.com/comment/42623000
tagged with: artificial-intelligence
has answer: http://stackoverflow.com/a/27053171
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42623269
has title: Exception in thread "main" java.lang.StackOverflowError issue
has comment: http://stackoverflow.com/comment/42622962
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42622841
has comment: http://stackoverflow.com/comment/42622956
accepted answer: http://stackoverflow.com/a/27053171
has comment: http://stackoverflow.com/comment/42622939
has comment: http://stackoverflow.com/comment/42623202
has comment: http://stackoverflow.com/comment/42623255
score: 0
has comment: http://stackoverflow.com/comment/42622911

http://stackoverflow.com/comment/42699127
has text: I added my entire class because there is little to see. I'm not sure if I'm supposed to explicitly state that the JFileChooser should be visible or what.
type: QuestionComment
comment on: http://stackoverflow.com/q/27096819
type: Comment
score: 0

http://stackoverflow.com/comment/42638817
score: 0
type: AnswerComment
has text: Not really enought detail to be considered a good answer. As the comments that follow show.
type: Comment
comment on: http://stackoverflow.com/a/27060790

http://stackoverflow.com/comment/42614502
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27047776
has text: Yes, I wondered about ASLR. I can't find anything anywhere that says it's not in Java 7 but is in Java 8, though.

http://stackoverflow.com/a/30484460
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27124152
downvote count: 0
type: AcceptedAnswer
has body: This is how we solved this issue: MessageDesc: @NotNull @Enumerated(EnumType.ORDINAL) @Column(name = "LANGUAGEID", insertable=false, nullable = false) private LanguageEnum language; @NotNull @ManyToOne @JoinColumn(name="MESSAGEID", insertable=false, nullable = false) private Message message; @PrePersist private void prePersist(){ if (getId() == null){ MessageDescPK id = new MessageDescPK(); //the way this enum is persisted is EnumType.ORDINAL id.setLanguage(getLanguage().ordinal()); id.setMessage(getMessage().getId()); this.setId(id); } } MessageDescPk: @Embeddable public class MessageDescPK implements Serializable { //default serial version id, required for serializable classes. private static final long serialVersionUID = 1L; @Column(name="messageid", nullable = false, insertable = false, updatable=false) private long message; @Column(name="languageid", nullable = false, insertable = false, updatable=false) private int language; Hope this helps :)
answers question: http://stackoverflow.com/q/27124152
type: Answer
score: 3

http://stackoverflow.com/q/27134487
has body: I'm having an exception all the time when trying to add a new entity : All fields are filled in, only ID is missing. I'm adding an image :
tagged with: jsf
tagged with: oracle-adf
type: AnsweredQuestion
tagged with: java
type: Question
has title: How to use ADF CreateInsert when having a sequence generated ID trigger in my database?
score: 0
accepted answer: http://stackoverflow.com/a/27134819
answer count: 1
has answer: http://stackoverflow.com/a/27134819
tagged with: jdeveloper

http://stackoverflow.com/a/27040422
has body: You cannot, TreeMap is a sorted key map type. Keys are sorted by Red-Black tree algorithm. So keys are a in sorted order. If you are interested in order in which your elements were added use LinkedHashMap. Your question's anwer are: remove entry under you key add key with new value Ps: updating key and value means deleting old key, not changing it. Map specification: HashMap - simple key/value pairs, unsorted, can't find insert order LinekdHashMap - unsorted, but keeps insert order TreeMap - sorts keys, but can't find insert order
accepted answer of: http://stackoverflow.com/q/27040282
has comment: http://stackoverflow.com/comment/42600157
type: Answer
answers question: http://stackoverflow.com/q/27040282
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42600074
has comment: http://stackoverflow.com/comment/42600201
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43657388
type: QuestionComment
has text: Could you add an answer so that I can give you credit for the solution ?
score: 0
comment on: http://stackoverflow.com/q/27146195
type: Comment

http://stackoverflow.com/q/27099903
has answer: http://stackoverflow.com/a/27100120
has answer: http://stackoverflow.com/a/27100049
tagged with: arrays
tagged with: eclipse
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42704257
tagged with: string
has comment: http://stackoverflow.com/comment/42704243
favorite count: 0
accepted answer: http://stackoverflow.com/a/27100049
has body: I am coding in Java and I understand well that I can compare most arrays with Arrays.equals, and I can compare strings case insensitively with String.equalsIgnoreCase, but is there a way to specifically compare Arrays of strings case insensitively? sample code: class Foo { String[] array; // don't care about case @Override public boolean equals(Foo obj) { // bunch of stuff to check equality if (!Arrays.equals(array, obj.array)) return false; // case insensitive? return true; } }
linked to: http://stackoverflow.com/q/13817413
tagged with: case-sensitive
type: AnsweredQuestion
score: 1
linked to: http://stackoverflow.com/q/15269723
tagged with: java
has comment: http://stackoverflow.com/comment/42704215
upvote count: 1
has comment: http://stackoverflow.com/comment/42704253
possible better answer: http://stackoverflow.com/a/27100120
has title: Case Insensitive String Array Comparison
type: Question

keymapping
tag name: keymapping
type: Tag
tags question: http://stackoverflow.com/q/27129242

http://stackoverflow.com/a/27127591
has body: Change this line by removing type of parameter when calling the method: toDistance(Travelable otherTravelable) / speed; To toDistance(otherTravelable) / speed;
answers question: http://stackoverflow.com/q/27127530
score: 0
type: Answer

http-post
tags question: http://stackoverflow.com/q/26996679
type: Tag
tags question: http://stackoverflow.com/q/27084666
tags question: http://stackoverflow.com/q/27120819
tags question: http://stackoverflow.com/q/27059808
tags question: http://stackoverflow.com/q/27145927
tag name: http-post

http://stackoverflow.com/comment/65340399
has text: rozhok, not rozhoc pls.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/36319834
type: Comment

http://stackoverflow.com/q/27110187
type: UnansweredQuestion
tagged with: android
has title: The method setOutline(Outline) is undefined for the type ImageButton
has comment: http://stackoverflow.com/comment/42723382
answer count: 0
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/26472955
type: Question
tagged with: android-layout
duplicate of: http://stackoverflow.com/q/26472955
has comment: http://stackoverflow.com/comment/42725680
tagged with: android-activity
has body: I am receiving the following error in my code: The method setOutline(Outline) is undefined for the type ImageButton this occured at the following line: ib.setOutline(outline); Below is am image displaying the errors: Below is the dimens xml found under values: 16dp 16dp 56dp 2dp 5dp Note: import android.graphics.Outline was called Any help would be greatly appreciated. Thanks.

http://stackoverflow.com/q/27049340
type: Question
tagged with: format
has title: String split based on column (Java)
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27049867
tagged with: string
favorite count: 0
has body: New to java. I want to read in a file that has lines formatted like this en Fox 3 1344 en Bird 19 144 en Dog 93 1234 For each line I want to pick the contents of column 2 and 3. In the case of the first line "Fox" and "3". and display them. So far this is what I have. import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class pagecounts { public static void main(String[] args) throws FileNotFoundException { String content = new Scanner(new File("filename")).useDelimiter("\\Z").next(); *// letter in column 2 and 3 pick code goes here.* System.out.println(content); } } Any help will be appreciated.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27049407
tagged with: text
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42582428
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27029972
has text: This is java, not javascript?
type: Comment

http://stackoverflow.com/q/27083161
accepted answer: http://stackoverflow.com/a/27083180
has body: I have a method that accepts varargs: public static void main(String... args) throws Exception { I'm trying to set the value of a variable based upon if an argument is passed or not. In this case, I want to know if an 8th argument has been passed and if so set the variable's value to that argument's value, otherwise use an empty string. I cannot hard code in args[8] on the boolean true result portion because that results in a compile error when it's ran with only 7 arguments. So I tried the following but it also errors out: String titlePrefix = ((args.length!=8) ? "" : args[args.length]); What is the correct way to test if an argument has been passed in this case and use it's value only if it has been passed? I know that the above would give me problems should this method ever exceed 8 arguments, but for now, let's just assume that it will never have more than 8. Thank you in advance.
has comment: http://stackoverflow.com/comment/42675535
possible better answer: http://stackoverflow.com/a/27083245
has answer: http://stackoverflow.com/a/27083245
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42675534
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42676090
favorite count: 0
has answer: http://stackoverflow.com/a/27083263
has title: How to test arg in varargs
has answer: http://stackoverflow.com/a/27083180
type: Question
has comment: http://stackoverflow.com/comment/42675908
tagged with: java
answer count: 3
upvote count: 1

http://stackoverflow.com/comment/42558498
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27007814
has text: Thank you for the response. I just need a short clarification: do I have to install Spark on my local machine?

http://stackoverflow.com/comment/42736000
type: QuestionComment
score: 2
has text: If you've alerady extracted the numbers with regex, what's the problem? Seconds = Hours * 60 * 60 + Minutes * 60 + Seconds
comment on: http://stackoverflow.com/q/27116777
type: Comment

http://stackoverflow.com/a/27036307
answers question: http://stackoverflow.com/q/27036047
has comment: http://stackoverflow.com/comment/42593450
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42593376
has comment: http://stackoverflow.com/comment/42593434
downvote count: 1
has body: But I'll lose the 0 parameter functionality of varargs. Have you tried? You will not lose this "0 parameter functionality". It is legal to have an array with no elements at all. You know the prototype for main(), right? public static void main(String... args). And as I am sure you already know this can also be written as public static void main(String[] args). And you can very well invoke your main with: java [whatever JVM args here] path.to.my.MainClass ie, no argument. There will be an array allocated, with no elements. So, your second code will work even in that case. Also, if you declare at least one constructor in a class, the default, no-arg constructor will not be generated. So, in the end, you are "safe".
has comment: http://stackoverflow.com/comment/42593471
has comment: http://stackoverflow.com/comment/42593634
score: 0

http://stackoverflow.com/comment/42727793
type: AnswerComment
comment on: http://stackoverflow.com/a/27102624
score: 0
type: Comment
has text: Hey I read the docs and I dont think I have to do any additional configuration in my jboss

http://stackoverflow.com/comment/42657963
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27072758
score: 0
has text: I am using Entities with the annotations set on the accessor methods, rather than the fields. Could this be the problem?

http://stackoverflow.com/comment/42611327
has text: I tried using the solutions provided on the link, still it doesnt work. I'm not sure what could be the problem. Maybe I need to reinstall Maven and see if that works or not.
type: Comment
comment on: http://stackoverflow.com/a/27030545
type: AnswerComment
score: 0

http://stackoverflow.com/q/27028302
tagged with: java
has title: Class cast exception while adding a second tree node to PriorityQueue
type: Question
answer count: 2
score: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27028518
has answer: http://stackoverflow.com/a/27028443
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has body: I am trying to print a binary tree by BFS. my implementation is with a PriorityQueue. in the beginning i insert root into PriorityQueue. then in loop, i pull a node from PriorityQueue, print it, and insert his childs(if thay are not null) into PriorityQueue. why when inserting the second node, i get this exception: Exception in thread "main" java.lang.ClassCastException: Node cannot be cast to java.lang.Comparable this is my code: class main: public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Tree tree = new Tree(); } } class Node: public class Node { public Node(){} public Node(int num) { value = num; } private int value; private Node left; private Node right; public int getValue() { return value; } public void setValue(int value) { this.value = value; } public Node getLeft() { return left; } public void setLeft(Node left) { this.left = left; } public Node getRight() { return right; } public void setRight(Node right) { this.right = right; } } class tree: public class Tree { private Node root; public Tree() { root = new Node(5); Node node2 = new Node(2); Node node10 = new Node(10); Node node8 = new Node(8); Node node6 = new Node(6); Node node15 = new Node(15); root.setRight(node10); root.setLeft(node2); node10.setRight(node15); node10.setLeft(node8); node8.setLeft(node6); printToWidth(root); } public void printToWidth(Node node) { PriorityQueue&lt;Node&gt; queue = new PriorityQueue&lt;Node&gt;(); queue.add(node); while( !(queue.isEmpty())) { Node n = queue.poll(); System.out.println(n.getValue()); if (n.getLeft() != null) queue.add(n.getLeft()); if (n.getRight() != null) queue.add(n.getRight()); } System.out.println("end printToWidth"); } }

http://stackoverflow.com/q/27088219
tagged with: java
has comment: http://stackoverflow.com/comment/42684552
tagged with: swing
has body: I have a panel in which there is a JScrollPane and a JButton. I want to know how I can set the scroll pane's vertical scroll bar to bottom when I press the button. I have tried code:- private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { writeClient(); jScrollPane2.getVerticalScrollBar().setValue(jScrollPane2.getVerticalScrollBar().getMaximum()); } But it doesn't lead to extreme bottom - a little space is still left at the bottom.
type: Question
has title: How to make JScrollPane set to the bottom when a JButton is pressed?
has answer: http://stackoverflow.com/a/27089894
score: 0
tagged with: jscrollpane
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/27063362
upvote count: 2
has title: Code based Spring configuration returns Hello World instead of expected jsp page
has comment: http://stackoverflow.com/comment/42641451
has comment: http://stackoverflow.com/comment/42641059
type: Question
tagged with: java
has body: After switching from XML to code based Spring configuration the "Hello World!" page is returned after successful log in. Why Spring cannot map controller's methods? AppConfig @Configuration @ComponentScan(basePackages = "app.controller") public class AppConfig {} SecurityConfig @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("a") .password("a") .roles("ADMIN"); } @Override public void configure(WebSecurity web) throws Exception { web .ignoring() .antMatchers("/resources/**"); // #3 } @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() // .antMatchers("/signup","/about").permitAll() // #4 .antMatchers("/**").hasRole("ADMIN") // #6 .anyRequest().authenticated() // 7 .and() .formLogin() // #8 // .loginUrl("/login") // #9 .permitAll(); // #5 } } SecurityWebApplicationInitializer public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer { } WebMvcConfig @EnableWebMvc @Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } @Bean public InternalResourceViewResolver jspViewResolver() { InternalResourceViewResolver bean = new InternalResourceViewResolver(); bean.setPrefix("/WEB-INF/pages/"); bean.setSuffix(".jsp"); return bean; } } WebAppInitializer public class WebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationCo…
score: 2
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/42641286
has comment: http://stackoverflow.com/comment/42641704
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27068702
tagged with: spring-mvc

http://stackoverflow.com/comment/42737017
type: Comment
comment on: http://stackoverflow.com/q/27117159
has text: I see the problem with that error. In line 30, when the dimensions of the grid are set at width and length, there should be a +2 on both. I don't know why this wasn't there already.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42765822
type: QuestionComment
score: 0
has text: It's a custom object. myObjs however is an ArrayList.
comment on: http://stackoverflow.com/q/27133556
type: Comment

http://stackoverflow.com/a/27059419
score: 0
has body: char != Char Class Char has method equals but not primitive type char. if (odpoved!=null) for(int i=0;i!=odpoved.length();i++) if (zvolenePismeno==odpoved.charAt(i)) Should work
type: Answer
answers question: http://stackoverflow.com/q/27059203
has comment: http://stackoverflow.com/comment/42834518
has comment: http://stackoverflow.com/comment/43205911

http://stackoverflow.com/comment/42647464
type: QuestionComment
comment on: http://stackoverflow.com/q/27066837
type: Comment
has text: I have layout with some editTexts and my keyboard
score: 0

http://stackoverflow.com/comment/42757167
type: Comment
type: QuestionComment
has text: Are you accessing image from another class, from a view,... ? Can you also show us that code pls.
comment on: http://stackoverflow.com/q/27128957
score: 0

http://stackoverflow.com/a/27103660
upvote count: 3
has comment: http://stackoverflow.com/comment/42712337
has comment: http://stackoverflow.com/comment/42711283
has comment: http://stackoverflow.com/comment/42711428
score: 3
has comment: http://stackoverflow.com/comment/42712523
downvote count: 0
has comment: http://stackoverflow.com/comment/42711167
has comment: http://stackoverflow.com/comment/42712427
answers question: http://stackoverflow.com/q/27103231
has body: Java 7 You can define an interface for your steps: interface Step { int step(); } Then use a list of steps: ArrayList&lt;Step&gt; steps = new ArrayList&lt;Step&gt;(); Iterate over it like so: public int algorithm() { for (Step step : steps) { int result = step.step(); if (result != 0) return result; } return 0; } To initialise that list, you can do this using anonymous implementation classes: steps.add(new Step() { @Override public int step() { return step1(); //or the code directly } }); steps.add(new Step() { @Override public int step() { return step2(); } }); Or create well named implementation classes for each step: public class Step1 implements Step { @Override public int step() { // TODO Auto-generated method stub return 0; } } And add to list like this: steps.add(new Step1()); steps.add(new Step2()); Using lambda in Java8 No interface required. List: ArrayList&lt;Supplier&lt;Integer&gt;&gt; steps = new ArrayList&lt;Supplier&lt;Integer&gt;&gt;(); Setup: steps.add(()-&gt; step1()); steps.add(()-&gt; step2()); Algorithm: public int algorithm() { for (Supplier&lt;Integer&gt; step : steps) { int result = step.get(); if (result != 0) return result; } return 0; }
type: Answer

http://stackoverflow.com/comment/42672262
score: 0
type: Comment
type: QuestionComment
has text: I think that is the problem. But I don't understand why. It returns JSON in the browser.
comment on: http://stackoverflow.com/q/27081278

http://stackoverflow.com/tag/mp3
tags question: http://stackoverflow.com/q/27021916
type: Tag
tag name: mp3
tags question: http://stackoverflow.com/q/27026042

http://stackoverflow.com/comment/42673491
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27081976
score: 0
has text: you realize that isn't transactionally safe, right? someone could insert something inbetween when you check the count and when you do the insert.

http://stackoverflow.com/q/27103782
upvote count: 2
type: UnansweredQuestion
downvote count: 1
has title: Primefaces confirmDialog issue in dataTable
tagged with: jsf
tagged with: primefaces
tagged with: java
has answer: http://stackoverflow.com/a/29557452
type: Question
answer count: 1
favorite count: 0
has body: I have an issue when using JSF with Primefaces. I used confirmDialog in dataTable. After so many times (at least 3 times) i clicked commandButton, the confirmDialog does not work properly and actioning is slowly. How can i solve or any other advice? Here is form of my JSF Page. <h:form id="salePersonTableForm"> <h:commandLink action="#{ManageSalePersonActionBean.createNewSalePerson}"> <h:panelGrid columns="2"> <h:graphicImage value="/images/add.png" styleClass="command-image" /> <h:outputText value="#{label['COMMON_ADDNEW_LINK']}" styleClass="command-link" /> </h:panelGrid> </h:commandLink> <p:outputPanel id="listPanel"> <p:selectOneMenu converter="omnifaces.SelectItemsIndexConverter" id="selectSalePersonCriteria" value="#{ManageSalePersonActionBean.selectedCriteria}" style="width:150px;font-size:13px;"> <f:selectItem itemLabel="Select Criteria" /> <f:selectItems value="#{ManageSalePersonActionBean.criteriaItems}" var="criteriaItem" /> </p:selectOneMenu> <p:inputText id="customerCriteria" style="width:150px;" value="#{ManageSalePersonActionBean.criteria.criteriaValue}" /> <p:commandButton action="#{ManageSalePersonActionBean.searchSalePerson}" id="searchSalePersonButtonBtn" update=":salePersonTableForm" value="Search" style="font-size:13px;" /> <p:commandButton action="#{ManageSalePersonActionBean.init()}" id="resetSalePersonButtonBtn" update=":salePersonTableForm" value="Reset" style="font-size:13px;" /> <p:dataTable var="salePerson" value="#{ManageSalePersonActionBean.salePersonList}" id="salePersonTable" paginator="true" rows="10" style="width:100%;" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10, 15" rowIndexVar="index"> <p:column headerText="No" style="width:50px;font-size:13px;"> <h:outputText value="#{index + 1}" style="font-size:13px;" /> </p:column> <p:column headerText="SalePersonID" style="font-size:13px;"> <h:outputText value="#{salePerso…
score: 1

http://stackoverflow.com/q/27081837
has comment: http://stackoverflow.com/comment/42675026
tagged with: jcs
upvote count: 0
has title: Java cache as database?
has comment: http://stackoverflow.com/comment/42686730
answer count: 1
favorite count: 0
tagged with: ehcache
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42673132
has body: How are java cache libraries usable as database? My I use something like Ehcache or JCS instead of database? Is it true that Ehcache supports persistence strategy = localRestartable only for Enterprise Ehcache, i.e. paid version? Does it mean free version does not suitable for database replacement? UPDATE Why isn't persistent cache a database replacement? What is the principal difference between database engine operation and cache operation with dist storage? Here is an example of comparison between neo4j (graph database) and Ehcache (cache): http://vschart.com/compare/ehcache/vs/neo4j-community They appear comparable.
downvote count: 1
has comment: http://stackoverflow.com/comment/42685307
tagged with: java
has answer: http://stackoverflow.com/a/27103214
score: -1
tagged with: caching
type: Question

http://stackoverflow.com/q/27085827
has title: How to backtrace in a maze...?
tagged with: maze
type: UnansweredQuestion
tagged with: recursion
has answer: http://stackoverflow.com/a/27086003
tagged with: java
has body: So I'm writing a program to make a robot explore a maze to find a specified cavern. There are four types of Cells: Cavern, Start, Wall, and Passage. Robots can only move to a passage or a cavern. I implemented my method so that a robot can't move to a visited cell or go out of bounds. But once it moves to a cell where there isn't a valid adjacent cell, the program stops. So how do I make my robot backtrace to where there is a valid cell? I'm using a recursion for this. Below is my code. Any help will be great. Thank you! public void explore (Cell cavern, Maze maze) throws InterruptedException { // for debugging System.out.println(row + " " + col); System.out.println(cavern.getRow() + " " + cavern.getCol()); System.out.println(visited.toString()); TimeUnit.MILLISECONDS.sleep(10); // delay program //base case if (row == cavern.getRow() &amp;&amp; col == cavern.getCol()) { foundCavern = true; return; } else { // move right if ((col+1) &lt; maze.getNumCols() &amp;&amp; !visited.contains(maze.getCell(row, col+1)) &amp;&amp; (maze.getCell(row, col+1).isPassage() || maze.getCell(row, col+1).isCavern())) { visited.add(maze.getCell(row, col+1)); setRobotLocation(row,col+1); explore(cavern, maze); } // move down else if ((row+1) &lt; maze.getNumRows() &amp;&amp; !visited.contains(maze.getCell(row+1, col)) &amp;&amp; (maze.getCell(row+1, col).isPassage() || maze.getCell(row+1, col).isCavern())) { visited.add(maze.getCell(row+1, col)); setRobotLocation(row+1,col); explore(cavern, maze); } // move left else if ((col-1) &gt;= 0 &amp;&amp; !visited.contains(maze.getCell(row, col-1)) &amp;&amp; (maze.getCell(row, col-1).isPassage() || maze.getCell(row, col-1).isCavern())) { visited.add(maze.getCell(row, col-1)); setRobotLocation(row,col-1); explore(cavern, maze); } // move up else if ((row-1) &gt;= 0 &amp;&amp; !visited.contains(maze.getCell(row-1, col)) &amp;&amp; (maze.getCell(row-1, col).isPassage() || maze.getCell(row-1, col).isCavern())) { visited.add(maze.getCell(row-1, col))…
has comment: http://stackoverflow.com/comment/42680283
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42680396
has comment: http://stackoverflow.com/comment/42680381
has comment: http://stackoverflow.com/comment/42680407
score: 0
answer count: 1

http://stackoverflow.com/a/27092489
upvote count: 1
answers question: http://stackoverflow.com/q/27087768
type: Answer
has body: You can find your default behavior for the case where graphite receive several points during the aggregation period in aggreagtion-rules.conf. I think graphite default is to take last received point in the aggregation period. If you might be interested in metric detail by process instance (and you'll probably be at some point), you should tag instances in some way and use that tag in metric path. Graphite is extremely useful for aggregation at request time and finding a way to aggregate individuals metrics (sum, avg, max, or more complex) you be difficult. One thing that can make you reluctant to have different metrics by sender process would be if you have a very versatile environment where instances change all the time (thus creating many transient metrics). Otherwise, just use ip+pid and you'll be fine.
downvote count: 0
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27087768

http://stackoverflow.com/a/27009807
score: 1
answers question: http://stackoverflow.com/q/27009389
accepted answer of: http://stackoverflow.com/q/27009389
has body: It looks like you just need a 1 row of with many columns (per image) so a table isn't what I would use. A ListView is basically a 1 dimensional table which is what you are looking for. Using an ObservableList as your data model is an easy way to feed data. Modify the list and the ListView updates automatically ObservableList&lt;String&gt; model = FXCollections.observableArrayList( " ", "X", " ", "X", "X", " ", " ", "X"); listView.setOrientation(Orientation.HORIZONTAL); ListView&lt;String&gt; listView = new ListView&lt;String&gt;(model); This is a working example on GitHub:
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42547835
type: Answer
has comment: http://stackoverflow.com/comment/42563769
downvote count: 0

http://stackoverflow.com/q/27132622
has comment: http://stackoverflow.com/comment/42769891
score: 3
has comment: http://stackoverflow.com/comment/42789169
tagged with: rmi
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42794263
has answer: http://stackoverflow.com/a/27164221
type: Question
has body: I have a RMI Server that needs to be tested with thousands of requests per second sent by a Traffic Generator simulating multiple clients. What I want to do is something similar with this but with RMI. Basically, stop accepting/processing requests if the saturation of the server is reached so it can keep processing the current ones. Is this possible or I really need to use sockets to achieve this? Thanks in advance. EDIT: I also need to know how many requests have been rejected somewhere (might be client side or server side)
downvote count: 0
linked to: http://stackoverflow.com/q/2001086
has title: Java RMI: Rejecting requests when saturation is reached
answer count: 1
has comment: http://stackoverflow.com/comment/42812539
favorite count: 0
has comment: http://stackoverflow.com/comment/42789958
type: UnansweredQuestion

http://stackoverflow.com/comment/42697961
comment on: http://stackoverflow.com/q/27096232
type: Comment
type: QuestionComment
has text: I believe so. Ill add a screen shot of what the database looks like right now to see if that can shed light onto this issues.
score: 0

g1gc
tags question: http://stackoverflow.com/q/27032214
type: Tag
tag name: g1gc

http://stackoverflow.com/comment/42569660
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27022423
has text: Create a new column in the education table and then `INSERT INTO education(newColumn) SELECT oldColumn FROM MyOneTable`

http://stackoverflow.com/q/27102930
tagged with: gradle
type: Question
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/27133263
answer count: 1
tagged with: wsdl
downvote count: 0
favorite count: 0
has body: I have 2 WSDL files and I have to generate java classes from them. I have been told that this thing can be done by this plugin: https://github.com/tklein/gradle-jaxws-plugin . But I don't know how to properly use this. I tried to change the build-test.gradle (wsdlURL= ), but it doesn't work. I don't know how I am supposed to run, use this plugin and where to check if those classes were generated. I hope someone finds the time to help me with this because I really need this problem solved. Thank you very much!
has comment: http://stackoverflow.com/comment/42710124
has comment: http://stackoverflow.com/comment/42709655
has title: wsdl to java classes
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27133263
upvote count: 1
tagged with: web-services

http://stackoverflow.com/comment/42693362
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27093714
has text: What exactly is the problem. You say the history item isn't saved, and the SQL logs show that a history item is inserted. So what?
score: 0

http://stackoverflow.com/q/27094036
has body: I am learning Apache Spark. Given such an implementation of spark using java below, I am confused about some details about it. public class JavaWordCount { public static void main(String[] args) throws Exception { if (args.length &lt; 2) { System.err.println("Usage: JavaWordCount &lt;master&gt; &lt;file&gt;"); System.exit(1); } JavaSparkContext ctx = new JavaSparkContext(args[0], "JavaWordCount", System.getenv("SPARK_HOME"), System.getenv("SPARK_EXAMPLES_JAR")); JavaRDD&lt;String&gt; lines = ctx.textFile(args[1], 1); JavaRDD&lt;String&gt; words = lines.flatMap(new FlatMapFunction&lt;String, String&gt;() { public Iterable&lt;String&gt; call(String s) { return Arrays.asList(s.split(" ")); } }); JavaPairRDD&lt;String, Integer&gt; ones = words.map(new PairFunction&lt;String, String, Integer&gt;() { public Tuple2&lt;String, Integer&gt; call(String s) { return new Tuple2&lt;String, Integer&gt;(s, 1); } }); JavaPairRDD&lt;String, Integer&gt; counts = ones.reduceByKey(new Function2&lt;Integer, Integer, Integer&gt;() { public Integer call(Integer i1, Integer i2) { return i1 + i2; } }); List&lt;Tuple2&lt;String, Integer&gt;&gt; output = counts.collect(); for (Tuple2 tuple : output) { System.out.println(tuple._1 + ": " + tuple._2); } System.exit(0); } } According to my comprehension, begin in line 12, it passed an anonymous class FlatMapFunction into the lines.flatMap() as an argument. Then what does the String s mean? It seems that it doesn't pass an created String s as an argument, then how will the FlatMapFunction&lt;String,String&gt;(){} class works since no specific arguments are passed into?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27094146
accepted answer: http://stackoverflow.com/a/27094071
has title: Anonymous class do not have an argument
tagged with: java
has comment: http://stackoverflow.com/comment/42693926
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27094071
score: 0
possible better answer: http://stackoverflow.com/a/27094146

http://stackoverflow.com/comment/42543110
type: Comment
has text: @DavidFrank is your suggestion substantially different from [this](https://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-files/introduction_to_fxml.html#custom_components)?
score: 0
comment on: http://stackoverflow.com/q/27006707
type: QuestionComment

http://stackoverflow.com/comment/42560996
score: 0
type: QuestionComment
has text: My DBA said that query looks good in Querymonitor and did't log anything strange
type: Comment
comment on: http://stackoverflow.com/q/27015975

http://stackoverflow.com/q/27042297
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27288595
score: 7
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/27069668
type: Question
tagged with: android-5.0-lollipop
downvote count: 0
possible better answer: http://stackoverflow.com/a/27069668
has answer: http://stackoverflow.com/a/27615313
tagged with: android
tagged with: aviary
has body: Was just testing my app and found out that after I upgraded my Nexus 5 to Lollipop/5.0, the Aviary SDK I use in it crashes big time. In a google search I found an SO question asked yesterday with the exact same problem, but that question has been deleted by the user (I was able to view it through Googles cache). It said: When I run my project on Android L it crash every time with error: 11-20 09:27:38.560: A/art(13974): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception 'java.lang.NoSuchFieldError' thrown in int com.aviary.android.feather.headless.moa.Moa.n_init(android.content.Context, java.lang.String, int):-2 anyone has any solution for this? thanks. ps, it fine with sdk &lt;= 4.4 My problem is exactly the same - It worked pre-5.0 and on my other phone (Galaxy S2 with 4.1.3) it works perfectly.
favorite count: 0
has title: Aviary crashes on Android L (5.0)
has answer: http://stackoverflow.com/a/27743124
accepted answer: http://stackoverflow.com/a/27615313
answer count: 4

http://stackoverflow.com/q/27036300
answer count: 1
has body: I'm using a Simpleadapter to create a Lisview for display some data, but i get this error: java.lang.NullPointerException, at com.example.example.FindPeopleFragment.ListDrwaer(FindPeopleFragment.java:214) Code // Async Task to access the web private class JsonReadTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... params) { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(params[0]); try { HttpResponse response = httpclient.execute(httppost); jsonResult = inputStreamToString( response.getEntity().getContent()).toString(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } private StringBuilder inputStreamToString(InputStream is) { String rLine = ""; StringBuilder answer = new StringBuilder(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); try { while ((rLine = rd.readLine()) != null) { answer.append(rLine); } } catch (IOException e) { // e.printStackTrace(); Toast.makeText(getActivity(), "Error..." + e.toString(), Toast.LENGTH_LONG).show(); } return answer; } @Override protected void onPostExecute(String result) { ListDrwaer(); } }// end async task public void accessWebService() { JsonReadTask task = new JsonReadTask(); // passes values for the urls string array task.execute(new String[] { url }); } // build hash set for list view public void ListDrwaer() { List&lt;Map&lt;String, String&gt;&gt; employeeList = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); try { JSONObject jsonResponse = new JSONObject(jsonResult); JSONArray jsonMainNode = jsonResponse.optJSONArray("Utente"); for (int i = 0; i &lt; jsonMainNode.length(); i++) { JSONObject jsonChildNode = jsonMainNode.getJSONObject(i); String name = jsonChildNode.optString("Nome"); String number = jsonChildNode.optString("Cognome"); String string = jsonChildNode.optString("Stringa"); String data = jsonChildNode.optString("DataLogin"); Strin…
favorite count: 0
has comment: http://stackoverflow.com/comment/42593021
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42594093
has comment: http://stackoverflow.com/comment/42593112
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/27036572
upvote count: 1
has title: Android NullPointerException with simpleAdapter while setting data in fragment
type: Question
has comment: http://stackoverflow.com/comment/42593097
has comment: http://stackoverflow.com/comment/42593139
score: -1
has comment: http://stackoverflow.com/comment/42593381
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42593482

http://stackoverflow.com/comment/42742456
type: AnswerComment
score: 0
has text: import org.primefaces.event.SelectEvent; import org.primefaces.event.UnselectEvent; Those are part of the primefaces .jar package and therefore are available. Car and CarService are not part of the primefaces package. Those are just examples to illustrate how primefaces work. You do not import those, but you make your own...
type: Comment
comment on: http://stackoverflow.com/a/27105592

http://stackoverflow.com/a/27098772
has body: java.net method is better for network communication using java.net or java.nio for Android applications
type: Answer
has comment: http://stackoverflow.com/comment/42702372
has comment: http://stackoverflow.com/comment/42702509
answers question: http://stackoverflow.com/q/27098727
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/comment/42784062
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27143611
has text: @Hafiz.M.Usman please check edited question for logcat
score: 0

http://stackoverflow.com/a/27075691
has body: First is important to know, that the compiler replace ? operator with Object class. So when you write this: DummyClass&lt;?&gt; dummy your class definition will look like this: public class DummyClass&lt;Object&gt; and methods like this: public List&lt;Object&gt; getList() { return new ArrayList&lt;Object&gt;(); } public Set&lt;List&lt;Object&gt;&gt; getListSet() { return new HashSet&lt;List&lt;Object&gt;&gt;(); } You can write List&lt;?&gt; list = new List&lt;Object&gt;(); but not Set&lt;List&lt;?&gt;&gt; set = new HashSet&lt;List&lt;Object&gt;&gt;();
answers question: http://stackoverflow.com/q/27075287
type: Answer
upvote count: 0
score: -1
downvote count: 1

http://stackoverflow.com/comment/42586722
has text: Thanks for reply.. But it change text value not label value. I want to change label value.What changes i need to do?
comment on: http://stackoverflow.com/a/27011556
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42520575
has text: Ok, this solved some errors, but now i can't find out why my "textView" is null when i use it. When i first create it, it has the widget.TextView correct, but when i use it to set the value from the "entityFinal" the textView is null.
score: 0
comment on: http://stackoverflow.com/a/26994524
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42655687
comment on: http://stackoverflow.com/q/27071539
score: 0
type: Comment
has text: @peter.petrov Thanks for the honesty. That is one less moment wasted.
type: QuestionComment

http://stackoverflow.com/q/27129846
has title: Caused by: javax.media.opengl.GLException: Not a GL3 implementation
has comment: http://stackoverflow.com/comment/42760979
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27202391
favorite count: 0
has comment: http://stackoverflow.com/comment/42761619
tagged with: jogl
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42762464
has comment: http://stackoverflow.com/comment/42762493
has comment: http://stackoverflow.com/comment/42760848
has comment: http://stackoverflow.com/comment/42758964
tagged with: opengl
tagged with: java
has body: I am getting a "Not a GL3 implementation exception" in the method init when it tries to do the assignment. void init(GLAutoDrawable glad){ GL3 gl3 = glad.getGL().getGL3(); } I downloaded the jogamp-all-platforms. I am using Eclispe IDE and configured the build path by making a new user library. The new user library has all the jars of the jogamp-all-platforms in it. I looked at similar questions but it is not that helpful.
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27159085
score: 0

http://stackoverflow.com/comment/42668010
score: 0
comment on: http://stackoverflow.com/q/27078224
type: QuestionComment
has text: I think searching for *java create custom classloader* is not that hard. Anyway: http://publib.boulder.ibm.com/infocenter/javasdk/v1r4m2/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.142%2Fhtml%2Fid1100.html
type: Comment

http://stackoverflow.com/comment/42925979
type: Comment
has text: please take a look at http://stackoverflow.com/questions/27223838/update-a-tag-name-along-with-its-value
score: 0
comment on: http://stackoverflow.com/a/27055679
type: AnswerComment

http://stackoverflow.com/q/27055262
accepted answer: http://stackoverflow.com/a/27055396
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: How to catch the exception unsupported major .minor version exception in java
type: Question
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27055396
score: -1
favorite count: 0
has body: By chaining java version to higher problem will be solved but i don't want to do in that way . I want to catch the exception and throw user understandable message . it will possible or not ?
tagged with: exception

http://stackoverflow.com/comment/42813427
score: 0
type: AnswerComment
type: Comment
has text: A great answer! This clears all of the things I have been wondering and puts my thoughts into order. As far as I have started implementing the REST API with tokens, this suites me fine with a few adjustments.
comment on: http://stackoverflow.com/a/27150984

spring-mvc
tags question: http://stackoverflow.com/q/26996613
tags question: http://stackoverflow.com/q/27063362
tags question: http://stackoverflow.com/q/26997252
tags question: http://stackoverflow.com/q/27148556
tags question: http://stackoverflow.com/q/27141058
tags question: http://stackoverflow.com/q/27066437
tags question: http://stackoverflow.com/q/27121366
tags question: http://stackoverflow.com/q/27071184
tags question: http://stackoverflow.com/q/27071978
tags question: http://stackoverflow.com/q/27139121
tags question: http://stackoverflow.com/q/27074622
tags question: http://stackoverflow.com/q/27060757
tags question: http://stackoverflow.com/q/27023299
tags question: http://stackoverflow.com/q/27139886
tags question: http://stackoverflow.com/q/27004963
tags question: http://stackoverflow.com/q/27124323
tags question: http://stackoverflow.com/q/27060730
tags question: http://stackoverflow.com/q/27017495
tags question: http://stackoverflow.com/q/27014435
tags question: http://stackoverflow.com/q/26993364
tags question: http://stackoverflow.com/q/27026815
tags question: http://stackoverflow.com/q/27124866
tags question: http://stackoverflow.com/q/27099333
tags question: http://stackoverflow.com/q/26994951
tags question: http://stackoverflow.com/q/27139100
tags question: http://stackoverflow.com/q/27014776
tags question: http://stackoverflow.com/q/27029574
tags question: http://stackoverflow.com/q/27073953
tags question: http://stackoverflow.com/q/27145927
tags question: http://stackoverflow.com/q/27062538
tags question: http://stackoverflow.com/q/27123182
tags question: http://stackoverflow.com/q/27015077
tags question: http://stackoverflow.com/q/27129310
tags question: http://stackoverflow.com/q/27084567
tags question: http://stackoverflow.com/q/27131086
tags question: http://stackoverflow.com/q/27106686
tags question: http://stackoverflow.com/q/27041384
tags question: http://stackoverflow.com/q/27052240
tags question: http://stackoverflow.com/q/27098043
tags question: http://stackoverflow.com/q/27034433
tags question: http://stackoverflow.com/q/27040088
tags question: http://stackoverflow.com/q/27134564
tags question: http://stackoverflow.com/q/27122884
tags question: http://stackoverflow.com/q/27010706
tags question: http://stackoverflow.com/q/27058941
tags question: http://stackoverflow.com/q/27095136
tags question: http://stackoverflow.com/q/27038432
tags question: http://stackoverflow.com/q/27058998
tags question: http://stackoverflow.com/q/27102751
tags question: http://stackoverflow.com/q/27106055
tag name: spring-mvc
tags question: http://stackoverflow.com/q/27106693
tags question: http://stackoverflow.com/q/27143658
tags question: http://stackoverflow.com/q/27063652
tags question: http://stackoverflow.com/q/27065779
tags question: http://stackoverflow.com/q/27000730
tags question: http://stackoverflow.com/q/27033371
tags question: http://stackoverflow.com/q/27056672
tags question: http://stackoverflow.com/q/27123600
tags question: http://stackoverflow.com/q/27035797
tags question: http://stackoverflow.com/q/27069253
tags question: http://stackoverflow.com/q/27012459
tags question: http://stackoverflow.com/q/27063632
tags question: http://stackoverflow.com/q/27098708
tags question: http://stackoverflow.com/q/27105478
tags question: http://stackoverflow.com/q/26994248
type: Tag
tags question: http://stackoverflow.com/q/27121831
tags question: http://stackoverflow.com/q/26997069
tags question: http://stackoverflow.com/q/27123370
tags question: http://stackoverflow.com/q/27057679
tags question: http://stackoverflow.com/q/27152769
tags question: http://stackoverflow.com/q/27015856
tags question: http://stackoverflow.com/q/27133738
tags question: http://stackoverflow.com/q/27130369
tags question: http://stackoverflow.com/q/27141156
tags question: http://stackoverflow.com/q/27126013
tags question: http://stackoverflow.com/q/27063392
tags question: http://stackoverflow.com/q/27056860
tags question: http://stackoverflow.com/q/27148868

http://stackoverflow.com/q/27006226
has body: I'm creating a mock application in Android Studio and on the loading screen I would like to create a 'mock' progress bar that take 10 seconds to fill. This is just to show what the app will look like once it is fully coded. I'm not experienced with android studio very at all so please bare with my inexperience, but at the moment I have created a for loop to run 10 times incrementing the progress bar by 10% each time with the following code: private ProgressBar progress; public void mockprogressbar (ProgressBar progress){ progress = (ProgressBar) findViewById(R.id.progressBar); progress.setMax(100); for(int i = 1; i &lt; 11; ++i){ try { Thread.sleep(1000); progress.setProgress(i*10); } catch (InterruptedException e) { e.printStackTrace(); } } } I hoped that when this method was run when an image was selected that I would have a 'mock' progress bar that would wait a second then increment itself by 10% until it reach 100%, however what I have instead is when I run my AVD the code runs till complete and skips to display the progress bar completely full. I was wondering if I needed to somehow 'update' the progress bar after each incrementation or whether this is even possible in Android Studio. If there is another simpler way I would also be interested to know, thanks for any help in advance and sorry for my inexperience again :)
favorite count: 0
tagged with: android-studio
score: 2
has title: Android Studio - Create Mock Progress Bar
upvote count: 2
accepted answer: http://stackoverflow.com/a/27015572
type: Question
type: AnsweredQuestion
tagged with: java
answer count: 1
downvote count: 0
tagged with: progress-bar
has answer: http://stackoverflow.com/a/27015572
tagged with: android

http://stackoverflow.com/q/27005534
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27005585
accepted answer: http://stackoverflow.com/a/27005585
has body: I am trying to write a recursive implementation of a method that takes a non-negative argument, and returns the sum of the squares of its digits. For example, sumSquareDigits(10) should return 1 and sumSquareDigits(103) should return 10. This is my code : public static int sumSquareDigits(int n) { if (n &lt; 10) return n^2; return (((n % 10)^2) + sumSquareDigits(n/10)); } For example for an given integer 625, it would be something like: (625 % 10)^2 + (62,5 % 10)^2 + (6,25)^2 = 5^2 + 2^2 + (6,25)^2 which of course is wrong because the last term should be 6 and not 6,25. What I am looking for is a way to truncate 6,25 so that it becomes 6. How do we do this? And I'd appreciate any hints to implement this function better (I'm new in Java). Thanks!
type: AnsweredQuestion
tagged with: recursion
tagged with: java
type: Question
has title: Sum of squares of digits of an integer in Java
has comment: http://stackoverflow.com/comment/42540648
possible better answer: http://stackoverflow.com/a/27005624
has answer: http://stackoverflow.com/a/27005624

http://stackoverflow.com/q/27086856
has comment: http://stackoverflow.com/comment/42681973
downvote count: 0
tagged with: jsp
score: 1
has body: I'm using this Code in my jsp: <c:if test="<%=box.getPrefs().getBool("PrefOTPEnabled")%>"> </c:if> but I got a syntax error: Syntax error on token ";", Expression expected after this token What is wrong with that?
favorite count: 0
type: Question
has title: Syntax error on token ";", Expression expected after this token in JSP
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/27086896
has answer: http://stackoverflow.com/a/27086914
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/a/27109461
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42721986
type: Answer
answers question: http://stackoverflow.com/q/27109365
has body: Seems like you need to use JMockit or PowerMock to mock the call to FileChannel.open so that it returns a mocked FileChannel. JMockit mock static method

http://stackoverflow.com/q/27066851
answer count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27068036
has comment: http://stackoverflow.com/comment/42647323
type: AnsweredQuestion
has body: I know that all variables in any classes normally should be encapsulated, And another one could not be access but itself. But in case of child class, I wonder that why child class can not access its variables that inherit from mother class (e.g. Mother class has variable A = "" and when you create Child class that extends from Mother class. you are not allowed to change variable A to another value (overriding) immediately in Child class). And yes, there are another way to do this we can use constructor and super keyword to solve this problem. the question is that why they do not allow us to do it more simply way? for example just allow us to override variables that much much more easier that using constructor and super keyword. I think should have some reason to support this. Right?
tagged with: oop
has comment: http://stackoverflow.com/comment/42647762
tagged with: java
has comment: http://stackoverflow.com/comment/42650487
has comment: http://stackoverflow.com/comment/42647216
type: Question
has title: What is the reason behind the concept of OOP in java that "Overriding variable is not allowed"?
tagged with: overriding
accepted answer: http://stackoverflow.com/a/27068036
score: 0
upvote count: 1

http://stackoverflow.com/comment/42542818
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27006694
type: AnswerComment
has text: I'd do `clickCount = (clickCount + 1) % COLORS.length;`, y'know just in case.

http://stackoverflow.com/q/27094813
has comment: http://stackoverflow.com/comment/42696723
has comment: http://stackoverflow.com/comment/42695361
type: Question
has comment: http://stackoverflow.com/comment/42697127
has comment: http://stackoverflow.com/comment/42697081
tagged with: java
has comment: http://stackoverflow.com/comment/42697437
has title: display received message android
tagged with: message
has comment: http://stackoverflow.com/comment/42695376
has body: im trying to create a dummy app that increments/decrements a number but in the background it is listening to any recieved messages , im unable to to display any received messages in the app, heres my code for the smsReceiver class. import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Environment; import android.telephony.SmsMessage; import android.widget.Toast; /* Class used to listen for incoming SMS Messages */ public class SMSReceiver extends BroadcastReceiver{ public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){ Bundle bundle = intent.getExtras(); //---get the SMS message passed in--- SmsMessage[] msgs = null; String msg_from; String msgBody =""; if (bundle != null){ //---retrieve the SMS message received--- try{ Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; for(int i=0; i&lt;msgs.length; i++){ msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]); // msg_from = msgs[i].getOriginatingAddress(); msgBody = msgs[i].getMessageBody();//.toString(); } }catch(Exception e){ // Log.d("Exception caught",e.getMessage()); } } try { File root = Environment.getExternalStorageDirectory(); if (root.canWrite()){ File dir = new File (root.getAbsolutePath() + "/Bonbon info"); dir.mkdirs(); File f = new File(dir, "test.txt"); FileWriter fw = new FileWriter(f); BufferedWriter out = new BufferedWriter(fw); out.write(msgBody); out.close(); } } catch (IOException e) { } //---display the new SMS message--- Toast.makeText(context, msgBody, Toast.LENGTH_LONG).show(); } } } i have also added this to my manifest for receiving . `&lt;receiver android:name=".listener.SMSReceiver"&gt; &lt;intent-filter&gt; &lt;action android:name="android.provider.Te…
has comment: http://stackoverflow.com/comment/42695729
score: 0
has comment: http://stackoverflow.com/comment/42695711
tagged with: android
has comment: http://stackoverflow.com/comment/42697517
answer count: 0
tagged with: sms
type: UnansweredQuestion

http://stackoverflow.com/q/27134187
has comment: http://stackoverflow.com/comment/42766844
has comment: http://stackoverflow.com/comment/42767451
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42766927
has body: One of the functions in the program is a user entering their postcode. So far I have: if ( postcode != //SOMETHING// ) { JOptionPane.showMessageDialog(this, "Not UK Postcode", "Postcode must be a valid UK postcode", jOptionPane.ERROR_MESSAGE); } What would I put in the if statement in order for it to check if the entered postcode is a valid UK postcode?
has comment: http://stackoverflow.com/comment/42766955
linked to: http://stackoverflow.com/q/21616133
linked to: http://stackoverflow.com/q/14998459
has comment: http://stackoverflow.com/comment/42767052
has title: How to validate a UK postal code in Java?
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/42767725
has comment: http://stackoverflow.com/comment/42766863
upvote count: 1
tagged with: postal-code
has answer: http://stackoverflow.com/a/27175647
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/42768336
score: -2
has comment: http://stackoverflow.com/comment/42766858
has comment: http://stackoverflow.com/comment/42766922
has answer: http://stackoverflow.com/a/27145329
answer count: 3
tagged with: validation
has answer: http://stackoverflow.com/a/73032280
favorite count: 0

http://stackoverflow.com/q/27141685
has comment: http://stackoverflow.com/comment/42781425
tagged with: arraylist
has body: import java.util.ArrayList; import java.util.HashMap; /** * Write a description of class Game here. * * @author (Christopher ) * @version (a version number or a date) */ public class Game { ArrayList &lt;Item&gt; myArray; HashMap &lt;String, Room&gt; myNeighbor; Room currentRoom; String currentMessage; Room hallway, kitchen, bathroom, livingRoom, upstairsLobby, blakesRoom, jaysRoom, mikesRoom; Item crumbs, eggs, cellPhone, textBooks, poptarts, pizzaRolls, clothes, chips; public Game() { ArrayList &lt;Item&gt; myArray = new ArrayList(); currentRoom = hallway; } private void createRooms() { myNeighbor = new HashMap &lt;String, Room&gt; (); crumbs = new Item("Crumbs", "small crumbs of some kind of food", 100); eggs = new Item("Raw Eggs", "a couple of raw eggs still contained within their egg shells", 1100); cellPhone = new Item("Cell Phone", "Mike's cell phone he must have forgotten here...", 0); textBooks = new Item("Textbooks", "Jay's textbooks, because he can't use his bedroom to store his stuff", 0); poptarts = new Item("Pop Tarts", "an un-opened box of chocolate pop tarts that someone must have left behind...", 1500); pizzaRolls = new Item("Pizza Rolls", "cooked steaming pizza rolls piled high", 2000); clothes = new Item("Clothes", "clothes, a lot of clothes all over the floor and all over the room, who knows if they're clean or not...", 0); // miningTools = new Item("Mining Tools", "pickaxes, drills, and everything else you need to extract rocks and minerals from the earth's crust", 100); chips = new Item("Chips", "chip bag hidden away that is only half full now", 400); hallway = new Room("in a dark hallway with crumbs scattered over the ground", crumbs); kitchen = new Room("in a kitchen with raw eggs lying on the counter tops", eggs); bathroom = new Room("in a bathroom with a stand up shower, a washer, a drier, and Mike's cell phone left behind laying on the counter", cellPhone); livingRoom = new Room("in a living room with Jay's textbooks all over the room", te…
has comment: http://stackoverflow.com/comment/42780977
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42781255
accepted answer: http://stackoverflow.com/a/27142095
has answer: http://stackoverflow.com/a/27141914
has answer: http://stackoverflow.com/a/27141699
type: Question
has title: adding items to an Hashmap and getting error null.pointer.exception
possible better answer: http://stackoverflow.com/a/27141699
has comment: http://stackoverflow.com/comment/42780924
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/42781034
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/27142095
tagged with: hashmap

http://stackoverflow.com/comment/42763041
comment on: http://stackoverflow.com/a/27131338
has text: Thanks for answer. But, I've already tried such thing, but forgot to specify. Unfortunatly it does not work in my case. The main pain that I work with BindingResult object that subsequently converted to CustomObject to have possibility resolve message on Client Side.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42642110
score: 0
type: Comment
type: QuestionComment
has text: the jframe auto generated code only calls the constructor of classes that extends JFrame, as shown in the cose above.
comment on: http://stackoverflow.com/q/27063017

http://stackoverflow.com/q/27133974
tagged with: accessor
has title: Unreachable Statement On "Return"
score: 0
type: UnansweredQuestion
upvote count: 1
tagged with: methods
downvote count: 1
has answer: http://stackoverflow.com/a/27134003
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42766673
answer count: 3
tagged with: unreachable-statement
has answer: http://stackoverflow.com/a/27134199
has body: Here's My First Class: public class Fraction { int Numerator; int Denominator; /** * Constructor for objects of class Fraction */ public Fraction() { // initialise instance variables Numerator=0; Denominator=0; } public Fraction(int StartNumerator , int StartDenominator) { StartNumerator = Numerator; StartDenominator = Denominator; } public String toString() { String FractionOne = Numerator + "/" + Denominator; String FractionTwo = Numerator + "/" + Denominator; return FractionOne; return FractionTwo; } } Here's my second Class: public class TestFraction { public static void main (String [] args) { Fraction FractionOne = new Fraction(1 , 4); Fraction FractionTwo = new Fraction(2 , 3); System.out.println(FractionOne); System.out.println(FractionTwo); } } When I compile, I get an error upon: return FractionTwo; as an unreachable statement Please help me understand what I am doing wrong.
favorite count: 0
has answer: http://stackoverflow.com/a/27134028

http://stackoverflow.com/comment/42545944
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27008786
has text: actually isAbsolute() is sytem dependant. if I am running the code on windows it returns true for "C:/temp" but if I am referring to a unix path "/home/xx" , its returning false. In my code, am working with remote machine and I need to determine correctly is the file path is absolute or not. so i cant use this method.
score: 0

http://stackoverflow.com/comment/42768292
type: QuestionComment
comment on: http://stackoverflow.com/q/27134861
has text: post some of your code.
score: 0
type: Comment

http://stackoverflow.com/comment/42563769
comment on: http://stackoverflow.com/a/27009807
score: 0
type: AnswerComment
type: Comment
has text: I don't know offhand, but from the documentation link above, "The visuals of the ListView can be entirely customized by replacing the default cell factory. A cell factory is used to generate ListCell instances, which are used to represent an item in the ListView. See the Cell class documentation for a more complete description of how to write custom Cells."

http://stackoverflow.com/a/27144159
has comment: http://stackoverflow.com/comment/42785869
score: 13
downvote count: 1
has comment: http://stackoverflow.com/comment/42784706
has comment: http://stackoverflow.com/comment/42784648
answers question: http://stackoverflow.com/q/27143951
has comment: http://stackoverflow.com/comment/42785596
type: AcceptedAnswer
has body: If you create getters and setters in your superclass then you can acces the variables through those methods. Other possibility is to change the visibility from private to protected first solution looks like this Employee public class Employee { private String name; private int id; private double salary; public Employee(String name, int id, double salary) { super(); this.name = name; this.id = id; this.salary = salary; } public double getSalary() { return salary; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getId() { return id; } public void setId(int id) { this.id = id; } public void setSalary(double salary) { this.salary = salary; } @Override public String toString() { return "Employee [name=" + name + ", id=" + id + ", salary=" + salary + "]"; } } Manager public class Manager extends Employee { private double bonus; public Manager(String name, int id, double salary, int bonus) { super(name, id, salary); this.bonus = bonus; } public double getSalary() { double baseSalary = super.getSalary(); return (baseSalary + baseSalary * (bonus / 100)); } @Override public String toString() { return "Manager [name=" + getName() + ", id=" + getId() + ", salary=" + getSalary() + ", bonus=" + bonus + "]"; } } Second one (using protected) Employee public class Employee { protected String name; protected int id; protected double salary; public Employee(String name, int id, double salary) { super(); this.name = name; this.id = id; this.salary = salary; } public double getSalary() { return salary; } @Override public String toString() { return "Employee [name=" + name + ", id=" + id + ", salary=" + salary + "]"; } } Manager public class Manager extends Employee { protected double bonus; public Manager(String name, int id, double salary, int bonus) { super(name, id, salary); this.bonus = bonus; } public double getSalary() { double baseSalary = super.getSalary(); return (baseSalary + baseSalary * (bonus / 100)); } @Override p…
has comment: http://stackoverflow.com/comment/98462770
has comment: http://stackoverflow.com/comment/42784719
type: Answer
has comment: http://stackoverflow.com/comment/42785888
accepted answer of: http://stackoverflow.com/q/27143951
upvote count: 14

http://stackoverflow.com/a/27032334
type: Answer
answers question: http://stackoverflow.com/q/27031635
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27031635
has body: You didn't properly instantiate bankBean prior to calling initial() method. You have to do something like this: // Obtain InitialContext (ctx) object BankBeanRemote bankBean = ctx.lookup("BankBean"); .... BigDecimal initial = bankBean.initial(); This should get rid of your NPE.

http://stackoverflow.com/a/53205394
type: Answer
has body: It is simple, You have the following options: Goto menu option "Build" -> "Rebuild project" Goto menu "File" -> "Invalidate caches / Restart..." -> "Invalidate and Restart".
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/27080373

http://stackoverflow.com/q/27018327
tagged with: java
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/27020273
type: Question
upvote count: 0
answer count: 1
favorite count: 0
tagged with: osgi
type: UnansweredQuestion
has body: My Problem is ..... I have a OSGi Software and I try to combine into Eclipse as a plug-in. Is that possible to create a Eclipse plug-in UI (just like a button/menu in Eclipse) to trigger a OSGi platform? Thanks.
downvote count: 1
has title: Is that possible to create a Eclipse plug-in UI (just like a button/menu in Eclipse) to trigger a OSGi platform?
tagged with: osgi-bundle

http://stackoverflow.com/q/27013932
has answer: http://stackoverflow.com/a/27019801
type: UnansweredQuestion
type: Question
has body: I want to know what if maxindex reached in case of FixedwindowRollingPolicy. where it writes the logs. I am using it and given the maxindex as 10. once it reaches 10. i am not able to find the logs where it is writing? Please help....
tagged with: java
has title: Maxindex in FixedWindowrollingpolicy
tagged with: apache
answer count: 1
score: 0
tagged with: log4j

http://stackoverflow.com/q/27106736
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42718251
type: Question
has body: I'm not sure how to ask this, I have a subclass JPanel that draws strings with paintComponent. And I have a class that takes String string, int xPos, int yPos, Font font as arguments, the object is then drawn with g.drawString(text.getstring, etc...). However, the problem is that when the text class is constructed I would like to calculate the width and height of the text based on the string and font given, but the way to do that seems to be by doing this: FontMetrics = g.getFontMetrics(Font); int height = metrics.getHeight(); int width = metrics.stringWidth(string); the problem is that g has to be the 'Graphics' object from paintComponent, however that doesn't exist in the scope of the class, should I pass it as a parameter to the text class? Or is there a more elegant way of doing this?
accepted answer: http://stackoverflow.com/a/27107230
tagged with: jpanel
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27107230
linked to: http://stackoverflow.com/q/4914145
tagged with: swing
has title: Font dimensions in different object to JPanel

http://stackoverflow.com/a/27027365
score: 2
has comment: http://stackoverflow.com/comment/42578075
has body: So, from comments we learned that you extend Activity in the class which gets the data because you are trying to use getSystemService() and this method needs a Context...this is the wrong fix. Remove extends Activity and add a Context pram to your constructor, create a member variable such as Context mContext and pass the Activity Context to it from your actual Activity. public DownloadHandler(String s, String title, String f, Context c) throws Exception { mContext = c; and use it here downloadManager = (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE); now pass the appropriate Context DownloadHandler file = new DownloadHandler("http://mysite/"+cleanLink+"/"+fileName+".pdf", title, fileName, DownloadPosters.this); You still haven't posted the stacktrace but I suspect the issue is in the activity which shouldn't be an activity and onCreate() is never called because you aren't instantiating the Activity correctly. My answer gets you part of the way there but you need to take out the UI stuff for now until you learn how to handle that outside of an Activity. Use logs instead of Toasts in that case.
upvote count: 2
has comment: http://stackoverflow.com/comment/42577917
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27026801
has comment: http://stackoverflow.com/comment/42577795
answers question: http://stackoverflow.com/q/27026801
type: Answer
has comment: http://stackoverflow.com/comment/42578383
downvote count: 0

http://stackoverflow.com/q/27133829
has comment: http://stackoverflow.com/comment/42766180
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42766541
linked to: http://stackoverflow.com/q/16123446
score: -1
has body: So, if I declare a String object str and assign it a value, and then assign a different value to the same String object str, since String class is immutable, a new String object will be created in memory and str now points to this new object. BUT, since the older String object is now referenced by none, why couldn't that be garbage-collected immediately? I'm aware that if a new String literal is created with the same value, the same earlier object will be returned but it's less likely that it happens anyway. Is there a reason JVM doesn't run GC when it gets to know that the bad developer is creating 3 String objects in every iteration of his gigantic for loop?
has answer: http://stackoverflow.com/a/27133892
answer count: 2
has comment: http://stackoverflow.com/comment/42766316
has comment: http://stackoverflow.com/comment/42766790
upvote count: 0
tagged with: string
tagged with: jvm
favorite count: 0
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/42766643
has comment: http://stackoverflow.com/comment/42766776
has answer: http://stackoverflow.com/a/27134212
has title: Why doesn't JVM garbage-collect unreferenced String objects immediately?
tagged with: java

http://stackoverflow.com/q/27052433
has body: I'm making a library project in Java that is supposed to record data about members, books, users and borrowings. When I create a new object of the class Borrowing the system automatically notes the IssueDate. The problem happens when I try to make a record of the book being returned with and UPDATE SQL QUERY and record the ReturnDate.The query works but in DB in the corresponding field I always get 30/12/1899 as a ReturnDate. The SQL query goes like this: UPDATE Booking SET Returned = 1, ReturnDate = "+ sdf.format(getReturnDate()) +" WHERE BookingID =" + getBookingID() SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); setReturnDate(new Date()); I decided to format it to String and format dd/mm/yyyy because that is the format Access recognizes when I enter it manually and it worked with all other queries (like creating a new Booking and IssueDate) in the project and it enters the real date. I have already tried using java.sql.Date instead, switching to the US format (mm/dd/yyyy) and using # (hash marks) at the beginning and the end of the date string and none of those worked. Do you have any other ideas?
tagged with: date
score: 0
tagged with: sql
answer count: 1
has title: Insert Date in Access DB - zero date
accepted answer: http://stackoverflow.com/a/27052689
tagged with: ms-access
has comment: http://stackoverflow.com/comment/42621854
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42621915
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27052689
has comment: http://stackoverflow.com/comment/42622357

http://stackoverflow.com/q/27117589
tagged with: duplicates
has answer: http://stackoverflow.com/a/27117685
score: 0
answer count: 3
has title: Java: implement a loop with duplicate values in Array
tagged with: arrays
has answer: http://stackoverflow.com/a/27117656
possible better answer: http://stackoverflow.com/a/27117656
accepted answer: http://stackoverflow.com/a/27117685
has answer: http://stackoverflow.com/a/27117662
type: AnsweredQuestion
tagged with: java
tagged with: loops
type: Question
has body: My task is to enter names into an array. If the name has already been entered, the program must alert about that and offer to reenter the player under the same number. This is my code: public void enterNames() { for (int i=0; i&lt;nameOfPlayers.length; i++) { do { // isDuplicate is a Boolean initialized to false System.out.println("CHECK": + isDuplicate); System.out.println("Enter player " + (i+1) + ":"); nameOfPlayers[i] = in.next(); for (int k=0; k&lt;nameOfPlayers.length; k++) { if (k!=i &amp;&amp; nameOfPlayers[i].equals(nameOfPlayers[k])) { isDuplicate = true; break; } } } while (isDuplicate = false); } } Interesting, even when I enter a duplicate value, it is caught and assigns true to isDuplicate, but when it returns to the beginning of the while loop, the value is false again ("CHECK: false"). Looks like an easy task, but I am caught... Also, I did not want to use HashSet and wanted to use only Array. Thanks a lot! EDIT: Thanks to others, I rewrote the code to the following: public void enterNames() { List&lt;String&gt; nameOfPlayersList = new ArrayList&lt;String&gt;(); int i = 0; for (i=0; i&lt;numberOfPlayers;) { while(true) { System.out.println("Enter player " + (i+1) + ":"); String input = in.next(); if(!nameOfPlayersList.contains(input)) { nameOfPlayersList.add(input); i++; break; } System.out.println("Player " + input + " already exists, please retry"); } } }

http://stackoverflow.com/q/27040626
tagged with: html-parsing
type: Question
has body: I was trying to parse HTML document where I encountered the following scenario. I have put the content in the form of string in the following code. In this there is a P tag inside an anchor tag. If parsed with Jsoup, it adds an extra &lt; /a> tag and &lt; a> tags in between near #item1, changing the html structure. public class Test{ public static void main(String[] args) { String html="&lt;A HREF=\"#Item1\"&gt;\n" + "&lt;p style=\"font-family:times;margin-top:12pt;margin-left:0pt;\"&gt;\n" + "&lt;FONT SIZE=2&gt;Item&amp;nbsp;1.&lt;/FONT&gt;\n" + "&lt;/A&gt;"; Document doc = Jsoup.parse(html); System.out.println("UNPARSED = \n"+html); System.out.println("JSOUP PARSED = \n"+doc.toString()); } } OUTPUT UNPARSED = &lt;A HREF="#Item1"&gt; &lt;p style="font-family:times;margin-top:12pt;margin-left:0pt;"&gt; &lt;FONT SIZE=2&gt;Item&amp;nbsp;1.&lt;/FONT&gt; &lt;/A&gt; JSOUP PARSED = &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;a href="#Item1"&gt; &lt;/a&gt; &lt;p style="font-family:times;margin-top:12pt;margin-left:0pt;"&gt;&lt;a&gt; &lt;font size="2"&gt;Item&amp;nbsp;1.&lt;/font&gt; &lt;/a&gt;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; Is there any way to avoid the automatic tag completion using Jsoup. Thank you.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1827965
score: 0
tagged with: jsoup
accepted answer: http://stackoverflow.com/a/27048653
answer count: 1
linked to: http://stackoverflow.com/q/27150489
has title: How to turn off automatic generation of close tags </tagName> in Jsoup?
tagged with: java
has answer: http://stackoverflow.com/a/27048653

http://stackoverflow.com/a/27091898
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42690304
has body: You can use a do-while loop to get rid of the line just before the while loop: Node tmp = first; if (tmp == null) { StdOut.println(""); return; } do { StdOut.println(tmp.p.toString()); tmp = tmp.next; } while (tmp != first); There's not much else you can do to improve the method.
downvote count: 0
answers question: http://stackoverflow.com/q/27091802
accepted answer of: http://stackoverflow.com/q/27091802
score: 1

http://stackoverflow.com/a/27087193
downvote count: 0
has comment: http://stackoverflow.com/comment/42682618
score: 1
has comment: http://stackoverflow.com/comment/42682566
has comment: http://stackoverflow.com/comment/42682632
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42692258
has comment: http://stackoverflow.com/comment/42693747
accepted answer of: http://stackoverflow.com/q/27087180
type: Answer
has body: In findOccurancesOf(): if( s.charAt(i) == 1 ) { should be if( s.charAt(i) == '1' ) { to check for the character '1'. Otherwise it's looking for the character with ASCII value 1. There is an out of bounds exception because if findOccuranceOf() returns the wrong value, then notes[i] is not constructed with the correct length in the following line of convertToScale(): notes[i] = new String[findOccurancesOf(e[i])]; In addition, you probably want to use something like: notes[i][c++] = Integer.toString(x + 1); with some counter c initialized to 0, if I understand your intentions correctly.
answers question: http://stackoverflow.com/q/27087180

http://stackoverflow.com/q/27134118
tagged with: linux
upvote count: 1
answer count: 1
favorite count: 0
tagged with: c++
has body: I have a java program to which I made some optimization by doing part of the code in C++. I included the C++ executable in the self contained runnable jar. When the program runs and I need to use this executable I extract it to the current folder and run it. The problem that I found is that when I extract the file it no longer seems to be considered an executable. The file works perfectly fine before it is compressed into the jar but I cannot run it in the shell after extracting. I also tried using the java "jar xf" command to extract the file and see if there was a bug on my code and I still find the same problem. My current version of java is 1.7.0.51 and I'm making the program to run on computers that are stuck on this version of java for now.
has comment: http://stackoverflow.com/comment/42766727
accepted answer: http://stackoverflow.com/a/27158014
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42810172
downvote count: 0
has comment: http://stackoverflow.com/comment/42766758
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27158014
type: Question
has title: Executable won't work after extracted from jar
tagged with: jar
has comment: http://stackoverflow.com/comment/42767025

http://stackoverflow.com/comment/42769151
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27135033
has text: @ManeatingKoala So what? It's not at all uncommon to ask something like "XXX language has such-and-such feature, does YYY language have something similar"? That takes place even when the languages XXX and YYY don't have similar names.

http://stackoverflow.com/a/27108767
has comment: http://stackoverflow.com/comment/42720450
type: Answer
answers question: http://stackoverflow.com/q/27108641
upvote count: 5
has body: Daughter's constructor invokes the Mother constructor, which invokes maker(). In C++, at least, the object is only considered to be a Mother at this point as the Daughter construction is incomplete. Thus Mother::maker() is invoked, so this is doing the correct thing. However, it is generally considered a strong code smell to invoke virtual functions during construction - for exactly these sorts of reasons. In Java, apparently the sub-class overrides are always called, even during construction, and as a result constructors in Java should never call overridable methods. Doing so can lead to undefined behavior. There is a very nice explanation of this here.
score: 5
downvote count: 0

http://stackoverflow.com/comment/42564654
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27019809
has text: thank you so much guy, i worked on this for about two hours, and now i fell like a stupid :)
type: AnswerComment

http://stackoverflow.com/comment/42559351
has text: @Bathsheba: To do that, you'll have to first rewrite the code in C++.
comment on: http://stackoverflow.com/a/27016869
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27107794
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42933272
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42720299
tagged with: javascript
tagged with: jquery
has body: In blueimp JQuery fileupload the backend I am using is struts 2. I want to send reponse image preview. Am getting image name and size except the image preview and href. Fire bug: Photo-0010.jpg 310.12 KB I am not doing anything to get the title of the image, just getting the files and uploading in a path in action class. I don't know where its getting the name of the image but why not the href link. I tried to display using <img src="<s:property value="filesFileName"/>"/> but its not working. It is going to "// Callback for failed (abort or error) uploads: fail: function (e, data) " in jquery.fileupload-ui.js I want to display the image preview and `href`. Can anyone help?
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/42724645
has comment: http://stackoverflow.com/comment/42718766
has title: java - Error Internal Server Error” in blueimp

http://stackoverflow.com/a/27080715
score: 2
has body: If you know the number of lines in the cvs file then you can do the following to skip all lines before the last line: CSVReader reader = new CSVReader(new FileReader(file), ',', '\'', num_of_lines-1);
answers question: http://stackoverflow.com/q/27080669
has comment: http://stackoverflow.com/comment/42671201
upvote count: 2
type: Answer
downvote count: 0

http://stackoverflow.com/a/27015703
has comment: http://stackoverflow.com/comment/42557956
answers question: http://stackoverflow.com/q/27015236
has comment: http://stackoverflow.com/comment/42558044
upvote count: 1
has comment: http://stackoverflow.com/comment/42556799
has body: Probably fastest way is write own simple application to do this operation.
type: Answer
has comment: http://stackoverflow.com/comment/42556788
downvote count: 0
score: 1

http://stackoverflow.com/comment/42718940
type: Comment
has text: You have to set path for java in your environment variables
comment on: http://stackoverflow.com/q/27107750
score: 0
type: QuestionComment

http://stackoverflow.com/a/27139777
has comment: http://stackoverflow.com/comment/42785757
answers question: http://stackoverflow.com/q/27139659
has comment: http://stackoverflow.com/comment/42783327
has body: There are a couple of ways to do this, depending on what you actually want. I think that you should delete the old image and create a new one to the right. You should probably just change the LayoutParameters like this: As long as you have your ImageView (or whatever it is) initialized in your onCreate() method, you can set a new location for it with this code: AbsoluteLayout.LayoutParams param = new AbsoluteLayout.LayoutParams(int width, int height, int x, int y) myImageView.setLayoutParams(param); Where x is the new x value that you want, y is the new y value that you want, and the width and height are the width and height of your ImageView. You can get the current width and height with myImageView.getWidth() and myImageView.getHeight(). For the current x value, use myImageView.getLeft(), and for the current y value, use myImageView.getTop(). Let me know if you need anything else.
score: 0
has comment: http://stackoverflow.com/comment/42796938
type: Answer

http://stackoverflow.com/a/27046672
upvote count: 1
answers question: http://stackoverflow.com/q/27037364
has comment: http://stackoverflow.com/comment/42705130
score: 1
has body: You'll find the Java code to decrypt the ciphertext below. A couple of notes first: server-side code uses commons-codec for hex decoder in client-side code, replace key parameter to encrypt function with CryptoJS.enc.Hex.parse(key) That should be it. And now the code ... public class Decryptor { private static final String IV = "3ad5485e60a4fecde36fa49ff63817dc"; private static final String KEY = "0a948a068f5d4d8b9cc45df90b58d382d2b916c25822b6f74ea96fe6823132f4"; private final static String CIPHERTEXT = "4E6B9EC6B5A0614BF9D69C5B0B5AE03D27484F2DB9D450E50EE623E80B8E34F5"; public static final void main(String[] args) throws DecoderException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { SecretKeySpec sks = new SecretKeySpec(Hex.decodeHex(KEY.toCharArray()), "AES"); IvParameterSpec iv = new IvParameterSpec(Hex.decodeHex(IV.toCharArray())); Cipher c = Cipher.getInstance("AES/CBC/NoPadding"); c.init(Cipher.DECRYPT_MODE, sks, iv); byte[] plain = c.doFinal(Hex.decodeHex(CIPHERTEXT.toCharArray())); String plainText = new String(plain); System.out.println(plainText); } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42710138
has comment: http://stackoverflow.com/comment/42703089
accepted answer of: http://stackoverflow.com/q/27037364
type: Answer

http://stackoverflow.com/a/27031777
has comment: http://stackoverflow.com/comment/42585671
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27031639
type: Answer
answers question: http://stackoverflow.com/q/27031639
score: 2
has body: It is a compilation error because ArrayList&lt;Library&lt;?&gt;&gt; is not a supertype of ArrayList&lt;Library&lt;Photo&gt;. You can declare the array like this: ArrayList&lt;ArrayList&lt;? extends Library&lt;?&gt;&gt;&gt; listTopLibrary = new ArrayList&lt;&gt;(); A thorough explanation why can be found at Java nested generic type
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/27101988
type: AcceptedAnswer
downvote count: 0
score: 19
type: Answer
upvote count: 19
accepted answer of: http://stackoverflow.com/q/27101931
answers question: http://stackoverflow.com/q/27101931
has body: You have not specified the name attribute , @RequestParam("textFile") requires name , &lt;input type="file" class="file" name="textFile"/&gt;

http://stackoverflow.com/q/27075767
score: 0
has comment: http://stackoverflow.com/comment/42662865
answer count: 1
has comment: http://stackoverflow.com/comment/42662888
favorite count: 0
tagged with: android-studio
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27075939
tagged with: java
upvote count: 1
has title: How can I get Position from ArrayList<>
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27075939
has comment: http://stackoverflow.com/comment/42662762
has body: /** * Created by myozawoo on 11/21/14. */ public class GridActivity extends Activity { GridView gridView; ArrayList&lt;Item&gt; gridArray = new ArrayList&lt;Item&gt;(); CustomGridViewAdapter customGridAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 0); setContentView(R.layout.activity_grid); //set grid view item final Bitmap one = BitmapFactory.decodeResource(this.getResources(), R.drawable.one); Bitmap two = BitmapFactory.decodeResource(this.getResources(), R.drawable.two); Bitmap three = BitmapFactory.decodeResource(this.getResources(), R.drawable.three); Bitmap four = BitmapFactory.decodeResource(this.getResources(), R.drawable.four); Bitmap five = BitmapFactory.decodeResource(this.getResources(), R.drawable.five); Bitmap six = BitmapFactory.decodeResource(this.getResources(), R.drawable.six); gridArray.add(new Item(one,"Text One")); gridArray.add(new Item(two,"Text Two")); gridArray.add(new Item(three,"Text Three")); gridArray.add(new Item(four,"Text Four")); gridArray.add(new Item(five,"Text Five")); gridArray.add(new Item(six,"Text Six")); //I want the position from this array gridView = (GridView) findViewById(R.id.gridView); customGridAdapter = new CustomGridViewAdapter(this, R.layout.custom_cell, gridArray); gridView.setAdapter(customGridAdapter); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long l) { Intent intent = new Intent(getBaseContext(), MainActivity.class); intent.putExtra("page", gridArray.get(position).toString()); startActivity(intent); Toast.makeText(getApplicationContext(), gridArray.get(position).toString(), Toast.LENGTH_SHORT).show(); } }); } } I want the static position such as 1,2. But I'm not getting it.
tagged with: arraylist

http://stackoverflow.com/q/27085583
has title: Java error when running Mapreduce program
has body: I have a MapReduce Program which aggregates the total stock volume in a stock exchange data set. I have compiled &amp; created a jar file without any errors. But when i run the jar on Hadoop cluster it throws me a java class notfound exception. I am new to java and any help will be greatly appreciated cloudera@cloudera-vm:~$ hadoop jar NYSE.jar -D com.rashmi.mapreduce.NYSE.NYSEJob /user/NYSE/NASDAQ_daily_prices_A_sample.csv /user/NYSE/outputException in thread "main" java.lang.ClassNotFoundException: -D 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:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.apache.hadoop.util.RunJar.main(RunJar.java:179)
has comment: http://stackoverflow.com/comment/42680170
type: Question
tagged with: java
tagged with: hadoop
score: 0
has answer: http://stackoverflow.com/a/27106192
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/27108318
tagged with: jtree
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27135296
has title: Java JTree's ui refresh after removing node from parent
linked to: http://stackoverflow.com/q/8210630
answer count: 1
downvote count: 0
favorite count: 0
has body: when I remove a node from a Jtree, sometimes other nodes's jlabels are not refreshed and the text is cut off therefore displaying three dots "..." because the jlabel has the width of the previous node that was removed and the UI didn't refreshed as requested in the code. I believe I'm managing nodes properly and refreshing the UI properly, but I guess either I'm missing something in my code or I am completely doing it wrong. I'm hoping someone can help me. Here is an example of my JTree: RootNode ParentNodeA ChildNodeA1 ChildNodeA2 ParentNodeB ChildNodeB1_hithere ChildNodeB2_imlost ChildNodeB3_whoisthere ChildNodeB4_dude Say I want to add a node "ChildNodeA3" to ParentNodeA. I call the function addNodeToTree() by providing the JTree object and a string array with the path I want the new node to go, ie: [RootNode, ParentNodeA]. When I want to remove a node, say "ChildNodeB2_imlost", I call the function removeNodeFromTree(tree, [RootNode, ParentNodeB, ChildNodeB2_imlost]) which I provide the jtree object and a string array with the complete path to the node that is to be removed. When I remove the node, other nodes jlabels UI is not refreshed in their new position and still hold their original width at their last position and now doesn't wrap around the text of their new position, therefore showing the three dots. In the code below, I'm validating the path and expanding parent nodes as necessary in order to find the node to be removed. Once the node is removed, I used the tree model to reload the parent node of the node that was removed to reload the UI, but still doesn't work. public void removeNodeFromTree(JTree tree, String[] path) { TreePath treepath = null; for (String section : path) { int row = (treepath == null ? 0 : tree.getRowForPath(treepath)); // Expand the current tree path because it seems that if the current tree // path is collapsed, getNextMatch() returns null even though the node we are // looking for exists. Not sure if this is a bug in JTree.getNex…
has comment: http://stackoverflow.com/comment/42767843
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27135296
type: Question
has comment: http://stackoverflow.com/comment/42748575

http://stackoverflow.com/comment/42574242
score: 0
has text: I can see using this as a way to manage if the extension is supported however I keep getting the error java.lang.UnsatisfiedLinkError: no jdic in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860) at java.lang.Runtime.loadLibrary0(Runtime.java:845) at java.lang.System.loadLibrary(System.java:1084)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27022600

http://stackoverflow.com/q/27137494
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42775490
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/26002948
tagged with: x11-forwarding
upvote count: 1
has comment: http://stackoverflow.com/comment/42774986
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/27141359
answer count: 1
tagged with: ssh
has answer: http://stackoverflow.com/a/27141359
favorite count: 0
tagged with: jcombobox
has body: Symptoms: click on a drop down list, it takes ~14 seconds for the list of all options under it to display all other UI elements are interactive; there's no visible delay takes only 14ms to ping the host I am sshing into How can I speed the the responsiveness of the drop down lists? Commands that I ran: ping &lt;destination host&gt; PING &lt;destination host&gt; (&lt;destination ip&gt;) 56(84) bytes of data. 64 bytes from &lt;destination host&gt; (&lt;destination ip&gt;): icmp_seq=1 ttl=50 time=16.4 ms ssh -X &lt;destination host&gt; java -cp &lt;class path stuff&gt; &lt;class with main method that initializes the UI&gt; Client Machine Information: ssh -V OpenSSH_6.6.1p1 Ubuntu-2ubuntu2, OpenSSL 1.0.1f 6 Jan 2014 cat /etc/*-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS" Server Machine Information: sshd -V sshd: illegal option -- V OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012 usage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file] [-f config_file] [-g login_grace_time] [-h host_key_file] [-k key_gen_time] [-o option] [-p port] [-u len] java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) cat /etc/*-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 DISTRIB_CODENAME=precise DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"
has comment: http://stackoverflow.com/comment/42780132
has title: ssh -X (X11 forwarding) java swing application has slow drop down lists

http://stackoverflow.com/comment/59646335
has text: I have confirm this to be working. I save a copy of args and change it with the new url.tostring() and bootstrap.setConfig...(new UrlConfig...).
type: Comment
comment on: http://stackoverflow.com/a/26997556
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42681853
type: Comment
has text: The sentence "declaring no constructor that is public" means "not declaring any public constructors". Could have been worded more clearly in the JLS.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27086773

http://stackoverflow.com/a/27074752
has comment: http://stackoverflow.com/comment/42661710
type: Answer
has comment: http://stackoverflow.com/comment/42661704
downvote count: 0
score: 1
has body: change System.out.println (actualWord.indexOf('at')); to System.out.println (actualWord.indexOf("at")); 'at' is invalid character literal
answers question: http://stackoverflow.com/q/27074734
upvote count: 1
has comment: http://stackoverflow.com/comment/42661244

http://stackoverflow.com/comment/42716623
type: Comment
has text: have edited my code in the comments to match this, running it but getting a 404. any idea? or need to see more code?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27106383

http://stackoverflow.com/comment/51550697
type: AnswerComment
comment on: http://stackoverflow.com/a/27169549
type: Comment
score: 1
has text: This worked for me as well, which was expected. Syntax highlighting a file with 18k lines is just not possible (and I curse the guy who created this file)....

http://stackoverflow.com/comment/42768880
comment on: http://stackoverflow.com/a/27134690
type: Comment
score: 0
type: AnswerComment
has text: so it is needed to create a physical file on the server?

http://stackoverflow.com/a/27018152
has body: use Gson (or any other json parser) to parse the data into Map, remove the non strings, serialize back to json using Gson
upvote count: 3
type: Answer
score: 3
answers question: http://stackoverflow.com/q/27018091
downvote count: 0

http://stackoverflow.com/q/27108992
has body: Coming from a relational db background I find it easy to break apart user and their roles into normalized tables. But what is the customary way to do this in a mongo database? Scenario I have ({ "roles" : [ {"role": "user"}, {"role": "manager"}, {"role": "admin"} ] "privileges" : [ {"privilege": "READ"}, {"privilege": "READ/WRITE"}, {"privilege": "ALL"} ] "users" : [ {"user": "Sammy"}, {"user": "Tom"}, {"user": "Fred"}, {"user": "Zack"} ] "userPermissions" : [ {"admin": "Sammy"}, {"manager": "Tom"}, {"user": "Fred"}, {"user": "Zack"} ] }) Question : Is this an appropriate way to model user roles in Mongo?
has comment: http://stackoverflow.com/comment/42720909
has answer: http://stackoverflow.com/a/43501597
type: AnsweredQuestion
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/43501597
has title: What is a good way to define user roles in a mongo database
type: Question
has comment: http://stackoverflow.com/comment/42721638
has comment: http://stackoverflow.com/comment/42721246
tagged with: mongodb
answer count: 2
has answer: http://stackoverflow.com/a/27109387
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42721526
accepted answer: http://stackoverflow.com/a/27109387
favorite count: 0
tagged with: user-roles

solr
tags question: http://stackoverflow.com/q/27145905
tags question: http://stackoverflow.com/q/27108075
tags question: http://stackoverflow.com/q/27147960
tags question: http://stackoverflow.com/q/27056663
tags question: http://stackoverflow.com/q/27038794
tags question: http://stackoverflow.com/q/27012774
tag name: solr
tags question: http://stackoverflow.com/q/27094295
tags question: http://stackoverflow.com/q/27108200
tags question: http://stackoverflow.com/q/27058991
tags question: http://stackoverflow.com/q/27041989
tags question: http://stackoverflow.com/q/27064729
type: Tag
tags question: http://stackoverflow.com/q/27011413

http://stackoverflow.com/a/27093591
answers question: http://stackoverflow.com/q/27093345
has body: I would highly recommend putting the number into a String and then reading it, parsing it, and use the number however you want. As follows, int input = 12345; String inputString = input + ""; int sum = 0; for (int i = 0; i &lt; inputString.length(); i++) { sum += Integer.parseInt(inputString.charAt(i) + ""); } System.out.println(sum); However an alternative way, not as pretty is.. int input = 12345; int sum = 0; while (input &gt; 0) { int i = (input + "").length() - 1; int n = (int) (input / Math.pow(10, i)); input -= (int) (n * Math.pow(10, i)); sum += n; } System.out.println(sum);
score: 0
type: Answer

http://stackoverflow.com/q/27029185
score: 0
answer count: 3
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
tagged with: hadoop
has answer: http://stackoverflow.com/a/27041057
has title: Eclipse - Run on Hadoop does not prompt anything
type: Question
has comment: http://stackoverflow.com/comment/42622927
has body: Im trying to build a simple Wordcount Hadoop project(https://developer.yahoo.com/hadoop/tutorial/module3.html#running) but when I click "Run on Hadoop" there is no action at all...Infact nothing is displayed in the console. Here is my project structure - Here is my wordcount job file... import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.FileInputFormat; import org.apache.hadoop.mapred.FileOutputFormat; import org.apache.hadoop.mapred.JobClient; import org.apache.hadoop.mapred.JobConf; public class WordCount { public static void main(String[] args) { Configuration config = new Configuration(); config.addResource(new Path("/HADOOP_HOME/conf/hadoop-default.xml")); config.addResource(new Path("/HADOOP_HOME/conf/hadoop-site.xml")); JobClient client = new JobClient(); JobConf conf = new JobConf(WordCount.class); // specify output types conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(IntWritable.class); // specify input and output dirs FileInputPath.addInputPath(conf, new Path("input")); FileOutputPath.addOutputPath(conf, new Path("output")); // specify a mapper conf.setMapperClass(WordCountMapper.class); // specify a reducer conf.setReducerClass(WordCountReducer.class); conf.setCombinerClass(WordCountReducer.class); client.setConf(conf); try { JobClient.runJob(conf); } catch (Exception e) { e.printStackTrace(); } }
has answer: http://stackoverflow.com/a/29162173
has answer: http://stackoverflow.com/a/27031120

http://stackoverflow.com/comment/42689927
score: 0
has text: but i need it. maybe you could recommend a different approach? i intend to store multiple string lines
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27091471

http://stackoverflow.com/q/27016449
has comment: http://stackoverflow.com/comment/42559013
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42561607
has title: cannot receive udp broadcast packet on android
has comment: http://stackoverflow.com/comment/42563293
type: Question
has comment: http://stackoverflow.com/comment/42558276
has comment: http://stackoverflow.com/comment/42560081
has comment: http://stackoverflow.com/comment/42559584
has comment: http://stackoverflow.com/comment/42558411
has comment: http://stackoverflow.com/comment/42558783
has body: I am trying to receive udp packets being sent from another android machine.II can receive the same packets over java udp client program however same not working on android. here is my code: //Main Activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.v("Main Activity", "intialized started"); list = (ListView) findViewById(R.id.listview1); mainWifiObj = (WifiManager) getSystemService(Context.WIFI_SERVICE); wifiReciever = new WifiScanReceiver(); mainWifiObj.startScan(); Log.v("Main Activity", "MainActivity started"); clientDatagramReceiver=new ClientDatagramReceiver(); clientDatagramReceiver.start(); //clientdatagramreceiver class import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; import android.util.Log; import android.widget.Toast; public class ClientDatagramReceiver extends Thread { private DatagramSocket datagramsocket = null; private boolean bKeepRunning = true; InetAddress serverIP=null; public ClientDatagramReceiver() { try { datagramsocket = new DatagramSocket(7999); Log.v("ClientDatagramSender", "Socket Created"); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); Log.v("ClientDatagramSender", "Socket Unicast SET"); } } public void run() { byte[] messageBytes = new byte[10]; DatagramPacket packet = null; while(this.bKeepRunning) { packet = new DatagramPacket(messageBytes, 10); Log.d("ClientDatagramReceiver", "RECEIVING PACKET CREATED"); try { datagramsocket.receive(packet); Log.d("ClientDatagramReceiver", "INCOMING PACKET RECEIVED"); } catch (IOException e) { e.printStackTrace(); } serverIP=packet.getAddress(); Log.d("ClientDatagramReceiver", "IP ADDRESS of REMOTE SENDER: " + serverIP.getHostAddress()); ServerIpHelper.setServerIP(serverIP); ClientDatagramSender.killAllThreads(); Log.d("ClientDatagramReceiver", "STOPPING BROADCAST SERVICE");…
has comment: http://stackoverflow.com/comment/42562090
score: 0
has comment: http://stackoverflow.com/comment/42561761
has comment: http://stackoverflow.com/comment/42558337
has comment: http://stackoverflow.com/comment/42558535
has comment: http://stackoverflow.com/comment/42559811
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42558791
tagged with: android
has comment: http://stackoverflow.com/comment/42558820
has comment: http://stackoverflow.com/comment/42559935
has comment: http://stackoverflow.com/comment/42561722
has comment: http://stackoverflow.com/comment/42562249
has comment: http://stackoverflow.com/comment/42558496

http://stackoverflow.com/comment/42593939
has text: Will take a look at JavaCPP, tied with JNA (jnaerator) allready, but somehow the resulting class in the generated jar does not contain any functions.
type: Comment
comment on: http://stackoverflow.com/q/27012567
score: 0
type: QuestionComment

http://stackoverflow.com/q/27147341
has answer: http://stackoverflow.com/a/27205896
tagged with: netbeans
tagged with: netbeans-platform
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27205896
type: Question
has title: Customize properties sheet of a BeanNode in Netbeans
score: 0
has body: I have consulted the Node API, and some examples like HERE. My problem is to customize the properties sheet of a BeanNode so that I hide the "Properties" and create my own one. For that, usuallay I have to override createSheet() method, and this is my code (in fact I want to show only the "Expert" sheet. @Override protected Sheet createSheet() { Sheet sheet = super.createSheet(); Sheet.Set set = Sheet.createExpertSet(); TUser user = getLookup().lookup(TUser.class); try { Property loginProp = new PropertySupport.Reflection(user, String.class, "getLogin", null); loginProp.setName("Login"); set.put(loginProp); } catch (NoSuchMethodException ex) { ErrorManager.getDefault(); } sheet.remove(Sheet.PROPERTIES); sheet.put(set); return sheet; } What I got is: How can I hide Properties sheet and show only the Expert one?
answer count: 1

http://stackoverflow.com/q/27130434
has title: How to calculate a safe cache size?
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27131139
tagged with: ehcache
has body: I have a feature which calls out to an upstream service and loads some content. The content being loaded is only updated about once every 4 hours making it a good candidate for caching. Is there a process/algorithm or set of steps I can follow to calculate the optimal cache size which will not effect the overall performance of my application servers? Something like Calculate size of each object being cached Calculate the number of items which could potentially be cached ( this would be the total number of all requests for the feature in question) Calculate the delta between the amount of memory each of the application server JVM's has versus what it is using. Somehow calculate a safe percentage of this delta which could be used? Calculate the number of objects based on the value calculated in the above step Step 4 is particularly vague, if anyone can provide some process for calculating cache it would really help.
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42760782
accepted answer: http://stackoverflow.com/a/27131139
tagged with: java
has comment: http://stackoverflow.com/comment/42761363

http://stackoverflow.com/q/27124121
has body: I want to change the Name of the tab After save an created Document and when I create a New Document the cursor is not placing/focus in TextArea,when I click on textarea then only it focus.How can I achive Auto focus on Textarea.In My Application when I create a new Document,It open with a Empty Doc with the Tab name of Doc 1/Doc 2/Doc 3....When I enter a Text and save through "Save" menu Item,I want to replace Doc 1 with the given file Name.Please Check it Both.Thank you. My Code: public class TabbedPaneFocus extends javax.swing.JFrame { JTextArea textArea; int i=0; JTabbedPane tabbedPane; public TabbedPaneFocus() { initComponents(); tabbedPane=new CloseButtonTabbedPane(); add(tabbedPane); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 512, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE) ); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); create = new javax.swing.JMenuItem(); save = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jMenu1.setText("File"); create.setText("Create"); create.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { createActionPerformed(evt); } }); jMenu1.add(create); save.setText("Save"); save.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveActionPerformed(evt); } }); jMenu1.add(s…
tagged with: java
has answer: http://stackoverflow.com/a/27127761
score: -1
type: Question
accepted answer: http://stackoverflow.com/a/27127761
has comment: http://stackoverflow.com/comment/42751782
tagged with: jtextarea
upvote count: 0
answer count: 1
favorite count: 0
tagged with: jtabbedpane
tagged with: focus
has comment: http://stackoverflow.com/comment/42749167
has title: How To Change The Tab Name in JTabbedPane
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/42752149
type: Comment
has text: Awesome, it works, it doesn't print out the numbers in order but in this case that is not relevant. To the other answer that appears to be deleted I will look into AtomicInteger but I am going to choose this answer as correct as soon as I am allowed to. THANKS!!!!!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27126168

http://stackoverflow.com/comment/42718455
score: 0
type: Comment
has text: yes this is great. it is working.the array[0] gets value datadatadatadatadatadata and all the other array[1], array[2] is null. how do i divide lines to whole array?
type: AnswerComment
comment on: http://stackoverflow.com/a/27107356

http://stackoverflow.com/q/27012901
possible better answer: http://stackoverflow.com/a/27013868
type: Question
has answer: http://stackoverflow.com/a/27013868
has comment: http://stackoverflow.com/comment/42553442
has comment: http://stackoverflow.com/comment/42552266
has answer: http://stackoverflow.com/a/27013452
upvote count: 3
score: 0
has comment: http://stackoverflow.com/comment/42552139
has comment: http://stackoverflow.com/comment/42552107
has title: java.text.ParseException: Unparseable date: "531772200000"
downvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/42552298
has comment: http://stackoverflow.com/comment/42552160
favorite count: 0
has comment: http://stackoverflow.com/comment/42552213
tagged with: string-parsing
has comment: http://stackoverflow.com/comment/42552215
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27012986
tagged with: java
accepted answer: http://stackoverflow.com/a/27012986
has body: I need to convert the string 531772200000 to a Java Date object. The date is stored in a database. When I am doing this, I am getting java.text.ParseException: Unparseable date: "531772200000". My code: String dateToBeConverted = String.valueOf(dbObject.get("customerDateOfBirth")); String parseabledate = dateToBeConverted .replace("/Date(","") .replace(")/","") .replace("+0530", ""); dbObject.put("_id", String.valueOf(dbObject.get("userInfoId"))); SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy"); Date date; date = formatter.parse(parseabledate);
has comment: http://stackoverflow.com/comment/42552102

http://stackoverflow.com/q/27088926
has body: I'm writing a small Eclipse plug-in and some tests for it. I'm starting the plug-in tests by specifying them to run in Headless Mode. I want to access the active Java projects within the workspace in those tests, but when I execute them, the workspace is empty. I use the following code to get all Java projects (which works fine): IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); for(IProject project : myWorkspaceRoot.getProjects()) { if(project.isOpen() &amp;&amp; isJavaProject(project)) { IJavaProject javaProject = JavaCore.create(project); projects.put(project.getName(), javaProject); } } However, the projects are always empty. This is due to the fact that the Headless Mode starts a new Eclipse instance with an empty workspace I guess. My question is: can I somehow either specify that the tests should run in the current Eclipse instance OR can I specify the projects I want to have in the newly created workspace?
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27806188
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42688434
favorite count: 0
has title: Run Eclipse Plug-in Test with included workspace projects
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42727670
upvote count: 3
has answer: http://stackoverflow.com/a/27806188
tagged with: plugins
answer count: 1

http://stackoverflow.com/comment/114518943
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27008250
has text: I highly doubt you tested it with 10000, not only will this solution loop forever, but also 2^10000 is such a big number that I'm not sure if any computer ever counted towards that...

http://stackoverflow.com/a/27089088
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42685710
accepted answer of: http://stackoverflow.com/q/27089020
answers question: http://stackoverflow.com/q/27089020
has body: You can reset the seconds and minutes at the end of each loop : int m = minute; int s = second; for (int i = hour; i &lt; 24; i++) { for (int j = m; j &lt; 60; j++) { for (int k = s; k &lt; 60; k++) { .... } s = 0; } m = 0; }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27117925
has comment: http://stackoverflow.com/comment/42737991
type: Question
answer count: 2
has title: Equal Spacing In print statements
possible better answer: http://stackoverflow.com/a/27118198
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/27117955
has body: So I was just about finished with a small little program and when I ran it everything worked fine. I did have 1 small technical issue that I didnt like and it was an unevenly spaced "table" if you would. In a nutshell I want it so my outputs are aligned on both sides. Original output: How many numbers should be generated? 10 What is the number of values of each random draw? 1000 - 1 108 - 2 90 - 3 101 - 4 98 - 5 117 - 6 97 - 7 89 - 8 111 - 9 93 - 10 96 Code: import java.util.Random; import java.util.Scanner; public class tester { public static void main(String[] args) { Random rnum = new Random(); Scanner in = new Scanner(System.in); int x = 0; int y = 0; int num = 0; int length = 0; System.out.println("How many numbers should be generated?"); x = in.nextInt(); System.out.println("What is the number of values of each random draw?"); y = in.nextInt(); int[] roll = new int[x]; for(int i = 1; i&lt;=y; i++){ num = rnum.nextInt(x); roll[num] = roll[num] + 1; } length = (int) Math.log10(x) + 1; for(int i = 0; i &lt; x; i++){ System.out.println(i+1 + " " + roll[i]); //This is the code that prints the original output /* * This is the code I attempted that did not give the desired result * a = i; System.out.println(i+1); while(Math.log10(i) &lt; length){ System.out.print(" "); length--; } System.out.print(roll[i]);*/ } } }
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27118198
has answer: http://stackoverflow.com/a/27117955

http://stackoverflow.com/q/27047309
has body: I want to maintain connection pooling into my java/spring application. For this i used spring configuration file. Which looks like this &lt;bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"&gt; &lt;property name="driverClassName" value="${db.driver}"/&gt; &lt;property name="url" value="${db.jdbcurl}"/&gt; &lt;property name="username" value="${db.username}"/&gt; &lt;property name="password" value="${db.password}"/&gt; &lt;property name="initialSize" value="3"/&gt; T &lt;property name="maxActive" value="100"/&gt; &lt;/bean&gt; This application war is hosted into tomcat. When i saw tomcat context.xml file which is set by some network team. Context.xml file also contain some configuration regarding the connection pooling.It looks like this &lt;Context&gt; &lt;Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource" username="naveen" password="12345" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql:localhost:3306/cyl" maxActive="15" maxIdle="3"/&gt; &lt;/Context&gt; Now i have two question to asked 1) Which connection pool configuration will apply when application runs. 2) If we have multiple war a.war(with connection pool config), b.war(with out CPC), c.war(without CPC) then, will tomcat connection pool setting will apply to all application. 3) what can be max value for maxActive attribute. Thanks in advance
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/42613184
type: UnansweredQuestion
tagged with: spring
score: 3
answer count: 0
tagged with: java
type: Question
upvote count: 3
has comment: http://stackoverflow.com/comment/42613082
downvote count: 0
has title: Does Application connection pooling override Tomcat connection pooling

http://stackoverflow.com/comment/42775626
score: 0
has text: This question appears to be off-topic because it is a homework dump, one that he is repeatedly dumping on us (see [repeat question](http://stackoverflow.com/questions/27138512/doing-employee-data-using-2d-arrays)).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27136655

http://stackoverflow.com/q/27149415
has answer: http://stackoverflow.com/a/27150984
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27150984
upvote count: 1
type: Question
has body: I have read a lot of about the way to provide acces to a REST API and I still cannot come with a decision what to use. In my case I am writing a REST API that will be used by the users of the mobile application(android&amp;iOS), thus I do not provide or require access from third parties and this makes me think that I don't have to use OAuth. However I have considerations about how to provide access of one user's account from multiple devices and how to provide offline access. Another consideration I have is how should I restrict the API access, for example if using API Tokens what are the best practices for expiration and renewal of the tokens?
has title: REST API Authorization type
tagged with: jersey
answer count: 2
tagged with: api
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27150327
tagged with: rest
possible better answer: http://stackoverflow.com/a/27150327

http://stackoverflow.com/comment/78827849
comment on: http://stackoverflow.com/a/37675253
type: AnswerComment
score: 0
type: Comment
has text: another solution is to use setFixedLengthStreamingMode(contentLength) which solves your requesting time perspective. read this https://issuetracker.google.com/issues/37036206

http://stackoverflow.com/q/27094466
upvote count: 1
favorite count: 0
has title: Injection Service Spring on ManagedBean Failed NPE
tagged with: spring
type: AnsweredQuestion
tagged with: jsf
tagged with: primefaces
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27114988
accepted answer: http://stackoverflow.com/a/27114988
possible better answer: http://stackoverflow.com/a/27094963
type: Question
downvote count: 0
has body: Using, Spring 3, Hibernate 4, JSF 2.0, PrimeFaces My Spring config: <context:component-scan base-package="com.tds.erp"/> <context:annotation-config/> <context:spring-configured/> org.hibernate.dialect.DB2400Dialect true <tx:annotation-driven transaction-manager="txManager"/> My Web.xml: contextConfigLocation /WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener javax.faces.PROJECT_STAGE Development faces/index.xhtml Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet /faces/* Faces Servlet *.jsf Faces Servlet *.faces Faces Servlet *.xhtml FacesConfig.xml: org.springframework.web.jsf.el.SpringBeanFacesELResolver ManagedBean: @ManagedBean(name="UserErpMB") @Scope(value="request") public class UserErpManagedBean implements Serializable { private static final long serialVersionUID = 1L; private static final String SUCCESS = "success"; private static final String ERROR = "error"; //Spring UserErp Service is injected... @ManagedProperty("#{IUserErpService}") private IUserErpService iUserErpService ; // getter and setter for this. //THIS IS NULL! } I try to inject UserErpService in my managedBean, but its always be Null!! NPE this is my UserErpServiceImpl: @Service @Transactional (readOnly=true) public class UserErpServiceImpl implements IUserErpService { @Autowired IUserErpDao iuserdao; @Override @Transactional (propagation = Propagation.REQUIRED, readOnly=false) public void addUser(UserErp user) { // TODO Auto-generated method stub System.out.println("Service Impl"); iuserdao.addUser(user); } I got this exception: nov. 23, 2014 10:48:06 PM com.sun.faces.lifecycle.InvokeApplicationPhase execute AVERTISSEMENT: #{UserErpMB.addUserErp}: java.lang.NullPointerException javax.faces.FacesException: #{UserErpMB.addUserErp}: java.lang.NullPointerException at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) at javax.faces.component.UIComman…
has answer: http://stackoverflow.com/a/27125326
has answer: http://stackoverflow.com/a/27094963
answer count: 3

http://stackoverflow.com/comment/42698138
type: QuestionComment
has text: @JasonC Thanks Jason, I didn't think of that. I will try using this method!
score: 0
comment on: http://stackoverflow.com/q/27096374
type: Comment

http://stackoverflow.com/comment/42751199
score: 0
type: Comment
has text: i will try these steps give me bout 3 mins
comment on: http://stackoverflow.com/a/27125606
type: AnswerComment

http://stackoverflow.com/comment/42653467
comment on: http://stackoverflow.com/a/27028297
type: Comment
score: 0
has text: I'm begging you, please show me how to ask for input in the loop, I've been at this for hours and I cannot get this assignment.
type: AnswerComment

http://stackoverflow.com/a/27070329
upvote count: 1
has comment: http://stackoverflow.com/comment/47779970
answers question: http://stackoverflow.com/q/27070231
type: AcceptedAnswer
downvote count: 0
has body: int Neighbours(int x, int y) is called with x=0 and y=0, right? How do you then evaluate grid[y-1][x-1]?
has comment: http://stackoverflow.com/comment/42655520
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/27070231

http://stackoverflow.com/q/26995607
has title: find unique elements from sorted array with complexity < O(n)
has comment: http://stackoverflow.com/comment/42521833
favorite count: 0
has comment: http://stackoverflow.com/comment/42521772
has answer: http://stackoverflow.com/a/26995892
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26958118
upvote count: 1
tagged with: collections
has body: An interveiewer asked me below question: Search out unique integer values(approx. 1000) from a sorted array of billion records(like 1,1,1,1,3,3,3,4,5,5,6,6,6,6,6,7,7,7,7,7,7,8,8,8,8...........) with complexity less than O(n). NOTE: NOt to use SET. One solution that i tried to implement: Divide that array into two set of arrays,then iterate both subarrays and search in hashmap if element doesnot exit,then add it into hashmap otherwise move to next iteration. public static void main(String[] args) { int arr[] = {1,2,4,9,-3,5,6,3,6,12,5,6,2,-1,-3,6,87,9,2,3,5,7,9,1,0,1,3,5,7,6,3,8,6,3,21,45,6}; int size1 =0, size2 = 0; HashMap&lt;Integer, Integer&gt; map = new HashMap&lt;Integer,Integer&gt;(); System.out.println("length of Array:"+arr.length); if((arr.length)%2 == 0){ size1 = size2 = arr.length/2; }else{ size1 = (arr.length + 1)/2; size2 = (arr.length)/2; } for(int i=0;((size1-i-1)&gt;= 0)||((size2+i)&lt;(arr.length - 1));i++){ if(map.containsKey(arr[size1 -i-1])== false){ map.put(arr[size1 -i-1],arr[size1 -i-1]); } if(map.containsKey(arr[size2 + i]) == false){ map.put(arr[size2 + i], arr[size2 + i]); } } System.out.println(map.keySet()); } And its working as expected, then he asked what if we divide the array into n sets? then the complexity would be O(1) or O(n/n)? Is it possible? Please suggest if there is another way to implement the same without using hashmap?
has answer: http://stackoverflow.com/a/26995888
duplicate of: http://stackoverflow.com/q/26958118
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/42521950
has comment: http://stackoverflow.com/comment/42522447
downvote count: 3
has comment: http://stackoverflow.com/comment/42521929
type: Question
answer count: 2
score: -2
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/42522804

http://stackoverflow.com/comment/42682309
type: QuestionComment
has text: Unless specified on initial base declaration, C++ member functions are *not* [**virtual**](http://en.wikipedia.org/wiki/Virtual_function). Until closed as `final`, Java member functions *are* virtual. Perhaps that is the difference you're experiencing or otherwise-not-expecting?
score: 4
comment on: http://stackoverflow.com/q/27087031
type: Comment

http://stackoverflow.com/comment/42768513
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27135054
has text: You should look into the concept of classpath in Java.

http://stackoverflow.com/comment/42835296
type: QuestionComment
has text: Is it possible for you to show me the complete implementation of your code?
score: 0
comment on: http://stackoverflow.com/q/27147857
type: Comment

compiler-errors
tags question: http://stackoverflow.com/q/27146738
tags question: http://stackoverflow.com/q/27012833
tag name: compiler-errors
tags question: http://stackoverflow.com/q/26996582
type: Tag
tags question: http://stackoverflow.com/q/27077089
tags question: http://stackoverflow.com/q/27053776
tags question: http://stackoverflow.com/q/27047145
tags question: http://stackoverflow.com/q/27127530
tags question: http://stackoverflow.com/q/26992781
tags question: http://stackoverflow.com/q/27137250
tags question: http://stackoverflow.com/q/27032618

http://stackoverflow.com/q/27107072
accepted answer: http://stackoverflow.com/a/27107189
has body: Can I add null values to an ArrayList even if it has a generic type parameter? Eg. ArrayList&lt;Item&gt; itemList = new ArrayList&lt;Item&gt;(); itemList.add(null); If so, will itemsList.size(); return 1 or 0? If I can add null values to an ArrayList, can I loop through only the indexes that contain items like this? for(Item i : itemList) { //code here } Or would the for each loop also loop through the null values in the list?
has title: Adding null values to arraylist
linked to: http://stackoverflow.com/q/5600668
has comment: http://stackoverflow.com/comment/127414970
linked to: http://stackoverflow.com/q/44430633
upvote count: 81
has comment: http://stackoverflow.com/comment/94046808
has comment: http://stackoverflow.com/comment/42717423
type: AnsweredQuestion
downvote count: 9
tagged with: java
possible better answer: http://stackoverflow.com/a/27107101
has answer: http://stackoverflow.com/a/27107189
type: Question
has answer: http://stackoverflow.com/a/27107101
score: 72
has answer: http://stackoverflow.com/a/48424175
favorite count: 0
tagged with: arraylist
answer count: 3

http://stackoverflow.com/q/27066632
tagged with: java
has answer: http://stackoverflow.com/a/27066694
type: Question
downvote count: 5
has body: for (int i = 0; i &lt; 150; i++) { if (i % 13 == 0) { System.out.println("#: " + i); } } I just started learning java yesterday and I'm stuck with for loops statement. I'm confused about part if (i % 13 == 0) variable i is initialized to zero int i = 0 and if you divide zero by 13 the result is 0. There's no remainder. I tried on calculator. But when I run the program. I get the result like this it keeps adding by 13 how? #: 0 #: 13 #: 26 #: 39 #: 52 #: 65 #: 78 #: 91 #: 104 #: 117 #: 130 #: 143
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/42646767
favorite count: 0
has comment: http://stackoverflow.com/comment/42646694
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42646640
has answer: http://stackoverflow.com/a/27066698
has title: If statement inside for loops
score: -5
has answer: http://stackoverflow.com/a/27066704

http://stackoverflow.com/q/27030715
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27031955
upvote count: 1
type: AnsweredQuestion
tagged with: jsf
has title: create dynamic Confirm dialog in jsf
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27031955
downvote count: 0
has body: I need create dynamic confirmDialog. I have a dynamicallly created CommandButton. So when it press, confirmDialog will show. I do not know how to show it on CommandButton pressed.

http://stackoverflow.com/q/27136037
has comment: http://stackoverflow.com/comment/42771784
upvote count: 4
has comment: http://stackoverflow.com/comment/74225415
downvote count: 0
has title: Android opencv stream IP Camera
has body: I have searched for many hours but not found the answer to my problem. I have successfully stream an IP camera to android with rtsp connection but it is without the use of opencv library. Is it possible to stream IP camera on android with the help of opencv? I mean in the opencv, it uses the android built in camera but what I wanted is that to use the IP camera instead of the built in one. And on the opencv for android samples, it uses JavaCameraView (XML) and the way to access is using CameraBridgeViewBase. Is there a way to set it based on the IP of the IP camera? I have seen some examples using VideoCapture but on swing only. I'm confused on how to integrate VideoCapture on to CameraBridgeViewBase. I'm sorry I'm so noob. Please can someone help me.
favorite count: 0
type: Question
tagged with: android
score: 4
has comment: http://stackoverflow.com/comment/42771826
tagged with: java
tagged with: opencv
has comment: http://stackoverflow.com/comment/121186478
has comment: http://stackoverflow.com/comment/42771805
has comment: http://stackoverflow.com/comment/42771614
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42643549
type: Comment
type: QuestionComment
has text: @Joiner - changed to line 45
comment on: http://stackoverflow.com/q/27064766
score: 0

http://stackoverflow.com/q/27140962
type: Question
tagged with: java
tagged with: javafx
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27144388
has answer: http://stackoverflow.com/a/27141889
has title: EventHandlers overriding each other? JavaFX
type: UnansweredQuestion
has body: I have a context menu which activated on right click of a node in my JavaFX application. Originally I just had one menu item, but I decided to add another. When I added another, the second menu item worked but the first menu item stopped working. Here was my code: final ContextMenu contextMenu = new ContextMenu(); MenuItem delete = new MenuItem("Delete"); MenuItem hyperlink = new MenuItem("Hyperlink..."); contextMenu.getItems().addAll(delete, hyperlink); //handles deletion webView.setOnMousePressed(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent e){ if (e.isSecondaryButtonDown()){ contextMenu.show(workspace, e.getScreenX(), e.getScreenY()); delete.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { //do stuff } }); } } }); //handles hyperlink webView.setOnMousePressed(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent e){ if (e.isSecondaryButtonDown()){ contextMenu.show(workspace, e.getScreenX(), e.getScreenY()); hyperlink.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { //do stuff } }); } } }); } I assumed this was because the listeners were overriding each other, so I changed it to add event handlers. Here's how I changed the code: final ContextMenu contextMenu = new ContextMenu(); MenuItem delete = new MenuItem("Delete"); MenuItem hyperlink = new MenuItem("Hyperlink..."); contextMenu.getItems().addAll(delete, hyperlink); //handles deletion webView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent e){ if (e.isSecondaryButtonDown()){ contextMenu.show(workspace, e.getScreenX(), e.getScreenY()); delete.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { //do stuff } }); } } }); //handles hyperlink webView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler&lt;MouseEvent&gt;() { @Ove…

http://stackoverflow.com/comment/42714990
has text: Make sure that it is also used by your application that you don't have an old version somewhere in your classpath. Maybe try deleting the one from your repo and retrieve it again.
type: QuestionComment
comment on: http://stackoverflow.com/q/27105160
score: 0
type: Comment

http://stackoverflow.com/comment/42682902
has text: Thank you for pointing that out. I thought arrays had null pointers in them if not declared otherwise. Now I see that it depends on the type of array. Still my question remains, how can this be done? Do you need to increment a variable every time you put something new in the array? Is that the only correct way if 0 is also a valid number as input to calculate the mean?
score: 0
comment on: http://stackoverflow.com/q/27087229
type: Comment
type: QuestionComment

http://stackoverflow.com/a/47592414
downvote count: 0
has body: Lets make it generic: public static &lt;T extends Comparable&lt;T&gt;&gt; boolean isBetween(T value, T start, T end) { return value.compareTo(start) &gt;= 0 &amp;&amp; value.compareTo(end) &lt;= 0; }
upvote count: 14
answers question: http://stackoverflow.com/q/26996600
type: Answer
score: 14

http://stackoverflow.com/comment/42601641
comment on: http://stackoverflow.com/q/27040389
type: QuestionComment
has text: The docs should probably be answering this question for you, e.g., where it says "Called by the server (via the service method) to allow a servlet to handle a GET request."
score: 0
type: Comment

http://stackoverflow.com/comment/42792997
type: QuestionComment
has text: @MihaiC I read it but didn't understand...
type: Comment
comment on: http://stackoverflow.com/q/27148599
score: 0

http://stackoverflow.com/q/27071178
has answer: http://stackoverflow.com/a/27071644
answer count: 2
has body: I have a "achat.txt" file on every purchase with a line separated by commas information. Jean Charles, 3214324565, 321, 2 Yvan Richard, 5435435545, 321, 1 Yvette Gagnon, 4324324243, 1, 12 I have a inventaire.XML file my inventory. Code : &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;inventaire&gt; &lt;produit code="1" prix="432.00" quantité= "43" /&gt; &lt;produit code="32" prix="32.00" quantité= "100" /&gt; &lt;produit code="321" prix="31.00" quantité= "200" /&gt; &lt;/inventaire&gt; I have to write a program in which DOM updates the inventory taking into account the "achats.txt" .The file update only applies to the attribute "code" and "quantity" of "achats.txt" file. I managed to read the "achats.txt" file in java program. Code : import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Affiche { // On créer une classe "Affiche" public static void main(String[] args) throws IOException { FileReader fichier = new FileReader("achats.txt"); BufferedReader br = new BufferedReader(fichier); String ligne = null; while ((ligne = br.readLine()) != null) { String str[] =ligne.split(","); System.out.println (str[2] =","+str[3]); } fichier.close() } DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder parser = factory.newDocumentBuilder(); Document doc = parser.parse("inventaire.xml"); Element racine = doc.getDocumentElement(); NodeList nl = racine.getElementsByTagName("produit"); for (int i = 0; i &lt; nl.getLength(); ++i) { Element produit = (Element) nl.item(i); } I don't know how to create an array of string that will contain the variables achats.txt file. I don't know either how to get the "code" and "quantity" attribute then subtract the inventaire.xml file. Thank you for your help
downvote count: 0
has comment: http://stackoverflow.com/comment/42655461
has title: java Update a .XML file from a .txt file
favorite count: 0
has answer: http://stackoverflow.com/a/27071615
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java

http://stackoverflow.com/q/27113923
score: 2
has comment: http://stackoverflow.com/comment/42730771
downvote count: 0
has title: writing synchronized method java
favorite count: 0
type: UnansweredQuestion
has body: I can not understand why no thread never enters into the method wait public class File { private boolean writing = false; public synchronized void write() { String name = Thread.currentThread().getName(); while(this.writing == true){ System.out.println(name +" wait "); try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } this.writing=true; System.out.println(name +" writing "); try{ Thread.sleep((int)(Math.random()*3000)); } catch( InterruptedException e){ e.printStackTrace(); } this.writing=false; System.out.println(name +" writing end "); this.notifyAll(); } } public class M_thread extends Thread{ File file; public M_thread(String name,File f){ super(name); this.file=f; } public void run(){ while(true){ file.write(); } } } public class Main { public static void main(String[] args) { File file=new File(); new M_thread("t1",file).start(); new M_thread("t2",file).start(); new M_thread("t3",file).start(); } } In my code as I can prevent the problem of starvation caused by the simulation method of writing with sleep ? Because if a thread is put to sleep for a long time always will never write than one that you put to sleep for a short time
linked to: http://stackoverflow.com/q/26856242
has answer: http://stackoverflow.com/a/27114546
has comment: http://stackoverflow.com/comment/42731486
upvote count: 2
has comment: http://stackoverflow.com/comment/42731713
type: Question
has answer: http://stackoverflow.com/a/27114538
tagged with: java
has comment: http://stackoverflow.com/comment/42731640
has comment: http://stackoverflow.com/comment/42730832
answer count: 2

http://stackoverflow.com/comment/42601197
has text: Well, I guess you need to import appropriate Java classes, with :import clause on the ns macro, right?
comment on: http://stackoverflow.com/a/27040702
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42686426
type: Comment
type: AnswerComment
has text: Thank you. Kind of weird I didn't think of this. Could you modify your answer so it mentions the things pointed out by @BoristheSpider? (Modulo is expensive + .values() is ~equivalent~ to .clone(), which is O(n))
score: 0
comment on: http://stackoverflow.com/a/27089552

http://stackoverflow.com/q/27084697
has comment: http://stackoverflow.com/comment/42678342
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/27084829
has comment: http://stackoverflow.com/comment/42692790
type: UnansweredQuestion
has body: I'm trying to create the 24 game in java to practice. The 24 Game is an arithmetical game in which the objective is to find a way to manipulate four integers so that the end result is 24. Addition, subtraction, multiplication, or division in any order of the numbers may be used to make the four digits operations from one to nine equal 24. The rules are simple: you have to use each number only once and only the 4 numbers that were read from the user to find one equation to obtain 24. My issue is I am not receiving any output after the program completes. The issue could be in the append(String equation) method which is used to prevent duplicate answers and to add the correct equations to the ans array. Or it could be somewhere else. I just can't figure it out for the life of me. Edited Code: public class TwentyFourGame { String [] ans = new String[20]; boolean [] used = new boolean[20]; int count = 0; int value = 0; public void Solve(double w, double x, double y, double z){ double [] nums = {w,x,y,z}; double eHold=0, fHold=0; //Replaces null array elements with empty string to avoid NPE for(int d=0; d&lt;ans.length;d++){ ans[d] = ""; } for (int a=0;a&lt; 4; a++){ for (int b=0;b&lt; 3; b++){ for (int c=0;c&lt;2; c++){ fHold = nums[2]+nums[3]; if (((nums[0]/nums[1])*fHold)==24) append (nums[0]+" / "+nums[1]+" * ("+nums[2]+" + "+nums[3]+")" + " = 24"); else if (((nums[0]/nums[1])-fHold)==24) append (nums[0]+" / "+nums[1]+" - ("+nums[2]+" + "+nums[3]+")" + " = 24"); else if (((nums[0]*nums[1])-fHold)==24) append (nums[0]+" * "+nums[1]+" - ("+nums[2]+" + "+nums[3]+")" + " = 24"); else if (((nums[0]*nums[1])/fHold)==24) append (nums[0]+" * "+nums[1]+" / ("+nums[2]+" + "+nums[3]+")" + " = 24"); else if (((nums[0]-nums[1])*fHold)==24) append (nums[0]+" - "+nums[1]+" * ("+nums[2]+" + "+nums[3]+")" + " = 24"); else if (((nums[0]-nums[1])/fHold)==24) append (nums[0]+" - "+nums[1]+" / ("+nums[2]+" + "+nums[3]+")" + " = 24"); else value++; fHold=nums[2]-nums[3]; if (((nums[0]/nums…
has answer: http://stackoverflow.com/a/27084888
tagged with: java
has title: Can't figure out why my program is not printing contents of array
type: Question
tagged with: arrays
score: 0

http://stackoverflow.com/q/27085018
tagged with: http://stackoverflow.com/tag/html
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27085082
tagged with: java
has comment: http://stackoverflow.com/comment/42678867
type: Question
has title: (HTML) How to save conent of text area to a local variable?
has comment: http://stackoverflow.com/comment/42678884
has comment: http://stackoverflow.com/comment/42678922
has body: I'm trying to save the content of a textarea to a local variable. Those variables are used on a Java method that send their values to a Database upon a button click. But I can't seem to do it right. https://i.sstatic.net/0OFLG.jpg https://i.sstatic.net/Rv9Yb.jpg (this is my method that updates the DB with the values user puts on textarea) The variables are inside the black box. They are Strings.
score: 0

http://stackoverflow.com/a/27132753
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/27132659
has body: Yes. Integer.toBinaryString is correct. Your answer is the binary of pos without any newlines. 1000001 110001 1000101 110001 1000110 110001 The output you expected requires you to decode the digit value. Like String binCode = Integer.toBinaryString(Character.digit(pos, 16)); Then the output is 101011110111111
upvote count: 5
has comment: http://stackoverflow.com/comment/42764227

http://stackoverflow.com/comment/42737934
type: Comment
comment on: http://stackoverflow.com/a/27115304
score: 0
type: AnswerComment
has text: yup,and the value is extremely large(of course).I don't have my computer now.I will test the program with smaller values to insure there are no flaws.Thanks for the advices :)

http://stackoverflow.com/q/27146289
has comment: http://stackoverflow.com/comment/42788348
has answer: http://stackoverflow.com/a/27149171
has comment: http://stackoverflow.com/comment/42788971
type: UnansweredQuestion
has body: I was trying to combine 3 byte arrays to form a single one to generate a report. byte[] bArray=null; ByteArrayOutputStream outputStream = new ByteArrayOutputStream( ); for(int i=0;i&lt;3;i++) { //Other stuff bArray = getTheReportContent(); //The return type of this method is List&lt;byte[]&gt; outputStream.write(bArray); } byte bArrayCombined[] = outputStream.toByteArray( ); //Checked the count. bArrayCombined.length=sum of all the 3 bArray response.setContentLength((int) bArrayCombined.length); outStream.write(bArrayCombined, 0, bArrayCombined.length); outStream.flush(); When I have written this in to the report, the content is not as expected. It shows only first bArray contents. Where I went wrong here. EDIT: The getTheReportContent do the following: Exports the report using jasper. And returns byteArrList. List byteArrList = new ArrayList(); -------- exporterXLS.exportReport(); byteArrList.add(outputStream.toByteArray());
tagged with: java
has comment: http://stackoverflow.com/comment/42788570
type: Question
has comment: http://stackoverflow.com/comment/42790475
has comment: http://stackoverflow.com/comment/42789076
has title: Combine 3 byte arrays
score: 0
tagged with: bytearrayoutputstream
has comment: http://stackoverflow.com/comment/42790406
answer count: 1
tagged with: arrays

http://stackoverflow.com/comment/42791463
has text: That change will cause the output to be 'enemity'
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27148085

http://stackoverflow.com/a/27081306
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27049144
has body: I fixed the problem using POST method and adding a line request.getParts(); The actual code is: @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces("application/json") @Path("/{text}") public void postEditar3(@Context HttpServletRequest request, @PathParam("text")String texto) { boolean sucesso; try { request.getParts(); Tabela2colunasDTO.Produto produtoDTO; Tabela2colunasDTO dto = new Tabela2colunasDTO(); produtoDTO = dto.getInstanceProduto(); produtoDTO.text = text; produtoDTO.price = request.getParameter("PRICE_EDIT"); success = (new ProdutosDAO()).doUpdate(produtoDTO); System.out.println("passou do sucesso doUpdate: "+success); } catch (IOException | ServletException e) { } }

http://stackoverflow.com/comment/57812132
comment on: http://stackoverflow.com/a/27032623
type: AnswerComment
has text: The process is basically the same for the Windows version of Intellij IDEA as well.
score: 0
type: Comment

http://stackoverflow.com/comment/42756605
type: AnswerComment
has text: Yes that's weird, I set up a class which implements ServletContextListener, HttpSessionActivationListener, HttpSessionListener and related methods to implement. I log in each one, but not all methods are invoked on session lifecycle or session pass/activate...
type: Comment
comment on: http://stackoverflow.com/a/27127426
score: 0

http://stackoverflow.com/comment/42666210
comment on: http://stackoverflow.com/a/27077847
type: AnswerComment
type: Comment
score: 3
has text: @Dev no. Everything is pass by value.

http://stackoverflow.com/q/26994176
has body: I am looking for an easy way to design a simple web interface for a java application to control some settings from another computer. I have looked at a few possibilites like embedding a Jetty or Tomcat server. Altho i guess Jetty will be better choice for a simple web interface to control a few settings of an application. It might even be enough to use build in HTTPServer. But all the tutorials so far show simple Hello World examples. It would be easy to follow those and build all the pages i want to show with simple string builder, but that is quite tedious work. It is possible to pass JSPs to the embedded servers, but so far i haven't found a good designer for those either. It seems there are a few vidual designers availiable for Eclipse, but i am working with NetBeans and don't want to switch just for this. It seems NetBeans hat a visual desinger in Version 6, but it was removed again. There is vaadin, but NetBeans Plugin Central seems to be down at the moment, so i can't check it out. Are there any other tools availiable to design simple web interfaces? Preferably usable with NetBeans, but if it needs some work to integrate the finished page i can live with it.
has title: Tools to design code for dynamic web interface
tagged with: netbeans
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26994590
tagged with: embeddedwebserver
answer count: 1
type: UnansweredQuestion

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

http://stackoverflow.com/comment/42709096
type: Comment
score: 3
has text: Won't this only list the default Java version? What if an application started from the Windows start menu is configured to run a different (older) version of Java?
type: AnswerComment
comment on: http://stackoverflow.com/a/27101362

http://stackoverflow.com/a/27027384
answers question: http://stackoverflow.com/q/27027330
has body: Test.getInstance().firstMethod() Test.getInstance().secondMethod() Test.getInstance().thirdMethod() This will create three different instances of the Test class and call a method on each. Test test = Test.getInstance(); test.firstMethod(); test.secondMethod(); test.thirdMethod(); Will create only one instance and invoke the three methods on that instance. So it's a completely different behavior to begin with. Obviously, since the first creates three objects, then it should take more heap space. If you're intending to implement a singleton class, however, both are equivalent.
type: Answer
has comment: http://stackoverflow.com/comment/42578342
upvote count: 3
has comment: http://stackoverflow.com/comment/42577959
score: 3
has comment: http://stackoverflow.com/comment/42578007
has comment: http://stackoverflow.com/comment/42578115
has comment: http://stackoverflow.com/comment/42577838
downvote count: 0

http://stackoverflow.com/comment/42638772
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27062022
score: 1
has text: @LutzHorn It could be. But what of it? If the OP marked it as Java, and he has a valid problem which *is* in the language, it makes sense for him to ask for help that could, potentially, involve non-regex code, in Java.

http://stackoverflow.com/a/27071403
has comment: http://stackoverflow.com/comment/42655744
upvote count: 7
has comment: http://stackoverflow.com/comment/42655791
score: 7
has comment: http://stackoverflow.com/comment/42656269
has body: Never call paintComponent(...) directly as you're doing. Instead suggest a draw by calling repaint() on a component when necessary. Don't draw with a Graphics object obtained via a getGraphics() call on a component. Instead, draw with the Graphics object provided in the paintComponent method. Avoid using while (true) loops in a Swing GUI as you risk tying up the Swing event thread and freezing the GUI. Use a Swing Timer for simple animations. You probably don't even need a Swing Timer since your animation can be driven by your MouseListener/MouseMotionListener. Most important -- do read the Swing painting and other tutorials, as most of this information can be found there. It looks like you're guessing how to do some of your coding and that's a dangerous thing to do when it comes to drawing or animating a GUI. You can find most tutorials in the Swing info link. Consider using a Shape object to represent your Circle, such as an ellipse2D. The reason that this will help is that it has some very useful methods, including a contains(Point p) method that will help you determine if a mouse click lands inside of your circle. You will want to decide where _x and _y represent the center point of your circle or not. If so, then you'll need to adjust your drawing some, by shifting it left and up by _radius amount. Consider casting your Graphics object into a Graphics2D object in order to use its extra methods and properties. One such property are the RenderingHings. Set your Graphics2D RenderingHints to allow for anti-aliasing to get rid of your image "jaggies". This can be done with: g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); where g2 is your Graphics2D object. Your paintComponent method is not a true paintComponent override and thus won't work correctly. It should be a protected method, not public, it should have one parameter, a Graphics object, and nto a second parameter, and you should place the @Override annotation above it. …
answers question: http://stackoverflow.com/q/27071128
downvote count: 0
has comment: http://stackoverflow.com/comment/42655663
has comment: http://stackoverflow.com/comment/42655516
has comment: http://stackoverflow.com/comment/42655955
type: Answer
has comment: http://stackoverflow.com/comment/42655980

http://stackoverflow.com/comment/42636199
has text: you can desalinize it to a Map like: HashMap<String, String> map = new Gson().fromJson(jObjt.toString(), HashMap.class); I just Edit my code.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27060477
type: Comment

http://stackoverflow.com/comment/42532563
comment on: http://stackoverflow.com/q/27001199
type: Comment
type: QuestionComment
has text: Use an if statement, set the value to 0, and `if(val = 0)` print an X instead of the number?
score: 0

http://stackoverflow.com/a/27038774
score: -1
has body: You can try this for your second &lt;p:ajax&gt; &lt;p:ajax listener="#{issueAdmitCardBean.selectContByid(issueAdmitCardBean.center.id,issueAdmitCardBean.examination.id,issueAdmitCardBean.degree.id)}" update="venueNames" process="propExam degreeList centerId"/&gt;
type: AcceptedAnswer
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/27037918
upvote count: 0
answers question: http://stackoverflow.com/q/27037918

http://stackoverflow.com/a/27115072
has comment: http://stackoverflow.com/comment/42738106
has body: It looks like you haven't included the GooglePlayServices library in your APK. Since you are using a non-standard way of building, you will need to reference their docs on how to ensure that the GPS library is included in your APK.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27092301
has comment: http://stackoverflow.com/comment/42769885

http://stackoverflow.com/comment/42719883
type: Comment
type: AnswerComment
has text: You can create a Thread from a Runnable. A Runnable on its own is not a thread, whether it is in Android or not.
score: 0
comment on: http://stackoverflow.com/a/27107231

http://stackoverflow.com/comment/42737869
comment on: http://stackoverflow.com/q/27115919
type: Comment
score: 0
has text: I'm not an expert in this area at all... but if it's complaining about a misplaced from, I'd try first getting the query to run on your db locally... independently of the Java code - when you're sure there's nothing wrong with the sql, then I'd move it back into the Java. I'd also start with a minimal query ie without the big case statement... because the from is after that so it suggests something is wrong in there.
type: QuestionComment

http://stackoverflow.com/q/27017379
has body: I have a problem relating data transmission between ipojo components during reconfiguration. Here's an example: A component Calcul_1 provides a calculation service to return a value (a+b) (ex: f(a,b)=&gt; (a+b)) A component Calcul_2 provides a calculation service to return a value (a*b) (ex: f(a,b)=&gt; (a*b)) These two components implement the same calculation service (ex: f). Now, I have a component CallCalcul that uses the calculation service of Calcul_1. The component CallCalcul calls f(5,6) in the component Calcul_1. Then, the CallCalcul component receives the value of 11. Problem: When Calcul_1 receives the value (5,6) (not yet calculate) from CallCalcul, CallCalcul reconfigure by changing connector to Calcul_2, i.e., it binds to Calcul_2. In this case, how can I transmit (5,6) from Calcul_1 to Calcul_2 and return (5*6=30) to CallCalcul ? When Calcul_1 receives the value (5,6) (and calculate their, i.e. 5+6=11) from CallCalcul, CallCalcul reconfigure. In this case, how can I transmit 11 to Calcul_2 and return this value to CallCalcul?
linked to: http://stackoverflow.com/q/27039926
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42564083
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27023560
accepted answer: http://stackoverflow.com/a/27023560
type: Question
tagged with: ipojo
has title: Data transmission during ipojo reconfiguration
has comment: http://stackoverflow.com/comment/42562786

http://stackoverflow.com/comment/42782235
type: Comment
comment on: http://stackoverflow.com/a/27074662
type: AnswerComment
has text: I accepted your answer. I am fairly new to this site so I dont know all of the procedures yet.
score: 0

http://stackoverflow.com/a/27096619
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/42698969
type: Answer
has body: Why can I not have a interface inside of a inner class? Because interfaces are implicitly static: JLS §8.5.1: A member interface is implicitly static (§9.1.1). It is permitted for the declaration of a member interface to redundantly specify the static modifier. and you can't have non-final statics in an inner class. Why are they implicitly static? Because that's the way they designed it. why cannot I declare these in inner classes/local classes? Because they're implicitly static. the reason we can have static final variables in a interface is because they do not specify the state or any of that sort of the implementation right? Right. If we lose static and use just a final, we need a instance Right. which makes no sense cause you can't instantiate a interface. Yes you can. You can instantiate a class which implements the interface, or you can instantiate a method-local anonymous implementation of it. The real issue here is multiple inheritance of interfaces.
answers question: http://stackoverflow.com/q/27096561
upvote count: 4

http://stackoverflow.com/comment/42871613
has text: Guess the password hello Try again hello Try again hello Try again password Try again later!
comment on: http://stackoverflow.com/a/27112675
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27059021
has title: Hibernate criteria sum where property is equal
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has body: I store in database data as | RAPORT_DAY | FIELD_VALUE | USER_ID. All works good if I specify user_id, I'm getting one record for one day. But if I dont specify user_id I'm getting a lot of records for same day. Is it possible to sum field_value for each day by criteria ? if (userId != null) { criteria.add(Restrictions.eq("user.id", userId)); } criteria.add(Restrictions.ge("raportDay", dateFrom)); criteria.add(Restrictions.le("raportDay", dateTo)); criteria.setProjection(Projections.projectionList() .add(Projections.property("raportDay")) .add(Projections.property(field)));
type: Question
tagged with: criteria
tagged with: java
tagged with: hibernate
tagged with: detachedcriteria
tagged with: mysql
has comment: http://stackoverflow.com/comment/42633426
has comment: http://stackoverflow.com/comment/42636999
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42800002
has text: This will depend on your OS and require an ad-hoc solution, different for each platform. For Windows you can take a look [here](http://superuser.com/questions/361816/pass-command-line-arguments-to-windows-open-with). Not a good question for SO in my opinion.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27152735

http://stackoverflow.com/q/27131156
score: 1
tagged with: java
tagged with: authentication
upvote count: 1
has body: My scenario: I am working with an enterprise portal which is closed-source to me , the app provides some reports , I need to show the reports in a TV , so I need to , the TV has a build-in web browser to show html. til here there is no problem but the portal has a log-in page to prevent anonymous access , I have credentials but the TV is going to show reports randomly so I need a mechanism to log-in to the app and then loading a sample report and pass it to TV's browser. What I've Done: I've created a web page which gets a report's URL and then logs into the portal and after that reads the cookies and then opens a connection to the reports (via it's URL) to load its content and returns back the contents to the browser (TV browser). My Code @WebServlet("/LoadReport") public class LoadReport extends HttpServlet { private static final long serialVersionUID = 1L; public LoadReport() { // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); session.setMaxInactiveInterval(5); response.setContentType("text/html"); PrintWriter out = response.getWriter(); if (request.getQueryString() != null &amp;&amp; request.getQueryString() != "") { String tmp = request.getQueryString(); tmp = tmp.substring(tmp.indexOf('=') + 1); sb.append(tmp); String postParams = "j_username=djboobo&amp;j_password=djboobo&amp;persistent=on"; URL url = new URL("http://xyz/xyz/login/auth.jsp"); HttpURLConnection connection = (HttpURLConnection) getConnection(postParams, url); // get sessionid from cookies String cookies = getCookies(connection, postParams); cookies += "logindetails=username:djboobo&amp;persistent:yes"; // url to report url = new URL(tmp); connection = (HttpURLConnection) getConnection(postParams, url); connection.setRequestProperty("Cookie", cookies); DataOutputStream wr = new DataOutputStream(connection.getOutputStream()); wr.writeBytes(p…
type: Question
has title: Login into Web portal via Java
downvote count: 0
tagged with: httpurlconnection
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42762781
has comment: http://stackoverflow.com/comment/42782898
tagged with: missing-cookies
answer count: 0
tagged with: cookies

http://stackoverflow.com/comment/42740115
comment on: http://stackoverflow.com/q/27119254
type: Comment
type: QuestionComment
has text: Secondly, your call to `checkInput(elems);` from BidParser is invalid (will give a compiler error). It needs to be `InputSanityChecker.checkInput(elems);`
score: 0

http://stackoverflow.com/q/26995859
has answer: http://stackoverflow.com/a/26996212
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26995906
type: Question
has body: I've had a look around and could not find what I'm looking for, so please feel free to redirect me. I'm writing a card game that uses a Java server that stores the card information. I want to develop an Android app that connects to this server (via TCP/IP is my initial thought) and issues the commands i.e. pick up cards, play cards etc. (as the cards are stored in arraylists within the server app.) My knowledge of Android is extremely limited and I cant find any good sources that could possibly help me, or explain how android networking works.
tagged with: android-networking
has comment: http://stackoverflow.com/comment/42523045
has title: Android app need help connecting to a JAVA localhost server
answer count: 2
accepted answer: http://stackoverflow.com/a/26995906
tagged with: android
possible better answer: http://stackoverflow.com/a/26996212

http://stackoverflow.com/comment/42799069
type: Comment
has text: What is `email()` method supposed to return if it doesn't end with .sc?
comment on: http://stackoverflow.com/q/27152298
score: 4
type: QuestionComment

http://stackoverflow.com/comment/42729369
score: 0
type: AnswerComment
has text: @$(mainPanel) is the use of [GWTQuery][1]. Which Scheduler method would you use in my case?
type: Comment
comment on: http://stackoverflow.com/a/27109984

http://stackoverflow.com/comment/42674485
score: 0
type: AnswerComment
has text: Ah thanks. :) Do you think making this multithreaded will help? Do you have any opinions regarding improving this algorithm? Or any number crunching that can save us some time?
type: Comment
comment on: http://stackoverflow.com/a/27082356

http://stackoverflow.com/a/27038416
has comment: http://stackoverflow.com/comment/42596862
score: 0
has body: It is very clear that you are going to use get only numeric value from Edittext. So you can make the edit text as android:inputType="number" &lt;EditText android:id="@+id/edtPhoneNo" android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="number"/&gt; if you are using : Number1 = Integer.parseInt(FirstNum.getText().toString()); alphabetic value will aslo used. So that's the reason you are getting that exception. If you not getting solution, add it on comments.
type: Answer
answers question: http://stackoverflow.com/q/27038197

http://stackoverflow.com/q/27043333
has comment: http://stackoverflow.com/comment/42605828
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/42605740
has body: Hello so somehow managed to make that id isn't shown in combobox , but then how to make that when I press button ok I could get id value? Using String from = (String) jComboBox1.getSelectedItem(); when button is pressed doesn't work... I get String code = (String) item.getValue(); the id i needed but how I pass it to the next query? public void select() { try { String sql = "select * from category"; pst = con.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { jComboBox1.addItem(new Item&lt;String&gt;(rs.getString("mkid"), rs.getString("name"))); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } jComboBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox jComboBox1 = (JComboBox) e.getSource(); Item item = (Item) jComboBox1.getSelectedItem(); String code = (String) item.getValue(); System.out.println(code); } }); } The item public class Item&lt;V&gt; implements Comparable&lt;Item&gt; { private V value; private String description; public Item(V value, String description) { this.value = value; this.description = description; } public V getValue() { return value; } public String getDescription() { return description; } public int compareTo(Item item) { return getDescription().compareTo(item.getDescription()); } @Override public boolean equals(Object object) { Item item = (Item)object; return value.equals(item.getValue()); } @Override public int hashCode() { return value.hashCode(); } @Override public String toString() { return description; }
tagged with: java
tagged with: swing
type: Question
tagged with: database
linked to: http://stackoverflow.com/q/9053927
has title: How to hide jcombobox item from list but still use it to get data from databse tables
score: 0
has comment: http://stackoverflow.com/comment/42605794
has answer: http://stackoverflow.com/a/27045700
answer count: 1
tagged with: jquery
type: UnansweredQuestion

http://stackoverflow.com/comment/42568321
type: QuestionComment
has text: You are essentially asking, "How can I violate YouTube's [Terms of Service](https://www.youtube.com/static?template=terms)". The answer is, you should not.
comment on: http://stackoverflow.com/q/27021916
score: 0
type: Comment

http://stackoverflow.com/comment/42612651
type: AnswerComment
score: 0
type: Comment
has text: Hello, this creates unwanted whitespace in string and then I can't create array of strings out of it (which is split by space).
comment on: http://stackoverflow.com/a/27046467

http://stackoverflow.com/comment/42676529
has text: @Paul The package name is `net.objectlab.kit` (see that link I posted above).
comment on: http://stackoverflow.com/a/27083520
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42733791
type: Comment
comment on: http://stackoverflow.com/q/27115534
has text: Have you searched at all for getting Java command line input?
score: 4
type: QuestionComment

http://stackoverflow.com/comment/42752121
type: QuestionComment
comment on: http://stackoverflow.com/q/27125528
has text: it is very easy if you use database then add one parameter in model isFriend. and if isfriend is true then Change your text other wisenot
score: 0
type: Comment

http://stackoverflow.com/a/27065668
has body: Wouldn't be easier with a IN ! SELECT id FROM staff WHERE ? IN (name1, name2, name3, name4, name5, name6, name7, name8, name9, name10);
type: Answer
has comment: http://stackoverflow.com/comment/42739790
downvote count: 0
answers question: http://stackoverflow.com/q/27065152
accepted answer of: http://stackoverflow.com/q/27065152
score: 1
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/comment/42757216
has text: I've corrected my use of multiple inheritance :)
comment on: http://stackoverflow.com/a/27128881
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27083020
has comment: http://stackoverflow.com/comment/42675253
score: 1
tagged with: java
has body: I have a jframe as part of a program where the user will populate an arraylist by pressing the add buttons. When they are finished populating the arraylist I want them to click the done button to hide the jframe while the program continues to run. Is there a way to do this. Initially I was using System.exit(0) but this seems to terminate the program. public class Street extends JFrame { private static final Random randomNumbers = new Random(); private ArrayList&lt;Vehicle&gt; vehicles = new ArrayList&lt;Vehicle&gt;(); private JLabel messageJLabel; // displays vehicle that was added private JButton addBicycleJButton; private JButton addCarJButton; private JButton doneJButton; private Color background; // background color of application public Street() { super("Street Simulation"); background = Color.LIGHT_GRAY; messageJLabel = new JLabel("No vehicles added."); addBicycleJButton = new JButton("Add Bicycle"); addBicycleJButton.addActionListener( new ActionListener() // anonymous inner class { public void actionPerformed(ActionEvent e) { background = Color.LIGHT_GRAY; Bicycle b = new Bicycle(2, 0); vehicles.add(b); messageJLabel.setText(b.toString() + " added to vehicles"); repaint(); } // end method actionPerformed } // end anonymous inner class ); // end call to addActionListener addCarJButton = new JButton("Add Car"); addCarJButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { background = Color.LIGHT_GRAY; Car c = new Car(4, 0); vehicles.add(c); messageJLabel.setText(c.toString() + " added to vehicles"); repaint(); } // end method actionPerformed } // end anonymous inner class );// end call to addActionListener doneJButton = new JButton("Done"); doneJButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // code to exit goes here background = Color.LIGHT_GRAY; //I would like to have the jframe running in the background after this button is pushed. // System.exit(0); repaint(); } // end m…
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/9554636
has answer: http://stackoverflow.com/a/27083050
has comment: http://stackoverflow.com/comment/42675343
has answer: http://stackoverflow.com/a/27083095
has title: Hiding JFrame when button is clicked without stopping program
answer count: 2
upvote count: 1
tagged with: user-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/42690349
has comment: http://stackoverflow.com/comment/42677787
favorite count: 0
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/comment/42715879
type: QuestionComment
comment on: http://stackoverflow.com/q/27106275
has text: tried with 21 and 18, same results
score: 0
type: Comment

http://stackoverflow.com/comment/42679886
type: QuestionComment
comment on: http://stackoverflow.com/q/27085291
has text: True..But at the same time, not everybody is interested in learning things like that, and I respect that. Looks like command prompt is the easiest way for now, so I guess I will stick to it..Now if I wanted to share my finished project online for other people to try out my game, how would I go about doing so?
score: 0
type: Comment

http://stackoverflow.com/comment/42704378
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27095598
has text: Sorry was downvoted, I was gonna say when I try calling `findChange(change, coinTypes, answerCoins);` in main, it says answerCoins not found

http://stackoverflow.com/q/27074991
has answer: http://stackoverflow.com/a/78763102
score: 5
tagged with: intellij-idea
upvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/42661759
has answer: http://stackoverflow.com/a/37281191
has body: When debugging in intellij, I can tell it to display a given int variable with its decimal value or its hex value. Is it possible for the debugger to display BOTH at the same time?
has comment: http://stackoverflow.com/comment/80566237
answer count: 4
has comment: http://stackoverflow.com/comment/42695671
has answer: http://stackoverflow.com/a/27076770
accepted answer: http://stackoverflow.com/a/27076770
tagged with: java
has title: Is it possible to view int as decimal AND hexadecimal at the same time in intellij?
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/41223716
tagged with: debugging
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/37281191

http://stackoverflow.com/a/27038572
has body: Use either binary packages - "pkg install protobuf" ("pkg search protobuf" to see what packages are available) - or install from ports; "cd /usr/ports/devel/protobuf &amp;&amp; make install".
upvote count: 2
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27025146

swt
tags question: http://stackoverflow.com/q/27036677
tags question: http://stackoverflow.com/q/26991928
tags question: http://stackoverflow.com/q/27033156
tags question: http://stackoverflow.com/q/27127562
tags question: http://stackoverflow.com/q/27132065
tags question: http://stackoverflow.com/q/27042021
type: Tag
tags question: http://stackoverflow.com/q/27134861
tags question: http://stackoverflow.com/q/27053933
tags question: http://stackoverflow.com/q/27107972
tags question: http://stackoverflow.com/q/27145440
tags question: http://stackoverflow.com/q/27045417
tags question: http://stackoverflow.com/q/27032979
tags question: http://stackoverflow.com/q/27128440
tag name: swt
tags question: http://stackoverflow.com/q/27037362
tags question: http://stackoverflow.com/q/27145140
tags question: http://stackoverflow.com/q/27152279

http://stackoverflow.com/q/27118725
score: 0
has comment: http://stackoverflow.com/comment/42740217
has comment: http://stackoverflow.com/comment/42740557
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42740374
has comment: http://stackoverflow.com/comment/42742025
tagged with: swing
has comment: http://stackoverflow.com/comment/42742473
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Jtextfield with autocomplete or Jsuggestfield java swing
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/42778032
has comment: http://stackoverflow.com/comment/42740578
has body: Which is better to use between jtextfield with autocomplete or jsuggestfield what i want to achieve here is i have a json file and from that file i want to select the names of all members in that json and when i type A in the field all the names that starts with letter will appear as dropdown and adding a letter will filter the list with names starting with A and what ever letter is typed FYI: found the jsuggestion here but i only understand little from there because it is not really explained there
has comment: http://stackoverflow.com/comment/42755280
has comment: http://stackoverflow.com/comment/42741973

http://stackoverflow.com/a/27126866
has comment: http://stackoverflow.com/comment/42754210
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42753433
answers question: http://stackoverflow.com/q/27126382
has comment: http://stackoverflow.com/comment/42753701
accepted answer of: http://stackoverflow.com/q/27126382
type: Answer
has body: The problem is not on encoding and decoding the messages but in the server container. Seems that server cant display properly the special characters, so it can not treat them from request. If you display the values in the JSP page itself, everything is working fine. Example: <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Page <% String msg="206_John_help i m in trouble,delhi,อินเดีย_30.64741430_76.817313799"; System.out.println("The original message "+msg); String result = java.net.URLEncoder.encode(msg, "UTF-8"); System.out.println("The msg is "+result); String result1=java.net.URLDecoder.decode(result, "UTF-8"); System.out.println("The decoded msg is "+result1); %> Original message <%=msg %> Encrypted message <%=result %> Decrypted message <%=result1 %>
downvote count: 0
score: 1

http://stackoverflow.com/q/27095312
answer count: 2
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/27095426
has body: I've made a GUI using swing with a BorderLayout and GridLayout in the center. I want to add a triangle I've made in another class to the JPanel east in my BorderLayout but cant get it to show. When I set a bgcolor for said JPanel I got a weird little result, if you like you can have a look at the code: gistlink I have a feeling the issue is in the TriGoButton constructor but I'm not sure how to test further. I've tried different variations of paint() but have never been able to see the green triangle. import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @SuppressWarnings("serial") public class TestGUI extends JFrame implements ActionListener { private JPanel content; private JTextField placeTxtField; public static void main(String[] args) { TestGUI frame = new TestGUI(); frame.pack(); frame.setVisible(true); } @SuppressWarnings("rawtypes") public TestGUI() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); content = new JPanel(); content.setLayout(new BorderLayout()); setContentPane(content); // issue JPanel rightPanel = new JPanel(); content.add(rightPanel, BorderLayout.EAST); rightPanel.add(new TriGoButton()); // issue? JPanel leftPanel = new JPanel(); content.add(leftPanel, BorderLayout.WEST); JPanel centerPanel = new JPanel(); content.add(centerPanel, BorderLayout.CENTER); centerPanel.setLayout(new GridLayout(3, 3, 0, 20)); JLabel countyLbl = new JLabel("County"); centerPanel.add(countyLbl); JComboBox countyDropDown = new JComboBox(); centerPanel.add(countyDropDown); JLabel muniLbl = new JLabel("Munipalicity"); centerPanel.add(muniLbl); JComboBox muniDropDown = new JComboBox(); centerPanel.add(muniDropDown); JLabel placeLbl = new JLabel("City or place"); placeLbl.setToolTipText("search"); centerPanel.add(placeLbl); placeTxtField = new JTextField(); centerPanel.add(placeTxtField); placeTxtField.setColumns(15); placeTxtField.setToolTipText("enter w/e"); JPanel bottomPanel = ne…
has comment: http://stackoverflow.com/comment/42696852
has comment: http://stackoverflow.com/comment/42696418
has comment: http://stackoverflow.com/comment/42696448
tagged with: java
has comment: http://stackoverflow.com/comment/42696484
possible better answer: http://stackoverflow.com/a/27095451
type: AnsweredQuestion
tagged with: user-interface
has comment: http://stackoverflow.com/comment/42696910
downvote count: 0
accepted answer: http://stackoverflow.com/a/27095426
has answer: http://stackoverflow.com/a/27095451
tagged with: layout-manager
favorite count: 0
type: Question
has title: Issue getting a graphic triangle to show on my JPanel east in BorderLayout
score: 1

http://stackoverflow.com/comment/42827314
type: QuestionComment
comment on: http://stackoverflow.com/q/27152171
score: 0
type: Comment
has text: Which step was the last one that worked? Did `DictionaryVectorizer` work? Did you have a look at the source code of Mahout (it's open-source, after all)? I wouldn't be surprised if the tokenizer or vectorizers already don't work for Chinese...

http://stackoverflow.com/comment/42738777
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27098654
has text: Thanks for your site. It's weird. Mine has all the similar response, except that the Chrome only downloads 1MB and stopped. Another file stopped at 1.1M.
score: 0

http://stackoverflow.com/comment/42816251
comment on: http://stackoverflow.com/a/27140176
has text: @RamBavireddi: How do you trigger scheduling the next Runnable then?
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42793466
comment on: http://stackoverflow.com/q/27148599
type: QuestionComment
has text: @pskink nope. It's clean.
type: Comment
score: 0

http://stackoverflow.com/q/27009069
has comment: http://stackoverflow.com/comment/42546243
has answer: http://stackoverflow.com/a/27009144
has title: Java Timers and actionlisteners
answer count: 1
tagged with: timer
type: UnansweredQuestion
has body: Baiscilly, I'm making this game for a project, and I can't fiure out how to get timers to work whatsoever, here is my code attempting. import java.awt.event.*; import java.util.Timer; public class Timers { private int timeLeft = 60; private void timer() { while(timeLeft &gt; 0){ int delay = 1000; ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { timeLeft--; }{ new Timer(delay, taskPerformer).start(); }; }; } } } I don't know what I'm doing wrong or what to do next. As well as this i need to make an Actionlistener see if the users answer is the same as the preset answer. import javax.swing.*; import java.awt.event.*; ... JTextField Janswer = new JTextField(); Janswer.setBounds(110, 70, 150, 25); newFrame.add(Janswer); if Janswer = equations.getanswer(){ score++; And I guess if i'm giving this much I may as well give you where it is getting the answers from public class Equations { private static String equation; private int answer; Problems problem = new Problems(); public Equations() { equation = problem.getFirstNumber() + " " + problem.getSign() + " " + problem.getSecondNumber(); String sign = problem.getSign(); if (sign.equals("+")) answer = problem.getFirstNumber() + problem.getSecondNumber(); else if (sign.equals("-")) answer = problem.getFirstNumber() - problem.getSecondNumber(); else if (sign.equals("*")) answer = problem.getFirstNumber() * problem.getSecondNumber(); } public static String getEquations() { return equation; } public int getAnswer() { return answer; } } Thank you all for any help you're able to give me, and just let me know if I need to change my post in any way, I'm new to this!
score: 0
tagged with: java
tagged with: swing
type: Question

http://stackoverflow.com/q/27044784
possible better answer: http://stackoverflow.com/a/27044904
accepted answer: http://stackoverflow.com/a/27044890
has answer: http://stackoverflow.com/a/27044904
tagged with: default-constructor
tagged with: java
has comment: http://stackoverflow.com/comment/42608370
has comment: http://stackoverflow.com/comment/42608198
has answer: http://stackoverflow.com/a/27044881
answer count: 3
downvote count: 0
favorite count: 0
tagged with: abstract-class
has answer: http://stackoverflow.com/a/27044890
has title: Can I Avoid Implementing Parameterized Constructors in Sub-classes
has body: I have an abstract class with a 1-param constructor which should be identical for any concrete sub-class. Does every concrete sub-class have to have that same 1-param constructor, and if so, why? Abstract: public abstract class AbstractClass { public AbstractClass(String name){} public AbstractClass getConcreteClass(){ return (AbstractClass) new ConcreteClass("name"); //Does not work } } Concrete: public class ConcreteClass { /*Would like to have no constructor*/ }
tagged with: concreteclass
type: AnsweredQuestion
tagged with: constructor
score: 1
upvote count: 1
type: Question

bytecode-manipulation
type: Tag
tag name: bytecode-manipulation
tags question: http://stackoverflow.com/q/27048214

http://stackoverflow.com/comment/42769183
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27134690
has text: It depends on your use case. If a user may come back later to download the file, you need to store it somewhere. If you respond right away, you need to send the byte array in your response - there is no need to store it as a file.
score: 0

http://stackoverflow.com/comment/42701139
comment on: http://stackoverflow.com/q/27097661
type: Comment
score: 0
has text: joined column is not exist in your POJO class
type: QuestionComment

http://stackoverflow.com/a/27049440
answers question: http://stackoverflow.com/q/27033781
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42620437
has body: According to every scrap of documentation I can get my hands on, I am supposed to be prompted as to whether or not I want to trust this application. You must be getting old scraps. In recent times, Oracle decided to raise the security level so self-signed apps. were no longer acceptable.
downvote count: 0
has comment: http://stackoverflow.com/comment/42622756
type: Answer

http://stackoverflow.com/q/27044112
tagged with: screen
accepted answer: http://stackoverflow.com/a/27045583
type: AnsweredQuestion
tagged with: rendering
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27052609
tagged with: libgdx
has answer: http://stackoverflow.com/a/27052609
has answer: http://stackoverflow.com/a/27045583
score: 0
has title: LibGdx Background not Rendering
has body: I'm using multiple screens for my LibGdx Java game and I'm having trouble getting the start screen and the death screen rendering the background. The background is in the right place, as I have checked. The Main.java (The game itself) works but nothing else. The only thing that works on the start and death screen is the inputs such as keyboard input. Code: FishGame.java package us.webco.fish; import com.badlogic.gdx.Game; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class FishGame extends Game { public SpriteBatch batch; public void create() { batch = new SpriteBatch(); this.setScreen(new StartScreen(this)); } public void render() { super.render(); } public void dispose() { batch.dispose(); } } StartScreen.java (Empty functions cut out) package us.webco.fish; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Sprite; public class StartScreen implements Screen{ private Texture backgroundImage; private Sprite backgroundToSprite; final FishGame game; public StartScreen(final FishGame gam) { game = gam; backgroundImage = new Texture(Gdx.files.internal("../android/assets/startScreen.jpg")); backgroundToSprite = new Sprite(backgroundImage); backgroundToSprite.setSize(Main.width, Main.height); } @Override public void render(float p) { p = 1/60f; /* FPS */ Gdx.gl.glClearColor(0.4f,0.4f,0.7f,1.0f); /* Setting a default background color */ Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); /* Rendering purposes */ game.batch.begin(); game.batch.draw(backgroundToSprite, Main.width, Main.height); game.batch.end(); if(Gdx.input.isKeyPressed(Keys.X)) { System.out.println("Start Game"); game.setScreen(new Main(game)); dispose(); } if(Gdx.input.isKeyPressed(Keys.Z)) { System.out.println("Game has been quit!"); Gdx.app.exit(); } } Main.java uses game.batch, too. I'm not sure why it's not working as I followed the LibGd…

http://stackoverflow.com/comment/44941108
type: AnswerComment
score: 0
type: Comment
has text: Yes @Que, that was the answer, I got it from a long time but forgot update the post. Thank you.
comment on: http://stackoverflow.com/a/28291973

http://stackoverflow.com/comment/42787666
score: 0
type: AnswerComment
type: Comment
has text: YES!!! It worked !! I now downloadXML and save it in seperate method and download it again if I use WiFi ON method to manipulate directly with data !! And it works !!! THANKS !!!
comment on: http://stackoverflow.com/a/27145862

http://stackoverflow.com/q/27079662
type: UnansweredQuestion
score: 0
has title: My class implements action listener, but my buttons do nothing when clicked.
tagged with: swing
has comment: http://stackoverflow.com/comment/42669253
has comment: http://stackoverflow.com/comment/42677476
has body: I am making a simple text editor. My code extends JFrame and implements ActionListener. I have several constructors but I only included one at the very bottom of my code here just to keep things short. For some reason, whenever I clicked any of the buttons, they do nothing happens. Can anyone help me see what I am doing wrong? public class TextEditor extends JFrame implements ActionListener{ JMenuItem aboutMenuItem; JMenuItem newMenuItem; JMenuItem saveMenuItem; JMenuItem exitMenuItem; JMenu fileMenu; JMenu helpMenu; JMenuItem loadMenuItem; JTextArea textArea; JButton newButton; JButton saveButton; JButton openButton; JButton searchButton; JButton calculatorButton; JButton fToCButton; JButton ozToCupsButton; JButton litersToGallonButton; JTextField fToC; JTextField oz; JTextField liters; public TextEditor(){ super("TextMe"); this.setLayout(new BorderLayout()); loadMenuBar(); loadToolBar(); loadTextArea(); this.pack(); } JTextField searchInputText ; private void loadToolBar() { // TODO Auto-generated method stub JToolBar toolBar; // CALCULATOR BUTTON calculatorButton = new JButton(new ImageIcon(this.getClass().getResource("/images/calculator.png"))); calculatorButton.addActionListener(this); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource() == calculatorButton){ // TODO Auto-generated method stub //super("Unit Converter"); System.out.println("Calculator!"); TextEditor calculator = new TextEditor(); calculator.setVisible(true); calculator.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); this.setLayout(new FlowLayout()); fToC = new JTextField(5); oz = new JTextField(5); liters = new JTextField(5); fToCButton = new JButton("Ferenheit To Celcius"); fToCButton.addActionListener(this); ozToCupsButton = new JButton("Ounces to Cups"); ozToCupsButton.addActionListener(this); litersToGallonButton = new JButton("Liters to Gallons"); litersToGallonButton.addActionListener(this); add(fToCButton, BorderLayout.WEST); add(fTo…
tagged with: actionlistener
tagged with: java
has comment: http://stackoverflow.com/comment/42670902
has comment: http://stackoverflow.com/comment/42670053
has comment: http://stackoverflow.com/comment/42680341
type: Question
has comment: http://stackoverflow.com/comment/42671257
has comment: http://stackoverflow.com/comment/42669189
answer count: 0

http://stackoverflow.com/a/26993425
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26993382
type: Answer
upvote count: 5
has body: You usually keep the single instance of the Singleton class in a static variable of that class. This doesn't make that instance static. Only the reference to it is static. Since you can only obtain that single instance via a static method of the class (you can't explicitly construct instances of a Singleton class via a constructor - otherwise it wouldn't be a singleton), the reference to that instance must be stored in a static variable.
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/26993382

http://stackoverflow.com/comment/42546336
has text: Tried your code it's saying "Syntax error on token ";", . expected" at the };
type: Comment
comment on: http://stackoverflow.com/a/27009144
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42777460
has text: Could you explain a little bit more please? Also my program says The method printf(java.lang.String, int) is undefined for the type primeFactors
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27139772
type: Comment

http://stackoverflow.com/q/27028791
type: Question
has title: Pass non printing character to shell command for Hadoop Streaming Separator
answer count: 1
tagged with: hadoop-streaming
tagged with: shell
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/27029053
tagged with: java
has body: I am using hadoop streaming and I want to change my separator between key and values. I noticed that I can change it using this argument. hadoop jar \ /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hadoop-0.20-mapreduce/contrib/streaming/hadoop-streaming-2.3.0-mr1-cdh5.1.0.jar \ -D stream.map.output.field.separator=. \ ... which will use . instead of \t as the new separator. How can I send a non-printing characters like ^A to the command(start of heading), which is the default separator from Hive?

http://stackoverflow.com/a/27046625
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27046554
answers question: http://stackoverflow.com/q/27046554
type: Answer
downvote count: 0
score: 1
has body: Read the section from the Swing tutorial on How to Use GridBagLayout, especially the section on using the weightx/weighty constraints for the solution to your problem.
upvote count: 1

intellij-idea
tags question: http://stackoverflow.com/q/27108911
tags question: http://stackoverflow.com/q/27037657
tags question: http://stackoverflow.com/q/27085385
tags question: http://stackoverflow.com/q/27080373
tags question: http://stackoverflow.com/q/27075903
tags question: http://stackoverflow.com/q/27070318
tags question: http://stackoverflow.com/q/27088398
tags question: http://stackoverflow.com/q/26994248
type: Tag
tags question: http://stackoverflow.com/q/27078338
tags question: http://stackoverflow.com/q/27021943
tag name: intellij-idea
tags question: http://stackoverflow.com/q/27133698
tags question: http://stackoverflow.com/q/27145627
tags question: http://stackoverflow.com/q/27113432
tags question: http://stackoverflow.com/q/26992877
tags question: http://stackoverflow.com/q/27062281
tags question: http://stackoverflow.com/q/27069720
tags question: http://stackoverflow.com/q/27074991
tags question: http://stackoverflow.com/q/27045233
tags question: http://stackoverflow.com/q/27144432
tags question: http://stackoverflow.com/q/27032016
tags question: http://stackoverflow.com/q/27032622
tags question: http://stackoverflow.com/q/27071431
tags question: http://stackoverflow.com/q/27004141
tags question: http://stackoverflow.com/q/26999175
tags question: http://stackoverflow.com/q/27135371
tags question: http://stackoverflow.com/q/27125411
tags question: http://stackoverflow.com/q/27104466
tags question: http://stackoverflow.com/q/27063562
tags question: http://stackoverflow.com/q/27045174
tags question: http://stackoverflow.com/q/27104556
tags question: http://stackoverflow.com/q/27040411

http://stackoverflow.com/q/26994308
tagged with: java
has answer: http://stackoverflow.com/a/26994594
accepted answer: http://stackoverflow.com/a/26994594
has answer: http://stackoverflow.com/a/26994378
type: Question
upvote count: 2
tagged with: try-catch
has body: Hello i am not that familiar with Exception Handling in Java so: As the Topic says in a basic try/catch block, when i catch an Exception in the Try block, when is the Program flow interrupted? try{ //some code that raises an Exception }catch(Exception e){ // react to interrupt or continue program flow }finally{ // always done after the catch } //when is this code executed? The finally statement is always executed after a try catch, so what has to be done in the catch part to either interrupt the program or let the program continue?
possible better answer: http://stackoverflow.com/a/26994327
has comment: http://stackoverflow.com/comment/42519452
favorite count: 0
has title: java try catch when is the program flow interrupted?
has answer: http://stackoverflow.com/a/26994835
has answer: http://stackoverflow.com/a/26994550
answer count: 5
has comment: http://stackoverflow.com/comment/42519178
has comment: http://stackoverflow.com/comment/42519291
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26994327

http://stackoverflow.com/comment/42598142
score: 0
type: Comment
type: QuestionComment
has text: JDK 1.7.0_25 is quite old ([JRE expired November 15, 2013](http://www.oracle.com/technetwork/java/javase/7u25-relnotes-1955741.html)), current is 1.7.0_71/72.
comment on: http://stackoverflow.com/q/27039052

http://stackoverflow.com/comment/42781727
type: QuestionComment
type: Comment
has text: For such a field I would introduce an additional flag field is_auto (true by default). On user's call of the setField() the is_auto is set to false. The is_auto could be used in trigger or in POJO class.
comment on: http://stackoverflow.com/q/27142376
score: 0

http://stackoverflow.com/q/27149706
has comment: http://stackoverflow.com/comment/42794094
has comment: http://stackoverflow.com/comment/42794110
has comment: http://stackoverflow.com/comment/42794124
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/42794145
type: Question
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/27149843
has comment: http://stackoverflow.com/comment/42797740
has body: I'm making a class involving objects. I'm having trouble with the retrieveMessage method, because when I test it, it returns a NullPointerException. public class PostOffice { public PostOffice(int size) { boxbox = new Letter[size]; } public boolean placeLetter(Letter mail, int boxNum) { if(((boxNum&gt;(boxbox.length-1))||(boxNum&lt;0))||(boxbox[boxNum]!=null)) return false; else{ boxbox[boxNum]=mail; return true; } } /**Returns the message contained within the Letter located in the specific box number. * Returns "Empty!" if the post office box specified by the integer does not contain a Letter. * Returns "Box does not exist!" if there is no box with the specified integer. * @param boxNum The post office box number to be checked. */ public String retrieveMsg(int boxNum) { if(boxNum&lt;=boxbox.length-1) { String swag = boxbox[boxNum].getMsg(); if(swag!=null &amp;&amp; swag.isEmpty()==false) { return swag; } return "Empty!"; } return "Box does not exist!"; } public Letter findSender(String name) { String sender; int index =0; for(int i = 0; i&lt;boxbox.length; i++) { if((boxbox[i].getSender()).equals(name)){ index= i; } else{ return null; } } return boxbox[index]; } }
tagged with: nullpointerexception
upvote count: 1
answer count: 1
favorite count: 0
downvote count: 5
type: UnansweredQuestion
has title: NullPointerException error in Java

http://stackoverflow.com/a/51089565
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/89181837
has comment: http://stackoverflow.com/comment/89213438
downvote count: 0
answers question: http://stackoverflow.com/q/27104466
has body: idea.module.resourceDirs += file('src/dist/etc') Should work since Gradle 4.7 where support for specifying idea resourceDirs has been added.

http://stackoverflow.com/comment/110595216
score: 1
type: AnswerComment
has text: Although this is probably not the "right" answer to the question, it helped me greatly as I am indeed working with anaconda :)
comment on: http://stackoverflow.com/a/57443778
type: Comment

http://stackoverflow.com/comment/42602220
has text: look into this code (you can copy and run it) https://gist.github.com/anonymous/1ca847a3bdda0011a197
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27041007

http://stackoverflow.com/q/27120070
tagged with: java
has comment: http://stackoverflow.com/comment/42744210
type: Question
has title: AssertionError on totally unrelated line of code - Junit test for school project
has comment: http://stackoverflow.com/comment/42744123
has comment: http://stackoverflow.com/comment/42749815
score: 0
has body: I am working on a Java RMI project and I am trying to begin to test the code I've written and when I run the following code, I get an AssertionError on a line that doesn't even have an assertion statement. I am confused as to how to fix this. public void basicTest() throws UnknownHostException, RemoteException, AlreadyBoundException, NotBoundException, InterruptedException { int numBooks = 20; int copiesPerBook = 5; int booksPerMember = 4; // Simulate the server LibraryServerImpl library = new LibraryServerImpl(numBooks, copiesPerBook, booksPerMember); LibraryServer stub = (LibraryServer) java.rmi.server.UnicastRemoteObject.exportObject(library, 0); Registry registry = LocateRegistry.createRegistry(port); registry.bind(libraryName, stub); // Simulate the client Member member = new MemberImpl(); assertNotNull(member.getName()); // Will fail until you implement MemberImpl Thread t = new Thread(new BasicClient(member)); t.start(); t.join(); } This is the copied trace: java.lang.AssertionError at org.junit.Assert.fail(Assert.java:86) at org.junit.Assert.assertTrue(Assert.java:41) at org.junit.Assert.assertNotNull(Assert.java:712) at org.junit.Assert.assertNotNull(Assert.java:722) at PublicTests.basicTest(PublicTests.java:56) 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:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit…
tagged with: assertions
answer count: 1
tagged with: junit
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28070693
tagged with: rmi

http://stackoverflow.com/q/27094544
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/37675253
tagged with: java
score: 13
type: Question
has answer: http://stackoverflow.com/a/27094595
has comment: http://stackoverflow.com/comment/48592371
has body: So I'm using Google Volley for HTTP request, which basically uses Java's HttpURLConnection. According to my tests, the problem is this: When the 'read' timeout on the HttpURLConnection reaches, a silent retry is executed before the connection is closed and the relevant exception thrown (SocketTimeoutException). Note that: - I noticed this error when using HTTP POST request. - 'read' timeout is different than 'connect' timeout. - If the 'read' timeout (set by calling connection.setReadTimeout(int)) is NOT set (0), or set to a greater value than connection.setConnectTimeout(int), this error does not occur. - This issue has been discussed, here for example, but I haven't found any satisfying solution. - A somewhat related issue can be found here, but I'm not sure it is relevant (is it?) More Background My app is used for paying money, so not retrying a request is crucial (yes, I know it can be handled by the server, I want my client to be "correct" anyway). When the 'read' timeout is set, in case the server connection is established, but the server waits/sleeps/delays-response that 'timeout' time before answering (thus raising the 'read' exception and not the 'connect' exception), another (silent) request is sent just before that exception is raised, resulting in 2 similar requests, which is not acceptable. What kind of solution am I looking for? Well, a one that will nicely solve this problem/bug, just like the fix explained here (but I again, I think it's irrelevant in this case). Also, I would want to keep the original flow as is, meaning not forcing the connection to close or anything like that. What I'm gonna do for now, is set the 'read' timeout to twice the 'connection' timeout (they start counting at the same time), to make sure the 'connection' exception is raised first. I will also try to overcome this issue on the server side. The problem is, this 'read' timeout is there for a reason, and my current implementation practically just ignores it, and handles onl…
has answer: http://stackoverflow.com/a/27095233
has answer: http://stackoverflow.com/a/37675253
downvote count: 0
tagged with: httpurlconnection
favorite count: 0
has comment: http://stackoverflow.com/comment/48565063
linked to: http://stackoverflow.com/q/24417817
tagged with: android-volley
tagged with: android
possible better answer: http://stackoverflow.com/a/30245868
has title: Android (Java) HttpURLConnection silent retry on 'read' timeout
linked to: http://stackoverflow.com/q/34168030
answer count: 4
upvote count: 13
has answer: http://stackoverflow.com/a/30245868

http://stackoverflow.com/q/27147567
downvote count: 0
linked to: http://stackoverflow.com/q/8709892
answer count: 1
has comment: http://stackoverflow.com/comment/42790566
linked to: http://stackoverflow.com/q/10957238
favorite count: 0
type: UnansweredQuestion
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/34653473
has title: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x8F' for column 'tweetcontent' at row 1
tagged with: java
has body: I try to save twitter feeds in mysql database in the following table CREATE TABLE `tweets` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tweetcontent` varchar(255) CHARACTER SET utf8mb4 NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; but the following error has appeared java.sql.SQLException: Incorrect string value: '\xF0\x9F\x98\x8F' for column 'tweetcontent' at row 1 Can anyone help me please?
tagged with: mysql
tagged with: twitter
type: Question

http://stackoverflow.com/q/26996590
tagged with: while-loop
tagged with: for-loop
answer count: 3
tagged with: string
has answer: http://stackoverflow.com/a/26997014
has title: Return a string in a while loop
has body: Here, I want to avoid using the line return ""; and instead return all of the values I output with System.out.println(); I have tried using a StringBuilder method, but this outputs nothing when I run my test program. I am guessing that StringBuilder must work differently in a while loop, but I can't find how! Any advice or guidance would be appreciated! public String toString(){ int topLine = size; int topCurrentLine = size; int bottomLine = 1; int bottomCurrentLine = size; while(topCurrentLine&lt;=size){ topCurrentLine= (size-topLine)+1; if (topCurrentLine&lt;=size){ for (int i = 0; i &lt; (topCurrentLine-1); ++i){ System.out.print("."); } System.out.print(starMinusLine(getSandInLine(topLine), ((2*topLine-1)-getSandInLine(topLine)),false)); for (int i = 0; i &lt; (topCurrentLine-1); ++i){ System.out.print("."); } topLine = topLine -1; System.out.print("\n"); } } while(bottomCurrentLine&gt;1){ bottomCurrentLine= (size-bottomLine)+1; for (int i = 0; i &lt; (bottomCurrentLine-1); ++i){ System.out.print("."); } System.out.print(starMinusLine(getSandInLine(bottomLine), ((2*bottomLine-1)-getSandInLine(bottomLine)))); for (int i = 0; i &lt; (bottomCurrentLine-1); ++i){ System.out.print("."); } bottomLine = bottomLine +1; System.out.print("\n"); } return ""; } Here is my attempt with StringBuilder: public String toString(){ int topLine = size; int topCurrentLine = size; int bottomLine = 1; int bottomCurrentLine = size; StringBuilder y = new StringBuilder(); while(topCurrentLine&lt;=size) { topCurrentLine= (size-topLine)+1; if (topCurrentLine&lt;=size){ for (int i = 0; i &lt; (topCurrentLine-1); ++i){ y.append("."); } y.append(starMinusLine(getSandInLine(topLine), ((2*topLine-1)-getSandInLine(topLine)),false)); for (int i = 0; i &lt; (topCurrentLine-1); ++i){ y.append("."); } topLine = topLine -1; y.append("\n"); } } while(bottomCurrentLine &gt; 1) { bottomCurrentLine= (size-bottomLine)+1; for (int i = 0; i &lt; (bottomCurrentLine-1); ++i){ y.append("."); } y.append(starMin…
has comment: http://stackoverflow.com/comment/42524673
has answer: http://stackoverflow.com/a/26997010
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42524229
tagged with: java
accepted answer: http://stackoverflow.com/a/26997014
type: Question
tagged with: stringbuilder
has comment: http://stackoverflow.com/comment/42524104
has comment: http://stackoverflow.com/comment/42523943
possible better answer: http://stackoverflow.com/a/26996850
score: 0
has answer: http://stackoverflow.com/a/26996850

http://stackoverflow.com/comment/42521929
type: QuestionComment
comment on: http://stackoverflow.com/q/26995607
has text: Where were you interviewed? Someone asked the same question a few days ago: http://stackoverflow.com/q/26958118/209629
score: 1
type: Comment

http://stackoverflow.com/comment/42667851
comment on: http://stackoverflow.com/a/27075601
score: 0
type: Comment
has text: I know this post, but it doesn't change my view. Note that I actually did some work with Jboss modules in the past. A big issues is that lack of a services layer, because that's a requirement to actually create modular applications. Modularity is more than just class loading...
type: AnswerComment

http://stackoverflow.com/comment/42678051
type: Comment
has text: While not technically content-assist, I think it does essentially solve the problem. :)
comment on: http://stackoverflow.com/a/27084372
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42692258
type: Comment
score: 0
has text: I updated the question after trying your suggestions! Thanks :)
type: AnswerComment
comment on: http://stackoverflow.com/a/27087193

http://stackoverflow.com/a/27031798
score: 1
has body: You can Fix this by using List&lt;ArrayList&lt;? extends Library&lt;?&gt;&gt;&gt; listTopLibrary = new ArrayList&lt;&gt;();
upvote count: 1
answers question: http://stackoverflow.com/q/27031639
downvote count: 0
type: Answer

http://stackoverflow.com/a/27029056
has body: You can reset "for" loop this way: ... l.add(sb.toString()); temp = temp.substring(sb.length()); i = 0; sb.setLength(0); ...
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27028873

http://stackoverflow.com/comment/42747635
type: QuestionComment
comment on: http://stackoverflow.com/q/27101872
score: 0
has text: @JBNizet , you are right hence I used output.toString() while extending HttpServletResponseWrapper .
type: Comment

http://stackoverflow.com/comment/42562006
has text: As I wrote, I am not sure why this worked, but it did. I would think it would be better to have the answer rather than nothing...
score: 0
comment on: http://stackoverflow.com/a/27017321
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27094316
has title: How should I organize this data in Java?
linked to: http://stackoverflow.com/q/2336692
type: Question
possible better answer: http://stackoverflow.com/a/35762193
answer count: 2
has answer: http://stackoverflow.com/a/27094412
accepted answer: http://stackoverflow.com/a/27094412
upvote count: 1
has comment: http://stackoverflow.com/comment/42694748
favorite count: 0
has comment: http://stackoverflow.com/comment/42694516
has comment: http://stackoverflow.com/comment/42694515
has comment: http://stackoverflow.com/comment/42703858
has body: I'm learning Java after having just come from Haskell, and I'm trying to set up a small class to represent a generic robot. One of the instance variables that I want to add is some kind of representation of the Robot's position. In Haskell, I would have just done something like: type Point = (Float, Float) data Robot = Robot { position :: Point } but, from what I can tell, Java doesn't have any such aliasing, or tuples, so I'll have to look at it another way. I thought of just creating another class called Point, and giving it the 2 instance variables "x" and "y" (or, ideally something a little more descriptive), but that seems clumsy. I'll have to define it in it's own file (every class is in a separate file if I correctly recall), and it will only be a few lines long (unless I need to ever add functionality, like "movement"). My other thought was to just do something like: public class Robot { ... int xPos; int yPos; ... } which is messier, but more compact. Basically, this could all be summed up as: Is it typical in Java to separate a program into a ton of smaller pieces, regardless of the size of the piece? Or, is it typical to group things together if there's little chance of re-use? (I know that ideally, everything is treated as though it may be re-used in the future, and cut off into a million sub-files, but to what extent should this be followed; especially during initial learning?)
has answer: http://stackoverflow.com/a/35762193
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/42536245
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27003242
has text: @SotiriosDelimanolis this class extends from exception that's why I think it's related with exception handling.

http://stackoverflow.com/q/27079976
has answer: http://stackoverflow.com/a/27080040
has body: I was trying to set the password entered in a JPasswordField and this error appeared: "Incompatible types: char[] cannot be converted to String" dts.setSalary(Double.parseDouble(txtSalary.getText())); selected=chgAccess.getSelectedIndex(); dts.setAccess_number((String)chgAccess.getItemAt(selected)); dts.setLogin(txtLogin.getText()); //HERE dts.setPassword((String)txtPassword.getPassword()); How can I fix it? extra question: then it's supposed to go as a VARCHAR type in my database, will it work? I mean, I have created the spaces in the database for text not for passwords; I didn't find a datatype password in MySQL.
tagged with: jpasswordfield
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27080121
answer count: 2
tagged with: char
downvote count: 0
score: 1
tagged with: string
favorite count: 0
has title: char[] cannot be converted to String
type: UnansweredQuestion

http://stackoverflow.com/comment/42564787
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27020057
has text: The *total* memory decreases; do you mean the *free* memory?
score: 0

http://stackoverflow.com/comment/43195587
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27218086
has text: So IIUC you are trying to replicate what is done in the SpeakHere sample? If that's the case it would be awesome if we could get some help porting that sample to RoboVM (as far as possible). We could then have a look at it and fix whatever bugs are there to get it to work properly. Anyone of you up for it? If yes please send a PR to the samples repos here: https://github.com/robovm/robovm-samples.
score: 0

http://stackoverflow.com/a/27100251
answers question: http://stackoverflow.com/q/27100214
score: 1
upvote count: 1
has body: java.lang.Object indeed has three wait methods - one which takes no arguments, one which takes a long, and one which takes a long and an int.
downvote count: 0
type: Answer

http://stackoverflow.com/q/27052003
has answer: http://stackoverflow.com/a/27057521
accepted answer: http://stackoverflow.com/a/27057521
type: Question
score: 0
has title: How to modify an event through a Runnable
tagged with: runnable
answer count: 1
has comment: http://stackoverflow.com/comment/42621090
type: AnsweredQuestion
tagged with: java
tagged with: bukkit
has comment: http://stackoverflow.com/comment/42621255
has body: I have a runnable that fires on an event. I am trying to get a list from the event and clear it, but put the list in Metadata storage in the entity that is created during the event. So far I have tried: Note: the class this is in implements and is an event listener. @EventHandler public synchronized void playerDeathEvent(final EntityDeathEvent event) { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { Entity p = event.getEntity(); // Spawn the Firework, get the FireworkMeta. Firework fw = (Firework) p.getWorld().spawnEntity(p.getLocation(), EntityType.FIREWORK); FireworkMeta fwm = fw.getFireworkMeta(); // Our random generator Random r = new Random(); // Get the type int rt = r.nextInt(4) + 1; Type type = Type.BALL; if (rt == 1) type = Type.BALL; if (rt == 2) type = Type.BALL_LARGE; if (rt == 3) type = Type.BURST; if (rt == 4) type = Type.CREEPER; if (rt == 5) type = Type.STAR; //Get our random colors int r1i = r.nextInt(15) + 1; int r2i = r.nextInt(15) + 1; Color c1 = getColor(r1i); Color c2 = getColor(r2i); // Create our effect with this FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build(); // Then apply the effect to the meta fwm.addEffect(effect); // Generate some random power and set it int rp = r.nextInt(2) + 1; fwm.setPower(rp); // Then apply this to our rocket fw.setFireworkMeta(fwm); // Clear drops and set the drops to be released on explosion //TODO: fix problem where list is cleared before put into Metadata List&lt;ItemStack&gt; list = new ArrayList&lt;ItemStack&gt;(); for (ItemStack stack : event.getDrops()) list.add(stack); fw.setMetadata("dropItems", new FixedMetadataValue(GLDPlugin, list)); event.getDrops().clear(); forceDelete(event); } }); } public void forceDelete(EntityDeathEvent event) { for (int i = 0; i &lt; event.getDrops().size(); i++) event.getDrops().remove(i); } And (just the last section): @EventHandl…

http://stackoverflow.com/comment/42658658
type: AnswerComment
score: 0
type: Comment
has text: This kinda works, but when it runs once, it skips the action the second time it runs, and so on
comment on: http://stackoverflow.com/a/27073338

http://stackoverflow.com/a/27137820
score: 2
answers question: http://stackoverflow.com/q/27137189
has comment: http://stackoverflow.com/comment/42779100
downvote count: 0
upvote count: 2
has body: Try adding this switch to your Java args in the /runtime/bin/jvm.config file (the location of this file can vary with the type of your CF install). -Djavax.net.debug=all Then check the out log (cfusion-out.log in runtime/logs on a standard install) for information on each handshake (outgoing) that it makes. You will likely see some clues there and be able to determine which protocol/level of TLS is reached by SSL connections from the server. This link on diagnosing TLS has some useful tidbits as well - though you will have to figure out how they translate to ColdFusion. Note that the CPL for Java will be of no use to you here. The JVM is started with it's own config file that details what it can and cannot support. The CPL is going to set up standard INI files that are used by a java client (an application on desktop) but CF runs as a serve instance and won't use that information. I'm not even sure where it is stored :)
type: Answer

http://stackoverflow.com/comment/42788291
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/27146294
has text: http://www.informit.com/articles/article.aspx

http://stackoverflow.com/q/27002355
type: Question
has comment: http://stackoverflow.com/comment/42567233
has body: While trying to verify a signed docx file using apache POI OOXML using this code snippet. OPCPackage pkg = OPCPackage.open(inputStream); SignatureConfig sic = new SignatureConfig(); sic.setOpcPackage(pkg); SignatureInfo si = new SignatureInfo(); si.setSignatureConfig(sic); boolean isValid = si.verifySignature(); Here's my exception stacktrace: telling me that there are a class cast exception !! java.lang.ClassCastException: org.apache.xmlbeans.impl.values.XmlAnyTypeImpl cannot be cast to org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference at org.apache.poi.poifs.crypt.dsig.services.RelationshipTransformService.init(RelationshipTransformService.java:150) at org.apache.jcp.xml.dsig.internal.dom.DOMTransform.<init>(DOMTransform.java:92) at org.apache.jcp.xml.dsig.internal.dom.DOMReference.<init>(DOMReference.java:205) at org.apache.jcp.xml.dsig.internal.dom.DOMManifest.<init>(DOMManifest.java:102) at org.apache.jcp.xml.dsig.internal.dom.DOMXMLObject.<init>(DOMXMLObject.java:112) at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.<init>(DOMXMLSignature.java:163) at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory.unmarshal(DOMXMLSignatureFactory.java:206) at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory.unmarshalXMLSignature(DOMXMLSignatureFactory.java:161) at org.apache.poi.poifs.crypt.dsig.SignatureInfo$SignaturePart.validate(SignatureInfo.java:237) at org.apache.poi.poifs.crypt.dsig.SignatureInfo.verifySignature(SignatureInfo.java:296) at com.hamed.docx_signer.DocxSigner.verify(DocxSigner.java:74) Here's my POM: 4.0.0 com.me docx-signer 0.0.1-SNAPSHOT jar docx-signer http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> junit junit 3.8.1 test org.apache.poi poi-ooxml 3.11-beta3 org.bouncycastle bcprov-jdk15on 1.51 org.bouncycastle bcpkix-jdk15on 1.51 org.slf4j slf4j-api 1.7.7 org.apache.santuario xmlsec 2.0.2 Here's my log: 2014/11/19 01:17:28 DEBUG org.apache.poi.openxm…
accepted answer: http://stackoverflow.com/a/27051402
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27051402
tagged with: apache-poi
tagged with: maven
type: AnsweredQuestion
has title: cannot be cast to org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference?
tagged with: java

http://stackoverflow.com/comment/42519271
comment on: http://stackoverflow.com/q/26994301
score: 1
has text: The plugin development tools are still in Luna. Possibly you have downloaded the wrong build of Luna.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42627064
comment on: http://stackoverflow.com/q/27055238
score: 0
type: Comment
has text: do you know which type are you getting? - nvm
type: QuestionComment

http://stackoverflow.com/a/27055512
has comment: http://stackoverflow.com/comment/42678797
has comment: http://stackoverflow.com/comment/42680377
has body: It is because you are adding the item "above" the currently visible items. I understand this looks unexpected if you think about the first position but if RV was showing items from 5 to 10 and a new item is added at position 2, you really don't want your list to move to 4 to 9. So LinearLayoutManager keeps this simple, if an item is added above or below the list, it does not move around (so that UX is consistent). If you want it to show position 0 when you add an item to position 0, call recyclerView.scrollToPosition(0) after adding the item. I think what you really want is: items.add(0, oilChangeableItem); oilChangeableAdapter.notifyItemInserted(0); if (layoutManager.findFirstCompletelyVisibleItemPosition() == 0) { layoutManager.scrollToPosition(0); }
has comment: http://stackoverflow.com/comment/57766953
score: 9
accepted answer of: http://stackoverflow.com/q/27044475
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27044475
has comment: http://stackoverflow.com/comment/42680346
upvote count: 9
has comment: http://stackoverflow.com/comment/42678857
has comment: http://stackoverflow.com/comment/42680934
type: Answer
has comment: http://stackoverflow.com/comment/49753039
downvote count: 0
has comment: http://stackoverflow.com/comment/42679077
has comment: http://stackoverflow.com/comment/42678768
has comment: http://stackoverflow.com/comment/42689923

http://stackoverflow.com/q/27100440
has comment: http://stackoverflow.com/comment/42705300
has comment: http://stackoverflow.com/comment/42705259
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42705412
has answer: http://stackoverflow.com/a/27100504
has comment: http://stackoverflow.com/comment/42705238
has comment: http://stackoverflow.com/comment/42705518
has comment: http://stackoverflow.com/comment/42705189
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42705336
has comment: http://stackoverflow.com/comment/42705399
answer count: 1
tagged with: junit
has title: Failure on calling a method from JUnit Test Case
has body: I have a question: I have such a method in my JUnit Test case: @Test public void test1st_scenario() { out = Mockito.mock(PrintStream.class); System.setOut(out); restaurant = new Restaurant(); employee = new Employee(null, null, null); ArrayList&lt;Employee&gt; employees = new ArrayList&lt;Employee&gt;(); employees.add(new Employee("Luciano", "chef", ExperienceLevel.LOW)); employees.add(new Employee("Naved", "waiter", ExperienceLevel.LOW)); employees.add(new Employee("Fabrizio", "waiter", ExperienceLevel.LOW)); employees.add(new Employee("Amnir", "waiter", ExperienceLevel.LOW)); employees.add(new Employee("Abel", "barman", ExperienceLevel.LOW)); restaurant.setBudget(10000); employee.increaseExperience(employees, 1, "Luciano"); Mockito.verify(out).println("The chef experience level increased"); Assert.assertEquals(8800, restaurant.getBudget()); } And increaseExperience method in Employee class is: public void increaseExperience(ArrayList&lt;Employee&gt; employees, int numberOfEmployee, String employeeName) { restaurant = new Restaurant(); String[] parts = employeeName.split(","); for (int i = 0; i &lt; numberOfEmployee; i++) { for (int a = 0; a &lt; employees.size(); a++) { if (employees.get(a).name.equals(parts[i])) { if (employees.get(a).job.equals("chef") || employees.get(a).job.equals("barman")) { if (employees.get(a).experience.equals(ExperienceLevel.LOW) || employees.get(a).experience.equals(ExperienceLevel.MEDIUM)) { if (restaurant.getBudget() &gt;= 1200) { restaurant.setBudget(restaurant.getBudget() - 1200); if (i == 0) System.out.println("The " + employees.get(a).job + " experience level is increased"); else System.out.println(" and the " + employees.get(a).job + " experience level is increased"); } else { if (i == 0) System.out.println("The " + employees.get(a).job + " experience level is failed to increase"); else System.out.println(" and the " + employees.get(a).job + " experience level is failed to increase"); } } else if (employees.get(a).experience.equa…
score: 0

http://stackoverflow.com/comment/42727245
type: Comment
comment on: http://stackoverflow.com/q/27112188
type: QuestionComment
score: 1
has text: Show us your output. Additionally, do you have any example expected input/output?

http://stackoverflow.com/comment/42549205
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27010964
has text: @KickButtowski ohh k k. Is it possible to get full path in firefox browser or any alternate solution
score: 0

http://stackoverflow.com/q/27022619
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27022678
has body: I have following code with repeated code so I am doing something wrong and there must be better way of doing this. I have common set of statement in the catch section. I can't put this in finally block as these are done for exception scenario only. Other than making separate method to hold this code is there any other approach I can take? public MyResponseDto doSomeWork(MyRequestDto) { .... String jsonStr = null; try { jsonStr = new ObjectMapper().writeValueAsString(MyRequestDto); } catch (JsonGenerationException e) { log.error(e.getMessage()); myResponseDto .setWorkDone(false); myResponseDto .setErrorMessage(e.getMessage()); return myResponseDto ; } catch (JsonMappingException e) { log.error(e.getMessage()); myResponseDto .setWorkDone(false); myResponseDto .setErrorMessage(e.getMessage()); return myResponseDto ; } catch (IOException e) { log.error(e.getMessage()); myResponseDto .setWorkDone(false); myResponseDto .setErrorMessage(e.getMessage()); return myResponseDto ; } myResponseDto = postWorkRequest(jsonStr); return myResponseDto ; }
possible better answer: http://stackoverflow.com/a/27022722
has answer: http://stackoverflow.com/a/27022722
tagged with: refactoring
tagged with: java
has answer: http://stackoverflow.com/a/27022678
has title: Refactoring common code from exception section
type: Question
has comment: http://stackoverflow.com/comment/42569398
type: AnsweredQuestion

http://stackoverflow.com/comment/42751548
score: 0
type: QuestionComment
type: Comment
has text: it's a context problem, till us what's the case here so that we can properly help you, is it a fragment? a regular class out of the Activity to achieve some needs? please illustrate.
comment on: http://stackoverflow.com/q/27125645

http://stackoverflow.com/comment/46268843
type: Comment
comment on: http://stackoverflow.com/a/28993419
has text: First try updating your hadoop version. If that doesn't work, then if you are in a test environment, try this: type 'hadoop classpath' , in your cli. You should get a list of paths where the libraries are picked from. Navigate to each directory in there and replace your guava jar with version with 15 or higher. This is highly dangerous and not recommended. Make sure to back up your old jars as well. But you can try this if you are in a test environment. This makes sure that there are no old versions of guava in your environment.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27094046
has comment: http://stackoverflow.com/comment/42694077
has comment: http://stackoverflow.com/comment/42694397
tagged with: web-services
tagged with: c#
has title: ASP.NET Java Web Service HTTP Request Error
type: UnansweredQuestion
tagged with: apache
answer count: 0
tagged with: asp.net
type: Question
has body: I'm working on a web application developed by using ASP.NET (C#) and we are using a web service developed by Java I've published it to apache and I want to call it using HTTPWebRequest but when trying to call it I have this exception: Internal Server Error - 500 : Java heap Space
has comment: http://stackoverflow.com/comment/42694411
has comment: http://stackoverflow.com/comment/42694057
score: 0
tagged with: java

http://stackoverflow.com/a/27009147
answers question: http://stackoverflow.com/q/27009025
has comment: http://stackoverflow.com/comment/42585013
has comment: http://stackoverflow.com/comment/42584573
type: AcceptedAnswer
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/42584288
downvote count: 0
has comment: http://stackoverflow.com/comment/42584198
has comment: http://stackoverflow.com/comment/42546213
has body: I do not quite get your problem in fact. Wish what I am answering make sense to you :) . In BigInteger it does provide toByteArray() which returns a byte[] containing the 2-compliment representation of the BigInteger itself. On the same time there is a constructor taking byte[]. Therefore your solution can be as easy as getting the byte array, partition the byte array by whatever dirty way you want, and create each result BigInteger accordingly. This should save you from creating lots unnecessary BigIntegers as what you are concerning.
has comment: http://stackoverflow.com/comment/42584838
has comment: http://stackoverflow.com/comment/42547772
score: 3
accepted answer of: http://stackoverflow.com/q/27009025
has comment: http://stackoverflow.com/comment/42584044

http://stackoverflow.com/comment/42584198
type: AnswerComment
has text: imho, the not-in-byte-boundary is not something hard to solve. My biggest concern on your work is more about negative number. Are you going to have 2-complient representation for negative number? And, your splitting logic is going to cause ambiguous result, for example: 1010101 and 1111 are going to give you same result. Is that really what you want?
type: Comment
comment on: http://stackoverflow.com/a/27009147
score: 0

http://stackoverflow.com/q/26997083
has body: I've written a standalone Java (console) application that runs in a cycle of: Check a database for new tasks to perform Perform the tasks Update the database with the results Sleep for n minutes before waking up to repeat the above So, it's basically a daemon running in the background. I'd like to add the ability to ask the application, "Hey app, what are you working on right now? Can you give details on your current task? etc.". Ideally, the app would have an easy way to query it for its state, but I'm not sure how to add this. I've looked at Restlet, and considered signal handling, but I'm looking for suggestions from others. I'm not looking at logging right now since the log files could get very large, and it would be great if the app only generated the info on demand instead of always generating it (I'd like to minimize the impact of this feature on the app's performance). Has anyone else tried doing this, or have recommendations to make? Thanks in advance.
has comment: http://stackoverflow.com/comment/42525027
possible better answer: http://stackoverflow.com/a/26997500
linked to: http://stackoverflow.com/q/15536952
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26997500
score: 0
answer count: 2
has title: Asking an app what it's doing (Java, standalone console app)
has answer: http://stackoverflow.com/a/26997399
accepted answer: http://stackoverflow.com/a/26997399

aspectj
tags question: http://stackoverflow.com/q/27063164
tags question: http://stackoverflow.com/q/27069547
tag name: aspectj
tags question: http://stackoverflow.com/q/27035862
type: Tag
tags question: http://stackoverflow.com/q/27047321
tags question: http://stackoverflow.com/q/27010184

http://stackoverflow.com/a/27022264
downvote count: 0
has body: Yes you can do this in Java with Proxys and reflection. I've done it before. The extra issue you have to worry about is methods that return values. If you are wrapping multiple implementations, which return value do you actually return? In my solution, I use an enum to tell the class to either return the first result from the list or the last result (either way all delegates are called) Here's my code /** * {@code MultipleWrapper} uses dymanic proxies to wrap * several instances of an interface. This allows * all wrapped instances to be called by only a single * call to the wrapper. * @author dkatzel */ public final class MultipleWrapper&lt;T&gt; implements InvocationHandler{ private final ReturnPolicy policy; private final List&lt;T&gt; delegates = new ArrayList&lt;T&gt;(); /** * Since methods can only return a single * return value, only one of the wrapped * methods can be returned to the caller (even though * they will all be called). * @author dkatzel */ public static enum ReturnPolicy{ /** * Return the first wrapped instance. */ RETURN_FIRST, /** * Return the last wrapped instance. */ RETURN_LAST } /** * Create a dynamic proxy to wrap the given delegate instances. * @param &lt;T&gt; the interface to proxy. * @param &lt;I&gt; the instances of T. * @param classType the class object of T. * @param policy the return policy to use on methods that return something. * @param delegates the list of delegates to wrap in the order in which * they will be called. * @return a new instance of T that wraps the delegates. * @throws IllegalArgumentException if no delegates are given * @throws NullPointerException if classType ==null or policy ==null or any delegate ==null. */ @SuppressWarnings("unchecked") public static &lt;T, I extends T&gt; T createMultipleWrapper(Class&lt;T&gt; classType,ReturnPolicy policy, Iterable&lt;I&gt; delegates){ return (T) Proxy.newProxyInstance(classType.getClassLoader(), new Class&lt;?&gt;[]{classType}, new MultipleWrapper&lt;T&gt;(policy,delegate…
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27019889

http://stackoverflow.com/a/27079225
has comment: http://stackoverflow.com/comment/43549568
type: Answer
has body: The problem is with declaring the number member static. This means there's only one such member for the Node class, instead of each instance having its own member. Just define it as an instance variable, and you should be fine: public class Node { private ArrayList&lt;Integer&gt; childs = new ArrayList&lt;Integer&gt;(); private int number; // Note the static was removed // rest of the class
score: 3
accepted answer of: http://stackoverflow.com/q/27079176
downvote count: 0
answers question: http://stackoverflow.com/q/27079176
has comment: http://stackoverflow.com/comment/42668415
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/a/27086346
score: 0
has body: That seems like a JSON string so use a Json Parser... PHP: JSON_decode $parsedStr = json_decode($yourString, true); you can access sites array in $parsedStr['sites'] So, to access the id of the first site: echo $parsedStr['sites'][0]['id']; Java check this answer in SO Decoding JSON String in Java
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27086284
answers question: http://stackoverflow.com/q/27086284

http://stackoverflow.com/comment/42651132
has text: or perhaps show how I might implement the super-implementation in order to refresh it properly? (I'll gladly test it and accept your answer within a few minutes if we can get it working)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27068016

http://stackoverflow.com/comment/42803750
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27119547
score: 0
has text: Is there a reason you can't use [nextFloat()](https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextFloat--)?

http://stackoverflow.com/comment/42788798
comment on: http://stackoverflow.com/a/27146330
type: AnswerComment
has text: Ah, sorry I missed that point. I guess that without specific implementation details it will be difficult to evaluate them in terms of complexity & cost.
score: 0
type: Comment

http://stackoverflow.com/a/27064197
has comment: http://stackoverflow.com/comment/42644991
answers question: http://stackoverflow.com/q/27063410
has body: I'd have to see DEBUG logs, but you really don't need a transaction manager, set acknowledge="transacted" and the container will use local transactions on the session. You typically only need an external transaction manager when synchronizing transactions (e.g. with a JDBC tm) or when using a JTA transaction manager in an app server.
type: Answer
accepted answer of: http://stackoverflow.com/q/27063410
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/42775721
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27136990
score: 0
has text: Even when using createBufferStrategy(3) or 4.

http://stackoverflow.com/q/27051034
answer count: 1
upvote count: 23
has comment: http://stackoverflow.com/comment/99566695
tagged with: optaplanner
has answer: http://stackoverflow.com/a/57321693
has comment: http://stackoverflow.com/comment/71539965
favorite count: 0
has comment: http://stackoverflow.com/comment/42783691
downvote count: 0
has comment: http://stackoverflow.com/comment/42824326
has comment: http://stackoverflow.com/comment/42806144
type: UnansweredQuestion
score: 23
has title: Using Optaplanner to solve VRPTWPD
linked to: http://stackoverflow.com/q/19080537
has body: I'm new to optaplanner, and am hoping to use it to solve the VRPTW problem with pickups and deliveries (VRPTWPD). I started by taking the VRPTW code from the examples repo. I am trying to add to it to solve my problem. However, I'm unable to return a solution that honors the precedence/vehicle constraints (pickups must be done before deliveries, and both must be done by the same vehicle). I am consistently returning a solution where the hard score is what I would expect for such a solution (i.e. I can add up all the violations in a small sample problem and see that the hard score matches the penalties I assigned for these violations). The first approach I tried was following the steps outlined by Geoffrey De Smet here - https://stackoverflow.com/a/19087210/351400 Each Customer has a variable customerType that describes whether it is a pickup (PU) or a delivery (DO). It also has a variable called parcelId that indicates which parcel is either being picked up or delivered. I added a shadow variable to the Customer named parcelIdsOnboard. This is a HashSet that holds all the parcelIds that the driver has with him when he visits a given Customer. My VariableListener that keeps parcelIdsOnboard updated looks like this: public void afterEntityAdded(ScoreDirector scoreDirector, Customer customer) { if (customer instanceof TimeWindowedCustomer) { updateParcelsOnboard(scoreDirector, (TimeWindowedCustomer) customer); } } public void afterVariableChanged(ScoreDirector scoreDirector, Customer customer) { if (customer instanceof TimeWindowedCustomer) { updateParcelsOnboard(scoreDirector, (TimeWindowedCustomer) customer); } } protected void updateParcelsOnboard(ScoreDirector scoreDirector, TimeWindowedCustomer sourceCustomer) { Standstill previousStandstill = sourceCustomer.getPreviousStandstill(); Set&lt;Integer&gt; parcelIdsOnboard = (previousStandstill instanceof TimeWindowedCustomer) ? new HashSet&lt;Integer&gt;(((TimeWindowedCustomer) previousStandstill).getParcelIdsOnboard(…
tagged with: java
has comment: http://stackoverflow.com/comment/42926559
type: Question
tagged with: drools

http://stackoverflow.com/q/27148642
linked to: http://stackoverflow.com/q/373833
has answer: http://stackoverflow.com/a/27148873
has comment: http://stackoverflow.com/comment/42793036
tagged with: java
type: Question
has title: How to read an XML file with several elements
has body: I have an XML file which I wrote that looks like this: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Author name="JKRowling"/> <Author name="SirAConandoyle"/> <Author name="DanBrown"/> What is the simplest way to read this? I need to get the Library name, and all the books in that library, and name of the author who wrote that book. I already have a model called Library so if I can extract the data with each parse, I can set the values onto a Library object. name is an attribute of each element in my xml.
has comment: http://stackoverflow.com/comment/42792608
has answer: http://stackoverflow.com/a/27148879
score: 0
linked to: http://stackoverflow.com/q/19371587
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27149330
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42792449
has answer: http://stackoverflow.com/a/27149560

http://stackoverflow.com/a/27031130
type: Answer
has comment: http://stackoverflow.com/comment/42585877
has comment: http://stackoverflow.com/comment/42601638
answers question: http://stackoverflow.com/q/27030586
has body: You are probably overcomplicating it. Firstly, the type parameter T will not be available in the context of a static method, so you can never write a common static getInstance() method in your base class. Besides, you are trying to maintain a single instance of BaseManager (i.e its subtype) - what will happen to other subtypes when of those subtypes occupies the instance reference? You are better off making the getInstance method abstract (and so non-static) and let the subtypes provide their own implementation (you will lose the singletonness, though). Or write a factory class called Managers that would always get its clients singleton instances of the managers, if you intend to maintain the singletonness.
score: 0

http://stackoverflow.com/comment/42743106
has text: You can use Pagination .
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27099928

http://stackoverflow.com/comment/42780267
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27131418
has text: I'm no Java expert but you are sure that the **null** is NOT causing a problem? Can it not be `private Quantity<Float> quantity = 0;`? Otherwise using `null` is just like saying **undefined** or **non-existant**..
score: 0

http://stackoverflow.com/comment/42821750
type: Comment
comment on: http://stackoverflow.com/a/27131802
score: 0
type: AnswerComment
has text: @NoahHuppert I updated my answer with additional code snippets to retrieve user.

http://stackoverflow.com/comment/42573225
score: 0
has text: Are you executing a 'xmlvalidate' task within your Ant build? Are you behind a proxy?
comment on: http://stackoverflow.com/q/27024471
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27070643
has comment: http://stackoverflow.com/comment/42654181
has body: Keep in mind that randNum.nextInt(10) will give you lottery numbers that range from 0 to 9. You can use a for loop to assign the random numbers to the lotteryNumbers array easier. Also, you should make sure that the random lottery numbers don't repeat. In your compareArrays function, just put one return sameNum call after the outermost for loop, otherwise it won't update with the correct number of matching numbers. You need to give compareArrays() the correct parameters (userDigits and lotteryNumbers) and set sameNum equal to this result.
score: 0
answers question: http://stackoverflow.com/q/27070169
has comment: http://stackoverflow.com/comment/42654076
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27070169
type: Answer

http://stackoverflow.com/q/27057900
has answer: http://stackoverflow.com/a/47510307
tagged with: java
accepted answer: http://stackoverflow.com/a/27057989
has title: in memory database h2 how long keep connection open?
answer count: 2
possible better answer: http://stackoverflow.com/a/47510307
tagged with: sql
downvote count: 0
favorite count: 0
score: 8
tagged with: in-memory-database
upvote count: 8
has body: I am testing currently a H2 DB in memory mode. I set up a connection by h2Con = DriverManager.getConnection( "jdbc:h2:mem:db1", "SA", ""); I want to some imports with dbunit and set up dbUnits db connection IDataBaseConnection dBUnitConnection = new DatabaseConnection(h2con); and the imports which i want to query later So my question is, in memory mode, when can i close the connection? Normaly i do something like this try{ //some sql query }catch{ //error handling }finally{ if(connection!=null) connection.close() } But in memory if the connection is closed i loose the data? So should it stay open until i end my program?
tagged with: connection
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27057989
tagged with: h2
type: Question

http://stackoverflow.com/a/27028696
upvote count: 3
has comment: http://stackoverflow.com/comment/97251938
has comment: http://stackoverflow.com/comment/97211761
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/51574534
type: Answer
accepted answer of: http://stackoverflow.com/q/27028423
score: 3
answers question: http://stackoverflow.com/q/27028423
has comment: http://stackoverflow.com/comment/97256339
has body: Yes, this approach is good and correct one. Yes it is possible to send multiple but you should be aware that they are not "send" they are more something like shared or synchronized between phone and Wear, and can be modified in any further point in time (however I would recommend to save them to SharedPreferences on Wear to be able to access them in offline mode. So Message API sends objects (fast, and simple), and DataItem API is more complex but is used for bigger data and to share things between watch and phone.
has comment: http://stackoverflow.com/comment/42733871

http://stackoverflow.com/a/27103753
score: 0
has body: Yes System.setOut(out) does just that. where out can be any instance of PrintStream. For example : System.setOut(System.err); would set the default output stream to be the same as the default error stream.
type: Answer
has comment: http://stackoverflow.com/comment/42711071
answers question: http://stackoverflow.com/q/27103706

http://stackoverflow.com/a/27099928
has comment: http://stackoverflow.com/comment/42705507
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27099234
score: 2
has comment: http://stackoverflow.com/comment/42743106
has comment: http://stackoverflow.com/comment/42706222
has body: You can use Query sry=s.createQuery("from MyBean where flag='NP'") .setFirstResult(start).setMaxResults(pageSize); for pagination. Or you can increase heap size

http://stackoverflow.com/a/27026218
answers question: http://stackoverflow.com/q/27025863
upvote count: 1
has body: It's actually a type of operator called a pre-decrement, and it's part of a family of 4 operators (see table of java operators) For an integer-type variable called n: post-increment n++ is the equivalent of n = n + 1, the 'post' part means that if you see it in a line of code (ex. foo(n++);) then the line of code will be called Before n is incremented. pre-increment ++n is also the same as n = n + 1 but it occurs Before the line of code it belongs in has been run. post-decrement n-- is the equivalent of n = n - 1 and occurs After the current line of code has been run pre-decrement --n is the equivalent of n = n - 1 and occurs Before the current line of code has been run Example of post vs pre decrement: int n = 5; System.out.println(n--); //This prints 5 System.out.println(n); //This prints 4 System.out.println(--n); //This prints 3 System.out.println(n); //this prints 3
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/42594358
score: 0
has text: where is your onCreate(..)?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27037131

http://stackoverflow.com/a/27041402
upvote count: 8
has comment: http://stackoverflow.com/comment/42602515
score: 8
has body: The type -9 is java.sql.Types.NVARCHAR. Looking at the sources of the SQLServerDialect variants on https://github.com/hibernate/hibernate-orm/tree/master/hibernate-core/src/main/java/org/hibernate/dialect there is no mapping for nvarchar columns. You might want to try to define your own dialect that also registers various NVARCHAR-like definitions: public class SQLServer2008DialectWithNvarchar extends SQLServer2008Dialect { public SQLServer2008DialectWithNvarchar () { registerColumnType( Types.NCLOB, "nvarchar(MAX)" ); registerColumnType( Types.LONGNVARCHAR, "nvarchar(MAX)" ); registerColumnType( Types.NVARCHAR, "nvarchar(MAX)" ); registerColumnType( Types.NVARCHAR, 4000, "nvarchar($1)" ); } } I based this on the definition for VARCHAR in the SQLServer2005Dialect. You may need to put this class in the org.hibernate.dialect package (or at least I seem to remember there are issues if you don't). NOTE: I haven't actually tested this!
has comment: http://stackoverflow.com/comment/42602866
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/42625848
answers question: http://stackoverflow.com/q/27039300

http://stackoverflow.com/q/26997069
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27303849
possible better answer: http://stackoverflow.com/a/37620569
type: Question
has answer: http://stackoverflow.com/a/37620569
accepted answer: http://stackoverflow.com/a/27303849
tagged with: osgi-bundle
has title: Spring MVC with OSGi - how to register new controllers - second part?
answer count: 2
linked to: http://stackoverflow.com/q/4673406
tagged with: osgi
has body: I have maven web application, what used Spring Web MVC and I use in main app @RequestMapping annotation and &lt;context:component-scan base-package="net.arturik.testosgispring.controllers" /&gt; &lt;mvc:annotation-driven /&gt; in mvc-dispatcher-servlet.xml . All works OK, controllers correctly maps with @RequestMapping. It's OK. But hell is starts when I trying to map new controller from OSGi bundle. My bundle code is: package net.arturik.testosgibundle; import net.arturik.testosgispringlib.Vars; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.util.tracker.ServiceTracker; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; //@Configuration //Specifies the class as configuration //@ComponentScan("net.arturik.testosgibundle.controllers") //Specifies which package to scan //@EnableWebMvc //Enables to use Spring's annotations in the code public class Activator implements BundleActivator { private static BundleContext context; private ServiceTracker httpServiceTracker; static BundleContext getContext() { return context; } public void start(BundleContext context) throws Exception { ApplicationContext applicationContext = new FileSystemXmlApplicationContext("k:\\myhostingpanel\\myhostingpanel\\Tests\\TestOSGIBundle\\src\\main\\resources\\dispatcher-context.xml"); System.out.println("STARTING MODULE!!! 2"); Vars.qqq = "!!!!"; } Code of the controller, what I want map to the URL: package net.arturik.testosgispring.controllers.q; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class C1 { @RequestMapping(value = "/77777", method = RequestMethod.GET) public ModelAndView getdata() { ModelAndView model = new ModelAndView("index"); return model; } } Content…
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/42737868
type: Comment
has text: In my code , from the main method, the control is directly going to the finally block. But not into try block. I am confused with the flow of execution.Ideally when return statement is in the try block, the control should move out of the try block right?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27117795

http://stackoverflow.com/a/27075531
has comment: http://stackoverflow.com/comment/42662776
type: Answer
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/42663120
has comment: http://stackoverflow.com/comment/42663213
has body: Use the below code, which will give you an idea about applying rollover effect with rows of a JTable. import java.awt.Component; import java.awt.event.MouseEvent; import javax.swing.*; import javax.swing.event.MouseInputAdapter; import javax.swing.table.*; public class RollOverTable extends JTable { private int rollOverRowIndex = -1; public RollOverTable(TableModel model) { super(model); RollOverListener lst = new RollOverListener(); addMouseMotionListener(lst); addMouseListener(lst); } public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); if( isRowSelected(row) || (row == rollOverRowIndex) ) { c.setForeground(getSelectionForeground()); c.setBackground(getSelectionBackground()); } else { c.setForeground(getForeground()); c.setBackground(getBackground()); } return c; } private class RollOverListener extends MouseInputAdapter { public void mouseExited(MouseEvent e) { rollOverRowIndex = -1; repaint(); } public void mouseMoved(MouseEvent e) { int row = rowAtPoint(e.getPoint()); if( row != rollOverRowIndex ) { rollOverRowIndex = row; repaint(); } } } }
upvote count: 2
has comment: http://stackoverflow.com/comment/42663245
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27075493
has comment: http://stackoverflow.com/comment/42662761
has comment: http://stackoverflow.com/comment/42664430
answers question: http://stackoverflow.com/q/27075493

http://stackoverflow.com/q/27053628
answer count: 2
tagged with: skype
has body: This code is to msg somethone om Skype but I don't know how to set https://play.google.com/store/apps/details?id=com.skype.raider in case I didn't have Skype. skypename.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Uri skypeUri = Uri.parse("skype:username?chat"); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(myIntent); } }); Code added ................................................................................................... skypename.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!isSkypeClientInstalled(activity)) { Context activity; goToMarket(activity); return; } else{ Uri skypeUri = Uri.parse("skype:username?chat"); Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri); myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main")); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(myIntent); } public void goToMarket(Context myContext) { Activity activity; try { activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + "com.skype.raider"))); } catch (android.content.ActivityNotFoundException anfe) { activity. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + "com.skype.raider"))); } return; } public boolean isSkypeClientInstalled(Context myContext) { PackageManager myPackageMgr = myContext.getPackageManager(); try { myPackageMgr.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES); } catch (PackageManager.NameNotFoundException e) { return (false); } return (true); });
has title: How can I play.google for Skype?
accepted answer: http://stackoverflow.com/a/27054398
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27060454
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/27060454
tagged with: message
type: AnsweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27054398
type: Question

http://stackoverflow.com/q/27039497
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42601178
has body: I have to make a java applet looking like this [IMG]http://i58.tinypic.com/15guqs4.png[/IMG]. The snake is made of 5 rect's, each one with 20px height and 20px width. With the use of a thread i have to make it move only at the edge's and clockwise (like in the picture). Here is my code, i know how to draw the snake, and i know how to make it move from left to right, i have trouble moving it top to bottom, right to left and bottom to top... any help would be appreciated :). import javax.swing.JApplet; import java.awt.*; import java.awt.event.*; import java.util.logging.Logger; import javax.swing.*; import javax.swing.border.TitledBorder; import javax.swing.JComboBox; import javax.swing.JApplet; import javax.swing.JSlider; import java.awt.Color; import java.awt.Graphics; import java.util.logging.Level; import java.util.logging.Logger; public class Treta extends JApplet implements Runnable { private int x = 0; private int y = 0; private int dx = 5; public void init(){ Thread t = new Thread(this); t.start(); } public void paint(Graphics g){ super.paint(g); g.setColor(Color.BLUE); g.fillRect(x, y, 20, 20); g.fillRect(x+20, y, 20, 20); g.fillRect(x+40, y, 20, 20); g.fillRect(x+60, y, 20, 20); g.fillRect(x+80, y, 20, 20); g.setColor(Color.BLACK); g.drawRect(x, y, 20, 20); g.drawRect(x+20, y, 20, 20); g.drawRect(x+40, y, 20, 20); g.drawRect(x+60, y, 20, 20); g.drawRect(x+80, y, 20, 20); } public void run(){ while(true){ x += dx; repaint(); if(x &gt;= getWidth()-20){ y += 5; } try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
tagged with: java
type: Question
has title: (not traditional) snake game in JAVA
tagged with: applet
has comment: http://stackoverflow.com/comment/42598927
has comment: http://stackoverflow.com/comment/42601102
score: 0
answer count: 0

http://stackoverflow.com/comment/42681615
type: AnswerComment
comment on: http://stackoverflow.com/a/27086604
has text: Never is a strong word. try { array = new byte[bufsize]; } catch (final OutOfMemoryError e) { // ... } seems completely fine with me.
type: Comment
score: 2

http://stackoverflow.com/comment/42886533
comment on: http://stackoverflow.com/a/27110370
has text: Time for me to find a new hobby it seems... :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42764501
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27132824
has text: `The second answer in this thread` ... hehehe ... order of the answers is changing dynamically

http://stackoverflow.com/a/27150291
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27064412
has body: Short answer : you can't hide/remove these classes as they are needed at runtime by your application. In my opinon, you have 3 alternatives : Change the classes access to "package private". Yes, doing that doesn't make it impossible to access them, but these classes won't be accessible directly. Remove the classes and create an API. You want to hide the logic ? Remove it and provide it through a REST API for instance. Depending or your architecture, it could be difficult or impossible. Create all the instance of these classes in a dynamic way, with Class.forName, using Spring or as in @Steve K answer, with Java's ServiceLoader. As a result, you will be able to remove these classes from the main jar and make them more private, in a way. Again, classes will be here but a little less accessible.
answers question: http://stackoverflow.com/q/27064412

http://stackoverflow.com/q/27073572
score: 0
tagged with: loops
answer count: 1
accepted answer: http://stackoverflow.com/a/27073619
tagged with: do-while
has comment: http://stackoverflow.com/comment/42659134
tagged with: java
has title: Java Do-while loop not working?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42659152
has answer: http://stackoverflow.com/a/27073619
type: Question
has body: I honestly have no idea while my do-while loop is not working. Every time I run the program it just skips over it and moves on without even asking for the reply. import java.util.*; public class CourseApp { public static void main(String[] args) { Scanner s = new Scanner(System.in); ArrayList &lt;Course&gt; courseList = new ArrayList&lt;Course&gt;(); String reply; //boolean boolVal = true; do { System.out.print("Enter new course number: "); String tempCourseNum = s.nextLine(); System.out.print("Enter course name: "); String tempCourseName = s.nextLine(); System.out.print("Enter instructor's last name: "); String tempLastName = s.nextLine(); System.out.print("Enter instructor's first name: "); String tempFirstName = s.nextLine(); System.out.print("Enter instructor's username: "); String tempUsername = s.nextLine(); //new Instructor(tempLastName, tempFirstName, tempUsername); Instructor tempInstruc = new Instructor(tempLastName, tempFirstName, tempUsername); System.out.print("Enter textbook title: "); String tempTitle = s.nextLine(); System.out.print("Enter textbook author: "); String tempAuthor = s.nextLine(); System.out.print("Enter textbook price (no $ sign): "); double tempPrice = s.nextDouble(); //new TextBook(tempTitle, tempAuthor, tempPrice); TextBook tempText = new TextBook(tempTitle, tempAuthor, tempPrice); courseList.add(new Course(tempCourseNum, tempCourseName, tempInstruc, tempText )); System.out.print("\nEnter another course? (y/n): "); reply = s.nextLine(); } while (reply.equalsIgnoreCase("Y")); for (int i =0; i &lt; courseList.size(); i++) { System.out.println("\n\tCourse #" + (i+1)+":"); System.out.println(courseList.get(i)); } } } If anyone could tell me what the problem is that would be great

http://stackoverflow.com/comment/42799311
comment on: http://stackoverflow.com/q/27152369
type: Comment
type: QuestionComment
score: 2
has text: If you are using an IDE like eclipse, you can easily select the code segment and press Ctrl+Alt+M to extract method. IDE will take care of variables.

http://stackoverflow.com/a/27091154
answers question: http://stackoverflow.com/q/27091144
upvote count: 1
score: 1
downvote count: 0
has body: Catch the exception and return null.
type: Answer

http://stackoverflow.com/q/26993334
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42517923
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/38325807
tagged with: rabbitmq
has comment: http://stackoverflow.com/comment/42517524
has comment: http://stackoverflow.com/comment/42523218
has comment: http://stackoverflow.com/comment/42631396
has title: Websocket message delivery intermittent
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42548784
tagged with: spring-websocket
has comment: http://stackoverflow.com/comment/42548868
has comment: http://stackoverflow.com/comment/42631693
has answer: http://stackoverflow.com/a/50070416
has body: I am using Spring 4 websocket with RabbitMQ and STOMP. My broker xml is : &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:stomp-broker-relay prefix="/topic" relay-host="${websocket.relay.host}" relay-port="61613" client-login="XXXX" client-passcode="XXXX" system-login="XXXX" system-passcode="XXXX" heartbeat-send-interval="20000" heartbeat-receive-interval="20000"/&gt; &lt;!-- &lt;websocket:simple-broker prefix="/topic"/&gt; --&gt; &lt;websocket:client-inbound-channel&gt; &lt;websocket:executor core-pool-size="50" max-pool-size="100" queue-capacity="100" keep-alive-seconds="60"/&gt; &lt;/websocket:client-inbound-channel&gt; &lt;websocket:client-outbound-channel&gt; &lt;websocket:executor core-pool-size="50" max-pool-size="100" queue-capacity="100" keep-alive-seconds="60"/&gt; &lt;/websocket:client-outbound-channel&gt; &lt;websocket:broker-channel&gt; &lt;websocket:executor core-pool-size="50" max-pool-size="100" queue-capacity="100" keep-alive-seconds="60"/&gt; &lt;/websocket:broker-channel&gt; &lt;/websocket:message-broker&gt; Messages are getting lost on client intermittently. I have used SimpMessagingTemplate to forward message to broker. I have also configured size for text as : &lt;beans:bean class="org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean "&gt; &lt;beans:property name="maxTextMessageBufferSize" value="8192000"/&gt; &lt;beans:property name="maxBinaryMessageBufferSize" value="8192000"/&gt; &lt;/beans:bean&gt; I am not able to understand whther messages are getting lost from Server to Broker or broker to browser. Any Help will be appreciated.

last-modified
type: Tag
tags question: http://stackoverflow.com/q/27013672
tag name: last-modified

http://stackoverflow.com/a/27130033
type: Answer
score: 0
has body: It was stateHelper problem, I stored these attributes on component initialize, in a backing bean using: getStateHelper().put("formObject", formObject); getStateHelper().put("formDataObject", formDataObject); turns out it prevents them from changing on update until you clear all attributes from a State Helper before you try to set them again. getStateHelper().remove("formObject"); getStateHelper().remove("formDataObject");
answers question: http://stackoverflow.com/q/27123995

http://stackoverflow.com/a/27019932
upvote count: 1
has body: When the last time inner loop execute value of j = 9 and when j become 11 it exits. You are storing each value of j in the same index. ie. you are overwriting the element[i] each time in the inner loop and i doesn't change in the inner loop. So only the final value of j is available. Below code will give the first five odd numbers ie (1, 3, 5, 7, 9) for(int i=0,j=1; i &lt;= 4; j=j+2,i++) { element[i] = j; }
type: Answer
answers question: http://stackoverflow.com/q/27019748
downvote count: 0
score: 1

http://stackoverflow.com/q/27138958
type: Question
has comment: http://stackoverflow.com/comment/42776025
tagged with: jframe
score: 0
answer count: 2
has body: Ok so I'm creating a Menu/GUI for a program I am working on but I don't have too much experience with this so I need some help with the component organization and the layout. Right now, when I run this code, as you can see in the picture (sorry I don't have enough rep to embed it, new to stackoverflow) there Is a large space between The JTextField and the where the previous buttons / window border is. It would be great if someone could help me fix this. :) Thanks. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class WindowWin extends JFrame implements ActionListener { JPanel[] row = new JPanel[4]; JButton[] button = new JButton[4]; String[] buttonString = {"Copy to Clipboard","Go","Back","Info"}; int[] dimW = {400,200,65}; int[] dimH = {40,100}; Dimension keyDim = new Dimension(dimW[0],dimH[0]); Dimension displayDimension = new Dimension(dimW[0],dimH[1]); Dimension butDim = new Dimension(dimW[1],dimH[0]); Dimension infoDim = new Dimension(dimW[2],dimH[0]); JEditorPane display = new JEditorPane(); Font font = new Font("Times new Roman",Font.PLAIN, 14); JTextField keyIn = new JTextField(24); JEditorPane msgIn = new JEditorPane(); JScrollPane scrollerD = new JScrollPane(display,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JScrollPane scrollerM = new JScrollPane(msgIn,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); public static void main(String[] args) { WindowWin c = new WindowWin(); } WindowWin(){ super("Test"); // setDesign(); //setSize(380,250); setSize(460,500); setResizable(true); setDefaultCloseOperation(EXIT_ON_CLOSE); GridLayout grid = new GridLayout(4,3); setLayout(grid); FlowLayout f1 = new FlowLayout(FlowLayout.CENTER); FlowLayout f2 = new FlowLayout(FlowLayout.CENTER,1,1); //FlowLayout South for(int i = 0; i &lt; 4; i++) row[i] = new JPanel(); row[0].setLayout(f1); for(int i = 1; i &lt; 4; i++) row[i].setLayout(f2); for(int i = 0; i &lt; 4; i++) { button[i] = n…
has answer: http://stackoverflow.com/a/27139181
tagged with: components
has comment: http://stackoverflow.com/comment/42776014
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27139108
has title: JTextField in a JFrame is taking too much space outside the actual text field

http://stackoverflow.com/q/27067477
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/6115896
has answer: http://stackoverflow.com/a/27067636
tagged with: signature
has title: what is the effect that explicits the "throw exception" in the method signature
tagged with: exception
has answer: http://stackoverflow.com/a/27067567
has body: --the effects of case 1 and 2 are the same, why need to add the exception declaration in method signature? //case 1 public void doSomething() throws Exception { //do Something } public void Caller() { try { doSomething(); } catch (Exception e) { //handle the exception } } //case 2 public void doSomething() { //do Something } public void Caller() { try { doSomething(); } catch (Exception e) { //handle the exception } } reference: what is the use of throws Exception
tagged with: throw
answer count: 4
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/27067636
has answer: http://stackoverflow.com/a/27067587
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/27067572
accepted answer: http://stackoverflow.com/a/27067572

http://stackoverflow.com/comment/42737200
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27117107
has text: @elvas, I have 4GB RAM. When I tag 100,000 words, it works fine. When I try to tag 200,000 words, it throws the error. I am not greedy for tokenizing and tagging at the same time. I don't know how to do it separately. Could you please show me how to.
score: 0

bloom-filter
type: Tag
tag name: bloom-filter
tags question: http://stackoverflow.com/q/27027323

http://stackoverflow.com/comment/42552116
type: Comment
comment on: http://stackoverflow.com/a/27012493
type: AnswerComment
has text: This @Path( Constants.API_POST_CITYLISTID_NAME ) is valid only when Constants.API_POST_CITYLISTID_NAME ="<some hard coded string>" and not for Constants.API_POST_CITYLISTID_NAME=property.getproperty("<propertyName>")
score: 0

http://stackoverflow.com/comment/42554734
type: AnswerComment
comment on: http://stackoverflow.com/a/27014403
type: Comment
has text: @Karina if your getter returns mutable objects (such as a `List`), it is possible to modify it by invoking the getter. This is not possible for `Integer`.
score: 0

http://stackoverflow.com/comment/42713639
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27105146
has text: what if `value.toString().split("\s+")` produces only one string? Or none? What's value?
type: Comment

http://stackoverflow.com/a/27127891
score: 2
has comment: http://stackoverflow.com/comment/42755485
has body: Since you just created the ArrayList instance exp, exp.get(i) doesn't exist, so you can't call exp.get(i).setxxx(...). EDIT : Try : void certNode(ArrayList&lt;B&gt; certResp) { ArrayList&lt;RespNode&gt; exp = new ArrayList&lt;RespNode&gt;(); for (int i = 0; i&lt; certResp.size(); i++) { exp.add(certResp.get(i).getxxx()); } } It's hard to be sure without knowing the return value of certResp.get(i).getxxx(), but if it returns RespNode, the code above would add that RespNode instance of the list.
has comment: http://stackoverflow.com/comment/42755370
upvote count: 2
has comment: http://stackoverflow.com/comment/42755061
has comment: http://stackoverflow.com/comment/42755487
answers question: http://stackoverflow.com/q/27127865
downvote count: 0
has comment: http://stackoverflow.com/comment/42755277
type: Answer
has comment: http://stackoverflow.com/comment/42755017

http://stackoverflow.com/comment/42770640
has text: Also `if ( wordsDistributionList.containsKey(word.toLowerCase()) == true )` is redundant, `if ( wordsDistributionList.containsKey(word.toLowerCase()) ` is enough.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27136134

http://stackoverflow.com/q/27044253
type: Question
has comment: http://stackoverflow.com/comment/42609212
has comment: http://stackoverflow.com/comment/42609244
linked to: http://stackoverflow.com/q/27024140
has comment: http://stackoverflow.com/comment/42645722
has body: I am using CDI to initialize a DataSource (See my previous question: DataSource initialization error within liberty profile server) public abstract class DAOBase { @Resource(name="jdbc/Oracle", lookup = "jdbc/Oracle") private DataSource ds; This works well when the DAO class is initialized directly from the REST class: @Path("/audit") public class AuditREST extends RESTBase implements AuditRESTInterface { @Inject private AuditDAO auditDAO = new AuditDAO(); And when the REST class calls an intermediate class which calls the DAO I can do it by: public class JobConfigurationREST extends RESTBase implements JobConfigurationRESTInterface { @Inject private JobRunner jr = new JobRunner(); public class JobRunner implements Runnable{ @Inject private JobConfigurationDAO jcDAO = new JobConfigurationDAO(); However JobRunner also contains a method which creates some instances of a class (SampleModel) on the fly. SampleModel then contains a dao which I need to inject. public class SampleModel extends Step implements Model { @Inject private ModelDAO modelDAO = new ModelDAO(); I can see no way of adding the link between JobRunner and SampleModel. How do I do this? Alternatively, is this even necessary? I feel that having to specify all the links between the REST class and the DAO class is overly complicated, and I should be able to declare SampleModel somewhere (possibly beans.xml?), and the container should take care of everything for me. EDIT: I was simplifying the problem here. SampleModel is created via a Job class which is created via a method in a JobBuilder class (which I also can't seem to inject). JobBuilder jb = new JobBuilder(); Job j = jb.buildJob(jc, jobContext); SampleModel is also created via reflection deep within the buildJob method. public Job buildJob(JobConfiguration inJobConfiguration, JobContext inJobContext) { stepList.add(ModelFactory.getInstance().getModel(sc.getImplementationName())); } And within the Factory: ret = (Model) Class.forName(tmpImplDetail.getC…
has comment: http://stackoverflow.com/comment/42608790
score: 0
answer count: 1
tagged with: cdi
accepted answer: http://stackoverflow.com/a/27090660
tagged with: websphere-liberty
has comment: http://stackoverflow.com/comment/42609727
type: AnsweredQuestion
has title: CDI Injection through multiple levels?
has answer: http://stackoverflow.com/a/27090660
tagged with: java

http://stackoverflow.com/q/27046674
has body: In reference to this post I am creating a charting engine and I have everything setup where a GET request returns an SVG. I am using JFreeSVG (extremely similar to Batik). I can render the SVG using a iframe and object HTML tag. I want to use a img tag to create the svg image, but it gives me a blank box. I have scoured the web and truly cannot find anything and you are my last hope. Here is an example of what my request returns: <?xml version="1.0" standalone="no"?> <rect x="0" y="0" width="423" height="452" style="fill: rgb(255,255,255); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#4989619974245clip-0)"/> <g transform="matrix(1,0,0,1,0,0)"> November 19, 2014 <g style="fill: url(#4989619974245gp0); fill-opacity: 1.0; stroke: none" transform="matrix(1,0,0,1,0,0)" clip-path="url(#4989619974245clip-1)"> <rect x="5" y="8" width="386.62" height="412.27" style="stroke-width: 1.0;stroke: rgb(204,204,204);stroke-opacity: 1.0;; fill: none" transform="matrix(1,0,0,1,0,0)" clip-path="url(#4989619974245clip-0)"/>
score: 0
answer count: 1
tagged with: batik
tagged with: http://stackoverflow.com/tag/svg
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27051021
tagged with: java
tagged with: jfreechart
linked to: http://stackoverflow.com/q/3453482
type: Question
has title: Java & SVG using the img tag

http://stackoverflow.com/comment/42644520
comment on: http://stackoverflow.com/q/27065520
has text: Take a look at this: http://www.codeproject.com/Articles/35018/Access-MS-Access-Databases-from-Java
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27095671
has comment: http://stackoverflow.com/comment/42696903
downvote count: 1
has comment: http://stackoverflow.com/comment/42696949
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/27095557
score: -1
has body: well, can't see any obvious issues here. However, I would say the "protected" attribute using here not looking good to me, would recommend in Question class you have: private ArrayList&lt;Answer&gt; answers = new ArrayList&lt;Answer&gt;(); protected ArrayList&lt;Answer&gt; getAnswers(){ return answers; } In sub class TrueFalse, refer that by getter method System.out.println(question.getAnswers()); question.getAnswers().add(answer);

http://stackoverflow.com/comment/42766949
score: 1
type: AnswerComment
type: Comment
has text: @Brendanten You assign `Numerator + "/" + Denominator;` to both of them.
comment on: http://stackoverflow.com/a/27134003

http://stackoverflow.com/a/27142127
answers question: http://stackoverflow.com/q/27142092
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42781308
has body: chances are, you read from the scanner before the while loop, and you didn't use nextLine, you used something like nextInt. This leaves characters remaining on that same line. YOu want to clear them out with a readLine() before the loop, so that when you ask in the loop, it will wait for you. To be sure, however you should show what happens before the loop.
upvote count: 2

http://stackoverflow.com/comment/42767100
has text: Yeah, seeing SecurityException in logs. Thanks!
type: Comment
comment on: http://stackoverflow.com/q/27131612
type: QuestionComment
score: 1

http://stackoverflow.com/comment/42556011
has text: Thanks a lot @M.Deinum I change the version of web.xml and all works.
type: QuestionComment
comment on: http://stackoverflow.com/q/27014776
score: 0
type: Comment

http://stackoverflow.com/comment/42550008
comment on: http://stackoverflow.com/a/26997672
has text: @Rouby it is true for Java. Once the constructor exits the field cannot be reassigned.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42697865
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27094716
has text: @SergiyMedvynskyy I have written and added a Demo code Please check and see if the problem can be fixed.

http://stackoverflow.com/comment/42792555
comment on: http://stackoverflow.com/a/27148745
has text: @Darkhogg depends on matching algorithm. you can use `instanceof`, class equality or whatever else.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42793224
comment on: http://stackoverflow.com/a/27146373
type: Comment
has text: @user3514596 you should import GetChildList in import section of file
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42725337
score: 0
comment on: http://stackoverflow.com/q/27095136
type: Comment
type: QuestionComment
has text: the format is dd-MM-yyyy brazilian date. but the initbinder solves.

user-interface
tags question: http://stackoverflow.com/q/27146918
tags question: http://stackoverflow.com/q/27083253
tags question: http://stackoverflow.com/q/27150303
tags question: http://stackoverflow.com/q/27127715
tags question: http://stackoverflow.com/q/27044303
tags question: http://stackoverflow.com/q/27092649
tags question: http://stackoverflow.com/q/27110635
tags question: http://stackoverflow.com/q/27089651
tags question: http://stackoverflow.com/q/27038386
tags question: http://stackoverflow.com/q/27036702
type: Tag
tags question: http://stackoverflow.com/q/27042021
tags question: http://stackoverflow.com/q/27133327
tags question: http://stackoverflow.com/q/27071128
tags question: http://stackoverflow.com/q/27015795
tags question: http://stackoverflow.com/q/27095312
tags question: http://stackoverflow.com/q/27097200
tags question: http://stackoverflow.com/q/27085026
tags question: http://stackoverflow.com/q/27128165
tags question: http://stackoverflow.com/q/27086707
tags question: http://stackoverflow.com/q/27081058
tags question: http://stackoverflow.com/q/27084319
tags question: http://stackoverflow.com/q/27080663
tags question: http://stackoverflow.com/q/27145591
tags question: http://stackoverflow.com/q/27118212
tags question: http://stackoverflow.com/q/27129155
tags question: http://stackoverflow.com/q/27028662
tags question: http://stackoverflow.com/q/27052523
tags question: http://stackoverflow.com/q/27105232
tags question: http://stackoverflow.com/q/27013920
tags question: http://stackoverflow.com/q/27106673
tags question: http://stackoverflow.com/q/27069913
tags question: http://stackoverflow.com/q/27128491
tags question: http://stackoverflow.com/q/27007695
tags question: http://stackoverflow.com/q/26996828
tags question: http://stackoverflow.com/q/27031805
tags question: http://stackoverflow.com/q/27150414
tags question: http://stackoverflow.com/q/27040895
tags question: http://stackoverflow.com/q/27053149
tags question: http://stackoverflow.com/q/27060788
tags question: http://stackoverflow.com/q/27066881
tags question: http://stackoverflow.com/q/27011203
tags question: http://stackoverflow.com/q/27015463
tags question: http://stackoverflow.com/q/27093249
tags question: http://stackoverflow.com/q/26997893
tags question: http://stackoverflow.com/q/27006596
tags question: http://stackoverflow.com/q/27009975
tags question: http://stackoverflow.com/q/27006045
tag name: user-interface
tags question: http://stackoverflow.com/q/27101517
tags question: http://stackoverflow.com/q/27083020
tags question: http://stackoverflow.com/q/27073828
tags question: http://stackoverflow.com/q/26995784
tags question: http://stackoverflow.com/q/27051937
tags question: http://stackoverflow.com/q/27049654

http://stackoverflow.com/q/27078224
answer count: 3
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/27080128
favorite count: 0
has comment: http://stackoverflow.com/comment/42668010
has answer: http://stackoverflow.com/a/27079002
has body: //UPDATE// Now I can load a Jar, but how can I run methods from it?
linked to: http://stackoverflow.com/q/60764
score: 2
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42667935
type: Question
has comment: http://stackoverflow.com/comment/42666691
tagged with: java
has answer: http://stackoverflow.com/a/27078280
tagged with: class
has title: Java how to load a Class from another jar to my jar and how to use it

http://stackoverflow.com/q/27033180
has answer: http://stackoverflow.com/a/27033845
tagged with: java
type: Question
tagged with: hadoop
has title: Formatting namenode for Hadoop Installation
has body: How to format Namenode of HDFS? I have tried folliwing commands raj@raj-SVE15115ENB:~$ /home/raj/hadoop/bin/hadoop namenode -format Warning: $HADOOP_HOME is deprecated. /home/raj/hadoop/bin/hadoop: line 320: /usr/lib/jvm/java-7-sun/bin/java: No such file or directory /home/raj/hadoop/bin/hadoop: line 390: /usr/lib/jvm/java-7-sun/bin/java: No such file or directory Why this is happening?
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42603101
has answer: http://stackoverflow.com/a/27034315
tagged with: linux
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27033790

http://stackoverflow.com/comment/43137396
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27218086
type: Comment
has text: No luck, Marc. The code inside the callback isn't executing. Have you already tested it?

http://stackoverflow.com/comment/42778029
comment on: http://stackoverflow.com/q/27140106
score: 1
type: Comment
type: QuestionComment
has text: what do you mean you are using maven for the heavy lifting? Is there a noticeable difference running `mvn test` from the command line? Why does performance of tests matter, is it affecting functionality of the tests?

http://stackoverflow.com/q/27065195
downvote count: 1
tagged with: inject
has answer: http://stackoverflow.com/a/78616776
has body: I am having some troubles passing a dependency while unit testing with JUnit. Consider these pieces of code: This is the dependacy injecton into the class which i want to test, lets call it Controller. @Inject private FastPowering fastPowering; And this is the unit test: @RunWith(MockitoJUnitRunner.class) public class ControllerTest { @Mock FastPowering fastPower; @InjectMocks Controller controller; @Test public void test() { assertEquals( (controller.computeAnswer(new BigDecimal(2), 2)).longValue(), (long) Math.pow(2, 2)); } } It seems that fastPower is null, please explain how to fix that. Null pointer exception , because of calling the @injected field (fastPower) inside the .computeAnswer method) Edit: Solved i should have read about the difference between @Mock and @Spy... Due to a lot of comments I am adding some more context to the solution The difference is that in mock, you are creating a complete mock or fake object while in spy, there is the real object and you just spying or stubbing specific methods of it. While in spy objects, of course, since it is a real method, when you are not stubbing the method, then it will call the real method behavior. If fastPower is annotated as @Mock it's methods are dummy, yet controller.computeAnswer depends on them to compute. One must provide behaviour. If spy is used without stubbing then the real implementation of fastPower is being executed which eventually returns desired value. Another option is to use a real FastPowering instance https://github.com/mockito/mockito/wiki/Using-Spies-(and-Fakes) https://github.com/mockito/mockito/wiki/Mocking-Object-Creation And some stackoverflow thread outlining the difference Mocking vs. Spying in mocking frameworks Short Answer: Replace @Mock with @Spy and should be working fine
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42651733
has comment: http://stackoverflow.com/comment/111793203
has title: Null after @InjectMocks
tagged with: mocking
linked to: http://stackoverflow.com/q/12827580
tagged with: null
tagged with: mockito
has answer: http://stackoverflow.com/a/58520093
has answer: http://stackoverflow.com/a/78890843
favorite count: 0
has answer: http://stackoverflow.com/a/53036608
has answer: http://stackoverflow.com/a/27069042
has answer: http://stackoverflow.com/a/58806006
type: Question
has comment: http://stackoverflow.com/comment/111497909
has answer: http://stackoverflow.com/a/73715662
answer count: 8
has answer: http://stackoverflow.com/a/34290929
has comment: http://stackoverflow.com/comment/42652618
score: 24
upvote count: 25
has comment: http://stackoverflow.com/comment/84484764

http://stackoverflow.com/q/27061050
type: UnansweredQuestion
type: Question
tagged with: network-protocols
tagged with: network-programming
tagged with: java
has comment: http://stackoverflow.com/comment/47855634
has body: I want to create a Java application that connects to my android phone, accesses my phones messages, files and .. That I could send or download photos, or send messages directly from my pc. What connection should I use that I would be capable to do all these things?
downvote count: 0
has title: Android - Java connection through wifi
tagged with: android
favorite count: 0
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/47855108
upvote count: 2

http://stackoverflow.com/a/27242903
accepted answer of: http://stackoverflow.com/q/27142674
downvote count: 0
has body: Here is the hackish way I was able to do it. I changed my workflow to find the available free slave rather than finding if a slave was busy and then checking the next one to see it is free. This Groovy script counts the number of busy executors on the Slave. It polls continuously till it finds an online slave with zero number of busy executors. I hate polling and will request knowledgeable members to chip in with suggestions to somehow plug into Jenkins event based notification. import hudson.FilePath import hudson.model.Node import hudson.model.Slave import jenkins.model.Jenkins import groovy.time.* Jenkins jenkins = Jenkins.instance def jenkinsNodes =jenkins.nodes while(1) { for (Node node in jenkinsNodes) { sleep(1000) // Make sure slave is online if (!node.getComputer().isOffline()) { //Make sure that the slave busy executor number is 0. if(node.getComputer().countBusy()==0) { println &quot;'$node.nodeName' can take jobs !!!&quot; return 0 } else { println &quot;$node.nodeName' is busy !!!&quot; } } else { println &quot;'$node.nodeName' is offline !!!&quot; } } sleep(1000) } This runs as job and returns as soon as it finds a suitable slave. Return 0 is a success in Jenkins. I am open to better ways of doing it. I am not really happy with this continuous polling I have to do.
has comment: http://stackoverflow.com/comment/105924342
type: Answer
has comment: http://stackoverflow.com/comment/85035408
upvote count: 10
answers question: http://stackoverflow.com/q/27142674
type: AcceptedAnswer
score: 10

http://stackoverflow.com/a/27119733
has comment: http://stackoverflow.com/comment/42741048
has comment: http://stackoverflow.com/comment/42741095
accepted answer of: http://stackoverflow.com/q/27119547
has comment: http://stackoverflow.com/comment/42740928
has comment: http://stackoverflow.com/comment/42741088
answers question: http://stackoverflow.com/q/27119547
type: AcceptedAnswer
has body: If you only want to round when rand==1.0f, then I second @paxdiablo's answer. However, it sounds like you're okay with always rounding, and simply want to always round down. If so: float rand = Math.nextDown((float)Math.random()); from the javadoc: nextDown(float f) Returns the floating-point value adjacent to f in the direction of negative infinity. In response to your comment - good point. To avoid that problem, you could simply wrap the statement in a call to Math.abs(), which will have no affect except when the result of nextDown() is negative. float rand = Math.abs(Math.nextDown((float)Math.random()));
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/42740867
has comment: http://stackoverflow.com/comment/42741042
score: 1
has comment: http://stackoverflow.com/comment/42740981

http://stackoverflow.com/q/26993751
tagged with: spring-security
linked to: http://stackoverflow.com/q/628416
type: Question
answer count: 1
score: 0
tagged with: java
has body: I've been doing some reading and I'm still not quite sure -- is Spring Security JAAS-based, or is it doing a thing of it's own? Could somebody please go into some more details and explain it to me, or maybe provide some useful links? Thanks!
has answer: http://stackoverflow.com/a/26993841
has comment: http://stackoverflow.com/comment/42541290
has title: Is Spring Security JAAS-based?
type: UnansweredQuestion

http://stackoverflow.com/a/27077583
answers question: http://stackoverflow.com/q/27077510
has body: change out.write(b) and fos.write(b) to fos.write(b, 0, x); That will resolve the error.
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42665965
type: Answer
accepted answer of: http://stackoverflow.com/q/27077510
upvote count: 1

http://stackoverflow.com/comment/42633068
type: Comment
comment on: http://stackoverflow.com/a/27052609
score: 0
type: AnswerComment
has text: I've not had to use a camera before, should I be using one?

http://stackoverflow.com/a/27120443
score: 0
type: Answer
has body: @Override public void run() { // TODO Auto-generated method stub while(running) { try { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cm.getActiveNetworkInfo(); if (info != null) { if (info.isConnected()) { // you got a connection! tell your user! Log.i("Post", "Connected"); running=false; runOnUiThread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub pd.dismiss(); } }); Intent intent_service=new Intent(this, anotherActivity.class); context.startService(intent_service); } } Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
answers question: http://stackoverflow.com/q/27120183

http://stackoverflow.com/comment/44044890
type: Comment
has text: err, scratch that. This works only in some situations (works for deletion of a component, and when readding, but not when adding an entirely new component)
comment on: http://stackoverflow.com/a/27817365
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42742197
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27103170
score: 0
has text: Sorry for confusion. I wanted to just put what approach I have tried. Yes my main goal is to run web sockets on separate machine. Thanks for making question more clear.

http://stackoverflow.com/a/27400272
type: Answer
accepted answer of: http://stackoverflow.com/q/27115420
score: 0
answers question: http://stackoverflow.com/q/27115420
has body: I found the error. I didn't use the full package name for the API-Key. After I made sure that the package name used in the API-Key is equal to the package name defined in the AndroidManifest.xml it worked.
type: AcceptedAnswer

http://stackoverflow.com/comment/42808093
score: 0
type: Comment
type: QuestionComment
has text: Interesting. That would suggest that there are less than four lines in the file. Did you check that the file was getting written correctly? Does it fix it if you close the `PrintWriter` before you start reading the file? Please try adding `outputFile.close();` before the line `Scanner keyboard = new Scanner(System.in);` and see if it helps. If it does, I'll write it up as an answer.
comment on: http://stackoverflow.com/q/27141429

http://stackoverflow.com/comment/42584753
type: QuestionComment
score: 1
has text: @Luciano I think `filename` accepts whatever is in `getImages()` and returns a `String` e.g. `img -> entity.filename(img)`. OP could clarify.
comment on: http://stackoverflow.com/q/27031244
type: Comment

http://stackoverflow.com/comment/42664447
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27076828
has text: http://developer.android.com/reference/android/hardware/Camera.html Follow step by step this link
type: Comment

http://stackoverflow.com/comment/42735484
has text: @JeffreyBlattman, yeah; if you look at the bottom of the stack trace, you can see that the OS is trying to `getIntForUser` in response to the phone's orientation changing. So it seems that something I've done is causing that operation to fail for some reason.
comment on: http://stackoverflow.com/q/27114764
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42741859
comment on: http://stackoverflow.com/a/27099007
type: AnswerComment
score: 0
has text: Is it possible then to implement transactions on top of normal file systems?
type: Comment

http://stackoverflow.com/q/27132206
has body: Ok, so now it displays. The Panel is covered up by the lines I have drawn, and I am currently working on figuring out what layout to use. BorderLayout doesn't seem to work the way I want it, but there are many others to try. Thank you for the help, and if you have any other advice, I would love to hear it. Another addition before I log of for the night: I have settled on the GridLayout, because I can control the size of all the components and then size the frame to fit them all. Now I am working on the inputs. How do I get the information from the TextFields in the JPanel into the JComponent to use as data? The problem arises in the paintComponent method of the JComponent class near the bottom. I will use this solution to help with the networking part of the project. Here is the code I have so far: import javax.swing.*; import java.awt.*; public class GoBoard extends JFrame { public static void main(String[] args) { Graphics g; JFrame goframe=new JFrame("Go"); goframe.setDefaultCloseOperation(EXIT_ON_CLOSE); goframe.setSize(600,700); goframe.setLayout(new GridLayout()); JPanel panel=new JPanel(); JComponent component=new gocomponent(); panel.setBackground(Color.WHITE); JButton passbutton=new JButton("Pass"); JButton sendbutton=new JButton("Send"); JLabel label=new JLabel("Enter the coordinates of the intesection you want to play on."); JLabel label2=new JLabel("Click send, Or click pass"); JLabel blank=new JLabel(" "); JLabel blank2=new JLabel(" "); JTextField text1=new JTextField(10); JTextField text2=new JTextField(10); panel.add(label); panel.add(label2); panel.add(blank); panel.add(blank2); panel.add(passbutton); panel.add(sendbutton); panel.add(text1); panel.add(text2); component.setOpaque(false); component.setSize(450,450); component.setVisible(true); goframe.add(component); goframe.add(panel); goframe.setVisible(true); } } class gocomponent extends JComponent { public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; for(int i=0;i&lt;=9;i++) {…
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43062886
score: 1
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42763503
upvote count: 1
has answer: http://stackoverflow.com/a/27325819
has title: Drawing multiple lines (minimum 9x9) in JFrame
tagged with: java
has comment: http://stackoverflow.com/comment/42763400
has comment: http://stackoverflow.com/comment/43061082
type: Question

http://stackoverflow.com/comment/42534488
comment on: http://stackoverflow.com/a/27000234
score: 0
type: AnswerComment
has text: @hfontanez I don't see what there is to discuss.
type: Comment

http://stackoverflow.com/q/27017294
tagged with: xssf
has body: I'm trying to work with XSSFWorkbook in my web application. I ran a sample application with XSSFWorkbook as a plain Java program (with public static void main(String args[])) - it runs fine - an excel sheet is generated. However, when I run the same piece of code in my java based web application - an instance of XSSFWorkbook is not instantiated. No Exception is thrown either! Please help!
tagged with: java
has comment: http://stackoverflow.com/comment/42559823
type: Question
tagged with: jakarta-ee
has title: Unable to instantiate an object of XSSFWorkbook in Java servlet
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27017415
type: UnansweredQuestion

http://stackoverflow.com/comment/42657210
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27072224
score: 0
has text: You could try using the [Java Application Bundler](https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html), demonstrated [here](http://stackoverflow.com/questions/24978212/jar-to-mac-osx-app-bundle-with-app-bundler/24992828#24992828)

http://stackoverflow.com/comment/42653593
type: QuestionComment
comment on: http://stackoverflow.com/q/27069786
type: Comment
has text: Exactly what does *//SAME FOR REST OF CRITERIAS* mean?
score: 0

http://stackoverflow.com/q/27033712
tagged with: apache-storm
type: Question
tagged with: apache-kafka
tagged with: apache-zookeeper
has title: Zookeeper cluster set up
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42620828
type: UnansweredQuestion
tagged with: bigdata
has body: I am able to set up zookeeper cluster on 1 machine with 3 different ports, but when I do the same with different IP to have zookeeper instance on different machines, it throws following error: 2014-11-20 12:16:24,819 [myid:1] - INFO [main:QuorumPeerMain@127] - Starting quorum peer 2014-11-20 12:16:24,827 [myid:1] - INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181 2014-11-20 12:16:24,842 [myid:1] - INFO [main:QuorumPeer@959] - tickTime set to 2000 2014-11-20 12:16:24,842 [myid:1] - INFO [main:QuorumPeer@979] - minSessionTimeout set to -1 2014-11-20 12:16:24,842 [myid:1] - INFO [main:QuorumPeer@990] - maxSessionTimeout set to -1 2014-11-20 12:16:24,842 [myid:1] - INFO [main:QuorumPeer@1005] - initLimit set to 10 2014-11-20 12:16:24,857 [myid:1] - INFO [Thread-1:QuorumCnxManager$Listener@504] - My election bind port: /172.16.1.175:2223 2014-11-20 12:16:24,870 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer@714] - LOOKING 2014-11-20 12:16:24,873 [myid:1] - INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@815] - New election. My id = 1, proposed zxid=0x0 2014-11-20 12:16:24,876 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection@597] - Notification: 1 (message format version), 1 (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), 1 (n.sid), 0x0 (n.peerEpoch) LOOKING (my state) 2014-11-20 12:16:24,881 [myid:1] - WARN [WorkerSender[myid=1]:QuorumCnxManager@382] - Cannot open channel to 2 at election address /172.16.1.170:2223 java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at org.apache.zookeeper.se…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27067863
has answer: http://stackoverflow.com/a/47393198
linked to: http://stackoverflow.com/q/26732514
upvote count: 1

http://stackoverflow.com/a/27047963
has body: The array field arr belongs to an instance of the class, hence its length cannot be determined by the Field object obtained via reflection as this is essentially class level metadata.
has comment: http://stackoverflow.com/comment/42613973
upvote count: 2
has comment: http://stackoverflow.com/comment/42613873
type: Answer
answers question: http://stackoverflow.com/q/27047843
score: 2
downvote count: 0

http://stackoverflow.com/comment/42558787
has text: the `foreach` should be replaced with `var newString = String.Join("",array);`
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/27016114
type: Comment

http://stackoverflow.com/comment/42733006
type: QuestionComment
has text: Can you give us a stack trace, and identify which line the exception is being thrown from?
comment on: http://stackoverflow.com/q/27114503
score: 0
type: Comment

http://stackoverflow.com/comment/42670678
has text: @Voo both are slower than c++ and java ! look at my edit 1 :)
score: 0
comment on: http://stackoverflow.com/q/27079644
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42709160
has text: You added `rowStatePreserved="true"`.. why ? And please modify your question so we can see the scopes, etc. I'm not BalucC btw..
type: Comment
comment on: http://stackoverflow.com/a/27101816
score: 0
type: AnswerComment

file-upload
tags question: http://stackoverflow.com/q/27050018
tags question: http://stackoverflow.com/q/27101931
type: Tag
tag name: file-upload
tags question: http://stackoverflow.com/q/27115524
tags question: http://stackoverflow.com/q/27061209

http://stackoverflow.com/comment/42737901
type: AnswerComment
has text: Thanks for the answer, is there any design pattern involved for this design ?
type: Comment
comment on: http://stackoverflow.com/a/27117831
score: 0

http://stackoverflow.com/comment/42795760
type: QuestionComment
has text: @Manish Maheshwari Yes, there is a REST client which will discover an instances of the service (depending on how many have been made available) which many not be the previous service instance
comment on: http://stackoverflow.com/q/27149392
score: 0
type: Comment

http://stackoverflow.com/comment/42591470
comment on: http://stackoverflow.com/a/27032909
type: AnswerComment
score: 0
type: Comment
has text: Instead of `Message message = new MimeMessage(session);` try using `MimeMessage message = new MimeMessage(session);`

http://stackoverflow.com/a/42034871
has body: return the input stream which file will be downloaded from direct database -- public static InputStream getTheDbFileInputStreamWhereId(String id) { try { String sql = "select songFile from songs where id= ?"; Connection con = getConnectionGp(); PreparedStatement stat = con.prepareStatement(sql); stat.setString(1, id); ResultSet result = stat.executeQuery(); if (result.next()) { return result.getBinaryStream(1); } } catch (Exception e) { System.out.println("prolbem in dao dwonload"); e.printStackTrace(); } return null; } make the road clear to download the file in the doGet method -- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String id = request.getParameter("id"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); try { String fileName = Dao.getFileNameWhereId(id); if (fileName == null) { System.out.println("file name not found!"); return; } String resContentType = "APPLICATION/OCTET-STREAM"; response.setContentType(resContentType); String headerKey = "Content-Disposition"; String headerValue = String.format("attachment; filename=\"%s\"", fileName); response.setHeader(headerKey, headerValue); InputStream in = Dao.getTheDbFileInputStreamWhereId(id); if (in == null) { System.out.println("file not found according to id"); return; } for (int i = in.read(); i != -1; i = in.read()) { out.write(i); } in.close(); out.close(); } catch (Exception e) { System.out.println("problem occurs"); } }
answers question: http://stackoverflow.com/q/27090246
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27090246

http://stackoverflow.com/q/27071731
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42683455
type: Question
has body: I created a simple Android app in Eclipse ADT, just a simple Hello World. The IDE I am using was downloaded from the Android web site, seems it's based on Eclipse Juno and has the ADT plugin. My OS is Windows 7, 64 bit. OK, then I created an AVD in the IDE (from a Nexus 5 template; just lowered the memory to 512MB). The problem is that I keep getting this error when I try to start the AVD (with no app in it). Seems like it's in some loop and keeps printing this in the LogCat and the AVD screen is just black. What might be wrong? How does one normally troubleshoot such issues? I am new to Android (but not to Java). 11-21 22:50:01.740: A/libc(1275): Fatal signal 6 (SIGABRT) at 0x4fb (code=-6), thread 1275 (surfaceflinger) 11-21 22:50:04.030: W/AudioFlinger(1278): Thread AudioOut_2 cannot connect to the power manager service 11-21 22:50:04.060: W/AudioFlinger(1278): Thread AudioOut_2 cannot connect to the power manager service 11-21 22:50:04.060: W/AudioFlinger(1278): Thread AudioOut_2 cannot connect to the power manager service 11-21 22:50:04.060: E/AudioFlinger(1278): no wake lock to update! 11-21 22:50:04.090: E/AudioFlinger(1278): int android::load_audio_interface(const char*, audio_hw_device_t**) couldn't load audio hw module audio.r_submix (No such file or directory) 11-21 22:50:04.090: W/AudioPolicyManagerBase(1278): could not open HW module r_submix 11-21 22:50:05.970: W/InterfaceController(1325): Warning (dlopen failed: library "/system/lib/libnetcmdiface.so" not found) while opening the net interface command library 11-21 22:50:06.530: E/SurfaceFlinger(1326): hwcomposer module not found 11-21 22:50:06.530: E/SurfaceFlinger(1326): ERROR: failed to open framebuffer (No such file or directory), aborting
answer count: 1
tagged with: adt
downvote count: 0
has comment: http://stackoverflow.com/comment/42674099
has answer: http://stackoverflow.com/a/27115778
has title: AVD won't start up
tagged with: android
has comment: http://stackoverflow.com/comment/42656232
tagged with: android-virtual-device
favorite count: 0
has comment: http://stackoverflow.com/comment/42656349
upvote count: 1
accepted answer: http://stackoverflow.com/a/27115778
has comment: http://stackoverflow.com/comment/42674270
has comment: http://stackoverflow.com/comment/42674133
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42674218
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42674120
has comment: http://stackoverflow.com/comment/42674203
has comment: http://stackoverflow.com/comment/42674151

http://stackoverflow.com/q/27102679
tagged with: java
has answer: http://stackoverflow.com/a/27102927
has title: How to set activity no history parameter only in some cases?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: themes
has comment: http://stackoverflow.com/comment/42710869
tagged with: android
has comment: http://stackoverflow.com/comment/42710840
type: AnsweredQuestion
upvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/27102927
score: 3
has body: I have the following configuration, I have one application that is the Main app, and another application that is considered as a Theme of the first app. The second application can't function without the first one. Now, I have to deal with two cases: User installs the second app while he already has the first Main app. User installs the second app but he does not have the first Main app. In the first case when the users run the second app (Theme), I want to redirect him to the first app (Main) as it's already installed. In this case I would like to remove the activity of the second app (Theme) from the stack. So that if users presses back, it will return him to the android desktop instead of the second (Theme) app. In this case the user should not be aware that there was an activity in the middle. In the second case I would like to run the activity of the second app (Theme). This activity has a button that redirect the user to go to google play and install the first app (main). In this case if the user decides to press the back button he will go from google play, back to the activity of the second app (Theme), so in this case I want the user see this activity and it's should be located in the stack as opposed to the first case. This is my current activity code: public class MainActivity extends Activity { private Context mContext; private RelativeLayout rlShareAndWin; private TextView tvInPrizeTitle, tvPrizeDesc; private boolean isCorrespondingKiboAppInstalled; private String kiboAppPackageName; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initControllers(); initControllerListeners(); } @Override protected void onResume() { super.onResume(); String themePackageName = getPackageName(); kiboAppPackageName = themePackageName.substring(0, ( themePackageName.indexOf(getResources().getString(R.string.theme_away_suffix_string)))); boolean isCorrespondingKiboAppInstalled = isKiboAppInstalledOrNot(kiboAppPackageName); if (…

http://stackoverflow.com/comment/42578157
type: AnswerComment
score: 0
has text: So I've updated it so that the two drinks do not go below 0 or above 10, and I've changed it so that the total '0' area is a textview, but can I manipulate text view in java?
type: Comment
comment on: http://stackoverflow.com/a/27006283

http://stackoverflow.com/comment/42644862
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27065534
has text: Yes when I run the code it throws a null pointer exception.
type: Comment

http://stackoverflow.com/comment/42760620
type: QuestionComment
has text: All user input is read as `String` or per single `byte`. If you read `byte` by `byte`, then good luck. If you read `String` by `String`, then you will need to convert `String` into `Integer`, and use this `Integer` however you want/need, which in this case seems to be the key and value for your `Map`.
score: 0
comment on: http://stackoverflow.com/q/27130534
type: Comment

http://stackoverflow.com/q/27095565
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42697471
has comment: http://stackoverflow.com/comment/42706244
has comment: http://stackoverflow.com/comment/42696774
has title: Java Threading in my Connect 4 game
score: 0
has comment: http://stackoverflow.com/comment/42697633
has comment: http://stackoverflow.com/comment/42696824
has comment: http://stackoverflow.com/comment/42705793
type: UnansweredQuestion
has body: Okay, so I'm working on a Connect 4 game for my Java class and this is what I have so far. I'm trying to get the sleep thread method to work(at the bottom) but I'm not sure how to get it to only call the first one for the first click and the second one for the second click and so on. Any help or input is appreciated import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Color; import java.awt.Font; import javax.swing.*; public class ConnectMain extends JFrame implements ActionListener { private JButton btn1, btn2, btn3, btn4, btn5, btn6, btn7; private JButton Reset; private JTextField[][] text; private char myLabel; private Moving mover; public ConnectMain() { this.setLayout(null); this.setBounds(400,300, 600, 600); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.getContentPane().setBackground(Color.cyan); text = new JTextField [7][6]; for (int a = 0 ; a &lt; 7; a++) { for (int b = 0; b &lt; 6; b++) { text[a][b] = new JTextField(); add(text[a][b]); text[a][b].setBounds(50 + (a*70), (b+3) * 50 , 50, 50); text[a][b].addActionListener(this); Font font = new Font("Verdana", Font.BOLD, 20); text[a][b].setFont(font); text[a][b].setHorizontalAlignmen(JFormattedTextField.CENTER); text[a][b].setForeground(Color.red); } } mover = new Moving(text); btn1 = new JButton(); add(btn1); btn1.setBounds(50, 50, 50, 50); btn1.addActionListener(this); btn2 = new JButton(); add(btn2); btn2.setBounds(120, 50, 50, 50); btn2.addActionListener(this); btn3 = new JButton(); add(btn3); btn3.setBounds(190, 50, 50, 50); btn3.addActionListener(this); btn4 = new JButton(); add(btn4); btn4.setBounds(260, 50, 50, 50); btn4.addActionListener(this); btn5 = new JButton(); add(btn5); btn5.setBounds(330, 50, 50, 50); btn5.addActionListener(this); btn6 = new JButton(); add(btn6); btn6.setBounds(400, 50, 50, 50); btn6.addActionListener(this); btn7 = new JButton(); add(btn7); btn7.setBounds(470, 50, 50, 50); btn7.addActionListener(this); Rese…
tagged with: multithreading
tagged with: swing
has comment: http://stackoverflow.com/comment/42697042
has comment: http://stackoverflow.com/comment/42697768

http://stackoverflow.com/q/27080797
favorite count: 0
upvote count: 5
tagged with: spring-data-mongodb
has answer: http://stackoverflow.com/a/33426206
has title: MongoDB Spring Data Repository - Cache methods
accepted answer: http://stackoverflow.com/a/33426206
downvote count: 0
tagged with: spring-data
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: mongodb
has body: I need to have calls to MongoDB cached using spring @Cacheable annotation: public interface SiteRepository extends PagingAndSortingRepository&lt;Site, String&gt;{ @Cacheable List&lt;Site&gt; findByStatus(Site.Status status); } Unfortunately, annotating any method in the interface with @Cacheable causes the following exception: Nov 22, 2014 7:11:06 PM org.apache.catalina.core.ApplicationContext log SEVERE: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'example': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.example.repositories.mongodb.SiteRepository com.example.siteRepo; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'siteRepository': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.sun.proxy.$Proxy92]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy92 at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1147) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.…
score: 5
answer count: 1

http://stackoverflow.com/a/27056927
score: 0
has comment: http://stackoverflow.com/comment/42629818
answers question: http://stackoverflow.com/q/27056663
type: Answer
has body: Check the Solr log for a better error of what the issue is when Solr is starting up - you'll probably have a better error message there than the one you can see in the Admin interface (which is the error triggered when the interface attempts to access the Solr core). The reason why the core or requestHandler isn't loading will be in the log file, and not in the message produced by the UI. Remember that logging also changed at 4.3, if you've updated to 4.10 (I see that you wrote 4.1, but if you're planning on going the whole way (or meant 4.10) - the logging might have to be configured as well). You'll also want to consider the "going from 3 to 4" document, that details the changed to the configuration files (as solrconfig.xml changed a bit). Update The log shows that it's complaining about loading "solr.DisMaxRequestHandler". This has been deprecated for quite some time and has been removed - just use the standard request handler from the example solrconfig.xml instead. explicit

http://stackoverflow.com/comment/42630012
comment on: http://stackoverflow.com/q/27057227
score: 1
has text: In File -> Project Structure (Strg+Alt+Shift+S) under 'SDK Location' you can check if you point to the right JDK. If only your JRE is Java 1.7 download the Java 7 JDK additionally.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/127741076
score: 0
has text: @MarkRotteveel I dont, provide option to remove request to reopen and problem solved as I explained it was by mistake. But it looks like you are not aware of that, so obviously missing functionality to revert accidentaly requested reopen. Maybe add that to save some time, just a suggestion
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27121831

http://stackoverflow.com/q/27133328
answer count: 1
tagged with: build-helper-maven-plugin
score: 0
has title: Unable to see generated test source folder with mojo's build-helper
tagged with: maven-plugin
type: UnansweredQuestion
type: Question
tagged with: mojo
has body: I have added the mojo's plugin build-helper to my project pom to generate a new test source folder for my integration tests. When I run the phase, generate-test-sources mvn generate-test-sources I could see the below console output showing the test source folder has generated, but When I look in project explorer, I don't see any folder which was created. [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for ******* [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.google.guava:guava:jar -> version 18.0 vs ${guava.version} @ line 154, column 21 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.unitils:unitils-core:jar -> duplicate declaration of version 3.3 @ line 164, column 21 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building projectxxStaticAnalysisxxxxx versionxxxxx [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ StaticAnalysis --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 4 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ StaticAnalysis --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- build-helper-maven-plugin:1.9:add-test-source (add-integration-test-sources) @ StaticAnalysis --- [INFO] Test Source directory: C:\{workspacepath}\src\integration-test\java added. [INFO] -------------------…
tagged with: java
has answer: http://stackoverflow.com/a/27135462

http://stackoverflow.com/comment/42535488
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27002620
has text: Seeing how there are many different types of socket implementations and many different ways for the network to become unstable/shutdown which determines whether the data has actually left the local network or not, this question is pretty broad. If you could, try making it a bit more specific

jdbc
tags question: http://stackoverflow.com/q/27139011
tags question: http://stackoverflow.com/q/27024140
tags question: http://stackoverflow.com/q/27060702
tags question: http://stackoverflow.com/q/27123521
tags question: http://stackoverflow.com/q/27037510
tags question: http://stackoverflow.com/q/27108960
tags question: http://stackoverflow.com/q/27095713
tags question: http://stackoverflow.com/q/27102735
tags question: http://stackoverflow.com/q/27084037
tags question: http://stackoverflow.com/q/27096917
tags question: http://stackoverflow.com/q/27073624
tags question: http://stackoverflow.com/q/27076705
tags question: http://stackoverflow.com/q/27095205
tags question: http://stackoverflow.com/q/27148541
tags question: http://stackoverflow.com/q/27113075
tags question: http://stackoverflow.com/q/27032778
tags question: http://stackoverflow.com/q/27063063
tags question: http://stackoverflow.com/q/27070310
tags question: http://stackoverflow.com/q/27097537
tags question: http://stackoverflow.com/q/27135226
tags question: http://stackoverflow.com/q/27113689
tags question: http://stackoverflow.com/q/27108141
tags question: http://stackoverflow.com/q/27074410
type: Tag
tags question: http://stackoverflow.com/q/27032910
tags question: http://stackoverflow.com/q/27069093
tags question: http://stackoverflow.com/q/27144132
tags question: http://stackoverflow.com/q/27011330
tags question: http://stackoverflow.com/q/27058454
tags question: http://stackoverflow.com/q/27111849
tags question: http://stackoverflow.com/q/27043186
tags question: http://stackoverflow.com/q/27042571
tags question: http://stackoverflow.com/q/27078016
tags question: http://stackoverflow.com/q/27030462
tags question: http://stackoverflow.com/q/27070341
tags question: http://stackoverflow.com/q/27113372
tags question: http://stackoverflow.com/q/27102600
tags question: http://stackoverflow.com/q/27063315
tags question: http://stackoverflow.com/q/27024765
tags question: http://stackoverflow.com/q/27002256
tags question: http://stackoverflow.com/q/27066098
tags question: http://stackoverflow.com/q/27140183
tags question: http://stackoverflow.com/q/27060563
tags question: http://stackoverflow.com/q/27065520
tags question: http://stackoverflow.com/q/27022406
tags question: http://stackoverflow.com/q/27120555
tags question: http://stackoverflow.com/q/27029391
tags question: http://stackoverflow.com/q/27152182
tags question: http://stackoverflow.com/q/27049130
tags question: http://stackoverflow.com/q/27062973
tags question: http://stackoverflow.com/q/27094056
tags question: http://stackoverflow.com/q/27132648
tags question: http://stackoverflow.com/q/27089923
tags question: http://stackoverflow.com/q/27106711
tags question: http://stackoverflow.com/q/27018186
tags question: http://stackoverflow.com/q/27098301
tags question: http://stackoverflow.com/q/27079070
tag name: jdbc
tags question: http://stackoverflow.com/q/27071223
tags question: http://stackoverflow.com/q/27105082
tags question: http://stackoverflow.com/q/27033954
tags question: http://stackoverflow.com/q/27039300
tags question: http://stackoverflow.com/q/27124177
tags question: http://stackoverflow.com/q/27051271
tags question: http://stackoverflow.com/q/27062896
tags question: http://stackoverflow.com/q/27050935
tags question: http://stackoverflow.com/q/27023475
tags question: http://stackoverflow.com/q/27111344
tags question: http://stackoverflow.com/q/27081976
tags question: http://stackoverflow.com/q/27037998

http://stackoverflow.com/a/27068557
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27067746
downvote count: 0
has body: Well, if I understood what you're trying to do from your comment on Eran's answer (it may be a good idea to provide this information on your question so more people can help you), you have a bunch of points on the cartesian plane and have to check if one is too close to another. To avoid the need of so many checks each time you need this information you want to store it in some kind of data structure wich will be updated each time a new point is inserted. Is it correct? If so, you can create a graph representing this information: public class MyPoints { private List&lt;Point&gt; points = new ArrayList&lt;&gt;(); private List&lt;List&lt;Boolean&gt;&gt; tooCloseGraph = new ArrayList&lt;&gt;(); public void addPoint(Point point){ List&lt;Boolean&gt; newLine = new ArrayList&lt;&gt;(); for(Point p : points){ newLine.add(p.isTooClose(point)); } newLine.add(true) //Assuming a point is too close to itself tooCloseGraph.add(newLine); points.add(point); } public boolean isTooClose(int a, int b){ if(a &gt; b) return tooCloseGraph.get(a).get(b); else return tooCloseGraph.get(b).get(a); } public boolean isTooClose(Point a, Pont b){ return isTooClose(points.indexOf(a), points.indexOf(b)); } } I have't tested it but I think it works. Cheers!
type: Answer

timer
tag name: timer
tags question: http://stackoverflow.com/q/27034670
tags question: http://stackoverflow.com/q/27009069
type: Tag
tags question: http://stackoverflow.com/q/27020021
tags question: http://stackoverflow.com/q/27033971
tags question: http://stackoverflow.com/q/27105718
tags question: http://stackoverflow.com/q/27094712
tags question: http://stackoverflow.com/q/26997893
tags question: http://stackoverflow.com/q/27134753
tags question: http://stackoverflow.com/q/27091875
tags question: http://stackoverflow.com/q/27083821
tags question: http://stackoverflow.com/q/27118190
tags question: http://stackoverflow.com/q/27151166
tags question: http://stackoverflow.com/q/26999854
tags question: http://stackoverflow.com/q/27147539

http://stackoverflow.com/a/27013094
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27012815
has body: The example you provide implements Comparable which is only necessary if you want to compare your data objects (e.g. is "Obj A" greater than "Obj B" using a comparator). You do not need the constructor. It only exists to ensure your elements are initialized. Otherwise you may end up with NullPointerExceptions and you can't compare. This example simply is "safe" and can prevent some kinds of problems. If you just need a "list" you can use ArrayList&lt;Data&gt; or other List options.

http://stackoverflow.com/q/27007967
favorite count: 0
has answer: http://stackoverflow.com/a/74575362
answer count: 3
possible better answer: http://stackoverflow.com/a/27008994
has comment: http://stackoverflow.com/comment/42544406
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27016542
accepted answer: http://stackoverflow.com/a/27016542
type: Question
has comment: http://stackoverflow.com/comment/42549368
tagged with: java-native-interface
tagged with: java
has comment: http://stackoverflow.com/comment/42544596
tagged with: unsatisfiedlinkerror
has answer: http://stackoverflow.com/a/27008994
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/42562335
has body: .h file #include &lt;jni.h&gt; #include "NativePackage_HelloWorld.h" #include &lt;stdio.h&gt; JNIEXPORT void JNICALL Java_NativePackage_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj) { printf("Hello world!\n"); return; } Java package NativePackage; public class HelloWorld { public native void displayHelloWorld(); static { System.loadLibrary("hello"); } public static void main(String[] args) { new HelloWorld().displayHelloWorld(); } } .c file #include &lt;jni.h&gt; #include "NativePackage_HelloWorld.h" #include &lt;stdio.h&gt; JNIEXPORT void JNICALL Java_NativePackage_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj){ printf("Hello world!\n"); return; } I've compiled my .c file using gcc -I /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/include/ -I /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/include/darwin/ -fPIC -o hello -c HelloWorldImp.c However, trying to run using java NativePackage/HelloWorld produce the following error: java -Djava.library.path=NativePackage/ NativePackage/HelloWorld Exception in thread "main" java.lang.UnsatisfiedLinkError: no hello in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1119) at NativePackage.HelloWorld.&lt;clinit&gt;(HelloWorld.java:7) I'm running on a MAC OS X 10.10
has title: UnsatisfiedLinkError with JNI

http://stackoverflow.com/a/27019987
has comment: http://stackoverflow.com/comment/42569269
has comment: http://stackoverflow.com/comment/42641586
accepted answer of: http://stackoverflow.com/q/27017754
score: 1
has comment: http://stackoverflow.com/comment/42674761
has comment: http://stackoverflow.com/comment/42634786
answers question: http://stackoverflow.com/q/27017754
upvote count: 1
has comment: http://stackoverflow.com/comment/42592562
has body: There are two ways to do this. If you take a look at the documentation you'll see that you can use Place IDs rather than text searches. For your particular case, you will need to geocode your search as per the documentation. The search operator “near” isn’t available in API, but there is a more precise way to restrict your query by a given location using the geocode parameter specified with the template “latitude,longitude,radius”, for example, “37.781157,-122.398720,1mi”.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/53030686
type: Answer

http://stackoverflow.com/q/27130669
answer count: 1
downvote count: 0
score: 4
accepted answer: http://stackoverflow.com/a/27131016
tagged with: rest
linked to: http://stackoverflow.com/q/26765891
favorite count: 0
has comment: http://stackoverflow.com/comment/42770230
tagged with: authentication
tagged with: web-services
linked to: http://stackoverflow.com/q/12086041
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27131016
tagged with: java
upvote count: 4
has title: JAX-RS with Basic Authentication - How to safely avoid asking for credentials on each request?
has body: I've got a JAX-RS API (running on a Wildfly 8 server) that's used by a Javascript-based web application. We're learning as we're going along, so apologies for anything that might be stupid about this implementation. We've got Basic Authentication with PBKDF2-based password storage up and running, but for obvious reasons we do not want the user to have to authenticate each time they click a new navigation item in the web application. What we're currently doing while in development is to take the credentials the first time they're entered and store them in a BASE64-encoded local variable that's used in all subsequent requests (everything goes over HTTPS). The question is, for production, is this an acceptable way of handling user credentials, or is it a big no-no? And if it's a no-no, how should you do it instead? After all, using sessions sort of goes against the idea of RESTful web services to begin with, and stateful Java Session Beans don't seem to work too well with JAX-RS (based on what I've been able to read).

http://stackoverflow.com/comment/42609720
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27045245
has text: Yeah, that won't work, just tried

http://stackoverflow.com/comment/43613310
type: Comment
comment on: http://stackoverflow.com/a/27091562
has text: @user2397162: OK, I figured it out. Just click on [this link](http://chat.stackoverflow.com/rooms/67435/discussion-between-hovercraft-full-of-eels-and-user2397162).
type: AnswerComment
score: 0

http://stackoverflow.com/a/27172212
type: AcceptedAnswer
has body: Finally got the real winner out of this two. I should select for Thread pool Executor because of following reasons Performance cost: Here if we see, using a resource maximum is main motive to get performance during heavy load.So if we use threads in this high time it will be providing high performance as an advantage of multi-threading . Flexibility:Flexibility in terms of scalable use of resources i.e during low time we can reduce number of worker threads in thread pool executor architecture and vice versa. Less number of iterations and minimal updates:If we maintain tree set every time, it will check with the help of comparator interface though it has complexity O(logn) but after that we have to fetch it and it will become a sequential flow of single source so we will not multi-threaded environment advantage. Faster processing:With the help of threading architecture we can achieve faster output. etc were the reasons which I pointed out during a heavy brain storming,googling and last but not the least stack Overflow searching. Thank you all for your humble support and huge appreciation to @didierc for getting me clear over it.
type: Answer
accepted answer of: http://stackoverflow.com/q/27143122
answers question: http://stackoverflow.com/q/27143122
score: 0

http://stackoverflow.com/q/27126112
accepted answer: http://stackoverflow.com/a/27126267
has comment: http://stackoverflow.com/comment/42752025
downvote count: 4
answer count: 2
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/42751989
favorite count: 0
has comment: http://stackoverflow.com/comment/42816757
has answer: http://stackoverflow.com/a/27126267
has title: Java: Which is faster, arrays or objects?
has comment: http://stackoverflow.com/comment/42753419
possible better answer: http://stackoverflow.com/a/27126259
has answer: http://stackoverflow.com/a/27126259
score: -4
has comment: http://stackoverflow.com/comment/42751985
has body: This question is purely regarding speed and efficiency, not minding which is the structural better approach. Basically I need a view module to read a state, which is essentially an array of characters. These characters have a position, name, items etc. Either I could make an array of character object with getters for the information, or I could represent each character as an array containing the same information. Which of these two approaches would be faster for the view module to read? example: approach 1 for(int i = 0; i &lt; characters.length(); i++){ Character temp = character[i]; this.drawName(temp.getName()); this.drawCharacterAt(temp.getColor(), temp.getX(), temp.getY()) .... } approach 2 for(int i = 0; i &lt; characters.length(); i++){ this.drawName(character[i][0]); this.drawCharacterAt(character[i][1],character[i][2],character[i][3]); .... }
type: Question
type: AnsweredQuestion
tagged with: performance
tagged with: java

http://stackoverflow.com/comment/42790999
type: Comment
comment on: http://stackoverflow.com/a/27146464
score: 0
type: AnswerComment
has text: I didn't think of it. Thats a great idea. Thanks again.

http://stackoverflow.com/q/26992267
has title: alert box like toast notification from a service
tagged with: android-alertdialog
tagged with: java
has answer: http://stackoverflow.com/a/26992897
type: Question
has body: Can I open a dialogBox from a service in android? I want something like a Toast notification, but I want the possibility to close it when I want and not after some seconds like the Toast notification. I need a "pop up " alert without focus, so the user can interacts with the application below thanks!
score: 0
answer count: 1
tagged with: toast
tagged with: service
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/27047894
type: Question
accepted answer: http://stackoverflow.com/a/27048323
tagged with: debugging
tagged with: jdb
answer count: 2
score: 5
has title: How to properly set a breakpoint in a nested class using JDB?
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27048323
has body: package com.android.internal.telephony.dataconnection; public abstract class DcTrackerBase extends Handler { protected BroadcastReceiver mIntentReceiver = new BroadcastReceiver () { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DBG) log("onReceive: action=" + action); [...] In the above code, using jdb, I'd like to set a breakpoint on the onReceive method. I used the following command : &gt; stop in com.android.internal.telephony.dataconnection.DcTrackerBase$mIntentReceiver.onReceive And I get this from jdb : &gt; Deferring breakpoint com.android.internal.telephony.dataconnection.DcTrackerBase$mIntentReceiver.onReceive. It will be set after the class is loaded. I know that the class is already loaded, so I imagine that jdb is not finding the method I want. How should I set my breakpoint then ?
has answer: http://stackoverflow.com/a/27048420
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27048420
upvote count: 5
tagged with: java

http://stackoverflow.com/q/26993449
tagged with: java
type: Question
has title: How to get batch-inserts with back references to work?
has body: Here's my Android problem that I've spend hours on already: I am inserting objects in table CARS, followed by objects in table DRIVERS. I need DRIVERS's foreign-key to be set correctly to reference the just inserted row in CARS. Also, if row in DRIVERS cannot be saved, CARS should not be saved, as well. (transactiomn-semantics) I am using the ContentProvider-approach. I understand I should use a batch insert and withValueBackReference for this task. Example code: // (populate carData obejct..) ArrayList&lt;ContentProviderOperation&gt; opList = new ArrayList&lt;ContentProviderOperation&gt;(); ContentValues carv = new ContentValues(); carv.put(Car.CAR_MAKE, carData.make); carv.put(Car.CAR_MODEL, carData.model); carv.put(BaseColumns._ID, 0); // this HAS to be here or withBackValues doesn't work opList.add(ContentProviderOperation.newInsert(Car.CONTENT_URI).withValues(carv).build()); ContentValues driverv = new ContentValues(); driverv.put(Driver.DRIVER_NAME, carData.driverName); driverv.put(Driver.DRIVER_CAR_FK, 0); // THIS should set the ID of the car above! opList.add(ContentProviderOperation. newInsert(Driver.CONTENT_URI).withValues(driverv) .withValueBackReference(Driver.DRIVER_CAR_FK, 0).build()); //... applyBatch etc. If I leave out carv.put(BaseColumns._ID, 0) it doesn't work. If I leave it in, I have to set the value AUTO INCREMENT would have assigned. (Driver._ID is set to be the primary key.) So my question is, how to to have the CARS row set its own _ID, and reference this id in the second insert of the batch, when I insert the DRIVER? Help is very appreciated, the documentation isn't very clear..
answer count: 1
has answer: http://stackoverflow.com/a/30123344
tagged with: sqliteopenhelper
score: 0
tagged with: android
tagged with: sqlite
type: UnansweredQuestion
tagged with: android-sqlite

http://stackoverflow.com/q/27091875
score: 0
tagged with: multidimensional-array
tagged with: while-loop
has title: JAVA How do you iterate a 2d boolean array (synchronised with a generation counter or timer)?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42690761
type: Question
has comment: http://stackoverflow.com/comment/42691839
tagged with: java
has body: First of all, thank you for coming and taking the time to help with the problem. I am a complete noob (3rd day programming) which explains why I have spent countless head-aching hours trying to solve this problem and still have not figured it out yet: How do you iterate the grids (e.g. using for loop or while loop) so that the new grid replaces the old one and the newest grid becomes the new grid non-stop? I'm not familiar with the 'show()' method but I kind of got it to work. Bonus Problem: How do you use the thread.sleep(1000) method so that the 2 grids pause one second or whatever before iterating? I think I should implement a generation counter as well so that the user can keep track of the growth. Here's my incomplete code to give you an idea of the problem: import java.io.File; import java.io.IOException; import java.util.Scanner; public class LifeGrid { public static boolean[][] gen() throws IOException { Scanner scanner = new Scanner(new File("seed.txt")); int rows = 0, columns = 0; while (scanner.hasNextLine()) { String s = scanner.nextLine(); if (s.length() &gt; columns) { columns = s.length(); } rows++; } boolean[][] cells = new boolean[rows][columns + 1]; Scanner scanner1 = new Scanner(new File("seed.txt")); System.out.println("Original seed pattern:"); for (int r = 0; r &lt; rows; r++) { String line = scanner1.nextLine(); System.out.println(line); for (int c = 0; c &lt;= line.length(); c++) { if (line.charAt(r) == '*') { cells[r][c] = true; } } } System.out.println(); return cells; } public static boolean[][] nextGen(boolean[][] cells) { boolean[][] newCells = new boolean[cells.length][cells[0].length]; for (int r = 0; r &lt; cells.length; r++) { for (int c = 0; c &lt; cells[0].length; c++) { int num = numNeighbours(cells, r, c); if (occupiedNext(num, cells[r][c])) newCells[r][c] = true; } } return newCells; } public static void main(String[] args) throws IOException { boolean[][] cells = gen(); System.out.println("Generation:"); show(cells); System.out…
tagged with: for-loop
tagged with: timer

glassfish-4
tags question: http://stackoverflow.com/q/27092755
tags question: http://stackoverflow.com/q/27127789
type: Tag
tags question: http://stackoverflow.com/q/27038134
tags question: http://stackoverflow.com/q/26995995
tag name: glassfish-4

http://stackoverflow.com/a/27026527
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42587808
score: 0
accepted answer of: http://stackoverflow.com/q/27026282
has comment: http://stackoverflow.com/comment/42583073
answers question: http://stackoverflow.com/q/27026282
has body: If you are trying to persist a choice of printer over multiple sessions, I would recommend storing the information as a table in a database. Each choice of printer for a given 'option' (probably a more descriptive term should be chosen) is saved as a line in the database, for example User: (foreign key to user table), Purpose: (foreign key to table of purposes), Printer: (address of the printer to be used?), optionally PrinterName for display purposes.

http://stackoverflow.com/a/46461889
has body: To resolve this add the following line of script to /usr/iop/4.1.0.0/hive/bin/hive.distro file on all hive nodes, CLASSPATH=`echo $CLASSPATH| sed 's/\/usr\/local\/hadoop\/lib\/slf4j\-log4j12\-1\.7\.10\.jar//g'` The script should be inserted after the lines if $cygwin; then CLASSPATH=`cygpath -p -w "$CLASSPATH"` CLASSPATH=${CLASSPATH};${AUX_CLASSPATH} else CLASSPATH=${CLASSPATH}:${AUX_CLASSPATH} fi The warnings will no longer appear. http://www-01.ibm.com/support/docview.wss?uid=swg21971864
score: 0
answers question: http://stackoverflow.com/q/27050820
type: Answer

http://stackoverflow.com/comment/42770588
has text: Dammit .. I forgot to `.toLowerCase()` it .. I was already thinking I forgot how to Java but it seems that I have forgotten a lot more ..
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27136158

http://stackoverflow.com/comment/42517923
type: Comment
type: QuestionComment
has text: Actually Its PROD , so I cant put it on remote debug, but there are logs which suggest that application tried to push the results using simpmessaging template.
comment on: http://stackoverflow.com/q/26993334
score: 0

http://stackoverflow.com/q/27129384
has comment: http://stackoverflow.com/comment/42758211
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/42758095
accepted answer: http://stackoverflow.com/a/27129613
type: Question
has title: How to Correct If Else Statement
has answer: http://stackoverflow.com/a/27129670
has body: I'm Having a problem on my program, I'm Using if-else statement In my program I'm trying to count the vowels and consonants on a String. I already know how to do it, my problem is i want to add an "error" message that if the user inputs a non-string it will show the error box. "Try to run the program, The user will input a "String" and if the user press "Sort" it will count the vowels and consonant. What i need is if the user will not enter a "String" example is double or int ...etc as long as it is not a string it will show a Error box. /** * * @author Patrick */ import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; public class VowelandConsonant extends JFrame{ private JLabel stringl, resultl,resultl1; private JTextField stringtf, resulttf,resulttf1; private JButton cb,eb; private CButtonHandler cHandler; private EButtonHandler eHandler; public VowelandConsonant(){ stringl=new JLabel("Enter String:",SwingConstants.CENTER); resultl=new JLabel("Vowel:",SwingConstants.CENTER); resultl1=new JLabel("Consonants:",SwingConstants.CENTER); stringtf=new JTextField(10); resulttf=new JTextField(10); resulttf1=new JTextField(10); eb=new JButton("Exit"); eHandler= new EButtonHandler(); eb.addActionListener(eHandler); cb=new JButton("Sort"); cHandler= new CButtonHandler(); cb.addActionListener(cHandler); setTitle("Vowels and Consonants"); Container p=getContentPane(); p.setLayout(new GridLayout(7,2)); p.add(stringl); p.add(stringtf); p.add(resultl); p.add(resulttf); p.add(resultl1); p.add(resulttf1); p.add(cb); p.add(eb); setSize(500,400); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } private class CButtonHandler implements ActionListener{ public void actionPerformed(ActionEvent e){ String string1; string1 = stringtf.getText(); string1 = string1.toLowerCase(); int vowels = 0; int consonants = 0; for (String retval: string1.split(" ")){ for (int i = 0; i &lt; retval.length(); i++) { char ch = retval.charAt(i); i…
has comment: http://stackoverflow.com/comment/42758296
favorite count: 0
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42758036
has comment: http://stackoverflow.com/comment/42758131
has comment: http://stackoverflow.com/comment/42758685
tagged with: joptionpane
has answer: http://stackoverflow.com/a/27129613
has comment: http://stackoverflow.com/comment/42758078
possible better answer: http://stackoverflow.com/a/27129574
upvote count: 1
has comment: http://stackoverflow.com/comment/42758011
downvote count: 1
has answer: http://stackoverflow.com/a/27129574
has comment: http://stackoverflow.com/comment/42758361
type: AnsweredQuestion

http://stackoverflow.com/q/27079943
has body: I would like to access the variable without entering a method, and would like to know if that's even possible. I tried: public class MyClass{ public static ItemStack myItem = new ItemStack(Material.BOOK); myItem.addEnchantment(Enchantment.ARROW_DAMAGE, 1); } But I believe that isn't possible without starting a method (for example a main method) Is there anyway to do it?
has answer: http://stackoverflow.com/a/27080062
type: AnsweredQuestion
tagged with: java
has title: How to set a property in a variable without starting a method?
tagged with: bukkit
has comment: http://stackoverflow.com/comment/42671568
accepted answer: http://stackoverflow.com/a/27080062
type: Question
answer count: 2
tagged with: minecraft
possible better answer: http://stackoverflow.com/a/27080002
has answer: http://stackoverflow.com/a/27080002
score: 0

http://stackoverflow.com/comment/42597342
type: Comment
type: QuestionComment
has text: Tried with no luck..:(
comment on: http://stackoverflow.com/q/27038685
score: 0

http://stackoverflow.com/comment/42658762
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27073254
has text: For better help, post a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). It just wayyyy to little code to go off of.
score: 0

http://stackoverflow.com/a/27147924
has body: You could add something like code below to your singletons and invoke checkAlive() method when you need to check if timers are alive: @Resource private TimerService timerService; private int initialNumberOfTimers; @PostConstruct public void postCon() { initialNumberOfTimers = timerService.getTimers().size(); System.out.println("Initial number of timers is: "+initialNumberOfTimers); } public void checkAlive() { Collection&lt;Timer&gt; timers = timerService.getTimers(); if (timers.size() != initialNumberOfTimers) { System.out.println("ALARM!!! Number of timers is: " + timers.size()); } for (Timer timer : timers) { System.out.println("Next timeout: " + timer.getNextTimeout().toString()); } }
answers question: http://stackoverflow.com/q/27141192
score: 0
type: Answer

http://stackoverflow.com/q/27048157
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27048591
has comment: http://stackoverflow.com/comment/42614833
tagged with: java
score: 0
tagged with: import
tagged with: arrays
has body: I'm trying to write a method that imports a text file of a very large quantity of words, and then find words of a certain length and print them out. I'm not looking for code, but rather a clarification if I'm correctly understanding what I'm trying to accomplish. So, I'm going to import the text using throw exception, and take the number of letters of a specific word: public static void name(int size) throws Exception{ Scanner inputFile = new Scanner(new File("2of12inf.txt")); And then create a new array list: int[] list = new int[MAX_SIZE]; //MAX_SIZE is initially a small number, say 100 int listSize = 0; Where if the size of the list of words exceeds my MAX_SIZE array, then I'm going to copy the existing array and double it, in order to have the numbers of words fit in the list. if (listSize == list.length) { int[] temp = new int [2*list.length]; for(int i = 0; i &lt; list.length; i++){ temp[i] = list[i];} list = temp; } list[listSize] = size; listSize++; inputFile.close();} This is my raw understanding of how I'm suppose to write the method, is this the correct thinking of just being able to read in words and give a list of them? EDIT: Sorry, I didn't mention that I'm not to use ArrayLists.
has title: Importing text file and doubling array
has answer: http://stackoverflow.com/a/27048591
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42614307
has comment: http://stackoverflow.com/comment/42614302

http://stackoverflow.com/comment/42576914
type: Comment
comment on: http://stackoverflow.com/a/27025984
has text: You want Grid -> Double (like in C++), not Double -> Object. Therefore: Map<Grid, Double> cache = new HashMap<Grid, Double>();
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42727935
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27112520
has text: the text file must have some sort of separator, like it may be a csv file or something. can't tell without you posting. but read the file in, and for each line, split on whatever is the delimiter, get the score, the id, etc by its column index.

http://stackoverflow.com/a/27117698
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42756723
upvote count: 1
has body: So to answer your specific question, if you want a filter to be executed before a component is called you would create a filter that is listening to Component level filter scope. See http://sling.apache.org/documentation/the-sling-engine/filters.html You would then have your filter change the incoming request to a SlingServletRequest and determine if the target resource is the one that you are looking for. However this filter would be executed on every single component that is being included on a page. The reverse process of this that may be useful to you is the ResourceDecorator. http://sling.apache.org/documentation/the-sling-engine/wrap-or-decorate-resources.html These are executed when the resource is identified, prior to the servlet and filter calls, which would allow you to verify if a resource is a type that you are interested in, and then allows you to add additional information to the resource object.However this is, once again a service that would be applied to every resource that is identified. However, if what you are looking for is a filter that is only executed for a specific path, then no. Sling doesn't do that. You mentioned Spring MVC and Spring MVC works on a completely different concept of MVC then what Slings version of MVC does. EDIT So in a traditional web app, the servlet would be at a fixed position and all filters are applied prior to the call to that servlet. In Sling you are dynamically wiring servlets together to generate the resulting page. So each time that you are in a servlet and call directly or indirectly the request dispatcher, it's executing the resolution process again and applying a series of filters again before the new servlet is executed. To prevent a high level filter that needs to applied only to the main request being applied on every single internal dispatch, they came up with the idea of contexts, or chains of filters that are applied at different times and associated with different types of includes. Here is a basic fil…
answers question: http://stackoverflow.com/q/27107092
score: 1
accepted answer of: http://stackoverflow.com/q/27107092
has comment: http://stackoverflow.com/comment/42787183
type: AcceptedAnswer

jsf
tags question: http://stackoverflow.com/q/27019013
type: Tag
tags question: http://stackoverflow.com/q/26999368
tags question: http://stackoverflow.com/q/27030715
tags question: http://stackoverflow.com/q/27099448
tags question: http://stackoverflow.com/q/27037918
tags question: http://stackoverflow.com/q/27018429
tags question: http://stackoverflow.com/q/27024297
tags question: http://stackoverflow.com/q/27105194
tags question: http://stackoverflow.com/q/27123785
tags question: http://stackoverflow.com/q/27086345
tags question: http://stackoverflow.com/q/27094466
tags question: http://stackoverflow.com/q/27012058
tags question: http://stackoverflow.com/q/27016066
tags question: http://stackoverflow.com/q/27109423
tags question: http://stackoverflow.com/q/27048438
tags question: http://stackoverflow.com/q/27099154
tags question: http://stackoverflow.com/q/27015795
tags question: http://stackoverflow.com/q/27011008
tags question: http://stackoverflow.com/q/27141156
tags question: http://stackoverflow.com/q/27144153
tags question: http://stackoverflow.com/q/26993120
tags question: http://stackoverflow.com/q/27103782
tags question: http://stackoverflow.com/q/27035595
tags question: http://stackoverflow.com/q/27143229
tags question: http://stackoverflow.com/q/27064452
tags question: http://stackoverflow.com/q/26992591
tags question: http://stackoverflow.com/q/27059911
tags question: http://stackoverflow.com/q/27063864
tags question: http://stackoverflow.com/q/27134487
tags question: http://stackoverflow.com/q/27061141
tags question: http://stackoverflow.com/q/27136825
tags question: http://stackoverflow.com/q/27066953
tags question: http://stackoverflow.com/q/27066836
tags question: http://stackoverflow.com/q/27131257
tags question: http://stackoverflow.com/q/27015057
tag name: jsf
tags question: http://stackoverflow.com/q/27005920
tags question: http://stackoverflow.com/q/27088134
tags question: http://stackoverflow.com/q/27024861
tags question: http://stackoverflow.com/q/27100224
tags question: http://stackoverflow.com/q/27131722
tags question: http://stackoverflow.com/q/26999934
tags question: http://stackoverflow.com/q/27141280
tags question: http://stackoverflow.com/q/27104046
tags question: http://stackoverflow.com/q/27152076
tags question: http://stackoverflow.com/q/27049781
tags question: http://stackoverflow.com/q/27123995
tags question: http://stackoverflow.com/q/27149375
tags question: http://stackoverflow.com/q/27013562
tags question: http://stackoverflow.com/q/27094457

http://stackoverflow.com/a/27143935
has comment: http://stackoverflow.com/comment/42785904
score: 1
answers question: http://stackoverflow.com/q/27143828
downvote count: 0
has comment: http://stackoverflow.com/comment/42784259
has comment: http://stackoverflow.com/comment/42784961
has comment: http://stackoverflow.com/comment/42784283
has body: remove the double quotes from the classpath definition: java -cp .;./libs/dbunit-2.5.0.jar org.junit.runner.junitcore testclass
has comment: http://stackoverflow.com/comment/42785798
type: Answer
has comment: http://stackoverflow.com/comment/42784853
upvote count: 1

http://stackoverflow.com/q/27152627
tagged with: selenium
upvote count: 1
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27153585
accepted answer: http://stackoverflow.com/a/27153585
favorite count: 0
has body: I've written a test case that creates random emails to be input to email fields package DDselenium.general; import org.apache.commons.lang3.RandomStringUtils; public class GenerateData { public String generateRandomString(int length){ return RandomStringUtils.randomAlphabetic(length); } public String generateRandomNumber(int length){ return RandomStringUtils.randomNumeric(length); } public String generateRandomAlphaNumeric(int length){ return RandomStringUtils.randomAlphanumeric(length); } public String generateStringWithAllobedSplChars(int length,String allowdSplChrs){ String allowedChars="abcdefghijklmnopqrstuvwxyz" + //alphabets "1234567890"; //numbers return RandomStringUtils.random(length, allowedChars); } public String generateEmail(int length) { String allowedChars="abcdefghijklmnopqrstuvwxyz" + //alphabets "1234567890"; //numbers String email=""; String temp=RandomStringUtils.random(length,allowedChars); email=temp.substring(0,temp.length()-9)+"@test.org"; return email; } public String generateUrl(int length) { String allowedChars="abcdefghijklmnopqrstuvwxyz" + //alphabets "1234567890"; //Numbers String url=""; String temp=RandomStringUtils.random(length,allowedChars); url=temp.substring(0,3)+"."+temp.substring(4,temp.length()-4)+"."+temp.substring(temp.length()-3); return url; } } I generate the random email as such driver.findElement(By.id("email")).sendKeys(genData.generateEmail(30)); The issue I'm running into is that I have a field for confirm email so the actual code is like this driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys(genData.generateEmail(30)); driver.findElement(By.id("emailconfirm")).clear(); driver.findElement(By.id("emailconfirm")).equals("email"); The problem is, I don't know how to get the emailconfirm element to duplicate whats in the email element. Any help is appreciated.
has title: Repeat input field for email in selenium using random string
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/27099405
accepted answer: http://stackoverflow.com/a/27112135
has answer: http://stackoverflow.com/a/37694658
answer count: 3
tagged with: hamcrest
has title: hamcrest: how to match array is subset of another array?
tagged with: junit
upvote count: 17
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27112135
has answer: http://stackoverflow.com/a/27100445
tagged with: java
score: 17
type: Question
possible better answer: http://stackoverflow.com/a/27100445
has body: Given that: int[] a = {1, 2, 3, 4}; int[] b = {1, 2, 3, 4, 5}; How to asser that "a" is a subset of "b" using hamcrest matchers? The following works assertThat(Arrays.asList(b), hasItems(a)); But since I am creating "a" from "b", I would prefer to apply the asserts on "a" as the value. Something like assertThat(a, isSubsetOf(b)); Additionally it is preferable to avoid converting the array to a list.
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42673447
has text: All the time you are ignoring exception, hence you have set an empty list which you then `null` in the JSP. If you have a stacktrace printed then it would be nice to attach it to the post.
score: 0
comment on: http://stackoverflow.com/q/27081635
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42553526
type: QuestionComment
comment on: http://stackoverflow.com/q/27013660
has text: change void to datatype which is the argument typefor verify method and return it from your myMethod
score: 0
type: Comment

http://stackoverflow.com/a/27084317
has body: You set subscription equal to 0 and never change it before passing it in to the determineCableSrv method. You do the same with cableSrvs, so the return value from your method is going to be 0. The cableSrvs variable isn't read inside the method, so it probably shouldn't be in input parameter to begin with.
answers question: http://stackoverflow.com/q/27084280
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/27101730
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27101258
downvote count: 0
has body: You can use the Scanner's findInLine(String pattern) method, try the following: public static String validName(Scanner input, Scanner histogram) { String user = ""; String name = input.next(); if(histogram.findInLine(name) != null){ System.out.println("This name exist");//Do what you have to do here } else{ System.out.println("Name not found"); user = validName(input, histogram); } return user; } Take a look at the Scanner Class methods for more information.

http://stackoverflow.com/a/35074414
upvote count: 1
has comment: http://stackoverflow.com/comment/94606555
downvote count: 0
has body: I found a workaround for this was swapping the order of the generics. For instance, use class A&lt;T extends B &amp; C&gt; where you need to access a B method, or use class A&lt;T extends C &amp; B&gt; if you need to access a C method. Of course, if you need access to methods from both classes, this won't work. I found this useful when one of the interfaces was a marker interface like Serializable. As for fixing this in the JDK, the only info I could find were some bugs on openjdk's bug tracker that are marked resolved in version 9 which is rather unhelpful.
has comment: http://stackoverflow.com/comment/61812985
type: Answer
answers question: http://stackoverflow.com/q/27031244
score: 1

http://stackoverflow.com/comment/42996906
score: 0
type: Comment
type: QuestionComment
has text: @Michael what is the use of your addTransaction?
comment on: http://stackoverflow.com/q/27142841

http://stackoverflow.com/a/27016799
upvote count: 1
score: 1
has body: Parse using Jackson JSON eg: { "foo" : ["1","2","3","4"], "bar" : "xxxx", "baz" : "yyyy" } Could be mapped to this class: public class Fizzle{ private List&lt;String&gt; foo; private boolean bar; private int baz; // getters and setters omitted } Now if you have a Controller method like this: @RequestMapping("somepath") @ResponseBody public Fozzle doSomeThing(@RequestBody Fizzle input){ return new Fozzle(input); }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26997252
has comment: http://stackoverflow.com/comment/42560247

http://stackoverflow.com/a/27106766
score: 3
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42721318
upvote count: 3
has comment: http://stackoverflow.com/comment/42719714
answers question: http://stackoverflow.com/q/27106673
has body: Change this: if (result == JOptionPane.YES_OPTION) frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } to if (result == JOptionPane.YES_OPTION) System.exit(0); } frame.setDefaultCloseOperation is what happens when someone clicks the 'x' to close the window. Every other way to exit is controlled by you. The best way is to have your window closing listener and action listener call the same method that will pop up the dialog and call System.exit(0) if the user wants to exit. This will also help you with cleanup operations. Sample code: public class Test extends JPanel implements WindowListener { public Test() { setLayout(new BorderLayout()); add(new JLabel("This is a test."), BorderLayout.CENTER); JButton b = new JButton("Exit"); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { exit(); } }); add(b, BorderLayout.SOUTH); } public static void main(String[] args) throws Exception { JFrame f = new JFrame(); Test t = new Test(); f.add(t, BorderLayout.CENTER); f.addWindowListener(t); f.pack(); f.setVisible(true); } public void windowClosing(WindowEvent e) { exit(); } private void exit() { System.exit(0); } }
has comment: http://stackoverflow.com/comment/42717086

http://stackoverflow.com/comment/42544267
type: QuestionComment
has text: I just noticed two problems with your analysis: 1. you sum from 1 to n in the inner loop, when you should be summing from i to n, and 2. you sum j/2 from 1 to n when you should be summing j from 1 to (n-i)/2. You forgot to take into account the shrinking of the unvisited side of a2, and you incorrectly calculated the multiplicity for iterating over half of the range (instead you calculated cost of iterating over the WHOLE range, then divided by two).
comment on: http://stackoverflow.com/q/27004712
score: 0
type: Comment

spring-security
tags question: http://stackoverflow.com/q/27052240
tags question: http://stackoverflow.com/q/27056860
tags question: http://stackoverflow.com/q/27129985
type: Tag
tags question: http://stackoverflow.com/q/27109769
tags question: http://stackoverflow.com/q/26993751
tags question: http://stackoverflow.com/q/27022217
tags question: http://stackoverflow.com/q/27072758
tags question: http://stackoverflow.com/q/27063362
tags question: http://stackoverflow.com/q/27020702
tags question: http://stackoverflow.com/q/27063121
tags question: http://stackoverflow.com/q/27023119
tags question: http://stackoverflow.com/q/27123182
tags question: http://stackoverflow.com/q/27015077
tags question: http://stackoverflow.com/q/27057399
tags question: http://stackoverflow.com/q/27002745
tags question: http://stackoverflow.com/q/27091285
tags question: http://stackoverflow.com/q/27063652
tag name: spring-security

http://stackoverflow.com/a/28728040
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27092755
has body: the qualifier must be "glassfish", here is a complete example how it works for me <?xml version="1.0" encoding="UTF-8"?> target/arquillian src/test/resources-glassfish-embedded/glassfish-resources.xml 8083
type: Answer
score: 1

http://stackoverflow.com/comment/42795333
type: Comment
comment on: http://stackoverflow.com/q/27147660
score: 0
has text: If I understand well, your problem is at runtime, not compile time, right ? And you have a multi-module project, with no dependency between the 2 modules ? Are the modules jar-with-dependencies projects ?
type: QuestionComment

http://stackoverflow.com/comment/42716763
type: Comment
has text: When I add in the 'children[0].Click() ' line of code I get an error advising 'this type of expression must be an array, but it is resolved to a type'. I've taken a code snippet above (apologies I am new to this)
score: 0
comment on: http://stackoverflow.com/a/27102879
type: AnswerComment

http://stackoverflow.com/a/27138565
has comment: http://stackoverflow.com/comment/42777427
has comment: http://stackoverflow.com/comment/42776245
type: Answer
has comment: http://stackoverflow.com/comment/42833422
has comment: http://stackoverflow.com/comment/42847423
has comment: http://stackoverflow.com/comment/42848438
has comment: http://stackoverflow.com/comment/42777930
has comment: http://stackoverflow.com/comment/42775407
answers question: http://stackoverflow.com/q/27138188
score: 0
has comment: http://stackoverflow.com/comment/42815144
has comment: http://stackoverflow.com/comment/42816781
has body: In your class for the pawns, you can have an instance boolean, say, boolean hasMoved and initially make it false. If this boolean is false, then the pawn can move one OR two units. Whenever you move a pawn, you check this boolean, and if it's false, set it to true after moving it. That should work out.
has comment: http://stackoverflow.com/comment/42776279

http://stackoverflow.com/comment/43243962
comment on: http://stackoverflow.com/a/27375949
type: Comment
score: 0
type: AnswerComment
has text: ahhh ... didn't even think at looking into core implementation ;-) Good argument, thanks! clear/setAll being the same is good enough - basically I need some means to reliably throw away all state related to old items (without having references to the items, only to their former positions). hmm ... back to thinking

http://stackoverflow.com/a/27068382
has body: A sequence diagram can be found here https://code.google.com/p/welikegwt-presentation/wiki/GwtRpc
upvote count: 1
has comment: http://stackoverflow.com/comment/42650160
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27068128

http://stackoverflow.com/a/27091859
type: Answer
accepted answer of: http://stackoverflow.com/q/27088612
has comment: http://stackoverflow.com/comment/42692506
score: 2
answers question: http://stackoverflow.com/q/27088612
has body: Please, check if the firewall is set to block FTP communication.
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/27092371
score: 0
answer count: 1
tagged with: one-to-one
has body: I have mapped entities: Entity @Table(name="user_content") public class UserContent { @GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "content")) @Id @GeneratedValue(generator = "generator") @Column(name = "content_id", unique = true, nullable = false) private Long contentId; @Column(name = "name") String name; @Column(name = "moderate_comment") String moderateComment; @OneToOne(fetch = FetchType.LAZY) @PrimaryKeyJoinColumn Content content; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getModerateComment() { return moderateComment; } public void setModerateComment(String moderateComment) { this.moderateComment = moderateComment; } public Content getContent() { return content; } public void setContent(Content content) { this.content = content; } } @Entity @Table(name = "content") public class Content { @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "content_id", unique = true, nullable = false) private Long contentId; @OneToOne(fetch = FetchType.LAZY, mappedBy = "content", cascade = CascadeType.ALL) UserContent userContent; public UserContent getUserContent() { return userContent; } public void setUserContent(UserContent userContent) { this.userContent = userContent; } public Long getContentId() { return this.contentId; } public void setContentId(Long id) { this.contentId = id; } } I have 2 projects where I use hibernate.hbm2ddl.auto set to create. I confused but this code creates database different in my differernt projects. First: It is expected and desired behaviour. Second: As you can see realtion is missing. I don't understand where can I search a cause of this problem. Pleasr help to find.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27092509
tagged with: java
tagged with: hibernate
type: Question
has title: Hibernate. Different behaviour of same one to one mapping in different projects

http://stackoverflow.com/q/27092406
tagged with: java
downvote count: 4
answer count: 1
tagged with: facebook-graph-api
has body: I would like to get data from www.facebook.com/ads/manage/powereditor page, Is there any official or unofficial api which will allow to get data (campaign name, buying type, total daily budget , .... ). I already have tried to scrap that page, but it seems that it is not so easy(html isn't well structured), and I didn't find api which will allow to get the data, that's why I would like to get help from you. Thanks .
favorite count: 0
has title: data from www.facebook.com/ads/manage/powereditor page
tagged with: facebook-ads-api
tagged with: facebook
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42769864
score: -3
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27092861
accepted answer: http://stackoverflow.com/a/27092861

http://stackoverflow.com/comment/42612960
has text: I found something http://viralpatel.net/blogs/java-read-write-csv-file/. Just as I do to read all of the columns and the first row of columns is the key
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27043875

http://stackoverflow.com/comment/42546975
comment on: http://stackoverflow.com/q/27009748
has text: show your `pom.xml`, looks like you are packing something up from `target` on each iteration
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42621128
type: QuestionComment
has text: I'm not sure this will help but I've found if the initialization method is removed, the windowbuilder doesn't know how to render the the user interface. I think it gives an error message though saying it can't parse. But it doesn't seem like you've gotten an error message.
comment on: http://stackoverflow.com/q/27008693
score: 0
type: Comment

http://stackoverflow.com/comment/43391093
has text: This is not an error, just an INFO saying that a redirection to Yahoo is required.
type: Comment
comment on: http://stackoverflow.com/a/27090299
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42625847
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27054437
has text: The variable definitely will be changing. I'll look into a "singleton", thanks
type: Comment

http://stackoverflow.com/a/27120247
answers question: http://stackoverflow.com/q/27120208
downvote count: 0
has comment: http://stackoverflow.com/comment/42741892
has body: That line: PrintWriter out = new PrintWriter("C:/Users/Vicki/Desktop/CountrySortedFormat.txt"); recreates the file. After this line your input file will be empty.
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42741798

http://stackoverflow.com/q/27125593
type: Question
tagged with: jakarta-ee
tagged with: session
accepted answer: http://stackoverflow.com/a/27125824
score: 4
upvote count: 4
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27127426
has answer: http://stackoverflow.com/a/27125824
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27127426
has title: Remove attribute from session before serialize
tagged with: java
has body: I saved some references in user sessions that link to objects which aren't serializable. I would like to remove these attributes from the session before app shut down, before session serialization. Is there a way to do so? I already tried with a Listener that listens to app destroy, but sessions are already invalidated at that moment.

http://stackoverflow.com/a/27160493
score: 0
accepted answer of: http://stackoverflow.com/q/27141280
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27141280
has body: Thanks to @BalusC, I got information for successful solution from this source: c:forEach inside primefaces(e.g. p:panelgrid) inside ui:repeat. The code that I have got written dashboard.xhtml is only one part of all code. This part is inside two more dataTables. I don't know if dataTables also are connected with this problem but for less problems I changed them to &lt;c:when&gt;, &lt;c:forEach&gt; and simple &lt;div&gt; tags. The problem solved at the moment when I changed all &lt;ui:include&gt; to &lt;c:forEach&gt; tags. If You meet problem like I had, then here are the steps that You should do for reaching the solution: 1) Change all: &lt;h:dataTable value="#{messageBean.getComments(msg)}" var="com" rendered="#{not empty messageBean.getComments(msg)}"&gt; &lt;h:column&gt; &lt;div&gt; ... &lt;/div&gt; &lt;/h:column&gt; &lt;/h:dataTable&gt; To: &lt;c:when test="#{not empty messageBean.getComments(msg)}"&gt; &lt;c:forEach items="#{messageBean.getComments(msg)}" var="com"&gt; &lt;div&gt; ... &lt;/div&gt; &lt;/c:forEach&gt; &lt;/c:when&gt; 2) Change all: &lt;ui:repeat value="#{com.listComments}" var="comment" rendered="#{com.hasChildren}"&gt; &lt;ui:include src="comments.xhtml" /&gt; &lt;/ui:repeat&gt; To: &lt;c:when test="#{com.hasChildren}"&gt; &lt;c:forEach items="#{com.listComments}" var="subComment"&gt; &lt;ui:include src="comments.xhtml"&gt; &lt;ui:param name="comment" value="#{subComment}" /&gt; &lt;/ui:include&gt; &lt;/c:forEach&gt; &lt;/c:when&gt; 3) Important or just Suggestion: 3.1) Split &lt;ui:include&gt; tag and put the &lt;ui:param /&gt; tag inside of it! 3.2) For &lt;ui:include&gt; tag use different "var" parameter than &lt;ui:param /&gt; tag's "name" parameter has (Example is described and can be seen in 2nd chapter).
type: Answer

http://stackoverflow.com/comment/42685900
score: 0
type: Comment
type: QuestionComment
has text: are you able to show the image on your label??
comment on: http://stackoverflow.com/q/27089290

jax-rs
tags question: http://stackoverflow.com/q/27037292
tags question: http://stackoverflow.com/q/27012333
tags question: http://stackoverflow.com/q/27060259
tags question: http://stackoverflow.com/q/27081991
tags question: http://stackoverflow.com/q/27090833
tags question: http://stackoverflow.com/q/26996651
tags question: http://stackoverflow.com/q/27092632
tags question: http://stackoverflow.com/q/27076978
tags question: http://stackoverflow.com/q/27029925
tags question: http://stackoverflow.com/q/27068490
tags question: http://stackoverflow.com/q/27092387
tags question: http://stackoverflow.com/q/27038274
tags question: http://stackoverflow.com/q/27114974
tags question: http://stackoverflow.com/q/27143397
tags question: http://stackoverflow.com/q/26992222
type: Tag
tags question: http://stackoverflow.com/q/27137593
tags question: http://stackoverflow.com/q/27083376
tags question: http://stackoverflow.com/q/27043093
tags question: http://stackoverflow.com/q/27073097
tags question: http://stackoverflow.com/q/26996565
tag name: jax-rs
tags question: http://stackoverflow.com/q/27091834

http://stackoverflow.com/comment/42644306
score: 0
has text: should this fix the issue?
type: Comment
comment on: http://stackoverflow.com/a/27064981
type: AnswerComment

http://stackoverflow.com/comment/42568077
has text: ok, thank you for now then. At least, I understood the architecture.
type: Comment
comment on: http://stackoverflow.com/a/27004654
score: 0
type: AnswerComment

http://stackoverflow.com/a/27128741
downvote count: 0
answers question: http://stackoverflow.com/q/27128604
type: Answer
score: 3
has body: It looks like what you really want is a constructor for your Enemies class, rather than a void method: public Enemies(int choice){ switch(choice) { case 1: this.enemyName = "Sentient Shoelace"; this.enemyHealth = 100.0; this.enemyAttackDamage = 1; this.enemyDefenseLevel = 1; this.hardLevel = 2; this.lootDropped = 100; break; case 2: this.enemyName = "Slimey Fartbox"; this.enemyHealth = 100.0; this.enemyAttackDamage = 2; this.enemyDefenseLevel = 1; this.hardLevel = 3; this.lootDropped = 100; break; default: System.out.println("Mess up in the enemy selection process"); } } Now you can change your fight() method as follows: private void fight() { //I'm using a rand.nextInt() to get enemychoice Enemies enemy = new Enemies(enemyChoice); System.out.println("You run into a " + enemy.enemyName); } There are still some stylistic issues you might like to ponder on: You really want it to be called Enemy rather than Enemies. You could think about using an enum if you just have two possibilities for an Enemy. You might also think about having another constructor that takes six parameters, one for each thing you're setting. This could be a private constructor if you like, and that could be invoked by the public constructor that takes the int choice.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27128604
type: AcceptedAnswer

http://stackoverflow.com/comment/42788580
type: Comment
type: QuestionComment
has text: Client code is pasted
comment on: http://stackoverflow.com/q/27145954
score: 0

http://stackoverflow.com/comment/42803802
type: Comment
comment on: http://stackoverflow.com/a/27154455
has text: And btw as for hashbasedtable or treebasedtable, which one would be more suitable for my coding?
type: AnswerComment
score: 0

http://stackoverflow.com/a/27019461
answers question: http://stackoverflow.com/q/27019045
upvote count: 2
has body: You need a server-side language like PHP. So you have to read about PHP, and how you can connect PHP with your database, e.g MySQL. You also need to change your HTML form action to the PHP file, e.g &lt;form action="yourPHPFile.php" method="POST" onsubmit="return validateCustomerForm(this)"&gt; A simple example where you can start with: &lt;?php $firstname = $_POST[firstname]; $lastname = $_POST[lastname]; . . // commands to open a connection to your database // commands to insert into your database (query) // close the database connection . . . ?&gt; Notes: $firstname is a variable and in PHP the variables must begin with $ symbol $_POST is used to get the information provided by the user via the HTML file you gave. Is $_POST because you use as method the POST in your HTML form, there is another one way to do that and is with the GET method. Below, are some introduction links where you can start: For connection For insert data to your table Just go through the MySQL Database section at the website provided.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/42780621
type: Comment
has text: @JuanAntonioGomezMoriano Are you sure it "does not compile"? Your declaration of `regexHHMM` is just a `String` variable initialized with a string literal. As far as I know, it isn't parsed as a regex until runtime when you call `Pattern.compile` or some other methods. What exactly is the "compiler"'s behavior?
comment on: http://stackoverflow.com/a/27141538
score: 0
type: AnswerComment

http://stackoverflow.com/q/27008553
accepted answer: http://stackoverflow.com/a/27009834
linked to: http://stackoverflow.com/q/19445737
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27008708
downvote count: 0
has title: Access same property (member of object) multiple times in code
tagged with: java
has comment: http://stackoverflow.com/comment/42545263
type: Question
has body: Pretty simple question, I have an object (say Obj) which has member variable (say "var"). In one function I need to access this property multiple times (4 to 5 times). What I am doing right now is everytime I do Obj.var to get the value. Is is right (from optimization point of view) to do that or I should store Obj.var in a temporary variable and then use this variable? I am looking for explanation from "how both approaches impact performance" point of view. ===== What if Obj.var is replaced by Obj.getVar(), a getter method for that variable? How will it impact the performance?
tagged with: optimization
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/42545447
possible better answer: http://stackoverflow.com/a/27008708
has comment: http://stackoverflow.com/comment/42560820
has comment: http://stackoverflow.com/comment/42545261
favorite count: 0
has answer: http://stackoverflow.com/a/27009834

http://stackoverflow.com/q/27095136
has comment: http://stackoverflow.com/comment/42727807
tagged with: jsp
has comment: http://stackoverflow.com/comment/42725337
has body: Every time im insert an input type=date in my form, return error 400, but if i delete the input from the form, the code runs OK. I've tried different types of date, but anyone works. my controller package br.com.starcode.agenda.controller; import java.util.Date; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import br.com.starcode.agenda.domain.Usuario; import br.com.starcode.agenda.service.UsuarioService; @Controller public class UsuarioController { @Autowired UsuarioService UsuarioService; @RequestMapping(value="/usuario", params="new") ModelAndView novoUsuario() { Usuario usuario = new Usuario(); usuario.setDataNascimento(new Date()); return new ModelAndView("cadastrar-usuario") .addObject("usuario", usuario); } @RequestMapping(value="/usuario", method = RequestMethod.POST) ModelAndView confirmarNovo( Usuario novoUsuario, @RequestParam(value="dataNascimento", required=false) @DateTimeFormat(pattern="yyyy-MM-dd") Date dtNasc, RedirectAttributes redirectAttributes) { try { novoUsuario.setDataNascimento(dtNasc); //insert UsuarioService.insert(novoUsuario); //success redirectAttributes.addFlashAttribute("msg", "Registro '" + novoUsuario.getIdUsuario() + "' inserido com sucesso!"); return new ModelAndView("redirect:/"); } catch (Exception e) { return new ModelAndView("cadastrar-usuario") .addObject("erro", e.getMessage()) .addObject("usuario", novoUsuario); } } *@InitBinder void initBinder(WebDataBinder webDataBinder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setLenient(false); webDataBinder.registerCus…
type: UnansweredQuestion
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/21929232
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42703429
score: 0
has comment: http://stackoverflow.com/comment/42697030
has comment: http://stackoverflow.com/comment/42696208
has title: error 400 input type=date The request sent by the client was syntactically incorrect

http://stackoverflow.com/comment/42643022
comment on: http://stackoverflow.com/q/27064238
has text: @Kon Why? Multithreading can help also.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27006178
linked to: http://stackoverflow.com/q/14206083
has answer: http://stackoverflow.com/a/27022350
tagged with: jtable
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42541409
type: UnansweredQuestion
has body: Here is what I want. I want tab to go to the next editable cell and shift+tab to go to the previous editable field. I think I may be going down a terrible path right now from some code I found out there. Right now, I'm extending JTable and overriding the changeSelection method. I'm looking at the current event and saying "if this is a tab event, go to the next editable field". This works, except in the case where the user is currently editing and then they hit tab. In that case, a HierarchyEvent happens with (as far as I can tell) no indication that the hierarchy change came from a tab or a mouse click, or whatever. So it defaults to moving to the next cell (which is usually uneditable). Here is what I'm currently doing private final KeyStroke tabKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0); @Override public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) { AWTEvent currentEvent = EventQueue.getCurrentEvent(); if (currentEvent instanceof KeyEvent) { KeyEvent keyEvent = (KeyEvent) currentEvent; if (keyEvent.getSource() == this &amp;&amp; KeyStroke.getKeyStrokeForEvent(keyEvent).equals(tabKeyStroke)) { Row nextEditableCell = getNextEditableCell(rowIndex, columnIndex); if (nextEditableCell != null) { rowIndex = nextEditableCell.getRow(); columnIndex = nextEditableCell.getColumn(); } } } super.changeSelection(rowIndex, columnIndex, toggle, extend); } How can I make my JTable, on tabs whether it is currently editing or not, shift to the next editable cell and not just the next cell?
linked to: http://stackoverflow.com/q/23648646
has comment: http://stackoverflow.com/comment/42541469
has comment: http://stackoverflow.com/comment/42541460
tagged with: java
has title: Override Jtable tab behavior go to next editable cell
tagged with: swing
type: Question

http://stackoverflow.com/q/27081454
has body: I am testing the coding for number recognition. This is my source code. P/s : i edited my coding. this is the full coding in my main. I tried adding public/protected/private for the sigmoid function but the errors keep adding up. import java.util.Scanner; import java.io.*; import java.util.*; import javax.swing.JOptionPane; public class Recog { public static void main(String[] args) { int row, col, data; int[][] input = new int[10][35]; //array for input data int[][] target = new int[10][10]; //array for target data double[][] weight1 = new double[20][35]; //weight between input &amp; hidden layer double[][] weight2 = new double[10][20]; //weight bween hidden &amp; output layer double[] threshold1 = new double[20]; double[] threshold2 = new double[10]; //array for threshold value double[] error = new double[20]; //error double[] errorgradient1 = new double[20]; //error gradient between input &amp; hidden layer double[] errorgradient2 = new double[10]; //error gradient between hidden &amp; output layer double alpha=0.9; double randomNumber = Math.random(); double randomMax = Math.random(); System.out.println("---------------------------------------------------------"); System.out.println(" Initialize weight &amp; threshold at hidden layer "); System.out.println("---------------------------------------------------------"); for(row=0; row&lt;20; row++) { System.out.println("Initialization of weighted values at neuron."); for(col=0; col&lt;35; col++) { weight1[row][col]=((randomNumber/randomMax)*2.4)/35; if((randomNumber%2+1)==1) //if 1 becomes negative { weight1[row][col]=weight1[row][col]*(-1); } System.out.println("Value of Hidden layer - neuron W " +row +" " +col +"[" +weight1[row][col] +"]"); } threshold1[row]=(randomNumber/randomMax)*0.5; if ((randomNumber%3+1)==1) { threshold1[row]=threshold1[row]*(-1); System.out.println("Initialization of threshold values of neuron :"); System.out.println("initialization of neuron value : " +row +" [" +threshold1[row] +"]"); } …
downvote count: 1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42672363
has title: Problems at declaring sigmoid function
upvote count: 0
has answer: http://stackoverflow.com/a/27081491
favorite count: 0
has comment: http://stackoverflow.com/comment/42688172
has answer: http://stackoverflow.com/a/27083525
type: Question
tagged with: unexpectendoffile
score: -1
has comment: http://stackoverflow.com/comment/42672386
has comment: http://stackoverflow.com/comment/42689408
answer count: 2

http://stackoverflow.com/comment/42693926
type: QuestionComment
type: Comment
has text: `String s` is an argument for `call` method in that anonymous class.
score: 1
comment on: http://stackoverflow.com/q/27094036

http://stackoverflow.com/a/27187140
type: Answer
upvote count: 2
has body: For IE 11, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0. References: google code seleniumsimplified seleniumhq docs jimevansmusic toolsqa
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27062825
answers question: http://stackoverflow.com/q/27062825

http://stackoverflow.com/comment/42666062
type: QuestionComment
comment on: http://stackoverflow.com/q/27076336
score: 0
has text: @Haresh Can you explain better?
type: Comment

http://stackoverflow.com/comment/42566720
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27019141
type: AnswerComment
has text: thank you sir... thank you very much for the reply... there is no repeated values so sorting may probably work... and thanks for the suggestion to create a method for searching...

http://stackoverflow.com/q/27096458
has comment: http://stackoverflow.com/comment/42698582
has body: I am trying to create a new thread inside a run method of currently running thread. But new thread is not getting started and it is blocking the execution of currently running thread. Run method of currently running thread. public void run() { while(true){ try{ Message message = (Message)objIn.readObject(); System.out.println("Received msg:"+message); if(message.type.equals("connection")){ if(message.content.equals("true")){ System.out.println("connection successful"); InetAddress senderIp = message.senderIp; InetAddress receiverIp = message.receiverIp; System.err.println(senderIp+"------"+receiverIp); if(senderIp.getHostAddress().equals(receiverIp.getHostAddress())){ //first member of ring topology System.err.println("first member"); }else{ System.err.println("not the first member"); ClientSideTempClient clientTemp = new ClientSideTempClient(receiverIp); Thread obj1 = new Thread(clientTemp); obj1.start(); System.out.println("after starting local client tread..."); } }else{ System.out.println("something went wrong"); } } }catch(Exception e){ System.out.println("Exception:"+e); } } } Class for new thread: ClientSideTempClient.java public class ClientSideTempClient implements Runnable{ public Socket socket; public ObjectInputStream objIn; public ObjectOutputStream objOut; public ClientSideTempClient(InetAddress serverIp){ try{ System.err.println("trying to connect"+serverIp.getHostAddress()); String ipAddress = serverIp.getHostAddress(); socket = new Socket(ipAddress, 9010); objOut = new ObjectOutputStream(socket.getOutputStream()); objOut.flush(); objIn = new ObjectInputStream(socket.getInputStream()); }catch(Exception e){ System.err.println("Exception in ClientSideTempClient"+e); } } public void sendMessageToLocalServer(Message msg){ try { objOut.writeObject(msg); objOut.flush(); System.out.println("Outgoing : "+msg.toString()); }catch(Exception e){ System.out.println("Exception in chatroom_client:"+e); } } @Override public void run() { While(true){ System.out.print…
has title: Run method is blocked on creating a new thread in JAVA
type: Question
has comment: http://stackoverflow.com/comment/42698348
has comment: http://stackoverflow.com/comment/42698442
has comment: http://stackoverflow.com/comment/42698330
score: 0
has comment: http://stackoverflow.com/comment/42698547
answer count: 1
has answer: http://stackoverflow.com/a/27096498
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42698574
has comment: http://stackoverflow.com/comment/42698437
tagged with: java

http://stackoverflow.com/q/27145389
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: What is wrong with InputStream?
has body: APP IDEA: I am struggling with fetching a XML file from Web and storing it on Internal Storage. My App checks whether there is a Internet Connection, when the user clicks button "Search" in MainActivity. If there is the an Internet connection, then I should fetch the XML from the given URL and store it in a file on Internal Storage. If there is no internet connection, I should just work with the stored file. WHAT IS WRONG: The problem that occurs is, that if I have WiFi enabled, it wont get the InputStream to be parsed through web - so there will be no output (when a user clicks Search it wont find that word in XML, although it exists). However, if the WiFi is OFF, then it will find the very same word in the stored file. (please check sample code below for more clarification). MY CODE (this is in HandleXML.java): public void handlingOnlineXML(Context ctx) throws XmlPullParserException, IOException { InputStream is; /* * Fetching the XML file from the Web */ URL url = new URL("http://meteo.arso.gov.si/uploads/probase/www/observ/surface/text/sl/observation_si_latest.xml"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(10000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.setRequestMethod("GET"); conn.setDoInput(true); // Starts the query conn.connect(); int response = conn.getResponseCode(); Log.d(TAG,"The response is: " + response); is = conn.getInputStream(); /* * Initiating XMLPullParser and sending the InputStream * into parseXMLandStoreIt method */ XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser xpp = factory.newPullParser(); /* * Saving Input Stream to a Internal Storage file */ InputStream ins = is; try { final File file = new File(ctx.getFilesDir(), "data.xml"); final OutputStream output = new FileOutputStream(file); try { final byte[] buffer = new byte[1024]; int read; while ((read = ins.read(buffer)) != -1) output.write(buffe…
score: 1
has answer: http://stackoverflow.com/a/27145862
downvote count: 1
accepted answer: http://stackoverflow.com/a/27145862
type: Question
tagged with: java
upvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27064496
accepted answer: http://stackoverflow.com/a/27066626
downvote count: 0
score: 3
has answer: http://stackoverflow.com/a/43227466
has answer: http://stackoverflow.com/a/27066505
tagged with: clojure
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
has answer: http://stackoverflow.com/a/27066626
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/59934340
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/59934340
type: Question
has title: How to zip a folder recursively with Clojure
has body: I would like to zip a folder recursevely with clojure. An example of such a folder would be ├── a ├── b │ ├── c │ │ └── ccc.txt │ └── bb.txt ├── c ├── a.txt └── b.txt Option 1 : using the OS from within Clojure What works with zip in Ubuntu is to execute following in the root of this structure : zip -r result.zip * But you have to be in the working dir in order to do this. Using absolute paths will yield other results and omiting paths all together will flatten the structure of course. Problem is that you cannot change the working directory in Clojure, not that I'm aware of that is.. Option 2 : using native Clojure (or Java) This should be possible, and I find some zip implementations in Clojure or Java wrappers. Most of them however for single files. This might be a solution : http://www.java-forums.org/blogs/java-io/973-how-work-zip-files-java.html but before I try that out I'd like to now or there isn't a good Clojure library around.

http://stackoverflow.com/comment/42600617
score: 0
comment on: http://stackoverflow.com/q/27040533
type: Comment
type: QuestionComment
has text: What is the format of your file?

http://stackoverflow.com/comment/55331055
has text: One gotcha with this is that IntelliJ will still show your Project Language level as something else, but it should set the Module Language level correctly.
comment on: http://stackoverflow.com/a/27037879
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27026815
tagged with: spring-mvc
type: AnsweredQuestion
has body: I have set up a REST application in spring, I would like the applicaiton to return JSON object from my Java Classes. I trying get my unit test to recognise the response as a JSON object but it keeps failing. here is the application context <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:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <context:component-scan base-package="com.livingsoup.beaconapp"/> <mvc:annotation-driven/> com.livingsoup.beaconapp.data.entities.CustomerEntity org.hibernate.dialect.MySQL5Dialect true </beans> here is the web.xml file Beacon MVC Rest App mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / this is my controller @RestController @RequestMapping(value = "/student") public class DataController { private CustomerDOA customerDOA; @Autowired public DataController(CustomerDOA customerDOA) { this.customerDOA = customerDOA; } @RequestMapping(value = "/get", method = RequestMethod.GET) public @ResponseBody Student getData() { Student student = new Student(); student.setName("Hello World"); return student; } @RequestMapping(value = "/findByPhoneNumber", method = RequestMethod.GET, produces="application/json") public @ResponseBody CustomerEntity findByPhoneNumber() { return customerDOA.findByPhoneNumber("07966487189"); } and here is my Entity @Entity @Table(name = "Customer", schema = "", catalo…
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Content type Not Set JSON Object from Server Spring
answer count: 2
has answer: http://stackoverflow.com/a/27027743
downvote count: 0
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/27044080
accepted answer: http://stackoverflow.com/a/27027743
upvote count: 1
possible better answer: http://stackoverflow.com/a/27044080
tagged with: unit-testing
type: Question

http://stackoverflow.com/q/27036521
tagged with: threadpool
has comment: http://stackoverflow.com/comment/42594079
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42593713
upvote count: 2
has answer: http://stackoverflow.com/a/27036780
tagged with: multithreading
has answer: http://stackoverflow.com/a/27039202
has body: I'm trying to figure out how I can get the maximum performance from a multithreaded app. I have a thread pool which I created like this: ExecutorService executor = Executors.newFixedThreadPool(8); // I have 8 CPU cores. My question is, should I divide the work into only 8 runnables/callables, which is the same number as the threads in the thread pool, or should I divide it into say 1000000 runnables/callables? for (int i = 0; i &lt; 1000000; i++) { Callable&lt;Long&gt; worker = new MyCallable(); // Each worker does little work. Future&lt;Long&gt; submit = executor.submit(worker); } long sum = 0; for (Future&lt;Long&gt; future : list) sum += future.get(); // Much more overhead from the for loops OR for (int i = 0; i &lt; 8; i++) { Callable&lt;Long&gt; worker = new MyCallable(); // Each worker does much more work. Future&lt;Long&gt; submit = executor.submit(worker); } long sum = 0; for (Future&lt;Long&gt; future : list) sum += future.get(); // Negligible overhead from the for loops Dividing into 1000000 callables seems slower to me since there is the overhead of instantiating all these callables and collecting results from them in for loops. On the other hand If I have 8 callables this overhead is negligible. And since I have only 8 threads, I can't run 1000000 callables at the same time so there is no performance gain from there. Am I right or wrong? BTW I could test these cases but the operation is very trivial and I guess the compiler realizes that and makes some optimizations. So the result might be misleading. I want to know which approach is better for something like an image processing app.
accepted answer: http://stackoverflow.com/a/27039202
has title: Which is faster? Less work in more runnables, or more work in less runnables? (ExecutorService)
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42593488
tagged with: performance
has answer: http://stackoverflow.com/a/27037460
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/42593561
type: Question
has comment: http://stackoverflow.com/comment/42593829
possible better answer: http://stackoverflow.com/a/27036780

http://stackoverflow.com/q/27146979
answer count: 2
has answer: http://stackoverflow.com/a/27166431
accepted answer: http://stackoverflow.com/a/27166431
possible better answer: http://stackoverflow.com/a/27190166
has body: The following code is aimed to read audio files from a network storage and play them back in a swing application The code makes use of java SourceDataLine and jcifs to retrieve the audio back The problem is that i need to define the mark/reset for the buffer Error: java.io.IOException: mark/reset not supported at java.io.InputStream.reset(InputStream.java:347) at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(SoftMidiAudioFileReader.java:135) at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1111) at SoundJCIFSLineTest.main(SoundJCIFSLineTest.java:36) Exception in thread "main" java.lang.NullPointerException at SoundJCIFSLineTest.main(SoundJCIFSLineTest.java:71) Code: import java.io.*; import javax.sound.sampled.*; import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.SmbFile; import jcifs.smb.SmbFileInputStream; public class SoundJCIFSLineTest { public static void main(String[] args) { SourceDataLine soundLine = null; int BUFFER_SIZE = 64*1024; // 64 KB // Set up an audio input stream piped from the sound file. try { //Maked the connection fast jcifs.Config.setProperty("resolveOrder", "DNS"); String originPath="smb://192.168.1.2/server/audiofile.wav"; NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("", "username", "password"); //This is the audio file the needs to be downloaded from the network storage SmbFile audioFile = new SmbFile(originPath, auth); SmbFileInputStream smbFileInputStream = new SmbFileInputStream(audioFile); AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(smbFileInputStream); AudioFormat audioFormat = audioInputStream.getFormat(); DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat); soundLine = (SourceDataLine) AudioSystem.getLine(info); soundLine.open(audioFormat); soundLine.start(); int nBytesRead = 0; byte[] sampledData = new byte[BUFFER_SIZE]; while (nBytesRead != -1) { nBytesRead = audioInputStream.read(sampledData, 0, sampledData.length)…
score: 0
tagged with: javasound
tagged with: jcifs
tagged with: swing
has answer: http://stackoverflow.com/a/27190166
type: AnsweredQuestion
tagged with: java
has title: How to retrieve audio from network storage
type: Question

http://stackoverflow.com/a/31787002
upvote count: 1
has body: Try to look at this code example: https://gist.github.com/erickok/7692592
downvote count: 0
answers question: http://stackoverflow.com/q/27108873
type: Answer
score: 1

http://stackoverflow.com/comment/42669449
comment on: http://stackoverflow.com/a/27079338
score: 0
type: AnswerComment
type: Comment
has text: @Mario: Then use composition, for [example](http://stackoverflow.com/a/11372932/230513), with the label & worker contained in the same class.

http://stackoverflow.com/a/27126646
score: 1
has body: The regex and example you provided will not work, as you don't allow capital letters. You can try this: ([a-zA-Z]*(\s)*[\.\,]*)*
downvote count: 0
answers question: http://stackoverflow.com/q/27126455
type: Answer
upvote count: 1

http://stackoverflow.com/q/27099994
has answer: http://stackoverflow.com/a/27100264
has title: Instantiate self-bounded generic in java
score: 0
has body: Possibly a simple question, but I can't seem to do this for some reason. How do I instantiate an object of type BinaryTree from the class below: public class BinaryTree&lt;N extends BinaryTree.BTNode&lt;N&gt;&gt; { public static class BTNode&lt;N extends BTNode&lt;N&gt;&gt; { public N left; public N right; public N parent; } //some methods which return variables of type N //or take variables of type N as arguments } Both: BinaryTree&lt;BTNode&gt; tree = new BinaryTree&lt;BTNode&gt;(); and: BinaryTree&lt;BTNode&lt;BTNode&gt;&gt; tree = new BinaryTree&lt;BTNode&lt;BTNode&gt;&gt;(); generate a compiler error in Eclipse saying the type BTNode is not a valid substitute for the bounded parameter N extends BTNode. The reason for this structure is that I want to be able to extend BinaryTree and BTNode and have the subclass call superclass functions which return variables of type N, and have N be of the type of the subclass of BTNode, not of type BTNode. I feel like I may be missing something obvious here, but I've searched extensively and spent a decent amount of time trying different things and I remain unable to do this. Any help is appreciated.
answer count: 2
tagged with: generics
has answer: http://stackoverflow.com/a/27131854
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42704597
tagged with: java
type: Question

http://stackoverflow.com/q/27010670
favorite count: 0
tagged with: linux
has body: I am running Linux Angstrom on BeagleBone Black and with this Oracle JDK "Linux ARM v6/v7 VFP Soft Float ABI". I wrote a simple code to have a panel inside a frame with 1 button and that is running just fine. However, when I adding some drawings (lines and circles) to the panel and refresh with any validate() or revalidate(), I get the following error when I try to run the jar file. java: res_quer.c:251 __libc_res_nquery: Assertion 'hp != hp2' failed. Aborted Any idea about how to solve that issue, if not, any idea about how to refresh the panel so that it displays the updated content without using validate or revalidate? (I called repaint explicit but it did nothing) Any ideas, recommendations?
tagged with: beagleboneblack
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27027472
has title: BeagleBone Black and java revalidate()
accepted answer: http://stackoverflow.com/a/27027472
upvote count: 1
answer count: 1

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/27030183
tags question: http://stackoverflow.com/q/27047526
tag name: android-actionbar
tags question: http://stackoverflow.com/q/27097126

http://stackoverflow.com/comment/42615379
comment on: http://stackoverflow.com/a/27048488
score: 0
type: AnswerComment
type: Comment
has text: Here I am only getting the first part of the string .ie. only Hello. I also want StackOverflow

http://stackoverflow.com/comment/42789416
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27146973
has text: BogoSort it the best sort: http://en.wikipedia.org/wiki/Bogosort
score: 0

algorithm
tags question: http://stackoverflow.com/q/27090107
tags question: http://stackoverflow.com/q/27138035
tag name: algorithm
tags question: http://stackoverflow.com/q/27047698
tags question: http://stackoverflow.com/q/27094660
tags question: http://stackoverflow.com/q/27098303
tags question: http://stackoverflow.com/q/27076034
tags question: http://stackoverflow.com/q/26995166
tags question: http://stackoverflow.com/q/27003335
tags question: http://stackoverflow.com/q/27086845
tags question: http://stackoverflow.com/q/27004830
tags question: http://stackoverflow.com/q/27046368
tags question: http://stackoverflow.com/q/27062497
tags question: http://stackoverflow.com/q/27112162
tags question: http://stackoverflow.com/q/27091714
tags question: http://stackoverflow.com/q/27138839
tags question: http://stackoverflow.com/q/27100152
tags question: http://stackoverflow.com/q/27083086
tags question: http://stackoverflow.com/q/27076767
tags question: http://stackoverflow.com/q/27046463
tags question: http://stackoverflow.com/q/27096435
type: Tag
tags question: http://stackoverflow.com/q/27012415
tags question: http://stackoverflow.com/q/27118479
tags question: http://stackoverflow.com/q/27074759
tags question: http://stackoverflow.com/q/27117379
tags question: http://stackoverflow.com/q/27103231
tags question: http://stackoverflow.com/q/27003803
tags question: http://stackoverflow.com/q/27119821
tags question: http://stackoverflow.com/q/27021241
tags question: http://stackoverflow.com/q/27101938
tags question: http://stackoverflow.com/q/27004712
tags question: http://stackoverflow.com/q/27028033
tags question: http://stackoverflow.com/q/27119768
tags question: http://stackoverflow.com/q/27077616
tags question: http://stackoverflow.com/q/26995607
tags question: http://stackoverflow.com/q/27077773
tags question: http://stackoverflow.com/q/27140585
tags question: http://stackoverflow.com/q/27066986
tags question: http://stackoverflow.com/q/26996818
tags question: http://stackoverflow.com/q/27152108
tags question: http://stackoverflow.com/q/27092858
tags question: http://stackoverflow.com/q/27026430
tags question: http://stackoverflow.com/q/27013060
tags question: http://stackoverflow.com/q/27111825
tags question: http://stackoverflow.com/q/27148856

http://stackoverflow.com/comment/42737877
comment on: http://stackoverflow.com/q/27117764
has text: The finally block will always be executed if you enter the try block. Them's the rules.
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27070341
has comment: http://stackoverflow.com/comment/42655075
has comment: http://stackoverflow.com/comment/42654868
has comment: http://stackoverflow.com/comment/42653868
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42655477
tagged with: teradata
has title: Name requires more than 30 bytes in LATIN internal form?
tagged with: jdbc
has body: I am trying to implement Fastload Utility with jdbc. But I keep getting the following error: Name requires more than 30 bytes in LATIN internal form I read many articles : this error occurs during table creation. In my case this error is thrown at the executeBatch() line . Here is my code Connection conn = DriverManager.getConnection(url, username, password); // I am using TYPE=FASTLOAD // creating table String createStr = "CREATE TABLE dbname.tablename( " + " Fname VARCHAR(506) CHARACTER SET UNICODE, " + " Lname VARCHAR(507) CHARACTER SET UNICODE " + " );" Statement createTable = ... createTable.execueQuery("CREATE TABLE ... ") ; PreparedStatement prst = ... ; while ( // loop ) { prst.addBatch(); } prst.executeBatch(); // Here it throws this error conn.commit(); Why do I get this error when executeBatch() method fires ? What can I do ?
has comment: http://stackoverflow.com/comment/42655443
has answer: http://stackoverflow.com/a/27071565
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27071565
has comment: http://stackoverflow.com/comment/42653661
tagged with: java
has comment: http://stackoverflow.com/comment/42653874
type: Question

http://stackoverflow.com/comment/42646940
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27065784
has text: I added `public Dimension getPreferredSize(){ return new Dimension(50,50); }` in the controls class. But it still doesn't render the panel. Am I doing something wrong?

http://stackoverflow.com/a/27065528
has body: In your example an array is used and not a JSON object. You are just changing the index of the array not its value. you shouldn't be using an array here at all you should use a regular object. All Javascript objects function as associative arrays. String json = '"data":[ {"key":"1", "key":"2","key":"3"}, {"key":"4", "key":"5", "key":"6"}, {"key":"7", "key":"8", "key":"9"} ]'; To convert it to DBObject, you can code like this : DBObject dbObject = (DBObject)JSON.parse(json); And save it in the database. I hope my answer helps you.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27064634
type: Answer
accepted answer of: http://stackoverflow.com/q/27064634
upvote count: 1
score: 1

http://stackoverflow.com/comment/42723340
comment on: http://stackoverflow.com/q/27110110
type: QuestionComment
type: Comment
has text: possible duplicate of [In Java, how to check if a string contains a substring ( ignoring the case )?](http://stackoverflow.com/questions/2275004/in-java-how-to-check-if-a-string-contains-a-substring-ignoring-the-case)
score: 1

http://stackoverflow.com/a/27145463
accepted answer of: http://stackoverflow.com/q/27145341
type: AcceptedAnswer
downvote count: 0
has body: You need to use like: (SalDettaglio[]) request.getSession(false).getAttribute("salDettaglio"); OR You could directly use something like: &lt;h4&gt;${salDettaglio}&lt;/h4&gt; &lt;!-- if its a string say for example --&gt; OR you could even print using core's out EL like: &lt;c:out value="${sessionScope.salDettaglio}"/&gt; &lt;!-- which again would be useless as its an array --&gt;
answers question: http://stackoverflow.com/q/27145341
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/42550674
comment on: http://stackoverflow.com/q/27011828
type: Comment
score: 1
type: QuestionComment
has text: Consider getting rid of `static` fields and methods and call methods on an object instance.

http://stackoverflow.com/a/27150645
type: Answer
has comment: http://stackoverflow.com/comment/42971396
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27150181
upvote count: 1
has body: to save the scoer you can use SharedPrefrences: to save your score: (gameData is the string to later use to get the sharedPrefrences) SharedPreferences myData= getSharedPreferences("gameData", 0); SharedPreferences.Editor editor = myData.edit(); editor.putInt("gameScore", myGameScore); editor.commit; to load your score: SharedPreferences myData= getSharedPreferences("gameData", 0); int myScore = myData.getInt(gameScore, 0); after doing so, "myScore" will contain the score that you save (or 0 for default value if you didn't save any score before). about the first part of your question - I didn't andestood what you asked...
has comment: http://stackoverflow.com/comment/42959125
has comment: http://stackoverflow.com/comment/42963675

duplicates
tags question: http://stackoverflow.com/q/27141833
tags question: http://stackoverflow.com/q/27020447
tags question: http://stackoverflow.com/q/27073791
tags question: http://stackoverflow.com/q/27009045
type: Tag
tags question: http://stackoverflow.com/q/27128247
tags question: http://stackoverflow.com/q/27117589
tags question: http://stackoverflow.com/q/27034262
tag name: duplicates

http://stackoverflow.com/comment/42656790
comment on: http://stackoverflow.com/a/27064463
has text: I am assuming I need to put the 2nd block of code in my saveExcelFile method in my Save_File class. But when I do I get an error saying "cannot make a static reference to a non static method (getIntent) from the type activity.
score: 0
type: AnswerComment
type: Comment

constructor
tags question: http://stackoverflow.com/q/26997666
tags question: http://stackoverflow.com/q/27054266
tags question: http://stackoverflow.com/q/27045425
tags question: http://stackoverflow.com/q/27126275
tags question: http://stackoverflow.com/q/27044784
tags question: http://stackoverflow.com/q/27136143
tags question: http://stackoverflow.com/q/26996632
tags question: http://stackoverflow.com/q/27088194
tags question: http://stackoverflow.com/q/27051499
tags question: http://stackoverflow.com/q/27139409
tags question: http://stackoverflow.com/q/27086773
tags question: http://stackoverflow.com/q/27108366
tags question: http://stackoverflow.com/q/27115986
tags question: http://stackoverflow.com/q/27150364
tags question: http://stackoverflow.com/q/27024102
tags question: http://stackoverflow.com/q/27075290
tag name: constructor
tags question: http://stackoverflow.com/q/27074372
tags question: http://stackoverflow.com/q/27070622
tags question: http://stackoverflow.com/q/27089043
type: Tag
tags question: http://stackoverflow.com/q/27094397
tags question: http://stackoverflow.com/q/27140383
tags question: http://stackoverflow.com/q/27025537
tags question: http://stackoverflow.com/q/27078735

http://stackoverflow.com/comment/42550002
has text: If you have the program working, then what's your question? How could we help uou shorten or cleanup the code without seeing any of it?
comment on: http://stackoverflow.com/q/27011662
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42524321
has text: I've looked around and recursion appears to be popular. However, I'm inexperienced with it and I have trouble getting my head around how it could work.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26996818
score: 0

http://stackoverflow.com/a/27143889
upvote count: 7
score: 7
answers question: http://stackoverflow.com/q/27143860
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Change System.out.println(arr[i] + ' '); to System.out.println(arr[i]); or System.out.println(arr[i] + " "); When you are printing arr[i] + ' ', first the expression is evaluated as the addition of an int and a char (the integral value of the space character, which is 32), and only then the resulting integer is printed. Therefore, all the integers in your array are offset by 32 when printed this way.
has comment: http://stackoverflow.com/comment/42784300
accepted answer of: http://stackoverflow.com/q/27143860

http://stackoverflow.com/a/27019832
upvote count: 1
type: Answer
downvote count: 0
has body: You are changing all the elements in your array to the last value of j. Your loop needs to be : for (int i=0;i&lt;5;i++) { elements[i]=2*i +1; } Think about it this way : When i is 0 , then you are assigning to elements[0] values from 1 to 9 (the j loop). The last value assigned is 9.
answers question: http://stackoverflow.com/q/27019748
score: 1

http://stackoverflow.com/q/27021806
has title: How to use files within a jar file?
type: Question
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/27022468
has body: I have seen other questions on accessing resource in jar topic but my question is a bit different. I need to use .jks files in my code for a client i am writing to access a webservice. This code works perfectly in my system even when i package it as a jar but when i send jar to another person it gets SSL error. I understood it was unable to access the files as I hardcoded in my code. This was the same even when I added the files in the jar. Can anybody tell me how to access this file in jar. I do not need to use file reader or buffered reader here as i just need to give path of the file. Thanks in advance SslConfigurator sslConfig = SslConfigurator.newInstance() .trustStoreFile("AAAWSKeyStore.jks") .trustStorePassword("password") .keyStoreFile("AAAWSKeyStore.jks") .keyPassword("password") .securityProtocol("TLS"); The error thrown here is jjava.lang.IllegalStateException: Cannot find key store file ".\AAAWSKeyStore.jks ". at org.glassfish.jersey.SslConfigurator.createSSLContext(SslConfigurator .java:679) at GuiAAAWS.sendPost(GuiAAAWS.java:220) at GuiAAAWS.OkActionPerformed(GuiAAAWS.java:198) at GuiAAAWS.access$2(GuiAAAWS.java:193) at GuiAAAWS$3.actionPerformed(GuiAAAWS.java:88) 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
upvote count: 1
has comment: http://stackoverflow.com/comment/42568690
favorite count: 0
has comment: http://stackoverflow.com/comment/42569371
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42568601
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27022468

http://stackoverflow.com/q/27139329
has body: I'm learning java with Swing. I have a problem with setAccelerator for menu. My code: closeItem.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_W, ActionEvent.CTRL_MASK)); closeOtherItem.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_W, ActionEvent.CTRL_MASK&amp;ActionEvent.SHIFT_MASK)); I want when I press Ctrl+W, my JTabbedPane will close selectedTab, and when press Ctrl+Shift+W my JtabbedPane will close all ignore selectedTab. But only action Ctrl+W was detected, although when I click on closeOtherItem my program will run normally.
tagged with: jframe
type: UnansweredQuestion
has title: setAccelerator for jmenu item in java
tagged with: jmenu
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/27139370
tagged with: jmenuitem
score: 0
answer count: 1

http://stackoverflow.com/comment/42790123
has text: If you're using Java 7 or newer, you might want to write this code using try-with-resources, this would greatly simplify your exception handling code.
type: Comment
comment on: http://stackoverflow.com/q/27146759
score: 0
type: QuestionComment

http://stackoverflow.com/q/27133514
type: AnsweredQuestion
has body: I'd like to implement an handler which is triggered every time I close a part of my Application Model. How can I do? For instance, every time I close such part I want to print a message thru the System Console. Moreover is there any object (that could be injected) that provides the state of an MPart? (if it's open or close) Thanks
score: 1
tagged with: java
tagged with: rcp
tagged with: eclipse
type: Question
answer count: 1
has title: Eclipse e4 - Add a Closing Part handler
has answer: http://stackoverflow.com/a/27134021
accepted answer: http://stackoverflow.com/a/27134021
tagged with: handler
upvote count: 1
favorite count: 0
tagged with: e4
downvote count: 0

http://stackoverflow.com/q/27102546
has body: how can I implement a tooltip which shows me for each cell a tip when the value is too long? I just have a table renderer which colors me some cell. So I think the easiest way is to implement the metod in it. public class ColorRenderer extends DefaultTableCellRenderer { final int STATUS_COL = 7; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); int modelIndex = table.convertRowIndexToModel(row); String type = (String) table.getModel().getValueAt(modelIndex, 7); if ("".endsWith(type)) { component.setBackground(table.getBackground()); component.setForeground(table.getForeground()); } else { component.setBackground(Color.RED); component.setForeground(Color.WHITE); } if (isSelected) { setBackground(table.getSelectionBackground()); setForeground(table.getSelectionForeground()); } return component; } } Thank you in advance.
has answer: http://stackoverflow.com/a/27103502
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42709064
accepted answer: http://stackoverflow.com/a/27103502
has answer: http://stackoverflow.com/a/27104492
score: 0
answer count: 3
tagged with: tablecellrenderer
has title: Show tooltips in JTable only when column is cut off
has answer: http://stackoverflow.com/a/27102683
tagged with: java
tagged with: jtable
possible better answer: http://stackoverflow.com/a/27102683
tagged with: tooltip

http://stackoverflow.com/a/27168977
has body: Looks like the keystore.load() is not using "SunJSSE" as the default keystore provider in my j2ee environment rather it was using oraclepki provider. Now that i am loading keystore.load(Is,"SunJSSE") it is able to load properly.
type: Answer
accepted answer of: http://stackoverflow.com/q/27119576
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27119576

http://stackoverflow.com/comment/42703406
score: 0
type: Comment
type: QuestionComment
has text: Is this the one you are searching?? http://stackoverflow.com/questions/2808632/manually-put-files-to-android-emulator-sd-card
comment on: http://stackoverflow.com/q/27099099

http://stackoverflow.com/comment/42788502
has text: would you please explain what's the problem with <T,F>for creating an array
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27146476

http://stackoverflow.com/comment/42767198
type: QuestionComment
comment on: http://stackoverflow.com/q/27132065
score: 0
has text: @Rüdiger-Herrmann while that did point me to the right direction, it was not what I asked for.. The greyed check is not the same as a "no" and would be confusing. I modified your anwser to use images, but still not sure if it is the best solution
type: Comment

http://stackoverflow.com/comment/42703478
score: 0
type: Comment
has text: i downloaded the dtd files again and loaded them in the project. No idea how that made any difference.
type: AnswerComment
comment on: http://stackoverflow.com/a/27098612

http://stackoverflow.com/q/27087698
type: Question
tagged with: reflection
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/339699
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42683314
has title: Accessing private/protected method with generic type using reflection
has comment: http://stackoverflow.com/comment/42683294
has body: I have a class with a validate method that contains generic type public class Foo{ private &lt;T&gt; validateThis(T objectToValidate) { Set&lt;ConstraintViolation&lt;T&gt;&gt; constraintViolations; try { constraintViolations = validator.validate(objectToValidate); } catch(RuntimeException re) { throw new HttpStatusUnprocessableEntityException("Unexpected problem occurred); } } however I want to access this method using reflection (i.e for unit testing ) but when I try Method method = Foo.class.getDeclaredMethod("validateThis",ParameterizedType.class); method.setAccessible(true); I am getting java.lang.NoSuchMethodException:Foo.validateThis(java.lang.reflect.ParameterizedType)
answer count: 0
tagged with: generics

http://stackoverflow.com/q/27118195
type: Question
has answer: http://stackoverflow.com/a/27118309
tagged with: java
has body: I have been trying to implement parse.com push notifications on my iOS and android app. Ive successfully been able to implement this on iOS, however, I'm still struggling with the Android implementation. When the notification is received by the user, and the user presses the notification, i want to open up my 'HomeScreen' activity, and display the text from the notification in an alert Dialogue. the Receiver handler and manifest files are shown below, along with the LogCat. What am i doing wrong, and how do i fix it? HomeScreen Java: public class Receiver extends ParsePushBroadcastReceiver { public Receiver(){ } private static final String TAG = "MyNotificationsReceiver"; @Override public void onPushOpen(Context context, Intent intent) { Log.e("Push", "Clicked"); Intent i = new Intent(context, HomeScreen.class); i.putExtras(intent.getExtras()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); try { JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data")); String notificationText = json.getString("alert"); AlertDialog Alert= new AlertDialog.Builder(context) .setTitle("News") .setMessage(notificationText) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog, int which){ } }) .show(); } catch (JSONException e) { Log.d(TAG, "JSONException: " + e.getMessage()); } } } Manifest: <service android:name="com.parse.PushService" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.USER_PRESENT" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="au.gov.nsw.shellharbour.saferroadsshellharbour" /> <action android:name="com.parse.push.intent.RECEIVE" /> <action android:name="com.parse.push.intent.DELETE" /> <action android:name="com.parse.push.intent.OPEN" /> Logcat: java.lang.RuntimeException: Unable to i…
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27118309
tagged with: push-notification
tagged with: android
type: AnsweredQuestion
tagged with: parse-platform
has title: Error associated with receiving parse.com push notification Android

jar
tags question: http://stackoverflow.com/q/26995644
tags question: http://stackoverflow.com/q/27073376
tags question: http://stackoverflow.com/q/27076391
tags question: http://stackoverflow.com/q/27134118
tags question: http://stackoverflow.com/q/27021806
tags question: http://stackoverflow.com/q/27007018
tags question: http://stackoverflow.com/q/27048226
tags question: http://stackoverflow.com/q/27077573
tags question: http://stackoverflow.com/q/27004174
tags question: http://stackoverflow.com/q/27061782
tags question: http://stackoverflow.com/q/27009549
tags question: http://stackoverflow.com/q/27120657
tags question: http://stackoverflow.com/q/27015848
tags question: http://stackoverflow.com/q/26992625
type: Tag
tags question: http://stackoverflow.com/q/27081406
tags question: http://stackoverflow.com/q/27078338
tags question: http://stackoverflow.com/q/27010487
tags question: http://stackoverflow.com/q/26992163
tags question: http://stackoverflow.com/q/27005479
tags question: http://stackoverflow.com/q/27129629
tags question: http://stackoverflow.com/q/27089126
tag name: jar
tags question: http://stackoverflow.com/q/27141806
tags question: http://stackoverflow.com/q/27017031
tags question: http://stackoverflow.com/q/27145726
tags question: http://stackoverflow.com/q/27062394
tags question: http://stackoverflow.com/q/27141561
tags question: http://stackoverflow.com/q/27054993
tags question: http://stackoverflow.com/q/27141038
tags question: http://stackoverflow.com/q/27150307
tags question: http://stackoverflow.com/q/27128690
tags question: http://stackoverflow.com/q/27125411
tags question: http://stackoverflow.com/q/27019244
tags question: http://stackoverflow.com/q/26997508
tags question: http://stackoverflow.com/q/26995908
tags question: http://stackoverflow.com/q/27078224
tags question: http://stackoverflow.com/q/26993474
tags question: http://stackoverflow.com/q/27148502
tags question: http://stackoverflow.com/q/27031743
tags question: http://stackoverflow.com/q/27082920
tags question: http://stackoverflow.com/q/27040411

http://stackoverflow.com/q/27117948
has comment: http://stackoverflow.com/comment/42738117
answer count: 1
has comment: http://stackoverflow.com/comment/42738077
has body: Im trying to understand how String immutability increases the security. I had searched and found many cases but it does not give real practical example. Here is one such example - boolean connect(string s){ if (!isSecure(s)) { throw new SecurityException(); } //here will cause problem, if s is changed before this by using other references. causeProblem(s); } In the above case the connect method could be called with any valid String For ex:- connect("DB2") or connect("ORACLE") and the method will be executed accordingly. Can someone elaborate more on this how the security is enhanced? Excuse if its more basic question.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42738063
has comment: http://stackoverflow.com/comment/42738463
tagged with: java
has answer: http://stackoverflow.com/a/27118003
type: Question
has comment: http://stackoverflow.com/comment/42738178
has title: Security for String immutability
duplicate of: http://stackoverflow.com/q/15274874
has comment: http://stackoverflow.com/comment/42737997
linked to: http://stackoverflow.com/q/15274874
score: 0
has comment: http://stackoverflow.com/comment/42738034
has comment: http://stackoverflow.com/comment/42738480

http://stackoverflow.com/a/26994561
has comment: http://stackoverflow.com/comment/42520157
upvote count: 1
answers question: http://stackoverflow.com/q/26994344
score: 1
has comment: http://stackoverflow.com/comment/42524381
accepted answer of: http://stackoverflow.com/q/26994344
type: AcceptedAnswer
has body: You should use generics. For example: class DList&lt;T&gt; { DListNode2&lt;T&gt; head; // Or whatever properties your class contains } class DListNode2&lt;T&gt; { T runObject; DListNode2&lt;T&gt; prev; DListNode2&lt;T&gt; next; } And in your RunLengthEncoding class declare list like this: DList&lt;String&gt; list;. That way you can define the type of the parameters in your list and won't have to do casting when you retrieve your object from the list. Take a look at the standard Java Collections API classes, for example LinkedList. They do this the same way.
downvote count: 0
has comment: http://stackoverflow.com/comment/42519972
has comment: http://stackoverflow.com/comment/42520043
type: Answer

http://stackoverflow.com/q/26995116
has body: In system.config file I removed the OPTIONS method declaration and I'm waiting that requests which's method type is OPTIONS must be prevented. If I remove other method types from system.config file, requests having them is prevented but my controll not working for OPTIONS method type. system.config file; CORS_ALLOW_GENERIC_HTTP_REQUESTS=true CORS_ALLOW_ORIGIN="*" CORS_SUPPORTED_METHODS=" HEAD, PUT,POST, GET, DELETE" CORS_SUPPORTED_HEADERS="*" My doOptions method; protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { corsRequestHandler.tagRequest(request); CORSRequestType type = CORSRequestType.detect(request); if (type.equals(CORSRequestType.PREFLIGHT)) { try { corsRequestHandler.handlePreflightRequest(request, response); } catch (InvalidCORSRequestException e) { logger.error("Invalid CORS Request Exception: " + e.getMessage()); } catch (CORSOriginDeniedException e) { logger.error("CORS Origin Denied Exception: " + e.getMessage()); } catch (UnsupportedHTTPMethodException e) { logger.error("Unsupported HTTP Method Exception: " + e.getMessage()); } catch (UnsupportedHTTPHeaderException e) { logger.error("Unsupported HTTP Header Exception: " + e.getMessage()); } } } I am out of ideas, please advise.
tagged with: servlets
tagged with: httprequest
type: Question
tagged with: cors
score: 0
answer count: 1
has title: OPTIONS Cors method cannot be prevented
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27001358
accepted answer: http://stackoverflow.com/a/27001358

http://stackoverflow.com/q/27113045
has comment: http://stackoverflow.com/comment/42730307
tagged with: concurrency
answer count: 3
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42728853
has answer: http://stackoverflow.com/a/27113169
linked to: http://stackoverflow.com/q/14624365
has comment: http://stackoverflow.com/comment/42728877
accepted answer: http://stackoverflow.com/a/27113210
has body: for the code below: public ReentrantReadWriteLock getLock(String tableName) { ReentrantReadWriteLock lock = locksMap.get(tableName); if (lock == null) { lock = new ReentrantReadWriteLock(); locksMap.put(tableName, lock); } } //where locksMap is a HashMap with key String (tableName) and value ReentrantReadWriteLock (Lock). My question is, if threads are accessing this method simultaneously, they will get different Lock objects with the same "tableName", because the get and put methods of the Map are called separately. Any solutions with explanation will be appreciated? Thanks in advance.
possible better answer: http://stackoverflow.com/a/27113154
type: AnsweredQuestion
has title: Calling get() and put() method of Hashmap correctly.
downvote count: 0
has comment: http://stackoverflow.com/comment/42729721
has answer: http://stackoverflow.com/a/27113210
tagged with: multithreading
has answer: http://stackoverflow.com/a/27113154
has comment: http://stackoverflow.com/comment/42728999
type: Question
has comment: http://stackoverflow.com/comment/42728920
tagged with: hashmap
score: 1
tagged with: java

http://stackoverflow.com/comment/42573269
score: 0
comment on: http://stackoverflow.com/q/27024824
has text: no, I don't want too, I was just looking for a explanation before running it :)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42721421
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27109096
has text: Ok, so you modified your answer, now it is more clear. You could still give an example of how to solve it. You could use Gson with the answer you provided.
type: AnswerComment

http://stackoverflow.com/comment/46626865
score: 0
type: Comment
has text: I regret. This didn't not work neither. The only thing possible is to add it to the maven_opts or the VM Arguments in Eclipse. Only saving this to the maven-compiler-plugin did not help.
comment on: http://stackoverflow.com/a/27056150
type: AnswerComment

http://stackoverflow.com/q/27073319
answer count: 2
has comment: http://stackoverflow.com/comment/42658852
has answer: http://stackoverflow.com/a/27073388
has title: Printing specific path to a node in a binary tree
tagged with: binary-tree
tagged with: preorder
type: UnansweredQuestion
tagged with: binary-search-tree
has comment: http://stackoverflow.com/comment/42658868
tagged with: java
has body: I'm trying to use pre-order traversal to find a node in a binary tree made up of the characters a-z and A-Z, where going left is marked as "0" and going right is marked as "1", so that a correct output would look like "00" for a node that is two branches to the left. The nodes are not sorted. So far I have this: static String routeNum = ""; private static String onePath(BinaryNodeInterface&lt;Character&gt; root, String route) { BinaryNodeInterface&lt;Character&gt; temp = root; if(temp != null){ if(temp.hasLeftChild()){ routeNum = onePath(temp.getLeftChild(),route+"0"); } if(temp.hasRightChild()){ routeNum = onePath(temp.getRightChild(), route+"1"); } } System.out.print(route); return route; } The output indicates that I am getting to the right nodes but it doesn't print the path.
type: Question
tagged with: traversal
has answer: http://stackoverflow.com/a/27073433
score: 0

jmx
tags question: http://stackoverflow.com/q/27051092
tags question: http://stackoverflow.com/q/27049710
tag name: jmx
tags question: http://stackoverflow.com/q/27067707
type: Tag
tags question: http://stackoverflow.com/q/27117347

http://stackoverflow.com/a/27078707
type: Answer
has comment: http://stackoverflow.com/comment/42667643
has comment: http://stackoverflow.com/comment/42667787
has comment: http://stackoverflow.com/comment/42668118
has comment: http://stackoverflow.com/comment/42667676
score: 1
answers question: http://stackoverflow.com/q/27078603
upvote count: 1
has comment: http://stackoverflow.com/comment/42667899
has body: When I use the AVD I can storage the files directly on data/data/... directory, but when I use my cellphone the directory is not open, why? Security. The piece on Android that adb talks to has elevated privileges on an emulator. Will those files be accessible by anyone who download my app? Generally no, for the same reason why they are not accessible to you per question #1. Users who root their devices will be able to get to files on internal storage. Otherwise, they cannot. I wrote a blog post series a while back on the various storage options in Android and their characteristics, including one on internal storage, that might be of interest to you.
has comment: http://stackoverflow.com/comment/42667872
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27078603

http://stackoverflow.com/a/27146449
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42788600
has comment: http://stackoverflow.com/comment/42789335
answers question: http://stackoverflow.com/q/27146146
has body: Java Date objects, are wrappers around a specific point in time. This is implemented as "the number of milliseconds past the epoch [1 Jan 1970]". And, as per the Javadocs, the getTime() method returns this number of milliseconds. So, when you parse your time into a Date, you're not getting an object that represents "1:30am". You're getting an object that represents "1:30am today". And so its getTime() will return some number that represents about 45 years in milliseconds. If you add two of these outputs together, you'll get a number that is about 90 years in milliseconds, and so if you turn it back into a Date you'll get an instant that represents some point in late 2059. That is... really not what you want. (Note that it sort of works for the subtraction case, because you get two very large numbers that are nevertheless just a half hour apart. When you subtract them, you're left with a date that represents a little after midnight on 1 Jan 1970. Still - this might not work in some edge cases, depending on things like daylight savings times, because you're still referencing actual instants in history - so I wouldn't rely on it.) The better way to do it, is by using an object that represents just a time-of-day. Java 8 has LocalTime to represent this, and you could easily add two of these by combining the result of the toSecondOfDay call. Edit: If you're stuck using an earlier version of Java... The standard response for any date/time related questions used to be "use Joda-Time" (which is what the Java 8 classes were based on anyway). If third-party libraries aren't an option for whatever reason, then you'll probably have to implement your own class to represent and add times (it's not that involved - just three int fields, and some logic to "carry the one" when the latter two hit 60).
accepted answer of: http://stackoverflow.com/q/27146146
score: 4
upvote count: 4
type: AcceptedAnswer

input
tags question: http://stackoverflow.com/q/27018633
tags question: http://stackoverflow.com/q/27040554
tags question: http://stackoverflow.com/q/27129181
tags question: http://stackoverflow.com/q/27083695
tags question: http://stackoverflow.com/q/27046056
tags question: http://stackoverflow.com/q/27039007
tags question: http://stackoverflow.com/q/27098713
tags question: http://stackoverflow.com/q/27037251
tags question: http://stackoverflow.com/q/27081675
tags question: http://stackoverflow.com/q/26994489
tags question: http://stackoverflow.com/q/26995219
tags question: http://stackoverflow.com/q/27027929
tags question: http://stackoverflow.com/q/27068309
tags question: http://stackoverflow.com/q/27050323
tags question: http://stackoverflow.com/q/27103968
tags question: http://stackoverflow.com/q/27096392
tag name: input
type: Tag
tags question: http://stackoverflow.com/q/27030527
tags question: http://stackoverflow.com/q/27095397

http://stackoverflow.com/comment/42745814
type: QuestionComment
comment on: http://stackoverflow.com/q/27122490
score: 0
has text: int Recursion(int k , int A[] , int lowIn , int HIND ){ int mid =lowIn + HIND /2; if (lowIn > HIND ) return -1; if(k==A[mid]) return mid; else if (k<A[mid]) return Recursion(k , A, lowIn , mid -1); else return Recursion(k , A, mid +1, HIND); }
type: Comment

http://stackoverflow.com/comment/42757303
type: AnswerComment
type: Comment
has text: But all the color classes implementation will be present in the SDK right, even in the customer one ?
comment on: http://stackoverflow.com/a/27117758
score: 0

http://stackoverflow.com/q/26992333
tagged with: android
tagged with: soap
tagged with: android-ksoap2
type: AnsweredQuestion
tagged with: java
has title: kSoap2 POJO mapping class cast exception
type: Question
accepted answer: http://stackoverflow.com/a/27005367
has body: I have difficulties using kSOAP2 library for android. I am able to send requests and get the response, but I would like to map the contents of the response to a plain java object. Basically kSOAP2 allows you to do that by specifying the parameters of the mapping into the addMapping() method. Anyway I am having a class cast exception when trying to cast the response to my Java object. Here is my implementation : final SoapSerializationEnvelope envelope = LoginInfo.buildLoginObject(login,password); envelope.addMapping(NAMESPACE, "GetCustomerByIdPwdResponse", new GetCustomerByIdPwdResponse().getClass()); new AsyncTask&lt;Void, Void, Void&gt;() { @Override protected Void doInBackground(Void... params) { HttpTransportSE httpTransport = new HttpTransportSE("URL"); httpTransport.debug = true; try { httpTransport.call(URL, envelope); Log.d("SOAP OBJECT SENT",httpTransport.requestDump); Log.d("SOAP OBJECT RESPONSE",httpTransport.responseDump); GetCustomerByIdPwdResponse customerByIdPwd = (GetCustomerByIdPwdResponse)envelope.bodyIn; } catch (IOException | XmlPullParserException e) { e.printStackTrace(); } return null; } }.execute(); And here is the request and response I get, they are all good : Request : &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;v:Envelope xmlns:v="http://www.w3.org/2003/05/soap-envelope" xmlns:c="http://www.w3.org/2003/05/soap-encoding" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;v:Header&gt; &lt;n0:To xmlns:n0="http://www.w3.org/2005/08/addressing"&gt;To&lt;/n0:To&gt; &lt;n1:Action xmlns:n1="http://www.w3.org/2005/08/addressing"&gt;rexwebservices/IWebShopServices/GetCustomerByIdPwd&lt;/n1:Action&gt; &lt;/v:Header&gt; &lt;v:Body&gt; &lt;GetCustomerByIdPwd xmlns="rexwebservices" xmlns:ns2="http://schemas.datacontract.org/2004/07/RexWebServices" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/" id="o0" c:root="1"&gt; &lt;loginMail i:type="d:string"&gt;...&lt;/loginMail&gt; &lt;pwd…
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27005367

http://stackoverflow.com/comment/42638663
has text: You change can cause warning in unchanged line. What should happened then?
comment on: http://stackoverflow.com/q/27062281
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42620876
type: Comment
score: 0
has text: @bhargavthanki If that fixed it, you didn't have this code at all: `out.writeObject("matches");`. You had `" matches"` or `"matches "` etc.
type: AnswerComment
comment on: http://stackoverflow.com/a/27050507

http://stackoverflow.com/comment/42647121
has text: Oh it's because the location of the circle you are drawing. If the size of the panel is 50, and you are starting to draw at 50, the circle will be outside the size of the panel. You can use `50, 50`, if you draw at `0, 0, 50, 50`. But you should make the size of the panel, as big as you want the entire drawing surface to be
comment on: http://stackoverflow.com/a/27065784
type: AnswerComment
score: 2
type: Comment

http://stackoverflow.com/a/27163963
answers question: http://stackoverflow.com/q/27065700
score: 1
has body: Look my code. It works fine int whichDescriptor = siftDescriptor; //freakDescriptor; // Features SEARCH int detectorType = FeatureDetector.SIFT; FeatureDetector detector = FeatureDetector.create(detectorType); Mat mask = new Mat(); MatOfKeyPoint keypoints = new MatOfKeyPoint(); detector.detect(image, keypoints , mask); if (!detector.empty()){ // Draw kewpoints Mat outputImage = new Mat(); Scalar color = new Scalar(0, 0, 255); // BGR int flags = Features2d.DRAW_RICH_KEYPOINTS; // For each keypoint, the circle around keypoint with keypoint size and orientation will be drawn. Features2d.drawKeypoints(image, keypoints, outputImage, color , flags); displayImage(Mat2BufferedImage(outputImage), "Feautures_"+detectorType); } displayImage() and Mat2BufferedImage() are referenced here link1 or link2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27065700

http://stackoverflow.com/comment/42704667
comment on: http://stackoverflow.com/a/27100145
score: 0
type: AnswerComment
type: Comment
has text: What if I don't want to call the constructor of `Abc` from `Bb` constructor?

http://stackoverflow.com/comment/42716510
comment on: http://stackoverflow.com/a/27106575
score: 0
type: AnswerComment
has text: thank you for answering. I changed that path but it didn't work!
type: Comment

http://stackoverflow.com/a/27145703
has body: You use nextInt() which only expected int values. Change it to next() and cast the value to an int if it is not q
type: Answer
answers question: http://stackoverflow.com/q/27145624
score: 0

http://stackoverflow.com/comment/42725566
comment on: http://stackoverflow.com/a/27049597
type: Comment
has text: Yeah I had actually tried that before posting that first comment to you, and unfortunately that didn't work either. It's so strange that the xpath is so sensitive to the use of single quotes. Any other ideas? I may just post this as a separate question so I can get more eyes on it.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27164850
type: Answer
answers question: http://stackoverflow.com/q/27152395
has body: There is no bug. We believed the rule where fired with a wrong order because we used a logger in a drools listener capturing the matchCreated event. A simple log in the rule showed the rule have been fired in the right order. Seb &amp; Joseph
score: 0

http://stackoverflow.com/q/27112084
has answer: http://stackoverflow.com/a/27112836
accepted answer: http://stackoverflow.com/a/27112836
answer count: 2
linked to: http://stackoverflow.com/q/55463519
has body: I am trying to use Netty (4.0.24) to create several servers (several ServerBootstraps) in one application (one main method). I saw this question/answer but it leaves many questions unanswered: Netty 4.0 multi port with difference protocol each port So here are my questions: The above answer suggests that all we need to do is create multiple ServerBootstrap objects and bind() to each. But most of the code examples I see for a single ServerBootstrap will then call something like this: try { b.bind().sync().channel().closeFuture().sync(); } finally { b.shutdown(); } So doesn't the sync() call result in the ServerBootstrap b blocking? So how can we do this for multiple ServerBootstraps? And what happens if we do not call sync()? Is the set of sync calls only for being able to gracefully shutdown the server with b.shutdown()? If so, is there any way to gracefully shutdown multiple ServerBootstraps? Also, I don't understand what happens when we just call bind() without calling sync(). Does the server somehow keep running? How do we shut it down gracefully? Obviously I'm pretty confused about how all this works, and sadly Netty documentation is really lacking in this regard. Any help would be greatly appreciated.
possible better answer: http://stackoverflow.com/a/27256798
favorite count: 0
has answer: http://stackoverflow.com/a/27256798
has title: How to use multiple ServerBootstrap objects in Netty
tagged with: netty
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/24571339
type: Question
score: 4
tagged with: nio

http://stackoverflow.com/comment/42608808
score: 0
comment on: http://stackoverflow.com/q/27045005
type: Comment
type: QuestionComment
has text: no, just a simple extension of Applet, i threw the .java code up there.

http://stackoverflow.com/a/27055331
has body: SimpleDateFormat can be used to get the desired result. For instance- Calendar cal = Calendar.getInstance(); SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); Then call sdFormat.format(cal.getTime()) So, in your case you can do something like sdFormat.format(order_employee_start.getTime())
score: 0
answers question: http://stackoverflow.com/q/27054623
type: Answer

http://stackoverflow.com/q/27124202
type: Question
has comment: http://stackoverflow.com/comment/42749060
tagged with: android
has title: how to play a tone from assets folder using Android ringtone manager?
has answer: http://stackoverflow.com/a/27124351
has comment: http://stackoverflow.com/comment/42753607
linked to: http://stackoverflow.com/q/3289038
upvote count: 3
tagged with: ringtone
tagged with: java
has comment: http://stackoverflow.com/comment/42753462
answer count: 1
has comment: http://stackoverflow.com/comment/42749954
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42753018
has body: Can i play a tone which is present in assets using Android Ring tone manger? I know i can use the tone copied in Res folder in following manner: Uri inAppsoundUri = Uri.parse("android.resource://" + mAppContext.getPackageName() + "/raw/" + tone);** ringTone = RingtoneManager.getRingtone(mAppContext, inAppsoundUri);** ringTone.play(); But when i tried replacing /raw/ with /assets/ in inAppsoundUri, it resulted in error. Actually i want to copy the tones to Sdcard also for some app specific usage for which i have to keep these tones files in assets, and also some times i have to play it through Ringtone manager for which i have to copy the same files in Res/raw folder. So there is unnecessary 2 copies of same tone files are present in the apk which results in larger apk size. So could you please suggest any way to do this both the functions(i.e. copy to sdcard and play using Android Ringtone mnager) from same place?
has comment: http://stackoverflow.com/comment/42753225
score: 3
has comment: http://stackoverflow.com/comment/42749031
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42600920
score: 0
comment on: http://stackoverflow.com/a/27040532
type: Comment
has text: animals cannot be resolved to a variable? What variable do I set it as and private or public?
type: AnswerComment

http://stackoverflow.com/q/27053790
has title: How do I pass a parameter to a Java Component from a Mule flow?
has body: I'm just getting started with mule and cant figure out how I can possibly pass a part of my request header as a parameter/argument to the Java component. My Java Component is as follows public String processHeader(String in) { //process header System.out.print(" Header" + in); } Ive been able to access processHeader in the following manner from the flow &lt;component&gt; &lt;method-entry-point-resolver&gt; &lt;include-entry-point method="processHeader" /&gt; &lt;/method-entry-point-resolver&gt; &lt;singleton-object class="my.test.mule.Processor" /&gt; &lt;/component&gt; Accessing the above using http://localhost:8080/test . Prints Header test I'm able to dump the contents of the header using the following &lt;logger level="INFO" doc:name="Logger" message="#[headers:INBOUND:*]"/&gt; But I cant seem to figure out how to pass the message as an argument to processHeader nor can I find any relevant examples. Any help would be appreciated. Btw, I'm using Mule 3.5 if that matters.
accepted answer: http://stackoverflow.com/a/27057902
tagged with: mule-component
upvote count: 3
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/42625242
tagged with: mule-el
tagged with: mule
linked to: http://stackoverflow.com/q/22841424
possible better answer: http://stackoverflow.com/a/27062682
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27062682
score: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27057902
type: Question

http://stackoverflow.com/q/27102805
type: Question
has comment: http://stackoverflow.com/comment/42709769
has comment: http://stackoverflow.com/comment/42709488
score: 0
answer count: 1
tagged with: url
linked to: http://stackoverflow.com/q/26716664
has body: I am building an android app that connects to a backend service on my laptop. It connects to a localhost address where it gets data from JSON. It works properly when I write the IP address of my laptop in my code. This IP address can change so I would like to use the host name which doesn't seem to work. private static final String URLLocalhost = "http://localhost:8081/"; // doesn't work private static final String URLPCName = "http://PCNAME:8081/"; // doesn't work private static final String URLIPAddress = "http://192.168.x.y:8081/"; // works but IP needs to be modified @Override public List&lt;Spike&gt; getSpikes() { RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(URLPCName).build(); I get multiple ECONNREFUSED errors when it doesn't work. It won't go public anytime soon so I don't have an URL for that. I have found some solutions for this but they require making changes to my device. (haven't tried them) Change DNS settings Edit the hosts file I would like any device (may be limited to the local wifi) to access this service without having to change settings in the device. How can I connect using the host name from my code? Related question, does not solve my question: How to connect my android app to the remote web server
tagged with: rest
has title: Connect to host name instead of IP address in android app
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42709700
has answer: http://stackoverflow.com/a/27103078
has comment: http://stackoverflow.com/comment/42709593
tagged with: java

http://stackoverflow.com/comment/42764866
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27133031
has text: I am not sure what you're asking. You have words scattered in a file that by themselves are not palindromes. Then you have words in between ("text") that, if you were to read the file as a stream, the output will not result in a palindrome. Somehow, you want to "eliminate" these words and turn the output into a palindrome?
score: 0

http://stackoverflow.com/a/27093384
has body: It looks like there are at least two outcomes, so covering them is important. You can slightly redesign the class to make testing easy. public abstract class YourClass { protected abstract void addInfoMessage(String message); protected abstract void addErrorMessage(String message); public void closeTransaction() { try { saveAccountInternal(); /* ! */ addInfoMessage("All Updated!"); } catch (final ResourceException e) { addErrorMessage("Sorry your account could not be updated."); } return null; } /** Package-private. Overridable for testing. */ void saveAccountInternal() throws ResourceException { account.save(); } } You're designing a class for subclassing, so test it using a subclass: public class YourClassTest { private static class TestYourClass extends YourClass { boolean saveCalled = false; boolean shouldThrow = false; List&lt;String&gt; infoMessages = new ArrayList&lt;&gt;(); List&lt;String&gt; errorMessages = new ArrayList&lt;&gt;(); protected void addInfoMessage(String message) { infoMessages.add(message); } protected void addErrorMessage(String message) { errorMessages.add(message); } @Override void saveAccountInternal() throws ResourceException { saveCalled = true; if (shouldThrow) throw new ResourceException(); } } @Test public void closeTransactionShouldSave() { TestYourClass testYourClass = new TestYourClass(); assertNull(testYourClass.closeTransaction()); assertTrue(testYourClass.saveCalled); assertEquals(1, testYourClass.infoMessages.size()); assertEquals(0, testYourClass.errorMessages.size()); } @Test public void closeTransactionShouldSave() { TestYourClass testYourClass = new TestYourClass(); testYourClass.shouldThrow = true; assertNull(testYourClass.closeTransaction()); assertTrue(testYourClass.saveCalled); assertEquals(1, testYourClass.infoMessages.size()); assertEquals(0, testYourClass.errorMessages.size()); } } Note that the solution above doesn't involve Mockito. Once you're comfortable with that test redesign, you can consider using Mockito to…
score: 0
has comment: http://stackoverflow.com/comment/42738815
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27091530
answers question: http://stackoverflow.com/q/27091530

http://stackoverflow.com/a/27128371
has comment: http://stackoverflow.com/comment/42756542
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27124961
upvote count: 3
answers question: http://stackoverflow.com/q/27124961
type: Answer
downvote count: 0
has body: @Override public RibResource toResource(Rib rib) { return createResourceWithId(rib.getId(), rib); } createResourceWithId() internally creates a self link based on the controller's URL. In your case that contains the placeholder {idInt} so you would have to provide a parameter for that: CustomUserDetails user = CurrentUserUtils.getCurrentUser(); return createResourceWithId(rib.getId(), rib, user.getIdInt()); The better choice would be not to call createResourceWithId() at all. Just move everything you now have in instantiateResource() to toResource().
score: 3

http://stackoverflow.com/q/27006870
has comment: http://stackoverflow.com/comment/42543069
has answer: http://stackoverflow.com/a/27012903
accepted answer: http://stackoverflow.com/a/27012903
tagged with: spring
type: Question
has answer: http://stackoverflow.com/a/27013592
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/36802514
possible better answer: http://stackoverflow.com/a/27013592
has comment: http://stackoverflow.com/comment/42542685
answer count: 3
upvote count: 1
favorite count: 0
type: AnsweredQuestion
has title: Spring java based configuration with scope prototype in imported configurations
downvote count: 0
has body: Is it possible to have beans of imported java based configurations be created with prototype scope? What I mean is that if I have the following example code: ApplicationContext applicationContext = new AnnotationConfigApplicationContext( SpringTopLevelConfig.class); for (int i = 0; i &lt; 2; i++) { System.out.println(applicationContext.getBean(Student.class)); } Where public class Notebook { static int idCounter = 1; private final int id; @Override public String toString() { return "Notebook{" + "id=" + id + '}'; } public Notebook() { id = idCounter++; } } public class Student { private final Notebook notebook; @Override public String toString() { return "Student{" + "notebook=" + notebook + '}'; } public Student(Notebook notebook) { this.notebook = notebook; } } And spring Config is : @Configuration public class SpringTopLevelConfig { @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Bean Notebook notebook(){ return new Notebook(); } @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Bean Student student(){ return new Student(notebook()); } } As expected each student gets its own notebook: Student{notebook=Notebook{id=1}} Student{notebook=Notebook{id=2}} However if I try to split up the configuration across multiple classes all of the examples I have found suggest using @Autowire to accomplish this: @Configuration @Import(SpringConfigSecondLevel.class) public class SpringTopLevelConfig { @Autowired Notebook notebook; @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Bean Student student(){ return new Student(notebook); } } @Configuration public class SpringConfigSecondLevel { @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Bean Notebook notebook(){ return new Notebook(); } } However now the students end up sharing one notebook which is not the behaviour I am trying to achieve. Student{notebook=Notebook{id=1}} Student{notebook=Notebook{id=1}} Is there a spring way to achieve SCOPE_PROTOTYPE behaviour with split configuration classes or will I need to create a NotebookFactory bean to save the students fro…

http://stackoverflow.com/comment/42671789
comment on: http://stackoverflow.com/a/27080931
score: 0
type: AnswerComment
type: Comment
has text: if i type javac, it s showing the options along with i can use javac.. but on typing java, cmd says the above error where the path doesnt exist at all!

http://stackoverflow.com/comment/43612932
comment on: http://stackoverflow.com/a/27091562
type: AnswerComment
has text: @user2397162: please see edit to answer. Again, get all thoughts of applets out of your head with regards to this. Serious.
score: 0
type: Comment

http://stackoverflow.com/a/27005751
has comment: http://stackoverflow.com/comment/42570219
score: 1
has comment: http://stackoverflow.com/comment/42541728
has comment: http://stackoverflow.com/comment/42557886
upvote count: 1
has comment: http://stackoverflow.com/comment/42557670
downvote count: 0
has comment: http://stackoverflow.com/comment/42557948
type: Answer
has comment: http://stackoverflow.com/comment/42541591
has body: I had the same problem and I don't find a "clean" solution. Finally, I decided to create a dummy class with same methods but declared as native. Then I use javah to create the header file and I take the signature from that header file. I know that it does not look nice... but I don't find a better option (except creating it "manually" based on the Method properties).
answers question: http://stackoverflow.com/q/27005501

http://stackoverflow.com/a/27035873
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/42593950
has comment: http://stackoverflow.com/comment/42593324
has comment: http://stackoverflow.com/comment/42594394
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42593161
accepted answer of: http://stackoverflow.com/q/27035715
downvote count: 0
has body: You can use the following code: //put your json in the string variable "data" JSONArray jsonArray=new JSONArray(data); if(jsonArray!=null &amp;&amp; jsonArray.length()&gt;0){ for (int i = 0; i &lt; jsonArray.length(); i++) { JSONArray childJsonArray=jsonArray.optJSONArray(i); if(childJsonArray!=null &amp;&amp; childJsonArray.length()&gt;0){ for (int j = 0; j &lt; childJsonArray.length(); j++) { System.out.println(childJsonArray.optString(j)); } } } }
type: Answer
has comment: http://stackoverflow.com/comment/42593729
answers question: http://stackoverflow.com/q/27035715
has comment: http://stackoverflow.com/comment/42594627

http://stackoverflow.com/q/27067327
score: 4
tagged with: proxy
has answer: http://stackoverflow.com/a/31472395
answer count: 1
favorite count: 0
upvote count: 5
type: UnansweredQuestion
tagged with: web-services
downvote count: 1
has title: CXF client proxy how to handle certain response codes within the client
tagged with: cxf
tagged with: java
type: Question
has body: When I send a request using a proxy client, if I get a certain response, I would like to be able to modify the request and then send the same request again for all requests. Normally I would do something like: BookStore proxy = JAXRSClientFactory.create("http://books", BookStore.class); try { proxy.getBook("someId"); } catch(WebApplicationException ex) { Response r = ex.getResponse(); if (r.getStatusCode() == 404) { proxy.getBook("anotherId"); } } But in this case, there is a common thing I want to do for all requests: If I get a specific http code, modify some header values, and then try again (probably with a limit on the amount of retries). I haven't seen a way that cxf proxy clients explicitly support this, how could I go about implementing it?

http://stackoverflow.com/q/27102614
tagged with: android
type: AnsweredQuestion
has body: I'm trying to implement AdMob in my Android game which has been ported using the NDK, and SDL. I've been following the example here, but when I call showAdPopup, my game's Activity seems to be destroyed, I'm left with a blank grey screen, with an ad at the bottom. The logs seem to show my activity being paused when the popup window is shown. I've commented out all of the admob code and it seems that the problem is reproducible just by trying to create a PopupWindow over my NativeActivity. I noticed there is a sample app here which has almost identical code to mine, but that sample has disappeared from the SDK in later versions (I'm targeting android-19). Does anyone know why my native activity seems to pause/shutdown when I try to launch a popupwindow? Did something change in android-19 that stops this approach from working?
tagged with: java
tagged with: android-ndk
type: Question
has answer: http://stackoverflow.com/a/27211384
accepted answer: http://stackoverflow.com/a/27211384
tagged with: native-activity
score: 0
answer count: 1
has title: Showing an Android PopupWindow over a NativeActivity

http://stackoverflow.com/comment/42729535
type: QuestionComment
comment on: http://stackoverflow.com/q/27113389
score: 0
has text: Can you post some code, what you have tried, for example?
type: Comment

java-server
tags question: http://stackoverflow.com/q/27015534
type: Tag
tag name: java-server

http://stackoverflow.com/comment/42578183
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27027539
has text: Please edit your question to explain the following: what is "create from constructor"? Do you mean "create inside constructor's code"? Or "create by calling particular constructor"? Also, what will you do with 50 objects? Do you have 50 member variables?

http://stackoverflow.com/q/27079413
has body: This will probably sound like a dumb question to many of you but I'm a new student and I am trying to learn. This is a program that takes a roman numeral input from a user and converts it to it's decimal value. I am trying to test out this program, but I don't know exactly what I have to do in my main method in order to do so. I have the other methods for the calculating but now how am I supposed to test it out? Let me show you what I have: public class RomanNumeralConverter { public String getUserInput() { Scanner numberInput = new Scanner (System.in); System.out.print("Enter a roman numeral in uppercase: "); String userInput = numberInput.next(); numberInput.close(); return userInput; } public static void romanToDecimal(String userInput) { int decimal = 0; int lastNumber = 0; userInput = userInput.toUpperCase(); for (int x = userInput.length() - 1; x &gt;= 0 ; x--) { char convertToDecimal = userInput.charAt(x); switch (convertToDecimal) { case 'M': decimal = processDecimal(1000, lastNumber, decimal); lastNumber = 1000; break; case 'D': decimal = processDecimal(500, lastNumber, decimal); lastNumber = 500; break; case 'C': decimal = processDecimal(100, lastNumber, decimal); lastNumber = 100; break; case 'L': decimal = processDecimal(50, lastNumber, decimal); lastNumber = 50; break; case 'X': decimal = processDecimal(10, lastNumber, decimal); lastNumber = 10; break; case 'V': decimal = processDecimal(5, lastNumber, decimal); lastNumber = 5; break; case 'I': decimal = processDecimal(1, lastNumber, decimal); lastNumber = 1; break; } } System.out.println(decimal); } public static int processDecimal(int decimal, int lastNumber, int lastDecimal) { if (lastNumber &gt; decimal) { return lastDecimal - decimal; } else { return lastDecimal + decimal; } } public static void main(String[] args) { romanToDecimal(getUserInput); } } You could see that I tried plugging in getUserInputin to romanToDecimal but I know that I don't have those parameters in the main method, and I don't e…
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27079493
type: Question
has answer: http://stackoverflow.com/a/27079527
possible better answer: http://stackoverflow.com/a/27079456
answer count: 6
has answer: http://stackoverflow.com/a/27079456
has answer: http://stackoverflow.com/a/27079481
downvote count: 0
has answer: http://stackoverflow.com/a/27079493
favorite count: 0
has title: How do I test out my program in the main method?
has answer: http://stackoverflow.com/a/27079519
upvote count: 1
has answer: http://stackoverflow.com/a/27079712
type: AnsweredQuestion

paypal-sandbox
tags question: http://stackoverflow.com/q/27138937
type: Tag
tag name: paypal-sandbox

http://stackoverflow.com/q/26998031
tagged with: jbutton
has comment: http://stackoverflow.com/comment/42527023
type: AnsweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/10601676
type: Question
has answer: http://stackoverflow.com/a/26999671
answer count: 1
has title: Java: how to relaunch the class extended application from JButton?
accepted answer: http://stackoverflow.com/a/26999671
tagged with: web-applications
has body: Inside of my JPanel, I have a button calling SimpleBrowser JButton swingButton = new JButton(); swingButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SimpleBrowser openBrowser = new SimpleBrowser(); openBrowser.main((new String[0])); } }); swingButton.setText("Browser"); add(swingButton, BorderLayout.SOUTH); this is my SimpleBrowser class public class SimpleBrowser extends Application { VBox vb = new VBox(); public void main(String[] args) { Application.launch(args); } @Override public void start(Stage primaryStage) { vb.setId("root"); WebView browser = new WebView(); WebEngine engine = browser.getEngine(); String url = "https://www.google.com"; engine.load(url); vb.getChildren().addAll(browser); Scene scene = new Scene(vb); primaryStage.setScene(scene); primaryStage.show(); } When I run this code, JButton opens up properly SimpleBrowser and display google. However, when I close this application and repress JButton, nothing happens. It suppose to relaunch SimpleBrowser and display google. Could you guys help me?

http://stackoverflow.com/comment/42617889
comment on: http://stackoverflow.com/q/27050210
type: Comment
type: QuestionComment
score: 2
has text: You seem to want to send JSON content. Use `@RequestBody` with the appropriate data type.

http://stackoverflow.com/comment/42651305
has text: See anything else I might look into?
comment on: http://stackoverflow.com/a/27067047
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27136216
has body: Well I don't think there is any such method available anywhere. There are some predefined color provided you can use them. e.g.: String enteredColor = "RED"; if(enteredCode.equalsIgnoreCase("red") { return Color.RED; } although above code is not best approach. What you can do (if you know predefined input string's) is you can map the names with there RGB values. Then based on input create color abject and return.
type: Answer
answers question: http://stackoverflow.com/q/27136104
score: 0

http://stackoverflow.com/q/27145517
score: 0
tagged with: android
answer count: 1
has title: does an animation always return to its starting point in java?
has body: I am trying to make an ImageView spin around and it always goes back to its original position after the animation is done. Is there a way to make it stop or to make it, say, stop upside down?
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27145531
accepted answer: http://stackoverflow.com/a/27145531

http://stackoverflow.com/q/27046621
has title: How Can I Remove Child of A node list?
score: 0
has answer: http://stackoverflow.com/a/27047562
answer count: 1
has comment: http://stackoverflow.com/comment/42612900
has comment: http://stackoverflow.com/comment/42612183
tagged with: android
accepted answer: http://stackoverflow.com/a/27047562
tagged with: http://stackoverflow.com/tag/xml
tagged with: list
tagged with: java
type: Question
type: AnsweredQuestion
has body: I'am new in java and android. I have an XML file Like this: <?xml version="1.0" encoding="UTF-8"?> aaaaaa xfhjj 1111222 list bbbbbbbbb ghjchjxff 45885367 list ccccccc hkggcckj 46964788 list I want to delete each of node but with this code i use I receive Null pointer Exception except last Node ! Node no = document.getFirstChild(); NodeList nl = no.getChildNodes(); for (int n = 0; n < nl.getLength(); n++) { Node list = document.getElementsByTagName("listdata").item(n); NodeList nodes = list.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node element = nodes.item(i); String t = element.getFirstChild().getTextContent(); if (deleteValueName.equals(t)) { \\deleteValueName for example equal aaaaaa OR bbbbbbbbb if ("name".equals(element.getNodeName())) { Node nd = element.getParentNode(); Node ndParent = nd.getParentNode(); ndParent.removeChild(nd); } } } } Please Help Me !

http://stackoverflow.com/a/27071894
type: Answer
has body: ScheduledExecutorService are not aimed to run concurrent instance of the job, actually the next thread is not started before current one is finished. the method you use is just a convenient way to avoid rescheduling of the next job at the end of the current one. You could use scheduler to schedule the next job as the first command of your run. like : private static class ExampleThread implements Runnable { @Override public void run() { scheduler.schedule(new ExampleThread(), 0L, 1L); System.out.println("1:"+System.currentTimeMillis()); // ... } } Then you only start the first thread (either with new Thread or using an ExecutorService). be sure to increase corePoolSize parameter in the factory of the ScheduledExecutorService to able other thread in the pool. Another approach that I prefere, is to create a wrapper that only launch your job. then you schedule your wrapper : private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); private ExecutorService pool = Executors.newCachedThreadPool(); public void beepForAnHour() { scheduler.scheduleWithFixedDelay(new ExampleWrapperThread(), 1L, 1L, TimeUnit.SECONDS); } private class ExampleWrapperThread implements Runnable { @Override public void run() { pool.execute(new ExampleThread()); } } private int _examplethread_id = 0; private class ExampleThread implements Runnable { @Override public void run() { int sid = _examplethread_id++; System.out.println(sid + ":" + System.currentTimeMillis()); try { Thread.sleep(5000L); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(sid + ":" + System.currentTimeMillis()); } }
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27069179

http://stackoverflow.com/comment/42755820
type: AnswerComment
comment on: http://stackoverflow.com/a/27128021
type: Comment
has text: Ok i'll try that in a few minutes, but can the output be different than the one i got using ubuntu package manager?
score: 0

http://stackoverflow.com/comment/122081055
score: 0
has text: how did you solve your problem?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27080961

http://stackoverflow.com/q/27078857
tagged with: cookies
score: 1
tagged with: java
tagged with: https
type: Question
tagged with: firebug
downvote count: 0
answer count: 1
has title: How to retrieve Google Analytic cookies in Java/ using Firebug?
favorite count: 0
has body: I've been trying to capture https traffic in firefox using firebug during an website login and my browser sends some Google Analytic Cookies (such as __utma, __utmb) without receiving any of them first. My goal is to implement some of the headers in java so I need also the cookies. I can see most of them but none of those GA cookies. So my question is: how can I fetch those cookies ?
has answer: http://stackoverflow.com/a/27084309
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/42651705
type: Comment
type: QuestionComment
has text: Using hibernate with Spring.
score: 0
comment on: http://stackoverflow.com/q/27066098

http://stackoverflow.com/a/26998205
accepted answer of: http://stackoverflow.com/q/26997791
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26997791
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/42527601
has comment: http://stackoverflow.com/comment/42527247
has body: It says property name, not field name. Property name in this case is inferred from the setter method name as defined by the JavaBeans naming convention (setB -> b), thus property name and bean name are the same.
score: 2

http://stackoverflow.com/comment/42665278
type: Comment
comment on: http://stackoverflow.com/a/27075170
has text: @AbdullahJahangirAbbasi - No it isn't. There is not OOAD that says that classes need to be complicated, used for lots of things, etc.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27020664
tagged with: java
has answer: http://stackoverflow.com/a/27020850
type: Question
answer count: 1
has body: I've been struggling trying to understand this area in java, so I figured perhaps someone online could help with it. Basically, I need to "prime" 9,000 blank records (for a bank) and then choose to enter data in specific areas (i.e. account number, name, balance). I know I have to use for loops but I don't know where they should go. Currently, I can create 9,000 records, but after entering data for one record it just duplicates 9,0000 times, instead of putting the record in one specific spot and leaving the rest blank. import java.nio.file.*; import java.io.*; import static java.nio.file.StandardOpenOption.*; import java.util.Scanner; public class WriteEmployeeFile { public static void main(String[] args) { Scanner input = new Scanner(System.in); File myFile = new File ("C:\\Users\\USSI\\Desktop\\CustomerRecords.txt"); Path file = Paths.get("C:\\Users\\USSI\\Desktop\\CustomerRecords.txt"); String s = "000, ,00.00" + System.getProperty("line.separator"); String delimiter = ","; int account; String name; double balance; final int QUIT = 999; final int MAX = 9001; try { OutputStream output = new BufferedOutputStream(Files.newOutputStream(file, CREATE)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output)); System.out.print("Enter client account number: "); account = input.nextInt(); while(account != QUIT) { System.out.print("Enter last name for client #" + account + ": "); input.nextLine(); name = input.nextLine(); System.out.print("Enter account balance: "); balance = input.nextDouble(); s = account + delimiter + name + delimiter + balance; for(int count = 0; count &lt; MAX; ++count) writer.write(s, 0, s.length()); writer.newLine(); System.out.print("Enter next ID number or " + QUIT + " to quit: "); account = input.nextInt(); } writer.close(); } catch(Exception e) { System.out.println("Message: " + e); } } } EDIT: These are my assignment instructions (if someone was curious or if I didn't explain it clearly. The Winter Park Bank maintains custome…
score: 0
tagged with: records
has title: How to prime multiple blank records and then add data to them
type: UnansweredQuestion

http://stackoverflow.com/a/27010356
downvote count: 0
answers question: http://stackoverflow.com/q/27010105
upvote count: 2
type: Answer
has body: This is how you do it in Android, no main function. OnCreate is kind of main function here, now all you need to do is to make this functionFile() work. public class Sample extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); functionFile(); } public void functionFile() { Workbook workbook = new HSSFWorkbook(); try { File file = new File(""); FileOutputStream output = new FileOutputStream("Test.xls"); workbook.write(output); output.close(); } catch (Exception e) { e.printStackTrace(); } } } You seem to be new to Android, read more How to make activities.
score: 2

http://stackoverflow.com/a/27564497
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27011341
has body: After few days of extensive hands on I found the solution. The answer is to make use of NAMED MODELS in Dataset. The mistake committed in the above code snippet is that model/ontModel used is generated from the DefaultModel i.e. Model model = dataset.getDefaultModel(); Insted one should make use of : Model namedmodel = dataset.addNamedModel("NameOfModel"); where NameOfModel can be any string convenient for the developer. After which load the OWL files in the respective namedModel. Thus the above function can be re-written as follows: public static void loadModel(){ dataset.begin(ReadWrite.WRITE); try{ Model namedModel1 = dataset.addNamedModel("NamedModel1"); OntModel ontModel1 = ModelFactory.createOntologyModel(); FileManager.get().readModel( ontModel1, "SourceOwl1.owl"); // Load second Model Model namedModel1 = dataset.addNamedModel("NamedModel2"); OntModel ontModel1 = ModelFactory.createOntologyModel(); FileManager.get().readModel( ontModel, "SourceOwl2.owl"); // Similarly you can load many other models within same dataset. dataset.commit(); } catch (Exception e){ System.out.println("Error in Loading model from source!!"); e.printStackTrace(); } finally { dataset.end(); } } To answer the problems stated in the question: Once dataset creation is complete we can access the different ontologies / OntModel specific to our requirement by using dataset.getNamedModel("NamedModel1") and hence treat it as a ontModel independent of others. Since the ontModel used in the question was generated via dataset.getDefaultModel() hence on ontModel.lisRootHierarchyClasses() used to result in root classes from all the source owls. But now one can access the desiered model using the named model concept and ontModel.lisRootHierarchyClasses() will answer the root classes specific to that ontology only. For more information on Named models you can refer here It helped me clear my concepts.. hope it helps you too..
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27011341
type: Answer

http://stackoverflow.com/comment/46060983
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28859568
has text: Confirmed! The problem was the lazy fetch JPA wrapper objects. When fetch was turned to eager, the sort began to work. The sort had always worked up until Java 8u20, so now it seems that JPA lazy fetch mechanism is not compatible with the new Java 8 sort optimizations.

http://stackoverflow.com/q/27108141
has comment: http://stackoverflow.com/comment/42721766
accepted answer: http://stackoverflow.com/a/27108213
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42720700
has comment: http://stackoverflow.com/comment/42719346
has body: Im calling a stored function like the following: PreparedStatement deleteAll=connection.prepareStatement("{ call delete_all_data() }"); deleteAll.execute(); And in the logs i see: 15:16:31,950 WARN SqlExceptionHelper:143 - SQL Error: 0, SQLState: 42601 15:16:31,950 ERROR SqlExceptionHelper:144 - ERROR: syntax error at or near "{" Position: 1 what is wrong with the prepareStatement??
tagged with: postgresql
type: Question
tagged with: jdbc
has title: Calling a Postgres stored function SQL error
has answer: http://stackoverflow.com/a/27108240
has answer: http://stackoverflow.com/a/27108213
score: 0
answer count: 2
tagged with: jdb
possible better answer: http://stackoverflow.com/a/27108240
tagged with: java

http://stackoverflow.com/comment/42547525
has text: @Prabu syso isAdmin and also syso ed just before you check if.And check do you have some blank char or case senstivie? or something.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27009945

http://stackoverflow.com/comment/42561339
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27018091
has text: I want to do it in Java.

http://stackoverflow.com/a/27078090
has body: public class Something { public String blah; public int hashCode() { return blah.hashCode(); } } Obviously you wouldn't quite code things like this (you'd have a getter and a setter, and the hashCode would be a little more complicated, and you'd have an equals() too) but this meets the requirements of your question. If you change the blah field, then the hash code will change.
downvote count: 0
has comment: http://stackoverflow.com/comment/42667068
score: 1
has comment: http://stackoverflow.com/comment/42666912
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42666716
accepted answer of: http://stackoverflow.com/q/27078047
answers question: http://stackoverflow.com/q/27078047
type: Answer
has comment: http://stackoverflow.com/comment/42666643

http://stackoverflow.com/q/26994586
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/6899019
downvote count: 0
has title: Simpledateformat didn't check date validation?
has body: I have a REST api which involving date conversions. For that it has inputs like a dateString and its format .But my problem is I can't validate the date for some negative scenarios. For example new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("29-09-2014 20:35:27"); I expect the above code will throw exception, but it doesn't. So my validation fails. Can anyone suggest a solution
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26994636
tagged with: date-format
upvote count: 1
duplicate of: http://stackoverflow.com/q/6899019
has answer: http://stackoverflow.com/a/26994636
type: AnsweredQuestion

http://stackoverflow.com/comment/42651123
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27069001
has text: I'm sorry for the silly post... thank you for the fast response
score: 0

http://stackoverflow.com/q/27119494
tagged with: java
accepted answer: http://stackoverflow.com/a/27119579
type: Question
has title: Transfer hashmaps across fragments Android
score: 0
has comment: http://stackoverflow.com/comment/42740811
answer count: 1
tagged with: android
has body: Say I have: private Map&lt;Integer,String&gt; prices = new HashMap&lt;Integer,String&gt;(); private Map&lt;Integer,String&gt; titles = new HashMap&lt;Integer,String&gt;(); private Map&lt;Integer,String&gt; descriptions = new HashMap&lt;Integer,String&gt;(); private Map&lt;Integer,String[]&gt; pictures = new HashMap&lt;Integer,String[]&gt;(); I want to transfer these to another fragment via bundle: Bundle bundle = new Bundle(); bundle.put //best way? fragment.setArguments(bundle); if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.frame_container, fragment).commit(); } What would be the most efficient/simplest way to do this?
has answer: http://stackoverflow.com/a/27119579
type: AnsweredQuestion

http://stackoverflow.com/a/27149497
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27149389
upvote count: 1
has body: You have do add the xalan.jar to your classpath.

http://stackoverflow.com/q/26996292
has title: hibernate table per month
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42523919
has body: I've a conception problem with Hibernate for my application. Actually, my project needs to communicate with PLCs and record a lot of variables. In some cases, the application should be able to record 100 000 values per day (or more). So, to reduce tables size, how can I record a value in one table per month with Hibernate ? (Ex. : table name '201401_records', '201402_records', '201403_records', ...) Class example : public class Record { private long id; private GregorianCalendar eventDate; private String value; private Variable variable; ... } Thanks for your help.
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42526013
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26997357
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/27024668
upvote count: 4
has comment: http://stackoverflow.com/comment/42577262
accepted answer of: http://stackoverflow.com/q/27024540
downvote count: 0
has comment: http://stackoverflow.com/comment/42577991
has comment: http://stackoverflow.com/comment/42576921
score: 4
type: AcceptedAnswer
has body: This problem can be solved with recursion. One possible implementation would look like: public static void buildNameChoicesHelper(String[] nameArray, int nameIndex, String str) { if(nameIndex &gt;= nameArray.length) { if(str.length() &gt; 0) { System.out.println(str.substring(0, str.length() - 1)); } } else { buildNameChoicesHelper(nameArray, nameIndex + 1, str); buildNameChoicesHelper(nameArray, nameIndex + 1, str + nameArray[nameIndex] + "."); } } public static void buildNameChoices(String nameStr) { String[] nameArray = nameStr.split("\\.", -1); buildNameChoicesHelper(nameArray, 0, ""); } If every name must be a (first name, last name) combination, then you could try this modification: public static void buildNameChoicesHelper(String[] nameArray, int nameIndex, String firstName, String lastName) { if(nameIndex &gt;= nameArray.length) { if(lastName.length() &gt; 0) { System.out.println(firstName + lastName); } } else { buildNameChoicesHelper(nameArray, nameIndex + 1, firstName, lastName); buildNameChoicesHelper(nameArray, nameIndex + 1, firstName, lastName + "." + nameArray[nameIndex]); } } public static void buildNameChoices(String nameStr) { String[] nameArray = nameStr.split("\\.", -1); for(int i = 0; i &lt; nameArray.length; i++) { buildNameChoicesHelper(nameArray, i + 1, nameArray[i], ""); } }
answers question: http://stackoverflow.com/q/27024540
has comment: http://stackoverflow.com/comment/42576515
type: Answer

http://stackoverflow.com/q/27016202
tagged with: soap
has comment: http://stackoverflow.com/comment/42591671
type: AnsweredQuestion
upvote count: 2
has body: I want to know is it possible to send a request from one wsdl to another wsdl. If yes, then how do I do that? The flow will be : I want to expose a wsdl using switchyard say wsdl-1 which might have 100 parameters, with create, get, delete and set request. I want a XSLT which will take the request from wsdl-1 and I will pick only few parameters and will ignore the other remaining parameter. Now with the picked parameters in XSLT, I want to send another request to my other wsdl say wsdl-2 which will perform its task. I am not sure how do I do this and need some guidance . Please let me if the question is not clear from my end. EDIT : Adding the exact flow architecture which I am looking for. I want to know how would I communication with WSDL Country 1 and my SIM WSDL. I want to know whether is it possible or not (communication between two wsdls). Please let know if you need more explanation.
tagged with: web-services
downvote count: 1
has title: Sending a request from one WSDL to another WSDL
tagged with: xslt
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27050669
answer count: 1
tagged with: wsdl
favorite count: 0
has comment: http://stackoverflow.com/comment/42577414
accepted answer: http://stackoverflow.com/a/27050669

http://stackoverflow.com/q/27006156
upvote count: 5
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/16946778
favorite count: 0
tagged with: scala
has body: In searching for how to create a Kafka topic through the API, I found this example in Scala: import kafka.admin.AdminUtils import kafka.utils.ZKStringSerializer import org.I0Itec.zkclient.ZkClient // Create a ZooKeeper client val sessionTimeoutMs = 10000 val connectionTimeoutMs = 10000 val zkClient = new ZkClient("zookeeper1:2181", sessionTimeoutMs, connectionTimeoutMs, ZKStringSerializer) // Create a topic with 8 partitions and a replication factor of 3 val topicName = "myTopic" val numPartitions = 8 val replicationFactor = 3 val topicConfig = new Properties AdminUtils.createTopic(zkClient, topicName, numPartitions, replicationFactor, topicConfig) Source: https://stackoverflow.com/a/23360100/871012 The last arg ZKStringSerializer is apparently a Scala object. It is not clear to me how to make this example work in Java. This post How to create a scala object in clojure asks the same question in Clojure and the answer was: ZKStringSerializer$/MODULE$ which in Java would (I think) translate to: ZKStringSerializer$.MODULE$ But when I try that (or any number of other variations) none of them compile. The compilation error is: KafkaTopicCreator.java:[16,18] cannot find symbol symbol: variable ZKStringSerializer$ location: class org.sample.KafkaTopicCreator I am using kafka_2.9.2-0.8.1.1 and Java 8.
has title: How create Kafka ZKStringSerializer in Java?
tagged with: apache-kafka
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27038395
accepted answer: http://stackoverflow.com/a/27038395
type: Question
score: 5

http://stackoverflow.com/a/27118079
type: Answer
answers question: http://stackoverflow.com/q/27118008
has comment: http://stackoverflow.com/comment/42738293
has body: Move reading cadena into the try block int z = 0; do { try { cadena = LeerTeclado.nextLine(); // &lt;-- re-read if ("salir".equalsIgnoreCase(cadena)) { // &lt;-- you might test once. System.exit(0); } // if ("Salir".equals(cadena)) { // System.exit(0); // } z = Integer.valueOf(cadena); // &lt;-- or this loops forever.
score: 0

http://stackoverflow.com/q/27090843
upvote count: 7
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/312168
has title: Modifying private instance variables in Java
duplicate of: http://stackoverflow.com/q/312168
has comment: http://stackoverflow.com/comment/42688392
answer count: 3
has answer: http://stackoverflow.com/a/27090884
favorite count: 0
has body: So, I came across an example in a Java book I found: public class Account { private String name; private double balance; private int acctNumber; public Account(){} public boolean equals(Account anotherAcc) { return (this.name.equals(anotherAcc.name) &amp;&amp; (this.balance == anotherAcc.balance) &amp;&amp; (this.acctNumber == anotherAcc.acctNumber)); } } We see that the equals method is overloaded and is passed with another Account object to check if all instance variables are equal. My problem with this piece of code is that it seems as thought we're directly accessing private variables in the anotherAcc object, which doesn't seem right, but it works. The same thing happens when I make a main method in the same class where I somehow gain access to the private variables. Conversely, when I create a main method in another class, it's only then I get a visibility error. My question is, why does Java allow private instance variable to be accessed in a object that is passed in a method? Is it because the object is of type Account and the method being passed to is part of a class called Account?
score: 6
possible better answer: http://stackoverflow.com/a/27090867
has comment: http://stackoverflow.com/comment/42688733
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27090867
has answer: http://stackoverflow.com/a/27090864
has comment: http://stackoverflow.com/comment/42688554
accepted answer: http://stackoverflow.com/a/27090884
tagged with: java

http://stackoverflow.com/q/27012870
score: 4
upvote count: 4
tagged with: websphere
tagged with: embeddable
tagged with: junit
answer count: 1
downvote count: 0
favorite count: 0
has title: Hibernate in emeddable websphere container does not find java:comp/websphere/ExtendedJTATransaction
type: UnansweredQuestion
has body: I have a Java EE application which uses Hibernate 4.2.7 as persistence provider executing Junit tests in an embeddable Websphere 8.0.0 container. Database access works fine in a real (i.e. non-embedded) Websphere 8.0.0 instance. The unit tests do work when run with OpenJPA instead of Hibernate. However, running the Junit tests with Hibernate, I get the following exception: CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "getEntity" on bean "BeanId(embeddable#classes#SomeBean, null)". Exception data: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [java:comp/websphere/ExtendedJTATransaction] at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68) at org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter$TransactionAdapter.(WebSphereExtendedJtaPlatform.java:156) at org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter$TransactionAdapter.(WebSphereExtendedJtaPlatform.java:152) at org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter.getTransaction(WebSphereExtendedJtaPlatform.java:124) at org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter.getStatus(WebSphereExtendedJtaPlatform.java:119) at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:73) at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:115) at org.hibernate.service.jta.platform.internal.TransactionManagerBasedSynchronizationStrategy.canRegisterSynchronization(TransactionManagerBasedSynchronizationStrategy.java:56) ... stripped ... It seems the implementation of WebsphereExtendedJtaPlatform is trying to get the current transaction via a JNDI lookup but fails because that JNDI name does not exist in the embedded container. Here's a snipped from org.hibernate.s…
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/30306542

http://stackoverflow.com/a/27125190
has body: Send the bytes to the server, when you retrieve them or keep them in a list (in case you need them more than 1 time) // as mentioned in the comments, user wants specifically 4 arrays byte[][] byteArrays = byte[4][]; // Set&lt;String&gt; finalPathNames = sharedpre.getStringSet("prePathNames", null); InputStream is = null; int index = 0; for (String temp : finalPathNames) { byteArrays[index] = new byte[0]; // in case of exception clear array. possibly set to null try { is = new FileInputStream(temp); try { byte[] byteArray = streamToBytes(is); byteArrays[index] = byteArray; } finally { is.close(); } } catch (Exception e) { } finally { index++; } } Then the resulting streams are available as: byteArrays[0], byteArrays[1], byteArrays[2], byteArrays[3],
has comment: http://stackoverflow.com/comment/42751691
has comment: http://stackoverflow.com/comment/42750404
has comment: http://stackoverflow.com/comment/42750395
score: 1
has comment: http://stackoverflow.com/comment/42752995
has comment: http://stackoverflow.com/comment/42754824
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42754995
has comment: http://stackoverflow.com/comment/42754180
upvote count: 1
answers question: http://stackoverflow.com/q/27124937
type: Answer
accepted answer of: http://stackoverflow.com/q/27124937
has comment: http://stackoverflow.com/comment/42756831

http://stackoverflow.com/q/27096232
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
has body: I am attempting to insert a new row into a MySQL database. However I am receiving java.sql.SQLException: Column count doesn't match value count at row 1 each time I run the following piece of code. JButton btnSubmit = new JButton("Submit"); btnSubmit.addActionListener(new ActionListener() { Connection connection = dbConnector.dbConnector(); public void actionPerformed(ActionEvent arg0) { try{ String query = "insert into ChampionData(`Champion`,`User`,`TimeStamp`,`Opponet`,`Lane`,`Role`,`Kills`,`Deaths`,`Assists`,`CS`,`Gold`,`W/L`,`TotalGameTime`) values(?,?,?,?,?,?,?,?,?,?,?,?)"; PreparedStatement pstInsert = connection.prepareStatement(query); pstInsert.setString(1, textField.getText()); pstInsert.setString(2, textField_1.getText()); pstInsert.setString(3, textField_2.getText()); pstInsert.setString(4, textField_3.getText()); pstInsert.setString(5, textField_4.getText()); pstInsert.setString(6, textField_5.getText()); pstInsert.setString(7, textField_6.getText()); pstInsert.setString(8, textField_7.getText()); pstInsert.setString(9, textField_8.getText()); pstInsert.setString(10, textField_9.getText()); pstInsert.setString(11, textField_10.getText()); pstInsert.setString(12, textField_11.getText()); pstInsert.execute(); }catch(Exception e){ e.printStackTrace(); } } }); Error received each time the code is executed. java.sql.SQLException: Column count doesn't match value count at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723) at com.mysql.jdbc.Connection.execSQL(Connection.java:3283) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:882) at me.sage.hopkins.gui.and.mysql.Admin$2.actionPerformed(Admin.java:228) at javax.swing.AbstractButton.fireActionPerformed(Unknown Sour…
type: Question
has comment: http://stackoverflow.com/comment/42697952
upvote count: 1
has answer: http://stackoverflow.com/a/27096287
accepted answer: http://stackoverflow.com/a/27096287
answer count: 1
has title: MySQL error: Column count doesn't match value count at row 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42697961
type: AnsweredQuestion

http://stackoverflow.com/a/27118197
answers question: http://stackoverflow.com/q/27118183
has body: Try with for(String name:names){ System.out.println(name); }
score: 0
type: Answer

http://stackoverflow.com/q/27067498
type: Question
has answer: http://stackoverflow.com/a/27067512
has answer: http://stackoverflow.com/a/27067699
tagged with: java
has answer: http://stackoverflow.com/a/27067503
possible better answer: http://stackoverflow.com/a/27067512
has answer: http://stackoverflow.com/a/27067543
has body: I'm trying to write a program that splits up a String into an ArrayList, but I keep getting java.lang.StringIndexOutOfBoundsException: String index out of range: &lt;length of string&gt;. Anyone got any ideas? (I have the ArrayList and List classes already imported) public static void main(String[] args) { String test = "Hello, World!"; int testLength = test.length(); List&lt;Character&gt; testChars = new ArrayList&lt;Character&gt;(); for(int i = 1; i &lt;= testLength; i++){ testChars.add(test.charAt(i) } System.out.println(testChars); }
has title: StringIndexOutOfBoundsException on List<Character>
tagged with: string
score: 0
tagged with: exception
accepted answer: http://stackoverflow.com/a/27067503
answer count: 4
tagged with: character
type: AnsweredQuestion
tagged with: list

http://stackoverflow.com/a/27134682
answers question: http://stackoverflow.com/q/27009793
downvote count: 0
type: Answer
has body: FloatinActionsMenu is ViewGroup it can accept any view. Create layout like: &lt;FloatingActionsMenu android:layout_height="wrap_content" android:layout_width="wrap_content" &gt; &lt;RelativeView android:layout_height="wrap_content" android:layout_width="wrap_content"&gt; &lt;TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/floating_description_1"/&gt; &lt;FloatingActionButton android:layout_height="wrap_content" android:layout_width="wrap_content" //.... &lt;/RelativeLayout&gt; &lt;RelativeView android:layout_height="wrap_content" android:layout_width="wrap_content"&gt; &lt;TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/floating_description_2"/&gt; &lt;FloatingActionButton android:layout_height="wrap_content" android:layout_width="wrap_content" //.... &lt;/RelativeLayout&gt; &lt;/FloatingActionsMenu&gt; Style TextView as your heart desires, backgrounds, text color etc. Please note that first FloatingActionButton will be displaced to the size of child view that has largest width. You should move it to largest child width - first floating button width. If you want to add TextView also to that FloatingAction, get it by id R.id.fab_expand_menu, or .getChildAt(0), wrap it programatically as you would do it in xml and set it using addView(0, wrapped) I'm planning to fork, if by any chance I have time to fix it. I'll post a link to the fork.
score: 2
upvote count: 2

http://stackoverflow.com/comment/42587478
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27033028
has text: Nope. Use the iterator loop and remove using iterator's `remove()` method.
type: Comment

http://stackoverflow.com/a/40150342
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27104197
has body: I guess you should use OutputStreamWriter to deserialize your response. OutputStreamWriter wr = new OutputStreamWriter(con.getOutputStream()); wr.write(auth.toString()); wr.flush();

http://stackoverflow.com/comment/42643767
type: Comment
comment on: http://stackoverflow.com/q/27065023
type: QuestionComment
score: 3
has text: Well yeah, you're telling it to. If you need to get all the strings for all the columns for all the rows that's pretty much your option. You could try caching the column count, but I suspect that won't help much--you're still iterating 9M times. What do you actually *need* to do?

http://stackoverflow.com/q/27064441
has title: How to parse a ISO 8601 String to Java Date on Android
has body: I'm creating an app on Android which communicates with a server. That server gives me back a ISO 8601 date String, like the following: 2014-11-21 12:24:56.662061-02 Then I'm trying to use Java's SimpleDateFormatter to parse my String, like this: Locale l = new Locale("pt","BR"); Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSSZZ",l).parse(str_date); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(date.getTime()); Thing is, this solution works partially. I'm able to get the year, month, day and hour correctly, but when it comes down to hours, minutes and seconds I always get the minutes wrong. If I try to print it using my example String, I get something like "12:35" instead of "12:24". I've tried different masks, using a Locale, not using a Locale, and nothing seems to work for me. I've seen on this link that The SimpleDateFormatter doesn't support ISO 8601 very well, and that guy gave a solution using javax.xml.bind.DatatypeConverter.parseDateTime() method, but the DatatypeConverter is not present on the Android SDK. So... What can I do to parse this String correctly?
tagged with: date
has comment: http://stackoverflow.com/comment/42656120
type: Question
has comment: http://stackoverflow.com/comment/42643103
has answer: http://stackoverflow.com/a/27065749
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/16336643
duplicate of: http://stackoverflow.com/q/16336643
tagged with: android
accepted answer: http://stackoverflow.com/a/27065749
favorite count: 0
linked to: http://stackoverflow.com/q/2201925
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/27066966
tagged with: javascript
tagged with: db2
answer count: 1
tagged with: extjs
has answer: http://stackoverflow.com/a/27068711
has comment: http://stackoverflow.com/comment/42655172
type: AnsweredQuestion
tagged with: extjs4.2
has body: I have an EXTJS application that connects to a Java server. The Java server calls a JDBC DAO that reads/writes to DB2 SQL Tables. The front end is basically a simple grid. Editing the grid makes an AJAX call to the server through a given URL, the URL is then handled by the Java which calls the JDBC DAO, updating the table, and the front end grid is refreshed after the change has taken place. This is all pretty straightforward implementation. However, now I need to be able to set up a listener on the EXTJS side which will refresh the grid's store when an external program changes the DB2 Database. Essentially, whenever the SQL table updates, the front end should know and just do a store.load() to refresh the data. However, I can't seem to find any information on how this possible. It can be in the simplest possible way, even just sending a single (a 1 or 0 or a true or a false or something) that indicates to the front end that it needs to refresh. Is this doable without a tremendous amount of overhead? I assume I'll have to set up a Java database listener or something as well, so that the Java knows when the DB2 gets updated, then it can somehow alert the front end. Can someone just give me a general heading? As you can probably tell I'm not exactly fluent in this stuff, I'm relatively new to it all. Edit: The Java server side stuff is hosted on a Tomcat server.
has title: EXTJS - Can a Java Server make a call to the Browser Front end?
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27068711

http://stackoverflow.com/q/27129922
has body: I am testing spring rest services, particularly POST method. Here is the code snippet of my controller: @RequestMapping(value = "/testrequest", method = RequestMethod.POST, headers = "Accept=application/json") public @ResponseBody String createEmployee(@RequestBody Employee e){ String value = "id " + e.getId() + "firstName " + e.getFirstName() + "lastname " + e.getLastName(); System.out.println(value); return value; } Employee class: public class Employee { private int id; private String firstName; private String lastName; public Employee(int id,String firstName,String lastName){ this.id = id; this.firstName = firstName; this.lastName = lastName; } public Employee() { // TODO Auto-generated constructor stub } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } I have included dependency of jackson library in pom.xml as well pom.xml org.codehaus.jackson jackson-mapper-asl 1.9.13 I am testing the services using firefox poster plugin. When I submit my request, I am getting Status: 415 Unsupported media type. This is the error message I am getting: The server refused this request because the request entity is in a format not supported by the requested resource for the requested method. Please suggest what I am doing wrong?
type: UnansweredQuestion
tagged with: maven
has title: Data format to test Spring Rest Services
tagged with: spring
has answer: http://stackoverflow.com/a/27130418
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27132678
tagged with: rest

http://stackoverflow.com/q/27074299
type: Question
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/27074321
downvote count: 1
favorite count: 0
tagged with: processbuilder
type: UnansweredQuestion
upvote count: 0
has title: current directory in string command to run a file
tagged with: java
has body: i have already asked a similar question but i have changed up my code a little bit. i am in the making of an application that opens other applications from a usb, like a hirens boot cd menu toolbox. my problem now is that every time i plug my usb into another computer with java file and tools the directory changes. for example if my script is... String command = "E:/IPRESET.bat" than when i connect the usb to another pc than it might change from E to J, or whatever. i wanted to know if there is a way to replace E,J,K or whatever with a code to set the current java file directory so it changes for every computer. Thank you!
score: -1
tagged with: eclipse

http://stackoverflow.com/q/27109423
score: 0
accepted answer: http://stackoverflow.com/a/27168826
has body: Given this selectOneMenu &lt;h:selectOneMenu value="#{fb.aktionTxt}"&gt; &lt;f:selectItems value="#{myBean.FBAEnum}" /&gt; &lt;/h:selectOneMenu&gt; this bean code public FehlerBewertungAktionEnum[] getFBAEnum() { return FehlerBewertungAktionEnum.values(); } this enum public enum FehlerBewertungAktionEnum { NEKO_NEKO("NEK0-NEK0 "), CURSOR_PARAMETER("CURSOR-PARAMETER "), CURSOR_LEER("CURSOR-LEER "); private final String str; FehlerBewertungAktionEnum(String str) { this.str = str;} public String toString(){ return str; } } and a database value of aktionTxt |CURSOR_LEER | (20 chars) why does it display NEK0-NEK0 (first element of the enum) instead of CURSOR_LEER in my selectOneMenu, when the getter returns |CURSOR_LEER |? I debugged the jsf page and found that no &lt;option&gt; has the selected attribute. The strange thing also is that I can create a new element with the same jsf code and it will properly save my new object to the DB. I am pretty sure there is no way to use trim() here since then I cannot save my fb object.
has title: selectOneMenu does not show the proper value but getter gets it
type: AnsweredQuestion
tagged with: enums
tagged with: jsf
tagged with: java
has answer: http://stackoverflow.com/a/27168826
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27109862
possible better answer: http://stackoverflow.com/a/27109862

http://stackoverflow.com/comment/42616444
type: Comment
has text: Unfortunately still the same...
comment on: http://stackoverflow.com/q/27046031
score: 0
type: QuestionComment

http://stackoverflow.com/a/27078849
answers question: http://stackoverflow.com/q/27073923
has body: Your Java class is weird: the getter and setter for impressions do not use the same data type. There's no way you can munge it all together in one Scala var, which has only one type. You can translate your Java class into the equivalent Scala code like this: class ReportTest { var _impressions: Int = _ def impressions: Int = _impressions def impressions_=(v: String): Unit = _impressions = Integer.parseInt(v.replace(",", "")) } but it's still very weird because of the different types for the getter and setter. It seems to me that it should be the caller's responsibility to convert the string into an Int. Then, your class can be written trivially as: class ReportTest { var impressions: Int = _ }
score: 0
type: Answer

http://stackoverflow.com/comment/116965283
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/66156213
has text: very interesting stuff! +1 still I think those are optimizations which should be done by the JVM. I, as a developer, should only worry about the operations I want to perform on the type, semantic value it gives, and the range of values it provides.
score: 0

http://stackoverflow.com/comment/86473250
type: AnswerComment
has text: @paul I have just modified OP's method where the return type was boolean already. You can change the return type as per your need as well, say "String" or might as well keep it as void. In the above case, it will be helpful to assert that whether the alert is present or not; here browser alert is taken into consideration. For instance, if it's a explicitly generated alert/modal by DEV in the browser, the above method will return false, inferring that the alert isn't present, and you can modify accordingly. You can further optimize the method by printing stacktrace to track the exact issue.
type: Comment
comment on: http://stackoverflow.com/a/27075857
score: 0

http://stackoverflow.com/comment/42659680
type: QuestionComment
comment on: http://stackoverflow.com/q/27073868
type: Comment
has text: fibonacci is world worse problem so some cases even super computers take 100 years to get the answers
score: 0

http://stackoverflow.com/a/27191885
answers question: http://stackoverflow.com/q/27135749
accepted answer of: http://stackoverflow.com/q/27135749
type: AcceptedAnswer
has body: There is a Jira bug report for this issue RT-34970. My colleague solved this issue by periodically removing all the columns and adding them back. That caused the TableView to tidy up the visibleLeafColumn object and the heap stayed sensible. Thanks Jewelsea and Tomas for your suggestions. We did try Java 8 which didn't have this memory problem but the performance seemed to degrade over time (12hrs ish). This appeared to be related to animations so we'll investigate that properly when we make the jump to Java 8 in the future (cache hint didn't help).
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/27127467
favorite count: 0
has answer: http://stackoverflow.com/a/78870000
has body: I am trying to change my java version because of compiler errors when running mvn install via the windows command prompt. I changed the JAVA_HOME variable and made sure that it is referenced in the PATH variable (##EDIT##: had been done like this %JAVA_HOME%\bin;%PATH%;). When I open the command prompt in the folder where my pom.exe is located (using the Windows 7 'Open command window here' shortcut) and type java -version the unchanged java version is displayed. I made sure to close all instances of command prompts before starting a new one. Strangely I discovered that when starting the command prompt via the Run dialog in the start menu (by typing cmd) the result of java -version is the desired version.
score: 5
tagged with: windows
upvote count: 6
has answer: http://stackoverflow.com/a/50835558
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/75501100
tagged with: java
has answer: http://stackoverflow.com/a/27127468
has answer: http://stackoverflow.com/a/79493956
possible better answer: http://stackoverflow.com/a/75501100
downvote count: 1
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/27127535
has title: Java version does not change in windows command prompt
accepted answer: http://stackoverflow.com/a/27127468
has answer: http://stackoverflow.com/a/27127587
has answer: http://stackoverflow.com/a/74463253

http://stackoverflow.com/comment/42700720
has text: it is not set on both machines
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27097239
score: 0

http://stackoverflow.com/q/27120029
accepted answer: http://stackoverflow.com/a/27120114
upvote count: 6
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27120161
tagged with: subclass
score: 6
possible better answer: http://stackoverflow.com/a/27120161
tagged with: superclass
tagged with: object
type: AnsweredQuestion
has body: I'm trying to assign a sub class object array to its super class. The program compiles successfully, but I' getting an ArrayStoreException. I know that arrays parent and child are references to same array, but shouldn't I be able to access method func at least? class Pclass { Pclass() { System.out.println("constructor : Parent class"); } public void func() { System.out.println("Parent class"); } } class Cclass extends Pclass { Cclass() { System.out.println("Constructor : Child class"); } public void func2() { System.out.println("It worked"); } public void func() { System.out.println("Common"); } } public class test { public static void main(String ab[]) { Cclass[] child = new Cclass[10]; Pclass[] parent = child; parent[0]=new Pclass(); parent[0].func(); } }
tagged with: java
has answer: http://stackoverflow.com/a/27120114
type: Question
has answer: http://stackoverflow.com/a/27120148
has comment: http://stackoverflow.com/comment/42741270
has title: Java : Super class array object assigned with sub class array object
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/27120215

http://stackoverflow.com/comment/96747775
type: Comment
type: QuestionComment
has text: Here's a solution in C++: https://github.com/wkaras/C-plus-plus-intrusive-container-templates/blob/master/modulus_hash.h
comment on: http://stackoverflow.com/q/27057920
score: 0

http://stackoverflow.com/a/27009902
score: 0
type: Answer
has body: This is not an answer, I cant comment cause I don't have enough rep. I agree with momo. So you will have something like this: class SendThread extends Thread{ boolean gotData = false; //flag to check if data is received. @Override public void run(){ while(gotData == false){ new Runnable() { @Override public void run(){ //SendData code //if you get Data change gotData = true; } }.run(); Thread.sleep(3000); //sleep for 3 secs } } }
accepted answer of: http://stackoverflow.com/q/27007990
answers question: http://stackoverflow.com/q/27007990
type: AcceptedAnswer

http://stackoverflow.com/comment/42765771
type: Comment
comment on: http://stackoverflow.com/q/27133142
type: QuestionComment
has text: Then I'll have to cast it to a specific type, which is not compile time safe.
score: 0

http://stackoverflow.com/q/27124733
has answer: http://stackoverflow.com/a/41953131
has comment: http://stackoverflow.com/comment/42749763
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27124930
tagged with: excel
type: Question
score: 2
tagged with: java
has title: create multiple sheets on excel in java
answer count: 2
downvote count: 0
has body: I'm trying to create two different sheets on a single excel file . But only getting the first sheet.How can I get the second sheet ? where did I mistake ? Please help Below is the code : WorkbookSettings ws = new WorkbookSettings(); ws.setLocale(new Locale("en", "EN")); WritableWorkbook workbook = Workbook.createWorkbook(new File(filename), ws); WritableSheet s = workbook.createSheet("Summary", 0); // set font ,border,alignment cf.setWrap(true); Label l = null; l = new Label(0, 0, "Ticket Product", cf); s.addCell(l); ............................................ ............................................ // code to load data on the first sheet int columns = s.getColumns(); for (i = 0; i &lt; columns; i++) { //write on excel columnwise } workbook.write(); s = workbook.createSheet("Details", 1); // set font ,border,alignment cf.setWrap(true); l = null; l = new Label(0, 0, "Ticket Product", cf); s.addCell(l); ............................................ ............................................ //code to load data on the second sheet columns = s.getColumns(); for (i = 0; i &lt; columns; i++) { //the same loop as before to write columnwise } workbook.write(); workbook.close();

http://stackoverflow.com/comment/42738542
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27103988
has text: If i use DOM parser will i be able to perform operations like addition,subtractions on the String Latest afterwards??

http://stackoverflow.com/a/27048653
has body: -- UPDATE !! As seen in How to prevent tags replacement? There is a great solution to this problem: Parsing with: Document doc = Jsoup.parse(html, "", Parser.xmlParser()); Will give: &lt;a href="#Item1"&gt; &lt;p style="font-family:times;margin-top:12pt;margin-left:0pt;"&gt; &lt;font size="2"&gt;Item&amp;nbsp;1.&lt;/font&gt; &lt;/p&gt;&lt;/a&gt; Thanks @user2784201! -- OLD RESPONSE: I'm not sure if what you are asking for is possible or not, but I think that it goes against JSoup philosophy of parsing html in a way as similar as possible to the way of a browser. Note that browsers will also close that A tag too. I think this is because in HTML4 putting a P inside an A was forbidden. Look at this https://stackoverflow.com/a/1828032/3324704. Bytheway I think you are using an old version of JSoup, if you use 1.8.1 you will see that the inner A tag (a spurious tag put there by JSoup, also by browsers) will mantain the href. This fact may help you in your parsing. See the output of JSoup 1.8.1 (Note the inner &lt;a href="#Item1"&gt;): JSOUP PARSED = &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;a href="#Item1"&gt; &lt;/a&gt; &lt;p style="font-family:times;margin-top:12pt;margin-left:0pt;"&gt;&lt;a href="#Item1"&gt; &lt;font size="2"&gt;Item&amp;nbsp;1.&lt;/font&gt; &lt;/a&gt;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; Furthermore, I've tried other libraries. Htmlcleaner (here) fires an error (a - UnpermittedChild) and gives very similar output: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt;&lt;a href="#Item1"&gt; &lt;/a&gt;&lt;p style="font-family:times;margin-top:12pt;margin-left:0pt;"&gt;&lt;a href="#Item1"&gt; &lt;font size="2"&gt;Item 1.&lt;/font&gt; &lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt; And jtidy (here) that says: Warning: missing &lt;/a&gt; before &lt;p&gt; and gives: &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti…
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27040626
answers question: http://stackoverflow.com/q/27040626
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/comment/42785682
comment on: http://stackoverflow.com/q/27144827
type: QuestionComment
has text: What's the actual question? How big is the image? How much memory does your device have? The problem seems pretty obvious; your app is using too much memory.
score: 0
type: Comment

http://stackoverflow.com/a/27064970
type: Answer
has comment: http://stackoverflow.com/comment/60741942
has comment: http://stackoverflow.com/comment/42668528
has comment: http://stackoverflow.com/comment/42764975
accepted answer of: http://stackoverflow.com/q/27037003
score: 1
has comment: http://stackoverflow.com/comment/42723386
upvote count: 1
answers question: http://stackoverflow.com/q/27037003
type: AcceptedAnswer
downvote count: 0
has body: Use spark-rowsimilarity job in Mahout v1. Create a file of user-ID&lt;tab&gt;book-ID1&lt;space&gt;book-ID2&lt;space&gt;etc... In other words each row is a user's history of books read. First column is the user-ID, second column is a space delimited list of book-IDs. Run "mahout spark-rowsimilarity" and you'll get back files of the form: user-ID&lt;tab&gt;user-ID5:strength&lt;space&gt;user-ID6:strength&lt;space&gt;etc... This is a list of similar users for each user. The list is sorted and the strength is the LLR (log-likelihood ratio) score for how similar the users are. Docs here: http://mahout.apache.org/users/recommender/intro-cooccurrence-spark.html

http://stackoverflow.com/comment/42620868
has text: Is this the full script or does it need to be added onto something?
comment on: http://stackoverflow.com/a/27048035
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27150489
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jsoup
accepted answer: http://stackoverflow.com/a/27151260
has body: I need to parse html code as java input stream. I have this html code in stream: item 1 item 2 and after calling Jsoup.parse(stream) I have as result item 1 item 2 How to prevent code modifying? I don't need to change html code. How to fix this? why it replaces tag?
has comment: http://stackoverflow.com/comment/42795984
answer count: 2
has comment: http://stackoverflow.com/comment/42797195
downvote count: 0
has comment: http://stackoverflow.com/comment/42795812
favorite count: 0
has title: How to prevent tags replacement?
upvote count: 2
has answer: http://stackoverflow.com/a/27151260
possible better answer: http://stackoverflow.com/a/27151055
has comment: http://stackoverflow.com/comment/42797146
has comment: http://stackoverflow.com/comment/42797283
has answer: http://stackoverflow.com/a/27151055

http://stackoverflow.com/comment/43222276
has text: http://drumcoder.co.uk/blog/2011/oct/18/httpclient-client-side-certificates/
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27108873

http://stackoverflow.com/q/27055069
has answer: http://stackoverflow.com/a/27055152
downvote count: 0
linked to: http://stackoverflow.com/q/16206813
has title: geting a multiline text with scanner class in java
favorite count: 0
has comment: http://stackoverflow.com/comment/42626613
has body: In a part of my university project I have to get a text with some lines then saving it in a string or a string array.My problem is that in scanner class using methods gets only one line of the input. So I cannot get the other lines.please help me. public class Main { public static void main(String[] args) { java.util.Scanner a = new java.util.Scanner(System.in); String b = ""; while (a.hasNextLine()) { b += a.nextLine(); } } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27055152
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42627266
possible better answer: http://stackoverflow.com/a/27056202
tagged with: multilinestring
has answer: http://stackoverflow.com/a/27056202
answer count: 2

http://stackoverflow.com/q/27096743
has comment: http://stackoverflow.com/comment/42699379
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42699387
type: Question
has comment: http://stackoverflow.com/comment/42699547
has comment: http://stackoverflow.com/comment/42699675
tagged with: math
accepted answer: http://stackoverflow.com/a/27096843
has title: How to calculate area under a normal distribution in Java?
has comment: http://stackoverflow.com/comment/42699617
has comment: http://stackoverflow.com/comment/42698857
upvote count: 4
answer count: 1
linked to: http://stackoverflow.com/q/16221406
has comment: http://stackoverflow.com/comment/42698890
favorite count: 0
has comment: http://stackoverflow.com/comment/42699740
has comment: http://stackoverflow.com/comment/42698847
has body: I am trying to calculate the area under the curve for a normal distribution. Normally, I can refer to a calculator or z table. But, how would I code this? I have the values of z, mu, sigma and the bounds. I saw multiple codes online, but none of them explain the logic behind it. Rather than using an external method, I would like to learn how this works and then write a code for it. It would be a great help, if someone can provide an algorithm to how to calculate the area under curve using z, mu, sigma and the bounds, without any complex details. Thanks
has answer: http://stackoverflow.com/a/27096843
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/27115391
answers question: http://stackoverflow.com/q/27114108
has body: Sorry for the confusion. I think I need to review Android Studio. That is an error from a previous version of my code (notice the date of yesterday 11-23). I thought "clear all" in logcat literally cleared all and delete it. I just found out I am wrong. There are no NPEs at this time that I am aware of. Sorry for the waste of time....lesson learned for me using android studio. After noticing this I was able to find the logical error that caused the program to exit shortly after. Thanks all for the help
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27114108

http://stackoverflow.com/q/27135671
answer count: 0
has body: With the configuration below, I'm facing a NoUniqueBeanDefinitionException at PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory():556 @Bean @Primary public LocalContainerEntityManagerFactoryBean oneEmf(...) { return ( abstracted as not relevant ); } @Bean public LocalContainerEntityManagerFactoryBean twoEmf(...) { return ( abstracted as not relevant ); } Then I configured a Dao with the @PersistenceContextannotation @PersistenceContext protected void setEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } It simple do find both EntityManagerFactory beans and throw the exception. I'm just wondering if PersistenceAnnotationBeanPostProcessor shouldn't try to decide taking into account the @Primary annotation, since is what I expected to happen. The code says otherwise, did anyone had similar problem?
upvote count: 1
type: Question
has title: PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory should honor @Primary?
score: 1
tagged with: java
downvote count: 0
favorite count: 0
tagged with: spring-aop
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/27014403
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27014366
type: Answer
has comment: http://stackoverflow.com/comment/42554688
has comment: http://stackoverflow.com/comment/42554734
has body: Your issue is that you are not implementing a proper setter, and Integer is immutable. So what you are doing when incrementing someInteger right now is incrementing the value of reference someInteger scoped to the method where you are executing the increment, without impacting on the private field. A setter method takes an argument, and internally sets the field's value, after validation if applicable. So your setter should look like: public void setSomeInteger(int value) { // TODO validate if applicable someInteger = value; } Then you would invoke it as: someClassInstance.setSomeInteger(42);
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27014366

http://stackoverflow.com/comment/42562647
score: 1
has text: Put the code in `onResume` method. You cannot call onCreate unless you completely destroy the activity and it restarts again...
comment on: http://stackoverflow.com/q/27018781
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27134622
has answer: http://stackoverflow.com/a/75780925
downvote count: 0
has answer: http://stackoverflow.com/a/27157777
has answer: http://stackoverflow.com/a/27157832
has title: Memory requirements for Stanford NER retraining
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/80414219
upvote count: 2
type: UnansweredQuestion
has body: I am retraining the Stanford NER model on my own training data for extracting organizations. But, whether I use a 4GB RAM machine or an 8GB RAM machine, I get the same Java heap space error. Could anyone tell what is the general configuration of machines on which we can retrain the models without getting these memory issues? I used the following command : java -mx4g -cp stanford-ner.jar edu.stanford.nlp.ie.crf.CRFClassifier -prop newdata_retrain.prop I am working with training data (multiple files - each file has about 15000 lines in the following format) - one word and its category on each line She O is O working O at O Microsoft ORGANIZATION Is there anything else we could do to make these models run reliably ? I did try with reducing the number of classes in my training data. But that is impacting the accuracy of extraction. For example, some locations or other entities are getting classified as organization names. Can we reduce specific number of classes without impact on accuracy ? One data I am using is the Alan Ritter twitter nlp data : https://github.com/aritter/twitter_nlp/tree/master/data/annotated/ner.txt The properties file looks like this: #location of the training file trainFile = ner.txt #location where you would like to save (serialize to) your #classifier; adding .gz at the end automatically gzips the file, #making it faster and smaller serializeTo = ner-model-twitter.ser.gz #structure of your training file; this tells the classifier #that the word is in column 0 and the correct answer is in #column 1 map = word=0,answer=1 #these are the features we'd like to train with #some are discussed below, the rest can be #understood by looking at NERFeatureFactory useClassFeature=true useWord=true useNGrams=true #no ngrams will be included that do not contain either the #beginning or end of the word noMidNGrams=true useDisjunctive=true maxNGramLeng=6 usePrev=true useNext=true useSequences=true usePrevSequences=true maxLeft=1 #the next 4 deal with word shape …
score: 2
has answer: http://stackoverflow.com/a/50679612
tagged with: java
has answer: http://stackoverflow.com/a/27220936
type: Question
tagged with: stanford-nlp
has answer: http://stackoverflow.com/a/27222084
answer count: 6

http://stackoverflow.com/a/73529718
has body: I had the same problem in Kotlin with old beans automatically converted from Java. They were missing the field target specifier, without which the javax.validation annotations had no effect. A Kotlin snippet from the question code (with field to solve the problem): @field:NotNull @field:Size(max = 20) @Column(name = "username") var username: String
type: Answer
score: 6
downvote count: 0
upvote count: 6
answers question: http://stackoverflow.com/q/27111806

http://stackoverflow.com/comment/42798154
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27149138
has text: By the way that exception `invalid constant type: 18` suggests that this version of `javassist` doesn’t even support Java 7 correctly. See also http://stackoverflow.com/a/23625762/2711488

http://stackoverflow.com/comment/42821296
comment on: http://stackoverflow.com/a/27152007
score: 0
has text: Still problem is going on.. Do you have an idea?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42663024
has text: which location have you store pdf ?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27076017

http://stackoverflow.com/q/27145055
type: UnansweredQuestion
tagged with: orm
type: Question
score: 3
has title: Play Framework 2.X Models definition in a concurrent application
tagged with: java
upvote count: 3
has body: Developing a Play Framework 2.3.X application here using the Ebean ORM. I just have some doubts that i really want to clarify about best practice when defining my models in order to make them "safe" in a concurrent environment. All my models as suggested by the documentation are extending the play.db.ebean.Model and i have some instances that can be modified by different sources. For example i have this simple model, a User public class User extends Model { @Id public Long id; public String name; public String surname; public String email; public String password; public int credits } that has some credits on his account. He can recharge them and can start and have jobs in background that can consume them. I red that when having concurrent access/writes to a model is a wise choice to add a @Version public Long version field to each instance in order to avoid inconsistent states in the model, and when this happens an OptimisticLockException will be thrown. The question is, is the @Version annotation the best solution in a application like mine? Are out there some best practice that i'm missing and that could be used in order to reduce the chance of getting an optimisticLockExceptions and if yes, which ones ?? Let's say the optimisticLockExceptions occurs when making an automatic payments by the system, for example after a credit cards payment, is it safe to loop while the transaction does complete successfully, thus by not throwing an optimisticLockExceptions ? Should i add the @Version annotation to each model of my application ? Sorry for being so meticulous but the models layer has to be as much robust as possibile. Hoping some of you can help me, answering even to some of my questions Greetings
tagged with: jpa
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27255634
tagged with: ebean
tagged with: playframework-2.0
downvote count: 0

http://stackoverflow.com/q/27140436
has comment: http://stackoverflow.com/comment/42778531
has title: How can I round down a decimal?
type: Question
has comment: http://stackoverflow.com/comment/42778490
tagged with: java
has answer: http://stackoverflow.com/a/27140513
tagged with: printing
answer count: 3
tagged with: casting
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27143032
has answer: http://stackoverflow.com/a/27140476
has body: I am writing a program that will simulate a cash register change calculator. It should print the change and how to give back the change ( number of twenty, tens, fives, quarters, dimes, etc). The problem is that when I compile the program, I get a big number. I've tried rounding it down but it doesn't work. ALSO, I don't know if it is caused by the change not being rounded but I won't get the number of cents, I only get 1 $10 bill. p.s. I am taking a high school CS course and right now I can't use other methods of rounding it, I know there is a way like the one I attempted below (casting and stuff) which I am allowed to use at the moment. Thank you. public class changeCash { public static void main(String[] args) { double cost = 68.90; double amtPaid = 80.00; double change = 0; int twentyBill= 0; int tenBill = 0; int fiveBill = 0; int oneBill = 0; int quarters = 0; int dimes = 0; int nickels = 0; int pennies = 0; change = amtPaid - cost; change = ((int)change * 10) / 10.0; System.out.println("Your change is " +"$" + change); double back = amtPaid - cost; if(back &gt;= 20) { twentyBill++; back -= 20; System.out.println(twentyBill + " $20 bill(s)"); } else if(back &gt;= 10) { tenBill++; back -= 10; System.out.println(tenBill + " $10 bill(s)"); } else if(back &gt;= 5) { fiveBill++; back -= 5; System.out.println(fiveBill + " $5 bills(s)"); } else if(back &gt;= 1) { oneBill++; back -= 1; System.out.println(oneBill + " $1 bills(s)"); } else if(back &gt;= 0.25) { quarters++; back -= 0.25; System.out.println(quarters + " qaurter(s)"); } else if(back &gt;= 0.10) { dimes++; back -= 0.10; System.out.println(dimes + " dime(s)"); } else if(back &gt;= 0.05) { nickels++; back -= 0.05; System.out.println(nickels + " nickel(s)"); } else if(back &gt;= 0.01) { pennies++; back -= 0.01; System.out.println(pennies + " penny(ies)"); } } }
accepted answer: http://stackoverflow.com/a/27140513
possible better answer: http://stackoverflow.com/a/27140476
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/q/27054010
tagged with: java
has comment: http://stackoverflow.com/comment/42624798
has comment: http://stackoverflow.com/comment/42625147
linked to: http://stackoverflow.com/q/3911966
type: Question
has comment: http://stackoverflow.com/comment/42624791
has comment: http://stackoverflow.com/comment/42624757
tagged with: int
has answer: http://stackoverflow.com/a/27054103
has title: converting string to int in method java
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/42624891
favorite count: 0
has answer: http://stackoverflow.com/a/27054084
has comment: http://stackoverflow.com/comment/42624740
has comment: http://stackoverflow.com/comment/42624713
has comment: http://stackoverflow.com/comment/42624778
possible better answer: http://stackoverflow.com/a/27054084
answer count: 4
accepted answer: http://stackoverflow.com/a/27054103
has answer: http://stackoverflow.com/a/27054135
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42624767
has body: So I am trying to convert an int to string and then charAt(0), charAt(1), and charAt(2). I did that to split the 3 digit int to 3 different integers. I want to then convert those individual integers to Strings. What I am trying to do is take numbers from 101 and above and print them in words. I have hundreds, tens and ones methods. I am trying to take first integer and apply it to the hundreds method, second integer and apply it to the tens, and third integer to ones method. this is the method of >= 101 import java.util.Scanner; public class rough { public static void main(String args[]) { int number = 0; Scanner scanner = new Scanner(System.in); System.out.print("Please type a number between 0 and 999 OR type -1 to exit: "); number = scanner.nextInt(); if (number &gt;= 101) { System.out.println(hundred(first) + " AND" + tens(second) + "" + From1To19(third)); } else { System.out.println("please input a number from 101: "); } //this is what i have so far(might be junk). public static void From101(int num) { String SNumber = Integer.toString(num); char First = SNumber.charAt(0); char Second = SNumber.charAt(1); char Third = SNumber.charAt(2); int num1 = Integer.parseInt(first); } } Now I am trying to print the words and i am getting 3 errors. System.out.println(hundred(first) + " AND" + tens(second) + "" + From1To19(third)); I add that line in my if/else statement and the errors are: ----jGRASP exec: javac -g rough.java rough.java:27: error: 'void' type not allowed here System.out.println(hundred(first) + " AND" + tens(second) + "" + From1To19(third)); ^ rough.java:27: error: 'void' type not allowed here System.out.println(hundred(first) + " AND" + tens(second) + "" + From1To19(third)); ^ rough.java:27: error: 'void' type not allowed here System.out.println(hundred(first) + " AND" + tens(second) + "" + From1To19(third)); ^ 3 errors ----jGRASP wedge2: exit code for process is 1. ----jGRASP: operation complete.
has answer: http://stackoverflow.com/a/27054131
upvote count: 2

http://stackoverflow.com/comment/42605834
type: Comment
type: QuestionComment
has text: Use Java 8: http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html
comment on: http://stackoverflow.com/q/27043427
score: 0

http://stackoverflow.com/comment/42727321
comment on: http://stackoverflow.com/q/27112188
has text: Read the last two lines of the assignment. You're just not doing what it asks you to do.
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/q/27006596
downvote count: 1
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/42542174
has comment: http://stackoverflow.com/comment/42542488
has body: i've been stuck on getting one of my JTextArea's to display an array of Strings that represent letters in a word in a hangman game. Once the user guesses a letter, (assuming it's right), it should reflect into the array. Instead, it seems to be only adding the letter that was guessed, and not the blanks or the rest of the array. I want to set the guessed letter equal to the correct index in the array and then have it shown on the screen. Here is my code: import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Random; @SuppressWarnings("serial") public class GuiClass extends JFrame { char guess = ' '; int numGuesses = 0; char[] letterGuessedAgainst = null; String wordInPlay = " "; String[] hangmanScores = null; ArrayList&lt;Character&gt; wrongGuesses = null; boolean isGuessSuccessfull = false; private Container contents; JRadioButton rbEasy; JRadioButton rbHard; ButtonGroup difficultyGroup; JTextField txtfldWord; JTextArea txtareaWord; JLabel difficultyPrompt; JLabel userDifficulty; JButton btnStartGame; JButton btnGuessSubmit; JButton btnWordGuessSubmit; JPanel topPanel; JPanel midPanel; JLabel topLabel; JPanel guessPanel; JPanel letterPanel; JLabel word; JTextArea txtareaNumGuesses; JTextField txtfldGuess; JTextField txtfldWordGuess; JTextArea txtareaguessedLetters; JTextArea txtareaLettersLeft; public GuiClass(){ super("Hangman GUI"); contents = getContentPane(); //create a new panel &amp; set layout midPanel = new JPanel(); midPanel.setLayout(new GridLayout(3,3)); //layout manager topLabel = new JLabel("Welcome to Hangman!"); contents.setLayout(new FlowLayout()); //create new ButtonHandlers ButtonHandler buttonHandler = new ButtonHandler(); ButtonHandler2 btnHndlrNewGame = new ButtonHandler2(); //create difficulty buttons/labels &amp; add ActionListeners difficultyPrompt = new JLabel("Fi…
has comment: http://stackoverflow.com/comment/42542451
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/27006879
tagged with: user-interface
favorite count: 0
type: Question
has title: Displaying an array of Strings in a JTextArea
score: -1
tagged with: java
has answer: http://stackoverflow.com/a/27006879

http://stackoverflow.com/comment/42565938
comment on: http://stackoverflow.com/q/27020545
has text: Just wandering if it works if you add `getLatest()` instead of `isLatest()` to your entity?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27034433
has answer: http://stackoverflow.com/a/27034472
possible better answer: http://stackoverflow.com/a/27034472
favorite count: 0
has answer: http://stackoverflow.com/a/27034716
answer count: 5
has body: I have common css and js files that i include in every jsp file. So what's the best practice to include them in every page ? I used to use &lt;%@ include file="header.jsp" %&gt; but I'm wondering if this is the best and clean way to proceed.
upvote count: 4
tagged with: spring
linked to: http://stackoverflow.com/q/4790720
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27034631
accepted answer: http://stackoverflow.com/a/27034631
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27036360
type: Question
linked to: http://stackoverflow.com/q/1296235
has title: Include css and js file in every jsp page
tagged with: jsp
has answer: http://stackoverflow.com/a/27034497
score: 4

http://stackoverflow.com/a/27098208
upvote count: 1
answers question: http://stackoverflow.com/q/27098155
score: 1
downvote count: 0
has body: Go to Windows-&gt;Preference-&gt;Java-&gt;Compiler-&gt;Errors/Warnings In that Unnecessary Code tab. Make Value of Parameter is not used as Error from Ignore or Warning.
type: Answer

http://stackoverflow.com/comment/139904406
comment on: http://stackoverflow.com/a/27069042
type: Comment
has text: The OP is using `MockitoJUnitRunner` which, [its documentation](https://www.javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/junit/MockitoJUnitRunner.html) says, "Initializes mocks annotated with Mock, so that explicit usage of MockitoAnnotations.initMocks(Object) is not necessary."
score: 0
type: AnswerComment

http://stackoverflow.com/q/27077644
tagged with: java
has body: Here is my code. I know it maybe very complicated with stupid errors but I am learning! It always outputs only 2, whatever n is. public static void prime(int n) { int i; int b = 1; int d; int a =0; for (i=1; i!=n; i++){ while (b!=i){ d = i / b; if (d == i) a = 1; else a = 2; b++; } if (a==1) System.out.println( i); }
type: Question
has answer: http://stackoverflow.com/a/27077947
has comment: http://stackoverflow.com/comment/42665761
has comment: http://stackoverflow.com/comment/42665712
has title: Print prime numbers in an interval
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: primes
has answer: http://stackoverflow.com/a/27077698
has comment: http://stackoverflow.com/comment/42665829

http://stackoverflow.com/comment/42654506
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27064662
has text: Can you elaborate further why explicitly listing the datasource is a "logical reference"? Is there any hope to have it out of the box (let's say, two configuration modes).
score: 0

http://stackoverflow.com/comment/42683784
has text: Why you don't use Gradle to add dependency?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27087969

http://stackoverflow.com/q/27067908
downvote count: 0
favorite count: 0
tagged with: jooq
tagged with: oracle-database
has title: Exception raised executing Oracle SP with Table and Record Types
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: I'm evaluating JOOQ, Oracle -> Java generation went smooth. However I'm having an issue calling an SP which expects a Table Type as an IN PARAMETER XxFooRecTypeRecord record = new XxFooRecTypeRecord(); record.setPreferenceStartDate(new Date(new java.util.Date().getTime())); XxFooTabTypeRecord table = new XxFooTabTypeRecord(); table.set(record); Preferences procedure = new Preferences(); procedure.setPPreferenceRec(table); procedure.execute(configuration); Gives me the exception PLS-00306: wrong number or types of arguments in call to 'PREFERENCES' For Stored Procedures that use primitives (string, number, etc) it works as expected. Further in the log I see: 2014-11-21 13:23:29 DEBUG LoggerListener:258 - Calling routine : { call "XXAR"."XX_AR_FOO_PKG"."PREFERENCES"(?, ?, ?) } But I don't see the bind values log line.
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42663386
has comment: http://stackoverflow.com/comment/42715068
tagged with: sql

http://stackoverflow.com/q/27031807
answer count: 3
has comment: http://stackoverflow.com/comment/42616601
has body: I have working with swing API for the first time to get the screen resolution for my win application. How to set present screensize in Java Swing?
has answer: http://stackoverflow.com/a/27031968
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27031933
has comment: http://stackoverflow.com/comment/42585537
downvote count: 0
tagged with: awt
has title: How to set present screensize in Java Swing?
has answer: http://stackoverflow.com/a/27031826

http://stackoverflow.com/a/58752733
upvote count: 1
answers question: http://stackoverflow.com/q/27107043
has body: A little bit late, but today i had this same problem. My solution: public Number multiply(Number number, int multiplier) { return new Number() { @Override public long longValue() { return number.longValue() * multiplier; } @Override public int intValue() { return number.intValue() * multiplier; } @Override public float floatValue() { return number.floatValue() * multiplier; } @Override public double doubleValue() { return number.doubleValue() * multiplier; } }; }
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/103801343

http://stackoverflow.com/comment/42551910
type: Comment
comment on: http://stackoverflow.com/q/27012717
score: 0
has text: Please avoid unnecessary whitespace when putting code in your question - this will make your question much more readable
type: QuestionComment

neo4j
tags question: http://stackoverflow.com/q/27127981
tag name: neo4j
tags question: http://stackoverflow.com/q/27094532
tags question: http://stackoverflow.com/q/27114098
tags question: http://stackoverflow.com/q/27072879
type: Tag
tags question: http://stackoverflow.com/q/27150077
tags question: http://stackoverflow.com/q/27025325
tags question: http://stackoverflow.com/q/27050036

http://stackoverflow.com/comment/43023213
comment on: http://stackoverflow.com/a/27088324
type: AnswerComment
score: 0
type: Comment
has text: for example we have declared a instance variable, and initialized it in a method, then the variable will only be initialized if we call that method

http://stackoverflow.com/comment/42634608
type: AnswerComment
comment on: http://stackoverflow.com/a/27056281
has text: It works when used query.select(root.get(Order_.price)), but query.select(builder.sum(root.get(Order_.price))) returns a single result. So setMaxResults works not as I need.
type: Comment
score: 0

http://stackoverflow.com/a/27066710
has body: There is actually a separate function where you can define the radix: https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#parseInt(java.lang.String,%20int) Integer.parseInt(x) simply calls Integer.parseInt(x, 10), so you have to specify a radix 10 number. In order to parse a hex string, you would simply have to use the following (note that the 0x prefix is not allowed): Integer.parseInt("FFFFFFF", 16);
answers question: http://stackoverflow.com/q/27066487
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27066487
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/27024362
upvote count: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27024338
has body: A constructor is called with the new operator: List&lt;Character&gt; newLst = new ArrayList&lt;Character&gt;();
accepted answer of: http://stackoverflow.com/q/27024338
type: Answer
has comment: http://stackoverflow.com/comment/42572485
score: 5

jakarta-ee
tags question: http://stackoverflow.com/q/27045695
tags question: http://stackoverflow.com/q/27035174
tags question: http://stackoverflow.com/q/27144604
tags question: http://stackoverflow.com/q/27058966
tags question: http://stackoverflow.com/q/27123385
type: Tag
tags question: http://stackoverflow.com/q/27101798
tags question: http://stackoverflow.com/q/27078869
tags question: http://stackoverflow.com/q/26997430
tags question: http://stackoverflow.com/q/26994820
tags question: http://stackoverflow.com/q/27106460
tags question: http://stackoverflow.com/q/27088385
tags question: http://stackoverflow.com/q/27117840
tags question: http://stackoverflow.com/q/27056096
tags question: http://stackoverflow.com/q/26995262
tags question: http://stackoverflow.com/q/27103517
tags question: http://stackoverflow.com/q/27066335
tags question: http://stackoverflow.com/q/26992354
tags question: http://stackoverflow.com/q/27088134
tags question: http://stackoverflow.com/q/26995126
tags question: http://stackoverflow.com/q/27100224
tags question: http://stackoverflow.com/q/27102384
tags question: http://stackoverflow.com/q/27122613
tags question: http://stackoverflow.com/q/26999934
tags question: http://stackoverflow.com/q/27037570
tags question: http://stackoverflow.com/q/27058974
tags question: http://stackoverflow.com/q/26994464
tags question: http://stackoverflow.com/q/27014675
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/27019584
tags question: http://stackoverflow.com/q/27003738
tags question: http://stackoverflow.com/q/27120704
tags question: http://stackoverflow.com/q/27064210
tags question: http://stackoverflow.com/q/26996651
tags question: http://stackoverflow.com/q/27045245
tags question: http://stackoverflow.com/q/27011194
tags question: http://stackoverflow.com/q/27086622
tags question: http://stackoverflow.com/q/27067816
tags question: http://stackoverflow.com/q/27036240
tags question: http://stackoverflow.com/q/27060276
tags question: http://stackoverflow.com/q/27094457
tags question: http://stackoverflow.com/q/27119770
tags question: http://stackoverflow.com/q/27146105
tags question: http://stackoverflow.com/q/27124851
tags question: http://stackoverflow.com/q/27134743
tags question: http://stackoverflow.com/q/27038632
tags question: http://stackoverflow.com/q/27023963
tags question: http://stackoverflow.com/q/27094295
tags question: http://stackoverflow.com/q/27146746
tags question: http://stackoverflow.com/q/27042319
tags question: http://stackoverflow.com/q/27142376
tags question: http://stackoverflow.com/q/27019444
tags question: http://stackoverflow.com/q/27141192
tags question: http://stackoverflow.com/q/27125593
tags question: http://stackoverflow.com/q/27147760
tags question: http://stackoverflow.com/q/27147851
tags question: http://stackoverflow.com/q/27129310
tags question: http://stackoverflow.com/q/27028123
tags question: http://stackoverflow.com/q/27143599
tags question: http://stackoverflow.com/q/27119576
tags question: http://stackoverflow.com/q/27071627
tags question: http://stackoverflow.com/q/27057399
tags question: http://stackoverflow.com/q/27076651
tags question: http://stackoverflow.com/q/27002745
tags question: http://stackoverflow.com/q/27017294
tags question: http://stackoverflow.com/q/27031748
tags question: http://stackoverflow.com/q/27016066
tags question: http://stackoverflow.com/q/27021697
tags question: http://stackoverflow.com/q/26992958
tags question: http://stackoverflow.com/q/27004587
tags question: http://stackoverflow.com/q/27118344
tags question: http://stackoverflow.com/q/27093387
tags question: http://stackoverflow.com/q/27018494
tags question: http://stackoverflow.com/q/27092941
tags question: http://stackoverflow.com/q/27050989
tags question: http://stackoverflow.com/q/27034508
tags question: http://stackoverflow.com/q/27145341
tags question: http://stackoverflow.com/q/27121232
tags question: http://stackoverflow.com/q/27060193
tags question: http://stackoverflow.com/q/27057927

http://stackoverflow.com/comment/42707031
type: QuestionComment
has text: I think you missing your project name at last : http://developer.android.com/tools/help/lint.html
comment on: http://stackoverflow.com/q/27101287
score: 0
type: Comment

http://stackoverflow.com/q/27145440
tagged with: eclipse-plugin
has title: Refresh whole composite/view on mouse click
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42789913
tagged with: swt
type: Question
score: 0
has body: I am new to swt. In an eclipse plugin, i have created the view which contains some code as shown below. public void createPartControl(final Composite parent) { Composite outer = new Composite(parent, SWT.BORDER); outer.setBackground(new Color(null, 207, 255, 206)); // Green FormLayout formLayout = new FormLayout(); formLayout.marginHeight = 5; formLayout.marginWidth = 5; formLayout.spacing = 5; outer.setLayout(formLayout); //TOP Composite Top = new Composite(outer, SWT.BORDER); Top.setLayout(new GridLayout()); Top.setBackground(new Color(null, 232, 223, 255)); // Blue FormData fData = new FormData(); fData.top = new FormAttachment(0); fData.left = new FormAttachment(0); fData.right = new FormAttachment(100); // Locks on 10% of the view fData.bottom = new FormAttachment(20); Top.setLayoutData(fData); //BOTTOM Composite Bottom = new Composite(outer, SWT.BORDER); Bottom.setLayout(fillLayout); Bottom.setBackground(new Color(null, 255, 235, 223)); // Orange fData = new FormData(); fData.top = new FormAttachment(20); fData.left = new FormAttachment(0); fData.right = new FormAttachment(100); fData.bottom = new FormAttachment(100); Bottom.setLayoutData(fData); The Bottom Composite contains some label where on mouseDown of MouseListener the whole page should be redraw. I used dispose but the page is empty but its not creating again. How to redraw or refresh the main parent. The label code is as shown: Label label = new Label(Bottom, SWT.NONE); label.addMouseListener(new MouseListener() { @Override public void mouseUp(MouseEvent arg0) { } @Override public void mouseDown(MouseEvent arg0) { for (Control kid : parent.getChildren()) { kid.dispose(); } //Need to create/redraw th layout here } @Override public void mouseDoubleClick(MouseEvent arg0) { } });
answer count: 1
has answer: http://stackoverflow.com/a/27149705

http://stackoverflow.com/q/27026976
score: 0
has comment: http://stackoverflow.com/comment/42577367
answer count: 2
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42577324
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42577145
has answer: http://stackoverflow.com/a/27027049
has comment: http://stackoverflow.com/comment/42580400
tagged with: java
has title: Get textfield input from another class
tagged with: jtextfield
type: Question
has body: I wanted to call an input from mainGui.java to mainmenu.java but it keep returns me NullPointException. Below is my code for mainGui.java String input; public String user() { return input = logintext.getText(); } private void submitbtnActionPerformed(java.awt.event.ActionEvent evt) { String input = logintext.getText(); String input2 = loginpassword.getText(); try { lectFunc = (lectFunc)lectRecord.get(input); if(lectFunc == null){ JOptionPane.showMessageDialog(null,"Wrong username or password!"); } else if (lectFunc.getUser().equals(input) &amp;&amp; lectFunc.getPass().equals(input2)){ dispose(); new mainmenu().setVisible(true); } else { JOptionPane.showMessageDialog(null,"Error"); } } catch (Exception ex) { ex.printStackTrace(); } } and code for mainmenu.java public class mainmenu extends javax.swing.JFrame { lectFunc lectFunc; mainGui mainGui; public mainmenu() { final String user = mainGui.user(); lectFunc.setUser(user); System.out.println(lectFunc.getUser()); new mainGui().setVisible(false); initComponents(); } Is there any way to overcome this problem? UPDATE: NPE java.lang.NullPointerException at oodj.mainmenu.&lt;init&gt;(mainmenu.java:9) at oodj.mainGui.submitbtnActionPerformed(mainGui.java:158) at oodj.mainGui.access$000(mainGui.java:8) at oodj.mainGui$1.actionPerformed(mainGui.java:52) Line 9 : final String user = mainGui.user();
has comment: http://stackoverflow.com/comment/42577117
has comment: http://stackoverflow.com/comment/42577514
has answer: http://stackoverflow.com/a/27027235
tagged with: class

http://stackoverflow.com/comment/42785900
type: AnswerComment
has text: great, thanks a lot. So the fact I am writing my selenium scripts in Selenium shouldn't cause any difficulties?
type: Comment
comment on: http://stackoverflow.com/a/27136372
score: 0

http://stackoverflow.com/q/27119946
has comment: http://stackoverflow.com/comment/42745069
downvote count: 0
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/27119967
type: Question
answer count: 8
has body: I confuse between thread.run() &amp;&amp; thread.start() methods because thread.start() --> start new thread so name of thread is changed (obviously) thread.run() --> does not start new thread (run on main thread) though according to below program thread's name is changed. Why god why? public class DemoClass { public static void main(String[] z) { Thread t = Thread.currentThread(); System.out.println("Main thread : " + t.getName()); MyThread thread = new MyThread(); thread.run(); thread.start(); } } public class MyThread extends Thread { public void run() { System.out.println("Important job running in MyThread"); System.out.println("run : " + this.getName()); } } O/p : Main thread : main Important job running in MyThread run : Thread-0 Important job running in MyThread run : Thread-0 Please correct me if i am wrong to some concept.
upvote count: 2
has answer: http://stackoverflow.com/a/27143315
has answer: http://stackoverflow.com/a/35789340
accepted answer: http://stackoverflow.com/a/27143315
has answer: http://stackoverflow.com/a/27122420
has answer: http://stackoverflow.com/a/27120141
possible better answer: http://stackoverflow.com/a/27119967
favorite count: 0
has answer: http://stackoverflow.com/a/35789164
has answer: http://stackoverflow.com/a/27120656
linked to: http://stackoverflow.com/q/541487
has answer: http://stackoverflow.com/a/27129176
has title: Java multithreading difference between run() and start()
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/27072767
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42657842
accepted answer of: http://stackoverflow.com/q/27072526
answers question: http://stackoverflow.com/q/27072526
has body: Look at this question: How can I play sound in Java? Also why are you calling .stop() right after .play()? Wouldn't that be the cause of not playing the sound? Anyway, no need to use Applets. Also play the sound using a new thread, so loading and streaming doesn't crumble your user interface.
score: 0

http://stackoverflow.com/comment/42628048
type: Comment
type: QuestionComment
has text: Not sure about jax but it is something to with browser cookies
score: 0
comment on: http://stackoverflow.com/q/27056064

http://stackoverflow.com/comment/42771000
type: AnswerComment
type: Comment
has text: Ok, I did that and ran 'javac Student.java Advisor.java' in my new bookKeeping directory. This removed half of my errors; however, I am still getting the error Cannot Find Symbol for instances with Student[lineSafe].
comment on: http://stackoverflow.com/a/27136185
score: 0

http://stackoverflow.com/comment/42673819
type: Comment
has text: Can you paste the contents of your ant build file and the contents of the file you are using the run it?
comment on: http://stackoverflow.com/a/27081755
score: 0
type: AnswerComment

jms
tags question: http://stackoverflow.com/q/27070745
tags question: http://stackoverflow.com/q/27044547
tags question: http://stackoverflow.com/q/27106762
tags question: http://stackoverflow.com/q/27081978
tags question: http://stackoverflow.com/q/27021192
tags question: http://stackoverflow.com/q/27063410
tag name: jms
tags question: http://stackoverflow.com/q/27049415
tags question: http://stackoverflow.com/q/27040088
type: Tag
tags question: http://stackoverflow.com/q/27140595
tags question: http://stackoverflow.com/q/27032856

http://stackoverflow.com/comment/42545911
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27008937
type: QuestionComment
has text: what sorting algorithm is this? Also could you comment that inner for-loop, the one that uses j as an indexing variable. I'm having trouble figuring out what that does

http://stackoverflow.com/comment/42530591
type: Comment
type: QuestionComment
score: 2
has text: You need to be much more specific. We aren't mind readers, concise and targeted questions are best. Are you asking about ranges for the marks for the student?
comment on: http://stackoverflow.com/q/27000113

http://stackoverflow.com/comment/42810098
score: 1
comment on: http://stackoverflow.com/a/27124720
type: Comment
type: AnswerComment
has text: Solved! I changed the permissions for the logs folder in windows explorer to allow write permissions.

codahale-metrics
tag name: codahale-metrics
type: Tag
tags question: http://stackoverflow.com/q/27087768

http://stackoverflow.com/comment/42687776
type: QuestionComment
type: Comment
has text: So, if you see the code write bytes to the response, how could the file have 0 byte? That contradicts what you're saying in your question. How do you see that the file has 0 byte?
score: 0
comment on: http://stackoverflow.com/q/27090246

http://stackoverflow.com/comment/42776397
score: 0
comment on: http://stackoverflow.com/a/27107429
type: Comment
has text: The report uses the mysql JDBC driver - it's declared directly in the report. Using Java 1.6.
type: AnswerComment

http://stackoverflow.com/comment/42711434
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27103745
has text: Curios to know why do want to do this.. When you write new code, use new syntax. Leave the old code as it is.

http://stackoverflow.com/q/27133764
type: Question
has answer: http://stackoverflow.com/a/27137452
accepted answer: http://stackoverflow.com/a/27137452
has comment: http://stackoverflow.com/comment/42766384
has title: Android ComponentInfo and NullPointerException
score: 0
has body: in application sometimes i'm get this error and after trace i cant find whats cause of this error: java.lang.RuntimeException: Unable to start activity ComponentInfo{ir.tsms/ir.tsms.ServiceDialog}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) at android.app.ActivityThread.access$600(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:153) at android.app.ActivityThread.main(ActivityThread.java:5297) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at ir.tsms.ServiceDialog.updateAndIntertDialog(ServiceDialog.java:233) at ir.tsms.ServiceDialog.onCreate(ServiceDialog.java:105) at android.app.Activity.performCreate(Activity.java:5122) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270) ... 11 more java.lang.NullPointerException at ir.tsms.ServiceDialog.updateAndIntertDialog(ServiceDialog.java:233) at ir.tsms.ServiceDialog.onCreate(ServiceDialog.java:105) i get NullPointerException error and i can not resolve that. my code: public class ServiceDialog extends Activity { private Context ctx; private String count; private Boolean ps; private Boolean sn; private String mLastIDForDelete; private String mLastID; private String mSmsNumber; private String mMobileNumber; private String mContactName; private String mSmsBody; private String mSenderName; private String mDate; private MediaPlayer sms_music; private P…
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/42766304
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/27142338
type: Answer
upvote count: 1
score: 1
has body: 1) MySQL doesn't know about your connection pools. MySQL has own option for max allowed connections. And the number should be bigger than sum of connections required by all the connection pools. So in your case 2*100. 2) best maxactive value depends on multiple factors. 500 requsts per second if one request is processed 1 second requires 500 connections. But if the request processing time is 0.1 sec 50 connections would be enough.
answers question: http://stackoverflow.com/q/27141811
downvote count: 0

http://stackoverflow.com/comment/42575111
type: QuestionComment
score: 1
has text: --n means "decrement the value of n then find the element at that index" n++ means "find the element at index n, then increment n"
comment on: http://stackoverflow.com/q/27025863
type: Comment

http://stackoverflow.com/comment/42650521
type: AnswerComment
type: Comment
has text: So you've changed the return type of your method to `void`, removed the assignments to those `result` variables, removed the `return` statements, removed the assignment within `arrays` of the result of `printmessage`, and removed the subsequent `JOptionPane` after your call to `printmessage`? And you're still getting errors?
comment on: http://stackoverflow.com/a/27068280
score: 0

http://stackoverflow.com/q/27128317
has answer: http://stackoverflow.com/a/27128764
upvote count: 3
answer count: 3
has title: How to create a header/footer in new docx document?
tagged with: header
favorite count: 0
has body: I would like to create a header and footer on a docx document (a new one and not existing one) with XWPF jars (apache poi). When I use XWPFHeaderFooterPolicy policy = document.getHeaderFooterPolicy(); policy is null, so I would know how to create it in a new document. CustomXWPFDocument document = new CustomXWPFDocument(); XWPFHeaderFooterPolicy policy = document.getHeaderFooterPolicy(); XWPFHeader head = policy.createHeader(policy.DEFAULT); head.getListParagraph().get(0).createRun().setText("Hello Header World!"); CTP ctP1 = CTP.Factory.newInstance(); CTR ctR1 = ctP1.addNewR(); CTText t = ctR1.addNewT(); t.setStringValue("Paragraph in header"); XWPFParagraph p1 = new XWPFParagraph(ctP1, document); XWPFParagraph[] pars = new XWPFParagraph[1]; pars[0] = p1; policy.createHeader(policy.FIRST, pars);
tagged with: http://stackoverflow.com/tag/docx
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28128401
score: 3
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/46099880
tagged with: xwpf

http://stackoverflow.com/comment/42852023
type: QuestionComment
comment on: http://stackoverflow.com/q/27061225
type: Comment
has text: how to maintain session id throughout the application can you please tell me.
score: 0

http://stackoverflow.com/a/26995755
accepted answer of: http://stackoverflow.com/q/26992338
type: Answer
answers question: http://stackoverflow.com/q/26992338
score: 0
type: AcceptedAnswer
has body: Sorry for the in-convenience. It worked as expected. I had an error in my myJson.json file and i had re-generated the Getters and Setters as suggested by @Vishvesh Phadnis { "address": { "street": "Hunterfly Place", "city": "Dunlo", "state": "Arizona", "country": "Colorado", "zipcode": "1631" }, "studentName": "John", "loggedInUser": "Admin", "createdBy": "System", "createdTs": "03-19-2011 14:53", "updatedBy": "John", "updatedTs": "06-11-2014 08:00", "skills": [ { "skill": "Football", "grade": "A" }, { "skill": "Swimming", "grade": "C" }, { "skill": "Dance", "grade": "A" }] } Thanks all:)

http://stackoverflow.com/comment/42623994
type: QuestionComment
comment on: http://stackoverflow.com/q/27051350
has text: Yes - and the top of the class
score: 0
type: Comment

http://stackoverflow.com/comment/42626117
has text: move those false elements to empty elements in the array
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27054794

http://stackoverflow.com/q/27073937
has body: My last attempt at getting help was poorly explained on my part so I thought I'd try again and be clearer. I am writing a program that is supposed to have a user enter the number of exams, homework, and quizzes in a class, and then the scores for each student on all of those assignments. Ex: Please provide grade item details Exams (number, points, weight):3 100 60 Quizzes (number, points, weight):3 10 20 Homework (number, points, weight):3 10 20 What would you like to do? 1 Add student data 2 Display student grades &amp; statistics 3 Plot grade distribution 4 Quit Your choice: 1 Enter student data: data&gt;Bob Jones: e100 e80 e90 q10 q10 q0 h10 h5 h10 data&gt;Joe Smith: e85 e90 e100 q10 q10 q5 h0 h10 h5 data&gt;Sam Johnson: q10 h10 h0 h10 e60 e100 e90 q10 q8 My main issue is that I am struggling with how to separate one line of data into four different arrays: one for the name, one for exam scores, one for quiz scores, and one for homework scores. What I have tried to do up to this point is shown here: if(input == 1){ for(int i = 0; i &lt;= students;){ for (boolean done = false;done == true;){ System.out.println("Enter student data: "); System.out.print("data&gt;"); String[] readInput = s.next().split(":"); String name = readInput[0]; String scoreString = readInput[1]; String [] scores = scoreString.split("\\s+"); char type = scores[0]; String inputscore = scores.substring(1); int score = Integer.valueOf(inputscore); if (type == 'e'){ So what I'm attempting to do, is split the entered line of data into an array called readInput, with index 0 being the name and index 1 being the list of scores. I then create two strings, one called name and one called score, with the data from index 0 and 1. Then my idea was to read the character before each entered score ("e100" for example) to determine which array it should go into. I feel like I'm doing this in a way that doesn't make much sense and that there's probably a way easier way to do it, but I have kind of hit a wall he…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27074022
has comment: http://stackoverflow.com/comment/42659967
tagged with: arrays
has title: Extracting data from user input String into arrays
accepted answer: http://stackoverflow.com/a/27074191
has comment: http://stackoverflow.com/comment/42659795
type: Question
has answer: http://stackoverflow.com/a/27074008
has comment: http://stackoverflow.com/comment/42659903
score: 0
possible better answer: http://stackoverflow.com/a/27074008
answer count: 3
has comment: http://stackoverflow.com/comment/42659806
has answer: http://stackoverflow.com/a/27074191
tagged with: java

design-patterns
tags question: http://stackoverflow.com/q/27036047
tags question: http://stackoverflow.com/q/27079833
tags question: http://stackoverflow.com/q/27038163
tags question: http://stackoverflow.com/q/27028400
tags question: http://stackoverflow.com/q/26998792
tags question: http://stackoverflow.com/q/27131405
tag name: design-patterns
tags question: http://stackoverflow.com/q/27015262
tags question: http://stackoverflow.com/q/27133314
tags question: http://stackoverflow.com/q/26993382
tags question: http://stackoverflow.com/q/27121406
tags question: http://stackoverflow.com/q/27058612
tags question: http://stackoverflow.com/q/27019417
tags question: http://stackoverflow.com/q/27008051
tags question: http://stackoverflow.com/q/27021599
tags question: http://stackoverflow.com/q/27089300
type: Tag
tags question: http://stackoverflow.com/q/27119632
tags question: http://stackoverflow.com/q/27148701
tags question: http://stackoverflow.com/q/27070523
tags question: http://stackoverflow.com/q/27031390
tags question: http://stackoverflow.com/q/27141021
tags question: http://stackoverflow.com/q/27063729
tags question: http://stackoverflow.com/q/27055752
tags question: http://stackoverflow.com/q/27142376
tags question: http://stackoverflow.com/q/27019889
tags question: http://stackoverflow.com/q/27093754
tags question: http://stackoverflow.com/q/27007107

http://stackoverflow.com/comment/42639611
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27052106
type: Comment
has text: @MadProgrammer the command is 'shutdown -s -f -t <dynamic time>'

http://stackoverflow.com/comment/42759120
comment on: http://stackoverflow.com/q/27125051
type: Comment
has text: Show your code... whatever you have tried yet...
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42721360
has text: Then use `out`. I do not know what IntelliJ-IDEA and/or you have configured. But it will contain .class files.
comment on: http://stackoverflow.com/a/27109001
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42601674
type: QuestionComment
has text: Thank you. I've solved the problem by the method from #user1902288
comment on: http://stackoverflow.com/q/27039211
type: Comment
score: 0

http://stackoverflow.com/comment/42654161
has text: @LuisAlves I was able to determine by printing to the console the value of moreRecords when hasMoreRecords() is called, that only shows once so it is failing somewhere on the first line.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27070523

http://stackoverflow.com/q/26994324
answer count: 0
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: android-fragments
tagged with: java
type: Question
has title: Reload data in onOptionsItemSelected during fragment (same) transaction
favorite count: 0
upvote count: 3
tagged with: android
has body: I have a problem about my Android application. I've an activity with a fragment that have a list of elements (about a forum with ID) and an action bar with 2 button: refresh and new. I want to send the current ID to the "new button" that open an intent to other activity. The problem is: when in the fragment (ListTopic.java) I launch another (same) fragment (ListTopic.java) to open another forum (then with other ID), the "new button" have the same ID of previous forum and not new. So, if I have opened forum with ID 33, when I click the subforum with ID 200, the new button have ever ID 33. This is code where I take new forumId: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_list_topics, container, false); parent = new Forum(); count = 10; imageLoader = new ImageLoader(getActivity()); Bundle bundle = getArguments(); pkg = getActivity().getPackageName(); forumId = bundle.getString(pkg + "FORUMID"); user = bundle.getString(pkg + "USER"); password = bundle.getString(pkg + "PASS"); nome = bundle.getString(pkg + "NOME"); parent = (Forum) bundle.getSerializable(pkg + "parent"); This is end of code: @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); inflater.inflate(R.menu.menu_topic, menu); super.onCreateOptionsMenu(menu,inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_topic_update: this.dialog = new ProgressDialog(getActivity()); subForumList = new ArrayList&lt;Forum&gt;(); TopicList asyncTopic = new TopicList(); asyncTopic.execute(); break; case R.id.menu_topic_new: Intent newTopic = new Intent(getActivity(), NewTopicActivity.class); newTopic.putExtra(pkg + "USER", user); newTopic.putExtra(pkg + "PASS", password); newTopic.putExtra(pkg + "FORUMID", forumId); startActivity(newTopic); break; default: return super.onOptionsItemSelected(item); } return true; } Thanks a…

http://stackoverflow.com/q/27072318
has body: I'm coding a website for a client as well as an app that mirrors the site. Does anyone have a good understanding on how to implement users created on the Joomla site and use that same database on an App for android? The app and site will allow users to change and add new data and the data must be current on the site and the app. Thanks.
score: -1
accepted answer: http://stackoverflow.com/a/27089001
upvote count: 0
answer count: 1
favorite count: 0
tagged with: joomla
has title: How can I use a Joomla user database in a mobile application?
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/42662494
has comment: http://stackoverflow.com/comment/42663219
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27089001
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42672210
tagged with: database

http://stackoverflow.com/a/27005347
upvote count: 1
score: 1
has body: Like Eric said, you need to start the arrays at 0. However, since you say you get and OutOfBoundsException at index 0, most likely nothing is being passed as arguments from the command line. I don't work with the cmd much, but I assume that you are making some mistake when entering in the three arguments.
downvote count: 0
answers question: http://stackoverflow.com/q/27004609
type: Answer

http://stackoverflow.com/q/27040684
tagged with: spring-cloud
has body: Application.java @Configuration @ComponentScan @EnableAutoConfiguration @EnableZuulProxy public class ZuulServer { public static void main(String[] args) { SpringApplication.run(ZuulServer.class, args); } } application.yml eureka: client: enabled: true serviceUrl: defaultZone: http://localhost:8761/v2/ zuul: proxy: route: service1: /myservice1 service2: /myservice2 Example calls: http://localhost:8080/proxy/myservice1/users http://localhost:8080/proxy/myservice2/auctionlots/today Predecoration filter works during routing getting following error (using 1.0.0.M2) : Caused by: java.lang.NoSuchMethodError: com.netflix.hystrix.HystrixExecutableBase$ObservableCommand.toBlocking()Lrx/observables/BlockingObservable; at com.netflix.hystrix.HystrixExecutableBase.queue(HystrixExecutableBase.java:342) at com.netflix.hystrix.HystrixObservableCommand.queue(HystrixObservableCommand.java:50) at com.netflix.hystrix.HystrixExecutableBase.execute(HystrixExecutableBase.java:296) at com.netflix.hystrix.HystrixObservableCommand.execute(HystrixObservableCommand.java:50) at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:485) at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:162) at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:86) at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:197) ... 41 common frames omitted
favorite count: 0
tagged with: netflix-zuul
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has title: Spring Cloud - Zuul Server error
tagged with: spring-boot
has answer: http://stackoverflow.com/a/27046285
score: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/q/27126707
tagged with: http-live-streaming
has answer: http://stackoverflow.com/a/27154242
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27154242
type: Question
tagged with: rtmp
answer count: 1
tagged with: encoder
tagged with: wowza
has title: Live streaming from remote machine webcam to wowza media server using encoder
has body: Hi, I am working on live streaming (java) application. Where I need to stream the video on wowza media server captured from webcam and from there it is broadcast to multiple pc's and on devices. I tried all the encoders given on wowza official site but all are softwares which i don't intended to use in my application. I need rtmp encoder which is suitable to use with my application by using it i can stream videos on wowza media server. So anybody successfully integrated live streaming using wowza media server in java application or any reference or link which may be helpful to me. Thank You.
score: 0

http://stackoverflow.com/comment/42538885
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27004818
has text: If you're using Java 8 , use parallelStream() API

http://stackoverflow.com/comment/45876944
comment on: http://stackoverflow.com/a/28801287
type: Comment
score: 2
type: AnswerComment
has text: That would have had zero effect unless you also set a security manager, which you would have to set after setting the policy and before the bind, so evidently you didn't. Setting AllPermission with a security manager is pretty pointless anyway.

http://stackoverflow.com/comment/42538692
has text: Try using something like `(num = num + 2)` and see where that takes you
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27004684

http://stackoverflow.com/q/27117065
downvote count: 0
accepted answer: http://stackoverflow.com/a/27209671
tagged with: fault-tolerance
has body: I am trying to figure out how Hystrix request caching works but am not following the wiki or end-to-end examples they provide in their docs. Essentially I have the following HystrixCommand subclass: public class GetFizzCommand extends HystrixCommand&lt;Fizz&gt; { private Long id; private Map&lt;Long,Fizz&gt; fizzCache = new HashMap&lt;Long,Fizz&gt;(); void doExecute(Long id) { this.id = id; execute(); } @Override public Fizz run() { return getFizzSomehow(); } @Override public Fizz getFallback() { // Consult a cache somehow. // Perhaps something like a Map&lt;Long,Fizz&gt; where the 'id' is the key (?) // If the 'id' exists in the cache, return it. Otherwise, give up and return // NULL. fizzCache.get(id); } } So I feel like I'm going against the grain here. I believe Hystrix offers built-in caching, as is evidenced by a 'cacheKey', but I can't find any working examples. I don't want to reinvent the wheel here and build caching into my commands if something is already provided out of the box. So I ask: what does request caching look like with Hystrix (exactly)? How are entries added to the cache? How/when is the cache flushed? Is it configurable (expiries, max sizes, etc.)?
answer count: 3
tagged with: hystrix
favorite count: 0
score: 9
has answer: http://stackoverflow.com/a/60517949
has answer: http://stackoverflow.com/a/27209671
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/60517949
tagged with: java
has title: Hystrix Request Caching by Example
tagged with: caching
type: Question
has answer: http://stackoverflow.com/a/67021564
upvote count: 9
has comment: http://stackoverflow.com/comment/42871449

http://stackoverflow.com/q/27041962
type: Question
has title: Eclipse CVS - warning: commitinfo line contains no format strings
score: 0
has body: I'm getting the following error: "commitinfo line contains no format strings [..] Appending defaults (" %r/%p %s")" when trying to commit a project to CVS using Eclipse (juno) and Ubuntu 12.04. I couldn't find a solution elsewhere. The directory /usr/local/sbin is empty. Thanks in advance, below is the full trace The server reported an error while performing the "cvs commit" command. myProject: cvs commit: warning: commitinfo line contains no format strings: myProject: "/usr/local/sbin/validarcommit" myProject: Appending defaults (" %r/%p %s"), but please be aware that this usage is myProject: deprecated. myProject: cvs commit: warning: commitinfo line contains no format strings: myProject: "/usr/local/sbin/validarcommit" myProject: Appending defaults (" %r/%p %s"), but please be aware that this usage is myProject: deprecated. myProject: cvs commit: warning: verifymsg line doesn't contain any format strings: myProject: "/export/cvs/CVSROOT/validarmensajecommit" myProject: Appending default format string (" %l"), but be aware that this usage is myProject: deprecated. myProject: cvs [commit aborted]: Message verification failed
answer count: 1
has answer: http://stackoverflow.com/a/27045188
accepted answer: http://stackoverflow.com/a/27045188
has comment: http://stackoverflow.com/comment/42603423
tagged with: cvs
type: AnsweredQuestion
tagged with: java
tagged with: ubuntu
tagged with: eclipse

http://stackoverflow.com/comment/42578645
comment on: http://stackoverflow.com/a/27027822
has text: Since I need loops and if conditions in my DSL, I don't know if I can use ConfigSluper, but I'll give it a try. Thanke for the hint!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27129623
answer count: 4
has answer: http://stackoverflow.com/a/27129848
has comment: http://stackoverflow.com/comment/42758433
favorite count: 0
has comment: http://stackoverflow.com/comment/42758665
possible better answer: http://stackoverflow.com/a/27129737
has comment: http://stackoverflow.com/comment/42758304
has comment: http://stackoverflow.com/comment/42758337
has title: Sum a Column in a jTable?
tagged with: swing
has body: I am having a problem trying to get values from a column within a jTable and sum them up. This is the code I have so far: public void saveTable(){ for(int i = 0; i &lt; jTable2.getRowCount(); i++){ int total = 0; int Amount = (int) jTable2.getValueAt(i, 5); total = Amount+total; System.out.println(total); } } However I keep getting ClassCastException Errors specifically: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at my.rcsv1.accounting.DraftInvoice.saveTable(DraftInvoice.java:851) Which is referring to the line of code: int Amount = (int) jTable2.getValueAt(i, 5); What do I need to do in order to get this to work? Thank you!
has comment: http://stackoverflow.com/comment/42758556
has answer: http://stackoverflow.com/a/64405263
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42758357
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27129737
has comment: http://stackoverflow.com/comment/42758532
tagged with: jtable
has answer: http://stackoverflow.com/a/27129730
accepted answer: http://stackoverflow.com/a/27129730

http://stackoverflow.com/comment/42650518
has text: @Kon Soo you'll let me search the internet during an interview? :P Or did you mean to say the internet can teach me so let the trees live? I put my final code in the question.
comment on: http://stackoverflow.com/q/27066986
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27026042
has body: I am trying to play a wav/mp3 to my virtual audio cable, I have been searching for hours but can't seem to find how to achieve this. I have been able to play sound in both formats but I can't get it to output to 'Line-1' rather than 'Speakers' Any helpful links or example code would be greatly appreciated.
accepted answer: http://stackoverflow.com/a/27028385
favorite count: 0
has title: Change Mixer to output sound to in java
linked to: http://stackoverflow.com/q/6045384
upvote count: 1
type: Question
tagged with: mixer
tagged with: audio
has answer: http://stackoverflow.com/a/27028385
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/mp3
downvote count: 0
answer count: 1
tagged with: wav

http://stackoverflow.com/a/27126074
type: Answer
has comment: http://stackoverflow.com/comment/42754022
has body: Is your toDoItemList list have field title? if yes , does title have getter and setters? And also please review jsf f:attribute
score: 0
answers question: http://stackoverflow.com/q/27105194

httprequest
tags question: http://stackoverflow.com/q/27050210
tags question: http://stackoverflow.com/q/27124851
tag name: httprequest
tags question: http://stackoverflow.com/q/26995116
tags question: http://stackoverflow.com/q/27079407
type: Tag
tags question: http://stackoverflow.com/q/27147973

http://stackoverflow.com/a/27006185
type: Answer
score: 201
downvote count: 0
answers question: http://stackoverflow.com/q/27005861
has comment: http://stackoverflow.com/comment/113877318
upvote count: 201
has body: Based on VGR's comments here is what you can use: ChronoUnit.DAYS.between(firstDate, secondDate)

http://stackoverflow.com/comment/42767282
type: QuestionComment
has text: As far as i know you cannot do in it the method definition but you can do it in the body.
comment on: http://stackoverflow.com/q/27134432
score: 1
type: Comment

http://stackoverflow.com/a/27064708
type: Answer
accepted answer of: http://stackoverflow.com/q/27064340
answers question: http://stackoverflow.com/q/27064340
type: AcceptedAnswer
score: 0
has body: You can hide the navigation bar on Android 4.0 and higher using the SYSTEM_UI_FLAG_HIDE_NAVIGATION flag. This snippet hides both the navigation bar and the status bar: View decorView = getWindow().getDecorView(); // Hide both the navigation bar and the status bar. // SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as // a general rule, you should design your app to hide the status bar whenever you // hide the navigation bar. int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); For official documentation refer Hiding the Navigation Bar If you permanently want to hide navigation bar for Android 4.4+, which is actually called Immersive Full-Screen Mode, then you can try this snippet of code private int currentApiVersion; @Override @SuppressLint("NewApi") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currentApiVersion = android.os.Build.VERSION.SDK_INT; final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; // This work only for android 4.4+ if(currentApiVersion &gt;= Build.VERSION_CODES.KITKAT) { getWindow().getDecorView().setSystemUiVisibility(flags); // Code below is to handle presses of Volume up or Volume down. // Without this, after pressing volume buttons, the navigation bar will // show up and won't hide final View decorView = getWindow().getDecorView(); decorView .setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int visibility) { if((visibility &amp; View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { decorView.setSystemUiVisibility(flags); } } }); } } @SuppressLint("NewApi") @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFoc…

http://stackoverflow.com/a/27064591
answers question: http://stackoverflow.com/q/27064538
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Both solutions will almost certainly take exactly the same amount of memory, and no heap memory is involved here (GC is irrelevant). Even at the level of javac it can be easily determined when the local variable in your second case is out of scope (outside the for loop), and the location used for it can be reused for the other loop. At runtime the variable will probably be assigned to a register and, subject to many details of the actual code and the JVM implementation, the loop will be unrolled or transformed in other ways, making it almost impossible to even make sense of the concept of "memory usage" of that variable.
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27064538
has comment: http://stackoverflow.com/comment/42643018

http://stackoverflow.com/comment/42686650
score: 0
type: AnswerComment
has text: thank you this is exactly what i want. but this situation violates private access modifier. am i right
type: Comment
comment on: http://stackoverflow.com/a/27089456

struts2
tags question: http://stackoverflow.com/q/27049450
tags question: http://stackoverflow.com/q/27058830
tags question: http://stackoverflow.com/q/27044330
tags question: http://stackoverflow.com/q/27057150
tags question: http://stackoverflow.com/q/26998091
tags question: http://stackoverflow.com/q/27019240
tags question: http://stackoverflow.com/q/27061225
tags question: http://stackoverflow.com/q/27056030
tags question: http://stackoverflow.com/q/27107794
tags question: http://stackoverflow.com/q/27149042
tags question: http://stackoverflow.com/q/27056261
tags question: http://stackoverflow.com/q/27123296
tag name: struts2
tags question: http://stackoverflow.com/q/27147851
tags question: http://stackoverflow.com/q/27148322
tags question: http://stackoverflow.com/q/27145093
tags question: http://stackoverflow.com/q/27093545
tags question: http://stackoverflow.com/q/27141534
tags question: http://stackoverflow.com/q/27109474
tags question: http://stackoverflow.com/q/27060455
tags question: http://stackoverflow.com/q/27097322
tags question: http://stackoverflow.com/q/27039211
tags question: http://stackoverflow.com/q/27118263
tags question: http://stackoverflow.com/q/26992174
tags question: http://stackoverflow.com/q/27054623
tags question: http://stackoverflow.com/q/27129728
tags question: http://stackoverflow.com/q/27046861
tags question: http://stackoverflow.com/q/27084247
tags question: http://stackoverflow.com/q/27044978
tags question: http://stackoverflow.com/q/27098228
tags question: http://stackoverflow.com/q/27059938
type: Tag
tags question: http://stackoverflow.com/q/27117549
tags question: http://stackoverflow.com/q/27125680

http://stackoverflow.com/q/27016778
has answer: http://stackoverflow.com/a/27452380
has comment: http://stackoverflow.com/comment/43518646
has comment: http://stackoverflow.com/comment/42565788
has comment: http://stackoverflow.com/comment/43438028
tagged with: java
tagged with: hibernate
tagged with: orm
has comment: http://stackoverflow.com/comment/43519215
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/10082434
has answer: http://stackoverflow.com/a/27537607
has comment: http://stackoverflow.com/comment/43521349
has comment: http://stackoverflow.com/comment/42561866
linked to: http://stackoverflow.com/q/11221072
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/42561506
score: 4
has comment: http://stackoverflow.com/comment/43611958
has comment: http://stackoverflow.com/comment/43515856
has comment: http://stackoverflow.com/comment/42592799
has body: I have two entities mapped in my application in order to model a Team and its Members. A Team can have many Members and a Member can belong to no more than one Team. Everything is fine about handling this concepts. The problem comes when I try to move a Member from one existing Team to another. The entities are presented below, in simplified form. The very last method, transfer(), is the one that should perform the removal of a certain Member from its Team and send it to another one. @Entity public class Member extends Person { @ManyToOne private Team team; protected Member() { super(); } public Member(Team team, String name) { super(name); this.team = team; } // Trivial getters and setters... public Team getTeam() { return team; } protected void setTeam(Team team) { this.team = team; } } @Entity public class Team { @Id private long id; private String name; @OneToMany(mappedBy="team", cascade=CascadeType.ALL) private List&lt;Member&gt; members = new ArrayList&lt;Member&gt;(); protected Team() { } public Team(String name) { this.name = name; } // trivial getters and setters... public Member addMember(String name) { Member member = new Member(this, name); members.add(member); return member; } protected void addMember(Member member) { members.add(member); member.setTeam(this); } public void removeMember(Member member) { members.remove(member); } public Member memberByName(String memberName) { for(Member member : members) if(member.getName().equals(memberName)) return member; return null; } public Collection&lt;Members&gt; getMembers() { return Collections.unmodifiableCollection(members); } public void transfer(Member member, Team destination) { members.remove(member); destination.addMember(member); } } I have this unit test code that is intended to validate the transfer service Team teamA = teamRepository.teamById(idTeamA); Team teamB = teamRepository.teamById(idTeamB); Team teamC = teamRepository.teamById(idTeamC); Member zaki = teamA.memberByName("Zaki"); Member deni…
tagged with: hibernate-mapping
has answer: http://stackoverflow.com/a/27017199
has comment: http://stackoverflow.com/comment/43440544
has title: How to move items between collections in Hibernate
answer count: 4
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27444287

http://stackoverflow.com/comment/42548495
type: QuestionComment
comment on: http://stackoverflow.com/q/27010700
type: Comment
score: 1
has text: It looks like you tried to avoid this problem with `if (i+1 == 0) break`--but how can `i+1==0` ever be true? Was this a typo?

http://stackoverflow.com/a/27088435
has body: If you don't want to use JavaScript and you don't mind refreshing, then you can have your sizes as URL parameters, and have the controller refresh the current page with the appropriate product. Select a Size S M L XL In your controller: @RequestMapping(value = "/product", params = "size", method = RequestMethod.GET) public String getProduct(@RequestParam String size, Model model){ if ("s".equals(size)) { // add small product to model } else if ("m".equals(size)) { // add medium product to model } .... return "..."; } A better approach is to have the sizes inside a select tag in the form. The controller will get the size when the form is submitted, and insert the appropriate product accordingly.
has comment: http://stackoverflow.com/comment/42698656
accepted answer of: http://stackoverflow.com/q/27085866
answers question: http://stackoverflow.com/q/27085866
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27090042
accepted answer: http://stackoverflow.com/a/27294095
score: 7
favorite count: 0
tagged with: eclipse-luna
upvote count: 7
answer count: 1
linked to: http://stackoverflow.com/q/8229598
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/27294095
has body: I am trying to follow these instructions http://www.eclipse.org/tptp/home/documents/tutorials/profilingtool/profilingexample_32.html and eventually was led to this unresolved question: Adding Profiling and Logging perspective to Eclipse on RedHat I'm actually using Windows 7, but the issue is similar to the one reported above for Redhat. How to add Profiling And Logging perspective to Eclipse Luna?
downvote count: 0
linked to: http://stackoverflow.com/q/9731849
linked to: http://stackoverflow.com/q/25731711
has title: How to add Profiling And Logging perspective to Eclipse Luna?
type: Question
type: AnsweredQuestion
tagged with: profiling
tagged with: performance-testing

http://stackoverflow.com/a/27068812
has body: I found the solution to the problem. The timestamp was indeed correctly stored as milliseconds, however, I did not store the ts_resol option correctly in the interface header block. I simply stored a 32 bit aligned value (integer) as the option value. Which is wrong, as the specification states that the most significant bit determines the value of the timestamp resolution. The solution was thus to store the ts_resol value as a single byte and then add 3 extra bytes as padding to align the value to 32 bits. ts_resol before: 00 09 00 01 00 00 00 03 ts_resol after (solution): 00 09 00 01 03 00 00 00
type: Answer
accepted answer of: http://stackoverflow.com/q/27067971
score: 1
answers question: http://stackoverflow.com/q/27067971
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27068305
has comment: http://stackoverflow.com/comment/42650595
score: 1
upvote count: 1
has body: java is not the compiler, that's javac. Also, the compiler generates the same byte-code on 64-bit as it does on 32-bit. Assuming you are using pure Java, the only distinction is in the run-time (or JRE) where a 64-bit JRE can address more memory. If you have native code then you must match the settings those libraries were compiled with . But, in general, if you are on a 64-bit system with more then 4 gigabytes of memory, only a 64-bit JRE can use the extra memory.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27068243

http://stackoverflow.com/q/27074031
downvote count: 0
tagged with: eclipse-rcp
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/42662847
has comment: http://stackoverflow.com/comment/63695394
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/44136202
tagged with: java
has comment: http://stackoverflow.com/comment/42661973
has title: Menu bar not displaying in eclipse e4 on restore state
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42662380
type: Question
score: 5
has body: I am creating an RCP application using Eclipse 4.4.1 with the Compatibility Layer (migration from 3.x to 4.x). I have defined menus in the application model. Menus are displaying properly when the application is launched for the first time, but restarting the application is hiding the menu bar completely and only showing the toolbar. Why might no menus be displaying when the RCP Application is restored?
upvote count: 5

http://stackoverflow.com/a/27312666
has body: Answered in NavigationDrawer with Activities In short, there is no way to use Activitys while maintaining the Navigation Drawer, you will have to use Fragments.
accepted answer of: http://stackoverflow.com/q/27082999
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27082999

http://stackoverflow.com/a/27115177
upvote count: 1
answers question: http://stackoverflow.com/q/27115142
downvote count: 0
type: Answer
score: 1
has body: You could use BigDecimal or you could use formatted output like System.out.printf("%.2f%n", 4.6 - 0.2); Output is 4.40 Or, using BigDecimal BigDecimal bd = BigDecimal.valueOf(4.6); System.out.println(bd.subtract(BigDecimal.valueOf(0.2))); Output is 4.4

http://stackoverflow.com/a/27119562
score: 2
has comment: http://stackoverflow.com/comment/42740698
has comment: http://stackoverflow.com/comment/42740624
has comment: http://stackoverflow.com/comment/42740952
answers question: http://stackoverflow.com/q/27119527
has comment: http://stackoverflow.com/comment/42740805
has comment: http://stackoverflow.com/comment/42740741
has comment: http://stackoverflow.com/comment/42740792
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42741012
has comment: http://stackoverflow.com/comment/42740638
upvote count: 2
has body: Problem is your use of unescaped hyphen in the middle of character class. Use this instead: ^[a-zA-Z0-9@.#$%^&amp;*_&amp;\\\\-]+$ Hyphen when used in the middle of regex behaves like a range i.e. a-z or A-Z or 0-9 etc. In your regex is making a range of *-_. Between * and _ it will match characters like: :, ;, / etc. Look at this ascii chart for reference (it will match everything in this table): 42 * 43 + 44 , 45 - 46 . 47 / 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7 56 8 57 9 58 : 59 ; 60 &lt; 61 = 62 &gt; 63 ? 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W 88 X 89 Y 90 Z 91 [ 92 \ 93 ] 94 ^ 95 _ PS: Your regex can be shortened to: ^[\\w@.#$%^&amp;*&amp;\\\\-]+$
accepted answer of: http://stackoverflow.com/q/27119527
type: Answer
has comment: http://stackoverflow.com/comment/42740690
has comment: http://stackoverflow.com/comment/42740714
has comment: http://stackoverflow.com/comment/42740693
has comment: http://stackoverflow.com/comment/42740600

http://stackoverflow.com/comment/42557884
has text: I thought about that too but I think OP wants to listen for a mouse double-click to trigger the action. However you made me realize that implementation has several issues (asking the *model* for data using *view* indexes is one of them). I'm editing now. Thanks! @mKorbel
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27015908

replaceall
tags question: http://stackoverflow.com/q/27017017
type: Tag
tags question: http://stackoverflow.com/q/27143644
tags question: http://stackoverflow.com/q/26998442
tag name: replaceall

http://stackoverflow.com/q/27148614
score: 0
tagged with: junit
tagged with: dozer
has title: How do I turn off/change the log level of dozer during unit tests with standard java logging?
type: UnansweredQuestion
tagged with: logging
has answer: http://stackoverflow.com/a/27152085
tagged with: java
linked to: http://stackoverflow.com/q/2533227
type: Question
tagged with: testing
has body: We are using dozer, and every time a test runs it will create an instance of the dozer mapping (or so it looks, I'm not a hard core dozer guy). This gives a lot of junk in the console when running unit tests (see below). How do we turns this off? Completely off. We're using Maven as build tool, so a property file would be preferable. I have tried to load logging.properties without any luck (we're also using java.util.logging.Logger) I have tried to look at this (using programmatic approach), but we have many tests so added to all of them is close to impossible. Any tips/tricks is much appreciated! Example of the output - line numbers run into thousands, which makes the build slow: 2640 [main] INFO org.dozer.DozerBeanMapper - Trying to find xml mapping file: dozerServicesEjb/dozerBeanMapper.xml 2642 [main] INFO org.dozer.DozerBeanMapper - Using URL [file:/C:/development/core-services/services.ejb/target/classes/dozerServicesEjb/dozerBeanMapper.xml] to load custom xml mappings 2654 [main] INFO org.dozer.DozerBeanMapper - Successfully loaded custom xml mappings from URL: [file:/C:/development/core-services/services.ejb/target/classes/dozerServicesEjb/dozerBeanMapper.xml] 2654 [main] INFO org.dozer.DozerBeanMapper - Trying to find xml mapping file: dozerServicesEjb/AccountArrangementMapping.xml 2655 [main] INFO org.dozer.DozerBeanMapper - Using URL [file:/C:/development/core-services/services.ejb/target/classes/dozerServicesEjb/AccountArrangementMapping.xml] to load custom xml mappings 2683 [main] INFO org.dozer.DozerBeanMapper - Successfully loaded custom xml mappings from URL: [file:/C:/development/core-services/services.ejb/target/classes/dozerServicesEjb/AccountArrangementMapping.xml] 2684 [main] INFO org.dozer.DozerBeanMapper - Trying to find xml mapping file: dozerServicesEjb/AddressMapping.xml 2685 [main] INFO org.dozer.DozerBeanMapper - Using URL [file:/C:/development/core-services/services.ejb/target/classes/dozerServicesEjb/AddressMapping.xml] to load custom x…
answer count: 1

http://stackoverflow.com/a/27152007
type: Answer
has comment: http://stackoverflow.com/comment/43017930
answers question: http://stackoverflow.com/q/27151867
has comment: http://stackoverflow.com/comment/42799047
has comment: http://stackoverflow.com/comment/42824186
has comment: http://stackoverflow.com/comment/42821296
has comment: http://stackoverflow.com/comment/42824323
has body: You should enable remote debugging using &lt;java&gt; tag. &lt;java ....&gt; &lt;jvmarg value="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5555"/&gt; &lt;/java&gt; Now run your ant script. It will start java process and wait until you connect with your debugger to porr 5555. If you do not want to wait change suspend=y to suspend=n.
has comment: http://stackoverflow.com/comment/42824805
has comment: http://stackoverflow.com/comment/43005863
has comment: http://stackoverflow.com/comment/42824007
has comment: http://stackoverflow.com/comment/42798820
has comment: http://stackoverflow.com/comment/43006002
has comment: http://stackoverflow.com/comment/43018492
has comment: http://stackoverflow.com/comment/42798874
score: 2
has comment: http://stackoverflow.com/comment/42824056
downvote count: 0
has comment: http://stackoverflow.com/comment/43006316
has comment: http://stackoverflow.com/comment/43004799
has comment: http://stackoverflow.com/comment/43005086
upvote count: 2

http://stackoverflow.com/q/27038134
has answer: http://stackoverflow.com/a/27040485
has answer: http://stackoverflow.com/a/27039213
has title: Unable to build entity manager factory
type: UnansweredQuestion
tagged with: glassfish-4
has body: I create a maven web project. I want to use JPA/Hibernate in this project. I created the database already. I make JPA configuration with new persistence unit and create entity class I receive an error when insert transaction for test error message Warning: #{test.insert()}: javax.persistence.PersistenceException: Unable to build entity manager factory javax.faces.FacesException: #{test.insert()}: javax.persistence.PersistenceException: Unable to build entity manager factory at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) at javax.faces.component.UICommand.broadcast(UICommand.java:315) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:205) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPi…
has comment: http://stackoverflow.com/comment/42600555
has comment: http://stackoverflow.com/comment/42596374
score: 0
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42597533
tagged with: jpa

http://stackoverflow.com/comment/42711119
has text: @Pablo Can you help me take a look and pin point the part where I did wrongly?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27103015

http://stackoverflow.com/a/27001412
score: 0
has comment: http://stackoverflow.com/comment/42541636
has comment: http://stackoverflow.com/comment/42533658
answers question: http://stackoverflow.com/q/27001199
has body: Use an boolean array to indicate that those positions can be occupied by a person. In order to do this, you have to change your printing method. You have to use a code like: // You must set canSeat at your will (true and false). public static void print(int[][] seatArray, Boolean canSeat[][]) { for(i = 0; i &lt; 10; i++) { for(x = 0; x &lt; 7; x++) { if(canSeat[i][x]) System.out.print(seatArray[i][x]); else System.out.print(" "); System.out.print(" \t"); } } }
has comment: http://stackoverflow.com/comment/42534615
type: Answer
has comment: http://stackoverflow.com/comment/42533477
has comment: http://stackoverflow.com/comment/42533166

http://stackoverflow.com/q/27080357
has comment: http://stackoverflow.com/comment/42670464
has title: Different calculation outcome in JavaScript than in Java
has comment: http://stackoverflow.com/comment/42670527
answer count: 3
score: 3
has comment: http://stackoverflow.com/comment/42670475
favorite count: 0
has answer: http://stackoverflow.com/a/27080434
has answer: http://stackoverflow.com/a/27087184
linked to: http://stackoverflow.com/q/3428136
has comment: http://stackoverflow.com/comment/42670519
possible better answer: http://stackoverflow.com/a/27080434
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27087184
tagged with: math
tagged with: java
has body: I've a problem with large numbers I think. The calculation in Java: int n = 4451 + 554 * 57; n = n &lt;&lt; 13 ^ n; System.out.println(n * (n * n * 15731 + 789221) + 1376312589); =&gt; 587046333 In JavaScript: var n = 4451 + 554 * 57; n = n &lt;&lt; 13 ^ n; console.log(n * (n * n * 15731 + 789221) + 1376312589); =&gt; 4.043454188561781e+29 What is the problem in the JavaScript version and how can I fix it, so that the outcome of JavaScript is identical to the Java outcome? EDIT: tried with: https://github.com/jtobey/javascript-bignum, but outcome is 0 var test = new BigInteger(295120061).multiply( new BigInteger(295120061) .multiply(new BigInteger(295120061)) .multiply(new BigInteger(15731)) .add(new BigInteger(789221))) .add(new BigInteger(1376312589)); => test = 0
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27080935
tagged with: javascript

http://stackoverflow.com/comment/42628751
comment on: http://stackoverflow.com/q/27056539
has text: [How to Use Formatted Text Fields](http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html). Remember, `JFormattedTextField` is post validate, that it's it doesn't do real time validation of the input
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/a/70110818
downvote count: 0
score: 1
upvote count: 1
has body: For the record, the Eclipse compiler of Eclipse 2021-09 (4.21.0) still seems to have this (or a very similar) bug, which I've reported here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=577466 So, if you're developing with Eclipse, it might be this error still persists when developing (using the Eclipse compiler), even when at build time, it is absent (using javac via Maven or Gradle, etc.).
answers question: http://stackoverflow.com/q/27031244
type: Answer

http://stackoverflow.com/a/27070185
has body: All your methods are marked as void. That means the have no return value. One might say, they are procedures, not functions. If you want to return a List, you have to change the signature: public static List AddPatient() Then you can return your list from the method using keyword return. return patient; The parameters in brackets () are all input parameters. This is a very basic concept of methods/functions. I suggest reading a book for begginers to understand the fundamentals of Java. Also Java has it's own general-purpose implementation of linked list. You should use it, if you don't have any special requirements for it's implementation.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27069486

http://stackoverflow.com/comment/42785251
type: AnswerComment
comment on: http://stackoverflow.com/a/27105123
type: Comment
has text: @D4rWiNS I can't reply to the solution you posted for some reason, so I'll do it here: If it works, that's good! GL_PROJECTION is generally used for transforming the camera, whereas GL_MODELVIEW is used for transforming the objects on screen. I only just read it, so I feel silly myself too. Good luck in your future endeavours!
score: 1

http://stackoverflow.com/q/27113877
has answer: http://stackoverflow.com/a/27114431
answer count: 1
linked to: http://stackoverflow.com/q/1143293
has comment: http://stackoverflow.com/comment/42730867
favorite count: 0
has title: convert byte to image
upvote count: 3
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42730725
accepted answer: http://stackoverflow.com/a/27114431
has comment: http://stackoverflow.com/comment/42731035
tagged with: java
has comment: http://stackoverflow.com/comment/42730648
has body: why bImageFromConvert is getting null even o has data ? BufferedImage img = null; byte[] s; ArrayList&lt;Byte&gt; f; InputStream in; BufferedImage bImageFromConvert; public void print(ArrayList&lt;Byte&gt; lst) throws IOException { byte[] o = new byte[lst.size()]; for (int i = 0; i &lt; lst.size(); i++) { o[i] = lst.get(i); } in = new ByteArrayInputStream(o); bImageFromConvert = ImageIO.read(in);
tagged with: image
has comment: http://stackoverflow.com/comment/42730564
type: Question
has comment: http://stackoverflow.com/comment/42731170
downvote count: 0

http://stackoverflow.com/comment/42793352
comment on: http://stackoverflow.com/a/27149279
score: 0
type: Comment
has text: First, I am not *updating* the `EditText`. Second, I did try to do it in `onPreExecute` which did not solve this. Please see the Edit in the question, am I still missing it?
type: AnswerComment

http://stackoverflow.com/comment/42709769
type: QuestionComment
comment on: http://stackoverflow.com/q/27102805
has text: Yes, yes indeed it is. (would the IP address work if it wasn't?)
score: 0
type: Comment

http://stackoverflow.com/comment/42721935
type: Comment
comment on: http://stackoverflow.com/a/27108213
score: 1
type: AnswerComment
has text: See my comment on the question itself, although this is probably the solution, it is not according to specification: the call escape should also be supported on `Statement` and `PreparedStatement`. See: section 6.4 of JDBC 4.2 and http://mail.openjdk.java.net/pipermail/jdbc-spec-discuss/2013-January/000030.html

http://stackoverflow.com/q/27010898
tagged with: android
has comment: http://stackoverflow.com/comment/42548749
has body: I'm use the dependencies by compile 'org.apache.httpcomponents:httpmime:4.3.5' compile 'org.apache.httpcomponents:httpclient-android:4.3.5'` then build it there is error Error:Gradle: Execution failed for task ':XmppDemo:packageDebug'. Duplicate files copied in APK META-INF/NOTICE File 1: E:\develop\gradle.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient-android\4.3.5\82edcaec6c7b4599eaeaaf11167ceea41db42f33\httpclient-android-4.3.5.jar File 2: E:\develop\gradle.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient-android\4.3.5\82edcaec6c7b4599eaeaaf11167ceea41db42f33\httpclient-android-4.3.5.jar can you help me explain the reason. excuse me! i'm Chinese,my English is not good.
accepted answer: http://stackoverflow.com/a/27010971
upvote count: 1
tagged with: gradle
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27010971
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has title: my android project dependence the httpclient and httpMime can't build

http://stackoverflow.com/comment/42684190
has text: I think I get it. Since it's a library and not an application it is not launched as a separate application so it doesn't need main class. Its classes are used as a dependency for other classes. Could that be true?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27088127

http://stackoverflow.com/comment/42830987
type: QuestionComment
has text: You might be using a loop, so the action is getting repeated or else you might have written the code for clicking on the button twice (Human error, happens to most of us :) ). Either way, unless you post the code snippet, it will not be possible to help you out.
comment on: http://stackoverflow.com/q/27110169
score: 0
type: Comment

http://stackoverflow.com/comment/42623165
has text: Or "How to make a Minesweeper game in Java" http://zetcode.com/tutorials/javagamestutorial/minesweeper/
comment on: http://stackoverflow.com/q/27052710
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27110484
downvote count: 0
answers question: http://stackoverflow.com/q/27110395
score: 1
has comment: http://stackoverflow.com/comment/42724127
upvote count: 1
has body: I don't think that is possible. Anyways, if C does not relate to B, but to A, why does C extend B in the first place? You could also try and create some protected method in A that could be called from both A's and C's constructors. If you could try and describe what you're trying to model, maybe some alternative hierarchy would be more suitable.
type: Answer

http://stackoverflow.com/a/27072336
has body: Ok, fellow... Heres what you need: public class MyVectorInsertingLel{ private static Object[] objects; private static int n; public static void main(String []args){ MyVectorInsertingLel v = new MyVectorInsertingLel(10); v.insertObject("c"); } public MyVectorInsertingLel(int initialHeap) { n = 0; objects = new Object[initialHeap]; } public void insertObject(Object obj) { n++; if (n &gt; objects.length) { Object[] temp = objects.clone(); objects = new Object[objects.length*2]; System.arraycopy(temp, 0, objects, 0, temp.length); } objects[n] = obj; } } "insert elements into a vector-based array" - Vector-based understood as extendable... As you didnt say "remove" or anything else, no reason to be mad :3 Really. This is an answer!
answers question: http://stackoverflow.com/q/27071596
type: Answer
has comment: http://stackoverflow.com/comment/42658150
has comment: http://stackoverflow.com/comment/42657282
score: 0

http://stackoverflow.com/comment/42686639
type: QuestionComment
score: 3
has text: Have you done any research? I.e. check the kivy site documentation or anything
comment on: http://stackoverflow.com/q/27089754
type: Comment

http://stackoverflow.com/comment/42826299
comment on: http://stackoverflow.com/q/27151125
score: 0
type: Comment
type: QuestionComment
has text: You might also try to overwrite the save() method on SimpleJpaRepository directly. You would then need to change the spring internal wiring in order for your extension being used in place of SimpleJpaRepository. Note that tinkering with SimpleJpaRepository is not the official/ supported way of doing things and might - or might not - have some side effects.

http://stackoverflow.com/a/29770579
downvote count: 0
has comment: http://stackoverflow.com/comment/52620077
has comment: http://stackoverflow.com/comment/47811179
has comment: http://stackoverflow.com/comment/47811653
has body: We have exactly the same Setup here: WAS 8.0.0.9 log4j for logging EAR containing jcl-over-slf4j, slf4j and slf4j-log4j Axis 1.4 Classloader policy Parent Last and WAR policy Single class loader for application As soon as axis-classes are loaded, some static-initializer-block gets executed and we get this Exception: DiscoveryException: Class org.apache.commons.logging.impl.LogFactoryImpl does not implement org.apache.commons.logging.LogFactory It seems like org.apache.commons.logging.LogFactory is loaded from jcl-over-slf4j and org.apache.commons.logging.impl.LogFactoryImpl is provided by WebSphere. The only way it works for us, is to remove jcl-over-slf4j.jar from our EAR. Of course this way we might lose some Logs or find them in WebSphere SystemOut.log but at least 'it works'...
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27065647
score: 2

http://stackoverflow.com/comment/42582904
score: 0
type: Comment
has text: Thank you! It is listed in the download page of junit, I can't believe I missed it..
comment on: http://stackoverflow.com/a/27029536
type: AnswerComment

paint
tags question: http://stackoverflow.com/q/27104086
tags question: http://stackoverflow.com/q/27130472
tags question: http://stackoverflow.com/q/27005695
tags question: http://stackoverflow.com/q/27078002
tag name: paint
tags question: http://stackoverflow.com/q/27018791
tags question: http://stackoverflow.com/q/27041010
type: Tag

http://stackoverflow.com/comment/42709608
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27102659
has text: `node.add(subElements(reader, subNode));` does not look like it is dropping references to me.
type: Comment

http://stackoverflow.com/comment/42661911
type: QuestionComment
comment on: http://stackoverflow.com/q/27075290
score: 0
has text: possible duplicate of [unnecessary to put super() in constructor?](http://stackoverflow.com/questions/2054022/unnecessary-to-put-super-in-constructor)
type: Comment

http://stackoverflow.com/q/27067356
tagged with: swing
type: Question
tagged with: java
score: 0
answer count: 1
has title: how to pass from combobox value to
tagged with: combobox
has answer: http://stackoverflow.com/a/27067488
tagged with: jcombobox
type: AnsweredQuestion
has body: Somehow I managed to make that id isn't shown in the combobox, but then how to make that when I press the button ok I could get the id value? Using String from = (String) jComboBox1.getSelectedItem(); when the button is pressed doesn't work. I get String code = (String) item.getValue(); the id I needed, but how do I pass it to the next query? public void select() { try { String sql = "select * from category"; pst = con.prepareStatement(sql); rs = pst.executeQuery(); while (rs.next()) { jComboBox1.addItem(new Item&lt;String&gt;(rs.getString("mkid"), rs.getString("name"))); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } jComboBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox jComboBox1 = (JComboBox) e.getSource(); Item item = (Item) jComboBox1.getSelectedItem(); String code = (String) item.getValue(); System.out.println(code); } }); } The item public class Item&lt;V&gt; implements Comparable&lt;Item&gt; { private V value; private String description; public Item(V value, String description) { this.value = value; this.description = description; } public V getValue() { return value; } public String getDescription() { return description; } public int compareTo(Item item) { return getDescription().compareTo(item.getDescription()); } @Override public boolean equals(Object object) { Item item = (Item)object; return value.equals(item.getValue()); } @Override public int hashCode() { return value.hashCode(); } @Override public String toString() { return description; }
accepted answer: http://stackoverflow.com/a/27067488

http://stackoverflow.com/q/27027594
has body: Good day. This is my second roadblock in my path to Learning Android Development. Well, what I am trying to do now, is basically trying to call a method from another project which I have already added as a reference project. Consider example below (IDE is Eclipse): I have two projects with classes called ProjectA and ProjectB ProjectB has a method called showToast() whose job is only to show a toast. I already added ProjectB as reference to ProjectA via Project > Properties > Java Build Path > Projects In ProjectA, I instantiated ProjectB's class: ProjectB project_b = new ProjectB(); Then I tried calling the method: project_b.showToast(); Any thoughts guys? - Could not find class 'com.androidexample.test.ProjectB', referenced from method com.example.testproject.MainActivity.&lt;init&gt;
has comment: http://stackoverflow.com/comment/42578749
has comment: http://stackoverflow.com/comment/42578363
score: 0
type: UnansweredQuestion
tagged with: android
has title: Android / Java : Unable to find class/method from another project (already referenced)
answer count: 0
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/27018239
tagged with: java
has answer: http://stackoverflow.com/a/27018723
type: Question
has title: How to check the data type exchanged over UDP connection
has body: Is there a way to determine the data type being exchanged from a client to the server? Here is a code example of how I think my answer should look like: byte[] dataBook = new byte[1024]; DatagramPacket packetR = new DatagramPacket(dataBook, dataBook.length); dS.receive(packetR); // the following is psuedo code if (packetR.getData() is off data type String) { // do code here } if (packetR.getdata() is off data type File) { // do diff code here }
score: 0
tagged with: udp
has comment: http://stackoverflow.com/comment/42561900
answer count: 1
tagged with: sockets
accepted answer: http://stackoverflow.com/a/27018723
type: AnsweredQuestion

http://stackoverflow.com/a/27057048
has body: I suggest you to create your own class for this, similar to this class Matrix{ int rows int cols List&lt;MatrixElement&gt; elements; //some methods like getCols(), getRows() } class MatrixElement{ int row int col double value //some methods like boolean isNeighbourOf(MatrixElement other) etc whatever you need } Such thing is quite easy to implement and gives you all the flexibility you need when using
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27056799
score: 1

http://stackoverflow.com/comment/42713425
type: AnswerComment
has text: timestr is already string type and I have written fixed date as fixedDate.toString() as you said.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27104776

http://stackoverflow.com/q/27072842
downvote count: 3
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27073284
has comment: http://stackoverflow.com/comment/42657813
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/42657804
upvote count: 0
has comment: http://stackoverflow.com/comment/42657776
has comment: http://stackoverflow.com/comment/42658048
has body: So the question is what the title says. How can i store passwords safely so i can read and write to them but also other people cannot edit the files (with java)? FTP clearly wont work because you have to say the password.
tagged with: java
tagged with: file
has title: How do you save passwords safely on a server for a game?
has comment: http://stackoverflow.com/comment/42657748
type: Question
has comment: http://stackoverflow.com/comment/42657807

http://stackoverflow.com/a/27009140
has body: It sounds like you should not write the record id into the web form, but instead, save it in the user's session on the server. Use request.getSession().setAttribute(name, value); to set it, and request.getSession().getAttribute(name); to read it. That way, it can't be tampered with. If instead you need to allow multiple forms (and records) with a single session, you might track them in a set attached to the session.
answers question: http://stackoverflow.com/q/27008051
has comment: http://stackoverflow.com/comment/42557016
score: 0
type: Answer

http://stackoverflow.com/q/27144566
type: AnsweredQuestion
has title: JDK 8-java.lang.ClassNotFoundException: sunw.io.Serializable
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42785527
has comment: http://stackoverflow.com/comment/42785670
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27144703
favorite count: 0
has comment: http://stackoverflow.com/comment/42785593
has comment: http://stackoverflow.com/comment/42785182
has answer: http://stackoverflow.com/a/27144703
has comment: http://stackoverflow.com/comment/42785546
has body: When I try to run my java class I am getting below error message but same is working fine in JDK 1.7. Newly I have installed JDK 8 after that I am getting below Error. How to solve this problem? Some related files cannot be found : java.lang.NoClassDefFoundError: sunw/io/Serializable I am loading my class file using Class inv = Class.forName(ClassName); Exception: Caused by: java.lang.ClassNotFoundException: sunw.io.Serializable 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)
downvote count: 2
upvote count: 1

http://stackoverflow.com/q/27124664
favorite count: 0
accepted answer: http://stackoverflow.com/a/27130644
answer count: 1
upvote count: 2
has body: I'm trying to implement a business functionality which uses Coherence transient caches. One of the features I was planning to depend upon is auto-eviction of cache entries, when providing a (configurable) time-to-live at the time of putting an item in the cache. The interface NamedCache provides an API to achieve this (http://download.oracle.com/otn_hosted_doc/coherence/330/com/tangosol/net/NamedCache.html#put(java.lang.Object, java.lang.Object, long)). However, I'm also planning to use Entry-Processors to ensure effective concurrency across the cluster. I'm stuck at a point now where, within the scope of the processor, I'm supposed to work with InvocableMap.Entry to get/set values with a key in the cache. Unfortunately, there is no setValue method which lets me specify the time-to-live value. I'm assuming here that interfacing directly with the NamedCache reference inside the EntryProcessor's process method will not be a good idea, and will compromise the concurrency guarantees which EntryProcessor provides. Can you please share your thoughts on what could be the best way to get an entry evicted after a certain amount of time (which is dynamically decided), while ensuring optimal concurrency across a cluster of nodes? I'm not completely hung up on using the auto-eviction functionality. However, if I were to abandon that, I may have to rely upon a timer-based programmatic removal of the entry, which works reliably across a cluster. Again, I'm falling short of ideas on this one. Ideally, I would want Coherence to deal with this. Many thanks in advance. Best regards, - Aditya
tagged with: oracle-coherence
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27130644
tagged with: java
tagged with: concurrency
tagged with: caching
type: Question
downvote count: 0
has title: Coherence EntryProcessor query

http://stackoverflow.com/comment/42740600
has text: Very nice breakdown of the ASCII chart. I would also like to point out the doubled up \\.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27119562
type: AnswerComment

http://stackoverflow.com/comment/42538809
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27004647
has text: @elephont something like `public Node<T> getNext() { return next; }` - that's not what the issue is.
score: 0

http://stackoverflow.com/comment/42624534
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27020702
has text: It very useful when you are using OAuth2 for pure client side (JS) web app or mobile app and you'll need difference token for each session. That's what Google done with their APIs
score: 1

http://stackoverflow.com/q/27093205
has title: Android: java.lang.OutOfMemoryError, when i try to set image view programmatically
score: 0
answer count: 1
tagged with: android-image
has answer: http://stackoverflow.com/a/27093242
has comment: http://stackoverflow.com/comment/42692317
type: UnansweredQuestion
tagged with: android
has body: I have the below code, which sets some texts and loads images. Code: private void buidAndroidComponentsFromRandom(int localVarRandomChoice){ switch(localVarRandomChoice){ case 0: /* American food */ titleForRandom = (TextView) findViewById(R.id.title); logoForRandom = (ImageView) findViewById(R.id.imageView1); addressForRandom = (TextView) findViewById(R.id.button_text); foodImageForRandom = (ImageView) findViewById(R.id.numberDays); foodDescForRandom = (TextView) findViewById(R.id.foodDesc); titleForRandom.setText("How about Subway?"); logoForRandom.setImageResource(R.drawable.subway); addressForRandom.setText("Coffman Union\n3rd Floor\nWest bank"); foodImageForRandom.setImageResource(R.drawable.sandwish); foodDescForRandom.setText("Fish Sandich\n$5"); case 1: /* Cafe */ titleForRandom = (TextView) findViewById(R.id.title); logoForRandom = (ImageView) findViewById(R.id.imageView1); addressForRandom = (TextView) findViewById(R.id.button_text); foodImageForRandom = (ImageView) findViewById(R.id.numberDays); foodDescForRandom = (TextView) findViewById(R.id.foodDesc); titleForRandom.setText("How about Caribou Cafe?"); logoForRandom.setImageResource(R.drawable.cariboulogo); addressForRandom.setText("Coffman Union\n3rd Floor\nWest bank"); foodImageForRandom.setImageResource(R.drawable.cariboufood); foodDescForRandom.setText("Fish Sandich\n$5"); case 2: /* Chinese */ titleForRandom = (TextView) findViewById(R.id.title); logoForRandom = (ImageView) findViewById(R.id.imageView1); addressForRandom = (TextView) findViewById(R.id.button_text); foodImageForRandom = (ImageView) findViewById(R.id.numberDays); foodDescForRandom = (TextView) findViewById(R.id.foodDesc); titleForRandom.setText("How about Panda Express?"); logoForRandom.setImageResource(R.drawable.pandaexpresslogo); addressForRandom.setText("Coffman Union\n3rd Floor\nWest bank"); foodImageForRandom.setImageResource(R.drawable.pandaexpressfood); foodDescForRandom.setText("Fish Sandich\n$5"); case 3: /* Italian */ titl…
tagged with: java
type: Question

http://stackoverflow.com/q/27065265
downvote count: 1
duplicate of: http://stackoverflow.com/q/11459543
tagged with: java
type: Question
has title: Methods that don't change a variable's value need to be synchronized if they accessed the variable
favorite count: 0
tagged with: synchronization
tagged with: synchronized
has body: From page 231 of OCP Java SE 6 Programmer Practice Exams, question 56: public class Buffalo { protected int y; public int getY() { return y; } public void setY(int newY) { y = newY; } } Which methods need to be synchronized to make the class thread safe? And the book says that the correct answer is - all of them: Even methods that don't change a variable's value need to be synchronized if they accessed the variable. Why I need to synchronize getY()? It's not changing the state, so it can't cause any synchronization problems, isn't it?
has comment: http://stackoverflow.com/comment/42644215
score: 2
answer count: 0
tagged with: scjp
has comment: http://stackoverflow.com/comment/42644129
linked to: http://stackoverflow.com/q/11459543
upvote count: 3
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/42673987
type: Comment
type: QuestionComment
has text: energizer: The model will not be used by DTO but can you suggest how to initialize the model class without being declared as a @component...
comment on: http://stackoverflow.com/q/27081472
score: 0

http://stackoverflow.com/comment/42827178
comment on: http://stackoverflow.com/q/27149890
has text: thanks Serdar, there is no proxy in my network. I am not sure how to get the response, all I get it org.jsoup.helper.HttpConnection$Response@13491349
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26997403
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42526643
downvote count: 0
score: 1
tagged with: java
has title: Importing java class to jsp causing cannot be resolved to a type error
type: Question
has body: JSP code: &lt;%@ page import = "action.LoginCheckAction" %&gt; &lt;% String username = request.getParameter("username"); String password = request.getParameter("password"); LoginCheckAction ls = new LoginCheckAction(); ls.printSomething(username); %&gt; Java class: package action; public class LoginCheckAction{ public LoginCheckAction(){ super(); } public void printSomething(String username){ System.out.println(username); } } Another JSP file is sending post data to the JSP code posted here. I am trying to use the method available in my Java file that is located in another directory, inside the package action, however it keeps giving me a LoginCheckAction cannot be resolved to a type. I tried importing action.* instead, and it did not work. Can anyone please explain what the problem is?
tagged with: jsp
upvote count: 1
accepted answer: http://stackoverflow.com/a/26997580
possible better answer: http://stackoverflow.com/a/26997576
favorite count: 0
has answer: http://stackoverflow.com/a/26997576
has answer: http://stackoverflow.com/a/33545566
has answer: http://stackoverflow.com/a/26997580
has answer: http://stackoverflow.com/a/33545515
answer count: 4

http://stackoverflow.com/q/27084284
has body: For my java class in college, I need to read a text file that holds the scores of a golf game and add them together to reach a total. I can scan the first column of the file fine, but I cannot figure out how to read the integers in the second, third, etc. column(s). Here is the pertinent Method: public static int Total(int passed, String fileName) throws IOException { int total = 0; Scanner fileScan = new Scanner(new File(fileName)); for (int line = 1; line &lt;= 18; line++) { for(int col = passed; col == passed; col++) { total += fileScan.nextInt(); } } return total; } //End of Total Method
type: Question
has comment: http://stackoverflow.com/comment/42677638
has comment: http://stackoverflow.com/comment/49586427
tagged with: java-io
score: 0
has title: Using scanner to get integers from a file
tagged with: java.util.scanner
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9084040
tagged with: java

http://stackoverflow.com/a/27013647
score: 0
answers question: http://stackoverflow.com/q/27012147
type: Answer
has body: To add the Android Support Library to an existing Android Project: Right click on your project Select Android Tools Select Add Support Library. Usually even after you add through SDK manager,you have to individually add in this process.This will set up the jar files needed.
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/27055554
answers question: http://stackoverflow.com/q/27055503
has body: Use instanceof operator instead of using Class.equals() that is better way. Use single instanceof for Number that is super class of Integer and Double. Here is sample code: double total=0; int count=0; for(Object obj:list){ if(obj instanceof Number){ total+=((Number)obj).doubleValue(); count++; } } double average=total/count;
has comment: http://stackoverflow.com/comment/42627298
type: Answer
score: 0

http://stackoverflow.com/q/27035797
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27037156
has body: We are planning to develop Spring Application. In our servers JDK version is 1.5(it cannot be changes as there are so many other applications running on the same server). I am planning to use Spring core , MVC modules.SO can any one suggest which version of spring is suitable for JDK 1.5.And also suggest which version of Hibernate is suitable for the selected spring version. Thanks in Advance, Rajesh
upvote count: 1
tagged with: spring
has title: spring framework jdk compatibility
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27037156
score: 1
tagged with: java
tagged with: hibernate
type: Question
linked to: http://stackoverflow.com/q/9346408
tagged with: compatibility
has comment: http://stackoverflow.com/comment/42592186

http://stackoverflow.com/a/27092142
upvote count: 1
has body: There is 3 main ways to communicate with the UI thread : Activity.runOnUiThread(Runnable) View.post(Runnable) Handlers In your case, I advice you to create an Handler, as the 2 first solutions imply that you have a reference on your Activity or a View Edit If you want to use any thread in your app, just make sure a Looper has been set, and use an associated Handler class YourLooperThread extends Thread { // make it accessible from the outside private Handler handler; @Override public void run() { Looper.prepare(); // Customize your handler, it has to be used in any thread which want to push a message in this thread's looper message Queue handler = new Handler(); Looper.loop(); } } Be careful : all the other tasks you want to do in that thread must be done through the message queue, i.e posting a runnable in the handler. More information here : Handlers, MessageQueue, Looper, do they all run on the UI thread?
has comment: http://stackoverflow.com/comment/42707403
has comment: http://stackoverflow.com/comment/42707666
accepted answer of: http://stackoverflow.com/q/27088175
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27088175
has comment: http://stackoverflow.com/comment/42693520
type: Answer
score: 1

http://stackoverflow.com/comment/42793376
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27149085
has text: So codereview would be better? I didn't post it there because the code is far from complete or real. The question is which of the two implementations are the better to use? Or perhaps if there is a 3rd one which I don't know about.
score: 0

http://stackoverflow.com/a/26999495
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26993203
answers question: http://stackoverflow.com/q/26993203
type: Answer
has body: This is a bit hacky but could be used as a method to deserialize the string. Serialization would be done with Gson.toJson(map). final Map&lt;String, List&lt;Double&gt;&gt; map = new Gson().fromJson("{\"[1,2,3,5]\"=[4,5,6]}", Map.class); final Map&lt;List&lt;Long&gt;, List&lt;Long&gt;&gt; result = Maps.newHashMap(); for (final Map.Entry&lt;String, List&lt;Double&gt;&gt; entry : map.entrySet()) { final List&lt;Long&gt; value = Lists.newArrayList(); for (final Double number : entry.getValue()) { value.add(number.longValue()); } final List&lt;Double&gt; rawKey = new Gson().fromJson(entry.getKey(), List.class); final List&lt;Long&gt; key = Lists.newArrayList(); for (final Double number : rawKey) { key.add(number.longValue()); } result.put(key, value); } System.out.println(result);
downvote count: 0
score: 1

http://stackoverflow.com/a/27076080
accepted answer of: http://stackoverflow.com/q/27057150
answers question: http://stackoverflow.com/q/27057150
type: Answer
score: 1
has body: String "str" have Json message who extract json in action using key value pair example to more understanding... JSONObject json = new JSONObject(str); rec_id = json.getInt("receptionist_id"); tag_id = json.getInt("tag_id");
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27029269
has answer: http://stackoverflow.com/a/27029310
has comment: http://stackoverflow.com/comment/42581223
has comment: http://stackoverflow.com/comment/42581263
possible better answer: http://stackoverflow.com/a/27029310
accepted answer: http://stackoverflow.com/a/27029301
type: AnsweredQuestion
has title: program only read last line in .txt file java
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27029301
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42581280
has body: I have a problem and don't know what to do. This method is supposed to read all the text in a .txt document. My problem is when the document contains more then one line of text and the program only read the last line. The program don't need to worry about signs like . , : or spaces, but it have to read all the letters. Can anybody help me? example text hello my name is (returns the right result) hello my name is (returns only name is) private Scanner x; String readFile(String fileName) { try { x = new Scanner (new File(fileName + (".txt"))); } catch (Exception e) { System.out.println("cant open file"); } while (x.hasNext()) { read = x.next(); } return read; }

http://stackoverflow.com/comment/42575563
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27026107
has text: No, it wouldn't. Did you try it? (The argument only applies when you first open the file. You're only opening it once...)
score: 0

http://stackoverflow.com/comment/42717694
comment on: http://stackoverflow.com/q/27107174
type: QuestionComment
type: Comment
has text: In Java an array has a `length` attribute. No need to pass the size.
score: 1

http://stackoverflow.com/comment/42672831
has text: I just found an issue. I had two main methods in the same package. Question though. How would I use the code I have here in a class and not in a main method. I need to sort the txt file and put it into an array list.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27081440
score: 0

http://stackoverflow.com/q/27014420
type: UnansweredQuestion
downvote count: 2
tagged with: numbers
has answer: http://stackoverflow.com/a/27014514
tagged with: java
has answer: http://stackoverflow.com/a/27014464
has comment: http://stackoverflow.com/comment/42554720
linked to: http://stackoverflow.com/q/363681
type: Question
upvote count: 0
score: -2
answer count: 2
tagged with: random
has title: How to generate random numbers?
has body: How do I write a program in java to generate random numbers between 1 and 2 ? Do I need to use for-loop or math.random ?? Is there any calculations that needs to be done before writing the code ?
favorite count: 0
has comment: http://stackoverflow.com/comment/42554596
linked to: http://stackoverflow.com/q/9723765

http://stackoverflow.com/comment/42665934
comment on: http://stackoverflow.com/q/27077796
score: 0
type: Comment
type: QuestionComment
has text: You need to quote (Pattern.quote) the first argument of replaceAll, as it is a regex.

http://stackoverflow.com/comment/114518784
type: Comment
comment on: http://stackoverflow.com/a/44416761
type: AnswerComment
has text: In case anybody is interested in a bit of extra performance (like I needed), I used this in the loop to shave about 40% of the time ```boolean[] boolArray = new boolean[n]; long mask = 1; for (int j = 0; j < n; j++) { boolArray[j] = (i & mask) > 0; mask <<= 1; }``` (Oh, do note that I used longs instead of ints or bigintegers, this means it will work for n <= 63, also the speed comparison was compared to the example using integers and strings, so there will be an even better speedup compared to the BigInteger version (but of course there will be the n limit in this case)
score: 0

http://stackoverflow.com/comment/42675753
has text: Peter, thank you but that requires looping through the args which in my case wasn't necessary. I only had one argument that was optional that I needed to test for. Thank you.
comment on: http://stackoverflow.com/a/27083263
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27052927
has answer: http://stackoverflow.com/a/27053756
linked to: http://stackoverflow.com/q/20703544
tagged with: data-binding
upvote count: 3
tagged with: javafx
possible better answer: http://stackoverflow.com/a/27053756
type: AnsweredQuestion
score: 3
has title: Custom bidirectional bindings in JavaFX
accepted answer: http://stackoverflow.com/a/27053995
tagged with: java
has body: I'm trying to implements a GUI involving a computation of 2 fields. My model has 2 properties and one binding. ObjectProperty&lt;BigDecimal&gt; price = new SimpleObjectProperty&lt;&gt;(); ObjectProperty&lt;BigDecimal&gt; quantity= new SimpleObjectProperty&lt;&gt;(); ObjectBinding&lt;BigDecimal&gt; totalPrice = new ObjectBinding&lt;BigDecimal&gt;() { { bind(price,quantity);} protected BigDecimal computeValue() { if (price.get() == null || quantity.get() == null) return null; return price.get().multiply(quantity.get()); } }; My GUI has 3 TextField to match price, amount, totalPrice. Usualy, I'm doing a regular binding between my properties and my TextField as such priceTextField.textProperty().bindBidirectional(myModel.priceProperty(), new NumberStringConverter()); Now this where it gets a bit tricky. If the user modify the price or the quantity, it has toupdate the TotalPrice (which is what the binding does so far). But I want to be able to do the following: if the user update the TotalPrice, then it recomputes the quantity accordingly to the fixed price. So the question is: how do I create such a flow => TotalPrice is bind on price and quantity, but quantity is bind on TotalPrice and price. When I input something in the totalPriceTextfield it should update the quantityTextField and vice versa. Thanks. ****** Edit ******** Here is an ugly piece of code just to illustrate what I want to achieve (nb: i know i could use Binding.multiply and other method but I need for future project to implement the compute function) public class TestOnBindings { private DoubleProperty price = new SimpleDoubleProperty(10.0); private DoubleProperty quantity = new SimpleDoubleProperty(1.0); private DoubleProperty total = new SimpleDoubleProperty(1.0); private DoubleBinding totalBinding = new DoubleBinding() { {bind(quantity,price);} @Override protected double computeValue() { return quantity.get()*price.get(); } }; private DoubleBinding quantityBinding = new DoubleBinding() { {bind(total,…
type: Question
answer count: 2
downvote count: 0
tagged with: javabeans
favorite count: 0
has answer: http://stackoverflow.com/a/27053995

http://stackoverflow.com/comment/42633921
type: QuestionComment
type: Comment
has text: you prepare 2 statements but actually execute only one. pStmt var on UserStocks is erased by Stocks statement before it is actually executed.
comment on: http://stackoverflow.com/q/27059321
score: 0

http://stackoverflow.com/q/27065607
has answer: http://stackoverflow.com/a/27065784
has comment: http://stackoverflow.com/comment/42644922
score: 1
tagged with: java
upvote count: 1
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/42647050
favorite count: 0
tagged with: japplet
has body: This is a noob question. We are being taught applets in class, and I was trying something on my own. The following is the code import java.awt.*; import javax.swing.*; class controls extends JPanel{ @Override public void paintComponent(Graphics g) { g.drawOval(50, 50, 50, 50); // &lt;-- draws an oval on the panel } } public class test extends JApplet{ public void init(){ final JPanel stage = new JPanel(); final JPanel controlPanel = new controls(); final JPanel banner = new JPanel(); final JLabel name = new JLabel("Test", JLabel.CENTER); this.setLayout(new BorderLayout()); banner.setBackground(Color.CYAN); banner.add(name); this.add(controlPanel, BorderLayout.WEST); this.add(banner, BorderLayout.NORTH); } } As far as I understand, paintComponent() need not be called explicitly. The controls class works well when used alone. I mean the following code works. public class test extends JApplet{ public void init(){ JPanel controlPanel = new controls(); this.add(controlPanel); } } I am not able to understand the difference. Why does the same code work in this case, and not in the previous? Thank you.
has title: paintComponent overriding to draw on a panel
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27065784
downvote count: 0
tagged with: swing
type: Question

http://stackoverflow.com/comment/49845446
type: Comment
has text: My class files are scattered deep below the `out` dir. There is no `bin`. They work from IntelliJ but not the command prompt- from subdirs of `out\production` dir, which is the only place `.class`'s appear. I think I need to setup from scratch.
comment on: http://stackoverflow.com/a/27108952
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42686007
type: Comment
has text: I think you're missing the point that Meir is trying to link to the Windows library (`.dll` file) while running his code on Mac.
comment on: http://stackoverflow.com/a/27089122
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42752327
type: Comment
comment on: http://stackoverflow.com/a/27116749
has text: Thanks for this complete answer. Too bad the tutorial talks about port 9000 or "localhost:8020" which doesnt work (http://hortonworks.com/hadoop-tutorial/using-commandline-manage-files-hdfs/)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42735226
comment on: http://stackoverflow.com/q/27116345
score: 3
type: Comment
type: QuestionComment
has text: you could use `Collections.sort()` and write your custom `comparator`.

http://stackoverflow.com/comment/43108094
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27130605
has text: Thanks a lot for your options too. It was informative and helpful for me.
score: 0

http://stackoverflow.com/a/27126006
has comment: http://stackoverflow.com/comment/42753429
score: 1
has comment: http://stackoverflow.com/comment/42754249
answers question: http://stackoverflow.com/q/27125899
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27125899
has comment: http://stackoverflow.com/comment/42754212
has comment: http://stackoverflow.com/comment/42753777
has body: Bundling all lazily-initialized state into an immutable object is usually the preferred approach because then all you need is a volatile variable, with no synchronization. That arrangement opens you to some duplicated effort if another thread starts initializing while initialization is in progress, but the chances of that can be minimized, such as by writing a sentinel value to the volatile to signal the "in progress" state.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42658186
comment on: http://stackoverflow.com/q/27073081
score: 0
has text: you have to read this `1 5 10 25 50 100` or `143`
type: Comment
type: QuestionComment

semaphore
type: Tag
tags question: http://stackoverflow.com/q/27084579
tags question: http://stackoverflow.com/q/27117367
tag name: semaphore

http://stackoverflow.com/q/27050078
has title: Spring project deployment throws ClassNotFoundException for org.apache.commons.logging.Log
has answer: http://stackoverflow.com/a/27050250
tagged with: spring
tagged with: logging
type: AnsweredQuestion
tagged with: apache-commons
has body: I have Spring Web app built with maven. I excluded commons-logging from spring to use SLF4J and Logback. But for some reason, the deployment fails with the following error Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2436) at java.lang.Class.getDeclaredFields(Class.java:1806) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:256) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:132) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:334) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:774) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5095) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 40 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1295) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1147) ... 54 more I'm not sure what is triggering the Apps server to look for commons logging and then complain that it can't find it. I'm trying to find out the misconfiguration in my app that could be causing this (maven's dependency tree did not show commons logging at all). Here's my Maven configuration org.springframe…
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27050250
tagged with: slf4j
score: 0
answer count: 1

http://stackoverflow.com/q/27040062
answer count: 1
has comment: http://stackoverflow.com/comment/42599553
type: UnansweredQuestion
tagged with: android
has title: How to remove the application specific data, in Android, from code level?
has comment: http://stackoverflow.com/comment/42599886
tagged with: java
has answer: http://stackoverflow.com/a/27040200
has comment: http://stackoverflow.com/comment/42599503
has body: How to remove the application specific data, in Android, from code level? Something similar to "Clear Data" and "Clear Cache" button in application settings. Something like, myAppID.clearData() or myAppID.clearCache()? I couldn't find any reference, is there anything like this?
type: Question
has comment: http://stackoverflow.com/comment/42599462
score: 0

http://stackoverflow.com/comment/48798521
has text: This also includes classes that you have in the packages listed under `ebean.default` in application.conf. like `ebean.default="models.*`"
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27234565
score: 1

http://stackoverflow.com/comment/42716098
has text: See this. This is probably because the Android Lollipop has introduced significant changes for SQLite : http://stackoverflow.com/questions/26816561/android-lollipop-changed-behavior-of-sqlite
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27106275

http://stackoverflow.com/a/27083165
score: 1
has comment: http://stackoverflow.com/comment/42675572
accepted answer of: http://stackoverflow.com/q/27083110
type: Answer
has comment: http://stackoverflow.com/comment/42675738
answers question: http://stackoverflow.com/q/27083110
upvote count: 1
has body: As an Object fileData defaults to null so its initial String value is translated to the String literal "null" as per JLS 15.18.1 when appended to another String. Therefore it needs to be initialized: private String fileData = ""; Consider using a StringBuilder here
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/27104280
has body: I want include Mongo to Spring. So I have spring.context.xml <mongo:mongo host="localhost" port="27017" /> <mongo:db-factory dbname="employee_service" /> <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" /> pom.xml: org.springframework.data spring-data-mongodb 1.6.1.RELEASE org.mongodb mongo-java-driver 2.11.0 cglib cglib 2.11.0 And class: @Document(collection = "vacancy") public class Vacancy { @Id private String id; private String description; //setters and getters } so when I try to deploy my application on tomcat, I have exceptions: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [spring.config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/objenesis/ObjenesisStd NOTE: I hava Spring 4.x version
answer count: 0
type: UnansweredQuestion
tagged with: spring
downvote count: 0
score: 1
tagged with: java
favorite count: 0
type: Question
tagged with: mongodb
linked to: http://stackoverflow.com/q/25262248
has title: How to include Mongo to Spring?
duplicate of: http://stackoverflow.com/q/25262248
has comment: http://stackoverflow.com/comment/42712072
upvote count: 1

http://stackoverflow.com/a/27076281
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42670824
type: Answer
accepted answer of: http://stackoverflow.com/q/27075842
answers question: http://stackoverflow.com/q/27075842
has comment: http://stackoverflow.com/comment/42670634
has body: Disk IO is faster when done sequentially (especially on non-SSD drives, I think that's the case too with SSD). If your task doesn't do anything other than write to the disk (no computation which would benefit from multi-threading), I'd use only one thread.
has comment: http://stackoverflow.com/comment/42671478
score: 0

http://stackoverflow.com/q/27120900
type: UnansweredQuestion
has body: I have design a frame in which i have used JFileChooser and JList. now i want to perform drag and drop feature from JfileChooser to JList contianing Folder (Such as in my screen Short JList contians folder name a,b,c) suppose from JFileChooser i open a folder and from this folder i select (example.txt)file and then i perform drag and drop of this to JList contianing folder a. so i want (example.txt) file should be in folder a. how to do this things.and i have one more problem. in my screenshot Jlist contian Three folder(a,b,c). so when i click on folder a but i m not able to get inside folder a. this is my code by using this i have create screenshot. In this code i have create JFileChooser and JList. I have add all the folder into the JList. now i want to perform Drag and Drop from JFileChooser to JList containing folder. this is my code by using this i have create screenshot. In this code i have create JFileChooser and JList. I have add all the folder into the JList. now i want to perform Drag and Drop from JFileChooser to JList containing folder. package com.dhananjaynet.swing; import java.awt.datatransfer.*; import java.awt.event.*; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.io.*; import javax.swing.*; import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.border.TitledBorder; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileSystemView; import javax.swing.text.*; import com.dhananjay.swing.upload.ReadAllFolderName; import java.util.ArrayList; import java.util.List; public class ConsolidatorDemo extends JPanel implements ActionListener { private static final long serialVersionUID = -4487732343062917781L; JFileChooser fc; JButton clear; JTextArea console; JList dropZone; DefaultListModel listModel; JSplitPane childSplitPane, parentSplitPane; PrintStream ps; ArrayList&lt;String &gt; directyName; public ConsolidatorDemo() { super(new BorderLayout()); fc = new JFil…
tagged with: swing
tagged with: jfilechooser
type: Question
has title: how to perform drag and drop from JFileChooser to JList containig Folders
has answer: http://stackoverflow.com/a/27121557
tagged with: java
upvote count: 2
answer count: 1
favorite count: 0
tagged with: drag-and-drop
tagged with: jlist
score: 2
downvote count: 0

http://stackoverflow.com/a/27109329
has comment: http://stackoverflow.com/comment/42722309
downvote count: 1
has comment: http://stackoverflow.com/comment/42721669
has body: No, in switch statement order doesn't matter at all. Also the compiler always maintain a hash table for jumping to the switch statement. So ordering or increase of casing is not a matter at all. It's always a O(1) operation. However, this will reduce the switching for your case: switch(difficulty) { case 2: i--; break; default: i++; break; }
answers question: http://stackoverflow.com/q/27109031
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/42721881
has comment: http://stackoverflow.com/comment/42721561
type: Answer

http://stackoverflow.com/a/27152258
type: Answer
answers question: http://stackoverflow.com/q/27150065
has body: No need to do more: String[] embTagsToArray = embossingTags.split("#[^#]*#"); (remove the last item if it is empty)
score: 0

http://stackoverflow.com/a/27112524
type: Answer
has comment: http://stackoverflow.com/comment/42727908
upvote count: 4
score: 2
has comment: http://stackoverflow.com/comment/42728343
has body: You are asking the wrong question. You should be trying to figure out how to make your application less memory-hungry, not trying to find workarounds for specific vendors/OEMs. For some guidance, this article is particularly helpful: Managing Your App's Memory. Since you mentioned that you are attempting to use the largeHeap attribute in your manifest, you might want to read the following snippet from the article: In very special situations, you can request a larger heap size by setting the largeHeap attribute to "true" in the manifest &lt;application&gt; tag. If you do so, you can call getLargeMemoryClass() to get an estimate of the large heap size. However, the ability to request a large heap is intended only for a small set of apps that can justify the need to consume more RAM (such as a large photo editing app). Never request a large heap simply because you've run out of memory and you need a quick fix.
has comment: http://stackoverflow.com/comment/42729871
has comment: http://stackoverflow.com/comment/42727978
downvote count: 2
answers question: http://stackoverflow.com/q/27112391
has comment: http://stackoverflow.com/comment/42728553
has comment: http://stackoverflow.com/comment/42728684

http://stackoverflow.com/q/27009889
has comment: http://stackoverflow.com/comment/42547357
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42547228
has body: When i am searching for a file in windows search bar it will display all the files related with my search term in a list along with its name and icon which is belong to the file type(i.e., for the image file it will show a photo gallery icon on the left side of the file name) and when we click that it will open up related with the file supported application. How do do this stuff in java, i can find the file as per the search term and location but i even want to display the name of the file with icon type?
type: Question
has title: how to display a file type related icon in my file search in java?
tagged with: java-io
score: 0
type: UnansweredQuestion

http://stackoverflow.com/a/27111474
answers question: http://stackoverflow.com/q/27111439
score: 0
type: Answer
has body: Edit the I'd field IN MYSQL client and set it to AUTO INCREMENT

http://stackoverflow.com/q/27144212
answer count: 0
type: UnansweredQuestion
tagged with: git
score: 3
upvote count: 3
has body: I am using eclipse Kepler. But Eclipse is always busy in "Computing Git status for repository Application" when something changed and it eats up my CPUs, and pops up a dialog. I have to stop the dialog. Sometime later, it also pops up a same dialog. I try to upgrade eclipse and search some solutions on stackoverflow. Unluckily, they are helpless. How do I stop that? I’m fed up.
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/19457735
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42784608
has title: Eclipse “Computing Git status for repository Application”
favorite count: 0

http://stackoverflow.com/q/27068654
accepted answer: http://stackoverflow.com/a/27121947
has answer: http://stackoverflow.com/a/53559389
type: Question
has body: We are fully annotation driven and do not use XML files for spring configuration. Default scope of spring beans is singleton which many developers forget and end up in creating beans that should be differently scoped. Added to the complexity of problems mix and match of various scoped beans. Is there any maven plugin that can check if any class that has @Component annotation also has @Scope annotation and fail the build if its missing. This will force developers to think about the scope and usage patterns. If something similar does not exists, I can write the plugin or have a custom tool that can check this and fire during jenkins build. Can any of spring code help me to do this? Additionally if there is @Autowire annotation in spring bean, is there a way to validate that beans being injected have right scopes. I am working with the assumption if you inject prototype scoped bean in singleton scoped bean, most likely that is not what you wan. Though there might be use cases where this is what developer want, in our case, so far this is mostly been developer mistake.
possible better answer: http://stackoverflow.com/a/27128166
has answer: http://stackoverflow.com/a/27128166
tagged with: maven
tagged with: spring
has title: How to enforce/verify spring scope annotation on spring beans
tagged with: java
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/42652287
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/27121947
has comment: http://stackoverflow.com/comment/42669855
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/a/27134003
has body: return FractionOne; return FractionTwo; You can't have two return statements one after the other. The second one can never be executed, since the first one will exit the method. That's why the second statement is unreachable. If what you want is to return both Strings, you should probably concatenate them : return FractionOne+FractionTwo; or return FractionOne+","+FractionTwo; or return FractionOne+"\n"+FractionTwo; However, since both of them are identical, I don't see the point in returning both.
answers question: http://stackoverflow.com/q/27133974
upvote count: 3
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/42766907
has comment: http://stackoverflow.com/comment/42766949
type: Answer

http://stackoverflow.com/comment/42727498
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27112162
has text: This is an example of microbenchmarking; I see no warm up period, how are you accounting for JIT?
type: Comment

http://stackoverflow.com/comment/42639336
has text: You should talk with other developer and ask them what do they think about it. Maybe they ok with warnings. looks like it true because warning exists and nobody do anything about it. In this case you can try to convince them to change they're mind. Or turn off warning (I put a bet on later :) )
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27062281
score: 0

http://stackoverflow.com/q/27115913
score: 0
has comment: http://stackoverflow.com/comment/42734421
has title: Hibernate oneToOne mapping not reading joinColumn class instance
answer count: 1
has comment: http://stackoverflow.com/comment/42745731
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27122516
tagged with: java
tagged with: hibernate
type: Question
has body: package com.hibernatetest; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Transient; @Entity @Table(name = "country") public class Country { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "ctry_id") private Integer id; @Column(name = "ctry_name") private String name; @Transient private int rank; @ManyToOne @JoinColumn(name="fk_cont_id") private Continent continent; @OneToOne(mappedBy="country") private HeadOfState hos; public HeadOfState getHos() { return hos; } public void setHos(HeadOfState hos) { this.hos = hos; } public Continent getContinent() { return continent; } public Country() { ; } public Country(String name) { this.name = name; } public void setContinent(Continent continent) { this.continent = continent; } public Integer getId() { return id; } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setRank(int rank) { this.rank = rank; } public int getRank() { return rank; } public void addCountryToDb(Continent cont) { continent = cont; } } package com.hibernatetest; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; @Entity @Table(name="hos") public class HeadOfState { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="hos_id") private Integer id; @Column(name="hos_name") private String name; @OneToOne @JoinColumn(name="fk_ctry_id") private Country country; public HeadOfState() { } public HeadOfState(String name) { this.name=name; } public String getName() …
has comment: http://stackoverflow.com/comment/42745941

http://stackoverflow.com/a/27069942
type: Answer
has body: to get an input grade. Just read nextLine, use a regular expression to see it's a number and the use Integer.parseint(String grade) to get the final grade.
has comment: http://stackoverflow.com/comment/42652988
score: 0
answers question: http://stackoverflow.com/q/27069786

http://stackoverflow.com/comment/42782618
score: 0
has text: @SweetWisherツ I've updated the question already. I don't think it's calling scheduleAlarm() otherwise, I would have received a push notification.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27142358

unsatisfiedlinkerror
tags question: http://stackoverflow.com/q/27007967
tag name: unsatisfiedlinkerror
type: Tag

http://stackoverflow.com/comment/75792322
comment on: http://stackoverflow.com/a/26994636
has text: @Jon Skeet, It was my misunderstanding. I agree with your answer. The method is defined in DateFormat class. Extremely sorry for wrong comment ..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27118556
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42738993
has answer: http://stackoverflow.com/a/27118613
has body: the output for this is - - - - - - - - - 1 2 3 4 5 6 7 8 9 if I enter 1 I want the new output to be X - - - - - - - - 1 2 3 4 5 6 7 8 9 I've tried using boolean statements and while(true) but I just can't figure it out.. Here is some sample code String table[][]; table = new String[3][3]; int options[][]={{1,2,3},{4,5,6},{7,8,9}}; while(true){ for (int i = 0; i &lt; table.length; i++) { for (int j = 0; j &lt; table[i].length; j++) { table[i][j] = "—"; System.out.print(table[i][j] + " "); } //FOR LOOP 2 System.out.println(); }// FOR LOOP 1 for (int i = 0; i &lt; options.length; i++) { for (int j = 0; j &lt; options[i].length; j++) { System.out.print(options[i][j]+ " "); }// FOR LOOP 2(2) System.out.println(); }// FOR LOOP 1(1) // ASK FOR MOVE ONE System.out.println("Player One (x) : Enter a move from 1-9 &gt;&gt;&gt; "); int x = in.nextInt(); if (x==1){ table[0][0]="x"; return true; //DOES NOT WORK. I WANT IT TO RETURN TO TOP WITH THE VALUE table[0][0] = x } When I enter 1 my output is still - - - - - - - - - 1 2 3 4 5 6 7 8 9
answer count: 3
has answer: http://stackoverflow.com/a/27118618
favorite count: 0
has comment: http://stackoverflow.com/comment/42738985
has comment: http://stackoverflow.com/comment/42739013
has title: How do I change the value in a 2d array
possible better answer: http://stackoverflow.com/a/27118613
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42738953
has comment: http://stackoverflow.com/comment/42738928
has answer: http://stackoverflow.com/a/27118623
downvote count: 2
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27118618

http://stackoverflow.com/comment/42656912
type: Comment
type: QuestionComment
has text: @kriegaex : I'd like to use some new aspects where the pointcut should intercept internally called methods. However in the migration I'd like to not touch the aspects already written. The aspects written however make assumptions that they will not be called on internally called methods (i.e. they were developed with Spring AOP)
comment on: http://stackoverflow.com/q/27069547
score: 0

http://stackoverflow.com/comment/42594574
has text: If you don't know the label of the strings, then the optString method provided by some of the other answers should do the job, as well.
comment on: http://stackoverflow.com/a/27035884
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27120484
has body: i want to make secure my java file while making Android APK file , to safe my research work. Because when we Decompile APK file , we can get all the source project code using some steps. Is any way to do this ?
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27120821
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42742012
has title: how to make secure and hide .java files from being Decompile APK file.
upvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/comment/42571131
has text: You'd need to replace the call to `nextBoolean()` with something else. Perhaps something like `ThreadLocalRandom.nextDouble() < 0.2 ? ...`
score: 1
comment on: http://stackoverflow.com/a/27006327
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27097901
score: 0
tagged with: nullpointerexception
answer count: 1
has title: Null Pointer Exception Hadoop
accepted answer: http://stackoverflow.com/a/27102140
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/42701560
has answer: http://stackoverflow.com/a/27102140
has body: Hi I am currently writing a map reduce job to run through an hdfs containing images and record output where a file contains red or not. I am currently running into a NullPointerException error and I cannot seem to figure out where it is coming from. Below is my code { package hipi.examples.redfilter; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.BooleanWritable; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; public class RedFilter extends Configured implements Tool{ private static String inputPath; public static class RedFilterMapper extends Mapper&lt;NullWritable, BufferedImage, Text, BooleanWritable&gt; { public void map(IntWritable key, BufferedImage currImage, Context content) throws IOException, InterruptedException { System.out.println("I am in the mapper method"); FileSystem fs = FileSystem.get(new Configuration()); FileStatus[] status = fs.listStatus(new Path(inputPath)); System.out.println("I am in the mapper method"); for (int i=0;i&lt;status.length;i++){ String fileName = fs.open(status[i].getPath()).toString(); currImage= ImageIO.read(fs.open(status[i].getPath())); int width = currImage.getWidth(); int height = currImage.getHeight(); boolean exit = false; for(int x = 0; x &lt; width; x++) { for(int y = 0; y &lt; height; y++) { Color c = new Color(currImage.getRGB(x, y)); int red = c.getRed(); if ( red &gt; 20…

http://stackoverflow.com/q/27001971
has comment: http://stackoverflow.com/comment/42534101
has body: I need some help with my android game. I want to set up an analog stick - 2 circles. 1 moveable. When you hold the smaller one it moves the character on screen. Now I'am using DrawableImages to change the values but this is not very comfortable: @Override public boolean onTouch(View v, MotionEvent event) { switch (v.getId()){ case R.id.upButton: gameEngine.moveUp(); return true; case R.id.downButton: gameEngine.moveDown(); return true; case R.id.leftButton: gameEngine.moveLeft(); return true; case R.id.rightButton: gameEngine.moveRight(); return true; case R.id.down_left: gameEngine.moveDownLeft(); return true; case R.id.down_right: gameEngine.moveDownRight(); return true; case R.id.up_left: gameEngine.moveUpLeft(); return true; case R.id.up_right: gameEngine.moveUpRight(); return true; case R.id.button_attack: paintGame.setAttack(); gameEngine.attack(); return true; } return false; } }; public void moveUp(){ charX -= 8; } public void moveDown(){ charX += 8; } public void moveRight(){ charY +=8; } public void moveLeft(){ charY -= 8; } public void moveDownLeft(){ charX += 4; charY -= 4; } public void moveUpLeft(){ charX -= 4; charY -= 4; } public void moveDownRight(){ charX += 4; charY +=4; } public void moveUpRight(){ charX -= 4; charY +=4; } I don't know how i can realize this. I hope you can help me. Thanks!
accepted answer: http://stackoverflow.com/a/27002049
type: AnsweredQuestion
downvote count: 0
has title: Android Analog Stick for a Game
score: 1
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/27002049
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/42714996
score: 0
type: AnswerComment
has text: Thank you for your effort, now I comfortably can say that I understood the whole concept :)
comment on: http://stackoverflow.com/a/27103669
type: Comment

http://stackoverflow.com/q/27009084
tagged with: excel
has comment: http://stackoverflow.com/comment/42546157
score: 2
has comment: http://stackoverflow.com/comment/42546096
tagged with: java
has title: How to remove cell content in excel using apache poi
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42654109
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42546917
has comment: http://stackoverflow.com/comment/42549202
has body: I want to remove the cell content but keeping its style but it's always remove the style and content. Here's my code: private static void RefreshReport(String sheetName, String resultColumn) { try { InputStream inp = new FileInputStream(getExcelFile()); Workbook wb = WorkbookFactory.create(inp); Sheet sheet = wb.getSheet(sheetName); int colResult = getColumnResult(sheet, resultColumn); int rowStart = getRowResult(sheet, resultColumn); int rowEnd = Math.max(20, sheet.getLastRowNum()); for (int rowNum = rowStart; rowNum &lt; rowEnd; rowNum++) { Row r = sheet.getRow(rowNum); if (r != null) { Cell cell = r.createCell(colResult); if (cell.getCellType() != Cell.CELL_TYPE_BLANK) { CellStyle cs = wb.createCellStyle(); cs = cell.getCellStyle(); r.removeCell(cell); cell = r.createCell(colResult); cell.setCellStyle(cs); } } } FileOutputStream fileOut = new FileOutputStream(getExcelFile()); wb.write(fileOut); fileOut.close(); inp.close(); } catch (Exception e) { e.printStackTrace(); } } Any help would be great.
has answer: http://stackoverflow.com/a/72417666
tagged with: apache-poi
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27114965

http://stackoverflow.com/q/27073852
has title: Chatbot method stuck looping in Java
type: UnansweredQuestion
tagged with: java
tagged with: loops
type: Question
tagged with: chatbot
answer count: 1
has body: I am coding a simple chatbot, and my method seems to be stuck in a loop. This below is the method, and I suspect there is a problem with the while loop, but I cannot find where I am messing up. No problems with compiling and running other than the stuck loop. The loop below takes in a complete string, statement, loops for specific keywords, goal, and the starts looking through the string at startPos private int findKeyword(String statement, String goal, int startPos) { String phrase = statement.trim(); int psn = phrase.toLowerCase().indexOf(goal.toLowerCase(), startPos); while (psn &gt;= 0) { String before = " ", after = " "; if (psn &gt; 0) { before = phrase.substring(psn-1, psn).toLowerCase(); } if (psn + goal.length() &lt; phrase.length()) { after = phrase.substring(psn + goal.length(), psn + goal.length() + 1).toLowerCase(); } if (((before.compareTo("a") &lt; 0) || (before.compareTo("z") &gt; 0)) &amp;&amp; ((after.compareTo("a") &lt; 0) || after.compareTo("z") &gt; 0)) { return psn; } psn = phrase.indexOf(goal.toLowerCase(), psn + 1); } return -1; }
score: 0
has answer: http://stackoverflow.com/a/27073882

http://stackoverflow.com/a/27032231
answers question: http://stackoverflow.com/q/27019096
type: Answer
score: 0
has body: There are at least a couple of problems in this code. The big one is right at the start: public MyGLSurfaceView(Context context) { super(context); setRenderer(new MyGLRenderer()); setEGLContextClientVersion(2); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); } This is the wrong order of calls. setEGLContexClientVersion() needs to be called before setRenderer(). setRenderer() initiates picking the config and creating the context, which both depend on the API version. The correct order is: public MyGLSurfaceView(Context context) { super(context); setEGLContextClientVersion(2); setRenderer(new MyGLRenderer()); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); } Another problem is with this call: GLES20.glUniform4fv(mColorHandle, 0, color,1); The second argument is count, which is the number of vectors to set. Since the value passed for this argument is 0, this will do nothing at all. On the other hand, the last argument is an offset into the vector passed as the 3rd argument, which should be 0 in this case. The correct call is: GLES20.glUniform4fv(mColorHandle, 1, color, 0); I didn't study all of the code in detail, but these were the issues that jumped out immediately.
accepted answer of: http://stackoverflow.com/q/27019096
type: AcceptedAnswer

stored-procedures
tags question: http://stackoverflow.com/q/27063063
tag name: stored-procedures
type: Tag
tags question: http://stackoverflow.com/q/27032910
tags question: http://stackoverflow.com/q/27117511
tags question: http://stackoverflow.com/q/27071044
tags question: http://stackoverflow.com/q/27032274
tags question: http://stackoverflow.com/q/27090420

http://stackoverflow.com/comment/42577863
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27027150
has text: In my example the variables are not declared inside the method. It is declared in the class and fill() method uses them directly.

http://stackoverflow.com/comment/42517347
type: AnswerComment
has text: Thanks for the reply but its not working. Mentioning Return type as NONE does nothing and now my file is not even download
type: Comment
comment on: http://stackoverflow.com/a/26992717
score: 0

http://stackoverflow.com/q/27059798
tagged with: java
tagged with: eclipse
has title: Appcompat res values-v21 themes_base errors on eclipse are not going away
score: 9
answer count: 3
has body: I had checked for the questions and have not found a suitable answer for my problem + [2014-11-21 16:12:02 - android-support-v7-appcompat] [2014-11-21 16:12:02 - android-support-v7-appcompat] E:\MISC\canvas\eclipse workspace\android-support-v7-appcompat\res\values-v21\themes_base.xml:220: error: Error: No resource found that matches the given name: attr 'colorControlNormal'. [2014-11-21 16:12:02 - android-support-v7-appcompat] [2014-11-21 16:12:02 - android-support-v7-appcompat] E:\MISC\canvas\eclipse workspace\android-support-v7-appcompat\res\values-v21\themes_base.xml:225: error: Error: No resource found that matches the given name: attr 'colorControlHighlight'. [2014-11-21 16:12:02 - android-support-v7-appcompat] [2014-11-21 16:12:02 - android-support-v7-appcompat] E:\MISC\canvas\eclipse workspace\android-support-v7-appcompat\res\values-v21\themes_base.xml:224: error: Error: No resource found that matches the given name: attr 'colorControlNormal'. [2014-11-21 16:12:02 - android-support-v7-appcompat] [2014-11-21 16:14:50 - android-support-v7-appcompat] E:\MISC\canvas\eclipse workspace\android-support-v7-appcompat\res\values-v21\themes_base.xml:50: error: Error retrieving parent for item: No resource found that matches the given name 'Base.V7.Theme.AppCompat'. [2014-11-21 16:14:50 - android-support-v7-appcompat] [2014-11-21 16:14:50 - android-support-v7-appcompat] E:\MISC\canvas\eclipse workspace\android-support-v7-appcompat\res\values-v21\themes_base.xml:74: error: Error: No resource found that matches the given name: attr 'editTextBackground'. .................................. ........................................ [2014-11-21 16:15:48 - android-support-v7-appcompat] [2014-11-21 16:15:48 - android-support-v7-appcompat] E:\MISC\canvas\eclipse workspace\android-support-v7-appcompat\res\values-v21\themes_base.xml:225: error: Error: No resource found that matches the given name: attr 'colorControlHighlight'. [2014-11-21 16:15:48 - android-support-v7-appcompat] [20…
has answer: http://stackoverflow.com/a/27683812
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27183010
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27060284
tagged with: android-appcompat
accepted answer: http://stackoverflow.com/a/27683812
has answer: http://stackoverflow.com/a/27060284
type: Question
upvote count: 9

http://stackoverflow.com/comment/42614487
has text: What does it mean that H2 synchronizes access to the same connection?
comment on: http://stackoverflow.com/a/27048166
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42766009
type: Comment
comment on: http://stackoverflow.com/a/27133686
score: 0
type: AnswerComment
has text: Sorry, I wasn't clear. I know which line throws the error - after trying for a while, I don't know how to achieve what I want.

http://stackoverflow.com/a/27008483
has comment: http://stackoverflow.com/comment/42570172
accepted answer of: http://stackoverflow.com/q/27008352
type: AcceptedAnswer
downvote count: 0
has body: Unless you're using Java 8, this is the fastest and easiest way to do what you need. If you're using Java 8, you can do the following one liner: Float f[] = Arrays.stream(text).map(t -&gt; Float.parseFloat(t)).toArray(Float[]::new);
answers question: http://stackoverflow.com/q/27008352
has comment: http://stackoverflow.com/comment/42568900
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42570622
has comment: http://stackoverflow.com/comment/42569259

http://stackoverflow.com/comment/42670301
score: 0
type: Comment
type: QuestionComment
has text: Well, is its size 3?
comment on: http://stackoverflow.com/q/27079867

http://stackoverflow.com/a/27031384
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27031344
type: Answer
answers question: http://stackoverflow.com/q/27031344
has body: Looks like this problem is related to: JavaFx StackedBar Chart Issue The fix from that article also works for this problem. Unfortunately, the fix involves importing one of Oracle's private packages which would limit the portability of the solution. In that post the issue was with negative values. In my post the values are between 0.0 and 1.0.

http://stackoverflow.com/q/27064399
tagged with: java
score: 0
has title: Maven reactor and transitive dependencies
type: Question
has comment: http://stackoverflow.com/comment/42710736
has comment: http://stackoverflow.com/comment/42702411
type: UnansweredQuestion
tagged with: maven
has body: my projects have the following structure: tst.parent with modules: tst.one -> has dependency to tst.two tst.two -> has dependency to tst.three tst.three the goal is to have two builds. the first is a full build and the second only builds module tst.one and tst.three. for this reason i made two profiles in the pom.xml of tst.parent: <?xml version="1.0"?> 4.0.0 tst tst.parent 1.0.0-SNAPSHOT tst.parent pom part tst.one tst.three full tst.one tst.two tst.three the pom.xml of module tst.one: 4.0.0 tst.parent tst 1.0.0-SNAPSHOT tst.one tst tst.two 1.0.0-SNAPSHOT the pom.xml of module tst.two: 4.0.0 tst.parent tst 1.0.0-SNAPSHOT tst.two tst tst.three 1.0.0-SNAPSHOT the pom.xml of module tst.three: 4.0.0 tst.parent tst 1.0.0-SNAPSHOT tst.three if i run a full build, the reactor is sorting/building the modules in correct order: mvn clean install -P full [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] tst.parent [INFO] tst.three [INFO] tst.two [INFO] tst.one but if i run a partial build, the modules are sorted like i list them in the modules section: mvn clean install -P part [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] tst.parent [INFO] tst.one [INFO] tst.three [INFO] if i use the --project commandline-option, the buildorder is calculated correctly: mvn clean install -P full --projects tst.one,tst.three [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] tst.three [INFO] tst.one [INFO] but with this approach, there is the limitation, that module tst.two must be available as source as well. does anyone have an idea how to tell maven that in the partial build, the transitive dependency from module tst.one to module tst.three should be considered while calculating th…
has comment: http://stackoverflow.com/comment/42643468
answer count: 0

http://stackoverflow.com/comment/42642964
comment on: http://stackoverflow.com/a/27064331
score: 0
type: AnswerComment
has text: so, i would use prefetched sequence values instead of UUIDs, seems to me I get the plusses of UUIDs (minus ID generation on the client) without the performance and space concerns, but I don't find a ready-made solution (generator) for that, which surprises me.
type: Comment

http://stackoverflow.com/a/27107290
answers question: http://stackoverflow.com/q/27107092
has comment: http://stackoverflow.com/comment/42728893
type: Answer
score: 0
has body: But by this method I would have to go through a URL like "/bin/.*". You can also register a servlet against a resource type, as well as by path, e.g. (from the Sling documentation): @SlingServlet( resourceTypes = "sling/servlet/default", selectors = "hello", extensions = "html", methods = "GET") public class MyServlet extends SlingSafeMethodsServlet { @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { ... } } If you remove the "selectors", "extensions" and "methods" parameters on the annotation, this servlet would bind against all calls to sling/servlet/default without requiring binding against a set path.

http://stackoverflow.com/q/27001709
tagged with: class
has body: This is my first time taking a java class and for my assignment am suppose to write a Class and Driver to show the change that is returned as well as the coins. i.e Enter item price: 45.50 -> Enter cash given: 50.00 -> Change is 4.50 -> dollars: 4 &amp; quarters: 2 Here is the class. public class Change { private int price; private int cash; public Change (int p, int c) { price =p; cash =c; } public Change() { } public int getPrice ( ) { return price;} public void setPrice (int p) {price=p;} public int getCash ( ) { return cash;} public void setCash (int c) {cash=c;} public int computeChange( ) {return cash-price; } public int toDollars ( ) {return computeChange() / 100; } public int aChanges ( ) {return computeChange() % 100; } public int toQuarters ( ) {return aChanges() / 25; } public int bChanges ( ) {return aChanges() % 25; } public int toDimes ( ) {return bChanges() / 10; } public int cChanges ( ) {return bChanges() % 10; } public int toNickels ( ) {return cChanges() / 5; } public int dChanges ( ) {return cChanges() % 5; } public int toPennies ( ) {return dChanges() / 1; } public int eChanges ( ) {return dChanges() % 1; } } Here is my driver import java.util.Scanner; public class TestChange{ public static void main (String[] args) { double cash; double price; double changes = 0; int change; Scanner scan = new Scanner (System.in); Change c = new Change (); System.out.println ("Enter the price of the item: "); price = scan.nextDouble(); System.out.println ("Enter cash amount: "); cash = scan.nextDouble(); int cents = (int) (changes * 100); changes = c.computeChange(); System.out.println ("Change: " + changes ); System.out.println ("Dollar bills is: " + c.toDollars()); System.out.println ("Quarters is: " + c.toQuarters()); System.out.println ("Dimes is: " + c.toDimes()); System.out.println ("Nickels is: " + c.toNickels()); System.out.println ("Pennies is: " + c.toPennies()); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27003872
has comment: http://stackoverflow.com/comment/42533457
score: 0
tagged with: java
type: Question
has title: Change Calculator not showing change
answer count: 2
has answer: http://stackoverflow.com/a/27001812

http://stackoverflow.com/comment/42770508
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27136104
has text: Instead of String can you java.awt.Color? Then you can use something like this: Color.BLACK.getRGB();
score: 0

http://stackoverflow.com/comment/42552100
type: AnswerComment
has text: You would need to do **a lot** of things to deal with custom views in Android - way more than what I could explain here. I suggest you to use Android's vast amount of built-in views or, if you're determined to make one youself, you can start reading [this](http://developer.android.com/reference/android/view/View.html).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27012008

http://stackoverflow.com/a/27109179
has body: I think something like this should do it: double[] values = .... List&lt;double[]&gt; list = new ArrayList&lt;&gt;(); for(int i = 0; i &lt; values.length; i += 3) { double[] d = new double[3]; d[0] = values[i]; d[1] = values[i+1]; d[2] = values[i+2]; list.add(d); }
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42721709
score: 0
answers question: http://stackoverflow.com/q/27109095
type: Answer

http://stackoverflow.com/a/26999870
has body: Since only one TitledPane in the same Accordion can be expanded at any time, the Accordion (to some extent) manages the expanded state of any TitledPanes it contains. You can do accordion.setExpandedPane(titledPane); to get the accordion to expand titledPane. Calling titledPane.setExpanded(true); also works, but only if you invoke this after the window has been shown (for reasons I don't fully understand).
has comment: http://stackoverflow.com/comment/42530321
type: AcceptedAnswer
downvote count: 0
score: 14
type: Answer
has comment: http://stackoverflow.com/comment/42530505
upvote count: 14
accepted answer of: http://stackoverflow.com/q/26999322
answers question: http://stackoverflow.com/q/26999322
has comment: http://stackoverflow.com/comment/100268846

http://stackoverflow.com/a/27028154
score: 0
has body: equals returns true if the objects are actually equal, but in your case they are not. You should use a simple string comparison using compareTo method instead. String f1 = folder1.folderUri.toString(); String f2 = folder2.folderUri.toString(); if (f1.compareTo(f2) == 0) { // Do what needs to be done}
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27027882
has comment: http://stackoverflow.com/comment/42580008
answers question: http://stackoverflow.com/q/27027882
type: Answer
has comment: http://stackoverflow.com/comment/42580151

http://stackoverflow.com/comment/42695048
comment on: http://stackoverflow.com/q/27094614
type: QuestionComment
type: Comment
has text: Can you post Code that compiles?
score: 0

http://stackoverflow.com/comment/42695153
comment on: http://stackoverflow.com/q/27094306
score: 0
has text: The problem may be that you cannot modify the /data/local/tmp directory itself (by moving the file out of it). Instead of /data/local/tmp/yourfolder try creating /data/local/tmp/container and granting rwx permission to that, and then creating /data/local/tmp/container/yourfolder to hold your files. The app can then mv yourfolder from container to somewhere else, and only need to modify container but not /data/local/tmp itself. That said, this sounds like a very hack-y way to deploy data to a device.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42537888
type: Comment
has text: Try `c < N` without the `=`. Remember, arrays are *zero-based* in Java.
type: QuestionComment
comment on: http://stackoverflow.com/q/27004252
score: 0

http://stackoverflow.com/comment/127976150
type: AnswerComment
has text: @Jatin I have updated answer with PowerShell script also.
type: Comment
comment on: http://stackoverflow.com/a/64459399
score: 2

http://stackoverflow.com/q/27006670
has title: Most frequent letter with method errors
score: 0
has body: Trying to count array but having trouble treating it like any other type of variable I get a missing method body error every time I try to compile along with a few other errors, not sure what I'm missing. public static char maxLetterRecurrence(String sampleInput, int[]count); { int length=sampleInput.length(); int letterCount = 1; int max = 0; char maxChar = 0; for(int i=1; i&lt;length; i++) { if(count[i]==count[i-1]) { letterCount++; } else { if(letterCount&gt;max) { max=letterCount; maxChar=count[i-1]; } } return maxChar; } }
answer count: 1
has answer: http://stackoverflow.com/a/27006682
type: UnansweredQuestion
tagged with: loops
type: Question
tagged with: java
tagged with: counter

http://stackoverflow.com/q/27088871
has comment: http://stackoverflow.com/comment/42753143
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27504222
has comment: http://stackoverflow.com/comment/42695417
has title: java.rmi.ConnectException: Connection refused to host 192.168.56.1
type: AnsweredQuestion
tagged with: rmi
tagged with: java
accepted answer: http://stackoverflow.com/a/27504222
has body: I try to install an opensource software on a Windows8 system using command prompt. I have never done something similar before and I am not very experienced using RMI. I need some help with the exception errors I get. This is the procedure I follow: I have set a CLASSPATH like this set CLASSPATH=C:\kuwaiba7\service\lib\PersistenceAbstractionAPI.jar;C:\kuwaiba7\service\lib\PersistenceServiceRemoteInterfaces.jar Then I start the RMI registry: start "C:\Program Files\Java\jdk1.7.0_71\bin\rmiregistry.exe A new command prompt windows opens. In this window I run the following command for the PersistenceService: C:\kuwaiba7\service&gt;java -Djava.rmi.server.codebase="file:/C:/kuwaiba7/service/l ib/PersistenceAbstractionAPI.jar file:/C:/kuwaiba7/service/lib/PersistenceServiceRemoteInterfaces.jar" -jar PersistenceService.jar The first lines show that the connection to the database is established but then I get a: java.rmi.ConnectException error. [Sun Nov 23 13:57:02 EET 2014] Current working directory: C:\kuwaiba7\service [Sun Nov 23 13:57:02 EET 2014] Establishing connection to the database... [Sun Nov 23 13:57:03 EET 2014] Connection established EmbeddedGraphDatabase [C:\kuwaiba7\service\target\kuwaiba.db] [Sun Nov 23 13:57:04 EET 2014] Registry obtained java.rmi.ConnectException: Connection refused to host: 192.168.56.1; nested exception is: java.net.ConnectException: Connection refused: connect at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at sun.rmi.server.UnicastRef.newCall(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source) at org.kuwaiba.persistenceservice.Main.main(Main.java:72) Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlai…
type: Question

http://stackoverflow.com/comment/42522338
type: AnswerComment
type: Comment
has text: I think you are misunderstanding. I am trying to output the value of the variable in the Converter class (the conversion class), not the name of the currency. Although from reading your response i figured out myself how to solve my problem, so thank you anyways?
comment on: http://stackoverflow.com/a/26995872
score: 0

http://stackoverflow.com/q/27114523
favorite count: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27114850
upvote count: 1
has title: stop start music - Libgdx Java
type: Question
tagged with: libgdx
score: 1
tagged with: java
has body: In my game I have a music class that organizes and plays all of the music: public class MusicPlayer extends Game{ (..) public static void MainBackgroundMusic(){ if(backgroundMusicPlaying != true){ backgroundMusic.play(); backgroundMusic.setVolume(0.1f); backgroundMusic.setLooping(true); backgroundMusicPlaying = true; } } public static void BackgroundStop(){ if(backgroundMusicPlaying = true){ backgroundMusic.stop(); } } I want to be able to stop the music from playing, during levels then restart it again. But when i try and restart it it doesn't play again. I call the music to play at the start of the game: public OptionScreen(final Game1 gam){ (..) MusicPlayer.MainBackgroundMusic(); (..) } public void render(float delta) { (..) } Then during the start of the level I call the stop: public InsaneLevels(Game1 gam) { (..) MusicPlayer.BackgroundStop(); (..) } public void render(float delta) { (..) } And when i go back to the start it doesn't replay.
accepted answer: http://stackoverflow.com/a/27114850
answer count: 1
downvote count: 0

nutiteq
tag name: nutiteq
type: Tag
tags question: http://stackoverflow.com/q/27104589

http://stackoverflow.com/a/27069995
upvote count: 1
has comment: http://stackoverflow.com/comment/66473698
has comment: http://stackoverflow.com/comment/42653675
answers question: http://stackoverflow.com/q/27069097
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27069097
has comment: http://stackoverflow.com/comment/66471094
type: Answer
has body: Check your minimum API level. The java.lang.AutoCloseable interface wasn't added to Android until API 19. So the Java 7 'try-with-resources' feature isn't available unless you are building with Java 7 and your minSdkVersion is set to 19.
score: 1

http://stackoverflow.com/a/27082864
score: 1
has comment: http://stackoverflow.com/comment/42674952
upvote count: 1
answers question: http://stackoverflow.com/q/27082556
has comment: http://stackoverflow.com/comment/42675048
accepted answer of: http://stackoverflow.com/q/27082556
has body: Your value t is static. So the way you tried to synchronize things, it was doomed to failure. You actually didn't synchronize anything because you have many different MRCTask instances (10000 in fact). Each one of them has a separate lock/monitor. Try changing your code in MRCTask to this: private static final Object LOCK = new Object(); public void processTask() { synchronized (LOCK) { t += 5; } } This is different, now you use a shared lock. See if you still get unpredictable/random results. You won't. Previously you were just having a classical race condition.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42674960
type: Answer

http://stackoverflow.com/q/27032856
score: 0
has comment: http://stackoverflow.com/comment/42589116
answer count: 1
tagged with: jms
has answer: http://stackoverflow.com/a/27854750
type: UnansweredQuestion
tagged with: connection-pooling
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42587328
type: Question
has body: I am getting below two exceptions while publishing messages (50 messages at a time) in queue. I'm using ThreadLocal(includes JMS publishing class also) in my project. I really don't have any clue why this occurs. Any help to move further is appreciated. Thanks in advance. Exception:javax.jms.JMSException: CWSIA0024E: The JCA runtime failed to create a session. at com.ibm.ws.sib.api.jms.impl.JmsConnectionImpl.createJcaSession(JmsConnectionImpl.java:951) at com.ibm.ws.sib.api.jms.impl.JmsConnectionImpl.createSession(JmsConnectionImpl.java:340) at com.ibm.ws.sib.api.jms.impl.JmsQueueConnectionImpl.createQueueSession(JmsQueueConnectionImpl.java:115) ... ... Caused by: com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException: Connection not available, Timed out waiting for 180001 at com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1721) at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:3321) at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:2567) at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:1544) at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:1027) at com.ibm.ws.sib.api.jmsra.impl.JmsJcaConnectionImpl.createSession(JmsJcaConnectionImpl.java:394) at com.ibm.ws.sib.api.jms.impl.JmsConnectionImpl.createJcaSession(JmsConnectionImpl.java:946) Exception:javax.jms.JMSException: CWSIA0005E: The JCA runtime failed to create a connection ... Code to publish:: try { QueueConnectionFactory queueFactory = null; queueFactory = getQueueConnectionFactory(ConnectionFactoryJNDIName); // Create a QueueConnection queueConnection = queueFactory.createQueueConnection(); try { // Create a QueueSession queueSession = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE); Queue queue = getQueue(queueJNDIName); // Create the Publisher queueSender = queueSession.createSender(queue); // Create a message ObjectMessage objMsg = queueSession.createObjectMessage(object); // Publish the message queue…
tagged with: websphere-8
has title: JMSException: CWSIA0005E: The JCA runtime failed to create a connection
has comment: http://stackoverflow.com/comment/42587203

solaris
tags question: http://stackoverflow.com/q/27143810
tags question: http://stackoverflow.com/q/27054464
type: Tag
tag name: solaris
tags question: http://stackoverflow.com/q/26996636

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/27005911

http://stackoverflow.com/q/27031442
answer count: 1
has answer: http://stackoverflow.com/a/27031502
type: UnansweredQuestion
tagged with: android
has title: Eclipse ADT won't run/install android application
score: 0
tagged with: java
tagged with: eclipse
has body: I am new to android application development. I have the eclipse ADT, JDK 7 and an android device (Nexus 5). I made a test app and would like to try it out on my Nexus. However, when I click the green "run" button, nothing happens. My device is connected via USB and also show when i do adb devices and also in the DDMS so my drivers are installed correctly. I can also see the logcat for everything happening on my phone in realtime through the eclipse ADT. When I click run, nothing happens.
type: Question
tagged with: adt

http://stackoverflow.com/comment/42721844
type: QuestionComment
has text: @user3437460 There's a given text document consisting of roughly 100 integers in the range long, separated by white spaces and a positive integer in the range int. Our goal is to find the exponent of the given positive integer in the product of the integers in the given text document i.e. to find how many times does the given positive integer evenly divide the product of the numbers in the text document.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27106502

http://stackoverflow.com/q/27050023
score: 0
linked to: http://stackoverflow.com/q/22091792
has comment: http://stackoverflow.com/comment/42618387
has body: I want to create stardust application. When I configure tomcat server and Audit Trial DataSource (using documentation http://help.eclipse.org/luna/topic/org.eclipse.stardust.docs.wst/html/wst-integration/configuration.html?cp=60_7_4_2) and start server I get: lis 20, 2014 10:15:54 PM org.apache.tomcat.util.digester.Digester startElement SEVERE: Begin event threw exception java.lang.ClassNotFoundException: org.eclipse.stardust.ide.wst.server.tomcat.EmbeddedDerbyLifecycleListener at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360)... I use Eclipse Luna, Tomcat 7, java 8 and ArchLinux. I've installed all Eclipse Process Manager plugins. What could cause that problem ?
has comment: http://stackoverflow.com/comment/42618182
has title: Eclipse + Tomcat 7 + Audit Trial DataSource - Server Failed to start
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/27201434
type: Question
answer count: 1
tagged with: tomcat

http://stackoverflow.com/q/27024824
has comment: http://stackoverflow.com/comment/42573301
answer count: 1
has body: I was going through a couple of questions that are often asked in job interviews (at least in my country - Switzerland), and I was quite unsure about the output of a block of code that is supposed to be tricky. It would be nice to hear what you think the correct answer is. here it is : ￼ public class LanguageTest12 { public static void main(String... args){ System.out.println(foo()); } private static int foo() { int a = 1, b = 2; try { return a+b; } finally { a = 10; b = 20; return a+b; } } } I know however that the answer must be one of those three possibilities : 3 30 33 (PS: just in case someone is interested, here are the all the questions : http://se.inf.ethz.ch/courses/2014a_spring/JavaCSharp/exercise_sessions/ExerciseSession5.pdf)
linked to: http://stackoverflow.com/q/4559661
linked to: http://stackoverflow.com/q/2309964
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42573269
tagged with: java
type: Question
has title: Try/Finally - Job Interview
has comment: http://stackoverflow.com/comment/42586293
has answer: http://stackoverflow.com/a/27024923
accepted answer: http://stackoverflow.com/a/27024923
score: 0
has comment: http://stackoverflow.com/comment/42573820
duplicate of: http://stackoverflow.com/q/2309964

http://stackoverflow.com/q/27069276
has body: I'm trying to connect Twinfield logon api through Java. The code I tried is import java.net.URL; import javax.xml.namespace.QName; import javax.xml.soap.MessageFactory; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPBodyElement; import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPConnectionFactory; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPMessage; import javax.xml.soap.MimeHeaders; import java.io.ByteArrayInputStream; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class SoapTest { public static void main(String[] args) { try { SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance(); SOAPConnection connection = sfc.createConnection(); MessageFactory mf = MessageFactory.newInstance(); SOAPMessage sm = mf.createMessage(); SOAPHeader sh = sm.getSOAPHeader(); SOAPBody sb = sm.getSOAPBody(); //sh.detachNode(); QName logonName = new QName("http://www.twinfield.com", "Logon"); SOAPBodyElement logonElement = sb.addBodyElement(logonName); QName userTag = new QName("user"); SOAPElement user = logonElement.addChildElement(userTag); user.addTextNode("myuser"); QName passwordTag = new QName("password"); SOAPElement password = logonElement.addChildElement(passwordTag); password.addTextNode("mypassword"); QName organisationTag = new QName("organisation"); SOAPElement organisation = logonElement.addChildElement(organisationTag); organisation.addTextNode("myorg"); System.out.println("\n Soap Request:\n"); sm.writeTo(System.out); System.out.println(); URL endpoint = new URL("https://login.twinfield.com/webservices/session.asmx"); SOAPMessage response = connection.call(sm, endpoint); connection.close(); //System.out.println(response.getContentDescription()); //System.out.println("--------------------------"); // Reading response printSOAPResponse(response); } catch (Exception ex) { ex.printStackTrace(); } } private static void printSOAPResponse(SOAPMessage soapResponse) throw…
tagged with: web-services
score: 2
downvote count: 0
has title: Twinfield - Server did not recognize the value of HTTP Header SOAPAction
tagged with: java
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/50794466
answer count: 2
has answer: http://stackoverflow.com/a/27109593
favorite count: 0
has answer: http://stackoverflow.com/a/54761024
tagged with: soap
tagged with: soap-client
type: UnansweredQuestion

http://stackoverflow.com/comment/42783676
type: Comment
has text: Shall I delete the tmp folder from the terminal or can I do it manually
comment on: http://stackoverflow.com/a/27141099
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42555780
type: Comment
comment on: http://stackoverflow.com/a/27014829
has text: Yes, there were extra javaw process, removing there it resolve the problem. Thanks a lot.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27039634
score: 0
has body: I need to perform a method after the clicking of a JButton in a Java Project. I'm making a client-server game and after the click of a button I need that the client/server start to wait untill the opponent perform a click. The problem is that at the end of the action listener code I start a loop end untill the opponent don't perform another click the jbutton stays clicked.. public void actionPerformed(ActionEvent e) { JButton o = (JButton)e.getSource(); String name = o.getName().substring(3); Click(Integer.parseInt(name)); if(isServer) ListenServer(); else ListeClient(); } ListenServer() and ListenClient() are two loop function... How can I call this methods AFTER the click??? Thanks and sorry for the bad english
accepted answer: http://stackoverflow.com/a/27040097
tagged with: jframe
linked to: http://stackoverflow.com/q/11366330
tagged with: swing
tagged with: jbutton
tagged with: actionlistener
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42598782
type: Question
duplicate of: http://stackoverflow.com/q/11366330
answer count: 1
has title: Method after a ActionListener
has answer: http://stackoverflow.com/a/27040097

http://stackoverflow.com/q/27054264
has answer: http://stackoverflow.com/a/27054303
favorite count: 0
possible better answer: http://stackoverflow.com/a/27055073
downvote count: 2
has answer: http://stackoverflow.com/a/27055073
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42625120
tagged with: command-prompt
has body: The file name is BookDemo.java and I compiled it like this: javac bookpack\BookDemo.java This is my block of code: package bookpack; class Book { private String title; private String author; private int pubDate; Book(String t, String a, int d) { title = t; author = a; pubDate = d; } void show() { System.out.println(title); System.out.println(author); System.out.println(pubDate); System.out.println(); } } class BookDemo { public static void main(String args[]) { Book books[] = new Book[5]; books[0] = new Book("Java: A Beginner's Guide", "Schildt", 2011); books[1] = new Book("Java: The Complete Reference", "Schildt", 2011); books[2] = new Book("The Art of Java", "Schildt and Holmes", 2003); books[3] = new Book("Red Storm Rising", "Clancy", 1986); books[4] = new Book("On the Road", "Kerouac", 1955); for(int i=0; i &lt; books.length; i++) books[i].show(); } } The output is this: javac: file not found:bookpack\BookDemo.java Usage: javac &lt;options&gt; &lt;source files&gt; use -help for a list of possible options How can you fix this so that the code will execute? Thank you for your help!!!
tagged with: java
has comment: http://stackoverflow.com/comment/42625127
has comment: http://stackoverflow.com/comment/42625165
has answer: http://stackoverflow.com/a/27054400
type: Question
score: -1
accepted answer: http://stackoverflow.com/a/27054400
has comment: http://stackoverflow.com/comment/42625139
linked to: http://stackoverflow.com/q/2079635
linked to: http://stackoverflow.com/q/1279542
answer count: 3
has title: Command Prompt: java file not found

http://stackoverflow.com/comment/91259266
score: 0
type: AnswerComment
has text: This answer is in Matlab language, however the same does apply to Java directly. By following this advice my program dropped from 1GB ram at 1min after start to 56mb. Looping and preparing statements makes it grow like a snowball. Opening and closing connections might take you a little more time in processing, but it keeps ram and GC at bay.
type: Comment
comment on: http://stackoverflow.com/a/38378052

http://stackoverflow.com/comment/42580573
comment on: http://stackoverflow.com/q/27028215
type: QuestionComment
has text: 1) Why code an applet? If it is due to the teacher specifying it, please refer them to [Why CS teachers should **stop** teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). 2) The best way to deploy a Java desktop application is using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info).
type: Comment
score: 2

http://stackoverflow.com/comment/42583108
score: 0
type: Comment
has text: Can I suggest something? how about using random number formula rand.nextInt((max+1) - min) + min; to be sure that always the op get zero or one for first number for example? does my solution make sense?
comment on: http://stackoverflow.com/a/27030410
type: AnswerComment

http://stackoverflow.com/comment/42708117
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27101865
has text: In your `MainWindow` class, you need to set ResultsTabPanel as non-static, or provide the setter that I described.
score: 1

http://stackoverflow.com/comment/42756788
type: AnswerComment
type: Comment
has text: Right on. Multiple inheritance would be like `Prof extends Person, AndSomethingElse` and that's not possible in java.
comment on: http://stackoverflow.com/a/27128824
score: 0

http://stackoverflow.com/comment/42539037
type: QuestionComment
comment on: http://stackoverflow.com/q/27004392
has text: @Jackson, ok I can read but **average number of probes**. I don't know how to interpret this, you have to count amount conditional statements or what, help me help you.
score: 0
type: Comment

http://stackoverflow.com/a/27104630
downvote count: 0
has body: You can use a ServletContextListener to listen for a contextDestroyed event. If you are using the Spring integration for Vaadin, you can also use a simple lifecycle listener bean to track events you need to react to.
type: Answer
answers question: http://stackoverflow.com/q/27104503
score: 1
upvote count: 1

http://stackoverflow.com/q/27111806
has answer: http://stackoverflow.com/a/65710362
tagged with: java
has title: Validation form in Spring using @Valid not work
has comment: http://stackoverflow.com/comment/52020691
type: Question
has answer: http://stackoverflow.com/a/74956032
possible better answer: http://stackoverflow.com/a/61897103
tagged with: validation
downvote count: 0
has answer: http://stackoverflow.com/a/66093090
favorite count: 0
has answer: http://stackoverflow.com/a/73529718
has answer: http://stackoverflow.com/a/61897103
answer count: 9
tagged with: controller
has body: I want to validation my form, but this not work. My entity class import java.io.Serializable; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.Email; @Entity @Table(name = "users") public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(name = "id") private Integer id; @NotNull @Size(max = 20) @Column(name = "username") private String username; @NotNull @Size(max = 20) @Column(name = "password") private String password; @NotNull @Size(max = 20) @Column(name = "firstName") private String firstName; @NotNull @Size(max = 20) @Column(name = "lastName") private String lastName; @Size(min = 11, max = 11) @Column(name = "personalId") private String personalId; @Size(max = 40) @Column(name = "city") private String city; @Size(max = 40) @Column(name = "address") private String address; @NotNull @Email @Size(max = 30) @Column(name = "email") private String email; @Size(min = 9, max = 9) @Column(name = "phone") private String phone; @OneToMany(mappedBy = "user") private Set&lt;UserRole&gt; userRoleSet; } adminList.jsp and form go to addAdmin page: &lt;form action="addAdminForm" method="post"&gt; &lt;input type="submit" value="Dodaj administratora" /&gt; &lt;/form&gt; addAdmin.jsp page formule: &lt;form:form action="addAdmin" modelAttribute="user" method="post"&gt; &lt;form:label path="username"&gt;Login: &lt;/form:label&gt; &lt;form:input path="username" /&gt; &lt;form:errors path="username" cssClass="error" /&gt; &lt;br /&gt; &lt;form:label path="password"&gt;Hasło: &lt;/form:label&gt; &lt;form:password path="password" /&gt; &lt;form:errors path="password" cssClass="error" /&gt; &lt;br /&gt; &lt;form:label path…
tagged with: spring
has answer: http://stackoverflow.com/a/27112083
accepted answer: http://stackoverflow.com/a/27112083
has answer: http://stackoverflow.com/a/37089075
has answer: http://stackoverflow.com/a/66869068
score: 16
has answer: http://stackoverflow.com/a/49967252
upvote count: 16
type: AnsweredQuestion

http://stackoverflow.com/q/27006847
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27006928
has body: I am running into an issue where I need to get the Longitude / Latitude from an address that is passed into an AsyncTask that retrieves a Google Static Map. This AsyncTask can take a set of coordinates and create a map, and it can also take an address that is retrieved using Google Places API. The issue I am having is that I don't know how I can retrieve the coordinates of the address that is passed in. Does anyone know a way that I can get the Long/Lat? The only way I have figured out how to do it is by using another AsyncTask. I would rather not make 2 requests though. CREATE STATIC MAP class CreateStaticMapAsyncTask extends AsyncTask { private static final String STATIC_MAPS_API_BASE = "https://maps.googleapis.com/maps/api/staticmap"; private static final String STATIC_MAPS_API_SIZE = "300x300"; @Override protected void onPreExecute() { addTask(); // adds one to task count. super.onPreExecute(); } @Override protected Bitmap doInBackground(String... params) { // TODO Auto-generated method stub locationString = params[0]; Log.e("LOCATION STRING", locationString); Bitmap bmp = null; StringBuilder sb = new StringBuilder(STATIC_MAPS_API_BASE); try { sb.append("?center=").append( URLEncoder.encode(locationString, "UTF-8")); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } sb.append("&amp;size=" + STATIC_MAPS_API_SIZE); sb.append("&amp;key=" + API_KEY); String url = new String(sb.toString()); Log.e("URL", sb.toString()); HttpClient httpclient = new DefaultHttpClient(); HttpGet request = new HttpGet(url); InputStream in = null; try { in = httpclient.execute(request).getEntity().getContent(); bmp = BitmapFactory.decodeStream(in); in.close(); } catch (Exception e) { e.printStackTrace(); } return bmp; } protected void onPostExecute(Bitmap bmp) { super.onPostExecute(bmp); if (bmp != null) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); data = stream.toByt…
tagged with: google-maps-static-api
score: 0
tagged with: google-maps
answer count: 1
has title: Issue retrieving longitude/latitude using Google Static Maps
tagged with: android-asynctask

http://stackoverflow.com/comment/42530996
type: QuestionComment
type: Comment
has text: And what is the question? You already have a suitable type for buyable objects from the machine. You only need to create new instances of them with their data (i.e., name, price, ...).
comment on: http://stackoverflow.com/q/26999158
score: 0

http://stackoverflow.com/comment/42781901
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27142406
has text: try add modifier "volatile" to val1.

jnlp
tags question: http://stackoverflow.com/q/27035359
tag name: jnlp
tags question: http://stackoverflow.com/q/27015848
type: Tag

http://stackoverflow.com/q/27016675
has title: Setting the font of a JTextArea
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has body: I want to create a Text Editor in Java. Here is what I've written so far: package com.thundercrust.applications; import java.awt.BorderLayout; public class TextEditor implements ActionListener{ private static String[] fontOptions = {"Serif", "Agency FB", "Arial", "Calibri", "Cambrian", "Century Gothic", "Comic Sans MS", "Courier New", "Forte", "Garamond", "Monospaced", "Segoe UI", "Times New Roman", "Trebuchet MS", "Serif"}; private static String[] sizeOptions = {"8", "10", "12", "14", "16", "18", "20", "22", "24", "26", "28"}; ImageIcon newIcon = new ImageIcon("res/NewIcon.png"); ImageIcon saveIcon = new ImageIcon("res/SaveIcon.png"); ImageIcon openIcon = new ImageIcon("res/OpenIcon.png"); ImageIcon fontIcon = new ImageIcon("res/FontIcon.png"); ImageIcon changeFontIcon = new ImageIcon("res/ChangeFontIcon.png"); JButton New = new JButton(newIcon); JButton Save = new JButton(saveIcon); JButton Open = new JButton(openIcon); JButton changeFont = new JButton(changeFontIcon); JLabel fontLabel = new JLabel(fontIcon); JLabel fontLabelText = new JLabel("Font: "); JLabel fontSizeLabel = new JLabel("Size: "); JComboBox &lt;String&gt; fontName = new JComboBox&lt;&gt;(fontOptions); JComboBox &lt;String&gt; fontSize = new JComboBox&lt;&gt;(sizeOptions); JToolBar tool = new JToolBar(); JTextArea texty = new JTextArea(); JScrollPane scroll = new JScrollPane(texty); private static final int WIDTH = 1366; private static final int HEIGHT = WIDTH / 16 * 9; private static String name = "Text Editor"; private static JFrame frame = new JFrame(); public void Display() { frame.setTitle(name); frame.setSize(WIDTH, HEIGHT); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setResizable(false); frame.setVisible(true); New.addActionListener(this); New.setToolTipText("Creates a new File"); Save.addActionListener(this); Save.setToolTipText("Saves the current File"); Open.addActionListener(this); Open.setToolTipText("Opens a file"); changeFont.addActio…
tagged with: fonts
tagged with: java
linked to: http://stackoverflow.com/q/14589119
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/42558672
score: 3
tagged with: jtextarea
upvote count: 3
has answer: http://stackoverflow.com/a/27021076
accepted answer: http://stackoverflow.com/a/27021076
answer count: 1

http://stackoverflow.com/q/27097126
downvote count: 0
has answer: http://stackoverflow.com/a/37411283
favorite count: 0
has body: I've tried several different approaches, including the one found here (which in turn led me to trying both of the top answers to this question), as well as using reflection to get access to the TextView and setting the relevant methods. Both attempts failed, the former resulting in no text at all being set to the title (and I was setting the text to the proper textview element), the latter setting the text and removing the ellipse, but not marqueeing at all. Below is my reflection attempt. import android.content.Context; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.AttributeSet; import android.widget.TextView; import android.widget.Toast; import java.lang.reflect.Field; public class MarqueeToolbar extends Toolbar { public MarqueeToolbar(Context context) { super(context); } public MarqueeToolbar(Context context, AttributeSet attrs) { super(context, attrs); } public MarqueeToolbar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public void setTitle(CharSequence title) { if (!reflected) { reflected = reflectTitle(); } super.setTitle(title); } @Override public void setTitle(int resId) { if (!reflected) { reflected = reflectTitle(); } super.setTitle(resId); } boolean reflected = false; private boolean reflectTitle() { try { Field field = Toolbar.class.getDeclaredField("mTitleTextView"); field.setAccessible(true); TextView titleView = (TextView) field.get(this); titleView.setEllipsize(TextUtils.TruncateAt.MARQUEE); titleView.setMarqueeRepeatLimit(-1); return true; } catch (NoSuchFieldException e) { e.printStackTrace(); return false; } catch (IllegalAccessException e) { e.printStackTrace(); return false; } catch (NullPointerException e) { e.printStackTrace(); return false; } } }
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/54428286
accepted answer: http://stackoverflow.com/a/27762114
tagged with: android-actionbar
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10034639
has title: Marquee title in Toolbar / ActionBar in Android with Lollipop SDK?
tagged with: java
linked to: http://stackoverflow.com/q/8607707
has answer: http://stackoverflow.com/a/28879135
score: 10
upvote count: 10
tagged with: android-5.0-lollipop
tagged with: android-toolbar
possible better answer: http://stackoverflow.com/a/28879135
has answer: http://stackoverflow.com/a/27557171
has answer: http://stackoverflow.com/a/27762114

http://stackoverflow.com/comment/42731732
score: 1
comment on: http://stackoverflow.com/q/27114463
has text: Its just basic HTML at that point.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42546738
type: QuestionComment
comment on: http://stackoverflow.com/q/27008937
score: 0
has text: Add some plugins to your browser for inspecting what are wrongs with your script. BTW,, what the type of sorting is that?
type: Comment

http://stackoverflow.com/a/53585190
has comment: http://stackoverflow.com/comment/113078608
has body: I hope this can help somebody, a little late but, just I had this problem, ok my solution it next: 1. Run your code normally and copy the command line that the IntellijIDEA made, see the screenshot. 2.Copy and paste the command line that it uses to use with your params.
answers question: http://stackoverflow.com/q/27108911
upvote count: 35
downvote count: 0
has comment: http://stackoverflow.com/comment/106000823
type: Answer
has comment: http://stackoverflow.com/comment/97357559
has comment: http://stackoverflow.com/comment/95238568
score: 35

http://stackoverflow.com/a/27134837
answers question: http://stackoverflow.com/q/27134676
has comment: http://stackoverflow.com/comment/42788615
score: 0
has comment: http://stackoverflow.com/comment/42774615
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27134676
has comment: http://stackoverflow.com/comment/42778978
has body: On Android, the accelerometer results from onSensorChanged are in units of m/sec^2, where the gravitational constant G is commonly known to be 9.81 m/sec^2. Note that this is different from iOS, where the accelerometer API returns data in units of G. So to convert your data to units of G, divide your data by 9.81 m/sec^2. Note also that if your device is laying on a flat surface and not moving, then the z-axis will always have a force acting on it, namely gravity. It will be -9.81 or 9.81 depending on if your device is facing up or down.
has comment: http://stackoverflow.com/comment/42776524
type: Answer
has comment: http://stackoverflow.com/comment/42772890
has comment: http://stackoverflow.com/comment/42769103
has comment: http://stackoverflow.com/comment/42771833

http://stackoverflow.com/a/27448632
has body: Here's what has worked for me. on the command line go to the root directory of the project ensure that your JAVA_HOME environment variable points to the version of the java sdk you are going to use. On a Mac via the bash shell that would look something like this: export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home' (click here to find out how to find your Java Home) To clean type ./gradlew clean To build the library type ./gradlew aR (This may take a while) You should now find the .aar file in mymodulename/build/outputs/aar Thanks to geekgarage for clarification.
answers question: http://stackoverflow.com/q/27148599
score: 4
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/27006372
score: 0
type: Answer
has body: public class Fan { final int SLOW = 1; final int MEDIUM = 2; final int FAST = 3; public int speed = SLOW; public boolean on = false; public double radius = 5; public String color = new String("blue"); //fan on void fanOn() { on = true; return on; } //fan off void fanOff() { on = false; return on; } //sets fan speed void setSpeed(String speed) { this.speed=speed; } //sets custom radius double setRadius(double rad) { rad = radius; return rad; } //sets custom color void setColor(String colorType) { color = colorType; } //toString() method public String toString() { return ("Speed: " + speed + "\nRadius: " + radius + "\nColor: " + "\nOn: " + on); } } //test program public class TestFan { public static void main(String[] args) { Fan fan1 = new Fan(); fan1.setColor("green"); fan1.setSpeed("FAST"); fan1.setRadius(3.5); fan1.fanOff(); System.out.println(fan1.toString()); } }
answers question: http://stackoverflow.com/q/27006339

http://stackoverflow.com/q/27066018
has answer: http://stackoverflow.com/a/27066136
downvote count: 1
accepted answer: http://stackoverflow.com/a/27066136
has body: Consider the scenario below: Public Class A { ..... static void DoSomething(){ int a=some mathematical operation; int b[10]; } } Public Class B{ .... public static void main(String[] args) { for(int i=0;i&lt;10;i++){ A.DoSomething; } } } Here the mathematical operation in Class A is being executed over a forloop in the main program, what I want to achieve is that I want to store the value of variable being calculated in Class A after every iteration into Array b. In the end I want my output to look like this: b[10]=[iteration1value iteration2value......iteration10value]
favorite count: 0
possible better answer: http://stackoverflow.com/a/27066327
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/27066327
has title: How to store values in an Array after every iteration?
score: -1

http://stackoverflow.com/q/27110169
score: 0
tagged with: selenium
type: Question
tagged with: java
has title: WebDriver - Unable to locate element
tagged with: webdriver
has comment: http://stackoverflow.com/comment/42723376
answer count: 1
has comment: http://stackoverflow.com/comment/42726205
type: UnansweredQuestion
has body: I am testing a website where I have to submit the form. I entered the username, password. Clicked Submit. But even though the form is submitted, I getting the following error message for submit: Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"name","selector":"submit"} code: driver.findElement(By.name("submit")); I wanted to know why this error occurs.
has comment: http://stackoverflow.com/comment/42727684
has comment: http://stackoverflow.com/comment/42738675
has comment: http://stackoverflow.com/comment/42725743
has comment: http://stackoverflow.com/comment/42724691
has answer: http://stackoverflow.com/a/27110811
has comment: http://stackoverflow.com/comment/42830987

http://stackoverflow.com/comment/42523263
score: 1
type: AnswerComment
has text: Tks for the advice @Rick.
type: Comment
comment on: http://stackoverflow.com/a/26994606

http://stackoverflow.com/a/27189699
score: 0
type: Answer
has body: Think outside the box. Label button = new Label(parent, SWT.BORDER); button.setToolTipText("Email Settings..."); button.setImage(SWTResourceManager.getImage(Settings.class, "settings1616.png")); button.setBounds(494, 26, 28, 25); button.setCursor(Display.getDefault().getCursor(SWT.CURSOR_HAND)); button.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { // Do your thing } });
answers question: http://stackoverflow.com/q/27109374

http://stackoverflow.com/comment/42680612
comment on: http://stackoverflow.com/q/27085977
score: 0
has text: Thank You @AndrewThompson, I did reduce my original code to just the areas that I am having issues with, which is what I posted. This is probably about 1/4 of my original code for my full program.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42711393
type: Comment
has text: OK, yes the OP can do what they like. But if **you** want to get better, educate yourself on side effects: http://en.wikipedia.org/wiki/Side_effect_%28computer_science%29
comment on: http://stackoverflow.com/a/27103372
score: 0
type: AnswerComment

http://stackoverflow.com/q/27116889
tagged with: java
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/27116908
type: Question
has title: The basic pattern to implement a asynchronous logging
has body: In my web application, we do some socket job in our servlet, and we log socket data into database. I want to make that logging process asynchronous to improve performance. My idea is using a separate dedicated thread to do the logging job. In my servlet, I just submit data to a cache, and let the logging thread to process them one by one. I have a little experience in threading, What collection I can use as the cache ? What's the basic code pattern to implement this ? Please provide some code to show how to achieve that. sorry for my poor English As my application is legacy system running in production environment.It just use servlet and jsp no other Java EE technology. It seems that adding JMS support is too expensive for me.
score: -1
has answer: http://stackoverflow.com/a/27117160
has answer: http://stackoverflow.com/a/27117164
tagged with: asynchronous
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
linked to: http://stackoverflow.com/q/15928091
answer count: 4
has comment: http://stackoverflow.com/comment/42736447
has answer: http://stackoverflow.com/a/27117398
has comment: http://stackoverflow.com/comment/42736257

http://stackoverflow.com/comment/71665201
has text: This works fine. You might have to cast ((NotFoundException)e).getResourceId() in the exception handler. I had to.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/33208126

http://stackoverflow.com/comment/42702101
type: AnswerComment
has text: [gcloud Tool](https://cloud.google.com/sdk/gcloud/#gcloud.auth) handles this use case by now.
comment on: http://stackoverflow.com/a/27037550
type: Comment
score: 1

http://stackoverflow.com/comment/42720054
has text: what exactly do you mean with fileInfo? I logged the file.length() at this point and it was zero. So I tried a simple text file and my method worked. Looks like the problem is this stupid .gnh FileFormat. is there another way to copy/ extract a folder?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27108158
type: QuestionComment

http://stackoverflow.com/q/27013367
has comment: http://stackoverflow.com/comment/42553608
tagged with: text
tagged with: java
has comment: http://stackoverflow.com/comment/42553763
has comment: http://stackoverflow.com/comment/42554500
type: Question
has title: Receive SMS with Java SE via GSM Modem (USB)?
has comment: http://stackoverflow.com/comment/42553352
has body: Can someone give me a code to receive SMS via GSM modem (USB) with Java? I have been searching for this code a while and I didn't find anything. Thank you
has comment: http://stackoverflow.com/comment/42553571
answer count: 0
tagged with: sms
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/27056860
tagged with: spring
upvote count: 6
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27057460
has answer: http://stackoverflow.com/a/27058643
tagged with: java
has comment: http://stackoverflow.com/comment/42631814
type: Question
has comment: http://stackoverflow.com/comment/42632116
downvote count: 0
has answer: http://stackoverflow.com/a/27057421
tagged with: spring-security
has body: First of all this is not a duplicate question i checked answers here! and here! but couldnt get it to work. Also i want to perform it just before logout so can not use logoutSuccessHandler. So i need to create a custom LOGOUT_FILTER , with which i am really having hard time getting it to work. here is my spring-security xml in which i tried two methods first was :- &lt;custom-filter ref="logoutFilter" position="LOGOUT_FILTER" /&gt; &lt;beans:bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter"&gt; &lt;beans:constructor-arg index="0" value="/logoutSuccess" /&gt; &lt;beans:constructor-arg index="1"&gt; &lt;beans:list&gt; &lt;beans:bean id="securityContextLogoutHandler" class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" /&gt; &lt;beans:bean id="myLogoutHandler" class="com.fe.cms.listener.SimpleLogoutHandler" /&gt; &lt;/beans:list&gt; &lt;/beans:constructor-arg&gt; &lt;beans:property name="filterProcessesUrl" value="/logout" /&gt; &lt;/beans:bean&gt; but this gives me error Configuration problem: Security namespace does not support decoration of element [custom-filter] then i tried.. &lt;beans:bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter"&gt; &lt;beans:constructor-arg index="0" value="/logout" /&gt; &lt;beans:constructor-arg index="1"&gt; &lt;beans:ref bean="securityContextLogoutHandler" /&gt; &lt;beans:ref bean="myLogoutHandler" /&gt; &lt;/beans:constructor-arg&gt; &lt;beans:property name="filterProcessesUrl" value="/logout" /&gt; &lt;/beans:bean&gt; &lt;beans:bean id="securityContextLogoutHandler" class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" /&gt; &lt;beans:bean id="myLogoutHandler" class="com.fe.cms.listener.SimpleLogoutHandler" /&gt; &lt;http auto-config="false" entry-point-ref="authenticationManger"&gt; &lt;custom-filter ref="logoutFilter" position="LOGOUT_FILTER" /&gt; &lt;/http&g…
has comment: http://stackoverflow.com/comment/42632155
answer count: 3
has comment: http://stackoverflow.com/comment/42629544
favorite count: 0
has title: how to perform operation just before logout in spring?
has comment: http://stackoverflow.com/comment/42631860
accepted answer: http://stackoverflow.com/a/27058643
score: 6
possible better answer: http://stackoverflow.com/a/27057421

http://stackoverflow.com/a/27110556
has comment: http://stackoverflow.com/comment/42749140
has comment: http://stackoverflow.com/comment/42811269
has comment: http://stackoverflow.com/comment/42724952
answers question: http://stackoverflow.com/q/27109944
score: 10
accepted answer of: http://stackoverflow.com/q/27109944
has comment: http://stackoverflow.com/comment/42746688
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42810405
has comment: http://stackoverflow.com/comment/42824924
has comment: http://stackoverflow.com/comment/42724488
has comment: http://stackoverflow.com/comment/42724668
upvote count: 10
type: Answer
has body: It is not the JIT compiler. Most of those 70 milliseconds are spent on the initialization of the whole lambda subsystem (the entry point to that logic is probably the LambdaMetaFactory class) and a good bit is also spent on the lambda bootstrap call (the linkage phase, as mentioned by user fge). Check out this method, the same as yours but with all the steps separately measured (and I use nanoTime): public static void Iterate(int[] values, int from, int to) { long start = System.nanoTime(); final IntPredicate predicate = i -&gt; i &lt; to &amp;&amp; i &gt; from; System.out.println("Predicate lambda creation time:" + NANOSECONDS.toMillis(System.nanoTime() - start)); start = System.nanoTime(); final IntConsumer action = System.out::println; System.out.println("Action lambda creation time:" + NANOSECONDS.toMillis(System.nanoTime() - start)); start = System.nanoTime(); final IntStream stream = IntStream.of(values).filter(predicate); System.out.println("Stream creation time:" + NANOSECONDS.toMillis(System.nanoTime() - start)); start = System.nanoTime(); stream.forEach(action); System.out.println("Stream consumption time:" + NANOSECONDS.toMillis(System.nanoTime() - start)); } This is what was printed on my machine: Predicate lambda creation time:53 Action lambda creation time:2 Stream creation time:2 599 Stream consumption time:1 Predicate lambda creation time:0 Action lambda creation time:0 Stream creation time:0 201 ... all timings zero from here on... You can see that the entire overhead of the first call is in the lambda creation part (which, on the first run only, includes general initialization and linkage) and stream creation also takes some time. Actual stream consumption takes zero time in all cases. This effect is definitely something to keep on your mind with the current version of HotSpot: lambda bootstrap is an expensive thing. Final note: if you reorder the lambda creation statements, you'll see that the majority of time stays with the first lambda to be cre…
has comment: http://stackoverflow.com/comment/42809211
has comment: http://stackoverflow.com/comment/42789525
has comment: http://stackoverflow.com/comment/42810700
has comment: http://stackoverflow.com/comment/42725246
has comment: http://stackoverflow.com/comment/42724830

http://stackoverflow.com/comment/42657113
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27072403
has text: You could try formatting the text in HTML, [for example](http://stackoverflow.com/questions/14737810/jlabel-show-longer-text-as-multiple-lines/14738193#14738193) or use a non-editable text area

http://stackoverflow.com/comment/42741095
type: AnswerComment
comment on: http://stackoverflow.com/a/27119733
type: Comment
has text: @PascalCuoq the other answer doesn't really answer the question though, I said I wasn't interested in work-arounds for my specific problem - rather I wanted to how to find the float value nearest to but not above a double.
score: 1

http://stackoverflow.com/a/27062201
downvote count: 0
has body: Just convert it to a BufferedImage first, using javafx.embed.swing.SwingFXUtils: Image image = ... ; // javafx.scene.image.Image String format = ... ; File file = ... ; ImageIO.write(SwingFXUtils.fromFXImage(image, null), format, file);
has comment: http://stackoverflow.com/comment/127419794
score: 26
has comment: http://stackoverflow.com/comment/127421060
upvote count: 26
type: Answer
answers question: http://stackoverflow.com/q/27054672

http://stackoverflow.com/a/27141641
has comment: http://stackoverflow.com/comment/42819451
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27141364
downvote count: 0
has comment: http://stackoverflow.com/comment/42782056
has body: It's hard to say without a preview of your output, but I'll take a stab. It looks like to me, during the second iteration of the do/while, if you use array sizes that are smaller than the original arrays then you could keep garbage from the first iteration. It's better practice to re-initialize these variable during each iteration. do { System.out.println("ENTER 2 SETS OF NUMBERS.\n"); System.out.println("HOW MANY NUMBERS IN YOUR FIRST SET?"); sizeA=kbd.nextInt(); while(sizeA&gt;MAXSIZE){ System.out.println("\nERROR: SET SIZE LIMIT EXCEEDED." + "ENTER A DIFFERENT AMOUNT. \n"); sizeA = kbd.nextInt(); } System.out.println("\nENTER THE FIRST SET OF NUMBERS"); setA = new int[MAXSIZE]; getData(setA, sizeA); sort(setA,sizeA); System.out.println("\nHOW MANY NUMBERS IN YOUR SECOND SET?"); sizeB=kbd.nextInt(); while(sizeB&gt;MAXSIZE){ System.out.println("\nERROR: SET SIZE LIMIT EXCEEDED. \n" + "ENTER A DIFFERENT AMOUNT.\n "); sizeB = kbd.nextInt(); } System.out.println("\nENTER THE SECOND SET OF NUMBERS"); setB = new int[MAXSIZE]; getData(setB, sizeB); sort(setB, sizeB); System.out.println("\nINTERSECTION:"); . . . . } while (repeat.equal('y')) Does this solve your problem? Like I said earlier, I don't completely understand your problem, so if this doesn't solve it please provide some more detail so I can help.
type: Answer

http://stackoverflow.com/comment/42632204
comment on: http://stackoverflow.com/q/27054822
has text: @PiyushGupta Thanks after reading all stuff of above 3 link's I learned a lot and the last link was very much helpful form me. I had some question still in my mind can I ask you ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27075089
type: Answer
upvote count: 14
score: 14
has comment: http://stackoverflow.com/comment/98656391
has body: You seem to be saying that: if (str != null) { doSomething(); } is throwing a NullPointerException in the comparison. That is impossible. So I expect that what is really happening is one of the following: You have misinterpreted the stack trace, and the NPE is not being thrown there. The actual code is substantially different to the illustrative example. You are not executing the code that you think you are executing. For example, you might not have recompiled it ... or you may be executing a stale copy of the .class or .jar file. You have managed to seriously confuse your IDE. (Sometimes you can get very strange behaviour from a confused IDE ...) The only situations where that code might give an NPE that is not an artefact of something else you are doing wrong is if have a damaged Java (or IDE) installation, or if your hardware is faulty. I would discount those explanations as basically implausible. Update Now you say that: Map params = new HashMap(); if(params != null &amp;&amp; params.get("requestType")) { //some null safe code goes here } throws an NPE in params.get. I have to say that this is nonsense. The code won't compile. The params.get call doesn't return something that is boolean or that can be automatically converted to a boolean. If we ignore the compilation errors, then params.get on a thread-confined map can only throw an NPE if params is null. This map is thread-confined, and the previous check ensures that params isn't null. My previous conclusions stand. This is impossible. Hint: this could be a threading problem. It is possible to get intermittent NPE's if you update a HashMap with one thread and read it with another, and you don't synchronize properly.
has comment: http://stackoverflow.com/comment/42706679
accepted answer of: http://stackoverflow.com/q/27074430
answers question: http://stackoverflow.com/q/27074430
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27107062
downvote count: 7
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/27107200
has title: My Program just doesn't work and i don't know why?
tagged with: jlabel
type: UnansweredQuestion
tagged with: jradiobutton
tagged with: jbutton
type: Question
has body: This is my code for a school project, i have to make a list of toppings to put on a Pizza and also Choose a Size. Every is okay, when I tick Sausage, Ham, Pepperoni 1$ is added, When I tick Pineapple, BlackOlives, Onion, GreenPepper 0.5$ is added. However when i tick Extra Cheese it adds like 10.25 or something and also the Size buttons don't seem to work. Please Explain this to me D: import javax.swing.JFrame; import javax.swing.JRadioButton; import java.awt.*; import javax.swing.*; import javax.swing.JButton; import javax.swing.Icon; import javax.swing.ImageIcon; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class RealPizza2 extends JFrame { public static void main(String args[]) { JOptionPane.showMessageDialog(null, "Welcome to Your Pizza Place! :)", "Your Pizza Place", JOptionPane.PLAIN_MESSAGE); JOptionPane.showMessageDialog(null, "Hi, Please choose from our selection of toppings", "Your Pizza Place", JOptionPane.PLAIN_MESSAGE); RealPizza2 go = new RealPizza2 (); go.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); go.setSize(300,450); go.setVisible(true); } private JLabel PS; private JLabel CT; private JButton Next; private JRadioButton Sausage; private JRadioButton Pepperoni; private JRadioButton Ham; private JRadioButton ExtraCheese; private JRadioButton Pineapple; private JRadioButton BlackOlives; private JRadioButton Onion; private JRadioButton GreenPepper; private JRadioButton ExtraLargePizza; private JRadioButton LargePizza; private JRadioButton MediumPizza; private JRadioButton SmallPizza; private ButtonGroup group; double PizzaPrice; public RealPizza2(){ super("Pizza Menu"); setLayout(new FlowLayout()); CT = new JLabel("Choose your Pizza toppings!"); CT.setFont(new Font("serif", Font.BOLD, 20)); PS = new JLabel("Choose your Pizza Size!"); PS.setFont(new Font("serif", Font.BOLD, 20)); PizzaPrice = 5; Sausage = new JRadioButton ("Would you like Sausage", false); Sausage.addActionListener(new ActionListener() { public void …
tagged with: java
has comment: http://stackoverflow.com/comment/42717424
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/42792889
has text: @Dziugas: environment variables set this way apply only within that command window. But that's the suggested way. You don't want to set a "global" CLASSPATH anyway.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27148939

http://stackoverflow.com/a/27090911
answers question: http://stackoverflow.com/q/27090792
type: Answer
has comment: http://stackoverflow.com/comment/42688566
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42688620
has body: Like I said in my comment, you need to save the previous choice. So it may look something like this: public static void main( String[] args ) throws Exception { int previousChoice = 0; for( int i = 1; i &lt;= 5; i++ ) { System.out.println("Select an Icecream:\n1.Strawberry\n2.Vanilla\n3.Chocolate\n4.Butterscotch\n5.Black current\n6.Exit"); DataInputStream in = new DataInputStream(System.in); int n = Integer.parseInt(in.readLine()); while (previousChoice == n) { System.out.println("Can't select the same ice-cream twice in a row, try again."); n = Integer.parseInt(in.readLine()); } previousChoice = n; // save previous choice switch( n ) { Disclaimer: this only works if you need to avoid selecting the same ice-cream twice in a row. If you need to make sure the choice is always unique, the solution will be different, but it'd be good to clarify it in your question.

http://stackoverflow.com/comment/42695966
score: 1
has text: `entry.getValue().size()`
comment on: http://stackoverflow.com/a/27094453
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42748632
has text: I have a doubt. When making a query like "select * from..." should I still use hibernateUtil class or should I handle it by using LocalSessionFactoryBean?
comment on: http://stackoverflow.com/q/27101048
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27133161
has comment: http://stackoverflow.com/comment/42765651
type: AnsweredQuestion
score: 2
tagged with: mapping
has answer: http://stackoverflow.com/a/27134352
has title: How to pass constructor's parameters with jackson?
upvote count: 2
linked to: http://stackoverflow.com/q/60061131
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42765046
type: Question
accepted answer: http://stackoverflow.com/a/27134352
has comment: http://stackoverflow.com/comment/42765429
has body: i am trying to desearlize an object using Jackson this.prepareCustomMapper().readValue(response.getBody(), EmailResponse.class); and i have this exception: org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class com.despegar.social.automation.services.emailservice.response.EmailResponse]: can not instantiate from JSON object (need to add/enable type information?) at [Source: java.io.StringReader@4f38f663; line: 1, column: 12] (through reference chain: com.despegar.social.automation.services.emailservice.response.EmailsResponse["items"]) at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163) at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObjectUsingNonDefault(BeanDeserializer.java:746) at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:683) at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:217) I know that this is happening because this is my constructor: public class EmailResponse extends MyServiceResponse { private String id; private String user_id; private String email; private Boolean is_primary; private Boolean is_confirmed; public EmailResponse(HttpResponse request) { super(request); } } So, my constructor recieve HttpResponse parameter and i am not passing it, but i don't know how to do it. I cant overcharge with an empty constructor because i need that to recieve HttpResponse object at this way. Is there any way to pass this constructor param when i call readValue() method? Or what could be the best option at this case? I appreciate your help. Regards
has comment: http://stackoverflow.com/comment/42765148
tagged with: jackson
has answer: http://stackoverflow.com/a/27133677
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/27133677
favorite count: 0
tagged with: serialization

http://stackoverflow.com/a/27003977
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42539052
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/27003715
score: 2
has body: Create a class named Setting public class Setting { public String password; public String name; public String lastname; } then create a hashmap as you are doing HashMap<String, Setting> mapList = new HashMap<String, Setting>(); Not that your hashmap is accepting key as String and object of setting class as Value So you can put the value into your hashmap as Setting setting = new Setting(); setting.password = "Your Password"; setting.name= "Your Name"; setting.lastname= "Your Lastname"; mapList.put("login", setting); Mark as up if it works for you.
accepted answer of: http://stackoverflow.com/q/27003715
has comment: http://stackoverflow.com/comment/42538800

http://stackoverflow.com/a/26993170
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42517482
answers question: http://stackoverflow.com/q/26993024
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26993024
has comment: http://stackoverflow.com/comment/42518860
has body: You have to format your string into date first like SimpleDateFormat formatter = new SimpleDateFormat("dd-mm-yyyy"); String dateInString = "7-07-2014"; try { Date date = formatter.parse(dateInString); System.out.println(date); System.out.println(formatter.format(date)); } catch (ParseException e) { e.printStackTrace(); } Match your db format accordingly txt_date.getText() is a string value try using following code: SimpleDateFormat formatter = new SimpleDateFormat("dd-mm-yyyy"); String dateInString = txt_date.getText(); try { Date date = formatter.parse(dateInString); System.out.println(date); System.out.println(formatter.format(date)); pst.setDate (4, formatter.format(date)); } catch (ParseException e) { e.printStackTrace(); } Or TimeStamp like:HELP pst.setTimestamp(java.util.Date().getTime());
has comment: http://stackoverflow.com/comment/42517906

http://stackoverflow.com/q/27146918
has comment: http://stackoverflow.com/comment/42789507
tagged with: java
has comment: http://stackoverflow.com/comment/42789394
type: Question
linked to: http://stackoverflow.com/q/218384
has title: NullPointerException error when running GUI
has comment: http://stackoverflow.com/comment/42789261
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42789255
tagged with: user-interface
answer count: 1
has body: I have limited knowledge with GUI's. I am trying to create a very basic GUI and have the following so far: public class Controller { // variables private JFrame ACMEFrame; private JPanel contentPane; private JPanel contentPanel; private JPanel detailsPanel; private JPanel buttonPanel; private JLabel label; private JComboBox box; private JButton ok; private JButton quit; // constructor public Controller() { handleAddCruiseToShip(); } public final void handleAddCruiseToShip() { ACMEFrame = new JFrame("Assign Cruise to Ship"); // name of frame ACMEFrame.setSize(600, 400); // size of JFrame ACMEFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // exit JFrame on close contentPanel = new JPanel(); contentPanel.setBackground(Color.GREEN); quit = new JButton("Quit"); ok = new JButton("Ok"); detailsPanel.add(quit); detailsPanel.add(ok); ACMEFrame.add(detailsPanel); ACMEFrame.pack(); ACMEFrame.setVisible(true); } } However, upon running the test class(guiTest), I am coming across the following errors: Exception in thread "main" java.lang.NullPointerException at Controller.AddCruiseToShip(Controller.java:42) at Controller.&lt;init&gt;(Controller.java:26) at guiTest.main(guiTest.java:10) Previously, I was able to run the test class and the GUI was displayed, however, now I am coming across errors. This is my guiTest Class: public class guiTest { public static void main (String args []){ new Controller(); } } How do I overcome this? Thank you.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27147079

http://stackoverflow.com/a/27137831
downvote count: 0
has body: Think of the POP3 server as storing messages in a sequential list where the last message in the list is always the most recently received message. So essentially it "sorts" them in order of arrival, but this might not be the same as "Date Sent".
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27128478

http://stackoverflow.com/a/27104781
has comment: http://stackoverflow.com/comment/42712973
answers question: http://stackoverflow.com/q/27104259
has comment: http://stackoverflow.com/comment/42712969
type: Answer
has body: Apart from threading issue there is a clear route to this result: class Key implements CharSequence { private byte[] key; public Key(String key) { // Take a copy of the bytes of the string. this.key = key.getBytes(); } @Override public int length() { return key.length; } @Override public char charAt(int index) { return (char) key[index]; } @Override public CharSequence subSequence(int start, int end) { return new Key(new String(key).substring(start, end)); } // Allow the key to change. public void setKey(String newValue) { key = newValue.getBytes(); } @Override public String toString() { return new String(key); } } public void test() { Map&lt;CharSequence, String&gt; testMap = new HashMap&lt;&gt;(); Key aKey = new Key("a"); Key bKey = new Key("b"); testMap.put(aKey, "a"); testMap.put(bKey, "b"); bKey.setKey("a"); System.out.println(testMap.keySet()); } This is essentially making the keys of the map mutable so they can be changed after they are added to the map. Although this may not be the problem you are facing (a multi-threading issue is much more likely) this is a real answer to the question How come my HashMap have a duplicate key?.
upvote count: 2
score: 1
downvote count: 1

http://stackoverflow.com/a/27077034
answers question: http://stackoverflow.com/q/27075593
type: Answer
has body: You could read in one file after the other, encrypt it and write it out to your desired larger file. Then you just have to create a "Separation Marker" between each "file" so you know where a new file begins when you read the big file in again
score: 0

http://stackoverflow.com/comment/42577838
score: 0
type: Comment
has text: And since every object is an `Object`, the JIT might not be able to completely optimize the calls to `new` away. So memory has to be allocated (takes a bit of time) and then garbage collected too (takes longer, but happens over time).
type: AnswerComment
comment on: http://stackoverflow.com/a/27027384

http://stackoverflow.com/comment/42534374
comment on: http://stackoverflow.com/a/26997663
type: AnswerComment
score: 0
type: Comment
has text: Although for people who read this in the future, import Collections not Collection.

http://stackoverflow.com/comment/42722532
score: 1
type: AnswerComment
has text: I have added an empty element at the start of the array to deal with that.
type: Comment
comment on: http://stackoverflow.com/a/27109791

http://stackoverflow.com/q/27095557
has comment: http://stackoverflow.com/comment/42696697
type: UnansweredQuestion
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/27095671
type: Question
has comment: http://stackoverflow.com/comment/42696866
has comment: http://stackoverflow.com/comment/42696698
has comment: http://stackoverflow.com/comment/42696916
has comment: http://stackoverflow.com/comment/42696960
has comment: http://stackoverflow.com/comment/42696889
tagged with: null
score: -2
has comment: http://stackoverflow.com/comment/42696827
tagged with: inheritance
has answer: http://stackoverflow.com/a/27095821
answer count: 3
has comment: http://stackoverflow.com/comment/42696818
has body: I have a class TrueFalse that extends a class Question. Question has a property answers which is an ArrayList of type Answer protected ArrayList&lt;Answer&gt; answers = new ArrayList&lt;Answer&gt;(); TrueFalse has a method called take(Question q) which attempts to add an Answer to the answers ArrayList. This is my problem - the answers ArrayList is throwing a NullPointerException and appearing as null. public void take(Question question) { input = new Input(); answer = new Answer(); System.out.print("Enter Option: "); int response = input.getIntInput(question.options.size()); answer.setAnswerNumber(response); System.out.println(question.answers); // PRINTS NULL question.answers.add(answer); } Does anyone have an idea why? Thanks for the help! EDIT: I believe this is the stack trace? I'm rather new so I think this is what we're looking for: null Exception in thread "main" java.lang.NullPointerException at Question.TrueFalse.take(TrueFalse.java:53) at Survey.Survey.take(Survey.java:239) at Survey.Main.mainMenuSelection(Main.java:74) at Survey.Survey.mainMenu(Survey.java:320) at Survey.Main.mainMenuSelection(Main.java:41) at Survey.Survey.mainMenu(Survey.java:320) at Survey.Main.main(Main.java:196) EDIT2: This is where the take method is being called, from my Survey class. public void take(Survey survey) { if (survey.name == null &amp;&amp; survey.questions.isEmpty()) { System.out.println("MESSAGE: Please create/load first."); mainMenu(); } System.out.print("Name: "); System.out.println(survey.name); for (int i = 0; i &lt; survey.questions.size(); i++) { System.out.print("\n" + (i+1) + ". " + survey.questions.get(i).questionType + ") "); System.out.println(survey.questions.get(i).prompt); for(int j = 0; j &lt; survey.questions.get(i).options.size(); j++) { System.out.print(j+1 + ". "); System.out.println(survey.questions.get(i).options.get(j)); } survey.questions.get(i).take(survey.questions.get(i)); // CALLED HERE } System.out.println("Survey complete!"); } EDIT3: Her…
upvote count: 0
has comment: http://stackoverflow.com/comment/42696696
favorite count: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42696945
has title: Property null when it looks like it shouldn't
has comment: http://stackoverflow.com/comment/42696964
has answer: http://stackoverflow.com/a/27095911
has comment: http://stackoverflow.com/comment/42697112

http://stackoverflow.com/comment/42563249
type: QuestionComment
score: 0
has text: *or* you can make the app run as a daemon/service, with `Timer` scheduled to run on 12PM with interval set to 24 hours... seems simpler and less OS dependent IMO.
type: Comment
comment on: http://stackoverflow.com/q/27019193

http://stackoverflow.com/comment/42714790
comment on: http://stackoverflow.com/a/27102879
score: 0
type: AnswerComment
type: Comment
has text: Hi there, thanks for your comments. Still struggling a bit with this, I think I maybe need some guidance using the specific example I have given above

http://stackoverflow.com/a/27061728
score: 0
has body: I think it would be fine to copy the description from Oracle, in the end just acknowledge them.
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27061613

linux
tags question: http://stackoverflow.com/q/27021434
tags question: http://stackoverflow.com/q/27010670
tags question: http://stackoverflow.com/q/27054464
tags question: http://stackoverflow.com/q/27134118
tags question: http://stackoverflow.com/q/27070937
tags question: http://stackoverflow.com/q/27127929
type: Tag
tags question: http://stackoverflow.com/q/27020819
tags question: http://stackoverflow.com/q/27126718
tags question: http://stackoverflow.com/q/27049736
tag name: linux
tags question: http://stackoverflow.com/q/27033180
tags question: http://stackoverflow.com/q/27010518
tags question: http://stackoverflow.com/q/27129383
tags question: http://stackoverflow.com/q/27010388
tags question: http://stackoverflow.com/q/27096589
tags question: http://stackoverflow.com/q/27071406
tags question: http://stackoverflow.com/q/27038579
tags question: http://stackoverflow.com/q/27116627
tags question: http://stackoverflow.com/q/27093072
tags question: http://stackoverflow.com/q/27110438
tags question: http://stackoverflow.com/q/27003920
tags question: http://stackoverflow.com/q/27130282
tags question: http://stackoverflow.com/q/27052608
tags question: http://stackoverflow.com/q/26997161

http://stackoverflow.com/q/27068785
tagged with: java
has body: In my project i have several maven dependencies. Among one of springContext.xml loads spring web service bean and it loads JAXBContext. It fails with below error- Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions Two classes have the same XML type name My question is why this code works fine in tomcat server environment and fails in testcase. Any pointer or hint will be greatly helpful. Note: There is a limitation to change java code or jaxb.properties because this code is auto-generated from xsd files.
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/42651356
has comment: http://stackoverflow.com/comment/42728815
score: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42651996
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42729693
tagged with: maven
tagged with: spring
has title: JAXBContext load perfectly in server environment but fails in testcase
has comment: http://stackoverflow.com/comment/42655107

http://stackoverflow.com/q/27018501
accepted answer: http://stackoverflow.com/a/27018742
has body: I have a jsp which will hit the database and get the data of the table Employee_details which eill have five columns Id,Name,Department,salary,Manager. The below jsp displaying the whole table but i want to add pagination to it.Can some one help regarding this <%@page import="com.symp.DbUtil" import="java.sql.*"%> <% Connection con; DbUtil db; db=new DbUtil(); con=db.getOracleConnection("oracle.jdbc.driver.OracleDriver",url,username,password); System.out.println("connection is "+con); Statement st=con.createStatement(); ResultSet resultset = st.executeQuery("SELECT * FROM EMPLOYEE_DETAILS") ; %> EMPLOYEE_ID Name SALARY DEPARTMENT MANAGER <% while(resultset.next()){ %> <%= resultset.getString(1) %> <%= resultset.getString(2) %> <%= resultset.getString(3) %> <%= resultset.getString(4) %> <%= resultset.getString(5) %> <% } %>
answer count: 1
tagged with: jsp
tagged with: oracle-database
linked to: http://stackoverflow.com/q/3177733
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27018742
score: 0
tagged with: java
tagged with: pagination
has title: how to add pagination to jsp
type: Question

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/27097852

http://stackoverflow.com/q/27103383
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3758982
score: 6
tagged with: calendar
upvote count: 6
has title: Why do java.util.Calendar before() and after() methods take an Object as an argument, and simply return false if the passed Object is not a Calendar?
duplicate of: http://stackoverflow.com/q/3758982
has answer: http://stackoverflow.com/a/27103593
tagged with: java
has comment: http://stackoverflow.com/comment/42710465
has comment: http://stackoverflow.com/comment/42710696
type: Question
has comment: http://stackoverflow.com/comment/42710741
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42710633
tagged with: java.util.date
has comment: http://stackoverflow.com/comment/42710399
favorite count: 0
has body: This was a bit of a WTF moment for me... I know the Java Date/Calendar classes are supposed to be horrible, but still why do this? This just makes it easy to introduce subtle bugs, or am I missing something?
has comment: http://stackoverflow.com/comment/42710786

http://stackoverflow.com/comment/42705192
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27083393
has text: But it seems that the Methods are not used, because I get the same error messages as before.
type: AnswerComment

http://stackoverflow.com/a/27064331
type: Answer
has body: Using an assigned identifier is the best approach from a writing perspective. It's also consistent across all entity state transitions and you can even batch multiple inserts at JDBC level. When it comes to reading and indexing, a numeric column performs better and an assigned identifier is either unique logical key (Social Security Number) or a unique identifier (e.g. UUID). Using application-level unique assigned identifiers is complicated because you may have multiple application nodes (in a cluster) or you want to synchronize inserts from both within the application as well as from external sources (database client utility). For database-assigned identifier you need to take into consideration how flushing is affected by your choice. Hibernate tries to defer the Persistence Context flushing up until the last possible moment. This strategy has been traditionally known as transactional write-behind. The write-behind is more related to Hibernate flushing rather than any logical or physical transaction. During a transaction, the flush may occur multiple times. The flushed changes are visible only for the current database transaction. Until the current transaction is committed, no change is visible by other concurrent transactions. IDENTITY requires flushing, while a sequence is non-transactional, hence it doesn't require a flush. IDENTITY disables JDBC insert batching and it doesn't support pre-allocation. JPA cannot assign the identifier at Entity construct time, because a new instance can only become persisted through an EntityManager.persist() call. JPA requires explicit "entity state transitions". Wasting a sequence identifier is not much of a problem. The database performs just fine even with gaps in sequence values. Using a bigint column can guarantee you don't practically run out of sequence identifiers. It's better to have non-transactional sequence identifier allocation with occasional gaps than to have transactional allocation with a higher risk of dead-loc…
has comment: http://stackoverflow.com/comment/42643738
upvote count: 2
has comment: http://stackoverflow.com/comment/42643886
score: 2
has comment: http://stackoverflow.com/comment/42642964
has comment: http://stackoverflow.com/comment/42642711
downvote count: 0
answers question: http://stackoverflow.com/q/27062797

http://stackoverflow.com/comment/42788692
has text: Yeah, so how should I fix this? If I do like normal notification, the problem would not exist. Also, the items in InboxStyle are not showing
type: AnswerComment
comment on: http://stackoverflow.com/a/27146385
score: 0
type: Comment

http://stackoverflow.com/comment/42565733
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27016284
has text: Thank you @Magnilex for the support, seems like those people (whose comments are now removed) would bash anybody with the pretext of poor formatting or poor relevance to get some reputation ... Their comments were the only irrelevance towards that topic ... sad...

http://stackoverflow.com/comment/42640019
type: Comment
has text: I was trying to upload a picture of it, but it said I needed a higher reputation to do so. I will copy paste: //Begin code if (name.equals (badName)) { usernameConfirmed.setText("username unavailable"); } else if (!name.equals (badName)) { usernameConfirmed.setText("username accepted"); } if (pass.equals ( )) { passwordConfirmed.setText("Password accepted");
type: QuestionComment
comment on: http://stackoverflow.com/q/27048137
score: 0

http://stackoverflow.com/comment/42555656
comment on: http://stackoverflow.com/q/27014989
score: 0
type: Comment
type: QuestionComment
has text: That's how a set/bag works by design.

http://stackoverflow.com/q/27113137
has comment: http://stackoverflow.com/comment/42729747
answer count: 1
tagged with: jenkins
has answer: http://stackoverflow.com/a/27113565
tagged with: maven
has comment: http://stackoverflow.com/comment/42729183
type: AnsweredQuestion
tagged with: java
has title: Jenkins Build not failing
type: Question
has comment: http://stackoverflow.com/comment/42729454
has body: I'd like know what can makes Jenkins ignore a compilation error, and finish a job with a successful status? We're using Jenkins v1.590 with Maven 1.0.2 (no choice for the moment) and SVN. Our project is a web application and it is subdivided into 5 Maven modules. 4 Java modules/projects that produce jars and 1 module that produces a war. Here is an example of a compilation error that should fail with the build of the war: C:\DevTools\workspace-Jenkins\xxxxx_Construction_du_War_3_18_x\src\main\java\com\.....\servlet\command\compte\RemboursementAnnuler.java:54: annulerReglement(com.........base.ReglementBean,java.lang.String,com.........securite.BusinessUtilisateurBean) in com......transaction.compte.Compte cannot be applied to (com......base.ReglementBean,com.......metier.securite.BusinessUtilisateurBean) : new Compte().annulerReglement(reglementBean, businessUtilisateurBean); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors BUILD FAILED File...... C:\.maven\cache\maven-java-plugin-1.5\plugin.jelly Element... ant:javac Line...... 63 Column.... 48 Compile failed; see the compiler error output for details. Total time: 33 seconds Finished at: Mon Nov 24 18:54:39 CET 2014 Finished: SUCCESS Why Jenkins can't detect itself the failure ? Could it be something with the exit code of Maven 1? I tried with one of the project that build a jar and it's the same problem. Any clue? Thank you by advance. [EDIT] My solution : Inspired by the suggestion from @Jigar Joshi, I just replaced the Maven build step by a simple batch command calling maven clean ... (because with Maven 1, by default the command name is maven, not mvn). I've done that in each one of my modules/jobs and now every compilation error is properly reported as a build failed. The problem was effectively the return code of the Maven command…
accepted answer: http://stackoverflow.com/a/27113565
has comment: http://stackoverflow.com/comment/42729684
has comment: http://stackoverflow.com/comment/42729632
score: 0
has comment: http://stackoverflow.com/comment/42729018

http://stackoverflow.com/q/27126915
has comment: http://stackoverflow.com/comment/42753436
has title: Spring data + JPA - locking occurs even though no @Lock was set
type: UnansweredQuestion
has body: We are developing a web app using spring data + JPA and mySQL. On the beginning of our development process we considered AVOIDING using @Lock all together for the sake of avoiding Deadlocks. Today one of our automated tests actually generated a deadlock exception. Our questions 1) How come we have a deadlock even without setting @Lock on our repositories? 2) If deadlocks are unavoidable - we read that consistent locking order can mitigate the deadlock issues, how can we manipulate our repositories (that mostly do HQL \ SQL updates) that the lock order will be consistent?
tagged with: spring
answer count: 0
tagged with: java
tagged with: mysql
type: Question
tagged with: jpa
tagged with: deadlock
score: 0
has comment: http://stackoverflow.com/comment/42754172

http://stackoverflow.com/comment/42835682
comment on: http://stackoverflow.com/a/27172374
type: AnswerComment
type: Comment
score: 0
has text: O, nice, can you also show as how to use Address object in `repeated` helper, that will be helpful for other guys, (also with validation and binding)

http://stackoverflow.com/a/28193907
has body: When the Android Studio starts, it checks for JAVA_HOME environment variable. Mostly you would have hardcoded/set this variable somewhere. Check it's value by typing below in terminal/shell: echo $JAVA_HOME Like you have stated already, > Unsupported major.minor version 51.0 ==> JDK 1.7 / 7 That implies the plugin has been compiled in higher version[1.7] and you are trying to run in lower version[&lt;1.7] runtime environment. You may then set/export the environment variable to point to correct version appropriately. In Linux environment:export JAVA_HOME="Absolute_Path_To_JDK1.7" and then restart the Android studio with the JAVA_HOME set correctly. May be you can set/export it in ".bashrc" or other startup script. For others facing similar issue, check your java version first: java -version Update the JDK &amp;&amp; JRE if you are running lower version based on the link above. For Ubuntu; update-alternatives --display java [checking all versions available] sudo apt-get install openjdk-?-jdk openjdk-?-jre [ ? == version you got from the wiki link above ] sudo update-alternatives --config java [ setting the default java ] And then if required, set the JAVA_HOME environment variable as stated above.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27059344

http://stackoverflow.com/a/27026676
score: 1
type: Answer
has body: You can use BoxLyout: // Components to show // Left JLabel leftLabel = new JLabel("Left"); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.X_AXIS)); leftPanel.add(leftLabel); leftPanel.add(Box.createHorizontalGlue()); // Center JButton centerButton = new JButton("Middle"); // Right JLabel rightLabel = new JLabel("Right"); JPanel rightPanel = new JPanel(); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.X_AXIS)); rightPanel.add(Box.createHorizontalGlue()); rightPanel.add(rightLabel); // Add all to box Box box = Box.createVerticalBox(); box.add(leftPanel); box.add(centerButton); box.add(rightPanel); box.add(Box.createHorizontalStrut(180)); // Align content in box // leftLabel.setAlignmentX(LEFT_ALIGNMENT); centerButton.setAlignmentX(CENTER_ALIGNMENT); // rightLabel.setAlignmentX(RIGHT_ALIGNMENT);
upvote count: 1
answers question: http://stackoverflow.com/q/27025230
has comment: http://stackoverflow.com/comment/42576827
downvote count: 0

http://stackoverflow.com/q/27007749
favorite count: 0
has comment: http://stackoverflow.com/comment/42544014
tagged with: tostring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27007913
tagged with: java
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
has title: Converting Gregorian Calendar to String but throwing an exception
has body: After running the program and trying to display the purchase date the program throws an exception here is the code for getters and setters for purchase date: public void setPurchaseDate(String purchaseDate){ String[] dateSplit = purchaseDate.split("/"); int month, day, year; month = Integer.parseInt(dateSplit[0]); day = Integer.parseInt(dateSplit[1]); year = Integer.parseInt(dateSplit[2]); GregorianCalendar date = new GregorianCalendar (year, month-1, day); } public String getPurchaseDate(){ String date; SimpleDateFormat sdf = new SimpleDateFormat("MM/DD/YYYY"); date = sdf.format(this.purchaseDate.getTime()); return date; } this the exception from the console: Exception in thread "main" java.lang.NullPointerException at jasonsiboleproject5.motorVehicle.getPurchaseDate(motorVehicle.java:88) at jasonsiboleproject5.car.toString(car.java:69) at java.lang.String.valueOf(String.java:2847) at java.lang.StringBuilder.append(StringBuilder.java:128) at java.util.AbstractCollection.toString(AbstractCollection.java:458) at java.lang.String.valueOf(String.java:2847) at java.io.PrintStream.println(PrintStream.java:821) at jasonsiboleproject5.mainclass.main(mainclass.java:83) Java Result: 1
tagged with: gregorian-calendar
has comment: http://stackoverflow.com/comment/42544111
score: 0
has answer: http://stackoverflow.com/a/27007913
answer count: 1

http://stackoverflow.com/a/35764009
answers question: http://stackoverflow.com/q/27005861
type: Answer
score: 11
upvote count: 11
has body: Use the DAYS in enum java.time.temporal.ChronoUnit . Below is the Sample Code : Output : *Number of days between the start date : 2015-03-01 and end date : 2016-03-03 is ==> 368. **Number of days between the start date : 2016-03-03 and end date : 2015-03-01 is ==> -368* package com.bitiknow.date; import java.time.LocalDate; import java.time.temporal.ChronoUnit; /** * * @author pradeep * */ public class LocalDateTimeTry { public static void main(String[] args) { // Date in String format. String dateString = "2015-03-01"; // Converting date to Java8 Local date LocalDate startDate = LocalDate.parse(dateString); LocalDate endtDate = LocalDate.now(); // Range = End date - Start date Long range = ChronoUnit.DAYS.between(startDate, endtDate); System.out.println("Number of days between the start date : " + dateString + " and end date : " + endtDate + " is ==&gt; " + range); range = ChronoUnit.DAYS.between(endtDate, startDate); System.out.println("Number of days between the start date : " + endtDate + " and end date : " + dateString + " is ==&gt; " + range); } }
downvote count: 0

http://stackoverflow.com/q/27081649
possible better answer: http://stackoverflow.com/a/27081681
upvote count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27081681
has answer: http://stackoverflow.com/a/27081688
accepted answer: http://stackoverflow.com/a/27081688
has body: Let's say you have two classes, one called Main and the other called Second. Second needs to take a variable from Main and Main needs to take a method from Second Example: public class Main { Second second = new Second(); public int firstInt = 5; second.printThing(); } public class Second { Main main = new Main(); public void printThing() { System.out.println(main.firstInt); } } Since you can't do Main main = new Main(); and Second second = new Second; without getting a stack overflow exception, what are you supposed to do?
type: AnsweredQuestion
has title: Java Having classes take information from each other
score: 1
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/q/27048698
accepted answer: http://stackoverflow.com/a/27049487
tagged with: binary-search-tree
has title: Java Binary Search Tree with Nodes that contain Linked Lists
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
has body: I'm trying to write a Java program that will create a Database using a Binary Search Tree whose keys will be the make of a car (Chevy for example). And that node will contain a Linked list that will contain more detailed information about the cars. My cars are added in a Linked List class called DBTreeNode. Can I modify the BST implementation here, to make the data of the Node be a Linked List?
type: Question
has answer: http://stackoverflow.com/a/27049487
score: 0
answer count: 1

http://stackoverflow.com/a/27115945
score: 1
has body: The problem you might be having is that you are performing a network operation on the UI (main) thread. One easy way of solving is by starting an new thread and perform the operation in the background. You can use the class Asynctask for this purpose like this: private class AsyncCaller extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); //This runs on UI thread still. } @Override protected Void doInBackground(Void... params) { //This runs in the background. Make your network operations here return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); //This method will be running on UI thread //This is called when onBackground ha finished } } You can then instantiate an AsyncCaller and call execute() on it.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42735066
answers question: http://stackoverflow.com/q/27115636
type: Answer
accepted answer of: http://stackoverflow.com/q/27115636
downvote count: 0

object
tags question: http://stackoverflow.com/q/27025141
tag name: object
tags question: http://stackoverflow.com/q/27103495
tags question: http://stackoverflow.com/q/27053208
tags question: http://stackoverflow.com/q/27052505
tags question: http://stackoverflow.com/q/27036499
tags question: http://stackoverflow.com/q/27136139
tags question: http://stackoverflow.com/q/26999158
tags question: http://stackoverflow.com/q/26999693
tags question: http://stackoverflow.com/q/27141514
tags question: http://stackoverflow.com/q/27024507
tags question: http://stackoverflow.com/q/27093249
tags question: http://stackoverflow.com/q/27083477
tags question: http://stackoverflow.com/q/27088276
tags question: http://stackoverflow.com/q/27141455
tags question: http://stackoverflow.com/q/27002882
tags question: http://stackoverflow.com/q/27046316
tags question: http://stackoverflow.com/q/27009343
tags question: http://stackoverflow.com/q/27096182
tags question: http://stackoverflow.com/q/26997666
tags question: http://stackoverflow.com/q/27023980
tags question: http://stackoverflow.com/q/27029296
tags question: http://stackoverflow.com/q/27049570
tags question: http://stackoverflow.com/q/27070191
tags question: http://stackoverflow.com/q/27120029
tags question: http://stackoverflow.com/q/26994115
tags question: http://stackoverflow.com/q/27070075
tags question: http://stackoverflow.com/q/27052384
tags question: http://stackoverflow.com/q/27151121
type: Tag
tags question: http://stackoverflow.com/q/27009151
tags question: http://stackoverflow.com/q/27092608
tags question: http://stackoverflow.com/q/27013301
tags question: http://stackoverflow.com/q/27034650
tags question: http://stackoverflow.com/q/26999480

http://stackoverflow.com/q/27127929
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42755154
score: -2
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/42755224
has answer: http://stackoverflow.com/a/27128021
has comment: http://stackoverflow.com/comment/42761169
answer count: 1
favorite count: 0
has body: I am trying to install Java 8 on Ubuntu. Due to restrictions on download at my work place, I cannot install using apt-get. Hence, I downloaded the archive from Oracle's website. However, when I extracted it, there was only a file inside it. How to install using that file?
has title: Installing Java 8 on Ubuntu
tagged with: linux
type: UnansweredQuestion
tagged with: java-8
has comment: http://stackoverflow.com/comment/42755174
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/42943081
type: AnswerComment
comment on: http://stackoverflow.com/a/27159030
has text: Currently individual values aren't available via the http api. If you are using `spring-cloud-config-client` in your Spring application Environment. The values are available as YAML or Java Properties documents via `http://localhost:8080/myapp-default.yml` and `http://localhost:8080/myapp-default.properties` respectively.
type: Comment
score: 3

http://stackoverflow.com/comment/42635125
score: 0
has text: seems fine to me... could you post the entire method?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27060276

http://stackoverflow.com/comment/42677669
comment on: http://stackoverflow.com/a/27052874
type: Comment
score: 0
type: AnswerComment
has text: `for (int i = 0; i <= 200; i++) { System.out.print("Data>"); String dataentry = s.nextLine(); String[] firstsplit = dataentry.split(":"); String[] secondsplit = firstsplit[1].split(" "); for (int j = 0; j <= 200; j++) { String c; c = secondsplit[j].substring(0 , 1);` Hey matthew, I'm still having trouble with my program. For some reason when I try to run it now there is an error where I declare my secondstring array and split it. Have any insight on this?

http://stackoverflow.com/q/27103517
type: AnsweredQuestion
tagged with: thread-safety
has answer: http://stackoverflow.com/a/27104010
has comment: http://stackoverflow.com/comment/42714554
has comment: http://stackoverflow.com/comment/42735647
has comment: http://stackoverflow.com/comment/42744961
answer count: 1
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/42759723
has body: LoggerProducer.java is a class used to produce Loggers to be injected in CDI beans with: @Inject Logger LOG; Full code: import javax.ejb.Singleton; /** * @author rveldpau */ @Singleton public class LoggerProducer { private Map&lt;String, Logger&gt; loggers = new HashMap&lt;&gt;(); @Produces public Logger getProducer(InjectionPoint ip) { String key = getKeyFromIp(ip); if (!loggers.containsKey(key)) { loggers.put(key, Logger.getLogger(key)); } return loggers.get(key); } private String getKeyFromIp(InjectionPoint ip) { return ip.getMember().getDeclaringClass().getCanonicalName(); } } QUESTION: can @Singleton be safely turned into @ApplicationScoped ? I mean, why would anyone want an EJB here ? Are there technical reasons, since no transactions are involved, and (AFAIK) it would be thread-safe anyway ? I'm obviously referring to javax.enterprise.context.ApplicationScoped, not to javax.faces.bean.ApplicationScoped.
favorite count: 0
tagged with: cdi
has comment: http://stackoverflow.com/comment/42711513
linked to: http://stackoverflow.com/q/14237499
has title: Why @Singleton over @ApplicationScoped in Producers?
accepted answer: http://stackoverflow.com/a/27104010
has comment: http://stackoverflow.com/comment/42759768
tagged with: java
upvote count: 7
tagged with: ejb-3.1
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/a/27022393
has comment: http://stackoverflow.com/comment/42581049
score: 0
has body: If you plan on doing lots of increase key operations, then you may want to look at Fibonacci heaps or Brodal queues because they provide better asymptotic complexity for the increase key operation. A Google search for those specific names with the Java keyword will probably find what you need. Here's one that I found: http://www.keithschwarz.com/interesting/code/?dir=fibonacci-heap
type: Answer
answers question: http://stackoverflow.com/q/27021899
has comment: http://stackoverflow.com/comment/42581511

http://stackoverflow.com/comment/42738508
has text: They are also known as "for-each" loop. In fact, that is how you read them: ***FOR EACH*** [Data type] ***IN*** [collection or array]
comment on: http://stackoverflow.com/q/27118183
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/56380097
type: QuestionComment
comment on: http://stackoverflow.com/q/27061979
has text: Are you using Spring Security? If so, refer my [answer](http://stackoverflow.com/a/34319194/583237).
type: Comment
score: 0

http://stackoverflow.com/comment/43897006
type: Comment
has text: use adobe creative sdk!
comment on: http://stackoverflow.com/a/27288595
score: 0
type: AnswerComment

jpa
tags question: http://stackoverflow.com/q/27127647
tags question: http://stackoverflow.com/q/27028400
tags question: http://stackoverflow.com/q/27081472
tags question: http://stackoverflow.com/q/27023935
tags question: http://stackoverflow.com/q/26994500
tags question: http://stackoverflow.com/q/27138272
tags question: http://stackoverflow.com/q/27090348
tags question: http://stackoverflow.com/q/27081410
tags question: http://stackoverflow.com/q/27001714
tags question: http://stackoverflow.com/q/27121232
tags question: http://stackoverflow.com/q/27051866
tags question: http://stackoverflow.com/q/27062538
tags question: http://stackoverflow.com/q/27057927
tags question: http://stackoverflow.com/q/27150123
tags question: http://stackoverflow.com/q/27058454
tags question: http://stackoverflow.com/q/27019431
tags question: http://stackoverflow.com/q/27025425
tags question: http://stackoverflow.com/q/27057867
tags question: http://stackoverflow.com/q/27124152
tags question: http://stackoverflow.com/q/27117511
tags question: http://stackoverflow.com/q/27049874
tags question: http://stackoverflow.com/q/27112784
tags question: http://stackoverflow.com/q/27115639
tags question: http://stackoverflow.com/q/27151125
tags question: http://stackoverflow.com/q/27082040
tags question: http://stackoverflow.com/q/27126915
tags question: http://stackoverflow.com/q/27013353
tags question: http://stackoverflow.com/q/27074104
tags question: http://stackoverflow.com/q/27122605
tags question: http://stackoverflow.com/q/27126075
tags question: http://stackoverflow.com/q/27014267
tags question: http://stackoverflow.com/q/27077054
tags question: http://stackoverflow.com/q/27048704
tags question: http://stackoverflow.com/q/27098228
type: Tag
tags question: http://stackoverflow.com/q/27089986
tags question: http://stackoverflow.com/q/27087699
tags question: http://stackoverflow.com/q/27117840
tags question: http://stackoverflow.com/q/27015856
tags question: http://stackoverflow.com/q/27000486
tags question: http://stackoverflow.com/q/27115334
tags question: http://stackoverflow.com/q/27045464
tags question: http://stackoverflow.com/q/27054320
tags question: http://stackoverflow.com/q/27055964
tags question: http://stackoverflow.com/q/27089278
tags question: http://stackoverflow.com/q/27034113
tags question: http://stackoverflow.com/q/27039305
tags question: http://stackoverflow.com/q/27024644
tags question: http://stackoverflow.com/q/27016778
tags question: http://stackoverflow.com/q/26999642
tags question: http://stackoverflow.com/q/27041945
tags question: http://stackoverflow.com/q/27107940
tags question: http://stackoverflow.com/q/27038134
tags question: http://stackoverflow.com/q/27061162
tag name: jpa
tags question: http://stackoverflow.com/q/27145055
tags question: http://stackoverflow.com/q/27031938
tags question: http://stackoverflow.com/q/27037955
tags question: http://stackoverflow.com/q/27144892
tags question: http://stackoverflow.com/q/27094457
tags question: http://stackoverflow.com/q/27053097
tags question: http://stackoverflow.com/q/27129232
tags question: http://stackoverflow.com/q/27067190
tags question: http://stackoverflow.com/q/27062797
tags question: http://stackoverflow.com/q/27134144
tags question: http://stackoverflow.com/q/27091144
tags question: http://stackoverflow.com/q/27101716
tags question: http://stackoverflow.com/q/27101707
tags question: http://stackoverflow.com/q/27045782
tags question: http://stackoverflow.com/q/27037059
tags question: http://stackoverflow.com/q/27091748
tags question: http://stackoverflow.com/q/27013562
tags question: http://stackoverflow.com/q/27039300

http://stackoverflow.com/q/27005718
downvote count: 0
answer count: 1
favorite count: 0
tagged with: gmail-api
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/27006603
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/27006603
type: Question
type: AnsweredQuestion
tagged with: java
has title: Accessing email of multiple GMail users in one web application
has body: I am trying to modify GMail messages of multiple users using the Google API Client with the GMail API on top of Google App Engine. Flow outline: The user sends a request to the webApp adding a message into a queue. In this request, the Gmail account is checked for the existence of the given message. This message is then later to be processed via a cron job (without the user making another request). I followed the example on how to use the API in the documentation and have the following two methods: private static GoogleClientSecrets getClientCredential() throws IOException { return GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(Utils.class.getResourceAsStream("/client_secret.json"))); } public static GoogleAuthorizationCodeFlow newFlow(final String userId) throws IOException { return new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, getClientCredential(), Collections.singleton(GmailScopes.GMAIL_MODIFY)) .setDataStoreFactory(DATA_STORE_FACTORY) .setAccessType("offline") .setApprovalPrompt("force") .addRefreshListener( new DataStoreCredentialRefreshListener(userId, DATA_STORE_FACTORY)) .build(); } public static Gmail loadGmailClient(final String userId) throws IOException { final Credential credential = newFlow(userId).loadCredential(userId); return new Gmail.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential) .setApplicationName(APP_NAME) .build(); } which should basically give me offline access to the users' mailbox, allowing me to process the given message later on in the cron. as long as userId is "me" everything seems to work fine. However in the cron job phase that is supposed to modify without the user actually making a request to the WebApp, so I can't use "me" but have to use the users ID. Therefore I started using UserServiceFactory.getUserService().getCurrentUser().getUserId() as userId in the request phase and store this ID together with the cron job data. When doing this, I keep on getting errors like com.google.api.client.…
tagged with: google-client

http://stackoverflow.com/a/27012828
has body: Ideally you would want to use XQuery full text for this because it will take are of case sensitivity, etc: for $entity in collection('data2.dbxml')//movie where $entity contains text 'countdown' return $entity If you don't have access to it then use the answer Jens provided.
has comment: http://stackoverflow.com/comment/42555909
has comment: http://stackoverflow.com/comment/42555892
type: Answer
has comment: http://stackoverflow.com/comment/42556601
score: 0
answers question: http://stackoverflow.com/q/27010058

http://stackoverflow.com/comment/42727908
has text: Thank you, but it's not something I can fix fast. I ll sure deal with this later.
comment on: http://stackoverflow.com/a/27112524
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42871962
has text: what error? If you are so lost you really need to get more extensive help from your teacher rather than us here at StackOverflow
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27133459
type: Comment

http://stackoverflow.com/comment/42807960
has text: You don't have to throw exception, it should be enough to break out of the loop. You could just make it `while (!interrupted()){...}`. But, on the other hand, I don't think the difference is crucial, so, your problem is probably somewhere else.
comment on: http://stackoverflow.com/a/27149710
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/28167732
score: 6
has body: Found the solution for this. I had to access the ServletContext to get to the configuration text file. Here is the code sample - // Extract the ServletContext from the attributes of RestletContext ServletContext servlet = (ServletContext) context.getAttributes().get("org.restlet.ext.servlet.ServletContext"); // Get the path of the config file relative to the WAR String rootPath = servlet.getRealPath("/WEB-INF/configuration.txt"); Path path = Paths.get(rootPath); File configFile = new File(path.toString()); FileRepresentation file = new FileRepresentation(configFile, MediaType.TEXT_PLAIN);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27043399
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/27043399

http://stackoverflow.com/q/27051122
answer count: 1
tagged with: ide
has answer: http://stackoverflow.com/a/27051272
has comment: http://stackoverflow.com/comment/42620159
score: 0
has comment: http://stackoverflow.com/comment/42619851
type: UnansweredQuestion
tagged with: http
has comment: http://stackoverflow.com/comment/42620193
tagged with: java
tagged with: eclipse
tagged with: servlets
linked to: http://stackoverflow.com/q/3106452
type: Question
has title: How to integrate between two httpServlets?
has body: I wrote an HttpServlet and I named it "Stick" and then defined a Class named "John" in it. In addition, I wrote another HttpServlet and named it "StickDetails". Both of the Servlets are in the same package. I want StickDetails servlet to function as a Main function (I want to use the "Stick" class inside it). The problem starts when I try to write the command in StickDetails "John j = new John;" but john isen't recognized! (""String cannot resolved to a type"") what did I do wrong here? Here you see StickDetails servlet: package wood; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class StickDetails extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException,ServletException { Stick a; // Stick is not recognized "String cannot resolved to a type" } } I am using Eclipse IDE for java Developers

http://stackoverflow.com/q/27090107
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27091413
has comment: http://stackoverflow.com/comment/42693191
type: AnsweredQuestion
has body: Let's say I have two colors in Lab color space- Color 1: L=81, a=-8, b=74 Color 2: L=64, a=-14, b=3 I want generate n colors between them. For say n=100 or as many colors possible between them. I know the RGB and HSV color gradient algorithm. But I want to generate gradient in LAB color spaces. I don't want to convert the colors to HSV or RGB as different color models generate different gradients. This is a link i found which generates gradient in Lab and other color models: http://davidjohnstone.net/pages/lch-lab-colour-gradient-picker I'm aiming to do something similar in Java but language doesn't matter, I just need to understand the logic and algorithm behind it. I'm doing this basically for matching a scanned color value with a chart of 5 colors I have. So, I have to first generate all colors in between those 5 colors (using gradient) and compare the other color to find the one which is closest to it. (For comparing I'm using CIEDE2000 Delta-e method). But that's secondary i guess. Adding further to the last part of my question, I suppose I'll have to generate a gradient because I want to find the exact location of the color from my sample in the sequence of chart I have. For eg- I have 6 colors of green shades (light to dark) in my chart each corresponding to particular numeric data between 0 to 450 mg like below (with their LAB values) Color 1: 78, -10, -71 [0 mg] Color 2: 73,-14,44 [30 mg] Color 3: 71, -19, 53 [80 mg] Color 4: 67, -18, 31 [160 mg] Color 5: 69, -2, 29 [300 mg] Color 6: 61, -14, 3 [450 mg] Now I want to generate all colors between them and find the location of my scanned color and return the mg value. Say my color is exactly between Color 1 and Color 2, then it'll return 15 mg, otherwise if it is closer to Color 2 it'll return 28.5 mg and so on. Hope this clears up what I'm trying to achieve.
tagged with: java
tagged with: gradient
has title: Color Gradient Algorithm in Lab color space
type: Question
score: 5
has comment: http://stackoverflow.com/comment/42694600
tagged with: algorithm
tagged with: matching
upvote count: 5
has answer: http://stackoverflow.com/a/27091413
tagged with: colors

http://stackoverflow.com/q/27064410
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27065065
tagged with: java
has body: Im a little lost on this. Trying to pass variables onto another class for output. This class gets the variable. OneWeekPlan_Start_Btn.java package com.th3ramr0d.prtmanager; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class OneWeekPlan_Start_Btn extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.oneweek_day1); EditText inputTxt = (EditText) findViewById(R.id.wkOneDayOneInstructorName); String wk1day1_inst = inputTxt.getText().toString(); Button oneweekDay2 = (Button) findViewById(R.id.wk1Day2); oneweekDay2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent("com.th3ramr0d.prtmanager.ONEWEEKDAYTWO")); } }); } } I want to be able to use the variable wk1day1_inst in the following class Save_File.java package com.th3ramr0d.prtmanager; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import android.content.Context; import android.os.Environment; import android.util.Log; import android.view.View.OnClickListener; public class Save_File extends Activity implements OnClickListener{ Button writeExcelButton; static String TAG = "ExelLog"; @Override protected void onCreate(Bundle savedInstanceState) { …
type: Question
has title: How to use variables in other classes
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27064463
accepted answer: http://stackoverflow.com/a/27064463
possible better answer: http://stackoverflow.com/a/27065065
tagged with: android

apache-spark
tags question: http://stackoverflow.com/q/27092110
tags question: http://stackoverflow.com/q/27023409
tags question: http://stackoverflow.com/q/27103977
tags question: http://stackoverflow.com/q/27128142
tags question: http://stackoverflow.com/q/27077247
tags question: http://stackoverflow.com/q/27053036
tags question: http://stackoverflow.com/q/26994157
tag name: apache-spark
tags question: http://stackoverflow.com/q/27041640
tags question: http://stackoverflow.com/q/27151943
tags question: http://stackoverflow.com/q/27123653
tags question: http://stackoverflow.com/q/27130321
tags question: http://stackoverflow.com/q/27024169
tags question: http://stackoverflow.com/q/27137443
type: Tag

http://stackoverflow.com/comment/42580378
has text: Your arrays of size 7 and 9, so you will get an out of bounds, if you try putting more elements than it can hold, give an if condition to check the bounds before assigning.
type: QuestionComment
comment on: http://stackoverflow.com/q/27028205
score: 0
type: Comment

http://stackoverflow.com/q/27122332
has title: BooleanFieldEditor doesn't load value from PreferenceStore
has body: For an own PreferencePage in an Eclipse-RCP-Plugin I use an BooleanFieldEditor. Its value is saved in the PreferenceStore (confirmed that it is saved). But the Editor always is set to "false" after opening the PreferencePage again. public class PreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { [...] protected void createFieldEditors() { subversionSupportBooleanFieldEditor = new BooleanFieldEditor (PreferenceConstants.FIELD_SUBVERSION_SUPPORT, "Enable Subversion support", BooleanFieldEditor.DEFAULT, getFieldEditorParent()); subversionSupportBooleanFieldEditor.setPreferenceStore(Activator.getDefault().getPreferenceStore()); subversionSupportBooleanFieldEditor.load(); [...]} What is missing?
tagged with: eclipse-plugin
tagged with: eclipse-rcp
score: 0
has answer: http://stackoverflow.com/a/27123118
accepted answer: http://stackoverflow.com/a/27123118
answer count: 1
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/27077372
tagged with: jseparator
has answer: http://stackoverflow.com/a/74657060
type: Question
downvote count: 0
favorite count: 0
has title: JSeparator dashed style
accepted answer: http://stackoverflow.com/a/27077591
answer count: 3
has body: I am using a JSeparator in my java swing application. The normal implementation makes the separator normal line; but what I need is the separator should be dashed(like we create dashed border). Is there any way we can do that? Thanks
possible better answer: http://stackoverflow.com/a/27077679
has answer: http://stackoverflow.com/a/27077679
score: 1
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/7748245
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27077591
tagged with: java

http://stackoverflow.com/a/27095370
has comment: http://stackoverflow.com/comment/42697788
has body: You never schedule the TimerTask tt: public static void main(String[] args) throws InterruptedException { Timer timer = new Timer(); TimerTask tt = new TimerTask() { public void run() { Calendar cal = Calendar.getInstance(); int hour = cal.get(Calendar.HOUR_OF_DAY); if(hour == 8) { String url = "http://www.youtube.com"; if(Desktop.isDesktopSupported()){ Desktop desktop = Desktop.getDesktop(); try { desktop.browse(new URI(url)); } catch (IOException | URISyntaxException e) { e.printStackTrace(); } } else { Runtime runtime = Runtime.getRuntime(); try { runtime.exec("xdg-open " + url); } catch (IOException e) { e.printStackTrace(); } } } } }; timer.schedule(tt, 0, 1000); }
type: Answer
has comment: http://stackoverflow.com/comment/42697801
has comment: http://stackoverflow.com/comment/42697341
has comment: http://stackoverflow.com/comment/42697464
accepted answer of: http://stackoverflow.com/q/27094932
has comment: http://stackoverflow.com/comment/42697243
has comment: http://stackoverflow.com/comment/42696671
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42697486
score: 0
has comment: http://stackoverflow.com/comment/42696955
answers question: http://stackoverflow.com/q/27094932

http://stackoverflow.com/comment/42611259
comment on: http://stackoverflow.com/q/27046463
score: 0
type: QuestionComment
type: Comment
has text: The number of possibilities with assignments doubles for each variable, so it is 2^(2*n-1), not 2*2^(n-1).

http://stackoverflow.com/comment/42533416
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27000504
has text: Let's chat here, you don't have enough reputation for chatting on SO : http://collabedit.com/v2n8y

http://stackoverflow.com/a/27007663
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27007504
has body: Using this solution, I was able to get rid of the error. Add targetCompatibility to Java 1.7 to resolve this. Android does not currently use Java 1.8 in their projects. Add this to the build.gradle file: compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 }
answers question: http://stackoverflow.com/q/27007504
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42783692
has text: That's the point, file in this folder can not be created. Is this folder writable for the user which is running Tomcat?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27124720

http://stackoverflow.com/q/27041240
answer count: 0
downvote count: 0
tagged with: activemq-classic
has comment: http://stackoverflow.com/comment/42601927
type: UnansweredQuestion
has body: Recently we had to drop all the KahaDB files in order to get a production ActiveMQ server up and running. We waited for 45min but nothing showed up, so we were forced to drop all the info. The pending messages were not an issue, but there were a number of scheduled jobs that requires rescheduling. I was thinking, anticipating future similar situations, if it is possible to store that information in a differente storage, or maybe in a different KahaDB using mKahaDB? Thanks Carlos
type: Question
score: 1
tagged with: java
tagged with: database
has title: Separate storage for ActiveMQ Scheduled/Delayed messages
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42637111
has comment: http://stackoverflow.com/comment/42643909

http://stackoverflow.com/q/27044660
upvote count: 2
type: UnansweredQuestion
tagged with: android-library
score: 2
has title: java.lang.UnsatisfiedLinkError: Couldn't load aacdecoder from loader dalvik.system.PathClassLoader
has body: I'm trying to play a aac in my app using aacdecoder lib So the problem is that when I use this code: AACPlayer aacPlayer = new AACPlayer(); aacPlayer.playAsync( "http://cast.direcnode.com:11320/stream" ); My app crash I have put all the files in my libs folder: &gt;libs &gt;armeabi &gt;libaacdecoder.so &gt;armeabi-v7a &gt;libaacdecoder.so &gt;mips &gt;libaacdecoder.so &gt;x86 &gt;libaacdecoder.so &gt;aacdecoder-android-0.8.jar And I have add the jar file to the build.gradle compile files('libs/aacdecoder-android-0.8.jar') But when I run the code It says this: java.lang.UnsatisfiedLinkError: Couldn't load aacdecoder from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/ger.radio-2.apk"],nativeLibraryDirectories=[/data/app-lib/ger.radio-2, /vendor/lib, /system/lib]]]: findLibrary returned null I've tried everything, please help me Thanks in advanced
tagged with: java
type: Question
downvote count: 0
tagged with: android
favorite count: 0
answer count: 0

http://stackoverflow.com/a/27129723
has comment: http://stackoverflow.com/comment/42846193
type: Answer
has comment: http://stackoverflow.com/comment/42844251
downvote count: 0
has comment: http://stackoverflow.com/comment/42928657
has comment: http://stackoverflow.com/comment/42871478
score: 6
has body: To read the messages currently in the SIM memory, you can just do ArrayList&lt;InboundMessage&gt; msgList = new ArrayList&lt;InboundMessage&gt;(); Service.getInstance().readMessages(msgList, InboundMessage.MessageClasses.ALL); for (InboundMessage im : msgList) { } But to do live detection of incoming messages, you need to implement org.smslib.IInboundMessageNotification E.g. import org.smslib.AGateway; import org.smslib.IInboundMessageNotification; import org.smslib.InboundMessage; import org.smslib.Message.MessageTypes; public class SMSInNotification implements IInboundMessageNotification { public void process(AGateway gateway, MessageTypes msgType, InboundMessage msg) { switch (msgType) { case INBOUND: System.out.println("&gt;&gt;&gt; New Inbound message detected from " + "+" + msg.getOriginator() + " " + msg.getText()); break; case STATUSREPORT: break; } } } Then run these before the line which starts the service with .startService() gateway.setInbound(true); Service.getInstance().setInboundMessageNotification(new SMSInNotification()); You can read more in the documentation on github https://github.com/smslib/smslib-v3/tree/master/doc
has comment: http://stackoverflow.com/comment/42818940
has comment: http://stackoverflow.com/comment/42879708
has comment: http://stackoverflow.com/comment/42935587
has comment: http://stackoverflow.com/comment/42972062
accepted answer of: http://stackoverflow.com/q/27058841
type: AcceptedAnswer
upvote count: 6
answers question: http://stackoverflow.com/q/27058841

http://stackoverflow.com/a/27002025
score: 1
has body: the problem is here : btn_sign_up = (Button) findViewById(R.id.btn_sign_up); you are trying to find a view by id = btn_sign_up but you are defining it by another id here : android:id="@+id/sign_up"
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26995379
has comment: http://stackoverflow.com/comment/42550963
has comment: http://stackoverflow.com/comment/42565419
accepted answer of: http://stackoverflow.com/q/26995379
has comment: http://stackoverflow.com/comment/42547376
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42667892
comment on: http://stackoverflow.com/q/27078825
has text: example (ab) a is msb and b is lsb i want to combine them and make a 16bit no than convert it to hex
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27108943
linked to: http://stackoverflow.com/q/25531070
accepted answer: http://stackoverflow.com/a/27114222
answer count: 1
downvote count: 0
tagged with: layout-manager
favorite count: 0
has title: Resize table in miglayou
tagged with: swing
type: AnsweredQuestion
tagged with: miglayout
has answer: http://stackoverflow.com/a/27114222
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42731741
type: Question
has comment: http://stackoverflow.com/comment/42730037
tagged with: layout
has body: I have created a MigLayout, which looks like that: As you can see the table does not resize correctly. I am creating my layout like that: public JScrollPane createLayout() { JPanel panel = new JPanel(new MigLayout("debug 400")); JScrollPane sp; JLabel lab = new JLabel(labelValue); lab.setFont(new Font("Tahoma", Font.BOLD, 15)); panel.add(lab, "wrap"); panel.add(resultsTable(), "growx, wrap"); panel.add(resultsButtons(), "wrap"); //set table properties tableProperties(resultTable); updateResultsTable(); sp = new JScrollPane(panel); sp.repaint(); sp.validate(); return sp; } My table is created like that: private JPanel resultsTable() { JPanel panel = new JPanel(new MigLayout("")); JScrollPane scrollTablePane; rtm = new ResultTableModel(resultList); resultTable = new JTable(rtm); scrollTablePane = new JScrollPane(resultTable); sorter = new TableRowSorter&lt;TableModel&gt;(resultTable.getModel()); resultTable.setRowSorter(sorter); scrollTablePane.repaint(); scrollTablePane.validate(); //add to panel panel.add(scrollTablePane); panel.repaint(); panel.validate(); return panel; } Furthermore, I set the table properties in the following method: public void tableProperties(JTable table) { table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); } Any recommendations why my columns of my table do not stretch? I appreciate your answer!

http://stackoverflow.com/comment/42682855
comment on: http://stackoverflow.com/a/27087257
score: 0
type: AnswerComment
has text: hmmm, there seems to be some problem witth your recorder, you can try setting default values to setAudioEncoder and others, maybe it will help i ain't sure
type: Comment

http://stackoverflow.com/a/27375949
has comment: http://stackoverflow.com/comment/43245644
type: AcceptedAnswer
has body: Unfortunately there is no reliable way of detecting this on the Listener side. The struggle starts with the default implemention, which mostly looks like this: @Override public boolean setAll(Collection&lt;? extends E&gt; col) { beginChange(); try { clear(); addAll(col); } finally { endChange(); } return true; } If you pass an empty Collection to setAll the result and the event that is fired are both exactly the same as when you would have called clear. So your method wasSetOrClearedAll returns true when clear has been called, too (as would the core implementation). So in the end there is no generic detection of setAll, it all depends on your use-case. If you can narrow down what you are trying to detect you may write a filter for that.
has comment: http://stackoverflow.com/comment/43243962
type: Answer
has comment: http://stackoverflow.com/comment/43250810
accepted answer of: http://stackoverflow.com/q/26994886
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/26994886

http://stackoverflow.com/comment/42700223
score: 0
has text: Yes, 1) Look at the server log and show us the stacktrace. JAX-RS will throw an exception, which is mapped to that 405. 2) Show how you are accessing this resource (i.e. the client request)
type: Comment
comment on: http://stackoverflow.com/q/27092632
type: QuestionComment

http://stackoverflow.com/a/27073870
has comment: http://stackoverflow.com/comment/42659664
has body: Essentially every Book, Magazine, Disk &amp; Paper is an Item. Hence you should have a parent class named Item and not its plural form. Every Base Class should classify as a singular entity. You should then create objects of Book, Magazine, Disk &amp; Paper. Since all of these classify as an Item, create an array list of type Item and add these objects to the same. This way you have a item list which has books, magazines, disks &amp; papers. You can then look into this list for an item with barcode and get the type of item. Source Code: Item.java package myLibrary; public class Item { protected String barcode; public String getBarcode() { return barcode; } public void setBarcode(String barcode) { this.barcode = barcode; } public Item(String barcode) { this.barcode = barcode; } } Book.java / Disk.java / Magazine.java / Paper.java package myLibrary; public class Book extends Item { public Book(String barcode) { super(barcode); } public String getBarcode() { return barcode; } } Lecturer.java (Class containing main function) package myCollege; import java.util.ArrayList; import myLibrary.Book; import myLibrary.Disk; import myLibrary.Item; import myLibrary.Magazine; import myLibrary.Paper; public class Lecturer { public static void main(String[] args) { // Declare items Book x1 = new Book("Item101"); Book x2 = new Book("Item102"); Disk x3 = new Disk("Item201"); Disk x4 = new Disk("Item202"); Magazine x5 = new Magazine("Item301"); Paper x6 = new Paper("Item401"); Paper x7 = new Paper("Item402"); ArrayList&lt;Item&gt; items = new ArrayList&lt;&gt;(); items.add(x1); items.add(x2); items.add(x3); items.add(x4); items.add(x5); items.add(x6); items.add(x7); String itemType = getItemByBarcode("Item202", items); System.out.println(itemType); } private static String getItemByBarcode(String barcode, ArrayList&lt;Item&gt; items) { String itemType = ""; for(Item i : items) { if(i.getBarcode().equalsIgnoreCase(barcode)) { itemType = i.getClass().getSimpleName(); } } return itemType; …
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42659631
accepted answer of: http://stackoverflow.com/q/27073183
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27073183

http://stackoverflow.com/q/26996987
accepted answer: http://stackoverflow.com/a/26997218
tagged with: cross-join
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: HQL Hibernate un-related entities, but same id
tagged with: hql
type: Question
score: 0
answer count: 1
has body: I have 2 classes Verification Contract with the following structure: public class Verification implements Serializable { private Long verificationId; private Long salesManCode; private Long clientCode; ... } public class Contract implements Serializable { private Long contractId; private Long salesManCode; private Long clientCode; ... } These classes have their respectives hbm.xml maps, in the database model the tables do not have association, neither in the hibernate mapping, but when saving a Contract, it must have the same verificationId y the contractId field (Business Rules), but some cases are also given contracts without verification. verification verificationId | salesManCode | clientCode 1050 1001 2056 1051 1001 2248 1054 1002 2856 contract contractId | salesManCode |clientCode 1050 1001 2056 &lt;- this contract have verification 1051 1001 2248 &lt;- this contract have verification 1052 1025 2822 &lt;- this contract not have verification 1053 1254 1547 &lt;- this contract not have verification 1054 1002 2856 &lt;- this contract have verification My problem is when I run the HQL query: select con.salesManCode, ver.salesManCode, con.clientCode, ver.clientCode, con.contracId, ver.verificationId from Verification ver, Contract con where ver.verificationId = con.contractId but Hibernate translate with a cross join sentence and combine all records. Is there any method to execute a HQL query between un-related classes in hbm.xml files? RULE: should not be mapped entities.
has answer: http://stackoverflow.com/a/26997218
favorite count: 0
tagged with: mapping

http://stackoverflow.com/q/27028745
accepted answer: http://stackoverflow.com/a/27028795
type: Question
has body: I ma getting Exception when trying type from keyboard 2nd scanner in "talis probability". Mainly i am trying to change from keyboard probabilty of tail.. Number of threads: 2 Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextFloat(Scanner.java:2345) at rzutmoneta.Toss.main(Toss.java:32) talis probability: Java Result: 1 and dont know why...but i know that issue is probably here "final class Coin".. How to repair my program? final class Toss { public static float p; public static void main(String... argv) { System.out.print("Number of threads: "); int how_much; try (Scanner input = new Scanner(System.in)) { how_much = input.nextInt(); } System.out.print("talis probability: "); try (Scanner input = new Scanner(System.in)) { p = input.nextFloat(); } ExecutorService threads = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); for (int i = 0; i &lt; how_much; ++i) threads.submit(Toss::run); threads.shutdown(); } private static void run() { Coin coin = new Coin(); int count = 0; while (coin.flip() == Coin.UpDown.Tails) { System.out.println(Thread.currentThread().getName() + ": Talis!"); ++count; } System.out.printf("%s: heads! %d talis%n", Thread.currentThread().getName(), count); } } final class Coin { public static float p; Coin() { Toss.p = Coin.p; } enum UpDown { Heads, Tails } UpDown flip() { //return ThreadLocalRandom.current().nextBoolean() ? Strony.Orzeł : Strony.Reszka; return ThreadLocalRandom.current().nextFloat() &lt; p ? UpDown.Heads : UpDown.Tails; } }
has title: Exception when passing value from scanner
score: 0
answer count: 1
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/27028795
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42807959
comment on: http://stackoverflow.com/a/27143682
score: 0
type: Comment
has text: Look at your date format, the first date are separated by `/` and the other by `-`. How do you expect your `SimpleDateFormat` to parse your date if the date string does not conform to your date pattern `yyyy/MM/dd HH:mm:ss`?
type: AnswerComment

http://stackoverflow.com/comment/42730512
comment on: http://stackoverflow.com/a/27113529
score: 0
type: AnswerComment
has text: Ok, I also thought about that. So the better solution would be the second possibility that I mentioned?
type: Comment

http://stackoverflow.com/q/27148589
linked to: http://stackoverflow.com/q/26176439
has comment: http://stackoverflow.com/comment/42819272
tagged with: spring
has comment: http://stackoverflow.com/comment/42795146
has answer: http://stackoverflow.com/a/27443095
answer count: 2
has title: How to create and maintain one jdbc connection per user in web app (Spring/Vaadin)?
upvote count: 1
possible better answer: http://stackoverflow.com/a/27163748
tagged with: java
has comment: http://stackoverflow.com/comment/42794715
has comment: http://stackoverflow.com/comment/42792795
has answer: http://stackoverflow.com/a/27163748
accepted answer: http://stackoverflow.com/a/27443095
has comment: http://stackoverflow.com/comment/42816083
type: AnsweredQuestion
tagged with: apache-commons-dbcp
downvote count: 0
tagged with: mybatis
score: 1
has body: How to create an application which can handle thousand of jdbc connection at runtime without implementing connection pool ? AFAIK to establish connection pool, we need username, passowrd and required dbinstance url but here all of them will be provided at runtime to connect particular database, and there would be more than 1000 user at one time to connect to set of databases.(memory intensive !) So typically it going to be like this: Users: User-A,User-B,User-C.....User-n db: DB1, DB2, DB3....DBn Can anyone please guide me how can I achieve this task ? I only have one thing in my mind, i.e. to create single connection with each session and use it whereever required specific to that user. I've used Apache Commons DBCP2 for connection pooling, MyBatis-Spring implementation, Spring and Vaadin for different application but not sure if anyone of them gonna help me !
favorite count: 0
has comment: http://stackoverflow.com/comment/42855041
type: Question

http://stackoverflow.com/comment/42639041
has text: Do google for merge using util:map and see what you are getting.
comment on: http://stackoverflow.com/q/27061985
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27141469
tagged with: resteasy
tagged with: rest
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/3459795
linked to: http://stackoverflow.com/q/5042886
type: Question
has title: What is diffrence between RESTEasy and jersey
has comment: http://stackoverflow.com/comment/42780307
tagged with: jersey
duplicate of: http://stackoverflow.com/q/3459795
tagged with: jsp
has body: i am working with java restfull services, i want a light weight rest server with jetty. What is actual difference between jersey and rest-eassy? Which is light weight? In which scenario i want to chose jersey or rest-eassy?
downvote count: 0
has comment: http://stackoverflow.com/comment/42780249
favorite count: 0

http://stackoverflow.com/a/27141822
score: 0
type: AcceptedAnswer
has body: This code will initialize all your list elements to null import java.util.ArrayList; import java.util.Collections; public class TestArray { public static void main(String[] arg) { ArrayList&lt;Object&gt; list = new ArrayList&lt;Object&gt;(Collections.nCopies(5, null)); System.out.println(list); } } output: [null, null, null, null, null]
has comment: http://stackoverflow.com/comment/42781038
answers question: http://stackoverflow.com/q/27141668
type: Answer
accepted answer of: http://stackoverflow.com/q/27141668
has comment: http://stackoverflow.com/comment/42781146
has comment: http://stackoverflow.com/comment/42780926
has comment: http://stackoverflow.com/comment/42781306
has comment: http://stackoverflow.com/comment/42782425

http://stackoverflow.com/q/27010388
has answer: http://stackoverflow.com/a/33417274
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42548530
has comment: http://stackoverflow.com/comment/42548364
tagged with: java
type: Question
tagged with: inetaddress
tagged with: network-programming
has comment: http://stackoverflow.com/comment/42548276
has answer: http://stackoverflow.com/a/27010750
has answer: http://stackoverflow.com/a/27010843
has body: My Host entry as follow : 10.106.1.188 myhost 192.168.0.156 myhost 192.168.0.160 myhost 192.168.0.150 myhost 10.106.1.121 myhost 10.106.1.110 myhost I use following code for get all IP Address from host entry InetAddress[] addresses = InetAddress.getAllByName("myhost"); for( InetAddress address : addresses) { System.out.println(address); } Problem is above code does not manage Ip Address order. When Running above program on Windows 7 it works fine but on linux machine it does not manage order
score: 0
answer count: 3
has title: InetAddress getAllByName does not manage order of return IP Addresses as mentioned in host entry

http://stackoverflow.com/comment/42741490
comment on: http://stackoverflow.com/q/27120135
score: 0
type: Comment
type: QuestionComment
has text: @MadProgrammer Yes I did it in construtor only . . Here it is ` public VirtualK() { setAlwaysOnTop(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 500, 400); setFocusable(false); initComponents(); }`

http://stackoverflow.com/comment/42633474
has text: There are concurrent data structures available in Java libraries. So IF you are having multiple copies of the same data which various threads work upon, then you can use the concurrent structures and the threads can work concurrently on the same structure. It can save space if you're having local copies of the data.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27058755

http://stackoverflow.com/comment/42714854
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27105650
has text: No sir. For some reason or other, the list remains empty even after putting the code in the `onPreExecute` section of my `AsyncTask`

http://stackoverflow.com/q/27123120
score: 2
has comment: http://stackoverflow.com/comment/42748220
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42748728
tagged with: java
has comment: http://stackoverflow.com/comment/42747971
has comment: http://stackoverflow.com/comment/42748825
tagged with: methods
has comment: http://stackoverflow.com/comment/42747052
type: Question
linked to: http://stackoverflow.com/q/7383622
has answer: http://stackoverflow.com/a/27123609
accepted answer: http://stackoverflow.com/a/27123392
has comment: http://stackoverflow.com/comment/42750562
has comment: http://stackoverflow.com/comment/42748489
answer count: 2
has comment: http://stackoverflow.com/comment/42786993
has title: java method not returning the correct type
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/27123392
favorite count: 0
has comment: http://stackoverflow.com/comment/42746942
tagged with: return
upvote count: 2
possible better answer: http://stackoverflow.com/a/27123609
has body: I have a method in a class and it is suppose to be returning a jsp file once the 'next' button is hit. but it just wipes the data from the current page and returns the current page. this is the method @RequestMapping(value = "/addQuestion", method = RequestMethod.POST) public String addQuestion(Model model, @RequestParam(value="question", required = true) String theQuestion , @RequestParam(value="questionId", required = true) Integer questionId, @RequestParam(value="category", required = true) String category, @RequestParam(value="correctAnswer", required = true) String correctAnswer) throws SQLException{ ViewController viewController = new ViewController(); viewController.createQuestion(questionId, theQuestion, category, correctAnswer); model.addAttribute("question", new Question()); return "qFour"; } it should return qFour.jsp but it just returns addQuestion.jsp which is the page it is currently on
has comment: http://stackoverflow.com/comment/42780302
has comment: http://stackoverflow.com/comment/42748181

http://stackoverflow.com/comment/42790678
type: AnswerComment
score: 0
type: Comment
has text: But you need to use `Response.ok().cookie(new NewCookie(name, value)).build();`, otherwise you will not set any cookies in the response.
comment on: http://stackoverflow.com/a/27147611

http://stackoverflow.com/comment/42556844
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27015701
has text: Doesn't thread write to the same output stream as the process it's parent process, this would be natural since they share memory, they would naturally share underlying file descriptors.
type: Comment

http://stackoverflow.com/comment/42899985
type: AnswerComment
has text: @AngelAngel I have nothing to hide! not going to delete anything :P
type: Comment
comment on: http://stackoverflow.com/a/27117023
score: 1

http://stackoverflow.com/q/27139615
has comment: http://stackoverflow.com/comment/42777047
has comment: http://stackoverflow.com/comment/42777156
has comment: http://stackoverflow.com/comment/42777228
linked to: http://stackoverflow.com/q/49379
has body: I would like to know what the checkCreateClassLoader method does , its not very clear in the java api doc.Yes , let say I have an application and want to avoid someone dumping my classes during run time(using java agent or reflection). Can I use this method for avoiding this . Thanks MalikDz
has answer: http://stackoverflow.com/a/27139724
has comment: http://stackoverflow.com/comment/42777198
answer count: 1
downvote count: 1
tagged with: securitymanager
has title: What does this method do checkCreateClassLoader in the security manager class
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42777142
upvote count: 0
has comment: http://stackoverflow.com/comment/42777197
tagged with: java
type: Question
score: -1

http://stackoverflow.com/a/27065497
score: 0
type: Answer
has body: In my current project (trading terminal) we are using GWT with interop with server side over web sockets. It is fast, tiny and allow interact in both directions. We used custom protocol but you can use Protobuf for serialization/deserialization on both sides. Web sockets are not supported on old browsers.
answers question: http://stackoverflow.com/q/27063950

http://stackoverflow.com/comment/42608801
score: 0
comment on: http://stackoverflow.com/q/27045009
has text: `Caused by: java.lang.ClassNotFoundException: Didn't find class "com.estimote.examples.demos.DistanceBackgroundView"` and please don't post your API key in the manifest. You can safely delete that.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26996651
tagged with: java
has body: I'm trying to consume a webservice with a response like the following <prize numCorrect="3" winners="0" guarantee="0" value="18.00" size="18.0"/> <event id="15854" name="Barnet v Cameroun" scoreHome="" scoreAway="" outcomeId="" poolResultStatus="" lastUpdateDate="2014-11-14" lastUpdateTime="13:43:51"/> <event id="15855" name="Celtic v Clydebank" scoreHome="" scoreAway="" outcomeId="" poolResultStatus="" lastUpdateDate="2014-11-14" lastUpdateTime="13:43:51"/> <event id="15856" name="Barcelona v Arbroath" scoreHome="" scoreAway="" outcomeId="" poolResultStatus="" lastUpdateDate="2014-11-14" lastUpdateTime="13:43:51"/> So only properties - no values. I'm consuming it like WebTarget oxipTarget = ClientBuilder.newClient().target(<URL>); oxip = oxipTarget.request(MediaType.APPLICATION_XML).get(Oxip.class); And Oxip is the base root of the hiearchy But only the instances are created I get no values in my instances. How can I get the properties as values inside my instances ? From my log I can sew the following (log from each constructor) creating Oxip creating Response creating Disclaimer creating Pool creating Prize creating Event creating Event creating Event (I'll properly have an issue with 3 events not in a events list - I'm trying to get the producer to change this) kind regards Torben
has answer: http://stackoverflow.com/a/26998185
has title: Properties instead of values in J2EE 7 Rest client
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42525671
downvote count: 0
tagged with: jax-rs
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42526920
tagged with: rest
type: Question
accepted answer: http://stackoverflow.com/a/26998185
upvote count: 1
answer count: 1
tagged with: jakarta-ee

http://stackoverflow.com/comment/42604719
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27042695
has text: You're right. I just changed it and it kinda works, but since I've put it in the buttonStart, now how do I cancel it from another button's method?

http://stackoverflow.com/comment/42632927
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27058846
has text: i could not send messages between these two clients. But, yes, they can connect to the server. However, I want my clients to communicate each other instead.
score: 0

http://stackoverflow.com/a/27138384
answers question: http://stackoverflow.com/q/27138328
has body: You internal loop do{}while(cond) will exit if you enter a string which has 10 chars. do{}while(cond) will exit only if the inverse of the cond is found.
type: Answer
score: 0

http://stackoverflow.com/comment/42538960
type: QuestionComment
has text: @nitind thanks for the suggestion. It helped me track down where it wasn't pointing right, even though it said it was.
score: 0
comment on: http://stackoverflow.com/q/27001486
type: Comment

http://stackoverflow.com/a/27050477
type: Answer
answers question: http://stackoverflow.com/q/27050275
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42618545
upvote count: 1
has body: try this, for me is working: setBackground(new Color(rand.nextInt(251), rand.nextInt(251), rand.nextInt(251))); your applet not change color, because define a random color in the begining, and each time it paint repaint with the same random color declared in the begin. i hope this help you
has comment: http://stackoverflow.com/comment/42620088

http://stackoverflow.com/a/27067303
has comment: http://stackoverflow.com/comment/42671033
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43204504
type: Answer
has comment: http://stackoverflow.com/comment/42650370
has body: Check this thread (uses swingx JXDatePicker component, he extends it's functionality) Is there any good and free Date AND Time Picker available for Java Swing? Second answer has a full example download swingx from here: http://www.java2s.com/Code/Jar/s/Downloadswingxjar.htm example from the other post: import org.jdesktop.swingx.calendar.SingleDaySelectionModel; import org.jdesktop.swingx.JXDatePicker; import javax.swing.*; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.DateFormatter; import java.text.DateFormat; import java.text.ParseException; import java.util.*; import java.awt.*; public class DateTimePicker extends JXDatePicker { private JSpinner timeSpinner; private JPanel timePanel; private DateFormat timeFormat; public DateTimePicker() { super(); getMonthView().setSelectionModel(new SingleDaySelectionModel()); } public DateTimePicker( Date d ) { this(); setDate(d); } public void commitEdit() throws ParseException { commitTime(); super.commitEdit(); } public void cancelEdit() { super.cancelEdit(); setTimeSpinners(); } @Override public JPanel getLinkPanel() { super.getLinkPanel(); if( timePanel == null ) { timePanel = createTimePanel(); } setTimeSpinners(); return timePanel; } private JPanel createTimePanel() { JPanel newPanel = new JPanel(); newPanel.setLayout(new FlowLayout()); //newPanel.add(panelOriginal); SpinnerDateModel dateModel = new SpinnerDateModel(); timeSpinner = new JSpinner(dateModel); if( timeFormat == null ) timeFormat = DateFormat.getTimeInstance( DateFormat.SHORT ); updateTextFieldFormat(); newPanel.add(new JLabel( "Time:" ) ); newPanel.add(timeSpinner); newPanel.setBackground(Color.WHITE); return newPanel; } private void updateTextFieldFormat() { if( timeSpinner == null ) return; JFormattedTextField tf = ((JSpinner.DefaultEditor) timeSpinner.getEditor()).getTextField(); DefaultFormatterFactory factory = (DefaultFormatterFactory) tf.getFormatterFactory(); DateFormatter formatter = (DateFormatter) factory.getDefaultFo…
downvote count: 1
has comment: http://stackoverflow.com/comment/42672245
has comment: http://stackoverflow.com/comment/42675216
score: 3
accepted answer of: http://stackoverflow.com/q/27053276
has comment: http://stackoverflow.com/comment/42649267
answers question: http://stackoverflow.com/q/27053276
upvote count: 4

http://stackoverflow.com/comment/42826948
comment on: http://stackoverflow.com/q/27147379
has text: it was because my screenshot was to big, so I removed my scroll view
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27133371
accepted answer: http://stackoverflow.com/a/27133448
has comment: http://stackoverflow.com/comment/42765367
type: AnsweredQuestion
tagged with: java
has body: I'm getting wrong output. I'll put the 3 codes here, they are pretty basic as I've just started to study. (The third code is the tester) The problem: in the tester I'm getting that input (0,0,0), but I need to get (50,40,30) I think the main problem is here: public void setColor (RGBColor color) { } I tried playing with it, and I don't have a better solution than: _color = new RGBColor(color); _color.setRed(color.getRed()); _color.setGreen(color.getGreen()); _color.setBlue(color.getBlue()); RGBColor class. /** * This program is used to represent 3 Colors: Red, Green, Blue. (RGB) * These colors hold values between 0 and 255. * * * @Author doesn't matter ;) */ public class RGBColor { /** * attributes: red, green and blue component of a color. */ private int _red,_green,_blue; /** * final variables. */ private final int MAX_VALUE = 255,MIN_VALUE = 0; private final double THIRTY_PERCENT = 0.3,FIFTY_NINE_PERCENT = 0.59,ELEVEN_PERCENT = 0.11; /** * Consctructor which gets 3 colors (RGB), we check here if their range is valid (0 - 255), if not we assign black to it. * * @param red - The red color component value. * @param green - The green color component value. * @param blue - The blue color component value */ public RGBColor(int red, int green, int blue) { if(isValid(red,green,blue)) { _red = red; _green = green; _blue = blue; } else doBlack(); } /** * Construct a black RGBColor. i.e. red = green = blue = 0 */ public RGBColor() { doBlack(); } /** * Construct a new RGBColor which is a copy of the given color. * * @param other - The RGBColor to copy. */ public RGBColor(RGBColor other) { _red = other._red; _green = other._green; _blue = other._blue; } /** * Returns the Red component of RGBColor. * * @return The red color component value of this RGBColor. */ public int getRed() { return _red; } /** * Returns the Green component of RGBColor. * * @return The green color component value of this RGBColor. */ public int getGreen() { return _green; } /** * Returns the blue compone…
type: Question
has title: Getting Input (0,0,0) instead of (50,40,30) [Java]
has comment: http://stackoverflow.com/comment/42765418
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27133448

http://stackoverflow.com/comment/42525650
score: 0
type: AnswerComment
has text: @bukowski, if you need any help fixing the error with spinner, post the code sample.
type: Comment
comment on: http://stackoverflow.com/a/26996465

http://stackoverflow.com/comment/113877318
type: Comment
has text: This solution should be the accepted answer since it is more concise.
score: 11
comment on: http://stackoverflow.com/a/27006185
type: AnswerComment

http://stackoverflow.com/comment/42742728
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27120530
has text: @Subh : yeah, probably that will be a better solution :)

http://stackoverflow.com/a/28551379
type: Answer
accepted answer of: http://stackoverflow.com/q/27007492
answers question: http://stackoverflow.com/q/27007492
score: 0
type: AcceptedAnswer
has body: Are you behind a proxy or firewall? Have you tried starting the demo without the examples that are cloned from a public repo?

http://stackoverflow.com/a/27140575
answers question: http://stackoverflow.com/q/27140383
has body: The most important thing to do is understand the concept. You are going to store a rational number in your Rational class. When you do this: Rational r1 = new Rational(num1,den1); You are making a single instance of a Rational and naming it r1. r1 should now contain a numerator and a denominator (in this case num1 and den1). Let's say you want to make the number one half, or 1/2. You could do this: Rational oneHalf = new Rational(1,2); Realize that new Rational(1,2) is calling the constructor of your Rational class. In your constructor you need to assign num and den to the passed values (in this case 1 and 2). So you would need something like this: this.num = num1; this.den = den1; So if you want to have the ability to multiply one Rational with another Rational you would need a method or function to do that. In your Rational class, create a method called multiply(Rational anotherRational). That function would do something like this: this.num = this.num * anotherRational.num; this.den = this.den * anotherRational.den; I gave away half the answer, I'll let you do the rest. Don't just copy what you find here, think about what you're doing.
score: 0
type: Answer

http://stackoverflow.com/a/27094276
score: 0
type: Answer
has body: You could simplify this code somewhat (and make it easier to maintain) by only having a single method that performs the check. The second method can simply call the first one, for example: public static boolean isOdd(int num) { return ((num % 2) == 1); } public static boolean isEven(int num) { return !isOdd(num); } For that matter, using a bitwise AND operation here is more efficient: public status boolean isEven(int num) { return (num &amp; 1) == 0; }
has comment: http://stackoverflow.com/comment/42694398
answers question: http://stackoverflow.com/q/27094189

http://stackoverflow.com/comment/42570875
type: Comment
has text: @JoeyChong I added fuseki-server.bat. But same error gave me. Is there any otherway to run this server like Tomcat server run when application start? (Like adding to class path)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27012458

http://stackoverflow.com/q/27136752
has comment: http://stackoverflow.com/comment/42801524
has answer: http://stackoverflow.com/a/60452520
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/39937207
favorite count: 0
tagged with: powermock
accepted answer: http://stackoverflow.com/a/28679264
has title: PowerMock throws NoSuchMethodError (setMockName)
has body: I'm trying to mock a constructor using PowerMockito but every time I run the test I get the following error: java.lang.NoSuchMethodError: org.mockito.internal.creation.MockSettingsImpl.setMockName(Lorg/mockito/mock/MockName;)Lorg/mockito/internal/creation/settings/CreationSettings; at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:107) at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:60) at org.powermock.api.mockito.internal.expectation.DefaultConstructorExpectationSetup.createNewSubstituteMock(DefaultConstructorExpectationSetup.java:105) at org.powermock.api.mockito.internal.expectation.DefaultConstructorExpectationSetup.withAnyArguments(DefaultConstructorExpectationSetup.java:71) I have the following PowerMock dependencies in my project: org.powermock:powermock-module-junit4:1.5.6 org.powermock:powermock-mockito-release-full:1.5.6 I've traced the dependency tree of my project and fixed conflicts so that mockito-all:1.9.5 gets included in the build.
has answer: http://stackoverflow.com/a/39669045
has comment: http://stackoverflow.com/comment/42802671
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42796347
score: 21
tagged with: java
upvote count: 21
has answer: http://stackoverflow.com/a/61606663
type: Question
tagged with: junit4
possible better answer: http://stackoverflow.com/a/40371375
tagged with: mockito
has answer: http://stackoverflow.com/a/40371375
has answer: http://stackoverflow.com/a/28679264
has comment: http://stackoverflow.com/comment/42772003
has answer: http://stackoverflow.com/a/27607632

http://stackoverflow.com/a/37675253
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27094544
has comment: http://stackoverflow.com/comment/62886675
type: Answer
accepted answer of: http://stackoverflow.com/q/27094544
has comment: http://stackoverflow.com/comment/62845726
has comment: http://stackoverflow.com/comment/78827849
upvote count: 10
has body: This bad decision was made by a developer in the year 2006. Here is a nice citation from someone that explains the whole situation from java perspective: "As you probably guessed by now it's a bug (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6382788). Not the retry mechanism, of course, that's just crap. The bug is that it also happens for a POST (which is by default not idempotent per HTTP RFC). But don't worry, Bill fixed that bug a long time ago. Bill fixed it by introducing a toggle. Bill learned about backward compatibility. Bill decided it's better to leave the toggle 'on' by default because that would make it bug-backward-compatible. Bill smiles. He can already see the faces of surprised developers around the globe running into this. Please don't be like Bill?" Source Well the proposed solution is: System.setProperty("sun.net.http.retryPost", "false") But we cannot do this on android! The only remaining solution then is: httpURLConnection.setChunkedStreamingMode(0); Which seems to be working, but isn't very effective from a requesting-time perspektive. EDIT: I could not use this implementation so i looked for an alternative library. I found out that the implementation of HttpUrlConnection uses OkHttp since Android 4.4. As OkHttp is opensource i could search if they have also problems with silent retries. And yep they had problems with it and fixed it in April, 2016. CommonsWare (a real android expert) explains that every manufacturer can decide which implementation they can use. As a consequence of this there must be a lot of devices out there that do silent retries on POST requests and as a developer we only can try some workarrounds. My solution will be to change the library EDIT 2: To give you a final answer: You can now use OkHttp as the transport layer for Volley with minimal code. Another helpful solution
score: 10
has comment: http://stackoverflow.com/comment/62871210

http://stackoverflow.com/a/27138547
has body: JMSPriority should be a header rather than a property. producerTemplate.sendBodyAndHeader("activemq:queue.queue", message, "JMSPriority", priority);
answers question: http://stackoverflow.com/q/27138036
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27138036
type: Answer

http://stackoverflow.com/q/27062815
tagged with: dropwizard
answer count: 1
tagged with: unix
has title: Is there a way to be notified when a task started with nohup goes down?
tagged with: nohup
type: UnansweredQuestion
has body: I have a service developed in DropWizard. I run the fat jar on an AWS server with the nohup command like this. nohup java -jar myapp-0.0.1-SNAPSHOT.jar server my-configure.yml &gt; outfile &amp; This works fine. However, yesterday I tried to use the app that makes use of the service and it wasn't working. When I logged into the server I realized that the service was no longer running. It had been running for couple of months without any issues. In the logs (outfile) I just see the following: INFO [2014-11-13 19:48:31,978] org.eclipse.jetty.server.Server: Graceful shutdown SocketConnector@0.0.0.0:9001 INFO [2014-11-13 19:48:31,987] org.eclipse.jetty.server.Server: Graceful shutdown InstrumentedBlockingChannelConnector@0.0.0.0:9000 INFO [2014-11-13 19:48:31,988] org.eclipse.jetty.server.Server: Graceful shutdown o.e.j.s.ServletContextHandler{/,null} INFO [2014-11-13 19:48:31,988] org.eclipse.jetty.server.Server: Graceful shutdown o.e.j.s.ServletContextHandler{/,null} Question How can I troubleshoot why the service stopped running?...could AWS server have been restarted? Is there a better way to do this that is not prone to errors like these Is there a way I can be notified when the service stopped running ...rather than checking it every so often... Edit Just checked uptime on the AWS server and it says up for 7 days. Which coincides with when the service went down. I guess the solution is to have the service start automatically on server restart.
tagged with: java
has answer: http://stackoverflow.com/a/27064472
type: Question
linked to: http://stackoverflow.com/q/5747803
tagged with: amazon-web-services
score: 0

http://stackoverflow.com/comment/42621189
has text: @markspace This is for school and my teacher said not to use JLabel.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27051937
type: Comment

http://stackoverflow.com/comment/42741476
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27120114
has text: downvote rescinded, but you still haven't really answered this question. The underlying confusion is a reference-vs-value issue

http://stackoverflow.com/a/27024334
has body: This has been fixed for a future Android release, but in the meantime you can work around the issue by using a non-opaque popup menu background. The default background in Material is a 2dp rounded rectangle, which will work fine, but if you absolutely need a custom background then you can do something like: res/drawable/my_menu_background.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&gt; &lt;corners android:radius="2dp" /&gt; &lt;solid android:color="@color/my_color" /&gt; &lt;/shape&gt;
has comment: http://stackoverflow.com/comment/42594800
type: Answer
answers question: http://stackoverflow.com/q/27019343
upvote count: 2
has comment: http://stackoverflow.com/comment/42581900
score: 2
has comment: http://stackoverflow.com/comment/42581077
accepted answer of: http://stackoverflow.com/q/27019343
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42838587
score: 0
type: Comment
has text: if I use your code, it cannot find a symbol, but when I delete "this." the alert message pops up. On Main Thread the App crashes. But that's not a problem for me. All I was searching for was an alert message, that shows me, if it goes throu the code. Thank You for your help :)
type: AnswerComment
comment on: http://stackoverflow.com/a/27077349

http://stackoverflow.com/comment/42538637
comment on: http://stackoverflow.com/q/27004392
score: 0
has text: Java's `HashTable` class neither defines nor inherits an `insert` method. It uses `put` to add new data. When adding data to a `hashtable` one needs to provide **2** parameters: **key** and **value**.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/97886779
has text: @nairavs: Ask a new question :)
comment on: http://stackoverflow.com/a/27146852
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/27097473
answer count: 1
linked to: http://stackoverflow.com/q/19418427
tagged with: parsing
has title: Command Line Input Issues (Java)
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42700204
type: Question
has answer: http://stackoverflow.com/a/27097589
accepted answer: http://stackoverflow.com/a/27097589
has comment: http://stackoverflow.com/comment/42700327
has body: I have a program that reads in a specific grammar for a CFL and outputs the separate productions for the start symbol, but for some reason passing in command line arguments doesn't work. I've tried using a String[] in the program, named input and using that seems to provide output, but when I try and run the program with specific commands from the command line, I get errors. Here's the code: char[][] prod; int prodCount = 0, numProds = 0; String[] input = new String[] {"a","a","S","b","X", "a","a","S","a","X", "a","S","a","X"}; for(int i = 0; i &lt; input.length; i++) { if(input[i] == "X") prodCount++; } if(input[input.length - 1] == "X") { prod = new char[prodCount + 1][1]; prod[prod.length - 1][0] = '\0'; } else prod = new char[prodCount][]; int current = 0; for(int i = 0; i &lt; input.length; i++) { if(input[i] == "X") { prod[current] = new char[numProds]; current++; numProds = 0; } else numProds++; } int currentTerminal = 0; current = 0; for(int i = 0; i &lt; input.length; i++) { if(input[i] == "X") { currentTerminal = 0; current++; } else { prod[current][currentTerminal] = input[i].charAt(0); currentTerminal++; } } for(int i = 0; i &lt; prod.length; i++) { for(int j = 0; j &lt; prod[i].length; j++) { if(prod[i][j] == '\0') System.out.print("E"); else System.out.print(prod[i][j]); } System.out.println(); } Using this code with the String[] input gives me aaSb aaSa aSa E However, when I try using input from the command line I get... Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 Line 36 Here's the line that the above error points to prod[current][currentTerminal] = args[i].charAt(0); I'm not sure what's different between String[] input and String[] args. Can someone let me know where I'm making a mistake?
score: 0
has comment: http://stackoverflow.com/comment/42700245
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/q/27116605
favorite count: 0
tagged with: objectify
tagged with: google-app-engine
has body: I got the following error in a Google App Engine project that utilizes Objectify: [INFO] com.googlecode.objectify.SaveException: Error saving com.netbase.model.InsightDataSet@13b24628: id cannot be zero [INFO] at com.googlecode.objectify.impl.EntityMetadata.save(EntityMetadata.java:95) [INFO] at com.googlecode.objectify.impl.WriteEngine.save(WriteEngine.java:73) [INFO] at com.googlecode.objectify.impl.SaverImpl.entities(SaverImpl.java:60) [INFO] at com.googlecode.objectify.impl.SaverImpl.entity(SaverImpl.java:35) [INFO] at com.netbase.server.InsightManager.persistInsights(InsightManager.java:26) [INFO] at com.netbase.server.LongTestServlet.downloadAllInsightsAsTimeSeriesAndSend(LongTestServlet.java:140) [INFO] at com.netbase.server.LongTestServlet.doHelper(LongTestServlet.java:98) [INFO] at com.netbase.server.LongTestServlet.doPost(LongTestServlet.java:52) Here is how my java class is defined: @com.googlecode.objectify.annotation.Entity public class InsightDataSet { @com.googlecode.objectify.annotation.Id long id; Here is how I'm trying to save it: InsightDataSet insightDataSet = new InsightDataSet(username, topicId, requestDate); ofy().save().entity(insightDataSet).now();
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27116606
accepted answer: http://stackoverflow.com/a/27116606
has title: Objectify - com.googlecode.objectify.SaveException: Error saving : id cannot be zero
type: Question
upvote count: 1
answer count: 1

instantiation
type: Tag
tags question: http://stackoverflow.com/q/27078488
tags question: http://stackoverflow.com/q/27036499
tags question: http://stackoverflow.com/q/27028878
tag name: instantiation

http://stackoverflow.com/a/27040440
has body: It seems that your files are saved with the wrong case, the file should be named project.properties with a lowercase p.
type: Answer
has comment: http://stackoverflow.com/comment/42600184
score: 0
answers question: http://stackoverflow.com/q/27040184

http://stackoverflow.com/a/27071989
has body: You can do it outside the class hierarchy. Have a utility function that uses reflection to find all descendants of Parent and then adds them to your list.
accepted answer of: http://stackoverflow.com/q/27071941
answers question: http://stackoverflow.com/q/27071941
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42668022
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42656404

http://stackoverflow.com/q/27151276
tagged with: swing
tagged with: java
has body: I've tried to run the example found in Java Swing 2nd Edition 7.1.3 ScrollPaneLayout. The image and the scroll have worked just fine, but the ruler hasn't. Here's my code: public class ScrollPaneLayoutDemo extends JFrame{ JLabel label = new JLabel(new ImageIcon("img.jpg")); public ScrollPaneLayoutDemo() { super("ScrollPaneLayout Demo"); JScrollPane jsp = new JScrollPane(label); JLabel[] corners = new JLabel[4]; for(int i=0; i&lt;4; i++) { corners[i] = new JLabel(); corners[i].setBackground(Color.YELLOW); corners[i].setOpaque(true); corners[i].setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createLineBorder(Color.RED, 1))); } JLabel rowheader = new JLabel() { Font f = new Font("Serif", Font.ITALIC | Font.BOLD, 10); public void paintComponent(Graphics g) { super.paintComponent(g); Rectangle r = g.getClipBounds(); g.setFont(f); g.setColor(Color.RED); for (int i = 50 - (r.y % 50); i &lt; r.height; i += 50) { g.drawLine(0, r.y + i, 3, r.y + i); g.drawString("" + (r.y + i), 6, r.y + i + 3); } } public Dimension getPreferredSize() { return new Dimension(25, (int) label.getPreferredSize().getHeight()); } }; rowheader.setBackground(Color.YELLOW); rowheader.setOpaque(true); JLabel columnheader = new JLabel() { Font f = new Font("Serif", Font.ITALIC | Font.BOLD, 10); public void paintComponent(Graphics g) { super.paintComponent(g); Rectangle r = g.getClipBounds(); g.setFont(f); g.setColor(Color.RED); for (int i = 50 - (r.x % 50); i &lt; r.width; i += 50) { g.drawLine(r.x + i, 0, r.x + i, 3); g.drawString("" + (r.x + i), r.x + i - 10, 16); } } public Dimension getPreferredSize() { return new Dimension((int) label.getPreferredSize().getWidth(),25); } }; columnheader.setBackground(Color.YELLOW); columnheader.setOpaque(true); jsp.setRowHeaderView(rowheader); jsp.setColumnHeaderView(columnheader); jsp.setCorner(JScrollPane.LOWER_LEFT_CORNER, corners[0]); jsp.setCorner(JScrollPane.LOWER_RIGHT_CORNER, corners[1]); jsp.setCorner(…
type: Question
has answer: http://stackoverflow.com/a/27151542
has comment: http://stackoverflow.com/comment/42797238
score: 0
tagged with: jscrollpane
answer count: 1
type: UnansweredQuestion
has title: JScrollPane with rulers didn't work

http://stackoverflow.com/q/26994718
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/26996801
favorite count: 0
has comment: http://stackoverflow.com/comment/42523971
tagged with: jenkins-scriptler
tagged with: jenkins-cli
type: AnsweredQuestion
tagged with: jenkins
tagged with: java
upvote count: 1
tagged with: jenkins-plugins
has answer: http://stackoverflow.com/a/26996801
type: Question
has comment: http://stackoverflow.com/comment/42521001
has body: I am working on to migrate inhouse written java based build tools to Jenkins. The inhouse build tools has more than 1000 jobs for various products and their respective release and each job has 10+ steps and each step has some lines of code to executed. This inhouse build tool is written in Java. inhouse build tools doing nothing but reading following files and creating a dynamic jsp view and load the build history from db and display it. Step.prop - which has all the step and respective commands e.g pdplanner : clean : YES : YES : runant -Dproperties_file=build/dallas78.build.properties -f buildjars.xml clean_all pdplanner : version : YES : NO : runant -Dproperties_file=build/dallas78.build.properties version Clearcase config spec files .cs for each job If we start setting up each jobs in jenkins for all 1000 jobs, it will take a more than a year to get the successful build for all. I am thinking to do some automation whereas the dynamically Jenkins config.xml can be created by reading all these properties n spec files for each project. One more specification from product mgmt team is that - we should be having each step as a checkbox in jenkins job so if someone does want to execute some of the steps, they can uncheck it accordingly. I am puzzling my mind to do this task with different options but have not concluded...i did consider template plugins which might not suite my way. Can you please share your views/suggestion on this problem and share your ideas?
possible better answer: http://stackoverflow.com/a/27603039
has answer: http://stackoverflow.com/a/27603039
answer count: 2
has title: inhouse build tool to Jenkins

http://stackoverflow.com/comment/42681171
type: QuestionComment
score: 1
has text: I can not understand why it should do something different. What behavior would you expect?
comment on: http://stackoverflow.com/q/27086347
type: Comment

http://stackoverflow.com/a/27025031
has body: Try to force update dependencies with the switch -U. At least you can be sure that it is not because of your local error in .m2.
has comment: http://stackoverflow.com/comment/42610349
has comment: http://stackoverflow.com/comment/42573919
has comment: http://stackoverflow.com/comment/42573704
upvote count: 1
has comment: http://stackoverflow.com/comment/42573625
type: Answer
answers question: http://stackoverflow.com/q/27024974
downvote count: 0
has comment: http://stackoverflow.com/comment/42574013
score: 1

http://stackoverflow.com/comment/42702300
has text: @Makoto - if you'd care to elaborate on that, perhaps I could improve my answer. The111 +1, lol.
comment on: http://stackoverflow.com/a/27098335
type: AnswerComment
score: 0
type: Comment

calendar
tags question: http://stackoverflow.com/q/27100733
tags question: http://stackoverflow.com/q/27043409
tags question: http://stackoverflow.com/q/27121717
tags question: http://stackoverflow.com/q/27001231
tag name: calendar
tags question: http://stackoverflow.com/q/27115420
tags question: http://stackoverflow.com/q/27001959
tags question: http://stackoverflow.com/q/27083821
tags question: http://stackoverflow.com/q/27107535
tags question: http://stackoverflow.com/q/27036702
tags question: http://stackoverflow.com/q/27103383
type: Tag

http://stackoverflow.com/q/27031986
has title: Make sure a password matches a user name using java
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/42586720
has answer: http://stackoverflow.com/a/27032130
tagged with: arrays
has answer: http://stackoverflow.com/a/27032129
favorite count: 0
has body: Hello all thanks for your time. I need to write a method which will validate a user's credentials. I have an array of strings for the usernames and an array of strings for passwords I want the user to input a username and password into a dialog box and then check whether or not that username and password match but I seem to be hitting a wall whereby even if the password and user name is valid it returns false. private static final String[] EMPLOYEE = { "Abe", "Bob", "Cud"}; // names of all employees private static final String[] EMPLOYEE_PSWD = { "aaa", "bbb", "ccc"}; // passwords for the employees in same order as names Above are the arrays as fields, below are the OptionPane declarations. userName = JOptionPane.showInputDialog(null, "Please enter a username:", "Login", QSTN); password = JOptionPane.showInputDialog(null, "Please enter a password:", "Login", QSTN); verifyUser(userName,password); (This is a snippet of a main method. The whole project is to create a Sales report program where an employee enters credentials then enters what he/she sold. If you need me to put the whole thing up let me know) This is what I have tried to use I've simply been spitting out ideas: private static void verifyUser(String userName, String password) { for(int i = 0; i&lt;EMPLOYEE.length; i++) { HashMap&lt;String,String&gt; login = new HashMap&lt;String, String&gt;(); login.put(EMPLOYEE[i],EMPLOYEE_PSWD[i]); if(!login.get(userName).equals(EMPLOYEE_PSWD[i])) { JOptionPane.showMessageDialog(null, "Invalid password or username", "Error", INFO); System.exit(0); } } } If you guys need anything else just let me know! Thanks!
answer count: 3
accepted answer: http://stackoverflow.com/a/27032130
possible better answer: http://stackoverflow.com/a/27032081
has answer: http://stackoverflow.com/a/27032081
downvote count: 1
tagged with: passwords
type: AnsweredQuestion
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/42586194
score: -1

http://stackoverflow.com/q/27139820
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/9478222
has comment: http://stackoverflow.com/comment/43259165
tagged with: jaxb
type: Question
upvote count: 1
answer count: 1
has body: I know there are similar questions around such as How to marshal/unmarshal a Map&lt;Integer, List&lt;Integer&gt;&gt;? and JAXB java.util.Map binding. Also I read Blaise Doughan's blog a lot especially this post: http://blog.bdoughan.com/2013/03/jaxb-and-javautilmap.html and tried to follow what he suggested as much as I can, however I still cannot unmarshal the json payload successfully and really appreciate your help. The json payload to unmarshal looks like this: { "uri":"\\foo\\dosomthing", "action":"POST", "queryParameters":[ "$filter=aaa", "$orderby=bbb" ], "requestData":{ "data1":{ "key1":"value1", "key2":"value2" }, "ids":[ "1234", "0294" ] } } And I am having problem to unmarshal the "data" into the java.util.Map. The "data" field does not have specific schema so it can contains an array, key-value pairs or any other valid json data. I decided to use a Map to wrap it. Based on what I researched, I think I need XmlAdapter to convert the data properly. Here are my code: The Java Schema Class: import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.eclipse.persistence.oxm.annotations.XmlPath; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class CustomerRequest { public CustomerRequest() {} public CustomerRequest(String uri, String action, List&lt;String&gt; queryParameters, Map&lt;String, Object&gt; reqeustData) { this.uri = uri; this.action = action; this.queryParameters = queryParameters; this.requestData = reqeustData; } public String getUri() { return uri; } public String getAction() { return action; } public List&lt;String&gt; getQueryParameters() { return Col…
has answer: http://stackoverflow.com/a/27248642
favorite count: 0
has title: How to unmarshal json to java.util.Map<String, Object> with MOXy?
tagged with: moxy
linked to: http://stackoverflow.com/q/21684854
linked to: http://stackoverflow.com/q/67648941
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/a/27040515
upvote count: 2
has body: The answer was under my eyes the whole time and I was too blind to see it: Listeners. Updated grammar with locals definitions so that scala objects can be stored: grammar ToyLang2; @lexer::header{ package toylang.parser.antlr; } @parser::header{ package toylang.parser.antlr; import toylang.ast.*; // import scala ast symbols } program locals [scala.collection.immutable.List&lt;Stmt&gt; result] : sl+=defStmt sl+=defStmt* EOF ; type locals [TypeExpr result] : 'int' # IntType | 'bool' # BoolType ; defStmt locals[Stmt result] : id=ident ':' t=type d=def? ';' ; def locals [Expr result] : op=DEFINE e=expr ; expr locals[Expr result] : e=boolNum #BoolNumExpr | e=intNum #IntNumxpr | e=ident #IdentExpr | op='(' e=expr ')' #ParenExpr | IF c=expr THEN t=expr ei+=elsif* ELSE e=expr #IteExpr | op=(ADD|SUB) e=expr #UnopArithExpr |&lt;assoc=right&gt; l=expr op=CARRET r=expr #PowerExpr |&lt;assoc=left&gt; l=expr op=(STAR|SLASH) r=expr #MulDivExpr |&lt;assoc=left&gt; l=expr op=(ADD|SUB) r=expr #AddSubExpr | l=expr op=(NEQ|EQ|LT|LE|GT|GE) r=expr #RelExpr | op=NOT e=expr #NotExpr |&lt;assoc=left&gt; l=expr op=AND r=expr #AndExpr |&lt;assoc=left&gt; l=expr op=OR r=expr #OrExpr |&lt;assoc=left&gt; l=expr op=IMPLIES r=expr #ImpliesExpr ; elsif locals [Elsif result] : op=ELSIF c=expr THEN t=expr ; ident locals [Ident result] : id=IDENT ; intNum locals [IntNum result] : num=INT_NUM ; boolNum locals [BoolNum result] : num=(TRUE | FALSE) ; LT: '&lt;' ; LE: '&lt;=' ; GT: '&gt;' ; GE: '&gt;=' ; EQ: '=' ; NEQ: '!=' ; ADD: '+'; AND: 'and'; DEFINE: ':='; CARRET: '^'; ELSE: 'else'; ELSIF: 'elsif'; FALSE: 'false'; IF: 'if'; IMPLIES: 'implies'; KW_BOOL: 'bool'; KW_INT: 'int'; NOT: 'not'; OR: 'or'; SLASH: '*'; STAR: '*'; SUB: '-'; THEN: 'then'; TRUE: 'true'; INT_NUM :'0' |[1-9][0-9]* ; IDENT:[_a-zA-Z][_a-zA-Z0-9]* ; WS: [ \t\f\r\n]+ -&gt; skip; //NL: '\r'? \n; And a single Scala listener: package toylang.parser.antlr import toylang.ast._ import scala.collection.JavaConversions._ class Listener extends …
answers question: http://stackoverflow.com/q/27023457
type: Answer
downvote count: 0
score: 2

http://stackoverflow.com/q/27128721
answer count: 1
downvote count: 0
favorite count: 0
tagged with: confluence-rest-api
type: AnsweredQuestion
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27226400
tagged with: confluence
type: Question
has body: I'm using Atlassian Confluence REST API. I need to get Space permissions. I couldn't find any info on it in the documentation. Does anyone know how to get these permissions?
has answer: http://stackoverflow.com/a/27226400
has title: How to get Atlassian Confluence Space permissions by REST API?
upvote count: 3

foursquare
tags question: http://stackoverflow.com/q/27020230
type: Tag
tag name: foursquare

http://stackoverflow.com/comment/42553989
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27013765
type: AnswerComment
has text: @chiranjeevi in the first case, the init order is : member variables of A (A.d), constructor of A, member variables of B (B.d), constructor of B. In the second case : member variables of A (A.d), constructor of A. Therefore, in the second case A.d is already initialized when the constructor is called.

http://stackoverflow.com/q/27054182
tagged with: java
tagged with: thread-safety
tagged with: concurrency
type: Question
has answer: http://stackoverflow.com/a/27057680
answer count: 2
has comment: http://stackoverflow.com/comment/42709326
has body: I'm writing a lift controller and I currently have it working with two threads: one for the lift object and one for the person object. They both call a lift controller class that correctly orders their actions using wait/notify. I want to get it to work with multiple person threads and one lift thread. So I when a second person thread requests the lift, it should wait until the current person thread has reached a pausable point. The problem is that the notify() method does not specify which thread is notified.. How do I overcome this so that notify only notifies the person thread that I am currently interleaving with the lift thread instead of notifying some random person thread that is in queue? Thanks
score: 0
type: UnansweredQuestion
tagged with: multithreading
has title: How to get threads to run one at a time?
has answer: http://stackoverflow.com/a/27054367

http://stackoverflow.com/comment/42838543
score: 0
type: QuestionComment
type: Comment
has text: @SaurabhMeshram Can you control that the compiler output will not overwrite some really important system files? You can't, the root can do anything. In worst case your system won't boot or - even worse - will destroy some really important data because the compiler output has overwritten some files. Having a seperate user to compile source code with and going into root shell for make install after compilation brings a good barrier of protection to your system.
comment on: http://stackoverflow.com/q/27121397

http://stackoverflow.com/a/27118643
type: Answer
has body: Set your adapter in onPostExecute of your Asynctask
score: 0
answers question: http://stackoverflow.com/q/27118603

http://stackoverflow.com/comment/42666361
has text: In order to really help, I think you should explain how your answer actually works.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27078045

http://stackoverflow.com/a/27023948
answers question: http://stackoverflow.com/q/27023140
type: Answer
has comment: http://stackoverflow.com/comment/42572025
has body: Your first block of while (m&gt;0) never exits because your two conditionals that decrement m are never met. while (m&gt;0) { System.out.println(m); //Debugging statement to show that value of m never changes if( (arrayInUse[first]!=arrayInUse[first+k]) &amp;&amp;(arrayInUse[last]!=arrayInUse[last-k])) continue; if (arrayInUse[first]==arrayInUse[first+k]) m=m-1; if(m&lt;0) continue; first=first+k; if ((arrayInUse[last])==(arrayInUse[last-k])) m=m-2; if(m&lt;0) continue; last=last-k; k=k+1; }
has comment: http://stackoverflow.com/comment/42572139
score: 0

http://stackoverflow.com/q/27125483
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/27125606
accepted answer: http://stackoverflow.com/a/27125606
type: AnsweredQuestion
tagged with: netbeans
has title: Search requires entire field contents, but I want to search by only a few letters
tagged with: java
has body: I am using Sqlite, and this is the code I have written for my database and a picture of my program running showing the dilemma. I have to input the full text of table field to get search result. BUT I want to enter only a few letters to bring up results. private void txt_SearchKeyReleased(java.awt.event.KeyEvent evt) { // TODO add your handling code here: try { String sql ="select * from GameList1 where Name =?"; pst=conn.prepareStatement(sql); pst.setString(1, txt_Search.getText()); rs=pst.executeQuery(); if(rs.next()) { String add1=rs.getString("GameID"); txt_GameID.setText(add1); String add2=rs.getString("Name"); txt_Name.setText(add2); String add3=rs.getString("Company"); txt_Company.setText(add3); String add4=rs.getString("Format"); txt_Format.setText(add4); String add5=rs.getString("YearMade"); txt_Year.setText(add5); String add6=rs.getString("YearReleased"); txt_Release.setText(add6); } } }
type: Question
linked to: http://stackoverflow.com/q/2333285
tagged with: database
tagged with: search
score: 0

http://stackoverflow.com/a/27065880
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27065814
downvote count: 0
type: Answer
has body: You are not calling Average constructor where you calculate the average. You are calling static method instead without calculating the average and hence you get divide by zero exception.

http://stackoverflow.com/a/27075677
answers question: http://stackoverflow.com/q/27075525
type: Answer
has body: You have to use the POI jar. If you have already added it in your code, make sure that jar is in your classpath. If you are using windows then you can call "set" command in your command prompt and check the value of your classpath.
score: 0

http://stackoverflow.com/q/27107595
favorite count: 0
has title: java 8 lambda myMap.stream().count() != myMap.size() after merging myMap
has comment: http://stackoverflow.com/comment/42718977
has comment: http://stackoverflow.com/comment/42719461
tagged with: dictionary
has comment: http://stackoverflow.com/comment/46675728
tagged with: lambda
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42718518
has body: EDIT: I found this beeing a bug of eclipse link: https://bugs.eclipse.org/bugs/show_bug.cgi?id=433075 ORIGINAL QUESTION: In a JUnit test I found unexpected behaviour. As you can see the last assertion fails, because the stream seems to contain no data, while the map is not empty?! I found out, that it has something to do with jpa/eclipselink. public class MyTest { private EntityManager em; @Before public void setUp() throws IOException { String dbFileName = "testDb.db"; Map<String, Object> properties = new HashMap<String, Object>(); properties.put(PersistenceUnitProperties.JDBC_URL, "jdbc:sqlite:" + dbFileName); EntityManagerFactory factory = Persistence.createEntityManagerFactory("pul", properties); this.em = factory.createEntityManager(); } @Test public void testStrange() { LV lv = new LV(); // em.persist(lv); // this would work // em.merge(lv); // this would work as well lv = em.merge(lv); // this leads to the assertionError lv.getAms().add(new AM()); assertEquals(1, lv.getAms().size()); // ok assertEquals(1, lv.getAms().stream().count()); // java.lang.AssertionError: expected:<1> but was:<0> } } LV: @Entity public class LV { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long _id; @OneToMany(mappedBy = "lv", cascade = CascadeType.ALL) private Collection<AM> ams = new HashSet<AM>(); public LV() { } public Collection<AM> getAms() { return ams; } } AM: @Entity public class AM { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long _id; @ManyToOne private LV lv; public AM() { } } persistence.xml <?xml version="1.0" encoding="UTF-8" ?> org.eclipse.persistence.jpa.PersistenceProvider <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="javax.persistence.jdbc.driver" value="org.sqlite.JDBC" /> <!-- <property name="javax.persistence.jdbc.url" value="jdbc:sqlite:sample.db" /> --> <property name="javax.persistence.jdbc.user" value="" /> <property name="javax.persistence.jdbc.password" value="" /> <property name="eclipselink.dd…
tagged with: java-stream
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27125717
has comment: http://stackoverflow.com/comment/42719918
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42718563
accepted answer: http://stackoverflow.com/a/27125717
has comment: http://stackoverflow.com/comment/42718717
has comment: http://stackoverflow.com/comment/42719157
tagged with: eclipselink
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/42562781
type: Comment
comment on: http://stackoverflow.com/a/27018834
score: 0
has text: And that will refresh the page content, when I use my code to reorganise and bring to front activities from within the stack? Or do I need to add something in place of your comment?
type: AnswerComment

http://stackoverflow.com/comment/42596935
type: Comment
comment on: http://stackoverflow.com/a/27036926
has text: for `You should `(also consider) `using a JTable` with one column without/without `JTableHeader` with `RowFilter`
score: 0
type: AnswerComment

http://stackoverflow.com/a/27128503
score: 1
upvote count: 1
type: AcceptedAnswer
has body: This is due to Security issue from Java. To resolve it. Download JCE files from the oracle site here Extract the files to {YOUR_JDK_PATH}/jdk1.7.0_51/jre/lib/security
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27018331
answers question: http://stackoverflow.com/q/27018331

http://stackoverflow.com/a/27087774
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42683431
has comment: http://stackoverflow.com/comment/42683542
has comment: http://stackoverflow.com/comment/42683574
accepted answer of: http://stackoverflow.com/q/27087728
has comment: http://stackoverflow.com/comment/42683413
answers question: http://stackoverflow.com/q/27087728
has comment: http://stackoverflow.com/comment/42697208
score: 0
has body: You keep re-binding num to a new list object, one with just the current h and b values: for h in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": for b in range(1, int(size) + 1): num = [h, b] In the end, if you entered 10 for the size, you get num = ['Z', 10]. No coordinate the user is entering is going to be part of that list. You need to set num to an empty list and append new coordinates, where you have concatenated the h and b values into a new string first: num = [] for h in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": for b in range(1, int(size) + 1): num.append(h + str(b)) You could use more compact Python code to produce the same results; using a list comprehension and string formatting: num = ['{}{}'.format(h, b + 1) for h in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" for b in range(int(size))] You probably want to limit the height as well as the breadth of the map, so you'll need to limit the number of letters used; you could slice those by the size: num = [] size = int(size) for h in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[:size]: for b in range(1, size + 1): num.append(h + str(b)) Do note that size should always be entered as a number only!
has comment: http://stackoverflow.com/comment/42688296

http://stackoverflow.com/q/27098712
type: Question
tagged with: java
tagged with: grails
tagged with: office365
accepted answer: http://stackoverflow.com/a/27131578
has title: Microsoft office 365 Mail REST API in JAVA
answer count: 1
has body: Hi I'm using a Mail REST API for Office 365 I need to get a all messages more than 1 accounts. I tried to use 'getMessages' API. But it prompts a login screen. I want to get logged in via program code so that a client should not login manually. Is there any java API or sdk I can use? Can anyone provide an example?
score: 0
tagged with: rest
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27131578

http://stackoverflow.com/q/27140494
answer count: 1
accepted answer: http://stackoverflow.com/a/27141646
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42800005
type: AnsweredQuestion
has title: ClassCastException adding header to list view (ListFragment onCreateView)
tagged with: fragment
type: Question
has answer: http://stackoverflow.com/a/27141646
has comment: http://stackoverflow.com/comment/42779231
tagged with: java
has body: I have a listview with a custom adapter, it renders and works fine. The moment I try to add a header to the listview the app crashes. My header is a seperate layout xml file it has a relative layout with two spinners one on the left and one on the right. I inflate the view, manipulate the spinners to add data, add it to the list view and the app no longer works when the view is created it crashes. Java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams. I am using a Fragment that extends list fragment and the xml layout just has a list in it. The code used to add the header is in the onCreateView call, View view = inflater.inflate(R.layout.listview_layout, container, false); View header = (View)inflater.inflate(R.layout.header_layout, container, false); Spinner spinner1 = (Spinner)header.findViewById( R.id.spinner1 ); //add pre-defined per page information ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource( getActivity(), R.array.header_layout_spinner1, android.R.layout.simple_spinner_item ); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter( adapter ); Integer values[] = new Integer[100]; for(int i=1;i&lt;=100;i++) { pages[i-1] = i; } Spinner spinner2 = (Spinner)header.findViewById(R.id.spinner2); ArrayAdapter&lt;Integer&gt; adapter2 = new ArrayAdapter&lt;Integer&gt;(getActivity(), android.R.layout.simple_spinner_item, values); spinner2.setAdapter(adapter2); //include header in the view ((ListView)view.findViewById(R.id.list)).addHeaderView(header);

http://stackoverflow.com/comment/42626613
type: QuestionComment
comment on: http://stackoverflow.com/q/27055069
score: 0
has text: Your program intent is correct. The way you are trying to give multiline input is wrong. Try reading from a file, by writing: `Scanner scanner = new Scanner(Paths.get(<file path in string here>));`. Also use `StringBuilder` for appending lines in `b`, since `String` is immutable, so it'll incur performance hits if you do a `+=` to it.
type: Comment

http://stackoverflow.com/comment/42658828
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27073397
has text: Good catch on `revalidate()` the panel. +1

http://stackoverflow.com/comment/70272510
has text: .dylib instead of .so in Mac
type: AnswerComment
comment on: http://stackoverflow.com/a/27016542
score: 0
type: Comment

http://stackoverflow.com/q/27118916
has body: I am trying to connect to google trends and parse their response. I have code like this. String urlstr = "http://www.google.com/trends/fetchComponent?q=seattle&amp;cid=TIMESERIES_GRAPH_0&amp;export=3"; URL url; String responsestr = null; try { url = new URL(urlstr); //Reader reader = new InputStreamReader(url.openStream(),"UTF-8"); URLConnection connection = url.openConnection(); connection.setRequestProperty("Accept-Charset", "UTF-8"); InputStream response = connection.getInputStream(); Reader reader = new InputStreamReader(response); }catch(Exception e){} You can check that the URL is correct by simply copy pasting the url into a browser, however, although my code goes through and connects with google, it returns an error on the side of google saying that it can't process my request. I am doing something wrong in the encoding or the URL or how I am setting up my URLConnection. Any help would be appreciated!
has comment: http://stackoverflow.com/comment/42739817
tagged with: encoding
has comment: http://stackoverflow.com/comment/42740059
has answer: http://stackoverflow.com/a/27119113
has title: Encoding + URLConnection in Java
upvote count: 1
answer count: 1
tagged with: google-trends
tagged with: urlconnection
favorite count: 0
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42740046
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/27117379
has title: Java: Count Inversions Algorithm logic went wrong
has comment: http://stackoverflow.com/comment/42737584
has body: I am trying to write the Count inversion algorithm. It works on an array of size 10. However, things went terribly wrong, when I tried to test on an array of size 100000. I was still able to sort the array but the number of inversions is NEGATIVE, which is wrong. I don't understand which part of my logic went wrong. My main logic: I created an array object called myArray and it has a CountSplitInv instance method that is suppose to sort the sub-arrays and return number of inversions involved. Please help me out. I have been stuck in this for a long time now and I still wasn't able to figure out what went wrong. I have a feeling that I don't understand Recursion concept fully. import java.io.*; import java.util.*; import java.math.*; class myArray{ private int[] input_array; private int nElems; public myArray(int max){ input_array = new int[max]; nElems = 0; } public void insert(int value){ input_array[nElems++] = value; } public void display(){ for(int j = 0; j &lt; nElems; j++){ System.out.print(input_array[j] + " "); } System.out.println(""); } public void SortAndCount(){ int[] output_array = new int[nElems]; int ans = SortNInversionCounts(output_array,0, nElems -1); System.out.println("number of inversions IS: " + ans); } public int SortNInversionCounts(int[] output_array, int lowerBound, int upperBound){ if(lowerBound == upperBound){ return 0; } else{ int mid = (lowerBound + upperBound)/2; int x, y , z; x = SortNInversionCounts(output_array, lowerBound, mid); y = SortNInversionCounts(output_array, mid+1, upperBound); z = CountSplitInv(output_array, lowerBound, mid+1, upperBound); return x + y + z; } } public int CountSplitInv(int[] output_array, int lowPtr, int highPtr, int upperBound){ int j = 0; int lowerBound = lowPtr; int mid = highPtr - 1; int n = upperBound - lowerBound + 1; int numOfInversions = 0; while(lowPtr &lt;= mid &amp;&amp; highPtr &lt;= upperBound){ if( input_array[lowPtr] &lt; input_array[highPtr]){ output_array[j++] = input_array[lowPtr++]; } e…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42738277
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/42737320
type: Question
has comment: http://stackoverflow.com/comment/42737176
has comment: http://stackoverflow.com/comment/42737440
has comment: http://stackoverflow.com/comment/42737439
score: 0

http://stackoverflow.com/comment/42606234
has text: Thanks Nadir. As I have excluded "spring-boot-starter-logging", nothing is getting printed on my console.
comment on: http://stackoverflow.com/a/27041944
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42538351
has text: Define "cannot run." Do you mean it won't compile, it throws an Exception when you try to run it, or it runs but gives incorrect output?
comment on: http://stackoverflow.com/q/27004411
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27011990
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27010799
answers question: http://stackoverflow.com/q/27010799
type: Answer
score: 1
upvote count: 1
has body: Sounds like plugin A is a cache. Plugin A should be designed in the way that a classLoader can be passed in during the initialization (or during each request). If it is not designed in this way, it is not really OSGi friendly and it should not be used in OSGi environment. E.g.: EHCache, Infinispan and other cache engines allow you to pass a Classloader instance during the initialization of the cache.
has comment: http://stackoverflow.com/comment/42639691

http://stackoverflow.com/q/27071406
has body: Trying to install Java Opengl and keep getting this error Exception in thread "main" java.lang.InstantiationError: com.jogamp.common.util.locks.RecursiveLock at javax.media.opengl.awt.GLCanvas.&lt;init&gt;(GLCanvas.java:491) at javax.media.opengl.awt.GLCanvas.&lt;init&gt;(GLCanvas.java:178) at javax.media.opengl.awt.GLCanvas.&lt;init&gt;(GLCanvas.java:169) at Simple.&lt;init&gt;(Simple.java:43) at Simple.main(Simple.java:20) what does this mean and what can I do to fix it ? I'm using Ubuntu 64 bit 14.04 with intel i5processor IDE:Eclipse ;
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27081479
tagged with: ubuntu
tagged with: eclipse
has title: Java OpenGL install in ubuntu Linux?
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27081878
tagged with: linux
tagged with: jogl
has answer: http://stackoverflow.com/a/27081479
has answer: http://stackoverflow.com/a/27081878

http://stackoverflow.com/comment/42702230
score: 0
type: AnswerComment
type: Comment
has text: All data access is done through the incrementCnt() function so I will go with your suggestion. Thank you for your help
comment on: http://stackoverflow.com/a/27094698

http://stackoverflow.com/comment/42568193
score: 0
has text: Is there a reason you don't want to build using the current release?
comment on: http://stackoverflow.com/q/27021531
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27050989
type: UnansweredQuestion
score: 2
has title: Pre-populating Entities into database for testing purposes
downvote count: 0
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: derby
has body: I'm developing a Java EE 7 application. For testing purposes, it'd be very beneficial to populate the database with some content. This tutorial explains how you can create the database content at or before run time using an SQL file. I'm assuming, within this SQL file, I could do something like this: INSERT INTO ENTITYNAME(ENTITYATTRIBUTE1, ENTITYATTRIBUTE2, ... ENTITYATTRIBUTEN) value ("entityAttribute1", "entityAttribute2, ... "entityAttributeN") If my approach is correct, how would I provide the value of an @ElementCollection, @OneToMany, or just Entity attribute?
tagged with: jpql
upvote count: 2
tagged with: sql
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27052254

http://stackoverflow.com/comment/42737515
score: 0
type: QuestionComment
type: Comment
has text: thanks for reply Federico, i think that link is the correct answer, cause in the other forums suggesting that too. Have added that snippet before, but still not working for me :(
comment on: http://stackoverflow.com/q/27103847

http://stackoverflow.com/q/27103465
has comment: http://stackoverflow.com/comment/43277666
tagged with: jboss-4.2.x
favorite count: 0
tagged with: jcifs
tagged with: ntlmv2
answer count: 1
has answer: http://stackoverflow.com/a/31610315
has body: We are trying to port our jboss j2ee application from ntlm-auth to ntlmv2-auth. AppServer: JBoss v. 4.5.2, java6, jcifs 1.3.17, ntlmv2-auth 1.0.4 AD-server: Windows Server 2003 - with a computer account in the AD created acc. to specifications from Liferay. NTLMv2 is off course enabled on the server; 'Send NTLMv2 response only\refuse LM and NTLM' Authentication fails with a NtlmLogonException: Session key negotiation failed From the AD-servers Event viewer logon/logoff traces off the computer account can be seen. Stacktrace: ERROR org.ntlmv2.filter.NtlmFilter - NTLM authentication failed: org.ntlmv2.liferay.NtlmLogonException: Session key negotiation failed org.ntlmv2.liferay.NtlmLogonException: Session key negotiation failed at org.ntlmv2.liferay.NetlogonConnection.connect(NetlogonConnection.java:172) at org.ntlmv2.liferay.Netlogon.logon(Netlogon.java:50) at org.ntlmv2.liferay.NtlmManager.authenticate(NtlmManager.java:66) at org.ntlmv2.filter.NtlmFilter.doFilter(NtlmFilter.java:236) Could anyone please enlighten me on this one? Any help would be appreciated. Thank you.
has title: ntlmv2-auth fails in Session key negotiation
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
tagged with: liferay
downvote count: 0

http://stackoverflow.com/comment/42741449
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27120135
has text: Make you buttons (and any other component) non-focusable (`setFocusable(false)`)
score: 0

http://stackoverflow.com/q/27140786
has comment: http://stackoverflow.com/comment/42779097
tagged with: applet
has comment: http://stackoverflow.com/comment/42779367
possible better answer: http://stackoverflow.com/a/27140848
has answer: http://stackoverflow.com/a/27140848
type: Question
tagged with: japplet
has title: How would I reduce the repetitiveness of this method?
has answer: http://stackoverflow.com/a/27140862
has comment: http://stackoverflow.com/comment/42779098
score: 0
accepted answer: http://stackoverflow.com/a/27140862
answer count: 2
has comment: http://stackoverflow.com/comment/42779073
tagged with: java
has body: Here is the code I am working on(Its part of the CalculatorTester Class which is an extension of the Calculator Class): if (choice == 1) //Addition { System.out.println("Math Operation: Addition."); System.out.println("Enter First Number."); int a = in.nextInt(); System.out.println("Enter Second Number."); int b = in.nextInt(); int endValue = c1.addition(a, b); System.out.println("The Sum is: " + endValue + "."); } else if (choice == 2) { ...More Code Here... }//end of if() The addition method inside the Calculator object: public int addition(int a, int b) { endValue = a + b; return endValue; }//end of method addition() How would I reduce the Repetitiveness of the if Statements, as I have 5 in total due to the amount of different operations one can choose from? Thanks!
type: AnsweredQuestion

http://stackoverflow.com/comment/42565788
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27016778
has text: What happens if you move the `EntityTransaction` before your `teamById` calls? Also @dpawel is correct that modifying anything with a `mappedBy` attribute will not get picked up by hibernate.
score: 0

http://stackoverflow.com/q/27077199
tagged with: java
has answer: http://stackoverflow.com/a/27077528
possible better answer: http://stackoverflow.com/a/27077363
has body: Basically, the user enters student grades and the program will display and arrange them into sections (0-29 marks, 30-39 marks, 40-69 marks and 70-100 marks). If the user enters anything higher than 100 then the program terminates and outputs the results. I'm just having trouble printing out the output vertically. public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Type in the students marks. Type above 100 to show output."); int marks; int starsfrom0to29 = 0; int starsfrom30to39 = 0; int starsfrom40to69 = 0; int starsfrom70to100 = 0; int counter = 0; marks = input.nextInt(); while (marks &lt; 100) { //PUTTING MARKS INTO CATEGOERY if ((marks &gt;= 0) &amp;&amp; (marks &lt;= 29)) { starsfrom0to29++; } if ((marks &gt;= 30) &amp;&amp; (marks &lt;= 39)) { starsfrom30to39++; } if ((marks &gt;= 40) &amp;&amp; (marks &lt;= 69)) { starsfrom40to69++; } if ((marks &gt;= 70) &amp;&amp; (marks &lt;= 100)) { starsfrom70to100++; } if (marks &lt; 100) { counter++; } marks = input.nextInt(); } //PRINTING OUT NUMBER OF STARS System.out.println(); System.out.print("0-29 "); for (int x = 0; x &lt; starsfrom0to29; x++) { System.out.print("*"); } System.out.println(); System.out.print("30-39 "); for (int x = 0; x &lt; starsfrom30to39; x++) { System.out.print("*"); } System.out.println(); System.out.print("40-69 "); for (int x = 0; x &lt; starsfrom40to69; x++) { System.out.print("*"); } System.out.println(); System.out.print("70-100 "); for (int x = 0; x &lt; starsfrom70to100; x++) { System.out.print("*"); } System.out.println(); System.out.println(); } This prints it out horizontally. E.g: If I typed in the numbers: 23,65,77,87,101 it would display: 0-29 * 30-39 40-69 * 70-100 ** However, I need to find out how to print the output vertically. Basically the stars (asterisks) should be in a vertical line and are below the headlines.
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42665117
has answer: http://stackoverflow.com/a/27077536
accepted answer: http://stackoverflow.com/a/27077485
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42664998
has comment: http://stackoverflow.com/comment/42665191
has title: How to print out the output vertically
answer count: 4
has answer: http://stackoverflow.com/a/27077363
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27077485
upvote count: 3

http://stackoverflow.com/a/27045227
upvote count: 1
has body: It's a bit difficult without the code for JCanvas and JEventQueue, but normally I would use a key listener for a panel that contains the canvas: //frame.add(canvas); final JPanel panel = new JPanel(); panel.add(canvas); frame.getContentPane().add(panel); panel.addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent keyEvent) { System.out.println("keyEvent.getKeyCode(): " + keyEvent.getKeyCode()); } });
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27043582
type: Answer
answers question: http://stackoverflow.com/q/27043582

http://stackoverflow.com/q/27006345
score: 2
upvote count: 2
tagged with: java
tagged with: jboss
has answer: http://stackoverflow.com/a/27354286
tagged with: eclipse
type: Question
has body: I am developing an app in java crawler with jboss. I made the following code: connectionFactoryLookupAddress = new String("jms/RemoteConnectionFactory"); destinationLookupAddress = new String("jms/topic/mC"); environment = new Properties(); environment.put(Context.SECURITY_PRINCIPAL, "isuser"); environment.put(Context.SECURITY_CREDENTIALS, "is"); environment.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory"); environment.put(Context.PROVIDER_URL, "remote://localhost:4447"); InitialContext iCtx = new InitialContext(environment); And I get the following exception javax.naming.NoInitialContextException: Cannot instantiate class: org.jboss.naming.remote.client.InitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory] (...) Caused by: java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory (...) Already added the jboss-client.jar, and nothing ... Have to configure the jboss server to hit this project or add a user on the server? I am using eclipse. I've read some thread on this topic but I was unclear as jboss settings I need to run this code. Some help?
has title: exception in InitialContext jboss
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42553995
score: 0
type: AnswerComment
has text: @user3272072 Sorry.. I see you have written it twice so got confused... reading...
type: Comment
comment on: http://stackoverflow.com/a/27013236

http://stackoverflow.com/q/27131138
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27131348
has body: I am writing a GUI based project using java and SQLite. I created a Table in my SQLite database and using it in my project. there are several column where I made RoomNo as a primary key and gave a default value 111. The problem is when I try to edit or update data from what you say from jTable and save it to my database it show exception , java.sql.SQLException:PRYMARY KEY must be unique. I can't find the reason why it shows up. May be the problem is in my code. Here is the code f update method. Please try to help me out to sort out this problem. private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try{ String value1 = roomNumbertf.getText(); String value2 = detailtf.getText(); String value3 = statustf.getText(); String value4 = billPerDaytf.getText(); String value5 = clientNametf.getText(); String value6 = clientAddresstf.getText(); String value7 = clientMobileNotf.getText(); String value8 = entryDatetf.getText(); String value9 = leavingDatetf.getText(); String sql = "update RoomStatusTable2 set RoomNo='"+value1+"', Details= '"+value2+"', Status='"+value3+"', BillPerDay='"+value4+"',ClientName='"+value5+"', ClientAddress='"+value6+"', ContactNo='"+value7+"', EntryDate='"+value8+"', LeavingDate='"+value9+"'"; pstatement = connection.prepareStatement(sql); pstatement.execute(); JOptionPane.showMessageDialog(null, "Information Updated"); updateTable(); }catch(Exception e){ JOptionPane.showMessageDialog(null, e); } } // this my SQLite table crate statement CREATE TABLE "RoomStatusTable2" ("RoomNo" INTEGER PRIMARY KEY DEFAULT (111) ,"Details" CHAR,"Status" CHAR,"BillPerDay" CHAR,"AdvancedBooking" CHAR,"ClientName" CHAR,"ClientAddress" CHAR,"ContactNo" CHAR,"EntryDate" CHAR,"LeavingDate" CHAR) If further information or code is needed to understand where the problem is please comment me.
has comment: http://stackoverflow.com/comment/42761291
type: Question
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/27131348
possible better answer: http://stackoverflow.com/a/27131329
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27131329
has comment: http://stackoverflow.com/comment/42761419
has title: PRYMARY KEY must be unique exception while calling update mehtod
tagged with: java

http://stackoverflow.com/q/27106063
type: Question
answer count: 2
has body: I need to create an array of 10^15 positions, based on the amount of positions, I thought it would be necessary to create a long array, however, the index of the array needs to be Int, I tried with BigInteger but it needed to convert the BigInteger into an Int and when doing so, it changed to a negative number, so the array could not be created. Here's the code: BigInteger num = new BigInteger("1000000000000000"); long[] array = new long[num.intValue()]; if I print num.intValue() it shows that the number is -1530494976
tagged with: arrays
has comment: http://stackoverflow.com/comment/42715761
has comment: http://stackoverflow.com/comment/42717411
has answer: http://stackoverflow.com/a/27106238
has comment: http://stackoverflow.com/comment/42716069
score: 0
has comment: http://stackoverflow.com/comment/42715531
has comment: http://stackoverflow.com/comment/42715452
has title: How to can I create an array of 10^15 positions?
has answer: http://stackoverflow.com/a/27106392
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42716033
has comment: http://stackoverflow.com/comment/42715552
has comment: http://stackoverflow.com/comment/42715447
tagged with: biginteger
tagged with: java
has comment: http://stackoverflow.com/comment/42715664

http://stackoverflow.com/a/27137179
answers question: http://stackoverflow.com/q/27130866
has body: I already discover my mistake. The problem was that i didn't know that i must deploy an EAR with the WAr end EJB.
score: 0
type: Answer

http://stackoverflow.com/comment/42783004
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27126376
has text: @GabrielAramburu : No, sayHello() does not throw any exception. On further digging, I found that the exception occurs for sayHi() only, not for any other method. Cannot understand such weird behavior, i.e. invocation fails only a specific method.

http://stackoverflow.com/q/27007421
has answer: http://stackoverflow.com/a/27007576
answer count: 3
has answer: http://stackoverflow.com/a/27007562
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42543788
has comment: http://stackoverflow.com/comment/42543566
has comment: http://stackoverflow.com/comment/42543556
has comment: http://stackoverflow.com/comment/42543720
has title: How do I display a string from an array from user input?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27007666
has comment: http://stackoverflow.com/comment/42543661
type: Question
has body: I have an array of 8 strings (Carter","Cocke","Washington","Greene","Hawkins","Johnson","Sullivan","Unicoi") all referenced by "county" I'd prompt the user to input a number of 1-8 (iVal), 1 being Carter, 2 being Cocke, etc... Is there a way I could do this other than using a switch statement? Also, how would I go about this if the user were to input Washington I'd display "Washington is in the array" and the opposite if the string isn't in the array? Thanks in advance. Here is my array. String [] county = {"Carter","Cocke","Washington","Greene","Hawkins","Johnson","Sullivan","Unicoi"}; for (int i = 0; i&lt; county.length; i++) { System.out.print (county [i]+ "\n"); }
downvote count: 0

http://stackoverflow.com/a/27173652
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27151125
has body: Spring Data Jpa Repository functionality is implemented via the SimpleJpaRepository class containing following save(..) method: @Transactional public &lt;S extends T&gt; S save(S entity) { if (entityInformation.isNew(entity)) { em.persist(entity); return entity; } else { return em.merge(entity); } } Thus the Spring Jpa Data Repository save(...) method merges an already existing entity. Opposed to that the naked EntityManager#persist() throws an exception if invoked with already existing entity. The problem might be solved by adding custom behavior to Spring Data Repository/ies. The custom behavior might be added using one of the approaches as described in 1.3.1 Adding custom behavior to single repositories with example here or in 1.3.2 Adding custom behavior to all repositories with example here. In both cases the custom behavior would include a new persist() method delegating to EntityManager#persist(). Note that in approach 1.3.2. you already have a EntityManager instance, in the approach 1.3.1 you are able to inject EntityManager instance using the @PersistenceContext. Opposed to my comment I would recommend adding new method to the repository and not overwriting the existing save(...).
upvote count: 2
has comment: http://stackoverflow.com/comment/100325422
has comment: http://stackoverflow.com/comment/100292084
downvote count: 0

http://stackoverflow.com/comment/67388490
type: Comment
type: QuestionComment
has text: @AndyFedoroff only quotes should be in quotes, reverting your changes
comment on: http://stackoverflow.com/q/27047010
score: 0

http://stackoverflow.com/comment/42524378
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26996869
has text: Do you have any `keyboard.nextInt()` calls (on any other calls that don't read a full line) prior to this loop?
type: Comment

http://stackoverflow.com/q/27076623
tagged with: openjpa-maven-plugin
tagged with: java
tagged with: openjpa
type: Question
has title: Entity enhancement on OpenJPA 2.x
score: 0
answer count: 1
has body: I am working on project with Spring and OpenJPA. I have a use case where I need to create entities of same data source in different projects/maven modules. Approach 1: I have Maven project core-entities having two modules containing set of entities with specific functionality. Module A - Enitity1, Enitity2, Enitity3 Module B – Enitity4, Enitity5, Enitity6 I have a created separate persistence units and persistence xml for each set of entities. It works fine when entities are enhanced in their respective maven modules. Approach 2: In this approach I have separate modules for entities as above but the only difference is that I am using a single persistence unit for both set of entities. I have added the openjpa-maven-plugin for enhancing entities in both the modules. In this case when entities are enhanced using maven plugin it gives exception saying no metadata found for entities in Module A at runtime. Is it because when the entities are enhanced, somehow metadata of entities in Module A is lost at runtime.This problem does not come with entities of module B. I have few questions around this issue: 1)Is it recommended to have multiple persistence units for same data source (as done in Approach 1)? 2)Is there any way by which I can enhance entities in single persistence unit and different maven modules? 3)Are the any alternate approaches of entities enhancement other than using eclipse and maven plugin? Below is the plugin in pom.xml of each module: org.codehaus.mojo openjpa-maven-plugin 1.1 **/entity/**/*.class true <enforcePropertyRestrictions>true</enforcePropertyRestrictions> ${basedir}/src/main/resources/META-INF/moduleApersistence.xml enhancer process-classes enhance org.apache.openjpa openjpa ${openjpa.version} org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> org.apache.openjpa openjpa-maven-plugin [2.2.0,) enhance org.codehaus.mojo cobertura-maven-plugin [2.5.2,) instrument </lifecycleMappingMetadata>
has answer: http://stackoverflow.com/a/27357175
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/42711700
comment on: http://stackoverflow.com/a/27102332
score: 0
type: AnswerComment
has text: Do you mean that you have compilation or runtime problem?
type: Comment

http://stackoverflow.com/comment/42782796
type: Comment
has text: Bear in mind that both these languages evolved from C which originally did not have `void`. All functions were defined to return something (`int` by default), and you could assign a variable to the result of a function that never actually returned a value, giving you garbage. On the other side, in Algol/Pascal/Ada, you write either a `procedure` (which does not return a value) or a `function` (which does). You could say that a `void` function is an attempt to add a `procedure` to C to help prevent using garbage results of functions that don't return anything.
score: 0
comment on: http://stackoverflow.com/q/27142891
type: QuestionComment

http://stackoverflow.com/q/26995358
favorite count: 0
linked to: http://stackoverflow.com/q/27015236
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26995557
downvote count: 0
tagged with: java
has body: Correct me if i'm using any wrong term (I don't know exactly what this feature is called) Is there any Option/Plugin for creating my own short code for java in Eclipse IDE Just like these short-code represent syso --&gt; System.out.println(); syse --&gt; System.error.println(); fori --&gt; for(int i=0;i&lt;args.length;i++){}
type: Question
tagged with: eclipse
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/26995557
has answer: http://stackoverflow.com/a/26995451
accepted answer: http://stackoverflow.com/a/26995451
has title: How to create a shortcode in Eclipse
tagged with: keyboard-shortcuts
tagged with: eclipse-plugin

http://stackoverflow.com/q/27035269
tagged with: android-volley
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27035737
accepted answer: http://stackoverflow.com/a/27035737
has body: How to send 2nd Request to server , after getting Response from Server ? Using Volley. I get response using, private void makeStringReq() { showProgressDialog(); // Instantiate the Request Q RequestQueue q=Volley.newRequestQueue(this); StringRequest strReq = new StringRequest(Method.GET, Const.URL_STRING_REQ, new Response.Listener&lt;String&gt;() { @Override public void onResponse(String response) { Log.d(TAG, response.toString()); msgResponse.setText(response.toString()); hideProgressDialog(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d(TAG, "Error: " + error.getMessage()); hideProgressDialog(); } }); // Add the request to the RequestQueue. q.add(strReq); } my question is , How to send request back once i got the response from server ? thanks.
score: 0
answer count: 1
has title: How to send 2nd Request to server after getting Response from Server ? Using Volley

http://stackoverflow.com/q/27126839
linked to: http://stackoverflow.com/q/10786042
type: Question
has body: What i am doing: I am trying to make a reverse geocoding in android I am getting error as:: java.lang.IllegalArgumentException: Illegal character in query at index 59: http://maps.google.com/maps/api/geocode/json?address=Agram, Bengaluru, Karnataka, India&amp;sensor=false NOte: that request gets a json response in browser but not from my class below This line is giving this error:: HttpGet httpget = new HttpGet(url); JSONfunctions.java public class JSONfunctions { public static JSONObject getJSONfromURL(String url) { InputStream is = null; String result = ""; JSONObject jArray = null; // Download JSON data from URL try { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error in http connection " + e.toString()); } // Convert response to string try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result = sb.toString(); } catch (Exception e) { Log.e("log_tag", "Error converting result " + e.toString()); } try { jArray = new JSONObject(result); } catch (JSONException e) { Log.e("log_tag", "Error parsing data " + e.toString()); } return jArray; } }
has comment: http://stackoverflow.com/comment/42753208
tagged with: google-maps
has comment: http://stackoverflow.com/comment/42753491
has answer: http://stackoverflow.com/a/46461360
answer count: 3
has answer: http://stackoverflow.com/a/27127010
downvote count: 0
has comment: http://stackoverflow.com/comment/42753170
favorite count: 0
score: 8
upvote count: 8
tagged with: android
has answer: http://stackoverflow.com/a/27127032
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27127010
has title: java.lang.IllegalArgumentException: Illegal character in query at index 59
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/27127032

izpack
tag name: izpack
tags question: http://stackoverflow.com/q/27018919
type: Tag

http://stackoverflow.com/q/27093072
tagged with: youtrack
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22849379
has body: I have followed http://confluence.jetbrains.com/display/YTD6/Linux.+YouTrack+JAR+as+a+Service on Fedora server. Starting Youtrack 6 as "youtrack" user by /etc/init.d/youtrack start command starts properly. I have added youtrack service wrapper on boot by /sbin/chkconfig --add youtrack command. But after server reboot Youtrack application is not running. journalctl -xn command gives me only this hint systemd[4000]: Failed at step EXEC spawning /etc/rc.d/init.d/youtrack: Exec format error I have fixed my permissions like in this thread '' Starting YouTrack as a service fails without error message'' But error still occurs. I have pasted default template from the tutorial '/etc/rc.d/init.d/youtrack' with only one change: #export JAVA_HOME=/usr/java/jdk1.6.0_21 export JAVA_HOME=/usr/java/latest /usr/java/latest points to Oracle JDK 8.
type: Question
score: 3
tagged with: java-service-wrapper
has title: Youtrack 6 reboot fails on Fedora and Java Service Wrapper
tagged with: java
has answer: http://stackoverflow.com/a/27094308
tagged with: fedora
answer count: 1
downvote count: 0
favorite count: 0
tagged with: linux

http://stackoverflow.com/a/27043208
score: 0
answers question: http://stackoverflow.com/q/27042937
has body: To open an application associated with the file extension you'll need to use the java.awt.Desktop class. Oracle has a tutorial with sample code. Getting the icon for an application is more difficult. Your best course of action is to include standard icons as resources in your application; that should cover most scenarios.
type: Answer

http://stackoverflow.com/a/27060987
accepted answer of: http://stackoverflow.com/q/27057953
score: 2
downvote count: 0
has body: I see two solutions here: Use RawSql to execute your SQL query. You have set of ids and you want a list of objects but calling .in() throws exception when collection is too big. So you can split set of ids to smaller sets and call .in() for every set. Then join result lists into one list.
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/27057953
type: Answer

http://stackoverflow.com/q/27093150
tagged with: java
has body: The method that I'm having issues with is popTop I have an OurProcess array that has a variable name currentPriority that I am sorting this heap from smallest to largest but popTop just sends back the first object then leaves priorities[0] == null and I can't seem to figure it out. Any help would be greatly appreciated! public class Queue { int number1 = 0; final int root = 0; // an easy reference to the root of the heap int endPoint = 0; // Endpoint is where the first blank space in in queue is int size; // an easier value to work with than the length of the array OurProcess[] priorities; // The array that the whole class is built upon char location; // This is just shorthand for the name of the object Queue(int size, char location) { this.location = location; this.size = size; priorities = new OurProcess[size]; } Queue(OurProcess[] processesArray, char location) throws Exception { this.location = location; size = processesArray.length; priorities = new OurProcess[processesArray.length]; for (int i = 0; i &lt; processesArray.length - 1; i++) { insert(processesArray[i]); } } public void insert(OurProcess toAdd) { if (endPoint == priorities.length) { System.out.println("Out of bounds"); } else { endPoint++; priorities[endPoint - 1] = toAdd; siftUp(endPoint - 1); } } public void siftUp(int nodeIndex) { int parentIndex; OurProcess tmp; if (nodeIndex &lt; priorities.length) { parentIndex = (nodeIndex - 1) / 2; while (priorities[parentIndex].currentPriority &gt; priorities[nodeIndex].currentPriority) { tmp = priorities[parentIndex]; priorities[parentIndex] = priorities[nodeIndex]; priorities[nodeIndex] = tmp; siftUp(parentIndex); } } } public OurProcess popTop() { OurProcess pop = priorities[root]; // Copy the root of our array priorities[root] = priorities[endPoint]; // Place our object at the end priorities[endPoint] = null; int index = root; int leftChild = index*2+1; int rightChild, lesserChild; while(index &lt; priorities.length &amp;&amp; priorities[index] != null)…
has title: Popping and reordering a heap array by an element of an object in java
type: Question
has answer: http://stackoverflow.com/a/27093263
answer count: 1
tagged with: arrays
score: 0
tagged with: heap
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42692285

http://stackoverflow.com/q/27152108
answer count: 3
has answer: http://stackoverflow.com/a/27155202
has comment: http://stackoverflow.com/comment/42799060
has title: Java let user create and execute algorithms
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27152192
tagged with: java
has body: I'm creating a program (executable) that allows the user to play around with graphs and execute algorithms on them. Basically the user should be able to create a new algorithm, for example a modification of Dijkstra's, and try it out on the graph. However, I'm not sure what's the best way to program this. At the moment I'm considering allowing the user to write java code and let that be saved in a separate directory. However, I don't know whether that's even possible, as you would have to compile java code live while executing the program. Is this method viable? Another way would be to create an interpreter and allow the user to write pseudocode, which would then be saved and converted to something the program would understand. However, if the previous method can be done it might be easier than this one. Is the first method possible? If so, is it better than the second? Or is there an easier way to do this?
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/42798797
tagged with: algorithm
has comment: http://stackoverflow.com/comment/42798871
has answer: http://stackoverflow.com/a/27152216
score: 0

http://stackoverflow.com/a/27093112
upvote count: 3
answers question: http://stackoverflow.com/q/27093068
has body: There are two things that help you: Generics do not distinguish between Interfaces and Classes. Generics support ampersand for listing multiple types. That said, what you probably want is this: class YourClass&lt;T extends Node &amp; Linkable&gt; { }
type: Answer
has comment: http://stackoverflow.com/comment/42692243
has comment: http://stackoverflow.com/comment/42692202
score: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27093068

http://stackoverflow.com/q/27097862
has comment: http://stackoverflow.com/comment/42700851
answer count: 1
has body: My code for converting Roman Numerals to their Decimal Form seems to be correct, but for some reason I cannot figure out how to get any sort of output. I want to say at the end "The Roman Number" + roman numeral + "is" + decimal number. How, and where would I put that? import java.util.Scanner; public class RomantoInteger { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter an Roman numeral with an equivalent between 0 and 3999:"); } public class Roman { private final char[] romanNumerals = { 'M', 'D', 'C', 'L', 'X', 'V', 'I' }; private final int[] romanEquivalent = { 1000, 500, 100, 50, 10, 5, 1 }; private final String romanNum; private int decimalNum; public Roman(String input) { romanNum = input.toUpperCase(); } //public void checkRoman(){ // for(int x=romanNum.length()-1;x&lt;romanNum.length(); x++){ // if(romanNum.charAt(x)=='M') // } //} /* * Method to convert roman number to decimal */ public int convertToDecimal() { int sum[]; //Create a integer array sum = new int[romanNum.length()]; //set the size of sum array to the length of romanNum for (int y = 0; y &lt; romanNum.length(); y++) { for (int i = 0; i &lt; romanNumerals.length; i++) { if ((romanNum.charAt(y) == romanNumerals[i]) &amp;&amp; (romanNum.length() &gt; 1)) { //and if length of romanNum is greater than 1 sum[y] = romanEquivalent[i]; //store the value of the matching romanNumeral to an indexed variable of array sum } if ((romanNum.charAt(y) == romanNumerals[i]) //if &amp;&amp; (romanNum.length() == 1)) { //and if length of romanNum is just 1 System.out.println(romanEquivalent[i]); //print out the value of the matching romanNumeral break; //terminate looping (for loop) } } } return add(sum); //call method add } public int add(int[] sum) { int lastIndex = sum.length - 1; int decimalNum = sum[lastIndex]; int count = 0; for (int i = lastIndex; count &lt; sum.length - 1; count++) { if ((sum[i - 1] &lt;= sum[i])) { decimalNum = decimalNum - sum[i -…
has comment: http://stackoverflow.com/comment/42700943
accepted answer: http://stackoverflow.com/a/27097946
favorite count: 0
has title: Not getting an output for my code
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/42700953
downvote count: 2
has comment: http://stackoverflow.com/comment/42700993
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42700890
has comment: http://stackoverflow.com/comment/42700877
tagged with: java
has answer: http://stackoverflow.com/a/27097946
has comment: http://stackoverflow.com/comment/42700995
type: Question
upvote count: 0
score: -2

http://stackoverflow.com/q/27025863
has comment: http://stackoverflow.com/comment/42575064
has title: What does someArray[--n] mean?
has answer: http://stackoverflow.com/a/27026017
has answer: http://stackoverflow.com/a/27025939
has answer: http://stackoverflow.com/a/27025966
accepted answer: http://stackoverflow.com/a/27025966
upvote count: 4
answer count: 4
has comment: http://stackoverflow.com/comment/42575229
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27026218
type: Question
has comment: http://stackoverflow.com/comment/42575111
has comment: http://stackoverflow.com/comment/42575323
has body: I tried googling this but Google doesn't handle "--n" well. I saw this in my professor's code: f[--n]; f[n++]; where f is an array of double values. My guess is that it returns the value of f[n] before reducing (or adding) to n.
tagged with: arrays
score: 4
has comment: http://stackoverflow.com/comment/42575118
has comment: http://stackoverflow.com/comment/42575016
has answer: http://stackoverflow.com/a/27026218
linked to: http://stackoverflow.com/q/1094872
favorite count: 0

http://stackoverflow.com/a/27073882
has body: psn = phrase.indexOf(goal.toLowerCase(), psn + 1); will never rich to (psn &lt; 0) thats the problem
type: Answer
answers question: http://stackoverflow.com/q/27073852
score: 0
has comment: http://stackoverflow.com/comment/42659810

apache-stringutils
tag name: apache-stringutils
type: Tag
tags question: http://stackoverflow.com/q/27135446
tags question: http://stackoverflow.com/q/27017291

http://stackoverflow.com/comment/42580066
type: Comment
has text: the error I get is "can not find symbol" It wont compile. Why does max need to be define in secondaryMethodCalls if I'm just calling the printMAx method? Same question with count It's inside a method which I'm calling, why would I have to define it?
comment on: http://stackoverflow.com/a/27028547
score: 0
type: AnswerComment

http://stackoverflow.com/q/27096777
type: UnansweredQuestion
has body: Whenever I run this program, everything runs fine until I get to the bottom where I'm supposed to type "y" or "n". I type "n" (without the parenthesis), and for some reason it continues to loop. Most likely, I'm improperly using. However, any help is fully appreciated! Thanks! import java.util.Scanner; public class GuessTheNumberEC { public static void main(String[] args) { Scanner reader = new Scanner(System.in); int guess = 5; int randomNumber; int guessRepetition = 1; String yes = "y"; String no = "n"; String answer; randomNumber = (int)(Math.random() * 24 + 1); System.out.println(randomNumber); for(;;){ for (int x = 1; x&lt;=4; x++) { System.out.println("Guess a number from 1 - 25."); guess = reader.nextInt(); if(guess == randomNumber) { System.out.println("Guess #" + guessRepetition + " is correct."); if(guessRepetition == 1) { System.out.println("Great, you guessed the number in " + guessRepetition + " try."); break; } else { System.out.println("Great, you guessed the number in " + guessRepetition + " tries."); break; } } else if (guess &gt; randomNumber) { System.out.println("Guess # " + guessRepetition + " is too high."); guessRepetition ++; } else if (guess &lt; randomNumber) { System.out.println("Guess # " + guessRepetition + " is too low."); guessRepetition ++; } } if (guess != randomNumber) { System.out.println("The number was " + randomNumber + "."); System.out.println("You couldn't guess the number in 4 tries, so you lose."); } System.out.println("Would you like to play again? Press 'y' or 'n'"); answer = reader.next(); if (answer == no) break; } } }
has answer: http://stackoverflow.com/a/27096795
type: Question
tagged with: if-statement
tagged with: java
has title: Applying strings and using them in if-else statements in java
duplicate of: http://stackoverflow.com/q/513832
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27096798
tagged with: string
linked to: http://stackoverflow.com/q/513832

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/27014038
tag name: tablemodel
tags question: http://stackoverflow.com/q/27127634

http://stackoverflow.com/comment/42720584
score: 0
type: QuestionComment
has text: Do you mean you want to fetch by row+cell, not just iterate? If so, did you [try looking at the Apache POI documentation on fetching cells](http://poi.apache.org/spreadsheet/quick-guide.html#Iterator)?
comment on: http://stackoverflow.com/q/27097885
type: Comment

http://stackoverflow.com/comment/42617519
has text: I dont think the use of a Border would cause a problem. I'm guessing you need to account for the existing margins of one or both of your JTextPanes. If the JTextPanes are side by side, you might want to do the modelToView calls on each of them, and create a union of those two Rectangles.
comment on: http://stackoverflow.com/a/27049283
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27083945
has body: The contest is rather unclear; at least to me. It says "none of them was divisible by the same prime number" which makes no sense, and if it did, I'd interpret it as that all the numbers must be co-prime. The next sentence sounds more like gcd(h, gcd(m, s)) &lt;= 1 for good days. I'm offering some untested potential improvements to Aman Agnihotri's algorithms. By creating the cumulative table, the biggest optimization is already done. There is a faster GDC algorithm, but I wouldn't bother as all you need is to fill a 60x60 table. This could be done even without GCD by something like int[] gcdTable = new int[60*60]; Arrays.fill(gcdTable, 1); for (int p=2; p&lt;60; ++p) for (int i=0; i&lt;60; i+=p) for (int j=0; j&lt;60; j+=p) gcdTable[60*i+j] = Math.max(gcdTable[60*i+j], p); Then use it as int gcd(int a, int b) { return gcdTable[60*a+b]; } in boolean isGood(int h, int m, int s) { return gcd(h, gcd(m, s)) &lt;= 1; } to fill the cumulative table. I guess, using a 1D array via int secondOfDay(int h, int m, int s) { return 3600*h + 60*m + s; } should be a bit faster than a 3D array. You don't need to store both remaining good and bad seconds, as their sum equals to 24*3600 - secondOfDay. My above table is too small for use for the expressing of the B:G ratio in smallest common terms, so you'll need one proper GCD per sample.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27081029

http://stackoverflow.com/comment/42661830
comment on: http://stackoverflow.com/q/27070108
type: QuestionComment
type: Comment
has text: Yes! NumberFormatException is when I send data to Database using JDBC. Please ignore that part. Sorry about the confusion. Any idea what could be the problem here otherwise? I tried sending encryptedData (without using Base64) and it failed as well. So the problem is not with Base 64 encoding-decoding (my initial guess).
score: 0

http://stackoverflow.com/q/27145847
tagged with: jvisualvm
type: UnansweredQuestion
has title: Menu not accessible during profiling
linked to: http://stackoverflow.com/q/34162074
has answer: http://stackoverflow.com/a/40424360
has comment: http://stackoverflow.com/comment/47345574
tagged with: java
tagged with: javafx
type: Question
upvote count: 4
downvote count: 0
score: 4
has body: I have a JavaFX application which I want to run under the JVisualVM profiler. However, I cannot access the menu items from the menu bar when running it under the profiler. So far, my application is just a simple scene built with SceneBuilder. It has an AnchorPane and a default Menubar. <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.layout.AnchorPane?> <MenuItem mnemonicParsing="false" text="Close" /> The code is also straight-forward, nothing special: @Override public void start(Stage primaryStage) throws IOException { String path = "Window.fxml"; URL url = getClass().getClassLoader().getResource(path); FXMLLoader loader = new FXMLLoader(); loader.setLocation(url); Parent root = loader.load(); Scene scene = new Scene(root, 600, 400); primaryStage.setScene(scene); primaryStage.show(); } I do the following: run the application from Eclipse until the window shows up, click on "File" to see whether "Close" becomes visible start JVisualVM, double click my application, go to the "Profiler" tab click "CPU" and wait until it has injected profiling instructions click on "File" again, but "Close" does not appear In Eclipse I see the following error messages coming up in the Console window very fast: Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: com/sun/javafx/tk/Toolkit$$Lambda$166 at com.sun.javafx.tk.Toolkit$$Lambda$166/563347763.get$Lambda(Unknown Source) at com.sun.javafx.tk.Toolkit.runPulse(Unknown Source) at com.sun.javafx.tk.Toolkit.firePulse(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$363(Unknown Source) at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$41/353428524.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at com.sun.gla…
tagged with: profiling
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27024418
answer count: 1
has body: I have more than 5000 Spring unit tests and I know every test works against Oracle DB and does a rollback as I have tested every single one individually. When I ran a maven test suite, I ended up with out of memory errors and found out that a few tests didn't rollback. I fixed the out of memory errors by adding a argLine param in my pom.xml and it doesn't happen anymore. But I am still trying to figure out if out of memory errors caused the rollback to fail? Or could it be something else? If out of memory is the culprit, what would be the best approach to handle/solve this problem in the code? Thanks.
type: UnansweredQuestion
has title: A few spring junit tests doesn't rollback. Because of out of memory errors?
tagged with: spring
has answer: http://stackoverflow.com/a/27032402
tagged with: junit4
tagged with: java
tagged with: oracle11g
tagged with: unit-testing
type: Question
score: 0

http://stackoverflow.com/a/27095566
type: Answer
has body: You should return a value from your method i.e. public static int[] reverse(int[] list) { ... return temp; } and in main... list = reverse(list); instead of reverse(list);
answers question: http://stackoverflow.com/q/27095520
score: 0

http://stackoverflow.com/comment/42782947
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27142841
has text: How are you even creating the `BankAccount`? You don't instantiate one anywhere.
score: 0

http://stackoverflow.com/q/26995889
possible better answer: http://stackoverflow.com/a/26995919
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/26996008
tagged with: casting
has answer: http://stackoverflow.com/a/26996024
tagged with: types
has body: Is there any problem (Run Time of course) in assigning Integer to int? int x= Integer.class.cast(parameters.get("PO_PAGE_CNT")); As Integer is the parent class and int is the instance, I think maybe in some cases I get ClassCastException or other type of Exception at run time. Is it right?
has comment: http://stackoverflow.com/comment/42522552
has answer: http://stackoverflow.com/a/26995950
tagged with: type-conversion
has answer: http://stackoverflow.com/a/26996008
has answer: http://stackoverflow.com/a/26995919
has comment: http://stackoverflow.com/comment/42522481
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42522351
has comment: http://stackoverflow.com/comment/42522356
type: Question
has title: assign Integer type to int

http://stackoverflow.com/comment/42564002
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27019183
has text: I don't understand your question : testing.xml is the suite file's name. I should have chosen a clearer name.

http://stackoverflow.com/q/27010621
has comment: http://stackoverflow.com/comment/42548353
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27011299
tagged with: jquery
favorite count: 0
type: UnansweredQuestion
has title: Tooltip text using Selenium 2 + Java when tootip is a parameter in onmouseover method
tagged with: java
downvote count: 2
tagged with: selenium
type: Question
has body: How can I get a tooltip for a link Footnote using Selenium 2 + Java? I am expecting "Tooltip for footnote" as the text. html is as: &lt;a onmouseout="rdm.js.util.RDMUtils.hideTooltip(event);return true" onmouseover="rdm.js.util.RDMUtils.showTooltipEncoded(event, "&lt;p&gt;;&lt;/p&gt;; Tooltip for footnote &lt;br /&gt;");return true" href="#"&gt;Footnote&lt;/a&gt;
score: -2
tagged with: javascript

http://stackoverflow.com/a/26994648
has comment: http://stackoverflow.com/comment/42520391
score: 0
has comment: http://stackoverflow.com/comment/42520396
has comment: http://stackoverflow.com/comment/42520197
has comment: http://stackoverflow.com/comment/42521292
has body: Your class is in package action so its full name is action.LoginServlet. You have configured src.action.LoginServlet as the servlet class. Remove src from there. loginServlet action.LoginServlet This part: You have lot of boilerplate code there. Instead, use Expression Language to add localhost:8080/webappName like this: Since you're using Servlet Specification 2.5, you cannot use @WebServlet annotation. So remove it from your Serlvet class. Otherwise, start using Servlet 3.0 or superior by changing the servlet specification in your web.xml To retrieve parameters from the submitted use ServletRequest#getParameter. request#getAttribute is used in JSP to retrieve attributes to display the data when using Expression Language.
answers question: http://stackoverflow.com/q/26994555
has comment: http://stackoverflow.com/comment/42521315
type: Answer
has comment: http://stackoverflow.com/comment/42520515
has comment: http://stackoverflow.com/comment/42520622
has comment: http://stackoverflow.com/comment/42521367
has comment: http://stackoverflow.com/comment/42520244

http://stackoverflow.com/q/27041123
linked to: http://stackoverflow.com/q/4375410
has comment: http://stackoverflow.com/comment/42601532
has comment: http://stackoverflow.com/comment/42601472
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I need to implement the Cost Matrix in Java Eclipse editor using the Weka API. I have imported all the Weka API in Jave and using the code:- public class EvaluteCM { public static void main(String[] args) throws Exception { CostMatrix matrix = new CostMatrix( new BufferedReader(new FileReader("c:/data.txt"))); System.out.println(matrix); } } and I show here some of my data in text file data.txt 0.211429 0.223573 0.274898 0.260206 0 class1 0.211429 0.223573 0.274898 0.260206 0 class1 0.099854 0.110879 0.312785 0.291716 0 class1 0.747867 0 0.272726 0.320873 0.727273 class2 0.775455 0 0.272726 0.304774 0.727273 class2 0.775455 0 0.272726 0.304774 0.727273 class2 0.76761 0 0.272726 0.304774 0.727273 class2 when I implement the class EvaluteCM, I got the following error Exception in thread "main" java.lang.NumberFormatException: For input string: "0.211429" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at weka.classifiers.CostMatrix.&lt;init&gt;(CostMatrix.java:524) at EvaluteCM.main(EvaluteCM.java:13) Any Help will be appreciated?
type: Question
has answer: http://stackoverflow.com/a/27042758
accepted answer: http://stackoverflow.com/a/27042758
has comment: http://stackoverflow.com/comment/42601481
tagged with: weka
upvote count: 1
answer count: 1
has title: Cost Matrix in Java
favorite count: 0

http://stackoverflow.com/comment/42536039
has text: This question appears to be off-topic because regardless of whether or not you've already handed this in, it's still a `"do my work for me"` type question. Please ask a specific question about what confuses you, not just a requirement and a code dump.
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27003229

http://stackoverflow.com/q/27131991
has comment: http://stackoverflow.com/comment/42764265
tagged with: java
tagged with: multithreading
has title: Starvation thread
has comment: http://stackoverflow.com/comment/42763278
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42762942
has comment: http://stackoverflow.com/comment/42763120
score: -1
has comment: http://stackoverflow.com/comment/42763342
upvote count: 0
answer count: 1
has body: In my code as I can prevent the problem of starvation caused by the simulation method of writing with sleep ? Because if a thread is put to sleep for a long time always will never write than one that you put to sleep for a short time The program consists of many threads that continually access the write method of the class my_file , whose instance is shared by all threads,but only one thread at a time can write to the file. public class My_File { private boolean writing = false; public synchronized void write() { String name = Thread.currentThread().getName(); System.out.println(name +" writing "); try{ Thread.sleep((int)(Math.random()*3000)); } catch( InterruptedException e){ e.printStackTrace(); } System.out.println(name +" writing end "); } } I have this problem , I have a lot of files shared by many threads , all threads that do nothing but try to write to a file in the case , writing is simulated by the method sleep , I do not really write to a file , in this situation how can I prevent starvation ?
has comment: http://stackoverflow.com/comment/42775497
favorite count: 0
has answer: http://stackoverflow.com/a/27135046
type: UnansweredQuestion

http://stackoverflow.com/comment/42646743
comment on: http://stackoverflow.com/q/27066603
has text: Thats all there is to the question stated, what else can there be for the code? @user1071777
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42694044
type: Comment
comment on: http://stackoverflow.com/a/27093846
type: AnswerComment
has text: @EssaidiM: use a Swing Timer that has easy to use `stop()` and `start()` methods.
score: 0

http://stackoverflow.com/comment/42537215
has text: so how to return what the called function return?
comment on: http://stackoverflow.com/q/27003803
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27077110
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42667797
has answer: http://stackoverflow.com/a/27326247
has body: I received the following error while running my javacode that uses jNetPcap jar : Exception in thread "main" java.lang.UnsatisfiedLinkError: com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)J at com.slytechs.library.NativeLibrary.dlopen(Native Method) at com.slytechs.library.NativeLibrary.&lt;init&gt;(Unknown Source) at com.slytechs.library.JNILibrary.&lt;init&gt;(Unknown Source) at com.slytechs.library.JNILibrary.loadLibrary(Unknown Source) at com.slytechs.library.JNILibrary.register(Unknown Source) at com.slytechs.library.JNILibrary.register(Unknown Source) at com.slytechs.library.JNILibrary.register(Unknown Source) at org.jnetpcap.Pcap.&lt;clinit&gt;(Unknown Source) at PacketExtractor.main(PacketExtractor.java:51) What i was trying to do is to open a .pcap file that i am going to read or extract some of its DNS type A packets, and for that i prepare my eclipse environment and added jNetPcap related jar, as its written in this web page : http://researchingtech.wordpress.com/2012/10/21/installing-jnetpcap-on-windowseclipse-users/ Then i added this part of code: final String FILENAME = "C:\\Users\\Administrator\\Downloads\\dns.cap"; final StringBuilder errbuf = new StringBuilder(); final Pcap pcap = Pcap.openOffline(FILENAME, errbuf); if (pcap == null) { System.err.println(errbuf); // Error is stored in errbuf if any return; } Then when i compiled the project i received the aforementioned error ! Any body know what i missed in my steps that caused that error? Please Advise..
upvote count: 1
tagged with: jnetpcap
has title: java.lang.UnsatisfiedLinkError JNetPcap output error
tagged with: java
type: Question
downvote count: 0
answer count: 1
score: 1
favorite count: 0

http://stackoverflow.com/q/27150123
tagged with: hql
has comment: http://stackoverflow.com/comment/42803862
score: 0
tagged with: jpa
has body: Guys I hope that someone can help me, first of all sorry for my english. I'm trying to do a query like this: SELECT new com.enterprise.entity.ObjectExample(oe.id, oe.image) FROM ObjectExample and I have a Constructor like this: public ObjectExample(Long id, byte[] image){ this.id = id; this.image = image; } But in my eclipse keep showing this error: "No constructors can be found that match the argument types." It's compile normal and the code is running ok, but i'd like to ignore this error in my eclipse or make a constructor in another way. Thanks in advance.
answer count: 0
type: UnansweredQuestion
has title: JPA HQL: SELECT new Object with byte array in the constructor
has comment: http://stackoverflow.com/comment/42866952
type: Question
tagged with: java
tagged with: hibernate
tagged with: eclipse

http://stackoverflow.com/q/27077796
has title: String index out of range with replace all
upvote count: 3
tagged with: java
type: Question
has body: How can I replace mapDir surrounded by &lt;> to a certain string? String mapDir = "D:\\mapping\\specialists\\ts_gpc\\"; String test = "foo: &lt;mapDir&gt; -bar"; println(test.replaceAll("&lt;mapDir&gt;", mapDir)); The above gives me a StringIndexOutOfBoundsException. This code below for me, but I think pure java has to work as well. static String replaceWord(String original, String find, String replacement) { int i = original.indexOf(find); if (i &lt; 0) { return original; // return original if 'find' is not in it. } String partBefore = original.substring(0, i); String partAfter = original.substring(i + find.length()); return partBefore + replacement + partAfter; }
has comment: http://stackoverflow.com/comment/42666279
tagged with: replace
has answer: http://stackoverflow.com/a/27077837
answer count: 3
has answer: http://stackoverflow.com/a/27077905
linked to: http://stackoverflow.com/q/1701839
downvote count: 0
accepted answer: http://stackoverflow.com/a/27077837
linked to: http://stackoverflow.com/q/18875852
has comment: http://stackoverflow.com/comment/42665934
favorite count: 0
possible better answer: http://stackoverflow.com/a/27077905
has answer: http://stackoverflow.com/a/27077898
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/27086817
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42685459
accepted answer of: http://stackoverflow.com/q/27086707
type: AcceptedAnswer
downvote count: 0
has body: There are a few problems. You should compare equality of strings with equals method and not with ==. Change color.green to Color.GREEN public void actionPerformed(ActionEvent e) { String text = Input.getText(); if (text.equals("green")) { color.setBackground(Color.GREEN); } } For more than one color, you can use if-else or switch case Using if-else: public void actionPerformed(ActionEvent e) { String text = Input.getText(); if (text.equals("green")) { color.setBackground(Color.GREEN); } else if(text.equals("red")) { color.setBackground(Color.RED); } else if(text.equals("yellow")) { color.setBackground(Color.YELLOW); } else { color.setBackground(Color.BLUE); } } Using switch case: public void actionPerformed(ActionEvent e) { String text = Input.getText(); switch (text) { case "green": color.setBackground(Color.GREEN); break; case "red": color.setBackground(Color.RED); break; case "yellow": color.setBackground(Color.YELLOW); break; case "blue": color.setBackground(Color.BLUE); break; } }
answers question: http://stackoverflow.com/q/27086707

http://stackoverflow.com/a/27106223
has comment: http://stackoverflow.com/comment/42716148
has comment: http://stackoverflow.com/comment/42715873
answers question: http://stackoverflow.com/q/27106079
has body: If the external app will run inside the same process, you can try to redirect System.out (using System.setOut()) before the call to the external application.
score: 0
has comment: http://stackoverflow.com/comment/42716252
has comment: http://stackoverflow.com/comment/42716075
type: Answer

http://stackoverflow.com/q/27027511
answer count: 2
possible better answer: http://stackoverflow.com/a/27027576
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/27027576
favorite count: 0
has title: Java arraycopy specific area of a two dimensional array
has body: I started coding java about 2 weeks ago,and need some help with my code. I have an 4x4 array [0][1][2][3] [4][5][6][7] [8][9][10][11] [11][12][13][14] I want to copy a part of the array to newArray,which is 2x2, for example {[9][10];[12][13]} But this code only copies values from the first two rows,while I need the third and fourth int[][]newArray=new int[2][2]; for (int i =0; i &lt; newArray.length; i++) { System.arraycopy(array[i], 1, newArray[i], 0, newArray[0].length); } Cheers,and thank you in advance.
accepted answer: http://stackoverflow.com/a/27027561
type: AnsweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27027561

http://stackoverflow.com/a/27019355
score: 0
has body: Try removing @JoinColumn(referencedColumnName="bid") from class B, it is not needed and maybe it'll fix the error. EDIT This is a pretty basic setup, so to keep it simple try this code @Entity @Table(name="A") public class A { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="aid") private Integer AId; @OneToOne @JoinColumn(name="bid") private B b; // getters and setters } @Entity @Table(name="B") public class B { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="bid") private Integer bId; @OneToOne(mappedBy="b") private A a; // getters and setters }
has comment: http://stackoverflow.com/comment/42566736
answers question: http://stackoverflow.com/q/27019263
has comment: http://stackoverflow.com/comment/42563619
has comment: http://stackoverflow.com/comment/42563383
type: Answer

http://stackoverflow.com/comment/42693409
has text: Come on, you don't really want to make that a public method, do you?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27093721

http://stackoverflow.com/comment/42614259
type: Comment
has text: I know it's a convention, but it's a major convention. To put unit testing in production just for an assert statement seems an overkill, considering the alternatives.
comment on: http://stackoverflow.com/a/27047590
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42691093
comment on: http://stackoverflow.com/a/27088773
has text: Awesome it works! I can't upvote until I have 15 rep but when I do I'll upvote! I already accepted as the answer. Thanks a lot.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42721758
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27109095
has text: @Maksym amplitudes of a wav file which we try to split into frames(subarray) of fixed length to apply, let's say, Hamming window function.
score: 0

http://stackoverflow.com/comment/42710630
comment on: http://stackoverflow.com/a/27103445
score: 1
has text: I agree. When you define an array in java, the value is the number of items and not the max index, so if you define 10 they will be 0 to 9. You have 11 questions, remove one or change definition.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27000820
has body: Okay so I am not sure why this works but I was able to figure out the anwer based on this question: onCreateView() in Fragment is not called immediately, even after FragmentManager.executePendingTransactions() I added the following line getFragmentManager().executePendingTransactions(); and then moved everthing to the onStart method @Override protected void onStart() { super.onStart(); //create a new note fragment if one has not been created yet mNoteFragment = (NoteFragment) getFragmentManager().findFragmentById(R.id.container); if (mNoteFragment == null) { mNoteFragment = new NoteFragment(); getFragmentManager().beginTransaction().replace(R.id.container, mNoteFragment).commit(); getFragmentManager().executePendingTransactions(); } //restore SharedPreferences SharedPreferences sharedPrefs = getPreferences(0); int stylePref = sharedPrefs.getInt(SharedPreferanceConstants.PREF_FONT_SIZE, 2); String fontPref = sharedPrefs.getString(SharedPreferanceConstants.PREF_TYPEFACE, ""); Log.d("STYLEID", String.valueOf(stylePref)); Log.d("FONTTYPE", fontPref); onStyleChange(null , stylePref); onFontChange(null, fontPref); } and for some reason it works fine now. If anyone could explain why that would be great
has comment: http://stackoverflow.com/comment/42532215
accepted answer of: http://stackoverflow.com/q/26998088
answers question: http://stackoverflow.com/q/26998088
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42532004
has comment: http://stackoverflow.com/comment/42532296
score: 0

http://stackoverflow.com/q/27044762
type: UnansweredQuestion
tagged with: java
type: Question
has body: What is the difference between the following two ways of setting property? While starting the application, e.g. java - cp /usr/bin/*.jar -D java.file.path=/home/export. System.setProperty("java.file.path","/home/export") When I use the first method to set a path for 3rd party API, it's working fine, but the second method does not work.
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27045380
has answer: http://stackoverflow.com/a/27046071
has title: Difference between setting the runtime option using -D option when starting the application and setting using System.setProperty

http://stackoverflow.com/q/27063820
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27063858
tagged with: java
tagged with: methods
accepted answer: http://stackoverflow.com/a/27063902
has title: Comparing two arrays. Wrong return value (1)
has comment: http://stackoverflow.com/comment/42641568
tagged with: program-entry-point
tagged with: arrays
has answer: http://stackoverflow.com/a/27063902
has answer: http://stackoverflow.com/a/27063858
score: 0
has answer: http://stackoverflow.com/a/27063967
has answer: http://stackoverflow.com/a/27064016
has body: I made this method that compares the numbers of two arrays and then returns how many numbers are equal to each other, but no matter how many numbers are equal, the method returns the value 1 every time. (both arrays are the same length). public static void main(String[] args) { int a [] = {1, 4, 6, 7, 8, 10, 13}; int b [] = {1, 2, 3, 4, 5, 6, 7}; equal(a,b); } public static int equal(int[] a, int[] b){ int j = 0; for(int i = 0; i&lt; a.length-1;i++){ if(a[i] == b[i]){ j++; } } System.out.println(j); return j; }
answer count: 4
tagged with: return
type: Question

http://stackoverflow.com/q/27034848
type: Question
answer count: 1
has title: using SystemProperties to get Serial (Brand, Device.. etc) on Android
linked to: http://stackoverflow.com/q/2641111
score: 0
tagged with: android
duplicate of: http://stackoverflow.com/q/2641111
has answer: http://stackoverflow.com/a/27035410
tagged with: system-properties
accepted answer: http://stackoverflow.com/a/27035410
has comment: http://stackoverflow.com/comment/42590570
type: AnsweredQuestion
tagged with: java
has body: I develop Android app to show some basic info. Looking at sources, I discovered that android.os.Build has most of needed values /** The name of the overall product. */ public static final String PRODUCT = getString("ro.product.name"); to take a look at those values on locally connected to PC device I can adb shell getprop [ro.product.name]: [A828t] That is good. And I can see a lot a values Then when trying to read from Java using similar getString like in android.os.Build private static String getString(String property) { return SystemProperties.get(property, UNKNOWN); } I found that sources for Android 4.4.2 (and in 4.3, 2.3.3 as well) android.jar does not have SystemProperties inside android.os package. In the same time i can find it online using grepcode.com, where it is present from 2.3.3 to 5.L What the problem here? Is this android.jar not good? Was the SystemProperties class made hidden?

http://stackoverflow.com/q/27009694
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27009713
has body: I'm trying to implement a shuffle method to shuffle cards in a deck array class. Here's the code: public void shuffle() { Card holderCard = new Card(); for (int x = 0; x &lt; 1000; x++) { spot1 = rnd.nextInt(52);&lt;&lt;&lt;&lt;&lt;&lt;&lt; spot2 = rnd.nextInt(52); holderCard = deck[spot1]; deck[spot1] = deck[spot2]; deck[spot2] = holderCard; } } Every time I run the program and get to the shuffle method, I get a java.lang.NullPointerException on the line with &lt;&lt;&lt;&lt;&lt;&lt;. I don't really know why or how, but this method is just supposed to change the position of cards in the array.
has answer: http://stackoverflow.com/a/27009733
downvote count: 0
score: 1
tagged with: java
has title: Java.lang.NullPointerException in my own shuffle method while using random numbers in Java?
type: Question
answer count: 2
tagged with: nullpointerexception
tagged with: random
upvote count: 1
favorite count: 0

akka
type: Tag
tags question: http://stackoverflow.com/q/27078869
tags question: http://stackoverflow.com/q/27054351
tag name: akka
tags question: http://stackoverflow.com/q/26999956
tags question: http://stackoverflow.com/q/27101934
tags question: http://stackoverflow.com/q/26994552

fragment
tags question: http://stackoverflow.com/q/27140494
tags question: http://stackoverflow.com/q/26999603
tags question: http://stackoverflow.com/q/27148575
tags question: http://stackoverflow.com/q/27030183
tags question: http://stackoverflow.com/q/27091471
tag name: fragment
tags question: http://stackoverflow.com/q/27126469
tags question: http://stackoverflow.com/q/27050099
tags question: http://stackoverflow.com/q/27008225
type: Tag

http://stackoverflow.com/a/28228388
downvote count: 0
has comment: http://stackoverflow.com/comment/44823010
answers question: http://stackoverflow.com/q/27045832
upvote count: 3
has comment: http://stackoverflow.com/comment/45057029
type: Answer
score: 3
has body: The short answer is: if (!input.hasNext()) input = new Scanner(System.in); The long answer is: Below is code, with comments made for removing later, to demonstrate the problem as I understand it and solution. Note this demo is intended to only work with integer and ^Z inputs. Copy out the code and save into file HN.java to compile. Run the program and it will prompt One. Enter integers to your heart's content and exit the loop by entering ^Z. Two will be displayed followed by the NoSuchElementFound exception in the question. This is because the ^Z remains in the Scanner object input and thereby fails on the nextInt() method. The first inclination might be to use hasNext() to account for this. So go ahead and uncomment /*Comment1 and recompile and run again. Now you avoid the exception, but the program blazes through to the end, skipping over the nextInt() originally intended. So now, uncomment /*Comment2, recompile, and run again. Now the program will wait at the Two prompt as intended. If you enter an integer here, you will proceed to the Three prompt for another entry. However, if you enter ^Z at Two, again, the program skips the next input. To correct this, uncomment /*Comment3, recompile, and run, and you will see the program works for all combos of integers and ^Z at the various inputs. Now, you might be wondering why I didn't just reuse the !input.hasNext() solution in /*Comment3. Here's a demo why: Put back the /*Comment3 and uncomment the /*Comment4, compile and run again. The program works fine and dandy with a ^Z input at the Two prompt, but if you enter an integer there, you'll see the system waiting for input, but there is no prompt Three! This is because the integer you entered was used in the preceding nextInt() so when the program gets to the hasNext(), it stops and waits for input. The lesson here is you use the !input.hasNext() when you KNOW you have a ^Z in queue such as when it was used to escape the while loop in this program and the original pos…
has comment: http://stackoverflow.com/comment/45061043
has comment: http://stackoverflow.com/comment/45057130

http://stackoverflow.com/q/27024338
favorite count: 0
has comment: http://stackoverflow.com/comment/42576774
has answer: http://stackoverflow.com/a/27024362
has title: Syntax error when declaring a list of characters in java
type: AnsweredQuestion
has body: I'm not really sure what's the problem, when I try to declare a new list like that: List&lt;Character&gt; newLst = ArrayList&lt;Character&gt;(); and the compiler tells me "Syntax error on token "(", Expression expected after this token". I declared a list of Integers like that: List&lt;Integer&gt; lst = new ArrayList&lt;Integer&gt;(); and I have no problems, what did I do wrong?
tagged with: java
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27024362
score: 0
answer count: 1

http://stackoverflow.com/comment/42685897
comment on: http://stackoverflow.com/a/27089231
has text: ok i undersatnd your code, but kndly would you please provide some explanation why the code i posted is not working? when i run it the screen displays nothinf and after a while it displays only "tv_1: 19"
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27914927
score: 0
type: AcceptedAnswer
has body: Found out what was wrong with this issue. We are using Maven and decided to check and see if there were conflicting libraries. We found one: Apache.FOP. Took it out and Birt worked fine after that.
accepted answer of: http://stackoverflow.com/q/27099683
type: Answer
answers question: http://stackoverflow.com/q/27099683

http://stackoverflow.com/q/27099521
has answer: http://stackoverflow.com/a/27114531
tagged with: log4j
type: AnsweredQuestion
upvote count: 3
tagged with: logging
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/27114531
tagged with: java
has body: I am using JMX Logger for monitoring java web application.MBean Server connect successfully and i see logs in JMX logger LoggerConsole but i dont know how to use Filter Expression in loggerconsole. this is my configuration file <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <priority value ="DEBUG" /> <appender-ref ref="console" /> <appender-ref ref="jmxlogger" /> </log4j:configuration> now my question is i want to filter trough raw data for example I am happy only what i will do? please help me
tagged with: monitoring
downvote count: 0
answer count: 1
has title: How can i use Filter Expression in jmx logger LogConsole?
favorite count: 0

eclipse
tags question: http://stackoverflow.com/q/27150123
tags question: http://stackoverflow.com/q/27065680
tags question: http://stackoverflow.com/q/27026203
tags question: http://stackoverflow.com/q/27002818
tags question: http://stackoverflow.com/q/27071731
tags question: http://stackoverflow.com/q/27134936
tag name: eclipse
tags question: http://stackoverflow.com/q/27071747
tags question: http://stackoverflow.com/q/27152769
tags question: http://stackoverflow.com/q/26994301
tags question: http://stackoverflow.com/q/27004893
tags question: http://stackoverflow.com/q/27151939
tags question: http://stackoverflow.com/q/27058622
tags question: http://stackoverflow.com/q/27111849
tags question: http://stackoverflow.com/q/27132251
tags question: http://stackoverflow.com/q/27032245
tags question: http://stackoverflow.com/q/27017807
tags question: http://stackoverflow.com/q/27048226
tags question: http://stackoverflow.com/q/27012833
tags question: http://stackoverflow.com/q/27064173
tags question: http://stackoverflow.com/q/26995767
tags question: http://stackoverflow.com/q/27013468
tags question: http://stackoverflow.com/q/27116931
tags question: http://stackoverflow.com/q/27108446
tags question: http://stackoverflow.com/q/27067288
tags question: http://stackoverflow.com/q/27001486
tags question: http://stackoverflow.com/q/27091994
tags question: http://stackoverflow.com/q/27151867
tags question: http://stackoverflow.com/q/27118317
tags question: http://stackoverflow.com/q/27041962
tags question: http://stackoverflow.com/q/27079423
tags question: http://stackoverflow.com/q/27104965
tags question: http://stackoverflow.com/q/27084319
tags question: http://stackoverflow.com/q/27124935
tags question: http://stackoverflow.com/q/27129894
tags question: http://stackoverflow.com/q/27084168
tags question: http://stackoverflow.com/q/27019786
tags question: http://stackoverflow.com/q/27007800
tags question: http://stackoverflow.com/q/27004635
tags question: http://stackoverflow.com/q/27099133
tags question: http://stackoverflow.com/q/27146006
tags question: http://stackoverflow.com/q/27111490
tags question: http://stackoverflow.com/q/27048301
tags question: http://stackoverflow.com/q/27024401
tags question: http://stackoverflow.com/q/27036206
tags question: http://stackoverflow.com/q/27128638
tags question: http://stackoverflow.com/q/27063886
tags question: http://stackoverflow.com/q/27045494
tags question: http://stackoverflow.com/q/27132903
tags question: http://stackoverflow.com/q/27094050
tags question: http://stackoverflow.com/q/27033033
tags question: http://stackoverflow.com/q/27059861
tags question: http://stackoverflow.com/q/27074299
tags question: http://stackoverflow.com/q/27060914
tags question: http://stackoverflow.com/q/27055585
tags question: http://stackoverflow.com/q/27058665
tags question: http://stackoverflow.com/q/27123385
tags question: http://stackoverflow.com/q/27083695
tags question: http://stackoverflow.com/q/27099222
tags question: http://stackoverflow.com/q/27004988
tags question: http://stackoverflow.com/q/27115952
tags question: http://stackoverflow.com/q/27102930
tags question: http://stackoverflow.com/q/27088926
tags question: http://stackoverflow.com/q/27105232
tags question: http://stackoverflow.com/q/27063881
tags question: http://stackoverflow.com/q/27079919
tags question: http://stackoverflow.com/q/27015236
tags question: http://stackoverflow.com/q/27032979
tags question: http://stackoverflow.com/q/27096301
tags question: http://stackoverflow.com/q/27120931
tags question: http://stackoverflow.com/q/27018327
tags question: http://stackoverflow.com/q/27029264
tags question: http://stackoverflow.com/q/27059798
tags question: http://stackoverflow.com/q/27014624
tags question: http://stackoverflow.com/q/27085827
tags question: http://stackoverflow.com/q/27031442
tags question: http://stackoverflow.com/q/27079668
tags question: http://stackoverflow.com/q/27084953
tags question: http://stackoverflow.com/q/27079048
tags question: http://stackoverflow.com/q/27081408

http://stackoverflow.com/q/27139010
has answer: http://stackoverflow.com/a/27139195
accepted answer: http://stackoverflow.com/a/27139195
has body: I wrote this code to ask the user to input an ip address and it worked using regex, but then I want to tell the user which class is this ip depending on the range (0-126)class A, (128-191)class b, (192-224)class c, and 127 is an exception "loop back", I don't know how to do it, can somebody help? Here's my code: public class main { public static void main(String[]args){ String IP=""; Scanner Scr = new Scanner(System.in); System.out.println("Enter a valid network IP:"); // thanks to this link http://www.mkyong.com/regular-expressions/how-to-validate-ip-address-with-regular-expression/ String pattern = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"; //String pattern = "[0-255][.][0-255][.][0-255][.][0-255]"; boolean matches = false; do{ IP = Scr.nextLine(); matches = Pattern.matches(pattern, IP); if(matches==false) System.out.println("wrong range"); }while(!matches); Scr.close(); } }
has title: java code to get ip address class
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/43540417
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27537607
has text: AlexSC, it WILL, because you have defined the relationship as one-to-many. A member can only have one team. Try it. If it fails, then feel free to disagree with me.
score: 0

http://stackoverflow.com/comment/42753098
comment on: http://stackoverflow.com/a/27126705
type: Comment
score: 0
type: AnswerComment
has text: Thanks for your answer. As I said above, I want to compare my two java programs performance. Which one is faster.

http://stackoverflow.com/comment/42585489
comment on: http://stackoverflow.com/q/27031748
score: 0
type: QuestionComment
type: Comment
has text: Do you have your own maven repository?

http://stackoverflow.com/comment/42727974
has text: Take a look at my code now, I added an extension trimming. Could you tell me how to add a counter to my code now? Or how to merge your code with mine, please?
type: Comment
comment on: http://stackoverflow.com/a/27111622
type: AnswerComment
score: 0

http://stackoverflow.com/a/34768066
type: Answer
upvote count: 17
score: 17
answers question: http://stackoverflow.com/q/26995395
downvote count: 0
has body: The difference between the two invocations can be seen by examining the value of request.getDispatcherType().

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/27052003
tags question: http://stackoverflow.com/q/27079943
type: Tag

http://stackoverflow.com/a/27084806
answers question: http://stackoverflow.com/q/27084690
has body: Imma a dummy =( I was trying to get the variables for my second page in the wrong class. I moved those 2 blocks of code //VARIABLES FOR DAY 2 EditText d2instructor = (EditText) findViewById(R.id.wkOneDayTwoInstructorName); String day2_inst = d2instructor.getText().toString(); and //PASS VARIABLES FOR DAY 2 intent.putExtra("day2_inst", day2_inst); to the next class that was being called and now its working.
score: 0
type: Answer

http://stackoverflow.com/comment/99023086
type: Comment
comment on: http://stackoverflow.com/a/54305813
has text: Related to my answer : https://stackoverflow.com/questions/10041410/default-profile-in-spring-3-1
type: AnswerComment
score: 0

http://stackoverflow.com/q/27034885
has body: I have created a sample application with a very simple entity "stock" with an String id. All pre-build and unit tests run without errors, but when I open the generated application, I can not see the dialog allowing me to create or see "stocks". Just the header and footer. The only warning I see is this one: I'm all done. Running bower install &amp; npm install for you to install the required dependencies. If this fails, try running the command yourself. 'bower' is not recognized as an internal or external command,operable program or batch file. npm WARN package.json stokker@0.0.0 No repository field. npm WARN optional dep failed, continuing fsevents@0.3.1 Could this be related? Do I need to do any additional "bower" installation? I followed the installation process shown in the JHipster website (Node.js and Yeoman). I´m running on Windows. UPDATE: I have installed bower manually using npm bower installand the error is not fixed. Also I have noticed that the upper menu is not working so I think this problem might be caused by some JavaScript problem...
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27070124
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27070124
type: Question
has title: JHipster After creating sample entity nothing is shown in the browser
upvote count: 3
tagged with: jhipster

http://stackoverflow.com/a/27118392
has body: Answer: GuestInfo info = vm.getGuest(); //(vm means VirtualMachine object.) GuestDiskInfo[] dInfos = info.getDisk(); if (dInfos != null) { System.out.println("Disk Info"); for (GuestDiskInfo dInfo : dInfos) { System.out.println(" Capacity(GB):"+dInfo.getCapacity()/1024/1024/1024); System.out.println(" Free(GB):"+dInfo.getFreeSpace()/1024/1024/1024); System.out.println(" Disk Path:"+dInfo.getDiskPath()); System.out.println("============"); } } **Important: Firstly need to install vmware tools on each guest os machine. From this question, guest os are Window 7, Window Xp, Window Server 2008 and Window server 2012.
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27033505
answers question: http://stackoverflow.com/q/27033505
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27143553
has answer: http://stackoverflow.com/a/27143735
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42783743
score: 1
tagged with: java
has title: Tags different size depending on usage
upvote count: 1
type: Question
downvote count: 0
tagged with: jsp
answer count: 1
has body: I have a JSP application and a mysql database, which are working very well. In my application you can save a connection between a tag and a ticket. It's a n-m entity. You can put many tags to a ticket and a ticket can have many tags. Now I want to print out a list of all tags and mark the tags which are more often used bigger then the others ( font-size). Basically I've already done this, but I have really no clue how to do this nice and smoothly. String xxx=""; for (TBean tb : tagsList) { int fontSize = 11; fontSize = fontSize + tb.counter; //counter = number of usages if (fontSize &gt; 20) { fontSize = 20; } xxx += "&lt;span style='font-size:" + fontSize + "px;'&gt;" + tb.name + "&lt;/span&gt;"; } return xxx;
favorite count: 0

http://stackoverflow.com/comment/42675638
type: Comment
has text: :So if I have 2 large arrays using two loops may be an incorrect approach, because the size of my third array will be very big
comment on: http://stackoverflow.com/a/27083056
type: AnswerComment
score: 0

http://stackoverflow.com/q/27130978
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42784819
type: Question
has comment: http://stackoverflow.com/comment/42760855
has answer: http://stackoverflow.com/a/27143840
score: 0
answer count: 3
has title: How to find exact match for a word in a string
has comment: http://stackoverflow.com/comment/42760820
has body: I have a string like this This is just a test-like thing. I want to test this I want to use a regex that will match test, such that it only matches test alone but not something like test-like. What would be the regex for this. I tried "\btest\b" but it doesn't work.
tagged with: regex
has answer: http://stackoverflow.com/a/27131054
has answer: http://stackoverflow.com/a/27131022

http://stackoverflow.com/comment/42711428
type: Comment
comment on: http://stackoverflow.com/a/27103660
has text: @user2504380 great point, I was just trying to install Java 8 to do that. I'm Android programmer, so I haven't had need to yet!
type: AnswerComment
score: 0

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/27092545
type: Tag
tags question: http://stackoverflow.com/q/27073319
tags question: http://stackoverflow.com/q/27050665
tags question: http://stackoverflow.com/q/27127304
tags question: http://stackoverflow.com/q/27007822

http://stackoverflow.com/q/26995363
has answer: http://stackoverflow.com/a/26995399
accepted answer: http://stackoverflow.com/a/26995454
type: AnsweredQuestion
has title: Is there a way to get rid of this null pointer exception I am geting?
tagged with: java
has answer: http://stackoverflow.com/a/26995386
tagged with: error-handling
has answer: http://stackoverflow.com/a/26995454
type: Question
tagged with: tooltip
score: 0
answer count: 3
has body: The following code shows a null pointer exception private void _settooltip() { localXYLineAndShapeRenderer.setBaseToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { //String toolTip = getToolTipText(); // return toolTip; CurveSegment segment = (CurveSegment) curveEncapsulator.getSegment(currentCurve); if (segment != null) { segment.getA(); segment.getB(); segment.getC(); } double A = segment.getA(); double B = segment.getB(); double C = segment.getC(); String AA = String.valueOf(A); String BB = String.valueOf(B); String CC = String.valueOf(C); return "A = " + AA + " B = " + BB + " C = " + CC; } }); } I am getting exception on public String generateToolTip(XYDataset dataset, int series, int item) Can anyone tell me how to handle this null pointer exception?
tagged with: exception
possible better answer: http://stackoverflow.com/a/26995386

http://stackoverflow.com/comment/42734629
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27111334
has text: @ajb is correct; compare the data from the `TableModel` (model) associated with each `JTable` (view); also consider that you may have an [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem).

http://stackoverflow.com/comment/42789161
score: 1
has text: [How to use Swing Timers](http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html) or [Worker Threads and SwingWorker](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html)
comment on: http://stackoverflow.com/q/27146759
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27086569
has title: Make one thread wait for another to finish
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/27086607
has body: I have two thread classes: one that prints numbers from 0 to 9, and another from 100 to 109. What I want is to make the first thread wait for the other one to finish. For this, I used the join() method, but it's not working. Please tell me where I'm going wrong: //demonstrates the use of join() to wait for another thread to finish class AThread implements Runnable { Thread t; AThread() { t = new Thread(this); } public void run() { try { for (int i=0; i&lt;10; i++) { System.out.println(i); Thread.sleep(10); } } catch (InterruptedException e) { System.out.println(t + " interruped."); } } public void halt(Thread th) { try { th.join(); } catch (InterruptedException e) { System.out.println(t + " interruped."); } } } //a different thread class (we distinguish threads by their output) class BThread implements Runnable { Thread t; BThread() { t = new Thread(this); } public void run() { try { for (int i=100; i&lt;110; i++) { System.out.println(i); Thread.sleep(10); } } catch (InterruptedException e) { System.out.println(t + " interruped."); } } } public class WaitForThread { public static void main(String[] args) { AThread t1 = new AThread(); BThread t2 = new BThread(); t1.t.start(); t1.halt(t2.t); //wait for the 100-109 thread to finish t2.t.start(); } }
type: Question
has comment: http://stackoverflow.com/comment/42681566
tagged with: java
has comment: http://stackoverflow.com/comment/42681625
answer count: 1
has answer: http://stackoverflow.com/a/27086607
score: 0
type: AnsweredQuestion

http://stackoverflow.com/q/27000031
tagged with: spring
tagged with: java
has title: Spring Data Neo4j Rest displays StartNode and EndNode when GETting entities via REST
type: Question
has comment: http://stackoverflow.com/comment/42530274
score: 0
tagged with: spring-data-rest
answer count: 1
has answer: http://stackoverflow.com/a/27015927
has body: I have a very simple issue with spring-data-neo4j-rest : since I put a @RelatedToVia relation in my @NodeEntity, @StartNode and @EndNode appeared in my GETs on that @Entity like in the following JSON : { "_embedded":{ "fields":[ { "label":"Field 1", "_links":{ "self":{ "href":"http://localhost/fields/5" }, "startField":{ "href":"http://localhost/fields/5/startField" }, "endField":{ "href":"http://localhost/fields/5/endField" }, "fieldValues":{ "href":"http://localhost/fields/5/fieldValues" }, "form":{ "href":"http://localhost/fields/5/form" } } } ] } } My question is : why does this happen as startnode and endnode are not part of the nodeentity and how can I prevent this behaviour from happening ? Sorry in advance if my question is not well formed, first question here, I will edit if asked to. Thank you ! ==== ADDITIONAL INFO ==== Here is my application @Configuration @EnableNeo4jRepositories @Import(RepositoryRestMvcConfiguration.class) @EnableAutoConfiguration public class Application extends Neo4jConfiguration { public Application() { setBasePackage("com.oliverstore.badger.server"); } @Bean(destroyMethod = "shutdown") public GraphDatabaseService graphDatabaseService() { return new GraphDatabaseFactory().newEmbeddedDatabase("/opt/ostore/badger/data/badger-server.db"); } public static void main(String[] args) { SpringApplication.run(Application.class, args); } } To be shorter I will only paste here the one NodeEntity and RelationshipEntity who are issues. Node : @NodeEntity public class Field { @GraphId private Long id; @Indexed(unique = true) private String label; @RelatedTo(type="HAS_FIELD", direction=Direction.BOTH) private @Fetch Form form; @RelatedTo(type="HAS_VALUE", direction=Direction.BOTH) private @Fetch Set&lt;FieldValue&gt; fieldValues = new HashSet&lt;FieldValue&gt;(); @RelatedToVia(type="EVENTS_WITH") @Fetch private Set&lt;Event&gt; events = new HashSet&lt;Event&gt;(); public String getLabel() { return label; } public void setLabel(String label) { this…
tagged with: spring-data-neo4j
tagged with: rest
type: UnansweredQuestion

http://stackoverflow.com/comment/42726159
score: 0
has text: @Panayiotis I added an example. Correction: "checking if the type is assignable from the item type" (i.e. the reverse but the idea is the same).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27111519

http://stackoverflow.com/comment/42518705
type: Comment
comment on: http://stackoverflow.com/q/26993949
has text: @LastFreeNickname I apologize, I missed that line. It's set up like this: catch(Exception e){ e.printStackTrace(); }
score: 0
type: QuestionComment

http://stackoverflow.com/a/27138640
has comment: http://stackoverflow.com/comment/46809596
has comment: http://stackoverflow.com/comment/51369823
has comment: http://stackoverflow.com/comment/46806938
has comment: http://stackoverflow.com/comment/81633034
downvote count: 1
upvote count: 17
answers question: http://stackoverflow.com/q/27031244
has comment: http://stackoverflow.com/comment/51378355
type: Answer
has body: I've just fixed this issue in JDK9 and JDK8u45. See this bug. The change will take a little while to percolate into promoted builds. Dan just pointed me at this Stack Overflow question, so I'm adding this note When you find bugs, please do submit them. I addressed this by having the compiler create a bridge, as is the approach for many cases of complex method references. We are also examining spec implications.
score: 16

http://stackoverflow.com/q/27074430
favorite count: 0
upvote count: 8
downvote count: 2
score: 6
has title: Null Check throws NullPointerException
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8970008
has comment: http://stackoverflow.com/comment/42660483
has comment: http://stackoverflow.com/comment/42660523
tagged with: java
accepted answer: http://stackoverflow.com/a/27075089
has comment: http://stackoverflow.com/comment/42660646
type: Question
possible better answer: http://stackoverflow.com/a/27074590
answer count: 2
tagged with: null
has answer: http://stackoverflow.com/a/27074590
has body: Sometimes it happens that I have written a code to check NullPointerException like below, if(str!=null) { doSomething(); } and the null check itself throws NUllPointerException. How to solve it. Edited: Actually this code was getting null pointer, Map params = new HashMap(); if(params != null &amp;&amp; params.get("requestType")) { //some null safe code goes here } i understood later that params.get() was throwing null pointer exception.
tagged with: nullpointerexception
tagged with: exception
has comment: http://stackoverflow.com/comment/42705490
has answer: http://stackoverflow.com/a/27075089
linked to: http://stackoverflow.com/q/2601978

http://stackoverflow.com/a/27057549
has body: I'm not sure, but you possibly need to initialise the list for the first entry? public List&lt;String&gt; getSelected() { if (!selectedSubjects.containsKey(selectedRole)) { selectedSubjects.put(selectedRole, new ArrayList&lt;String&gt;()); } return selectedSubjects.get(selectedRole); } public void setSelected(final List&lt;String&gt; sel) { List&lt;String&gt; selected = getSelected(); selected.clear(); selected.addAll(sel); }
answers question: http://stackoverflow.com/q/27040304
type: Answer
score: 0

http://stackoverflow.com/a/27094753
answers question: http://stackoverflow.com/q/27094597
type: Answer
score: 0
has body: int [][] arr = new int[x][y]; for(int i = 0; i &lt; x; i++) { // it will run you through the lines for(int j = 0; j &lt; y; j++) { // this will run you through each cell in the raw selected arr[i][j] = &lt;the thing you want to fill here&gt; ; } } you can look at a matrix as an array of arrays the first for is to run trough the array the second is for the cells in each array

http://stackoverflow.com/a/27134365
has body: You can use TranslateAnimation in your thread, Checkout here and here for more information ImageView img_animation = (ImageView) findViewById(R.id.img_animation); TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f, 0.0f, 0.0f); // new TranslateAnimation(xFrom,xTo, yFrom,yTo) animation.setDuration(5000); // animation duration animation.setRepeatCount(5); // animation repeat count animation.setRepeatMode(2); // repeat animation (left to right, right to left ) //animation.setFillAfter(true); img_animation.startAnimation(animation); // start animation
answers question: http://stackoverflow.com/q/27134216
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27134216
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42648096
type: AnswerComment
score: 0
type: Comment
has text: In particular, it would have been nice if I could pass a Clock to the constructor and then set that clock to different values. Unfortunately (at least in this case), Clock is immutable.
comment on: http://stackoverflow.com/a/27067090

http://stackoverflow.com/comment/42557670
comment on: http://stackoverflow.com/a/27005751
type: Comment
has text: I understood that you were looking for this:
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42732196
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27114658
has text: http://stackoverflow.com/questions/13640833/why-different-types-of-object-reference-is-allowed-in-java Check this question.

http://stackoverflow.com/comment/42750074
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27124937
has text: why you save byte value which may be happen out of memory problem ?
score: 1

http://stackoverflow.com/comment/42591625
type: QuestionComment
has text: Plese [edit your question](https://stackoverflow.com/posts/27035435/edit) if you want to add code.
comment on: http://stackoverflow.com/q/27035435
score: 0
type: Comment

http://stackoverflow.com/a/27005856
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27005835
has body: You are returning null outside the method, you need to return inside getHungryPeople() in case values is null. public int[] getHungryPeople() { // Get hungry people data from the class's Android Intent field final int[] values = mIntent.getIntArrayExtra( HUNGRY_PEOPLE ); if ( null != values ) { return Arrays.copyOf( values, values.length ); } // if values is null, return null return null; }
accepted answer of: http://stackoverflow.com/q/27005835

http://stackoverflow.com/a/27121140
type: Answer
has body: It can not stop since you don't check boolean stopped in your run method. Move it inside : public void run() { elapsedTime = System.currentTimeMillis() - startTime; updateTimer(elapsedTime); if(!stopped) { mHandler.postDelayed(this, REFRESH_RATE); } } and also consider declaring stopped as volatile as per suggestion in the comments.
answers question: http://stackoverflow.com/q/27120010
score: 0

http://stackoverflow.com/comment/42776631
comment on: http://stackoverflow.com/q/27139411
score: 2
has text: Read the `Pattern` class javadoc.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42561900
type: QuestionComment
has text: What format is used to send objects? Is it a standard serialization?
score: 0
comment on: http://stackoverflow.com/q/27018239
type: Comment

http://stackoverflow.com/comment/42654493
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27057303
score: 0
has text: java agent is a different jar that has only the transformer class and class containing premain method. My all other classes are in original jar that is running without agent.

http://stackoverflow.com/q/27062491
type: Question
accepted answer: http://stackoverflow.com/a/27062602
has answer: http://stackoverflow.com/a/27062602
tagged with: jsoup
answer count: 1
downvote count: 0
favorite count: 0
has title: How to know which text Jsoup remove?
type: AnsweredQuestion
has body: I have the following text: text&lt;html/&gt;text And use Jsoup library in order to clean up text from html content. Namely like code below: Document clean = new Cleaner(none()).clean(myDirtyDoc); I am going to log error for user like: Malisious content was specified: "&lt;html/&gt;". But I don't know how properly identify line that Jsoup was clean. I've tried to use StringUtils.difference(cleanedValue, value), but this method works in another way, namely documentation says: Compares two Strings, and returns the portion where they differ. (More precisely, return the remainder of the second String, starting from where it's different from the first.) As result it return string like this: &lt;html/&gt;text. Will be good to know any diff tools that can be easily used in java for comparing strings.
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/42796005
comment on: http://stackoverflow.com/q/27150118
score: 0
type: Comment
type: QuestionComment
has text: @user2267921 Normal i look up my page as http://localhost:8080/mywar/index.jsp, but after made Resteasy as servlet i couldn't able to access the jsp page but able to access the resteasy method from url http://localhost:8080/mywar/myrest/test

http://stackoverflow.com/q/27074054
type: Question
answer count: 1
upvote count: 6
favorite count: 0
has title: Number of threads for NioEventLoopGroup with persistent connections
tagged with: sockets
accepted answer: http://stackoverflow.com/a/27088833
tagged with: netty
linked to: http://stackoverflow.com/q/54818568
downvote count: 0
tagged with: tcp
has answer: http://stackoverflow.com/a/27088833
has body: I would like to use Java Netty to create a TCP server for a large number of persistent connections from a clients. In other words, imaging that there are 1000 client devices out there, and all of them create and maintain a persistent connection to the TCP server. There will be a reasonable amount of traffic (mostly lines of text) that go back and forth across each of these persistent connections. How can I determine the best number of threads to use in the boss and worker groups for NioEventLoopGroup? My understanding is that when the connection is created, Netty creates a SimpleChannelInboundHandler&lt;String&gt; object to handle the connection. When the connection is created then the handler channelActive method is called, and every time it gets a new message from the client, the method messageReceived gets called (or channelRead0 method in Netty 4.0.24). Is my understanding correct? What happens if I have long running code to run in messageReceived - do I need to launch this code in yet another thread (java.util.Thread)? What happens if my messageReceived method blocks on something or takes a long time to complete? Does that bring Netty to a grinding halt? Basically I need to write a TCP socket server that can serve a large number of persistent connections as quickly as possible. Is there any guidance available on number of threads for NioEventLoopGroup and on how to use any threads inside the handler? Any help would be greatly appreciated.
score: 6
type: AnsweredQuestion
tagged with: java
tagged with: nio

http://stackoverflow.com/q/27044377
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27044764
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42607746
score: 0
answer count: 1
favorite count: 0
has title: How can I msg to skype?
tagged with: msg
tagged with: android
tagged with: skype
has answer: http://stackoverflow.com/a/27044764
has body: How can it send a msg to someone written in the application, I have the java down below but this one asks me to write the name that I skype msg to ((Button) findViewById(R.id.skypemsg)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String skypeName = ((EditText) findViewById(R.id.edt_skypeusername)).getText().toString().trim(); if(skypeName.length()&lt;=0) { Toast.makeText(getApplicationContext(), "Please enter skype username to message", Toast.LENGTH_SHORT).show(); } else { String mySkypeUri = "skype:"+skypeName+"?chat"; SkypeUri(MainActivity.this, mySkypeUri); } } });
type: AnsweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42607611

http://stackoverflow.com/q/27026733
accepted answer: http://stackoverflow.com/a/27027460
has comment: http://stackoverflow.com/comment/42577292
has comment: http://stackoverflow.com/comment/42577136
has comment: http://stackoverflow.com/comment/42577456
upvote count: 2
has comment: http://stackoverflow.com/comment/42577374
downvote count: 1
has comment: http://stackoverflow.com/comment/42577389
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42577359
has title: ArrayHeap Class not returning sorted array
has comment: http://stackoverflow.com/comment/42576679
has answer: http://stackoverflow.com/a/27027460
has comment: http://stackoverflow.com/comment/42576847
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/42577278
score: 1
has body: I'm using java. Here is the code for my class: /** * Ensure that the ordering property of the heap holds after * the insertion of an new element into the heap. */ private void interchangeUp() { int current = size - 1; int parent = (current - 1) / 2; while(parent &lt;= 0 &amp;&amp; heapForm[current].compareTo(heapForm[parent]) &lt; 0) { swap(parent, current); current = parent; parent = (current - 1) / 2; } } I've looked over my code and can't seem to figure out what is causing this issue. Can anyone help me out?
favorite count: 0
has comment: http://stackoverflow.com/comment/42577339
tagged with: heap

http://stackoverflow.com/q/27135390
has comment: http://stackoverflow.com/comment/42769053
has answer: http://stackoverflow.com/a/27135478
score: 0
linked to: http://stackoverflow.com/q/9554636
answer count: 1
has body: I created a JFrame with buttons, labels and texts and I want to show it two times when I execute the main program, so I did like that: import java.net.SocketException; public class Main { public static void main(String[] args) throws SocketException { new MyFrame("client1"); new MyFrame("client2"); } } The result: I get two frames: one with the component of the other one inside, and one empty. How to resolve this issue?
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/42777679
accepted answer: http://stackoverflow.com/a/27135478
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42769041
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
has title: Instead of getting two similar JFrames, I get one whith double component

http://stackoverflow.com/comment/42627862
score: 1
has text: @ajb Thank you for your comment. I know that, that's why we use url mapper via xml (url ->component,command). I wrote "taken from url" to pass the idea.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27055752

http://stackoverflow.com/comment/42680664
comment on: http://stackoverflow.com/a/27085878
type: Comment
has text: Thanks. I can drag the invisible components around, but I overlap the visible components to where I want the invisible components to be.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27111344
has body: My question is related to this post and a post of mine . I am trying to pass REF_CURSOR as an IN parameter while calling a PL/SQL procedure using JDBC. Here is my code: public int printMaxSalAllDept() { Connection conn = null; OracleCallableStatement callStmt = null; int rowCount = -1; try { // Register the Jdbc Driver // Class.forName(JDBC_DRIVER_ORACLE); // Create a Database connection conn = DriverManager.getConnection(DB_URL,DB_USER,DB_PWD); // Create a query string to get the ResultSet of your choice String getRsQuery = "SELECT e.department_id , e.last_name , " + "e.salary FROM employees e , (SELECT department_id , " + "MAX(salary) AS maxSal FROM employees GROUP BY department_id) " + "m WHERE e.department_id = m.department_id " + "AND e.salary = m.maxSal ORDER BY e.salary"; // Create a Statement Statement stmt = conn.createStatement(); // Execute the statement ResultSet rs = stmt.executeQuery(getRsQuery); // Create a SQL String String callProc = "{ call HR.EMP_PKG.print_max_sal_all_dept(? , ?) }"; // Create a Callable Statement callStmt = (OracleCallableStatement) conn.prepareCall(callProc); // Bind values to the IN parameter callStmt.setCursor(1, rs); // callStmt.setNull(1,OracleTypes.CURSOR); // Register OUT parameters type to the SQL type of the value returned callStmt.registerOutParameter(2, java.sql.Types.NUMERIC); // Execute Callable Statements callStmt.execute(); // Retrieve value from the OUT parameters rowCount = callStmt.getInt(0); System.out.println("Number of rows in the cursor :" + rowCount); } catch (SQLException se) { System.out.println("Exception occured in the database"); System.out.println("Exception message: "+ se.getMessage()); System.out.println("Database error code: "+ se.getErrorCode()); se.printStackTrace(); } finally { // Clean up if(callStmt != null) { try { callStmt.close(); } catch (SQLException se2) { se2.printStackTrace(); } } if(conn != null) { try { conn.close(); } catch (SQLException se2) { se2.printStackTrace(); } } } return ro…
type: Question
has answer: http://stackoverflow.com/a/27138458
accepted answer: http://stackoverflow.com/a/27138458
has comment: http://stackoverflow.com/comment/42760071
linked to: http://stackoverflow.com/q/27051271
score: 0
has comment: http://stackoverflow.com/comment/42727022
has comment: http://stackoverflow.com/comment/42745371
tagged with: jdbc
answer count: 1
has comment: http://stackoverflow.com/comment/42726145
linked to: http://stackoverflow.com/q/2673626
tagged with: exception
has comment: http://stackoverflow.com/comment/42725846
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42760168
tagged with: java
has title: What does "java.sql.SQLException: Unsupported feature" mean?
has comment: http://stackoverflow.com/comment/42763525
tagged with: oracle11g

http://stackoverflow.com/comment/42738179
score: 0
type: AnswerComment
type: Comment
has text: That could be one thing, but that the `internal` and `external` methods that call for `(File folder, String name)` as the parameters just kind of sit there for now.; I just use the path currently to register my files, so that would make no difference.
comment on: http://stackoverflow.com/a/27118001

http://stackoverflow.com/a/55389621
answers question: http://stackoverflow.com/q/27022741
downvote count: 0
type: Answer
has body: you can use 1.response.sendRedirect("redirect.html") or 2.String path= "/redirect"; RequestDispatcher dispatcher =servletContext().getRequestDispatcher(path); dispatcher.forward(request,response);
upvote count: 1
score: 1

http://stackoverflow.com/comment/42625576
type: AnswerComment
comment on: http://stackoverflow.com/a/27054103
type: Comment
has text: @RogueBaneling how would i have 3 methods print on same line? if a user types 101 the output would be ONE HUNDRED AND ONE
score: 0

http://stackoverflow.com/comment/42722996
has text: just something like - cant get ad, or something. Same info on the linux (fresh system) and win 8.1 so its not firewall problem. So i did not see banner in the application and i dont know what to do.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27109961
score: 0

http://stackoverflow.com/q/27043553
has title: Where org.reflections takes package from if i pass empty?
tagged with: testng
score: 0
has answer: http://stackoverflow.com/a/27045309
answer count: 1
tagged with: parameters
tagged with: reflection
tagged with: java
accepted answer: http://stackoverflow.com/a/27045309
has body: i am having a problem when using reflections. I have this code in a project, which is implemented as maven dependency by other projects to find testNG test classes. So, as i haven't got a particular package, i was passing it empty and it was finding successfully classes i want when i execute locally. Here is my code: String pack = StringUtils.EMPTY; this.reflections = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage(pack)).setScanners( new MethodAnnotationsScanner())); this.testNGTests = this.reflections.getMethodsAnnotatedWith(org.testng.annotations.Test.class); But i have the problem that when i execute it remotely it can't find any classes. So i was thinking that i must pass it something at package parameter. So, i want to know if any of you have and idea about that happens behind reflections when i pass empty package and why is working. Do you know something that could help me? Thank you!
type: AnsweredQuestion
type: Question

http://stackoverflow.com/q/27152495
tagged with: arrays
has body: I am parsing a JSON as shown below [ { "vendor_itms_arr": [ "265", "141", "148" ] } ] This is my program import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class MrTest { public static void main(String args[]) throws JSONException { String json = "[\r\n" + " {\r\n" + " \"vendor_itms_arr\": [\r\n" + " \"265\",\r\n" + " \"141\",\r\n" + " \"148\"\r\n" + " ]\r\n" + " }\r\n" + "]"; JSONArray array = new JSONArray(json); ArrayList&lt;Integer&gt; vendor_itms_arr = new ArrayList&lt;Integer&gt;(); for(int i=0;i&lt;array.length();i++) { JSONObject jb1 = array.getJSONObject(i); JSONArray jr1 = jb1.getJSONArray("vendor_itms_arr"); if (jr1 != null) { int len = jr1.length(); for (int k=0;i&lt;len;i++){ int val = (Integer) jr1.get(k); vendor_itms_arr.add(val); } } } System.out.println(vendor_itms_arr); } } I am getting Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at MrTest.main(MrTest.java:36) Could you please let me know how can i construct a array int constructed_array[] = { 265 , 141 , 148};
possible better answer: http://stackoverflow.com/a/27152560
linked to: http://stackoverflow.com/q/960431
score: 0
accepted answer: http://stackoverflow.com/a/27152723
has comment: http://stackoverflow.com/comment/42799507
has answer: http://stackoverflow.com/a/27152723
has answer: http://stackoverflow.com/a/27152560
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42799630
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Parse Json and construct an array
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/5585779

http://stackoverflow.com/comment/68481095
score: 0
type: Comment
type: QuestionComment
has text: I'm almost sure I actually clicked "flag" and selected duplicate option... why did it make a comment? I don't think this is something that can be really fixed without moderator doing something. Sometimes I've seen it done by merging questions. And it may not need fixing (these questions are similar but are stated differently and the actual problemthat I originally had was different)
comment on: http://stackoverflow.com/q/27008503

http://stackoverflow.com/a/27141345
has comment: http://stackoverflow.com/comment/42780077
has body: The Exception class already has a getMessage() method. Why not just use it? public class Foo { public static void main(String[] args) { try { MiExcepcion e = new MiExcepcion("Este es mi propio error."); throw e; } catch (MiExcepcion e) { System.out.println("Excepción: " + e.getMessage()); } } } class MiExcepcion extends Exception { public MiExcepcion(String message) { super(message); } // Not needed // public String getmessage(String message)throws MiExcepcion // { // return message; // } } Note that capitalization matters, and that getmessage() will not work while getMessage() will.
has comment: http://stackoverflow.com/comment/42780035
score: 0
has comment: http://stackoverflow.com/comment/42780024
answers question: http://stackoverflow.com/q/27141310
type: Answer

http://stackoverflow.com/comment/42711044
has text: This uses a "side effect". The method called `is...` is not just a test, it sets a field. That's a bit nasty.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/27103372
type: AnswerComment

http://stackoverflow.com/comment/42754445
type: Comment
type: QuestionComment
has text: You're not comparing the right thing: http://stackoverflow.com/questions/1040868/java-syntax-and-meaning-behind-b1ef9157-binary-address
comment on: http://stackoverflow.com/q/27127526
score: 0

http://stackoverflow.com/comment/42695088
has text: @dummyDroid I have edited my original response and added the full source for the class. I am able to parse the original json and then the newer ShardsResponse json string. I did have to add a no args constructor for ShardsResponse since jackson requires it.
type: AnswerComment
comment on: http://stackoverflow.com/a/27094081
score: 0
type: Comment

http://stackoverflow.com/q/27041010
upvote count: 1
has title: Passing Data between Java Classes
has answer: http://stackoverflow.com/a/27041825
type: Question
has answer: http://stackoverflow.com/a/27041442
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27041825
downvote count: 0
has answer: http://stackoverflow.com/a/27041118
favorite count: 0
tagged with: colors
answer count: 3
has body: I'm having trouble retrieving the variable from my Colour class after i send the index from the GUI after selecting a colour from the drop down list. I can send the index fine and retrieve it from the HashMap, i know this because i use System.out.println to check. Basically my questions are, where have i gone wrong? and What do i need to remember to make sure i don't have this trouble again? Edit: forgot to mention, the button sending the index is in a seperate JPanel which is used for the UI components(buttons and combo boxes). //edit class UIPanel extends JPanel{ public MainPanel gpanel; public Integer data; public Color colval; public Colour col; public UIPanel(MainPanel panel) { col = new Colour(); gpanel = panel; Box btnBox = Box.createHorizontalBox(); btnBox.add(setBtn = new JButton()); btnBox.add(Box.createHorizontalGlue()); JButton setBtn = new JButton("Set"); final DefaultComboBoxModel colour = new DefaultComboBoxModel(); colour.addElement("Red"); final JComboBox colours = new JComboBox(colour); JScrollPane colourScroll = new JScrollPane(colours); btnBox.setSize(300, 100); btnBox.add(Box.createHorizontalGlue()); add(btnBox, BorderLayout.NORTH); //end of edit Button to send Index from GUI class to Colour class setBtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { data= colours.getSelectedIndex(); col.setCol(data); } }); Colour Class where hashmap with the list of colours in. public class Colour{ public Color colVal; HashMap&lt;Integer, Color&gt; map = new HashMap&lt;Integer, Color&gt;(); public Colour() { map.put(0, Color.RED); map.put(1, Color.BLUE); map.put(2, Color.YELLOW); map.put(3, Color.GREEN); } public Color setCol(Integer data) { //Color colours; colVal = map.get(data); System.out.println("colour" + colVal); return colVal; } public Color getColVal() { return colVal; } And the paint area on the GUI class where the colour will be sent to from the colour class class MainPanel extends JPanel{ //private Colour col; i…
type: AnsweredQuestion
tagged with: paint
accepted answer: http://stackoverflow.com/a/27041118

cycle
tags question: http://stackoverflow.com/q/27084934
type: Tag
tag name: cycle

http://stackoverflow.com/q/27143255
upvote count: 2
accepted answer: http://stackoverflow.com/a/27143967
type: Question
has title: Boolean field Oracle vs MySQL
type: AnsweredQuestion
tagged with: entity-framework
tagged with: java
tagged with: hibernate
tagged with: mysql
possible better answer: http://stackoverflow.com/a/27144000
answer count: 2
has body: I am using hibernate to create tables. In my entity I have following fields. This entity is successfully created when I use MySQL database. but on oracle 10g it throws error create table MetaData (ID bigint not null auto_increment, metaDataId varchar(255) not null, parentId bigint not null, locked bit, userId bigint not null, primary key (ID), unique (metaDataId)) java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis Entity: @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorOptions(force = true) @Table(name = "MetaData", uniqueConstraints = @UniqueConstraint(columnNames = "metaDataId")) public class MetaData extends SavableEntity { @Column(nullable = false) private String metaDataId; @Column(nullable = false) private Long parentId; @Column(nullable = false) private Long userId; @Column @Type(type = "boolean") private boolean locked; } Any idea what could be wrong?
has answer: http://stackoverflow.com/a/27144000
downvote count: 0
favorite count: 0
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/42783152
has answer: http://stackoverflow.com/a/27143967
score: 2

http://stackoverflow.com/comment/42527228
type: QuestionComment
type: Comment
has text: What do you mean "did not work"? I've just checked and it works for me.
comment on: http://stackoverflow.com/q/26992165
score: 0

sorting
tags question: http://stackoverflow.com/q/27031294
tags question: http://stackoverflow.com/q/27012415
tags question: http://stackoverflow.com/q/27084425
tags question: http://stackoverflow.com/q/27054896
tags question: http://stackoverflow.com/q/27048309
tags question: http://stackoverflow.com/q/27072409
tags question: http://stackoverflow.com/q/27119768
tags question: http://stackoverflow.com/q/27035435
tags question: http://stackoverflow.com/q/27146973
tags question: http://stackoverflow.com/q/26995607
tags question: http://stackoverflow.com/q/27133052
tags question: http://stackoverflow.com/q/27094848
tags question: http://stackoverflow.com/q/27116345
tags question: http://stackoverflow.com/q/27029296
tags question: http://stackoverflow.com/q/27008937
type: Tag
tags question: http://stackoverflow.com/q/27079075
tags question: http://stackoverflow.com/q/27082232
tags question: http://stackoverflow.com/q/27029881
tags question: http://stackoverflow.com/q/27062497
tags question: http://stackoverflow.com/q/27082966
tags question: http://stackoverflow.com/q/27089073
tags question: http://stackoverflow.com/q/27123499
tags question: http://stackoverflow.com/q/27151960
tag name: sorting
tags question: http://stackoverflow.com/q/27018434
tags question: http://stackoverflow.com/q/27138895
tags question: http://stackoverflow.com/q/27139265
tags question: http://stackoverflow.com/q/27127691
tags question: http://stackoverflow.com/q/26995080
tags question: http://stackoverflow.com/q/27076767
tags question: http://stackoverflow.com/q/27117732
tags question: http://stackoverflow.com/q/27050398
tags question: http://stackoverflow.com/q/27096968
tags question: http://stackoverflow.com/q/27030257
tags question: http://stackoverflow.com/q/27120208

http://stackoverflow.com/a/27134531
type: Answer
has comment: http://stackoverflow.com/comment/42913007
has comment: http://stackoverflow.com/comment/59630581
downvote count: 1
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/27133797
has body: You need the Gson jar file in the Tomcat classpath during runtime and in the classpath of your development environment for compilation.

http://stackoverflow.com/comment/42795075
type: QuestionComment
score: 2
has text: What is the value of FROM_DATE
type: Comment
comment on: http://stackoverflow.com/q/27150278

http://stackoverflow.com/a/27142794
has comment: http://stackoverflow.com/comment/42782672
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Arrays.asList is defined as having parameter T..., and the body will see it as one argument of type T[]. However, T must be a reference type (like any type parameter), and int is not a reference type. Because of that, there's no way to make new int[]{...} compatible with an array for varargs purposes. (And the result would be List&lt;int&gt; which isn't allowed.) The only alternative is to treat it as a single object, and thus T here will be int[], which is a reference type, and the function will return a List&lt;int[]&gt;. I think that's the reason, although I would still need to look up the exact language. It probably involves the type inference rules, which I haven't mastered. However, I did try this: List x = Arrays.asList(new int[]{1, 2, 3}); List y = Arrays.asList(new Integer[]{1, 2, 3}); System.out.println(x.size()); System.out.println(y.size()); (note that I deliberately used a List raw type, something I wouldn't do in real code). The output: 1 3
accepted answer of: http://stackoverflow.com/q/27142662
answers question: http://stackoverflow.com/q/27142662

http://stackoverflow.com/comment/42800239
comment on: http://stackoverflow.com/a/27152725
type: AnswerComment
type: Comment
score: 0
has text: @hakiko it seems like the problem is not related with Google Analytics. The error seems to indicate that GoogleAnal cannot be casted to Application. Try calling ((GoogleAnal) getApplication()) to know if your problem is related with Analytics or not.

http://stackoverflow.com/comment/42650743
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27068280
type: Comment
has text: I've edited the code, see above. I think ive changed what youve said, but still can you double check where i'm still going wrong. @Makoto

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

http://stackoverflow.com/comment/42654922
type: Comment
has text: @MarkLang You're welcome! You already marked the answer as accepted :) I just didn't want to leave your comments unanswered.
type: AnswerComment
comment on: http://stackoverflow.com/a/27046618
score: 0

http://stackoverflow.com/a/27035343
has comment: http://stackoverflow.com/comment/42592248
score: 0
answers question: http://stackoverflow.com/q/27035156
has comment: http://stackoverflow.com/comment/42591631
type: Answer
has body: Change you code by this, private class MyAdapter extends ArrayAdapter&lt;String&gt; { public MyAdapter(Context context, String[] strings) { super(context, -1, -1, strings); } @Override public View getView(int position, View convertView, ViewGroup parent) { //trying to reuse a recycled view ViewHolder holder; if(convertView == null){ holder = new ViewHolder(); LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.yourlayout, null); LinearLayout linear = (LinearLayout) convertView.findViewById(R.id.lnlayout); linear.setLayoutParams(new AbsListView.LayoutParams( AbsListView.LayoutParams.WRAP_CONTENT, AbsListView.LayoutParams.WRAP_CONTENT)); holder.tv = (TextView) convertView.findViewById(R.id.lnlayout); holder.rbg = (RadioGroup) convertView.findViewById(R.id.lnlayout); convertView.setTag(holder); } else{ holder = (ViewHolder) convertView.getTag() } linear.setId(50); holder.tv.setId(100); holder.rbg.setId(200); holder.rbg.setOrientation(LinearLayout.HORIZONTAL); holder.rbg.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { } }); //Make the list Items containing radiobuttons en textviews. for (int i = 0; i &lt; 5; i++) { holder.rName = new RadioButton (Bouwonderdeel.this); holder.rbg.addView(holder.rName); } } else{ holder = (ViewHolder) v.getTag(); } linear.addView(holder.rbg); linear.addView(holder.tv); holder.tv.setText(super.getItem(position)); return convertView; } } hope it will help you
has comment: http://stackoverflow.com/comment/42592506
has comment: http://stackoverflow.com/comment/42592683
has comment: http://stackoverflow.com/comment/42592773

http://stackoverflow.com/comment/42652306
has text: Possibly related: http://stackoverflow.com/questions/26960487/cant-connect-to-admin-console-using-virtualbox - make sure the 9990 port is not used by another application.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27069610
score: 1

http://stackoverflow.com/q/27065700
has answer: http://stackoverflow.com/a/27163963
accepted answer: http://stackoverflow.com/a/27163963
tagged with: android
has comment: http://stackoverflow.com/comment/42669260
has body: I'm trying display a image with keypoints detected. In my code, i get a list of key points, my i can't display the image on screen. I think that my problem is on converting the image to bitmap from MAT. What i'm doing wrong ? Here is my code: Mat teste = new Mat(); Mat mRgba = teste.clone(); Mat outputMat = new Mat(); BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable(); Bitmap bitmap = drawable.getBitmap(); Utils.bitmapToMat(bitmap, teste); MatOfKeyPoint myKeyPoints = new MatOfKeyPoint(); FeatureDetector orb = FeatureDetector.create(FeatureDetector.ORB); orb.detect(teste, myKeyPoints); List&lt;KeyPoint&gt; referenceKeypointsList = myKeyPoints.toList(); Imgproc.cvtColor(teste, mRgba, Imgproc.COLOR_RGBA2RGB,4); Features2d.drawKeypoints(mRgba, myKeyPoints, mRgba, new Scalar(2,254,255), Features2d.DRAW_RICH_KEYPOINTS); Imgproc.cvtColor(mRgba, outputMat, Imgproc.COLOR_RGB2RGBA); Utils.matToBitmap(outputMat, bitmap); imageView.setImageBitmap(bitmap);
tagged with: opencv
type: AnsweredQuestion
has title: Display Keypoints on Image in Android - OpenCV
tagged with: java
has comment: http://stackoverflow.com/comment/42668981
tagged with: feature-detection
tagged with: keypoint
type: Question
has comment: http://stackoverflow.com/comment/42669009
answer count: 1
has comment: http://stackoverflow.com/comment/42668204
linked to: http://stackoverflow.com/q/26515981
has comment: http://stackoverflow.com/comment/42669357
score: 0

http://stackoverflow.com/q/27115929
has body: I used the JFileChooser in my app. My question is if the user typing file name without the file extension on the dialog box; the app will allow more another file extension. How can I get the file extension on the file as type drop down box. I used fileChooser.getSelectedFile().getName() or fileChooser.getSelectedFile().getAbsolutePath() didn't get the extension. Would someone help me how to do it. There is my code: @SuppressWarnings("static-access") private String getSavedFileName() { String rtnValue=""; JFileChooser fileChooser = new JFileChooser(); String PDFEXTENSION= "pdf"; FileNameExtensionFilter pdfType=new FileNameExtensionFilter("PDF File (."+ PDFEXTENSION + ")", PDFEXTENSION); fileChooser.addChoosableFileFilter(pdfType); fileChooser.setFileFilter(pdfType); //clear "All files" from dropdown filter box fileChooser.setAcceptAllFileFilterUsed(false); int returnVal = fileChooser.showSaveDialog(this.splitRightPane); if (returnVal == fileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); // String extension = file.getName().substring(file.getName().lastIndexOf(".") + 1, file.getName().length()); String fileAbsolutePath=file.getName(); file.getAbsolutePath() String extension =fileAbsolutePath.substring(fileAbsolutePath.lastIndexOf(".") + 1, fileAbsolutePath.length() ); if ( PDFEXTENSION.equalsIgnoreCase(extension)){ rtnValue=fileAbsolutePath; } else{ Utility.DisplayWarningMsg("Only PDF File"); } } else if (returnVal == JFileChooser.CANCEL_OPTION ) { // Do something else } return rtnValue; }
tagged with: java
type: UnansweredQuestion
has title: How to get the file extension in JfileChooser if the user input the filename without extension
score: 2
answer count: 0
downvote count: 0
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/67746990
has text: Using `X-` is discourged these days. Just go with `API-Key`.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/40241988
type: AnswerComment

http://stackoverflow.com/comment/42671232
has text: @Douglas Huh? If you have a flat array, to access the `(i,j)` element is `ptr[i * RowSize + j]` (simplified obviously). To do the same for a ragged array we have `tmp = ptr[i]; tmp[j]` - quite clearly there's two memory accesses there - worse of all the later even has a dependency on the first. Hence if you access a large array randomly (or do enough work on each accessed element to flush the cacheline) you do get a second cache miss.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27079644
type: QuestionComment

http://stackoverflow.com/comment/42782520
comment on: http://stackoverflow.com/a/27059656
has text: have you called open method after initialising?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27013729
has body: AssetManager.load() will add an asset (such as TextureAtlas) to the load queue. AssetManager.finishLoading() will create/construct assets that are in the load queue. AssetManager.update() will do the same as above if called in succession until it returns true. AssetManager.get() will return the created/existing asset, it will not create a new one.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27010519

http://stackoverflow.com/a/27091881
type: Answer
answers question: http://stackoverflow.com/q/27091661
downvote count: 1
score: -1
has body: You can use an existing framework for tests that has a lot of common assertions in it.
upvote count: 0

http://stackoverflow.com/comment/96877479
type: Comment
score: 0
comment on: http://stackoverflow.com/a/45506857
has text: As noted below by @张浩然, both iso-8859-1 and windows-1252 have undefined characters. These really shouldn't be used.
type: AnswerComment

http://stackoverflow.com/comment/42531334
type: QuestionComment
has text: Is it possible it's because US dates aren't in that format? US dates are `MM/dd/yy` format usually.
score: 0
comment on: http://stackoverflow.com/q/27000555
type: Comment

http://stackoverflow.com/comment/42695599
comment on: http://stackoverflow.com/q/27082920
has text: Well for exemple, the jar file are placed into " C:\User\Desktop\Plugins" and i need to read the permission that would be stocked into "C:\User\Desktop\Plugins\plugins.jar\plugin.yml"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27042983
has comment: http://stackoverflow.com/comment/42614297
downvote count: 0
answers question: http://stackoverflow.com/q/27042668
has comment: http://stackoverflow.com/comment/42614692
has comment: http://stackoverflow.com/comment/42614865
has comment: http://stackoverflow.com/comment/42614726
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42614380
type: AcceptedAnswer
has body: If all you want to do is list the files inside that directory you can do it like this: File dir = Environment.getExternalStoragePublicDirectory(Environment .DIRECTORY_DOWNLOADS); String dirPath = dir.getAbsolutePath(); String[] files = dir.list(); for (String file : files) Log.e("", "File: " + file); Or like: File[] files = dir.listFiles(); for (File file : files) Log.e("", "File: " + file.getAbsolutePath());
has comment: http://stackoverflow.com/comment/42614769
type: Answer
has comment: http://stackoverflow.com/comment/42615112
accepted answer of: http://stackoverflow.com/q/27042668

http://stackoverflow.com/a/27010083
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27009878
has body: You have never written the myObj object to response. You have to use: response.getWriter().write(myObj.toString());
answers question: http://stackoverflow.com/q/27009878
has comment: http://stackoverflow.com/comment/42548010
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42702845
comment on: http://stackoverflow.com/q/27099099
score: 0
type: QuestionComment
type: Comment
has text: Right click on the project and see properties u will get where your project is stored on disk.

http://stackoverflow.com/a/27117792
has body: Because that's the definition of a finally block. It always happens, regardless of how the block is exited. Finally blocks exist for operations that SHOULD always be performed, like closing open streams and cleaning up socket connections. No matter how the block is exited, the code within the finally block should always be performed. If you want to skip code if the try block is exited successfully, then it belongs in a catch() block with an appropriate exception type.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27117764

http://stackoverflow.com/comment/42749175
comment on: http://stackoverflow.com/q/27124431
score: 1
has text: What's your approach? Share your attempts with us so you can get a better help.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42690493
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27075857
type: AnswerComment
has text: @MuthuKumar: When putting explicit wait, for above, the wait time ranges till 10 seconds. It means, whenever the alert comes into picture, may it be some milliseconds, or more than that (at max 10 seconds), then it will be switched to, and further actions will proceed hence. But, if you want to wait till some milliseconds try this code: `Alert a = new WebDriverWait(driver,0,500).until(ExpectedConditions.alertIsPresent());` It will wait for 500 milliseconds for the alert.

http://stackoverflow.com/a/27006428
answers question: http://stackoverflow.com/q/27006259
downvote count: 0
type: Answer
has body: You could use %d for decimal output (works for all integer types, not just int), but this will print the signed value (such as -100), which can be unexpected for a byte. You can also use %x for hexadecimal.
score: 1
upvote count: 1

http://stackoverflow.com/a/27052962
has comment: http://stackoverflow.com/comment/42623109
type: Answer
has body: Because String is not a Sub Class of A
answers question: http://stackoverflow.com/q/27052943
score: 0

http://stackoverflow.com/comment/42515737
type: AnswerComment
comment on: http://stackoverflow.com/a/26991987
type: Comment
has text: Ok so that is the difference between both of them now its clear to me +1 @fge :)
score: 0

http://stackoverflow.com/q/27087464
has answer: http://stackoverflow.com/a/27087918
type: AnsweredQuestion
has title: how to find new coordinates of a line after rotation in android?
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/27087918
type: Question
upvote count: 0
answer count: 1
has body: Click here to view the image From the above image how to find (?,?) this coordinate. I have used this coding in onDraw() method to get the above image. canvas.drawLine(600, 500, 600, 200, paint); //line 1 before rotaion canvas.rotate(20,600,500); canvas.drawLine(600, 500, 600, 200, paint); //line 2 after rotation How to get the new coordinates (?,?) as mentioned in the diagram above in android. Thanks in advance.
favorite count: 0
tagged with: android
score: -2

http://stackoverflow.com/comment/42594534
type: QuestionComment
has text: Should I clear all variables in OnPause ?
score: 0
comment on: http://stackoverflow.com/q/27037035
type: Comment

hql
tag name: hql
tags question: http://stackoverflow.com/q/27145331
tags question: http://stackoverflow.com/q/27021697
tags question: http://stackoverflow.com/q/26996987
tags question: http://stackoverflow.com/q/27099559
tags question: http://stackoverflow.com/q/27051866
type: Tag
tags question: http://stackoverflow.com/q/27150123
tags question: http://stackoverflow.com/q/27078774

http://stackoverflow.com/comment/42533936
type: QuestionComment
comment on: http://stackoverflow.com/q/27001959
has text: So how can i get Calender reference for other TimeZones.
score: 0
type: Comment

jsoup
tags question: http://stackoverflow.com/q/27012581
tags question: http://stackoverflow.com/q/27075992
tags question: http://stackoverflow.com/q/27060152
tags question: http://stackoverflow.com/q/27040626
tags question: http://stackoverflow.com/q/27049149
tags question: http://stackoverflow.com/q/26996207
tags question: http://stackoverflow.com/q/27075280
tags question: http://stackoverflow.com/q/27150489
tags question: http://stackoverflow.com/q/27027626
tags question: http://stackoverflow.com/q/27056182
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/27058023
tags question: http://stackoverflow.com/q/27091902
tags question: http://stackoverflow.com/q/27062491
tags question: http://stackoverflow.com/q/27142611

http://stackoverflow.com/comment/42765803
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27132112
type: AnswerComment
has text: ` `

http://stackoverflow.com/comment/42794387
type: AnswerComment
comment on: http://stackoverflow.com/a/27149279
type: Comment
has text: Why not getting the reference in the onCreate() method of the activity and then getting the text from it and sending it to the AsyncTask
score: 0

http://stackoverflow.com/comment/42799598
has text: The `equals` override. You might want to multiply the long by something odd, e.g., 31.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27152566

http://stackoverflow.com/q/27125951
type: Question
linked to: http://stackoverflow.com/q/12601596
tagged with: do-while
answer count: 2
has answer: http://stackoverflow.com/a/27126284
has comment: http://stackoverflow.com/comment/42751837
possible better answer: http://stackoverflow.com/a/27126284
has comment: http://stackoverflow.com/comment/42751797
tagged with: while-loop
has title: Do {} while ( , ) with comma operator, is that even possible?
has comment: http://stackoverflow.com/comment/42752168
accepted answer: http://stackoverflow.com/a/27126017
favorite count: 0
linked to: http://stackoverflow.com/q/6106658
score: 5
downvote count: 1
upvote count: 6
type: AnsweredQuestion
has body: Yesterday I read about the comma operator in Java for for-loops. Which worked as I expected them to. I thought of this construction but it does not work as expected. ';' expected } while((userInput &lt; 1 || userInput &gt; 3), wrongInput = true); ';' expected } while((userInput &lt; 1 || userInput &gt; 3), wrongInput = true); My idea was that after one iteration, if the userInput was not between 1 and 3, it should set boolean wrongInput to true so that during the next iteration an error message will be displayed. Indicating that the userInput was invalid. private int askUserToSelectDifficulty() { int userInput; Boolean wrongInput = false; do{ if(wrongInput) println("\n\t Wrong input: possible selection 1, 2 or 3"); userInput = readInt(); } while((userInput &lt; 1 || userInput &gt; 3), wrongInput = true); return userInput; } I imagine that maybe because this is inside the equivalent to the conditional part of a for-loop, that this is invalid syntax. Because you can't use a comma operator in the conditional part? Examples of where I have seen the comma operator being used in for-loops: Giving multiple conditions in for loop in Java Java - comma operator outside for loop declaration
tagged with: conditional-statements
tagged with: comma-operator
tagged with: java
has answer: http://stackoverflow.com/a/27126017

http://stackoverflow.com/q/27079867
has comment: http://stackoverflow.com/comment/42670542
has comment: http://stackoverflow.com/comment/42670146
has comment: http://stackoverflow.com/comment/42670301
type: UnansweredQuestion
tagged with: custom-adapter
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/42669885
answer count: 0
has comment: http://stackoverflow.com/comment/42670202
tagged with: java
type: Question
has title: Cant get my data from my database into my Spinner
has body: I have problems getting my Products out of my SQL Light Database into my Spinner. I also use a CustomAdapter to do this. When i click on the spinner nothing happens. My classes: _CustomAdapter class _CustomAdapter extends ArrayAdapter&lt;MyProduct&gt;{ private Activity context; ArrayList&lt;MyProduct&gt; product; public _CustomAdapter(Activity context, int resource, int bezID, ArrayList&lt;MyProduct&gt; product) { super(context, resource, bezID, product); this.context = context; this.product = product; } @Override public View getView(int position, View convertView, ViewGroup parent) { MyProduct current = product.get(position); TextView label = new TextView(context); label.setTextSize(30); label.setText(current.getBeschreibung()); return label; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View row = inflater.inflate(R.layout._spinneritem, parent, false); MyProduct current = product.get(position); ImageView profile = (ImageView) row.findViewById(R.id.imgProd); profile.setBackgroundResource(current.getImage()); TextView name = (TextView) row.findViewById(R.id.bezProd); name.setText(current.getBeschreibung()); return row; } } ActivityClass public class SortimentActivity extends Activity { EditText preis; EditText kommentar; Button okB; ProductDao pd; Spinner spinProducts; MyProduct selected; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sortiment); preis=(EditText) findViewById(R.id.preis); kommentar=(EditText) findViewById(R.id.kommentar); okB=(Button)findViewById(R.id.bOK); this.deleteDatabase("vegi.db"); SQLiteDatabase db = new OpenHelper(this).getWritableDatabase(); ArrayList&lt;MyProduct&gt; products= new ArrayList&lt;MyProduct&gt;(); pd = new ProductDao(db); try{ products=(ArrayList&lt;MyProduct&gt;)pd.getAll(); } catch(Exception e){ } spinProducts= (Spinner) findViewById(R.id.pr…
has comment: http://stackoverflow.com/comment/42670169
has comment: http://stackoverflow.com/comment/42669999
has comment: http://stackoverflow.com/comment/42669936
score: 0

http://stackoverflow.com/a/27110426
type: Answer
answers question: http://stackoverflow.com/q/27106339
downvote count: 1
has body: I found the problem: OpenGL seems to scale the whole texture to the next power of 2, which would be for the height 128, equally to the original image, but for the width 1024. If I do all the calculation for animation.baseImage().width(); instead with 1024 everything looks like expected. Is there a way to avoid this?
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/42732919

http://stackoverflow.com/a/27117975
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27117840
has body: This code builds a query using the IN condition. String query = ""; String whereClause = ""; for(int i = 0; i &lt; LIST.size(); i++) { // using * wildcard whereClause += "\"*" + LIST.get(i).toString() + "*\","; } query = String.format("SELECT User.firstName, User.lastName FROM User WHERE User.firstName IN (%s) OR User.lastName IN (%s);", whereClause, whereClause);

http://stackoverflow.com/q/27131199
upvote count: 1
type: Question
tagged with: simpledateformat
downvote count: 0
tagged with: date
accepted answer: http://stackoverflow.com/a/27305569
answer count: 2
has body: Is anybody aware of a third-party package that directly finds portions of an input string that match a Java DateFormat? In other words, that converts a DateFormat to a regular expression? E.g., it might convert; DateFromat df = new SimpleDateFormat("MM/dd/yyyy") to something like "(0[1-9]|1[0-2])\\/(0[1-9]|1[0-9]|2[0-9]|3[01])\\/([0-9]{4})" so that you would have seamless methods available like (fantasy code): DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); DateMatcher dm = df.dateMatcher(inputString); while (dfm.findDate()) { #dostuff }; // or if (dfm.matchesDate()) #dosomething
has comment: http://stackoverflow.com/comment/42761743
linked to: http://stackoverflow.com/q/3850784
score: 1
favorite count: 0
has title: Extracting dates using Java by matching date format from string
has answer: http://stackoverflow.com/a/28116173
tagged with: date-format
tagged with: regex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27305569
possible better answer: http://stackoverflow.com/a/28116173
tagged with: java

http://stackoverflow.com/q/27037657
tagged with: pom.xml
has answer: http://stackoverflow.com/a/31077884
favorite count: 0
has comment: http://stackoverflow.com/comment/95326853
answer count: 12
has answer: http://stackoverflow.com/a/67077275
has body: Using IntelliJ 12, I have a java project and I use maven with a pom.xml. My project is using java8, but it seems the default project language level has been set to 6 while importing the project. I can change the language level to 8.0 (F4 -> Modules -> Language level) however every time I edit my pom.xml the project level is switched back to "use project language level", and I have to edit this settings again and again. Is there something I need to add to the pom.xml to set the default language level to 8.0?
tagged with: maven
has answer: http://stackoverflow.com/a/71122846
has comment: http://stackoverflow.com/comment/42595316
has answer: http://stackoverflow.com/a/49259779
downvote count: 1
linked to: http://stackoverflow.com/q/21006136
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/47393213
has answer: http://stackoverflow.com/a/27037879
has answer: http://stackoverflow.com/a/48733496
has answer: http://stackoverflow.com/a/71072881
linked to: http://stackoverflow.com/q/29888592
has comment: http://stackoverflow.com/comment/42596039
type: Question
upvote count: 198
has answer: http://stackoverflow.com/a/41650126
score: 197
has title: stop IntelliJ IDEA to switch java language level every time the pom is reloaded (or change the default project language level)
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/36116666
has answer: http://stackoverflow.com/a/53733920
has answer: http://stackoverflow.com/a/43290528
possible better answer: http://stackoverflow.com/a/36116666
accepted answer: http://stackoverflow.com/a/27037879

http://stackoverflow.com/comment/42789589
score: 0
comment on: http://stackoverflow.com/q/27134754
type: Comment
type: QuestionComment
has text: Why do you need to create the general version? Can't you wait until the user selects the version?

http://stackoverflow.com/comment/42735350
comment on: http://stackoverflow.com/q/27116345
has text: @BatScream has you covered there. `Collections.sort` is well documented, as is the concept of using it in combination with a `Comparator` object, simply search for them within the context of java and you'll find *lots* of tutorials that explain how to use them. Or search Stackoverflow for it, plenty of questions that involve using Collections.sort, too.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27124940
tagged with: java
downvote count: 3
tagged with: accesscontrolexception
has comment: http://stackoverflow.com/comment/42751753
has title: How to fix Java.security.AcessControlExpection
upvote count: 0
has comment: http://stackoverflow.com/comment/42750256
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/42751215
has answer: http://stackoverflow.com/a/27125850
tagged with: applet
has body: I'm trying to execute my Java project on Delay analysis on Multihop and wireless networks so I'm getting this error. See the pic for more detail: http://tinypic.com/r/245locn/8
favorite count: 0
type: Question
tagged with: sockets
tagged with: swing
has comment: http://stackoverflow.com/comment/42751557
answer count: 1

http://stackoverflow.com/q/27046410
tagged with: android
has comment: http://stackoverflow.com/comment/42612069
tagged with: menu
has comment: http://stackoverflow.com/comment/42611224
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42611553
has comment: http://stackoverflow.com/comment/42613942
type: Question
has answer: http://stackoverflow.com/a/27048262
accepted answer: http://stackoverflow.com/a/27048262
has comment: http://stackoverflow.com/comment/42613297
has comment: http://stackoverflow.com/comment/42611154
tagged with: libgdx
tagged with: scene2d
has comment: http://stackoverflow.com/comment/42613130
tagged with: java
score: 0
has title: LibGDX loading scene2D widgets very slow for first time, need suggestions
answer count: 1
has comment: http://stackoverflow.com/comment/42614116
has body: I started using scene2D in my LibGDX game to make a more professional looking login/register menu. The only problem is that switching to those menus is very long for menu navigation (3-5 sec). I want to know if there is a better way to load them before hand, like during the game's initial loading screen. The thing is that once one of the menus is loaded, it loads very quick the second time. I know for sure that its the create method of my screens that takes this long. Here is all that it is loading: public void create(){ stage = new Stage(new StretchViewport(1920, 1080)); Gdx.input.setInputProcessor(stage); loginBox = new Image(Textures.Gui.BOX); loginBox.setSize(650, 1000); loginBox.setPosition(635, 40); stage.addActor(loginBox); loginLBL = new Label("Login", Archipelo.SKIN, "basic-large-font", Color.LIGHT_GRAY); loginLBL.setPosition(880, 955); stage.addActor(loginLBL); selectionHighlight = new Image(Textures.Gui.SELECTION_HIGHLIGHT); selectionHighlight.setSize(540, 140); stage.addActor(selectionHighlight); usernameTF = new TextField("", Archipelo.SKIN); usernameTF.setMaxLength(24); usernameTF.setPosition(usernameTFx, usernameTFy); usernameTF.setSize(400, 60); stage.addActor(usernameTF); passwordTF = new TextField("", Archipelo.SKIN); passwordTF.setPasswordMode(true); passwordTF.setPasswordCharacter('•'); passwordTF.setPosition(passwordTFx, passwordTFy); passwordTF.setSize(400, 60); stage.addActor(passwordTF); usernameLBL = new Label("Username", Archipelo.SKIN, "basic-medium-font", new Color(1, 1, 1, 0.5f)); usernameLBL.setPosition(usernameTFx + 10, usernameTFy + 5); stage.addActor(usernameLBL); passwordLBL = new Label("Password", Archipelo.SKIN, "basic-medium-font", new Color(1, 1, 1, 0.5f)); passwordLBL.setPosition(passwordTFx + 10, passwordTFy + 5); stage.addActor(passwordLBL); remember = new CheckBox(" Remember Login?", Archipelo.SKIN); remember.setPosition(rememberX, rememberY); remember.getCells().get(0).size(30, 30); stage.addActor(remember); errorLBL = new …

http://stackoverflow.com/comment/42542488
type: QuestionComment
has text: when i do that the area displays this: (given a guessed letter) _ _ _ _ _ _ _ h _ _ _ _ _ _ h _ _ _ _ _ _
score: 0
comment on: http://stackoverflow.com/q/27006596
type: Comment

http://stackoverflow.com/q/27035648
score: 2
downvote count: 0
answer count: 1
favorite count: 0
has body: I'm creating a GATE app which used to find co-reference text. It works fine and I have created zipped file of the app by export option provided in GATE. Now I'm trying to use the same in my Java code. Gate.runInSandbox(true); Gate.setGateHome(new File(gateHome)); Gate.setPluginsHome(new File(gateHome, "plugins")); Gate.init(); URL applicationURL = new URL("file:" + new Path(gateHome, "application.xgapp").toString()); application = (CorpusController) PersistenceManager.loadObjectFromUrl(applicationURL); corpus = Factory.newCorpus("Megaki Corpus"); application.setCorpus(corpus); Document document = Factory.newDocument(text); corpus.add(document); application.execute(); corpus.clear(); Now how can I parse this document and get co-reference text?
has title: Parse GATE Document to get Co-Reference Text
tagged with: reference
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27058976
upvote count: 2
tagged with: annotations
tagged with: gate
has comment: http://stackoverflow.com/comment/42632943
type: Question
tagged with: java
tagged with: text-mining
accepted answer: http://stackoverflow.com/a/27058976

http://stackoverflow.com/comment/42710077
type: AnswerComment
has text: Your pointcut syntax in the question above is correct, so you must have changed something. If you want us to help you spot syntax errors, how about sharing the code with us?
type: Comment
comment on: http://stackoverflow.com/a/27095555
score: 0

http://stackoverflow.com/comment/42546462
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27009144
score: 0
has text: I did that i'm still getting an error. Here's the exact code i'm using import java.awt.event.*; import javax.swing.Timer; public class Timers { private int score; ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { count++; if (count >= 59) { ((Timer)evt.getSource()).stop(); System.out.println("Time's up! Your score was "); } } }; new Timer(1000, taskPerformer).start(); }

http://stackoverflow.com/comment/42719340
has text: Forgot to mentioned i did this too... look at edit when i update it.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27107952
score: 0

http://stackoverflow.com/a/27053238
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27050099
has body: I agree with Bruce, but if you do need to keep a reference to the fragment in the activity, you can do something like this: In you activity, implement a method, let's say 'setFragmentInstance'. In your fragment, override the onActivityCreated method, in which you can either cast the activity to your activity (if the fragment always stay in that activity) and call that setFragmentInstance method, or you can also add a interface in the fragment, implement it activity and calls the interface's method in onActivityCreated to set the fragment instance. I asked one similar questions before, but soon after that I got clear about it, see DialogFragment members becomes null after screen rotation
upvote count: 1

http://stackoverflow.com/comment/42619784
comment on: http://stackoverflow.com/a/27045182
type: AnswerComment
has text: I find it is very useful to read about the same topic from different sources. So no, absolutely not. :)
type: Comment
score: 0

http://stackoverflow.com/q/27094335
score: 1
tagged with: java
upvote count: 1
has title: Return off a static, recursive Java method doesn't work
type: Question
accepted answer: http://stackoverflow.com/a/27094388
has body: I try to implement an Sudoku-Solver. I am invoking the method printSoluition(board) and it should print out the solution, if one exists or null. I am trying it with an example that has one solution. But it always returns null. My Code: static void printSolution(SudokuBoard board) { SudokuBoard resultBoard = findSolution(board); if(resultBoard != null) { resultBoard.print(); } } static SudokuBoard findSolution(SudokuBoard board) { if (board.isSolved()) { return board; } else { int nextEmptyField = getNextFreeIndex(board); if (nextEmptyField != -1) { int[] kandidaten = board.getCandidates(nextEmptyField); for (int i = 0; i &lt; kandidaten.length; i++) { SudokuBoard newBoard = board.set(nextEmptyField, kandidaten[i]); return findSolution(newBoard); } } return null; } }
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27094388
type: AnsweredQuestion
tagged with: recursion

http://stackoverflow.com/comment/42720820
has text: there is no reason I can catch. it must work. double check the code you use to launch new activity.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27108578
type: AnswerComment

http://stackoverflow.com/a/27024969
answers question: http://stackoverflow.com/q/26993113
has comment: http://stackoverflow.com/comment/42605002
has comment: http://stackoverflow.com/comment/42611390
score: 3
has comment: http://stackoverflow.com/comment/42611853
has body: The "Formatter" that you're looking for is the LineAggregator. Currently you're using the DelimitedLineAggregator, which while addressing the delimited aspect of your data, doesn't address formatting. Take a look at the FormatterLineAggregator. It allows you to format the output String generated from the LineAggregator by specifying a string format (uses String.format()). From there you should be able to specify the format you want the date to be rendered in.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42592241
type: Answer
has comment: http://stackoverflow.com/comment/70351419
has comment: http://stackoverflow.com/comment/138852987
accepted answer of: http://stackoverflow.com/q/26993113
upvote count: 3

http://stackoverflow.com/q/27048588
type: Question
has title: Improve recursive algorithm
downvote count: 0
favorite count: 0
tagged with: list
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: EDIT: So I have this recursive code which "scrambles" numbers on a list and calls a method to check if the order in which they are "solves" one x requirement listed below. for(int e=0;e&lt;nums.size();e++){ int v = nums.remove(e); //Takes the number from nums solucion.add(v); //Adds it to the solution if(solve(nums, solution))return true; //Calls solve recursively solution.removeLast(); //Removes the element added to the solution nums.add(e,v); //Places the number on its original position } This piece of code is inside a method called solve which looks like this: nums is the list of numbers read from the console. solution starts as an empty list. This code works great but it's REALLY slow. Is there any way you think I can improve this piece of code ? If it helps, the requirement is to check if there's a way to organize numbers and create a magic square from them (columns sum is the same as rows sum and diagonals sum)
tagged with: recursion
tagged with: performance
score: 1
tagged with: java

http://stackoverflow.com/comment/42749765
score: 0
has text: Use Http get method to get json data in android and parse this data and show this list.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27124798

http://stackoverflow.com/q/27128523
type: Question
has comment: http://stackoverflow.com/comment/42759292
has comment: http://stackoverflow.com/comment/42756627
accepted answer: http://stackoverflow.com/a/27132017
tagged with: arraylist
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42756914
has comment: http://stackoverflow.com/comment/42756926
has title: Fetching a Parcelable object from SharedPreferences gives huge size of inner ArrayList
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27132017
tagged with: java
tagged with: sharedpreferences
tagged with: gson
has body: I have two objects, Playlist and Song. I use SharedPreferences for storing and fetching Playlist objects. Playlist objects has an ArrayList of Song objects. Both Playlist and Song are Parcelable. When I want to get a stored Playlist, I get a huge size of ArrayList&lt;Song&gt;. It seems like it's been multipied its elements by hundreads of times. public void savePlaylist(Playlist playlist) { Gson gson = new GsonBuilder().create(); int fileIndex = playlist.getFileIndex(); if (fileIndex == -1) { fileIndex = getPlaylistCount(); fileIndex++; playlist.setFileIndex(fileIndex); } putString(fileIndex+"", gson.toJson(playlist)); putInt(PLAYLIST_COUNT, fileIndex); } public Playlist getPlaylist(int index) { String key = index + ""; Playlist savedPlaylist; Gson gson = new GsonBuilder().create(); String savedValue = preferences.getString(key, ""); if (savedValue.equals("")) { savedPlaylist = null; } else { savedPlaylist = gson.fromJson(savedValue, Playlist.class); } return savedPlaylist; } public ArrayList&lt;Playlist&gt; getAllPlaylist() { int count = getPlaylistCount(); if (count == 0) { return null; } ArrayList&lt;Playlist&gt; list = new ArrayList&lt;Playlist&gt;(); for (int i = 1; i &lt;= count; i++) { Playlist pl = getPlaylist(i); if (pl != null) { list.add(pl); } } if (list.size() == 0) { return null; } return list; } private int getPlaylistCount() { return preferences.getInt(PLAYLIST_COUNT, 0); } EDIT: object classes added Song.java public class Song implements Parcelable{ private long id; private String title; private String artist; private String path; private String size; private String extension; private int year; private long albumId; private long duration; private String artUrl; private boolean selected = false; private boolean checked = false; public Song(long id, String title, String artist, String path, String size, long duration, String extension, int year, long albumId) { super(); this.id = id; this.title = title; this.artist = artist; this.path = path; this.siz…

http://stackoverflow.com/a/27056848
has comment: http://stackoverflow.com/comment/42629843
has comment: http://stackoverflow.com/comment/42629725
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27056603
type: Answer
has body: can you try making sure that you have allowed geographic access to India in your Twilio account? Log into the portal, click on the drop down next to the date, choose account, then select geographic permissions, finally make sure that India has check marks allowing access to that area. Hope this helps

http://stackoverflow.com/q/27003074
tagged with: xor
type: AnsweredQuestion
tagged with: java
tagged with: bit-manipulation
accepted answer: http://stackoverflow.com/a/27003083
has title: Java XOR Operator questions
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27003274
score: 4
has body: I have some questions about the XOR operator ^ in Java. I always thought that Java does not have a logical XOR operator because several people told me ^ is bitwise. Today I found some (unconfirmed) posts (without sources) saying ^ is overloaded in Java, working as a logical XOR for booleans and as a bitwise XOR e.g. for integers. Which statement is true? Can anyone provide some reliable sources? If ^ is overloaded, which types does it accept?
possible better answer: http://stackoverflow.com/a/27003274
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27003083
favorite count: 0

http://stackoverflow.com/q/27012815
score: 0
has answer: http://stackoverflow.com/a/27013014
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1005073
has body: I found a class declaration that works for me, but I wonder if this class could be written more "short": public class Data implements Comparable &lt;Data&gt;{ public Data (int category, String quality, String title ) { super(); this.category = category; this.quality = quality; this.title = title; } int category; String quality; String title; @Override public int compareTo(Data d) { return this.getDuration_value() - (d.getDuration_value()); } } Why do I have to mention "category, quality an title" this often ? And why "super()" ? I would like to have it just shorter. I found other explanations, but nowhere this "complex structure". The "data" is given by these lines, and I want that I do not have to declare in advance the length of the array: Data[] myDataArray = { new Data(0, // category "0" "***", // quality "MyTitle1") // title new Data(0, // same category "0" "**", // quality "MyTitle2") // title }
has title: Define an array object in java
has comment: http://stackoverflow.com/comment/42552192
has comment: http://stackoverflow.com/comment/42552023
linked to: http://stackoverflow.com/q/1200621
tagged with: java
has answer: http://stackoverflow.com/a/27013094
type: Question
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/42552149
tagged with: class

http://stackoverflow.com/a/28882599
has body: You might not like this answer because it doesn't give you a quick-fix for your situation, but it will help you more in the long run. This is the kind of bug that you can figure out yourself with a little debugging. I don't know what IDE you are using, but with Eclipse, you can even step into code that is in the JDK! So, what I would do, is set a breakpoint at the line where you call sort() on the childNodes. Then I would step into the JDK code and just walk through it myself. It will become very clear what is going on and why it isn't calling your compare function.
type: Answer
answers question: http://stackoverflow.com/q/27050398
score: 0

http://stackoverflow.com/comment/42692100
score: 0
type: Comment
type: QuestionComment
has text: public static final int a=0; And everything will be fine ;)
comment on: http://stackoverflow.com/q/27092830

http://stackoverflow.com/comment/42694352
comment on: http://stackoverflow.com/q/27094247
score: 0
type: Comment
type: QuestionComment
has text: No deadlock, but if this is the only method that writes to cnt you can just do ++cnt from incrementCnt()

http://stackoverflow.com/a/27116232
type: Answer
has comment: http://stackoverflow.com/comment/42775942
has comment: http://stackoverflow.com/comment/111266408
score: 7
upvote count: 7
has body: In general you are required to perform hybrid encryption with ECC. ECIES for instance is basically a key agreement followed by symmetric encryption. So you cannot directly encrypt anything with ECIES, which is the most common ECC method for encryption. Basically you should couple it to a symmetric cipher. This is actually the best scheme for RSA encryption as well, most of the time. As you can see you can use this directly as a Cipher using CBC mode &amp; PKCS#7 padding, but beware of the large header (117 bytes for a 384 curve, no less). This is required to perform the key derivation. Make sure that the public key is properly validated (I'm not sure about the Bouncy Castle code in this regards, haven't taken a look at it). public static void main(String[] args) throws Exception { Security.addProvider(new BouncyCastleProvider()); KeyPairGenerator ecKeyGen = KeyPairGenerator.getInstance("EC", BouncyCastleProvider.PROVIDER_NAME); ecKeyGen.initialize(new ECGenParameterSpec("brainpoolP384r1")); // doesn't work, which means we are dancing on the leading edge :) // KeyPairGenerator ecKeyGen = KeyPairGenerator.getInstance("EC"); // ecKeyGen.initialize(new ECGenParameterSpec("secp384r1")); KeyPair ecKeyPair = ecKeyGen.generateKeyPair(); System.out.println("What is slow?"); Cipher iesCipher = Cipher.getInstance("ECIESwithAES"); iesCipher.init(Cipher.ENCRYPT_MODE, ecKeyPair.getPublic()); byte[] ciphertext = iesCipher.doFinal(com.google.common.base.Strings.repeat("owlstead", 1000).getBytes()); iesCipher.init(Cipher.DECRYPT_MODE, ecKeyPair.getPrivate()); byte[] plaintext = iesCipher.doFinal(ciphertext); System.out.println(Hex.toHexString(ciphertext)); System.out.println(new String(plaintext)); }
has comment: http://stackoverflow.com/comment/105981495
has comment: http://stackoverflow.com/comment/109684206
downvote count: 0
has comment: http://stackoverflow.com/comment/109679517
has comment: http://stackoverflow.com/comment/42747434
answers question: http://stackoverflow.com/q/27112213

http://stackoverflow.com/comment/42655791
comment on: http://stackoverflow.com/a/27071403
type: Comment
score: 0
type: AnswerComment
has text: @FreekdeBruijn: there are also many many examples of Swing graphics programs including animations to be found on this site, some written by me.

http://stackoverflow.com/comment/43005808
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27262908
type: Comment
has text: aaaa. you want to have an existing bank ?

http://stackoverflow.com/comment/42566527
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27020545
has text: @Predrag isLatest() is standard notation for Boolean. I'm not sure if it will be the problem, but you should not mix Boolean and boolean. Use Boolean if it can be null. If it cannot be null, use boolean.

http://stackoverflow.com/comment/42761915
has text: I did read some forums which mentioned writing an XML filter (I guess similar to what you've done) but I was hoping there was a more cleaner solution
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27130402
type: Comment

http://stackoverflow.com/q/27012833
type: UnansweredQuestion
tagged with: vaadin7
tagged with: maven
has comment: http://stackoverflow.com/comment/42552723
score: 1
tagged with: java
tagged with: eclipse
has body: Welcome, I have 2 projects, project A is a library (maven project) for my main project. Eclipse is able to compile and run main project but maven complains when I try to clean install. I have tried everything: clean install on A and then clean install in all combinations, changing default maven compiler to eclipse compiler, but still have compile errors on main project. Pom for A project: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 self.project A 7.3.002.001 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- <vaadin.version>7.1.8</vaadin.version> --> <vaadin.version>7.3.0</vaadin.version> A maven-compiler-plugin 3.1 1.7 1.7 org.apache.maven.plugins maven-source-plugin 2.2.1 attach-sources jar javax javaee-api 6.0 provided com.vaadin vaadin-archetype-application ${vaadin.version} com.vaadin vaadin-push ${vaadin.version} com.vaadin vaadin-client ${vaadin.version} com.vaadin vaadin-client-compiled ${vaadin.version} com.vaadin vaadin-client-compiler ${vaadin.version} commons-codec commons-codec com.vaadin vaadin-themes ${vaadin.version} org.eclipse.persistence eclipselink 2.5.0 org.eclipse.persistence javax.persistence 2.0.3 org.apache.poi poi 3.9 org.apache.poi poi-ooxml 3.9 org.quartz-scheduler quartz 2.1.6 org.vaadin.addons MultiButton 3.0 net.sourceforge.jtds jtds 1.3.1 org.vaadin.addons ContextMenu 4.2.1 de.steinwedel.vaadin.addon messagebox 2.0.6 org.slf4j slf4j-api 1.6.1 org.vaadin.addons wizards-for-vaadin 1.0.0-beta1 joda-time joda-time 2.1 org.vaadin.addons dragdroplayouts 1.0 org.vaadin.addons popupbutton 2.3.0 org.vaadin.addons listbuilder 0.7.3.v7 org.vaadin.addons TableExport 1.4.0 org.vaadin.addons stepper 2.1.2 com.itextpdf itextpdf 5.3.4 net.java.dev.stax-utils stax-utils 20070216 com.bea.xml jsr173-ri commons-collections commons-collections 3.2.1 xml-apis xml-apis 1.4…
type: Question
has comment: http://stackoverflow.com/comment/42557755
has comment: http://stackoverflow.com/comment/42553200
has comment: http://stackoverflow.com/comment/42555336
upvote count: 1
has comment: http://stackoverflow.com/comment/42556687
favorite count: 0
has title: project compiles in eclipse but maven instal gives errors
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/42553129
has comment: http://stackoverflow.com/comment/42554863
linked to: http://stackoverflow.com/q/5417958
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/42585892
comment on: http://stackoverflow.com/q/27031896
score: 1
type: QuestionComment
type: Comment
has text: @user3072758 In what way is that the relevant code? Why are you calling `trim()` and discarding the result? Are you forgetting to assign `transWord` back to an array? What is `transWord`? What output do you expect, and what do you get?

http://stackoverflow.com/q/27089527
answer count: 2
upvote count: 1
downvote count: 1
has title: Polymorphism and creation of Object using String
accepted answer: http://stackoverflow.com/a/27089650
tagged with: polymorphism
favorite count: 0
has answer: http://stackoverflow.com/a/27089599
has comment: http://stackoverflow.com/comment/42686302
tagged with: interface
has answer: http://stackoverflow.com/a/27089650
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42686334
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27089599
has body: I declared an Interface like the following public interface One { void setNo(int no); } Then I have a class to implement the interface public class Two implements One{ private int no; @Override public void setNo(int no){ this.no = no; } } I will have a lot of classes to implement the interface and then I want to create the corresponding Object according to user input. Let's say we have the classes Three, Four, Five described as the Two class. The user picks to create the class Three. So I try to do something like the following One base; Class c = Class.forName("Three"); base = (One) c.newInstance(); base.setNo(5); the call to base.setNo() fails. Am I doing this right? Error java.lang.ClassNotFoundException: Three at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:260) at com.company.Main.main(Main.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
has comment: http://stackoverflow.com/comment/42686278
score: 0

http://stackoverflow.com/a/42113081
type: Answer
answers question: http://stackoverflow.com/q/27115967
has body: you should use AUDIO FOCUS and onfocuschangelistener it will solve your problem.
score: 0

http://stackoverflow.com/q/27054215
possible better answer: http://stackoverflow.com/a/27054276
has comment: http://stackoverflow.com/comment/42625495
has comment: http://stackoverflow.com/comment/42625108
has answer: http://stackoverflow.com/a/27054276
has title: loop concatenation using .concat without using just loop
answer count: 3
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42625146
has answer: http://stackoverflow.com/a/27054311
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I was wondering if there's a way to do use String::concat with loops, instead of using StringBuilder/StringBuffer. I tried it like this, but it doesn't work. Could someone help fix up the problem? or give me suggestions so I try it myself? public class multiConcat { public static void main(String[] args) { int num = 0; String finish = ""; Scanner reader = new Scanner(System.in); System.out.println("Type a word: "); String state = reader.next(); System.out.println("Number of Concatenation: "); num = reader.nextInt(); finish = state.concat(state); for (int i = 0; i == num; i++) { finish.concat(state); } System.out.println(finish); } } I thought it would be sthe ame idea as x = x + 1, i.e. constantly overwriting the value... Thank you you mean as this? for (int i = 0; i == num; i++) { finish = finish.concat(state); }
type: Question
has answer: http://stackoverflow.com/a/27054282
accepted answer: http://stackoverflow.com/a/27054282

http://stackoverflow.com/q/27036438
tagged with: oracle-database
upvote count: 1
has title: How to ensure transaction management when updating two database
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42593407
score: 1
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/27036642
type: Question
answer count: 1
tagged with: database
has answer: http://stackoverflow.com/a/27036642
tagged with: dao
has body: How can ensure transaction is sucessfull in both database or none when connecting two different database(say one is mysql and other is oracle). More Information.. I have a transaction where i will be updating two different database. Hence I have two different Service and two different DAO. How can i ensure transaction successfull in both DB or none.. Thanks Chetan

http://stackoverflow.com/q/27143454
tagged with: servlets
type: Question
has title: GWT Project on Apache Tomcat: A child container failed during start
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42783484
score: 0
has comment: http://stackoverflow.com/comment/42783899
has comment: http://stackoverflow.com/comment/42783759
has comment: http://stackoverflow.com/comment/42784726
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42783734
has body: I recently added another servlet to my GWT project. After deplyoing it to tomcat, I am getting an error. When I run it in dev. mode the servlet container is working as intended. EDIT: It should be added that tomcat fails to start due to the error. catalina.2014-11-26 log: 26-Nov-2014 08:20:53.930 SEVERE [Catalina-startStop-1] org.apache.catalina.core.ContainerBase.startInternal A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.IllegalArgumentException: Invalid buysmarter/download in servlet mapping at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3125) at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3100) at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1372) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:…
tagged with: gwt
tagged with: java
has comment: http://stackoverflow.com/comment/42784172

http://stackoverflow.com/q/27008293
has body: I would like to sample data I get from a API call on a even 10 seconds. Now I call the api, update the data and wait for 10 seconds, but this is ten seconds plus the time it takes the code to execute. Is there a way to figure out how much to pause so that the pause would be 10 seconds-the time it took to sample the data???? code: do{ // sample data for(int i=0; i&lt;cMarkets.mTitle.length; i++ ) { mBitTrex.market=i; cTicker prices = new cTicker(); prices=mBitTrex.GetCurSales(); String FileName = "graph"+cMarkets.mTitle[i]; FileName+=".txt"; FileWriter fileWritter = new FileWriter( FileName,true); BufferedWriter bufferWritter = new BufferedWriter(fileWritter); String say; say=Double.toString(prices.last)+","+Double.toString(prices.bid)+","+Double.toString(prices.ask); bufferWritter.write(say ); bufferWritter.write("\r" ); bufferWritter.write("\n" ); System.out.println(say); bufferWritter.close(); } // wait for 10 seconds then sample data again // how can I make it so the puse is 10 seconds-the time it took to sample the fdata?? Thread.sleep(10000); } while(System.in.available()==0);
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27008359
has answer: http://stackoverflow.com/a/27008337
answer count: 2
downvote count: 0
favorite count: 0
has title: Java Trying to sample data every 10 seconds
possible better answer: http://stackoverflow.com/a/27008359
upvote count: 1
accepted answer: http://stackoverflow.com/a/27008337
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/27046810
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27046709
type: AcceptedAnswer
downvote count: 0
has body: You should leave them out. They don't add any benefit and just increase the amount of code to be maintained. If you want to remove the method you will need to do that in one more location. Code quality analyzers generally demand the reduction of anything which is not needed: redundant modifiers (eg: public abstract in interfaces), declared runtime exceptions (throws IllegalArgumentException), redundant throws (throws Exception, IOException) and so on. However, you could consider implementing the default behaviour of methods in the abstract class (event listener methods with an empty body, configuration property methods which return the default value, ...). Eg: public boolean isPersistent() { return true; } isPersistent() only needs to be overwritten in sub classes which use another value than the default one.
answers question: http://stackoverflow.com/q/27046709
score: 4
type: Answer

http://stackoverflow.com/comment/42796682
score: 0
comment on: http://stackoverflow.com/q/27150414
type: QuestionComment
type: Comment
has text: If you want to create stages in tasks / threads you have to use Platform.runLater, otherwise you are not running on the Application Thread and it will exit. So i need both tasks and runlater

http://stackoverflow.com/comment/42803862
has text: The temporary solution that I found was setting the error for warning to every Invalid or Incomplete JPQL queries. To do this in Eclipse Luna I follow this instructions: 1 - "Window" / "Preferences" 2 - "Java Persistence" -> "JPA" -> "Errors/Warnings" 3 - "Invalid or incomplete JPQL queries:" set to "Warning". But this isn't the solution at all.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27150123

http://stackoverflow.com/q/26993756
score: 0
has body: I'm looking at the SonarQube product for use on a project, and we have a historical issue in making sure that all literal strings are pushed out to a resource file ready for internationalization. Does the SonarQube regime include any checks to find literal strings that should be moved to a resource file? Our tech stack is Java and Javascript.
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27012462
tagged with: java
tagged with: sonarqube
type: Question
has title: SonarQube and checking for literal strings
tagged with: javascript

http://stackoverflow.com/a/27021419
has body: you should override getViewTypeCount and getItemViewType, otherwise you will get just one null convertView @Override public int getViewTypeCount() { return 3; } @Override public int getItemViewType(int position) { return getItem(position).getChanneltype() - 1; } and in getView int type = getItemViewType(position); and instead of switching to 1, 2 and 3 you have to switch to 0, 1 and 2
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/42567589
answers question: http://stackoverflow.com/q/27021342
accepted answer of: http://stackoverflow.com/q/27021342
has comment: http://stackoverflow.com/comment/42568180
type: AcceptedAnswer

http://stackoverflow.com/q/27092858
has comment: http://stackoverflow.com/comment/42691737
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2237021
tagged with: java
has comment: http://stackoverflow.com/comment/42692018
has comment: http://stackoverflow.com/comment/42691881
has title: Make a given string as palindrome using java
has comment: http://stackoverflow.com/comment/42691821
type: Question
has answer: http://stackoverflow.com/a/27102570
accepted answer: http://stackoverflow.com/a/27102570
downvote count: 4
tagged with: algorithm
has comment: http://stackoverflow.com/comment/42692372
has comment: http://stackoverflow.com/comment/42691776
tagged with: data-structures
has comment: http://stackoverflow.com/comment/42691882
has body: Can anyone please help me to solve below problem Check whether the string is palindrome or not. If the string is not palindrome then make it palindrome. eg: input: ABC, output: ABCBA I know how to check whether string is palindrome or not. Please help in the second part of the question. in best case, better if we can achieve below result also eg: input: AAB, output: ABA for 1st exmaple i tried this approach LinkedList &lt;String&gt; q = new LinkedList&lt;&gt;(); //String [] ar ={"a","b","c","b","d"}; String [] ar ={"A","B","C"};; int mid=ar.length/2; q.addFirst(ar[mid]); for(int i= mid, j=mid; i&gt;=0&amp;&amp;j&lt;ar.length;){ if(j+1==ar.length &amp;&amp; i-1==-1) break; q.addFirst(ar[i-1]); if(ar[i-1]!=ar[j+1]){ q.addLast(ar[i-1]); q.addLast(ar[j+1]); q.addFirst(ar[j+1]); }else{ q.addLast(ar[j+1]); } j++; i--; }
has comment: http://stackoverflow.com/comment/42692095
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42691935
score: -3
has comment: http://stackoverflow.com/comment/42709014
upvote count: 1
has comment: http://stackoverflow.com/comment/42692107

http://stackoverflow.com/q/27026887
linked to: http://stackoverflow.com/q/7388622
has comment: http://stackoverflow.com/comment/42576961
score: 4
accepted answer: http://stackoverflow.com/a/27027156
has comment: http://stackoverflow.com/comment/42619946
answer count: 1
has body: Given a Hibernate Entity Foo @Entity @Table(name = "foo") class Foo { //ID Field @Column(name = "bar", nullable = false) @Enumerated(EnumType.STRING) private Bar bar; //Getters, Setters } And an Enum Bar enum Bar { CAT, CRADLE, SILVER, SPOON; } I would like to run a query checking if Foo.bar's value contains some String matchString = "ADL". Currently, my DetachedCriteria object is constructed as: DetachedCriteria.forClass(Foo.class) .add(Restrictions.like("bar", matchString, MatchMode.ANYWHERE));` but causes a java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Enum when invoked.
has answer: http://stackoverflow.com/a/27027156
favorite count: 0
tagged with: hibernate-mapping
has comment: http://stackoverflow.com/comment/42617539
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
has title: Hibernate Like Criteria on Enum field
type: Question
tagged with: enums

http://stackoverflow.com/a/27817365
downvote count: 0
has body: I would try this: import org.eclipse.core.runtime.Platform; ... // at the place you need to reload your plugin Platform.getBundle( "bundle " ); and replace the String content "bundle" with the value from the MANIFEST.MF of the Bundle-SymbolicName: entry.
has comment: http://stackoverflow.com/comment/44044890
answers question: http://stackoverflow.com/q/27066244
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/44040769

http://stackoverflow.com/comment/42677159
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27083034
has text: Thanks for the help, works like a charm :). Should have tried this a long time ago!

http://stackoverflow.com/comment/51241076
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27089126
has text: @PrayagUpd, have you resolved this issue , please see my question which is same due to version conflict : http://stackoverflow.com/questions/31603890/nosuchmethoderror-when-running-on-hadoop-but-not-when-run-locally
score: 0

http://stackoverflow.com/comment/42610338
score: 0
type: Comment
has text: Thanks, go ahead if you want to extend the answer, but I think it's close enough. Right now I don't have the time to dig into it, that's why I was looking for a more straightforward-magical solution. But it doesn't seem to exist yet.
comment on: http://stackoverflow.com/a/27006163
type: AnswerComment

http://stackoverflow.com/q/26997557
tagged with: stringtokenizer
type: Question
has comment: http://stackoverflow.com/comment/42525733
has comment: http://stackoverflow.com/comment/42525908
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26997663
favorite count: 0
has comment: http://stackoverflow.com/comment/42525727
has body: We're learning the uses of a HashMap data structure in class and I've been working on an assignment where we read in a file with 3 columns and a set number of rows. The first column is the full name of a user, the second is their username, and the third is their password. import java.io.*; import java.util.HashMap; import java.util.ArrayList; import java.util.Scanner; import java.util.StringTokenizer; public class Question2Client { public static void main(String[] args) throws IOException{ Scanner in = new Scanner(System.in); System.out.println("Read the number file to read from."); ArrayList &lt;String&gt; list = new ArrayList&lt;&gt;(); String filename = in.nextLine(); File processes = new File(filename); Scanner inputFile = new Scanner(processes); String line, word; StringTokenizer token; HashMap &lt;String, String&gt; userDatabase = new HashMap&lt;&gt;(); HashMap &lt;String, String&gt; fullName = new HashMap&lt;&gt;(); The problem comes in the reading of the file. I implement the above arraylist because I was running into issues with the StringTokenizer before. The logic for the code below is that whenever there is a string deliminated by a tab, it is added to the list (the code reads in left to right, and the file separates its entries by a tab indentation). Note: after debugging this is where I've identified the problem to be. while (inputFile.hasNext()){ line = inputFile.nextLine(); token = new StringTokenizer(line, "\t"); while(token.hasMoreTokens()){ word = token.nextToken(); list.add(word); } } From there I take the first items in the list and assign them to their appropriate places in the hashmap. The user's full name is the value for the second HashMap, the username is the key for both HashMaps, and the password is the value for the first HashMap. Later on I will be adding code to request an input from the user and if the password matches their username, it displays their information (i.e. access through userDatabase, display info from fullName). for (in…
has answer: http://stackoverflow.com/a/26997663
downvote count: 1
has title: String Tokenizer code not Reading File Correctly
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42528598
score: -1

http://stackoverflow.com/comment/42706912
comment on: http://stackoverflow.com/q/27101130
score: 0
type: Comment
type: QuestionComment
has text: I have also got this pain point and did the same as you mentioned above.

http://stackoverflow.com/q/27117489
has comment: http://stackoverflow.com/comment/42739231
has comment: http://stackoverflow.com/comment/42739074
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42737318
upvote count: 1
has title: Java not making sense with Tic Tac Toe program
type: Question
has comment: http://stackoverflow.com/comment/42759175
has comment: http://stackoverflow.com/comment/42737328
downvote count: 0
has answer: http://stackoverflow.com/a/27117574
has body: This has been my side project in APCS the past few weeks and I almost have it done. I'm basically making a simple gui with swing that has a grid of buttons and displays images like tic tac toe. However I just can't get the win sequence to work. I've resorted to using a method I found online and it's still not working; in fact it's not even making sense. I have 1 print statement to test values and it's printing 4 times. I'm just at a complete lost. Something to note is that I'm doing this on my home PC so I don't have the images on this pc, but I don't think that will affect the program...? Heres the code(I think the problem is in the gameover()) int XgoesFirst=0; int[] press= {0,0,0,0,0,0,0,0,0}; int count=0; int over=0; String Xmess=("Cross for you laymens out there"); String Omess=("Naught for you laymens out there"); String rowWinner=""; String diagWinner=""; String columnWinner=""; private class CellButtonHandler implements ActionListener{ public void actionPerformed(ActionEvent e) { ImageIcon xImage = new ImageIcon("images.jpg"); JButton pressed=(JButton)(e.getSource()); if(gameover()){ if(XgoesFirst==0){ pressed.setIcon(xImage); pressed.setText(Xmess); XgoesFirst=XgoesFirst+1; press[count]+=1; over++; }else if(XgoesFirst==1){ pressed.setIcon(new ImageIcon("O.jpg","")); pressed.setText(Omess); XgoesFirst=XgoesFirst-1; press[count]+=1; over++; } } count++; System.out.println(gameover()); } } } public boolean gameover(){ if(cells[0].getText().equals(cells[1].getText()) &amp;&amp; cells[1].getText().equals(cells[2].getText())){ return true; }else{ if(cells[3].getText().equals(cells[4].getText()) &amp;&amp; cells[4].getText().equals(cells[5].getText())){ return true; }else{ if(cells[6].getText().equals(cells[7].getText()) &amp;&amp; cells[7].getText().equals(cells[8].getText())){ return true; }else{ if(cells[0].getText().equals(cells[3].getText()) &amp;&amp; cells[3].getText().equals(cells[6].getText())){ return true; }else{ if(cells[1].getText().equals(cells[4].ge…
tagged with: logic
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42737437
has comment: http://stackoverflow.com/comment/42738964
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42740056
tagged with: swing

finalize
type: Tag
tag name: finalize
tags question: http://stackoverflow.com/q/27014430

http://stackoverflow.com/q/27103529
tagged with: loopj
type: Question
tagged with: uri
upvote count: 5
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm trying to select image from gallery then convert this image to File and send it via HttpPost but I'm getting always FileNotFoundException. This my Code : Selecting the photo public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { if (requestCode == 1) { // currImageURI is the global variable I’m using to hold the content: currImageURI = data.getData(); //Save the currImageUri (URI type) to global variable. photosHolder.getInstance().setOneIm(currImageURI); } } } Converting the photo // First Try File myFile = new File((photosHolder.getInstance().getOneIm()).toString()); params.put("visit_report[photos_attributes][0][file]",myFile); **The exception Raised here // second try File myFile2 = new File((photosHolder.getInstance().getOneIm()).getPath()); params.put("visit_report[photos_attributes][1][file]",myFile2); ** Also here And those are myFiles Value while debuging : mFile : content:/com.android.providers.media.documents/document/image%3A19143 myFile2 : /document/image:19143 So any help ? Update I have tried this solution also : //get The real path from uri then save it (and then use it to create the file) photosHolder.getInstance().setUriString(getRealPathFromURI(currImageURI)); //Convert the image URI to the direct file system path of the image file private String getRealPathFromURI(Uri contentURI) { String result = ""; try { Cursor cursor = getActivity().getContentResolver().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similar local file path result = contentURI.getPath(); } else { cursor.moveToFirst(); int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); // Exception raised HERE cursor.close(); } } catch (Exception e) { e.printStackTrace(); } return result; } But I got java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before a…
type: UnansweredQuestion
score: 5
tagged with: android
tagged with: java
tagged with: file
has title: Create File from Uri type android
has answer: http://stackoverflow.com/a/27103868

http://stackoverflow.com/comment/42659771
type: QuestionComment
has text: @HareshChhelana, you are right there is a lot of confusion between primitive data type
score: 0
comment on: http://stackoverflow.com/q/27073944
type: Comment

http://stackoverflow.com/comment/42671114
type: Comment
has text: This onCall gets invoked automatically. No explicit call is required.
comment on: http://stackoverflow.com/a/27057902
type: AnswerComment
score: 0

http://stackoverflow.com/comment/54680237
has text: Finally over 15 reputation. I'm keeping my word and upvoting your solution. Thanks again @Tadej Gašparovič
type: AnswerComment
comment on: http://stackoverflow.com/a/27088773
score: 0
type: Comment

http://stackoverflow.com/q/27115009
tagged with: jfreechart
type: Question
has comment: http://stackoverflow.com/comment/42734350
has comment: http://stackoverflow.com/comment/42769465
score: 0
has title: Java Swing - JFreeChart works slowly
duplicate of: http://stackoverflow.com/q/27136131
has body: I use JFreeChart to plot splines and polynimials. For charts I use XYSeriesCollection. When I have more than 30 splines, my program works slowly. YourKit shows me this: As far as I understand, the draw of splines works slowly. How it is possible to get rid of this problem? Movement of a point lags behind a mouse already in case of 30 splines, so what will be in case of 100+ splines?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26876749
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/27136131
tagged with: swing

http://stackoverflow.com/a/27022228
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27022138
has body: Java adds a default constructor to every class that doesn't provide one. A constructor is a method without a return type. So, in your case the default constructor DownloadHandler() is automatically added to your class and it does not take any parameters while you are trying to initialize it with a String. The String you are using in main method right now is coming from console from user.

http://stackoverflow.com/comment/42611591
has text: you are getting on the idea...please elaborate more with some pseudocode...i m trying this by the way
type: Comment
comment on: http://stackoverflow.com/a/27046591
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42630442
type: Comment
type: QuestionComment
has text: Do you really need to give an HTML element an `id` in this way? `ids` are not available on the server as you seem to have assumed :).
score: 1
comment on: http://stackoverflow.com/q/27057462

http://stackoverflow.com/a/27036110
accepted answer of: http://stackoverflow.com/q/27032778
score: 1
answers question: http://stackoverflow.com/q/27032778
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42603860
type: Answer
has body: Provided auto-commit set to false Then the answer is straight-forward if you are concerning on querying in the middle of insert (as you have mentioned in comment on another answer): Given that in same connection, you cannot do query before your previous insert statement finished, that means your query needs to be from another connection. In Oracle, before any insert/update/delete is committed, the change is not visible to other connection. That means, the query will see the snapshot before any insert is done, until you commit the change. Then you should have no concern about the insert order in such aspect.
downvote count: 0

http://stackoverflow.com/comment/42736767
has text: this works, but only from 0 to 2. how do i do it from say, 2 to 5, or something like that?
comment on: http://stackoverflow.com/a/27117225
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27148701
has answer: http://stackoverflow.com/a/27149087
has title: Avoid using instanceof Patterns
has comment: http://stackoverflow.com/comment/42792748
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27148745
has body: I want to avoid the using of instanceof: here is my case : The definition of my Events classes are in a commons module : public class Event1 extends AbstractEvent{ } public class Event2 extends AbstractEvent{ } public class Event3 extends AbstractEvent{ } in another module called jms i have a listener that receive Event message from a queue : public class MyMessageListener implements MessageListener { @Override public void onMessage(Message message) { // CONVERT message to Event Object if (event instanceof Event1) { // Execute Processing 1 } if (event instanceof Event2) { // Execute Processing 2 } if (event instanceof Event3) { // Execute Processing 3 } } I want to avoid using instanceof and the best things for doing this is the visitor pattern with an execute method in the AbstractEvent and every leaf classes will implement it . My problem is that in the common package i don't have access to the classes responsible for the processing . theses classes exist only in the jms module . Is there any Tips or hint to do this (Advanced Visitor) or another pattern to do that
tagged with: java
accepted answer: http://stackoverflow.com/a/27149115
tagged with: design-patterns
has answer: http://stackoverflow.com/a/27148777
type: Question
tagged with: oop
has answer: http://stackoverflow.com/a/27149115
score: 0
possible better answer: http://stackoverflow.com/a/27148745

http://stackoverflow.com/q/27084006
has comment: http://stackoverflow.com/comment/42677786
has comment: http://stackoverflow.com/comment/42677113
score: -1
has comment: http://stackoverflow.com/comment/42677598
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/42677225
answer count: 1
has body: About an hour or so ago I exported a different program into a runnable jar and it worked perfectly. Now when I right click export on my project and do everything else necessary all I get is the window of my program, when I type things in and press enter none of the code runs. My project has 2 classes and 1 text file that it reads. So I did the export with libraries required into a folder and nothing is in the file. Is it because it reads from a text file? is the text file not packaging with the jar?
has comment: http://stackoverflow.com/comment/42677092
has comment: http://stackoverflow.com/comment/42677249
favorite count: 0
has answer: http://stackoverflow.com/a/27084222
has comment: http://stackoverflow.com/comment/42677154
has title: How do I properly export a runnable jar?
has comment: http://stackoverflow.com/comment/42677447
has comment: http://stackoverflow.com/comment/42677223
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/106368269
has comment: http://stackoverflow.com/comment/42679525
downvote count: 1
has comment: http://stackoverflow.com/comment/42677121
tagged with: java

http://stackoverflow.com/q/27075290
tagged with: constructor
has answer: http://stackoverflow.com/a/27075316
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27075309
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27075309
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/42661911
linked to: http://stackoverflow.com/q/2054022
accepted answer: http://stackoverflow.com/a/27075316
has title: Alternate constructor invocation
has body: I've been reading an article about constructors in Java and come across the following piece of text: Execution of instance variable initializers and instance initializers is performed regardless of whether the superclass constructor invocation actually appears as an explicit constructor invocation statement or is provided automatically. (An alternate constructor invocation does not perform this additional implicit execution.) It's a bit unclear to me about the sentence in parenthesis. Does that mean if we don't specify the alternate constructor to be invoked explcitly, it won't be called implicitly as this(), right?

http://stackoverflow.com/a/27144703
has comment: http://stackoverflow.com/comment/42814640
downvote count: 0
has comment: http://stackoverflow.com/comment/42786756
accepted answer of: http://stackoverflow.com/q/27144566
answers question: http://stackoverflow.com/q/27144566
score: 5
type: AcceptedAnswer
has body: The class sunw.io.Serializable is deprecated and hence shouldn't be used. It looks like JDK 8 has got rid of this, and hence not available for use at runtime. http://www.cis.upenn.edu/~bcpierce/courses/629/jdkdocs/api/sunw.io.Serializable.html You need to use java.io.Serializable instead.
upvote count: 5
type: Answer

http://stackoverflow.com/comment/42544750
has text: So perhaps in the for loop after `for (int i = 0; i < w; i++) {` before the inner for loop where you use the 2nd dimension (a guess as I haven't really studied your code).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27008163
score: 1

apache-poi
tags question: http://stackoverflow.com/q/27002355
tags question: http://stackoverflow.com/q/27125051
tags question: http://stackoverflow.com/q/27070262
tags question: http://stackoverflow.com/q/27088169
type: Tag
tags question: http://stackoverflow.com/q/27009084
tags question: http://stackoverflow.com/q/27005386
tags question: http://stackoverflow.com/q/27060902
tags question: http://stackoverflow.com/q/26992908
tags question: http://stackoverflow.com/q/27054569
tag name: apache-poi
tags question: http://stackoverflow.com/q/27084837
tags question: http://stackoverflow.com/q/27005996
tags question: http://stackoverflow.com/q/27069135
tags question: http://stackoverflow.com/q/27097885
tags question: http://stackoverflow.com/q/27011634
tags question: http://stackoverflow.com/q/27121755
tags question: http://stackoverflow.com/q/27134158
tags question: http://stackoverflow.com/q/27106002
tags question: http://stackoverflow.com/q/27137250

http://stackoverflow.com/comment/42773484
type: Comment
comment on: http://stackoverflow.com/a/27137027
score: 0
type: AnswerComment
has text: yes, it was one of the errors - thank you I fixed that one :)

http://stackoverflow.com/q/27103906
has comment: http://stackoverflow.com/comment/42711541
has title: Why does my Java code not compile?
has comment: http://stackoverflow.com/comment/42711464
answer count: 1
tagged with: initialization
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42711495
downvote count: 6
score: -5
tagged with: java
upvote count: 1
has body: I have this fragment of code: @RequestMapping(value = "/addQuestion", method = RequestMethod.POST) public String addQuestion(){ ViewController viewController ; viewController.createQuestion(int questionId, String theQuestion, String category, String correctAnswer); return "qFour"; } and the line beginning 'viewController.createQuestion' is underlined in red saying variable 'viewController' might not have been initialized. when I try ViewController viewController = null; (i.e. initializing it, it complains again for another reason) why does it need initializing? can someone instruct me what is syntactically wrong with this code?
type: Question
has comment: http://stackoverflow.com/comment/42711709
has answer: http://stackoverflow.com/a/27103929
has comment: http://stackoverflow.com/comment/42712922

http://stackoverflow.com/comment/42673880
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27082192
type: Comment
has text: Thanks for the help.I was aware of this method.I was just thinking if there could be other method where we can directly set it in the response instead of creating another class.Anyways i will use this.

http://stackoverflow.com/comment/42665180
type: AnswerComment
type: Comment
has text: Thank you so much... This is exactly what I needed, your a lifesaver :)
score: 0
comment on: http://stackoverflow.com/a/27075594

http://stackoverflow.com/comment/42616628
comment on: http://stackoverflow.com/q/27049547
score: 0
type: Comment
type: QuestionComment
has text: Show your Node class

http://stackoverflow.com/comment/42773769
has text: Thanks! I realised what I was doing wrongly, and I got it sorted :) Thank you very much! :)
score: 0
comment on: http://stackoverflow.com/q/27136812
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27141038
type: Question
tagged with: jar
has comment: http://stackoverflow.com/comment/42818603
has comment: http://stackoverflow.com/comment/42848008
has comment: http://stackoverflow.com/comment/42779691
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42783591
has answer: http://stackoverflow.com/a/27168228
favorite count: 0
has comment: http://stackoverflow.com/comment/42779708
has body: My project's jar file size is getting bigger and bigger as more stuff is added into it. I am wondering if someone has tips on how to generate a smaller jar file. I export it as a Runnable JAR file and the library handling is Copy required libraries into a sub-folder next to the generated JAR. In the Properties - Java Compiler - Classfile Generation, everything is unticked. With these options, I was able to save approx 3MB of space. And I am hoping I can save more by removing the unneeded data. My .jar file has a .java._trace files in it. How can I remove this from the jar file? A .xtend and .class file is also there for each class. Since the .class file is just a conversion of the .xtend, I want to remove either one of these from the jar file. How can I achieve this? I would appreciate any tips and tricks that can help me reduce the size of the jar file.
tagged with: xtext
type: UnansweredQuestion
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/42803586
has title: ECLIPSE: How to export the smallest jar file
score: 1
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/42534247
has text: @TarunChaudhary: What do you mean by that? It's unclear what you're trying to achieve *and* what you're actually seeing... along with the problem of being 1 hour out in your understanding of IST.
comment on: http://stackoverflow.com/a/27002052
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/102623723
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27006517
has text: what does the parameter(this,null,anInstance, whatever) do here?
type: AnswerComment

http://stackoverflow.com/a/27103972
type: Answer
has comment: http://stackoverflow.com/comment/44962491
has comment: http://stackoverflow.com/comment/42771573
has body: It's not true that arrays are considerably faster than collections - some collections are just wrappers over arrays so you loose nothing but gets the best of both worlds. Coming back to your case I think you can use Arrays.asList (a list backed by your array) or ImmutableList (if you don't need growing array) whatever suits you but don't use Arrays. The very first sign is that you have to write unnecessary code (your answer and more in future) which you'll have to maintain/tune in future, in my experience it's not worth it. Java is a higher level language and such tiny optimizations should be better left to Java for all the good reasons but even after all this if you still have doubts I would suggest you to write a micro benchmark to validate your assumption.
has comment: http://stackoverflow.com/comment/42736167
has comment: http://stackoverflow.com/comment/42729963
has comment: http://stackoverflow.com/comment/42729687
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/42729158
downvote count: 0
has comment: http://stackoverflow.com/comment/42772238
has comment: http://stackoverflow.com/comment/42735731
answers question: http://stackoverflow.com/q/27087881
has comment: http://stackoverflow.com/comment/42771187

http://stackoverflow.com/comment/42789916
comment on: http://stackoverflow.com/q/27146823
type: Comment
type: QuestionComment
has text: show your `web.xml` code
score: 0

http://stackoverflow.com/q/27020963
type: Question
accepted answer: http://stackoverflow.com/a/27021114
has body: I am programming a game. Most of my code is working fine, but I have a few problems. The gist of the game is that there is an initial combination, and then each player gives "bets" every turn. I have to subtract these bets from the combination and announce the winning player when the combination is"000". The problem I have, is with the second bet(by player two), I can't get the substraction to work. Here is an example of what I should get: initial combination: 333 player one bet:122 211(after substracting digit individually) player two bet: 211 =000 winner:player one The things is when it comes to player two I get a value of "122" instead of "000". I would just like to know if there is a problem with my code, and if I called the method(appliquerCoup),which is the method that does the substraction, correctly. Thank you! do{ if(num%2==0){ System.out.println(MessagesTp2.COUP_DU_JOUEUR1); }else{ System.out.println(MessagesTp2.COUP_DU_JOUEUR2); } coup=Clavier.lireString(); rep=coupEstValide(combinaison,coup); while(rep!=true){ System.out.println(MessagesTp2.COUP_INVALIDE); coup=Clavier.lireString(); } nouvelleValeur=appliquerCoup(combinaison,coup); System.out.println("=&gt;"+nouvelleValeur); num++; }while(!nouvelleValeur.equals("000")); if(nouvelleValeur.equals("000")){ if(num%2==0){ System.out.println(MessagesTp2.GAGNANT_JOUEUR1); }else{ System.out.println(MessagesTp2.GAGNANT_JOUEUR2); } } } public static String appliquerCoup(String combinaison,String coup) { String nouveauCoup = ""; if(combinaison!=null&amp;&amp;coup!=null){ for(int i = 0; i &lt; combinaison.length(); i++) { int a = Integer.parseInt(combinaison.substring(i, i + 1)); int b = Integer.parseInt(coup.substring(i, i + 1)); int c = a - b; if(c &lt; 0){ c=0; }else{ c=c; } nouveauCoup+=String.valueOf(c); } } return nouveauCoup; }
score: 0
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/27021114
type: AnsweredQuestion
tagged with: java
tagged with: methods
has title: Substracting strings

http://stackoverflow.com/comment/42782574
type: Comment
type: QuestionComment
has text: It makes sense but not in Java or C++ for which returning void is denoted by a return without an argument. Anyway, you often see a void returning function as a procedure, i.e. a piece of code with a side effect, rather than a function that computes... no value.
score: 0
comment on: http://stackoverflow.com/q/27142891

http://stackoverflow.com/q/27054794
has answer: http://stackoverflow.com/a/27141712
accepted answer: http://stackoverflow.com/a/27141712
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/42626573
favorite count: 0
has comment: http://stackoverflow.com/comment/42626624
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/42626218
has comment: http://stackoverflow.com/comment/42626117
downvote count: 0
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42626132
has comment: http://stackoverflow.com/comment/42626085
has body: I want to move false elements in empty space (just like in Schelling's Model of Segregation). This is the array ..(the elements in the array are placed randomly) 'X*''O'' ''X''O*' 'O''O'' '' ''X' 'O'' ''X''X''O*' 'X'' '' ''X''X' 'X''X''O*''X''O*' the element at (0,0),(0,4),(2,4),(4,2),(4,4) are false because it does no have similar elements around it.(i have * next to it is easier for you to see). I want to move those false elements to blank location ' ' in the array. It can be moved to any empty location in the array. ' ''O''X''X'' ' 'O''O''O'' ''X' 'O''O''X''X'' ' 'X''O''O''X''X' 'X''X'' ''X'' ' This is my code. //isArrGood is a method that checks if the element is false or true //arr is 2D array that is being passed in the method //store the false elements char[] falseEle = new char[arr.length * arr[0].length]; for(int i=0; i&lt;arr.length; i++){ for(int j=0; j&lt;arr[i].length; j++){ if(!isArrGood(arr,i,j)){ falseEle[i] = arr[i][j]; } } } //finds the blank space and replaces it with a false cell and finds a false cell and //replace it with a blank space for(int x=0; x&lt;arr.length; x++){ for(int y=0; y&lt;arr[x].length; y++) { if (arr[x][y] == ' ') { arr[x][y] = falseEle[x]; } if(!isArrGood(arr,x,y){ arr[x][y] = ' '; } } } This is the what i get. the current array(arr) being send in the method is. The false elements in this array are at (1,0),(2,2),(3,2) ' ' 'X' 'X' 'X' 'X' 'O' ' ' 'X' 'X' ' ' ' ' 'X' 'O' ' ' 'X' 'O' 'O' 'X' ' ' 'O' 'O' 'O' ' ' 'O' ' ' And this is what I get '' 'X' 'X' 'X' 'X' 'O' 'O' 'X' 'X' 'O' 'O' 'X' 'O' 'O' 'X' 'O' 'O' 'X' 'X' 'O' 'O' 'O' '' 'O' '' The array on the very top is just a example of what I am trying to do.
has title: moving elements in array to empty location
upvote count: 1

http://stackoverflow.com/comment/42692935
score: 0
has text: And of course this underlines @stringy05 's point that it is easy to screw up transactions when your code is managing them at a low level like this. :-)
comment on: http://stackoverflow.com/q/27023935
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42737657
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27117586
score: 0
has text: My sincere suggestion: learn to use a debugger. Simply tracing through your code and watch change in your variable, you will see what goes wrong. To be honest I have no idea why you write your code like this . One thing I can tell is, if I remove the innermost loop (with k as counter), you will see green circle in each square. It seems implies that you messed up your (poorly-named) variables in that loop. That should be a hint big enough for you to continue your work

http://stackoverflow.com/comment/42539346
type: Comment
comment on: http://stackoverflow.com/q/27000555
score: 1
type: QuestionComment
has text: Can you run `System.out.println( Arrays.toString(DateTimeUtils.getDateFormatSymbols(new Locale("pt","BR")).getShortMonths()))` on your laptop and on the server and see if there are any differences? Perhaps lowercase month names as BasilBourque believes?

http://stackoverflow.com/comment/42748514
has text: No.... 20 and 4500 are frequencies in Hz. Since autocorrelation is method in time domain you need to convert the frequency limits to time limits in period in samples
comment on: http://stackoverflow.com/a/27123449
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/100325422
comment on: http://stackoverflow.com/a/27173652
has text: It stands already in the answer - the linked-in documentation and example shows how to do exactly that. Is there anything still not clear?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42726166
comment on: http://stackoverflow.com/q/27111631
type: Comment
type: QuestionComment
has text: You need something like `array[0][0] = new Slot();` for every element.
score: 0

http://stackoverflow.com/comment/42686026
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27089191
has text: @csal you can print them simply by writing System.out.print(buffer2[j] + " ");
type: AnswerComment

http://stackoverflow.com/q/27133169
type: Question
has answer: http://stackoverflow.com/a/27133247
score: 1
tagged with: java
has title: Adding the diagonal of a 4x4 array
has body: I'm trying to add the diagonal of a 4x4 matrix that the user inputs, and when I run the program, my line with the addition of all 4 values in the array gives an error. Am I not adding them correctly? import java.util.Scanner; public class Set_9_P7_2 { public static void main(String[] args) { double x; double[][] sumMajorDiagnol = new double[4][4]; System.out.println("Enter a 4-by-4 matrix row by row:"); Scanner input = new Scanner(System.in); for (int i = 0; i &lt; sumMajorDiagnol.length; i++) { for (int j = 0; j &lt; sumMajorDiagnol.length; j++) { sumMajorDiagnol[i][j] = input.nextDouble(); } } x = sumMajorDiagnol[1][1] + sumMajorDiagnol[2][2] + sumMajorDiagnol[3][3] + sumMajorDiagnol[4][4]; System.out.println("The sum of the elements in the major diagnal is " + x); } } Instead of it printing the actual answer 4, I get this error: Enter a 4-by-4 matrix row by row: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at Set_9_P7_2.main(Set_9_P7_2.java:21) which points to this line: x = sumMajorDiagnol[1][1] + sumMajorDiagnol[2][2] + sumMajorDiagnol[3][3] + sumMajorDiagnol[4][4]; Is this not how you're supposed to add them?
downvote count: 0
favorite count: 0
tagged with: multidimensional-array
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27133194
has answer: http://stackoverflow.com/a/27133226
tagged with: addition
upvote count: 1

http://stackoverflow.com/q/27049130
accepted answer: http://stackoverflow.com/a/27062173
score: 1
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/42623078
upvote count: 1
tagged with: swing
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42616336
linked to: http://stackoverflow.com/q/25526833
has comment: http://stackoverflow.com/comment/42615943
tagged with: jtable
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42616394
favorite count: 0
has body: currently I have data in MySQL server and I am calling the datas onto the JTable through JDBC. However there are 1369 rows and it seems that it has too much data for it to load. It usually takes 5 minutes to load. Are there anyways to optimize the process? This is my code(I apologize in advance for a messy code): public class DataTable { private String databaseName = "*****"; private String tableName = "******"; public void showDatabase(){ Connection conn = null; DatabaseMetaData meta = null; Statement stmt = null; ResultSet rs = null; int k = 0; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); String connectionUrl = "jdbc:mysql://localhost:3306/" + databaseName; String connectionUser = "*****"; String connectionPassword = "*****"; conn = DriverManager.getConnection(connectionUrl, connectionUser, connectionPassword); stmt = conn.createStatement(); meta = conn.getMetaData(); dataSets(stmt, meta); }catch(Exception e){ e.printStackTrace(); } finally{ try { if (rs != null) rs.close(); } catch (SQLException e) { e.printStackTrace(); } try { if (stmt != null) stmt.close(); } catch (SQLException e) { e.printStackTrace(); } try { if (conn != null) conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } //return the column size of the table public int getColumnNumber(DatabaseMetaData meta, Statement stmt) throws SQLException { //ResultSet rs = meta.getColumns(null, null, "practiceexample", null); ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName); ResultSetMetaData rsmd = rs.getMetaData(); int columnsNumber = rsmd.getColumnCount(); return columnsNumber; } //return the rowNumber of the tables public int getRowNumber(Statement stmt) throws SQLException { ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM " + tableName); int rowCount = 0; while(rs.next()){ rowCount = rs.getInt(1); } return rowCount; } public void dataSets(Statement stmt, DatabaseMetaData meta) throws SQLException { String[] columnNames = new String[getColumnNumber(meta, stm…
has comment: http://stackoverflow.com/comment/42654934
has title: Optimize data calling in JDBC onto JTable
tagged with: jdbc
has answer: http://stackoverflow.com/a/27062173

http://stackoverflow.com/q/27008908
tagged with: infinite-loop
accepted answer: http://stackoverflow.com/a/27008922
has body: I have a coding assignment for my class that involves checking for characters for a "Tweet tester". There is something wrong with the following code, and I believe that it's an infinite loop, but I don't know what's causing it. Basically, every time I input a value, the interactions pane stops and just gives me a loading icon. Scanner scan = new Scanner(System.in); System.out.println("Tweet something!"); String tweet = scan.nextLine(); int mention1 = 0; while (mention1 &lt; tweet.length()); { mention = tweet.charAt (mention1); if (mention == '@') { if (tweet.charAt(mention1 + 1) != ' ' || tweet.charAt (mention1 + 1) != '\t') { mentionCount++; } } mention1++; } System.out.println ("Number of Mentions: " + mentionCount); Also, the part of the assignment displayed is supposed to tell the user how many mentions there are in the tweet (entered by the user), and is supposed to exclude any @ followed by a space or a tab.
downvote count: 0
answer count: 1
favorite count: 0
tagged with: while-loop
tagged with: syntax
has answer: http://stackoverflow.com/a/27008922
upvote count: 1
has title: Interactions Pane stops and keeps on displaying a loading icon after inputing something
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: char

http://stackoverflow.com/a/27012590
has body: what I want is to get this information (the same way as we can get public key information, or issuer or other items) of the certificate, not calculate it. The reason why you cannot get the fingerprint like you can get the public key or issuer, is that the fingerprint is not like those values, it is notpart of the certificate. Public key and issuer are part of it and, therefore, merely have to be read from the certificate, but the fingerprint is not a part of it and, consequently, has to be calculated. Microsoft's presentation of certificates is a bit misleading because it presents the fingerprint as if it was contained in the certificate but actually Microsoft has to calculate the fingerprint, too. This is especially misleading because a certificate actually has many fingerprints, and Microsoft only displays the fingerprint it seems to use internally, i.e. the SHA-1 fingerprint.
score: 5
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/27005987
answers question: http://stackoverflow.com/q/27005987

http://stackoverflow.com/q/27123909
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42754084
has title: JUnit rules TemporaryFolder - Error on Bamboo
score: 0
has comment: http://stackoverflow.com/comment/42753421
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/42753186
has comment: http://stackoverflow.com/comment/42752374
has answer: http://stackoverflow.com/a/27127393
accepted answer: http://stackoverflow.com/a/27127393
has body: I wrote some UT with the JUnit Rule TemporaryFolder. In my UT, I mock a service to return this directory like this: @Rule public TemporaryFolder folder = new TemporaryFolder(); ... @Test public void myTest(){ when(myMock.doSomething()).thenReturn(folder.getRoot()); ... Then in the service, folder is used like this: IOFileFilter filtreBasique = new NameFileFilter(tagRCPName + ".xml", IOCase.INSENSITIVE); FileUtils.listFiles(folder, filtreBasique, TrueFileFilter.TRUE); When I run my UT on my computer, it is all OK, but when I try to run it on Bamboo, I have this error: java.lang.IllegalArgumentException: Parameter 'directory' is not a directory at org.apache.commons.io.FileUtils.listFiles(FileUtils.java:358) I cannot figure out why...
tagged with: bamboo
tagged with: rule

http://stackoverflow.com/comment/42669268
type: Comment
has text: Oh...no...Its still sticked at the same point. I wonder lets try to print some thing before we take control of another window..
comment on: http://stackoverflow.com/a/27064465
type: AnswerComment
score: 0

http://stackoverflow.com/q/27138433
has title: In Install4j, what can I do to fix an java.lang.OutOfMemoryError caused by installing too many installers with too many files?
tagged with: install4j
has body: Some of our testers using the Install4j installers that we produce, are receiving an OurOfMemoryError part way through the process. After a closer inspection, we've narrowed it down to the .install4j/files.log file that Install4j generates. The cumulative entries in this file from all the installers that they run has caused the file to grow larger than 27mb. My question is what can I do to manage this file so that I don't have this OutOfMemoryError occur anymore? Do I simply have to clear it before every install, or is there a way I can override it to not generate anything at all? As an alternative, is there any reason I couldn't or shouldn't just delete the .install4j directory? Here is the stacktrace leading up to the OutOfMemoryError. java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Unknown Source) at java.lang.StringValue.from(Unknown Source) at java.lang.String.&lt;init&gt;(Unknown Source) at java.io.Win32FileSystem.resolve(Unknown Source) at java.io.File.&lt;init&gt;(Unknown Source) at com.install4j.runtime.installer.helper.fileinst.FileLogger.readEntries(Unknown Source) at com.install4j.runtime.installer.helper.fileinst.FileLogger.read(Unknown Source) at com.install4j.runtime.installer.helper.fileinst.MainFileInstallerState.setLogDir(Unknown Source) at com.install4j.runtime.installer.helper.fileinst.FileInstaller.setLogDir(Unknown Source) at com.install4j.runtime.beans.actions.InstallFilesAction.install(Unknown Source) at com.install4j.runtime.installer.InstallerContextImpl$2.fetchValue(Unknown Source) at com.install4j.runtime.installer.helper.comm.actions.FetchObjectAction.execute(Unknown Source) at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionDirect(Unknown Source) at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionInt(Unknown Source) at com.install4j.runtime.installer.helper.comm.HelperCommunication.executeActionChecked(Unknown Source) at com.install4j.runtime.installer.help…
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/27145799
downvote count: 0
favorite count: 0
type: Question
tagged with: out-of-memory
upvote count: 2
tagged with: logging
tagged with: installation
tagged with: java
has answer: http://stackoverflow.com/a/27145799
answer count: 1

http://stackoverflow.com/comment/42743847
comment on: http://stackoverflow.com/q/27121397
type: Comment
type: QuestionComment
score: 1
has text: The `-l` option (as in lower-case `l`) and the `-I` (as in upper-case `i`) options do different things. The `-l` (lower-case `l`) adds a library search path for the linker, the `-I` (upper-case `i') adds a search path for the preprocessor to look for header files.

http://stackoverflow.com/a/27000928
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27000788
has body: public void takeReceipts(String[] receipts){ for (int i=0; i&lt; receipts.length; i+=5) handleReceipts(Arrays.copyOfRange(receipts, i, Math.min(i+4, receipts.length-1))); } private void handleReceipts(String[] receipts){ } OR public void takeReceipts(String[] receipts){ for (int i=0; i&lt; receipts.length; i+=5) handleReceipts(Arrays.asList(receipts).subList(i, Math.min(i+4, receipts.length-1))); } private void handleReceipts(List&lt;String&gt; receipts){ }
downvote count: 0
score: 1

http://stackoverflow.com/comment/42639897
comment on: http://stackoverflow.com/q/27062188
type: Comment
score: 0
type: QuestionComment
has text: @Selvin i'm getting error markers in the code.I am not implementing it in the right way.If you could refer me to somewhere i can check out more code i'd highly appreciate.

http://stackoverflow.com/a/30941142
downvote count: 0
has body: I got the same issue, an before installing packages mention above, I included JavaFX SDK and I put it on top of my "Order and Export". e(fx)clipse start working without any Unknown property and the Auto-Complete starts working as well. Project -> Properties -> Java Build Path -> Order and Export Tab and put the JavaFX SDK on the top...
upvote count: 2
answers question: http://stackoverflow.com/q/27130489
type: Answer
score: 2

http://stackoverflow.com/a/27152723
type: AcceptedAnswer
upvote count: 1
has comment: http://stackoverflow.com/comment/42799881
has comment: http://stackoverflow.com/comment/42799984
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27152495
has body: Change your program from Integer to String and try this : String constructed_array[] = { "265", "141", "148" }; List&lt;Integer&gt; myNewList = new ArrayList&lt;Integer&gt;(constructed_array.length); for (String str : constructed_array) { myNewList.add(Integer.parseInt(str)); } Now the object myNewList contains [265, 141, 148]. Edit For the primitive array you can do this : String constructed_array[] = { "265", "141", "148" }; int[] myPrimitiveArray = new int[constructed_array.length]; for (int i = 0; i &lt; constructed_array.length; i++) { myPrimitiveArray[i] = Integer.parseInt(constructed_array[i]); } myPrimitiveArray is a primitive array that contain [265, 141, 148].
answers question: http://stackoverflow.com/q/27152495

http://stackoverflow.com/a/27061508
type: Answer
answers question: http://stackoverflow.com/q/27061138
score: 0
has body: You could return an OptionalDouble, which makes it obvious to the caller that they need to handle the case of the result not being found: try { // get ret return OptionalDouble.of(ret); } catch (SQLException ex) { return OptionalDouble.empty(); }

http://stackoverflow.com/q/27096819
has comment: http://stackoverflow.com/comment/42699242
has answer: http://stackoverflow.com/a/27097095
has title: JFileChooser seems to be running, but not showing
tagged with: jfilechooser
has comment: http://stackoverflow.com/comment/42698981
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42699289
has comment: http://stackoverflow.com/comment/42699442
has comment: http://stackoverflow.com/comment/42698974
has body: I'm trying to create a program that involves the use of JFileChooser so that a user may give the program a file's path for manipulation. When I attempt to launch the JFileChooser, nothing appears and the programs pauses (or rather it seems that it is pausing). I feel that the JFileChooser is running, but not showing up graphically. I'm even getting a Java program icon in my application tray when it runs, something I only get when I run graphical programs. I've clicked it and checked for available windows under the running application, but there are none. I have no idea why this is the case. My code, even though it's very similar to that of tutorials I've found online, is: final JFileChooser userFile = new JFileChooser(); int response = userFile.showOpenDialog(null); if (response == JFileChooser.APPROVE_OPTION) fileName = userFile.getSelectedFile().toString(); else fileName = "The file open operation failed."; MCVE: import lots of stuff; public class zipCracker { private static String fileName; public static void main(String[] args){ String[] buttons = {"Cancel", "zDictionaryForm", "zZipCracker"}; int rc = JOptionPane.showOptionDialog(null, "Which program would you like to use?", "Program Directory", JOptionPane.WARNING_MESSAGE, 0, null, buttons, buttons[0]); if(rc == 2) zZipCracker(); else if(rc == 1) System.exit(0); else System.exit(0); } public static String zZipCracker(){ final JFileChooser userFile = new JFileChooser(); int response = userFile.showOpenDialog(null); if (response == JFileChooser.APPROVE_OPTION) fileName = userFile.getSelectedFile().toString(); else fileName = "The file open operation failed."; //ZipFile zipper = new ZipFile(userFile); return ""; } }
score: 0
tagged with: visibility
has comment: http://stackoverflow.com/comment/42699043
has comment: http://stackoverflow.com/comment/42699401
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42699127
has comment: http://stackoverflow.com/comment/42699016
has comment: http://stackoverflow.com/comment/42699158
tagged with: java

http://stackoverflow.com/a/27060736
score: 1
upvote count: 1
downvote count: 0
has body: I think you can use: &lt;s:set var="newVariable" value="bean.property"/&gt; here you have the doc: http://struts.apache.org/release/2.3.x/docs/set.html
type: Answer
answers question: http://stackoverflow.com/q/27060455

primefaces
tags question: http://stackoverflow.com/q/27103782
tags question: http://stackoverflow.com/q/27143229
tags question: http://stackoverflow.com/q/26992591
tags question: http://stackoverflow.com/q/27063864
tags question: http://stackoverflow.com/q/27061141
tags question: http://stackoverflow.com/q/27066953
tags question: http://stackoverflow.com/q/27131257
tags question: http://stackoverflow.com/q/27088134
tags question: http://stackoverflow.com/q/26999934
tags question: http://stackoverflow.com/q/27141280
tags question: http://stackoverflow.com/q/27104046
tag name: primefaces
tags question: http://stackoverflow.com/q/27152076
tags question: http://stackoverflow.com/q/27123995
tags question: http://stackoverflow.com/q/27149375
tags question: http://stackoverflow.com/q/27013562
tags question: http://stackoverflow.com/q/27086345
tags question: http://stackoverflow.com/q/27011008
tags question: http://stackoverflow.com/q/27037918
tags question: http://stackoverflow.com/q/27024297
tags question: http://stackoverflow.com/q/27094466
type: Tag
tags question: http://stackoverflow.com/q/27066836
tags question: http://stackoverflow.com/q/27105165
tags question: http://stackoverflow.com/q/27144153

http://stackoverflow.com/a/61897103
type: Answer
answers question: http://stackoverflow.com/q/27111806
has comment: http://stackoverflow.com/comment/109768427
has comment: http://stackoverflow.com/comment/116936874
has body: After upgrading my project to Spring Boot 2.3.0, I struggled for hours with the same issue until I realized that as of #19550, Web and WebFlux starters do not depend on the validation starter by default anymore. If your application is using validation features, you’ll need to manually add back a dependency on spring-boot-starter-validation in your build file.
downvote count: 0
score: 51
upvote count: 51

http://stackoverflow.com/q/27013920
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6592468
tagged with: jframe
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/27017842
tagged with: java
has body: Suppose I have some data in a data base and I am retrieving that using query. Example: SELECT * FROM acsuserdetail where "+useranme+"= '"+arg+"' " System.out.print(" FirstName = " + rs.getString("FirstName")); This will return two result i.e.: FirstName = Anurag FirstName = Arvind But when I am showing this data in UI in a JFrame then it is opening two frames having two details and if more details are there then that number of frame will open. This may be because the data which is coming from database are coming one by one not in single shot. I want all information to consolidate in a single frame. Code for UI is:- public UIForShowingData(String data) { frame = new JFrame("Showing Data"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setVisible(true); frame.setSize(300, 300); button = new JButton("OK"); frame.setLayout(null); button.setBounds(250, 250, 40, 50); frame.add(button); System.out.println(data.length()); tx = new JTextField(data); frame.add(tx); tx.setBounds(50, 50, 40, 50); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { frame.dispose(); } }); }
score: 0
linked to: http://stackoverflow.com/q/7229226
tagged with: user-interface
answer count: 1
has title: How to iterate multiple data from DataBase showing in UI in Single Frame?

http://stackoverflow.com/q/27066792
has answer: http://stackoverflow.com/a/27068016
tagged with: android-orientation
has comment: http://stackoverflow.com/comment/42648806
type: Question
tagged with: android-lifecycle
tagged with: android
has answer: http://stackoverflow.com/a/27066880
has comment: http://stackoverflow.com/comment/42648399
score: 0
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/2250770
has answer: http://stackoverflow.com/a/27067047
has comment: http://stackoverflow.com/comment/42647232
type: UnansweredQuestion
tagged with: android-listview
has title: Unable to refresh list without orientation change - Android / Java
has body: I have some code which should allow a user to delete a folder (which it does) then it should be removed from the ‘recent folders’ list - however it is not. The folder remains on the ‘recent folders’ list even after the user has deleted it - which is undesired. /** * Add recent folders to the list in order as acquired by the {@link RecentFolderList}. * * @param destination List of drawer items to populate */ private void addRecentsToList(List&amp;lt;DrawerItem&amp;gt; destination) { // If there are recent folders, add them. final List&amp;lt;Folder&amp;gt; recentFolderList = getRecentFolders(mRecentFolders); // Remove any excluded folder types if (mExcludedFolderTypes != null) { final Iterator&amp;lt;Folder&amp;gt; iterator = recentFolderList.iterator(); while (iterator.hasNext()) { if (isFolderTypeExcluded(iterator.next())) { iterator.remove(); } } } if (recentFolderList.size() &amp;gt; 0) { destination.add(DrawerItem.ofHeader(mActivity, R.string.recent_folders_heading, mBidiFormatter)); // Recent folders are not queried for position. for (Folder f : recentFolderList) { destination.add(DrawerItem.ofFolder(mActivity, f, DrawerItem.FOLDER_RECENT, mBidiFormatter)); } } } The strange part is if I perform an orientation change - the folders are removed from the 'recent folders list' as desired - and I’m unsure as to why this might be happening. I have a feeling the list may simply need to be refreshed (after the folder has been deleted) however I am unsure. Any suggestions, clues or pointers are greatly appreciated. Full Source: http://pastebin.com/fiX4S9fB P.S. Calling notifyDataSetChanged() on the adapter (as suggested by one of the answers below - and whomever flagged this as a duplicate - does not seem to have any effect)

http://stackoverflow.com/comment/42596039
type: Comment
type: QuestionComment
has text: yep, source & target set to 1.8. However it wasn't specified during the project import
comment on: http://stackoverflow.com/q/27037657
score: 0

http://stackoverflow.com/comment/42729272
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27112743
has text: You have to check your network :/

http://stackoverflow.com/comment/42631891
type: AnswerComment
has text: i'm sorry to put you on my problem.. i just check it .. i have different variable for one thing, now the registration process is done.. but i got the problem with the login process, anyway.. thank you so much
type: Comment
comment on: http://stackoverflow.com/a/27057865
score: 0

http://stackoverflow.com/comment/42611154
score: 0
has text: What does the line that defines `Textures.Gui.BOX` look like? Maybe you are unintentionally doing some kind of lazy loading of Textures. Make sure your textures are loaded ahead of time while the user is on some loading screen.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27046410

http://stackoverflow.com/a/27082664
upvote count: 1
has body: Write this: int temp = (((array1[a] - 'a') + (array2[b] - 'a')) % 26) + 'a'; what this does is convert both characters into their respective place in the alphabet, perform addition modulo the number of characters in the alphabet for the wraparound effect, and convert back to the correct ascii value. Note that your code was having trouble because you were acting as though the alphabet's ascii values were their respective places in the alphabet itself, which is incorrect.
answers question: http://stackoverflow.com/q/27082605
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/27040364
answers question: http://stackoverflow.com/q/27040185
has body: Couple of issues: You are using if ((line = reader.readLine()) != null) instead of while which will just write the file length - 1 once into target file. You are using writer.write(files.length - 1); to write to last file, which should be writer.write(line);
accepted answer of: http://stackoverflow.com/q/27040185
score: 0
has comment: http://stackoverflow.com/comment/42600304
type: Answer
has comment: http://stackoverflow.com/comment/42600533
type: AcceptedAnswer

http://stackoverflow.com/comment/42581363
type: AnswerComment
comment on: http://stackoverflow.com/a/27029205
score: 0
type: Comment
has text: It seems these two suggestions are not exclusive. All data access libraries worth their salt will make use of prepared statements.

http://stackoverflow.com/comment/42798383
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27150007
score: 0
has text: But that will create a tight coupling between my class names & the user input. That's wny i have created a bean of the map in xml.

http://stackoverflow.com/comment/42769714
score: 0
type: Comment
type: QuestionComment
has text: Is this a purely theoretical question or do you have an actual requirement for such a thing in your project ? In case the latter is true, could you please provide some sort of insight on that requirement ?
comment on: http://stackoverflow.com/q/27135033

http://stackoverflow.com/a/27097095
upvote count: 2
has comment: http://stackoverflow.com/comment/82435022
downvote count: 0
has comment: http://stackoverflow.com/comment/118285472
type: Answer
answers question: http://stackoverflow.com/q/27096819
has body: It seems that making the JFileChooser object global, private, and static solved my issue. I have no idea where the difference between declaring it in the method and declaring it globally is, but it works. import stuff; public class zipCracker { private static String fileName; private static JFileChooser userFile = new JFileChooser(); //now declared globally public static void main(String[] args){ String[] buttons = {"Cancel", "zDictionaryForm", "zZipCracker"}; int rc = JOptionPane.showOptionDialog(null, "Which program would you like to use?", "Program Directory", JOptionPane.WARNING_MESSAGE, 0, null, buttons, buttons[0]); System.out.println(rc); if(rc == 2) zZipCracker(); else if(rc == 1) System.exit(0); else System.exit(0); } public static String zZipCracker(){ int returnVal = userFile.showDialog(null, "Choose This"); //used without being declared here in the method if (returnVal == JFileChooser.APPROVE_OPTION) fileName = userFile.getSelectedFile().toString(); else fileName = "The file open operation failed."; //ZipFile zipper = new ZipFile(userFile); return ""; } }
score: 2

http://stackoverflow.com/comment/42668022
type: Comment
comment on: http://stackoverflow.com/a/27071989
has text: @Camander, No you wont need to know names, while scanning a package you get class objects, use the method [Class#isAssignableFrom(java.lang.Class)](https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#isAssignableFrom-java.lang.Class-) to determine whether class is a subtype the the calling class: `Parent.class.AssignableFrom(protetialChild)`, if this call retuns `true` then you have found a child, create an instance and add it to the list.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42527644
comment on: http://stackoverflow.com/q/26996505
type: Comment
type: QuestionComment
has text: You haven't updated your code to my example? Remove `R.raw.Integer."word"+toString(i)` and replace with `getResources().getIdentifier("word" + Integer.toString(i), "raw", getPackageName())`
score: 0

http://stackoverflow.com/a/27021957
has comment: http://stackoverflow.com/comment/42568280
has comment: http://stackoverflow.com/comment/42568383
upvote count: 1
has comment: http://stackoverflow.com/comment/42568441
has comment: http://stackoverflow.com/comment/42568363
type: Answer
has comment: http://stackoverflow.com/comment/42568700
has comment: http://stackoverflow.com/comment/42588400
downvote count: 0
score: 1
has body: You can use a 2 dimensional array : Array [Alphabet] [Words starting with that alphabet]
answers question: http://stackoverflow.com/q/27021799
has comment: http://stackoverflow.com/comment/42568353
has comment: http://stackoverflow.com/comment/42568912
has comment: http://stackoverflow.com/comment/42568675

http://stackoverflow.com/q/27125572
tagged with: spring
possible better answer: http://stackoverflow.com/a/27126854
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27126854
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27140894
type: Question
has body: Ok so today I have spent all day trying to figure out how to map a relationship between Orders, Products, and OrderLine with hibernate using annotations all java config. I want OrderLine to be a junction table with extra fields, that joins Products and Orders. Orders has a OneToMany relationsbhip with OrderLine - One order has many order lines. Each Order has one or more OrderLines, Each OrderLine has one Order, Each OrderLine has one Product, Each Product can have 0 or more OrderLines. From what I have been following along with tutorials, there are two ways to do it. One being with @Embeddable, @EmbeddedId annotations and the other being @IdClass annotations, I have tried both with no success I will post my code for my shot at @IdClass method. My orders class @Entity @Table(name="orders") public class Order { @Id @Column(name = "order_id") @OneToMany(fetch = FetchType.EAGER, mappedBy = "order") private Set&lt;OrderLine&gt; orderLines = new HashSet&lt;&gt;(); ...some extra properties relevant to all orders public Order(){} ...setters/getters } My Products class @Entity @Table(name="products") public class Product implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "product_id") public Integer product_id; // primary key @OneToMany(fetch = FetchType.EAGER, mappedBy = "product") private Set&lt;OrderLine&gt; orderLines = new HashSet&lt;&gt;(); ...other properties public Product() { } ...setters/getters } Here is my OrderLine Class @Entity @IdClass(OrderLineId.class) @Table(name="order_line") public class OrderLine implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "product_id", insertable= false, updatable= false) public Integer product_id; @Id @Column(name = "order_id", insertable= false, updatable= false) public Integer order_id; @ManyToOne @JoinColumn(name = "product_id", insertable = false, updatable = false) private Product product; @ManyToOne @JoinColumn(name = "order_id", inserta…
has answer: http://stackoverflow.com/a/27134014
has title: Orders Products and Order_Line Hibernate Relationship with Composite Keys
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/27140894
tagged with: hibernate-mapping

http://stackoverflow.com/comment/42776946
type: QuestionComment
has text: What are the errors of the red x's?
comment on: http://stackoverflow.com/q/27138969
score: 0
type: Comment

http://stackoverflow.com/comment/49864121
has text: Auto-declaring is possible now, starting with Spring AMQP 1.5.0, which is currently in M1. See http://docs.spring.io/spring-amqp/docs/1.5.0.M1/reference/html/_reference.html#async-annotation-driven
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27109934
score: 0

http://stackoverflow.com/comment/42831383
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27151043
has text: i know you must be getting fed up with me by now, but im sorry i dont know how to work around it...
score: 0

http://stackoverflow.com/a/27109801
score: 0
has body: the 1st card's INDEX = 0 the 52nd card's index = 51 so you have to do the inputted number -1
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42723199
type: Answer
has comment: http://stackoverflow.com/comment/42722912
answers question: http://stackoverflow.com/q/27109745

http://stackoverflow.com/comment/42549504
score: 0
type: Comment
type: QuestionComment
has text: @Martin I add fragment1 to back stack and replace fragment1 by fragment2 then I click Back. Is it possible to add view programmatically to fragment and persist SOMEHOW? Or may be I should use Activity, not Fragment?
comment on: http://stackoverflow.com/q/26999603

http://stackoverflow.com/comment/42737152
type: QuestionComment
score: 0
has text: @Mnemonics that seems very plausible! What can I do to handle that more gracefully?
comment on: http://stackoverflow.com/q/27116614
type: Comment

response
tags question: http://stackoverflow.com/q/27119687
tag name: response
tags question: http://stackoverflow.com/q/27011874
tags question: http://stackoverflow.com/q/27003759
type: Tag

http://stackoverflow.com/q/27149595
tagged with: google-search-appliance
has body: Hello I want to specify a keyword to a particular URL through java code. Please suggest the approach how should I go about it.
has answer: http://stackoverflow.com/a/27170443
type: UnansweredQuestion
tagged with: java
type: Question
has title: GSA key words to URLs through JAVA code
score: 0
answer count: 1

http://stackoverflow.com/q/27049453
downvote count: 1
type: Question
has title: JSP WebServet Annotation: URLPattern mapped to Method (GET,POST etc)
has comment: http://stackoverflow.com/comment/42649786
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/42616670
tagged with: jsp
favorite count: 0
has body: Is there any way in creating a Servlet with the @WebServlet annotation to where I can map a urlpattern to a specific HTTP method (doGet(), doPost())? I would like to have a single Servlet with one URL mapped to the doGet() and another URL mapped to the doPost(). For Example: /GetWidget => WidgetServlet.doGet() /UpdateWidget => WidgetServlet.doPost() /CreateWidget => WidgetServlet.doPut() /DeleteWidget => WidgetServlet.doDelete()
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/42653252
tagged with: java
tagged with: annotations
upvote count: 1

android-cursor
tags question: http://stackoverflow.com/q/27027882
tags question: http://stackoverflow.com/q/27145052
tag name: android-cursor
type: Tag

http://stackoverflow.com/comment/42667507
type: Comment
has text: @LuiggiMendoza, Thanks. But I think the answer is something different and I edited it..
comment on: http://stackoverflow.com/a/27078661
score: 0
type: AnswerComment

http://stackoverflow.com/a/27020077
has body: That is pretty normal. Different web pages will use different amounts of memory based on the content they have in them. Where I would be worried is if you keep opening pages and memory never gets freed. That is a memory leak and is cause for concern if you are developing web browsers. It is also possible that total memory may decrease because the server keeps information about who requests web pages out of convenience, so it can serve them faster in the future. An example would be Amazon's way of storing what products you search so it can suggest other items while you're browsing.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27020057
has comment: http://stackoverflow.com/comment/42564820
type: Answer
has comment: http://stackoverflow.com/comment/42564802
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42565115
score: 0
has comment: http://stackoverflow.com/comment/42565717
accepted answer of: http://stackoverflow.com/q/27020057

http://stackoverflow.com/q/27133766
tagged with: integration-testing
type: Question
has title: integration tests - embedded jetty - how to setup data
accepted answer: http://stackoverflow.com/a/27931150
score: 0
answer count: 1
tagged with: junit
tagged with: embedded-jetty
has body: I wonder how do you usually setup data for integration tests. When my tests begin I start embedded jetty: @Before public void startServer() throws Exception { server = new Server(8080); server.setStopAtShutdown(true); WebAppContext webAppContext = new WebAppContext(); webAppContext.setDescriptor("WEB-INF/embedded-web.xml"); webAppContext.setContextPath("/core-test"); webAppContext.setResourceBase("src/main/webapp"); webAppContext.setClassLoader(getClass().getClassLoader()); server.addHandler(webAppContext); server.start(); } In embedded-web.xml there is a reference to spring application context: contextConfigLocation classpath:/applicationContext-test.xml In applicationContext-test.xml there is a configuration for in memory h2 database: <property name="driverClassName" value="org.h2.Driver" /> <property name="url" value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" /> The best solution would be to autowire Spring service classes into tests and then setup database, but I guess it's impossible to access application context started by jetty.
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27931150
tagged with: java

http://stackoverflow.com/q/26999934
has body: I'm trying to leverage PrimeFaces 5.1 in my JSF application. The app is deployed as an EAR file, with 1 WAR module and multiple EJB modules. The entire thing is built using Maven, and deployed on Wildfly 8.1. I've included the PrimeFaces dependency in my root-level pom.xml like this: org.primefaces primefaces ${version.primefaces} ...and in my WAR pom.xml, I've declared it as a dependency like this: org.primefaces primefaces When I build the EAR using Maven, I can see that the primefaces-5.1.jar file is included, as expected, under my WAR module in /WEB-INF/lib. That much seems to be working. My JSF page has a simple <p:messages /> tag in it, with a JSF FacesMessage set via an action class. However, when I visit the page itself I do not see the <p:messages /> component rendered. Instead, if I view the source I actually see "<p:messages ... />". That is, I see the JSF source for that tag, rather than the rendered component. I am declaring PrimeFaces in my JSF file like this... <h:head> ... ...and when I view the source of the rendered JSF page, I see the text " ". It seems to me that the PrimeFaces rendered is not being initialized or called properly. I've followed the directions on the PrimeFaces site that indicate how to get started with the library, but either my project structure is wrong or I am missing a step. Any idea why my PrimeFaces JSF library is not being included and used properly? EDIT: My web.xml declaration of the Faces Servlet looks like this: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.xhtml Faces Servlet /javax.faces.resource/* ...
score: 0
has comment: http://stackoverflow.com/comment/42530682
answer count: 1
has comment: http://stackoverflow.com/comment/42530502
has comment: http://stackoverflow.com/comment/42530154
tagged with: wildfly
has comment: http://stackoverflow.com/comment/42530920
has answer: http://stackoverflow.com/a/27023514
type: AnsweredQuestion
tagged with: jsf
linked to: http://stackoverflow.com/q/26969828
tagged with: primefaces
tagged with: java
has title: PrimeFaces 5.1 not being included properly
has comment: http://stackoverflow.com/comment/42530761
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/42530328
accepted answer: http://stackoverflow.com/a/27023514

http://stackoverflow.com/q/27097153
has title: (Java) Reading in a file, storing string information into an array, and writing a variation of this string out
score: 0
tagged with: java
tagged with: arrays
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27097751
answer count: 2
has body: This question has had me working for hours so I would immensely appreciate any help. I need to read in a file through command line argument that contains name, major, ID, and graduation date of multiple students. Then, I need to store this information in an array, and use this array to output just the information of specific students that satisfy a condition (they will graduate in 2017). So essentially I'm outputting a new file that only contains students that match this condition. I've created this code to read in a file and store them to an array. But from here, I am stumped :( Please, any help would be valuable. import java.util.*; import java.io.*; import java.io.File; public class Aid { public static void main(String[] args) throws IOException { String token1 = ""; Scanner inFile1 = new Scanner(new File("location of file in my folder")).useDelimiter(",\\s*"); List&lt;String&gt; temps = new ArrayList&lt;String&gt;(); while (inFile1.hasNext()) { token1 = inFile1.next(); temps.add(token1); } inFile1.close(); String[] tempsArray = temps.toArray(new String[0]); for (String s : tempsArray) { System.out.println(s); } } }
type: Question
has answer: http://stackoverflow.com/a/27097222

jogl
tags question: http://stackoverflow.com/q/27129846
tag name: jogl
tags question: http://stackoverflow.com/q/27071406
type: Tag

http://stackoverflow.com/q/27118831
score: 1
has answer: http://stackoverflow.com/a/27118907
tagged with: java
has answer: http://stackoverflow.com/a/27119142
accepted answer: http://stackoverflow.com/a/27118931
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42739596
has comment: http://stackoverflow.com/comment/42739490
possible better answer: http://stackoverflow.com/a/27119086
has answer: http://stackoverflow.com/a/27119086
has body: Not getting any errors im just stumped on this friggin if statement. I want the if statement to basically say if a check box is not checked and 3 EditTexts are empty then print a toast. Otherwise dont print the toast and continue to the next activity. First I turn the value of the checkbox into either t/f for true/false then execute my if statements as the following. CheckBox noPtD1 = (CheckBox) findViewById(R.id.noPTD1); String noPt_D1 = "f"; if (noPtD1.isChecked()) { noPt_D1 = "t"; } if (noPt_D1.equals("f") &amp;&amp; day1_inst.equals("") || day1_uniform.equals("") || day1_location.equals("")) { Toast.makeText(getApplicationContext(), "Please Enter All Data Or Select the NO PT THIS DAY checkbox!", Toast.LENGTH_LONG).show(); } if(noPt_D1.equals("t") || !day1_inst.equals("") &amp;&amp; !day1_uniform.equals("") &amp;&amp; !day1_location.equals("")) { //PASS VARIABLES WITH INTENT Intent intent = new Intent (OneWeekPlan_Start_Btn.this, Week1Day2.class); //PASS VARIABLES FOR DAY 1 intent.putExtra("noPt_D1", noPt_D1); intent.putExtra("day1_inst", day1_inst); intent.putExtra("day1_uniform", day1_uniform); intent.putExtra("day1_location", day1_location); intent.putExtra("d1hours", d1hours); intent.putExtra("d1min", d1min); intent.putExtra("d1x1", d1x1); intent.putExtra("d1x2", d1x2); intent.putExtra("d1x3", d1x3); intent.putExtra("d1x4", d1x4); startActivity(intent); } This is working except for then I check the checkbox and and start the next activity with a button the next activity pops up like it is supposed to but the toast still appears. What did I mess up? I got it I posted my answer below. But to rephrase exactly what my intent was: If the user DOES NOT check the checkbox and leaves all 3 inputtexts blank show the toast and dont continue to next activity. If the user DOES check the checkbox then DONT show the toast and continue to next activity.
answer count: 7
has title: If statement to show toast or continue to next activity
favorite count: 0
has answer: http://stackoverflow.com/a/27118931
has answer: http://stackoverflow.com/a/27118904
has answer: http://stackoverflow.com/a/27119131
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/42739494
has comment: http://stackoverflow.com/comment/42739524
has answer: http://stackoverflow.com/a/27119163
type: AnsweredQuestion

http://stackoverflow.com/comment/42664309
comment on: http://stackoverflow.com/q/27076758
type: Comment
type: QuestionComment
has text: Usually xp starts from 80 to 100 and xMax is 400 to 500
score: 0

http://stackoverflow.com/comment/42559943
has text: You can use an `if` with an `&` to check the two checkboxes are checked. Why do you want specifically switch?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27017355
score: 0

http://stackoverflow.com/comment/66814954
comment on: http://stackoverflow.com/q/27084404
type: QuestionComment
has text: Could you share the solution if you've solved this? I'm trying to make a share overlay exactly like Pocket
type: Comment
score: 0

http://stackoverflow.com/q/27024019
favorite count: 0
accepted answer: http://stackoverflow.com/a/27026929
has answer: http://stackoverflow.com/a/27024313
upvote count: 3
tagged with: swing
has answer: http://stackoverflow.com/a/27026929
type: AnsweredQuestion
tagged with: actionlistener
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/27180489
type: Question
has comment: http://stackoverflow.com/comment/42575151
possible better answer: http://stackoverflow.com/a/27024313
downvote count: 0
tagged with: button
has body: I dont need an outright answer for this. just a suggestion on how this problem could be fixed. I am trying to add an action listener to MyButton so that i can call the action performed method in my main class this is the buttons constructed. they show up and everything works on them minus the actionlistener. upButton = new MyButton(upStaticImageLocation, upRolledImageLocation, upClickedImageLocation); upButton.addActionListener(this); downButton = new MyButton(downStaticImageLocation, downRolledImageLocation, downClickedImageLocation); downButton.addActionListener(this); this is the MyButton class with action listener method. public class MyButton extends JComponent implements MouseListener { private Dimension size = new Dimension(32, 32); private Image staticImage; private Image rolledImage; private Image clickedImage; private ArrayList&lt;ActionListener&gt; listeners = new ArrayList&lt;ActionListener&gt;(); public MyButton(String staticImage, String rolledImage, String clickedImage) { super(); this.staticImage = new ImageIcon(staticImage).getImage(); this.rolledImage = new ImageIcon(rolledImage).getImage(); this.clickedImage = new ImageIcon(clickedImage).getImage(); enableInputMethods(true); addMouseListener(this); setSize(size.width, size.height); setFocusable(true); }
has title: ActionListener with a custom Button class (Java)
answer count: 3
has comment: http://stackoverflow.com/comment/42571930
has comment: http://stackoverflow.com/comment/42574851
tagged with: action

http://stackoverflow.com/comment/42692371
score: 0
has text: @Delfini Is there exactly one nonterminal in input grammar?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27054390

http://stackoverflow.com/comment/42581900
comment on: http://stackoverflow.com/a/27024334
score: 0
type: Comment
has text: You can a) use a non-opaque menu background or b) not use a custom background. The default background under Material theme is already correctly colored, there is really no need for you to customize it.
type: AnswerComment

http://stackoverflow.com/q/27143397
downvote count: 0
has body: i have following web.xml file. <?xml version="1.0" encoding="UTF-8"?> SeekLocal index.html Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher Resteasy /* javax.ws.rs.Application com.ba.rs.webservices.LocalApplication org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap Now if i change url pattern from /* to /app/* it starts showing index.html but then i am not able to access the web services. i have searched internet and found that there are some filter which will be applied but i cannot find a complete solution. i tried by not changing the url pattern and applying a forwarder but still it didnt show index.html. guide me what should i do to change the url pattern of the application with index.html working. i am using container like below to add web services classes which is mentioned below. package com.ba.rs.webservices; import java.util.Set; import java.util.HashSet; import javax.ws.rs.core.Application; public class LocalApplication extends Application { private Set<Object> singletons = new HashSet<Object>(); private Set<Class<?>> empty = new HashSet<Class<?>>(); public LocalApplication(){ //add WS Classes in here. singletons.add(new UserWS()); } @Override public Set<Class<?>> getClasses() { return empty; } @Override public Set<Object> getSingletons() { return singletons; } }
tagged with: java
linked to: http://stackoverflow.com/q/4131968
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27146073
tagged with: url
accepted answer: http://stackoverflow.com/a/27146073
answer count: 1
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/42784597
favorite count: 0
has title: changing URL Pattern, welcome file shows 404
tagged with: resteasy
tagged with: web-services
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/42742778
type: Comment
has text: Well, see the javax.crypto package for a start.
type: AnswerComment
comment on: http://stackoverflow.com/a/27120285
score: 0

http://stackoverflow.com/comment/42621800
type: QuestionComment
type: Comment
has text: Honestly, I see `"" + n` a lot and it makes my skin crawl, I don't know why, it just does. Generally `Integer.toString` is more efficiently, especially if you're doing this kind of thing in loops, but even `new StringBuilder().append(n).toString()` would seem more efficient, but maybe I'm just been an old fuddy duddy...
comment on: http://stackoverflow.com/q/27052326
score: 0

http://stackoverflow.com/a/27140361
score: 4
has body: foo2 works because in the statement Function&lt;T, T&gt; identity = Function.identity(); the type parameter of the identity method is chosen to be T automatically (see javadoc §18.5.1: generic method applicability testing). However in foo3, Function.identity() creates a raw Function object and the return type of the apply method of a raw Function object is Object. (Automatically choosing the type argument only works if the type argument is an argument of the last expression evaluated before the assignment expression) Cast in foo4 is allowed since explicit casts are allowed as long as there is no information that Function can never be cast to Function&lt;T,T&gt;. (see java language spec 15.16). Also an unchecked cast actually is allowed in foo3 too. The following foo3 method is perfectly valid: public T foo3(T t) { return (T)(Function.identity().apply(t)); } foo1, foo2 and foo5 have about the same "quality". I'd choose foo5 because it's the shortest one and is at least as readable as the other 2 methods.
upvote count: 4
has comment: http://stackoverflow.com/comment/42788824
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27139861
answers question: http://stackoverflow.com/q/27139861

http://stackoverflow.com/comment/42574034
comment on: http://stackoverflow.com/a/27025208
score: 0
type: AnswerComment
type: Comment
has text: @user3269660 My mistake. The PrintWriter creation should also be outside the loop. See my edit.

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/27027220
tag name: grouplayout

lwjgl
tags question: http://stackoverflow.com/q/27079503
tag name: lwjgl
tags question: http://stackoverflow.com/q/27106339
tags question: http://stackoverflow.com/q/27117462
type: Tag

http://stackoverflow.com/q/27019431
tagged with: spring-boot
has title: JPA in spring-boot project "batch insert" very slow
has comment: http://stackoverflow.com/comment/42578377
score: 0
tagged with: jpa
has comment: http://stackoverflow.com/comment/42587929
has body: Hey I'm trying to insert some 800 rows with @oneToMany relationships, but it seems they are really slow. Which I don't quite understand why, since I've read some guides that said it should be fairly quick. So I hope that some kind soul could tell me if there is something I've misunderstood and can help me increase the performance of the insertions. The Repository: @Repository public interface FootnoteRepository extends CrudRepository&lt;FootnotesEntity, Long&gt; { @Query("FROM FOOTNOTES WHERE number =?1 AND FOOTNOTE_TYPE=?2 order by DATE_START desc,id asc") public List&lt;FootnotesEntity&gt; findFootnoteByNumberAndType(Long number, String transportNumber, Pageable pageable); } The DomainClass: @Autowired private EntityRepository entityRepository; @Autowired private FootnoteRepository footnoteRepository; /** * Handles the JPA Interface * * @param * @return the success of the operation */ @Transactional private boolean insertUpdateFootnoteEntities(List&lt;FootnotesEntity&gt; footnotes) { boolean success = true; System.out.println("footnotes: " + footnotes.size()); long start = System.currentTimeMillis(); try { // TODO fix below: (does not "commit" the deletion") // footnoteRepository.deleteAll(); // TODO speed optimize footnoteRepository.save(footnotes); } catch (Exception e) { e.printStackTrace(); success = false; } long end = System.currentTimeMillis(); System.out.println("time: " + (end - start)); return success; } For this class I've also tried adding batchsize, and using the nonspecific repository(basicly an EntityManager)'s method: .persist(entity) 'Parent' Entity Class: @Table(indexes = { @Index(columnList = "FOOTNOTE_NUMBER,FOOTNOTE_TYPE") }, uniqueConstraints = @UniqueConstraint(columnNames = { "FOOTNOTE_NUMBER", "FOOTNOTE_TYPE", "DATE_START" })) @Entity(name = "FOOTNOTES") @EqualsAndHashCode(callSuper = false) @Data @NoArgsConstructor @AllArgsConstructor @Builder public class FootnotesEntity extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.…
has comment: http://stackoverflow.com/comment/42857922
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42588320
tagged with: batch-insert
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42589595
type: Question

http://stackoverflow.com/a/27089231
type: Answer
has comment: http://stackoverflow.com/comment/42685955
has comment: http://stackoverflow.com/comment/42685825
has comment: http://stackoverflow.com/comment/42686493
answers question: http://stackoverflow.com/q/27089181
has comment: http://stackoverflow.com/comment/42685897
has body: Maybe this will work out: for(int i = 0; i &lt; 20; i++) { new Handler().postDelayed(new Runnable() { @Override public void run() { tv_t1.setText("t1:" + i); } }, 2000); } And yes if you get a delay when the value of "i" was 0 then set the first text outside the loop and start the loop with i=1 or put an if-else block inside the loop Hope it helped.
has comment: http://stackoverflow.com/comment/42686651
score: 0
has comment: http://stackoverflow.com/comment/42687605
has comment: http://stackoverflow.com/comment/42686817
has comment: http://stackoverflow.com/comment/42685818

http://stackoverflow.com/a/27026046
has comment: http://stackoverflow.com/comment/42580553
score: 2
downvote count: 0
has body: The first line myArray = ArrayUtils.removeElement(myArray, 2); is correct syntax. It would return a new version of your array, with the element at index 2 removed. The other line would result in an error, because you aren't actually passing an array object but rather just a type. Here's the JavaDoc for ArrayUtils if you would like to learn more about this method or other, related methods: https://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/ArrayUtils.html
type: Answer
answers question: http://stackoverflow.com/q/27025985
has comment: http://stackoverflow.com/comment/42579413
upvote count: 2

http://stackoverflow.com/comment/42592650
has text: I don't know exchange too well so I'm not sure what you mean by "system generated". Did exchange generate them? Or is one of your systems sending out mails via exchange that you need to filter?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27035252

http://stackoverflow.com/a/27135102
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: The class Task is implemented as an unidirectional linked list. You could use a generic list to accomplish something similar but that would bring all the code you don't need. e.g. lastIndexOf(Object o) in the case of an ArrayList. Sometimes minimalist implementations are chosen for performance improvements. e.g. The list of Tasks in the example is likely to use less memory than an implementation using a generic list.
answers question: http://stackoverflow.com/q/27134873
type: Answer
accepted answer of: http://stackoverflow.com/q/27134873
score: 2

http://stackoverflow.com/a/27047856
downvote count: 1
has body: I believe creating an instance of Scanner would work for this. The Scanner class has a method that allows you to search text for a pattern which would be the words in your case. Scanner scanner=new Scanner(text); while(scanner.hasNext()){ scanner.findInLine(String pattern); scanner.next(); } Scanner class is good for doing stuff like this, and I believe it would work fine for what you need it for.
upvote count: 0
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/42615487
answers question: http://stackoverflow.com/q/27047698

http://stackoverflow.com/comment/42669855
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27068654
has text: You might take a look to maven-enforcer-plugin where you can implement your own rule which might be a path for you...
score: 0

http://stackoverflow.com/a/27145939
has body: In jsf PrimeFaces you have to use the following to reorder the tags &lt;f:facet name="first"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt; &lt;/f:facet&gt; It moved the meta to the top of the generated header using that code and it worked from the following link
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27144153
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27144153

http://stackoverflow.com/q/27035009
has comment: http://stackoverflow.com/comment/42590964
has comment: http://stackoverflow.com/comment/42590903
has answer: http://stackoverflow.com/a/39180585
tagged with: time
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27052876
tagged with: netbeans
has comment: http://stackoverflow.com/comment/42590793
tagged with: jspinner
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42590717
has body: I want to set my JSpinner in Neatbeans swing with the current time, and allow user to choose time through clicking the arrows up and down. I have these code which somehow works at first but cannot change the time when clicking the arrows. Here's my code: JSpinner spinner = new JSpinner(); spinner.setModel(new SpinnerDateModel()); mySpinnerControl.setEditor(new JSpinner.DateEditor(spinner, "HH:mm")); When i click the arrow keys, time wont change and got this error message: java.lang.ClassCastException: javax.swing.SpinnerNumberModel cannot be cast to javax.swing.SpinnerDateModel What is wrong with my code? I researched through net and they all have the same code. Any help would be greatly appreciated. Thanks ahead.
type: Question
has title: How to properly set time to JSpinner in Java?
answer count: 3
has answer: http://stackoverflow.com/a/27035299

http://stackoverflow.com/a/68629936
score: 0
has body: The map-and-reduce approach using nested loops Prepare a list of lists List&lt;List&lt;T&gt;&gt; populated with a single empty value. This list is used further as a storage of intermediate results and as a final result. Sequentially append the data from incoming lists List&lt;List&lt;T&gt;&gt; to the intermediate result and obtain the final result. Schematically, this iterative process looks as follows: result0: [[]] list1: [1,2] ------- result1: [[1],[2]] list2: [3,4] ------- result2: [[1,3],[1,4],[2,3],[2,4]] list3: [5,6] ------- result3: [[1,3,5],[1,3,6],[1,4,5],[1,4,6],[2,3,5],[2,3,6],[2,4,5],[2,4,6]] <a href="https://tio.run/##jVVLU9swEL7nV@zkZAcwpb01IdMOp8700CncOj0IWUkEsqSR1tC05LenK1kmtmMePkRy9vXttw/fsQd2ZqzQd@X9fi8raxzCHf1Z1ChVMZtPJlwx7@GKORReMv3DmbLmCP8mQM/5bBZPmMEXyxyrQEmPHpgG5m4lOua2oOvqVjgwq0Y4MFjcLOkVNwJwa0XQCnehRCV0R9kJrJ2OsmcsYBswSek8nra@VZKDR4Z0BO/fKeoi/twsl8AHmWR9cYSYp/RiiufAN4Lfg1yB1NxUUq@hZMhAetAGKT2lnrVJKWsouLyMkhwS8iujlOAojfaFqCxuQ8gsn3cDHWV2SiFRuEqUkqEgV75W@GwxSMzCZS@KJ6RKoNEx0gvx@wAkBQuBcONMvd4cEu5Ujp6VcZClwFEEn4@JSy610WeBCOqJMr7E4AOHXepa5uDpKWpRHn9Floe/P@TAjUapazEfxhkhKuLU4g@mvCj3nlWfv6hIocUjfHWORX4Wy26FUiRnHn3oU147Rz36aomO2CJjIovbIVPJd9v3Xf@BhCPd6PSG9BP1Y/7aClBGIeyBjTcA9/ghzPonWR8zQz4H5LRPMChYWWZCvaRBOKJGUB3R2U1efqOUbNhJaF4rbhyHID84370xayupmRoSksaX28bPbjKyZR6MLKFiUmfX6Ghcfv2m9bfuTcOh174R@2vh2l1DKK0TtAtFkPrsU4eNMaOY19ESa6avN8umRlsjPErc0BW8ZVwcJu5661FUBUkKS5BR6cZHgabJIcsLgqXIKJvC9BSm0@6uGDHn9h22iT6C52trm2YP34hKEMrytKXCJ25Cy1ZUDWmJ7UON@@yPsdSjlPCBfm8xhl2uO1nHoQveJClezOlYkAGdJyd5r/kaKkN/R1d09XHdSvqUfYQzuKDFHq5dSlOjRdOWrN1@/x8" rel="nofollow noreferrer" title="Java (OpenJDK 8) – Try It Online">Try it online! /** * @param lists an arbitrary number of lists * @param &lt;T&gt; the type of the elements * @return the Cartesian product */ public static &lt;T&gt; List&lt;List&lt;T&gt;&gt; cartesianProduct(List&lt;List&lt;T&gt;&gt; lists) { // check if incoming data is not null if (lists == null) return Collections.emptyList(); // Cartesian product, inter…
type: Answer
answers question: http://stackoverflow.com/q/26995166

http://stackoverflow.com/q/27054408
tagged with: deployment
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/42636196
has body: I am very new to programming and need help or a cheat. I am trying to create an application for windows, using eclipse, that simply launches other applications from a drop down menu on the top toolbar. Kind of like how Hirens boot cd menu looks and works but with my own applications. They need to be ran off of a portable USB as well. Thanks in advance. This is what I have so far. import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.IOException; public class Launcher { private JFrame frame; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Launcher window = new Launcher(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Launcher() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu mnVirusRemoval = new JMenu("Virus Removal"); menuBar.add(mnVirusRemoval); JButton btnFirefox = new JButton("Opera"); btnFirefox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { @SuppressWarnings("unused") Process process = null; try { process = Runtime.getRuntime().exec("IDK WHAT GOES HERE"); } catch (IOException e) { e.printStackTrace(); } } }); mnVirusRemoval.add(btnFirefox); } }
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42625569
has comment: http://stackoverflow.com/comment/42625524
has comment: http://stackoverflow.com/comment/42625554
has title: Creating a simple application launcher with Eclipse
has comment: http://stackoverflow.com/comment/42625586
answer count: 0
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42625479
type: Question
has comment: http://stackoverflow.com/comment/42642849

http://stackoverflow.com/q/26994861
has answer: http://stackoverflow.com/a/26994910
tagged with: exception
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26995192
has body: I have the following code try { .... } catch (Exception e) { log.error(String.format(SOME_CUSTOM_VARIABLE, e); throw e; } I want the exception to get the string SOME_CUSTOM_STRING_WITH_VARIABLES. So what I want to do is try { .... } catch (Exception e) { log.error(String.format(SOME_CUSTOM_VARIABLE, e); throw new Exception(SOME_CUSTOM_VARIABLE, e); } But this forces me to add "throws Exception" to the method signature. This method threw an exception anyhow. Why do I have to change the signature? How do I replace a basic exception with another one?
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26996696
has answer: http://stackoverflow.com/a/26994883
type: Question
has answer: http://stackoverflow.com/a/26995057
downvote count: 0
linked to: http://stackoverflow.com/q/6115896
has title: How do I replace a basic exception with another one?
favorite count: 0

http://stackoverflow.com/comment/43719357
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27630084
has text: this works, but it seems that taps are not passed through to the underlying app/activity. is there a way to create an overlay that allows interaction with the app/activity that's below it?
score: 0

http://stackoverflow.com/q/27003486
has answer: http://stackoverflow.com/a/35890482
score: 8
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27003490
type: Question
accepted answer: http://stackoverflow.com/a/27003490
answer count: 3
has title: Printing all rows of a SQLite database in Android
has body: For debugging/checkpointing purposes, I wanted to print out all rows of a SQLite database in Android. I did not find anything that answered this precise question: How can I easily print out all rows of a SQLite database in a human-readable format?
tagged with: sqlite
downvote count: 0
has answer: http://stackoverflow.com/a/27005118
favorite count: 0
upvote count: 8
possible better answer: http://stackoverflow.com/a/35890482
tagged with: android

appassembler
type: Tag
tag name: appassembler
tags question: http://stackoverflow.com/q/27048865

http://stackoverflow.com/a/27008267
answers question: http://stackoverflow.com/q/27003036
has body: Found the answer and it worked. As this field is part of the BuildStepDescriptor class, you can access it from the jelly script via ${descriptor.getSampleFieldInGlobalConfig()}
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27003036

http://stackoverflow.com/comment/42689366
has text: @AmarokStudios Sorry, I have no idea... But you can run .jar or .class files from batch also. For .jar use: `java -jar [your jar file name].jar` and for .class use: `java [your class name]`
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27088773
score: 0

http://stackoverflow.com/comment/42696418
comment on: http://stackoverflow.com/q/27095312
score: 1
has text: Please post pertinent code, preferably a [Minimal, Complete, and Verifiable Example Program](http://stackoverflow.com/help/mcve), here with your question, not in a link. Links can go dead, and links may hold large programs, programs too large to ask a volunteer to review. Your compliance with this request will be greatly appreciated and will likely help you in getting better and faster help.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27090355
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27090306
type: Answer
has body: you are right. you can do with %. Try like int number=83491; LinkedList&lt;Integer&gt; stack = new LinkedList&lt;Integer&gt;(); while (number &gt; 0) { stack.push( number % 10 ); number = number / 10; } while (!stack.isEmpty()) { System.out.print(stack.pop()+",); }

jython-2.5
tag name: jython-2.5
type: Tag
tags question: http://stackoverflow.com/q/27152356

http://stackoverflow.com/q/27001653
has comment: http://stackoverflow.com/comment/42533743
tagged with: javacompiler
type: UnansweredQuestion
has body: Is there any way to programatically generate class files from .java files present in a folder. There are examples using JavaCompiler.CompilationTask for compiling single java files.But i need to to generate class file from multiple couples .java codes(generated from JAXB gen).
linked to: http://stackoverflow.com/q/9112640
has answer: http://stackoverflow.com/a/27001776
tagged with: java
type: Question
answer count: 1
tagged with: compilation
has comment: http://stackoverflow.com/comment/42533620
has comment: http://stackoverflow.com/comment/42533493
score: 0
has title: How to compile multiple java source files dynamically

http://stackoverflow.com/q/27084209
type: UnansweredQuestion
tagged with: polygon
score: 2
answer count: 0
tagged with: boofcv
favorite count: 0
type: Question
upvote count: 3
has title: How can I use BoofCV to transform a list of vertices so that the center of the polygon they form will be moved to the middle of the image?
tagged with: java
tagged with: center
downvote count: 1
has body: I'm using the code below to detect shapes and extract a list of vertices for each shape found (stored in the List Vertexes). How can I transform the vertices for a shape to ensure that the shape will be located at the center of the image when I draw the vertices? done here> VisualizeShapes.drawPolygon(vertexes,true,g2); Is there a built-in way to do it using BoofCV or does it have to be done manually? /** * Fits polygons to found contours around binary blobs. */ public static void fitBinaryImage(ImageFloat32 input) { ImageUInt8 binary = new ImageUInt8(input.width,input.height); BufferedImage polygon = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB); // the mean pixel value is often a reasonable threshold when creating a binary image double mean = ImageStatistics.mean(input); // create a binary image by thresholding ThresholdImageOps.threshold(input, binary, (float) mean, true); // reduce noise with some filtering ImageUInt8 filtered = BinaryImageOps.erode8(binary, 1, null); filtered = BinaryImageOps.dilate8(filtered, 1, null); // Find the contour around the shapes List&lt;Contour&gt; contours = BinaryImageOps.contour(filtered, ConnectRule.EIGHT,null); // Fit a polygon to each shape and draw the results Graphics2D g2 = polygon.createGraphics(); g2.setStroke(new BasicStroke(2)); for( Contour c : contours ) { // Fit the polygon to the found external contour. Note loop = true List&lt;PointIndex_I32&gt; vertexes = ShapeFittingOps.fitPolygon(c.external,true,toleranceDist,toleranceAngle,100); g2.setColor(Color.RED); VisualizeShapes.drawPolygon(vertexes,true,g2); // handle internal contours now g2.setColor(Color.BLUE); for( List&lt;Point2D_I32&gt; internal : c.internal ) { vertexes = ShapeFittingOps.fitPolygon(internal,true,toleranceDist,toleranceAngle,100); //******************************************************************************************************************** //** how can I transform the vertexes here so that the polygon they form is c…

http://stackoverflow.com/comment/42785763
has text: The threadpool is only there to optimise resource usage.
comment on: http://stackoverflow.com/q/27143122
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27052959
has body: As suggested here, JChemPaint is a standard Java application. See showInstance() for an example of constructing a JChemPaintPanel and adding it to a JFrame.
has comment: http://stackoverflow.com/comment/42649607
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42664686
downvote count: 0
answers question: http://stackoverflow.com/q/27051970
type: Answer

http://stackoverflow.com/q/27110855
type: Question
tagged with: debugging
tagged with: remote-desktop
has body: I am working in Linux environment where my java process is running on Machine C. in order to connect to Machine C from my machine A i need to connect through B for security reason and there is no option to connect directly to machine C. is there any way to debug the java process that running on machine C.? Thanks in advance
accepted answer: http://stackoverflow.com/a/27111121
answer count: 1
has comment: http://stackoverflow.com/comment/42724684
favorite count: 0
has comment: http://stackoverflow.com/comment/42724676
upvote count: 2
downvote count: 1
type: AnsweredQuestion
has title: Java Debugging over 2 machines
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27111121

http://stackoverflow.com/comment/42586086
has text: No. C and C++ have this, but not Java.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27031300

http://stackoverflow.com/q/26999693
type: Question
has comment: http://stackoverflow.com/comment/42529621
answer count: 2
has body: I'm trying resolve a problem with List in Java but I can't. I have the following code: Productos producto = ... //come from a database, here there isn't errors List&lt;Productos&gt; lista = new ArrayList&lt;Productos&gt;(); lista.set(0,producto); And I can't introduce 'producto' in my list and I don't know why. I had tried it using "lista.add(producto)" too but it doesn't work. What can I do? Edit1: Producto is not null, it's initialized and it has some attributes with correct values. I used lista.add(0,producto) too but it didn't work :( .The error is: Grave: java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:454) at java.lang.Integer.parseInt(Integer.java:527) at clientesCarrito.ClienteCarritoCompraServlet.doPost(ClienteCarritoCompraServlet.java:68) Yeah, it looks like an error to have done a "bad casting" to Int but I don't think..this is my part of my code: EntityManager em = entityManagerFactory.createEntityManager(); . . int id = Integer.parseInt(request.getParameter("IdProd")); Productos producto = em.find(Productos.class,id); HttpSession session = request.getSession(false); if(session.getAttribute("carProductos")==null){ List&lt;Productos&gt; lista = new ArrayList&lt;Productos&gt;(); lista.add(producto); session.setAttribute("carProductos", lista); }else{ List&lt;Productos&gt; lista = (List&lt;Productos&gt;) session.getAttribute("carProductos"); lista.add(producto); session.setAttribute("carProductos", lista); } I have done debug in Eclipse and "IdProd" is 5 and "id" is 5 too. Now it looks like "lista" catch "producto" and introduces itself but when it's at bottom suddenly show that error and crash. After of this code, I don't use again "lista" or "producto". Somebody can help me?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26999834
has title: error in lista.add(obj) and list<obj> java
has comment: http://stackoverflow.com/comment/42529715
score: 1
tagged with: initialization
has comment: http://stackoverflow.com/comment/42529770
type: UnansweredQuestion
upvote count: 1
tagged with: object
tagged with: list
tagged with: initializer-list
tagged with: java
has answer: http://stackoverflow.com/a/26999771

http://stackoverflow.com/a/38378052
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/91259266
type: Answer
score: 1
has body: For my instance, I had to fire hundreds of thousands INSERT statements from Matlab into the DB. I also got the GC overhead exception: java.sql.SQLException: java.lang.OutOfMemoryError: GC overhead limit exceeded My solution was, to close the DB connection every some thousand(in this case 2000) INSERT shots, delete and clear the object from the Matlab workspace. Of course, to subsequently open a new connection. classdef MySqlService &lt; handle properties db; counter = 0; dblimit = 0; end methods function x = executeQuery(obj, query) obj.counter = obj.counter + 1; if (obj.counter &gt; obj.dblimit + 2000) obj.dblimit = obj.counter; delete(obj.db); clear obj.db; import lib.queryMySQL.src.edu.stanford.covert.db.MySQLDatabase; obj.db = MySQLDatabase('localhost:3306', 'fani_dev', 'root', 'dev1'); end obj.db.prepareStatement(query); x = obj.db.query(); end function obj = MySqlService() import lib.queryMySQL.src.edu.stanford.covert.db.MySQLDatabase; obj.db = MySQLDatabase('localhost:3306', 'fani_dev', 'root', 'dev1'); end end end Script works now without problems. Also CPU workload and RAM usage seems good.
answers question: http://stackoverflow.com/q/27033954

http://stackoverflow.com/q/27003242
has comment: http://stackoverflow.com/comment/42536245
accepted answer: http://stackoverflow.com/a/27003321
downvote count: 0
has comment: http://stackoverflow.com/comment/42536060
has body: public class AccountException extends Exception { public AccountException(String str) { super(str); } } This is first class in an example programme. What I didn't understand is that why we use super keyword . I know with extends this class from exception class but I do not understand to create method for exception . What will happen when we catch exception ? I got my question's answer super just call the method Exception(String message) to Constructs a new exception with the specified detail message. and this is an example of making our own exception class.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27003407
score: 1
has answer: http://stackoverflow.com/a/27003407
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27003321
has comment: http://stackoverflow.com/comment/42536072
tagged with: super
tagged with: java
upvote count: 1
has title: Effect of `Super` keyword in Exception subclasses

http://stackoverflow.com/comment/42760518
comment on: http://stackoverflow.com/q/27117369
has text: Is this the com.sun.enterprise.server.logging.UniformLogFormatter from GlassFish? If so what version of GF?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27033781
tagged with: security
has body: I have been trying to create a self-signed jar. I have embedded it on a website. However (this may be a Windows-specific problem), when the applet loads, this pops up: "Your security settings have blocked a self-signed application from running." According to every scrap of documentation I can get my hands on, I am supposed to be prompted as to whether or not I want to trust this application. This is embedded in GameJolt's website, so there is no HTML code to be posted. My META-INF folder contains a .MF, .SF, and .DSA file. Do I need anything else?
type: UnansweredQuestion
has title: JApplet: Never prompted to trust the install. It takes them right to to the error message
has answer: http://stackoverflow.com/a/27049440
tagged with: embed
type: Question
tagged with: java
score: 0
tagged with: japplet
answer count: 1
tagged with: applet

file
type: Tag
tags question: http://stackoverflow.com/q/27077331
tags question: http://stackoverflow.com/q/27016079
tags question: http://stackoverflow.com/q/27090824
tags question: http://stackoverflow.com/q/27035081
tags question: http://stackoverflow.com/q/27106851
tags question: http://stackoverflow.com/q/27125680
tags question: http://stackoverflow.com/q/27117713
tags question: http://stackoverflow.com/q/27035035
tags question: http://stackoverflow.com/q/27134465
tags question: http://stackoverflow.com/q/27075593
tags question: http://stackoverflow.com/q/27052681
tags question: http://stackoverflow.com/q/27041407
tags question: http://stackoverflow.com/q/27036912
tag name: file
tags question: http://stackoverflow.com/q/27053487
tags question: http://stackoverflow.com/q/27096213
tags question: http://stackoverflow.com/q/26997752
tags question: http://stackoverflow.com/q/26995827
tags question: http://stackoverflow.com/q/27009038
tags question: http://stackoverflow.com/q/27030084
tags question: http://stackoverflow.com/q/27046021
tags question: http://stackoverflow.com/q/27135054
tags question: http://stackoverflow.com/q/27096374
tags question: http://stackoverflow.com/q/27117302
tags question: http://stackoverflow.com/q/27085385
tags question: http://stackoverflow.com/q/27084074
tags question: http://stackoverflow.com/q/27120208
tags question: http://stackoverflow.com/q/27072842
tags question: http://stackoverflow.com/q/27008942
tags question: http://stackoverflow.com/q/27083589
tags question: http://stackoverflow.com/q/27009429
tags question: http://stackoverflow.com/q/27001824
tags question: http://stackoverflow.com/q/27040512
tags question: http://stackoverflow.com/q/27058249
tags question: http://stackoverflow.com/q/27068175
tags question: http://stackoverflow.com/q/27081440
tags question: http://stackoverflow.com/q/27069377
tags question: http://stackoverflow.com/q/27103529
tags question: http://stackoverflow.com/q/27060095
tags question: http://stackoverflow.com/q/27061248
tags question: http://stackoverflow.com/q/27048007
tags question: http://stackoverflow.com/q/27001415
tags question: http://stackoverflow.com/q/27026107
tags question: http://stackoverflow.com/q/27134058
tags question: http://stackoverflow.com/q/26992174
tags question: http://stackoverflow.com/q/27108158
tags question: http://stackoverflow.com/q/27094050
tags question: http://stackoverflow.com/q/27047132
tags question: http://stackoverflow.com/q/27106517
tags question: http://stackoverflow.com/q/27042654
tags question: http://stackoverflow.com/q/27072838
tags question: http://stackoverflow.com/q/26994321
tags question: http://stackoverflow.com/q/27016467

dao
tags question: http://stackoverflow.com/q/27114001
type: Tag
tags question: http://stackoverflow.com/q/27148930
tags question: http://stackoverflow.com/q/27036438
tag name: dao
tags question: http://stackoverflow.com/q/27025089

http://stackoverflow.com/comment/42715440
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27105943
has text: You can use `CDATA` & add your String inside `myData` in that then only it will retains `<` & `>` symbols.

http://stackoverflow.com/comment/42650813
has text: You need to do some preliminary debugging so you can post the **most relevant** code here and see what is/isn't being called.
comment on: http://stackoverflow.com/q/27068849
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27082139
upvote count: 2
answers question: http://stackoverflow.com/q/27082097
has body: This should work : x = ((x+30)/30) * 30; Examples : ((15+30)/30)*30 == (45/30)*30 == 1*30 == 30 ((30+30)/30)*30 == (60/30)*30 == 2*30 == 60 ((47+30)/30)*30 == (77/30)*30 == 2*30 == 60 ... EDIT : After the OP changed the requirements (30 should stay 30) : x = ((x+29)/30) * 30; Examples : ((15+29)/30)*30 == (44/30)*30 == 1*30 == 30 ((30+29)/30)*30 == (59/30)*30 == 1*30 == 30 ((47+29)/30)*30 == (76/30)*30 == 2*30 == 60 ...
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/57771836
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27233595
has text: Using Android Studio 1.5.1 and emulating API 23, the above only worked when `"generic"` was swapped to `"android"`. Works flawlessly after that change, though.

http://stackoverflow.com/q/27113219
tagged with: soapui
upvote count: 2
has answer: http://stackoverflow.com/a/27122780
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27122780
tagged with: java
type: Question
has body: I tried to add assertions to a WsdlTestRequestStep, but so far I failed in most parts. The first thing that I did try was adding assertions using WsdlTestRequestStep.addAssertion which only worked for SoapResponseAssertion and updated the GUI properly. When I tried the same with a couple of other assertion types, SoapUI responded with and error in the console window and corrupted my project file with an assertion with empty type attribute. (see belowaddNotSoapFaultAssertion). Then I did update the request config of the test step. This worked everytime without error. However, the GUI did only refresh when I reloaded the project, which is kind of impractical. (see below AddAssertions) Now, I am wondering if there is a way to make this work properly, meaning no errors and immediate GUI update. import com.eviware.soapui.config.CredentialsConfig; import com.eviware.soapui.config.TestAssertionConfig; import com.eviware.soapui.config.WsdlRequestConfig; import com.eviware.soapui.impl.wsdl.WsdlProject; import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequest; import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep; import com.eviware.soapui.impl.wsdl.teststeps.assertions.soap.NotSoapFaultAssertion; import com.eviware.soapui.impl.wsdl.teststeps.assertions.soap.SoapFaultAssertion; import com.eviware.soapui.impl.wsdl.teststeps.assertions.soap.SoapResponseAssertion; import com.eviware.soapui.model.testsuite.TestAssertion; import org.apache.log4j.Logger; public class SomeTestStep { private WsdlTestRequestStep _step; [...] public void AddAssertions() { //addSoapResponseAssertion(); //addNotSoapFaultAssertion(); // directly manipulating config tree, but only updates UI after project reload WsdlRequestConfig config = _step.getTestRequest().getConfig(); TestAssertionConfig testAssertionConfig = config.addNewAssertion(); testAssertionConfig.setType("SOAP Fault Assertion"); testAssertionConfig.setName("Not SOAP Fault"); // setConfig did not really change anything in term…
downvote count: 0
answer count: 1
has title: Properly adding an assertion to a WsdlTestRequestStep in SoapUI 5.0.0 in Java
favorite count: 0

http://stackoverflow.com/a/27006250
answers question: http://stackoverflow.com/q/26996504
has body: Oracle's XQuery processor for Java will "dynamically" stream path expressions: https://docs.oracle.com/database/121/ADXDK/adx_j_xqj.htm#ADXDK99930 Specifically, there is information on streaming here, including an example: https://docs.oracle.com/database/121/ADXDK/adx_j_xqj.htm#ADXDK119 But it will not stream using SAX. You must bind the input XML as either StAX, InputStream, or Reader to get streaming evaluation.
score: 0
type: Answer

http://stackoverflow.com/a/27129588
has body: I had this in my ListFragment public class MyListFragment extends ListFragment { public static final String TAG = "MyListFragment.TAG"; public static MyListFragment newInstance() { MyListFragment frag = new MyListFragment(); return frag; } @Override public void onActivityCreated(Bundle _savedInstanceState) { super.onActivityCreated(_savedInstanceState); String[] teams = getResources().getStringArray(R.array.teamList); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1, teams); setListAdapter(adapter); } public void onListItemClick(ListView _l, View _v, int _position, long _id) { String team = (String)_l.getItemAtPosition(_position); new AlertDialog.Builder(getActivity()) .setTitle(R.string.team) .setMessage(getString(R.string.selected, team)) .setPositiveButton(R.string.ok, null) .show(); } } So I changed that and added the onCreateView t this: package com.brianstacks.fragmentandfilefundamentals.fragments; import android.app.AlertDialog; import android.app.ListFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import com.brianstacks.fragmentandfilefundamentals.R; /** * Created by Brian Stacks * on 11/24/14 * for FullSail.edu. */ public class MyListFragment extends ListFragment { public static final String TAG = "MyListFragment.TAG"; public static MyListFragment newInstance() { MyListFragment frag = new MyListFragment(); return frag; } @Override public View onCreateView(LayoutInflater _inflater, ViewGroup _container, Bundle _savedInstanceState) { // Create and return view for this fragment. View view = _inflater.inflate(R.layout.display_fragment, _container, false); return view; } @Override public void onActivityCreated(Bundle _savedInstanceState) { super.onActivityCreated(_savedInstanceState); String[] teams = getResources().getStringArray(R.array.teamList…
type: Answer
answers question: http://stackoverflow.com/q/27129060
score: 0

http://stackoverflow.com/q/27085291
has comment: http://stackoverflow.com/comment/42680208
has comment: http://stackoverflow.com/comment/42679886
has comment: http://stackoverflow.com/comment/42679628
type: AnsweredQuestion
has title: Java Text Adventure: Displaying the Game
tagged with: java
has comment: http://stackoverflow.com/comment/42679437
type: Question
has body: How would I go about displaying my text adventure game when played? Do I have to run the program from the command line, or is there another way which would look better? I am still very new to programming.
has comment: http://stackoverflow.com/comment/42679639
accepted answer: http://stackoverflow.com/a/27085418
has comment: http://stackoverflow.com/comment/42679661
has comment: http://stackoverflow.com/comment/42680365
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42679763
has answer: http://stackoverflow.com/a/27085418

http://stackoverflow.com/a/27053484
answers question: http://stackoverflow.com/q/27030974
accepted answer of: http://stackoverflow.com/q/27030974
has body: I figured out that to display a vertical histogram (downward) without using arrays, you can do it through using 16 if statements as follows (16 if statements because of the 16 possible outcomes with 4 variables): System.out.println("0-29 30-39 40-69 70-100"); for(int v = 0; v&lt;countertwo||v&lt;counterthree||v&lt;counterfour||v&lt;counterfive;) { if (countertwo&gt;0 &amp;&amp; counterthree&gt;0 &amp;&amp; counterfour&gt;0 &amp;&amp;counterfive&gt;0) { System.out.println(" * * * *"); countertwo--; counterthree--; counterfour--; counterfive--; } if (countertwo&gt;0 &amp;&amp; counterthree&gt;0 &amp;&amp; counterfour&gt;0 &amp;&amp;counterfive==0) { System.out.println(" * * *"); countertwo--; counterthree--; counterfour--; } if (countertwo&gt;0 &amp;&amp; counterthree&gt;0 &amp;&amp; counterfour==0 &amp;&amp;counterfive&gt;0) { System.out.println(" * * *"); countertwo--; counterthree--; counterfive--; } if (countertwo&gt;0 &amp;&amp; counterthree&gt;0 &amp;&amp; counterfour==0 &amp;&amp;counterfive==0) { System.out.println(" * * "); countertwo--; counterthree--; } if (countertwo&gt;0 &amp;&amp; counterthree==0 &amp;&amp; counterfour&gt;0 &amp;&amp;counterfive&gt;0) { System.out.println(" * * *"); countertwo--; counterfour--; counterfive--; } if (countertwo&gt;0 &amp;&amp; counterthree==0 &amp;&amp; counterfour&gt;0 &amp;&amp;counterfive==0) { System.out.println(" * * "); countertwo--; counterfour--; } if (countertwo&gt;0 &amp;&amp; counterthree==0 &amp;&amp; counterfour==0 &amp;&amp;counterfive&gt;0) { System.out.println(" * *"); countertwo--; counterfive--; } if (countertwo&gt;0 &amp;&amp; counterthree==0 &amp;&amp; counterfour==0 &amp;&amp;counterfive==0) { System.out.println(" * "); countertwo--; } if (countertwo==0 &amp;&amp; counterthree&gt;0 &amp;&amp; counterfour&gt;0 &amp;&amp;counterfive&gt;0) { System.out.println(" * * *"); counterthree--; counterfour--; counterfive--; } if (countertwo==0 &amp;&amp; counterthree&gt;0 &amp;&amp; counterfour&gt;0 &amp;&amp;cou…
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/27021629
tagged with: ajax
has title: Displaying a JSON Google Search in The LogCat
score: 0
has body: I'm trying to get the search result from the URL https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=JSON and displaying it into the LogCat using log.v(). The problem is that instead of displaying the search results in the LogCat, the program keeps running non stop and what I see in the LogCat is an endless list of this 11-19 15:51:11.256: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 8ms, total 8ms 11-19 15:51:11.264: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 8ms, total 8ms 11-19 15:51:11.272: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 5ms, total 5ms 11-19 15:51:11.272: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 4ms, total 5ms 11-19 15:51:11.324: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 45ms, total 45ms 11-19 15:51:11.332: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 8ms, total 8ms 11-19 15:51:11.400: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 23ms, total 23ms 11-19 15:51:11.424: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 2ms, total 2ms 11-19 15:51:11.464: D/dalvikvm(1251): GC_FOR_ALLOC freed 480K, 14% free 6651K/7688K, paused 26ms, total 26ms This never stops and keeps going on and on until I kill the app in the emulator. Here is my code public class MainActivity extends Activity { public static final String TAG= MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if(isNetworkAvilable()){ GetSearchData getSearchData = new GetSearchData(); getSearchData.execute(); } else{ Toast.makeText(this, "The network is down", Toast.LENGTH_SHORT).show(); } } private boolean isNetworkAvilable() { // TODO Auto-generated method stub boolean isAvailable= false; ConnectivityManager manager= (ConnectivityManager) getSystemServi…
answer count: 1
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/42568184
has comment: http://stackoverflow.com/comment/42568895
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42568172
tagged with: android
has answer: http://stackoverflow.com/a/27022725
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/42568447
has comment: http://stackoverflow.com/comment/42567872
has comment: http://stackoverflow.com/comment/42568509

http://stackoverflow.com/q/27097240
favorite count: 0
has body: I am currently in a computer programming class and at a dead end for "creating a template" for this 2-person hang man game. First, person#1 is prompted for a phrase (contains all lowercase) Then, I must take whatever phrase they choose and turn it into a template with all ?'s. Then, as person#2 guesses letters, I must "reveal" the phrase and have the ?'s turn into the phrase letters. I can't get past turning it into the template though. An example is: person#1's phrase: "hello world" desired template outcome: "????? ?????" This is what I have so far... I'm having trouble at public static String createTemplate(String sPhrase) import java.util.Scanner; public class Program9 { public static void main (String[] args) { Scanner scanner = new Scanner (System.in); Scanner stdIn = new Scanner (System.in); int cnt = 0; //counter is set to zero String sPhrase; boolean def; System.out.print("Enter a phrase consisting of only lowercase letters and spaces: "); sPhrase = scanner.nextLine(); //reads into variable set to Scanner.nextLine() System.out.println("\n\n\nCommon Phrase"); System.out.println("--------------\n"); String template = createTemplate(sPhrase); //will run through "createTemplate" and show whatever on there. do { char guess = getGuess(stdIn); //will run through "getGuess" and show whatever SOP and return from that. WORKS. cnt = cnt + 1; //counts the guess System.out.println("\n\n\nCommon Phrase"); System.out.println("--------------\n"); String updated = updateTemplate(template, sPhrase, guess); //runs throuhgh and prints updated template } while (!exposedTemplate(sPhrase)); //will loop back if updated template still has ?'s System.out.println("Good job! It took you " + cnt + " guesses!"); } public static String createTemplate(String sPhrase) { String template = null; String str; sPhrase.substring(0, sPhrase.length()+1); //not sure if +1 needed. sPhrase.equals(template); //THIS IS WHERE IM HAVING PROBLEMS } public static char getGuess(Scanner stdIn) { //repeatedly …
has answer: http://stackoverflow.com/a/27097338
possible better answer: http://stackoverflow.com/a/27097263
has answer: http://stackoverflow.com/a/27097393
accepted answer: http://stackoverflow.com/a/27097393
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: substring
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27097263
downvote count: 0
has title: How do I make a new String based on another string's unknown length?
answer count: 3
tagged with: string

http://stackoverflow.com/q/27046572
tagged with: el
tagged with: resultset
accepted answer: http://stackoverflow.com/a/27047097
has body: I want to pass result set from Servlet to JSP page and have its value there in my JSP page. Here is the code of the Servlet: protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("username"); String password = request.getParameter("password"); PrintWriter out = response.getWriter(); Data select = new Data(username,password); try { Boolean result = select.Select(username, password); if (result) { ResultSet rset=select.SelectAll(username,password); request.setAttribute("user",rset); getServletConfig().getServletContext() .getRequestDispatcher("/dashboard.jsp") .forward(request,response); } else out.print("Please check your username and password"); } catch (Exception e) { out.print("There seems to be a exception" + e); } } The two function called here returns boolean value and ResultSet values respectively Select function returns boolean value where as SelectAll returns ResultSet. My JSP code looks like this: &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; Username: &lt;c:out value="$(user.username)"/&gt; &lt;br/&gt; Email: &lt;c:out value="$(user.email)"/&gt; &lt;br/&gt; Contact: &lt;c:out value="$(user.contact)"/&gt; &lt;br/&gt;
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42611605
possible better answer: http://stackoverflow.com/a/27047177
has title: Passing ResultSet from Servlet to JSP
linked to: http://stackoverflow.com/q/20497778
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27047177
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42611579
has answer: http://stackoverflow.com/a/27047097
tagged with: servlets
has comment: http://stackoverflow.com/comment/42612013
answer count: 2
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/42612015
favorite count: 0

http://stackoverflow.com/comment/42554720
score: 0
type: Comment
type: QuestionComment
has text: Check this link ( Generate Random Number using java) http://stackoverflow.com/questions/363681/generating-random-integers-in-a-range-with-java... you can also check http://java.about.com/od/javautil/a/randomnumbers.htm
comment on: http://stackoverflow.com/q/27014420

http://stackoverflow.com/q/27081976
has comment: http://stackoverflow.com/comment/42675064
has comment: http://stackoverflow.com/comment/42674346
answer count: 1
has answer: http://stackoverflow.com/a/27093043
has comment: http://stackoverflow.com/comment/42674342
has comment: http://stackoverflow.com/comment/42675546
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42674475
tagged with: sql-server
type: Question
tagged with: resultset
has comment: http://stackoverflow.com/comment/42674427
tagged with: jdbc
has comment: http://stackoverflow.com/comment/42674274
has comment: http://stackoverflow.com/comment/42673491
has comment: http://stackoverflow.com/comment/42674587
has title: How to retrive specific data from a SQL database with JDBC?
has comment: http://stackoverflow.com/comment/42675183
score: 0
has body: I've created a SQL-database containing three tables: Student, Course, Studies. I have no problem adding and retrieving information from/to student and course but when I try to do the same with Studies I get som problems. I've narrowed it down to the segment shown below. The problem is that I can add a student that does not exist in the Studies-table (but does exist in the Student &amp; course tables) without a problem. But if I already have a student that's in the studies table and I wan't to add another entry (i.e. a student who studies more then one course) I get nothing. I've tried bypassing it with numerous loops and methods outside the codesegment, but nothing works. I'm pretty sure I'm close to the answer but I need help to get to the end. Any help is appreciated. public void saveStudies() throws SQLException { String checkSql = "select count(*) as count from studies where spnr=?"; PreparedStatement checkStmt = con.prepareStatement(checkSql); String insertSql = "insert into studies (spnr, cid) values (?, ?)"; PreparedStatement insertStmt = con.prepareStatement(insertSql); for(Studies studies: studiess) { int spnr = studies.getSpnr(); int cid = studies.getCid(); checkStmt.setInt(1, spnr); ResultSet checkResult = checkStmt.executeQuery(); checkResult.next(); int count = checkResult.getInt(1); if(count == 0) { System.out.println("Inserting student with pnr: " + spnr + " into course with cid: " + cid); insertStmt.setInt(1, spnr); insertStmt.setInt(2, cid); insertStmt.executeUpdate(); } else { System.out.println("A message containing information that says that the student and or course does not exist in the database"); } } insertStmt.close(); checkStmt.close(); }

http://stackoverflow.com/a/27133781
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42766157
has body: When you enter "2.5", nextInt() consumes the 2. The next thing being scanned by the very same nextInt() will be . and that cannot be successfully scanned by nextInt(), so you get the error. nextInt() can only be used to scan int numbers, if you want to scan fractions like 2.5, you need nextDouble(). By the way, the exception objects hold useful information. If you do this, you're just hiding the error information: catch (Exception e) { System.err.println(error): } Instead do this: catch (Exception e) { e.printStackTrace(); } And don't mix System.out and System.err. System.out is for the normal program output but not for logging, debug, info, warning, error or such messages. Those should go to System.err.
answers question: http://stackoverflow.com/q/27133672
downvote count: 0

http://stackoverflow.com/comment/42602087
score: 0
has text: Represent the files by splitting as explained in your earlier question. Use a `SortedSet` instead of a `LinkedHashSet`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27041407

http://stackoverflow.com/comment/42679920
type: Comment
has text: Thanks for the wonderful response. I don't think I have a memory leak since this occurs even when I have only 1 image in memory and it grows the heap to around 16-17 mb each time. The reason only 1 is in memory is because I am have the images in the native heap space and then I am converting them one at a time to serialize them. I also checked this in the Eclipse heap and allocation viewer.
comment on: http://stackoverflow.com/a/27085282
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42637182
score: 0
comment on: http://stackoverflow.com/q/27061189
type: Comment
has text: The JSON array is in the question first code line
type: QuestionComment

http://stackoverflow.com/comment/42636243
type: QuestionComment
has text: the mbean is registered using a different name, try using jconsole and see the mbean name and use the correct name.
score: 1
comment on: http://stackoverflow.com/q/27060563
type: Comment

http://stackoverflow.com/q/26994054
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27990957
possible better answer: http://stackoverflow.com/a/27990957
has body: I am trying to show an external image (not in my application project) in the Sony Smartwatch UI. I know how to do it with an image located in the drawable folder. Bundle iconBundle = new Bundle(); iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail); iconBundle.putString(Control.Intents.EXTRA_DATA_URI, ExtensionUtils.getUriString(mContext, R.drawable.thumbnail_list_item)); In this example I have the image in the drawable folder called R.drawable.thumbnail_list_item. The problem is when I try it with an external image. I have the following URL: http://tcset.com/images/logotcsetarriba.png, and this code does not work: Bundle iconBundle = new Bundle(); iconBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.thumbnail); iconBundle.putString(Control.Intents.EXTRA_DATA_URI, ExtensionUtils.getUriString(mContext, "http://tcset.com/images/logotcsetarriba.png")); How could I do it? I need held :S Thank you!!
tagged with: android
tagged with: sony-smartwatch
has title: Images Sony Smartwatch 2
has answer: http://stackoverflow.com/a/27082175
accepted answer: http://stackoverflow.com/a/27082175
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/33067467
type: Question

http://stackoverflow.com/comment/42647682
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27066626
has text: @Peter are empty directories discarded using the command line?

http://stackoverflow.com/q/27149890
tagged with: security
has body: I have a java agent that makes http requests using jsoup, This agent works fine when I trigger it manually from the server console. but will give an error when I run it on the client, (right click on agent and run) The agent is set to option 2. Allow restricted operations, and is set to "Action menu selection" and Target "All documents in database" I have set the same security settings in my java.policy file on both the server and the client. I also tried to run my agent on a server with a "standard" java.policy file and that worked also so the problem do not seem to be related to the java.policy file. This is the error I get in the Java debug console when I run the agent in notes client (v9.0.1) java.lang.NullPointerException at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:727) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:654) at COM.ibm.JEmpower.applet.http.HttpURLConnection.getInputStream(HttpURLConnection.java:411) at COM.ibm.JEmpower.applet.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:703) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:399) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:453) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:434) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:181) at org.jsoup.helper.HttpConnection.get(HttpConnection.java:170) at JavaAgent.NotesMain(Unknown Source) at lotus.domino.AgentBase.runNotes(Unknown Source) at lotus.domino.NotesThread.run(Unknown Source) this is the java.policy settings I use in my Notes client (and on some servers) grant { permission java.util.PropertyPermission "http.keepAlive", "read, write"; }; grant { permission java.security.AllPermission; } Here is the agent code public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Database db = session.getCurrentDatabase(); lotus.…
upvote count: 1
accepted answer: http://stackoverflow.com/a/28662480
has title: Domino Agent issues when running in Notes Client - works fine on server
has comment: http://stackoverflow.com/comment/42795079
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42827178
has comment: http://stackoverflow.com/comment/42835728
score: 1
tagged with: java
tagged with: agent
tagged with: lotus-domino
type: Question
has comment: http://stackoverflow.com/comment/42813293
downvote count: 0
answer count: 1
tagged with: xpages
favorite count: 0
has answer: http://stackoverflow.com/a/28662480

http://stackoverflow.com/q/27000782
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has title: maven cannot find symbol
has answer: http://stackoverflow.com/a/27001318
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am running a clean test on my maven project. I am getting the following error: [ERROR] /Users/afrieden/Projects/CLO-processing/src/main/java/com/aws/mongodb/AWSMongoLoader.java:[51,9] cannot find symbol [ERROR] symbol: variable MongoUtility [ERROR] location: class com.aws.mongodb.AWSMongoLoader I got this part from running mvn clean test. These two classes are in the same namespace. MongoUtility is a class that just has a bunch of static methods I am using to load data. Versions of everything: Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00) Maven home: /usr/local/Cellar/maven/3.2.3/libexec Java version: 1.7.0_17, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac" Associated POM file: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 CLO-processing CLO-processing 1.0-SNAPSHOT qa org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 maven-dependency-plugin install copy-dependencies ${project.build.directory}/lib org.apache.maven.plugins maven-surefire-plugin 2.9 false in-project In Project Repo file://${project.basedir}/libs junit junit 4.11 test mygroupid mycustomartifact 2.0 org.codehaus.groovy.modules.http-builder http-builder 0.7 org.utgenome.thirdparty picard 1.86.0 org.mongodb mongo-java-driver 2.12.2 com.amazonaws aws-java-sdk 1.8.5 com.github.fakemongo fongo 1.5.7 org.slf4j slf4j-api 1.7.7 org.codehaus.groovy groovy-all 2.1.1 What is going wrong here? I am able to do mvn test fine with the intellij compiled class files. Any help is appreciated!
tagged with: groovy
answer count: 1
downvote count: 0

http://stackoverflow.com/a/27015523
downvote count: 1
score: 69
has comment: http://stackoverflow.com/comment/93016953
has body: This is method reference. Added in Java 8. TreeSet::new refers to the default constructor of TreeSet. In general A::B refers to method B in class A.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42556604
upvote count: 70
type: Answer
accepted answer of: http://stackoverflow.com/q/27015495
has comment: http://stackoverflow.com/comment/42556500
answers question: http://stackoverflow.com/q/27015495
has comment: http://stackoverflow.com/comment/42556666

http://stackoverflow.com/a/27014873
answers question: http://stackoverflow.com/q/27014394
has body: Without the formatting of whitespaces, the following is what I did: // Your code List&lt;String&gt; st=new ArrayList&lt;String&gt;(); st.add("Massachusetts institute "); st.add("of "); st.add("Technology "); st.add("MIT"); /* Added a few more to st for my own tests - see IDEONE link below */ //------------------------------------------------------------------- /* Additional code */ Set&lt;String&gt; combs = new HashSet&lt;String&gt;(); // Set of matches default 16 spaces /* The code should work even if the size goes above 16 - tried it in IDEONE */ int p = st.size(); // Get the endpoint for(int i =0; i&lt;p; i++){ for(int j=i+1; j&lt;p; j++) { combs.add(st.get(i) + st.get(j)); } } Iterator g = combs.iterator(); while(g.hasNext()) { System.out.println(g.next()); } } /************************************************/ The demo is here - http://ideone.com/K92Xwi Also, after reading some relevant comments, Apache library for PermutationIterator, google code library for Combinatorics, etc. should also help you. But the code above doesn't use anything than main Java.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27014394
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/27172828
answers question: http://stackoverflow.com/q/27149042
type: Answer
score: 0
has body: Actually Struts2 Actions are controller delegates. And Struts2 provides a valueStack on the View layer which has an Action on top of it, and if you want to use a pseudo-model then action should implement ModelDriven interface. You should also note that Struts2 actions are simple POJOs managed by Struts2 container. This is a bit different in the MVC point of view, also known as MVC Model2. For example, the description of the model given by wikipedia: The central component of MVC, the model, captures the behavior of the application in terms of its problem domain, independent of the user interface.[5] The model directly manages the data, logic and rules of the application. From this point of view a Business Model is defined separately from the View Model and often being managed by Persistence layer. Struts2 controller works with the View Model via its delegates. The View can be any output representation of information, such as a chart or a diagram; multiple views of the same information are possible, such as a bar chart for management and a tabular view for accountants. In Struts2 the View is a Result returned by the controller in response object. Struts2 can use different result types and templates to produce a response. The Controller, accepts input and converts it to commands for the model or view[6]. Struts2 uses a request for the input, which is handled by the Action to find appropriate delegate, which can work with the View Model directly or use a Service layer. In Struts2 an Action is a Controller, it's a simple POJO which is also a Model. Struts2 can help you with the Controller via ActionSupport and presenting a View, it's also pushes Action to the valueStack to have access from the View. You can design a Model via associating your Business Model with the View Model.

http://stackoverflow.com/comment/42618220
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27049911
has text: that didnt work, both image displayed, but the broder did not wrap

parse-platform
tags question: http://stackoverflow.com/q/27090786
tags question: http://stackoverflow.com/q/27118195
tags question: http://stackoverflow.com/q/27012101
type: Tag
tags question: http://stackoverflow.com/q/27077556
tags question: http://stackoverflow.com/q/27084901
tags question: http://stackoverflow.com/q/27101971
tags question: http://stackoverflow.com/q/27003628
tags question: http://stackoverflow.com/q/27007463
tags question: http://stackoverflow.com/q/27121358
tag name: parse-platform

http://stackoverflow.com/a/27095304
has body: Okay,I think I get your problem. First, you want to increment to i variable. So that's great. So you certainly need i++ in your for-loop. for(..,..,..) { i++; } You want to increment it count times, so you need a counter that holds the times you have already incremented it. But the counter can not go over the count value. for(int incs = 0; incs &lt; count; incs++) { i++; } And that's about it: public class HelloWorld { public static void main(String []args){ int count=1,i; i=10; // i will hold your input. for (int incs = 0;incs &lt; count ; incs++){ i++; System.out.println(i); } } } I think the mistake you made was increment count in your loop. When you do this, it always increments and the condition of your for-loop is never met.
upvote count: 1
answers question: http://stackoverflow.com/q/27085007
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27085007
type: Answer

http://stackoverflow.com/q/27146519
has answer: http://stackoverflow.com/a/27146983
favorite count: 0
tagged with: class-diagram
upvote count: 25
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/27797531
has comment: http://stackoverflow.com/comment/63861193
has comment: http://stackoverflow.com/comment/42791448
has answer: http://stackoverflow.com/a/27148457
has answer: http://stackoverflow.com/a/27155273
tagged with: java
tagged with: uml
has title: Private nested Java class in UML diagram
type: Question
tagged with: nested-class
score: 25
has body: I have a question regarding UML. I have a class which simply contains an inner class with the private access modifier - cannot be accessed from anywhere else... Normally in order to present an inner class relation I can use a (+) relation like here (InnerOddIterator): (taken from http://www.uml-diagrams.org/nested-classifier.html) I have not found anywhere any information about how can clearly emphasize that this class is private. Do you know if such a method exist at all? If yes I'll be grateful you give me some link here or something? Just to keep things clear, a sample code: public class DataStrucure { // fields, methods, etc private class InnerOddIterator{ // ... }; }
downvote count: 0
has comment: http://stackoverflow.com/comment/43108565
answer count: 3

http://stackoverflow.com/comment/42683872
comment on: http://stackoverflow.com/q/27088038
score: 0
has text: A _some_ point _something_ is going to have to carry out a low-level transaction. It just might not look quite like that.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42596660
has text: @Uooo Thanks, have read up on EL now. It is not available to me. So no.
comment on: http://stackoverflow.com/q/27037972
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42528789
type: QuestionComment
has text: Length of picture2.png is bigger than picture1.png. Checked in hexeditor.
type: Comment
comment on: http://stackoverflow.com/q/26999241
score: 0

http://stackoverflow.com/comment/42526614
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26998062
has text: Are these resources that are part of your application in some way?
score: 0

http://stackoverflow.com/comment/42678824
type: Comment
type: QuestionComment
score: 0
has text: No, it doesn't work with the YODA condition, it just keeps asking for more input, the exception is gone, but it doesn't stop when i input FIM, basically it's like there was only while(numAl < alunos.length);
comment on: http://stackoverflow.com/q/27084764

http://stackoverflow.com/q/27004899
has answer: http://stackoverflow.com/a/27005658
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42539070
favorite count: 0
upvote count: 6
has comment: http://stackoverflow.com/comment/42539983
has comment: http://stackoverflow.com/comment/66714559
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/42539755
has body: I am developing a project with Dropwizard and Titan DB. Both depend on Google Guava. One depends on version 15 and the other on 18. This error occurs at runtime: ! java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.&lt;init&gt;()V from class com.thinkaurelius.titan.graphdb.database.idassigner.StandardIDPool$ID BlockRunnable I researched the error and found that it was being caused by titan's Guava 15.0 dependency being evicted by Guava 18.0. I am new to Java and Gradle. I am using Gradle's java and application plugins to build and run the main class with gradle run. How can I resolve this problem? Here is my build.gradle: apply plugin: 'java' apply plugin: 'application' mainClassName = "com.example.rest.App" repositories { mavenCentral() } dependencies { compile ( [group: 'io.dropwizard', name: 'dropwizard-core', version: '0.8.0-rc1'], [group: 'com.thinkaurelius.titan', name: 'titan-core', version: '0.5.1'], [group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '0.5.1'], [group: 'com.tinkerpop', name: 'frames', version: '2.6.0'] ) testCompile group: 'junit', name: 'junit', version: '3.8.1' } run { if ( project.hasProperty("appArgs") ) { args Eval.me(appArgs) } }
tagged with: java
tagged with: gradle
type: Question
has title: How do I resolve dependency conflicts with Gradle?

http://stackoverflow.com/q/27118483
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42738794
has answer: http://stackoverflow.com/a/27118512
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42738861
has body: I've created a program that attempts to crack password protected zip files using a dictionary. The program reads from a line, stores that line in an ArrayList at position 0, then tries to open the locked zip file with it. If it is successful, it closes the buffered reader and announces the working password. If it is not successful, it ignores the produced ZipException, clears the password from position 0 in the ArrayList, and continues with the next line. I've included debugging to show the number of items in the ArrayList after each attempt (should always be 1). Code Snippet (Error): Exception in thread "main" java.lang.NullPointerException at net.lingala.zip4j.core.ZipFile.setPassword(ZipFile.java:650) at zZipCracker.zZipCracker.zZipCracker(zZipCracker.java:87) at zZipCracker.zZipCracker.main(zZipCracker.java:55) Code Snippet (My Loop): while(true) { //while elements are still in the array list String line; if ((line = br.readLine()) != null) { passwordArray.add(line); System.out.println(line); } zipper.setPassword((String) passwordArray.get(0)); //set the password to element position [passwordCounter] System.out.println("Testing password no." + passwordCounter + ", which is " + passwordArray.get(0)); passwordCounter = passwordCounter + 1; try { zipper.extractAll(dest); br.close(); JOptionPane.showMessageDialog(null, "The zip has been cracked. The password is " + passwordArray.get(0)); break; } catch(ZipException ze) { System.out.println(passwordArray.size()); passwordArray.remove(0); continue; } } } else { zipper.extractAll(dest); JOptionPane.showMessageDialog(null, "The selected zip was not password protected. It was extracted anyways."); } Code Snippet (Just line 87): zipper.setPassword((String) passwordArray.get(0)); Code Snippet (Output before the exception): darkside Testing password no.4747, which is darkside 1 angie1 Testing password no.4748, which is angie1 1 321456 Testing password no.4749, which is 321456 1 Exception in thread "main" java.lang.NullPoint…
tagged with: arraylist
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42738810
type: Question
has title: NullPointerException in Loop
score: -1
has answer: http://stackoverflow.com/a/27118554
answer count: 2
tagged with: loops
downvote count: 1

http://stackoverflow.com/comment/42516626
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26992383
has text: You forgot to tell which statement is on line 300.

http://stackoverflow.com/a/27112732
has comment: http://stackoverflow.com/comment/42728774
accepted answer of: http://stackoverflow.com/q/27112685
downvote count: 2
has comment: http://stackoverflow.com/comment/42735880
has comment: http://stackoverflow.com/comment/42754816
has comment: http://stackoverflow.com/comment/42728891
answers question: http://stackoverflow.com/q/27112685
has comment: http://stackoverflow.com/comment/42728478
score: 3
has body: You should use it like this: if (input.equals(yes)) { System.out.println("Your name is: " + name); } else if (input.equals(no)) { System.out.println("Enter your name again"); } Because the statement: input==yes; only checks if the references are equal or not And to input more values from the user you can do it like this: System.out.println("Enter your name:"); //This you already did name = userInput.next System.out.println("Enter your surname:"); String surname = userInput.next(); full code:(Asking for multiple prompts) package userinfo; import java.util.Scanner; public class UserInfo { public static void main(String[] args) { String name; int teleNum; String inputTeleNum; String yes = "YES"; String no = "NO"; Scanner userInput = new Scanner(System.in); while (true) { System.out.println("Enter your name:"); name = userInput.next(); System.out.println("Please varify your name by typing YES or NO"); String input = userInput.next(); if (input.equals(yes)) { System.out.println("Your name is: " + name); } else if (input.equals(no)) { System.out.println("Enter your name again"); } while (true) { System.out.println("Enter your telephone number:"); teleNum = userInput.nextInt(); System.out.println("Please varify your telephone number by typing YES or NO"); inputTeleNum = userInput.next(); if (inputTeleNum.equals(yes)) { System.out.println("Your telephone num is: " + teleNum); } else if (inputTeleNum.equals(no)) { System.out.println("Enter your tele number again: "); } } } } }
upvote count: 5
has comment: http://stackoverflow.com/comment/42728400
has comment: http://stackoverflow.com/comment/42728294
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42757299
type: Answer
has comment: http://stackoverflow.com/comment/42728289
has comment: http://stackoverflow.com/comment/42740823

http://stackoverflow.com/comment/42642466
has text: Yeah i just used return redirect(routes.Application.index();
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27064129

sqlite
tags question: http://stackoverflow.com/q/27007931
tags question: http://stackoverflow.com/q/27111989
tags question: http://stackoverflow.com/q/27148541
tags question: http://stackoverflow.com/q/27032288
tags question: http://stackoverflow.com/q/27053093
type: Tag
tags question: http://stackoverflow.com/q/27083920
tags question: http://stackoverflow.com/q/27010411
tags question: http://stackoverflow.com/q/27133656
tags question: http://stackoverflow.com/q/27041163
tags question: http://stackoverflow.com/q/27132824
tags question: http://stackoverflow.com/q/27039525
tags question: http://stackoverflow.com/q/27131138
tags question: http://stackoverflow.com/q/27076759
tags question: http://stackoverflow.com/q/27083034
tags question: http://stackoverflow.com/q/27136940
tags question: http://stackoverflow.com/q/27010345
tags question: http://stackoverflow.com/q/26993449
tags question: http://stackoverflow.com/q/27079377
tags question: http://stackoverflow.com/q/27087332
tags question: http://stackoverflow.com/q/27125483
tags question: http://stackoverflow.com/q/27003486
tags question: http://stackoverflow.com/q/27112715
tags question: http://stackoverflow.com/q/27003312
tags question: http://stackoverflow.com/q/27106275
tag name: sqlite

http://stackoverflow.com/comment/42707799
type: AnswerComment
score: 0
type: Comment
has text: @maasg About (1) you are right it's just more verbose but I included it since someone might get the same headaches as I did trying to get used to having two different functions because of the way the API works in Java. About (2) I mentioned it just in case someone thinks that he might need to a conversion from `List` to `Iterable`. He might think that because I implied it on my question, so in case someone tries to make the same mistake as I did he can just see that there is no need for conversion (I was trying for around 15 minutes to convert it before I realized how stupid I was).
comment on: http://stackoverflow.com/a/27101661

http://stackoverflow.com/comment/42782938
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27142841
has text: Google for Scanner and treemap. You'll get lot of tutorials.

http://stackoverflow.com/comment/42541997
type: AnswerComment
score: 0
type: Comment
has text: Read my post. The answer is there. The technique you use to read the file is really immaterial for what you are trying to do. If you want to "read and replace", it is probably best if you use `RandomAccessFile`. This class gives you the option to start reading/writing at a specific offset. A simple `FileWriter` append won't do the trick because `append` writes to the end of the file and not the current line. The other alternative is to hold the contents of the file in some buffer, modify it at will, and then write (overwrite) the entire contents of the buffer as a whole.
comment on: http://stackoverflow.com/a/27005627

http://stackoverflow.com/comment/42716361
type: QuestionComment
comment on: http://stackoverflow.com/q/27102282
score: 0
has text: Yes, especially for immutable objects. For example, java.lang.String is doing this.
type: Comment

http://stackoverflow.com/a/27031050
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27030586
accepted answer of: http://stackoverflow.com/q/27030586
has comment: http://stackoverflow.com/comment/42584269
type: Answer
score: 0
has body: You cannot create an instance of BaseManager&lt;T&gt; using new BaseManager&lt;T&gt;() because T is not an actual type. There needs to be some actual type between the angle brackets. The alternative is to instantiate the raw type BaseManager using new BaseManager(), but that defeats the purpose of your generics and can lead to some awful bugs. Static methods cannot be overridden by subclasses. They can only be hidden if the subclass declares a static method with the same name. I would make BaseManager abstract and remove getInstance() from it. You can still have your subclasses inherit common behavior from it, but having a getInstance() method in it is at best confusing and at worst incorrect.

http://stackoverflow.com/comment/42648104
score: 0
has text: Maybe, you will find this post helpful: http://stackoverflow.com/questions/19861168/call-a-method-any-time-other-methods-are-called
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27067119

http://stackoverflow.com/q/27028924
has comment: http://stackoverflow.com/comment/42600351
has title: Eclipse Java decryption
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5632658
tagged with: encryption
has comment: http://stackoverflow.com/comment/42581544
tagged with: output
type: Question
has comment: http://stackoverflow.com/comment/42581760
has body: Everything in this code works except decryption. It takes a file an encrypts it. After running the code and refreshing the project the files show in the src. The decrypted file is not decrypted though. Can anyone help me out, I know the problem is something simple. Here are some of the links I followed to get here: How to Encrypt or Decrypt a File in Java? http://www.macs.hw.ac.uk/~ml355/lore/pkencryption.htm The code works, but the output unencrypted file was never decrypted (keep in mind that I used my key from openssl (private and public)). I also already added the unlimited stength java .jars to my eclipse. Code: package CryptoFunction; import java.io.*; import java.security.*; import java.security.spec.*; import javax.crypto.*; import javax.crypto.spec.*; /** * Utility class for encrypting/decrypting files. * by: Michael Lones * Minor Revisions by Glenn Hall */ public class CryptoFunction { public static final int AES_Key_Size = 256; Cipher pkCipher, aesCipher; byte[] aesKey; SecretKeySpec aeskeySpec; /** * Constructor: creates ciphers */ public CryptoFunction() throws GeneralSecurityException { // create RSA public key cipher pkCipher = Cipher.getInstance("RSA"); // create AES shared key cipher aesCipher = Cipher.getInstance("AES"); } /** * Creates a new AES key * A random AES key is generated to encrypt files. * A key size (AES_Key_Size) of 256 bits is standard for AES */ public void makeKey() throws NoSuchAlgorithmException { KeyGenerator kgen = KeyGenerator.getInstance("AES"); kgen.init(AES_Key_Size); SecretKey key = kgen.generateKey(); aesKey = key.getEncoded(); aeskeySpec = new SecretKeySpec(aesKey, "AES"); } /** * Decrypts an AES key from a file using an RSA private key */ @SuppressWarnings("resource") public void loadKey(File in, File privateKeyFile) throws GeneralSecurityException, IOException { // read private key to be used to decrypt the AES key byte[] encodedKey = new byte[(int)privateKeyFile.length()]; new FileInputStream(privateKeyFile).read(enco…
tagged with: java
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/27047143
answer count: 1
has comment: http://stackoverflow.com/comment/42581838

http://stackoverflow.com/comment/42705011
type: QuestionComment
comment on: http://stackoverflow.com/q/27100231
has text: @Junaid but I haven't `HttpServletRequest request`
score: 0
type: Comment

http://stackoverflow.com/q/27093791
type: UnansweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/42693640
has comment: http://stackoverflow.com/comment/42693422
type: Question
has title: How can i access to a textfield in other jframe with java?
tagged with: java
has comment: http://stackoverflow.com/comment/42693481
has body: i'm bigginer in java . i tried to make a button in jframe1 and a textfield in jframe2 So i want to the button while clicking on it write a text in the textfield in the jframe2 Please help me and thanks. i traied this: String adress = jTextField1.getText(); //in the first jframe1
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27094131
has comment: http://stackoverflow.com/comment/42693478

http://stackoverflow.com/comment/42598172
has text: I have edited the the question and deed few more things. hope that helps.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27011341

http://stackoverflow.com/comment/42799911
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27152657
type: Comment
has text: No any mistakes or exceptions

http://stackoverflow.com/q/27005815
has body: I have method like this. Why when I set the login that is not in the database always gets true ? public boolean isLoginFree(String login) { String loginfree = null; try { PreparedStatement pst = null; pst = con.prepareStatement("SELECT login from User where login = ?"); pst.setString(1, login); ResultSet rs = pst.executeQuery(); while (rs.next()) { logintemp = rs.getString("login"); if ((logintemp.equals(login) == true)) { return false; //login free } } } catch (Exception e) { System.err.println(e); } return true; //login busy }
has comment: http://stackoverflow.com/comment/42540808
favorite count: 0
has answer: http://stackoverflow.com/a/27005914
has comment: http://stackoverflow.com/comment/42540834
accepted answer: http://stackoverflow.com/a/27005914
has answer: http://stackoverflow.com/a/27005872
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27005872
type: Question
has title: How to check is login free java?
answer count: 2
downvote count: 4
upvote count: 0
score: -4

http://stackoverflow.com/q/27152292
has body: I have my main; package lab8_9; import se.lth.cs.ptdc.images.ImageFilter; import se.lth.cs.ptdc.images.ImageGUI; public class ImageProcessor { public static void main(String[] args) { ImageFilter[] filters = new ImageFilter[2]; filters[0] = new IdentityFilter("Identity Filter"); filters[1] = new BlueFilter("Blue Filter"); new ImageGUI(filters); } } then I have my class; package lab8_9; import java.awt.Color; import se.lth.cs.ptdc.images.ImageFilter; public class IdentityFilter extends ImageFilter { public IdentityFilter(String name) { super(name); } public Color[][] apply(Color[][] inPixels, double paramValue) { int height = inPixels.length; int width = inPixels[0].length; Color[][] outPixels = new Color[height][width]; for (int i = 0; i &lt; height; i++) { for (int j = 0; j &lt; width; j++) { Color pixel = inPixels[i][j]; outPixels[i][j] = new Color(pixel.getRed(), pixel.getGreen(), pixel.getBlue()); } } return outPixels; } } Both of which works fine, but then I try to write my own class; package lab8_9; import java.awt.Color; import java.awt.image.ImageFilter; public class BlueFilter extends ImageFilter { public BlueFilter(String name) { super(name); } public Color[][] apply(Color[][] inPixels, double paramValue) { int height = inPixels.length; int width = inPixels[0].length; Color[][] outPixels = new Color[height][width]; for (int i = 0; i &lt; height; i++) { for (int j = 0; j &lt; width; j++) { Color pixel = inPixels[i][j]; outPixels[i][j] = new Color(0, 0, pixel.getBlue()); } } return outPixels; } } I get two errors, one for my main; filters[1] = new BlueFilter("Blue Filter"); "Type mismatch: cannot convert from BlueFilter to ImageFilter" and one for the class I'm trying to add, in the constructor; public BlueFilter(String name) { super(name); } "The constructor ImageFilter(String) is undefined" I am lost here, what is the problem? I pretty much copied IdentityFilter, which worked fine, yet it does not work. Any help is greatly appreciated. I'm a beginner, so p…
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27152329
has title: The constructor for superclass is undefined
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27152329
tagged with: java
type: Question

http://stackoverflow.com/q/27078488
has title: Instantiate Java Scanner in class or method
tagged with: java
type: Question
tagged with: instantiation
has comment: http://stackoverflow.com/comment/42667524
score: 4
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27078911
favorite count: 0
tagged with: java.util.scanner
upvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42667209
has body: I have created a class to read user input. I am using scanner to get user input and sanitize it. When using scanner object, it struck me with a question which of these 2 approaches will be best practice: To create a Scanner reference in a class &amp; instantiate it -> use it in each method private Scanner sc = new Scanner(System.in); public int readInt() { int input = sc.nextInt(); // some code to restrict input to integers only return input; } public int readDouble() { int double = sc.nextDouble(); // some code to restrict input to double only return input; } To create a Scanner reference a class -> instantiate it in each method -> use it in each method private Scanner; public int readInt() { sc = new Scanner(System.in); int input = sc.nextInt(); // some code to restrict input to integers only return input; } public int readDouble() { sc = new Scanner(System.in); int double = sc.nextDouble(); // some code to restrict input to double only return input; } Imagine a scenario where an object of this class will be created in another class, and readInt() or readDouble() will be called several times. In that case which of the 2 above mentioned approaches will be more practical from security and memory standpoint? Or as one of the comments suggested none of the above are practical and the best way will be to pass a scanner object as a paramter to each of the methods ?
has comment: http://stackoverflow.com/comment/42667212

http://stackoverflow.com/q/27078410
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: LibGDX: Reading from json file to ArrayList
has comment: http://stackoverflow.com/comment/42667141
has answer: http://stackoverflow.com/a/50360770
type: Question
accepted answer: http://stackoverflow.com/a/27080952
downvote count: 0
has body: I need help with reading json file to ArrayList. I have json file: [ { "name": "Wall", "symbol": "#", }, { "name": "Floor", "symbol": ".", } ] I have a class: public class Tile { public String name; public String symbol; } And I have another class with ArrayList: public class Data { public static ArrayList&lt;Tile&gt; tilesData; public static void loadData() { tilesData = new ArrayList&lt;Tile&gt;(); Json json = new Json(); json.fromJson(Tile.class, Gdx.files.internal("data/tiles.json")); } } I need to fill this ArrayList with data from json file, but I have some problems. I guess the line json.fromJson(Tile.class, Gdx.files.internal("data/tiles.json")); is wrong. When I try to run it there is Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error reading file: data/tiles.json Caused by: com.badlogic.gdx.utils.SerializationException: Unable to convert value to required type: [ { name: Wall, symbol: # }, { name: Floor, symbol: . } I have read the libgdx article about json files, but I found it unclear... I don't understand how to fill array. Please, help me with this case!
answer count: 3
possible better answer: http://stackoverflow.com/a/30424226
has answer: http://stackoverflow.com/a/30424226
favorite count: 0
upvote count: 14
has answer: http://stackoverflow.com/a/27080952
has comment: http://stackoverflow.com/comment/42667255
score: 14
type: AnsweredQuestion
tagged with: libgdx

http://stackoverflow.com/comment/42662425
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27074995
score: 1
has text: Wouldn't this lead to always evaluating function3 to function6?

http://stackoverflow.com/comment/42687977
has text: I thought OOP using Java at a university and I discarded the whole section about Applets. Instead, I just added it as a footnote. If you get a job offer that requires you to work with Applets, my professional suggestion to you is to apply somewhere else. If it is a bad thing for an institution to teach archaic technology, it is worse for a business to be using it today.
type: Comment
comment on: http://stackoverflow.com/q/27090362
score: 1
type: QuestionComment

http://stackoverflow.com/q/27029535
type: Question
tagged with: java
tagged with: nodes
has body: I need to find the path to a certain node, where a 0 indicates a left branch was taken and a 1 a right. Here is my code. private static String getPathTo(final BinaryNodeInterface&lt;Character&gt; root, char c) { // TO DO String path = ""; return getPT(root, c, path); } private static String getPT(BinaryNodeInterface&lt;Character&gt; root, char c, String path) { if( root.getData().equals(c) ) return path; if( (root.getData() &gt; c) &amp;&amp; (root.getLeftChild() != null) ) { path = path + "0"; getPT(root.getLeftChild(), c, path); } if( (root.getData() &lt; c) &amp;&amp; (root.getRightChild()!= null) ) { path = path + "1"; getPT(root.getRightChild(), c, path); } return "CHARACTER NOT FOUND"; } Where it just returns "CHARACTER NOT FOUND" except for the root. I am really confused because it seems so straight-forward, but clearly I'm doing something wrong.
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27030470
tagged with: path
has title: Trouble finding a path to a node in a BinarySearchTree
tagged with: binary-search-tree
type: UnansweredQuestion

http://stackoverflow.com/comment/42795910
type: QuestionComment
comment on: http://stackoverflow.com/q/27150421
has text: @TomCammann I'm doing a while loop with values of first group.. then on exiting.. updating the values and doing the same while loop.. I know this is not the right way.. Hence.. looking for some suggestion to do the right way
score: 0
type: Comment

http://stackoverflow.com/comment/42649720
comment on: http://stackoverflow.com/a/27064063
score: 1
type: AnswerComment
has text: proxies for classes is not supported by default in the JDK. However there are 3rd party libraries that provide that support. CGLib is the one most software uses. Here's a blog explaining how to proxy a class using cgLib https://brixomatic.wordpress.com/2012/12/22/dynamic-proxies-for-classes/
type: Comment

retrofit
tags question: http://stackoverflow.com/q/27016267
type: Tag
tags question: http://stackoverflow.com/q/27067970
tags question: http://stackoverflow.com/q/27098535
tags question: http://stackoverflow.com/q/27080231
tag name: retrofit

http://stackoverflow.com/q/27023980
answer count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/42575805
type: UnansweredQuestion
tagged with: multithreading
tagged with: graphics
tagged with: object
has body: How is an object is supposed to move on it's own? My project below is the current code for a simple Ping Pong game remake. I've succeeded in getting the left Paddle to move via user input, but I do not know how to program the Ball object and AI Paddle object to move independently. I suspect that I require a multitude of Threads, but where do I place them and how can I update my objects from within the Thread? Perhaps I misplaced the Ball and Paddle objects into the wrong class? Main Class: package com.N00744323.pingpong; import javax.swing.JFrame; public class Display { static JFrame frame; public static void main(String[] args) { frame = new JFrame("Ping Pong"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new GUI()); frame.pack(); frame.setVisible(true); } } GUI frame class: package com.N00744323.pingpong; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JPanel; public class GUI extends JPanel { private static final long serialVersionUID = 1L; final private int WIDTH = 750, HEIGHT = 500; private Paddle p1, p2; private Ball b; public GUI() { addKeyListener(new DirectionListener()); p1 = new Paddle(1); p2 = new Paddle(2); b = new Ball(); setBackground(Color.black); setPreferredSize(new Dimension(WIDTH, HEIGHT)); setFocusable(true); } public int getWIDTH() { return WIDTH; } public int getHEIGHT() { return HEIGHT; } public void paintComponent(Graphics page) { super.paintComponent(page); page.setColor(Color.black); page.fillRect(0, 0, WIDTH, HEIGHT); page.setColor(Color.white); page.fillRect(p1.getLocX(), p1.getLocY(), p1.getWIDTH(), p1.getHEIGHT()); page.fillRect(p2.getLocX(), p2.getLocY(), p2.getWIDTH(), p2.getHEIGHT()); page.fillOval(b.getLoc()[0], b.getLoc()[1], b.getSIZE()*2, b.getSIZE()*2); } private class DirectionListener implements KeyListener { public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if(key…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42573351
has comment: http://stackoverflow.com/comment/42572300
score: 0
has comment: http://stackoverflow.com/comment/42578222
has title: How do I make objects move independently? (Java)

http://stackoverflow.com/q/27048239
type: Question
has body: How can I solve this query with Hibernate's detached criteria? The hardest part for me is to bring the and u1.abrechnungsDatum is null into the subselect. I want a query like this: select * from patient as p where p.krankenstand = ? and ? &lt; ( select count(*) from ueberweisung u1 where p.id = u1.patient_id and u1.abrechnungsDatum is null) I have tried it with this DetachedCriteria dc = DetachedCriteria.forClass(Patient.class, "patient"); dc.add(Restrictions.eq("krankenstand", true)); DetachedCriteria nab = dc.createCriteria("ueberweisungs", "nab"); nab.add(Restrictions.isNull("nab.abrechnungsDatum")); dc.add(Restrictions.sizeGt("ueberweisungs", 0)); which gives me the following SQL-Statement select * from patient this_ inner join ueberweisung nab1_ on this_.id=nab1_.patient_id where this_.krankenstand=? and nab1_.abrechnungsDatum is null and ? &lt; ( select count(*) from ueberweisung where this_.id=patient_id ) As you can see, the and-clause for the field abrechnungsDatum is not inside the subselect. How can I achieve to get this inside?
tagged with: detachedcriteria
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27050659
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has title: Hibernate DetachedCriteria Query with and clause in subselect

http://stackoverflow.com/q/27095597
has title: android copy file from assets to sd card
has comment: http://stackoverflow.com/comment/42706003
has comment: http://stackoverflow.com/comment/42703919
tagged with: java
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/42697240
has answer: http://stackoverflow.com/a/27099763
has comment: http://stackoverflow.com/comment/42704879
linked to: http://stackoverflow.com/q/4447477
tagged with: copy
has answer: http://stackoverflow.com/a/31763482
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42715509
has comment: http://stackoverflow.com/comment/42697322
tagged with: assets
has body: this is MyNewMain.java CopyAssets(); private void CopyAssets() { AssetManager assetManager = getAssets(); String[] files = null; try { files = assetManager.list("Files"); } catch (IOException e) { Log.e("tag", e.getMessage()); } for(String filename : files) { System.out.println("File name =&gt; "+filename); InputStream in = null; OutputStream out = null; try { in = assetManager.open("Files/"+filename); out = new FileOutputStream(Environment.getExternalStorageDirectory().toString() +"/" + filename); copyFile(in, out); in.close(); in = null; out.flush(); out.close(); out = null; } catch(Exception e) { Log.e("tag", e.getMessage()); } } } private void copyFile(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[1024]; int read; while((read = in.read(buffer)) != -1){ out.write(buffer, 0, read); } } in my assets folder i have folder called Files. there is .txt file onCreate methed i am calling CopyAssets(); lower are the methods i used. the problem is that this does nothing. i have absoluteli no idea why my file is not being copied. in my manifest i have added and app.iml contains
has comment: http://stackoverflow.com/comment/42705851
has comment: http://stackoverflow.com/comment/42710905
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42702626

http://stackoverflow.com/q/27152573
type: Question
accepted answer: http://stackoverflow.com/a/27152674
answer count: 2
tagged with: size
score: -1
has title: How to create a larger frame in Java
tagged with: java
has body: I am drawing a coordinate system with weight, height =10000*10000 on a frame. It too big, my graph can't fully display. I try to draw on scroll but it's lag. I want to display my graph on a frame 10000*10000, fit with my screen computer to print screen. What should I do?
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/27152674
possible better answer: http://stackoverflow.com/a/27152680
has answer: http://stackoverflow.com/a/27152680
type: AnsweredQuestion
upvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42568676
comment on: http://stackoverflow.com/a/27015316
score: 0
type: Comment
has text: I am sure I am downloaded the android support repository and also android support library. I also add the line: compile "com.android.support:support-4:18.0.+" but the android studio still keep asking me go and install the android support repository.
type: AnswerComment

http://stackoverflow.com/q/27050757
has title: How do I get this code to loop based off the user's input?
answer count: 5
has answer: http://stackoverflow.com/a/27051153
type: AnsweredQuestion
score: 1
tagged with: java
has body: My code here checks whether or not the word that the user inputs is a palindrome or not. It executes properly its just that if the user tries to loop it by pressing "1". The program ends. How do I fix this? int answer =0; String original, backwards = ""; Scanner input = new Scanner(System.in); System.out.println("A palindrome is a word that is the same forwards as it is backwards. Enter a word to check if it is a palindrome or not."); original = input.nextLine(); int length = original.length(); do { for ( int i = length - 1; i &gt;= 0; i-- ) backwards = backwards + original.charAt(i); if (original.equals(backwards)) System.out.println("The entered phrase is a palindrome."); else System.out.println("The entered phrase is not a palindrome."); } while (answer ==1); System.out.println("If you would like to check another word press 1. If you wish to exit, press 2."); answer = input.nextInt(); if (answer ==1){ System.out.println("Enter another word"); } else if (answer == 2){ System.out.println("Have a nice day"); } } } Here is a sample output of the program: A palindrome is a word that is the same forwards as it is backwards. Enter a word to check if it is a palindrome or not. racecar The entered phrase is a palindrome. If you would like to check another word press 1. If you wish to exit, press 2. 1 Enter another word
tagged with: loops
upvote count: 1
has answer: http://stackoverflow.com/a/27050862
possible better answer: http://stackoverflow.com/a/27050844
type: Question
has answer: http://stackoverflow.com/a/27050844
has answer: http://stackoverflow.com/a/27050875
accepted answer: http://stackoverflow.com/a/27050862
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27051111

http://stackoverflow.com/comment/42668354
type: QuestionComment
comment on: http://stackoverflow.com/q/27071802
score: 0
has text: Of course such releases still can get updates for minor bug fixing or improvements, that's why you have some kind of minor version.
type: Comment

http://stackoverflow.com/comment/42856773
type: Comment
has text: Hi and thanks for contributing! I have already tried using explicit wait as was suggested in the previous comment by arisalexis. This results in wait function timeout. However, I like the check you use to see, if element exists, I think I will add this to my code so I can set test value to "Fail" if Selenium fails to retrieve the element.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27182936

http://stackoverflow.com/comment/44590104
type: AnswerComment
has text: @ntherning I created a pull request with a preliminary SpeakHere sample using marc-raiser's code. The UI does not yet reflect that of the original SpeakHere sample, and I haven't figured out exactly how to access the floating point PCM values of audio data (to display the volume).
comment on: http://stackoverflow.com/a/27218086
score: 0
type: Comment

http://stackoverflow.com/q/27062661
has comment: http://stackoverflow.com/comment/42639754
has body: I have the following MySQL query which fetches all the information I need. SELECT biobank.*, organization_.name, biobankattributelists.* FROM biobank INNER JOIN organization_ ON biobank.biobankDbId = organization_.organizationId LEFT JOIN biobankattributelists ON biobank.biobankDbId=biobankattributelists.biobankDbId WHERE ((organization_.name LIKE '%%' OR '' IS NULL) OR (biobank.biobankId LIKE '%%' OR '' IS NULL) OR (biobank.acronym LIKE '%%' OR '' IS NULL) OR (biobankattributelists.attributeListName LIKE '%%' OR '' IS NULL) OR (biobankattributelists.attributeListValue LIKE '%%' OR '' IS NULL)) AND (biobank.countryCode = '' OR '' = '') The result is The important columns to note here are biobankDbId, attributeListName, attributeListValue. Each biobank can have different attributeListName and each of that attributeListName has different attributeListValue. The combination of these three is unique across the result set. For eg in the rows 2 and 3; Available Documents for Biobank for Serum are Protocols/Procedures and Sample Catalogue. Provided that I get the result like this: Biobank results = BiobankLocalServiceUtil.searchBiobanks(); for(Biobank row:results){ // To be done.... } I want the result to be displayed like this for each biobank grouped by the attributeListName. Name: Biobank For Serum Automation Services: Analysis Available Documents: Protocols/Procedures, Sample Catalogue Complementary Services: Biochemistry Laboratory, Pathology Department/Imaging ..... I can probably get this done by fetching the results as it is and again making another query. But it will be inefficient to make multiple queries. Further more since I have everything needed fetched by this query I am looking for the solution either by modifying the query or perhaps in the front end say PHP/JSP to format the query result as I want it displayed. P.S. Apologies for the small picture. It is much bigger if opened in the new tab.
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/42639574
has answer: http://stackoverflow.com/a/27063317
has comment: http://stackoverflow.com/comment/42639634
has title: Format the results fetched by query for display
score: 0
answer count: 1
tagged with: jsp
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: php

http://stackoverflow.com/comment/42679872
has text: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [[Ljava.lang.Object;
comment on: http://stackoverflow.com/a/27085441
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27190166
upvote count: 1
has comment: http://stackoverflow.com/comment/42866476
answers question: http://stackoverflow.com/q/27146979
downvote count: 0
score: 1
type: Answer
has body: If you can address your network file via a URL or FileName, you can use forms of getAudioInputStream that do NOT require Markability/Resetability. This test is only performed when InputStream is used as the input parameter. If so, you can eliminate both the InputStream and BufferedInputStream steps. However, I am not experienced with getting files over a network, so I'm not entirely sure a URL (my most usual method of opening audio data files) will work. Seems like it should though.

http://stackoverflow.com/a/27101401
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42707728
answers question: http://stackoverflow.com/q/27101258
score: 2
has body: Here is a quick fix. Create a temporary Scanner and set it equal to histogram before you run through histogram. If the user is found then validName() will return that user, if not then repeat this function by passing in input and the copy of histogram tmp. This will get the job done but is not the right way to go about this task. Updated Create a temporary string and add each user to the string followed by a space. If the check fails then recall the function with an anonymous Scanner constructed with the string of users. public static String validName(Scanner input, Scanner histogram) { String user = ""; String name = input.next(); String tmp = ""; boolean test = false; while (histogram.hasNext()) { user = histogram.next(); tmp += user + " "; if (name.equalsIgnoreCase(user)) { test = true; break; } else { test = false; } } if (!test) { System.out.println("Name not found"); user = validName(input, new Scanner(tmp)); } return user; }
has comment: http://stackoverflow.com/comment/42707867
has comment: http://stackoverflow.com/comment/42707176
downvote count: 0
has comment: http://stackoverflow.com/comment/42708032
accepted answer of: http://stackoverflow.com/q/27101258
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42707346

http://stackoverflow.com/comment/42716770
type: Comment
type: QuestionComment
has text: could you try with value.toString().split(" ");
comment on: http://stackoverflow.com/q/27105146
score: 0

http://stackoverflow.com/a/27134179
accepted answer of: http://stackoverflow.com/q/27132382
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27132382
type: AcceptedAnswer
downvote count: 0
has body: If your native signature requires const char*, then JNA will automagically work when you pass a Java String. No conversion necessary. Internally, JNA will create a temporary buffer (for the duration of the call) and encode the Java String as a native NUL-terminated byte array (defaults to utf8 encoding, but can be modified by setting the system property jna.encoding).

http://stackoverflow.com/comment/42773464
comment on: http://stackoverflow.com/q/27137447
score: 0
type: Comment
type: QuestionComment
has text: Added code to show you my current code the exact way it sits. Thanks for the fast reply by the way.

http://stackoverflow.com/q/27009286
downvote count: 0
has body: I am making a Minecraft Control Panel in which members can run their own jar files on our servers which could have potentially damaging consequences to our equipment. I would like to set a jar file (I code java) which will be the security manager. I would like to do this so I can prevent some operations, e.g. only 1 socket to 1 IP so they dont use it to perform a denial of service attack. I know there is a java.policy file, but this isnt "smart" enough to allow you to do some of the operations I would like to do. I know you can override the security manager, but then the class would be loaded within the same JVM and another malicious code could override this manager. My question to you, is how can I make a security manager that nobody elses code can possibly interfere with.
score: 1
has answer: http://stackoverflow.com/a/27009693
favorite count: 0
tagged with: security
type: Question
has title: Java Security Manager: Specify Jar File in JVM Args
upvote count: 1
answer count: 1
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/comment/42805313
comment on: http://stackoverflow.com/a/27154455
type: Comment
has text: select "check" next to answer that is correct. If you found other answers as helpful, up-vote them.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42538800
score: 0
comment on: http://stackoverflow.com/a/27003977
has text: Vote for the answer if it serves for your problem.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42660749
score: 0
type: Comment
has text: i would add more context to your RegExp to handle spaces, negatives, etc.
comment on: http://stackoverflow.com/a/27074559
type: AnswerComment

http://stackoverflow.com/comment/42559450
score: 2
has text: Sounds like your JVM is too old
comment on: http://stackoverflow.com/q/27016835
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42850704
type: AnswerComment
type: Comment
has text: Yeah I had to configure it using a JschConfigSessionFactory. I am not sure if there is an easiest way for me to do it other than get this recipe and apply it: https://github.com/web-stories/release/blob/da834874ab6b081658d9ec50054b7698505edc7c/src/main/java/org/webstories/release/git/GitCommands.java#L49-L76
comment on: http://stackoverflow.com/a/27154454
score: 0

http://stackoverflow.com/comment/42837548
type: AnswerComment
has text: Hey thanks for the suggestion, spincity refers to a spinner created on the interface which is basicaly a dropdownlist for android, and the method returns an integer value for the index of the current selected item, and it should return the same index every time during the loop, as the only thing that I want to be changing should be the array retrieved from the list
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27128551

http://stackoverflow.com/comment/42712963
comment on: http://stackoverflow.com/a/27104644
type: AnswerComment
has text: I doubt this is going to work. No `resourceDirs` property exists or has ever existed (where did you get this from?). You can introduce one via `ext.`, but none of the existing plugins are going to be aware of it. Perhaps try `sourceDirs += [file('src/dist/etc')]`.
type: Comment
score: 2

http://stackoverflow.com/comment/42702711
has text: GreyBeardedGeek, i have updated my question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27098535

http://stackoverflow.com/a/27003220
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27003081
has body: If you're going to go native Java then do yourself a favor and use Retrofit. That will save you a ton of code in your API layer. Regular Java Http stuff is ugly, Retrofit makes it much easier. When you get comfortable, look at RxAndroid (RxJava) to really help with some of your Async code.
type: Answer
upvote count: 2

http://stackoverflow.com/comment/42567585
score: 0
type: Comment
type: QuestionComment
has text: `.. extends JComponent { public void paint(Graphics g) { ..` **should** be `.. extends JComponent { public void paintComponent(Graphics g) { super.paintComponent(g); ..`
comment on: http://stackoverflow.com/q/27021227

http://stackoverflow.com/q/27094317
has comment: http://stackoverflow.com/comment/42697474
tagged with: date
has answer: http://stackoverflow.com/a/27095296
linked to: http://stackoverflow.com/q/4024544
tagged with: converters
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42694905
has body: I need to parse a String to Date in Java. The problematic scenario is when the full date pattern is used and it depends on a specific locale (that I don't know previously) For example, using pattern "EEEE dd MMMM yyyy" two possible inputs are: English = "Friday 10 November 2014" Spanish = "Viernes 10 Noviembre 2014" Is it possible to convert the above inputs to a Date object without to know the source locale? Thanks.
has comment: http://stackoverflow.com/comment/42694484
score: 1
tagged with: java
upvote count: 1
has title: Parse a string to Date without locale
type: Question

http://stackoverflow.com/comment/42663639
has text: You dont have to copy the jars in the lib folder. Just include the path in your gradle file in the dependencies section. I think you have done both that is why you getting the duplicate error
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27076391
score: 0

http://stackoverflow.com/a/27073904
upvote count: 2
answers question: http://stackoverflow.com/q/27073872
type: Answer
score: 2
downvote count: 0
has body: a List of Beans has better type safety and readability. Use that until you can prove that there is a problem with that approach.

http://stackoverflow.com/comment/42777197
comment on: http://stackoverflow.com/q/27139615
has text: I would also like to know if Its block certain class to be loaded
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27128127
tagged with: red5-recorder
tagged with: red5
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: rtmp
tagged with: flash
has answer: http://stackoverflow.com/a/27136049
downvote count: 0
answer count: 1
has body: I am developing an application with the red5 server. I would like to create a simple webservice that to be asked to return the names of streans (rtmp: // IP / canal / stream) available at that time. My application is simple. The context also have the usual red5 server, sending and receiving video streans and would like to create something in JAVA to list the streans that are running / available at the time to be able to access them on a remote site with 1 or N streans by example. I am having doubt in how to assemble the code snippet for the streans of red5, the rest is ready. Do you have any idea how to find it? I am having some difficulty in finding some examples and docs. Thank you.
favorite count: 0
type: UnansweredQuestion
has title: List streams available with Red5

http://stackoverflow.com/q/27064238
has comment: http://stackoverflow.com/comment/42642476
has answer: http://stackoverflow.com/a/27067053
tagged with: java
downvote count: 3
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/42646541
has title: How to determine if a number is a prime in a faster fashion using additional threads?
has answer: http://stackoverflow.com/a/27066080
has comment: http://stackoverflow.com/comment/42656376
has comment: http://stackoverflow.com/comment/42679840
has comment: http://stackoverflow.com/comment/42642490
has comment: http://stackoverflow.com/comment/42643022
has answer: http://stackoverflow.com/a/27064430
has answer: http://stackoverflow.com/a/27064424
answer count: 4
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
score: -3
tagged with: primes
has body: I have a program which is PrimeNumbers class. It displays if the x is a prime or not. The x is the number being analyzed in the program. There is a time on how long will the program take to know the answer. x is so big it takes 9 seconds to know the answer. How could the program run faster using more threads? I am having a hard time on getting how to implement thread in this situation. public class PrimeNumbers { private static int x = 2147483647; public static boolean prime= true; public static void main(String[]args){ long start, end, elapsetime; start= System.currentTimeMillis(); for(int y=2; y&lt;x; y++){ if(x % y == 0){ prime=false; System.out.println(y); break; } } end = System.currentTimeMillis(); elapsetime = end - start; System.out.println("Prime: " + prime); System.out.println(elapsetime+ " mill sec " + (elapsetime / 1000 + " seconds.")); } }

http://stackoverflow.com/a/27068117
downvote count: 0
has body: Please put the servlet in a package. The container is unable to load classes from default package.
type: AcceptedAnswer
score: 1
answers question: http://stackoverflow.com/q/27066311
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27066311

http://stackoverflow.com/comment/42579456
comment on: http://stackoverflow.com/a/27028188
has text: Is this going into a method or is it in the main method? I'm sorry, I'm a beginner.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42610409
has text: Yes I am. I dont see anything like this in my file, cant you please specify what exactly am I supposed to add? all I see are "dependencies" and "classpath" etc...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27045900

http://stackoverflow.com/comment/42712884
comment on: http://stackoverflow.com/a/27083393
type: AnswerComment
score: 0
type: Comment
has text: @basbe I used this solution in jboss AS 6 and work as expected. What version of jboss you are using?

http://stackoverflow.com/a/27146219
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42788284
has body: You can't do this automatically - it's simply not a feature of Java property files. You'll need to write code to do this wherever you plan to load/use the properties file. You should think about: whether you want to make this more explicit, e.g. using ${MACHINE_NAME} instead of just MACHINE_NAME whether you have a fixed list of replacements you want to support, or whether you want to pick up anything that looks like it's a replacement (much easier if you have a syntax such as ${...} of course) whether replacements can be recursive, e.g. MACHINE_NAME = ${USER_NAME}-laptop - and how to handle cycles if so
answers question: http://stackoverflow.com/q/27146185
downvote count: 0
has comment: http://stackoverflow.com/comment/42788128
type: Answer

http://stackoverflow.com/a/27135133
answers question: http://stackoverflow.com/q/27123521
type: AcceptedAnswer
score: 0
type: Answer
has body: If you already have the column names in a List then you can use StringUtils.join from Apache Commons Lang to build a comma-separated list and include that in your SQL statement: // the following code assumes: import org.apache.commons.lang.*; String tableName="employee"; List&lt;String&gt; columnsList = new ArrayList&lt;String&gt;(); columnsList.add("emp_id"); // columnsList.add("name"); // sample data columnsList.add("salary"); // String colString = StringUtils.join(columnsList, ','); String paramString = StringUtils.repeat(",?", columnsList.size()); String sql = String.format( "INSERT INTO %s (%s) VALUES (%s)", tableName, colString, paramString.substring(1)); System.out.println(sql); resulting in INSERT INTO employee (emp_id,name,salary) VALUES (?,?,?) Edit: Note that for safety's sake you probably should enhance the above code to enclose the table and column names in backticks, e.g. INSERT INTO `employee` (`emp_id`, ...
accepted answer of: http://stackoverflow.com/q/27123521

http://stackoverflow.com/comment/42753925
comment on: http://stackoverflow.com/q/27127199
score: 0
type: Comment
has text: For what you are after, you should probably use an enum, and not a class.
type: QuestionComment

http://stackoverflow.com/comment/66552608
has text: I noticed my server.xml was corrupt as well. I went and fixed the archive and reset my local tomcat and it worked.
comment on: http://stackoverflow.com/a/30588865
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42634151
type: Comment
has text: privPickList is of type [org.primefaces.model.DualListModel<T>](http://www.primefaces.org/docs/api/3.5/org/primefaces/model/DualListModel.html) and signature of getSource is `public List<T> getSource()`
score: 0
comment on: http://stackoverflow.com/q/27056292
type: QuestionComment

http://stackoverflow.com/q/27057132
answer count: 1
has answer: http://stackoverflow.com/a/27057184
has body: Quick question, I have developed 3 A.I's each with a different depth. Currently to choose what A.I you want to play against you have to go into the java file called Main.java and change it to whichever one you want. The line to change is: chessGame.setPlayer(Piece.COLOR_BLACK, ai3);//Here A.I is assigned I want to allow the user to have an option at the start of the game to choose the A.I. I was hoping for some help with the interface, I was thinking something something like a JOptionpane might work. (I'm just not sure how to do one for the A.I selection) Current A.I's ai1 ai2 ai3 package chess; import chess.ai.SimpleAiPlayerHandler; import chess.gui.ChessGui; import chess.logic.ChessGame; import chess.logic.Piece; public class Main { public static void main(String[] args) { // Creating the Game ChessGame chessGame = new ChessGame(); // Creating the Human Player //Human Player is the Object chessGui ChessGui chessGui = new ChessGui(chessGame); //Creating the A.I's SimpleAiPlayerHandler ai1 = new SimpleAiPlayerHandler(chessGame);//Super Dumb SimpleAiPlayerHandler ai2 = new SimpleAiPlayerHandler(chessGame);//Dumb SimpleAiPlayerHandler ai3 = new SimpleAiPlayerHandler(chessGame);//Not So Dumb // Set strength of AI, how far they can see ahead ai1.maxDepth = 1; ai1.maxDepth = 2; ai3.maxDepth = 3; //Assign the Human to White chessGame.setPlayer(Piece.COLOR_WHITE, chessGui); //Assign the not so dumb A.I to black chessGame.setPlayer(Piece.COLOR_BLACK, ai3); // in the end we start the game new Thread(chessGame).start(); } } Thanks for any help.
has comment: http://stackoverflow.com/comment/42629830
has title: Need Help adding a difficulty option for User functionality
has comment: http://stackoverflow.com/comment/42629832
tagged with: joptionpane
type: AnsweredQuestion
tagged with: swing
accepted answer: http://stackoverflow.com/a/27057184
type: Question
linked to: http://stackoverflow.com/q/9246478
tagged with: java
score: 0

http://stackoverflow.com/q/27002001
tagged with: android
has answer: http://stackoverflow.com/a/27002115
tagged with: java
type: Question
type: AnsweredQuestion
has title: Load a XML file from a specific folder in Android
score: 0
accepted answer: http://stackoverflow.com/a/27002115
answer count: 1
has body: I have three XML files that I'd like to call from my app. I'd like to save those files in internal app-specific directory /data/data/your.package.name/, but I don't know where is that folder, or if is there another folder to put them.

http://stackoverflow.com/q/27092343
has answer: http://stackoverflow.com/a/27092378
has title: Java: argument list error in integer declaration
tagged with: declaration
tagged with: java
has answer: http://stackoverflow.com/a/27092369
tagged with: methods
downvote count: 1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/27092368
score: -1
has body: So I'm getting an error in line 18, it describes: HelloWorld.java:18: error: method calcThirdChance in class HelloWorld cannot be applied to given types; int t3 = calcThirdChance(t1+t2); ^ required: int,int found: int reason: actual and formal argument lists differ in length This makes little sense to me, because the method calcThirdChance returns a single int and I am declaring only one int in that line therefore I don't know why is it requiring 2 ints, which is allegedly the reason of the error. public class HelloWorld{ public static void main(String []args){ System.out.println(simMin(70,80)); } public static int calcThirdChance(int t1, int t2){ int c; c = -1*(t1+t2); double finalsend; finalsend = Math.pow(2.71, c/100)*2; finalsend*=150; return (int)finalsend; } public static int simMin(int t1, int t2){ int t3 = calcThirdChance(t1+t2); int total=t1+t2+t3; int play = 50; if(play&lt;=t1){ return t1; } else if(play&lt;=t1+t2){ return t2; } else{ return t3; } } }
tagged with: class
tagged with: int
answer count: 3
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/27049875
score: 0
type: Answer
has body: In Java this should really print -128. If a = 256 it should print 0. Byte is from -128 to 127, so if you cast 127 it is 127 and 128 is -128 because 127 + 1 = -128.
answers question: http://stackoverflow.com/q/27049651

http://stackoverflow.com/q/26999098
score: 14
has title: Is the IN relation in Cassandra bad for queries?
has answer: http://stackoverflow.com/a/27000384
type: AnsweredQuestion
upvote count: 14
possible better answer: http://stackoverflow.com/a/36349532
has answer: http://stackoverflow.com/a/36349532
type: Question
has body: Given an example of the following select in CQL: SELECT * FROM tickets WHERE ID IN (1,2,3,4) Given ID is a partition key, is using IN relation better than doing multiple queries or is there no difference?
accepted answer: http://stackoverflow.com/a/27000384
tagged with: java
tagged with: database
answer count: 2
downvote count: 0
tagged with: database-design
tagged with: cql
favorite count: 0
tagged with: cassandra

http://stackoverflow.com/a/27008250
upvote count: 4
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/114518943
downvote count: 2
has comment: http://stackoverflow.com/comment/75832953
has body: I've found the answer to your problem on another SO question, and I've adapted it for you: public class Foo { public static void main(String[] args) { final int n = 3; for (int i = 0; i &lt; Math.pow(2, n); i++) { String bin = Integer.toBinaryString(i); while (bin.length() &lt; n) bin = "0" + bin; char[] chars = bin.toCharArray(); boolean[] boolArray = new boolean[n]; for (int j = 0; j &lt; chars.length; j++) { boolArray[j] = chars[j] == '0' ? true : false; } System.out.println(Arrays.toString(boolArray)); } } } Will produce: [true, true, true] [true, true, false] [true, false, true] [true, false, false] [false, true, true] [false, true, false] [false, false, true] [false, false, false] Tested and this will work for high values of n, such as 10000 and so on.
has comment: http://stackoverflow.com/comment/42544788
has comment: http://stackoverflow.com/comment/42544847
answers question: http://stackoverflow.com/q/27007752

http://stackoverflow.com/q/27014799
tagged with: infix-notation
has comment: http://stackoverflow.com/comment/42556153
has comment: http://stackoverflow.com/comment/42555747
answer count: 0
has title: InFixToPostFix java with equations
score: 0
type: UnansweredQuestion
tagged with: postfix-notation
has comment: http://stackoverflow.com/comment/42555611
has comment: http://stackoverflow.com/comment/42555700
has comment: http://stackoverflow.com/comment/42556024
tagged with: java
has comment: http://stackoverflow.com/comment/42556056
has body: Using one input file as a map for variable value and then file with equations. My problem is with an equation such a ((A+B)-(C-D))/(E-F) calculates correctly until (A+B)-(C-D) I know it has to do with map.put('z', temp) and as.push('z') I just don't know how else to make it work properly. input file one: A = 8.0 B = -1.0 C = 7.0 D = -4.0 E = 11.0 F = 9.0 G = 3.2 H = 6.325 I = 8 J = -3.333894 input file two: (((A + B) - (C - D)) / (E - F)) (((A))) (A) ((A (B D) D)) Program: import java.util.*; import java.io.*; public class InfixToPostfix { static final String P_ERROR = "Parenthesis Match Error"; static final String E_ERROR = "Empty Infix Expression Error"; static Map&lt;Character, Integer&gt; out_stack = new HashMap&lt;Character, Integer&gt;(); static Map&lt;Character, Integer&gt; in_stack = new HashMap&lt;Character, Integer&gt;(); public static void main(String[] args) { Map&lt;Character, Double&gt; map = null; try { map = populate(); }catch(IOException e) { e.printStackTrace(); } generate(); System.out.print("Load infix file: "); try { BufferedReader in = new BufferedReader(new FileReader(getFile())); String line = ""; while((line = in.readLine()) != null) { if(!match(line)) { System.out.println(line + " --&gt; " + P_ERROR); continue; } String expression = convert(line, map); if(expression.equals("")) { System.out.println(line + " --&gt; " + E_ERROR); continue; } System.out.println(line + " --&gt; " + expression + " --&gt; " + evaluate(expression, map)); } in.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } } static boolean isOperand(char operand, Map&lt;Character, Double&gt; map) { if(map.containsKey(operand)) return true; return false; } static String convert(String infix, Map&lt;Character, Double&gt; map) { ArrayStack&lt;Character&gt; as = new ArrayStack&lt;Character&gt;(infix.length()); String post_expression = ""; int index = 0; while(index &lt; infix.length()) { char current = infix.charAt(inde…
type: Question

http://stackoverflow.com/comment/42758822
type: QuestionComment
comment on: http://stackoverflow.com/q/27129778
has text: You'd probably have to send the .keystore and .keycert files to your server... I've got no idea why you'd want to do this this way, or why you're talking about using raw sockets vs FTP (unless that's what you meant)
score: 0
type: Comment

http://stackoverflow.com/q/27050460
favorite count: 0
has comment: http://stackoverflow.com/comment/42618462
tagged with: android
tagged with: regex
upvote count: 0
has title: How can I compare out.writeObject("") with string?
has comment: http://stackoverflow.com/comment/42618449
type: AnsweredQuestion
has body: In my Android Login activity when user enters email and password the request goes to servlet and then servlet checks it in database. If email and password matches then it sends response back like below. out.writeObject("matches"); Here out is ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream()); Now from my Android login activity I want to open another activity if email and password matches.Here is code @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), result, Toast.LENGTH_LONG).show(); System.out.println(result); if(result.equals("matches")) { System.out.println("valid user"); Intent intent = new Intent(Login.this,Photos.class); startActivity(intent); } } But I can not enter in if condition.I print the value of String result that shows matches,and my toast message is also display matches when email and password match.But even though result.equals("matches") does not satisfied.And I am not getting any error also. I know I am making mistake somewhere but I don't know where. I also try if(result.toString().equals("matches")) But can't get output.
tagged with: java
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/42618471
has comment: http://stackoverflow.com/comment/42618414
downvote count: 2
score: -2
has answer: http://stackoverflow.com/a/27050507
accepted answer: http://stackoverflow.com/a/27050507
answer count: 1

http://stackoverflow.com/comment/42666204
comment on: http://stackoverflow.com/a/27077712
score: 0
type: AnswerComment
has text: Thanks all for the suggestions. the only problem now is that the rule wont apply when i construct and object of the class Clock. So i also need the rule to apply when i construct the following time 10:10:61
type: Comment

http://stackoverflow.com/q/27103988
has comment: http://stackoverflow.com/comment/42738425
has comment: http://stackoverflow.com/comment/42711655
tagged with: http://stackoverflow.com/tag/xml
has body: I'm trying to read the value of "release" tag of a remote XML file and return it's value .I'm able to find the value of "release" tag using getElementText() but not by getElementValue() Java Code.. try { URL url1 = new URL("http://hsv-artifactory.emrsn.org:8081/artifactory/libs-release-local/com/avocent/commonplatform/cps/symbols/gdd/GDDResources/maven-metadata.xml"); XMLStreamReader reader1 = XMLInputFactory.newInstance().createXMLStreamReader(url1.openStream()); String Latest = null; while (reader1.hasNext()) { if (reader1.next() == XMLStreamConstants.START_ELEMENT) { if (reader1.getLocalName().equals("release")) { Latest = reader1.getElementText(); break; } } } System.out.println("Latest version in Artifactory is :"+Latest); } catch (IOException ex) { // handle exception Logger.getLogger(SVNRepoConnector1.class.getName()).log(Level.SEVERE, null, ex); } catch (XMLStreamException ex) { // handle exception Logger.getLogger(SVNRepoConnector1.class.getName()).log(Level.SEVERE, null, ex); } finally { // close the stream } In the above code the value is being stored in a String variable but i want to store it in an integer variable so that i can perform operations like addition,subtraction on it afterwards..Please Help
type: UnansweredQuestion
tagged with: xmlreader
has answer: http://stackoverflow.com/a/27128892
tagged with: java
type: Question
tagged with: xmlstreamreader
answer count: 1
has comment: http://stackoverflow.com/comment/42738542
score: 0
has title: Get value of XML tag using java
has comment: http://stackoverflow.com/comment/42715746

http://stackoverflow.com/q/27021033
has answer: http://stackoverflow.com/a/27021782
tagged with: java
has body: I need to convert several String values to Integer,Boolean, etc., however since the input values may be null I can't use the Integer.valueOf() method for example. If the input is null I need the output object to be null as well, so I can't use apache commons NumberUtils.toInt(). Is there an existing implementation or a better solution than just writing a utility method for each type(Integer, Boolean etc.)? Edit: adding code sample String maxAgeStr = settings.get("maxAge"); //settings is a map, which may or //may not contain maxAge constraints.setMaxAge(Integer.valueOf(maxAgeStr)); // need null safety here String enableActionStr = settings.get("enableAction"); constraints.setEnableAction(Boolean.valueOf(enableActionStr)); // need null safety here
answer count: 3
downvote count: 1
upvote count: 12
possible better answer: http://stackoverflow.com/a/27021762
has answer: http://stackoverflow.com/a/27021762
accepted answer: http://stackoverflow.com/a/27021782
score: 11
has title: Null-safe valueOf method
has answer: http://stackoverflow.com/a/27021910
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42567053
has comment: http://stackoverflow.com/comment/42567149
favorite count: 0
type: Question

http://stackoverflow.com/a/27152680
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27152573
downvote count: 0
type: Answer
has body: Option 1: Set the size of the JFrame on which you are displaying the graph to the desired size. setSize(WIDTH, HEIGHT); where WIDTH and HEIGHT are in pixels. OR Option 2: Scale the drawing. That is, simply divide each dimension in the drawing by 2 to make it half the size.

http://stackoverflow.com/comment/52020691
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27111806
has text: Hi, I have got a similar case but in my case the @NotEmpty is also not working. can you please let me know if I need to configure other than this all above?
score: 0

http://stackoverflow.com/q/27073562
has body: My question is an extension on another question already answered, https://superuser.com/questions/257467/windows-7-how-to-pin-a-jar-to-the-taskbar Is there a way to pin a jar to the taskbar, and have the window generated by the jar register as a different process, thus creating a different icon in the task bar? because as it stands, using any of the methods listed in the answer to the above question, you end up with a shortcut that can be pinned. but it is just a shortcut and only that, not the program itself. Im willing to try anything at this point as it is beginning to be very bothersome. not only does it look unprofessional, it uses up unnecessary screen real estate. As I know someone is going to ask what else I've tried, here's a bit of code i tried to run in c# to launch the jar, but of course, it does the same thing, registering the new process as a new process. (should have thought that one through.) string strCmdText; strCmdText = "-jar ImgurDownloader.jar"; Process process = new Process(); process.StartInfo.Arguments = strCmdText; process.StartInfo.FileName = "javaw"; process.StartInfo.UseShellExecute = false; process.Start(); so then I tried this: string strCmdText; strCmdText = "-jar ImgurDownloader.jar"; Process process = Process.GetCurrentProcess(); process.StartInfo.Arguments = strCmdText; process.StartInfo.FileName = "javaw"; process.StartInfo.UseShellExecute = false; process.Start(); and yet still, even if i try and replace the current process, it comes across as a new process, and thus a second icon in the taskbar. Please excuse my possibly short tone, the frustration is starting to kick in after a couple weeks. Edit: have also tried setting the UAMID (User Application Model ID) using the JNA library to access shel32.dll's functions. The following is the code in the jar public static void setCurrentProcessExplicitAppUserModelID(final String appID) { if (SetCurrentProcessExplicitAppUserModelID(new WString(appID)).longValue() != 0) throw new RuntimeE…
score: 1
tagged with: java
upvote count: 1
has title: Pinning .jar files to the taskbar in windows 7
type: Question
tagged with: c#
tagged with: taskbar
downvote count: 0
favorite count: 0
tagged with: windows-7
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/a/27143981
answers question: http://stackoverflow.com/q/27143860
has body: In ASCII space has a char value of 32 (decimal) and char is actually an integer value. It gets added to your int value and gives that output. System.out.println(arr[i]); and System.out.println(arr[i]+" "); will solve the issue.
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/27098713
has comment: http://stackoverflow.com/comment/42702237
tagged with: input
has answer: http://stackoverflow.com/a/27098990
tagged with: java
has title: How do you use user input for characters in a calculation?
has body: How can you take in a sign (*, +, or -) and use that in a calculation in java? Example: int n = 10; int f = 10; //sign is the user input for the character to be used in the calculation. /* Insert something along the lines of int r = f sign n; if sign is equal to '-', then the result should be 0, if sign is '+', result should be 20. etc. */
type: Question
score: 0
has answer: http://stackoverflow.com/a/27098828
answer count: 2
tagged with: char
type: UnansweredQuestion

http://stackoverflow.com/comment/42587132
comment on: http://stackoverflow.com/a/27032668
has text: I think this is exactly what I needed. When I added the code setFocusable(true); I was then able to move my "monster", but after I click my start button the focus goes to the button. Can I set the focus on button click to a different panel?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/81633034
score: 4
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27138640
has text: This bug is not fixed, please have a look at: https://stackoverflow.com/questions/47339331/unclear-rules-define-the-type-for-t and look at the comments as well, thanks.

http://stackoverflow.com/a/27045577
upvote count: 1
has comment: http://stackoverflow.com/comment/42609732
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27045174
has comment: http://stackoverflow.com/comment/42610431
score: 1
has body: I have JScrollPanel which contains JPanel. Don't do custom painting. Just create a JLabel and add the label to the viewport of the scroll pane. Then when you want to change the image you use the setIcon(...) method of the JLabel and the label will automatically repaint itself and scrollbars will appear if necessary.
has comment: http://stackoverflow.com/comment/42610054
has comment: http://stackoverflow.com/comment/42609976
has comment: http://stackoverflow.com/comment/42610185

http://stackoverflow.com/q/27113029
tagged with: native
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27113343
has comment: http://stackoverflow.com/comment/42729352
accepted answer: http://stackoverflow.com/a/27113343
tagged with: android
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/42730454
has body: I have an SDK/NDK based app that creates native buffers and then reads/writes data to there to communicate through JNI bridge. in 4.4 (DALVIK) it functions OK - or at least it was not throwing an exception. Once ART became mandatory, i.e. Lollipop - it now fails on app close/exit. Creating the direct buffer here: JNIEXPORT void JNICALL Java_com_class_nativeOnDirect(JNIEnv* jenv, jobject obj, jobject m, jobject mv){ GLubyte* _dData; _dData = (GLubyte*)jenv-&gt;GetDirectBufferAddress(m); } Clearing the direct data: JNIEXPORT void JNICALL Java_com_class_nativeOnFreeNativeBuffer(JNIEnv* jenv, jobject obj, jobject m){ jenv-&gt;DeleteGlobalRef(m); } After some research into this - still not exactly clear to me as to why this happens. BTW - if the "DeleteGlobalref(jobjct) does not happen - the exception is not thrown. Afraid of a memory leak here. Thanks in advance
tagged with: android-ndk
type: Question
tagged with: android-runtime
tagged with: java
has title: Android 5.0 ART native DeleteGlobalReference(jobject) is failing

http://stackoverflow.com/comment/42832416
type: Comment
has text: @Raedwald technically, that's not exactly duplicate to this. but good to know
type: QuestionComment
comment on: http://stackoverflow.com/q/27147730
score: 0

http://stackoverflow.com/comment/42519861
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26993231
has text: You cannot use primitive types for Generics. See http://stackoverflow.com/questions/2721546/why-dont-java-generics-support-primitive-types

vb6
type: Tag
tag name: vb6
tags question: http://stackoverflow.com/q/27046374

http://stackoverflow.com/a/27121551
type: Answer
has comment: http://stackoverflow.com/comment/42771134
score: 0
has comment: http://stackoverflow.com/comment/42821174
has comment: http://stackoverflow.com/comment/42819892
has comment: http://stackoverflow.com/comment/42852325
has comment: http://stackoverflow.com/comment/42803070
has comment: http://stackoverflow.com/comment/42821738
has comment: http://stackoverflow.com/comment/42745650
has comment: http://stackoverflow.com/comment/42812199
answers question: http://stackoverflow.com/q/27119444
has body: The SPIs should be registered using the ServiceLoader mechanism, which the jars you downloaded don't seem to do. That is probably a bug in their packaging. I have never used jflac, but it looks like you should register: org.kc7bfi.jflac.sound.spi.FlacAudioFileReader as a javax.sound.sampled.spi.AudioFileReader and org.kc7bfi.jflac.sound.spi.FlacFormatConversionProvider as a javax.sound.sampled.spi.FormatConversionProvider. The source repository actually contains the necessary service files. Add these to your resources under META-INF/services.
has comment: http://stackoverflow.com/comment/42747291

http://stackoverflow.com/comment/42715509
type: Comment
type: QuestionComment
has text: `why cant i use upper case letter?`. I did not say as much. I only suggested you to find out if that was the problem. The posted logcat is useless. You should add a lot more Log statements to CopyAssets(). Certainly the first one at the beginning. And a Log before you call it and a Log after the call. And then post here the logcat for a call to CopyAssets(). Add e.PrintStackTrace to the catch block. Make it to return a boolean which you can inspect after calling it. return false in the catch block. You should just do some basic debugging in this way.
comment on: http://stackoverflow.com/q/27095597
score: 0

http://stackoverflow.com/q/27116499
linked to: http://stackoverflow.com/q/4356592
has answer: http://stackoverflow.com/a/27116688
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/27116688
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27116658
upvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/42735507
score: -2
has title: Add ArrayList to another ArrayList in java with Iterator
accepted answer: http://stackoverflow.com/a/27116658
tagged with: java
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/42735509
has body: I have a huge problem with my code: public class BookStore { private ArrayList&lt;Book&gt; books; } /** * This method takes the author's name as a String parameter and returns an * arraylist of all the books written by that author. It uses a while loop * and an iterator, locates the books written by that author (case-insensitive) * and adds them to another arraylist. */ public ArrayList&lt;Book&gt; getBooksByAuthor(String authorName){ ArrayList&lt;Book&gt; getBooksByAuthor = new ArrayList&lt;Book&gt;(); Iterator&lt;Book&gt; aBook = books.iterator(); while(aBook.hasNext()){ Book aBookd = aBook.next(); if (authorName.equalsIgnoreCase(aBookd.getAuthor())){ books.add(getAuthor()); books.addAll(getBooksByAuthor); } } return getBooksByAuthor.size(); } Those 3 lines books.add(getAuthor()); books.addAll(getBooksByAuthor); and the return getBooksByAuthor.size(); I'm pretty sure that they are completely wrong. I tried different ways to do it ,but it didn't work. I really don't understand how to do that. Could someone help me?. Thank you for your time!

http://stackoverflow.com/comment/42741433
score: 0
type: AnswerComment
type: Comment
has text: @drewmoore it takes time to write the full answer :)
comment on: http://stackoverflow.com/a/27120114

http://stackoverflow.com/comment/42783273
type: QuestionComment
has text: Not getting to some line of code does not 'clearly indicate a deadlock'. It could be many other things. You are misusing this term. Look it up. If you still think it's a deadlock please tell us which two or more lockable resources are involved.
type: Comment
comment on: http://stackoverflow.com/q/27142182
score: 0

http://stackoverflow.com/q/27117908
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27120009
tagged with: android-camera
tagged with: java
type: Question
has title: Android Poor Image Quality When Saving Image From takePicture callback
has body: I have looked at a bunch of other stack answers regarding poor Android camera images but they all seem to be from people who were grabbing the thumbnail and then scaling that up. My issue is that even the image being saved in the library is coming out very poor quality.Its coming out with dull colors and more pixelated. Here is my callback where I save the image to the library. Can you see any reason why I am losing image quality when I save it? Here is the callback @Override public void onPictureTaken(byte[] data, Camera camera) { File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE); FileOutputStream fos = new FileOutputStream(pictureFile); fos.write(data); fos.close(); MediaScannerConnection.scanFile(getBaseContext(), new String[]{pictureFile.getPath()}, new String[]{"image/png"}, null); Here is where I get the outputMediaFile private static File getOutputMediaFile(int type){ File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES), "PumpUp"); if (! mediaStorageDir.exists()){ if (! mediaStorageDir.mkdirs()){ Log.d("MyCameraApp", "failed to create directory"); return null; } } String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile; if (type == MEDIA_TYPE_IMAGE){ mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_"+ timeStamp + ".png"); Log.d(DEBUG_TAG,mediaStorageDir.getPath() + File.separator + "IMG_"+ timeStamp + ".png"); } else if(type == MEDIA_TYPE_VIDEO) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "VID_"+ timeStamp + ".mp4"); } else { return null; } return mediaFile; } UPDATE: The bitmap data is giving me a width and height of 320. Do you know why it got scaled down? UPDATE 2: This code will print out 320W 240H private Camera.PictureCallback mPicture = new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE); Bitmap imageBitmap…
answer count: 1
score: 4
favorite count: 0
duplicate of: http://stackoverflow.com/q/10605560
tagged with: android
upvote count: 4
linked to: http://stackoverflow.com/q/10605560

http://stackoverflow.com/q/27103689
has title: How to create string object in java
has body: String s="abc" in java.what happened in the memory any object is created or not and what is "s" here variable or object,and same question with String s=new String("abc");.
downvote count: 3
favorite count: 0
upvote count: 0
linked to: http://stackoverflow.com/q/3052442
type: UnansweredQuestion
score: -3
type: Question
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/27103788
has answer: http://stackoverflow.com/a/27103792
has comment: http://stackoverflow.com/comment/42711078

http://stackoverflow.com/a/27068041
accepted answer of: http://stackoverflow.com/q/27067650
has body: I guess you want to get max without giving the number of inputs as the first argument. read line as a string tokenize and covert the numbers to integer (convert to float if you allow floating point numbers) calc max public static void main(String[] args) { Scanner cin=new Scanner(System.in); String input=cin.nextLine(); String[] numbers = input.split("\\s"); int max = Integer.parseInt(numbers[0]); for(int i=1; i&lt;numbers.length; i++){ int num=Integer.parseInt(numbers[i]); if(num&gt;max) max=num; } System.out.println(max); }
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27067650
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27114260
has comment: http://stackoverflow.com/comment/42735553
upvote count: 1
has body: Your Account class requires 4 Strings as constructor arguments, so for example new Account("foo", "bar", "baz", "1337"). The first thing you should do is determine, what to pass as arguments and give these to the BankUI class as constructor arguments as well. The second thing what I recognized is your initialization of your account in the constructor of your BankUI. Instead of writing Account account = new Account(); I bet you want to init your field, which would be account = new Account("your", "four", "strings", "here");, like the line above.
type: Answer
has comment: http://stackoverflow.com/comment/42731402
answers question: http://stackoverflow.com/q/27114159
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42736790

http://stackoverflow.com/q/27117216
accepted answer: http://stackoverflow.com/a/27117256
favorite count: 0
has title: How can I make a variable work in more that one class? (Java)
has comment: http://stackoverflow.com/comment/42736959
score: -1
downvote count: 1
has answer: http://stackoverflow.com/a/27117256
type: AnsweredQuestion
tagged with: java
has body: I am working on a java code to calculate the cost of a pizza but my variables do not work in other classes. I'm getting an error called "cannot find symbols". This is my code so far. class PizzaCost { public static void main (String []args){ } } class pizza { int smallPizza = 4; int mediumPizza = 6; int largePizza = 12; } class rules { double laborCost = 0.75; double rentCost = 1.00; double materialsCost = 0.05; //per diameter } class costCalculator { double smallPizzaCost = (smallPizza*materialsCost) + rentCost + laborCost; double mediumPizzaCost = (mediumPizza*materialsCost) + rentCost + laborCost; double largePizzaCost = (largePizza*materialsCost) + rentCost + laborCost; }
has comment: http://stackoverflow.com/comment/42736789
type: Question
has comment: http://stackoverflow.com/comment/42736845
upvote count: 0
answer count: 1
tagged with: variables

debug-information
tag name: debug-information
type: Tag
tags question: http://stackoverflow.com/q/26994468

http://stackoverflow.com/comment/42765590
has text: this is answer has been flagged as low quality answer. please add some explanation to your answer.
comment on: http://stackoverflow.com/a/27133492
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42700327
comment on: http://stackoverflow.com/q/27097473
type: QuestionComment
type: Comment
has text: `args` is populated with information from the command line. So, if you're just running your program with `java MyClass` instead of `java MyClass arg1 arg2 arg3 arg4`, then `args` will never have any elements in it.
score: 0

http://stackoverflow.com/comment/42515789
has text: it can be string type
comment on: http://stackoverflow.com/q/26992252
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27037972
has comment: http://stackoverflow.com/comment/42596660
upvote count: 1
has comment: http://stackoverflow.com/comment/42596066
type: Question
has comment: http://stackoverflow.com/comment/42595714
tagged with: taglib
has comment: http://stackoverflow.com/comment/42595847
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/42595938
has body: An example will make this clearer! The jsp file... &lt;%@ taglib prefix ="jam" uri= "http://jam.tld" %&gt; &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%&gt; &lt;% String targetPage = true ? "toast" : "bread"; %&gt; &lt;jam:text onmousedown="movePage('&lt;%=targetPage%&gt;');" id="&lt;%=targetPage%&gt;"&gt;&lt;%=targetPage%&gt;&lt;/jam:text&gt; Note - the taglib is not mine and I have no control over it. (it isn't really called jam either :). This then creates this HTML... &lt;td onmousedown="movePage('&lt;%=targetpage%&gt;;');" id="toast"&gt;toast&lt;/td&gt; Which as you can see: the &lt;%=targetPage%> was only replaced/parsed in the non-javascript bit? The compiled jsp file looks like this: jspx_th_jam_005ftext_005f2.setOnmousedown("movepage('&lt;%=targetpage%&gt;')"); Anyone know what is going on, or how to fix it? Why is the &lt;%=%&gt; tag being ignored when it is part of JavaScript statement? :)
has answer: http://stackoverflow.com/a/27038285
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42595939
favorite count: 0
has comment: http://stackoverflow.com/comment/42596111
type: UnansweredQuestion
has title: jsp command <%=%> being ignored when it is used in a Javascript statement, inside a taglib tag statement?
score: 1
tagged with: java

http://stackoverflow.com/comment/42626703
type: QuestionComment
has text: You can set timeouts etc. via [ClientConfiguration](http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ClientConfiguration.html) and use it in appropriate constructor for AmazonS3Client. Also, I doubt that S3 would be so lousy to be unresponsive when the expiry job is running (considering their SLA) - there could be something going on with your network as well.
score: 1
comment on: http://stackoverflow.com/q/27052190
type: Comment

http://stackoverflow.com/comment/42793116
type: Comment
comment on: http://stackoverflow.com/a/27149175
score: 0
type: AnswerComment
has text: No need to ` Solution: ` as an answer should contain a possible solution which would make it redundant. A good programmer prevents redundancy!

http://stackoverflow.com/comment/42680918
score: 0
comment on: http://stackoverflow.com/a/27043768
type: AnswerComment
type: Comment
has text: I got the same problem. I found that if validation error happened, the `@Controller` method did not execute at all

http://stackoverflow.com/comment/42578993
type: Comment
score: 0
type: QuestionComment
has text: @Ryan - you could post that as an answer and do a self-accept. That way, people will know that the question is "solved" without having to trawl through the comments.
comment on: http://stackoverflow.com/q/27026430

http://stackoverflow.com/q/27119821
has answer: http://stackoverflow.com/a/27121330
tagged with: algorithm
type: UnansweredQuestion
tagged with: codenameone
has title: Mobile rijndael algorithm implementation
score: -1
favorite count: 0
has body: I have a mobile application generated by codename one, so it is going to work on all mobiles. Its a Client-Server application. I have to store credit card info and some other private info. I think for Encryption Rijndael would be the best. i have used MD5 before but now a days i think it is old I don't know how to do that any help..?? How can i Encrypt the information on mobile app it self and then send that to server ..?? Or is there any other Encryption method better than Rijndael ..??
type: Question
downvote count: 2
tagged with: encryption
tagged with: rijndael
upvote count: 1
has answer: http://stackoverflow.com/a/27120191
has answer: http://stackoverflow.com/a/27120285
tagged with: java
answer count: 3

http://stackoverflow.com/comment/42662896
comment on: http://stackoverflow.com/q/27071280
type: Comment
type: QuestionComment
has text: It is just experiment for understanding of class loading.
score: 0

http://stackoverflow.com/a/27124803
type: Answer
score: 0
has body: Here is your logic. import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; public class Test { public static void main(String[] args) throws Exception{ FileInputStream fis = new FileInputStream(new File("your.txt")); // path for the text file BufferedReader br = new BufferedReader(new InputStreamReader(fis)); String line = null; while ((line = br.readLine()) != null) { String st[] = line.split(" "); for(int i=0; i&lt;st.length; i++){ if(st[i].length()&gt;10) System.out.println(st[i]); } } } }
answers question: http://stackoverflow.com/q/27124519

http://stackoverflow.com/comment/42553423
comment on: http://stackoverflow.com/q/27002256
score: 0
type: QuestionComment
type: Comment
has text: Let's just say that `SELECT * FROM SCOUT_OPPORTUNITY;` in the cli is giving me a empty resultset too.

http://stackoverflow.com/comment/42693825
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27093846
has text: @EssaidiM: although understand that there are variants of MVC where the model notifies the view, and this is legit if it is followed, but yours isn't doing this.
score: 0

http://stackoverflow.com/comment/42535101
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27002496
has text: I have another example I can show that does the same thing even when I return.I have added it.
type: Comment

http://stackoverflow.com/q/27105146
has comment: http://stackoverflow.com/comment/42713699
score: 0
has answer: http://stackoverflow.com/a/27106091
has comment: http://stackoverflow.com/comment/42713639
has comment: http://stackoverflow.com/comment/42713830
has comment: http://stackoverflow.com/comment/42716770
accepted answer: http://stackoverflow.com/a/27106091
type: AnsweredQuestion
tagged with: java
has body: Below code is written in Mapper of Hadoop: String[] s = value.toString().split("\\s+"); String date = s[1]; Error occurs in s[1], ArrayIndexOutofBoundsException. Does regex not work in the hadoop?
type: Question
tagged with: hadoop
has title: using string split failed in hadoop mapper
has comment: http://stackoverflow.com/comment/42713801
has comment: http://stackoverflow.com/comment/42713692
answer count: 1

http://stackoverflow.com/q/27083467
type: Question
score: -2
tagged with: java
upvote count: 0
answer count: 1
favorite count: 0
has body: I have this interface for a stack I need to use: public interface StackInterface &lt;E&gt; { public void push (E item); public E pop(); public E peek(); public String toString(); } And I need to create a linked-based stack class that implements this interface. This is for a postfix to infix calculator, so I'm supposed to store type 'char' in this stack. How do I create such a stack?
has comment: http://stackoverflow.com/comment/42676114
type: UnansweredQuestion
tagged with: interface
has answer: http://stackoverflow.com/a/27083587
has title: How to implement an interface for stack
tagged with: stack
has comment: http://stackoverflow.com/comment/42676349
downvote count: 2

http://stackoverflow.com/a/27070655
upvote count: 2
has body: The return type of getBalance() method is missing whereas you're returning a variable of type double. Declare it as :- public double getBalance(){ // add double as the return-type here return Balance; } Also,as mentioned by Drew Kennedy---declare object of BankAccount class by adding BankAccount class along with a1. You haven't mentioned it anywhere... BankAccount a1 = new BankAccount(); // you're missing class name BankAccount
answers question: http://stackoverflow.com/q/27070622
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/a/27058871
has body: You could create a file on your server that generates a registration id whenever a device registers (But the device should not use GCM) and return it back afterwards. But to do this you also need to create your own "GCM like" library that would work for your server. Well, it may take a while but i think this is possible.
type: Answer
answers question: http://stackoverflow.com/q/27057031
score: 0
has comment: http://stackoverflow.com/comment/42633506

http://stackoverflow.com/comment/42584702
has text: please help me solve this program
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27009350

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/27077792

http://stackoverflow.com/q/27089126
has title: NoSuchMethodError Sets.newConcurrentHashSet() while running jar using hadoop
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42687234
has comment: http://stackoverflow.com/comment/51241076
has comment: http://stackoverflow.com/comment/46459573
has body: I'm using cassandra-all 2.0.7 api with hadoop 2.2.0. 4.0.0 zazzercode doctorhere-engine-writer 1.0 jar DoctorhereEngineWriter <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <cassandra.version>2.0.7</cassandra.version> <hector.version>1.0-2</hector.version> <guava.version>15.0</guava.version> <hadoop.version>2.2.0</hadoop.version> org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 maven-assembly-plugin zazzercode.DiseaseCountJob jar-with-dependencies junit junit 3.8.1 test me.prettyprint hector-core ${hector.version} org.apache.thrift libthrift org.apache.cassandra cassandra-all ${cassandra.version} libthrift org.apache.thrift org.apache.cassandra cassandra-thrift ${cassandra.version} libthrift org.apache.thrift org.apache.hadoop hadoop-client ${hadoop.version} org.apache.thrift libthrift 0.7.0 com.google.guava guava ${guava.version} com.googlecode.concurrentlinkedhashmap concurrentlinkedhashmap-lru 1.3 When I start the jar (created after mvn assembly:assembly from normal user prayagupd) as below from hduser, hduser@prayagupd$ hadoop jar target/doctorhere-engine-writer-1.0-jar-with-dependencies.jar /user/hduser/shakespeare I get following guava collection error on cassandra api, 14/11/23 17:51:04 WARN mapred.LocalJobRunner: job_local800673408_0001 java.lang.NoSuchMethodError: com.google.common.collect.Sets.newConcurrentHashSet()Ljava/util/Set; at org.apache.cassandra.config.Config.<init>(Config.java:53) at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:105) at org.apache.cassandra.hadoop.BulkRecordWriter.<init>(BulkRecordWriter.java:105) at org.apache.cassandra.hadoop.BulkRecordWriter.<init>(BulkRecordWriter.java:90) at org.apache.cassandra.hadoop.BulkOutputFormat.getRecordWriter(BulkOutputFormat.java:69) at org.apache.cassandra.hadoop.BulkOutputFormat.getRecordWriter(BulkOutputFormat.java:29) at org.apache.hadoop.mapred.ReduceTask$NewTrackingRecordWriter.<init>(ReduceTask.java:558) at org.apache.hadoop.m…
tagged with: java
has answer: http://stackoverflow.com/a/28993419
has comment: http://stackoverflow.com/comment/42686800
type: Question
tagged with: hadoop
score: 5
linked to: http://stackoverflow.com/q/31603890
has comment: http://stackoverflow.com/comment/44600432
upvote count: 5
downvote count: 0
linked to: http://stackoverflow.com/q/12664243
tagged with: cassandra
answer count: 1
tagged with: jar
favorite count: 0

variables
tag name: variables
tags question: http://stackoverflow.com/q/27086633
tags question: http://stackoverflow.com/q/27141033
tags question: http://stackoverflow.com/q/27150604
tags question: http://stackoverflow.com/q/27065597
tags question: http://stackoverflow.com/q/27042715
tags question: http://stackoverflow.com/q/27132539
tags question: http://stackoverflow.com/q/27118211
type: Tag
tags question: http://stackoverflow.com/q/27117216
tags question: http://stackoverflow.com/q/27139567
tags question: http://stackoverflow.com/q/27025141
tags question: http://stackoverflow.com/q/27077795
tags question: http://stackoverflow.com/q/27040751

http://stackoverflow.com/comment/43110263
comment on: http://stackoverflow.com/a/27324503
type: AnswerComment
has text: I wanted it to be abstract so the developer would be forced to pick either a Student or Tutor implementation, which would have their own unique fields as well.
score: 0
type: Comment

http://stackoverflow.com/q/27031805
tagged with: netbeans
has body: public LogInDatabase() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { picture = new javax.swing.JLabel(); userNameTextField = new javax.swing.JTextField(); labelUserName = new javax.swing.JLabel(); labelPassword = new javax.swing.JLabel(); passwordTextView = new javax.swing.JTextField(); submitButton = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); Names = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); picture.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Learn/Image/newpackage/colors.jpg"))); // NOI18N labelUserName.setFont(new java.awt.Font("Georgia", 0, 18)); // NOI18N labelUserName.setText("User Name"); labelUserName.setBorder(javax.swing.BorderFactory.createEtchedBorder()); labelPassword.setFont(new java.awt.Font("Georgia", 0, 18)); // NOI18N labelPassword.setText("Password"); labelPassword.setBorder(javax.swing.BorderFactory.createEtchedBorder()); submitButton.setBackground(new java.awt.Color(255, 51, 51)); submitButton.setLabel("Submit"); submitButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { submitButtonActionPerformed(evt); } }); jButton1.setText("Print"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); Names.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N Names.setText("Team 1 Database - Dean Bailey, Josh Dixie, Ben Boudra, Trevor, Abel Amadou, Jalen"); Names.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jLabel2.setText("Status"); javax.swing…
upvote count: 3
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42585759
has answer: http://stackoverflow.com/a/27032051
has title: How do I return to the class after I've called my run method in my new GUI?
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42585764

http://stackoverflow.com/a/27156972
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27102878
type: Answer
score: 1
has body: One option would be to inject the user ID (not the HttpSession) into your service component using a SpEL expression. To achieve proper run-time behavior, you must make sure your service component is an AOP-scoped proxy. Take a look at the "Testing request and session scoped beans" section of the Spring reference manual for further information. Regards, Sam (spring-test component lead)

http://stackoverflow.com/comment/42760083
has text: Added but still get exception and now exception with pbook-unit.(entitymanager) No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27129442
type: Comment

http://stackoverflow.com/q/27151211
type: Question
tagged with: apache-camel
score: 0
has answer: http://stackoverflow.com/a/27151466
has body: I am using Apache camel to upload files to Amazon s3. Does camel provides any provision to upload folders. Actually I have an requirement which as follows, The polling should happen on daily basis to specific folder. Consider the folder structure /photos/user and inside that there are some sub folders like day1,day2., from (file:\photos\user) to (aws-s3:bucket-name?access Key=&lt;&gt;&amp;secret Key=&lt;&gt;) So the above code should pull the records from day1 folder and next day folders consequently as day progresses.
answer count: 1
has title: Upload subfolders to amazon s3 using apache camel
accepted answer: http://stackoverflow.com/a/27151466
type: AnsweredQuestion
tagged with: amazon-s3
tagged with: java

http://stackoverflow.com/a/27042530
type: Answer
has body: The main performance kill will be the add operation since it will have to grow the data structure over time. Since you know details.size() you should initialize the other arraylists with details.size()/4. You should also check that details.size() % 4 == 0 before the for loop. If not it means your data is somehow wrong and you will run for sure into an IndexOutOfBounds. Just for correctness you should write i &lt; details.size()+3 as your condition, since you will access element i+3 in the for body. You should always check for i &lt; details.size()+x do it like this if you ever access i+x in the body. (for the largest x there will be in the body)
answers question: http://stackoverflow.com/q/27042301
score: 0

http://stackoverflow.com/comment/42568184
type: QuestionComment
comment on: http://stackoverflow.com/q/27021629
has text: Those Log messages are from the garbage collector, they are unrelated to your `AsyncTask`. Try filtering your Log messages by your tag and see what comes up.
score: 0
type: Comment

http://stackoverflow.com/q/27100556
downvote count: 0
has body: I want to add a little icon to the title of a TitledPane. Therefore I set an empty title and add a HBox containing a Label and a ImageView as graphic. In this way the icon is shown close to the end of the text. I want it to be shown always next to the right border of the TitledPane. How can I do this? I also tried to use a BorderPane and add the Label to the center and the ImageView to the right, but the BorderPane doesn't get the maximum size of the TitledPane. So I tried to set MaxWidth to Max-Value, but this didn't help Does anybody know what to do? **EDIT: ** The "custom" control I created will be initialized within a method called in stage.setOnShown. public class CustomTitledPane extends TitledPane { private Image alert; private Image registered; private Image deleted; private ImageView img; public CustomTitledPane(String titleText, Node node) { super(titleText, node); setAnimated(true); setCollapsible(true); img = new ImageView(); img.setFitHeight(10d); img.setPreserveRatio(true); img.setSmooth(true); setGraphic(img); setContentDisplay(ContentDisplay.RIGHT); // apply css and force layout of nodes applyCss(); layout(); // title region Node titleRegion = lookup(".title"); // padding Insets padding = ((StackPane) titleRegion).getPadding(); // image width double graphicWidth = img.getLayoutBounds().getWidth(); // arrow double arrowWidth = titleRegion.lookup(".arrow-button") .getLayoutBounds().getWidth(); // text double labelWidth = titleRegion.lookup(".text").getLayoutBounds() .getWidth(); double nodesWidth = graphicWidth + padding.getLeft() + padding.getRight() + arrowWidth + labelWidth; System.out.println("w: " + graphicWidth + " " + arrowWidth + " " + labelWidth); graphicTextGapProperty().bind(widthProperty().subtract(nodesWidth)); try { alert = new Image(new FileInputStream("img/Alert.png")); registered = new Image(new FileInputStream("img/Registered.png")); deleted = new Image(new FileInputStream("img/Deleted.png")); } catch (FileNotFoundException e) { e.pri…
favorite count: 0
has answer: http://stackoverflow.com/a/27105817
type: AnsweredQuestion
tagged with: java
has title: JavaFX 8 - Add a graphic to a TitledPane on the right side
type: Question
accepted answer: http://stackoverflow.com/a/27105817
tagged with: layout
has answer: http://stackoverflow.com/a/27102229
score: 4
upvote count: 4
answer count: 2
tagged with: javafx-8
possible better answer: http://stackoverflow.com/a/27102229

http://stackoverflow.com/comment/42536919
comment on: http://stackoverflow.com/q/27003551
has text: We need to know more about what the web server is expecting. From your code, it seems to be expecting the image data as an encoded string in a query parameter. This is possibly true, but very, very, odd. So point us at the definition of how that web server wants images
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/36732432
type: Answer
has body: Try using KeyEvent instead of ActionEvent @FXML private void newButtonClick(KeyEvent event) { ...}
score: 10
upvote count: 10
downvote count: 0
answers question: http://stackoverflow.com/q/27079062

http://stackoverflow.com/comment/42747507
comment on: http://stackoverflow.com/a/27123479
type: AnswerComment
score: 0
has text: @DroidIcs - Yep.. That's right. So the next time you do `String someVar="Test"`, the value from the Strings constants pool will be returned.
type: Comment

http://stackoverflow.com/comment/42660434
comment on: http://stackoverflow.com/a/27073016
type: AnswerComment
score: 0
type: Comment
has text: oh I didn't know that since I didn't learn exceptions yet and I am only using notepad and console to program. And as for the alternative answer, I don't quite understand yet but I think I will keep your suggestion in mind when learning exceptions. Thank you.

http://stackoverflow.com/comment/42680289
has text: Maybe something like [this example](http://stackoverflow.com/questions/19399904/set-hilighting-color-in-jtextfield/19401765#19401765)
score: 0
comment on: http://stackoverflow.com/q/27084299
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42672718
score: 0
has text: 11-22 21:35:22.936: E/AndroidRuntime(3188): at java.lang.reflect.Method.invoke(Method.java:511) 11-22 21:35:22.936: E/AndroidRuntime(3188): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 11-22 21:35:22.936: E/AndroidRuntime(3188): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 11-22 21:35:22.936: E/AndroidRuntime(3188): at dalvik.system.NativeStart.main(Native Method) 11-22 21:35:22.936: E/AndroidRuntime(3188): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.gms.ads.AdView
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27081413

http://stackoverflow.com/comment/42704041
type: Comment
type: QuestionComment
has text: Is the OS memory load "near 100%" or is it actually swapping? (monitor page file read/write deltas)
score: 0
comment on: http://stackoverflow.com/q/27003451

http://stackoverflow.com/q/27060828
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27060944
tagged with: http://stackoverflow.com/tag/csv
has title: Read csv with opencsv
tagged with: opencsv
favorite count: 0
has answer: http://stackoverflow.com/a/27060963
type: UnansweredQuestion
downvote count: 2
has body: List&lt;First&gt; listfirst(String dir){ try { List&lt;First&gt; list=new ArrayList&lt;First&gt;(); CSVReader reader = new CSVReader(new FileReader(dir)); String [] nextLine; while ((nextLine = reader.readNext()) != null) { // nextLine[] is an array of values from the line list.add(new First(nextLine[0], nextLine[1], nextLine[2],nextLine[3], nextLine[4],nextLine[5], nextLine[6], nextLine[7])); } return list; } catch (Exception e) { e.printStackTrace(); return null; } } There are 1994 rows. But this code print only 388 rows.What can i do?
tagged with: java
score: -1
upvote count: 1

http://stackoverflow.com/a/27082630
has body: You don't need the parent AsyncTask, you're already using findInBackground. What causes the issue here is that you're running the findInBackground in the background, so it's parent AsyncTask will not wait until the done method is called. Instead, it's returning the empty ArrayList. After that the done method is called so it doesn't make any difference to the list.
answers question: http://stackoverflow.com/q/27082553
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/27082553
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42837148
has text: Lets give a try with driver.findElement(By.xpath("//class[contains(text(),'Terminated Report: Pending')]"));
comment on: http://stackoverflow.com/q/27147857
score: 0
type: Comment
type: QuestionComment

spring-ioc
tag name: spring-ioc
type: Tag
tags question: http://stackoverflow.com/q/27068178

http://stackoverflow.com/comment/42674610
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27081635
score: 0
has text: Yap I'm sure because all another work and i created a list(LinkedList) and got data from it and it worked after reload, but my stack doesn't. I did debug and its show that Stack is full but after reload page just empty Stack. U can see it in the screens in the head @RomanC

http://stackoverflow.com/q/27103231
has comment: http://stackoverflow.com/comment/42710352
score: -1
has body: I have an outline for an algorithm - some logical steps that has to be performed in a specific order. The result of the algorithm has to be some number. Naturally this led me to the idea of using the template method pattern. This works fine for void methods but here comes my problem: each of the steps in the algorithm is not a void method but is allowed to return a number (so they are int methods) - if a step returns a non-zero number, this number is the result of the algorithm's execution, if it is a zero - the execution continues with the next step. This might sound really trivial but I just still find it somehow ugly to have something like: public int algorithm() { int resultStep1 = step1(); if (resultStep1!=0) { return resultStep1; } int resultStep2 = step2(); if (resultStep2!=0) { return resultStep2; } ... } Of course step1(), step2() and so on are abstract methods and have their own specific implementations in the corresponding classes that extend mine. The other idea that came to my mind was using exceptions but as we are talking about control flow here this would be an anti-pattern. Am I missing something here or is this just the way I have to write it?
type: Question
answer count: 2
downvote count: 1
tagged with: template-method-pattern
favorite count: 0
has answer: http://stackoverflow.com/a/27103372
has title: Template method with return value
upvote count: 0
has comment: http://stackoverflow.com/comment/42710294
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42710327
has comment: http://stackoverflow.com/comment/42710228
tagged with: algorithm
has answer: http://stackoverflow.com/a/27103660
tagged with: java

http://stackoverflow.com/comment/42596203
has text: I have; // Method that asks user for size of array. public static Student[] createArray() { Scanner userInputEntry = new Scanner(System.in); int inputLength = System.out.println("Enter size of array:"); Student students[] = new Student[inputLength]; return students; } but it won't work
comment on: http://stackoverflow.com/a/27028118
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26993138
score: 0
has title: I have different result if pass same argument why?
has body: I am developing some GUI apps in java. I wonder why JFrame.setBackground(Color) and Graphics.setColor(Color) return differ result on screen although I pass the same Color variable? I create JPanel. It set as JRootPane with setBackground(new Color(0xB7CBEF)). JPanel has a button which draw with overload paintComponent. Inside methode I call Graphics.setColor(0xB7CBEF))..Graphics.fillRect(0,0,button_width, button_heigth). On screen background of button look at little be dark. Thanks all. Problem was in realize external UI, which some dark background of button in passive condition. Fix this problem with transform button to transparent type.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42517189
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42517216
tagged with: swing
has comment: http://stackoverflow.com/comment/42517203
type: Question
has comment: http://stackoverflow.com/comment/42517572
has comment: http://stackoverflow.com/comment/42523037

http://stackoverflow.com/q/27125411
tagged with: intellij-idea
tagged with: ant
linked to: http://stackoverflow.com/q/9592057
has body: I saw this SOF post I'm experiencing the same problem. I'm using intelliJ as IDEA without Ant manifest to create the jar. How can I achieve the same using intelliJ ? <name name="**/*.RSA"/> <name name="**/*.SF"/> <name name="**/*.DSA"/> <fileset dir="lib" includes="**/*.jar"/>
downvote count: 0
tagged with: jar
favorite count: 0
type: UnansweredQuestion
upvote count: 6
has title: how to exclude `RSA, SF, DSA` while extracting jar in intelliJ?
answer count: 0
tagged with: java
score: 6
type: Question
tagged with: junit4

http://stackoverflow.com/comment/42703129
type: AnswerComment
comment on: http://stackoverflow.com/a/27099125
score: 0
has text: yes its a third-party lib, you would have to download joda-datetime jar and place on classpath, added a java util solution only as well, just in case you don't won't to use third-party libs
type: Comment

http://stackoverflow.com/q/27046372
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/42611804
has answer: http://stackoverflow.com/a/27046884
accepted answer: http://stackoverflow.com/a/27046884
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jcomponent
upvote count: 1
tagged with: swing
type: Question
has title: JFrame instance doesn't visualise added component
linked to: http://stackoverflow.com/q/22577924
has body: I created SelectMethodFrame that extends JFrame that can have only one instance: public class SelectMethodFrame extends JFrame { private JSplitPane mainWindow = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); public JSplitPane getMainWindow() { return mainWindow; } public void setMainWindow(JSplitPane mainWindow) { this.mainWindow = mainWindow; } private static SelectMethodFrame instance = null; public static SelectMethodFrame getInstance() { if (instance == null) instance = new SelectMethodFrame(); return instance; } public void setTab(JComponent panelConsumption, JComponent panelCpu, JComponent panelMemo, JComponent panelScreen, JComponent panelMobile, JComponent panelWifi) { TabbedView tab = new TabbedView(panelConsumption, panelCpu, panelMemo, panelScreen, panelMobile, panelWifi); mainWindow.setRightComponent(tab); } public void setTree(JTree tree) { mainWindow.setLeftComponent(new JScrollPane(tree)); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); getContentPane().add(mainWindow, java.awt.BorderLayout.CENTER); setExtendedState(MAXIMIZED_BOTH); setMinimumSize(new Dimension(800, 500)); this.setTitle(Constants.APP_CHECKBOXTREE); } } I create frame in one class in this way: SelectMethodFrame frame = new SelectMethodFrame(); frame.setTree(treeSelection); And everything works fine but when I want to add another component to my frame in another class: SelectMethodFrame.getInstance().setTab(panelConsumption, panelCpu, panelMemo, panelScreen, panelMobile, panelWifi); it doesn't show it. I tried with SelectMethodFrame.getInstance().repaint(); SelectMethodFrame.getInstance().revalidate(); but it doesn't work. It shows component only if created in the constructor. Where is the problem? I changed the code and put: public SelectMethodFrame() { this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); getContentPane().add(mainWindow, java.awt.BorderLayout.CENTER); setExtendedState(MAXIMIZED_BOTH); setMinimumSize(new Dimension(800, 500)); this.se…
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/42669932
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27079644
has text: @Douglas c++ arrays are not jagged ! please explain more

http://stackoverflow.com/comment/42872125
type: AnswerComment
comment on: http://stackoverflow.com/a/27112764
type: Comment
has text: Sorry I don't understand your comment. This sentence is too long. This loop works 4 times, if you put an incorrect password. If your password is correct the loop immediately stops. Have you tested it?
score: 0

http://stackoverflow.com/comment/42731076
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27113700
has text: @andybfmv96 - You're welcome. And welcome to stackoverflow. Don't hestitate to ask additional questions. Be sure to take the tour at http://stackoverflow.com/tour.
score: 0

http://stackoverflow.com/q/27038812
type: AnsweredQuestion
has body: I have a simple application of displaying rest+spring.but getting 404 error: on run it should give jeresey+spring as output web xml file Restful Web Application contextConfigLocation classpath:applicationContext.xml org.springframework.web.context.ContextLoaderListener jersey-serlvet com.sun.jersey.spi.spring.container.servlet.SpringServlet com.sun.jersey.config.property.packages com.mtv.rest 1 jersey-serlvet /rest/* application context file is <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.mtv.rest" /> <bean id="transactionBo" class="com.mtv.rest.TransactionBoImpl" /> </beans> payment class package com.mtv.rest; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.mtv.rest.TransactionBo; @Component @Path("/payment") public class PaymentService { @Autowired TransactionBo transactionBo; @GET @Path("/mtv") public Response savePayment() { String result = transactionBo.save(); return Response.status(200).entity(result).build(); } } interface is package com.mtv.rest; public class TransactionBoImpl implements TransactionBo { public String save() { return "Jersey + Spring example"; } } also sometimes tomcat port gets error.
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42597279
type: Question
has answer: http://stackoverflow.com/a/27053882
has comment: http://stackoverflow.com/comment/42597944
has title: 404 error in Spring-Rest Application
has comment: http://stackoverflow.com/comment/42597401
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27053882
tagged with: rest
has comment: http://stackoverflow.com/comment/42598016
possible better answer: http://stackoverflow.com/a/27038951
tagged with: spring
has comment: http://stackoverflow.com/comment/42597650
has answer: http://stackoverflow.com/a/27038951

http://stackoverflow.com/comment/42703390
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27099297
has text: @Junikin I'm a little unclear on what your actual problem is, but I suspect you may want to read [the official tutorial on passing information to a method](https://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html). It is concise and well-written and should give you some ideas.
score: 0

http://stackoverflow.com/q/27145854
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27145956
tagged with: loops
tagged with: methods
type: Question
has title: Trying to pass 2 arrays to a method and print out a table using values in the 2 arrays
answer count: 2
tagged with: arrays
tagged with: numberformatter
has answer: http://stackoverflow.com/a/27145880
has body: I'm trying to create 2 arrays in my main method with hard-coded values, then pass them down into my generateReport method and print out a table. The question I'm working with is With my code below I'm getting errors in my main and the section of code that is commented is supposed to display the currency which is default on the computer you're working on. public class sheet13t5 { public static void main(String[] args) { int[] units = new int[] {10, 1, 6, 2, 7}; double[] prices = new double[] {25.99, 30.49, 12.00, 15.55, 9.55}; generateReport(units[], prices[]); } public static void generateReport(int units[], double prices[]) { System.out.println("Event #\tTicket Price\tTickets Sold\tTotal Sales Value\tHistogram (+ for each ticket sold)"); NumberFormatter format = NumberFormat.getCurrencyInstance(); for (int i = 0; i &lt; units.length; i++) { System.out.print(i++ + "\t"); System.out.printf("%7d\t", ++i); System.out.print(prices[i] + "\t" + units[i]); //System.out.printf(format. System.out.print(prices[i] * units[i]); for (int j = 0; j &lt; units.length; j++) System.out.print("+"); System.out.println(); } } }
accepted answer: http://stackoverflow.com/a/27145880
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27145956

http://stackoverflow.com/q/27086773
has title: Preventing object class creation
score: 0
has body: I've been reading the article about constructors and what have been written there is: A public class can likewise prevent the creation of instances outside its package by declaring at least one constructor, to prevent creation of a default constructor with public access, and by declaring no constructor that is public. I'm confused by declaring no constructor that is public. This is because if we don't declare any constructor at all the implicitly-declared default constructor will be implicitly declared with an access modifier of the class. Which means if the class declared as public, the default constructor will be public too. That's we can use it outside the package (create instances outside the package).
has answer: http://stackoverflow.com/a/27086795
has comment: http://stackoverflow.com/comment/42681853
has answer: http://stackoverflow.com/a/27086790
tagged with: constructor
possible better answer: http://stackoverflow.com/a/27086795
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27086790
type: Question
answer count: 2

http://stackoverflow.com/comment/42724223
type: AnswerComment
score: 0
type: Comment
has text: I tried creating a "ResultSet" by executing a select query and then passing that to the procedure using setCursor. I am getting the Unsupported feature sql exception too . Even though I am using the latest oracle Jdbc jar
comment on: http://stackoverflow.com/a/27083378

http://stackoverflow.com/q/27027220
score: 0
has comment: http://stackoverflow.com/comment/42578390
has comment: http://stackoverflow.com/comment/42578043
has title: JFrame/JPanel's not showing with Group Layout
answer count: 1
has comment: http://stackoverflow.com/comment/42595688
has comment: http://stackoverflow.com/comment/42578058
accepted answer: http://stackoverflow.com/a/27027855
has comment: http://stackoverflow.com/comment/42577949
tagged with: jframe
has comment: http://stackoverflow.com/comment/42578011
has answer: http://stackoverflow.com/a/27027855
type: AnsweredQuestion
has body: I have a pretty big setup here and its still very much a WIP. Right now I want to get my GUI displaying properly, and switching between panels at the click of a button. In my GUI() method, I set up my various panels with group layout. At the end of the class, you will notice methods i want to use to set the various panels visible or invisible. LoginP is the panel i want to see when i run the code, so i call the corresponding method at the end of my GUI() method, but for some strange reason, when I run it is as if there are no panels at all, just a blank JFrame. I added a System.out.println(); just after I call the method to set LoginP to visible (at the end of the GUI() method), but alas, that line is not printed. I'm sure the answer is staring me right in the face, but I'm just not able to see it. Edit: For those who feel like playing a bit, here are all the source files: http://goo.gl/KjW8cH //Individual Imports /* import java.awt.GroupLayout; import java.awt.Font; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JPanel; import javax.swing.JLabel; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JCheckBox; import javax.swing.JOptionPane; */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; public class GUI extends JFrame { /*################################################################################################################################################################# *##################################################################################################################################################### *###############################################################################################################################################################*/ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Login Panel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~…
has comment: http://stackoverflow.com/comment/42580321
tagged with: java
has comment: http://stackoverflow.com/comment/42595978
tagged with: grouplayout
has comment: http://stackoverflow.com/comment/42578040
tagged with: swing
has comment: http://stackoverflow.com/comment/42578216
type: Question
has comment: http://stackoverflow.com/comment/42579313
tagged with: jpanel
has comment: http://stackoverflow.com/comment/42578463

http://stackoverflow.com/comment/42706450
type: Comment
comment on: http://stackoverflow.com/a/27101068
type: AnswerComment
has text: Closing the output stream will close the socket. And its input stream.
score: 0

http://stackoverflow.com/a/27082204
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27081675
downvote count: 0
answers question: http://stackoverflow.com/q/27081675
score: 1
has body: If you take the value of a field you must first save the information in a global variable and then access it. import javax.swing.JOptionPane; public class example extends javax.swing.JFrame { String nameStr = ""; //Here I save the name entered. public example() { initComponents(); } private void okBtnActionPerformed(java.awt.event.ActionEvent evt) { nameStr = nameTxt.getText(); nameTxt.setText(""); } private void showBtnActionPerformed(java.awt.event.ActionEvent evt) { JOptionPane.showMessageDialog(null, "You entered this name: " + nameStr); } public static void main(String args[]) { /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new example().setVisible(true); } }); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { aboutLbl = new javax.swing.JLabel(); inputLbl = new javax.swing.JLabel(); nameTxt = new javax.swing.JTextField(); okBtn = new javax.swing.JButton(); showBtn = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); aboutLbl.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N aboutLbl.setText("Example by José Peña"); inputLbl.setText("Input your name:"); okBtn.setText("OK"); okBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okBtnActionPerformed(evt); } }); showBtn.setText("Show my name entered"); showBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showBtnActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, S…
upvote count: 1

http://stackoverflow.com/q/26997161
tagged with: windows
tagged with: unix
has answer: http://stackoverflow.com/a/26997653
has body: I am writing an "end-to-end" test for a method that takes in command, runs it, and returns the stdout output in a string. It looks something like this: public static String runCommand(String ... command) { } What I need is a cross-platform command that writes something to the console as we have a mix of windows/linux machines and I need the test to run everywhere. I'd prefer not to have an if (os == 'windows') type statement. I don't want System.out.println(command) here, I want to execute the code and get the output. For instance, sleep 5 will sleep for 5 seconds on both Unix/Linux and Windows but won't output anything. echo hello won't work on Windows because echo is a command from Unix's Terminal. Any ideas? I am not looking for comments on the "testability" of this code.
type: Question
has comment: http://stackoverflow.com/comment/42524982
score: 0
tagged with: java
answer count: 3
tagged with: cross-platform
has comment: http://stackoverflow.com/comment/42525275
accepted answer: http://stackoverflow.com/a/26997653
has title: Is there a cross platform command that will print something to console?
has answer: http://stackoverflow.com/a/26997457
possible better answer: http://stackoverflow.com/a/61857874
has answer: http://stackoverflow.com/a/61857874
tagged with: linux
type: AnsweredQuestion

http://stackoverflow.com/comment/42551583
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27012518
has text: if you use enctype = "multipart/form-data" then you have to use post method.
type: Comment

http://stackoverflow.com/comment/42731953
score: 1
comment on: http://stackoverflow.com/q/27114432
type: Comment
type: QuestionComment
has text: You've nailed the root of the issue on the head: `data = (E[]) new Object[s]` in your constructor is indeed the problem

http://stackoverflow.com/a/27128324
answers question: http://stackoverflow.com/q/27128247
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42756243
type: Answer
accepted answer of: http://stackoverflow.com/q/27128247
score: 1
has body: The old value of the key is returned by the put method, so you can output it. Assuming the value of your HashMap is of type String : for( int i = 0; i &lt;= elements.length - 1; i++) { nodeDBList = (NodeList) xPath.compile(elements[i]).evaluate(dbDocument, XPathConstants.NODESET); for (int j = 0; j &lt; nodeDBList.getLength(); j++) { if(nodeDBList.item(j).getFirstChild() != null) { String oldVal = dbList.put(nodeDBList.item(j).getFirstChild().getNodeValue().toLowerCase().trim(), nodeDBList.item(j).getNodeName().toLowerCase().trim()); if (oldVal != null) { System.out.println(oldVal); } } } }
upvote count: 1

http://stackoverflow.com/comment/42685710
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27089088
has text: Don't forget that single digit numbers will not show a leading zero unless you format the output. If this is for displaying to the console, you can add this line `System.out.printf("%02d %02d %02d %n", hour, m, s);` to the inner loop. If it is to save to a file, you can use `String.format("%02d %02d %02d %n", hour, m, s)`.
type: AnswerComment

http://stackoverflow.com/a/27008141
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27007993
answers question: http://stackoverflow.com/q/27007993
upvote count: 2
has body: From the JLS §8.8.9: It is a compile-time error if a default constructor is implicitly declared but the superclass does not have an accessible constructor (§6.6) that takes no arguments and has no throws clause. This means, if your parent class doesn't have a default constructor, but your child class does, then you have a compilation error on your hands. Let's remove the generics and look at it like this: public class Parent { private int age; public Parent(int age) { this.age = age; } } public class Child extends Parent { public Child() { } } The above code won't compile since Parent doesn't have a default or no-arg constructor in it. The child class can't invoke the parent's constructor since it doesn't exist. If we fix it so that it does reference super... public class Child extends Parent { public Child(int age) { super(age); } } ...then the compiler is happy once more.
type: Answer
has comment: http://stackoverflow.com/comment/42564076
score: 2
has comment: http://stackoverflow.com/comment/42544721
has comment: http://stackoverflow.com/comment/42545043

http://stackoverflow.com/comment/42666249
type: Comment
has text: @mkleint For your fist comment, I edited the question with the right conf. tx.
score: 0
comment on: http://stackoverflow.com/q/27070750
type: QuestionComment

http://stackoverflow.com/q/27067971
upvote count: 1
has answer: http://stackoverflow.com/a/27068812
accepted answer: http://stackoverflow.com/a/27068812
answer count: 1
favorite count: 0
tagged with: byte
has body: I am generating PCAPNG files of packets that I capture. Everything seems to work fine, except for the timestamp of each packet being invalid. Simply put, I store the timestamp in a bytebuffer along with all the other data and write it to a file. When I then inspect the file using a hex editor I get the following value for the timestamp field: ByteBuffer data = ByteBuffer.allocate(epbLength).order(ByteOrder.BIG_ENDIAN); data.putlong(timestamp); 00 00 01 49 D3 7F B4 D9 =&gt; 1416592602329 (According to Hex Fiend) This seems like a valid timestamp. However, opening the file in Wireshark I get January 12, 46860 Looking at the PCAPNG specification regarding timestamp it states the following: Timestamp (High) and Timestamp (Low): high and low 32-bits of a 64-bit quantity representing the timestamp. The timestamp is a single 64-bit unsigned integer representing the number of units since 1/1/1970 00:00:00 UTC. The way to interpret this field is specified by the ’if_tsresol’ option (see Figure 9) of the Interface Description block referenced by this packet. Please note that differently from the libpcap file format, timestamps are not saved as two 32-bit values accounting for the seconds and microseconds since 1/1/1970. They are saved as a single 64-bit quantity saved as two 32-bit words. So I am assuming that it is wrong for me to simply store the value as a long in the bytebuffer and then save it to a file. But how am I supposed to save a timestamp as two 32 bit words? I have tried different things like simply storing the value as two ints but nothing seems to give me the right format. Note that I also specify if_tsresol, in the packet, but no matter what value I give it (3 for 10^-3 => millis) it does not affect the way Wireshark interprets the file. Another thing to note, is that if I store the timestamp as seconds, I do get a valid timestamp in wireshark. As seen here However, the milliseconds are discarded, meaning that the ordering of all packets received within the sa…
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: timestamp
type: AnsweredQuestion
has title: Storing Timestamps as two 32 bit words (pcapng format)
tagged with: pcap-ng

http://stackoverflow.com/comment/56346672
type: QuestionComment
has text: @DanielSetareh Please do not deface the post. If you need to remove information from it and can offer some proof of the concerns you have raised regarding this post, please raise a moderator flag.
score: 0
comment on: http://stackoverflow.com/q/27001919
type: Comment

http://stackoverflow.com/q/27021465
tagged with: lvalue
has body: What the title says. For C++, (++a)++ does compile. Strangely enough, though, ++(a++) does not: int main() { int a = 0; ++a++; // does not compile (++a)++; // does compile ++(a++); // does not compile } But in Java, it does not for all three: public class Test { public static void main(String[] args) { int a = 0; ++a++; // does not compile (++a)++; // does not compile ++(a++); // does not compile } } Is there any reason why C++ compiles this but not in Java?
answer count: 1
has answer: http://stackoverflow.com/a/27021971
has comment: http://stackoverflow.com/comment/42567584
favorite count: 0
upvote count: 8
has title: Why does `++a++` not compile in C++ but `(++a)++` does?
score: 6
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42567742
accepted answer: http://stackoverflow.com/a/27021971
tagged with: java
downvote count: 2
duplicate of: http://stackoverflow.com/q/371503
has comment: http://stackoverflow.com/comment/42567551
has comment: http://stackoverflow.com/comment/42567522
has comment: http://stackoverflow.com/comment/42567476
has comment: http://stackoverflow.com/comment/42575454
type: Question
tagged with: rvalue
has comment: http://stackoverflow.com/comment/42618895
has comment: http://stackoverflow.com/comment/42568838
has comment: http://stackoverflow.com/comment/42567546

http://stackoverflow.com/comment/42831531
has text: you can also try elementToBeClickable instead of visibilityOfElement
type: Comment
comment on: http://stackoverflow.com/a/27168549
score: 0
type: AnswerComment

http://stackoverflow.com/a/27137043
accepted answer of: http://stackoverflow.com/q/27116477
answers question: http://stackoverflow.com/q/27116477
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Objectify doesn't know what to do with a Date as a Map key. Map keys get turned into property names, which must be Strings. So you need to invent a DateStringifier class that implements the Stringifier interface. It's trivial, but you have some options - you can stringify your dates as millis-since-epoch or as some sort of human-readable format.

http://stackoverflow.com/q/27132154
has comment: http://stackoverflow.com/comment/42763102
has answer: http://stackoverflow.com/a/27132309
tagged with: generics
has title: generic signature to accept Map<String,Object> or Map<String,String>
type: UnansweredQuestion
has body: I currently have a method like this: public static Report createReport(Map&lt;String,Object&gt; parameters) {...} I'm trying to figure out if there is a way I can change the generic specification so that it will accept both Map&lt;String,Object&gt;s and Map&lt;String,String&gt;s for parameters. Note that createReport needs to be able to add entries to parameters. Is this possible?
linked to: http://stackoverflow.com/q/4343202
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27132291
has answer: http://stackoverflow.com/a/27132296
score: 0
answer count: 3

http://stackoverflow.com/comment/42592824
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27032910
has text: Possible duplicate of [jdbc sql error: statement did not return a result set](http://stackoverflow.com/q/24428928/2144390)
score: 1

http://stackoverflow.com/comment/42610084
comment on: http://stackoverflow.com/q/27045451
score: 0
type: Comment
type: QuestionComment
has text: You must choose to override only one of onCreateView or onCreateDialog in a DialogFragment. Overriding both will result in the exception: "requestFeature() must be called before adding content".

http://stackoverflow.com/a/27036147
upvote count: 1
type: Answer
has body: Not sure I understand your code entirely, but you can add the following method in your itemList class (btw, classes should be named with capital, like ItemList): public boolean isFull(){ return count == items.length; } and then in your original code you can just do if(itemList.isFull()){ System.out.println("Shop is full"); } else{ \\rest of code here }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42592822
has comment: http://stackoverflow.com/comment/42592945
answers question: http://stackoverflow.com/q/27035911

encryption
tags question: http://stackoverflow.com/q/27039986
tags question: http://stackoverflow.com/q/27049976
tags question: http://stackoverflow.com/q/27037364
tags question: http://stackoverflow.com/q/27086255
tags question: http://stackoverflow.com/q/27124498
tag name: encryption
tags question: http://stackoverflow.com/q/27025610
tags question: http://stackoverflow.com/q/27054993
tags question: http://stackoverflow.com/q/27123772
tags question: http://stackoverflow.com/q/27129435
tags question: http://stackoverflow.com/q/27119821
tags question: http://stackoverflow.com/q/27003994
tags question: http://stackoverflow.com/q/27070108
tags question: http://stackoverflow.com/q/27011874
tags question: http://stackoverflow.com/q/27132736
tags question: http://stackoverflow.com/q/27112213
tags question: http://stackoverflow.com/q/27147016
tags question: http://stackoverflow.com/q/27008942
tags question: http://stackoverflow.com/q/27018357
tags question: http://stackoverflow.com/q/27124931
tags question: http://stackoverflow.com/q/27115730
type: Tag
tags question: http://stackoverflow.com/q/27028924
tags question: http://stackoverflow.com/q/27106907

http://stackoverflow.com/a/27092509
has body: I wasted a lot of time and eventually I noticed that second varian doesnt work because following dependencies were added to pom.xml org.hibernate hibernate-annotations 3.6.3.Final org.hibernate hibernate-commons-annotations 3.3.0.ga After I removed their - relation became a create.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27092371

http://stackoverflow.com/q/27018180
type: Question
has body: I have a bean where I define multiple validation annotations for each field e.g. @NotEmpty @Pattern(regexp="(\\-?\\d)+") @Min(value=1) String myField; I have encountered two one problem that I cannot resolve in any easy way. Validation order of the specified annotations for each field is random i.e. do not happen in the order the annotations are defined. I believe @GroupSequence will not help since it only defines group validation sequence, not annotation sequence. As @Tom correctly commented, violations are reported as Set which means there is no 1:1 mapping between execution order of annotations and reported violations. I want to invalidate only one rule for each field i.e. if it does not match pattern do not try to check if the value is >= 1. Currently if is set myField to "abc" it will report both @Pattern and @Min violations. Setting failFast property of a validator to true does not help because I'm using the same validator instance to validate all the fields in my bean, and it will stop validating other fields as soon as the first violation for the whole bean is encountered. Edit. I tried to implement custom composite constraint with @ReportAsSingleViolation. The problem is that it will report the same message for all violations involved in composition. This is not what I need. Suggestions, please?
has comment: http://stackoverflow.com/comment/42561934
has answer: http://stackoverflow.com/a/42216178
possible better answer: http://stackoverflow.com/a/27019081
has answer: http://stackoverflow.com/a/27019081
has title: How-to make Hibernate Validator stop validation on the first field violation?
has comment: http://stackoverflow.com/comment/42561675
has answer: http://stackoverflow.com/a/27025041
score: 8
has answer: http://stackoverflow.com/a/75233042
tagged with: java
tagged with: hibernate
answer count: 4
type: AnsweredQuestion
tagged with: validation
has comment: http://stackoverflow.com/comment/42561821
downvote count: 0
accepted answer: http://stackoverflow.com/a/27025041
favorite count: 0
upvote count: 8

http://stackoverflow.com/a/27121855
type: Answer
has comment: http://stackoverflow.com/comment/42744757
answers question: http://stackoverflow.com/q/27121815
score: 2
upvote count: 2
has body: equalsIgnoreCase or toUpperCase() method is the best (and the easiest) option.
downvote count: 0

http://stackoverflow.com/a/27060298
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27060152
has body: According to the API doc, doc.select(...) doesn't return NULL, but an empty Elements collection if nothing is found that matches the selector. Try testing it this way: if (!porukeDiv.isEmpty()) { System.out.println("porukeDiv NOT Empty! "); }else{ System.out.println("porukeDiv Empty! "); }
accepted answer of: http://stackoverflow.com/q/27060152
score: 0

http://stackoverflow.com/comment/42746413
type: AnswerComment
comment on: http://stackoverflow.com/a/27122639
has text: @user3835765: Right, so say that - *don't* say that it passes by reference, when it doesn't. Now your answer is just code, with no explanation - it's still not really *helpful*.
score: 0
type: Comment

http://stackoverflow.com/comment/42682206
score: 0
has text: Where are you stuck? If we don't know which aspect of the problem you have trouble with we'll likely explain the wrong aspect ...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27086992

http://stackoverflow.com/comment/42712712
has text: ...ideally providing a size of the string builder that is likely to hold the result, so you don't get all those reallocations from the default size of 16 characters.
comment on: http://stackoverflow.com/a/27104600
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27136712
has body: I don't think it's valid to store an ArrayList in a HashMap where a String is expected. I would've said that that code should fail, but I guess it must be succeeding, since it's not failing for you, and so what I'm assuming is happening is that when you insert it into the HashMap Java is actually calling toString() on it behind the scenes to cast it to String. So the value sitting in the HashMap is not actually an array; it was a string from the moment it was inserted. Thus, you're losing information that can't be salvaged downstream from the lossage.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42772096
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27136604
answers question: http://stackoverflow.com/q/27136604
has comment: http://stackoverflow.com/comment/42772142
upvote count: 2

http://stackoverflow.com/a/27131054
has body: The word boundary \\b won't work in this case, as the hyphen - is considered to be a "non-word" character too. Use this instead, with whitespace: String test = "This is just a test-like thing. I want to test this"; Pattern p = Pattern.compile("(?&lt;=\\s|^)test(?=\\s|$)"); Matcher m = p.matcher(test); while (m.find()) { System.out.println(String.format("Found %s at index %d%n", m.group(), m.start())); } Output (pun not intended) Found test at index 42
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/42761136
answers question: http://stackoverflow.com/q/27130978
downvote count: 0

http://stackoverflow.com/a/27070596
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: It seems that the add, list and serve are three functions. All your methods are static, then you need a static PatientList variable. That is, when user picked add, he added elements in the list, when he chose list, the same list objects would be displayed. In codes just in your class declare: private static ListInterface&lt;PatientDetails&gt; patient = new LList&lt;PatientDetails&gt;(); In your add and list method, use this variable directly.
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/27069486
answers question: http://stackoverflow.com/q/27069486

http://stackoverflow.com/comment/42617278
comment on: http://stackoverflow.com/q/27049736
has text: if you look at ant.sh file it has the script how it finds `java`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27151964
type: UnansweredQuestion
tagged with: maven
answer count: 0
upvote count: 3
tagged with: java
has title: ClassNotFound exception on deploy Eclipse (Luna) jersey and tomcat
tagged with: eclipse
type: Question
has body: I have error on deploy my Jersey web services in Tomcat. I have create a dynamic project 3.0 and after i convert this in Maven project. I have installed this: Maven (Java EE) Integration for Eclipse WTP (Luna) 1.1.0 and Maven Integration for Eclipse (Luna) 1.5.0 But if i try right-click on the project and do a Maven > Update project, this not internally change the project configuration so the Maven dependencies are not copied to the /WEB-INF/lib folder. So when i try to run in server i have this error: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer If i go to the Deployment Assembly i have: Source: Maven Dependencies|Deploy path: WEB-INF/lib...i thinks this incorrect, is it?
downvote count: 0
linked to: http://stackoverflow.com/q/22022114
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42803403
score: 3
favorite count: 0

http://stackoverflow.com/comment/42586643
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27032485
has text: Please also show us the code that doesn't compile.
score: 0

http://stackoverflow.com/q/27067049
downvote count: 0
has answer: http://stackoverflow.com/a/75378087
favorite count: 0
has answer: http://stackoverflow.com/a/77416340
has comment: http://stackoverflow.com/comment/71023575
tagged with: java-8
has answer: http://stackoverflow.com/a/59248593
type: AnsweredQuestion
has title: Unit testing a class with a Java 8 Clock
has body: Java 8 introduced java.time.Clock which can be used as an argument to many other java.time objects, allowing you to inject a real or fake clock into them. For example, I know you can create a Clock.fixed() and then call Instant.now(clock) and it will return the fixed Instant you provided. This sounds perfect for unit testing! However, I'm having trouble figuring out how best to use this. I have a class, similar to the following: public class MyClass { private Clock clock = Clock.systemUTC(); public void method1() { Instant now = Instant.now(clock); // Do something with 'now' } } Now, I want to unit test this code. I need to be able to set clock to produce fixed times so that I can test method() at different times. Clearly, I could use reflection to set the clock member to specific values, but it would be nice if I didn't have to resort to reflection. I could create a public setClock() method, but that feels wrong. I don't want to add a Clock argument to the method because the real code shouldn't be concerned with passing in a clock. What is the best approach for handling this? This is new code so I could reorganize the class. Edit: To clarify, I need to be able to construct a single MyClass object but be able to have that one object see two different clock values (as if it were a regular system clock ticking along). As such, I cannot pass a fixed clock into the constructor.
tagged with: java
tagged with: unit-testing
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/27067090
possible better answer: http://stackoverflow.com/a/27068139
has answer: http://stackoverflow.com/a/56026271
upvote count: 87
tagged with: java-time
has answer: http://stackoverflow.com/a/64211788
has answer: http://stackoverflow.com/a/27068139
has answer: http://stackoverflow.com/a/38385316
accepted answer: http://stackoverflow.com/a/27067090
has comment: http://stackoverflow.com/comment/80656122
score: 87

http://stackoverflow.com/q/27037640
tagged with: java
has title: How to return outputstream of .xlsx file
has answer: http://stackoverflow.com/a/27038555
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/27038555
tagged with: excel
type: Question
type: AnsweredQuestion
has body: in a java-class i just created workbook like this XSSFWorkbook workbook = (XSSFWorkbook) WorkbookFactory.create(fis); and filled cells with its corresponding celltype. now i need to write it as a xxx.xlsx file same time return a BuyteArrayOutputStream. to do so, FileOutputStream fos = new FileOutputStream(tempFile); workbook.write(fos); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); workbook.write(outputStream); return outputStream; here writing xxx.xlsx fils done successfully but same time it returns outputStream as null? How do achieve it both?

http://stackoverflow.com/comment/42755209
comment on: http://stackoverflow.com/a/27117859
has text: also my SP site doesn't have _vti_bin/client.svc api.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42577680
score: 1
comment on: http://stackoverflow.com/a/27027172
has text: @silversunhunter you don't need sqlite for your task but you can reuse Loaders (AsyncTaskLoader) in your design. They were prepared exactly for your needs - i.e. asynchronously loading data thus looking at them may give good inputs to your design
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42637095
comment on: http://stackoverflow.com/q/27005659
type: QuestionComment
has text: Looks like the `appengine`'s sdk contains a repackaged bundle of `asm` library? Can you check for the compatibility of the version of the `asm` that is bundled with your version of the `java`?
score: 1
type: Comment

http://stackoverflow.com/q/27139229
tagged with: recursion
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has body: I was hoping someone could help me solve my problem of this Stack Overflow/Infinite-loop error and hopefully point me in the right direction. My program is designed to show all solutions of giving back change (change as in money) back to the user for a specified amount. The algorithm goes something like this: Subtract a coin amount from the total change value. If you get back 0, then is a solution If negative, discard that coin. If you try a nickle and it doesn't work, un-choose it, try a penny This is what I have so far import java.io.*; import java.util.*; import java.lang.*; public class homework5 { public static int change; public static void main(String[] args) throws FileNotFoundException { //begin main ArrayList&lt;Integer&gt; coinTypes = new ArrayList&lt;Integer&gt;();//array to store coin types ArrayList&lt;Integer&gt; answerCoins = new ArrayList&lt;Integer&gt;();//answer to be outputted Integer i; File f = new File (args[0]); Scanner input = new Scanner(f); //initialize scanner input.nextLine(); while(input.hasNextInt()) { i = input.nextInt(); coinTypes.add(i); //add all ints to file } change = coinTypes.get(coinTypes.size()-1); coinTypes.remove(coinTypes.size()-1); System.out.println("Change: " + change); findChange(change, coinTypes, answerCoins); } private static void findChange(int change, List&lt;Integer&gt; coinTypes, List&lt;Integer&gt; answerCoins) { //contains means of finding the //change solutions if(change == 0) { //base case System.out.println(answerCoins); } else if(change &lt; 0) { //if negative it can't be a solution } else { for(int coin = 0; coin &lt; coinTypes.size(); coin++) { answerCoins.add(coinTypes.get(coin)); //choose findChange(change-coinTypes.get(coin), coinTypes, answerCoins);//explore answerCoins.remove(answerCoins.size()-1); //un-choose } } } } As I mentioned, the program reads in values from a file, here is my test file I use // Coins available in the USA, given in cents. Very simple case. 1 5 9 After reading the file in, my…
has answer: http://stackoverflow.com/a/27139458
tagged with: infinite-loop
has title: Recursion Stack Overflow/Infinite-loop issue
score: 3
downvote count: 0
answer count: 1
tagged with: stack-overflow
favorite count: 0
accepted answer: http://stackoverflow.com/a/27139458
tagged with: backtracking

http://stackoverflow.com/q/27003551
type: Question
tagged with: encode
score: 0
has answer: http://stackoverflow.com/a/27003767
has comment: http://stackoverflow.com/comment/42536698
answer count: 1
has comment: http://stackoverflow.com/comment/42537479
has comment: http://stackoverflow.com/comment/42537425
has comment: http://stackoverflow.com/comment/42537645
has comment: http://stackoverflow.com/comment/42536919
has comment: http://stackoverflow.com/comment/42537545
tagged with: java
has body: I'm trying to send png to server using http get request. I'm using code below to to so. String encoding (on client): byte[] bytes = Files.readAllBytes(Paths.get(chosenFile.getPath())); String image = new String(bytes, "ISO-8859-1"); Then I send http get request to server with String image. Server receive it but I get image that is not the same as one I sent (I can't open one I received). I'm using URLEncoder.encode(image, "ISO-8859-1") to encode url for http get request. When I use URLEncoder.encode(image, "UTF-8"), the same happens. Why this doesn't work? Is there any better way of doing this kind of stuff? UPD #0 Code for sending an image: private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser chooser= new JFileChooser(); int choice = chooser.showOpenDialog(this); if (choice != JFileChooser.APPROVE_OPTION) return; File chosenFile = chooser.getSelectedFile(); try { byte[] bytes = Files.readAllBytes(Paths.get(chosenFile.getPath())); String image = new String(bytes, "ISO-8859-1"); if(image != null){ boolean allsent = false; long k = 0; String query = "0"; while(!allsent){ String s = image; String send = ""; long q; if(k+400&gt;image.length()){ q=image.length(); allsent=true; } else q = k+400; for(long i=k;i&lt;q;i++) send+=s.charAt((int) i); System.out.println(send); String response = new HTTP().GET(Constants.ADDRESS_ADDIMAGE + "?" + Constants.USERNAME + "=" + URLEncoder.encode(user, "UTF-8") + "&amp;" + Constants.IMAGE + "=" + URLEncoder.encode(send, "ISO-8859-1") + "&amp;" + Constants.QUERY + "=" + URLEncoder.encode(query, "UTF-8")); k+=400; query="1"; } } } catch (IOException ex) { ex.printStackTrace(); } } Note: HTTP().GET() invokes standard http get. UPD #1 Server code @GET @Path("/addimage") @Produces(MediaType.APPLICATION_JSON) public String addImage(@QueryParam("username") String uname, @QueryParam("image") String image, @QueryParam("query") String query) { if(query.equals("0")){ String s = image; JDBC.addImage("ABase", "MarketL…
has comment: http://stackoverflow.com/comment/42536934
has comment: http://stackoverflow.com/comment/42537000
has comment: http://stackoverflow.com/comment/42536675
type: UnansweredQuestion
tagged with: string
tagged with: http-get
has comment: http://stackoverflow.com/comment/42536750
has comment: http://stackoverflow.com/comment/42536809
has comment: http://stackoverflow.com/comment/42537077
has comment: http://stackoverflow.com/comment/42537023
has title: java sending images over http get doesn't work

http://stackoverflow.com/a/27011041
downvote count: 0
has comment: http://stackoverflow.com/comment/42659899
accepted answer of: http://stackoverflow.com/q/27010487
has body: Others are correct with the use of getResourceAsStream, but the path is a little tricky. You see the little package icon in the resources folder? That signifies that all the files in the resource folder will be put into the root of the classpath. Just like all the packages in src/main/java are put in the root. So you would take out the resources from the path InputStream is = getClass().getResourceAsStream("/Cloudy_Day.png"); An aside: Maven has a file structure conventions. Class path resources are usually put into src/main/resources. If you create a resources dir in the src/main, Eclipse should automatically pick it up, and create the little package icon for a path src/main/resource that you should see in the project explorer. These files would also go to the root and could be accessed the same way. I would fix the file structure to follow this convention. Note: A MimeBodyPart, can be Constructed from an InputStream (As suggested by Bill Shannon, this is incorrect). As mentioned in his comment below "You can also attach the data using" mbp.setDataHandler(new DataHandler(new ByteArrayDataSource( this.getClass().getResourceAsStream("/Cloudy_Day.png", "image/png"))));
type: Answer
answers question: http://stackoverflow.com/q/27010487
has comment: http://stackoverflow.com/comment/42549483
has comment: http://stackoverflow.com/comment/42549413
upvote count: 9
score: 9
type: AcceptedAnswer

http://stackoverflow.com/q/27033625
has answer: http://stackoverflow.com/a/27033756
has answer: http://stackoverflow.com/a/27033791
type: UnansweredQuestion
downvote count: 3
has comment: http://stackoverflow.com/comment/42588674
upvote count: 1
type: Question
has body: I'm trying to access a file test.gif located at (src/main/resources/test.gif in Eclipse),from my program using the absolute path using the ClassLoader, in the following manner String absPath=this.getClass().getResource("/test.gif").toString(); System.out.print(Path);// prints the absolute path /Users/Abby/Project/SubFolder/ProjectName/target/classes/test.gif - the file exists at the location. String relPath= "src/main/resources/test.gif"; However, accessing absPath causes a FileNotFoundException in my program whereas using relPath does not. What exactly am I doing wrong? And how do I correctly access the file using the absolute path (via ClassLoader)
has title: FileNotFoundException from the Absolute path of a file (Even though the file is present).Why?
score: -2
tagged with: java
linked to: http://stackoverflow.com/q/2850674
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42588448
answer count: 2
has comment: http://stackoverflow.com/comment/42588440
favorite count: 0
has comment: http://stackoverflow.com/comment/42588579
linked to: http://stackoverflow.com/q/3861989

http://stackoverflow.com/q/27071431
accepted answer: http://stackoverflow.com/a/27071691
has body: Hi I am trying to build maven project using intelliJ. I wanted to know what the maven import option does? Apart from importing files from local repository and remote maven repository, does it imports/ updates files from SVN repository (which I am using). So do I need to checkout the code from repository everytime or import option does this ? Thanks
type: Question
tagged with: intellij-idea
has title: Does maven import option in intelliJ imports jars from remote repositories as well
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27071691
tagged with: maven
type: AnsweredQuestion
tagged with: svn
tagged with: java

http://stackoverflow.com/comment/42691887
score: 0
has text: Your code has too much redundancy, demasiada redundancia, making it difficult for us to understand and for you to debug. Consider using arrays or ArrayLists to shorten your code significantly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27092649

http://stackoverflow.com/a/27093267
has comment: http://stackoverflow.com/comment/42692863
accepted answer of: http://stackoverflow.com/q/27093124
upvote count: 2
answers question: http://stackoverflow.com/q/27093124
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: Caused by: java.lang.NullPointerException because in LoginScreen Activity you are calling setOnClickListener method of LoginButton before initialization of LoginButton Button instance.so do it as after setContentView: LoginButton = (Button)findViewById(R.id.Login_Button_ID);

http://stackoverflow.com/q/27047314
tagged with: assertions
tagged with: junit
has comment: http://stackoverflow.com/comment/42794713
has answer: http://stackoverflow.com/a/27048193
has answer: http://stackoverflow.com/a/27048124
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42612978
has comment: http://stackoverflow.com/comment/42927198
has title: Alternatives to Assert
tagged with: java
has comment: http://stackoverflow.com/comment/46862020
has answer: http://stackoverflow.com/a/27047590
has body: The reasons I am dissatisfied with assert keyword in Java are 1) it's disabled by default, so it is a headache to make sure it's enabled when I want it to be 2) its behavior is rather rigid (I would want some inversion of control, ideally); but that's not terribly important. Some of the alternatives I can think about: JUnit's assertEquals() and such - good for tests, but can't use in main code Guava's preconditions - great, but no assertion methods per se. My own assertion library - I wrote it back in 1999, and back at the time it was great, but now I want to standardize. Anything else? So.. to sum it up.. how do I assert in production code in a way that is not disabled by default? (And yes, this may be considered an anti-pattern by some, but I do want at least some assertions in Production, even if assertion failures are just silently logged. I see some room for that even in shrink-wraps, and definitely in websites).
has comment: http://stackoverflow.com/comment/42613553
type: Question
has comment: http://stackoverflow.com/comment/42613573
downvote count: 0
has comment: http://stackoverflow.com/comment/42900079
has comment: http://stackoverflow.com/comment/42613638
tagged with: assert
answer count: 3

http://stackoverflow.com/comment/44271973
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27109216
score: 0
has text: So, did you work this out?

http://stackoverflow.com/comment/42696414
score: 0
has text: @SergiyMedvynskyy I have added some lines of code and a screen shot.
type: QuestionComment
comment on: http://stackoverflow.com/q/27094716
type: Comment

http://stackoverflow.com/comment/42621894
comment on: http://stackoverflow.com/q/27052402
score: 0
type: Comment
type: QuestionComment
has text: Finally, are you specifying your app's context path in your URL?

http://stackoverflow.com/q/27017355
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27018219
has title: Implementation of switch case for check box
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42559943
tagged with: switch-statement
has comment: http://stackoverflow.com/comment/42559950
type: Question
tagged with: jcheckbox
downvote count: 0
answer count: 1
has body: Is there any way to implement switch case for checkbox? Example: I have 4 checkboxes, if I selected 2 checkboxes, how to trigger the case to the output I want? double exam = 0.0, assign = 0.0, quiz = 0.0, ct = 0.0; if (examchkbox.isSelected()) { exam = Double.parseDouble(examtextfield.getText()); } if(ctchkbox.isSelected()) { ct = Double.parseDouble(cttextfield.getText()); } if(quizchkbox.isSelected()) { quiz = Double.parseDouble(quiztextfield.getText()); } if(asschkbox.isSelected()) { assign = Double.parseDouble(asstextfield.getText()); } if (!(exam + ct + quiz + assign == 100)) { markerrorlbl.setText("Total marks must be 100"); } else { // implementation of code here } This is the design view. Let say I ticked Exam and Class Test, I just want to select the value in the text field and store the marks by using switch case. Is that possible? This is the thing about I want but I've no idea how to implement with Checkbox. switch(x) { case 1 : A = new exam(marks) ;total+=marks; break; case 2 : A = new test(marks) ;total+=marks; break; case 3 : A = new quiz(marks) ;total+=marks; break; case 4 : A = new assignment(marks) ;total+=marks;break; }
favorite count: 0
has answer: http://stackoverflow.com/a/27018219
upvote count: 1

http://stackoverflow.com/a/26992541
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26992354
has body: null is not the same an an empty String. An empty String is still a String object. From the documentation for StringBuilder#append method: The data is converted to a string before the append operation takes place And Is it possible to change some configs that append function will not convert NULL to string ? Overriding a method in a final class is impossible. And append() isn't a method in Object, it is in java.lang.String

http://stackoverflow.com/comment/88021088
type: AnswerComment
comment on: http://stackoverflow.com/a/30334328
score: 0
type: Comment
has text: I believe now, as of libgdx 1.9.8 its Timer.instance().delay(long) in use

http://stackoverflow.com/q/27145044
tagged with: jpanel
has comment: http://stackoverflow.com/comment/42787614
score: 0
has title: swing reuse panelchange class
has comment: http://stackoverflow.com/comment/42843395
has comment: http://stackoverflow.com/comment/42786357
answer count: 0
type: UnansweredQuestion
has body: I am writing a program that consists of a number of classes. At this stage, I am only doing the layout (Java Swing), and will add functionality later. I added a menu bar that will appear on a JPanel with other items in each class (there is a reason I am doing it this way). I am calling classes from the class that contains my main() - it is called PanelChange. All it does (at this stage) is to replace the JPanel in this class with JPanels from the other classes, based on a user click on a menu item. This works perfect. Now I want to do this using the menu's from the other classes, and this is where I am running into trouble. When I instantiate the PanelChange class (object.item), it opens a new JFrame (this is probably because I instantiate a class that contains the JFrame). There certainly must be a way how I can access the functionality in my PanelChange class from the JPanels from other classes? The following is a snipped from my PanelChange class: public static void main(String[] args) { new PanelChange(); } @Override public void actionPerformed(ActionEvent event) { Object obj = event.getSource(); if(obj.equals(book)) { backPanel.removeAll(); backPanel.add(panelBookings.backPanel); backPanel.repaint(); backPanel.revalidate(); this.setTitle("Manage Bookings"); } } How do I use this functionality on a Panel from another class? Thanks!!!
tagged with: swing
tagged with: java
type: Question

http://stackoverflow.com/a/27004279
score: 1
accepted answer of: http://stackoverflow.com/q/27004252
answers question: http://stackoverflow.com/q/27004252
type: AcceptedAnswer
downvote count: 0
has body: Your for loop condition is bad for (int c = 0; c &lt;= N; c++) { should be for (int c = 0; c &lt; N; c++) { as you have an array of dimension N, and the cointng starts from 0. for (int c = 1; c &lt; N; c++) { isPrime[c] = true; } This code sets all numbers to be primes. What you should do is setting every number to be prime, and later setting every multiple of a number to not be prime. so it would be like Arrays.fill(isPrime, true); isPrime[0] = false; for (int x = 1, x &lt; N; x++) { for (int y = x; y &lt; N; y+=x) { isPrime[y] = false; } } This should be the real sieve algorithm. Refer to https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
type: Answer
has comment: http://stackoverflow.com/comment/42538210
has comment: http://stackoverflow.com/comment/42538403
upvote count: 1

http://stackoverflow.com/comment/42682938
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27087229
has text: @Joop-No,you can simply overwrite the element of array by assigning values. You don't need to itertae through the loop! Also, you can put any value,including null,on selective type like String,etc.-though that would result in run-time exception. Check my answer below for more detail!
score: 0

http://stackoverflow.com/q/27064452
has answer: http://stackoverflow.com/a/27069112
possible better answer: http://stackoverflow.com/a/27064910
type: Question
linked to: http://stackoverflow.com/q/8001079
has title: JSF Not Working: Select SelectOneMenu And Dynamically Update Other SelectOneMenu With Ajax
tagged with: java
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27069112
tagged with: ajax
has body: I have been trying to find out what is the problem for quite long time and no successful results for me. I was searching for this in Google and I tried out few different working examples but none helped me to solve my task. The problem is that "Messages" selectOneMenu just does not update when "Categories" selectOneMenu is changed. It does not load the messages of selected category. In HTML I have just two selectOneMenu elements. In service class I make Users, Categories and Messages and add them to linking lists. HTML &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"&gt; &lt;h:head&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"/&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;h:form&gt; &lt;h:outputText value="You have no categories made yet..." rendered="#{empty categoryBean.categories}" /&gt; &lt;h:selectOneMenu value="#{categoryBean.category}" rendered="#{not empty categoryBean.categories}"&gt; &lt;f:selectItems value="#{categoryBean.categories}" /&gt; &lt;f:ajax event="change" render="messages" listener="#{categoryBean.changeCategory}" /&gt; &lt;/h:selectOneMenu&gt; &lt;h:outputText value="This category has no messages yet..." rendered="#{empty categoryBean.messages}" /&gt; &lt;h:selectOneMenu value="#{categoryBean.message}" id="messages" rendered="#{not empty categoryBean.messages}"&gt; &lt;f:selectItems value="#{categoryBean.messages}" /&gt; &lt;/h:selectOneMenu&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/html&gt; Bean: package beans; @Named(value = "categoryBean") @SessionScoped public class CategoryBean implements Serializable { private List&lt;Message&gt; messages; private Category category; private Message message; @Inject private Service service; /** * Creates a new instance of CategoryBean */ public CategoryBean() { category = new Category(); } public void setCategory(Category category) { this.cat…
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/6089924
has answer: http://stackoverflow.com/a/27064910
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/q/27126658
has answer: http://stackoverflow.com/a/27127044
has title: which practise is better? about constructors
answer count: 5
has comment: http://stackoverflow.com/comment/42752881
has body: Which between of the practises is better, style wise? using the keyword "this" or choosing a different parameter name for the parameter of the constructor? case1: public class Student { //variables private String name; //constructor public Student(String name) { this.name = name; } } or case 2: public class Student { //variables private String name; //constructor public Student(String aName) { name = aName; } }
has comment: http://stackoverflow.com/comment/42752867
has answer: http://stackoverflow.com/a/27126755
type: AnsweredQuestion
tagged with: oop
downvote count: 0
accepted answer: http://stackoverflow.com/a/27127096
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27126808
possible better answer: http://stackoverflow.com/a/27126755
type: Question
has comment: http://stackoverflow.com/comment/42753062
has answer: http://stackoverflow.com/a/27127096
has comment: http://stackoverflow.com/comment/42752950
upvote count: 1
has comment: http://stackoverflow.com/comment/42753039
has comment: http://stackoverflow.com/comment/42752875
has comment: http://stackoverflow.com/comment/42752909
favorite count: 0
has answer: http://stackoverflow.com/a/27127026

http://stackoverflow.com/comment/42621816
type: QuestionComment
comment on: http://stackoverflow.com/q/27052384
type: Comment
has text: What's wrong with what you have now?
score: 0

http://stackoverflow.com/q/27070622
tagged with: class
has comment: http://stackoverflow.com/comment/42654349
has body: I am supposed to make a class and a tester class that allows a client to enter his name and current amount of money as well as any deposits or withdrawals that he would like to make. There is probably improper code but I am wondering what I am doing wrong with the code. One of the problems is that it says getBalance is an invalid method declaration. This is the class with the constructors public class BankAccount{ public String name; public double Balance, Withdrawal, Deposit; public BankAccount(double bal, String nm){ name = nm; Balance = bal; } public void setName (String nm){ name = nm; } public String getName(){ return name; } public String toString(){ return "Name: " + name + "\n" + "New Balance : " + getBalance; } public getBalance(){ return Balance; } public double Withdrawal(){ bal = Balance - Withdrawal; } public double Deposit(){ bal = Balance + Deposit; } } This is the tester class import java.util.Scanner; public class BankAccountTester{ public static void main(String [] args){ Scanner reader = new Scanner(System.in); a1 = new BankAccount(); String name; int Balance, Withdrawal, Deposit; System.out.println("What is the name of the bank account holder?"); name = reader.nextLine(); System.out.println("What is your current balance?"); Balance = reader.nextInt(); System.out.println("How much do you wish to deposit?"); Deposit = reader.nextInt(); System.out.println("How much do you with to withdraw?"); Withdrawal = reader.nextInt(); System.out.println("\n" + a1.getName()); } } Would you mind telling me what I am doing wrong and explaining it?
answer count: 3
has comment: http://stackoverflow.com/comment/42653951
has comment: http://stackoverflow.com/comment/42654115
favorite count: 0
tagged with: constructor
has answer: http://stackoverflow.com/a/27070655
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27070651
has comment: http://stackoverflow.com/comment/42654005
upvote count: 2
score: 1
tagged with: java
has title: Can't get my Java class to work
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27071314

http://stackoverflow.com/q/27128799
has title: Multiple Inheritance in Java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27128908
accepted answer: http://stackoverflow.com/a/27129140
has answer: http://stackoverflow.com/a/27128962
has body: Here this program seems to be using multiple inheritance. But Java does not support multiple inheritance, so how is this program working? What is the reason behind this code to compile when the two classes Student and Professor inherits the base class Person? class Person { private String name; private int age; private int val; private int value(int sal) { return sal/100; } public Person(String name, int age, int sal) { this.name = name; this.age = age; val = value(sal); } public void valOverride(int val) { this.val = val; } public String getName() { return name; } public int getAge() { return age; } public int getVal() { return val; } } class Student extends Person { Student(String name, int age, int sal) { super(name,age,sal); } } class Prof extends Person { Prof(String name, int age, int sal) { super(name,age,sal); } } public class AbsDemo { public static void main(String[] args) { Student s = new Student("prasi", 21, 18000); Prof pr = new Prof("david",38,25000); System.out.println(pr.getVal()); pr.valOverride(22); Person p = new Student("prasanna", 22, 12000); System.out.println(s.getName()); System.out.println(p.getName()); System.out.println(s.getVal()); System.out.println(pr.getVal()); } }
has answer: http://stackoverflow.com/a/27129295
tagged with: java
linked to: http://stackoverflow.com/q/6314836
has answer: http://stackoverflow.com/a/27128954
type: Question
upvote count: 0
score: -2
possible better answer: http://stackoverflow.com/a/27128824
has answer: http://stackoverflow.com/a/27128871
tagged with: multiple-inheritance
has answer: http://stackoverflow.com/a/27128824
tagged with: inheritance
linked to: http://stackoverflow.com/q/21824402
has comment: http://stackoverflow.com/comment/42756776
has answer: http://stackoverflow.com/a/27129140
duplicate of: http://stackoverflow.com/q/21824402
has comment: http://stackoverflow.com/comment/42756827
has comment: http://stackoverflow.com/comment/42756877
favorite count: 0
has answer: http://stackoverflow.com/a/27128881
answer count: 9
has answer: http://stackoverflow.com/a/27128847
downvote count: 2

http://stackoverflow.com/a/27137478
score: 0
answers question: http://stackoverflow.com/q/27137259
has body: You don't need to allocate new memory to result. Something like this should work (note some changes I made to your code since there was one more bug in your code) public class blubb { public static void main(String[] args) { char[] array = {'t', 'r', 'e', 'i', 'n', 'o', 'i', 't', 'k', 'n', 'u', 'F'}; char[] result= ArrayReversed(array); System.out.println(result); } public static char[] ArrayReversed(char[] arr) { char [] blubb= new char[arr.length]; for (int i = arr.length-1, j = 0; i &gt;=0; i--, j++) { blubb[i]=arr[j]; } return blubb; } }
type: Answer

http://stackoverflow.com/a/27097890
upvote count: 1
has body: Instead of trying to control it in your LoginFilter, create a new class that extends com.sun.identity.agents.filter.AmAgentFilter and configure that in your web.xml. You class would look something like this: public class CustomFilter extends AmAgentFilter { @Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (InitListener.isIAMEnabled()) { HttpSession session = httpRequest.getSession(); String userType = (String) session.getAttribute(Constant.USER_TYPE); if ("internal".equals(userType)) { super.doFilter(servletRequest, servletResponse, filterChain); } } filterChain.doFilter(servletRequest, servletResponse); } @Override public void destroy() { super.destroy(); } } The super.doFilter() call will only perform the actions in AmAgentFilter if the criteria in that if-block is met; otherwise, we ignore that filter and move on to the next one in the chain. You would configure this filter in your web.xml instead of the AmAgentFilter.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42818991
accepted answer of: http://stackoverflow.com/q/27097322
type: Answer
answers question: http://stackoverflow.com/q/27097322
has comment: http://stackoverflow.com/comment/42819828
score: 1

http://stackoverflow.com/q/27106895
has answer: http://stackoverflow.com/a/27108502
possible better answer: http://stackoverflow.com/a/27106985
has body: For example in this code snippet: c.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { System.out.println("Mouse entry event: " + e + " on button: " + buttonLabel); } }); Is the code block inside the braces of addMouseListener declaring an anonymous class of MouseAdapter() and then the whole thing is called a 'function callback', or am I mixing up the terms? What is the difference?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27106985
has comment: http://stackoverflow.com/comment/42717168
downvote count: 0
has title: Is a function callback in Java also an anonymous class?
accepted answer: http://stackoverflow.com/a/27108502
favorite count: 0
upvote count: 3
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/q/27096599
favorite count: 0
tagged with: roc
tagged with: matlab
upvote count: 0
type: UnansweredQuestion
tagged with: java
has body: I have a two sets set1=[0.333; 0.509; 0.607; 1.172; 0.275; 0.762; 0.850; 0.920; 0.556; -0.046]; set2=[ 0.295; -0.203; -0.097; 0.633; 0.147; 0.356; 0.235; -0.054; -0.024; 0.377; -0.180; 0.512; 0.428; -0.129; 0.094]; How to plot ROC curve for it using any random threshold?
type: Question
score: -2
has title: How to plot ROC curve for the following set?
downvote count: 2
has comment: http://stackoverflow.com/comment/42704742
has answer: http://stackoverflow.com/a/27100307
answer count: 1

http://stackoverflow.com/comment/42774417
type: AnswerComment
comment on: http://stackoverflow.com/a/27137020
type: Comment
has text: String selectQuery= "SELECT " + KEY_TEXT + " FROM " + TABLE_XYZ + " ORDER BY " + KEY_TEXT+ " DESC LIMIT 1"; @Verdolino: thanks
score: 0

http://stackoverflow.com/comment/42781849
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27142406
has text: @EJP: can u elaborate further. Thanx in advance.

http://stackoverflow.com/a/27062433
has body: Adding constants to interfaces is considered an anti-pattern since the primary purpose of an interface is to define behavior contracts. Use either an enum or access them directly since they are public.
downvote count: 0
has comment: http://stackoverflow.com/comment/42639429
answers question: http://stackoverflow.com/q/27062311
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/42721246
type: QuestionComment
has text: It wasn't before and it still isn't. Now I don't see the roles of the users.
score: 0
comment on: http://stackoverflow.com/q/27108992
type: Comment

http://stackoverflow.com/a/27028835
has comment: http://stackoverflow.com/comment/42581959
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27028631
has comment: http://stackoverflow.com/comment/42581882
has comment: http://stackoverflow.com/comment/42581261
answers question: http://stackoverflow.com/q/27028631
has comment: http://stackoverflow.com/comment/42580577
type: Answer
has comment: http://stackoverflow.com/comment/42581398
has comment: http://stackoverflow.com/comment/42581781
has comment: http://stackoverflow.com/comment/42581163
has body: Let us look at showCountries method: public boolean showCountries(String paramCountry, int where) { //.... return false; } I removed every line, that does not contain a return statement. As you can see, you always return false no matter if the searched element was found or not. Therefore this loop: while (error == false) { //... } is like an infinite loop. Change the code in your showCountries method to return true, it the country was found. And consider changing the variable name error to something else. error == false sounds like "everything was ok", but this is not the case here. If I understand your code correctly, you can change this: else if (paramCountry.equals(HashTable[location].substring(0,length))) { System.out.println("The Hash Table Index is " + location + " " + HashTable[location]); break; } to: else if (paramCountry.equals(HashTable[location].substring(0,length))) { System.out.println("The Hash Table Index is " + location + " " + HashTable[location]); return true; } Edit: Another error-prone point is right here: int length = paramCountry.length()-1; while (!(paramCountry.equals(HashTable[location].substring(0,length)))) { //... You're cutting off the last character due to the usage of -1. A small example: paramCountry = "Eng"; HashTable[0] = "England"; int length = paramCountry.length()-1; // 2 (paramCountry.length() is 3) And this are the results with the above values: HashTable[0].substring(0,length)) // "En" paramCountry.equals(HashTable[0].substring(0, length)) // "Eng".equals("En") -&gt; false So, you can remove that -1 or get rid of that substring and use contains instead. Edit 2: So, after your edit use contains instead of substring you only have one error left (the last one I cuurently see ): while (!(HashTable[location].substring(0, length).contains(paramCountry))) { // ... } return false; Before you're calling the method showCountries you're calculating the possible position by calling H.toASCII(UserChoice);. This position is given to the me…
has comment: http://stackoverflow.com/comment/42580529
has comment: http://stackoverflow.com/comment/42581575
score: 1
has comment: http://stackoverflow.com/comment/42580752
has comment: http://stackoverflow.com/comment/42582067
has comment: http://stackoverflow.com/comment/42581374
has comment: http://stackoverflow.com/comment/42581136
upvote count: 1
has comment: http://stackoverflow.com/comment/42581339
has comment: http://stackoverflow.com/comment/42581978
has comment: http://stackoverflow.com/comment/42581031
has comment: http://stackoverflow.com/comment/42580660

http://stackoverflow.com/comment/42672311
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27081440
type: Comment
has text: try `new File("survey.txt")`, i.e add the extension.

http://stackoverflow.com/a/27103593
score: 3
downvote count: 0
has body: I believe the original reason was that the methods were meant to be 'compatible' with the compareTo() method on the Comparable interface which specifies an Object argument (although this was obviously improved with the introduction of the generics syntax). Essentially before() is the same as compareTo(..) &lt; 0 - and uses this to actually do the comparison internally. Basically, it's a bad legacy thing though. Hopefully we can all move to the Java 8 libraries now and pretend Calendar never existed.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/27103383

http://stackoverflow.com/a/27103297
score: 4
has comment: http://stackoverflow.com/comment/76937100
has body: Don't provide priority and depends on together, you can group the tests. You can do it like : @Test(priority = 1, groups = { "qty" }) public void increaseQty() { System.out.println("in increase qty"); } @Test(dependsOnMethods = { "increaseQty" }, groups = { "qty" }) public void decreaseQty() { System.out.println("in decrease qty"); } @Test(dependsOnGroups = { "qty" }) public void removeFromCart() throws Exception { System.out.println("remove qty"); } @Test(dependsOnMethods = { "removeFromCart" }) public void emptyCart() throws InterruptedException { System.out.println("empty Cart"); } Edit: Another work around is to change your testng xml to have desciption like: &lt;methods&gt; &lt;include name="increaseQty"/&gt; &lt;include name="decreaseQty"/&gt; &lt;include name="removeFromCart"/&gt; &lt;include name="emptyCart"/&gt; &lt;/methods&gt; so testng will execute it in this manner only.
upvote count: 4
has comment: http://stackoverflow.com/comment/42740959
has comment: http://stackoverflow.com/comment/42741833
has comment: http://stackoverflow.com/comment/42715176
accepted answer of: http://stackoverflow.com/q/27103047
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27103047
type: Answer
has comment: http://stackoverflow.com/comment/42823065

poker
tags question: http://stackoverflow.com/q/27111676
tag name: poker
type: Tag

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/27031476
tags question: http://stackoverflow.com/q/27115636
tags question: http://stackoverflow.com/q/27126742
tags question: http://stackoverflow.com/q/26997231
tags question: http://stackoverflow.com/q/27118042
tags question: http://stackoverflow.com/q/27009038
tags question: http://stackoverflow.com/q/27027826
tags question: http://stackoverflow.com/q/27092301
tags question: http://stackoverflow.com/q/27105279
tags question: http://stackoverflow.com/q/27089410
tags question: http://stackoverflow.com/q/27046574
tags question: http://stackoverflow.com/q/27038632
tags question: http://stackoverflow.com/q/26997331
tags question: http://stackoverflow.com/q/27097661
tags question: http://stackoverflow.com/q/27016023
tags question: http://stackoverflow.com/q/27034562
tags question: http://stackoverflow.com/q/27085592
tags question: http://stackoverflow.com/q/27002516
type: Tag
tags question: http://stackoverflow.com/q/27018734
tags question: http://stackoverflow.com/q/27132898
tags question: http://stackoverflow.com/q/26997196
tags question: http://stackoverflow.com/q/27053702
tags question: http://stackoverflow.com/q/27144781
tags question: http://stackoverflow.com/q/27068785
tags question: http://stackoverflow.com/q/27150711
tags question: http://stackoverflow.com/q/27089945
tags question: http://stackoverflow.com/q/27086888
tags question: http://stackoverflow.com/q/27096414
tags question: http://stackoverflow.com/q/26992786
tags question: http://stackoverflow.com/q/27129486
tags question: http://stackoverflow.com/q/27148040
tags question: http://stackoverflow.com/q/27045009
tags question: http://stackoverflow.com/q/27051082
tags question: http://stackoverflow.com/q/27020709
tags question: http://stackoverflow.com/q/27035801
tags question: http://stackoverflow.com/q/27148130
tags question: http://stackoverflow.com/q/27017476
tags question: http://stackoverflow.com/q/26999033
tags question: http://stackoverflow.com/q/27082708
tags question: http://stackoverflow.com/q/27115309
tags question: http://stackoverflow.com/q/27147537
tags question: http://stackoverflow.com/q/27035724
tags question: http://stackoverflow.com/q/27071178
tags question: http://stackoverflow.com/q/27093387
tags question: http://stackoverflow.com/q/27125669
tags question: http://stackoverflow.com/q/27022741
tags question: http://stackoverflow.com/q/27055322
tags question: http://stackoverflow.com/q/27061901
tags question: http://stackoverflow.com/q/27098708
tags question: http://stackoverflow.com/q/27001526
tags question: http://stackoverflow.com/q/27143936
tags question: http://stackoverflow.com/q/27013701
tags question: http://stackoverflow.com/q/27022423
tags question: http://stackoverflow.com/q/27041793
tags question: http://stackoverflow.com/q/27148642
tags question: http://stackoverflow.com/q/27059108
tags question: http://stackoverflow.com/q/27103877
tags question: http://stackoverflow.com/q/27141420
tags question: http://stackoverflow.com/q/27133738
tags question: http://stackoverflow.com/q/27057436
tags question: http://stackoverflow.com/q/27078584
tags question: http://stackoverflow.com/q/27128578
tag name: xml
tags question: http://stackoverflow.com/q/27139659
tags question: http://stackoverflow.com/q/27011776
tags question: http://stackoverflow.com/q/27114791
tags question: http://stackoverflow.com/q/27061467
tags question: http://stackoverflow.com/q/27039514
tags question: http://stackoverflow.com/q/27030837
tags question: http://stackoverflow.com/q/27104985
tags question: http://stackoverflow.com/q/27142831
tags question: http://stackoverflow.com/q/27009056
tags question: http://stackoverflow.com/q/27120617
tags question: http://stackoverflow.com/q/27014038
tags question: http://stackoverflow.com/q/27120657
tags question: http://stackoverflow.com/q/27006201
tags question: http://stackoverflow.com/q/27007917
tags question: http://stackoverflow.com/q/27015895
tags question: http://stackoverflow.com/q/27046621

http://stackoverflow.com/q/27070231
tagged with: java
has answer: http://stackoverflow.com/a/27070418
type: Question
has answer: http://stackoverflow.com/a/27070329
has title: Conway's game of life out of boundaries when counting neighbours - java
downvote count: 0
has comment: http://stackoverflow.com/comment/42653318
answer count: 3
has answer: http://stackoverflow.com/a/27070708
score: 1
accepted answer: http://stackoverflow.com/a/27070329
favorite count: 0
has body: I am trying to create the game of life in java but I have difficulty writing the part that checks the number of neighbours. I understand that the problem is when the program gets to the edges of the grid it won't work because the indexes are greater/smaller than the bounds of the array. So the problem is in my Neighbours(). I am not sure how to fix it, I tried expanding the if statements and I also tried putting the whole set of statements in a while loop. The program seems to be working unless there are live cells at the edges of the grid. Any suggestions on this? Thanks in advance. import java.io.*; import java.util.Scanner; public class LifeGrid { public int[][] grid; public int[][] newgrid; public int getX() { return grid[0].length; } public int getY() { return grid.length; } public int getcurrentgen() { return currentgen; } public int currentgen=0; // modify neighbours out of boundary problem. int Neighbours(int x, int y) { int neighbours = 0; if (grid[y][x-1] == 1) { neighbours++; } if (grid[y][x+1] ==1) { neighbours++; } if (grid[y+1][x-1] ==1) { neighbours++; } if (grid[y+1][x+1] ==1) { neighbours++; } if (grid[y+1][x] ==1) { neighbours++; } if (grid[y-1][x-1] ==1) { neighbours++; } if (grid[y-1][x+1] ==1) { neighbours++; } if (grid[y-1][x] ==1) { neighbours++; } return neighbours; } public LifeGrid(int x, int y, String filename) { grid = new int [y][x]; newgrid = new int[y][x]; File input = new File(filename); Scanner sc; try { sc = new Scanner(input); } catch (FileNotFoundException e) { System.out.println("File error"); return; } for ( y=0; y&lt; getY(); y++) { String line = sc.nextLine(); for( x = 0; x &lt; getX(); x++) { if (line.charAt(x) == '*') { grid[y][x] = 1; } else { grid[y][x] = 0; } } } } public void run() { show(); while(getcurrentgen() &lt; 3) { setup(); grid = newgrid; currentgen++; show(); } } public void setup() { for (int y = 0; y &lt; getY(); y++) { for (int x = 0;x &lt; getX();x++) { if (grid[y][x]== 1) { if (Neighbours(x,y) &lt; 2) { ne…
possible better answer: http://stackoverflow.com/a/27070708
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/42705561
type: QuestionComment
type: Comment
has text: Yes please. `The R.id.messagesList refeers to the listview`. That looks not ok. The ArrayAdapter does not need such.
comment on: http://stackoverflow.com/q/27093830
score: 1

http://stackoverflow.com/q/27038579
has answer: http://stackoverflow.com/a/27038823
tagged with: java
accepted answer: http://stackoverflow.com/a/27038823
type: Question
answer count: 1
score: 0
has title: How to solve late file creation?
tagged with: linux
linked to: http://stackoverflow.com/q/20592397
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42597306
has body: I am developing java program. In program I am calling shell script and creating files from shell scipt. When I am trying to access created file it has not been created. so It creates file late. so how to overcome this problem?
type: AnsweredQuestion

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/27094151
type: Tag

http://stackoverflow.com/comment/42747415
has text: without more information it is impossible to give you a definite answer - but the bottom line is generally that one (or more) resource is creating a bottleneck, for example: a file that is being read or a synchronized method or a database access or ...
type: Comment
comment on: http://stackoverflow.com/q/27123327
type: QuestionComment
score: 3

http://stackoverflow.com/q/27109944
has comment: http://stackoverflow.com/comment/42723015
tagged with: performance-testing
accepted answer: http://stackoverflow.com/a/27110556
has comment: http://stackoverflow.com/comment/42722946
has comment: http://stackoverflow.com/comment/42722969
has body: I can't understand why iterating multiple time over a same array with Stream api result in such a performance! see the code below. public class WhyIsDifferent { public static void main(String[] args) { int[] values = getArray(); Iterate(values, 598, 600); // 70 ms Iterate(values, 200, 202); // 0 ms Iterate(values, 700, 702); // 0 ms Iterate(values, 300, 310); // 1 ms } public static void Iterate(int[] values, int from, int to) { long start = System.currentTimeMillis(); IntStream.of(values).filter(i -&gt; i &lt; to &amp;&amp; i &gt; from) .forEach(i -&gt; System.out.println(i) // do a something ); System.out.println("Time:" + (System.currentTimeMillis() - start)); } public static int[] getArray() { int[] values = new int[1000]; for (int i = 0; i &lt; 1000; i++) { values[i] = i; } return values; } } for sure JVM optimizes the code but i don't know how this happening?? It is amazing! do you have any clue why this happening? -- I'm testing on Ubuntu 14.04/ / Oracle jdk / intel cpu.
has comment: http://stackoverflow.com/comment/42723049
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/42726104
type: AnsweredQuestion
tagged with: performance
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/42722937
has answer: http://stackoverflow.com/a/27110556
has comment: http://stackoverflow.com/comment/42722856
type: Question
has comment: http://stackoverflow.com/comment/42726629
score: 5
answer count: 1
has title: Puzzled with Java8 Stream performance
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/27119049
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/42751745
type: UnansweredQuestion
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/42741211
tagged with: java
has body: I am trying to create a framework to test cross-platform mobile web apps (non native). Here is how my code is setup: Test Class: public class TestSuite extends MobileLibrary{ @BeforeClass public static void setUpTests() throws Exception { setUp(); } @AfterClass public static void cleanUpTests() throws Exception { driver.quit(); } @Test public void validateSignIn() throws Exception { String username = "testtest"; String password = "testtest"; SignInMobile(driver,username,password); assertTrue(true); } @Test public void randomTests() throws Exception dbcSelector(driver,"test"); assertTrue(true); } } Base Class public class SetupBase { protected static AppiumDriver driver; protected static AppiumPlatform appiumPlatform; protected static DeviceSize deviceSize; protected static DeviceName deviceName; protected static String deviceID; protected static DesiredCapabilities capabilities; protected static enum AppiumPlatform{ DESKTOP,IOS,ANDROID } protected static enum DeviceSize{ SMALL,MEDIUM,LARGE } protected static enum DeviceName{ NEXUS7,S5,IPHONE5S } public static void setUp() throws MalformedURLException /*throws Exception*/ { String deviceNameEnv = System.getenv("DEVICENAME"); switch(deviceNameEnv){ //sets devicename here } //sets platform here if(deviceName==DeviceName.NEXUS7 || deviceName==DeviceName.S5) appiumPlatform = AppiumPlatform.ANDROID; else if(deviceName==DeviceName.IPHONE5S) appiumPlatform = AppiumPlatform.IOS; else appiumPlatform = AppiumPlatform.DESKTOP; switch(deviceName){ //sets size here } capabilities = new DesiredCapabilities(); capabilities.setCapability("deviceName",deviceID); if(appiumPlatform==AppiumPlatform.ANDROID){ capabilities.setCapability("platformName","Android"); capabilities.setCapability("browserName","Chrome"); driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); } else if(appiumPlatform==AppiumPlatform.IOS){ capabilities.setCapability("platformName","iOS"); capabilities.setCapability("browserName","Safari…
type: Question
tagged with: appium
has title: My appium's second test keeps getting a java null point exception
has answer: http://stackoverflow.com/a/27130888
score: 0

http://stackoverflow.com/a/27030076
type: Answer
has body: As already stated above, you should add a piece of code that updates the value of your JLabel wherever you deduct the credits.(For example in the ActionEvent of your spin button.) It would look something like this: credits.setText("CREDITS: " + noOfCredits + " credits");
answers question: http://stackoverflow.com/q/27029861
score: 0

http://stackoverflow.com/q/27062699
has answer: http://stackoverflow.com/a/27062852
has answer: http://stackoverflow.com/a/27063060
has body: I have to read in emails for a particular user. At the moment I'm reading in the email removing all the noise words and just getting keywords and writing these keywords to a textfile user001.txt . The more emails I read the larger the textfile gets. Then I read the user001.txt and get the top 10 most used words for that user. Because the files could get very big I was thinking the I would write to a file the word and the occurrence {apple}{3}. Then for the subsequent emails I would have to read the user001.txt and for example if the word apple appears 5 times in a subsequent email I would have to increase apple in the text file by 5 so it would now read {apple}{8}. What is the best structure for the this particular problem ? What is the best approach to this problem as a whole ?
has comment: http://stackoverflow.com/comment/42639512
has comment: http://stackoverflow.com/comment/42639649
score: 0
answer count: 3
tagged with: file-io
favorite count: 0
has comment: http://stackoverflow.com/comment/42639438
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42639653
tagged with: text-files
has title: What is the best structure for updating the keywords of emails?
has comment: http://stackoverflow.com/comment/42639564
has answer: http://stackoverflow.com/a/27064417
tagged with: java
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/comment/42713361
score: 0
has text: You are correct. It is `Map<String, Integer>`. Id's are numeric.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27103957

asynchronous
tags question: http://stackoverflow.com/q/27131720
tags question: http://stackoverflow.com/q/27038583
tags question: http://stackoverflow.com/q/27110252
type: Tag
tags question: http://stackoverflow.com/q/27066001
tags question: http://stackoverflow.com/q/27032420
tag name: asynchronous
tags question: http://stackoverflow.com/q/27037362
tags question: http://stackoverflow.com/q/27062819
tags question: http://stackoverflow.com/q/27067417
tags question: http://stackoverflow.com/q/27123154
tags question: http://stackoverflow.com/q/27128737
tags question: http://stackoverflow.com/q/27116889
tags question: http://stackoverflow.com/q/27026267

http://stackoverflow.com/a/27028083
downvote count: 0
has body: (1) URL is invalid (has extra scheme) (2) There are &lt;tr&gt;s with no &lt;td&gt;s (ex. headers) :::: doc = Jsoup.connect("http://www.bloomberg.com/markets/stocks/movers/ftse-100/").get(); for (Element table : doc .select("table[class=index_members_table dual_border_data_table market_sortable_table alt_rows_stat_table]")) { for (Element row : table.select("tr")) { Elements tds = row.select("td"); if (tds.isEmpty()) { // Header &lt;tr&gt; with only &lt;th&gt;s continue; } ::::
type: Answer
answers question: http://stackoverflow.com/q/27027626
upvote count: 1
score: 1

http://stackoverflow.com/q/27032214
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27053567
type: Question
has comment: http://stackoverflow.com/comment/42586161
has title: Why the Scan RS spend a long time when I use G1GC
linked to: http://stackoverflow.com/q/17614754
tagged with: garbage-collection
upvote count: 1
has body: I'm using java1.7.0_67 and run my app with these: -Xms8g -Xmx8g -XX:PermSize=128M -XX:MaxPermSize=128M -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:log/gc.log -jar ***.jar below is my gc log: 3245.340: [GC pause (young), 0.9650490 secs]&lt;br /&gt; [Parallel Time: 953.5 ms, GC Workers: 4]&lt;br /&gt; [GC Worker Start (ms): Min: 3245340.8, Avg: 3245343.0, Max: 3245348.7, Diff: 7.9]&lt;br /&gt; [Ext Root Scanning (ms): Min: 0.0, Avg: 4.8, Max: 7.2, Diff: 7.2, Sum: 19.1]&lt;br /&gt; [Update RS (ms): Min: 7.9, Avg: 20.1, Max: 39.9, Diff: 32.0, Sum: 80.3]&lt;br /&gt; [Processed Buffers: Min: 10, Avg: 19.5, Max: 35, Diff: 25, Sum: 78]&lt;br /&gt; [Scan RS (ms): Min: 669.9, Avg: 690.4, Max: 702.4, Diff: 32.5, Sum: 2761.6]&lt;br /&gt; [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]&lt;br /&gt; [Object Copy (ms): Min: 235.3, Avg: 235.9, Max: 236.4, Diff: 1.0, Sum: 943.5]&lt;br /&gt; [Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]&lt;br /&gt; [GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]&lt;br /&gt; [GC Worker Total (ms): Min: 945.5, Avg: 951.2, Max: 953.4, Diff: 7.9, Sum: 3804.6]&lt;br /&gt; [GC Worker End (ms): Min: 3246294.2, Avg: 3246294.2, Max: 3246294.2, Diff: 0.0]&lt;br /&gt; [Code Root Fixup: 0.1 ms]&lt;br /&gt; [Code Root Migration: 0.0 ms]&lt;br /&gt; [Clear CT: 0.4 ms]&lt;br /&gt; [Other: 11.0 ms]&lt;br /&gt; [Choose CSet: 0.0 ms]&lt;br /&gt; [Ref Proc: 1.4 ms]&lt;br /&gt; [Ref Enq: 0.0 ms]&lt;br /&gt; [Free CSet: 1.7 ms]&lt;br /&gt; [Eden: 356.0M(356.0M)-&gt;0.0B(356.0M) Survivors: 52.0M-&gt;52.0M Heap: 1682.0M(8192.0M)-&gt;1388.0M(8192.0M)]&lt;br /&gt; [Times: user=3.74 sys=0.02, real=0.96 secs] &lt;br /&gt; 3606.407: [GC pause (young), 0.5226400 secs]&lt;br /&gt; [Parallel Time: 511.1 ms, GC Workers: 4]&lt;br /&gt; [GC Worker Start (ms): Min: 3606407.5, Avg: 3606407.5, Max: 3606407.6, Diff: 0.0]&lt;br /&gt; [Ext…
answer count: 1
has comment: http://stackoverflow.com/comment/42586316
has answer: http://stackoverflow.com/a/27053567
tagged with: java
type: AnsweredQuestion
tagged with: g1gc

http://stackoverflow.com/a/27033153
type: Answer
has body: If you are using java8 you can filter the list using stream API instead of iterating over it by hand. List&lt;Villager&gt; villagersWithTask = tasked.stream().filter(e -&gt; e.hasTask()).collect(Collectors.toList());
score: 0
answers question: http://stackoverflow.com/q/27033028

http://stackoverflow.com/q/27134554
answer count: 2
tagged with: jsp
has body: I need to implement some basic dropdown using jsp and java, but I can't find more info how to do that. So I never write something using JSP and when I didnt find nothing that help the last options for me was to ask. I want to get the selected value and when click the button to send the value to anoher .jsp file ("selector.jsp in my case") Please folks help me with some easy solution. p.P.: Sorry for my english (: index.jsp <% Test t = new Test(); t.getList().add("a"); t.getList().add("b"); t.getList().add("c"); for(int i=0; i < t.getList().size(); i++){ %> <Option value="<%t.getList().get(i);%>"><%=t.getList().get(i)%> <%}%> selector.jsp Insert title here You selected: <% request.getParameter("select"); request.getParameterValues("select"); %>
has answer: http://stackoverflow.com/a/27134977
type: UnansweredQuestion
tagged with: select
has title: Pass selected value from dropdown using JSP
type: Question
has answer: http://stackoverflow.com/a/27138529
tagged with: java
score: 0

http://stackoverflow.com/a/27066403
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/27065680
downvote count: 1
has body: Apparently missing this file: game/pokemon_tileset_from_public_tiles_by_chaoticcherrycake-d5xdb0y.png read the line error: com.badlogic.gdx.utils.GdxRuntimeException: Could not load file: map for game / pokemon_tileset_from_public_tiles_by_chaoticcherrycake-d5xdb0y.png
type: Answer

http://stackoverflow.com/a/27086870
score: 1
answers question: http://stackoverflow.com/q/27086845
has comment: http://stackoverflow.com/comment/42686393
downvote count: 0
has comment: http://stackoverflow.com/comment/42686402
type: Answer
upvote count: 1
has body: No, Math.random() will never return 1. It has an inclusive lower bound of 0, but an exclusive upper bound of 1.0. From the documentation - emphasis mine: Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Now given that this is floating point maths, you still need to consider whether there's some value less than 1 such that when multiplied by 6, the closest representable double is 6 rather than some value just below 6... but I don't believe that's a problem here. It would still be clearer to use java.util.Random though.... private static final int SIDES = 6; public static void main(String[] args) { Random random = new Random(); int a = random.nextInt(SIDES) + 1; int b = random.nextInt(SIDES) + 1; int sum = a + b; System.out.println(sum); }

http://stackoverflow.com/comment/42721348
score: 0
type: Comment
has text: is there a limit to the levels of nesting?
type: QuestionComment
comment on: http://stackoverflow.com/q/27108486

http://stackoverflow.com/q/27125272
upvote count: 2
has body: I'm trying to generate java service code with apache-cxf wsdl2java tool for wsdl: https://raw.githubusercontent.com/mpromonet/spring-onvif/master/src/main/resources/wsdl/remotediscovery.wsdl MBA-Anton:bin asmirnov$ ./wsdl2java "https://raw.githubusercontent.com/mpromonet/spring-onvif/master/src/main/resources/wsdl/remotediscovery.wsdl" 25.11.2014 16:16:49 org.apache.cxf.configuration.jsse.SSLUtils getDefaultKeyStoreManagers WARNING: Default key managers cannot be initialized: /Users/asmirnov/.keystore (No such file or directory) [Fatal Error] addressing:2:2: The markup in the document following the root element must be well-formed. WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition https://raw.githubusercontent.com/mpromonet/spring-onvif/master/src/main/resources/wsdl/remotediscovery.wsdl: WSDLException (at /wsdl:definitions/wsdl:types/xs:schema/xs:schema): faultCode=PARSER_ERROR: Problem parsing 'http://schemas.xmlsoap.org/ws/2004/08/addressing'.: org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed. Why is it trying to create wsdl definition instead of generating java code? How can i fix it? Verbose log: MBA-Anton:bin asmirnov$ ./wsdl2java -V "https://raw.githubusercontent.com/mpromonet/spring-onvif/master/src/main/resources/wsdl/remotediscovery.wsdl" Loading FrontEnd jaxws ... Loading DataBinding jaxb ... wsdl2java -V https://raw.githubusercontent.com/mpromonet/spring-onvif/master/src/main/resources/wsdl/remotediscovery.wsdl wsdl2java - Apache CXF 2.7.13 25.11.2014 16:18:39 org.apache.cxf.configuration.jsse.SSLUtils getDefaultKeyStoreManagers WARNING: Default key managers cannot be initialized: /Users/asmirnov/.keystore (No such file or directory) [Fatal Error] addressing:2:2: The markup in the document following the root element must be well-formed. WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition https://raw.githubusercontent…
tagged with: web-services
has answer: http://stackoverflow.com/a/27125589
type: AnsweredQuestion
score: 2
tagged with: cxf
has answer: http://stackoverflow.com/a/27125773
tagged with: java
accepted answer: http://stackoverflow.com/a/27125773
has title: wsdl2java error: "Fail to create wsdl definition" while generating java code
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/27125419
answer count: 3
tagged with: wsdl
has answer: http://stackoverflow.com/a/27125419
favorite count: 0

http://stackoverflow.com/a/27101268
answers question: http://stackoverflow.com/q/27099672
has comment: http://stackoverflow.com/comment/42726684
has body: The problem you have is all about namespaces; your element is in default namespace so you need to define that namespace in your query. xquery version "3.0"; declare default element namespace "http://schemas.openehr.org/v1"; for $n in fn:collection('/db/apps/compositions')//data return fn:data($n/name/value) read more in e.g. the tech wiki In general I'd recommend to test queries in the the excellent eXide IDE first before merging them into code. The IDE provides you fast feedback on query results so you can play a bit with your queries. Note that writing *:data might slowdown queries on large datasets.
score: 4
has comment: http://stackoverflow.com/comment/42718903
upvote count: 4
has comment: http://stackoverflow.com/comment/42717794
downvote count: 0
type: Answer

http://stackoverflow.com/q/27037035
has answer: http://stackoverflow.com/a/27037253
tagged with: android
has comment: http://stackoverflow.com/comment/42594332
has comment: http://stackoverflow.com/comment/42594248
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42594534
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/42594303
accepted answer: http://stackoverflow.com/a/27037253
type: Question
has comment: http://stackoverflow.com/comment/42594260
has comment: http://stackoverflow.com/comment/42605425
linked to: http://stackoverflow.com/q/4517653
has title: restart and IndexOutOfBoundsException strange reason, How can I avoid this in the future?
has comment: http://stackoverflow.com/comment/42594280
tagged with: arraylist
score: 0
has body: In 99% of cases working properly, sometimes as the application is minimized and I reopen it gets exception: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsException for (int i = 0; i &lt; list.size(); ++i) { description.setText(list.get(i).getStreet()); //this line Exception } I run this in onStart() method: What is the reason? How can I avoid this in the future?
has comment: http://stackoverflow.com/comment/42594243
has comment: http://stackoverflow.com/comment/42604191
answer count: 1

http://stackoverflow.com/comment/42683861
score: 0
type: QuestionComment
type: Comment
has text: So, it's possible to be implemented without low-level transaction, right?
comment on: http://stackoverflow.com/q/27088038

http://stackoverflow.com/a/32107927
upvote count: 1
answers question: http://stackoverflow.com/q/26999663
score: 1
has body: Here is a way to initialize a map using variable declarations when the keys and values are Strings. First declare a two dimensional array of Strings. Use the curly bracket notation to initialize the array, such as final static String [][] animalEatsArray = {{"mouse", "cheese"}, {"dog", "bone"}}; Then declare and initialize the map: final static Map animalEatsMap = buildMapFromStringArray(animalEatsArray ); You need a method like this somewhere: public static Map&lt;String, String&gt; buildMapFromStringArray( String [] [] stringArray) { if (stringArray == null ) { throw new IllegalArgumentException("buildMapFromStringArray: stringArray is null"); } Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;( 1 + (2 * stringArray.length) ); for ( String[] keyValue : stringArray) { map.put(keyValue[0], keyValue[1]); } return map; }
downvote count: 0
type: Answer

http://stackoverflow.com/a/27038585
upvote count: 1
has comment: http://stackoverflow.com/comment/42596942
has body: You can try something like that : int[] values = { 1, 2, 5, 4, 6, 7, 55, 11, 44, 71, 54, 1001, 111, 222 }; for (int i = 0; i &lt; values.length; i++) { boolean printed = false; for (int j = 0; j &lt; values.length; j++) { int duplicate = values[i]; for (int pow = 1 + (int) Math.log10(values[i]); pow &lt;= (int) Math.log10(values[j]); pow++) { duplicate += values[i] * (int) Math.pow(10, pow); } if (values[j] != values[i] &amp;&amp; values[j] == duplicate) { if (!printed) { System.out.println(values[i]); printed = true; } System.out.println(values[j]); } } } You can certainly have a better complexity if you sort your array.
has comment: http://stackoverflow.com/comment/42598162
answers question: http://stackoverflow.com/q/27038049
downvote count: 0
has comment: http://stackoverflow.com/comment/42630091
has comment: http://stackoverflow.com/comment/42597509
has comment: http://stackoverflow.com/comment/42597149
type: Answer
has comment: http://stackoverflow.com/comment/42597316
score: 1

http://stackoverflow.com/q/27072499
has answer: http://stackoverflow.com/a/27072548
tagged with: java
score: 0
answer count: 2
has body: I've got this code: @Override public int compareTo(LargeInt passedIn)// { if(passedIn == null) { throw new RuntimeException("NullExceptionError"); } int ewu = 0; int avs = 0; if(this.myArray.length != passedIn.myArray.length) { return this.myArray.length - passedIn.myArray.length; } for(this.myArray.length == passedIn.myArray.length) { } for(int x = 0; x &lt; this.myArray.length; x++) { ewu += this.myArray[x]; } for(int x = 0; x &lt; passedIn.myArray.length; x++) { avs += passedIn.myArray[x]; } return ewu - avs; } My goal is, under this line: for(this.myArray.length == passedIn.myArray.length) I want to If the lengths are equal, go through the array until a value that is different is found. Then subtract those two values and return. How might I go about doing this?
has comment: http://stackoverflow.com/comment/42657294
has comment: http://stackoverflow.com/comment/42657301
has comment: http://stackoverflow.com/comment/42657259
has title: Checking If Values in Array Are Different Java
has answer: http://stackoverflow.com/a/27072632
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/46862020
has text: I just write my own class. It only needs to be a few lines long to reliably provide the same functionality as Java's `assert` command. A slightly more sophisticated class that uses assertion objects can be found at http://www.engr.mun.ca/~theo/Misc/monitors/monitors.html .
comment on: http://stackoverflow.com/q/27047314
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42778154
type: Comment
comment on: http://stackoverflow.com/q/27140250
score: 0
type: QuestionComment
has text: 1 should also count. Sorry that was a typo.

http://stackoverflow.com/comment/42781007
score: 0
comment on: http://stackoverflow.com/q/27141806
type: Comment
type: QuestionComment
has text: You can just bind all you jars into a single jar. What IDE you are using? use netbeans or eclipse so it will handle those things.

http://stackoverflow.com/a/27009355
has comment: http://stackoverflow.com/comment/42546619
type: Answer
has body: Make y as float if you want to use %f float y = 5 * (x - 32) / 9; print.printf(x + " F = " + "%.1f", y ).print("C");
answers question: http://stackoverflow.com/q/27009284
score: 0

http://stackoverflow.com/a/27002414
answers question: http://stackoverflow.com/q/27002032
downvote count: 0
has comment: http://stackoverflow.com/comment/42554303
type: Answer
score: 1
has body: I would get rid of the loops all together, and use StringUtils. private static void draw(int x, int y) { System.out.print(Stringutils.repeat("+", x)); System.out.println(StringUtils.repeat("-", y)); }
upvote count: 1

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/27068128
tags question: http://stackoverflow.com/q/27090782
type: Tag
tags question: http://stackoverflow.com/q/27015619

http://stackoverflow.com/a/27047316
score: 2
has body: Use a RollingFile 1 with TimeBasedTriggeringPolicy 2. e.g.: <PatternLayout pattern="%d %p %c{1.} [%t] %m%n" /> <TimeBasedTriggeringPolicy /> See more in Apache Log4j 2 User's Guide [PDF]. Notes org.apache.logging.log4j.core.appender.RollingFileAppender org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy
answers question: http://stackoverflow.com/q/27043492
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27043492
upvote count: 2
type: Answer

http://stackoverflow.com/comment/42689016
comment on: http://stackoverflow.com/a/27090993
score: 0
type: AnswerComment
has text: For unidirectional, I have seen some websites using dotted arrow with the same arrowhead as yours. Does it mean the same thing as your diagram above?
type: Comment

nio
tags question: http://stackoverflow.com/q/27133007
tags question: http://stackoverflow.com/q/27112084
tags question: http://stackoverflow.com/q/27074054
tags question: http://stackoverflow.com/q/27069447
tag name: nio
type: Tag
tags question: http://stackoverflow.com/q/27016543
tags question: http://stackoverflow.com/q/27109365
tags question: http://stackoverflow.com/q/27039042
tags question: http://stackoverflow.com/q/27134465
tags question: http://stackoverflow.com/q/27144953

http://stackoverflow.com/comment/42545504
type: QuestionComment
score: 0
has text: Please post some example values for usage of your program so we can test it properly.
comment on: http://stackoverflow.com/q/27008335
type: Comment

http://stackoverflow.com/comment/42681803
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27075974
score: 0
has text: Hi codemonkey, thanks for the reply unfortunately I cant attach anything to stackoverflow as of yet because i need "10 points" i believe. im not at home right now as im out on avacation When i get home ill place a screenshot somewhere and then copy the link here.

http://stackoverflow.com/a/27150984
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27149415
has comment: http://stackoverflow.com/comment/42813427
has body: You have several topics in your question: What are the benefits of OAuth2 for an internal API exposed on the Internet? How should I manage tokens? How can a user gain access via multiple devices? How can a user have offline access? I discuss these questions below. Oauth2 OAuth2 offers a standardized protocol for several authentication schemes of varying complexity. One of the most complex use cases is the 'Authorization Code Grant' flow which allows a resource owner (user) to grant specific access to a client application via an intermediary, the Authorization server. This is what happens when you 'login using google'. The advantage of using OAuth2 over a homebrew solution is that the protocol is clear to all parties and less likely to contain fundamental flaws. A drawback can be that the protocol is not that flexible so some custom scenario's might be hard to support within the boundaries of OAuth2. If you don't have the immediate need for any of the typical OAuth2 scenario's (or a stakeholder demanding use of OAuth2) then I suggest not starting off with it, but to implement a simple token scheme yourself. Managing tokens The most common way to manage API access is by using tokens. A token is generated when the user logs in, typically with username and password over HTTPS. The token is persisted on the server and must be supplied by the app in each request. This is similar to the session ID used in web applications which is automatically generated and handled in-memory by the application container on the server and passed via a cookie or request parameter. An API token is typically handled by the security layer of the application itself, persisted in the database and passed via the 'Authorization' header. A token should have an expiration date. One should decide on the best interval for this and whether token renewal is automatic (each time the user accesses the API) or explicit (force the user to re-enter credentials after expiration). This depends on the type of a…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27149415
type: Answer

http://stackoverflow.com/comment/42705597
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27100503
score: 0
has text: I'm not sure but Java won't autobox the String/Path to the new entity - StringPath. Maybe you should leave the interface simple and let the user adopt to it

http://stackoverflow.com/comment/42521503
type: Comment
comment on: http://stackoverflow.com/a/26994794
type: AnswerComment
has text: I think the problem is that the jpg files can't be located so the getResource method is returning null - the answers here might help: http://stackoverflow.com/questions/4301329/java-class-getresource-returns-null
score: 0

http://stackoverflow.com/a/27003767
type: Answer
answers question: http://stackoverflow.com/q/27003551
upvote count: 1
has body: How about using a HttpURLConnection and sending bytes instead of strings. HttpURLConnection connection; ByteArrayOutputStream baos; try { URL url = new URL("http://www.somewebsite.com"); connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "image/jpeg"); connection.setRequestMethod("POST"); baos = new ByteArrayOutputStream(); baos.write(bytes); // your bytes here baos.writeTo(connection.getOutputStream()); } finally { if(baos != null) baos.close(); if(osw != null) osw.close(); if(connection != null) connection.disconnect(); }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42538802
has comment: http://stackoverflow.com/comment/42538596

http://stackoverflow.com/comment/42608496
type: Comment
type: QuestionComment
has text: Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackoverflow.com/rooms/65295/discussion-on-question-by-xiver77-java-is-2-times-faster-than-c-as-a-subset-of).
comment on: http://stackoverflow.com/q/27038803
score: 0

http://stackoverflow.com/comment/42684103
type: Comment
type: QuestionComment
has text: See any sources of java (e.g. HashMap, ArrayList). And you will see how they handle it.
comment on: http://stackoverflow.com/q/27088194
score: 0

http://stackoverflow.com/a/27309370
accepted answer of: http://stackoverflow.com/q/27013538
answers question: http://stackoverflow.com/q/27013538
score: 0
type: AcceptedAnswer
type: Answer
has body: The project is a HTML5 applications. You just need to edit these two files. Please refer to https://crosswalk-project.org/documentation/getting_started/build_an_application.html. After you edit your code. You can generate the android apk as follow: Export Crosswalk Application 1.In Eclipse menu: Select "File-&gt;Export" 2.Select "Crosswalk/Export Crosswalk App" then click next 3.Input the required information then click "Finish" button The you can install the apk to your device.
has comment: http://stackoverflow.com/comment/47443240

http://stackoverflow.com/comment/42698710
has text: Yeah, I completely agree with the point that using an interface within a class - let alone a nested class - should not be used very often.
type: AnswerComment
comment on: http://stackoverflow.com/a/27096648
type: Comment
score: 0

http://stackoverflow.com/comment/42555580
type: Comment
has text: @sumitjain `addAll` will compare everything with everything too! No performance difference here.
score: 1
comment on: http://stackoverflow.com/a/27014838
type: AnswerComment

http://stackoverflow.com/a/28211076
answers question: http://stackoverflow.com/q/27136303
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/44788323
accepted answer of: http://stackoverflow.com/q/27136303
score: 0
type: Answer
has body: You were all right. The problem was, infact, with BlueJ. When I ran the code with another editor it worked as intended. I guess I know what I take away from this one ... Still, thanks for all your answers.

http://stackoverflow.com/comment/53931829
score: 0
type: Comment
type: QuestionComment
has text: @MLefebvre - Did you find any solution for this..Even I am facing the same..
comment on: http://stackoverflow.com/q/27029574

jsp
tags question: http://stackoverflow.com/q/27095136
tags question: http://stackoverflow.com/q/27073759
tags question: http://stackoverflow.com/q/27081635
tags question: http://stackoverflow.com/q/27086856
tags question: http://stackoverflow.com/q/27099193
tags question: http://stackoverflow.com/q/27151711
tags question: http://stackoverflow.com/q/27012518
tags question: http://stackoverflow.com/q/27114463
tags question: http://stackoverflow.com/q/27093545
tags question: http://stackoverflow.com/q/27129728
tags question: http://stackoverflow.com/q/27035625
tags question: http://stackoverflow.com/q/27011555
tags question: http://stackoverflow.com/q/27096845
tags question: http://stackoverflow.com/q/27133396
tags question: http://stackoverflow.com/q/27145341
tags question: http://stackoverflow.com/q/27123120
tags question: http://stackoverflow.com/q/27016233
tags question: http://stackoverflow.com/q/27109677
tags question: http://stackoverflow.com/q/27124125
tags question: http://stackoverflow.com/q/27055347
tags question: http://stackoverflow.com/q/27084666
tags question: http://stackoverflow.com/q/27088404
tags question: http://stackoverflow.com/q/27090034
tags question: http://stackoverflow.com/q/27054792
tags question: http://stackoverflow.com/q/27018501
tags question: http://stackoverflow.com/q/27068616
tags question: http://stackoverflow.com/q/27054099
tags question: http://stackoverflow.com/q/27132903
tags question: http://stackoverflow.com/q/27141469
tags question: http://stackoverflow.com/q/27144604
tags question: http://stackoverflow.com/q/27071635
tags question: http://stackoverflow.com/q/26994555
tags question: http://stackoverflow.com/q/27084347
tags question: http://stackoverflow.com/q/26992625
tags question: http://stackoverflow.com/q/27005506
tags question: http://stackoverflow.com/q/27011076
type: Tag
tags question: http://stackoverflow.com/q/27094803
tags question: http://stackoverflow.com/q/27052236
tags question: http://stackoverflow.com/q/27148385
tags question: http://stackoverflow.com/q/26994820
tags question: http://stackoverflow.com/q/26999647
tags question: http://stackoverflow.com/q/27101380
tags question: http://stackoverflow.com/q/27148248
tags question: http://stackoverflow.com/q/27032602
tags question: http://stackoverflow.com/q/27144392
tags question: http://stackoverflow.com/q/27107092
tags question: http://stackoverflow.com/q/26998091
tags question: http://stackoverflow.com/q/27090595
tags question: http://stackoverflow.com/q/26995126
tags question: http://stackoverflow.com/q/27143553
tags question: http://stackoverflow.com/q/27122613
tags question: http://stackoverflow.com/q/27088627
tags question: http://stackoverflow.com/q/27026710
tags question: http://stackoverflow.com/q/26997403
tag name: jsp
tags question: http://stackoverflow.com/q/27123296
tags question: http://stackoverflow.com/q/27069386
tags question: http://stackoverflow.com/q/27099292
tags question: http://stackoverflow.com/q/27104045
tags question: http://stackoverflow.com/q/26996613
tags question: http://stackoverflow.com/q/27044330
tags question: http://stackoverflow.com/q/27037972
tags question: http://stackoverflow.com/q/27049453
tags question: http://stackoverflow.com/q/27125254
tags question: http://stackoverflow.com/q/27144454
tags question: http://stackoverflow.com/q/27130958
tags question: http://stackoverflow.com/q/27074622
tags question: http://stackoverflow.com/q/27030831
tags question: http://stackoverflow.com/q/27004963
tags question: http://stackoverflow.com/q/27019240
tags question: http://stackoverflow.com/q/27056030
tags question: http://stackoverflow.com/q/27118344
tags question: http://stackoverflow.com/q/27097858
tags question: http://stackoverflow.com/q/27014435
tags question: http://stackoverflow.com/q/27085866
tags question: http://stackoverflow.com/q/27124866
tags question: http://stackoverflow.com/q/27062661
tags question: http://stackoverflow.com/q/27134554
tags question: http://stackoverflow.com/q/27071904

http://stackoverflow.com/a/27032188
type: Answer
answers question: http://stackoverflow.com/q/27031464
score: 0
has body: Even there's looks like existing an special operator meet your requirement, but using loop in essence. As the structure for Set need to handle element in loop. Even I haven't heard a structure can do such operation.

http://stackoverflow.com/a/27115564
downvote count: 1
has comment: http://stackoverflow.com/comment/42734187
upvote count: 5
has comment: http://stackoverflow.com/comment/42734470
score: 4
has comment: http://stackoverflow.com/comment/42734242
has comment: http://stackoverflow.com/comment/42734714
accepted answer of: http://stackoverflow.com/q/27115534
has comment: http://stackoverflow.com/comment/42734434
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42733951
has body: public static void main(String[] args) { ... } args array contains the parameters from the command line. In your example the filename would be args[0]. Beware however that if you hard code args[0] into your code, then don't pass a parameter, you will get an ArrayIndexOutOfBoundsException because args[0] doesn't exist. You can expand this to include multiple parameters if you need to. For example java myprogram configfile.txt configfile2.txt configfile3.txt Those filenames would be args[0] args[1] and args[2] respectively. If your program can run with or without arguments, you can find out if you have some by checking the length of the array is > 0. Something like if (args.length &gt; 0) { myfile = args[0]; } else { myFile = someDefaultFilename; } or if you can have multiple parameters you can loop through the entire array for (String s : args) { //Do something with each parameter }
type: Answer
has comment: http://stackoverflow.com/comment/42734246
answers question: http://stackoverflow.com/q/27115534
has comment: http://stackoverflow.com/comment/42734415

http://stackoverflow.com/comment/42555647
type: AnswerComment
score: 0
type: Comment
has text: @Marco13 Because of the implementation of `java.util.TreeMap.Entry`. If it would have been saved like a array `Object[100000000]` `addAll` would be faster because we can use `System.arraycopy`.
comment on: http://stackoverflow.com/a/27014838

http://stackoverflow.com/comment/42533863
score: 0
type: AnswerComment
type: Comment
has text: @Radiodef why don't you join me in [chat](http://chat.stackoverflow.com/rooms/info/65168/reducing-if-statement-java?tab=conversations)?
comment on: http://stackoverflow.com/a/27000234

http://stackoverflow.com/comment/42690105
has text: thats the print preview window of my print device EPSON L800... and i tried printing it on actual paper and appear as the preview said it would
comment on: http://stackoverflow.com/a/27033735
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42609629
has text: @ArifMustafa: why no use of `this`, and again, what need do you have for the class name to be displayed? Again, consider telling us the **overall** problem that you're trying to solve to get a better solution from us.
comment on: http://stackoverflow.com/a/27043359
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42798820
type: AnswerComment
has text: I have corrected my run task like below and put a breakpoint but Eclipse did not stop in the breakpoint. <jvmarg value="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5555"/>
type: Comment
comment on: http://stackoverflow.com/a/27152007
score: 0

http://stackoverflow.com/q/27014249
has answer: http://stackoverflow.com/a/27037418
has comment: http://stackoverflow.com/comment/42554547
tagged with: hibernate3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42556161
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/27037418
has comment: http://stackoverflow.com/comment/42554676
has title: two transaction issue with Hibernate 3
score: 0
answer count: 1
has body: In our application we are using Hibernate 3. Recently I faced one issue in transactions. I have some code in following manner method1() try{ tx = session.beginTransaction(); //New object which needs to be stored session.save(object); // Some code which generates exception tx.commit(); // Exception occured before commit processing }catch(Exception ex){ e.printStackTrace(); throw e; }finally{ if(tx!=null &amp;&amp; tx.wasNotCommited()){ tx.rollback(); } } I have another method same as this, which is called after this method even in case of exception is thrown from this method. Session is same across both of the method. Now what I am experiencing is if my 2nd method executes successfully and commits hibernate transaction, this stores data which has been saved in 1st method which I don't want. I can not share exact code, but prepared one Test method which is similar to this issue. My database server is mysql. package com.opshub.jobs.core; import org.hibernate.Session; import org.hibernate.Transaction; import com.opshub.dao.core.Company; import com.opshub.utils.hibernate.HibernateSessionFactory; public class Test { public static void main(String[] args) throws Exception{ Session session = HibernateSessionFactory.openSession(); try{ Transaction tx = session.beginTransaction(); try{ Company company = new Company(); company.setName("Gaurav"); company.setCompanyDetails("IT Company"); company.setCompanyAddress("India"); session.save(company); if(true) throw new Exception("Now go to finally"); tx.commit(); }catch(Exception e){ throw e; }finally{ tx.rollback(); } }finally{ Transaction tx = session.beginTransaction(); tx.begin(); Company company = new Company(); company.setName("Gaurav 1"); company.setCompanyDetails("IT Company"); company.setCompanyAddress("India"); session.save(company); // if(true) // throw new Exception("Now go to finally"); tx.commit(); } } } Any help would be appreciated.

http://stackoverflow.com/a/27112454
accepted answer of: http://stackoverflow.com/q/27112424
has comment: http://stackoverflow.com/comment/42874416
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42873036
has body: You just need to add a break: if(password.equalsIgnoreCase("Password")){ System.out.println("Great job"); break; }
has comment: http://stackoverflow.com/comment/42872947
type: Answer
has comment: http://stackoverflow.com/comment/42873678
answers question: http://stackoverflow.com/q/27112424
score: 3
upvote count: 3

http://stackoverflow.com/comment/42765879
comment on: http://stackoverflow.com/q/27133142
score: 0
type: QuestionComment
type: Comment
has text: Why? S is your specific type. What do you want to achieve with your code?

http://stackoverflow.com/a/27011000
type: Answer
has body: import java.util.*; public class QueueProgram { static int[] arrival = {3,3,9}; static int[] service = {2,15,14}; int waitTime; int finishTime; int serviceTime; static int index; Queue&lt;Integer&gt; Customers = new LinkedList&lt;Integer&gt;(); public int maxWait(int[] arrival, int[] service) { //this.arrival = arrival; //this.service = service int maxWaitTime = 0; int[]finishTime = new int[arrival.length]; for(int i=0; i&lt;arrival.length;i++) { int startTime; index = i; if(index == 0) { startTime = arrival[index]; //System.out.println(startTime); } else { startTime = Math.max(arrival[i],finishTime[i-1]); } finishTime[i] = startTime + service[i]; waitTime = finishTime[i] - service[i] - arrival[i]; if(waitTime &gt; maxWaitTime) { maxWaitTime = waitTime; } } return maxWaitTime; } public static void main(String[] args) { QueueProgram q = new QueueProgram(); q.maxWait(arrival, service); System.out.println("Maximum wait time is: " + q.maxWait(arrival, service)); } }
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27009596
answers question: http://stackoverflow.com/q/27009596

http://stackoverflow.com/q/27136139
accepted answer: http://stackoverflow.com/a/27136257
tagged with: copy
has title: copying an array of objects and then modifying the original without affecting the copy
linked to: http://stackoverflow.com/q/6182565
answer count: 3
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27136296
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/27087881
has answer: http://stackoverflow.com/a/27136257
type: AnsweredQuestion
has body: So I have been banging my head over this seemingly insignificant issue. I don't necessarily know what to search for. I have scoured around for solutions. I need to make a copy of 2D array. The array consists of objects (a class I created call Cell), but the as soon as I make a copy I store that copy into a hash map (for possible reference later), then continue to modify the original array. The issue is that the modifications to the original also affect the copy now in the hash map. Essentially at the end of the day, my hash map will consist of many versions of the same grid. I have tried array.clone(), System.arraycopy(...), Arrays.copyof(), the traditional for loop copying scheme.... Finally I realized that I need what was called a deep copy, where you copy each data field of each object into a new object into the array copy....yeah, that didn't work either. Take a look: static Cell[][] gridCopy; ... Cell[][] grid = getGrid(file); //get grid from a file (this is Sudoku if you must know) ... static boolean SolveSudoku(Cell grid[][]) { // If there is no unassigned location, we are done if (unassigned == null) return true; // success! int row = unassigned.row; int col = unassigned.col; ArrayList&lt;Integer&gt; domain = unassigned.domain; // consider digits 1 to 9 for (int num = 0; num &lt; domain.size(); num++) { //if looks promising if (isSafe(grid, row, col, domain.get(num))) { //gridCopy = new Cell[N][N]; instance++; // make tentative assignment grid[row][col].value = domain.get(num); //here is my attempt at a deep copy for (int i = 0; i &lt; N; i++) for (int j = 0; j &lt; N; j++) gridCopy[i][j] = new Cell(grid[i][j].row, grid[i][j].col, grid[i][j].value, grid[i][j].domain); states.put(instance, gridCopy); //save the current state in a map for reference if we backtrack //as soon as I change things here in the original, the copy in the 'states' map also changes updateSpecifiedDomains(grid, row, col, domain.get(num), true); printGrid(grid, "Instance" + String.valueOf…
tagged with: java
has comment: http://stackoverflow.com/comment/42771066
type: Question
tagged with: object
possible better answer: http://stackoverflow.com/a/27136277
tagged with: arrays
has answer: http://stackoverflow.com/a/27136277

http://stackoverflow.com/a/42591259
type: Answer
answers question: http://stackoverflow.com/q/27083097
has body: This issue is fixed now in the code in git, as the Pull Request https://github.com/opencv/opencv/pull/8168 has been merged. It should be available in the next released version.
score: 0

http://stackoverflow.com/comment/101048419
score: 0
type: AnswerComment
type: Comment
has text: Instead of setting the connection string, there's a "username" and "password" value that can be set instead, and setting those fixed the problem for me.
comment on: http://stackoverflow.com/a/34830478

http://stackoverflow.com/comment/42617482
type: Comment
comment on: http://stackoverflow.com/a/27049972
score: 0
type: AnswerComment
has text: also lots of bugs with accessor methods, `field hiding`

http://stackoverflow.com/comment/42675712
score: 0
comment on: http://stackoverflow.com/q/27083253
has text: I looked in there and tried to use append but append has a String argument. Should I try to write my own append method that can work with my class?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42675183
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27081976
has text: If you want to check that the student exists in some other table (e.g., the "students" table) then your select query should be checking that table, not the "studies" table.
type: Comment

http://stackoverflow.com/comment/42612197
has text: It does seem like an outer-class reference should be enough to at least keep the Service object in memory, but maybe those are being treated specially. So if you have a sticky Service, how is it being stopped?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27034779
type: Comment

http://stackoverflow.com/comment/42844006
type: QuestionComment
has text: `In additions to the resources listed` what resources listed?
comment on: http://stackoverflow.com/q/27139411
score: 0
type: Comment

http://stackoverflow.com/q/27087031
has answer: http://stackoverflow.com/a/27087752
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27087752
has body: I was trying out violations of the Liskov Substitution Principle using C++ class inheritance but could not replicate the same problem resulting from LSP violation that was demonstrated with a Java program. The source of the Java program can be found on this page. The violation results in the error as described on the page. Here's my translation of that code in C++: #include &lt;iostream&gt; class Rectangle { protected: int height, width; public: int getHeight() { std::cout &gt;&gt; "Rectangle::getHeight() called" &gt;&gt; std::endl; return height; } int getWidth() { std::cout &gt;&gt; "Rectangle::getWidth() called" &gt;&gt; std::endl; return width; } void setHeight(int newHeight) { std::cout &gt;&gt; "Rectangle::setHeight() called" &gt;&gt; std::endl; height = newHeight; } void setWidth(int newWidth) { std::cout &gt;&gt; "Rectangle::setWidth() called" &gt;&gt; std::endl; width = newWidth; } int getArea() { return height * width; } }; class Square : public Rectangle { public: void setHeight(int newHeight) { std::cout &gt;&gt; "Square::setHeight() called" &gt;&gt; std::endl; height = newHeight; width = newHeight; } void setWidth(int newWidth) { std::cout &gt;&gt; "Square::setWidth() called" &gt;&gt; std::endl; width = newWidth; height = newWidth; } }; int main() { Rectangle* rect = new Square(); rect-&gt;setHeight(5); rect-&gt;setWidth(10); std::cout &gt;&gt; rect-&gt;getArea() &gt;&gt; std::endl; return 0; } The answer was 50 as expected of the Rectangle class. Is my translation of the Java wrong or is this something to do with the difference between Java and C++'s implementation of classes? The questions I have are: What is causing this difference in behaviour (under the hood/issues with my code)? Can the Java example of LSP violation be replicated in C++? If so, how? Thanks!
has title: Why are Liskov Substitution Principle violations not shown in this C++ snippet?
tagged with: c++
type: AnsweredQuestion
tagged with: liskov-substitution-principle
tagged with: java
has comment: http://stackoverflow.com/comment/42682309

http://stackoverflow.com/comment/42539694
comment on: http://stackoverflow.com/q/27004830
score: 0
type: Comment
type: QuestionComment
has text: Googled and I found exactly what you said. It leads to Extended Euclidean Algorithm but it seems hard to implement it into java with code wise.

http://stackoverflow.com/comment/42580077
has text: Printing the stack trace would tell you more about what went wrong. Just let `main` throw the exception instead of catching it.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27028559

http://stackoverflow.com/comment/42567227
has text: The request should be `/MyTestService/name` that is what is mapped in the request mapping.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27021380
score: 0

http://stackoverflow.com/q/27074419
type: Question
tagged with: .net
score: 0
tagged with: rest
has title: Jersey Java service with ASP.NET REST client
answer count: 1
type: UnansweredQuestion
tagged with: web-services
tagged with: jersey-client
has body: I have written a Java RESTful web-service using Jersey: @Path("UserInfoWebService") public class UserInfoWebService { @GET @Path("/name/{i}") @Produces(MediaType.TEXT_XML) public String userInfo(@PathParam("i") String i) { String name = i; return "&lt;User&gt;&lt;Name&gt;" + name + "&lt;/Name&gt;&lt;/User&gt;" ; } I have to call this service from an application which is already written in .NET and I'm not sure if Jersey also supports the .NET framework. How can I do this task? I have already gone through various posts but I found no proper explanation. I'm trying to create the client in ASP.NET. Is it possible?
tagged with: java
has answer: http://stackoverflow.com/a/27091989

http://stackoverflow.com/comment/42755829
type: Comment
comment on: http://stackoverflow.com/a/27128286
has text: I believe, when we try to insert a duplicate value, hashmap internally checks if thats a duplicate and allows the latest value. I need to print all those duplicate values encountered during the .put method. Is there a way to print them?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42792400
type: Comment
type: QuestionComment
has text: @PeterMmm how can I check the logs? And, what do you mean with the packing? [This is my full `.xml` file](http://paste.ofcode.org/7rd9Vm5R84iZrH5QVXmyhL) for exe4.j and [this is the .exe4j file](http://paste.ofcode.org/gjMyEKHAxaigF6xVATkVcV) associated with it.
comment on: http://stackoverflow.com/q/27147981
score: 0

http://stackoverflow.com/q/27114108
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42731350
has title: java.lang.NullPointerExeption before onCreate called for android app
has comment: http://stackoverflow.com/comment/42731621
has comment: http://stackoverflow.com/comment/42732412
type: Question
accepted answer: http://stackoverflow.com/a/27115391
downvote count: 4
has comment: http://stackoverflow.com/comment/42731697
has comment: http://stackoverflow.com/comment/42731675
upvote count: 0
has comment: http://stackoverflow.com/comment/42732861
has comment: http://stackoverflow.com/comment/42731858
has comment: http://stackoverflow.com/comment/42731105
tagged with: nullpointerexception
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/42731536
favorite count: 0
has comment: http://stackoverflow.com/comment/42732221
has answer: http://stackoverflow.com/a/27115391
has body: I'm having a tremendous amount of trouble figuring out how and why I am getting a java.lang.NullPointerException. I have no idea what is going on because it seems to happen before my program loads. I've set a breakpoint at the first line of my onCreate function and my android log still shows that I have a this exception thrown but the program continues to start and I reach my breakpoint. But stepping through I get very weird behavior. I will post the code in question as well as the log. if any other info needed to help me with this please ask. Also please excuse the indention. I'm fairly new to stack overflow package com.example.facta.myapplication; import android.content.Context; import android.content.res.XmlResourceParser; import android.util.Log; import org.xmlpull.v1.XmlPullParser; import java.util.ArrayList; import java.util.Arrays; /** * Created by facta on 11/21/2014. */ public class SiteConfig { private XmlResourceParser configParser; ArrayList&lt;RSSProviderInfo&gt; RSSProviderInfos; ArrayList&lt;String&gt; RSSProviderNames; public SiteConfig() { RSSProviderInfos = new ArrayList&lt;RSSProviderInfo&gt;(); RSSProviderNames = new ArrayList&lt;String&gt;(); } public ArrayList&lt;RSSProviderInfo&gt; getProvierInfos() { return RSSProviderInfos; } public ArrayList&lt;String&gt; getProvierNames() { return RSSProviderNames; } public void loadConfig(Context context, int resourceId) { configParser = context.getResources().getXml(resourceId); RSSProviderInfos.clear(); RSSProviderInfo providerInfo = new RSSProviderInfo(); ArrayList&lt;String&gt; providerNames = loadProviders(configParser); for(int i=0; i &lt; providerNames.size(); i++) { providerInfo = LoadProviderInfo(configParser, providerNames.get(i)); if(providerInfo != null &amp;&amp; providerInfo.isComplete()) { RSSProviderInfos.add(providerInfo); } } } private RSSProviderInfo LoadProviderInfo(XmlResourceParser parser, String provider) { RSSProviderInfo info = new RSSProviderInfo(); String attrName = new String()…
score: -4
has comment: http://stackoverflow.com/comment/42731391

http://stackoverflow.com/q/27112162
tagged with: algorithm
linked to: http://stackoverflow.com/q/7724061
has body: I have several questions with the following algorithms to tell if a number is prime, I also know that with the sieve of Eratosthenes can be faster response. Why is faster to compute i i * sqrt (n) times. than sqrt (n) just one time ? Why Math.sqrt() is faster than my sqrt() method ? What is the complexity of these algorithms O (n), O (sqrt (n)), O (n log (n))? public class Main { public static void main(String[] args) { // Case 1 comparing Algorithms long startTime = System.currentTimeMillis(); // Start Time for (int i = 2; i &lt;= 100000; ++i) { if (isPrime1(i)) continue; } long stopTime = System.currentTimeMillis(); // End Time System.out.printf("Duracion: %4d ms. while (i*i &lt;= N) Algorithm\n", stopTime - startTime); // Case 2 comparing Algorithms startTime = System.currentTimeMillis(); for (int i = 2; i &lt;= 100000; ++i) { if (isPrime2(i)) continue; } stopTime = System.currentTimeMillis(); System.out.printf("Duracion: %4d ms. while (i &lt;= sqrt(N)) Algorithm\n", stopTime - startTime); // Case 3 comparing Algorithms startTime = System.currentTimeMillis(); for (int i = 2; i &lt;= 100000; ++i) { if (isPrime3(i)) continue; } stopTime = System.currentTimeMillis(); System.out.printf( "Duracion: %4d ms. s = sqrt(N) while (i &lt;= s) Algorithm\n", stopTime - startTime); // Case 4 comparing Algorithms startTime = System.currentTimeMillis(); for (int i = 2; i &lt;= 100000; ++i) { if (isPrime4(i)) continue; } stopTime = System.currentTimeMillis(); System.out.printf( "Duracion: %4d ms. s = Math.sqrt(N) while (i &lt;= s) Algorithm\n", stopTime - startTime); } public static boolean isPrime1(int n) { for (long i = 2; i * i &lt;= n; i++) { if (n % i == 0) return false; } return true; } public static boolean isPrime2(int n) { for (long i = 2; i &lt;= sqrt(n); i++) { if (n % i == 0) return false; } return true; } public static boolean isPrime3(int n) { double s = sqrt(n); for (long i = 2; i &lt;= s; i++) { if (n % i == 0) return false; } return true; } public static boolean i…
upvote count: 3
has comment: http://stackoverflow.com/comment/42727329
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/27112497
has answer: http://stackoverflow.com/a/27112497
has comment: http://stackoverflow.com/comment/42727498
has answer: http://stackoverflow.com/a/27112916
tagged with: primes
tagged with: sqrt
accepted answer: http://stackoverflow.com/a/27112916
has title: Why is multiplied many times faster than taking the square root?
type: AnsweredQuestion
score: 3
tagged with: numbers
has comment: http://stackoverflow.com/comment/42847283
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42728146
has comment: http://stackoverflow.com/comment/42847300
type: Question

http://stackoverflow.com/comment/42583073
comment on: http://stackoverflow.com/a/27026527
score: 0
type: AnswerComment
type: Comment
has text: This seems like a perfect solution. I could just store the address (basically location) of the printer. But how would I call that in my program? For example, let's say I want to print a panel. When I use the print() functionality, where would I enter the code, and what would I enter?

http://stackoverflow.com/a/27090039
upvote count: 3
answers question: http://stackoverflow.com/q/27089976
has comment: http://stackoverflow.com/comment/42687236
score: 3
has body: The concept you're looking for is known as double buffering. In general, the concept is that you have an off-screen buffer that you do your graphical operations to, then copy the off-screen buffer to the on-screen display. I don't know exactly what graphical toolkit you're using for your work. AWT can do this with Graphics.drawImage(). See Double Buffering with awt for one discussion of how to do this. In Swing, this can be handled with JComponent.setDoubleBuffered() If you are using something else, you may wish to look it up using the exact phrase "double buffering". Update: The other answer, of course, is to not clear the entire screen and redraw. Given how the pong objects move, you should be able to clear just the portion of each paddle and ball that has moved.
downvote count: 0
type: Answer

http://stackoverflow.com/q/27117279
has body: This is just a portion of of my project that I hit a road block on, but basically what I am facing right now is this. I have a text file full of commands that I read individually line by line into a an array I named tokens[]. tokens[0] has the command it is calling, while token[1] or anything else is a name or anything that is used with the method. In this case token[0] is a addlist method that it invokes, and token[1] is the name of the list. What is the best way to create a list of strings with name from token[1]. This method could be called multiple times in which it needs to create another list if it doesn't exist already. What type of structure should I use for this, and how could I go about this? Thanks for the help in advance!
score: 0
has comment: http://stackoverflow.com/comment/42737485
tagged with: java
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42736897
has comment: http://stackoverflow.com/comment/42737142
has title: How to create a list from the name of a String in Java?
type: Question
has comment: http://stackoverflow.com/comment/42736902

http://stackoverflow.com/a/27041191
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: You can't pass column names as parameters to the prepared statement. You can only pass values as parameters : try { PreparedStatement prepStmt = conn.prepareStatement( "UPDATE week SET some_column_name=? WHERE id&gt;=? AND id&lt;=?"); prepStmt.setFloat(1, x); prepStmt.setInt(2, c); prepStmt.setInt(3, d); prepStmt.executeUpdate(); } catch(SQLException e) { System.err.println("Error during data update"); e.printStackTrace(); }
answers question: http://stackoverflow.com/q/27041163

http://stackoverflow.com/q/27095581
has answer: http://stackoverflow.com/a/27095672
favorite count: 0
has title: Memcache Latency Time Too High?
tagged with: google-app-engine
has body: I have below code working on GAE. When getting the items from memcache I get a latency around 30 ms for 5 to 20 results only. Isn't it too high? Is there anyway I can improve it? @SuppressWarnings({ "unchecked"}) @ApiMethod(name = "queryDesire2") public List&lt;String&gt; queryDesire2( @Nullable @Named("name2") String name2){ EntityManager mgr = getEntityManager(); List&lt;String&gt; list1=new ArrayList&lt;String&gt;(); Key userKey=null; Long x=0L; List&lt;Key&gt; keysNew = new ArrayList&lt;Key&gt;(); MemcacheService memcache = MemcacheServiceFactory.getMemcacheService(); try { userKey=KeyFactory.createKey(name2,1); if (memcache.get(userKey)==null) { Query query2 = mgr.createQuery("select d.good from Desire d where d.ctgry = :name2"); list1 = query2.setParameter("name2", name2).getResultList(); for (String d : list1){ x=x+1L; userKey = KeyFactory.createKey(name2,x); memcache.put(userKey, d); memcache.put(name2+"no", x); } } else { Long y=(Long) memcache.get(name2+"no"); for (x = 1L; x&lt;=y; x++){ userKey=KeyFactory.createKey(name2,x); keysNew.add(userKey); } Map mMap; mMap = memcache.getAll(keysNew); list1 = new ArrayList&lt;String&gt;(mMap.values()); } } finally { mgr.close(); } return list1; } EDIT: I captured this snapshot from https://appengine.google.com/... logs. I assumed that 26ms on the top one is the latency. But also I realized there is cpu_usd: 0.000035. What my real concern is to understand how much instance hour will my application use. Is there any formula or way to calculate that?
has comment: http://stackoverflow.com/comment/42734181
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27095672
upvote count: 1
has comment: http://stackoverflow.com/comment/42696938
downvote count: 1
has answer: http://stackoverflow.com/a/27097307
tagged with: memcached
type: Question
has comment: http://stackoverflow.com/comment/42696868
possible better answer: http://stackoverflow.com/a/27097307
has comment: http://stackoverflow.com/comment/42701430
tagged with: jpql
score: 0
tagged with: low-latency
answer count: 2
has comment: http://stackoverflow.com/comment/42698220

http://stackoverflow.com/comment/42818707
type: QuestionComment
has text: @Michal is there any solution using spring data jpa?
score: 0
comment on: http://stackoverflow.com/q/27151125
type: Comment

http://stackoverflow.com/a/27074887
type: Answer
answers question: http://stackoverflow.com/q/27074793
score: 1
has body: Call a private internalBar() method from A.foo(), instead of calling the overridable bar(). The A.bar() method can also call internalBar() by default (to avoid code duplication), and still be overridden in subclasses.
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/42689639
has text: Can you try adding another sleep *after* the loop? Maybe your Java Synthesizer is slow and plays sounds with a small delay sufficient enough to eat the last notes you were about to play. Maybe replacing the `channel.allNotesOff();` with a `channel.noteOff(60, 30);` could also improve the situation.
score: 0
comment on: http://stackoverflow.com/q/27091181
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27146464
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42790346
has comment: http://stackoverflow.com/comment/42790712
has comment: http://stackoverflow.com/comment/42790920
has comment: http://stackoverflow.com/comment/42790648
type: Answer
has comment: http://stackoverflow.com/comment/42790999
has comment: http://stackoverflow.com/comment/42789262
has body: Just change your regex like below. ^(?=.*(text[12]))(?=.*(text[34]))(?=.*text5)(?=.*(text[6789]))(?=.*(?:(?!\3)text[6789])).*$ Java regex would be, "^(?=.*(text[12]))(?=.*(text[34]))(?=.*text5)(?=.*(text[6789]))(?=.*(?:(?!\\3)text[6789])).*$" DEMO (?=.*(text[6789]))(?=.*(?:(?!\3)text[6789])) Asserts that there must be be two text[6789] or text[6789] but the text strings must not be repeated.
accepted answer of: http://stackoverflow.com/q/27146309
has comment: http://stackoverflow.com/comment/42790401
answers question: http://stackoverflow.com/q/27146309
has comment: http://stackoverflow.com/comment/42790363
score: 1
has comment: http://stackoverflow.com/comment/42790474
has comment: http://stackoverflow.com/comment/42790525
has comment: http://stackoverflow.com/comment/42789287
has comment: http://stackoverflow.com/comment/42790840
has comment: http://stackoverflow.com/comment/42790267
upvote count: 1

http://stackoverflow.com/q/27066437
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/108215141
tagged with: java
tagged with: hibernate
tagged with: annotations
has answer: http://stackoverflow.com/a/27142867
has comment: http://stackoverflow.com/comment/42649857
type: Question
has comment: http://stackoverflow.com/comment/42764663
has body: Need to see the search result of the: @Repository public interface UserRepository extends CrudRepository&lt;User, Long&gt; { public User findByUsername(String username); } which I call from my controller: @RequestMapping(value = "/users/find", method = RequestMethod.GET) public @ResponseBody User findByUsername(@RequestParam("username") String userName) { return usersRepo.findByUsername(userName); } The method above is called via: @GET("/users/find") public User findByUsername(String userName); And the class User is here: @Entity public class User { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private String username; etc... Results of the default methods I can see in my browser by typing e.g. localhost:8080/users I tried many possible requests but it seems that I'm missing something. Any help is appreciated.
has title: How to see result of findByUsername delievered by CrudRepository
answer count: 2
accepted answer: http://stackoverflow.com/a/27142867
has comment: http://stackoverflow.com/comment/42782349
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27647628
upvote count: 2
has comment: http://stackoverflow.com/comment/42781328
tagged with: spring
possible better answer: http://stackoverflow.com/a/27647628

http://stackoverflow.com/comment/42726768
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27111684
has text: And behold! A google on Spring boot parameter map returns exactly what you might think. Thanks!
type: Comment

http://stackoverflow.com/q/27095457
has comment: http://stackoverflow.com/comment/42705460
type: Question
tagged with: mockito
has title: Spring with Mockito: two strategies?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42696578
has comment: http://stackoverflow.com/comment/42728305
has body: JavaDoc for @InjectMocks says: If the object is successfully created with the constructor, then Mockito won't try the other strategies. but I have some doubts. Here's why: public class MyBean { private String path = "home"; public void setPath(String path) { this.path = path; } public String path() { return path; } } @Controller public class HomeController { private MyBean myBean; public HomeController(MyBean myBean) { System.out.println("HomeController(MyBean myBean)"); // always displays!!! // either: &lt;--- case 1 MyBean bean = new MyBean(); bean.setPath("home-modified"); this.myBean = bean; // or: &lt;--- case 2 this.myBean = null; } @RequestMapping("/") public String home() { System.out.println(myBean); return myBean.path(); } } Causes the following test to pass: public class HomeControllerTest { @Spy private MyBean myBean; @InjectMocks private HomeController controller; @Before public void initAnnotations() { MockitoAnnotations.initMocks(this); } @Test public void testAutowired() { assertThat(controller.home(), is("home")); } } But why myBean never becomes null (case 2) or represents my custom object (case 1)? Looks like a violation of its own JavaDoc by Mockito? Or do I miss something? Update: the same things with setters @Controller public class HomeController { private MyBean myBean; public HomeController(MyBean myBean) { this.myBean = myBean; System.out.println("HomeController(MyBean myBean)"); } public void setMyBean(MyBean myBean) { System.out.println("setMyBean(MyBean myBean)"); this.myBean = myBean; } @RequestMapping("/") public String home() { return myBean.path(); } } Displays: HomeController(MyBean myBean) setMyBean(MyBean myBean) Which is obviously "another strategy".
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/42697113
has comment: http://stackoverflow.com/comment/42696588
has comment: http://stackoverflow.com/comment/42696983
has comment: http://stackoverflow.com/comment/42728368
has comment: http://stackoverflow.com/comment/42716415
score: 1
tagged with: java

http://stackoverflow.com/comment/42610492
type: QuestionComment
comment on: http://stackoverflow.com/q/27046021
has text: @user3330053 what is the specific line 30 of Files.java? It seems you are trying to invoke a method on a null instance of a class. You have to figure out which instance is null and fix that.
score: 0
type: Comment

http://stackoverflow.com/a/27098281
score: 1
answers question: http://stackoverflow.com/q/27098054
upvote count: 1
type: Answer
has body: The Calculator class is independent of TextArea class. The problems I see in your code is the following: In the Program class there is no need to instantiate Calculator class In TextArea class do not instantiate Calculator class before hand, it should be instantiated in the loadCalculator method. Make Calculator to extend JDialog and pass to its constructor the instance of TextArea class and set this dialog box as a modal. When you are doing the calculation, the value is stored in a double variable. Two things you can do, when the button is pressed and you call degreeConversion at that time, call a method of TextArea class to set the double value to the textArea in the TextArea class, or when the window is closing (add its listener) then call the degreeConversion or TextArea updateValue method. For point #4 it should be something like the following: public class TextArea extends JFrame { ... private JTextArea textArea; private void loadCalculator() { Calculator c = new Calculator(this) c.setVisible(true); } public void updateValue(String str) { textArea.setText(str); } } public class Calculator extends JDialog() { private TextArea parent; public Calculator(TextArea parent) { super(parent, true); //or something like this to make it dialog I dont remember the exact syntax this.parent = parent; ... } ... private void degreeConversion() { double f = ... parent.updateValue(String.valueOf(f)); } }
downvote count: 0

http://stackoverflow.com/q/27003229
has answer: http://stackoverflow.com/a/27003299
type: AnsweredQuestion
favorite count: 0
has title: use 1 function instead of 3 functions in java
type: Question
has comment: http://stackoverflow.com/comment/42536095
has answer: http://stackoverflow.com/a/27003419
score: 0
answer count: 2
upvote count: 1
downvote count: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27003299
accepted answer: http://stackoverflow.com/a/27003419
has comment: http://stackoverflow.com/comment/42536039
has body: Below is a copy of my homework, I already had it graded dont worry! Feedback was "You do not need 3 different functions to read the input: use the same function 3 times instead". Can someone show me this? I am brand new at Java and would really like to understand before moving forward. /* */ package numbers; /** */ import javax.swing.*; public class Numbers { public static void main(String[] args) { //Declare variables float number1 = 0, number2 = 0, number3 = 0, smallest = 0, largest = 0, average, output; int count = 0; while (count&lt; 3) { count += 1; //Call Input method number1 = firstNumber(); count+=1; number2 = secondNumber(); count+=1; number3 = thirdNumber(); //Method to find the largest and smallest numbers largest = max(number1, number2, number3); smallest = min(number1, number2, number3); } //Methods to calculate average and display output messages average = mean(number1, number2, number3); results(largest, smallest, average); //Warning messages regarding size of input numbers if (smallest &gt; 50){ JOptionPane.showMessageDialog(null,"WARNING, YOUR NUMBERS ARE ALL " + "OVER 50!"); } if (largest &lt; 50){ JOptionPane.showMessageDialog (null,"WARNING ALL YOUR NUMBERS ARE " + "UNDER 50!"); } } /* * Method for Data Input */ public static float firstNumber() { float firstNumber = Float.parseFloat (JOptionPane.showInputDialog("Enter your " + "first number: ")); return firstNumber; } public static float secondNumber() { float secondNumber = Float.parseFloat (JOptionPane.showInputDialog("Enter your " + "second number: ")); return secondNumber; } public static float thirdNumber() { float thirdNumber = Float.parseFloat (JOptionPane.showInputDialog("Enter your " + "third and final number: ")); return thirdNumber; } /* * Method for maximum calculation */ public static float max(float firstNumber, float secondNumber, float thirdNumber) { float maxValue; if ((firstNumber &gt;= secondNumber) &amp;&amp; (firstNumber &gt;= thirdNumber)) maxValue = firstNumber; else if ((…

http://stackoverflow.com/comment/42581379
has text: Then it is likely that Java is changing the `PageFormat`
type: Comment
comment on: http://stackoverflow.com/a/27029220
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42699074
type: AnswerComment
comment on: http://stackoverflow.com/a/27096697
type: Comment
score: 9
has text: It's obiouds OP is asking to do his homework, and hasn't even put the main function into a class.

http://stackoverflow.com/q/27148169
downvote count: 0
answer count: 1
has title: Hibernate Alter the ID to null and save again as a new entry
linked to: http://stackoverflow.com/q/734461
accepted answer: http://stackoverflow.com/a/27148389
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has body: I have Java Spring MVC application. I am trying to do CRUD on one table, say Employee. When I am trying to create a new Employee, it saves and adds a new entry in database. But when I am trying to update an Employee, I am updating that row, and I am trying to add a new row, with the old values of the same employee and setting one field to false. Here is my ServiceImpl public class EmployeeServiceImpl extends GenericManagerImpl&lt;Employee, Long&gt; implements EmployeeService { @Override public void save(Employee employee) { Employee newEmpl = employee; Date date = new Date(); Long empKey = employee.getEmpKey(); if (empKey) != null) { oldEmp = (Employee) employeeDao.get(); oldEmp.setActive(false); oldEmp.setEmpKey(null); employeeDao.save(oldEmp); } else { employee.setCreated(date); } employee.setUpdated(date); employee.setActive(true); employeeDao.save(employee); } } When I am creating a new entry, it is working fine. But when I am trying to update one entry, then it showing the exception org.springframework.orm.hibernate4.HibernateSystemException: identifier of an instance of com.table.model.Employee was altered from 4 to null; nested exception is org.hibernate.HibernateException: identifier of an instance of com.table.model.Employee was altered from 4 to null at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:206) at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:606) at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:488) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTrans…
type: Question
has answer: http://stackoverflow.com/a/27148389

http://stackoverflow.com/comment/42525733
type: Comment
type: QuestionComment
has text: Have you printed out `word` in each iteration of the while loop? I suspect it is not printing out what you think. It is hard to help you, because we do not have the exact text file you are using, but from what you copy/pasted it does not appear that tab is the only delineator in that file.
comment on: http://stackoverflow.com/q/26997557
score: 0

http://stackoverflow.com/a/27004680
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42539160
has body: Array index starts at 0. Ex: int firstNumber = Integer.parseInt(args[0]); //Correct version You should have decremented all your index refernces by 1 and fixed the order: int firstNumber = Integer.parseInt(args[0]); char theOperator = args[1].charAt(0); //Wrong order here asusming its comming in as 1 + 2. Also charAt should be 0 indexed as well. int secondNumber = Integer.parseInt(args[2]);
downvote count: 0
answers question: http://stackoverflow.com/q/27004609
has comment: http://stackoverflow.com/comment/42538784
type: Answer

http://stackoverflow.com/comment/42712226
score: 1
type: QuestionComment
has text: All I can imagine is that either you're modifying entry values using reflection somehow, or you're accessing the map from multiple threads without proper synchronization, leaving the map in an inconsistent state.
comment on: http://stackoverflow.com/q/27104259
type: Comment

http://stackoverflow.com/comment/42787183
score: 0
type: AnswerComment
type: Comment
has text: This Filter is being Called before every resource in CQ5. Before I add my data into request object I am checking a condition `res.getResourceType().equals("myapp/components/mycomp")` so I won't end up executing unecessary code for the wrong resource type. **IT WORKS, BUT I just hope this is the right way of doing it.**
comment on: http://stackoverflow.com/a/27117698

http://stackoverflow.com/q/27150434
score: 0
accepted answer: http://stackoverflow.com/a/27168192
tagged with: http
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42821511
tagged with: java
has body: In the following code, EntityUtils.toString is going into IOException. When I paste 'EntityUtils.toString(entity)' on eclipse watch window, it showing me the value which is DISABLED private String triggerRestApiCalls(String url){ HttpClient httpClient = new DefaultHttpClient(); HttpGet getRequest = new HttpGet(url); getRequest.setHeader( new BasicHeader("Accept", "application/json")); try { HttpResponse response = httpClient.execute(getRequest); HttpEntity entity = response.getEntity(); String value = EntityUtils.toString(entity); return value; } catch (ClientProtocolException e) { log.debug(e.getCause()); } catch (IOException e) { log.debug(e.getCause()); } log.debug("Status Unknown"); return "UNKNOWN"; } The content value lenght is 8. The string expected is DISABLED, which is exactly of the length. The HTTP status is 200 (OK). I used curl with same URL. curl -i -H {Accept: application/json} http://127.0.0.1:9031/test/test.html?someDetails HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Set-Cookie: JSESSIONID=D35C61744F4FB3A47B624FF3D0BEB026; Path=/mics/; Secure; HttpOnly Content-Type: text/plain;charset=ISO-8859-1 Content-Length: 8 Date: Wed, 26 Nov 2014 13:23:30 GMT DISABLED. Any help is appreciated ! Is there any angle to encoding ? FIRST EDIT The Stack Trace mentions this. java.io.IOException: Attempted read from closed stream. The code that is executed by EntityUtils.toString() public static String toString( final HttpEntity entity, final Charset defaultCharset) throws IOException, ParseException { if (entity == null) { throw new IllegalArgumentException("HTTP entity may not be null"); } InputStream instream = entity.getContent(); if (instream == null) { return null; } try { if (entity.getContentLength() &gt; Integer.MAX_VALUE) { throw new IllegalArgumentException("HTTP entity too large to be buffered in memory"); } int i = (int)entity.getContentLength(); if (i &lt; 0) { i = 4096; } ContentType contentType = ContentType.getOrDefault(entity); Charset charset = conten…
has title: EntityUtils.toString moving into IOException
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/27168192
tagged with: rest
has comment: http://stackoverflow.com/comment/42795470
tagged with: curl

http://stackoverflow.com/comment/42688073
score: 0
comment on: http://stackoverflow.com/q/27002200
type: QuestionComment
type: Comment
has text: Can you post your landscape layout file?

http://stackoverflow.com/comment/42684040
score: 0
has text: I'm just starting with Java so I don't know if it's possible to not specify it. If it's not specified then how is it determined what class to start running with when executing `.jar` file? Command line options?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27088127

http://stackoverflow.com/comment/42769250
type: Comment
has text: Suggestion: make final `int`s `private final int TOP = 1`, `private final int MIDDLE = 2`, etc. Then `colors.put(TOP, unlit)`, and `colors.put(pos, color)` will work, no switch needed. Alternatively, make it an enum so you can typecheck when you pass in your parameters.
type: QuestionComment
comment on: http://stackoverflow.com/q/27135326
score: 0

scala
tags question: http://stackoverflow.com/q/27006156
tags question: http://stackoverflow.com/q/26992209
tags question: http://stackoverflow.com/q/27137443
tags question: http://stackoverflow.com/q/27115993
tags question: http://stackoverflow.com/q/27073923
tags question: http://stackoverflow.com/q/27052394
tags question: http://stackoverflow.com/q/27087768
tags question: http://stackoverflow.com/q/27129457
tags question: http://stackoverflow.com/q/27099333
tags question: http://stackoverflow.com/q/27094610
tags question: http://stackoverflow.com/q/27132411
tags question: http://stackoverflow.com/q/27053036
tags question: http://stackoverflow.com/q/27138744
tags question: http://stackoverflow.com/q/27031262
tags question: http://stackoverflow.com/q/27142693
tags question: http://stackoverflow.com/q/27058192
tags question: http://stackoverflow.com/q/27063439
tags question: http://stackoverflow.com/q/26999956
tag name: scala
tags question: http://stackoverflow.com/q/27081452
tags question: http://stackoverflow.com/q/27002423
type: Tag
tags question: http://stackoverflow.com/q/27023457
tags question: http://stackoverflow.com/q/27078869

http://stackoverflow.com/comment/42589046
has text: did your MainActivity is declared in your manifest file ?
score: 0
comment on: http://stackoverflow.com/q/27034010
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42677689
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27084095
has text: I'm just getting plain response and not xml,the output is below 3RobertParerarobert@gmail.com4AndrewStrauss8978767878

http://stackoverflow.com/comment/42713627
has text: downvote because add/subtract has higher precedence than boolean comparison
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27105095

http://stackoverflow.com/comment/42589673
type: Comment
type: QuestionComment
has text: Did you try the suggestion of Paresh? Otherwise use `execute` and `getMoreResults` and either get an update count or result set (based on the boolean return value).
score: 1
comment on: http://stackoverflow.com/q/27032910

monitor
tags question: http://stackoverflow.com/q/27058828
tag name: monitor
tags question: http://stackoverflow.com/q/27104021
type: Tag

http://stackoverflow.com/comment/43189214
has text: Created issue TYRUS-390 to track this.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27016805

http://stackoverflow.com/q/27086598
accepted answer: http://stackoverflow.com/a/27086661
answer count: 1
type: AnsweredQuestion
has body: my friend and I are using java eclipse, my labtop is 64-bit and eclipse is working fine, but on my friend's labtop - which is 32-bit - eclipse is slow when startup, slow while debugging and sometimes it stops working and responding suddenly. Our use of eclipse most of times is to do our homeworks and courses projects. please I appreciate any help to make eclipse performance faster. this is the eclipse.ini configuration -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140116-2212 -product org.eclipse.epp.package.standard.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m
tagged with: java
tagged with: eclipse
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/27086661
score: 0
has title: Slow Java eclipse performance

http://stackoverflow.com/comment/42763244
type: Comment
type: QuestionComment
has text: Yes, I am using javax.mail-1.4.7 library.
comment on: http://stackoverflow.com/q/27128478
score: 0

http://stackoverflow.com/q/27079668
has comment: http://stackoverflow.com/comment/42669364
has title: NullPointerException when integrating Processing into Eclipse
has comment: http://stackoverflow.com/comment/42669407
has comment: http://stackoverflow.com/comment/42669223
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27080824
tagged with: processing
has comment: http://stackoverflow.com/comment/42669246
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42669394
type: Question
has comment: http://stackoverflow.com/comment/42669484
answer count: 1
has body: I am currently trying to integrate an existing Processing project into Eclipse. There are 2 classes, TagCloud and Tag, the former is the controller of the latter. In TagCloud, I have the following code snippet: for (int i = 0; i &lt; NUM_RELATIONS; i++) { println("i: " + i); tags.get(i).refTagsMap(tagsMap); tags.get(i).setLinks(); //Randomly assign a location to the first tag. System.out.println("Tag from map: " + tags.get(i)); for(int j = 0; j &lt; tags.size(); j++) System.out.println(j + " " + tags.get(j)); tags.get(i).drawTag(); } for(int i = 0; i &lt; NUM_RELATIONS; i++) { println("Drawing tags for tag: " + i); tags.get(i).drawLinks(); } tags is an ArrayList of Tag objects, tagsMap is a HashMap of the type HashMap(String, Tag). However, the code breaks at the tags.get(i).drawTag() method and displays the following exception. Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException at processing.core.PApplet.runSketch(PApplet.java:10713) at processing.core.PApplet.main(PApplet.java:10525) at TagCloud.main(TagCloud.java:97) Caused by: java.lang.NullPointerException at processing.core.PApplet.noFill(PApplet.java:14574) at Tag.drawTag(Tag.java:65) at TagCloud.&lt;init&gt;(TagCloud.java:87) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at java.lang.Class.newInstance(Class.java:438) at processing.core.PApplet.runSketch(PApplet.java:10711) ... 2 more Below are the drawTag() and drawLink methods public void drawTag() { parent.noFill(); parent.stroke(255); parent.strokeWeight(3); float x = location.x; float y = location.y; //Create the rectangle frame frame = parent.createShape(parent.RECT, x, y, 100, 80); //Add it to the canvas parent.shape(frame); //Wr…
score: 0

http://stackoverflow.com/comment/42744562
type: QuestionComment
has text: Check this out see if this helps you: http://stackoverflow.com/questions/26941509/android-fragment-with-three-listviews-crashes-with-out-of-memory-error/26941825#26941825
comment on: http://stackoverflow.com/q/27111769
score: 0
type: Comment

http://stackoverflow.com/a/27133095
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/27132648
downvote count: 2
score: 6
has body: From: PL/SQL TABLE, BOOLEAN, and RECORD Types It is not feasible for Oracle JDBC drivers to support calling arguments or return values of the PL/SQL RECORD, BOOLEAN, or table with non-scalar element types. However, Oracle JDBC drivers support PL/SQL index-by table of scalar element types. ... As a workaround to PL/SQL RECORD, BOOLEAN, or non-scalar table types, create container procedures that handle the data as types supported by JDBC. For example, to wrap a stored procedure that uses PL/SQL boolean, create a stored procedure that takes a character or number from JDBC and passes it to the original procedure as BOOLEAN or, for an output parameter, accepts a BOOLEAN argument from the original procedure and passes it as a CHAR or NUMBER to JDBC. Similarly, to wrap a stored procedure that uses PL/SQL records, create a stored procedure that handles a record in its individual components, such as CHAR and NUMBER, or in a structured object type. To wrap a stored procedure that uses PL/SQL tables, break the data into components or perhaps use Oracle collection types.

http://stackoverflow.com/comment/42733041
has text: Your advice, not debugging my code (which I've tried, and obviously failed to do, since I'm asking for help here).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27114909

http://stackoverflow.com/q/27090959
has comment: http://stackoverflow.com/comment/42694530
has comment: http://stackoverflow.com/comment/42689135
has comment: http://stackoverflow.com/comment/42689526
has comment: http://stackoverflow.com/comment/42691216
has comment: http://stackoverflow.com/comment/42692353
has comment: http://stackoverflow.com/comment/42689569
answer count: 0
has comment: http://stackoverflow.com/comment/42689058
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/42689551
has title: Pass parameter to another panel swing java
tagged with: oop
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/42688729
type: Question
has comment: http://stackoverflow.com/comment/42689358
score: 0
linked to: http://stackoverflow.com/q/10523343
has body: I have a problem. For example: We have MainFrame, on this form we have mainPanel. Next, creates new classes with names FirstPanel and SecondPanel wich extends JPanel. Now in MainFrame writes: public MainFrame() { initComponents(); setLocationRelativeTo(null); Main main = new Main(); main.setMainPanel(mainPanel); mainPanel.setLayout( new BorderLayout() ); mainPanel.add( PANELS_LIST.get(0) ); mainPanel.validate(); } PANELS_LIST - arrayList with all panels. PANELS_LIST.get(0) - jpanel with name FirstPanel . After this we will see FirstPanel. On the FirstPanel we have button. So, on this button click I want to change mainPanel state (need SecondPanel overwrites FirstPanel). How can i do this? Tried to send mainPanel like a param with creating setter or getter but doesn't work.. At all I need mainPanel to be accesable from any panel in any class PS: ofcourse I can set mainPanel like a public and static, but.. I think this is bad solution

http://stackoverflow.com/a/27003480
score: 0
answers question: http://stackoverflow.com/q/27003268
type: Answer
has body: I would do BaseDao with load() and loadAll() methods to address your question.

http://stackoverflow.com/comment/42716047
type: QuestionComment
has text: @PredragMaric at least your answer explains what the problem is rather than just providing alternative code without any explanation :)
score: 0
comment on: http://stackoverflow.com/q/27106152
type: Comment

http://stackoverflow.com/comment/42660602
comment on: http://stackoverflow.com/q/27074474
score: 0
type: Comment
has text: @VinceEmigh No, I am asking for a null check operator...We do it in C# as String val = a?.child?.getValue();
type: QuestionComment

http://stackoverflow.com/comment/42692372
has text: I was afraid to post my code, getting of many kick backs from the community. I have posted my code for your information, even i think it is really a poor one. I am a beginner for coding, so please encourage.
score: 0
comment on: http://stackoverflow.com/q/27092858
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42740981
comment on: http://stackoverflow.com/a/27119733
has text: @Numeron - sure, and that'd probably be a better way to go. I was just having fun trying to do it without any `if` statements :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42638766
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27025958
type: Comment
has text: Sure :) It would also prevent data stacking up in the queue

http://stackoverflow.com/q/27085451
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
type: Question
has title: What is reason for following sql code couldn't insert data?
answer count: 2
tagged with: sql-insert
possible better answer: http://stackoverflow.com/a/27086022
tagged with: sql
upvote count: 1
has answer: http://stackoverflow.com/a/27086022
favorite count: 0
has body: My database have two column. One column is auto increment id(Primary Key) and other is 'Sentence' column. Manually type something and I can insert that value. But when I'm trying insert variable value that gives error message. I tried different ways. ('?') /( ? )/(?) Not work anything for me. int s1=9; String s2="Kasuni"; String sql = "INSERT INTO sentences (Sentence) VALUES ( ? )"; PreparedStatement pstmtJ = conn.prepareStatement(sql); //pstmtJ.setInt(1, s1); pstmtJ.setString(1,s2); pstmtJ.executeUpdate(sql); 1st value I didn't insert because of that is auto increment value. I just comment and that shows in my above code. Error message: Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? )' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(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:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566) at TestJsoup.main(TestJsoup.java:66) When I'm tring following code: int s1=9; String s2="Kasuni"; String sql = "INSERT INTO sentences (Sentence) VA…
has answer: http://stackoverflow.com/a/27085520
accepted answer: http://stackoverflow.com/a/27085520
type: AnsweredQuestion

http://stackoverflow.com/q/27086844
has title: Filter out list of elements in a "lazy" way
answer count: 4
has answer: http://stackoverflow.com/a/27087452
has answer: http://stackoverflow.com/a/27086897
possible better answer: http://stackoverflow.com/a/27086897
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27087212
tagged with: java
has answer: http://stackoverflow.com/a/27087251
score: 4
has comment: http://stackoverflow.com/comment/42682709
accepted answer: http://stackoverflow.com/a/27087452
type: Question
upvote count: 4
has body: I have a list of objects and I want to create another list, which will include only objects for which the method acceptable() returns "true". My problem is that I want to make this selection done only on demand. In other words, I want a new list to be calculated and populated only when its iterator() method is called. Are there any libraries for that in Java? I'm using JDK7
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/27016822
has answer: http://stackoverflow.com/a/27016869
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42559215
has title: Why are variable not recognised from inside for-statements?
has answer: http://stackoverflow.com/a/27016914
favorite count: 0
has body: What I am trying to do is create an array that pulls even numbers from another array. I'm not sure if I have gone about it the right way. I've look for ways of returning from statements like you would functions/methods and I can't find anything, not even sure if it is possible. Anyway, the issue I am having here is the 'return evenArray' below 'cannot find symbol.' I am not sure what this means? public static int[] getEvenArray(int[] array) { int dividedBy = 2; int evenElement; int evenCount = 0; for(int i = 0; i &lt; array.length; i++) { int[] evenArray; evenElement = array[i] % dividedBy; if(evenElement == 0) { evenCount++; } else { array[i] = 0; } evenArray = new int[evenCount]; for(int x = 0; x &lt; evenArray.length; x++) { if(array[i] != 0) { evenArray[x] = array[i]; } } } return evenArray; } This is for a tutorial from one of my lectures, it's a little bit challenging to say the least :-)0
has comment: http://stackoverflow.com/comment/42559281
tagged with: return
has comment: http://stackoverflow.com/comment/42559474
has comment: http://stackoverflow.com/comment/42559496
upvote count: 2
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: cannot-find-symbol
downvote count: 2

http://stackoverflow.com/comment/42639163
type: Comment
has text: sorry forgot to mention, you can only move a cargo to the wagon on the left or to the one on the right
type: QuestionComment
comment on: http://stackoverflow.com/q/27062497
score: 0

http://stackoverflow.com/a/27059496
downvote count: 0
has body: I would suggest a helper method: &lt;T&gt; Iterator&lt;T&gt; skipFirstIterator(Iterable&lt;T&gt; iterable) { Iterator&lt;T&gt; it = iterable.iterator(); it.next(); return it; } And call that in your for-loop header. The method impliciltly asserts the existence of the first element and throws an exception otherwise. I believe this is how it should be, given your program logic. If your list may legitimately have zero elements, then simply replace it.next(); with if (it.hasNext()) it.next();
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27059350

http://stackoverflow.com/q/27002508
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42535215
has answer: http://stackoverflow.com/a/28432220
answer count: 2
accepted answer: http://stackoverflow.com/a/28432220
possible better answer: http://stackoverflow.com/a/27002613
has title: Getting error "Cannot refer to a non-final variable inside an inner class defined in a different method"
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27002613
has comment: http://stackoverflow.com/comment/42534750
has body: I'm new to both Java and Android programming. I get the error with this code: public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tView=(TextView) findViewById(R.id.txt); Button btn=(Button) findViewById(R.id.button); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub tView.setText("Blah Blah"); } }); But when I declare reference type "tView" out of the onCreate() method simply the error goes away then the code would be like this: public class MainActivity extends ActionBarActivity { TextView tView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tView=(TextView) findViewById(R.id.txt); Button btn=(Button) findViewById(R.id.button); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub tView.setText("Blah Blah"); } }); So what's the difference when I declare reference type "tview" inside the method onCreate() and outside it?
type: Question

http://stackoverflow.com/q/27097427
has comment: http://stackoverflow.com/comment/42700299
has title: Android application crashes when trying to load maps
tagged with: android-maps-v2
has body: I am trying to launch map with in my application and it crashes with the below error: 11-23 21:23:16.345: E/AndroidRuntime(32288): FATAL EXCEPTION: main 11-23 21:23:16.345: E/AndroidRuntime(32288): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable 11-23 21:23:16.345: E/AndroidRuntime(32288): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source) 11-23 21:23:16.345: E/AndroidRuntime(32288): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.app.Activity.onCreateView(Activity.java:4965) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 11-23 21:23:16.345: E/AndroidRuntime(32288): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.app.Activity.setContentView(Activity.java:1956) 11-23 21:23:16.345: E/AndroidRuntime(32288): at com.example.mymaps.MainActivity.onCreate(MainActivity.java:27) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.app.Activity.performCreate(Activity.java:5372) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257) 11-23 21:23:16.345: E/AndroidRuntime(32288): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349) 11-23 21:23:16.3…
score: 0
answer count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14372391
tagged with: android
tagged with: android-maps
type: Question
has answer: http://stackoverflow.com/a/27097574
tagged with: java

http://stackoverflow.com/a/27052658
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42622714
has comment: http://stackoverflow.com/comment/42622695
type: Answer
answers question: http://stackoverflow.com/q/27052514
upvote count: 1
has comment: http://stackoverflow.com/comment/42622658
has comment: http://stackoverflow.com/comment/42622797
has body: Depending on what you are trying to do, you can use... JTable#setValueAt(Object, int, int) or TableModel#setValueAt(Object, int, int) to modify the row/column values of existing cells. Just beware, that the model and view might have different indices based on the current sort order and column positions. You can use DefaultTableModel#addRow to add new rows and You can use DefaultTableModel#removeRow to remove them. Just remember, the index value MUST be within the models context, if you are taking the original value from the table/view, it must be converted first to the model's context... For example... import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.DefaultTableModel; public class Test { public static void main(String[] args) { new Test(); } private JTable myJTable; private String values[] = {"Orange", "Green", "Blue", "Pink", "Yellow"}; private int count; public Test() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } myJTable = new JTable(); myJTable.setModel(new DefaultTableModel( new Object[][]{{"Banana", "Yellow"}}, new Object[]{"Fruit", "Color"} )); JButton change = new JButton("Change"); change.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { count++; String value = values[Math.abs(count % values.length)]; myJTable.setValueAt(value, 0, 1); } }); JButton add = new JButton("add"); add.addActionListener(new ActionListener() { @Override public void actio…

http://stackoverflow.com/a/27114613
has body: You are creating an Object[] and then trying to cast it to a Comprable[]. The compiler was telling you what you did wrong with the unchecked cast error. You want data to be E[] data and the line to be: data = new E[s]; Note: this could run into issues with how Java handles generics.
accepted answer of: http://stackoverflow.com/q/27114432
has comment: http://stackoverflow.com/comment/42736298
has comment: http://stackoverflow.com/comment/42733111
type: Answer
has comment: http://stackoverflow.com/comment/42732057
has comment: http://stackoverflow.com/comment/42733288
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27114432
has comment: http://stackoverflow.com/comment/42732965
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/27145140
type: Question
has title: javafx with swt : SWT.error() using animation
has comment: http://stackoverflow.com/comment/42927032
tagged with: java
upvote count: 2
has body: I'm developing an RCP application which uses some JavaFX controls and animations. Using the "Oracle Java Mission Control tool". I saw that I have a hot JavaFX Thread that is running (a lot) into a SWT.error. I reproduced this behavior using the oracle snippet (http://docs.oracle.com/javafx/2/swt_interoperability/jfxpub-swt_interoperability.htm). (I removed the buttons and added the animation. import javafx.animation.Interpolator; import javafx.animation.TranslateTransition; import javafx.embed.swt.FXCanvas; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.Text; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class TwoButtons { public static void main(String[] args) { TranslateTransition fTranslateTransition; final Display display = new Display(); final Shell shell = new Shell(display); final GridLayout layout = new GridLayout(); shell.setLayout(layout); shell.setSize(1000, 80); final FXCanvas fxCanvas = new FXCanvas(shell, SWT.NONE) { @Override public Point computeSize(int wHint, int hHint, boolean changed) { getScene().getWindow().sizeToScene(); int width = (int) getScene().getWidth(); int height = (int) getScene().getHeight(); return new Point(width, height); } }; fxCanvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Group group = new Group(); Text fBanner = new Text(); fBanner.setX(10); fBanner.setY(18); fBanner.setText("breaking news !!"); fBanner.setFont(Font.font("Arial", 20)); fBanner.setFill(Color.gray(0.3)); /* Create the Scene instance and set the group node as root */ Scene scene = new Scene(group, Color.AQUAMARINE); fxCanvas.setScene(scene); fTranslateTransition = new TranslateTransition(); fTranslateTransition.setNode(fBanner); fTranslateTransition.setFromX(shell…
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
score: 2
answer count: 0
downvote count: 0
tagged with: javafx
tagged with: swt
has comment: http://stackoverflow.com/comment/42787075

http://stackoverflow.com/comment/42604168
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27042335
has text: Ok, @nos. Then what actual "points" i need to include to make my classloader works? I mean where i need to add it or smth...

http://stackoverflow.com/q/27021241
type: Question
has answer: http://stackoverflow.com/a/27021732
score: 0
answer count: 1
has title: Array/range selection
has body: This was asked in an interview and I was not able to come up with a solution. The scenario is that there is an array of weights (of some items). The cost of choosing an item is 1. Now if you choose item of weight w, you get all items in range[w, w+4] as free. The job of the algorithm is to achieve minimum cost and pick all items. My approach was to have a max heap and traverse the array and while traversing the array calculate the number of items that can be obtained for free by picking up the current item and use max heap to pick items that gaurantee maximum items for free. The interviewer said OK but asked me for a better solution as the traversing part itself cost O(n^2). Concrete Example Weights array: 1 2 3 17 10 Minimum cost 3: I pick 1, get 2 and 3 for free and then pick both 17 and 10
tagged with: algorithm
tagged with: java
type: UnansweredQuestion
tagged with: arrays

http://stackoverflow.com/q/27105160
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27107558
has title: Unable to configure Hikaricp 2.2.5 with Java 6
has comment: http://stackoverflow.com/comment/42714801
tagged with: java
has comment: http://stackoverflow.com/comment/42715525
type: Question
has comment: http://stackoverflow.com/comment/42718285
has comment: http://stackoverflow.com/comment/42715329
has comment: http://stackoverflow.com/comment/42717014
has comment: http://stackoverflow.com/comment/42715824
has comment: http://stackoverflow.com/comment/42714095
tagged with: hikaricp
score: 0
has comment: http://stackoverflow.com/comment/42717203
has answer: http://stackoverflow.com/a/27107558
has comment: http://stackoverflow.com/comment/42714990
answer count: 1
has comment: http://stackoverflow.com/comment/42715206
tagged with: spring
has body: I have a Spring java web application. I am trying to use Hikaricp 2.2.5 for connection pooling with the following configuration. Maven: com.zaxxer HikariCP-java6 2.2.5 compile XML: <property name="minimumIdle" value="5"/> <property name="maximumPoolSize" value="200"/> <property name="dataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"/> <property name="username" value="root"/> <property name="password" value="root"/> <property name="connectionTestQuery" value="SELECT 1"/> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/app"/> <property name="autoCommit" value="true"/> <property name="connectionTimeout" value="30000"/> <property name="idleTimeout" value="600000"/> <property name="maxLifetime" value="1800000"/> <property name="poolName" value="LoginPool"/> I am getting the following error NoSuchMethodError. Exception Stack Trace: Caused by: java.lang.NoSuchMethodError: java.sql.Connection.getNetworkTimeout()I at com.zaxxer.hikari.util.PoolUtilities.isJdbc41Compliant(PoolUtilities.java:245) at com.zaxxer.hikari.pool.HikariPool.addConnection(HikariPool.java:412) at com.zaxxer.hikari.pool.HikariPool.fillPool(HikariPool.java:500) at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:159) at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:110) at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:102) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860) at org.springframework.orm.hibernate3.Loca…

http://stackoverflow.com/comment/42564682
has text: yes I think so; without any sleeping in the consumer, it is probably very fast in filling the queue before the consumer get access to it. To see the behaviour more realistically, add several consumers and several producers, with small random sleeping times
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27015972

http://stackoverflow.com/comment/42720333
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27093598
has text: @mprabhat: thanks. It's funny that the only people voting on this question are the two of us, you up-voted me, and I up-voted you (yesterday).

http://stackoverflow.com/comment/42754878
has text: Yes I agree It should be in different class but I have some limitations...@talex but code you have given is not working
comment on: http://stackoverflow.com/a/27126937
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27161368
type: AcceptedAnswer
type: Answer
has body: I will do a cache based on this Stack Overflow answer of @BalusC. How to read and copy the HTTP servlet response output stream content for logging. I can't exchange the response of other request, but I can cache the previous response by a short time. The subsequent requests can receive the cached response, thus it will avoid the processor flood. Thank @eduyayo for the suggestions.
has comment: http://stackoverflow.com/comment/43051966
accepted answer of: http://stackoverflow.com/q/27003759
answers question: http://stackoverflow.com/q/27003759
score: 0

http://stackoverflow.com/q/27020925
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/27021620
has answer: http://stackoverflow.com/a/27021115
upvote count: 0
type: UnansweredQuestion
has title: Application Android don't work with all the verions of device Android
tagged with: dialog
tagged with: java
tagged with: eclipse
type: Question
has body: I developed an Android application. It works fine in the phones having the version 4.4 but it shows the following error message when i run it on phone having the version 2.2. 11-19 16:25:26.012: E/WindowManager(12231): Activity com.example.smart_survey.QR has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@406beb98 that was originally added here 11-19 16:25:26.012: E/WindowManager(12231): android.view.WindowLeaked: Activity com.example.smart_survey.QR has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@406beb98 that was originally added here 11-19 16:25:26.012: E/WindowManager(12231): at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:263) 11-19 16:25:26.012: E/WindowManager(12231): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:171) 11-19 16:25:26.012: E/WindowManager(12231): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:114) 11-19 16:25:26.012: E/WindowManager(12231): at android.view.Window$LocalWindowManager.addView(Window.java:424) 11-19 16:25:26.012: E/WindowManager(12231): at android.app.Dialog.show(Dialog.java:241) 11-19 16:25:26.012: E/WindowManager(12231): at com.example.smart_survey.QR$Logs.onPreExecute(QR.java:362) 11-19 16:25:26.012: E/WindowManager(12231): at android.os.AsyncTask.execute(AsyncTask.java:391) 11-19 16:25:26.012: E/WindowManager(12231): at com.example.smart_survey.QR$UpdateScore.onPostExecute(QR.java:255) 11-19 16:25:26.012: E/WindowManager(12231): at com.example.smart_survey.QR$UpdateScore.onPostExecute(QR.java:1) 11-19 16:25:26.012: E/WindowManager(12231): at android.os.AsyncTask.finish(AsyncTask.java:417) 11-19 16:25:26.012: E/WindowManager(12231): at android.os.AsyncTask.access$300(AsyncTask.java:127) 11-19 16:25:26.012: E/WindowManager(12231): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429) 11-19 16:25:26.012: E/WindowManager(12231): at android.os.Handler.dispatchMessage(Handler.java:99) 11-19 16:25:26.012: E/WindowManager(12231):…
answer count: 2
has comment: http://stackoverflow.com/comment/42566494
score: -2
downvote count: 2

http://stackoverflow.com/comment/42699765
score: 0
has text: Try using something more like `return new ImageIcon(getClass().getResource("/" + name)).getImage();`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27096913

currency
tag name: currency
tags question: http://stackoverflow.com/q/26995784
tags question: http://stackoverflow.com/q/27130897
type: Tag
tags question: http://stackoverflow.com/q/27113734

http://stackoverflow.com/comment/42744455
type: Comment
comment on: http://stackoverflow.com/q/27121746
score: 0
has text: possible duplicate of [In Java,Using switch statement with a range of value in each case?](http://stackoverflow.com/questions/10873590/in-java-using-switch-statement-with-a-range-of-value-in-each-case)
type: QuestionComment

http://stackoverflow.com/comment/42551236
score: 0
has text: Array of which object you want?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27012294

http://stackoverflow.com/comment/42719909
has text: See updated answer. I don't know exactly what conditions you want to start or stop the sound, but basically you need to call `loop()` only once when you want to start the sound so you need some boolean to keep track of whether it's currently playing.
comment on: http://stackoverflow.com/a/27092958
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/27150734
has body: Stateless apps are the preferred way. Its acceptable to persist/retrieve the state using one of the below techniques: If you have (or can have) one of the in-memory caching services like memcached, or an in-memory data grid like HazelCast, you can use those for storing the state. Any instance can save/retrive the state based upon some unique clientId or sessionId in one of these stores. In the database. This is not possible with REST clients, but for completeness: For UI clients, you might retrieve the state from HTTP cookies, thus passing the burden of keeping the state to the client. This is certainly not a comprehensive list, but is a list of commonly used techniques.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27149392

http://stackoverflow.com/comment/42828699
score: 0
type: AnswerComment
has text: I guess, out of context, the name `length` was a poor choice :-/
comment on: http://stackoverflow.com/a/27133137
type: Comment

http://stackoverflow.com/q/27148502
has answer: http://stackoverflow.com/a/27149175
tagged with: java
has title: Why we get Multiple dex files define error in android
score: 0
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/42792998
has comment: http://stackoverflow.com/comment/42792786
has comment: http://stackoverflow.com/comment/42792503
tagged with: android
has body: I am creating a jar file where i did right click on project name then export&gt;java&gt;Jar file and then i checked on export generated class files and resources by selecting only src folder files and classpath and .project file. This jar file i tried to use in another android project and i am getting this above Unable to execute dex: Multiple dex files define com/example/projectname/xyzClass So i followed this link here and unchecked my jar in order and export of buildpath and if i do so i am getting another error java.lang.NoClassDefFoundError: com.example.xyzClass I have no idea why i am getting `Unable to execute dex: Multiple dex files define' error. And here is the screenshot of order and export of my project where i am using my servicedemonew2.jar file. I would be glad if someone assist me with this why and when do we get this above error.
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7870265
type: Question
has comment: http://stackoverflow.com/comment/42791993

http://stackoverflow.com/a/51777625
answers question: http://stackoverflow.com/q/27033650
score: 0
type: Answer
has body: @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == CODE_GALLERY_REQUEST){ if (grantResults.length &gt;0 &amp;&amp; grantResults[0]== PackageManager.PERMISSION_GRANTED){ Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent,"Select deposit slip"), CODE_GALLERY_REQUEST); }else{ Toast.makeText(getActivity(),"You dont Have permission",Toast.LENGTH_LONG).show(); } return; } super.onRequestPermissionsResult(requestCode, permissions, grantResults); }

http://stackoverflow.com/comment/42592444
score: 0
comment on: http://stackoverflow.com/q/27034650
type: QuestionComment
type: Comment
has text: How can i specify the layout and not add it to the center

http://stackoverflow.com/comment/42738319
type: Comment
type: QuestionComment
has text: Why not first show us your attempt to solve this? Edit -- or not. I guess August spoon fed you the answer. You know you're only cheating yourself by not trying or trying and not showing us your attempt. It's in those attempts where you really learn your Java. <shaking head>
comment on: http://stackoverflow.com/q/27118183
score: 1

parsing
tags question: http://stackoverflow.com/q/27111143
tags question: http://stackoverflow.com/q/27045578
tags question: http://stackoverflow.com/q/27138379
tag name: parsing
tags question: http://stackoverflow.com/q/27049149
tags question: http://stackoverflow.com/q/27032432
tags question: http://stackoverflow.com/q/27064878
tags question: http://stackoverflow.com/q/27107016
tags question: http://stackoverflow.com/q/27011776
tags question: http://stackoverflow.com/q/27097473
tags question: http://stackoverflow.com/q/27049409
tags question: http://stackoverflow.com/q/27000406
tags question: http://stackoverflow.com/q/27092771
tags question: http://stackoverflow.com/q/27105899
tags question: http://stackoverflow.com/q/27093638
tags question: http://stackoverflow.com/q/27099932
type: Tag
tags question: http://stackoverflow.com/q/27139845
tags question: http://stackoverflow.com/q/27066487
tags question: http://stackoverflow.com/q/27095380
tags question: http://stackoverflow.com/q/26996504
tags question: http://stackoverflow.com/q/27035715
tags question: http://stackoverflow.com/q/27000897
tags question: http://stackoverflow.com/q/27118042
tags question: http://stackoverflow.com/q/27006045
tags question: http://stackoverflow.com/q/27017905
tags question: http://stackoverflow.com/q/27054390
tags question: http://stackoverflow.com/q/27096414

http://stackoverflow.com/comment/42550608
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27011779
has text: Then you need more than one JLabel field. You should define as many fields as many buttons you have. Or define a Map<String, JLabel> and store the labels in the map where key could be button's text.
type: AnswerComment

http://stackoverflow.com/comment/42763603
type: Comment
comment on: http://stackoverflow.com/a/27131703
has text: Every class in Java descends from Object. They form a tree. You can cast an instance to a less specific ancestor. For example, you can cast everything to an `Object`. That **does not** make it an `Adapter`.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27069710
type: Answer
has body: You cannot do that with ScheduledExecutorService. The documentation for scheduleWithFixedDelay says: Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next. If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the executor. (My emphasis) For scheduleAtFixedRate, the documentation says: Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on. If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the executor. If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute. This class was designed to prevent concurrent execution of its tasks. You could, however, use the scheduler for threads whose only task is to run your ExampleThread: private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); public void beepForAnHour() { scheduler.scheduleWithFixedDelay(new ThreadMaker(), 1L, 1L, TimeUnit.SECONDS); } private static class ThreadMaker implements Runnable { @Override public void run() { Thread realThread = new Thread(new ExampleThread()); realThread.start(); } } private static class ExampleThread implements Runnable { @Override public void run() { System.out.println("1:"+System.currentTimeMillis()); try { Thread.sleep(5000L); } catch(InterruptedException e) { e.printStackTrace(); } System.out.println("2:"+System.currentTimeMillis()); } } In this manner, your scheduled task runs for only the split …
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/42652447
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27069179
answers question: http://stackoverflow.com/q/27069179

http://stackoverflow.com/comment/42552032
has text: Thanks thecodeflavour, I had a quick look at it and looks more like a solution to handle logs?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27001173
type: Comment

http://stackoverflow.com/q/26992908
has comment: http://stackoverflow.com/comment/66109596
score: 14
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/26993119
has answer: http://stackoverflow.com/a/63032345
favorite count: 0
has body: when i tried to create a workbook in normal java class it is creating but when i tried to run the same on servlet it is throwing exceptions Normal java class import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class Sampleclass { public static void main(String[] args) { FileInputStream file; try { file = new FileInputStream(new File("C:\\Users\\Rajasekhar\\Desktop\\EmployeeDetails.xlsx")); Workbook book=new XSSFWorkbook(file); System.out.println(book); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Servlet import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @SuppressWarnings("serial") public class sampleServlet extends HttpServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) { FileInputStream file; try { file = new FileInputStream(new File("C:\\Users\\Rajasekhar\\Desktop\\EmployeeDetails.xlsx")); Workbook book=new XSSFWorkbook(file); } catch (FileNotFoundException e) { System.out.println("exception occured is "+e); e.printStackTrace(); } catch (IOException e) { System.out.println("exception occured is "+e); e.printStackTrace(); } } } the exception occured was SEVERE: Servlet.service() for servlet [upload] in context with path [/Temp2] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook at org.apache.catalina.load…
has answer: http://stackoverflow.com/a/39964854
tagged with: http://stackoverflow.com/tag/xlsx
has title: java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook
downvote count: 1
has answer: http://stackoverflow.com/a/36075072
tagged with: xssf
upvote count: 15
has comment: http://stackoverflow.com/comment/42517046
has answer: http://stackoverflow.com/a/65952329
tagged with: apache-poi
answer count: 5
type: UnansweredQuestion

http://stackoverflow.com/comment/42597271
has text: There is another MainActivity defined but removing this causes more errors
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27038780

http://stackoverflow.com/a/27141646
has body: Try changing the line... View header = (View)inflater.inflate(R.layout.header_layout, container, false); to View header = (View)inflater.inflate(R.layout.header_layout, null, false);
has comment: http://stackoverflow.com/comment/42875116
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27140494
accepted answer of: http://stackoverflow.com/q/27140494

http://stackoverflow.com/comment/42547331
type: AnswerComment
comment on: http://stackoverflow.com/a/27009860
type: Comment
has text: How you have wrote this line in your code : JSONObject object = new JSONObject(YOUR RESPONSE STRING);
score: 0

http://stackoverflow.com/a/34885474
type: Answer
downvote count: 0
score: 1
has body: Click here to see full program Sample code: public static void main(String args[]) { int number = 333; int sum = 0; int num = number; while (num &gt; 0) { int lastDigit = num % 10; sum += lastDigit; num /= 10; } System.out.println("Sum of digits : "+sum); }
answers question: http://stackoverflow.com/q/27096670
upvote count: 1

http://stackoverflow.com/a/27017609
has body: here some piece of code: public static void main(String[] args) { String a = "C450.00 C30 P100"; String letters = ""; String numbers = ""; for (int i = 0; i &lt; a.length(); i++) { if ((a.charAt(i) + "").matches("\\d|\\.| ")) { numbers += a.charAt(i); } else { letters += a.charAt(i); } } String[] strArray = numbers.split(" "); int[] numberArray = new int[strArray.length]; for (int i = 0; i &lt; strArray.length; i++) { numberArray[i] = (int) Double.parseDouble(strArray[i]); System.out.println(numberArray[i]); } System.out.println(letters); } the result is numberArray, which contains all numbers as ints. and letters, which is a String with all letters.
score: 0
answers question: http://stackoverflow.com/q/27017178
type: Answer

http://stackoverflow.com/q/26992209
tagged with: inner-classes
tagged with: scala
has comment: http://stackoverflow.com/comment/42515652
has answer: http://stackoverflow.com/a/26993909
type: AnsweredQuestion
score: 3
tagged with: oop
tagged with: java
type: Question
has title: Static inner class vs Companion's inner class
linked to: http://stackoverflow.com/q/1069987
downvote count: 0
tagged with: companion-object
upvote count: 3
has body: Reading chapter 20 of Ordesky's book on Scala, I found that inner classes are path dependant. Among other features, that implies that they can only be instantiated within the outer class or giving an outer class instance. The question arises: I would like to implement an static inner class in Scala but the author suggest that is not possible. I immediatelly thought of making the "inner class" (lets call it Inner) a member of Outer's companion object. The accepted answer of this question seems to point towards that direction. But that drives to a problem: Inner's type ins't Outer#Inner, I could try something like: object Outer { class Inner extends Outer#Inner { } } This doesn't work however. Do you know a work arround for this? I have the hunch that it could be done with abstract types but I am not sure. Note that making Inner an inner class of the companion objects is not exactly as having a non-path-dependant Inner class because of its type.
answer count: 1
has comment: http://stackoverflow.com/comment/42515953
favorite count: 0
accepted answer: http://stackoverflow.com/a/26993909

opencv
type: Tag
tags question: http://stackoverflow.com/q/27136037
tags question: http://stackoverflow.com/q/27083097
tags question: http://stackoverflow.com/q/27035858
tags question: http://stackoverflow.com/q/27004661
tags question: http://stackoverflow.com/q/27065062
tags question: http://stackoverflow.com/q/27084953
tags question: http://stackoverflow.com/q/27058057
tag name: opencv
tags question: http://stackoverflow.com/q/27053041
tags question: http://stackoverflow.com/q/27022781
tags question: http://stackoverflow.com/q/27127700
tags question: http://stackoverflow.com/q/27065700
tags question: http://stackoverflow.com/q/27070199
tags question: http://stackoverflow.com/q/27086120
tags question: http://stackoverflow.com/q/27088934
tags question: http://stackoverflow.com/q/27082222

http://stackoverflow.com/q/26995080
tagged with: ranking
tagged with: arraylist
has body: I'm given a text file to read through. I can find the words in the text and file and their frequencies. I store this data in an ArrayList&lt;HashEntry&gt; where HashEntry consists of a key with the word and a value with the frequency. I sorted this ArrayList in decreasing frequency order using Collections.sort. So I end up with something like this: "a" 3, "a" 3, "a" 3, "now" 2, "days" 2, "everbody" 2, "wanna" 2, "they" 2, "they" 2, "their" 2, "just" 2, "now" 2, "days" 2, "talk" 1 I need to be able to produce something that will tell me the rank of occurrences. For example, "a" would have rank 1 because it appears the most. Everything that appears twice would have rank 2. "talk" would have rank 9 because there were 8 words that had a higher rank. How would I go about doing this? I'm having several problems with what I've tried so far because there are duplicates in the ArrayList and the duplicates aren't necessarily sequential. I tried putting the data into a hash table by iterating through the ArrayList, where the key is the word, but I'm not sure how I could actually calculate the rank for the word. for (int i = 0; i &lt; ranked.size(); i++) { //ranked is my array list rankedht.put(ranked.get(i).getKey(),1); //rankedht is a hash table } Doing that will just get me a hash table with the words and frequencies, but then that loses sort. Thanks
type: Question
has comment: http://stackoverflow.com/comment/42520798
has comment: http://stackoverflow.com/comment/42521070
has comment: http://stackoverflow.com/comment/42521152
has comment: http://stackoverflow.com/comment/42521005
has comment: http://stackoverflow.com/comment/42520926
has title: Sorting an array list of words based on frequency and finding its frequency rank
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42521380
has comment: http://stackoverflow.com/comment/42521170
answer count: 0
tagged with: sorting
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42521390
has comment: http://stackoverflow.com/comment/42521067

http://stackoverflow.com/a/27133459
downvote count: 0
has comment: http://stackoverflow.com/comment/42773098
has comment: http://stackoverflow.com/comment/42765826
upvote count: 2
has body: If it's okay to change the line order, you could create a Comparator to sort by length public class LengthComparator implements Comparator&lt;String&gt; { public int compare(String s1, String s2) { return s1.length() - s2.length(); } } Use Collections.sort to sort your list by length, then you can iterate through the sorted list compare each string to the next string, and see if that's shorter than the previous shortest int shortestIdx = 0; int shortestDist = Math.abs(list.get(0).length() - list.get(1).length()); for (int idx = 0; idx &lt; list.size(); idx++) { //left this for you to fill in }
type: Answer
has comment: http://stackoverflow.com/comment/42871962
score: 2
answers question: http://stackoverflow.com/q/27133236

http://stackoverflow.com/q/27094475
has comment: http://stackoverflow.com/comment/42694824
tagged with: arrays
has comment: http://stackoverflow.com/comment/42694889
favorite count: 0
has title: Efficient printwriting & minor issues
possible better answer: http://stackoverflow.com/a/27094640
has comment: http://stackoverflow.com/comment/42694970
has comment: http://stackoverflow.com/comment/42695261
upvote count: 0
has comment: http://stackoverflow.com/comment/42694812
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27094591
accepted answer: http://stackoverflow.com/a/27094591
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/42694771
type: Question
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/27094640
has body: I've been trying to print phone number to a file and just wondering how to make it more efficient. Right now, the time it takes for my program to write 28 phone numbers is 12.5seconds. I wonder if anyone could guide me to lower the runtime. Here's my print Method: &lt;code removed&gt; As you can see, I have to reset scanner every time since it gives me the order of list contrary to what I want.(I also need help on fixing this). For example: if I change the while loop to this: I get this result: expected result: actual result: TEL: 2475463 247 : AHR 2475463 : AIRLINE 247 : AHS 247 : AHR TEL: 2475463 247 : AHS 2475463 : AIRLINE -------- -------- I appreciate all your help and understanding.

http://stackoverflow.com/q/27006945
accepted answer: http://stackoverflow.com/a/27013835
tagged with: trilateration
has body: I am using android to scan WIFI AP's every frame of time, I am getting from each AP the Strength of Signal (RSSI in dbm) and I am calculating the distance with this formula: public double calculateDistance(double levelInDb, double freqInMHz) { double exp = (32.44 - (20 * Math.log10(freqInMHz)) + Math.abs(levelInDb)) / 20.0; return Math.pow(10.0, exp); } That is working fine, So I have three or more distances, now I need to draw on a map all AP's with its fixed locations, I made some reading on internet and I found the Trilateration (is the process of determining absolute or relative locations of points by measurement of distances) but it looks like I need at least one Point (x,y), at this moment I just have the calculated distances from the Signal Strength that can be taken as the radius of the different circumferences. I am confused because I don't have any concrete point (x,y) to start to calculate the location of the Mobile Phone. I just need to know if there is a way to calculate that point or I can assume that initial point or I am missing something. Thank you, I really appreciate any.
favorite count: 0
upvote count: 2
tagged with: android
tagged with: python
type: AnsweredQuestion
has title: Trilateration of 3 Calculated Distances from WiFI Strength Signals
tagged with: java
has answer: http://stackoverflow.com/a/27013835
type: Question
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/42548321
answer count: 1

glassfish-2.x
type: Tag
tag name: glassfish-2.x
tags question: http://stackoverflow.com/q/27073097

http://stackoverflow.com/q/27130897
has title: Currency Parsing in Java
has body: I'm trying to parse a html tag so far I got the text which can be as follows: "Guide Price £50,000" or "£50,000" or even "£50,000 - £55,000" In the third case to make things simpler all I need is the first price listed. My question is how can I convert the following numbers into an int or double, preferably an int as the numbers are quite large. Would number formatter do this or would I need a regex expression especially if some text trails the tag block. Example after what I got so far String priceNumber = url.select("span.price").text(); //using JSoup Libary String priceNumber = priceNumber.replaceAll("[^\\d.]) This removes everything which is not a digit I think. What if the example has 2 numbers in it how do I get the first?
has answer: http://stackoverflow.com/a/27131639
has answer: http://stackoverflow.com/a/27131576
tagged with: number-formatting
tagged with: currency
has answer: http://stackoverflow.com/a/27131743
has answer: http://stackoverflow.com/a/27131265
type: Question
has comment: http://stackoverflow.com/comment/42761234
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27131427
tagged with: regex
possible better answer: http://stackoverflow.com/a/27131265
has answer: http://stackoverflow.com/a/27143998
has comment: http://stackoverflow.com/comment/42760647
has comment: http://stackoverflow.com/comment/42761591
answer count: 6
accepted answer: http://stackoverflow.com/a/27131427
score: 0
tagged with: java

http://stackoverflow.com/comment/42544536
has text: You need to check that the values submitted are valid and they have permission to modify them
comment on: http://stackoverflow.com/q/27008051
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27141183
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/27141199
type: AnsweredQuestion
tagged with: java
type: Question
has body: Here is my code Scanner keyboard = new Scanner(System.in); System.out.print("Last name: "); lastName = keyboard.nextLine(); System.out.print("First name: "); firstName = keyboard.nextLine(); System.out.print("Email address: "); emailAddress = keyboard.nextLine(); System.out.print("Username: "); username = keyboard.nextLine(); and it outputs this Last name: First name: Basically it skips letting me enter lastName and goes straight to the prompt for firstName. However, if I use keyboard.next() instead of keyboard.nextLine(), it works fine. Any ideas why?
score: 5
accepted answer: http://stackoverflow.com/a/27141199
has title: Scanner nextLine() occasionally skips input
upvote count: 5
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42544433
comment on: http://stackoverflow.com/q/27007993
score: 1
has text: No, this isn't allowed. error: > expected (after SortedWood<A)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42781992
comment on: http://stackoverflow.com/q/27142534
score: 0
type: QuestionComment
type: Comment
has text: Seems as location is always the same. Let's confirm with the code

http://stackoverflow.com/q/27139265
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27139325
score: -3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27139325
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/42806329
type: Question
tagged with: sorting
has title: What sorting algorithm does Java adopt?
has comment: http://stackoverflow.com/comment/42776768
has body: What kind of algorithm does Collections.sort in Jana use? It might be similar to quick sort, I guess. Java has Array.sort, too. Are they different?
has comment: http://stackoverflow.com/comment/42776349

http://stackoverflow.com/comment/42745912
type: AnswerComment
type: Comment
has text: Then people in timezone Etc/GMT-14 have already 14 oclock, when people in GMT celebrate the new year? Is this right?But is Etc/GMT-14 the first?
comment on: http://stackoverflow.com/a/27121996
score: 0

http://stackoverflow.com/a/27123287
type: Answer
answers question: http://stackoverflow.com/q/27078584
has body: I am able to resolve the above issue. It was nothing to do with STAX. There were some loop holes in the code which I have fixed now.
downvote count: 1
accepted answer of: http://stackoverflow.com/q/27078584
upvote count: 0
score: -1
type: AcceptedAnswer

http://stackoverflow.com/comment/42784608
comment on: http://stackoverflow.com/q/27144212
score: 1
type: QuestionComment
type: Comment
has text: would http://stackoverflow.com/a/19466013/6309 help?

http://stackoverflow.com/a/27050554
has body: It largely depends on your use case. With the second variant, you always create a new DataEntity object, while with the first variant, users could reuse a single instance of that class. If the DataEntity objects are rather short-lived, but a lot of them will be created, the garbage collection might get busy cleaning up all the unused objects with the second variant. With the first variant, it's up to the user if they create a new instance every time or not. The second variant is the more traditional one, and more often to be seen. It is also less error-prone. Consider the situation a user reuses a single instance, but at some point doesn't take care and gives that object to some other method which decides to keep a reference to it. That instance is now modified, and when the other method (or class of that method) looks at the stored reference, all values have changed! For this reason, I'd suggest to use the second variant by default. The only case when I'd use the first variant is when know you will have millions of calls to createEntity that will create very short-lived objects and you are absolutely sure that none of the code dealing with such a DataEntity object will keep a reference to it. And even then, I'd first try to benchmark it to see if it really is a bottleneck. (Actually, I contribute to a large simulation framework which generates many millions of such simple Data objects, and for us, it was not yet worth the troubles to switch to the first variant as the gains would just be too small, but the chances of errors due to users keeping a reference to such an object too big)
type: Answer
answers question: http://stackoverflow.com/q/27049570
score: 0

http://stackoverflow.com/a/27102850
has comment: http://stackoverflow.com/comment/42712824
score: 2
has body: public class Swipe_Activity extends Activity { LinearLayout swipe_layout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); swipe_layout=(LinearLayout) findViewById(R.id.layout_swipe); swipe_layout.setOnTouchListener( new OnSwipeTouchListener(this)); } public class OnSwipeTouchListener implements OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeTouchListener (Context ctx){ gestureDetector = new GestureDetector(ctx, new GestureListener()); } private final class GestureListener extends SimpleOnGestureListener { private static final int SWIPE_THRESHOLD = 60; private static final int SWIPE_VELOCITY_THRESHOLD = 60; @Override public boolean onDown(MotionEvent e) { return true; } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { boolean result = false; try { float diffY = e2.getY() - e1.getY(); float diffX = e2.getX() - e1.getX(); if (Math.abs(diffX) &gt; Math.abs(diffY)) { if (Math.abs(diffX) &gt; SWIPE_THRESHOLD &amp;&amp; Math.abs(velocityX) &gt; SWIPE_VELOCITY_THRESHOLD) { if (diffX &gt; 0) { onSwipeRight(); } else { onSwipeLeft(); } } result = true; } /* else if (Math.abs(diffY) &gt; SWIPE_THRESHOLD &amp;&amp; Math.abs(velocityY) &gt; SWIPE_VELOCITY_THRESHOLD) { if (diffY &gt; 0) { onSwipeBottom(); } else { onSwipeTop(); } }*/ // result = true; } catch (Exception exception) { exception.printStackTrace(); } return result; } } public void onSwipeRight() { Log.i("Post", "right"); } public void onSwipeLeft() { Log.i("Post", "left"); Intent intent=new Intent(Swipe_Activity.this,Questions_Answers_Activity.class); startActivity(intent); } public void onSwipeTop() { Log.i("Post", "Top"); } public void onSwipeBottom() { Log.i("Post", "Bottom"); } @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub return gestureDetector.onTouchEvent(event); } }
has comment: http://stackoverflow.com/comment/42712602
has comment: http://stackoverflow.com/comment/42714222
has comment: http://stackoverflow.com/comment/42714236
has comment: http://stackoverflow.com/comment/42712986
has comment: http://stackoverflow.com/comment/42714868
has comment: http://stackoverflow.com/comment/42713339
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27098312
answers question: http://stackoverflow.com/q/27098312
has comment: http://stackoverflow.com/comment/42713910
type: Answer
upvote count: 2

http://stackoverflow.com/q/27071994
upvote count: 25
has comment: http://stackoverflow.com/comment/42656477
has body: I have a bit of a funny problem and instead of looking for a solution to it, I'm looking for solutions. Project Alice has a pom.xml. In it the pom says she gets packaged as a jar and although she is a strong woman, she is dependent on Bob. Project Bob, being a complementarian, says he depends on Alice. Ergo a circular dependency. Of course, running mvn compile on Alice says "Alice is missing Bob". And Bob, that true romantic, if you try and compile him, he misses Alice too. Since neither will comply without the other present, I'm looking for ways to resolve this. There is only two ways I know how to resolve this: Marry them and make them one maven project. Break their co-dependency Besides the fact that I don't want to promote incest, would making a parent pom and making Alice and Bob siblings solve this? Any other solutions?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42656440
downvote count: 3
has comment: http://stackoverflow.com/comment/42656577
has comment: http://stackoverflow.com/comment/42656496
tagged with: maven
has answer: http://stackoverflow.com/a/27072190
has comment: http://stackoverflow.com/comment/42656567
linked to: http://stackoverflow.com/q/8304110
has comment: http://stackoverflow.com/comment/42656383
tagged with: java
type: Question
answer count: 1
has title: Resolving or Compiling Circular Dependency in Maven
score: 22
has comment: http://stackoverflow.com/comment/74649867
favorite count: 0
has comment: http://stackoverflow.com/comment/42656438
linked to: http://stackoverflow.com/q/16468525
has comment: http://stackoverflow.com/comment/42656472
duplicate of: http://stackoverflow.com/q/16468525

http://stackoverflow.com/q/27014430
type: UnansweredQuestion
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/27014956
score: 1
tagged with: java
upvote count: 1
tagged with: finalize
type: Question
linked to: http://stackoverflow.com/q/2506488
has title: multiple call of the finalize
has body: I tried to write a class for counting the number of instances in memory. I used a static attribute - I increment it on the constructor and decrement it in the finalize method. You can see the Counter class below. On a main class (TestCounter), I made lists of counter. When I test this class with small values (java TestCounter 10 100) the result seems normal : Size of the list : : 0 curently : 100 over 100 created Size of the list : : 0 curently : 200 over 200 created Size of the list : : 0 curently : 300 over 300 created Size of the list : : 0 curently : 400 over 400 created Size of the list : : 0 curently : 500 over 500 created Size of the list : : 0 curently : 600 over 600 created Size of the list : : 0 curently : 700 over 700 created Size of the list : : 0 curently : 800 over 800 created Size of the list : : 0 curently : 900 over 900 created Size of the list : : 0 curently : 1000 over 1000 created Still 1000 instances in memory... waiting ... Still 1000 instances in memory... waiting ... Still 1000 instances in memory... waiting ... Still 1000 instances in memory... waiting ... As I read in an answer for this question, the garbage collector is not necessary called, so I call the GC explicitly (the 3 commented lines). And now nearly all instances seem liberated : curently : 10000 over 10000 created Still 7435 instances in memory... waiting ... at the end : 0 over 10000 created Sometimes, 1 or 2 instances seem stay to in memory... But if I try with more objects (java TestCounter 10 100000), the results are surprising. The "number of instances" can be negative, suggesting that the finalize() method is called twice... Size of the list : : 0 curently : 896577 over 1000000 created Still 892834 instances in memory... waiting ... Still -762 instances in memory... waiting ... Still -762 instances in memory... waiting ... Still -762 instances in memory... waiting ... Could you explain this behavior? Maybe I made an error or misunderstood something... public class Counter{ …
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42554897
favorite count: 0

http://stackoverflow.com/q/27123737
answer count: 1
has answer: http://stackoverflow.com/a/27128289
type: AnsweredQuestion
has title: Configuring a JTA datasource for JBoss 8 (WildFly)
tagged with: java
type: Question
tagged with: jndi
tagged with: datasource
accepted answer: http://stackoverflow.com/a/27128289
tagged with: jboss
score: 0
has body: So, I read several times that if you use a Java EE container, you do not need to add environment params to an InitialContext in order to be able to use JNDI. So I tried this: @Bean public DataSource dataSource() { JndiDataSourceLookup jndiDataSourceLookup = new JndiDataSourceLookup(); return jndiDataSourceLookup.getDataSource("java:global/ExpensesDataSource"); } However, retrieving a datasource using JNDI like this gives me a NoInitialContextException, telling me to specify the environment params. Now, okay, so seems I was wrong to think it would work so flawlessly, so I tried retrieving the datasource like this: @Bean public DataSource dataSource() { Properties jndiProperties = new Properties(); jndiProperties.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099"); jndiProperties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); jndiProperties.put("java.naming.factory.url.pkgs", "org.jboss.naming.org.jnp.interfaces"); JndiDataSourceLookup jndiDataSourceLookup = new JndiDataSourceLookup(); jndiDataSourceLookup.setJndiEnvironment(jndiProperties); return jndiDataSourceLookup.getDataSource("java:global/ExpensesDataSource"); } However this gives me a javax.naming.CommunicationException: Failed to connect to server localhost:1099 I've also tried just using localhost:1099 or localhost, none of them worked. So my question is: do I even need to specify these properties, since JBoss 8 is a Java EE container to my knowledge. And if so, what provider url do I need to specify here?

http://stackoverflow.com/comment/42853330
score: 0
type: QuestionComment
type: Comment
has text: I added your site to exception list and it still doesn't work. So then I looked at your html source and realized you're using the class file directly instead of wrapping it in a jar file. This is what you have: <applet code="GSort.class" width=700 height=400>. I think applets no longer work when using .class files directly. They have to be wrapped in jar files because you need to add some security settings to the meta-inf folder of the jar file. Here is how oracle recommends deploying an applet: https://docs.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html
comment on: http://stackoverflow.com/q/27049150

http://stackoverflow.com/comment/42566600
score: 0
comment on: http://stackoverflow.com/q/27021039
type: QuestionComment
has text: You are... Totally right. How come i didn't think about this before.
type: Comment

http://stackoverflow.com/comment/42755220
type: QuestionComment
type: Comment
has text: by keeping it in one's workspace and opening the right workspace at startup
comment on: http://stackoverflow.com/q/27128017
score: 0

http://stackoverflow.com/comment/42722881
has text: What do you mean with "that parameters not disappear elsewhere", you are saying that the parameter is not being displayed in the page ?
comment on: http://stackoverflow.com/q/27109677
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42646603
comment on: http://stackoverflow.com/q/27028865
score: 0
type: Comment
type: QuestionComment
has text: Thanks Bruce. Your answer may be correct but can you explain it a bit more to me. Are you available via skype by chance? I do not understand how to implement the answer you've given.

http://stackoverflow.com/q/27061036
linked to: http://stackoverflow.com/q/4827335
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/8023646
has body: I have a maven project depending on another maven projects. The project tree is the following: final_project | |----sub_project | |----jsf 1.2_09 |----jsf 2.0.3 How is it known what exactly jsf-library will be used in what project? I mean does it arise a conflict in such project? UPD: Because of the different group id: javax.faces jsf-impl 1.2_09 jar compile and com.sun.faces jsf-impl 2.0.3 these dependencies is not overridable.
has answer: http://stackoverflow.com/a/27061147
has title: Dependendecies with different versions
has comment: http://stackoverflow.com/comment/42636410
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42642758
tagged with: maven
type: Question
linked to: http://stackoverflow.com/q/27057481
tagged with: java

http://stackoverflow.com/a/27112408
answers question: http://stackoverflow.com/q/27107820
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27107820
has body: I think what you are asking for is coming with Eclipse Link 2.6.0. See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=431803 and https://wiki.eclipse.org/EclipseLink/Development/2.6.0

http://stackoverflow.com/a/27145862
has body: You are reading InputStream is twice. That is not possible. With the first reading you have already 'consumed' it. The parser will get an error like 'stream already consumed' if it tries to read the stream for the second time. You have to adapt your design. Just use always the file to parse for example. Or use a StringBuider to read the response in a String and then parse the string. You can then also save the string.
answers question: http://stackoverflow.com/q/27145389
has comment: http://stackoverflow.com/comment/42787703
type: Answer
has comment: http://stackoverflow.com/comment/42787666
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42787356
has comment: http://stackoverflow.com/comment/42787988
has comment: http://stackoverflow.com/comment/42787502
upvote count: 2
has comment: http://stackoverflow.com/comment/42787583
has comment: http://stackoverflow.com/comment/42787849
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27145389
has comment: http://stackoverflow.com/comment/42788024

http://stackoverflow.com/comment/42625869
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27040758
has text: Thanks for the answers. I am also considering trying with Java 6 update 45, but due to certain constraints related to nature of our software/and its platform/ bureaucracy involved, I have not yet tried but will be trying soon.
score: 0

http://stackoverflow.com/a/27129429
has body: How about: (?:(?&lt;!\\|)\\|(?:\\|)|\\|{2,}) This will match a pipe not preceeded nor followed by another pipe or a number of pipe greater than or equal to 2.
answers question: http://stackoverflow.com/q/27128528
score: 0
type: Answer

http://stackoverflow.com/q/27083106
answer count: 2
downvote count: 0
tagged with: intersection
accepted answer: http://stackoverflow.com/a/27083244
has comment: http://stackoverflow.com/comment/42675447
favorite count: 0
tagged with: geometry
has body: I want to calculate intersections between a ray and a segment. For this I form the linear equation and look for an intersection. Now I encounter a numerical problem for one example. An abbreviation of my code: public class Test { public static void main(String[] args) { double rayAX = 443.19661703858895d; double rayAY = 666.3485960845833d; double rayBX = 443.196744279195d; double rayBY = 103.21654864924565d; double segAX = 450.0d; double segAY = 114.42801992127828d; double segBX = 443.196744279195d; double segBY = 103.21654864924565d; double a1 = (rayBY - rayAY) / (rayBX - rayAX); double t1 = rayAY - rayAX * a1; double a2 = (segBY - segAY) / (segBX - segAX); double t2 = segAY - segAX * a2; double x = (t2 - t1) / (a1 - a2); double y = a1 * x + t1; System.out.println(x); System.out.println(y); } } Obviously the return should be (443.196744279195, 103.21654864924565) as this point is the same on both the ray and the segment. But the actual return is in my case (443.19674427919506, 103.21654844284058) In the second number there is an error already in the sixth decimal place. I guess the error is because the values rayAX and rayBX are very close to each other. My question is: Can I get a more precise result when calculating the intersection?
has title: Numerical inaccuracy calculating intersection
has answer: http://stackoverflow.com/a/27087610
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/27087610
has answer: http://stackoverflow.com/a/27083244
upvote count: 3
tagged with: java
tagged with: numeric
type: Question

http://stackoverflow.com/comment/42690561
type: AnswerComment
comment on: http://stackoverflow.com/a/27092106
type: Comment
has text: hello Roman, Thanks for this information and yes I always write sendRedirect() as last command to response.
score: 1

http://stackoverflow.com/q/27002032
has comment: http://stackoverflow.com/comment/42533943
has body: Is their a better way to format this for-loop? The user enters two integers which are initialised to x and y the program prints these values out as + for the first number and - for the second number. FOR EXAMPLE 9 and 5 would result in +++++++++----- I tried using a nested for-loop, but this resulted in +-----+-----+-----+-----+-----+-----+-----+-----+----- Scanner sc = new Scanner(System.in); int x,y,total = 0; System.out.println("Enter two numbers greater than 0 and no greater than 20!"); x = sc.nextInt(); y = sc.nextInt(); draw(x,y); private static void draw(int x, int y) { for(int i=1; i&lt;=x; i++) { System.out.print("+"); } for(int j=1; j&lt;=y; j++) { System.out.print("-"); } }
has answer: http://stackoverflow.com/a/27002414
possible better answer: http://stackoverflow.com/a/27002197
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/27002226
upvote count: 1
has comment: http://stackoverflow.com/comment/42534741
type: Question
has title: Java Code formatting for statment
tagged with: java
tagged with: formatting
tagged with: for-loop
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/27002226
favorite count: 0
has answer: http://stackoverflow.com/a/27002197

http://stackoverflow.com/q/27125550
answer count: 1
downvote count: 0
tagged with: amazon-web-services
favorite count: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27134043
upvote count: 1
has body: If have successfully developed and used Developer Authentication with Amazon Cognito. I have tried to upload images to S3 and download and display from there. What I want to do now is to secure my own webservice with the Cognito API. This is how Amazon WebServices are used, e.g. AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider); I want to secure my personal web services with the Cognito Security. Is it possible to secure developers personal webservices using Amazon Cognito?
tagged with: web-services
tagged with: amazon-cognito
type: Question
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27134043
has title: How to secure our own webservices with Amazon Cognito?

http://stackoverflow.com/a/27133441
has comment: http://stackoverflow.com/comment/42765556
has body: If the array is already sorted, like you show in your example, then you just have to do a simple search from where you start seeing a particular score, then taking the length of the array and subtracting the position of the element that came from your search. If the array isn't sorted, sort it and then do the search.
score: 0
answers question: http://stackoverflow.com/q/27133312
type: Answer
has comment: http://stackoverflow.com/comment/42767160

http://stackoverflow.com/a/28661302
answers question: http://stackoverflow.com/q/27142891
score: 2
upvote count: 2
has body: I think it should be allowed and considered valid in all languages. If you have a function whose return type is void and you return the result of an expression whose type is void (such as calling another void function), you've satisfied that constraint. It's not considered useful to do this in C (though I think it may be allowed) because there's no reason to need it. Anytime you do: return someVoidFn(); You can always translate that to: someVoidFn(); return; And get the exact same effect. However, in C++ and Java, returning a void function does have a real use, and that's because those languages have templates and generics. Consider this (not very useful) Java class: class NestedIdentity&lt;T&gt; { T run(int i, T value) { if (i == 0) return value; return run(i - 1); } } Its run method returns the value you pass to it, after calling itself a given number of times. I know, pointless, right? But the important part is that T may be void. You can do this: NestedIdentity&lt;Void&gt; nest = new NestedIdentity&lt;Void&gt;(); nest(5, null); And this works. In Java, Void (note the capitalization) instantiates a generic with a void-like type whose only value is null. If Java didn't allow returning a void expression in a void method, it would have to be a compile-time error to instantiate a generic with void.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42623331
has text: Could you show in hex the result of the decrypt? I mean, modular exponentiation usually is successful, but the result may not be correct. Also show the signature input in hex. Bouncy is not required for this. Please specify `"RSA/ECB/NoPadding"` for the decryption instead of just `"RSA"`
comment on: http://stackoverflow.com/q/27053117
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27127201
answer count: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/27127394
has answer: http://stackoverflow.com/a/27127259
has comment: http://stackoverflow.com/comment/42759852
has body: Is there a method JAVA to convert a radiant in degrees (° ' '')? For example radiant = - 272,7’ degrees: 4° 33’ S. Anybody can help me? Thank for your answers!
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5763841
upvote count: 2
has answer: http://stackoverflow.com/a/27127394
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/27127259
type: Question
has title: Convert radiant to degrees
has comment: http://stackoverflow.com/comment/42753792
score: 0
has answer: http://stackoverflow.com/a/27127270

http://stackoverflow.com/a/27120764
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42827728
answers question: http://stackoverflow.com/q/27119350
has body: There is no problem to play files that are installed on the device. You can open the file from the machine by the appropriate applications. And it is also possible to write code to play the files, do this: 1. Need to make sure the files are correct and appropriate format. 2. Need to ensure that access to read the files. 3. Write the appropriate code.
has comment: http://stackoverflow.com/comment/42820246
has comment: http://stackoverflow.com/comment/42825639

http://stackoverflow.com/comment/42607211
comment on: http://stackoverflow.com/q/27042973
score: 0
type: Comment
type: QuestionComment
has text: The criterion would be the count of the aggregation result. So lets say the page size of 1. In my example above, a terms aggregation on "contentId" in the "ViewsIndex" would return "bucket": [{"key": "4", "doc_count": 3}, {"key": "5", "doc_count": 1}], so page=1 would be computing the aggregation, seeing I want contentId 4, and then displaying that. For page=2, I'd do the same with an "from=1" on the aggregation. Not amazing, but would save precomputing everything, and might not be costly with aggregation caching. I don't think this is possible though, I was just checking.

web-services
type: Tag
tags question: http://stackoverflow.com/q/27132008
tags question: http://stackoverflow.com/q/27103673
tags question: http://stackoverflow.com/q/27009601
tags question: http://stackoverflow.com/q/27094046
tags question: http://stackoverflow.com/q/27014206
tags question: http://stackoverflow.com/q/27143397
tags question: http://stackoverflow.com/q/27000590
tags question: http://stackoverflow.com/q/27133695
tags question: http://stackoverflow.com/q/27009056
tags question: http://stackoverflow.com/q/27125272
tags question: http://stackoverflow.com/q/27102930
tags question: http://stackoverflow.com/q/27126360
tags question: http://stackoverflow.com/q/27032420
tags question: http://stackoverflow.com/q/27151335
tags question: http://stackoverflow.com/q/27058636
tags question: http://stackoverflow.com/q/27011899
tags question: http://stackoverflow.com/q/27002968
tags question: http://stackoverflow.com/q/27060259
tags question: http://stackoverflow.com/q/27069276
tags question: http://stackoverflow.com/q/27137593
tags question: http://stackoverflow.com/q/27065075
tags question: http://stackoverflow.com/q/27074419
tags question: http://stackoverflow.com/q/27014771
tags question: http://stackoverflow.com/q/27125550
tags question: http://stackoverflow.com/q/27067327
tags question: http://stackoverflow.com/q/27139886
tags question: http://stackoverflow.com/q/27105279
tags question: http://stackoverflow.com/q/26997331
tags question: http://stackoverflow.com/q/27146746
tags question: http://stackoverflow.com/q/27105078
tags question: http://stackoverflow.com/q/27098177
tags question: http://stackoverflow.com/q/27035000
tag name: web-services
tags question: http://stackoverflow.com/q/27016202
tags question: http://stackoverflow.com/q/27114974
tags question: http://stackoverflow.com/q/27025708
tags question: http://stackoverflow.com/q/27042286
tags question: http://stackoverflow.com/q/27130105
tags question: http://stackoverflow.com/q/27035724
tags question: http://stackoverflow.com/q/27003743
tags question: http://stackoverflow.com/q/26999118
tags question: http://stackoverflow.com/q/27130669

http://stackoverflow.com/comment/42783982
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27142406
has text: @KaushikSivaprasad You have a loop prior to the line that isn't reached. The loop never exits because the loop condition remains true. That is not a deadlock.
type: AnswerComment

http://stackoverflow.com/comment/42681854
comment on: http://stackoverflow.com/q/27080231
score: 0
has text: I will try it @ursa and will share my result.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42687606
type: QuestionComment
comment on: http://stackoverflow.com/q/27090344
score: 0
type: Comment
has text: This isn't really an internationalization issue, its a code structure issue. I'll answer the question but it may help get other answers to edit your title.

http://stackoverflow.com/comment/42822434
type: AnswerComment
comment on: http://stackoverflow.com/a/27106280
type: Comment
has text: seems _locationProvider = String.Empty and RequestLocationUpdates fails. Now I try to tests the version on Galaxy Note I. thank you.
score: 0

http://stackoverflow.com/comment/42759347
type: AnswerComment
score: 0
has text: Working on it, I'll let you know if it works or not.
type: Comment
comment on: http://stackoverflow.com/a/27129527

http://stackoverflow.com/comment/42534139
comment on: http://stackoverflow.com/q/27001919
score: 0
type: Comment
type: QuestionComment
has text: Any particular reason you're extending application?

http://stackoverflow.com/comment/42641567
type: QuestionComment
has text: You haven't showed us the BallTest class, but I'm gonna take a wild guess that it doesn't have a static field `ball`.
comment on: http://stackoverflow.com/q/27063722
score: 0
type: Comment

http://stackoverflow.com/a/27005658
has body: By default, Gradle will select the highest version for a dependency when there's a conflict. You can force a particular version to be used with a custom resolutionStrategy (adapted from http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html): configurations.all { resolutionStrategy { force 'com.google.guava:guava:15.0' } } This doesn't add a dependency on guava 15.0, but says if there is a dependency (even transitively) to force the use of 15.0. You can get more information on where your dependencies come from with gradle dependencies and gradle dependencyInsight .... FYI, it looks like you have a few different versions of Guava requested (11.0.2, 14.0.1, 15.0 and 18.0). HTH
has comment: http://stackoverflow.com/comment/42617607
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/42567456
downvote count: 0
has comment: http://stackoverflow.com/comment/42541056
has comment: http://stackoverflow.com/comment/42541626
has comment: http://stackoverflow.com/comment/42542059
answers question: http://stackoverflow.com/q/27004899
has comment: http://stackoverflow.com/comment/42540708
type: Answer

http://stackoverflow.com/comment/42570272
has text: you can use onStop or onDestroy too
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27023131
type: AnswerComment

http://stackoverflow.com/q/27106563
type: Question
has comment: http://stackoverflow.com/comment/42716519
has comment: http://stackoverflow.com/comment/42716392
linked to: http://stackoverflow.com/q/25953054
tagged with: google-play-services
score: 0
tagged with: mocking
tagged with: location
has body: I'm trying to mock the GPS location in my app but as soon as I set mocked location, any app using the google play services is unable to get the location of the device, whether it's the real one or the mocked one. For instance, if I open Google Map and try to go to my location, i'll get the message waiting for the location and nothing will happen. That's the same in my app, the location is never found my code is the following: public class MockLocationService { protected Context context; // Define a LocationClient object public LocationClient mLocationClient; // provider of fake locations private static final String PROVIDER = "flp"; // TAG for the logs protected static final String TAG = "MockLocationService"; // intens for states public static final String MOCK_LOCATION_SERVICE_CONNECTED = "CONNECTED"; public static final String MOCK_LOCATION_SERVICE_DECONNECTED = "DECONNECTED"; public static final String MOCK_LOCATION_SERVICE_FAILED = "FAILED"; public static final String MOCK_LOCATION_SERVICE_SETTING_NOT_ENABLED = "SETTING_NOT_ENABLED"; // current mockLocation protected static Location currentMockLocation; public MockLocationService(Context context) { this.context = context; // connect to the Google play services mLocationClient = new LocationClient(context, connectionCallbacks, onConnectionFailedListener); } /** * Connect to the API to enable mocking the location */ public void connect() { // Connect to Location Services // ONLY WHEN CALLBACK IS CALLED, ACT mLocationClient.connect(); } /** * Disconnect from the API, stops mocking the location */ public void disconnect() { // terminate aTask aTask.cancel(true); currentMockLocation=null; // disconnect mLocationClient.disconnect(); } /** * Sets the location from a LocationMessage object as the device current * location * * @param location */ public void setLocation(LocationMessage location) { if (location.getLat() == null || location.getLng() == null || location.getAccuracy() == null) return; Location newLocation = …
has title: Unable to fix when mocking location on Android
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java

http://stackoverflow.com/a/46099880
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27128317
has body: public static void setFooter(XWPFDocument document, String footerText) { CTP ctpFooter = CTP.Factory.newInstance(); ctpFooter.addNewR().addNewT(); XWPFParagraph footerParagraph = new XWPFParagraph(ctpFooter, document); XWPFRun footerRun = createFormattedRun(footerParagraph); footerRun.setFontSize(6); footerRun.setText(footerText); XWPFParagraph[] parsFooter = new XWPFParagraph[1]; parsFooter[0] = footerParagraph; CTSectPr sectPr = document.getDocument().getBody().addNewSectPr(); XWPFHeaderFooterPolicy policy = new XWPFHeaderFooterPolicy(document, sectPr); policy.createFooter(XWPFHeaderFooterPolicy.DEFAULT, parsFooter); }
downvote count: 0
score: 1

http://stackoverflow.com/comment/42621511
has text: I want to feed input into minecraft_server.jar as if my program where its console. @abarnert
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27052061

http://stackoverflow.com/comment/42620044
has text: You have access to the source code, we took it apart and rebuilt as a custom viewer for our needs (better thread management for starters)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27050515

http://stackoverflow.com/q/27014435
has title: how to re-populating jsp page fields when errors are there in binding result after server side validations?
score: 0
tagged with: jsp
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42559628
answer count: 0
has comment: http://stackoverflow.com/comment/42556728
tagged with: java
has body: I have a spring MVC based application in which i am handling server side validations using annoations and custom validator and handling errors using binding result. On submit when validations fails, jsp page field values does not retain its value. i am using the below code on the jsp &lt;spring:bind path="applicantDetails.name"&gt; &lt;input type="text" name="applicantDetails.name" title='&lt;fmt:message key="PERSON_NAME" /&gt;' maxlength="20" id="name" /&gt; &lt;/spring:bind&gt; On controller, i have something like: public String submitDetails( @ModelAttribute("beanName") @Valid ManageBean manageBean, BindingResult result, HttpSession session, Model model) { MyBeanValidator validator = new MyBeanValidator (); validator.validate(manageBean, result); if (result.hasErrors()) { return "pageName"; } What do i need to do so that the values entered on the page appears in the text box.
has comment: http://stackoverflow.com/comment/42556425
type: Question
has comment: http://stackoverflow.com/comment/42556877

http://stackoverflow.com/comment/43329908
comment on: http://stackoverflow.com/a/27444287
score: 0
type: AnswerComment
type: Comment
has text: My guess is that it has to do with session management in the test. Because entity code looks fine, and as long as the session is active during entity modifications it should work.

header
type: Tag
tags question: http://stackoverflow.com/q/27047338
tags question: http://stackoverflow.com/q/27128317
tag name: header
tags question: http://stackoverflow.com/q/27012058

http://stackoverflow.com/q/27105299
possible better answer: http://stackoverflow.com/a/27139841
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42715671
linked to: http://stackoverflow.com/q/6690745
tagged with: generics
favorite count: 0
linked to: http://stackoverflow.com/q/25958687
has comment: http://stackoverflow.com/comment/42715714
tagged with: java-8
linked to: http://stackoverflow.com/q/1302605
has comment: http://stackoverflow.com/comment/42717157
upvote count: 11
type: AnsweredQuestion
has title: Java 8 - converting an Integer to a long compilation issue
tagged with: java
has answer: http://stackoverflow.com/a/27106106
has body: I have the following abstract generic data holder in my project (simplified): public abstract static class Value&lt;E&gt; { E value; public void setValue(E value) { this.value = value; } public E getValue() { return this.value; } public String toString() { return "[" + value + "]"; } } Along with an InputCollection which contains a list of Objects: public static class InputCollection { private ArrayList&lt;Object&gt; values; public InputCollection() { this.values = new ArrayList&lt;&gt;(); } public void addValue(Value&lt;?&gt; value) { System.out.println("addding " + value + " to collection"); this.values.add(value); } public &lt;D&gt; D getValue(Value&lt;D&gt; value, D defaultValue) { int index = this.values.indexOf(value); if (index == -1) return defaultValue; Object val = this.values.get(index); if (val == null) { return defaultValue; } return ((Value&lt;D&gt;)val).getValue(); } } The idea behind this is to be able to define a set of final variables which implements this abstract Value&lt;E&gt; in a so-called 'state', like so: public static final class Input&lt;E&gt; extends Value&lt;E&gt; { public static final Input&lt;String&gt; STRING_ONE = new Input&lt;String&gt;(); public static final Input&lt;Integer&gt; INTEGER_ONE = new Input&lt;Integer&gt;(); } Then, adding these variables to an instance of InputCollection, which in turn is shared by many 'states' or 'processes'. The value of an Input&lt;E&gt; can then be changed by a different state, and then be retrieved when needed by the original state. A kind of shared memory model. This concept has been working fine for years (yea, this is legacy), but we recently started moving over to Java 8, and this created compilation errors, even though the implementation worked on Java 7. Add the following main to the above code samples: public static void main (String [] args) { InputCollection collection = new InputCollection(); //Add input to collection collection.addValue(Input.STRING_ONE); collection.addValue(Input.INTE…
type: Question
has comment: http://stackoverflow.com/comment/42715443
accepted answer: http://stackoverflow.com/a/27106106
has answer: http://stackoverflow.com/a/27139841
linked to: http://stackoverflow.com/q/5385743
tagged with: long-integer
has comment: http://stackoverflow.com/comment/42716175
tagged with: eclipse
score: 11

http://stackoverflow.com/comment/124100986
has text: BOMInputStream! Where have you been all my life?!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/42696546
score: 2

http://stackoverflow.com/q/27149791
favorite count: 0
has comment: http://stackoverflow.com/comment/42795042
tagged with: android
upvote count: 6
answer count: 0
has body: I'm trying to draw custom shapes for an android application that I am developing an I am doing so using paths. public Path makeFloorPath(){ Path p = new Path(); p.moveTo(50, 300); p.lineTo(100, 250); p.quadTo(200, 250, 250, 200); p.lineTo(250, 250); p.lineTo(300, 300); p.close(); return p; } However a lot of the time it seems like a guessing game. Is there a free path generator app out there which allows you to visually draw paths? The best I have found is this http://codecanyon.net/item/path-generator/full_screen_preview/337072 The problem is this program has limitations as you can not edit points but you can generate java paths.
type: UnansweredQuestion
tagged with: path
score: 6
tagged with: java
type: Question
has title: Path generator application for android
tagged with: vector
downvote count: 0

http://stackoverflow.com/a/27006746
has comment: http://stackoverflow.com/comment/42542922
has comment: http://stackoverflow.com/comment/42542611
type: Answer
has comment: http://stackoverflow.com/comment/42542771
answers question: http://stackoverflow.com/q/27006709
has comment: http://stackoverflow.com/comment/42542566
has comment: http://stackoverflow.com/comment/42542964
has body: Access modifiers affect direct access to that member. SubType can get access to item indirectly, through the public getter method, which exists in SuperType and thus has access to the private item member variable. But SubType can't directly access it, i.e. this is an error if in SubType: s.item // error; private in SuperType
upvote count: 4
has comment: http://stackoverflow.com/comment/42542980
downvote count: 0
has comment: http://stackoverflow.com/comment/42542842
score: 4

http://stackoverflow.com/comment/42625587
comment on: http://stackoverflow.com/q/27054437
score: 0
type: Comment
type: QuestionComment
has text: A couple global variables are ServerSocket and ArrayList objects, I can't have them be final for me to use them.

http://stackoverflow.com/a/27115778
answers question: http://stackoverflow.com/q/27071731
type: AcceptedAnswer
type: Answer
has body: My problem was that I was using Android 4.4W which (as I realized later) is the so-called Android Wear and is applicable to very specific devices only (like watches e.g.). After switching to the normal Android 4.4.2, the issue described in my question disappeared.
accepted answer of: http://stackoverflow.com/q/27071731
score: 0

http://stackoverflow.com/comment/42765349
has text: If I wanted to make it add the entire matrix as a whole instead of just the diagonal, what would be the best way? @eran
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27133194
type: Comment

http://stackoverflow.com/comment/42559506
score: 0
comment on: http://stackoverflow.com/q/27016693
has text: @ Shoaib Chikate: so I am basically forced to use something that I might call a chained-factories-pattern where prototype classes (single instances) get instantiated via @Autowired chains and the actual working copies are created by "getInstance(...)" methods? If yes, well, that's quite ugly.
type: Comment
type: QuestionComment

linked-list
tags question: http://stackoverflow.com/q/27076962
tag name: linked-list
tags question: http://stackoverflow.com/q/27091802
type: Tag
tags question: http://stackoverflow.com/q/27069486
tags question: http://stackoverflow.com/q/27020447
tags question: http://stackoverflow.com/q/27089776
tags question: http://stackoverflow.com/q/27065069
tags question: http://stackoverflow.com/q/27004647
tags question: http://stackoverflow.com/q/27041407
tags question: http://stackoverflow.com/q/27149585
tags question: http://stackoverflow.com/q/27133236
tags question: http://stackoverflow.com/q/27004818
tags question: http://stackoverflow.com/q/27048698
tags question: http://stackoverflow.com/q/27072409
tags question: http://stackoverflow.com/q/27031370
tags question: http://stackoverflow.com/q/27107623

http://stackoverflow.com/a/26997706
score: 1
answers question: http://stackoverflow.com/q/26997649
has body: The final modifier allows a field to be assigned only once - it cannot be changed after that and it has to be set at during object construction (that is, before the constructor returns). If you want to make the field read-only, use the principles of information hiding: make it private and provide a public getter that returns the field (or a copy of it for non-primitive types). You should use public final only for true constants. Even if your field is immutable because of final it is often a good idea to still make it private.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/27079535
has comment: http://stackoverflow.com/comment/42669042
score: 0
answers question: http://stackoverflow.com/q/27079241
type: Answer
has body: You should use OnItemClickListener instead of onclick listener on each list item. To disable the onClick effect on "title" type item, you can use isEnabled method in your adapter class. @Override public boolean isEnabled(int position) { // TODO Auto-generated method stub return super.isEnabled(position); }

http://stackoverflow.com/comment/42531274
type: Comment
has text: I'm sorry, I can't quite understand this. Is this correct, this a list and through the list you've defined a range of 0 to 100 on the second line. Then you've created both a maximum and minimum range value that can be altered only within the code. I'm not quite understanding the *i +29** on your fourth line. Could you explain the fifth line to me please?
comment on: http://stackoverflow.com/a/27000504
score: 0
type: AnswerComment

http://stackoverflow.com/a/26996658
has body: Use BigDecimal.compareTo(val) to compare if your Number is bigger, smaller or equal. returns -1, 0, or 1 as this BigDecimal is numerically less than, equal to, or greater than val. if (price.compareTo(BigDecimal.ZERO) &gt;= 0 &amp;&amp; price.compareTo(new BigDecimal(500)) &lt;= 0) { .... } else if (price.compareTo(new BigDecimal(500)) &gt;= 0 &amp;&amp; price.compareTo(new BigDecimal(1000)) &lt;= 0) { .... } else if (price.compareTo(price.compareTo(new BigDecimal(1000)) &lt; 0) { .... }
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42523927
has comment: http://stackoverflow.com/comment/42523967
score: 1
answers question: http://stackoverflow.com/q/26996600
downvote count: 0
has comment: http://stackoverflow.com/comment/42524208
has comment: http://stackoverflow.com/comment/42523935

appium
tags question: http://stackoverflow.com/q/27069687
tag name: appium
tags question: http://stackoverflow.com/q/27120762
tags question: http://stackoverflow.com/q/26998390
tags question: http://stackoverflow.com/q/27129406
type: Tag
tags question: http://stackoverflow.com/q/27119049

http://stackoverflow.com/comment/42751092
comment on: http://stackoverflow.com/q/27125645
has text: Are you putting this code before setContentView?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27140530
has comment: http://stackoverflow.com/comment/42778776
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27140383
score: 4
answers question: http://stackoverflow.com/q/27140383
type: Answer
has body: When you call: Rational r1 = new Rational(num1, den1); Rational r2 = new Rational(num2, den2); in the main method of your program you are creating two instances of the Rational class, one named r1 and one named r2. Because you are passing int values to the Rational constructors, the constructor that will be called is the constructor which requires two integer arguments: public Rational(int n, int d) { ... } The compiler knows this because it matches the name of the Constructor as well as the types of the arguments passed (known as matching the "signature" of the Constructor). In the code you have provided, the Rational Constructor code doesn't really make sense - this code: public Rational(int n, int d) { n = TextLab05.num1; d = TextLab05.den1; } should probably look something like this: public Rational(int n, int d) { this.firstNum = n; this.firstDen = d; } The values n and d are passed to the constructor, and then in the body of the constructor the instance variables firstNum and firstDen (which are declared in the private part of the Rational class and effectively "belong" to the instance being created) would then be initialised to the values of n and d. Everywhere within the body of the Rational class you should refer to the member variables firstNum and firstDen, rather than variables that do not "belong" to the class instance.
upvote count: 4

http://stackoverflow.com/comment/42660418
score: 2
comment on: http://stackoverflow.com/q/27074312
type: QuestionComment
type: Comment
has text: Apply [Collections.shuffle()](http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#shuffle%28java.util.List,%20java.util.Random%29) to the deck.

http://stackoverflow.com/comment/42792685
score: 0
has text: That's notpossible for me as I want to store the qualifier in a properties file.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27108223

http://stackoverflow.com/a/27044841
has body: You are running into JLS-5.1.4 Widening and Narrowing Primitive Conversion, The following conversion combines both widening and narrowing primitive conversions: byte to char First, the byte is converted to an int via widening primitive conversion (§5.1.2), and then the resulting int is converted to a char by narrowing primitive conversion (§5.1.3). final byte b = 1; char c = (char) ((int) 2); // &lt;-- 2 is an int literal c = (char) ((int) 1); // &lt;-- b is 1 a byte literal If you examine the bytescodes with javap -v you'll see the the value 1 has already replaced the variable b after compilation. public static void main(java.lang.String[]) throws java.lang.Exception; descriptor: ([Ljava/lang/String;)V flags: ACC_PUBLIC, ACC_STATIC Exceptions: throws java.lang.Exception Code: stack=2, locals=3, args_size=1 0: iconst_1 1: istore_1 // b = 1 2: iconst_2 3: istore_2 // c = 2 4: iconst_1 // integer1. 5: istore_2 // c = 1.
upvote count: 2
answers question: http://stackoverflow.com/q/27044674
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/42741007
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27080696
has text: And one more question i wanted to ask:If i have a form and i have given the action to a particular servlet,Then also do i have to configure it in web.xml.Because in my eclipse also i have not configured SearchController in web.xml,But the action of the search is pointing to SearchController.This is working fine in my eclipse.
score: 0

http://stackoverflow.com/q/27069361
favorite count: 0
has title: java going through array field without creating new instance
type: AnsweredQuestion
tagged with: reflection
downvote count: 0
has body: I'm trying to write a method which gets an Object and does some logic with the Object's fields. My method looks like: public void exampleCast(Object obj) { Field[] fields = obj.getClass().getFields(); for (Field field : fields) { if (field.getClass().isArray()) { /* HOW CAN I GO OVER THE ARRAY FIELDS , WITHOUT CREATING NEW INSATCNE ? SOMETHING LIKE: for (int i = 0; i &lt; array.length; i++) { array[i] ... } */ } else { ... ... } } } And an example of objects: class TBD1 { public int x; public int y; public int[] arrInt = new int[10]; public byte[] arrByte = new byte[10]; } And the call to my method: TBD1 tbd1 = new TBD1(); exampleCast(tbd1); In my method, I don't know how can I get the array values without create new instance (using the newInstance method) Is it possible? (please see the comment I wrote in my example) I have read those 2 websites: http://jroller.com/eyallupu/entry/two_side_notes_about_arrays http://tutorials.jenkov.com/java-reflection/arrays.html ... but I didn't get what I wanted to.
score: 1
has answer: http://stackoverflow.com/a/27069423
accepted answer: http://stackoverflow.com/a/27069423
type: Question
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/a/27106383
has comment: http://stackoverflow.com/comment/42717251
score: 0
has comment: http://stackoverflow.com/comment/42716623
answers question: http://stackoverflow.com/q/27105902
type: Answer
has comment: http://stackoverflow.com/comment/42720379
has body: Next line bind POST request to a path YOUAPPCONTEXT/addQuestion @RequestMapping(value = "/addQuestion", method = RequestMethod.POST) so you simply submit the form to specified path, but you have no params in your method. For example if your form has input fields named question,category,questionId you should define your method as follows @RequestMapping(value = "/addQuestion", method = RequestMethod.POST) public String addQuestion(@RequestParam(value="question", required = true) String theQuestion , @RequestParam(value=" questionId", required = true) Integer questionId, @RequestParam(value="category", required = true) String category) throws SQLException{ ViewController viewController = new ViewController(); viewController.createQuestion(questionId, theQuestion, category, return "qFour"; }
has comment: http://stackoverflow.com/comment/42718961

http://stackoverflow.com/q/27125630
tagged with: java
tagged with: gradle
type: Question
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/27127444
accepted answer: http://stackoverflow.com/a/27127444
favorite count: 0
has body: I am new to gradle and am trying to create a directory layout as such in netbeans: myproject | |-- ear |-- build.gradle |-- ... |-- core |-- build.gradle |-- ... |-- web |-- build.gradle |-- include core project as dependency for this project |-- ... |-- settings.gradle // has include "ear", "core", "web" I cant find a way to do this, in Google. Can anyone help me? Thanks in advance
has title: How to create gradle multi-project in netbeans?
type: AnsweredQuestion
score: 2
tagged with: netbeans
downvote count: 0

http://stackoverflow.com/q/27131086
has comment: http://stackoverflow.com/comment/42832450
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27133859
accepted answer: http://stackoverflow.com/a/27132912
possible better answer: http://stackoverflow.com/a/27133859
has comment: http://stackoverflow.com/comment/42761603
tagged with: hibernate-validator
tagged with: spring
has comment: http://stackoverflow.com/comment/42766041
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42838274
has body: I had used Hibernate validator with Spring, and the model "Admin" I need to check like this: @NotEmpty @Size(min = 4, max = 40) private String password; when I save "admin" the password is required, and I used "@Valid @ModelAttribute Admin admin". So it will be checked before save. But when I update the admin, if the user didn't provide the password, we think that he didn't want to change password, so the null value for the password is legal, for this situation, we couldn't use "@Valid @ModelAttribute Admin admin" anymore, because the password property have been annotation with @NotEmpty, so for this situation, our approach is do by ourselves in the code manually, I suppose if is there a better way to solve? and we still want to use the Bean Validation feature. And also another issue: @NotEmpty @Size(min = 2, max = 20) private String username; when we save username, we must check the username whether exists or not, that we need to check the DB, and this situation how to solve if we still use the bean validation, defined a class level annotation? I hope anyone could help me. Thanks
has answer: http://stackoverflow.com/a/27132912
type: Question
has comment: http://stackoverflow.com/comment/42766074
tagged with: spring-mvc
has title: Spring Hibernate validator issue about model add and update method
tagged with: java

http://stackoverflow.com/q/27101978
type: Question
has body: I get the concept of immutability, and why it is a good idea to make DTOs immutable. I also notice that Java has an @Immutable annotation that we can use to annotate immutable classes. My question is: what does annotating a Java class as @Immutable give us? Are there any library features that only work on classes annotated in this way?
has title: What is the advantage of annotating an immutable Java class with @Immutable?
tagged with: concurrency
has answer: http://stackoverflow.com/a/27110465
score: 22
upvote count: 22
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27102456
has answer: http://stackoverflow.com/a/27102456
accepted answer: http://stackoverflow.com/a/27110465
tagged with: immutability
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27144156
tagged with: java
tagged with: annotations
has comment: http://stackoverflow.com/comment/42708529

http://stackoverflow.com/q/27128165
tagged with: swing
has body: I have been using JTree to get the multiple root directories of the system, using the example FileTreeModel.java to achieve it. And also trying to get the selected leaf (path) but it throws cast error, please give me some directions on this, have posted the code so far have tried. Thanks. import java.io.File; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; import java.io.File; public class FileTreeDemo { public static void main(String[] args) { // Figure out where in the filesystem to start displaying File root; if (args.length &gt; 0) { root = new File(args[0]); //System.out.println(args.length); } else root = new File(System.getProperty("user.home")); //System.out.println(args.length); // Create a TreeModel object to represent our tree of files FileTreeModel model = new FileTreeModel(root); // Create a JTree and tell it to display our model JTree tree = new JTree(); tree.setModel(model); tree.setRootVisible(true); tree.setShowsRootHandles(true); //tree.setShowsRootHandles(true); // The JTree can get big, so allow it to scroll. JScrollPane scrollpane = new JScrollPane(tree); // Display it all in a window and make the window appear JFrame frame = new JFrame("FileTreeDemo"); frame.getContentPane().add(scrollpane, "Center"); frame.setSize(400,600); frame.setVisible(true); // Add a listener tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) e .getPath().getLastPathComponent(); System.out.println("You selected " + node); } }); } } class FileTreeModel implements TreeModel { protected File root; public FileTreeModel(File root) { this.root = root; } public Object getRoot() { return root; } public boolean isLeaf(Object node) { r…
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: jtree
has title: Get multiple root directories on JTree to select the leaf - Swing
has answer: http://stackoverflow.com/a/27128454
accepted answer: http://stackoverflow.com/a/27128454
upvote count: 1
tagged with: user-interface
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/42796766
score: 0
type: AnswerComment
type: Comment
has text: Thanks for your detailed answer! I read the Akka routing documentation, still some points are missing: Is it possible for Actor to know his route (his hash key)? Can Actor manage a state except his mailbox?
comment on: http://stackoverflow.com/a/27107539

http://stackoverflow.com/comment/42634507
comment on: http://stackoverflow.com/q/27059996
type: Comment
has text: check it with the find function.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42853761
has text: @NoahHuppert Setting the fetch type to `EAGER` will immediately fetch child along with parent entity. Hope this will work for you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27131802
type: Comment

http://stackoverflow.com/comment/42690618
type: QuestionComment
comment on: http://stackoverflow.com/q/27083084
has text: @TJamesBoone to be honest , i am supposed to use Map<Integer,Integer> but i dont really know how to get the inputs from the user ... using strings allow me to search for the comma and the 2 numbers you know.. i'm certain there is a way but i couldn't figure it out so i followed this method writtne on the book. so the inputs will be numbers for sure, and there will be duplicates of values for sure... i need first to determine the duplicates of values ( i tried doing that by getValues() and it worked ) but then i couldn't replace the coressponding key smaller key :( i searched the whole API...
score: 0
type: Comment

http://stackoverflow.com/comment/42706007
type: Comment
has text: I've re-opened this. It's really NOTHING LIKE the question that it was closed as a duplicate of.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27098584

http://stackoverflow.com/comment/42670405
type: AnswerComment
has text: And how can i run a method in this Class?
type: Comment
comment on: http://stackoverflow.com/a/27080128
score: 0

http://stackoverflow.com/comment/42612196
comment on: http://stackoverflow.com/q/27046730
score: 0
type: Comment
has text: @AlexanderKohler don't say that, please!!!! lol my hopes and dreams are being shattered :(
type: QuestionComment

http://stackoverflow.com/q/27092100
score: 0
type: UnansweredQuestion
tagged with: loops
type: Question
has body: public class InterfaceGUI implements ActionListener { private JFrame frame; private JPanel panelController; private JPanel panelJack; private JPanel panelModbus; private JPanel panelLog; private JPanel panelStatus; private JPanel panelToController; private JPanel panelToJack; private JLabel lblIpAddController; private JLabel lblPortController; private JLabel lblIpAddJack; private JLabel lblPortJack; private JLabel lblStatusToController; private JLabel lblStatusConnToCont; private JLabel lblIpAddToController; private JLabel lblIpAddConnToCont; private JLabel lblPortToController; private JLabel lblPortConnToCont; private JLabel lblStatusToJack; private JLabel lblStatusConnToJack; private JLabel lblIpAddToJack; private JLabel lblIpAddConnToJack; private JLabel lblPortToJack; private JLabel lblPortConnToJack; private JLabel lblSlaveId; private JLabel lblIcon; private JButton btnConnController; private JButton btnDiscController; private JButton btnConnJack; private JButton btnDiscJack; private JButton btnConnModbus; private JTextArea textAreaConnLog; private JTextField textFieldIpAddController; private JTextField textFieldPortController; private JTextField textFieldIpAddJack; private JTextField textFieldPortJack; private JTextField textFieldSlaveId; private Socket myClient; public byte[] message = new byte[5]; private static final String modbusConn = "modbusconnect"; private static final String modbusDisc = "modbusdisconnect"; /** * Launch the application. */ public static void main(String[] args){ EventQueue.invokeLater(new Runnable() { public void run() { try { InterfaceGUI window = new InterfaceGUI(); window.frame.setVisible(true); //window.receiveMessage(); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public InterfaceGUI() { initialize(); } public void startRunning() throws IOException{ try { while (true){ System.out.println("receive"); InputStream inFromServer = myClient.getInputStream(); DataInputStream in = new DataInputS…
has title: looping function and receiving bytes in java
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/27094419

http://stackoverflow.com/q/27151960
has title: Nested Sorting in Java List based on two elements Using Comparator
upvote count: 2
has answer: http://stackoverflow.com/a/27152890
has comment: http://stackoverflow.com/comment/42799523
type: AnsweredQuestion
score: 2
tagged with: list
tagged with: java
possible better answer: http://stackoverflow.com/a/27152890
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27152442
downvote count: 0
has body: I have a java list that i need to sort after adding objects to it. the object has three elements. a string and two integers. the class is as follows:- public class ValueWords implements Comparable&lt;ValueWords&gt;{ //............................................. public static final Comparator&lt;ValueWords&gt; valComparator = new Comparator&lt;ValueWords&gt;() {@Override public int compare(ValueWords v1, ValueWords v2) { return v1.valWord - v2.valWord; } } }; //.................................................................... private String strWord; private int valWord; private int phraseWord; public int getPhraseWord() { return phraseWord;} public void setPhraseWord(int phraseWord) { this.phraseWord = phraseWord;} public String getStrWord() { return strWord;} public void setStrWord(String strWord) { this.strWord = strWord;} public int getValWord() { return valWord;} public void setValWord(int valWord) { this.valWord = valWord;} public ValueWords() {} @Override public int compareTo(ValueWords arg0) { // TODO Auto-generated method stub return 0;} //.............................................. } i call it like this Collections.sort(valWordList,ValueWords.valComparator); it gives me the sorted list as follows:- --------------------------------------------- strWord valWord phraseWord abcd 0 1 abcde 0 0 mns 1 2 efgh 1 1 xyz 2 2 zxx 2 0 -------------------------------------------- i want a nested sorting like:- --------------------------------------------- strWord valWord phraseWord abcde 0 0 abcd 0 0 efgh 1 1 mns 1 2 zxx 2 0 xyz 2 2 -------------------------------------------- i have followed made few futile tries but being new to java. they did not work. and they are quiet primitive to be placed here.
has comment: http://stackoverflow.com/comment/42799557
tagged with: sorting
tagged with: comparator
favorite count: 0
has comment: http://stackoverflow.com/comment/42798529
accepted answer: http://stackoverflow.com/a/27152442

http://stackoverflow.com/q/27019933
upvote count: 0
has title: Interact with bundle in Apache Felix
has answer: http://stackoverflow.com/a/27020316
has body: I made a program that offers a CLI where you can type a number and calculate the square root of the number typed. I built a bundle starting from this simple application and installed on Apache Felix. The problem is that I can't interact with it (insert a number in the gogo shell) when launched in Felix. Someone has an idea on how to solve this or a work-around to get it works?
score: -1
answer count: 1
favorite count: 0
tagged with: apache-felix
tagged with: osgi
type: UnansweredQuestion
tagged with: osgi-bundle
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/a/27216285
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27089754
upvote count: 1
has body: Kivy cannot be easily integrated in an existing Java app, Kivy (the android part) have already a integrated Java application. Python is the main part, and you can execute Java code from Python using Pyjnius. Or write direct Java code. You want the inverse, which is not something we are targeting. I suggest you to check android-python27 project instead.
type: Answer

http://stackoverflow.com/comment/42768960
type: Comment
has text: I am unclear what you are concerned about. Are you afraid having a config file on your server is insecure? That does not really have anything to do with Java, and more to do with the general security of your server.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27135331

http://stackoverflow.com/q/27151163
type: Question
tagged with: help-system
score: 0
has answer: http://stackoverflow.com/a/27151865
answer count: 1
tagged with: eclipse-plugin
has body: I use a wizard to create a new Plug-in Project and select the template "Plug-in with sample help content". If I start the created project, the sample table of contents is listed in help view. I want to move the whole bunch of xml and html help-files into a 'help'-directory: The paths in plugin.xml are changed automatically by eclipse: The same for the toc*.xml files: The entry bin.includes in build.properties is changed appropriately as well: But the sample table of contents isn't shown anymore if I start eclipse with this plugin. I can't see any exceptions and there are no related messages in error log. Any ideas what I am missing?
type: AnsweredQuestion
has title: Eclipse Help Plugin - Move xml files into a nested directory of a project
accepted answer: http://stackoverflow.com/a/27151865
tagged with: java

http://stackoverflow.com/comment/42576679
type: Comment
type: QuestionComment
score: 1
has text: Instead of dumping 100 lines of code on us, use a debugger to more closely identify where the issue is.
comment on: http://stackoverflow.com/q/27026733

http://stackoverflow.com/comment/42685952
has text: Thank you @Gagravarr, you saved me. I used 3.10.FINAL and it works! I didn't want to switch versions because other parts of the project are using 3.7 and I didn't want to risk breaking those parts. I'm going to test those parts to see if everything works fine. THANK YOU!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27069135
score: 0

http://stackoverflow.com/comment/42689551
comment on: http://stackoverflow.com/q/27090959
type: Comment
type: QuestionComment
has text: Tip: Add @trashgod (or whoever, the `@` is important) to notify the person of a new comment. *"There will be a lot of other functions."* So? What methods of the extended panels are overridden? That is the ***only*** situation I can think of where it actually makes sense to override. Otherwise, these panels come into being mainly because of GUI editors. Are you using a GUI editor, or laying out the panels yourself?
score: 0

http://stackoverflow.com/comment/42694751
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27087290
has text: it's difficult (next to impossible) to mock Java Mail :(
score: 0

http://stackoverflow.com/a/27053281
has comment: http://stackoverflow.com/comment/42627712
has comment: http://stackoverflow.com/comment/42635317
has comment: http://stackoverflow.com/comment/42650420
has comment: http://stackoverflow.com/comment/42634977
score: 0
has comment: http://stackoverflow.com/comment/42647514
has body: You've moved your smart card provider in front of the other providers on Java SE, and for some reason it is also trying to verify RSA signatures instead of just using it for RSA private key operations. There are a few methods of solving this: if you are using the same signature instance for verification, then use a different one for the verification with the public key if that doesn't solve your problem, try and see if you can move the smart card provider down in the list of providers in the Security class (check the JCA documentation on how to do this) otherwise simply provide the correct provider using the Signature class, I would recommend specifying "SunRsaSign" (you may want to make this string configurable) explain to the company behind com.mse that they should implement delayed provider selection correctly and not gobble up software public keys for use in their hardware device Note that talking about "server side" is very confusing as the smart card acts as a server. "Terminal side" and "card side" would be a much more clear.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27053117
has comment: http://stackoverflow.com/comment/42645544
type: Answer
answers question: http://stackoverflow.com/q/27053117
has comment: http://stackoverflow.com/comment/42646116
has comment: http://stackoverflow.com/comment/42649688
has comment: http://stackoverflow.com/comment/42645899

http://stackoverflow.com/q/27125528
has title: Change inflated row in adapter on click
answer count: 0
has comment: http://stackoverflow.com/comment/42752022
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42751718
type: Question
tagged with: java
tagged with: layout-inflater
has comment: http://stackoverflow.com/comment/42752121
has comment: http://stackoverflow.com/comment/42751960
tagged with: baseadapter
has comment: http://stackoverflow.com/comment/42751833
score: 0
has comment: http://stackoverflow.com/comment/42751824
tagged with: android
has comment: http://stackoverflow.com/comment/42751544
has body: I have an adapter with buttons and text views. It represents friend requests. TextView text would be : Do you want to accept X as your friend? There are 2 buttons : one for accepting, one for declining. Pressing Decline, it would just remove the row from the ListView, while pressing accept will change the text into: X and Y are now friends. My question is how can I get the position of the row and change it on button press and also save the View for next time I access it? Adapter : At the moment I don't have proper data structure for the adapter, so for testing purposes, just using a String: public class FriendRequestAdapter extends BaseAdapter { String mName; Context mContext; public FriendRequestAdapter(String name, Context context) { this.mName = name; this.mContext = context; } @Override public int getCount() { return 1; } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.friend_request_layout, null); } TextView sender_name = (TextView) convertView.findViewById(R.id.wannabe_name); if (mName.length() &gt; 11) { mName = mName.substring(0, 12); } sender_name.setText(mName); ImageButton friend_request_accepted = (ImageButton) convertView.findViewById(R.id.accept_friend_request); friend_request_accepted.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new AsyncTask&lt;Void, Void, Void&gt;() { @Override protected Void doInBackground(Void... params) { try { new APIService().confirmInvite(); } catch (IOException e) { e.printStackTrace(); } return null; } }; } }); return convertView; } Inflated Layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout android:id="@+id/changing_layout" xmlns:android…

http://stackoverflow.com/comment/42602812
type: Comment
has text: Out of curiosity, is there any reason to ignore case on an empty string?
comment on: http://stackoverflow.com/a/27041680
score: 0
type: AnswerComment

http://stackoverflow.com/a/27047776
has comment: http://stackoverflow.com/comment/42614502
has body: The observed behavior is affected by the HotSpot optimizer, however it is not the only cause. When I run the following code public static void main(String[] argv) { System.out.println(System.getProperty("java.version")); System.out.println(countDepth()); System.out.println(countDepth()); System.out.println(countDepth()); System.out.println(countDepth()); System.out.println(countDepth()); System.out.println(countDepth()); System.out.println(countDepth()); } static int countDepth() { try { return 1+countDepth(); } catch(StackOverflowError err) { return 0; } } with JIT enabled, I get results like: &gt; f:\Software\jdk1.8.0_40beta02\bin\java -Xss68k -server -cp build\classes X 1.8.0_40-ea 2097 4195 4195 4195 12587 12587 12587 &gt; f:\Software\jdk1.8.0_40beta02\bin\java -Xss68k -server -cp build\classes X 1.8.0_40-ea 2095 4193 4193 4193 12579 12579 12579 &gt; f:\Software\jdk1.8.0_40beta02\bin\java -Xss68k -server -cp build\classes X 1.8.0_40-ea 2087 4177 4177 12529 12529 12529 12529 Here, the effect of the JIT is clearly visible, obviously the optimized code needs less stack space, and it’s shown that tiered compilation is enabled (indeed, using -XX:-TieredCompilation shows a single jump if the program runs long enough). In contrast, with disabled JIT I get the following results: &gt; f:\Software\jdk1.8.0_40beta02\bin\java -Xss68k -server -Xint -cp build\classes X 1.8.0_40-ea 2104 2104 2104 2104 2104 2104 2104 &gt; f:\Software\jdk1.8.0_40beta02\bin\java -Xss68k -server -Xint -cp build\classes X 1.8.0_40-ea 2076 2076 2076 2076 2076 2076 2076 &gt; f:\Software\jdk1.8.0_40beta02\bin\java -Xss68k -server -Xint -cp build\classes X 1.8.0_40-ea 2105 2105 2105 2105 2105 2105 2105 The values still vary, but not within the single runtime thread and with a lesser magnitude. So, there is a (rather small) difference that becomes much larger if the optimizer can reduce the stack space required per method invocation, e.g. due to inlining. What can cause such a difference? I don’t know h…
type: AcceptedAnswer
upvote count: 16
accepted answer of: http://stackoverflow.com/q/27043922
type: Answer
answers question: http://stackoverflow.com/q/27043922
score: 16
has comment: http://stackoverflow.com/comment/42631920
downvote count: 0

http://stackoverflow.com/q/27111930
favorite count: 0
has answer: http://stackoverflow.com/a/27112047
has body: Is there any way in JUnit (or any other testing framework) to make assertions about all possible inputs to a method? Something like: assertTrue(myClass.myMethod(anyString)) EDIT: I realize that there are an infinite number of possible inputs but I guess I was wondering if there were some frameworks that could statically analyze a method and detect that in all possible cases a certain result would be reached. E.g. public static boolean myMethod(String input) { return true; } will always return true?
type: Question
has comment: http://stackoverflow.com/comment/42726753
possible better answer: http://stackoverflow.com/a/27111992
has answer: http://stackoverflow.com/a/27111992
answer count: 3
upvote count: 1
accepted answer: http://stackoverflow.com/a/27112047
tagged with: testing
tagged with: java
has answer: http://stackoverflow.com/a/27112098
has title: Can JUnit make assertions about all Strings?
tagged with: mocking
type: AnsweredQuestion
tagged with: junit
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42726837

http://stackoverflow.com/q/27022741
has title: Redirecting servlet to another html page
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/42571980
tagged with: servlets
type: Question
score: 5
has answer: http://stackoverflow.com/a/55389205
downvote count: 0
has body: I have two html pages - one for login and one that takes in a persons details. The login page is the first page and when the database is checked for the username and password, the user is allowed to enter their details. The SQL code works perfectly, it is just a problem with the mapping I am having. I am using the Tomcat server by the way. Could anybody help or spot what i am doing wrong? This is my java code for logging in and entering details public class Details extends HttpServlet { private Connection con; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); //return writer PrintWriter out = res.getWriter(); String username = req.getParameter("username"); String password = request.getParameter("password"); out.close(); try { login(username, password); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } res.sendRedirect("/redirect.html"); String name = request.getParameter("name"); String address = request.getParameter("address"); String age = request.getParameter("age"); out.println(" <TITLE>Personnel Details "); out.println(name + address + age); out.println(" "); System.out.println("Finished Processing"); } out.close(); } In my web.xml file I have: <web-app> Details Details Details /Details redirect /redirect
has answer: http://stackoverflow.com/a/55389621
answer count: 3
tagged with: http://stackoverflow.com/tag/html
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: mapping
has answer: http://stackoverflow.com/a/27024320
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42572134

http://stackoverflow.com/a/27056202
answers question: http://stackoverflow.com/q/27055069
score: 1
has body: If you are building your program from command line, then there's something called "input redirection" which you can use. Here's how it works: Let's suppose your program is: import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class ScanningMultiline { public static void main (String[] args) { List&lt;String&gt; lines = new ArrayList&lt;&gt; (); try (Scanner scanner = new Scanner (System.in)) { while (scanner.hasNextLine ()) { lines.add (scanner.nextLine ()); } } System.out.println ("Total lines: " + lines.size ()); } } Now suppose you have input for your program prepared in a file. To compile the program you'd change the current directory of terminal/command prompt to the program directory and then write: javac ScanningMultiline.java And then to run, use input redirection like: java ScanningMultiline &lt; InputFile.txt If your InputFile.txt is in another directory, just put its complete path instead like: java ScanningMultiline &lt; "/Users/Xyz/Desktop/InputFile.txt" Another Approach You can try reading your input directly from a file. Here's how that program would be written: import java.io.IOException; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class ScanningMultiline { public static void main (String[] args) { final String inputFile = "/Users/Xyz/Desktop/InputFile.txt"; List&lt;String&gt; lines = new ArrayList&lt;&gt; (); try (Scanner scanner = new Scanner (Paths.get (inputFile))) { while (scanner.hasNextLine ()) { lines.add (scanner.nextLine ()); } } catch (IOException e) { e.printStackTrace (); } System.out.println ("Total lines: " + lines.size ()); } } This approach reads directly from a file and puts the lines from the file in a list of String. Another Approach You can read the lines from a file and store them in a list in a single line as well, as the following snippet demonstrates: import java.io.IOException; import java.nio.file.Files; import java.nio.file.P…
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42577514
has text: Is that because I can't call out value from private method?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27026976

http://stackoverflow.com/comment/42709652
type: Comment
score: 0
has text: Is it external drive? It's working fine for me. Try with `aFile.canRead()`
type: AnswerComment
comment on: http://stackoverflow.com/a/27102695

http://stackoverflow.com/comment/42749977
comment on: http://stackoverflow.com/q/27124931
score: 1
has text: An example code reproducing the problem would be nice
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42539851
type: QuestionComment
comment on: http://stackoverflow.com/q/27004623
type: Comment
has text: I don't like your linkCampaigns xpath. Are you directing to `Campaigns` element? Are you trying to click on that element? why not a regular click?!
score: 0

http://stackoverflow.com/q/27010411
tagged with: cursor
has comment: http://stackoverflow.com/comment/42548162
type: Question
has title: getting error - Make sure the Cursor is initialized correctly before accessing data from it
score: 0
has comment: http://stackoverflow.com/comment/42547982
has comment: http://stackoverflow.com/comment/42548191
tagged with: sqlite
linked to: http://stackoverflow.com/q/21881992
answer count: 1
has comment: http://stackoverflow.com/comment/42548011
has comment: http://stackoverflow.com/comment/42547993
has comment: http://stackoverflow.com/comment/42548057
has comment: http://stackoverflow.com/comment/42548000
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42548113
tagged with: android
has comment: http://stackoverflow.com/comment/42548061
has answer: http://stackoverflow.com/a/27010905
has body: while retrieving data from sqlite getting below exception. 11-19 11:37:43.357: E/AndroidRuntime(1494): java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. query is - Cursor c= db.rawQuery("SELECT * FROM "+OpenHelper.TABLE_ACTIVITY_DETAIL+" WHERE "+OpenHelper.Activity_Date+" = '"+date+"'",null); if(c != null){ if (c.moveToFirst()){ do{ task=c.getString(c.getColumnIndex("task")); activityList.add(""+task); }while(c.moveToNext()); } } c.close(); db.close(); is there any solution?
tagged with: java

http://stackoverflow.com/comment/42671186
comment on: http://stackoverflow.com/a/27029360
score: 0
type: AnswerComment
has text: Unfortunately this is still not working? There is still no input.
type: Comment

http://stackoverflow.com/a/27057657
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27057511
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/27057511
type: Answer
has body: try below code public class UploadServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public UploadServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File file = null ; int maxFileSize = 5000 * 1024; int maxMemSize = 8000 * 1024; ServletContext context = request.getServletContext(); String filePath = context.getInitParameter("file-upload"); // Verify the content type String contentType = request.getContentType(); if ((contentType.indexOf("multipart/form-data") >= 0)) { DiskFileItemFactory factory = new DiskFileItemFactory(); // maximum size that will be stored in memory factory.setSizeThreshold(maxMemSize); // Location to save data that is larger than maxMemSize. factory.setRepository(new File("c:\\temp")); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // maximum file size to be uploaded. upload.setSizeMax( maxFileSize ); try{ // Parse the request to get file items. List fileItems = upload.parseRequest(request); // Process the uploaded file items Iterator i = fileItems.iterator(); while ( i.hasNext () ) { FileItem fi = (FileItem)i.next(); if ( !fi.isFormField () ) { // Get the uploaded file parameters String fieldName = fi.getFieldName(); String fileName = fi.getName(); boolean isInMemory = fi.isInMemory(); long sizeInBytes = fi.getSize(); // Write the file if( fileName.lastIndexOf("\\") >= 0 ){ file = new File( filePath + fileName.substring( fileName.lastIndexOf("\\"))) ; }else{ file = new File( filePath + fileName.substring(fi…
has comment: http://stackoverflow.com/comment/42632801
score: 0

http://stackoverflow.com/comment/42749267
comment on: http://stackoverflow.com/a/27124083
type: AnswerComment
has text: In general it should work. But implementation will be quite complex. For instance I have to use `WeakReference` in such case to do not depend on the object itself. As a technical solution of this problem it works, but from my point of view it looks quite ugly. Anyway thank you fro the idea!
type: Comment
score: 1

http://stackoverflow.com/comment/42783544
type: Comment
has text: open bug exists in pdf.js: https://github.com/mozilla/pdf.js/issues/2802
comment on: http://stackoverflow.com/q/27143506
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42682807
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27087290
has text: If you mean sending email without using the implementation within the JDK (but still using Java), you can send emails with command line programs too. Use `Process` (https://docs.oracle.com/javase/8/docs/api/java/lang/Process.html)
score: 0

http://stackoverflow.com/comment/42678997
comment on: http://stackoverflow.com/q/27085078
has text: i have tried that. That does not seem to be making a difference. Is there a difference though ? i was scared that while adding like you did, i might be overwriting them. Though it is the second part of my question i am really unclear about @MadProgrammer
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27096670
downvote count: 10
has answer: http://stackoverflow.com/a/45743226
type: Question
has body: I am having a hard time figuring out the solution to this problem. I am trying to develop a program in Java that takes a number, such as 321, and finds the sum of digits, in this case 3 + 2 + 1 = 6. I need all the digits of any three digit number to add them together, and store that value using the % remainder symbol. This has been confusing me and I would appreciate anyones ideas.
accepted answer: http://stackoverflow.com/a/27096697
has comment: http://stackoverflow.com/comment/42698829
has answer: http://stackoverflow.com/a/55009442
has answer: http://stackoverflow.com/a/71940234
upvote count: 34
has answer: http://stackoverflow.com/a/34885474
has answer: http://stackoverflow.com/a/62539026
has answer: http://stackoverflow.com/a/47322700
has answer: http://stackoverflow.com/a/45780174
duplicate of: http://stackoverflow.com/q/3389264
has answer: http://stackoverflow.com/a/27096697
has answer: http://stackoverflow.com/a/54394131
has comment: http://stackoverflow.com/comment/42698742
has answer: http://stackoverflow.com/a/35110609
has answer: http://stackoverflow.com/a/40119041
has answer: http://stackoverflow.com/a/42623619
favorite count: 0
possible better answer: http://stackoverflow.com/a/45743226
has answer: http://stackoverflow.com/a/37449817
has answer: http://stackoverflow.com/a/35072547
has comment: http://stackoverflow.com/comment/42698719
has answer: http://stackoverflow.com/a/57254855
has answer: http://stackoverflow.com/a/31112618
has answer: http://stackoverflow.com/a/39673475
has answer: http://stackoverflow.com/a/36548866
has answer: http://stackoverflow.com/a/56000804
has comment: http://stackoverflow.com/comment/42698731
has title: How to sum digits of an integer in java?
linked to: http://stackoverflow.com/q/3389264
has answer: http://stackoverflow.com/a/36776973
answer count: 22
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42698705
tagged with: java
has answer: http://stackoverflow.com/a/27096862
score: 24
has comment: http://stackoverflow.com/comment/125937196
has answer: http://stackoverflow.com/a/36288365

http://stackoverflow.com/a/27054817
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42626140
has comment: http://stackoverflow.com/comment/42626173
has body: The only difference with inherited static (class) methods and inherited non-static (instance) methods is that when you write a new static method with the same signature, the old static method is just hidden, not overridden. Static methods are inherited but cannot be overriden they can be re- defined.
has comment: http://stackoverflow.com/comment/42626303
type: Answer
accepted answer of: http://stackoverflow.com/q/27054795
answers question: http://stackoverflow.com/q/27054795
score: 0

http://stackoverflow.com/comment/42617499
type: Comment
has text: This can be caused with any [failing] re-entrant access while iterating; threads are not required.
comment on: http://stackoverflow.com/a/27049703
score: 0
type: AnswerComment

http://stackoverflow.com/a/27037010
has body: Simply use the java Gson API: Gson gson = new GsonBuilder().create(); String json = gson.toJson(obj);// obj is your object And then you can create a JSONObject from this json String, like this: JSONObject jsonObj = new JSONObject(json); Take a look at Gson user guide and this SIMPLE GSON EXAMPLE for more information.
score: 49
has comment: http://stackoverflow.com/comment/72687060
has comment: http://stackoverflow.com/comment/72696103
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27036857
has comment: http://stackoverflow.com/comment/72696498
upvote count: 51
type: Answer
answers question: http://stackoverflow.com/q/27036857
downvote count: 2
has comment: http://stackoverflow.com/comment/72687679

http://stackoverflow.com/q/27112391
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42727731
tagged with: java
score: -1
tagged with: memory
has comment: http://stackoverflow.com/comment/42727893
answer count: 1
has answer: http://stackoverflow.com/a/27112524
favorite count: 0
tagged with: out-of-memory
tagged with: android
has comment: http://stackoverflow.com/comment/42727818
has title: How much RAM samsung devices do normally allocate for Android apps?
has body: Now my app has 2000 downloads and 180 daily users. I don't believe they all use Samsung devices only. I am confused - I don't have any samsung devices, please if you have one - could you please tell me how much RAM they normally allocate for android application? My app normally consumes 20-22mb +2mb per UI reload as memory leaks (but users normally don't do this more than 2-3 times so...) I have added "LargeHeap" in last version (not in statistics yet). Is this 46 OutOfMemory errors a lot for 14500 sessions? Or it is okay for android?
type: UnansweredQuestion
tagged with: ram
downvote count: 2

http://stackoverflow.com/q/26994886
has comment: http://stackoverflow.com/comment/42981699
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/43031400
answer count: 1
has comment: http://stackoverflow.com/comment/43035388
has comment: http://stackoverflow.com/comment/43034817
has answer: http://stackoverflow.com/a/27375949
has comment: http://stackoverflow.com/comment/42978382
favorite count: 0
tagged with: observablelist
has title: ObservableList: how to reliably detect a setAll?
type: AnsweredQuestion
upvote count: 19
tagged with: java
tagged with: javafx
has body: In some contexts it's necessary to detect - in a ListChangeListener, without control about the list itself - a "all data swapped out", f.i. when we need to clear some state like selection - on completely new data the old state is meaningless. Completely new data can be reached by list.setAll(...) list.set(otherObservableList) if list is a ListProperty Thinking about which type of changes could be fired on setAll (c is the change, items is the observed list, "subChangeCount" pseudo-code for counting the subchanges): // initially empty assertEquals(0, items.size()); items.setAll(1, 2, 4); assertEquals(1, c.subChangeCount()); assertTrue(c.wasAdded() &amp;&amp; !c.wasReplaced()); assertEquals(0, c.getFrom()); assertEquals(c.getList().size(), c.getAddedSize()); // initially not empty assertTrue(items.size() &gt; 0); items.setAll(1, 2, 4); assertEquals(1, c.subChangeCount()); assertTrue(c.wasReplaced()); assertEquals(0, c.getFrom()); assertEquals(c.getList().size(), c.getAddedSize()); This seems to allow a utility check like: boolean wasSetOrClearedAll(Change c) { if (c.getList().isEmpty()) return true; c.next(); if (c.getAddedSize() == c.getList().size()) return true; return false; } In contrast, internal fx code, f.i. in listening to ComboBox' items: while (c.next()) { comboBox.wasSetAllCalled = comboBox.previousItemCount == c.getRemovedSize(); ... } comboBox.previousItemCount = getItemCount(); stores the old itemCount and compare that against the current removedSize (which I'm uncomfortable with, old state gets stale far too often for my taste), nevertheless there's a good probability that I'm missing something with my approach. Question is: in which context would my utility method fail (and core approach would detect the setAll correctly)?
downvote count: 1
has comment: http://stackoverflow.com/comment/42981548
type: Question
has comment: http://stackoverflow.com/comment/43021448
score: 18
has comment: http://stackoverflow.com/comment/42984652
accepted answer: http://stackoverflow.com/a/27375949
has comment: http://stackoverflow.com/comment/43030173

http://stackoverflow.com/a/27075857
type: Answer
has comment: http://stackoverflow.com/comment/86473250
upvote count: 4
has comment: http://stackoverflow.com/comment/42690493
downvote count: 0
has comment: http://stackoverflow.com/comment/42690309
has body: Implicit waits are for assigning global timeout(s), that means once assigned, selenium will wait for that amount of time (at max), each time it tries to find an element. On the other hand, Explicit waits are useful in assigning timeouts exclusively to any element in the webpage, and it overrides the timeout so set by implicit wait. So, for the above, you can try Explicit wait instead like this: public boolean isAlertPresent(){ try{ Alert a = new WebDriverWait(driver, 10).until(ExpectedConditions.alertIsPresent()); if(a!=null){ System.out.println("Alert is present"); driver.switchTo().alert().accept(); return true; }else{ throw new Throwable(); } } catch (Throwable e) { System.err.println("Alert isn't present!!"); return false; } } This will check the existence of alert within 10 seconds. If it finds the alert within that, it will return 'true' else it will return 'false'.
score: 4
answers question: http://stackoverflow.com/q/27074625
has comment: http://stackoverflow.com/comment/86262423

http://stackoverflow.com/comment/42635927
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27060759
has text: What do you mean by "default time"? What's defaulting here? It sounds like you mean "to a text format of hh:mm:ss".
score: 0

http://stackoverflow.com/a/27025966
downvote count: 0
answers question: http://stackoverflow.com/q/27025863
accepted answer of: http://stackoverflow.com/q/27025863
score: 7
upvote count: 7
type: AcceptedAnswer
has body: f[--n]; means : n = n -1; f[n]; f[n++]; means : f[n]; n = n + 1;
type: Answer

selenium
tags question: http://stackoverflow.com/q/27096873
tags question: http://stackoverflow.com/q/27074625
tags question: http://stackoverflow.com/q/26995278
tags question: http://stackoverflow.com/q/27129564
tags question: http://stackoverflow.com/q/27027568
tags question: http://stackoverflow.com/q/27131875
tags question: http://stackoverflow.com/q/27101399
tags question: http://stackoverflow.com/q/27049514
tags question: http://stackoverflow.com/q/27016609
tags question: http://stackoverflow.com/q/27076774
tags question: http://stackoverflow.com/q/27027160
tags question: http://stackoverflow.com/q/27126865
tags question: http://stackoverflow.com/q/27146994
tags question: http://stackoverflow.com/q/27147057
tags question: http://stackoverflow.com/q/27060726
tag name: selenium
tags question: http://stackoverflow.com/q/27069687
tags question: http://stackoverflow.com/q/26998179
tags question: http://stackoverflow.com/q/27010621
tags question: http://stackoverflow.com/q/27067742
tags question: http://stackoverflow.com/q/27062825
tags question: http://stackoverflow.com/q/27114626
tags question: http://stackoverflow.com/q/27110169
tags question: http://stackoverflow.com/q/27096864
tags question: http://stackoverflow.com/q/26997606
tags question: http://stackoverflow.com/q/27052446
tags question: http://stackoverflow.com/q/27113536
tags question: http://stackoverflow.com/q/27085877
tags question: http://stackoverflow.com/q/27126802
tags question: http://stackoverflow.com/q/26998792
tags question: http://stackoverflow.com/q/27010252
tags question: http://stackoverflow.com/q/27086867
tags question: http://stackoverflow.com/q/27064096
tags question: http://stackoverflow.com/q/27145816
tags question: http://stackoverflow.com/q/27102131
type: Tag
tags question: http://stackoverflow.com/q/27047044
tags question: http://stackoverflow.com/q/27147857
tags question: http://stackoverflow.com/q/27120530
tags question: http://stackoverflow.com/q/27141108
tags question: http://stackoverflow.com/q/27152627
tags question: http://stackoverflow.com/q/27129894
tags question: http://stackoverflow.com/q/27047773

http://stackoverflow.com/comment/42713847
comment on: http://stackoverflow.com/q/27104922
type: Comment
score: 0
has text: I would suggest not using the glTranslatef type functions and instead use shaders
type: QuestionComment

http://stackoverflow.com/a/27144156
downvote count: 1
upvote count: 4
type: Answer
has body: what does annotating a Java class as @Immutable give us? Annotation in Java does not do anything itself, but they are used by external tools. Take a look at very good inspections for such annotations in IntelliJ IDEA.
score: 3
answers question: http://stackoverflow.com/q/27101978

http://stackoverflow.com/q/27140106
type: Question
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/42777991
score: 0
has title: Netbeans/Maven development: how to make it faster?
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27164662
has comment: http://stackoverflow.com/comment/42777909
tagged with: maven
has comment: http://stackoverflow.com/comment/42778029
tagged with: java
has body: I'm using Maven for the heavy lifting. However, when working on small parts (like unit tests), the reaction time of "mvn test" inside Netbeans is too slow. I have already written a ClassReloader that sets up directory watches and uses Netbeans' compile-on-save. However, that is a bit clumsy because it requires me to modify the test unit class and add a main method. Is there a nicer way? I already thought of setting up a parallel view of the same modules, one that uses ant build scripts. You guys have any better idea? Or tools to make that easier? For example, the maven-dependency-plugin is able to copy dependencies and write the classpath to a file. That's a start. But how do I import the classpath into the ant build file, or even better, into the netbeans project configuration? And what about the system props set up in the configuration section of the maven-surefire-plugin? There is the maven-ant-plugin, however it has nearly no configuration options and it does not work without modifying the output files. Are there better tools? Maybe a netbeans project generator that transforms maven projects into netbeans project configurations? Then there is yet another problem: you cannot use the same source folder twice in netbeans, not even if the other instance is inside a not currently open project group.... The solution need not be perfect: like I said, it is only needed for the small parts. Maybe I start using Eclipse for the simple and small stuff. I won't start discussing about what's better, Netbeans eclipse etc. I use Netbeans because it is the only IDE with native Maven support. Eclipse's maven support is crap and I wasted too much time already because of it being that way.

http://stackoverflow.com/comment/42765209
type: Comment
comment on: http://stackoverflow.com/a/27133194
type: AnswerComment
has text: @SamShaheen a loop has the advantage of having the same code work for any dimention of the 2-d array.
score: 0

http://stackoverflow.com/q/27103932
has comment: http://stackoverflow.com/comment/42711446
tagged with: java
downvote count: 2
type: Question
score: -2
has title: How can I build a method to convert today's date into the next working day?
answer count: 2
has comment: http://stackoverflow.com/comment/42711667
has answer: http://stackoverflow.com/a/27104257
favorite count: 0
has body: I have a problem in java. I would like to know how to get the date of the next working day. The date format is DD/MM/YYYY. This is difficult as you can't simply add a single number onto the day, what if the next day is the next month or even another year. I also need to make sure the next day is not a weekend day and is the next working day. Another problem is bank holidays but I am not currently thinking about this. Is there a method that does this job. Any help would be great!!
has comment: http://stackoverflow.com/comment/42724629
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42711520
linked to: http://stackoverflow.com/q/10072914
upvote count: 0
has comment: http://stackoverflow.com/comment/42711882
has answer: http://stackoverflow.com/a/27104362

http://stackoverflow.com/a/27060571
score: 0
has body: Try this. You just send which folder u want to download and file name. if you can get path from session its give more secure you have login id for user you create it. if you upload new data you delete the folder and create new.that time you have only one latest data.may i think its help for you response.setContentType("image/jpeg"); String path = request.getParameter("folder"); String name = request.getParameter("filename"); /* TODO output your page here. You may use following sample code. */ String filepath = "Your path" + path + "/" + name, filename = name; ServletOutputStream out = response.getOutputStream(); FileInputStream in = new FileInputStream(filepath); response.addHeader("content-disposition", "attachment; filename=" + filename); int octet; while ((octet = in.read()) != -1) { out.write(octet); } in.close(); out.close();
type: Answer
has comment: http://stackoverflow.com/comment/42635709
answers question: http://stackoverflow.com/q/27059114

http://stackoverflow.com/a/27092831
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/42691794
has comment: http://stackoverflow.com/comment/42692553
type: Answer
answers question: http://stackoverflow.com/q/27092792
has comment: http://stackoverflow.com/comment/42692444
has body: operator '+' cannot be applied to java.lang.string The reason you're seeing that error is that because of the comma here: Log.e(TAG, "Error Loading ", + nextImageName,e); // ------------------------^ ...the + is starting a new expression, and so it's the unary + operator (a "unary" operator is an operator that takes only one operand), not the binary + operator (an operator that takes two operands), which in that context would be the string concatenation operator. The unary + operator is a counterpart to the rather-more-well-known unary - which negates a number, and like the - can only be used with types that can be promoted to numeric values. The binary + can be applied to strings, but the unary + cannot. Removing the comma makes it a binary + (string concatenation, in this case), which works.
score: 5

http://stackoverflow.com/a/27146385
has comment: http://stackoverflow.com/comment/42788523
has comment: http://stackoverflow.com/comment/42788449
score: 0
has comment: http://stackoverflow.com/comment/42788653
has comment: http://stackoverflow.com/comment/42788328
type: Answer
has body: I added and change a few things from the another answer and: NotificationCompat.Builder builder; builder = new NotificationCompat.Builder(context) .setContentTitle("Hello") .setContentText("Notification") .setContentIntent(contentIntent) .setSmallIcon(R.drawable.ic_launcher); .setStyle(new NotificationCompat.InboxStyle()); .setAutoCancel(true); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notif = builder.build(); notif.flags = Notification.FLAG_ONGOING_EVENT; // this flag added notificationManager.notify(1, notif); But with this, your notification will not cancel. Maybe you can walk from here.
has comment: http://stackoverflow.com/comment/42790889
has comment: http://stackoverflow.com/comment/42788692
answers question: http://stackoverflow.com/q/27145891

http://stackoverflow.com/q/27024631
score: -1
has comment: http://stackoverflow.com/comment/42572994
has title: I did not initialize a variable yet I still receive an output
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/42572986
linked to: http://stackoverflow.com/q/18226405
has comment: http://stackoverflow.com/comment/42572937
answer count: 3
has answer: http://stackoverflow.com/a/27024685
has answer: http://stackoverflow.com/a/27024740
tagged with: initialization
favorite count: 0
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/42573071
has body: Here is my code: class Xyz{ public static void main(String args[]) { first fobj = new first(10); for(int i=0;i&lt;5;i++){ fobj.add(); System.out.printf("%s",fobj); } } } class first{ public int sum=0; public final int num; first(int x){ num=x; } public void add(){ sum+=num; } public String toString() { return String.format("sum = %d" ,sum); } } output: sum=10 sum=20 sum=30 sum=40 sum=50 In the class first I didn't initialize a variable named "sum" but I still get output. Can someone explain that to me? asgfafgalsdfkjsaflkasflaskfalskfajlskfaskfaslkjflaskfaslkflasjkf.
tagged with: java
has answer: http://stackoverflow.com/a/27024716

http://stackoverflow.com/q/27044396
tagged with: java
accepted answer: http://stackoverflow.com/a/27055928
tagged with: android-5.0-lollipop
score: 2
answer count: 1
downvote count: 0
has title: Call setPowerSaveMode of PowerManager class with reflection
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: reflection
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/27055928
has body: I will call a method of the public final class PowerManager with @hide annotation. the method is: /** * Set the current power save mode. * * @return True if the set was allowed. * * @see #isPowerSaveMode() * * @hide */ public boolean setPowerSaveMode(boolean mode) { try { return mService.setPowerSaveMode(mode); } catch (RemoteException e) { return false; } } In my code I tried to call the method with reflection: Class c; try { c = Class.forName("android.os.PowerManager"); Method m = c.getMethod("setPowerSaveMode", new Class[]{Boolean.class}); Boolean response = (Boolean) m.invoke(true); Log.d("test", "invoked?: " + response); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } but I run out with java.lang.NoSuchMethodException: setPowerSaveMode [class java.lang.Boolean]. Where am I wrong? How can I call this method? Thank you in advance!
tagged with: powermanager

http://stackoverflow.com/comment/42611340
score: 0
type: Comment
type: QuestionComment
has text: Do you want a [truth table](http://en.wikipedia.org/wiki/Truth_table) ?
comment on: http://stackoverflow.com/q/27046463

http://stackoverflow.com/comment/42629683
type: QuestionComment
score: 0
has text: I cannot find the string `yyyy-MM-dd'T'HH:mm:ss.SSSZ` on that wiki page.
comment on: http://stackoverflow.com/q/27057095
type: Comment

google-app-engine
tags question: http://stackoverflow.com/q/27120819
tag name: google-app-engine
tags question: http://stackoverflow.com/q/27133351
type: Tag
tags question: http://stackoverflow.com/q/27059473
tags question: http://stackoverflow.com/q/27036263
tags question: http://stackoverflow.com/q/27059855
tags question: http://stackoverflow.com/q/27094889
tags question: http://stackoverflow.com/q/27012182
tags question: http://stackoverflow.com/q/27028274
tags question: http://stackoverflow.com/q/27097584
tags question: http://stackoverflow.com/q/27007852
tags question: http://stackoverflow.com/q/27106829
tags question: http://stackoverflow.com/q/27116477
tags question: http://stackoverflow.com/q/27059402
tags question: http://stackoverflow.com/q/27059344
tags question: http://stackoverflow.com/q/27005718
tags question: http://stackoverflow.com/q/27075295
tags question: http://stackoverflow.com/q/27131479
tags question: http://stackoverflow.com/q/27037947
tags question: http://stackoverflow.com/q/27095581
tags question: http://stackoverflow.com/q/27005659
tags question: http://stackoverflow.com/q/27092474
tags question: http://stackoverflow.com/q/27116605
tags question: http://stackoverflow.com/q/27016586
tags question: http://stackoverflow.com/q/27008693
tags question: http://stackoverflow.com/q/26992910
tags question: http://stackoverflow.com/q/27115524

http://stackoverflow.com/q/27092699
tagged with: android
has answer: http://stackoverflow.com/a/27092854
tagged with: view
type: UnansweredQuestion
type: Question
tagged with: java
has body: I have to make a layout/view appearing under the marker: How can I achieve this? Is there any particular library, that could help?
has title: ANDROID - How to make a custom layout appear under the marker?
tagged with: google-maps
tagged with: layout
answer count: 1
score: 0

http://stackoverflow.com/q/27082711
has comment: http://stackoverflow.com/comment/42674649
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27082741
upvote count: 3
has comment: http://stackoverflow.com/comment/42674634
score: 1
downvote count: 2
has comment: http://stackoverflow.com/comment/42674619
type: Question
has title: Having trouble using a boolean method in an if statement
tagged with: java
has comment: http://stackoverflow.com/comment/42674609
has comment: http://stackoverflow.com/comment/42674650
answer count: 1
has answer: http://stackoverflow.com/a/27082741
favorite count: 0
has comment: http://stackoverflow.com/comment/42674639
has comment: http://stackoverflow.com/comment/42674590
has body: I want to use the method isLong() from Book class and use it in displayLongBooks() which is in the BookCollection method. Class BookCollection has bookList variable. Variable bookList is of ArrayList type and contains the collection of all books. All objects in the ArrayList are of Book type. import java.util.ArrayList; public class BookCollection { ArrayList&lt;Book&gt; bookList = new ArrayList&lt;Book&gt;(); public BookCollection(){ bookList.add(new Book(1001-01-141514, "Letones", "CS", 611)); bookList.add(new Book(1002-01-141424, "Lewis", "CS", 477)); bookList.add(new Book(1003-01-141434, "Smith", "MATH", 698)); bookList.add(new Book(1004-01-141444, "Smith", "CS", 617)); bookList.add(new Book(1005-01-141454, "Brown", "CHEM", 326)); bookList.add(new Book(1006-01-141464, "Smith", "BIO", 127)); bookList.add(new Book(1007-01-141474, "Sanket", "CS", 998)); } public String toString() { } public void displayLongBooks() { System.out.println(); System.out.println("LONG BOOKS"); if (isLong() == true) System.out.println(bookList); } public void displayBooksFromAuthor(String author) { } public void displayBooksFromArea(String area) { } public void displayAverageLength() { } } import java.util.*; import java.io.*; public class Book { String author; String area; int isbn; int pages; public Book (int isbn, String author, String area, int pages) { this.isbn = isbn; this.author = author; this.area = area; this.pages = pages; } public boolean isLong() { if(pages&gt;600) return true; else return false; } public String toString() { return "ISBN: " + this.isbn + "Author: " + this.author + "Subject: " + this.area + "Pages: " + this.pages; } /**PrintWriter outfile = new PrintWriter (new FileWriter("books.txt")); outfile.write("100101141514, Letones, CS, 611"); outfile.write(100201141424, Lewis, CS, 477); outfile.write(100301141434, Smith, MATH, 698); outfile.write(100401141444, Smith, CS, 617); outfile.write(100501141454, Brown, CHEM, 326); outfile.write(100601141464, Smith, BIO, 127);…

http://stackoverflow.com/comment/42638475
comment on: http://stackoverflow.com/q/27061967
score: 1
has text: if there is state in the handler, then clone or block using a synchronized lock. If it is stateless, then it could just be allowed to run concurrently. You are the best one to judge which approach is best here.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27077620
downvote count: 3
has title: I have two classes and there is a association between them and we make an object array
has body: I have this code and I can develop it to make two object from class Person and they have the same Address ( object class) the code : class Address { } class Person { //Person has-a Address public Address[] address; public Person(Address[] address) { this.address = address; } // Other code goes here } public Person(Address[] address) { this.address = address; } // Other code goes here } how can I create array object from class ?
has comment: http://stackoverflow.com/comment/42672071
answer count: 2
has comment: http://stackoverflow.com/comment/42672294
has comment: http://stackoverflow.com/comment/42674630
has answer: http://stackoverflow.com/a/27077740
possible better answer: http://stackoverflow.com/a/27077661
has answer: http://stackoverflow.com/a/27077661
has comment: http://stackoverflow.com/comment/42665641
has comment: http://stackoverflow.com/comment/42665648
favorite count: 0
accepted answer: http://stackoverflow.com/a/27077740
upvote count: 1
has comment: http://stackoverflow.com/comment/42665594
type: Question
type: AnsweredQuestion
score: -2
tagged with: java

http://stackoverflow.com/comment/42819195
type: Comment
comment on: http://stackoverflow.com/a/27125359
has text: Also please let me know using JNDI for this purpose will cause any other impacts or its fine
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42671426
has text: Unless they are already "waiting for" or "looking for" this notification there might not be a way to do this directly without prior registration. What I would investigate would be the configurability of the hotspot. It should have rudimentary routing capability. You want to set it up so that it redirects clients to your URL.
type: Comment
comment on: http://stackoverflow.com/a/27078168
score: 0
type: AnswerComment

http://stackoverflow.com/q/27033976
tagged with: java-8
has title: java 8 lambda ambiguous runnable and callback
has comment: http://stackoverflow.com/comment/68767381
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/23430854
has comment: http://stackoverflow.com/comment/42592456
type: Question
possible better answer: http://stackoverflow.com/a/27034487
answer count: 2
has comment: http://stackoverflow.com/comment/42596606
has answer: http://stackoverflow.com/a/27034487
upvote count: 6
favorite count: 0
has comment: http://stackoverflow.com/comment/42589666
accepted answer: http://stackoverflow.com/a/27034042
duplicate of: http://stackoverflow.com/q/23430854
has comment: http://stackoverflow.com/comment/42588899
has body: Executors.newFixedThreadPool(3).submit(() -&gt; {doSmth();}); "Ambiguous method call. Both submit (Callable) in ExecutorService and submit (Runnable) in ExecutorService match." How to fix it? I know that I can use anonymous class but I'd like to use Function.
has answer: http://stackoverflow.com/a/27034042
downvote count: 0
score: 6

http://stackoverflow.com/q/27128142
has body: I have a table "Gazelle" with 216 columns, and i want to get some of their columns in a javaPairRDD. I've tried to follow this link : How to read from hbase using spark and this one : how to fetch all of data from hbase table in spark In order to import all jars i need i've added this dependency to my pom file : '<?xml version="1.0" encoding="UTF-8"?> http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 fr.aid.cim spark-poc 1.0-SNAPSHOT org.apache.spark spark-core_2.10 1.1.0 org.apache.hbase hbase-client 0.96.0-hadoop2 org.apache.hbase hbase 0.20.6 </project>' and this is my code : 'SparkConf sparkConf = new SparkConf().setAppName("JavaWordCount"); JavaSparkContext ctx = new JavaSparkContext(sparkConf); //JavaSQLContext jsql = new JavaSQLContext(sc); //test hbase table HBaseConfiguration conf = new HBaseConfiguration(); conf.set("hbase.zookeeper.quorum", "192.168.10.32"); conf.set("hbase.zookeeper.property.clientPort","2181"); conf.set("hbase.master", "192.168.10.32" + ":60000"); conf.set("hbase.cluster.distributed", "true"); conf.set("hbase.rootdir", "hdfs://localhost:8020/hbase"); //conf.set(TableInputFormat.INPUT_TABLE, "gazelle_hive4"); String tableName = "gazelle_hbase4"; HTable table = new HTable(conf,tableName); JavaPairRDD<ImmutableBytesWritable, Result> hBaseRDD = ctx .newAPIHadoopRDD( conf, TableInputFormat.class,, org.apache.hadoop.hbase.io.ImmutableBytesWritable.class, org.apache.hadoop.hbase.client.Result.class); hBaseRDD.coalesce(1, true).saveAsTextFile(path + "hBaseRDD");' But i have a problem with "TableInputFormat" Error : Cannot resolve symbol TableInputFormat. Is their another library i should import or another dependency i should add? Note: I haven't created any XML file. Should i create the "hbase-default.xml" and "hbase-site.xml" ? If yes, how ? Thank you in advance for your help.
tagged with: maven
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/27128466
tagged with: java
linked to: http://stackoverflow.com/q/24534410
linked to: http://stackoverflow.com/q/25040709
has title: Read a hbase table using spark
tagged with: hadoop
downvote count: 0
has answer: http://stackoverflow.com/a/27128466
tagged with: apache-spark
type: AnsweredQuestion
score: 1
favorite count: 0
type: Question
tagged with: hbase

http://stackoverflow.com/q/27052612
type: Question
has title: How to iterate over object nodes formed from YAML
tagged with: iterator
tagged with: yaml
downvote count: 0
favorite count: 0
tagged with: snakeyaml
type: UnansweredQuestion
has body: I have parsed a YAML file using snakeYAML in Java. The following is the code: Yaml yaml = new Yaml(); String fileContent = readFile(folderPath+fileName, StandardCharsets.UTF_8); Object obj = yaml.load(fileContent); System.out.println(obj); The object is printed as: {meta={data_version=0.5, created=Tue Sep 08 05:30:00 IST 2009, revision=1}, info={city=London, dates=[Fri Sep 04 05:30:00 IST 2009], match_type=ODI, outcome={by={runs=4}, winner=Australia}, overs=50, player_of_match=[CJ Ferguson], teams=[England, Australia], toss={decision=field, winner=England}, umpires=[AL Hill, NJ Llong], venue=Kennington Oval}, innings=[{1st innings={team=Australia, deliveries=[{0.1={batsman=SR Watson, bowler=JM Anderson, extras={wides=1}, ... How can I iterate over the nodes to get different values?
score: 2
answer count: 0
upvote count: 2
tagged with: java

http://stackoverflow.com/q/27148017
tagged with: tuples
score: 2
tagged with: sql
has body: I want to create PreparedStatement for request like this: SELECT * FROM table WHERE (a, b) in ( (a1, b1), (a2, b2), (a3, b3) ); How I can send [(a1, b1), (a2, b2), (a3, b3)] to PreparedStatement from Java or create it from pair of array (a1, a2, a3) and (b1, b2, b3)?
favorite count: 0
has answer: http://stackoverflow.com/a/27158501
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42791393
has answer: http://stackoverflow.com/a/27148683
tagged with: java
linked to: http://stackoverflow.com/q/178479
has title: Send array of tuple to prepared statement
tagged with: prepared-statement
type: Question
answer count: 2
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/42699517
comment on: http://stackoverflow.com/q/27097051
score: 0
type: QuestionComment
type: Comment
has text: When asking a question on Stack Overflow, you need to provide evidence of research and attempts you have already made to resolve the problem. Questions that consist of "I don't know what to do, can someone help me" are not acceptable on Stack Overflow. You need to provide a [Minimum, complete, verifiable example](http://stackoverflow.com/help/mcve) of your problem.

http://stackoverflow.com/comment/42563398
type: QuestionComment
comment on: http://stackoverflow.com/q/26996407
score: 1
has text: Don't worry, I think the error is related to buildnumber-maven-plugin, the create goal is launching an ScmException, check that.
type: Comment

http://stackoverflow.com/a/27092677
score: 7
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27083027
answers question: http://stackoverflow.com/q/27083027
type: Answer
upvote count: 7
has body: Consider putting the canvas in a pane, and using CSS to style the pane. For example: import javafx.application.Application; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.control.Button; import javafx.scene.layout.Priority; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class CanvasWithBorderExample extends Application { @Override public void start(Stage primaryStage) { final int SIZE = 400 ; Canvas canvas = new Canvas(SIZE, SIZE); GraphicsContext gc = canvas.getGraphicsContext2D() ; gc.setStroke(Color.RED); gc.moveTo(0, 0); gc.lineTo(SIZE, SIZE); gc.stroke(); StackPane canvasContainer = new StackPane(canvas); canvasContainer.getStyleClass().add("canvas"); VBox root = new VBox(10, canvasContainer, new Button("Click here")); root.setFillWidth(false); VBox.setVgrow(canvasContainer, Priority.NEVER); root.setAlignment(Pos.CENTER); Scene scene = new Scene(root); scene.getStylesheets().add("canvas-with-border.css"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } with canvas-with-border.css: .canvas { -fx-background-color: antiquewhite, white ; -fx-background-insets: 0, 20 ; -fx-padding: 20 ; }

http://stackoverflow.com/comment/42790648
type: AnswerComment
has text: because i going to form pattern from a set of words in a file through a java method. I might have a number of this kind patterns merged with a "|" in between them.
type: Comment
comment on: http://stackoverflow.com/a/27146464
score: 0

android-edittext
tags question: http://stackoverflow.com/q/27077507
tags question: http://stackoverflow.com/q/27086324
tags question: http://stackoverflow.com/q/27033556
tags question: http://stackoverflow.com/q/27041495
type: Tag
tags question: http://stackoverflow.com/q/27100494
tag name: android-edittext
tags question: http://stackoverflow.com/q/27030389

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/27020925
type: Tag

http://stackoverflow.com/q/27038632
favorite count: 0
has answer: http://stackoverflow.com/a/27043754
accepted answer: http://stackoverflow.com/a/27043754
has body: I am new to Java Enterprise, sorry if this has been answered,I could not find anything specific. I am trying to loop through a datatable, and call a method with the id from every result and display some info. My XML looks like this: &lt;h:dataTable styleClass="data" value="#{moduleBean.allModules}" var="m" class="modulelist"&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;#{uistrings.module_name}&lt;/f:facet&gt; #{m.name} &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;#{uistrings.approved}&lt;/f:facet&gt; &lt;h:outputText value="#{moduleBean.findStats(m.id}"/&gt; &lt;/h:column&gt; &lt;/h:dataTable&gt; moduleBean.allmodules() returns a list of module objects. This works fine. The problem is moduleBean.findStats(). Error message: javax.el.MethodNotFoundException: java.lang.NoSuchMethodException: no.uia.slit.web.ModuleBean$$OwbNormalScopeProxy0.findStats(java.lang.Long) viewId=/teacher/status.xhtml location=D:\code\github\neiva\build\web\teacher\status.xhtml phaseId=RENDER_RESPONSE(6) Caused by: java.lang.NoSuchMethodException - no.uia.slit.web.ModuleBean$$OwbNormalScopeProxy0.findStats(java.lang.Long) at java.lang.Class.getMethod(Class.java:1773) /teacher/status.xhtml at line 27 and column 72 value="#{moduleBean.findStats(m.id)}" If I change the method to not take any parameters, and call it like "#{moduleBean.findStats"} it works, but how can I pass parameters to the method? the method is defined like this:public String findStats(long id){}
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: Java EE outputText with method & parameter, inside dataTable
downvote count: 0
type: Question
tagged with: jakarta-ee
score: 1
tagged with: java
tagged with: ejb
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/42575720
score: 0
comment on: http://stackoverflow.com/q/27026107
type: Comment
type: QuestionComment
has text: Yes, in simple words I do not want to overwrite the file from the previous program execution. I want new data to be written starting from the first line after every execution cycle.

http://stackoverflow.com/q/27139730
answer count: 1
tagged with: applet
has title: Is it possible to use an applet as a server with Java?
tagged with: sockets
accepted answer: http://stackoverflow.com/a/27139864
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: network-programming
tagged with: server
has body: I'm just getting into networking and I'm quite confused about how I can use a server from a server hosting company for a game. At the moment, the program allows a user to host the server from their computer and it works to some degree. The only problem is that when my friends connect to the game from other states their ping is super high and they lag horribly. I'm now using a site that gives out free web hosting space. I've believe I've jumped through most of the permission hoops that I need in order to use sockets and the applet works just like it does while running on my computer. Below is an excerpt from the Game class. If I use InetAddress.getLocalHost().getHostAddress() to get the IP, it gets the IP from the user who is using the client and makes them the server host. This works, but it doesn't solve my problem of lag. Game.java public synchronized void start() { running = true; thread = new Thread(this, NAME + "_main"); thread.start(); if (JOptionPane.showConfirmDialog(this, "Do you want to run the server") == 0) { socketServer = new GameServer(this); socketServer.start(); } this.ipAddress = "31.170.163.198"; //this.ipAddress = InetAddress.getByName(ipAddress).toString(); System.out.println("IP: " + this.ipAddress); socketClient = new GameClient(this, this.ipAddress);//Inet4Address.getLocalHost().getHostAddress()); try { Player.setIp(Inet4Address.getLocalHost().getHostAddress()); } catch (UnknownHostException e) { e.printStackTrace(); } socketClient.start(); } I want the server that contains the jar to host the server. We all ping test each other and we mostly all get timed out, however, when we ping the server's ip we all get decent ping. When I enter the Server's IP (I find this info in the control panel) manually the server/client fail to make a connection. I've tried using both the website IP and the server IP that are provided. I've also tried using the applet.getCodeBase().getHost() in order to retrieve the IP from the server but that IP failed to send/r…
has answer: http://stackoverflow.com/a/27139864
score: 0

http://stackoverflow.com/a/27056495
score: 2
accepted answer of: http://stackoverflow.com/q/27056480
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27056480
downvote count: 0
has body: sure, use fully qualified name (e.g com.xxx.yyy.Order)
upvote count: 2
type: Answer

http://stackoverflow.com/a/27063110
score: 0
answers question: http://stackoverflow.com/q/27060870
has comment: http://stackoverflow.com/comment/42662033
type: Answer
has comment: http://stackoverflow.com/comment/42643758
has body: Doing this in Java code is not the best way to do it, and except for very rare use cases (writing an admin application for MongoDB) even one I would strongly advice against. Security risk First of all, your application would need extremely high privileges, namely userAdminAnyDatabase or userAdmin on the admin database, which more or less grants the same rights: creating a superuser at will. To put it in other words: this code would be a high security risk. Granting roles and rights on a database is an administrative task and for good reasons should be decoupled from an application accessible by arbitrary users. Technical problems Activating authentication from a client simply is impossible. The mongod instance in question has to be started with authentication enabled. Furthermore, you would have to save to create a user with the mentioned roles before you could have your app administer users. The problem: you would have to store the password for that user somewhere. Unless you encrypt it, you basically store the most powerful password for your MongoDB databases and cluster in cleartext. And if you encrypt it, you have to pass the key for decryption to your application at some point in a secure manner. And all this to break best practices ("Separation of concerns")?

http://stackoverflow.com/a/27115519
upvote count: 1
has body: See the setFrame() methods of RectangulerShape. For example: col.setFrame(x, y, width, height);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27114409
type: Answer
accepted answer of: http://stackoverflow.com/q/27114409
score: 1

http://stackoverflow.com/q/27039588
tagged with: access-denied
tagged with: mysql
has title: CreateProcess error=5, Access is denied while mysql database backup using processbuilder in java
type: Question
has answer: http://stackoverflow.com/a/27040955
answer count: 1
downvote count: 0
has body: I am trying to backup MySQL DB using ProcessBuilder in Java but, I get this error. "!Cannot run program "C:\Program Files\MySQL\MySQL Server 5.5\bin": CreateProcess error=5, Access is denied". Here is my Code. public static String backupDb() { String resp=null; try { System.out.println("Started........"); ProcessBuilder builder = new ProcessBuilder("C:\\Program Files\\MySQL\\MySQL Server 5.5\\bin", "mysqldump -u root -pmypass mydb&gt; c:\\backup\\mybackup.sql"); builder.redirectErrorStream(true); Process p = builder.start(); } catch(Exception e) { resp="!"+e.getMessage(); } return resp; } Where could I be going wrong?
has comment: http://stackoverflow.com/comment/42599597
favorite count: 0
accepted answer: http://stackoverflow.com/a/27040955
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/42656034
score: 1
has text: @eckes - How does this get around the limitation I posted in the original post? "If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute."
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27071548

http://stackoverflow.com/q/27034555
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/27034659
favorite count: 0
has body: Here is the code to find parent in Binary search tree. I am not able to understand how is it working, as we are never assigning any value to parent other than null. I an new to recursion. public Node findParent(Type data) { return findParent(data, root, null); } public Node findParent(Type x, Node node, Node parent) { if (node == null) { return null; } else if (!(node.data == x)) { parent = findParent(x, node.left, node); if (parent == null) { parent = findParent(x, node.right, node); } } return parent; }
has title: finding parent in binary search tree
tagged with: binary-search-tree
upvote count: 2
has answer: http://stackoverflow.com/a/27034602
type: Question
tagged with: recursion
score: 2
has comment: http://stackoverflow.com/comment/50547212
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27034602
has answer: http://stackoverflow.com/a/27034659

http://stackoverflow.com/comment/42698847
type: QuestionComment
score: 2
has text: The logic behind this is not a programming related issue but rather is in the math domain and can be found from the usual online sources, such as Google, Wikipedia, etc.
comment on: http://stackoverflow.com/q/27096743
type: Comment

http://stackoverflow.com/q/27111472
tagged with: java
has answer: http://stackoverflow.com/a/27111510
has body: I have an ArrayList&lt;Item&gt; items and two classes which inherit Item, which are Book and DVD. I add some books and some dvds in the item list items.add(new Book()); items.add(new DVD()); Now I want to do a public void printAllBooks() { } How can I just pick the Item which is of child class Book to print only?
type: Question
has answer: http://stackoverflow.com/a/27111640
has answer: http://stackoverflow.com/a/27111511
upvote count: 1
possible better answer: http://stackoverflow.com/a/27111510
answer count: 6
favorite count: 0
tagged with: arraylist
score: 0
downvote count: 1
has answer: http://stackoverflow.com/a/27111519
accepted answer: http://stackoverflow.com/a/27111519
has title: Getting child class items only from an ArrayList
has answer: http://stackoverflow.com/a/27112271
has answer: http://stackoverflow.com/a/27111539
type: AnsweredQuestion

http://stackoverflow.com/a/27087274
has body: This looks wrong : public String path; public void onCreate(String path) { this.path = sanitizePath(path); } This orCreate doesn't have the signature of the noCreate method of Activity, so it is not executed when you start the activity. Therefore path remains null, leading to your NullPointerException at File directory = new File(path).getParentFile();. If you wish to pass a path variable to your activity, you should put it in the Intent that starts the activity.
has comment: http://stackoverflow.com/comment/42682851
has comment: http://stackoverflow.com/comment/42682888
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42683123
has comment: http://stackoverflow.com/comment/42683144
answers question: http://stackoverflow.com/q/27087242
has comment: http://stackoverflow.com/comment/42684516
upvote count: 1
has comment: http://stackoverflow.com/comment/42684470

http://stackoverflow.com/a/27034744
has body: You CAN'T find it as it's from Play 1.x API @Before and other interceptors are NOT available in Play 2.x - they are replaced by Action Composition @See similar topic Note: Do not use documentation of Play 1.x for Play 2.x at all. In most areas they are totally different.
answers question: http://stackoverflow.com/q/27034279
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27034279

http://stackoverflow.com/q/27101971
has answer: http://stackoverflow.com/a/27102431
tagged with: progress-bar
has body: I wrote that code to send data to parse.com then to receive it also but I can't even send it till now, why ?!! I don't know the main reason, I put the internet and network permission in AndroidManifest.xml the parse class in application also in AndroidManifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mkadaimtwo" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;application android:name="com.example.mkadaimtwo.ParseCode" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; and also put the parse class in application also in AndroidManifest.xml and that two codes of class and main Activity ParseCode class Activity : package com.example.mkadaimtwo; import com.parse.Parse; import android.app.Application; public class ParseCode extends Application { public void onCreate() { Parse.initialize(this, "GIuhlGILKRd8itvCF79femTyReHM6XjVkrfLKm3X", "Fjg4tBrMgl0mY47K4kCL7hVmXhu8FmkE2on9PlXK"); } } the MainActivity Code : package com.example.mkadaimtwo; import android.app.AlertDialog; import android.app.ProgressDialog; import android.net.ParseException; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.EditText; import com.parse.GetCallback; import com.parse.ParseObject; import com.parse.ParseQuery; public class MainA…
tagged with: data-retrieval
tagged with: android
tagged with: parse-platform
type: UnansweredQuestion
tagged with: java
type: Question
has title: How can I send and retrieve data with parse.com
score: 0
answer count: 1

http://stackoverflow.com/q/27117847
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27117892
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42737882
answer count: 4
has answer: http://stackoverflow.com/a/27117862
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/27117871
has title: Executing the java program from command prompt
has answer: http://stackoverflow.com/a/69181094
score: -3
has body: I have a java program in a Folder(template).There is a sub directory(lib) which has all the libraries. How do i execute the java program from the command prompt? I need to do the above stuff using process builder. How should i do that in the case of process builder too

http://stackoverflow.com/comment/42538210
has text: That fixed half of it, thanks! However, now it's saying that the number of primes is whatever N is. Any ideas?
comment on: http://stackoverflow.com/a/27004279
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42541940
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27006427
has text: Please post your stack trace in a code block, makes it easier to read
score: 0

http://stackoverflow.com/comment/42542077
has text: You should definitely create a method `createButton` which gets an `int` as parameter and returns the new subpanel with the button on it. You've currently copied that code 12 times. Also, please read this: [DRY](http://en.wikipedia.org/wiki/Don%27t_repeat_yourself).
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27006029
type: Comment

http://stackoverflow.com/comment/42608004
has text: You can clearly? How would you do it?
score: 1
comment on: http://stackoverflow.com/q/27043875
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42727670
type: QuestionComment
has text: Can you provide any link or sample code for that? Thank you!
comment on: http://stackoverflow.com/q/27088926
score: 0
type: Comment

http://stackoverflow.com/comment/42709155
type: Comment
comment on: http://stackoverflow.com/a/27102332
has text: Yeah if copy MyApp.class and put into WEB-INF/classes.After that when i create war file of Web App.That MyApp.class is not showing in file structure..
score: 0
type: AnswerComment

http://stackoverflow.com/comment/58346177
has text: @Araneo i am struggeling hard with iris detection (Hough), could you share yout code?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27058057

http://stackoverflow.com/comment/42665663
has text: Hi, I just did a rebuild on the project, and it is working now. I guess it must have not rebuild teh application when i hit debug. Thanks again for all your help, it is much appreciated. Corey
type: QuestionComment
comment on: http://stackoverflow.com/q/27075984
score: 0
type: Comment

http://stackoverflow.com/comment/42979912
type: QuestionComment
has text: I am using Scene Builder 2.0 and I defined the custom control in the project I want to use it in, so there is no external jar to import.
score: 0
comment on: http://stackoverflow.com/q/27113417
type: Comment

http://stackoverflow.com/a/27094228
answers question: http://stackoverflow.com/q/27094050
score: 0
has comment: http://stackoverflow.com/comment/42694654
type: AcceptedAnswer
has body: My guess is that it not only skips some numbers, but that it deletes some files actually! When renaming the files, you might end up overwriting some already existing files. Take the following example: You have 3 files: 0.jpg, 1.jpg, 2.jpg. They should be renamed as follows (a possible result of your shuffling): 0.jpg -&gt; 1.jpg 1.jpg -&gt; 2.jpg 2.jpg -&gt; 0.jpg This would work if all the files would be renamed at the same time. But if they are renamed sequentually, the first renaming (0.jpg -&gt; 1.jpg) will overwrite the "old" 1.jpg. When the "old" 1.jpg should be renamed, it's actually the new 1.jpg (=old 0.jpg) being renamed to 2.jpg, overwriting the "old" 2.jpg. And then, that file get's renamed again to 0.jpg. So, you'll end up only with 0.jpg (which in this case is actually the same as the original 0.jpg), but you've overwritten and thus lost the others. Depending on your shuffling, you might end up overwriting only some of the files, and thus see some numbers skipped. How to solve it? 2 Variants: 1) move the files to a new directory, and then in the end delete the old directory (it should be empty now, as all files have been moved) and rename the new directory to the name of the original directory. 2) rename the files first to include some prefix, e.g. "tmp_" + j + "." + extension, and after all files have been renamed, rename the files again to remove the prefix. Both variants make sure that no file is accidentially overwritten.
type: Answer
accepted answer of: http://stackoverflow.com/q/27094050

http://stackoverflow.com/comment/42769864
comment on: http://stackoverflow.com/q/27092406
has text: Please tell me what is wrong with my question that I can as good questions in future,
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27007034
tagged with: android
has answer: http://stackoverflow.com/a/27007122
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: arrays
score: 0
answer count: 1
has title: I am getting a type error when looping JSONArray in Android / Java
accepted answer: http://stackoverflow.com/a/27007122
has body: I want to access posters and loop it in this JSON sting. {"r": {"posters": [ {"rev":10,"poster_id":4,"poster_filename":"545397373c2c7","poster_filepath":"\/poster_files\/545397373c2c7","poster_synopsis":"This is the new synopsis for this exquisite poster I have created. You will marvel at its greatness and ask many questions.","poster_title":"Poster A"}, {"rev":6,"poster_id":7,"poster_filename":"5453b54b83b5f","poster_filepath":"\/poster_files\/5453b54b83b5f","poster_synopsis":"This is a synopsis that is not real. No one can say what this synopsis really means. It is total B.S..","poster_title":"Poster A"} ], "msg":"72 &amp; 2", "status":"complete"} } I have this to convert the string to JSONObject: JSONObject jsonObject = new JSONObject(result); JSONObject r = new JSONObject(jsonObject.getString("r")); JSONArray posters = r.getJSONArray("posters"); Android Studio says "Array type expected, found org.json.JSONArray when I try to loop posters: int arraySize = posters.length(); TextView myTextView = (TextView) findViewById(R.id.show_download_list); for(int i = 0; i &lt; arraySize; i++) { myTextView.append(posters[i]); myTextView.append("\n"); } Am I not converting the object correctly??

http://stackoverflow.com/q/27051770
has comment: http://stackoverflow.com/comment/42620873
tagged with: java
upvote count: 1
tagged with: polygon
has comment: http://stackoverflow.com/comment/42621145
has comment: http://stackoverflow.com/comment/42620793
type: UnansweredQuestion
tagged with: canvas
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/42628244
score: 1
favorite count: 0
has body: I am following one of the examples from a book "Fundamental 2D Game Programming With Java". In that book, one of the examples shows how to draw a polygon, in this case, it is a rectangle. I started to throw sysouts to understand better, how that polygon drawing works. ... and those sysouts confused me completely. sysouts prints completely different values than what is shown on screen. Values in console are without a doubt the wrong ones. But what might be causing that? Edit: Additional information: Vector2f is a class that holds X and Y float values. It also has methods for translating, scaling, shearing and rotating the whole polygon Here's the code that draws the polygon: public static void drawPolygon(Graphics g, Vector2f[] polygon) { Vector2f P; Vector2f S = polygon[polygon.length - 1]; System.out.println("Starting drawing:"); for (int i = 0; i &lt; polygon.length; ++i) { //Just for testing, calls g.setColor(), nothing relevant to the problem setColor(i, g); P = polygon[i]; //Debug drawing, draws the coordinates (Like in screenshot, in red color: '(322, 250)') g.drawString("(" + (int)S.x + ", " + (int)S.y + ")", (int)S.x, (int)(S.y)); //Draws the rectangle, line by line in for loop (first red, then green, blue, orange) g.drawLine((int) S.x, (int) S.y, (int) P.x, (int) P.y); //System outs that prints completely different values than what is shown on screen! System.out.println("S.x = " + (int)S.x); System.out.println("S.y = " + (int)S.y); System.out.println("P.x = " + (int)P.x); System.out.println("P.y = " + (int)P.y); System.out.println("Drawing line from (" + (int)S.x + "," + (int)S.y + ") to (" + (int)P.x + "," + (int)P.y + ")"); S = P; } System.out.println("End of drawing a polygon"); } And here's the console output for this particular call: Starting drawing: S.x = -316 S.y = -388 P.x = -316 P.y = -468 Drawing line from (-316,-388) to (-316,-468) S.x = -316 S.y = -468 P.x = -236 P.y = -468 Drawing line from (-316,-468) to (-236,-468) S.x = -236 S.y = -468 P.x …
has title: Console prints completely different values than what is shown on screen
has comment: http://stackoverflow.com/comment/42621105
type: Question
has comment: http://stackoverflow.com/comment/42623241
has comment: http://stackoverflow.com/comment/42620714
has comment: http://stackoverflow.com/comment/42621351

http://stackoverflow.com/a/27120421
score: 0
type: Answer
has body: while (stdIn.hasNextLine()) { // for (int k = 0; k &lt;= line.length - 1; k++) { String str = stdIn.nextLine(); out.println(str); // out.close(); --&gt; here you are closing the out put writer so after first line it will be closed. // } } Close scanner and printwriter outside the loop. otherwise after first line it will the writer will be closed and only first line will be printed.
answers question: http://stackoverflow.com/q/27120208

http://stackoverflow.com/comment/42846789
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27145949
type: Comment
has text: Thank you! The adding section works now but there is one more thing I would like to implement. This time around I would like to delete the section that was just added. I used the same logic but for some reason, it deletes the very first section added rather than the section that was added just now. What may be the problem? I showed the code. Thank you again!

http://stackoverflow.com/comment/42591241
type: Comment
comment on: http://stackoverflow.com/q/27035081
has text: Env is only windows. I need to run using command line, because in some location I need to list 5k-10-15k files. Which is a performance killer if I use just java File... I'm not totally sure bu tlisting using shell should be a lot faster and decrease IO to disk. Basically I need to know about file three info: filename, file size and last modify date.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42761901
score: 0
has text: And, probably the second code will also help too because you are generating the dynamic ID in that method, then concatenating with "something-" text, and then using that as the locator click on the element.
type: AnswerComment
comment on: http://stackoverflow.com/a/27130960
type: Comment

http://stackoverflow.com/q/27032245
score: 0
has comment: http://stackoverflow.com/comment/42586506
answer count: 1
has comment: http://stackoverflow.com/comment/42586305
has comment: http://stackoverflow.com/comment/42586451
has answer: http://stackoverflow.com/a/27032496
tagged with: path
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42586220
accepted answer: http://stackoverflow.com/a/27032496
type: Question
has title: Am I accessing these resource files in java incorrectly?
has body: I have two classes. One is intended to be a common library and another a client that consumes from the library. The library is structured as below: public class Library { public Library() { String pathToResourceA="src/main/resources/A.xls";// A.xls is present within resources String key="apples"; Resource res= loadResourceBasedOnDoc(pathToResource,key); ...//process resource } } It's corresponding test class public class LibraryTest { @Test public void testLibrary() { new Library();// works as expected- the test passes and the resource is loaded.//ie. A.xls is found in the right place } } However, when I try to access the library from my client in the following manner import packagename.Library public class Client{ Library lib; public Client() { lib= new Library();// throws a FileNotFoundException! } } I get a FileNotFoundException. I'm guessing this is something to do with defining the right value to pathToResourceA in class A but cant figure out what it is. Any thoughts would be appreciated. Thanks! Code for loadResourcesBasedonDoc protected Resource loadResourceBasedOnDoc(String filename,String password) { InputStream in = null; try { in = new FileInputStream(filename); //further in is processed...
tagged with: eclipse

http://stackoverflow.com/q/27052190
has comment: http://stackoverflow.com/comment/42677513
has body: I'm experiencing an issue in which it would appear that calls to AmazonS3Client.getObject never returns; this is happening to us every day, and I believe it's when S3 is running it's daily expiry job. There doesn't seem to be a way to specify a timeout value for this request, and it's causing our thread pool to become blocked indefinitely, making our entire instance unresponsive when enough of them hang indefinitely. Is there a way to overcome? I've gone down the Thread.interrupt path, but am not sure if it will that signal will abided. Here is the stack trace for where it is getting stuck: "image-s3-dispatcher-10187" - Thread t@10481 java.lang.Thread.State: TIMED_WAITING at sun.misc.Unsafe.park(Native Method) - parking to wait for &lt;7945c7e6&gt; (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkUntil(LockSupport.java:267) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitUntil(AbstractQueuedSynchronizer.java:2130) at org.apache.http.pool.PoolEntryFuture.await(PoolEntryFuture.java:129) at org.apache.http.pool.AbstractConnPool.getPoolEntryBlocking(AbstractConnPool.java:281) at org.apache.http.pool.AbstractConnPool.access$000(AbstractConnPool.java:62) at org.apache.http.pool.AbstractConnPool$2.getPoolEntry(AbstractConnPool.java:176) at org.apache.http.pool.AbstractConnPool$2.getPoolEntry(AbstractConnPool.java:172) at org.apache.http.pool.PoolEntryFuture.get(PoolEntryFuture.java:100) at org.apache.http.impl.conn.PoolingClientConnectionManager.leaseConnection(PoolingClientConnectionManager.java:212) at org.apache.http.impl.conn.PoolingClientConnectionManager$1.getConnection(PoolingClientConnectionManager.java:199) at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.amazonaws.http.conn.ClientConnectionRequestFactory…
downvote count: 0
has title: Java library AmazonS3Client.getObject never returns
accepted answer: http://stackoverflow.com/a/27095666
type: AnsweredQuestion
score: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/42647312
type: Question
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/42626703
has answer: http://stackoverflow.com/a/27095666
tagged with: amazon-s3
tagged with: java
has comment: http://stackoverflow.com/comment/65348928

http://stackoverflow.com/a/27109001
has comment: http://stackoverflow.com/comment/42722398
has comment: http://stackoverflow.com/comment/42721360
has comment: http://stackoverflow.com/comment/42722023
has comment: http://stackoverflow.com/comment/42721306
type: Answer
has comment: http://stackoverflow.com/comment/42722295
downvote count: 0
has body: Three issues: You have to specify the fully qualified class name (that means including the package name) to the java command. It looks like your myjava class is in a package com.myexample.test. So its fully qualified name is com.myexample.test.myjava. When you run the java command you have to be in the directory that is at the base of the package hierarchy (or put that directory on the classpath). You're using the src directory, which contains .java source files, but the java command expects compiled .class files, so you need to use the project's output directory. Its location in your project will depend on your IDE and configuration but it will contain same-named structure as inside src, except with .class files instead of .java files. In your case, navigate to: C:\myjava\sampl1\out\production\ Then run: java com.myexample.test.myjava
score: 29
accepted answer of: http://stackoverflow.com/q/27108911
answers question: http://stackoverflow.com/q/27108911
upvote count: 29
has comment: http://stackoverflow.com/comment/111657463
type: AcceptedAnswer

http://stackoverflow.com/a/27156991
upvote count: 1
downvote count: 0
has body: I dont know about the NetBeans Emulator, but I would say the APDU is in non-valid format. If you use three bytes for Lc beginning with leading zero you indicate Extended Length. Yet if you append Le byte this Le byte must be two bytes in this case! Try: CLA INS P1 P2 Lc Lch Lcl Data Le1 Le2 0xAB 0x00 0x00 0x00 0x00 0x01 0x13 ....... 0x00 0x7F;
answers question: http://stackoverflow.com/q/27132078
type: Answer
has comment: http://stackoverflow.com/comment/42857931
score: 1

http://stackoverflow.com/comment/42516231
comment on: http://stackoverflow.com/q/26992374
score: 1
has text: This question is just to broad.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42687089
has text: import java.math.BigDecimal
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27090038

http://stackoverflow.com/comment/42749643
type: Comment
comment on: http://stackoverflow.com/a/27124657
has text: http://programmerguru.com/android-tutorial/android-asynctask-example/ Refer this link.
type: AnswerComment
score: 0

http://stackoverflow.com/a/27306596
has body: What I often do in this situation is to checkout the source code for the library in question (it's open source remember?), modify it to suit my requirement, and then contribute the patch back to the project. Your use case certainly sounds like it would be a useful contribution.
type: Answer
answers question: http://stackoverflow.com/q/27132381
score: 0

http://stackoverflow.com/comment/42806358
has text: Thank you so much. I should have check the documents first.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27139325

http://stackoverflow.com/q/27027933
has answer: http://stackoverflow.com/a/27028738
upvote count: 2
tagged with: java
tagged with: gson
type: Question
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/27028738
answer count: 1
downvote count: 0
favorite count: 0
has body: I have the following (obfuscated for SO) JSON: { "ABC" : { "logo_1": { "hdpi": "value", "mdpi": "value", "xhdpi": "value", "xxhdpi": "value" }, "logo_2": { "regular": "value", "high_res": "value", } }, "XYZ" : { "logo_1": { "hdpi": "value", "mdpi": "value", "xhdpi": "value", "xxhdpi": "value" }, "logo_2": { "regular": "value", "high_res": "value", } } ABC and XYZ are regions. We need different logos per region and the problem I am hitting is that I want to be able to handle new regions in the future. Therefore I don't want to create an object such as the following: public class EnvoyMessagesModel { public Region ABC; public Region XYZ; } I've seen lists used in Gson but the name of the list variable is always the actual tag and since "ABC" != "XYZ" I don't think that would work. Is there a way to just get a list of these regions that will know their top level tag as well? I would want to do something like region.getTopLevel() and have it return "ABC" or "XYZ"
has title: Reading Into GSON for list of top level tags
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/26994344
type: Question
has title: How do i avoid runtime type checks in this code?
has body: As part of the assignment, I wrote the below code to encode the 2d-array into Doubly linked list. RunLengthEncoding class takes care of encode/decode functionality. Amidst implementation of this class, there was a necessity to typecast some variables to push the type check(String) at runtime. Below are the lines that does typecasting: class RunLengthEncoding { private DList2 list; private String nextRun() { Object obj = null; ..... obj = this.list.nTh(this.sizeOfRun); return (String)obj; } public void check() { .... while(node != this.list.sentinel){ int nodetype = Utility.regexChecker("\\D{1,}", (String)node.runObject, 1); } } } ==================== typecast is done because, because doubly linked list(class DList2{..}) is a list of DListNode2's which accepts and returns object of type Object. class DListNode2{ Object runObject; DListNode2 prev; DListNode2 next; } My question: How should i avoid type casting in RunLengthEncoding class to avoid runtime type checks, when i use DList2 class? Note: I am a java beginner.
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26994561
has comment: http://stackoverflow.com/comment/42519568
has comment: http://stackoverflow.com/comment/42519242
has answer: http://stackoverflow.com/a/26994561
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/27015181
answers question: http://stackoverflow.com/q/27015096
has comment: http://stackoverflow.com/comment/42556143
has comment: http://stackoverflow.com/comment/42556186
score: 0
has comment: http://stackoverflow.com/comment/42558011
type: Answer
has comment: http://stackoverflow.com/comment/42556084
has body: Default equal's and hashCode method of arrayList resides under java.util.AbstractList if you want to debug your code, you could set breakpoint in that class around those two methods. Internally it does call's equals on each and every String within the list. And same applies for hashCode i.e. it calls hashCode on each and every String within the list. In short, your code should work and you should find same hashcode for both list's and they both should be equal as well.

http://stackoverflow.com/comment/57186415
comment on: http://stackoverflow.com/a/27106543
has text: My bad, I used % instead of $. sorry
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27051435
score: 6
upvote count: 6
accepted answer: http://stackoverflow.com/a/27236734
linked to: http://stackoverflow.com/q/19731323
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: spark-java
has title: Use Java Spark after filter to run custom action when a 404 happens
has answer: http://stackoverflow.com/a/33208126
answer count: 2
has answer: http://stackoverflow.com/a/27236734
downvote count: 0
possible better answer: http://stackoverflow.com/a/33208126
has body: I'll try to keep it short. Here's the problem I'm having while trying to understand Spark filters. I'm trying to create a simple app and one of the things that it should do is to create an error report every time the client is about to see an http error e.g. 404 or 500. Here's how my app looks like: import static spark.Spark.*; public class MyApp { public static void main(String[] args) { get("/hello", (req, res) -&gt; "{\"status\":\"OK\"}"); after((request, response) -&gt; { if (response.raw().getStatus() == 404) { // here run the code that will report the error e.g. System.out.println("An error has occurred!!"); } }); } } For some reason, the response parameter has its status attribute set to 0 when I'm checking if it's set to 404. The documentation says "after" filters are evaluated after each request and can read the request and read/modify the response so, I should be able to do it somehow (unless the docs are wrong). Basically, I'm trying to intercept http errors using an after filter but when I try to check the response I don't get what I expect. Has anyone an idea what would be a different way of doing the same thing or how to make this work? Thanks.
favorite count: 0

http://stackoverflow.com/q/27124323
answer count: 1
has answer: http://stackoverflow.com/a/27195018
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42749467
tagged with: java
has title: Report Exception with Spring MVC 2.5 , JasperReport 5.5 , Ireport 5.5 , Tomcat 6
has comment: http://stackoverflow.com/comment/42829401
type: Question
tagged with: jasper-reports
accepted answer: http://stackoverflow.com/a/27195018
has body: I have successfully make a spring MVC 2.5 application based on this sample : Spring Web MVC - Spring Web Flow Working With JasperReports But when i tried to access a pdf view of a report built with IREPORT 5.5 i have this exception : Etat HTTP 500 - Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mbamsusers': Initialization of bean failed; nested exception is java.lang.ClassCastException: cannot assign instance of net.sf.jasperreports.engine.base.JRBaseStyle to field net.sf.jasperreports.engine.base.JRBaseParagraph.paragraphContainer of type net.sf.jasperreports.engine.JRParagraphContainer in instance of net.sf.jasperreports.engine.base.JRBaseParagraph type Rapport d'exception message Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mbamsusers': Initialization of bean failed; nested exception is java.lang.ClassCastException: cannot assign instance of net.sf.jasperreports.engine.base.JRBaseStyle to field net.sf.jasperreports.engine.base.JRBaseParagraph.paragraphContainer of type net.sf.jasperreports.engine.JRParagraphContainer in instance of net.sf.jasperreports.engine.base.JRBaseParagraph description Le serveur a rencontré une erreur interne qui l'a empêché de satisfaire la requête. exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mbamsusers': Initialization of bean failed; nested exception is java.lang.ClassCastException: cannot assign instance of net.sf.jasperreports.engine.base.JRBaseStyle to field net.sf.jasperreports.engine.base.JRBaseParagraph.paragraphContainer of type net.sf.jasperreports.engine.JRParagraphContainer in instance of net.sf.jasperreports.engine.base.JRBaseParagraph org.springframework.web.servlet.FrameworkServlet.processRequest(…
has comment: http://stackoverflow.com/comment/42758767
score: 0

http://stackoverflow.com/comment/42756218
type: AnswerComment
type: Comment
has text: I actually have a key (which is the xml node) and multiple values associated with the key. I can see that any duplicate values are currently ignored and the last one(from the duplicate values) gets added to the map.
comment on: http://stackoverflow.com/a/27128286
score: 0

http://stackoverflow.com/a/27102926
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27102478
accepted answer of: http://stackoverflow.com/q/27102478
has body: root_layout is basically the existing layout in your xml in which you want to add newly created View. Assign id root_layout to the RelativeLayout in your xml file. OR Keep a new Layout inside it with root_layout id. &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/root_layout" 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="nl.mprog.projects.nPuzzle10206353.ShowImage" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Wait three seconds..." /&gt; &lt;/RelativeLayout&gt; So now when you use this in Activity: RelativeLayout root = (RelativeLayout)this.findViewById(R.id.root_layout); root.addView(imageView); imageView would be added to that RelativeLayout with id root_layout
score: 0

http://stackoverflow.com/q/27054584
type: Question
has comment: http://stackoverflow.com/comment/42625899
has body: when the game executes, the player can enter a move, but then it gets stuck in a loop, and the logic error is in the isWinner method but I can't figure out how to do that without using a bunch of long if statements? help please public class TicTacToe { public static char board[] = new char[10]; public static void resetgame(){ for (int x = 0; x &lt; board.length; x++) board[x] = '-'; // resets board to all - } public static void displayBoard(){ for (int x = 1; x &lt; board.length; x++){ if (board[x] == '-') System.out.print(x + " "); else System.out.print(board[x] + " "); if (x % 3 == 0) System.out.println(); } } public static boolean isSpotEmpty(int m){ return (board[m] == '-'); } public static void getPlayerMove(){ Scanner input = new Scanner(System.in); System.out.print("Enter your move (1-9): "); int move = input.nextInt(); while (move &lt; 1 || move &gt; 9 || !isSpotEmpty(move)){ //validate move System.out.print("Move is not valid. Reenter move (1-9): "); move = input.nextInt(); } board[move] = 'X'; } public static void computerMove(){ int move = ((int)(Math.random() * 9)+1); while (isSpotEmpty(move)==false) move = ((int)(Math.random() * 9)+1); board[move] = 'O'; } public static boolean isWinner(char ch){ for(int x = 1; x &lt; 4; x++){ while (board[x] != ch) return false;} for(int x = 4; x &lt; 7; x++){ while (board[x] != ch) return false;} for (int x = 7; x &lt; board.length; x++){ while (board[x] != ch) return false;} for (int x = 1; x &lt; 8; x += 3){ while (board[x] != ch) return false;} for (int x = 2; x &lt; 9; x += 3){ while (board[x] != ch) return false;} for (int x = 3; x &lt; board.length; x += 3){ while (board[x] != ch) return false;} for (int x = 1; x &lt; board.length; x += 4){ while (board[x] != ch) return false;} for (int x = 3; x &lt; 8; x += 2){ while (board[x] != ch) return false;} return true; } public static boolean isFull(){ boolean draw = false; for (int x = 0; x &lt; board.length; x++){ while (board[x] != '-') draw = true; } return draw; }…
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42625853
has answer: http://stackoverflow.com/a/27055160
possible better answer: http://stackoverflow.com/a/27054641
answer count: 3
has answer: http://stackoverflow.com/a/27054905
accepted answer: http://stackoverflow.com/a/27054905
favorite count: 0
has comment: http://stackoverflow.com/comment/42625754
has title: I cannot spot my logic error
upvote count: 1
has comment: http://stackoverflow.com/comment/42625729
has answer: http://stackoverflow.com/a/27054641
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42625691
tagged with: methods

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/27087695
type: Tag

http://stackoverflow.com/comment/42633126
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27003759
type: Comment
has text: Hello @eduyayo. This is interesting. I'm thinking about a temporary context to store the first response, then the second request can get the content directly from this temporary context.

http://stackoverflow.com/comment/42716330
comment on: http://stackoverflow.com/a/27102879
type: AnswerComment
score: 0
type: Comment
has text: I have completed the below code WebElement parent = driver.findElement(By.className("highcharts-series-group")); List<WebElement> children = parent.findElements(By.tagName("rect"));

http://stackoverflow.com/comment/42721800
comment on: http://stackoverflow.com/a/27109183
type: AnswerComment
score: 0
has text: I wasn't talking directly about you, im talking about all the other people being like "method doesn't return anything" so what.. the logic is there.. im sure you could figure out the return if you wanted the code...
type: Comment

http://stackoverflow.com/comment/42730402
type: QuestionComment
comment on: http://stackoverflow.com/q/27112293
has text: Thank you all guys for the advices,I'm really new to this forum,sorry I shouldn't have just asked for the codes.I somehow made it this far
score: 0
type: Comment

http://stackoverflow.com/comment/42749566
type: Comment
score: 0
type: AnswerComment
has text: Put the data in sharePreference and other store then check this data in Dashboard and change the icon.
comment on: http://stackoverflow.com/a/27124438

http://stackoverflow.com/a/61712367
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27098043
type: Answer
has body: Spring scope singleton has nothing to do with thread safety those are two different concepts. The difference between singleton &amp; prototype bean is how we ask spring container that manages beans life-cycle to return beans: Singleton: Insure every time you call the bean it return the same instance. Prototype: Return new instance when ever called. Calling bean can be trigger by either @autowirde or AppContext.getBean("beanName") In summary it all depends on the objects injected the bean if it is not thread-safe then obviously it not gonna be thread-safe. To learn more Spring Bean Scopes
upvote count: 1

interop
tags question: http://stackoverflow.com/q/27040442
type: Tag
tag name: interop

http://stackoverflow.com/a/27115777
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27115524
has comment: http://stackoverflow.com/comment/42872474
downvote count: 0
has body: The appengine-maven-plugin for GAE is actually constructing a command line call to the GAE SDK, as you can see here. This is IMHO the Python version of the commands. However reading the GAE documentation, you should be able to use com.google.appengine.tools.admin.AppCfg in appengine-java-sdk/lib/appengine-tools-api.jar instead. And from that code, I am quite sure one does not want to code this yourself.
type: Answer

http://stackoverflow.com/q/27108194
type: Question
has answer: http://stackoverflow.com/a/27108456
tagged with: java
tagged with: easymock
answer count: 2
linked to: http://stackoverflow.com/q/15305490
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27110587
tagged with: powermock
accepted answer: http://stackoverflow.com/a/27110587
tagged with: singleton
has title: PowerMock - Mock a Singleton with a Private Constructor
has body: I'm using PowerMock with EasyMock, and wondered how I might mock a singleton with a private constructor? Let's say I have the following class: public class Singleton { private static Singleton singleton = new Singleton(); private Singleton() { } public static Singleton getInstance() { return singleton; } public int crazyServerStuff() { ... } } And a class which uses this: public class Thing { public Thing() {} public int doStuff(Singleton s) { return s.crazyServerStuff() + 42; } } How might I mock the crazyServerStuff method? I've tried the following: @RunWith(PowerMockRunner.class) @PrepareForTest(Singleton.class) public class ThingTest extends AndroidTestCase { @Test public void testDoStuff() { MemberModifier.suppress(MemberModifier.constructor(Singleton.class)); Singleton mockSingleton = PowerMock.createMock(Singleton.class); ... } } But I get the error java.lang.IllegalArgumentException: No visible constructors in class Singleton Does anyone know what I'm missing?
score: 2
type: AnsweredQuestion
upvote count: 2
possible better answer: http://stackoverflow.com/a/27108456
tagged with: unit-testing

http://stackoverflow.com/q/27089945
answer count: 1
tagged with: button
has answer: http://stackoverflow.com/a/27089994
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: I've looking for an answer for this question but no one really gives a clear answer on what code should be or look like. I've created am android app that plays sounds when you click a button but I'd like the use to have to option when they hold down on the button a display comes up where they can download or save as ringtone. Does anyone know how you would go about doing this? Here's my code: MediaPlayer mediaPlayer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button Bus = (Button) findViewById(R.id.b1); Bus.setOnClickListener (new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub Uri p1 = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bus); mediaPlayer = MediaPlayer.create(MainActivity.this, p1); mediaPlayer.start(); } }); and my xml: &lt;Button android:id="@+id/b1" android:layout_width="125dp" android:layout_height="60dp" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginLeft="18dp" android:layout_marginStart="21dp" android:layout_marginTop="25dp" android:background="@drawable/jay" android:shadowColor="#00FF00" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="10" android:text="@string/b1" android:textColor="#000000" /&gt; Thanks, I'd really appreciate any help on this issue!
has comment: http://stackoverflow.com/comment/42692800
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27089994
tagged with: java
type: Question
has title: Hold down button to give option to save as ringtone?
score: 0

http://stackoverflow.com/a/46689869
answers question: http://stackoverflow.com/q/27060113
type: Answer
has body: Set break points at where you want to trace in Right click on the Test Runner Select Debug as JUnit.
score: 0

http://stackoverflow.com/comment/42695729
type: Comment
type: QuestionComment
score: 0
has text: @NathanWalters yes i had done that, ive added my manifest to the op
comment on: http://stackoverflow.com/q/27094813

http://stackoverflow.com/a/27095797
has comment: http://stackoverflow.com/comment/42698737
has comment: http://stackoverflow.com/comment/42697255
answers question: http://stackoverflow.com/q/27095731
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27095731
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/42698633
upvote count: 3
has body: Why do I get the same output each time? Because you're not overriding the toString method. The value you're seeing is java's implementation of toString. Every object has this behavior. Put this method in your point class to override java's toString implementation. @Override public String toString(){ return "("+x+", "+y+")"; } This will give you output in the format (x, y) as you requested. Why are midpoint and distance static? The methods being static was a design decision. They could be written to be non-static, but it would make less sense as the methods don't change the state of either point object involved.

http://stackoverflow.com/a/27024572
has comment: http://stackoverflow.com/comment/42573422
has body: Have you considered using a Scanner to do this? Scanner can take the name of the file as the parameter and can easily read out each individual number. InputStream is = this.getClass().getResourceAsStream("/dataset.txt"); int[] spect = new int[is.available()]; Scanner fileScanner = new Scanner("/dataset.txt"); for(int i = 0; fileScanner.hasNextInt(); i++){ spect[i] = fileScanner.nextInt(); }
upvote count: 1
has comment: http://stackoverflow.com/comment/42573367
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27024382

http://stackoverflow.com/comment/42701230
comment on: http://stackoverflow.com/q/27098054
score: 0
type: Comment
type: QuestionComment
has text: This code doesn't compile. And what exactly is the question?

http://stackoverflow.com/comment/42779738
type: QuestionComment
comment on: http://stackoverflow.com/q/27141021
type: Comment
score: 0
has text: But I am looking for ways which follows design principles - low coupling and high cohesion.

http://stackoverflow.com/q/27018633
accepted answer: http://stackoverflow.com/a/27018705
answer count: 1
tagged with: long-integer
upvote count: 1
tagged with: input
favorite count: 0
has title: how to read a long value from standard input in java?
downvote count: 2
has body: i am using util.Scanner to read input from the user. I don't understand how to read a long datatype value. Scanner scr=new Scanner(System.in); long l=scr.nextInt(); I am unable to read 64-bit data using the above code &mdash; it just gives me an input mismatch exception.
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/42562000
has answer: http://stackoverflow.com/a/27018705

http://stackoverflow.com/q/27088038
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42683990
has comment: http://stackoverflow.com/comment/42683861
answer count: 0
has title: Does JTA wrap native sql-query into a transaction on low-level?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42684047
has comment: http://stackoverflow.com/comment/42683872
tagged with: jta
has body: I have a question about JTA. If we write the following: @Resource UserTransaction userTransaction; public void updateData() { // Start a transaction. userTransaction.begin(); // ... // Perform transactional operations on data // Commit the transaction. userTransaction.commit(); } will an sql-query generated by the operations on data be wrapped into a transaction like BEGIN --some sql-query COMMIT
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42683828

http://stackoverflow.com/a/27089912
downvote count: 0
has body: With sout live template, that's quite easy, at least in version 14: after "exampleInt", type a dot and "sout" will be suggested to you which will do exactly what you want. For just any method call, that's also easy if you use Complete Statement feature. You start typing before "exampleInt" but not overwriting it. You type what's necessary for the autopopup completion to suggest you the method, e.g. "System.out.priexampleInt". When you have the correct method selected in the popup list, press the shortcut of Edit | Complete Current Statement (Ctrl+Shift+Enter on Windows/Linux). As a result, you get the completed method call with the contents after the caret wrapped as an argument: "System.out.println(exampleInt)".
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27088398
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27088398

http://stackoverflow.com/q/27092828
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/27092874
possible better answer: http://stackoverflow.com/a/27092870
has answer: http://stackoverflow.com/a/27092870
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42693100
has body: i get a JSON response from a server and i want to transform it into a POJO which is the following: public class MeasureDataGetPOJO { @SerializedName("CODE") private String code = null; @SerializedName("USER") private User user = null; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public class User { private List&lt;MeasureData&gt; measureDatas = null; public List&lt;MeasureData&gt; getMeasureDatas() { return measureDatas; } public void setMeasureDatas(List&lt;MeasureData&gt; measureDatas) { this.measureDatas = measureDatas; } public class MeasureData { @SerializedName("MT_TIME") private String time = null; @SerializedName("MT_VALUE") private String value = null; public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } } } The JSON i get from the server: { "CODE":"012", "USER": [ { "MT_TIME":"1412882760", "MT_VALUE":"319", } ] } And the error i get from Gson is: Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 10 Is there something wrong with the JSON or with the POJO i try to map the JSON into? I am expecting one user with multiple pairs of MT_TIME and MT_VALUE. So i get a status code and a user object. the user has a array of pairs of MT_TIME and MT_VALUE. Later there maybe will be more user informations in the user object. It is just a guess but would this be the correct json? { "CODE":"012", "USER": { "MEASURE_DATA": [ { "MT_TIME":"1412882760", "MT_VALUE":"319" } ] } } with an additional SerializedName here: @SerializedName("MEASURE_DATA") private List&lt;MeasureData&gt; measureDatas = null;
has comment: http://stackoverflow.com/comment/42693160
accepted answer: http://stackoverflow.com/a/27092874
has title: Convert JSON to POJO using Gson: JsonSyntaxException
has comment: http://stackoverflow.com/comment/42693143
type: AnsweredQuestion

http://stackoverflow.com/comment/42721603
score: 0
has text: @Boann - It's not so much about me being concerned with the performance, as it is wanting to learn how to do things efficiently.
type: Comment
comment on: http://stackoverflow.com/a/27105897
type: AnswerComment

http://stackoverflow.com/comment/42744048
type: Comment
type: QuestionComment
has text: And for gods sake, please don't compile as root.
score: 1
comment on: http://stackoverflow.com/q/27121397

http://stackoverflow.com/comment/42684510
comment on: http://stackoverflow.com/q/27088398
has text: I changed the pictures. What I want is to use what I typed, and not have to type it again. I could use Ctr + X but even that's not what I want. I want Intellij to recognise that I want to keep what I selected and overwrote. @BoristheSpider thank you. The fact that the intelliJ manual doesn't cover this case seems like a good enough answer. It's a shame. I use this feature a lot in for example latex texstudio.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27107091
answers question: http://stackoverflow.com/q/27003451
has comment: http://stackoverflow.com/comment/42727169
has body: Since it's too much for a comment i'll write it up ans answer: Looking at your charts it seems to be using CPU for non-GC tasks, peak "GC activity" seems to stay within 10%. So on first impression it would seem that your task is simply CPU-bound, so if that's unexpected maybe you should do some CPU-profiling on your java application to see if something pops out. Apart from that, based on comments I suspect that physical memory filling up might evict file caches and memory-mapped things, leading to increased page faults which forces the CPU to wait for IO. Freeing up 500MB on a manual GC out of a 4GB heap does not seem all that much, most GCs try to keep pause times low as their primary goal, keep the total time spent in GC within some bound as secondary goal and only when the other goals are met they try to reduce memory footprint as tertiary goal. Before recommending further steps you should gather more statistics/provide more information since it's hard to even discern what your actual problem is from your description. monitor page faults figure out which GC algorithm is used in your setup and how they're tuned (-XX:+PrintFlagsFinal) log GC activity - I suspect it's pretty busy with minor GCs and thus eating up its pause time or CPU load goals perform allocation profiling of your application (anything creating excessive garbage?) You also have to be careful to distinguish problems caused by the java heap reaching its sizing limit vs. problems causing by the OS exhausting its physical memory. TL;DR: Unclear problem, more information required. Or if you're lazy/can afford it just plug in more RAM / remove other services from the machine and see if the problem goes away.
upvote count: 6
type: Answer
downvote count: 0
score: 6

http://stackoverflow.com/a/27130207
has comment: http://stackoverflow.com/comment/42759619
downvote count: 0
has comment: http://stackoverflow.com/comment/42759484
type: Answer
score: 2
has body: ArrayList&lt;String&gt; array = new ArrayList&lt;String&gt;(); //ArrayList of String (because you will read strings) BufferedReader reader = null; try { reader = new BufferedReader(new FileReader("numbers.txt")); //to read the file } catch (FileNotFoundException ex) { //file numbers.txt does not exists System.err.println(ex.toString()); //here you should stop your program, or find another way to open some file } String line; //to store a read line int N = 5; //max number of lines to read int counter = 0; //current number of lines already read try { //read line by line with the readLine() method while ((line = reader.readLine()) != null &amp;&amp; counter &lt; N) { //check also the counter if it is smaller then desired amount of lines to read array.add(line); //add the line to the ArrayList of strings counter++; //update the counter of the read lines (increment by one) } //the while loop will exit if: // there is no more line to read (i.e. line==null, i.e. N&gt;#lines in the file) // OR the desired amount of line was correctly read reader.close(); //close the reader and related streams } catch (IOException ex) { //if there is some input/output problem System.err.println(ex.toString()); }
upvote count: 2
has comment: http://stackoverflow.com/comment/42759685
answers question: http://stackoverflow.com/q/27130005

http://stackoverflow.com/a/27149013
has body: ^[a-z ]+$ Try this.This will validate the right ones.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27148964
downvote count: 0

http://stackoverflow.com/q/27056247
tagged with: onclick
has answer: http://stackoverflow.com/a/27056673
score: 1
tagged with: java
tagged with: webview
upvote count: 1
type: Question
tagged with: hyperlink
accepted answer: http://stackoverflow.com/a/27056673
answer count: 1
downvote count: 0
favorite count: 0
has body: I am having a webview, the webview might contain a webpage with two different types of links. What I want is that, if the user clicks on a link which contains http://webpagename.com it should open the link in the phone's browser. If the user clicks on the second type of link, which does not have http:// he should be redirected to a new activity. Right now what is happening is that, the links with http:// are opening up both in webviews and browsers. But, the links not having http:// is showing Web Page not available. The code to handle onclick link in webview: // to know which link is clicked holder.webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url){ holder.webView.setWebViewClient(new WebViewClient() { @Override public WebResourceResponse shouldInterceptRequest (final WebView view, String url) { if (url != null &amp;&amp; url.startsWith("http://")) { view.getContext().startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return null; } else { Log.e("URL: ", url); System.out.println(url.replace(url.substring(0,url.lastIndexOf("/")+1), "")); return null; } } /** * Return WebResourceResponse with CSS markup from a String. */ }); return super.shouldOverrideUrlLoading(view, url); } }); What should I do to make sure the http:// links always opens in the browser and the other links open an activity but nothing opens in the webview?
tagged with: android
has title: Webview tries to open all links, but it should be opened in a browser
type: AnsweredQuestion

http://stackoverflow.com/comment/42792601
has text: are there any general method that can be applied for all rawtype warnings including List
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27148826

http://stackoverflow.com/comment/42799118
score: 0
type: AnswerComment
type: Comment
has text: Yes I'm sure, I use it for couchDb entities where you need a type attribute to be able to select them and I just use that apporach (base class that sets `setDbType(this.getClass().getSimpleName());` in the constructor of the base class (so super constructor for all entities)) although its not abstract, but that shouldnt make a difference
comment on: http://stackoverflow.com/a/27152243

http://stackoverflow.com/q/27033524
tagged with: java
downvote count: 3
type: Question
has title: Using Scanner to import enum values
has answer: http://stackoverflow.com/a/27034265
has comment: http://stackoverflow.com/comment/42588245
has comment: http://stackoverflow.com/comment/42588234
upvote count: 0
has comment: http://stackoverflow.com/comment/42588233
answer count: 1
has body: I need to import the enum values that is ,days, which i have created in separate enum under same package. What i am asking is that how to import the enum values into main program using Scanner.. package com.huo.kop; import java.util.Scanner; public class WeekDay { public static void main(String[] args) { Scanner sc=new Scanner (System.in); System.out.println("Enter the day(only three letters with first letter being Capital : "); String dayWeek=sc.next(); if(dayWeek.equals("Sat") || dayWeek.equals("Sun")) {System.out.println("Yay, Its a Weekend!!!"); } else {System.out.println("Buah..Its still WeekDay!! Need to Work");}
favorite count: 0
linked to: http://stackoverflow.com/q/604424
type: UnansweredQuestion
score: -3
tagged with: enums

http://stackoverflow.com/a/27103669
answers question: http://stackoverflow.com/q/27103443
has body: Let me try to explain you: Object obj = new Object(); //creates a new object on the heap and links the reference obj to that object Case 1: Object obj2 = obj; //there is only one object on the heap but now two references are pointing to it. Case 2: Object obj2 = obj.clone(); //creates a new object on the heap, with same variables and values contained in obj and links the reference obj2 to it. for more info on clone method, you can refer the java api documentation
downvote count: 0
has comment: http://stackoverflow.com/comment/42714996
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/27149585
answer count: 2
tagged with: linked-list
has answer: http://stackoverflow.com/a/27150015
score: 0
tagged with: java
tagged with: hashmap
type: UnansweredQuestion
has body: I have the following hashmap, that stores string keys and linked list values public HashMap&lt;String, LinkedList&lt;String&gt;&gt; wordIndex = new HashMap&lt;&gt;(); My wordIndex contains multiple linked lists that contains the word "algorithms", so I wrote the following code to see if my hashmap is able to find the word "algorithms" String getWord(String query) { //query=user input in this case algorithms if(wordIndex.containsValue(query.toLowerCase())) { return "hello"; //should return hello if word is found } else { return "none"; } } However it is always returning none, which means it can find the word in the linked list. So what is the correct procedure to traverse through linked Lists inside Hashmaps. I searched but couldn't find any answer. Also I need to return all the KEYS, containing the query word (in this case "algorithm"). I cant seem to find a function in the hashmap class that can do that(or maybe I saw it but didn't understand it). I am new to hashmaps could you guys please help me out and point me in the right direction.
type: Question
has answer: http://stackoverflow.com/a/27149685
has comment: http://stackoverflow.com/comment/42794028
has title: How do i find a value stored in a linked list than in turn is stored in a hashmap

http://stackoverflow.com/comment/42552511
type: AnswerComment
comment on: http://stackoverflow.com/a/27011174
score: 0
type: Comment
has text: Thanks Thomas.. Can u just elaborate what i need to do step by step.

http://stackoverflow.com/comment/42609197
score: 0
type: AnswerComment
has text: @RobertVerkerk did you try changing it into a Relative Layout? It will work ;-)
type: Comment
comment on: http://stackoverflow.com/a/27043712

cross-join
type: Tag
tags question: http://stackoverflow.com/q/26996987
tag name: cross-join

http://stackoverflow.com/q/27056672
answer count: 1
has comment: http://stackoverflow.com/comment/42629848
has answer: http://stackoverflow.com/a/28472147
favorite count: 0
accepted answer: http://stackoverflow.com/a/28472147
has body: I have a Simple Web Service returning JSON data. The User Class (com.bargadss.SpringService.Domain) is The POJO class containing user_ID, firstName, lastName, eMail The UserService class (com.bargadss.SpringService.DAO) two major operation getAllUser() -> Queries the DB to Select all Users from User Table and returns List{User} getUserById(int user_ID) -> Queries the DB to Select a specific user based on ID The SpringServiceController (com.bargadss.SpringService.Controller) is as follows : package com.bargadss.SpringService.Controller; import java.util.List; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.bargadss.SpringService.DAO.UserService; import com.bargadss.SpringService.Domain.User; @RestController @RequestMapping("/service/user/") public class SpringServiceController { UserService userService=new UserService(); @RequestMapping(value = "/{id}", method = RequestMethod.GET,headers="Accept=application/json") public User getUser(@PathVariable int id) { User user=userService.getUserById(id); return user; } @RequestMapping(method = RequestMethod.GET,headers="Accept=application/json") public List<User> getAllUsers() { List<User> users=userService.getAllUsers(); return users; } } The ListUserController (com.bargadss.SpringService.Controller) is as follows : package com.bargadss.SpringService.Controller; import java.util.LinkedHashMap; import java.util.List; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.client.RestTemplate; import org.springframework.web.servlet.ModelAndView; import com.bargadss.SpringService.Domain.User; @Controller public class ListUserController { @RequestMapping("/listUsers") public…
tagged with: rest
tagged with: angularjs
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
downvote count: 0
has title: How to integrate Cross Origin Resource Sharing with Spring MVC 4.0.0 RESTful Webservice
tagged with: java
has comment: http://stackoverflow.com/comment/42629079
type: Question
has comment: http://stackoverflow.com/comment/42629609
linked to: http://stackoverflow.com/q/22546177
upvote count: 2
has comment: http://stackoverflow.com/comment/42629866
tagged with: cors

project
tags question: http://stackoverflow.com/q/27042654
type: Tag
tags question: http://stackoverflow.com/q/27133012
tags question: http://stackoverflow.com/q/27076793
tag name: project
tags question: http://stackoverflow.com/q/27139583

http://stackoverflow.com/q/27105674
downvote count: 0
has title: WebLogic Transaction Manager
score: 1
tagged with: java
type: Question
tagged with: weblogic
tagged with: xa
has answer: http://stackoverflow.com/a/27132602
accepted answer: http://stackoverflow.com/a/27132602
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has body: Anyone knows what do I have to change so that WebLogic Transaction manager works with a cluster ? I tested and I have it working by now with one server. How can I run it on a cluster ? InterposedTransactionManager itm = TxHelper.getClientInterposedTransactionManager(initialCtx, serverName); Is the second parameter I do believe needs to be changed !

http://stackoverflow.com/comment/42720813
type: QuestionComment
has text: "I'm converting some Java code to C++ and I want to keep the class structure similar." That's a bad idea to begin with.
comment on: http://stackoverflow.com/q/27108641
score: 0
type: Comment

spring-ws
tags question: http://stackoverflow.com/q/27035700
tag name: spring-ws
tags question: http://stackoverflow.com/q/27151335
tags question: http://stackoverflow.com/q/27132008
type: Tag

http://stackoverflow.com/a/27090993
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42689496
type: Answer
has comment: http://stackoverflow.com/comment/42689276
has comment: http://stackoverflow.com/comment/42776565
upvote count: 3
has body: In general you ask, how many different instances of X can exist for a single instance of a Y, and vice versa? In your example, it does not completely make sense to talk about multiplicity in a class diagram context, for two reasons: Your C does not maintain a reference to any associated A's or B's. Therefore, at best, it is a unidirectional relationship. This is OK when speaking of multiplicity, although not in your particular example (for which multiplicity does not make sense, see point 2). As far as multiplicity is concerned, ignoring point 2, A has exactly 1 C, B has exactly 1 C, and C has 0 A's and 0 B's. Your relationship is in the form of a local variable. Therefore it is not really a class-level relationship. This relationship disappears as soon as the method of A (or B) returns. So really it does not necessarily make sense to establish an association diagram for these classes. A caller/callee graph, perhaps, but a general association, no. Your example, where A uses C locally in some of its methods, is an example of a dependency, not an association. UML typically uses a dotted line for that (although some flavors may differ), and multiplicity does not come into play for this (sorry for the poor quality): There are a couple of small changes to your example that would make multiplicity relevant. For example, leaving C as it is but changing A to: class A { C&lt;Ball&gt; c = new C&lt;Ball&gt;(); ... methodA(){ c.method1(); } } In this case, an A has exactly one C, and a C has zero A's (it is unidirectional). The UML would look like (again, sorry for the quality): That is, if you make the change above, it becomes a zero-to-one relationship. It's unidirectional because the C is not aware of the A. One more thing, when is it a many-to-many relationship for both (1) &amp; (2)? It's a many-to-many relationship when A stores links to multiple C's, and C stores links to multiple A's. For example, students to courses in a university. Every course contains multiple stude…
has comment: http://stackoverflow.com/comment/42689016
accepted answer of: http://stackoverflow.com/q/27090756
has comment: http://stackoverflow.com/comment/42690209
answers question: http://stackoverflow.com/q/27090756
has comment: http://stackoverflow.com/comment/42690187

http://stackoverflow.com/comment/42673163
comment on: http://stackoverflow.com/q/27081410
score: 0
type: Comment
type: QuestionComment
has text: An author has many books, and a book has many author, so it's clearly a ManyToMany association: Book needs a collection of authors, and Author needs a collection of books. What confuses you? The JPA documentation, and the Hibernate documentation, contain plenty of examples.

multilinestring
tags question: http://stackoverflow.com/q/27055069
type: Tag
tag name: multilinestring

http://stackoverflow.com/comment/54057487
score: 1
has text: Refer here for sample code using jdk1.6.0_45 and bcprov-jdk15on-153.jar http://stackoverflow.com/questions/18065170/how-do-i-do-tls-with-bouncycastle/33122393#33122393
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/30756340

http://stackoverflow.com/comment/42656477
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27071994
has text: @rodrigoap I'm humble and not omnipotent. I asked this question incase there is a better answer ("Oh, you didn't know run mvn with the blank flag") and because I may not be able to implement either of my solutions.

junit
type: Tag
tags question: http://stackoverflow.com/q/27119049
tags question: http://stackoverflow.com/q/27078338
tags question: http://stackoverflow.com/q/27013346
tags question: http://stackoverflow.com/q/27123909
tags question: http://stackoverflow.com/q/27004853
tags question: http://stackoverflow.com/q/27133766
tags question: http://stackoverflow.com/q/27008158
tags question: http://stackoverflow.com/q/27060113
tags question: http://stackoverflow.com/q/27029264
tags question: http://stackoverflow.com/q/27133012
tags question: http://stackoverflow.com/q/27105951
tags question: http://stackoverflow.com/q/27027568
tags question: http://stackoverflow.com/q/27047314
tags question: http://stackoverflow.com/q/27063303
tags question: http://stackoverflow.com/q/27019041
tags question: http://stackoverflow.com/q/27121581
tags question: http://stackoverflow.com/q/27126510
tag name: junit
tags question: http://stackoverflow.com/q/27062159
tags question: http://stackoverflow.com/q/27003473
tags question: http://stackoverflow.com/q/27147494
tags question: http://stackoverflow.com/q/27012870
tags question: http://stackoverflow.com/q/27046642
tags question: http://stackoverflow.com/q/27038351
tags question: http://stackoverflow.com/q/27143678
tags question: http://stackoverflow.com/q/27049404
tags question: http://stackoverflow.com/q/27114503
tags question: http://stackoverflow.com/q/27091784
tags question: http://stackoverflow.com/q/27027045
tags question: http://stackoverflow.com/q/27120070
tags question: http://stackoverflow.com/q/27051992
tags question: http://stackoverflow.com/q/27148614
tags question: http://stackoverflow.com/q/27046733
tags question: http://stackoverflow.com/q/27031954
tags question: http://stackoverflow.com/q/26997861
tags question: http://stackoverflow.com/q/27081745
tags question: http://stackoverflow.com/q/27111930
tags question: http://stackoverflow.com/q/27089156
tags question: http://stackoverflow.com/q/27101973
tags question: http://stackoverflow.com/q/27135371
tags question: http://stackoverflow.com/q/27102878
tags question: http://stackoverflow.com/q/27140106
tags question: http://stackoverflow.com/q/27090685
tags question: http://stackoverflow.com/q/27099405
tags question: http://stackoverflow.com/q/27011310
tags question: http://stackoverflow.com/q/27077741
tags question: http://stackoverflow.com/q/27100440

http://stackoverflow.com/q/27085866
has title: Getting a single html list element back to my spring controller
type: AnsweredQuestion
answer count: 1
tagged with: jsp
type: Question
tagged with: spring
has answer: http://stackoverflow.com/a/27088435
score: 0
tagged with: java
has body: I have a kind of unique problem - nothing that I could find an answer or example on. I have a jsp page which shows an individual product, the user has an option to select a size and then add it to their cart, now all of my database work is already done and working - I am trying to find a way to get what size the user selected, and then forward that back to my controller which will grab the correct kind of product (in the size the user selected). Here is my code from my jsp Select a Size S M L XL and here is the submit button that would add to the cart. <form:form /> </form:form> I am thinking I should surround the ul tag in a the form tags and the surround each li in a form:input or maybe form:hidden tag, is that possible? I would like to avoid jquery/javascript and work with spring java/jsp primarily - just because I am strapped for time and the learning curve for accomplishing what I need may be too high so page refreshing isnt an issue. Thank you
accepted answer: http://stackoverflow.com/a/27088435

http://stackoverflow.com/comment/42631404
type: QuestionComment
has text: Connection Timeout is set for 5 minutes and as per logs connection is getting expired immediately.
score: 0
comment on: http://stackoverflow.com/q/27057672
type: Comment

http://stackoverflow.com/a/27125546
accepted answer of: http://stackoverflow.com/q/27124866
type: Answer
answers question: http://stackoverflow.com/q/27124866
has comment: http://stackoverflow.com/comment/42754105
has body: The following &lt;form:checkbox path="userFunctionsList[${count.index }].updatedValue" Is appended to your command object, which in your case is an Access object. That's why you're getting an error, its search the userFunctionsList against an Access bean not the Good bean To fix it, add an index to your outer loop as well, and correct your path, something like &lt;c:forEach var="userNamesListValue" items="${access.goodBeanList }" varStatus="accessCount" .... &lt;form:checkbox path="goodBeanList[${accessCount.index}].userFunctionsList[${count.index }].updatedValue"
has comment: http://stackoverflow.com/comment/42751678
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42754255
has comment: http://stackoverflow.com/comment/42753475

http://stackoverflow.com/a/27036105
upvote count: 1
has comment: http://stackoverflow.com/comment/42593240
has comment: http://stackoverflow.com/comment/42593354
downvote count: 0
answers question: http://stackoverflow.com/q/27035215
type: Answer
has body: Here's a compact one that may take advantage of any special efficiencies of String.indexof. I'd be interested in it's efficiency. public static int indexAnyOf(String of, String in) { for (int i = 0; i &lt; in.length(); i++) { if (of.indexOf(in.charAt(i)) != -1) { return i; } } return -1; } public void test() { String agent = "JamesBond007.txt"; int firstDigit = indexAnyOf("0123456789", agent); System.out.println(agent.substring(0, firstDigit) + "|" + agent.substring(firstDigit)); }
score: 1
has comment: http://stackoverflow.com/comment/42592886

http://stackoverflow.com/q/27024471
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42720018
tagged with: connection-timeout
has comment: http://stackoverflow.com/comment/42572661
has comment: http://stackoverflow.com/comment/42632555
has body: I am performing Ant build on my application and every time I am getting the java.net.ConnectException: Connection timed out: connect I tried the answers for the similar questions but no success. :( I am attaching the stack-trace of the Ant Build. [assemble-jar] java.net.ConnectException: Connection timed out: connect [assemble-jar] at java.net.PlainSocketImpl.socketConnect(Native Method) [assemble-jar] at java.net.PlainSocketImpl.doConnect(Unknown Source) [assemble-jar] at java.net.PlainSocketImpl.connectToAddress(Unknown Source) [assemble-jar] at java.net.PlainSocketImpl.connect(Unknown Source) [assemble-jar] at java.net.SocksSocketImpl.connect(Unknown Source) [assemble-jar] at java.net.Socket.connect(Unknown Source) [assemble-jar] at java.net.Socket.connect(Unknown Source) [assemble-jar] at sun.net.NetworkClient.doConnect(Unknown Source) [assemble-jar] at sun.net.www.http.HttpClient.openServer(Unknown Source) [assemble-jar] at sun.net.www.http.HttpClient.openServer(Unknown Source) [assemble-jar] at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source) [assemble-jar] at sun.net.www.http.HttpClient.New(Unknown Source) [assemble-jar] at sun.net.www.http.HttpClient.New(Unknown Source) [assemble-jar] at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) [assemble-jar] at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) [assemble-jar] at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) [assemble-jar] at atg.xml.XMLFileEntityResolver.resolveLocalEntity(XMLFileEntityResolver.java:372) [assemble-jar] at atg.xml.XMLFileEntityResolver.resolveEntity(XMLFileEntityResolver.java:286) [assemble-jar] at atg.dtds.j2ee.J2EEEntityResolver.resolveEntity(J2EEEntityResolver.java:470) [assemble-jar] at atg.dtds.j2ee.J2EEEntityResolver.resolveEntity(J2EEEntityResolver.java:465) [assemble-jar] at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(Unknown Source) [assemble-jar] at com.sun.org.ap…
score: 0
has comment: http://stackoverflow.com/comment/42632137
has comment: http://stackoverflow.com/comment/42572841
has comment: http://stackoverflow.com/comment/42632461
has comment: http://stackoverflow.com/comment/42646350
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36831499
has comment: http://stackoverflow.com/comment/42573225
has title: Getting java.net.ConnectException while performing Ant build on my application

http://stackoverflow.com/comment/42647626
score: 0
type: Comment
type: QuestionComment
has text: funny that you would use `fill.equals("1")` but `rank == "Rookie"`
comment on: http://stackoverflow.com/q/27067089

http://stackoverflow.com/a/27097946
accepted answer of: http://stackoverflow.com/q/27097862
answers question: http://stackoverflow.com/q/27097862
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Well following concept that need to be clear Fact about final variable final variable SHOULD be initialize on the time of deceleration like private final romanNum = "SomeRomanNumber"; OR private final ronamNum = ""; So you solution is import java.util.Scanner; public class RomantoInteger { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter an Roman numeral with an equivalent between 0 and 3999:"); int value = input.nextInt(); RomantoInteger rn = new RomantoInteger(); Roman roman = rn.new Roman(""+value); //Roman is subclass of RomantoInteger and it is been called from static method so it should be call like this rn.new Roman(""+value); // Here you can call any function of Roman class } public class Roman { private final char[] romanNumerals = { 'M', 'D', 'C', 'L', 'X', 'V', 'I' }; private final int[] romanEquivalent = { 1000, 500, 100, 50, 10, 5, 1 }; private final String romanNum = ""; private int decimalNum; public Roman(String input) { romanNum = input.toUpperCase(); } //public void checkRoman(){ // for(int x=romanNum.length()-1;x&lt;romanNum.length(); x++){ // if(romanNum.charAt(x)=='M') // } //} /* * Method to convert roman number to decimal */ public int convertToDecimal() { int sum[]; //Create a integer array sum = new int[romanNum.length()]; //set the size of sum array to the length of romanNum for (int y = 0; y &lt; romanNum.length(); y++) { for (int i = 0; i &lt; romanNumerals.length; i++) { if ((romanNum.charAt(y) == romanNumerals[i]) &amp;&amp; (romanNum.length() &gt; 1)) { //and if length of romanNum is greater than 1 sum[y] = romanEquivalent[i]; //store the value of the matching romanNumeral to an indexed variable of array sum } if ((romanNum.charAt(y) == romanNumerals[i]) //if &amp;&amp; (romanNum.length() == 1)) { //and if length of romanNum is just 1 System.out.println(romanEquivalent[i]); //print out the value of the matching romanNumeral break; //terminate looping (for loop) } } } return add(…
has comment: http://stackoverflow.com/comment/42701379
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42701032

http://stackoverflow.com/comment/42626604
has text: actualy my purpose is to sorting with date so i am using date.getTime()
score: 0
comment on: http://stackoverflow.com/q/27054931
type: Comment
type: QuestionComment

http://stackoverflow.com/a/40424360
answers question: http://stackoverflow.com/q/27145847
has comment: http://stackoverflow.com/comment/68098166
has body: If the profiler uses BCI/instrumentation, then this problem might be relevant: Transforming lambdas in Java 8 Should the profiler have any option(s) to stop tracing performance of lambdas, try using it. It would be interesting to know whether your problem still persists with newer versions of Java.
score: 0
type: Answer

http://stackoverflow.com/a/39138290
answers question: http://stackoverflow.com/q/27045821
type: Answer
score: 5
upvote count: 5
has body: Open the .ucls file that you have created. Right Click on an empty space and select the option "Save as image". Then you can save it in any of the image formats - GIF / JPEG / PNG.
downvote count: 0

http://stackoverflow.com/a/27091151
has comment: http://stackoverflow.com/comment/42905806
has comment: http://stackoverflow.com/comment/42889396
has comment: http://stackoverflow.com/comment/42905700
has comment: http://stackoverflow.com/comment/42949903
has comment: http://stackoverflow.com/comment/42954931
has comment: http://stackoverflow.com/comment/42890748
has comment: http://stackoverflow.com/comment/42690429
has comment: http://stackoverflow.com/comment/42885176
has comment: http://stackoverflow.com/comment/42951754
score: 0
has comment: http://stackoverflow.com/comment/42953844
has comment: http://stackoverflow.com/comment/43103168
has comment: http://stackoverflow.com/comment/42953965
has comment: http://stackoverflow.com/comment/42889512
has comment: http://stackoverflow.com/comment/43100761
has body: You can only use openFileOutput() for relative paths in intern memory. For external memory use new FileOutputStream(..absolute..path..).
type: Answer
has comment: http://stackoverflow.com/comment/42953250
has comment: http://stackoverflow.com/comment/42953934
has comment: http://stackoverflow.com/comment/42947642
has comment: http://stackoverflow.com/comment/42909507
has comment: http://stackoverflow.com/comment/42885354
has comment: http://stackoverflow.com/comment/42888760
has comment: http://stackoverflow.com/comment/43025510
has comment: http://stackoverflow.com/comment/43034985
has comment: http://stackoverflow.com/comment/42888627
has comment: http://stackoverflow.com/comment/42905838
has comment: http://stackoverflow.com/comment/42905437
has comment: http://stackoverflow.com/comment/42892163
has comment: http://stackoverflow.com/comment/42890687
has comment: http://stackoverflow.com/comment/42951986
answers question: http://stackoverflow.com/q/27090481
has comment: http://stackoverflow.com/comment/42690319
has comment: http://stackoverflow.com/comment/42889763
has comment: http://stackoverflow.com/comment/42906034
has comment: http://stackoverflow.com/comment/42885308
has comment: http://stackoverflow.com/comment/42910074

http://stackoverflow.com/comment/42543551
comment on: http://stackoverflow.com/a/27001818
has text: If it's not public, it's often possible to use OpenSSL internally: `openssl s_client -servername the.host.name -connect the.host.name:443` (that's with SNI) and without `-servername the.host.name` not to use SNI. You can also use `-ssl3`, `-tls1`, `-tls1_1`, `-tls1_2` to try different SSL/TLS versions. There are options for cipher suites too.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/q/27056292
has title: removeAll operation in ArrayList<Integer> not working as expected
tagged with: arraylist
score: 0
linked to: http://stackoverflow.com/q/2770321
has comment: http://stackoverflow.com/comment/42642381
has comment: http://stackoverflow.com/comment/42631201
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42636033
has comment: http://stackoverflow.com/comment/42628580
has comment: http://stackoverflow.com/comment/42636834
has comment: http://stackoverflow.com/comment/42635693
has answer: http://stackoverflow.com/a/27056376
has comment: http://stackoverflow.com/comment/42637960
has comment: http://stackoverflow.com/comment/42636377
tagged with: java
has comment: http://stackoverflow.com/comment/42632071
type: Question
has comment: http://stackoverflow.com/comment/42635883
has comment: http://stackoverflow.com/comment/42634151
has body: I am trying to do subtract operation on ArrayList using removeAll. But the outcome is not as expected. Actually its not removing anything. ArrayList&lt;Integer&gt; tempSelectedPrivilges = new ArrayList&lt;Integer&gt;(privPickList.getTarget()); log.debug("Original selected : " + selectedPrivilges); log.debug("temp selected : " + tempSelectedPrivilges); ArrayList&lt;Integer&gt; addedPrivileges = new ArrayList&lt;&gt;(tempSelectedPrivilges); ArrayList&lt;Integer&gt; deletedPrivileges = new ArrayList&lt;&gt;(selectedPrivilges); log.debug("Add : " + addedPrivileges); log.debug("Delete : " + deletedPrivileges); addedPrivileges.removeAll(selectedPrivilges); deletedPrivileges.removeAll(tempSelectedPrivilges); log.debug("Add : " + addedPrivileges); log.debug("Delete : " + deletedPrivileges); Output is something like this : Original selected : [2, 3] temp selected : [2, 1, 4, 5, 6] Add : [2, 1, 4, 5, 6] Delete : [2, 3] Add : [2, 1, 4, 5, 6] Delete : [2, 3] Only problem I see is : privPickList.getTarget() returns a List&lt;Integer&gt; rather than ArrayList&lt;Integer&gt;. Because when I create tempSelectedPrivileges like this, it works prefectly fine : ArrayList&lt;Integer&gt; tempSelectedPrivilges = new ArrayList&lt;&gt;(); tempSelectedPrivilges.add(3); tempSelectedPrivilges.add(5); tempSelectedPrivilges.add(6); Why creating ArayList of Integer from List of integer is creating problems? And when I am trying to do : for(Integer i : privPickList.getTarget()) { tempSelectedPrivilges.add(i); } there is no compile time error. But runtime error java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer on line tempSelectedPrivilges.add(i);
has comment: http://stackoverflow.com/comment/42637041

http://stackoverflow.com/a/27148604
answers question: http://stackoverflow.com/q/27147520
score: 0
type: Answer
has body: The server side GET or POST is used to specify what the server expects to receive in order to accept the request. The client side GET or POST is used to specify what will be sent to the server. These two must match. You cannot send a GET request when server expects a POST and vice-versa. When you are building a server application, it is important to know the appropriate request type to use, which by itself is a whole big different topic which you should research if it is you the one that builds the server side part.

http://stackoverflow.com/comment/42787614
has text: Separate the UI menu from the model, have the menuBar static on the UI, allowing each view to add/remove content from it. Personally, I'd make a menu manger of some kind that facilitates the process, decoupling the elements from each other, but that's just me
score: 0
comment on: http://stackoverflow.com/q/27145044
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42529364
comment on: http://stackoverflow.com/a/26999025
type: Comment
has text: right, square root is a stronger condition. should thought about it!
type: AnswerComment
score: 0

http://stackoverflow.com/q/27000832
tagged with: classification
tagged with: java
has body: I have a pom.xml file with two classifiers. Maven generates a "WAR" with all the files in the project and a "JAR" only with the folders I selected. However, I don't know how to indicate that the dependencies contained in the POM only correspond to the case of the "WAR" file. The classes in the "JAR" doesn't have dependencies. This is a problem for me because if I add the "JAR" as dependency of other project, Maven will look for all the dependencies, creating sometimes cycle dependencies. This is my pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 my.group.id myartifactid 0.0.1-SNAPSHOT war name description a.dependency.groupid articfact1 0.0.1-SNAPSHOT all log4j log4j 1.2.17 javax.inject javax.inject 1.redhat-4 javax.enterprise cdi-api 1.2 commons-beanutils commons-beanutils 1.9.2 maven-jar-plugin pojos jar package pojos my/project/pojos/* And this is how I add the dependency in other projects to include just the pojos JAR: my.group.id myartifactid 0.0.1-SNAPSHOT pojos Thank you!
type: Question
accepted answer: http://stackoverflow.com/a/27001118
has title: Specify dependencies for Maven classifiers
has answer: http://stackoverflow.com/a/27001118
score: 0
answer count: 1
tagged with: maven
tagged with: dependencies
type: AnsweredQuestion

http://stackoverflow.com/comment/42653943
comment on: http://stackoverflow.com/a/27022940
score: 1
type: AnswerComment
type: Comment
has text: @3429477 I think I will try rebuilding the app in the same way I did originally, if I can. Maybe I will gain some insight that way.

http://stackoverflow.com/comment/42649019
has text: What exactly is the problem? It looks like 6,1,2,3,4,5,6 should output 6, which sound like it is what you want.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27067650

http://stackoverflow.com/comment/42719918
type: QuestionComment
has text: Yes that would be fine. Still, I can't reproduce your problem with the part of the code you've shown.
comment on: http://stackoverflow.com/q/27107595
score: 0
type: Comment

http://stackoverflow.com/comment/42683049
type: Comment
comment on: http://stackoverflow.com/q/27087494
has text: And it's still extremely unclear. If you know how to deal with 1 progress bar, then do the same thing 3 times, and you'll know how to deal with 3 progress bars. I don't see any swing code in your question.
score: 1
type: QuestionComment

http://stackoverflow.com/q/27129630
tagged with: android
tagged with: android-debug
has answer: http://stackoverflow.com/a/27129678
has title: Title: How to differentiate sub package and main package name in android?
tagged with: java
has comment: http://stackoverflow.com/comment/42758331
downvote count: 1
tagged with: import
type: Question
has body: Problem: I'm developing content display app. Now I want to enable GCM push notification app, for that I downloaded a sample project from http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/ The sample project is working fine and notification are coming as expected. Now I copy pasted the following files to my project 1. manifest file 2. xml file 3. values file 4. MainActivity file I changed the Packagename that I need from the pervious code that I copied but still it is not working. Please guide me which line i should change the packagename of project , where I should use class packagename and in where i should use the project packagename. It is giving me error because the package name and sub package name are same. Code: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="com.androidhive.pushnotifications" /> <service android:name="com.androidhive.pushnotifications.GCMIntentService" /> being a newbie in android development, I'm not able to figure out which is the main package name in this code. Any suggestion would be great!. thanks in advance
has answer: http://stackoverflow.com/a/27129749
score: -1
answer count: 2
upvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: package

http://stackoverflow.com/comment/42737931
type: Comment
comment on: http://stackoverflow.com/a/27117862
score: 0
type: AnswerComment
has text: How do i execute the above stuff using process builder

http://stackoverflow.com/q/27146168
has answer: http://stackoverflow.com/a/27146286
accepted answer: http://stackoverflow.com/a/27146286
score: 0
possible better answer: http://stackoverflow.com/a/27146239
has title: Java - JRadioButton isSelected
has answer: http://stackoverflow.com/a/27146239
has body: I have simple check like this: boolean isPressed; if ((jRadioButton1.isSelected() == false) || (jRadioButton2.isSelected() == false) || (jRadioButton3.isSelected() == false)) { isPressed = false; } else { isPressed = true; } System.out.println(isPressed); Why I always get false, even if I mark RadioButton in panel ?
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/27075601
answers question: http://stackoverflow.com/q/27073423
has comment: http://stackoverflow.com/comment/42667871
score: 3
has comment: http://stackoverflow.com/comment/42667851
has comment: http://stackoverflow.com/comment/42665987
downvote count: 0
type: Answer
has body: OSGi would be the first choice. JBoss Modules is still much more an internal JBoss thing than a general purpose modularity solution. To start with an OSGi application, take a look at Bndtools. This is an Eclipse plugin to make OSGi development easy. From there you can create a "run configuration" which is the definition of your application. From there you can also export the application to a single executable JAR to distribute your app. This is a nice video to get you started. Also, for more high level components (REST, databases, scheduling etc.) take a look at Amdatu.
upvote count: 3

http://stackoverflow.com/q/27148461
has comment: http://stackoverflow.com/comment/42792248
has answer: http://stackoverflow.com/a/27149216
favorite count: 0
has comment: http://stackoverflow.com/comment/42791963
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/42791988
tagged with: nullpointerexception
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/27149224
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42792869
has comment: http://stackoverflow.com/comment/42793229
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42792013
has comment: http://stackoverflow.com/comment/42792627
type: Question
has comment: http://stackoverflow.com/comment/42792720
has body: From the Logcat: 11-26 06:43:40.643: E/AndroidRuntime(1163): FATAL EXCEPTION: AsyncTask #1 ... 11-26 06:43:40.643: E/AndroidRuntime(1163): java.lang.RuntimeException: An error occured while executing doInBackground() ... 11-26 06:43:40.643: E/AndroidRuntime(1163): Caused by: java.lang.NullPointerException ... 11-26 06:43:40.643: E/AndroidRuntime(1163): at com.example.mymobiletest.SearchTask.doInBackground(SearchTask.java:134) Line number 134 is ed = (EditText) mainActivity.findViewById(R.id.mainSearchActivity_editTextSearch);. Now the execution of this line indicates that mainActivity (it is an instance of the main activity passed to the constructor of this AsyncTask) is not null. So what else could be null at this line, which is causing the NullPointerException? @Override protected String doInBackground(Void... voidParameters) { EditText ed=null; if (mainActivity!=null) { ed = (EditText) mainActivity.findViewById(R.id.mainSearchActivity_editTextSearch); } else { return "mainActivity is the Null culprit."; } EDIT:- I do think that since I am not changing the UI in doInBackground() (but only reading from the UI), so this should not be a problem. But still I tried this in onPreExecute() since onPreExecute is executed in the UI thread, but I still get the NPE on the same statement. @Override protected void onPreExecute() { EditText ed=null; if (mainActivity!=null) { ed = (EditText) mainActivity.findViewById(R.id.mainSearchActivity_editTextSearch);//******NPE } else { Log.i(TAG, "mainActivity is the Null culprit."); } searchQuery = ed.getText().toString(); }
has answer: http://stackoverflow.com/a/27149279
has title: Android: NullPointerException, what could be null here?
has comment: http://stackoverflow.com/comment/42793752
upvote count: 2
has comment: http://stackoverflow.com/comment/42793386
has answer: http://stackoverflow.com/a/27150719

http://stackoverflow.com/comment/42644064
type: AnswerComment
has text: Use could try casting to java.lang.Number and then use intValue or longValue method.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27063544

http://stackoverflow.com/comment/42699318
comment on: http://stackoverflow.com/q/27096938
type: Comment
score: 0
type: QuestionComment
has text: @duffymo: The loops `bound` (O[log n]), `i` (O[bound]), and `j` (O[n]) are nested three levels deep, though, no?

http://stackoverflow.com/comment/42600141
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27039514
type: QuestionComment
has text: Could you please also post the complex type which contains your element?

http://stackoverflow.com/comment/42902861
has text: Your edit is no improvement. `isClosed()` doesn't tell you whether the peer closed the connection. It tells you whether you have closed this socket yourself. And now you're trying to layer another level of connection pooling on top of what RMI is already doing. And the fundamental flaw remains that it cannot possibly address existing connections being reused by the client. You have paid zero attention to this point despit it being raised three times, now four.
comment on: http://stackoverflow.com/a/27164221
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42584696
has text: in the above file name 2014-09-15{yyyy-mm-dd) is date and 17-08-05(hh-mm-ss) is time
score: 0
comment on: http://stackoverflow.com/q/27009350
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27099726
type: UnansweredQuestion
tagged with: android
tagged with: gallery
tagged with: audio
type: Question
tagged with: swipe
tagged with: java
has title: Gallery Swipe with Sounds
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27102951
has body: I've been searching for code for gallery with sounds (Swipe) then this is the last I did. When I open the activity the first photo played it sounds but when I swipe it for the next picture, it won't. public class alphagal extends Activity { MediaPlayer mp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.numgal); ViewPager viewPager = (ViewPager) findViewById(R.id.pager); ImagePagerAdapter adapter = new ImagePagerAdapter(); viewPager.setAdapter(adapter); } private class ImagePagerAdapter extends PagerAdapter { private int[] mImages = new int[] {R.drawable.a,R.drawable.bb}; private int[] mAudio = new int[]{R.raw.capture,R.raw.capture2}; @Override public int getCount() { return mImages.length; } @Override public boolean isViewFromObject(View view, Object object) { return view == ((ImageView) object); } @Override public Object instantiateItem(ViewGroup container, int position) { Context context = alphagal.this; ImageView imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER); imageView.setImageResource(mImages[position]); ((ViewPager) container).addView(imageView, 0); if(position&gt;=1){ mp = MediaPlayer.create(alphagal.this, mAudio[position-1]); mp.start(); } return imageView; } OnPageChangeListener player = new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { mp = MediaPlayer.create(alphagal.this, mAudio[arg0]); mp.start(); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }; @Override public void destroyItem(ViewGroup container, int position, Object object) { ((ViewPager) container).removeView((ImageView) object); } } }

http://stackoverflow.com/q/27018186
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42561861
tagged with: java
has comment: http://stackoverflow.com/comment/42565098
type: Question
has comment: http://stackoverflow.com/comment/42562061
has title: ResultSet.next() is too slow for an oracle ref cursor
answer count: 1
tagged with: slowdown
score: 4
has comment: http://stackoverflow.com/comment/42563722
tagged with: resultset
has body: I call an oracle procedure from java and it returns a ref cursor as result. I cast the ref cursor to a ResultSet and the iteration starts over it. String query = "{call ...(...)}"; CallableStatement stmt = conn.prepareCall(query,ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); stmt.setFetchSize(10000); . . . stmt.registerOutParameter(x, OracleTypes.CURSOR); stmt.execute(); Resultset rs = (ResultSet) stmt.getObject(x); while (rs.next()) { /** Problem occurs here **/ ... } The problem is that SOMETIMES (not always) for some specific records the ResultSet.next() method takes too long (like 100 secs). Necessary to mention that the number of returned records is at most 25 and the same query in the database behaves executed normally (executes in about 6 seconds). As I investigated more, I found out that there is a column in my returned cursor which if removed this problem doesn't occur. That column is actually the ROWNUM() which is included in the result cursor. --ORACLE Query snippet: OPEN result_cursor FOR SELECT "FirstName","LastName", r FROM (SELECT ROWNUM r, * ... -- query details WHERE ROWNUM &lt;= 25) I don't even touch that field in the ResultSet but it still causes this problem (which seems unfair :( ). I tried to convert it to string in the Oracle procedure (by concatenating it with a ' '), assuming that a type conversion might cause this issue, but it made no difference in the situation. why is this happening?
has comment: http://stackoverflow.com/comment/42569198
tagged with: oracle-database
tagged with: jdbc
has comment: http://stackoverflow.com/comment/42566031
upvote count: 4
has answer: http://stackoverflow.com/a/27055013
favorite count: 0

http://stackoverflow.com/comment/42618173
has text: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> it should be placed where? @MohammadRahchamani
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27049885

http://stackoverflow.com/comment/42803348
comment on: http://stackoverflow.com/a/27154455
score: 0
has text: Thank you so much :) I have already changed the title of the question and NOW I'm going to explore Guava's Table!
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27084960
score: 0
tagged with: nullpointerexception
has body: Inside of this class I have public DisplayMode resolutions[] = { new DisplayMode(1920, 1080, 32, 0), new DisplayMode(1680, 1050, 32, 0), }; public ArrayList&lt;DisplayMode&gt; list; and the constructor 14 - public myClass(){ 15 - list.add(resolutions[0]); 16 - } I'm getting a null pointer exception on line 15. What's wrong?
accepted answer: http://stackoverflow.com/a/27084973
favorite count: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
has title: ArrayList<DisplayMode> null pointer exception in Java
has answer: http://stackoverflow.com/a/27084973
answer count: 1
tagged with: arraylist

http://stackoverflow.com/q/27098574
answer count: 1
tagged with: awstats
has body: I use the command perl awstats_configure.pl to install awstats for my local glassfish. But I've got the following question to answer: Please, enter full directory path of your Apache web server or 'none' to skip this step if you don't have local web server or don't have permission to change its setup. Example: c:\Program files\apache group\apache Apache Web server path ('none' to skip): If I type the root directory of glassfish then I will need to answer the following question. Really confused here as there is no "httpd.conf" in glassfish. Any idea on how install and config awstats in glassfish server will be much appreciated. Now, enter full config file path of your Web server. Example: /etc/httpd/httpd.conf Example: /usr/local/apache2/conf/httpd.conf Example: c:\Program files\apache group\apache\conf\httpd.conf Config file path ('none' to skip web server setup):
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: glassfish
has title: Install awstats in glassfish
score: 0
has answer: http://stackoverflow.com/a/27124619
accepted answer: http://stackoverflow.com/a/27124619

http://stackoverflow.com/comment/42782575
score: 1
comment on: http://stackoverflow.com/q/27142910
type: Comment
type: QuestionComment
has text: Why, necessarily, is this a bad thing?

http://stackoverflow.com/comment/42754063
score: 0
type: Comment
type: QuestionComment
has text: @CommonsWare is that possible to enable GPS specific for an application only once for first time by asking user with alert and then automatically getting location updates
comment on: http://stackoverflow.com/q/27127236

http://stackoverflow.com/comment/42739075
type: Comment
has text: When I do that my program doesn't go back to the top of the while loop
type: AnswerComment
comment on: http://stackoverflow.com/a/27118613
score: 0

http://stackoverflow.com/q/27025958
favorite count: 0
tagged with: buffer
type: UnansweredQuestion
has title: In-memory batch buffer for writing objects to a database
tagged with: java-8
has comment: http://stackoverflow.com/comment/42638766
answer count: 0
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42576057
type: Question
score: 3
tagged with: database
linked to: http://stackoverflow.com/q/9466595
tagged with: concurrency
has body: I want to collect some user actions from a web site, which will send an AJAX request to a tracking server on most of the page visits, which then in turn extracts the relevant data structure and writes it to some database tables. As the website is running under heavy load (esprecially before christmas), there are many views of the relavant pages, which results in many requests to the tracking server. If a request comes in and I write the data to the database instantly, I will certainly run into trouble, e.g. Even if using a connection pool, I will run out of unsed connections quite quickly and waiting times in the pool's queue will start to increase more and more Concurrent access to the database might cause problems with table locking, as all data are written to the same table and query times will start to increase However the advantage is that I don't need to care about synchronization. Thus I want to collect a batch of data (e.g. 100 objects) and send them to the database to take off some load. This solves the above problem because there is only one connection there is no concurrency at database table level The problem is that I now would need to properly synchronize the underlying buffer mechanism. As the tracking server and the database are running on the same server, this should greatly improve overall performance. I am looking for some class or library for Java 8 which can buffer the objects in a FIFO manner and automatically writes them to the database if a certain minimum size is reached. The library should be able to handle concurrency as good and fast as possible, as it might occur that two items are stored into the cache at the same time. Do you know such a library where I can hook up my persistence layer myself or just use JDBC? My best guess is that I could use a flavour of java.util.concurrent.BlockingQueue, e.g. LinkedBlockingQueue.drainTo(Collection, maxElements) in combination with a timer which periodically polls the length of the queue. Does anyon…
downvote count: 0

http://stackoverflow.com/q/27147869
has comment: http://stackoverflow.com/comment/42792156
has body: How I get swagger api-docs to generate data for both SpringMVC and Apache CXF in one project? Now swagger displays only endpoints for SpringMVC. I used pom.xml com.mangofactory swagger-springmvc 0.9.1 applicationContext.xml <mvc:annotation-driven/> <mvc:default-servlet-handler/> <beans:bean class="com.mangofactory.swagger.configuration.SpringSwaggerConfig" /> I see REST endpoints for all classes with @RequestMethod annotations. How I achieve resources list to also display CXF endpoints? I was trying with following code in my cxf-servlet.xml <context:component-scan base-package="com.mydlarz.myapp.services" /> <cxf:bus> <cxf:features> <cxf:logging /> </cxf:features> </cxf:bus>
score: 0
has comment: http://stackoverflow.com/comment/42791695
has comment: http://stackoverflow.com/comment/42792407
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42792020
has comment: http://stackoverflow.com/comment/42791796
tagged with: cxf
has comment: http://stackoverflow.com/comment/42791336
tagged with: java
tagged with: swagger
has title: Swagger with SpringMVC and CXF both at one time configuration
has comment: http://stackoverflow.com/comment/42791909
type: Question

c#
tags question: http://stackoverflow.com/q/27003081
tags question: http://stackoverflow.com/q/27003374
tags question: http://stackoverflow.com/q/27011899
tag name: c#
tags question: http://stackoverflow.com/q/27121406
tags question: http://stackoverflow.com/q/27071419
tags question: http://stackoverflow.com/q/27073562
tags question: http://stackoverflow.com/q/27061782
tags question: http://stackoverflow.com/q/27094046
tags question: http://stackoverflow.com/q/27079644
tags question: http://stackoverflow.com/q/27103432
tags question: http://stackoverflow.com/q/27080663
tags question: http://stackoverflow.com/q/27112820
tags question: http://stackoverflow.com/q/27016004
tags question: http://stackoverflow.com/q/27099552
type: Tag
tags question: http://stackoverflow.com/q/27142596
tags question: http://stackoverflow.com/q/27141108
tags question: http://stackoverflow.com/q/27049353

matlab
tags question: http://stackoverflow.com/q/27001296
tags question: http://stackoverflow.com/q/27081163
type: Tag
tags question: http://stackoverflow.com/q/27096599
tag name: matlab
tags question: http://stackoverflow.com/q/27040689
tags question: http://stackoverflow.com/q/27034648

email
tags question: http://stackoverflow.com/q/27036995
tags question: http://stackoverflow.com/q/27128478
tags question: http://stackoverflow.com/q/27010964
tags question: http://stackoverflow.com/q/27119770
tags question: http://stackoverflow.com/q/27032746
type: Tag
tag name: email

getmethod
tag name: getmethod
type: Tag
tags question: http://stackoverflow.com/q/27148248

http://stackoverflow.com/q/27052106
downvote count: 1
tagged with: shell
tagged with: exe
favorite count: 0
answer count: 0
has body: I exported my Java-Application to a self-running jar-file, then compiled it to an .exe-file using Launch4j. I figured, that Runtime.getRuntime().exec('shutdown -s -f -t &lt;time in seconds&gt;'); works only if I open the .jar-file from command-line. Running the compiled .exe from command-line doesn't work. Why is that and is there any way to execute that command by simply opening the .exe-file?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42621401
score: 1
tagged with: runtime.exec
tagged with: java
has comment: http://stackoverflow.com/comment/42621404
has title: Execute Shell Command from self-running .exe-file
has comment: http://stackoverflow.com/comment/42639611
type: Question
upvote count: 2

http://stackoverflow.com/comment/42746340
comment on: http://stackoverflow.com/a/27121996
has text: yes, we mean the same, it is that Kiritimati timezone
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27544488
answers question: http://stackoverflow.com/q/27096245
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43719564
type: Answer
has body: First, I see your URL is wrong, it should be: %{ url='/'+lang+'/artists/'+item?.name?.asString()+'-'+item?.id?.asString(); }% Anyway, I think you can fix it. Second, I think you want your artistId is the number from 1 character to 32 characters, not exactly 32 characters. So, route.conf should be: GET /{&lt;(fr)|(en)|(ar)&gt;lang}/artists/{artistName}-{&lt;[0-9]{,32}&gt;artistId} MyControllerName.artistView(mode:'overview') Please read more about Regular Expression if you want to know why? Note: (mode:'overview') will be no effect. If you want to set default, please do it in your controller like: if (mode == null) mode = "overview"; Hope that help.
accepted answer of: http://stackoverflow.com/q/27096245

http://stackoverflow.com/a/27136257
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: You are creating a shallow copy of your objects. Array.clone() will only work on primitive types. You should create a method in the Class of the objects you are trying to copy that creates and returns a new instance of the class with the same attribute values. Then you can loop through your array getting a copy of each object and add them to a new array then store the new array to your hashmap. Example: public class MyClass() { private String temp; public MyClass(String temp) { this.temp = temp; } public MyClass copy() { MyClass copy = new MyClass(this.temp); //set attributes in constructor or using setters so they are the same as this object return copy; } }
type: Answer
accepted answer of: http://stackoverflow.com/q/27136139
answers question: http://stackoverflow.com/q/27136139
score: 2

http://stackoverflow.com/q/27072843
answer count: 2
has title: java error - how to solve the \n in the buffer (if that is the cause of the error)
has comment: http://stackoverflow.com/comment/42658021
score: 0
has comment: http://stackoverflow.com/comment/42658127
accepted answer: http://stackoverflow.com/a/27073018
possible better answer: http://stackoverflow.com/a/27073016
has answer: http://stackoverflow.com/a/27073016
has comment: http://stackoverflow.com/comment/42657915
has comment: http://stackoverflow.com/comment/42657884
has answer: http://stackoverflow.com/a/27073018
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42657872
has comment: http://stackoverflow.com/comment/42658229
tagged with: java
has body: The following is my code. The code works fine with the 'save' and 'search' menus. However, after I 'delete' a person and select the next menu as 'search', the program skips the part where the user enters a name, thus showing "no results found" as the result. I thought that the \n may be the problem and tried parseInt(), System.out.flush(), and using nextLine() as written in the comments in the code but they all seemed not to work. Also, I am confused why in some cases, even though there is a \n left in the buffer, I can enter the 'name' without the program skipping. Please let me know if the \n is not the cause of the problem. Thank you for your time. import java.util.Scanner; class PhoneInfo { String name; private String phoneNumber; private String birthDay; private String birthYear; private int choice; public PhoneInfo(String name, String phoneNumber, String birthDay) { this.name = name; this.phoneNumber = phoneNumber; this.birthDay = birthDay; } public PhoneInfo(String name, String phoneNumber, String birthDay, String birthYear) { this(name, phoneNumber, birthDay); this.birthYear = birthYear; } public void showPhoneInfo() { System.out.println("name: " + name); System.out.println("phone no.: " + phoneNumber); System.out.println("birthday: " + birthDay); if(birthYear == null) System.out.println("birth year: no record"); else System.out.println("birth year: " + birthYear); System.out.println("-----------------------------"); } } class Manager //save, search, delete data { PhoneInfo[] pBook = new PhoneInfo[100]; Scanner input = new Scanner(System.in); public PhoneInfo inputData() { System.out.print("name: "); String name = input.nextLine(); System.out.print("phone no.: "); String phoneNumber = input.nextLine(); System.out.print("birthday: "); String birthDay = input.nextLine(); System.out.print("birth year: "); String birthYear = input.nextLine(); PhoneInfo pData = new PhoneInfo(name, phoneNumber, birthDay, birthYear); System.out.println("----------------------------…
type: Question
linked to: http://stackoverflow.com/q/13102045

http://stackoverflow.com/comment/42642758
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27061036
has text: "exclude" is not an option? http://stackoverflow.com/questions/27057481/exclude-a-maven-dependecie-from-a-derived-pom?rq=1 ...
score: 0

http://stackoverflow.com/q/27099700
has body: How to clear history which gets populated in application progress,Here m creating a simple login application,where i have two activites LoginActivity and MainActivity, I am using shared preferences to check whether user is logged in or not,I have made application class which will be called every time when application is started, i have added these lines of code in manifest android:name=".FrontScreenApplication" FrontScreenApplication.class is as follows public class FrontScreenApplication extends Application { public static final String PREFS_NAME = "ApplicationFirstTime"; int PRIVATE_MODE = 0; private static final String PREF_NAME2 = "LoginPref"; private static final String IS_LOGIN = "IsLoggedIn"; @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); SharedPreferences pref = getSharedPreferences(PREFS_NAME, 0); if (!pref.getBoolean("isFirstTime", false)) { SharedPreferences.Editor editor = pref.edit(); editor.putBoolean("isFirstTime", true); editor.commit(); Intent intent = new Intent(this, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { SharedPreferences prefs = getSharedPreferences(PREF_NAME2,MODE_PRIVATE); boolean result = prefs.getBoolean(IS_LOGIN, false); if (result) { Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { Intent intent = new Intent(this, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } } Main class in manifest is MainActivity so it is called first,when we go back, each activity is shown in backstack LoginAcivity and MainActivity.
has title: How to clear history populated in application progress
has answer: http://stackoverflow.com/a/27103878
tagged with: android
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27101629
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/42590475
type: QuestionComment
has text: Please add the code YOU use to the question.
comment on: http://stackoverflow.com/q/27034648
score: 0
type: Comment

http://stackoverflow.com/q/27137479
accepted answer: http://stackoverflow.com/a/27137529
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/33728116
tagged with: android-studio
has answer: http://stackoverflow.com/a/35064481
has comment: http://stackoverflow.com/comment/42773003
has answer: http://stackoverflow.com/a/57460204
has answer: http://stackoverflow.com/a/70330637
type: AnsweredQuestion
tagged with: java
type: Question
score: 20
has body: To start with - Yes, I know that this is crazy/strange. But I need it :). I want to find simpliest way to run single java file (and prefer non-terminal answers :) - if they are possible ) in Android Studio. I mean random .java file from my Android project in which I'll write main(..) method. And there's one more thing: I don't want to create any new modules (I've already seen answers about adding Java library module). I just want to click something and run my (single) file, the same way as I can do it in Eclipse. Is it possible?
upvote count: 20
has title: Run single java file with standard main(String [] args) method - Android Studio
has comment: http://stackoverflow.com/comment/42773396
downvote count: 0
has answer: http://stackoverflow.com/a/34477772
has answer: http://stackoverflow.com/a/27137529
has answer: http://stackoverflow.com/a/69395040
tagged with: android
possible better answer: http://stackoverflow.com/a/34477772

http://stackoverflow.com/comment/42967592
type: Comment
has text: @Vic DateTimeFormat annotation is not responsible for formatting in storage (mongodb). It works at application-level (e.g. formatting on JSP pages). There is converters for converting data to appropripriate type. I found only `ZonedDateTimeToCalendarConverter` for Java 8 time API. So can you try to use ZonedDateTime?
type: AnswerComment
comment on: http://stackoverflow.com/a/27217711
score: 0

http://stackoverflow.com/q/27088108
has answer: http://stackoverflow.com/a/27088202
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42683991
answer count: 3
has body: I am trying to read a csv file that contains the names and scores in one line. My code works fine if the csv has exactly 20values(10names and 10 scores). Im having a difficulty making it work if the csv file is empty or has less than 20 values. My code reads the csv in an array and then stores the names and scores in two different arrays. Then it compares if a new player has a score greater than ones already stored in the csv file, if it is then it replaces it and then stores all updated names and scores in one array. The csv file can have a maximum of 10 names and 10 scores and the minimum can be empty csv. public class CompareLeaderboard { public static void main(String[] args) { CompareLeaderboard user = new CompareLeaderboard(); user.run(); } public void run() { String csvFileLoc = "/Documents/leaderboard.csv"; BufferedReader br = null; String line = ""; String commaSeparator = ","; int[] userScore = new int[10]; String[] userName = new String[10]; String[] userInfo = new String[20]; int k = 0; int h =0; int z = 10; int tempS; String tempN; int playerScore = 50; String playerName = "Matt"; boolean breaking = false; try { //int a = 1; br = new BufferedReader(new FileReader(csvFileLoc)); while ((line = br.readLine()) != null) { // use comma as separator //if(a==1){ String[] userDetails = line.split(commaSeparator); for(int j =0; j&lt;20; j = j+2){ userName[k] = userDetails[j]; int foo = Integer.parseInt(userDetails[j+1]); userScore[k] = foo; k++; } // } } //a++; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } //checking for(int i = 0; i &lt;10 ; i++){ if(userScore[i] &lt; playerScore) { if(breaking == false){ z = i; breaking = true; } } //else if(i==9 &amp;&amp; userScore[i] &gt; playerScore){ //} } //storing if(z&lt;10) { for(int j = z; j&lt; userName.length; j++){ tempN = userName[j]; tempS = userScore[j]; u…
tagged with: arrays
downvote count: 0
possible better answer: http://stackoverflow.com/a/27088254
favorite count: 0
has title: how to stop array out of bounds error if csv file empty?
tagged with: http://stackoverflow.com/tag/csv
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27088147
accepted answer: http://stackoverflow.com/a/27088147
upvote count: 1
has answer: http://stackoverflow.com/a/27088254
type: Question

http://stackoverflow.com/q/27131418
type: UnansweredQuestion
tagged with: apache-flex
upvote count: 1
has title: BlazeDs java.lang.Double cannot be cast to java.lang.Float
has comment: http://stackoverflow.com/comment/42780267
has comment: http://stackoverflow.com/comment/48212471
score: 1
tagged with: java
has body: Hello I'm implementing some tests through an AMF connection to test the performaces of a service deployed to a wildfly8 application server instance, that saves a complex type of entity. This entity contains a field like: private Quantity&lt;Float&gt; quantity = null; When Quantity is an object. public class Quantity&lt;T extends Number&gt; implements Serializable When this field is valued it is raised an exception: javax.ejb.EJBTransactionRolledbackException: java.lang.Double cannot be cast to java.lang.Float at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:163) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:253) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:342) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309) Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Float at org.hibernate.type.descriptor.java.FloatTypeDescriptor.unwrap(FloatTypeDescriptor.java:36) at org.hibernate.type.descriptor.sql.RealTypeDescriptor$1.doBind(RealTypeDescriptor.java:64) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:90) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:286) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:281) at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:367) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2843) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3121) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3581)` As suggested in this link (http://flexblog.faratasystems.com/index.php/custom-type-masrhaller-in-blazeds) I tried to override the method ASTranslator.…
type: Question
tagged with: jakarta-ee
tagged with: blazeds
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/49923062
has comment: http://stackoverflow.com/comment/42785782
tagged with: actionscript-3
answer count: 0

http://stackoverflow.com/comment/42674586
comment on: http://stackoverflow.com/a/27082349
has text: you can use JOptionPane.showMessageDialog I've edited my answer
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42742726
score: 1
has text: `get()` returns an object reference, so this answer is nonsense.
type: AnswerComment
comment on: http://stackoverflow.com/a/27120332
type: Comment

http://stackoverflow.com/comment/42550205
has text: i set CLASSPATH also , But it is not working . Can u tell me what location should be set as CLASSPATH ? i have researched a lot , not getting solution.
comment on: http://stackoverflow.com/a/27011239
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27150395
has body: I am trying to create a server to handle XMPP for android GCM by following the Google Doc. public static void main(String[] args) throws Exception { final long senderId = PROJECT_ID; final String password = "API_KEY"; XMPPServer00 ccsClient = new XMPPServer00(); ccsClient.connect(senderId, password); // Send a sample hello downstream message to a device. String toRegId = "REGISTRATION_ID"; String messageId = ccsClient.nextMessageId(); Map&lt;String, String&gt; payload = new HashMap&lt;String, String&gt;(); payload.put("Hello", "World"); payload.put("CCS", "Dummy Message"); payload.put("EmbeddedMessageId", messageId); String collapseKey = "sample"; Long timeToLive = 10000L; String message = createJsonMessage(toRegId, messageId, payload, collapseKey, timeToLive, true); ccsClient.sendDownstreamMessage(message); } So far the server is able to send downstream message to the client, but the client is not able to send upstream messages to the server. Nov 26, 2014 6:07:43 PM XMPPServer00$LoggingConnectionListener authenticated INFO: Authenticated. Nov 26, 2014 6:07:43 PM XMPPServer00$3 interceptPacket INFO: Sent: &lt;message id='4259t-2'&gt;&lt;gcm xmlns="google:mobile:data"&gt; {&amp;quot;to&amp;quot;:&amp;quot;API_KEY&amp;quot;,&amp;quot;delay_while_idle&amp;quot;:true,&amp;quot;collapse_key&amp;quot;:&amp;quot;sample&amp;quot;,&amp;quot;data&amp;quot;:{&amp;quot;EmbeddedMessageId&amp;quot;:&amp;quot;m-b9731a48-7730-40d6-a52e-2ea9253c85ca&amp;quot;,&amp;quot;title&amp;quot;:&amp;quot;World&amp;quot;,&amp;quot;CCS&amp;quot;:&amp;quot;Dummy Message&amp;quot;},&amp;quot;message_id&amp;quot;:&amp;quot;m-b9731a48-7730-40d6-a52e-2ea9253c85ca&amp;quot;,&amp;quot;time_to_live&amp;quot;:10000}&lt;/gcm&gt;&lt;/message&gt;` Looking at the code I've copied from google, its creating the connection then sending a downstream message to the device then it finishes. And if I'm not wrong Google Docs said that there needs to be a persistent connection between third-party server and google s…
accepted answer: http://stackoverflow.com/a/27170262
type: Question
has title: Android XMPP Server in Java From Google Docs
downvote count: 0
answer count: 1
favorite count: 0
tagged with: xmpp
tagged with: google-cloud-messaging
has answer: http://stackoverflow.com/a/27170262
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/27067699
has body: For loop needs to change. start at 0 and the stopping condition could be either i&lt;=testLength-1 or simply i &lt; testlength.
answers question: http://stackoverflow.com/q/27067498
score: 0
type: Answer

http://stackoverflow.com/q/27104121
answer count: 2
has body: I created an ArrayList of JComboBox private static ArrayList&lt;JComboBox&gt; comboList = new ArrayList&lt;&gt;(); and then added each instance of JComboBox to the ArrayList private void courseUnit() { String[] units = {"6", "5", "4", "3", "2", "1"}; int x = 520, y = 30; for (int i = 0; i &lt; 10; i++) { comboUnits = new JComboBox&lt;&gt;(units); comboUnits.setBounds(x, y, 100, 25); y += 30; comboUnits.setToolTipText("Select course unit"); comboUnits.setVisible(true); comboUnits.addActionListener(new PaneAction()); add(comboUnits); comboList.add(comboUnits); //comboUnits added to ArrayList } } My question is, how do i get the selectedItem from each comboBox in the ArrayList because i tried this //this is supposed to get the selected item of the first ComboBox and assign to courseGrade[0] public void actionPerformed(ActionEvent evt) { String[] courseGrade = new String[10]; courseGrade[0] = (String)comboList.get(0).getSelectedItem(); and the program didn't compile.
has comment: http://stackoverflow.com/comment/42713798
upvote count: 1
tagged with: swing
possible better answer: http://stackoverflow.com/a/27107561
accepted answer: http://stackoverflow.com/a/27104290
has answer: http://stackoverflow.com/a/27107561
tagged with: java
has comment: http://stackoverflow.com/comment/42713454
has comment: http://stackoverflow.com/comment/42713559
downvote count: 0
has title: ArrayList of JComboBoxes
has comment: http://stackoverflow.com/comment/42716845
has answer: http://stackoverflow.com/a/27104290
type: AnsweredQuestion
score: 1
favorite count: 0
tagged with: jcombobox
type: Question

http://stackoverflow.com/comment/42544104
has text: That's not really "almost any number" - that's a few numbers logarithmically really close to `Double.MAX_VALUE`.
comment on: http://stackoverflow.com/q/27007763
type: Comment
type: QuestionComment
score: 6

http://stackoverflow.com/q/27102537
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27102695
has title: How to retrieve hidden folders using java?
tagged with: java
has body: public void Process(File aFile) throws IOException, ParseException { if(aFile.isFile()) { System.out.println("File name:"+aFile.getAbsolutePath()); } else if (aFile.isDirectory()) { File[] listOfFiles = aFile.listFiles((FileFilter) HiddenFileFilter.HIDDEN); if(listOfFiles!=null) { for (int i = 0; i &lt; listOfFiles.length; i++) Process(listOfFiles[i]); } File[] listOfFiles1 = aFile.listFiles((FileFilter) HiddenFileFilter.VISIBLE); if(listOfFiles1!=null) { for (int i = 0; i &lt; listOfFiles1.length; i++) Process(listOfFiles1[i]); } } } Call the function in main as follows String nam = "E:\\"; File aFile = new File(nam); Process(aFile); I am using the above code to retrieve all the file details which is present in E:\. It does not retrieve the hidden folder file details. Can anyone help on this?
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42709143
has answer: http://stackoverflow.com/a/27102695

http://stackoverflow.com/comment/42632025
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27058216
has text: That first method looks really interesting! I'll try to implement it.
type: Comment

http://stackoverflow.com/comment/42653020
comment on: http://stackoverflow.com/a/27069945
type: AnswerComment
score: 0
type: Comment
has text: Indeed! My problem was with `parser.require(XmlPullParser.END_TAG, ns, "foo");` this fragment is unnecessary in my case. Thanks!

http://stackoverflow.com/q/27068374
tagged with: android
tagged with: xposed
has body: How to hook a onReceive method inside BroadcastReceiver? public class RecentsActivity extends Activity { mIntentReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { ... } }; }
has title: Hook to BroadcastReceiver using Xposed Framework
upvote count: 1
accepted answer: http://stackoverflow.com/a/27403660
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27403660

http://stackoverflow.com/comment/42785557
has text: Thanks .. but it doesn't work either and How I can use variable without first declaration like Location mylocation
type: Comment
comment on: http://stackoverflow.com/a/27144519
score: 0
type: AnswerComment

http://stackoverflow.com/a/27072081
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27071871
score: 1
upvote count: 1
has body: Look here in the FAQs for ways to do it for Jackson 2.0. Example from the FAQ for serialization: public class DateStuff { @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd,HH:00", timezone="CET") public Date creationTime; } Independent from that, there is the possibility of writing your own Serializer class and annotate the property with @JsonDeSerialize(using MyDeSerializer.class) public class MyJsonDateDeserializer extends JsonDeserializer&lt;Date&gt; { @Override public Date deserialize(JsonParser jsonparser, DeserializationContext deserializationcontext) throws IOException, JsonProcessingException { SimpleDateFormat f = new SimpleDateFormat("dd.MM.yyyy"); // german date String d = jsonparser.getText(); try { return f.parse(d); } catch (ParseException e) { throw new RuntimeException(e); } } }
has comment: http://stackoverflow.com/comment/42725983
answers question: http://stackoverflow.com/q/27071871

http://stackoverflow.com/a/27080434
answers question: http://stackoverflow.com/q/27080357
downvote count: 0
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/42682607
has body: JavaScript does not have integer arithmetic, and all numbers are stored as 64-bit floats (double in Java). When JavaScript sees a bit-handling operator like &lt;&lt; or ^, it temporarily converts the operands to 32-bit integers to perform the arithmetic, but then converts them back to 64-bit float. Thus, the last multiplication is performed as a floating-point operation in JavaScript. In Java, it is still an integer operation. This code performs the same operation in Java (I have now tested it, and the result is the same): int n = 4451 + 554 * 57; n = n &lt;&lt; 13 ^ n; double x = n; System.out.println(x * (x * x * 15731 + 789221) + 1376312589); If you want JavaScript code that works the same as Java, you will need a way to perform multiplication and addition that works the same way as Java does when you overflow. That is, it must treat the results of all operations as if they were in the range -231 and 231-1. There really isn't a reliable way to do this in JavaScript using its native arithmetic; even if you give it two values that have only 31 significant bits, when you multiply them you will get 62 significant bits, while JavaScript's "number" type only has 52 bits, which means some bits will get lost. There may be a JavaScript library that would allow you to do this kind of exact integer arithmetic, but I'm not an expert on JavaScript frameworks so I don't know what that would be. Maybe someone else will chime in.
has comment: http://stackoverflow.com/comment/42671237
has comment: http://stackoverflow.com/comment/42670589
has comment: http://stackoverflow.com/comment/42670726
has comment: http://stackoverflow.com/comment/42670750
upvote count: 5
has comment: http://stackoverflow.com/comment/42671271
has comment: http://stackoverflow.com/comment/42672066

http://stackoverflow.com/comment/42710357
comment on: http://stackoverflow.com/a/27102332
has text: ok now two class file i stored into WEB-INF/classes folder of webApp.After that i am not able to import MyApp class in to servlet Application..why?
type: Comment
score: 0
type: AnswerComment

performance
tags question: http://stackoverflow.com/q/27112091
tags question: http://stackoverflow.com/q/27101934
tags question: http://stackoverflow.com/q/27017017
tags question: http://stackoverflow.com/q/27026267
tags question: http://stackoverflow.com/q/27036521
tags question: http://stackoverflow.com/q/27054464
tags question: http://stackoverflow.com/q/26994500
tags question: http://stackoverflow.com/q/27123131
tags question: http://stackoverflow.com/q/27066986
tags question: http://stackoverflow.com/q/27039349
tags question: http://stackoverflow.com/q/27048588
tags question: http://stackoverflow.com/q/27109944
tags question: http://stackoverflow.com/q/27034905
tags question: http://stackoverflow.com/q/27027330
tags question: http://stackoverflow.com/q/27105677
tags question: http://stackoverflow.com/q/27130910
tags question: http://stackoverflow.com/q/27115993
tags question: http://stackoverflow.com/q/27037863
tags question: http://stackoverflow.com/q/27125939
tags question: http://stackoverflow.com/q/26995262
tags question: http://stackoverflow.com/q/27105102
tags question: http://stackoverflow.com/q/27076077
tags question: http://stackoverflow.com/q/27126112
tags question: http://stackoverflow.com/q/27037570
tags question: http://stackoverflow.com/q/27038803
tags question: http://stackoverflow.com/q/27014675
tags question: http://stackoverflow.com/q/27107954
tags question: http://stackoverflow.com/q/27070234
tags question: http://stackoverflow.com/q/27136131
tags question: http://stackoverflow.com/q/26999390
tags question: http://stackoverflow.com/q/27061491
tags question: http://stackoverflow.com/q/27104627
tag name: performance
tags question: http://stackoverflow.com/q/27104556
tags question: http://stackoverflow.com/q/27064373
tags question: http://stackoverflow.com/q/27115961
tags question: http://stackoverflow.com/q/27072340
type: Tag
tags question: http://stackoverflow.com/q/27079482
tags question: http://stackoverflow.com/q/27075842
tags question: http://stackoverflow.com/q/27037059

http://stackoverflow.com/a/27065913
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42646051
has body: The show__Dialog methods of JOptionPane accept Object for the "message". This can be anything: namely a custom JPanel that you have created. Create a JPanel, put your comboboxes in it, show it in a JOptionPane, then retrieve what you need. Here is an extremely short example: SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JPanel panel = new JPanel(); JCheckBox check = new JCheckBox("Yes or no?"); panel.add(check); JOptionPane.showMessageDialog(null, panel); JOptionPane.showMessageDialog(null, "You entered " + (check.isSelected() ? "yes" : "no") + "." ); } }); (The JCheckBox could have also been passed to showMessageDialog directly.) The JOptionPane doc is fairly specific about how message is handled. Look under "Parameters: message". According to the doc, you could even pass it a JComboBox[].
has comment: http://stackoverflow.com/comment/42646321
accepted answer of: http://stackoverflow.com/q/27064542
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27064542
upvote count: 2

http://stackoverflow.com/comment/42780381
type: Comment
has text: Ok sorry i have a new problem, when i run it now after intializing the array it just gets 1 hit than freezes and dosnet execute anything more. If you get a chance could you please look at my code and help find the problem?
comment on: http://stackoverflow.com/a/27141480
type: AnswerComment
score: 0

http://stackoverflow.com/a/27037935
type: Answer
has comment: http://stackoverflow.com/comment/42596459
upvote count: 78
downvote count: 0
has comment: http://stackoverflow.com/comment/42602884
has body: This seems to be an import problem. When using getFragmentMangager(), make sure that your Fragment classes extend android.app.Fragment class. If by any chance you are using android.support.v4.app.Fragment (see your imports), then you need to use getSupportFragmentManager() instead Hope it helps
accepted answer of: http://stackoverflow.com/q/27037662
has comment: http://stackoverflow.com/comment/42598089
has comment: http://stackoverflow.com/comment/42600572
answers question: http://stackoverflow.com/q/27037662
has comment: http://stackoverflow.com/comment/87108605
score: 78
has comment: http://stackoverflow.com/comment/42596781
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42596211
has comment: http://stackoverflow.com/comment/42599331

http://stackoverflow.com/comment/115281672
score: 8
has text: @KrzysztofWolny, I think you've missed the point - this is effectively creating a mutable clock as in Raman's answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/59248593
type: Comment

http://stackoverflow.com/a/27020045
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27019970
accepted answer of: http://stackoverflow.com/q/27019970
upvote count: 1
has body: change like this public Shapes(int userChoise){ choice = userChoise; } because you assign userChoise = choice. so choice default value is 0 and it is never gets update. in paintComponent there is no case for 0. so nothing will be drawn
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27134466
score: 9
type: AcceptedAnswer
has body: There is no syntax in Java that can restrict the range of a parameter. If it takes an int, then all possible values of int are legal to pass. You can however test the value with code in the method and throw an IllegalArgumentException if i is not greater than x.
type: Answer
upvote count: 9
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27134432
answers question: http://stackoverflow.com/q/27134432

http://stackoverflow.com/comment/42591075
type: QuestionComment
score: 1
has text: Please share code, so figure out problem.
comment on: http://stackoverflow.com/q/27035200
type: Comment

http://stackoverflow.com/comment/42690277
has text: Any suggestions as to how I can fix my method, then?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27054390

http://stackoverflow.com/comment/42670708
type: Comment
score: 0
type: AnswerComment
has text: You made the same changes to the other methods?
comment on: http://stackoverflow.com/a/27080487

http://stackoverflow.com/q/27043093
has answer: http://stackoverflow.com/a/27044339
tagged with: resteasy
tagged with: jax-rs
favorite count: 0
has body: I am implementing a pre matching ContainerRequestFilter and would like to retrieve the @Path pattern of my resource which is about to be invoked. Here is my resource Path("/v1/partner/{partnerId}/adresse") public interface AdresseResource { @GET @Produces({ MediaType.APPLICATION_JSON }) public Response handleAdresseCollectionGet(@Context UriInfo uriInfo, @PathParam("partnerId") String partnerId); // Other methods omitted } In my filter I would like to get the /v1/partner/{partnerId}/adresse pattern from my Path annotation. But I can't get it out of the ContainerRequestContext instance. I would have expected this information within the UriInfo but encodedPath and matchingPath are the same. Can you help me on this?
downvote count: 0
linked to: http://stackoverflow.com/q/16303694
type: AnsweredQuestion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/27044339
type: Question
upvote count: 2
has title: JAX-RS: Retrieve path pattern in ContainerRequestFilter
answer count: 1

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/27101437
type: Tag

http://stackoverflow.com/comment/42750559
type: QuestionComment
has text: You could write raw servlet and do all the request processing yourself, but, that would require more time and effort to do right than to just use some existing framework (spring mvc, jersey, ...).
score: 1
comment on: http://stackoverflow.com/q/27125254
type: Comment

http://stackoverflow.com/comment/42656164
comment on: http://stackoverflow.com/a/27071618
score: 0
type: AnswerComment
type: Comment
has text: @ThomYorkkke: so my quick and dirty fix is chosen over the good advice of [Hovercraft Full Of Eels](http://stackoverflow.com/users/522444/hovercraft-full-of-eels)... Thanks. Please do take a look at other examples (like [Java Animate JLabel](http://stackoverflow.com/a/12545773/1694043)) to find more animation code and good luck with your circles!

http://stackoverflow.com/comment/42748308
type: QuestionComment
comment on: http://stackoverflow.com/q/27123385
score: 1
type: Comment
has text: No. I didn't say that at all. I said that the servlet api is a jar file as any other library is, and that to be able to access classes of this API in your project, you must do the same thing as for any other library: download the jar file and add it to the build path of your eclipse project. Where to find this jar file? It comes with jetty, tomcat, glassfish or whatever container implementing the servlet api, or it can also be found in the Maven repository.

http://stackoverflow.com/comment/42782326
type: Comment
type: QuestionComment
has text: Thats hard to tell... Try a `System.out.println()` before the `if`-condition and print the 2 `collisionBox`es out. Then show me the results of a few checks, not only one.
comment on: http://stackoverflow.com/q/27121550
score: 0

http://stackoverflow.com/q/27110440
score: 0
tagged with: google-maps
tagged with: google-maps-api-2
answer count: 1
has body: I'm trying to implement a zoom that fits all the marker points, these marker points is coming from a database, I made an array of markers, but when I run the app it gives me a zoom in only one marker, what am I missing here? public class MapaViagem extends FragmentActivity { private GoogleMap googleMap; private String rm_IdViagem; private List&lt;ClienteModel&gt; mClienteModel = new ArrayList&lt;ClienteModel&gt;(); private ViagemModel mViagemModel = new ViagemModel(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maps); try { Bundle parametros = getIntent().getExtras(); rm_IdViagem = parametros.getString("id_viagem"); Repositorio ca = new Repositorio(this); mViagemModel = ca.getViagemPorId(Integer.valueOf(rm_IdViagem)); Repositorio cl = new Repositorio(this); mClienteModel = cl.getClientesViagem(Integer.valueOf(rm_IdViagem)); for (int i = 0; i &lt; mClienteModel.size(); i++) { Repositorio mRepositorio = new Repositorio(this); EnderecoModel mEnderecoModel = mRepositorio.getEnderecosDoCliente(Integer.valueOf(mClienteModel.get(i).getClientes_id())); // Loading map initilizeMap(); // Changing map type googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); // googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); // googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); // googleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN); // googleMap.setMapType(GoogleMap.MAP_TYPE_NONE); // Showing / hiding your current location googleMap.setMyLocationEnabled(true); // Enable / Disable zooming controls googleMap.getUiSettings().setZoomControlsEnabled(false); // Enable / Disable my location button googleMap.getUiSettings().setMyLocationButtonEnabled(true); // Enable / Disable Compass icon googleMap.getUiSettings().setCompassEnabled(true); // Enable / Disable Rotate gesture googleMap.getUiSettings().setRotateGesturesEnabled(true); // Enable / Disable zooming functionality googleMap.getUiSettings().setZoomGesturesEnabled(true); f…
tagged with: android
type: UnansweredQuestion
tagged with: java
type: Question
has title: Zoom to fit all markers on map google maps v2 android
has answer: http://stackoverflow.com/a/27112444
tagged with: google-maps-api-3

http://stackoverflow.com/comment/42545098
comment on: http://stackoverflow.com/a/27008504
score: 1
type: AnswerComment
has text: btw, I think IDEs could implement this automatically (or have a plugin), mostly because they could also automatically let the application re-grab the mouse; otherwise we can also code a "grabbed mouse checker/fixer" on the application itself.
type: Comment

http://stackoverflow.com/q/27047935
tagged with: robovm
answer count: 1
has body: I want to commit some Game Stats from my App to the Gamecenter. Have anyone ever worked with gamecenter and robovm? Is it possible to commit and receive data? If yes, how I do this? best regards...
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32687555
has title: Robovm connect to Gamecenter
type: Question
tagged with: java
score: 0

http://stackoverflow.com/comment/42728754
comment on: http://stackoverflow.com/a/27112959
score: 0
type: AnswerComment
type: Comment
has text: @McAdam331 if you read the [java doc](https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#add(int,%20E)) you see it will add it at that index.

http://stackoverflow.com/comment/42809845
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27052623
score: 0
has text: Thanks, I'm using that and it's going well so far.

http://stackoverflow.com/comment/42660235
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27074226
type: QuestionComment
has text: @ Naveen Tamrakar yes dear..I know about sqlite..But I want to store it to the mysql with java..

forms
tags question: http://stackoverflow.com/q/27130958
type: Tag
tags question: http://stackoverflow.com/q/27073759
tags question: http://stackoverflow.com/q/27019045
tags question: http://stackoverflow.com/q/27019381
tags question: http://stackoverflow.com/q/27061141
tag name: forms

http://stackoverflow.com/comment/55798873
type: Comment
comment on: http://stackoverflow.com/a/27144407
score: 0
type: AnswerComment
has text: This works. But if i try something like `rEngine = new RConnection(); //get the pid of rEngine and do the time consuming eval using rEngine.. //Terminate RConnection c2 = new RConnection(); // SIGTERM might not be understood everywhere: so using SIGKILL signal, as well. c2.eval("tools::pskill("+ this.rServePid + ")"); c2.eval("tools::pskill("+ this.rServePid + ", tools::SIGKILL)"); c2.close();` , the process is killed, but cpu usage of Rserve goes up and Rserver doesnt allow any new connections. Do you have any idea why?

http://stackoverflow.com/a/27151260
upvote count: 4
has body: 'ul' elements are not legally allowed inside 'p' elements, so probably Jsoup normalize it. Maybe Document xmlDoc = Jsoup.parse(html, baseUri, Parser.xmlParser()); will work.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27150489
score: 4
answers question: http://stackoverflow.com/q/27150489

http://stackoverflow.com/a/27067764
has comment: http://stackoverflow.com/comment/42648981
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27067746
type: Answer
accepted answer of: http://stackoverflow.com/q/27067746
has body: You should probably create some class that contains those two ints and one boolean. Then you can have a single List&lt;YourClass&gt;. public class YourClass { private int a; private int b; private boolean c; public YourClass (int a, int b, boolean c) { this.a=a; this.b=b; this.c=c; } // add some getters and setters here } void updateStuff(int i1, int i2, boolean b1) { list.add(new YourClass(i1,i2,b1)); } This way you don't have to worry about synchronizing the lists when adding/removing elements, since you only have one list.

http://stackoverflow.com/comment/42645873
has text: i'm removing close vote since you provided logcat log ... but still it deserves -1 becuase exception is obvious and self explanatory
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27065680

http://stackoverflow.com/comment/74673739
comment on: http://stackoverflow.com/a/28679264
score: 0
type: Comment
has text: how can I find - which dependencies are using javaassist old version ? BDW I am using gradle ... please guide
type: AnswerComment

http://stackoverflow.com/q/27104589
has body: I'm computing some area and I want to draw a polygon on the area I have computed. But I'm getting this error I've tracked the error with debug and I've seen that program just cant pass this line in the middle. I've declared everthing as described in Editable Carto DB page described. But It just stops when the point style is defining. Thanks in advance
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27123192
type: Question
tagged with: nutiteq
tagged with: java
tagged with: clip
has title: Why I'm getting InvocationTargetException error when I want to add new polygon on Nutiteq?
has comment: http://stackoverflow.com/comment/42746837
score: 0
accepted answer: http://stackoverflow.com/a/27123192
answer count: 1

http://stackoverflow.com/q/27100733
tagged with: time
tagged with: calendar
has comment: http://stackoverflow.com/comment/42705740
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27101067
possible better answer: http://stackoverflow.com/a/27101070
has answer: http://stackoverflow.com/a/27101070
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/42706975
has title: Counting weekdays with date parameter
type: Question
answer count: 2
has body: I need to make an app that counts how many weekdays it has been. For example is September 23,2014. That's the 17th weekday for the month. Obviously it excludes the weekend. And the counter will start over again when the month is over. So when the date is october 1 then the counter will be equals to 1. I already have this set of codes it works correctly for the date today which is 11-24-14. The output is 17 which is correct. But for the other dates it's wrong. I haven't put on some validation for example the weekend check because I was testing the logic. Here's the block of code: Date dateToday = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(dateToday); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_WEEK); int week = cal.get(Calendar.WEEK_OF_MONTH); int dayNo=0; System.out.println("year= " + year + " month= " + month + " day= " + day + " week= " + week); if ((day == Calendar.SATURDAY) &amp;&amp; (day == Calendar.SUNDAY)) { willPush = false; }else{ if(week&gt;4){ week-=1; } if(week==1){ dayNo+=day-1; }else if(week==2){ dayNo=day+5; }else if(week==3){ dayNo=day+10; }else if(week==4){ dayNo=day+15; }else if(week==5){ dayNo=day+20; } dayNo-=1; } System.out.println("DayNO: "+dayNo); UPDATE: Just figured out that this logic is flawed, very flawed. Will try a new approach, I'm thinking of looping through the days of the month then checking if they are the weekends or not. Not sure if this is the best idea though.
score: 0
has answer: http://stackoverflow.com/a/27101067
has comment: http://stackoverflow.com/comment/42705823

http://stackoverflow.com/q/27042478
type: Question
has comment: http://stackoverflow.com/comment/42604654
has comment: http://stackoverflow.com/comment/42603955
score: 0
linked to: http://stackoverflow.com/q/3138348
answer count: 2
tagged with: countdowntimer
tagged with: android
has answer: http://stackoverflow.com/a/27042616
has answer: http://stackoverflow.com/a/27042695
type: AnsweredQuestion
has title: CountDownTimer - EditText won't get an Integer
possible better answer: http://stackoverflow.com/a/27042616
accepted answer: http://stackoverflow.com/a/27042695
tagged with: java
has body: I keep getting "Application not responding" when trying to implement a CountDownTimer. Here's what I have: private TextView mTextField; private EditText secText; private int secs; private Button buttonStart, buttonStop; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTextField = (TextView) findViewById(R.id.textView1); secText = (EditText) findViewById(R.id.segText); buttonStart = (Button) findViewById(R.id.buttonStart); buttonStop = (Button) findViewById(R.id.buttonStop); secs = Integer.parseInt(secText.getText().toString()); final CountDownTimer count = new CountDownTimer((secs*1000), 1000) { public void onTick(long millisUntilFinished) { mTextField.setText("Seconds remaining: " + millisUntilFinished / 1000); } public void onFinish() { mTextField.setText("FINISHED!"); } }; The problem is with this line when it tries to parse, if I put a number it works: secs = Integer.parseInt(secText.getText().toString());

http://stackoverflow.com/comment/42545126
score: 0
type: Comment
has text: No i am not getting a stack trace. Here is what I got run: Please specify a path to a pricing catalogue file Java Result: 3 BUILD SUCCESSFUL (total time: 0 seconds)
type: QuestionComment
comment on: http://stackoverflow.com/q/27008458

http://stackoverflow.com/a/27148286
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42792076
has comment: http://stackoverflow.com/comment/42820542
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/27147760
answers question: http://stackoverflow.com/q/27147760
downvote count: 0
score: 1
has body: You have mixed a lot of unrelated things: Your service MultiselectorService is an EJB, and you cannot produce it with a producer. EJB is registered once application is created and then depending on the scope it creates instances. You have a method public void MultiselectorService(Class&lt;? extends Dbo&gt; clazz) with the name similar to constructor, it against convention. Assume that you have fixed that method to be a constructor, but then line 'itemList = em.createQuery("some Sql String", clazz);' will fail with NPE. Because em will be initialized only after bean creation. there are two ways to do it: Inject entity manager into constructor (this is against EJB spec, if you will still use EJB) Execute initialization operation in method with annotation '@PostConstruct' Do you have a producer for EntityManager ? e.g. you cannot just inject entity manager, you need to provide as a resource for EJB, with annotation @PersistenceContext I understand what you try to achieve. The main problem is that manually created beans are not managed by container, this means that interceptors and decorators won't apply (e.g. PostConstruct and Transactional annotation will not work). Check here. So far the best way to achieve this is: public interface SpecialDboMultiselectorService extends MultiselectorService { } @Stateless public class SpecialDboMultiselectorServiceImpl extends MultiselectorServiceImpl&lt;SpecialDbo&gt; implements SpecialDboMultiselectorService { public SpecialDboMultiselectorServiceImpl() { super(SpecialDbo.class); } } public class MultiselectorServiceImpl&lt;T extends Dbo&gt; implements MultiselectorService { @Inject private EntityManager em; private Class&lt;? extends Dbo&gt; clazz; private List&lt;T&gt; itemList; public MultiselectorService(Class&lt;? extends Dbo&gt; clazz) { this.clazz = clazz } @PostConstruct public void init() { itemList = em.createQuery("some Sql String", clazz); } } and inject SpecialDboMultiselectorService.

http://stackoverflow.com/q/27004174
has title: JAVA can I get the librarys of an exported project(runnable jar)?
answer count: 1
linked to: http://stackoverflow.com/q/320510
has body: My friend sent me a runnable jar he made and I would like to view the librarys he used in the jar. I was wondering if that was possible? if so how could I view/get the files? thanks for your time.
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42537756
has answer: http://stackoverflow.com/a/27004594
tagged with: jar
score: 0

http://stackoverflow.com/comment/42566414
has text: @LutzHorn, you can't always choose your dev environment.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27020538

http://stackoverflow.com/comment/42690761
comment on: http://stackoverflow.com/q/27091875
has text: I appreciate that you are new to this but you need to think about how you ask questions. 'How do you iterate the grids?' - What grids? It is not obvious from your code. It would be better if you explained exactly what your problem was.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27115023
answers question: http://stackoverflow.com/q/27114521
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42732896
has body: It does seem that you are looking for transactional behavior, and specifically, for atomicity ("all or nothing"). But usually "transaction" connotes certain guarantees (particularly around ACID properties) that will be difficult or impossible to achieve where human-level timescales on the order of minutes are involved. Probably "workflow with compensation for errors" is more what you would be looking for here. I would implement this manually, perhaps with tool support (e.g. workflow engines). Kick off a process to spawn your network, and keep track of the current progress, such as VMs created, VMs in progress, etc. If there are errors that demand a rollback, then have another process that performs a cleanup. The behavior of the cleanup process itself could fail, so it might retry its various steps a couple times before generating a report that says "this cleanup step failed". If there are shared resources involved then you would need to implement some kind of isolation mechanism as well. Sometimes this is easy enough--e.g., DHCP helps you avoid duplicate IPs. If you're updating a DNS zone file then you'd want to synchronize access to that to avoid concurrent writes. Etc.
type: Answer
accepted answer of: http://stackoverflow.com/q/27114521

http://stackoverflow.com/q/27090246
has comment: http://stackoverflow.com/comment/42687604
score: 0
has comment: http://stackoverflow.com/comment/42687642
has body: i want to download my file from file's path stored in Mysql by using JSP,actually i did it, but when download a file, it only has a file size= 0 KB, here is my code to download: package rizki; import java.io.*; import java.sql.*; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "downloadServlet2", urlPatterns = {"/downloadServlet2"}) public class downloadServlet2 extends HttpServlet { static ResultSet result; static Connection con; static PreparedStatement stat; static Statement st, st2; private static String dataSourceName="odbcMySql"; private static String dbURL="jdbc:odbc:"+dataSourceName; private static String dbUser="root"; private static String dbPass="085219236994"; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { String id=request.getParameter("file_id"); String filePath=""; String fileName=""; String completeFile=""; String sql="select FileName,lokasi from savedFile where id= ?"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection(dbURL,dbUser,dbPass); stat=con.prepareStatement(sql); stat.setString(1, id); result=stat.executeQuery(); if (result.next()) { fileName = result.getString(1); filePath=result.getString(2); } completeFile=filePath+File.separator+fileName; File downloadFile = new File(completeFile); int length = 0; ServletContext context = getServletContext(); // gets MIME type of the file String mimeType = context.getMimeType(completeFile); if (mimeType == null) { // set to binary type if MIME mapping not found mimeType = "application/octet-stream"; } System.out.println("MIME type: " + mime…
has comment: http://stackoverflow.com/comment/42687776
has answer: http://stackoverflow.com/a/27096062
favorite count: 0
has answer: http://stackoverflow.com/a/42034871
tagged with: download
possible better answer: http://stackoverflow.com/a/27096062
answer count: 4
has title: how to download file from file's path stored in MySql by using servlet,JSP
has comment: http://stackoverflow.com/comment/42687742
has comment: http://stackoverflow.com/comment/42687520
type: AnsweredQuestion
tagged with: java
tagged with: mysql
upvote count: 1
accepted answer: http://stackoverflow.com/a/42034871
has answer: http://stackoverflow.com/a/35684007
downvote count: 1
has comment: http://stackoverflow.com/comment/42689586
type: Question
has answer: http://stackoverflow.com/a/27102923
tagged with: jsp
has comment: http://stackoverflow.com/comment/42698405
tagged with: servlets
has comment: http://stackoverflow.com/comment/42687878

http://stackoverflow.com/q/27042840
has answer: http://stackoverflow.com/a/27043098
tagged with: jackson
accepted answer: http://stackoverflow.com/a/27043098
favorite count: 0
linked to: http://stackoverflow.com/q/18313323
upvote count: 2
type: AnsweredQuestion
score: 2
has title: Jackson serialization and @JsonValue : back to the default behavior
tagged with: java
type: Question
has body: I have a simple POJO : public class Test { private String id; private boolean asString; // getters and setters @JsonValue public Object getValue() { if (asString) { return id; } // I want to use the default behavior of Jackson but i don't know what to do here } } As you can see, i'm trying to use @JsonValue to make the following behavior : If asString is true, i want to serialize my object as a simple string. If asString is false, i want to serialize my object with the default behavior of Jackson. But i don't know how to do this. I also tried to make a custom serializer, but i can't reach the "default serializer" of Jackson and call it. How can i achieve this ? I want to serialize my object as a string on a certain condition but i want to back on the default behavior of Jackson if i want to.
answer count: 1
downvote count: 0

http://stackoverflow.com/q/27077460
tagged with: java
has answer: http://stackoverflow.com/a/27078168
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/27078066
answer count: 2
upvote count: 0
has body: I have 2 parts to my question. First is just a general question and second is more into app development and coding. How does Starbucks/Coffee Bean/McDonalds pushes out notification whenever we as customers connect to their WIFI AP? They will push out notifications like "Sign In to proceed using the internet" in the status bar, and then redirects us to their website before we can start using the internet. I am trying to create an app that does just that by creating a personal hotspot(that will have internet access), and whenever customers are logged into my hotspot, they will receive that same notification. My intention is to just direct them to a 'sign in' page in their browser, and once they click sign in, they will again be directed to my personal website. After that, they are free to surf any websites they want to. So is it possible to do just that? I only want the app to be installed in my phone, and not in my customers phone.
tagged with: push-notification
tagged with: android
has title: Q: How does wifi AP providers (e.g Starbucks,McD) pushes out "Sign In to surf website" notifications to customers, and how to implement that in JAVA?
favorite count: 0
linked to: http://stackoverflow.com/q/5353911
type: UnansweredQuestion
downvote count: 1
type: Question

http://stackoverflow.com/q/27064412
tagged with: android
has answer: http://stackoverflow.com/a/27232101
linked to: http://stackoverflow.com/q/3145968
has answer: http://stackoverflow.com/a/27117758
upvote count: 1
has answer: http://stackoverflow.com/a/27150291
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27117758
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42756904
has comment: http://stackoverflow.com/comment/42722243
linked to: http://stackoverflow.com/q/5760607
has body: After some research I cannot come across the best approach for this. There will be certain color classes that I would like to share amongst multiple projects. Let's call one of them EncryptedColor. Since it is used across multiple projects I don't want multiple copies of it in existence of course. Otherwise I would need to make sure that an update in one location would need to be updated everywhere. However, these classes are needed in some released SDKs that we provide to customers. How could I design it such that I can use these classes but not provide them with the classes that they don't need access to from their SDK. I don't want useless classes to become visible and flood the smaller subset of classes that they really need to be seeing. A couple approaches I have thought of so far but aren't quite ideal: Try and use a doclet structure that hides the calls within the javadoc such as doclava. Javadoc has not fully implemented its own hiding mechanism yet. As I understand this doesn't keep the functions from being visible, but it was mentioned in one spot that you would need reflection to use the calls. I don't see how just the javadoc does that so I must have been missing something. Android has designed themselves it seems to force reflection from some @hide attributes included in methods that they have in source code. But from the sounds of it, the system hides those and then uses a different jar when it is loading to make those visible at launch time. Probably not useful here. If I were to keep shared classes in the same package name I could access default and protected members, but...then I am keeping all my classes that use these in the same package name. Not quite ideal either, but it could be done in that manner if I needed to. Might get out of hand with large quantities of shared resources. What approaches are taken typically in situations such as these? I haven't liked my findings and thought process thus far.
downvote count: 0
has comment: http://stackoverflow.com/comment/42725717
accepted answer: http://stackoverflow.com/a/27150291
has comment: http://stackoverflow.com/comment/42745778
favorite count: 0
has title: Using shared class libraries internally, but not providing access to them in released SDK
linked to: http://stackoverflow.com/q/8761504
tagged with: sdk
answer count: 3

http://stackoverflow.com/comment/42517111
type: Comment
comment on: http://stackoverflow.com/a/26992789
score: 1
has text: This code will *not work*! String comparison using the == operator is a comparison on references and unless they are interned there is no guarantee this will do as intended. Use equals operator instead.
type: AnswerComment

http://stackoverflow.com/q/27001415
tagged with: multidimensional-array
type: AnsweredQuestion
has title: Putting char values into a 2D array from a file in Java
tagged with: java
tagged with: file
has body: I have a file with a known number of 40,000 digits. I need to read the digits one by one so I've created a for loop where I read the file in chars. The file is made up of numbers from 0 to 9. I need to filter out numbers 0 to 3 and 4 to 9. Numbers 0 to 3 need to be replaced with the letter x Numbers 4 to 9 need to be replaced with the letter y How do I go about storing these digits within the 2D array? The array is [200][200] as this is the size of the window in which the x's and y's will be printed. char[][] myArray = new char [200][200]; for (int i=0; i&lt;=39000; i++) { char readFile = fileInput.readChar(); {
type: Question
has answer: http://stackoverflow.com/a/27001578
tagged with: for-loop
tagged with: arrays
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27001578

http://stackoverflow.com/comment/42729074
type: Comment
comment on: http://stackoverflow.com/a/27071423
type: AnswerComment
has text: I am actually not. I don't know why people have written on a lot of forums that Servlet's cannot be accessed remotely and EJB's can
score: 0

http://stackoverflow.com/a/27048481
accepted answer of: http://stackoverflow.com/q/27024297
score: 0
has body: I found a workaround, In view.xhtml I removed the action attribute of h:commandLink and add a f:actionListener tag after the f:setPropertyActionListener (order matters) &lt;h:commandLink target="_blank"&gt; &lt;f:setPropertyActionListener target="#{documentBean.selectedDocument}" value="#{document}" /&gt; &lt;f:actionListener binding="#{documentBean.openDocumentActionListener}" /&gt; &lt;p:fileDownload value="#{documentBean.content}" contentDisposition="inline" /&gt; &lt;h:outputText value="Open Document" /&gt; &lt;/h:commandLink&gt; In manage bean, I created custom ActionListener with the StreamedContent creation logic @ManagedBean(name = "documentBean") @ViewScoped public class DocumentBean { private List&lt;DocumentVO&gt; documents; private DocumentVO selectedDocument; private StreamedContent content; private ActionListener openDocumentActionListener; @EJB private DocumentServiceIntegrator documentIntegrator; private static final Log LOG = LogFactory.getLog(DocumentBean.class); @PostConstruct public void init() { documents = documentIntegrator.getFolderContentByPath("/"); selectedDocument = new DocumentVO(); openDocumentActionListener = createOpenDocumentActionListener(); } public ActionListener createOpenDocumentActionListener() { ActionListener actionListener = new ActionListener() { @Override public void processAction(ActionEvent arg0) throws AbortProcessingException { LOG.info("Open document: " + selectedDocument.getId() + " (" + selectedDocument.getName() + ", " + selectedDocument.getMimeType() + ")"); byte[] bytes = documentIntegrator.getDocumentContentById(selectedDocument.getId()); LOG.info("Document content: " + (bytes != null ? bytes.length + " bytes" : "null")); InputStream stream = new ByteArrayInputStream(bytes); content = new DefaultStreamedContent(stream, selectedDocument.getMimeType(), selectedDocument.getName()); } }; return actionListener; } // getters and setters for: documents, selectedDocument, content and openDocumentActionListener } Somethi…
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27024297

http://stackoverflow.com/comment/42648342
type: Comment
type: QuestionComment
score: 3
has text: Not only what @TessellatingHeckler said, but you're also not [`flush`](https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html#flush--)ing the output stream, which means you're not in control of when the data is being written to disk. Which means that the `file.length()` call isn't giving you the length of the file with the new data.
comment on: http://stackoverflow.com/q/27067339

http://stackoverflow.com/comment/42762906
has text: Hi. Sorry if i'm hassling you but having difficulties with the concept. To store accounts, which data structure should I use in which class.And which data structure should I use for transaction and which class should it been in?
comment on: http://stackoverflow.com/a/27122406
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42529283
type: Comment
has text: @Paul, well, it's asking to compare a while and for loop, relative to an if statement.
type: QuestionComment
comment on: http://stackoverflow.com/q/26999390
score: 0

http://stackoverflow.com/q/27039446
score: 0
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/27040019
downvote count: 1
accepted answer: http://stackoverflow.com/a/27040019
has comment: http://stackoverflow.com/comment/42598462
has answer: http://stackoverflow.com/a/27039563
has title: When to call the super keyword of an inherited method
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42598337
type: AnsweredQuestion
tagged with: super
tagged with: java
has body: When should I call, for example, super.onResume? sometimes it is in the last line of the the body of onResume and sometimes in the first line. Is there any difference?
has comment: http://stackoverflow.com/comment/42598519
possible better answer: http://stackoverflow.com/a/27039563
type: Question
has comment: http://stackoverflow.com/comment/42598481
has answer: http://stackoverflow.com/a/27039628

http://stackoverflow.com/comment/42694484
has text: I don't think this is possible with `SimpleDateFormat` alone.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27094317

http://stackoverflow.com/q/27080045
type: UnansweredQuestion
score: 0
upvote count: 1
downvote count: 1
has title: Error extending from an abstract class and implementing the Comparable interface
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27080154
has body: Though the GeometricObject is without errors, the GeoCircle shows an error saying GeoCircle is not abstract and does not override the abstract method compareTo(GeometricObject) though the compareTo method is not written as an abstract class //abstract class GeometricObject that implements the comparable interface public abstract class GeometricObject implements Comparable&lt;GeometricObject&gt; { public String name; //sample abstract class of getting area of various shapes public abstract double getArea(); //sample abstract class for getting perimeter/circumference of various shapes public abstract double getPerimeter(); //pass in and return name of the object selected in a system out line public void name(String n) { System.out.println("This is a " + n); } /** A method for comparing the areas of two geometric objects and returning a boolean for their equals */ public static boolean equalArea(GeometricObject object1,GeometricObject object2) { //comparing double to another double return object1.getArea()==object2.getArea(); } // a method to find the bigger between two GeometricObjects and returning a String statement public static void max(GeometricObject g1, GeometricObject g2) { if(g1.compareTo(g2)&gt;0) System.out.println("Object 1 is larger "); else if (g1.compareTo(g2)&lt;0) System.out.println("Object 2 is larger "); else System.out.println("Objects are the same "); } // an override of the compareTo method from the implemented comparable interface public int compareTo(GeometricObject g1, GeometricObject g2) { if(g1.getArea()&gt;g2.getArea()) return 1; else if (g1.getArea()&lt;g2.getArea()) return -1; else return 0; } } //a class for calculating circumference and area of a circle extended from GeometricObject public class GeoCircle extends GeometricObject implements Comparable&lt;GeoCircle&gt; { public String name; public double radius; //constructor for only inputting radius of the circle public GeoCircle(double r) { radius = r; } // 2ndconstructor taking a name…
has answer: http://stackoverflow.com/a/27080073
favorite count: 0

http://stackoverflow.com/a/27134819
has body: For solving this problem it is necessary to change the type of the entity. Open the Entity Object, go to attributes tab, select ID field and in property inspector tab change Type NUMBER to DBSequence. In the case that you have an ID of type BigDecimal, it's necessary to double click the attribute to make appear "Edit Attribute" Popup, then in browse for the Type label, and search oracle.jpo.doman.DBSequence, then do OK.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27134487
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27134487

http://stackoverflow.com/q/27012829
has answer: http://stackoverflow.com/a/27525711
type: UnansweredQuestion
has title: How to delete excel sheet using jxl & java
tagged with: excel
type: Question
has answer: http://stackoverflow.com/a/27013809
has comment: http://stackoverflow.com/comment/42552020
tagged with: java
tagged with: jxl
score: 0
answer count: 2
has body: I am trying to delete an excel sheet with jxl jar file using java . But i am not able to understand how to do it. I am not getting any delete or remove method in jxl

http://stackoverflow.com/comment/42683446
comment on: http://stackoverflow.com/q/27087796
has text: Are you sure you're not getting out of bounds?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27253823
downvote count: 0
answers question: http://stackoverflow.com/q/27052623
has body: I worked it out in this way: for (Map.Entry&lt;String, Map&lt;String, Set&lt;String&gt;&gt;&gt; entry : treeMap .entrySet()) { if (!entry.getValue().isEmpty()) { LibraryModel libraryModel = new LibraryModel(entry.getKey()); root.addLibrary(libraryModel); for (Map.Entry&lt;String, Set&lt;String&gt;&gt; methodToFileEntry : entry .getValue().entrySet()) { MethodModel methodModel = new MethodModel( methodToFileEntry.getKey()); libraryModel.addMethod(methodModel); for (String fileName : methodToFileEntry.getValue()) { FileModel fileModel = new FileModel(fileName, fileName); methodModel.addFile(fileModel); } } } } The HashMap stores the information I get from visiting AST for (MethodInvocation method : visitor.getMethods()) { if (method.resolveMethodBinding().isDeprecated()) { for (IAnnotationBinding iab: method.resolveMethodBinding() .getAnnotations()) { for (IMemberValuePairBinding ivab: iab.getAllMemberValuePairs()) { System.out.println(ivab.getKey()); System.out.println(ivab.getValue()); } } String deprecatedMethod = method.getName().toString(); String fileName = parse.getJavaElement().getResource() .getName(); String packageName = method.resolveMethodBinding() .getDeclaringClass().getQualifiedName(); String library = findLibrary(packageName); if (treeMap.get(library).isEmpty() || treeMap.get(library).get(deprecatedMethod) .isEmpty()) { Map&lt;String, Set&lt;String&gt;&gt; innerMap = new HashMap&lt;String, Set&lt;String&gt;&gt;(); Set&lt;String&gt; fileNames = new HashSet&lt;String&gt;(); fileNames.add(fileName); innerMap.put(deprecatedMethod, fileNames); treeMap.put(library, innerMap); } else { Map&lt;String, Set&lt;String&gt;&gt; innerMap = treeMap .get(library); innerMap.get(deprecatedMethod).add(fileName); } } } This successfully gave me the tree I needed.
accepted answer of: http://stackoverflow.com/q/27052623
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/q/27086707
tagged with: swing
tagged with: gettext
type: AnsweredQuestion
tagged with: java
tagged with: jtextfield
type: Question
answer count: 2
tagged with: user-interface
has answer: http://stackoverflow.com/a/27086817
accepted answer: http://stackoverflow.com/a/27086817
possible better answer: http://stackoverflow.com/a/27087380
has answer: http://stackoverflow.com/a/27087380
score: 0
has title: jTextField and Jpanel color output
has body: ￼Create a program where you can enter a colour name into a textfield then use that colour to set the panel background colour with the colour specified in the text field Im having trouble getting the output import javax.swing.*; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.SwingUtilities; public class textfield implements ActionListener{ JTextField Input; JPanel color; JButton Button; public JPanel createContentPane (){ // We create a bottom JPanel to place everything on. JPanel totalGUI = new JPanel(); totalGUI.setLayout(null); // Creation of a Panel to contain the JLabels Input = new JTextField ("color", 35); Input.setBackground (Color.white); Input.setLocation(50,50); Input.setSize(100, 30); Input.addActionListener (this); totalGUI.add(Input); color = new JPanel(); color.setBackground (Color.white); color.setLocation(200, 50); color.setSize(200, 100); totalGUI.add(color); totalGUI.setOpaque(true); return totalGUI; } public void actionPerformed(ActionEvent e) { String text = Input.getText(); { if (text == "green") color.setBackground(color.green); } } private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("Assignment"); textfield demo = new textfield(); frame.setContentPane(demo.createContentPane()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 300); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }

http://stackoverflow.com/a/27093721
score: 0
has comment: http://stackoverflow.com/comment/42693769
has comment: http://stackoverflow.com/comment/42693894
answers question: http://stackoverflow.com/q/27093660
has comment: http://stackoverflow.com/comment/42693409
has comment: http://stackoverflow.com/comment/42693871
type: Answer
has comment: http://stackoverflow.com/comment/42693489
has body: Finally, here's your solution: public class A { private B b; public void setB(B b) { if(this.b != null) { this.b.unsetA(); } this.b = b; if(b != null &amp;&amp; b.getA() != this) { this.b.setA(this); } } public void unsetB() { this.b = null; } public B getB() { return b; } } public class B { private A a; public void setA(A a) { if(this.a != null) { this.a.unsetB(); } this.a = a; if(a != null &amp;&amp; a.getB() != this) { this.a.setB(this); } } public void unsetA() { this.a = null; } public A getA() { return a; } } My Test Class: public class Test { public static void main(String ... args) { A a1 = new A(); B b1 = new B(); A a2 = new A(); B b2 = new B(); checkForZeroOrTwoRelations(a1, a2, b1, b2); a1.setB(b1); checkForZeroOrTwoRelations(a1, a2, b1, b2); b1.setA(a2); checkForZeroOrTwoRelations(a1, a2, b1, b2); b2.setA(a2); checkForZeroOrTwoRelations(a1, a2, b1, b2); b2.setA(null); checkForZeroOrTwoRelations(a1, a2, b1, b2); } private static void checkForZeroOrTwoRelations(A a1, A a2, B b1, B b2) { int i = 0; if(a1.getB() != null) i++; if(a2.getB() != null) i++; if(b1.getA() != null) i++; if(b2.getA() != null) i++; if(i != 0 &amp;&amp; i != 2) { throw new IllegalStateException(); } } }
has comment: http://stackoverflow.com/comment/42693620
has comment: http://stackoverflow.com/comment/42693332

http://stackoverflow.com/comment/42758778
type: Comment
has text: Just throw away useless libs.
type: QuestionComment
comment on: http://stackoverflow.com/q/27129732
score: 0

http://stackoverflow.com/a/27100145
answers question: http://stackoverflow.com/q/27100131
downvote count: 0
has comment: http://stackoverflow.com/comment/42704697
type: Answer
has comment: http://stackoverflow.com/comment/42704667
upvote count: 3
has body: The constructor of a sub-class (Bb in your case) must call a constructor of the super-class (Abc in your case) before executing its own constructor. This code : public Bb() { System.out.println("constructor B"); } Is equivalent to : public Bb() { super (); // calls the super-class constructor System.out.println("constructor B"); }
score: 3
has comment: http://stackoverflow.com/comment/42704734

http://stackoverflow.com/comment/42721019
comment on: http://stackoverflow.com/a/27100761
has text: No it is not . because I also saw this link but it is an old way to do this. with weka.jar new version it shoes FastVactors as depreciate. So this why i put this question here to get new answer. Thank for the answer. I'm looking forward better ona
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42756170
score: 1
comment on: http://stackoverflow.com/q/27128470
has text: the problem may be in the method generating the random values.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27107133
favorite count: 0
linked to: http://stackoverflow.com/q/7812745
has answer: http://stackoverflow.com/a/54440458
type: UnansweredQuestion
score: 13
tagged with: spring
upvote count: 13
tagged with: java
has answer: http://stackoverflow.com/a/27108223
type: Question
has body: I have a @Service annotated class which provides core functionality which I can use in all my projects: @Service public class MyService {} and another one which extends it to implement project specific stuff: @Service public class ExtendedMyService extends MyService {} Now I would like to configure a bean alias to be able to use @Qualifier("MyServiceAlias") when autowiring it using a property: # MyService qualifier (default: myService) myService.qualifier=extendedMyService In XML it would look like: &lt;alias name="${myService.qualifier}" alias="MyServiceAlias" /&gt; It is also discussed here, but I need to do it w/o XML, JavaConfig only. Is it possible and how to realize?
tagged with: dependency-injection
linked to: http://stackoverflow.com/q/54938127
answer count: 3
has answer: http://stackoverflow.com/a/28988342
tagged with: spring-bean
downvote count: 0
has title: Spring Bean Alias in JavaConfig

http://stackoverflow.com/comment/42541773
has text: Can you show what the `fetchMoreMedia` method does that requires synchronization? Also, if you aren't using the blocking methods, use a `ConcurrentLinkedQueue` instead, as you don't need `take()` and `put()`
score: 0
comment on: http://stackoverflow.com/q/26993350
type: Comment
type: QuestionComment

restful-architecture
type: Tag
tag name: restful-architecture
tags question: http://stackoverflow.com/q/27009549

http://stackoverflow.com/q/27137067
has comment: http://stackoverflow.com/comment/42773363
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42772369
favorite count: 0
tagged with: nullpointerexception
tagged with: while-loop
has title: Zip4j Library ZipFile.setPassword() method throws NullPointerException on non-null input
has comment: http://stackoverflow.com/comment/42772672
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/42773015
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/42773178
has comment: http://stackoverflow.com/comment/42772500
tagged with: java
has body: I'm looping a buffered reader to pull lines from a dictionary, add them to an ArrayList, and then run them later in the program. Throughout this 15,000,000 line dictionary, blank lines come up about once every 30,000 lines. I don't expect all users of this program to use the dictionary I include, and I don't want to manually pick out and erase each blank line. When the program encounters this line, it throws a pesky NullPointerException, killing the program immediately. I've tried adding a try/catch to add the line if it's not blank and pass over a line that is null using continue. As always, here's my code: String line; if ((line = br.readLine()) != null) { try{ passwordArray.add(line); System.out.println(line); } catch(NullPointerException npe){ System.out.println("The line is null."); continue; } } Stack Trace: Exception in thread "main" java.lang.NullPointerException at net.lingala.zip4j.core.ZipFile.setPassword(ZipFile.java:650) at zZipCracker.zZipCracker.zZipCracker(zZipCracker.java:96) at zZipCracker.zZipCracker.main(zZipCracker.java:55) Line 96: zipper.setPassword((String) passwordArray.get(0)); Looking at line 96, the blank line is being added and cannot run because the library I'm using requires a password that's length is greater than 0. Line 55 is just a call to the method where this entire process is completed.
has comment: http://stackoverflow.com/comment/42773245
has answer: http://stackoverflow.com/a/27137596
tagged with: loops
has comment: http://stackoverflow.com/comment/42773152
has comment: http://stackoverflow.com/comment/42772869
type: Question

class
tags question: http://stackoverflow.com/q/27060999
tags question: http://stackoverflow.com/q/27094397
tags question: http://stackoverflow.com/q/27052199
tags question: http://stackoverflow.com/q/27095847
tags question: http://stackoverflow.com/q/27098560
tags question: http://stackoverflow.com/q/27045425
tags question: http://stackoverflow.com/q/27139583
tags question: http://stackoverflow.com/q/27078224
tags question: http://stackoverflow.com/q/27012815
tags question: http://stackoverflow.com/q/27141455
tags question: http://stackoverflow.com/q/27090362
tags question: http://stackoverflow.com/q/27096561
tags question: http://stackoverflow.com/q/27067089
tags question: http://stackoverflow.com/q/27026976
tags question: http://stackoverflow.com/q/27092343
tags question: http://stackoverflow.com/q/27136812
tags question: http://stackoverflow.com/q/27078345
tags question: http://stackoverflow.com/q/27025186
tags question: http://stackoverflow.com/q/27088168
tags question: http://stackoverflow.com/q/27148454
tags question: http://stackoverflow.com/q/27022138
tags question: http://stackoverflow.com/q/27132539
type: Tag
tags question: http://stackoverflow.com/q/27050344
tags question: http://stackoverflow.com/q/26996207
tags question: http://stackoverflow.com/q/27092608
tags question: http://stackoverflow.com/q/27025141
tag name: class
tags question: http://stackoverflow.com/q/27055562
tags question: http://stackoverflow.com/q/27004190
tags question: http://stackoverflow.com/q/27085567
tags question: http://stackoverflow.com/q/27016121
tags question: http://stackoverflow.com/q/27001709
tags question: http://stackoverflow.com/q/27023026
tags question: http://stackoverflow.com/q/27020392
tags question: http://stackoverflow.com/q/27132172
tags question: http://stackoverflow.com/q/27109680
tags question: http://stackoverflow.com/q/27070622
tags question: http://stackoverflow.com/q/26994158
tags question: http://stackoverflow.com/q/27036499
tags question: http://stackoverflow.com/q/27100474
tags question: http://stackoverflow.com/q/27137613

http://stackoverflow.com/comment/42562447
type: Comment
has text: I didn't test with `jersey-bundle.jar`. I just tested with the two dependencies you have posted in your pom.xml in your post. Try it with what you have in your original post
type: AnswerComment
comment on: http://stackoverflow.com/a/27016556
score: 0

http://stackoverflow.com/comment/42552110
has text: Figured it out! Updating w/ solution now!
comment on: http://stackoverflow.com/a/27012420
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42753309
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27126808
type: Comment
has text: I think, the standard Java way, as most starters need to grasp the meaning of 'this', is to call `this.attribute = attribute`. On Android, there is another coding policy proposed by Google: private attributes (members) get an 'm'-prefix. For example: `mAttribute = attribute`. But as you said, every company defines its own coding ruleset.

http://stackoverflow.com/comment/42717203
comment on: http://stackoverflow.com/q/27105160
type: Comment
type: QuestionComment
score: 0
has text: You shouldn't provide a `jdbcUrl` instead use `serverName` and `databaseName` properties.

http://stackoverflow.com/comment/42563165
has text: @BasilBourque Ok... so that's the deal. There were two problems. First one: Yes, in my machine Java expects a capital letter, on server not. Second one: I changed the Locale.setDefault to formatter.withLocale. I was using this before, but with Locale.forLanguageTag("pt_BR"). Like you said, the right way is new Locale("pt", "BR"). Now my code works on my laptop and on the server even if the first char is O or o. Thank you so much for your help. Thank you too Jon Skeet and RealSkeptic.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27002964
type: AnswerComment

http://stackoverflow.com/comment/42790956
score: 0
type: AnswerComment
has text: Yes, and it seems your value in fileToShare doesn't match the MediaStore.Video.VideoColumns.DATA.
type: Comment
comment on: http://stackoverflow.com/a/27145704

http://stackoverflow.com/comment/42534687
type: Comment
has text: @Alexanderalex So is your question really "How do I get JSch to use my ssh config so that the private key will be found automatically?"? If so, you might look at [this example](http://www.jcraft.com/jsch/examples/OpenSSHConfig.java.html)
comment on: http://stackoverflow.com/a/27001854
score: 0
type: AnswerComment

http://stackoverflow.com/q/27122988
upvote count: 7
tagged with: collections
has comment: http://stackoverflow.com/comment/42753322
has answer: http://stackoverflow.com/a/27124274
type: AnsweredQuestion
has body: I need your advice. For a start I would like to describe preconditions. I have some third party Java objects with default java.lang.Object's hashCode() and equals() implementation. Comparable interface is not implemented. The size is insignificant. I need to store such objects for some time in memory. I will read and write them from different threads in 50/50 ratio (approximately 50% reads and 50% writes). The order of the objects is not important. I just want to have possibility to take some object from the store, that's all. With take I mean both get and remove at the same time. Sure, I want it to work as fast as possible with lowest memory consumption. I'm trying to avoid any synchronizations in my code. First I've tried to solve this problem by myself. I've immediately rejected CopyOnWriteArray* collections due to high memory consumption. I've read it's better to use them in case of rare writes. ConcurrentHashMap in general suites for my needs but I didn't find way to make take operation atomic without synchronization. I've stopped with my investigation on ConcurrentSkipListSet collection. It contains pollFirst method which is pretty good suite to take objects. I've implemented my solution with ConcurrentSkipListSet as a basis. I've got everything works fine except one small detail. As I mentioned above objects I'm working with don't implement Comparable. So to use chosen collection I have to somehow implement Comparator. Here's my implementation of this interface. In this example I've used directly java.lang.Object instead of my objects type. I've done this 'cause implementation is completely the same, difference is only in generic part of the class. import java.util.Comparator; public class ObjectComparator implements Comparator&lt;Object&gt; { public int compare(Object o1, Object o2) { return o1.hashCode() - o2.hashCode(); } } Cons of this implementation is obvious. I've found there's no guarantee that two different objects will have different hash codes. In …
score: 7
tagged with: java
tagged with: concurrency
type: Question
possible better answer: http://stackoverflow.com/a/27124083
has comment: http://stackoverflow.com/comment/42746767
linked to: http://stackoverflow.com/q/1063068
downvote count: 0
has answer: http://stackoverflow.com/a/27124083
accepted answer: http://stackoverflow.com/a/27124274
has title: Concurrent collection to 50/50 read/write
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/27128533
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42748869

http://stackoverflow.com/comment/42774686
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27137447
has text: Amended the code with a check (and updated on the example above) - I seem to be stuck in an infinite loop of trying to get the root directory and not really getting down into the other directories
score: 0

http://stackoverflow.com/comment/42700195
comment on: http://stackoverflow.com/q/27096728
type: Comment
type: QuestionComment
has text: I have no idea why he deleted it. I wrote a comment on it about how the java documentation explicitly says you should avoid having wildcards as a return type. Can you explain me why you think the other answer was better then the current implementation? (the answer I am talking about had no cast and "<List ? extends Vehicles>" as the return type)
score: 0

macos
tags question: http://stackoverflow.com/q/27016659
tags question: http://stackoverflow.com/q/27031262
tags question: http://stackoverflow.com/q/27094492
tags question: http://stackoverflow.com/q/27045979
tags question: http://stackoverflow.com/q/27088960
tags question: http://stackoverflow.com/q/27115966
tags question: http://stackoverflow.com/q/27115390
tags question: http://stackoverflow.com/q/26995278
type: Tag
tags question: http://stackoverflow.com/q/27010668
tags question: http://stackoverflow.com/q/27072224
tags question: http://stackoverflow.com/q/27131272
tags question: http://stackoverflow.com/q/27083097
tags question: http://stackoverflow.com/q/27085849
tag name: macos
tags question: http://stackoverflow.com/q/27016400
tags question: http://stackoverflow.com/q/27026169

http://stackoverflow.com/comment/42590682
has text: There is no reason to do this.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27034569
type: AnswerComment

http://stackoverflow.com/q/27111769
favorite count: 0
has comment: http://stackoverflow.com/comment/42744562
has title: Out Of Memory with images in Android 5
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/42727806
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42727969
accepted answer: http://stackoverflow.com/a/27267095
tagged with: java
tagged with: image-processing
linked to: http://stackoverflow.com/q/26941509
type: Question
has comment: http://stackoverflow.com/comment/42727494
score: 5
has body: My app loading lot of images from network and decode it via BitmapFactory.decodeByteArray. But when the application is decoded many images throws error java.lang.OutOfMemoryError. So before i set flag inPurgeable = true in BitmapFactory.Options and this error will never not bother me. In Android 5 field BitmapFactory.Options.inPurgeable is deprecated and java.lang.OutOfMemoryError is thrown again after decoding a large amount of images. What I should use in Android 5 to avoid this error? EDIT: My code: BitmapFactory.Options options = new BitmapFactory.Options(); options.inPurgeable = true; bitmap = BitmapFactory.decodeByteArray(buffer.toByteArray(), 0, buffer.length(), options); It all. This works fine on Android 4 or less. Stacktrace on Android 5: 11-24 22:40:06.738: E/AndroidRuntime(19216): FATAL EXCEPTION: AsyncTask #3 11-24 22:40:06.738: E/AndroidRuntime(19216): java.lang.RuntimeException: An error occured while executing doInBackground() 11-24 22:40:06.738: E/AndroidRuntime(19216): at android.os.AsyncTask$3.done(AsyncTask.java:300) 11-24 22:40:06.738: E/AndroidRuntime(19216): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 11-24 22:40:06.738: E/AndroidRuntime(19216): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 11-24 22:40:06.738: E/AndroidRuntime(19216): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 11-24 22:40:06.738: E/AndroidRuntime(19216): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 11-24 22:40:06.738: E/AndroidRuntime(19216): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 11-24 22:40:06.738: E/AndroidRuntime(19216): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-24 22:40:06.738: E/AndroidRuntime(19216): at java.lang.Thread.run(Thread.java:818) 11-24 22:40:06.738: E/AndroidRuntime(19216): Caused by: java.lang.OutOfMemoryError: Failed to allocate a 1638412 byte allocation with 326188 free bytes and 31…
upvote count: 5
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27267095

http://stackoverflow.com/a/27086122
answers question: http://stackoverflow.com/q/27084579
downvote count: 0
type: Answer
has body: Rather than putting a semaphore on the Philosopher, I suggest putting a semaphore on the Chopstick; the Philosopher calls acquire on the left and right chopsticks' semaphores and releases the chopsticks' semaphores when done. This would replace the ReentrantLock on the Chopstick. To prevent deadlock, you can use tryAcquire(int permits, long timeout, TimeUnit unit) so that a Philosopher releases its left chopstick's semaphore if it fails to acquire its right chopstick's semaphores within a timeout; if you use a random timeout (e.g. between 100 and 500 milliseconds) then each Philosopher should eventually make progress. Edit: Your new Chopstick code runs the risk of deadlock - all philosophers pick up their left chopstick and then wait forever for their right chopstick to be free. A tryAcquire will allow a philosopher to release its left chopstick if it can't acquire its right chopstick after a timeout, which will allow the philosopher to its left to proceed. class ChopStick{ private static Random random = new Random(); // initialize with one permit private Semaphore sem = new Semaphore(1); public boolean pickUp(){ try { // wait between 100 and 500 milliseconds return sem.tryAcquire(1, random.nextInt(400) + 100, TimeUnit.MILLISECONDS); } catch(InterruptedException e) { return false; } } public void putDown(){ sem.release(); } } class Philosopher extends Thread { public void run() { while(true){ think(phil); doEat(); } private void doEat() { if(ch1.pickup()) { if(ch2.pickup()) { eat(phil); ch1.release(); ch2.release(); else { ch1.release(); doEat(); } else { doEat(); } } }
score: 4
has comment: http://stackoverflow.com/comment/42688330
upvote count: 4
has comment: http://stackoverflow.com/comment/42683760

http://stackoverflow.com/a/51976158
score: 0
has body: Lets say the Activity holding the fragment is MainActivity. Do MainActivity main = (MainActivity)getActivity(); //You can access all public variable and methods of MainActivity. //simply call main.setSupportActionBar(toolbar) main.getSupportActionBar.setTitle("title");
has comment: http://stackoverflow.com/comment/108439584
type: Answer
answers question: http://stackoverflow.com/q/27030183

http://stackoverflow.com/q/27030831
type: Question
score: 0
answer count: 1
tagged with: jsp
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
tagged with: java
has title: How to read a string as an HTML code from a Java file to a JSP page?
has answer: http://stackoverflow.com/a/27031031
accepted answer: http://stackoverflow.com/a/27031031
has body: I am creating a simple web application program (uses JSP) wherein users can add, update, and delete an employee record. In adding a new record, user is not allowed to enter null values of last and given names. An error message will be displayed if user attempts to add record with a null value. Error messages are generated from String in a Java file (action). However, the String contains HTML tags. They are not read as an HTML code, but as HTML entities. Here is the method from my action Java file, which generates the error message: final static String SUCCESS_MSG = "New record has been added successfully."; final static String ERROR_MSG = "Not valid. "; public String addEmployee() throws Exception { logger.info("addEmployee method called"); if (!this.employee.getLastname().isEmpty() && !this.employee.getFirstname().isEmpty()) { this.employeeManager.addEmployee(this.employee); addActionMessage(SUCCESS_MSG); return SUCCESS; } else { addActionError(ERROR_MSG + (this.employee.getFirstname().isEmpty() ? "First name" : this.employee.getLastname().isEmpty() ? "Last name" : "First and last names") + " is null."); return ERROR; } } Here is from my JSP file, where the messages will be displayed: <s:if test="hasActionMessages()"> <s:actionmessage /> </s:if> <s:if test="hasActionErrors()"> <s:actionerror /> </s:if> And here is the output: view image here. I checked the HTML source code. Less and greater than in the HTML tags were converted to HTML entities. Not valid. First name

http://stackoverflow.com/comment/77419729
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27034897
has text: Can you create the array on a server and have the Java code in your android app request it via HTTP?

http://stackoverflow.com/comment/43519201
comment on: http://stackoverflow.com/q/27146549
score: 0
type: Comment
type: QuestionComment
has text: WarPackaging NullPointerException error was solved and will be available on 1.3.1.RC2 https://github.com/spring-projects/spring-roo/commit/f23fcf5f8184c1466575d0450bc5e13b98a2c961

http://stackoverflow.com/comment/42757182
comment on: http://stackoverflow.com/q/27128957
has text: Please include the entire stack trace of the exception in your question, including any 'Caused by' parts.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42598543
type: QuestionComment
comment on: http://stackoverflow.com/q/27039525
has text: @HareshChhelana in Helper class : String query = "CREATE TABLE" +TABLE_NAME + "( " + KEY_ID+ "INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_PLACENAME+ "TEXT, "+KEY_LATITUDE+ "REAL, "+KEY_LONGITUDE+ "REAL)";
score: 0
type: Comment

http://stackoverflow.com/q/27070937
tagged with: javafx
has body: So I installed at centos 6.4 openjdk 8, netbeans 8 and build openjfx. The only thing I can't uderstand is how to make netbeans work with built openjfx sdk. As openjdx sdk is in folder /temp while jdk is in /usr/lib/jvm/java-8... I can't undertand how to add openjfx to netbeans as everywhere people say that jfx is already in jdk. So, what now should I do to make all these work together?
has comment: http://stackoverflow.com/comment/42654850
type: Question
accepted answer: http://stackoverflow.com/a/27071309
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27071309
linked to: http://stackoverflow.com/q/22514310
linked to: http://stackoverflow.com/q/18547362
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
tagged with: centos
tagged with: linux
has title: Linux (centos), openjdk 8, openjfx and netbeans 8
type: AnsweredQuestion
tagged with: netbeans

http://stackoverflow.com/q/27115636
favorite count: 0
score: 0
has title: Android crashes on performing HttpGet request
accepted answer: http://stackoverflow.com/a/27115945
possible better answer: http://stackoverflow.com/a/27115830
tagged with: android
has body: I have a problem on reading XML response from Http Url in android , although that I tried the same code in Java (eclipse) it worked but on the android device it crashes. The code : try { URL url = new URL(link); HttpURLConnection request1 = (HttpURLConnection) url.openConnection(); request1.setRequestMethod("GET"); request1.connect(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } LogCat : 11-25 01:11:28.853: D/AndroidRuntime(3600): Shutting down VM 11-25 01:11:28.853: W/dalvikvm(3600): threadid=1: thread exiting with uncaught exception (group=0x41832da0) 11-25 01:11:28.863: E/AndroidRuntime(3600): FATAL EXCEPTION: main 11-25 01:11:28.863: E/AndroidRuntime(3600): Process: com.example.qbuster, PID: 3600 11-25 01:11:28.863: E/AndroidRuntime(3600): java.lang.IllegalStateException: Could not execute method of the activity 11-25 01:11:28.863: E/AndroidRuntime(3600): at android.view.View$1.onClick(View.java:3969) 11-25 01:11:28.863: E/AndroidRuntime(3600): at android.view.View.performClick(View.java:4637) 11-25 01:11:28.863: E/AndroidRuntime(3600): at android.view.View$PerformClick.run(View.java:19422) 11-25 01:11:28.863: E/AndroidRuntime(3600): at android.os.Handler.handleCallback(Handler.java:733) 11-25 01:11:28.863: E/AndroidRuntime(3600): at android.os.Handler.dispatchMessage(Handler.java:95) 11-25 01:11:28.863: E/AndroidRuntime(3600): at android.os.Looper.loop(Looper.java:136) 11-25 01:11:28.863: E/AndroidRuntime(3600): at android.app.ActivityThread.main(ActivityThread.java:5586) 11-25 01:11:28.863: E/AndroidRuntime(3600): at java.lang.reflect.Method.invokeNative(Native Method)
tagged with: xmlhttprequest
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42734239
has comment: http://stackoverflow.com/comment/42734341
upvote count: 1
has comment: http://stackoverflow.com/comment/42734407
tagged with: http
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27115945
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27115830

http://stackoverflow.com/comment/42577245
comment on: http://stackoverflow.com/a/27026499
type: AnswerComment
type: Comment
has text: nice pretty useful info, this is only for maven3 correct?
score: 0

http://stackoverflow.com/comment/42657087
type: Comment
comment on: http://stackoverflow.com/a/27051504
type: AnswerComment
has text: Call `repaint` on the applet. You could use some kind of `Timer` or background `Thread`
score: 0

http://stackoverflow.com/a/26998218
accepted answer of: http://stackoverflow.com/q/26998091
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42527519
upvote count: 2
answers question: http://stackoverflow.com/q/26998091
type: AcceptedAnswer
downvote count: 0
has body: You can use this /newAction.action

http://stackoverflow.com/q/27069179
accepted answer: http://stackoverflow.com/a/27069710
has comment: http://stackoverflow.com/comment/42651421
score: 0
has comment: http://stackoverflow.com/comment/42651570
possible better answer: http://stackoverflow.com/a/27071894
has body: My Code: private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); public void beepForAnHour() { scheduler.scheduleWithFixedDelay(new ExampleThread(), 1L, 1L, SECONDS); } private static class ExampleThread implements Runnable { @Override public void run() { System.out.println("1:"+System.currentTimeMillis()); try { Thread.sleep(5000L); } catch(InterruptedException e) { e.printStackTrace(); } System.out.println("2:"+System.currentTimeMillis()); } } Example of the result will be: 1:1416599026988 2:1416599031988 1:1416599032989 2:1416599037989 1:1416599038990 I have got no idea, what should be changed in the code, so next ExampleThread will be started after 1 Second since start of the previous Thread and not since its finish. Sleep thing is just an example to show my problem. So the result i would like to see would be: 1:1416599026988 1:1416599027988 1:1416599028988 1:1416599029988 1:1416599030988 2:1416599030988 1:1416599031988 2:1416599031988 1:1416599032988 2:1416599033988
has answer: http://stackoverflow.com/a/27071894
tagged with: scheduled-tasks
tagged with: multithreading
has title: Start next Thread before previous finishes its work
has answer: http://stackoverflow.com/a/27069710
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/42554897
type: Comment
type: QuestionComment
has text: Your code is not thread safe. Therefore the value of `number` may not match the number of constructor calls minus the number of finalize calls. Try to modify `number` in a synchronized method, or change its type to AtomicInteger and see what happens.
comment on: http://stackoverflow.com/q/27014430
score: 0

http://stackoverflow.com/a/27081755
downvote count: 0
has comment: http://stackoverflow.com/comment/42672999
has comment: http://stackoverflow.com/comment/42673819
has comment: http://stackoverflow.com/comment/42674835
type: Answer
has comment: http://stackoverflow.com/comment/42674910
has comment: http://stackoverflow.com/comment/42673860
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42673053
has body: The error "Could not find main class" has nothing to do with the way you are using the File or Scanner class. It sounds like your classpath is wrong. Ensure that your project root is configured correctly. You could try to use this tutorial for using Eclipse for a reference on how to set up your project correctly. If you are not using an IDE, check out the contents of the file you are running and make sure the correct information is in there. It would help a lot if you could specify your question a lot more such as which operating system are you using, are you using an IDE (if yes, which one), are you compiling it as a jar file or are you running it from a directory with class files... etc.
has comment: http://stackoverflow.com/comment/42673134
has comment: http://stackoverflow.com/comment/42674938
answers question: http://stackoverflow.com/q/27081440

http://stackoverflow.com/comment/42731439
score: 0
comment on: http://stackoverflow.com/q/27114001
type: Comment
type: QuestionComment
has text: Then it just looks like some verbose (but not important) Tomcat warning or debug status message. I wouldn't worry too much about it, except for academic curiosity. Maybe Spring's class scanner is looking for a default constructor on @Service annotated classes or something (not a cause for concern). It does not seem to indicate a problem with your code. What version of Tomcat are you using, what version of the JRE are you using, and what version of the JDK did you compile with?

http://stackoverflow.com/comment/42959125
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27150645
has text: hi where should i put this code? What i mean on my first question is that the score only adds correctly 3 times(upon finding each word) @DvirItzko
type: Comment

http://stackoverflow.com/comment/42685032
score: 0
type: Comment
has text: I think that such kind of errors is reported by Lint tool
comment on: http://stackoverflow.com/a/27088754
type: AnswerComment

http://stackoverflow.com/comment/42545834
comment on: http://stackoverflow.com/q/27008786
score: 0
has text: Are you required to use a regex? You could use File.getCanonicalPath() instead. I am not sure why you say File.isAbsolute() is not platform independent. In fact, it sounds like you want a method for Windows machines (platform dependent), rather than platform-independent.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42786993
has text: it is not solved, but your solution was syntactically correct and thus the problem/errors in my program must lie elsewhere
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27123120

http://stackoverflow.com/comment/42796992
score: 0
comment on: http://stackoverflow.com/q/27151177
has text: http://www.java2s.com/Code/Java/Event/KeyStroketoString.htm or http://jexp.ru/index.php/Java_Tutorial/Swing_Event/KeyStroke
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42721885
has text: @Carnal : A JSON array doesn't have to have syntax [{}] - it simply meeds to be a comma-delimited list of JSON values bounded by []
score: 1
comment on: http://stackoverflow.com/a/27109096
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42720379
type: Comment
has text: i've done exactly as instructed above but what happens is, when i click submit it does not return qFour but rather returns addQuestion (i.e. the page it is currently on) and so it wipes out all the current inputs. do you know why? or what i've done wrong?
score: 0
comment on: http://stackoverflow.com/a/27106383
type: AnswerComment

http://stackoverflow.com/q/27127199
has answer: http://stackoverflow.com/a/72608130
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42753854
has answer: http://stackoverflow.com/a/27127367
answer count: 6
has answer: http://stackoverflow.com/a/27127397
has answer: http://stackoverflow.com/a/27127264
has answer: http://stackoverflow.com/a/27127482
favorite count: 0
has body: How can I use a variable from another file? I am writing automation tests (Selenium and TestNG). I want to store some data variables and xpaths in a separate file (secondFile.java) Master File: import secondFile.help; public class TicketAdminTestSuite extends something { void printStuff(){ System.out.println(bar); } } ============================================== Helper file (name: help.java): public class help { public static final String bar = "blah"; }
type: UnansweredQuestion
score: 2
downvote count: 0
has title: Java- use a variable from another file
has comment: http://stackoverflow.com/comment/42754137
has answer: http://stackoverflow.com/a/27127465
tagged with: java
has comment: http://stackoverflow.com/comment/42753925

http://stackoverflow.com/comment/42793468
has text: @Konard I am not saying it might be beneficial but it might be more meaningful/practical to use reference. e.g. Clients need not know if the method is static/non-static while using them as Static members can be called from both the static & non-static context.
comment on: http://stackoverflow.com/a/27147854
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27032035
has comment: http://stackoverflow.com/comment/42586013
score: 0
answers question: http://stackoverflow.com/q/27031910
type: Answer
has body: To clear the animation from any view you can use view.clearAnimation() Provide your complete code for more clearification.

http://stackoverflow.com/comment/42553111
score: 0
has text: what is onCreate(ViewAllPatientActivity.java:45) in this line....................
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27013489

http://stackoverflow.com/a/27137071
type: AcceptedAnswer
downvote count: 0
has body: As found out in the chat, the problematic line is this: rg.setReportDescr(reportDescr); As I assumed in the comments before, this is a standard setter method which will overwrite the old data with the new one. Therefore the last remaining data is the last element of the list: public void setReportDescr(String reportDescr) { this.reportDescr = reportDescr; } An easy way to fix this, is to pass the whole list to the ReportGroup instance: List&lt;String&gt; reportDescriptions=listDir(folder); rg.setReportDescriptions(reportDescriptions); // changed method name a bit rg.setReportList(reportList); reportGroupList.add(rg); In the class ReportGroup, the line String reportDescr; should be changed to: List&lt;String&gt; reportDescr; And the getter and setter methods should be changed accordingly: public List&lt;String&gt; getReportDescriptions() { // changed method name a bit return reportDescr; } public void setReportDescriptions(List&lt;String&gt; reportDescr) { // changed method name a bit this.reportDescr = reportDescr; }
has comment: http://stackoverflow.com/comment/42806326
accepted answer of: http://stackoverflow.com/q/27135488
has comment: http://stackoverflow.com/comment/42772344
type: Answer
has comment: http://stackoverflow.com/comment/42803188
has comment: http://stackoverflow.com/comment/42802906
score: 2
has comment: http://stackoverflow.com/comment/42805395
upvote count: 2
has comment: http://stackoverflow.com/comment/42808409
has comment: http://stackoverflow.com/comment/42772722
answers question: http://stackoverflow.com/q/27135488

http://stackoverflow.com/comment/42971655
type: Comment
has text: If the `ClassLoader` refuses to work when an agent has been specified on the command line, simply attach the agent at a later time. `ClassLoader`s are not asked whether they like `Instrumentation` or not, thus they can’t prevent it.
type: QuestionComment
comment on: http://stackoverflow.com/q/27115371
score: 0

http://stackoverflow.com/a/26998105
answers question: http://stackoverflow.com/q/26997893
has comment: http://stackoverflow.com/comment/42526708
type: AcceptedAnswer
downvote count: 0
has body: All graphics operations should be done on the UI thread. To accomplish this, you should use a SwingTimer class Painter implements ActionListener () { int step = 0; Timer = this.timer; public void actionPerformed(ActionEvent ae) { if (step &gt; ...) timer.stop(); switch (step) { case 0 : ... ; break; case 1 : ... ; break; } step = step + 1; } } Timer timer = new Timer(new Painter(), 500);
type: Answer
accepted answer of: http://stackoverflow.com/q/26997893
score: 2
upvote count: 2

http://stackoverflow.com/comment/42739253
score: 0
comment on: http://stackoverflow.com/q/27118183
type: Comment
type: QuestionComment
has text: It has nothing to do with school/homework, but showing your efforts always helps. It also forces you to focus your mind on the problem to a much greater degree than if you didn't first give it a try. I really think that it makes a difference in how we learn.

http://stackoverflow.com/a/33701603
answers question: http://stackoverflow.com/q/27048981
score: 0
type: Answer
has body: Hadoop's streaming tool supports mapping files from HDFS. Here's an example: hadoop jar ./share/hadoop/tools/lib/hadoop-streaming-2.7.1.jar \ -files hdfs://host:port/user/&lt;hadoop_username&gt;/code/mapper.py,hdfs://host:port/user/&lt;hadoop_username&gt;/code/reducer.py \ -Dmapred.reduce.tasks=1 \ -input text/* \ -output text/output \ -mapper code/mapper.py \ -reducer code/reducer.py Note that mapping files is still necessary. Here I use -files as -file is deprecated.

http://stackoverflow.com/comment/42715755
comment on: http://stackoverflow.com/q/27102495
score: 0
type: QuestionComment
has text: I don't see any transaction in your code. Also you will run into an infinite loop as `object2.getParents().get(0)` does not remove the element from the collection and therefore runs endlessly.
type: Comment

http://stackoverflow.com/q/27035911
has answer: http://stackoverflow.com/a/27036147
favorite count: 0
type: UnansweredQuestion
score: -2
answer count: 4
has answer: http://stackoverflow.com/a/27036162
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42592465
has answer: http://stackoverflow.com/a/27036184
has comment: http://stackoverflow.com/comment/42592898
has comment: http://stackoverflow.com/comment/42592660
has body: public static void addItem() { boolean items = false; System.out.println("Enter item name"); item = sc.nextLine(); while (item.equalsIgnoreCase("")) { item = "unknown"; } System.out.println("Enter item type"); itemType = sc.nextLine(); while (!itemType.equalsIgnoreCase("yes") &amp;&amp; !itemType.equalsIgnoreCase("no") &amp;&amp; !itemType.equalsIgnoreCase(null)) { System.out.println("Please enter yes or no only"); itemType = sc.nextLine(); } if (itemType.equalsIgnoreCase("yes")) items = true; else if (itemType.equalsIgnoreCase("no")) items = false; if (itemList.addItem(new Item(item, itemType))) System.out.println("Item added successfully\n"); else System.out.println("Shop is full\n"); } My itemList class public boolean addItem(Item anItem) { // if the array is full, return false // if the array is not full, add the item to the array and // increment counter if (count == items.length) { return false; } else { items[count] = anItem; count++; return true; } } What are the possible ways for me to add System.out.println("Shop is full") at the start whenever my array is full and new data can be added when my array is not full? What I have tried was the shop is full will be displayed in the end whenever my array is full, however, I want it to be displayed in the beginning instead of in the end. Any help here?
type: Question
has title: Java Set array to full
has comment: http://stackoverflow.com/comment/42592357
tagged with: arrays
has answer: http://stackoverflow.com/a/27036141
has comment: http://stackoverflow.com/comment/42592608
upvote count: 0
has comment: http://stackoverflow.com/comment/42592312

http://stackoverflow.com/q/27084299
answer count: 0
has comment: http://stackoverflow.com/comment/42678515
score: 0
tagged with: java
tagged with: jtextpane
tagged with: swing
has comment: http://stackoverflow.com/comment/42680034
type: Question
has title: Syntax highligting on specific keywords
linked to: http://stackoverflow.com/q/19399904
has comment: http://stackoverflow.com/comment/42680289
type: UnansweredQuestion
has body: I am trying to make a little editor and I need some syntax highlighting on some specific keywords. I hope you will have the patience to look through this. I want to highlight just the word from the .txt file in my JTextPane. I need a way to solve this and hope you can point me to the right direction. I started by making this .txt file: if else echo return global for Reading the .txt file here and also do some checking: import javax.swing.text.DefaultStyledDocument; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; /** * Created by Ilhami on 22-11-2014. */ public class SyntaxHighlighter { final static Charset ENCODING = StandardCharsets.UTF_8; private List&lt;String&gt; lines; public SyntaxHighlighter() { try { lines = readFile("keywords.txt"); } catch(IOException e) { e.getStackTrace(); } } public boolean keywordMatch(List&lt;String&gt; lines, String word) throws IOException { boolean isTrue = false; for(String item : lines) { if(!item.isEmpty() &amp;&amp; !word.isEmpty()) { if(item.equals(word)) { return isTrue = true; } } } return isTrue; } public List&lt;String&gt; readFile(String file) throws IOException { Path path = Paths.get(file); return Files.readAllLines(path, ENCODING); } public List&lt;String&gt; getLines() { return this.lines; } } I have tried something but I keep getting an exception when I type something in my JTextPane(yeah I am using Swing, not sure if that's a good idea). Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Attempt to mutate in notification at javax.swing.text.AbstractDocument.writeLock(AbstractDocument.java:1338) at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:658) at javax.swing.JTextPane.replaceSelection(JTextPane.java:192) at javax.swing.JTextPane.replaceSelection(JTextPane.java:175) at Editor$MyDocumentListener.a…
tagged with: editor

http://stackoverflow.com/comment/42677632
type: AnswerComment
score: 0
has text: I managed to add the library correctly and then the code wouldn't run after a message popped up informing me the 'main' method couldn't be located. If I start a new project and I copy/paste everything into the new project then no problems...thanks for your help nevertheless.
type: Comment
comment on: http://stackoverflow.com/a/27083425

http://stackoverflow.com/a/27090127
score: 0
has body: Your menu item doesn't have the android.widget.SearchView action class assigned to it, and therefore you get null from the getActionView() call. Basically, you're missing the code equivalent of the android:actionViewClass attribute from this example in the Android docs. You can use the setActionView method of MenuItem to add it. Another thing: you're not really supposed to just make up ID numbers in code, because the resource system can't prevent number clashes that way. You'll want to put a &lt;item type="id" name="menu_search"/&gt; in one of your values XML files and replace the all the 1s by R.id.menu_search.
type: Answer
answers question: http://stackoverflow.com/q/27089410

http://stackoverflow.com/comment/42666528
type: QuestionComment
comment on: http://stackoverflow.com/q/27076077
type: Comment
has text: I don't think "the VM" has to check the types to call the right overloaded method -- I think the compiler does that. Java is a strongly typed language (still, mostly, and at least for the time being); when a statement making a call is compiled, the compiler looks at the types and determines which method matches those types, then fashions a call that uses the correct place out of the jump table to match them. [BTW, Without numbers, or a user experience, or something specific that needs speeding up, the chances of speeding up the right things are small.]
score: 0

http://stackoverflow.com/q/27072751
has answer: http://stackoverflow.com/a/27072765
has comment: http://stackoverflow.com/comment/42657662
type: Question
score: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/25706216
answer count: 3
tagged with: uppercase
has body: I'm working on a Pig Latin method and now I'm trying to do the if-else statement: if Start word is capitalized, lowercase Start and uppercase End. This is so if a word is at the beginning of a sentence or is just capitalized in general (Ex. John), the Pig Latin will capitalize the first letter when translating (Ex. Ohnjay). I cannot figure out why my code won't work, maybe I'm not storing values correctly... I admit straight out>> this is for a homework assignment, if you don't like, don't answer&lt;&lt; Thanks for any help! else if (vowel &gt; 0) { Start = Input.substring(0, vowel); End = Input.substring(vowel); char StartFirstLetter = Start.charAt(0); char EndFirstLetter = End.charAt(0); if (Character.isUpperCase(StartFirstLetter) == true) { End = Character.toUppercase(EndFirstLetter); } else { Result = End + Start +"ay "; } here's the error: StringUtil.java:175: error: cannot find symbol End = Character.toUppercase(EndFirstLetter); ^ symbol: method toUppercase(char) location: class Character 1 error
has title: Cannot find symbol - method: toUppercase(char)?
type: UnansweredQuestion
tagged with: cannot-find-symbol
linked to: http://stackoverflow.com/q/25706216
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27072777
has answer: http://stackoverflow.com/a/27072801
tagged with: java

bufferunderflowexception
type: Tag
tag name: bufferunderflowexception
tags question: http://stackoverflow.com/q/27044010

http://stackoverflow.com/a/27004951
has body: Call keyboard.nextLine() after age = keyboard.nextInt();. Currently int value is read as age and college = keyboard.nextLine(); reads the remainder of the line which container your int, which is empty. So the correct form should be: // Get age System.out.print("What is your age? "); age = keyboard.nextInt(); keyboard.nextLine(); // Get college System.out.print("What college do you attend? "); college = keyboard.nextLine(); Other possible solution to avoid the extra call to nextLine() is reading the whole line as a String and then parsing that String to an integer, for example: age = Integer.parseInt(keyboard.nextLine());
score: 2
answers question: http://stackoverflow.com/q/27004833
has comment: http://stackoverflow.com/comment/42539514
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/42695275
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27090884
has text: He never said he was overriding `equals`, but overloading it.

http://stackoverflow.com/comment/42682899
comment on: http://stackoverflow.com/a/27087292
type: Comment
score: 0
type: AnswerComment
has text: are all variations of 0.9 and my example shows it to 1 precision

http://stackoverflow.com/comment/125939622
type: Comment
comment on: http://stackoverflow.com/a/62539026
has text: u can delete the screenshot
type: AnswerComment
score: 0

android-view
tags question: http://stackoverflow.com/q/27075984
tags question: http://stackoverflow.com/q/27074334
type: Tag
tag name: android-view

http://stackoverflow.com/a/27068711
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27066966
has body: May be this is the way: run a task which will update the grid in some time interval so that there is no need to handle at java side. var updateGrid=function(){ grid.store.load(); } var task = Ext.TaskManager.start({ run: updateGrid, interval: 1000 });
type: Answer
accepted answer of: http://stackoverflow.com/q/27066966
has comment: http://stackoverflow.com/comment/42657247
has comment: http://stackoverflow.com/comment/42653173

http://stackoverflow.com/comment/42633618
comment on: http://stackoverflow.com/q/27058092
score: 0
type: Comment
type: QuestionComment
has text: @ShubhangMalviya,please check Sujit Thombare answer,very simple one.but there is one error in his code.if array value are 10,20,30,333,999,then giving wrong output.

http://stackoverflow.com/comment/42607027
score: 2
comment on: http://stackoverflow.com/q/27043945
type: Comment
has text: A safer thing yet would be to check if the char is valid rather than invalid. In other words check that it is alphabetical or a number or one of the 30 or so symbols you wish to allow
type: QuestionComment

http://stackoverflow.com/comment/42779318
comment on: http://stackoverflow.com/q/27140379
has text: You'll likely connect the Card with Image via an `EnumMap<Card, Icon>` or something similar, but it should not be part of the Model.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27021230
score: 1
has comment: http://stackoverflow.com/comment/42566882
type: Answer
has comment: http://stackoverflow.com/comment/42566840
upvote count: 1
answers question: http://stackoverflow.com/q/27020783
has body: The basic idea behind the GET and POST methods is that a GET message only retrieves information but never changes the state of the server. (Hence the name). As a result, just about any caching system will assume that you can remember the last GET response returned, and that the next one will look the same. A POST on the other hand is a request that sends new information to the server. So not only can these not be cached (because there's no guaruantuee that the next POST won't modify things even more; think +1 like buttons for example) but they actually have to invalidate parts of the cache because they might modify pages. As a result, your browser for example will warn you when you try to refresh a page to which you POSTed information, because you might make changes you did not want made by doing so. When GETting a page, it will not do so because you cannot change anything on the site by doing so. (Or rather; it's your job as a programmer to make sure that nothing changes when GETting a page.)
downvote count: 0

http://stackoverflow.com/q/27033954
has answer: http://stackoverflow.com/a/27034558
tagged with: jdbc
has body: I'm writing a tool used for transferring the data from old schema to new schema in oracle database. There are about twenty tables in my database. Only two of them are big, they may have four million records. Others are small ( maybe ten thousands or one hundred thousand). Now I use one thread to process all small tables in serially, and divide big table into pieces, create some thread, and use one thread process one piece, every piece is one million record. Now I have some problems. When I start the program, every is ok. But when my program run after a period of time, I will get some error info: Exception in thread "Thread-8" java.lang.OutOfMemoryError: GC overhead limit exceeded at oracle.jdbc.driver.OracleBlobInputStream.needBytes(OracleBlobInputStream.java:168) at oracle.jdbc.driver.OracleBufferedStream.readInternal(OracleBufferedStream.java:178) at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.java:147) at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.java:137) at oracle.jdbc.driver.BlobAccessor.getBytes(BlobAccessor.java:249) at oracle.jdbc.driver.OracleResultSetImpl.getBytes(OracleResultSetImpl.java:714) at oracle.jdbc.driver.OracleResultSet.getBytes(OracleResultSet.java:1625) at datatransfer.processor.CProcessor.write(CProcessor.java:111) at datatransfer.processor.Processor.process(Processor.java:77) at datatransfer.thread.CThread.run(CThread.java:37) I have checked my program, there is no closed loop, and I really close statement and resultset. Every Thread has its own Connection. How can I check the reason why my program cost memory? And is there any way to solve this problem? ResultSet rs = statement.executeQuery(sql); int count = 0; long start = System.currentTimeMillis(); while(rsSrc.next()){ preStatement.setString(1, rsSrc.getString(1)); preStatement.setString(2, rsSrc.getString(2)); preStatement.setString(3, rsSrc.getString(3)); preStatement.setString(4, rsSrc.getString(4)); preStatement.setString(5, rsSrc.getStr…
favorite count: 0
tagged with: out-of-memory
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/38378052
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/129913752
tagged with: prepared-statement
has comment: http://stackoverflow.com/comment/42589057
type: Question
has title: OutOfMemoryError GC overhead limit exceeded for java jdbc preparedStatement
downvote count: 0
has answer: http://stackoverflow.com/a/27034770
answer count: 3

http://stackoverflow.com/comment/42608844
comment on: http://stackoverflow.com/q/27045038
has text: That was my gut feeling as well, but I was unsure if reading the `HashMap` concurrently would have any unintended side effects.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27082270
answers question: http://stackoverflow.com/q/27081494
upvote count: 1
score: 0
downvote count: 1
type: Answer
has body: Perhaps it's not the easiest to use, but for the description that you gave I would go with the Java Graphics API, you can easily find examples on how to use it.

http://stackoverflow.com/comment/42574955
type: AnswerComment
has text: @JaKoZo I added that capability to the program.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27006327

http://stackoverflow.com/a/27044068
has body: Assuming there's such constructor Student(String, int), then you can try this: Student[] studentArray = { new Student("Sam", 21), new Student("Jules",3) };
accepted answer of: http://stackoverflow.com/q/27044031
answers question: http://stackoverflow.com/q/27044031
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42564182
has text: dont need to use a string, can be an id, another object or simply a count position... `Map<Integer, Object>`....
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27019417

http://stackoverflow.com/a/27116102
has body: the unless parameter for the &lt;fail&gt; command takes a property name, not a property value! fixed version: &lt;fail unless="appFile" message="No application with the name ${appName} is defined in your properties file." /&gt;
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27096850
answers question: http://stackoverflow.com/q/27096850

http://stackoverflow.com/comment/42929282
type: Comment
comment on: http://stackoverflow.com/q/27147857
score: 0
has text: Thanks Rupesh....still does the same thing I'm afraid. What I have noticed (if you look at the screenshot at the top) is that the 'ET Days In Stock' and 'Terminated Report: Completed' drop-downs work. But from 'Terminated Report: Pending' onwards they all behave in the same way in that they lose focus and go to the 'Collections: Breached Report' page
type: QuestionComment

http://stackoverflow.com/a/27022834
answers question: http://stackoverflow.com/q/27022788
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has body: Use enumerated types, for example public enum MyStringType { value1{ public String toString() { return "this is value1"; } }, value2{ public String toString() { return "this is value2"; } } /* etc etc */ }
accepted answer of: http://stackoverflow.com/q/27022788

enums
tags question: http://stackoverflow.com/q/27089438
tags question: http://stackoverflow.com/q/27065455
tags question: http://stackoverflow.com/q/27006174
tags question: http://stackoverflow.com/q/27096288
tags question: http://stackoverflow.com/q/27020324
tags question: http://stackoverflow.com/q/27027792
tags question: http://stackoverflow.com/q/27033524
tag name: enums
tags question: http://stackoverflow.com/q/27135177
tags question: http://stackoverflow.com/q/27109423
tags question: http://stackoverflow.com/q/27135132
tags question: http://stackoverflow.com/q/27026887
type: Tag
tags question: http://stackoverflow.com/q/27049465
tags question: http://stackoverflow.com/q/27124152
tags question: http://stackoverflow.com/q/27030332

http://stackoverflow.com/comment/42582661
comment on: http://stackoverflow.com/q/27029972
has text: Let me give you a piece of advice. Don't make fields and method static just so you could run your code inside the main method. If you don't have a legitimate reason to make fields and/or methods static, simply create an instance of your class inside the main method, and access them using the class instance. Also, follow naming conventions (i.e. class names should be capitalized). Also, is there a question somewhere in your post?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27023185
has comment: http://stackoverflow.com/comment/42570682
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42570453
type: AnsweredQuestion
has title: Why it is not possible to place type parameters after method name?
tagged with: java
has comment: http://stackoverflow.com/comment/42571490
has comment: http://stackoverflow.com/comment/42570548
has comment: http://stackoverflow.com/comment/42571204
type: Question
answer count: 2
score: -1
possible better answer: http://stackoverflow.com/a/27023635
has answer: http://stackoverflow.com/a/27023635
has answer: http://stackoverflow.com/a/27024482
has body: If fact, the question is: What problems may occure if it would be possible to place type parameters after method name? E.g.: import com.google.common.base.Predicate; static import com.google.common.base.Predicates.alwaysTrue; Predicate&lt;SomeType&gt; p = alwaysTrue&lt;SomeType&gt;(); Update: I know that you could pass type parameter this way: Predicate&lt;SomeType&gt; p = Predicates.&lt;SomeType&gt;alwaysTrue();
has comment: http://stackoverflow.com/comment/42571085
tagged with: generics
has comment: http://stackoverflow.com/comment/42570413
favorite count: 0
has comment: http://stackoverflow.com/comment/42570632
accepted answer: http://stackoverflow.com/a/27024482

http://stackoverflow.com/a/27150336
answers question: http://stackoverflow.com/q/27150278
score: 0
type: Answer
has body: You need to give a date as the argument for format not a String. First create a SimpleDateFormat to parse the string to a date then give the date object to the other SimpleDateFormat to format the date.

http://stackoverflow.com/comment/42786952
has text: So I should use Camel to make the OSGI bundles to deploy on ServiceMix, that will redirect messages to remote WS through routes. Am I right? thank you
type: AnswerComment
comment on: http://stackoverflow.com/a/27044096
score: 0
type: Comment

http://stackoverflow.com/q/27106865
has answer: http://stackoverflow.com/a/27106965
score: -1
upvote count: 0
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27107055
has answer: http://stackoverflow.com/a/27106938
has answer: http://stackoverflow.com/a/27106963
tagged with: java
has answer: http://stackoverflow.com/a/27107007
downvote count: 1
has title: I’m using Deserialization method to create an object getting Exception “NullPointerException”?
type: Question
has body: I was trying creating objects in four different ways for one class, however I can able to create objects in three ways. But whenever I’m using Deserialization method to create an object getting Exception “NullPointerException”.please let me know the possible ways to resolve that exception. below is the code. import java.io.InputStream; import java.io.ObjectInputStream; class Student{ private String name; public String getName(){ return name; } public void setName(String s){ name=s; } } public class TestEncaps implements Cloneable{ public void Testing(){ System.out.println("Testing is On Going"); } protected Object clone() throws CloneNotSupportedException { return (TestEncaps) super.clone(); } /** * @param args * @throws CloneNotSupportedException */ public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub Student s = new Student(); s.setName("Lakshmikantham"); System.out.println(s.getName()); TestEncaps te = new TestEncaps(); TestEncaps te1 = (TestEncaps) te.clone(); te1.Testing(); te.Testing(); try{ InputStream inputStream = null; ObjectInputStream inStream = new ObjectInputStream(inputStream); TestEncaps object4 = (TestEncaps) inStream.readObject(); object4.Testing(); }catch(Exception e){ e.printStackTrace(); }finally{ } } }

http://stackoverflow.com/q/27070745
has title: Apache Camel: Route contentof class(bean) to jms
has body: I have a map like: Map&lt;String, MyMessage&gt; map = new HashMap&lt;String, MyMessage&gt;(); After I do: MyMessage msg = new Message(); msg.setBody("Hello"); map.put("123", msg) It contains String-correlationId and object MyMessage MyMessage contains method class MyMessage { private String someBody; String getBody() { return someBody; } void setBody(String someBody) { this.someBody = someBody; } } I need to get object MyMessage from map(I can do this) and from Camel invoke getBody() to get String of some text from someBody and route to jms. How can I get content from MyMessagewith Camel when I will build the route(RouteBuilder()) in Camel and send it to jms (second part I know, how to send it to jms)???
tagged with: jms
type: UnansweredQuestion
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/27073358
type: Question
answer count: 1
score: 0

http://stackoverflow.com/q/27129310
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/42761704
score: 0
has body: I have big problems with autowiring in Spring MVC 4 and I already spent many hours on it. Found many solutions but nothing helps. I have Controller: @Controller public class PrintedBookController { @Autowired PrintedBookService pbookService; // interface @RequestMapping(value = "/pbook", method = RequestMethod.GET) public ModelAndView pbook() { return new ModelAndView("pbook", "command", new PrintedBookDTO()); } ... } Also have: PrintedBookService // this is interface PrintedBookServiceImpl // this is implementation of PrintedBookService in printedbookserviceimpl is: @Service @Transactional public class PrintedBookServiceImpl implements PrintedBookService { @Autowired private PrintedBookDAO pbookDao; @Autowired private BookDAO bookDao; @Autowired private LoanDAO loanDao; public void setPrintedBookDao(PrintedBookDAO pbookDao) { this.pbookDao = pbookDao; } .... } the daos in PrintedBookServiceImpl are interfaces The dao implementations look like this: public class PrintedBookDAOImpl implements PrintedBookDAO, GenericDAO<PrintedBook> { @PersistenceContext(unitName = "pbook-unit", type = PersistenceContextType.EXTENDED) private EntityManager em; .... } I have three modules library-lib(daos) library-service(services) library-web(spring mvc). Library mvc has controller xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="cz.fi.muni.pa165.library.web" /> <context:component-scan base-package="cz.fi.muni.pa165.service" /> <context:component-scan base-package="cz.fi.muni.pa165.dao" /> /WEB-INF/pages/ .jsp </beans> and web.xml Spring MVC Application mvc-dispatcher org.spri…
has answer: http://stackoverflow.com/a/27129442
type: UnansweredQuestion
tagged with: spring
tagged with: autowired
type: Question
tagged with: jakarta-ee
tagged with: spring-mvc
has title: Spring MVC autowiring bean throws nestedexception
has answer: http://stackoverflow.com/a/27129541

http://stackoverflow.com/q/27077671
downvote count: 2
has answer: http://stackoverflow.com/a/27077725
favorite count: 0
has answer: http://stackoverflow.com/a/27077714
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27077712
upvote count: 0
has answer: http://stackoverflow.com/a/27077777
has comment: http://stackoverflow.com/comment/42665718
tagged with: java
has answer: http://stackoverflow.com/a/27077774
type: Question
score: -2
has title: Creating a java Clock. increasing time
has body: I am creating a clock in Java. I have managed to do some very basic stuff and now i want to implement a function. If i set the time to i.e. 12:04:59 and use my timeTick Method it will increase the time with 1 second but the problem is it will say the time is 12:04:60 and it doesn't change to 12:05:00. I've been struggling a while now and i can't really find a solution to it. My code is below, i hope you can help me, public class Clock{ public int seconds; public int minutes; public int hours; public Clock ( int InsertSeconds, int InsertMinutes, int InsertHours){ seconds = InsertSeconds; minutes = InsertMinutes; hours = InsertHours; } public void timeTick(){ seconds = seconds + 1; } public String toString(){ return hours + ":" + minutes + ":" + seconds; } } I am not planning to use Imports because i am a beginner it would be great if we can keep it simple.

http://stackoverflow.com/q/27063121
tagged with: java
type: Question
tagged with: spring-security
has answer: http://stackoverflow.com/a/27109210
has title: Spring security UserDetailsService configuration
score: 0
answer count: 1
type: UnansweredQuestion
has body: I added a custom UserDetails and UserDetailsService class to my spring project and want to use them in combination with httpbasic. How can I configure spring to use my custom classes? My application.yml looks like this: security: basic: enabled: false require_ssl: false enable_csrf: false ignored: - /register/** - /acitivate/** headers: hsts: domain sessions: stateless UserDetailsService: @Service @Transactional(readOnly = true) public class UserDetailsServiceAdapter implements UserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { //... } } Do I have to define Beans, or is it possible to set it within my application.yml?
tagged with: spring
tagged with: spring-boot

http://stackoverflow.com/comment/43612984
comment on: http://stackoverflow.com/a/27091562
type: Comment
type: AnswerComment
has text: @HovercraftFullOfEels anyway, any idea for the downvote(whether you or someone else did it).
score: 0

http://stackoverflow.com/q/27104357
tagged with: cors
has answer: http://stackoverflow.com/a/27104597
tagged with: angularjs
has body: I have a Java application deployed under Glassfish 3.1.2.2 which uses jersey for serving rest services. The front end is written in angularjs. My web.xml is as follows: qpark rest service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.restfulservice.restful;org.codehaus.jackson.jaxrs 1 qpark rest service /restservice/* The front-end is running in another server (apache). When sending a request from the front-end Glassfish is responding with an error as follows: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. which is logic because front-end and back-end are served from different servers. In order to avoid this I configured a filter which adds Access-Control-Allow-Origin to the response header. This filter has to be registered at the web.xml as follows: Gateway Servlet com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.spi.container.ContainerResponseFilters com.filters.CrossOriginResourceSharingFilter 1 My problem is that I want to map also this second filter to every restservice. That is, I want to add something like this Gateway Servlet /restservice/* But this is not allowed. The question is how to add/combine/register these two filters in the web.xml
upvote count: 1
has title: Adding a filter to a Glassfish server
accepted answer: http://stackoverflow.com/a/27104612
favorite count: 0
tagged with: web.xml
downvote count: 0
tagged with: servlet-filters
has answer: http://stackoverflow.com/a/27104612
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27104597
answer count: 2

http://stackoverflow.com/comment/42716100
type: AnswerComment
type: Comment
has text: Apologiees - should be parent.FindElements(By.TagName("rect")).
score: 0
comment on: http://stackoverflow.com/a/27102879

http://stackoverflow.com/q/27049059
has comment: http://stackoverflow.com/comment/42615740
tagged with: compilation
has title: Unreachable code, compilation error vicious circle
upvote count: 3
answer count: 1
downvote count: 1
has body: So I have made a programme that calculates the cost of of a ticket based on a number of factors I'll post the question i got below Create a program that given a number of tickets (maximum of 10), the type of ticket (return, one way), the passenger type (under 10, under 16, student, over 60, other), the selected route, and the starting and finishing stops (in the form of a number where n denotes stopn ), calculates the total cost for the journey. The cost of each ticket should be calculated as follows: • The cost per mile is 50p; • Under 10 travel free when accompanied by an adult; otherwise, a discount of 75% is applied; • Under 16 get a 50% discount; • Students get a 25% discount; • Over 60’s get a 60% discount. Train routes should be expressed in the format: int [n] route = {stop2 , stop3 , ... stopNPlusOne}; Example: int [4] route1 = {3, 5, 2, 6}; denotes a route with 5 stops: the distance between stop one and two is 3 miles, between stop two and three is 5 miles, between stop three and four is 2, and between stop four and five is 6. My code is as follows Scanner input = new Scanner(System.in); System.out.println("Enter the number of Tickets (Max 10): "); int numberOfTickets = input.nextInt(); if (numberOfTickets &gt; 10) { System.out.println("Please choose less than 10 tickets"); } else { double cost = route(); double totalCost = (cost * numberOfTickets); System.out.println(""); System.out.printf("Your total cost is:", totalCost); } } // DECLARE A NEW METHOD THAT CALCULATES THE DISTANCES TRAVELLED public static double route() { Scanner input = new Scanner(System.in); int[] route = { 7, 12, 13, 17, 22, 26 }; // miles between each stop System.out.println("Enter the first station number(0 - 5): "); int firstStation = input.nextInt(); System.out.println("Enter the last station number(0 - 5): "); int lastStation = input.nextInt(); int totalMiles = 0; for (int i = firstStation; i &lt; lastStation; i++) { totalMiles = totalMiles + route[i]; // Total miles } System.out.…
has comment: http://stackoverflow.com/comment/42659696
favorite count: 0
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/27049097
accepted answer: http://stackoverflow.com/a/27049097
type: Question

http://stackoverflow.com/q/27071517
has comment: http://stackoverflow.com/comment/42655751
has title: Iterations through a set of n variables
has answer: http://stackoverflow.com/a/41928285
tagged with: structure
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42656143
tagged with: loops
type: Question
accepted answer: http://stackoverflow.com/a/41928285
has comment: http://stackoverflow.com/comment/42655873
tagged with: java
has body: I want to create a data structure (or use an existing one) to iterate easily through all possible elements in form of: (i1, i2, ..., in) such that ij belongs to [ij_lower, ij_upper]. Those are all integer values. I iterate this way: for (int i1 = i1_lower; i1 &lt;= i1_upper; i1++) { for (int i2 = i2_lower; i2 &lt;= i2_upper; i2++) { for (int i3 = i3_lower; i3 &lt;= i3_upper; i3++) { /* * */ for (int in = in_lower; in &lt;= in_upper; i++) { } } } } It may not be a good solution for large n. How to make it easier?
tagged with: optimization
score: 0
has comment: http://stackoverflow.com/comment/42655550
has comment: http://stackoverflow.com/comment/42655603
answer count: 1

http://stackoverflow.com/comment/42576173
score: 0
type: Comment
type: QuestionComment
has text: @RC. I will anyways club the code with either of framework. Although, it would be better if you advise after reading the question.
comment on: http://stackoverflow.com/q/27026413

http://stackoverflow.com/a/27607632
has body: For me, in Eclipse, the fix to this problem was found in Java Build Path. Click on Order and Export tab. Move Web App Libraries to bottom. Note, that when appropriate, this will also allow you to view source of 3rd party libraries when Eclipse tells you that source cannot be found.
score: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27136752
downvote count: 1

size
type: Tag
tags question: http://stackoverflow.com/q/27039007
tags question: http://stackoverflow.com/q/27140640
tags question: http://stackoverflow.com/q/27152573
tags question: http://stackoverflow.com/q/27129732
tag name: size
tags question: http://stackoverflow.com/q/27038217
tags question: http://stackoverflow.com/q/27027929
tags question: http://stackoverflow.com/q/27060095

http://stackoverflow.com/a/27035508
answers question: http://stackoverflow.com/q/27035304
upvote count: 1
type: Answer
has body: Please prefer to implement kelmers answer to not open security holes! Depending on the security requirements of your application you could use the org.apache.cxf.stax.allowInsecureParser option. From the documentation There is a "org.apache.cxf.stax.allowInsecureParser" System Property that can be set to true to allow using an insecure parser, but that is HIGHLY not recommended But I think you are better of consulting the glassfish documentation on how to override/exclude system libs for specific deployments.
downvote count: 0
score: 1

http://stackoverflow.com/comment/42707481
comment on: http://stackoverflow.com/q/27077556
has text: No my question is I need a cloud database which can be used with a Swing based Java application..
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27059911
has comment: http://stackoverflow.com/comment/42635552
has body: I'm making a composite component with an attribute that I wish to have a number of enumerated possible values. For example, in the case of h:panelGroup... &lt;h:panelGroup layout="block" /&gt; The layout attribute allows and suggests 'block, as a value (ctrl-space in eclipse). I checked what source I could see at a glance, and the layout attribute on panelGroup is of type String - so I presume this is not being implemented with an Enum. Is this possible within custom composite components, or is this just a special case? Thanks in advance.
tagged with: jsf
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42634668
tagged with: jsf-2
tagged with: composite-component
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/7902547
has comment: http://stackoverflow.com/comment/64768962
has comment: http://stackoverflow.com/comment/42634553
type: UnansweredQuestion
has title: JSF Composite Component - predefined attribute values

http://stackoverflow.com/a/27046453
has body: This is not an ipojo issue. Swing uses one thread (and only one thread) in order to dispatch events such as clicks. When you click your first button, swing runs your actionPerformed in this thread. This method puts your thread to sleep for 5 seconds. This means that the thread responsible for event handling cannot do anything during this time. This is why your program does not respond to your second click. Whenever you have a long computation in swing (and also osgi), it is often a good idea to run your code in a separate thread in order to avoid blocking the execution (here you have a useless Thread.sleep() but I guess you could have an http request or anything that may take a long time instead). You should probably use an executor service or anything similar.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27039926
type: Answer
accepted answer of: http://stackoverflow.com/q/27039926
score: 1

http://stackoverflow.com/comment/42613184
score: 0
type: Comment
type: QuestionComment
has text: Sure, I am not looking for jndi that means spring application connection pooling will be used. What about 2 and 3 question.
comment on: http://stackoverflow.com/q/27047309

http://stackoverflow.com/a/38680084
answers question: http://stackoverflow.com/q/27098445
score: -1
has body: When you create object of the service instantiate it with new key word. Xservice x = new Xservice();
upvote count: 0
type: Answer
downvote count: 1

http://stackoverflow.com/q/27107503
type: Question
linked to: http://stackoverflow.com/q/27094466
tagged with: jsf-2
score: 0
answer count: 1
has title: JSF 2.0 Spring bean injection
has body: I'm using the following spring's jars: spring-web-2.5.5.jar spring-context-2.5.5.jar spring-core-2.5.5.jar spring-orm-2.5.5.jar spring-support-2.0.8.jar spring-security-taglibs-2.0.3.jar spring-security-acl-2.0.3.jar spring-security-core-2.0.4.jar spring-aop-2.5.5.jar spring-jdbc-2.5.5.jar spring-tx-2.5.5.jar The issue is after migration from JSF 1.2 to JSF 2.0 beans, defined in the faces-context cannot be injected into a managed bean with session scope. For instance: bannersController jaxp.com.controller.BannersController request bannerDao #{bannerDao} and <property name="sessionFactory" ref="sitePartnerSessionFactory" /> <property name="dataSource" ref="sitePartnerDataSource" /> When I replace the scope of the bean to session it'll work fine. But now, the managed property is just null. It had worked before we migrated to JSF 2.0. What's wrong and how to fix? UPD: If I set managed bean scope to view scope it also works fine/
has comment: http://stackoverflow.com/comment/42751314
has answer: http://stackoverflow.com/a/27125840
tagged with: spring
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42747006

http://stackoverflow.com/comment/42584773
comment on: http://stackoverflow.com/q/27031366
type: Comment
has text: All you need is some extra logic to deal with the case where CURDATE's day is less than EFFDATE's day. What part of that is causing you difficulty?
type: QuestionComment
score: 0

http://stackoverflow.com/a/27476746
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27076473
type: Answer
accepted answer of: http://stackoverflow.com/q/27076473
has body: Yes i have fixed the issue, This was due to my armeabi version, i have update it to armeabi-v7a and make some changes as described in below link. And worked both Android kitkat and lollipop version. Please follow this link

http://stackoverflow.com/a/27019001
has body: Convert to a sorted map with the keys and values inverted and applying the following method should work. private static Double getClosest(TreeMap&lt;Double, String&gt; mySet, Double d) { if (mySet.ceilingKey(d) != null &amp;&amp; mySet.floorKey(d) != null){ if( Math.abs(d - mySet.ceilingKey(d)) &lt; Math.abs(d - mySet.floorKey(d)) ) return mySet.ceilingKey(d); else return mySet.floorKey(d); } else if (mySet.ceilingKey(d) == null &amp;&amp; mySet.floorKey(d) != null) { return mySet.floorKey(d); } else if (mySet.ceilingKey(d) != null &amp;&amp; mySet.floorKey(d) == null) { return mySet.ceilingKey(d); } else return null; }
answers question: http://stackoverflow.com/q/27018424
score: 0
type: Answer

http://stackoverflow.com/comment/42781161
comment on: http://stackoverflow.com/q/27135895
type: Comment
type: QuestionComment
has text: you can check for presenceOfElementLocated(By.xpath("//a[contains(@href,'#!mainmenu')]")) and then try out myDynamicElement.click().
score: 0

http://stackoverflow.com/comment/42595792
score: 0
has text: My clue is that you said "regular Java code" wasn't impacted---so there must be something specific about the code which *is* impacted.
comment on: http://stackoverflow.com/q/27037863
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27013804
has answer: http://stackoverflow.com/a/27014120
answer count: 1
accepted answer: http://stackoverflow.com/a/27014120
tagged with: url
favorite count: 0
has comment: http://stackoverflow.com/comment/42554152
tagged with: proxy
has comment: http://stackoverflow.com/comment/42555246
has comment: http://stackoverflow.com/comment/42555376
has comment: http://stackoverflow.com/comment/42554993
tagged with: connection
has comment: http://stackoverflow.com/comment/42553935
score: 2
has body: I try to check if a proxy is online or not. But everytime an Exception is thrown. I also tried it with System.setProperty (), but that doesn't work either... My method: public static boolean isOnline(String host, int port) { String url = "http://www.google.com"; try { Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port)); HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(proxy); connection.connect(); return true; } catch (Exception e) { return false; } } The Exception: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient$1.run(HttpClient.java:484) at sun.net.www.http.HttpClient$1.run(HttpClient.java:482) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:481) at sun.net.www.http.HttpClient.openServer(HttpClient.java:522) at sun.net.www.http.HttpClient.&lt;init&gt;(HttpClient.java:211) at sun.net.www.http.HttpClient.New(HttpClient.java:308) at sun.net.www.http.HttpClient.New(HttpClient.java:326) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1167) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1146) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:…
downvote count: 0
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42555639
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/3957599
has comment: http://stackoverflow.com/comment/42555712
has title: Proxy Check in Java

http://stackoverflow.com/comment/42762680
score: 0
type: Comment
has text: Is this a job or homework assignment?
type: QuestionComment
comment on: http://stackoverflow.com/q/27131874

http://stackoverflow.com/q/27101931
has title: Required MultipartFile parameter 'file' is not present in spring mvc
upvote count: 17
type: Question
possible better answer: http://stackoverflow.com/a/27102022
tagged with: java
has answer: http://stackoverflow.com/a/27102022
has answer: http://stackoverflow.com/a/53572589
score: 17
tagged with: image
accepted answer: http://stackoverflow.com/a/27101988
has body: I am trying to add feature of uploading picture to my spring mvc application. jsp part: ... &lt;form method="POST" action="uploadImage" enctype="multipart/form-data"&gt; &lt;div class="load-line"&gt; &lt;input type="file" class="file"/&gt; &lt;input type="submit" value="Upload"&gt; ... configuration: ... &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" /&gt; ... controller: @RequestMapping(value="/member/createCompany/uploadImage", method=RequestMethod.POST) public @ResponseBody String handleFileUpload( @RequestParam("file") MultipartFile file){ String name = "image_name"; if (!file.isEmpty()) { try { byte[] bytes = file.getBytes(); BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(new File(name + "-uploaded"))); stream.write(bytes); stream.close(); return "You successfully uploaded " + name + " into " + name + "-uploaded !"; } catch (Exception e) { return "You failed to upload " + name + " =&gt; " + e.getMessage(); } } else { return "You failed to upload " + name + " because the file was empty."; } } After I selected picture I click upload and see error message: HTTP Status 400 - Required MultipartFile parameter 'file' is not present What do I wrong?
downvote count: 0
has comment: http://stackoverflow.com/comment/69952024
tagged with: file-upload
has answer: http://stackoverflow.com/a/73665702
favorite count: 0
has answer: http://stackoverflow.com/a/79266152
answer count: 5
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27101988

http://stackoverflow.com/comment/42668023
comment on: http://stackoverflow.com/q/27078952
type: Comment
type: QuestionComment
has text: Oh, I'm sorry. The post tag thing recommended it. I was confused but took it's word.
score: 0

http://stackoverflow.com/a/27049487
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27048698
type: Answer
accepted answer of: http://stackoverflow.com/q/27048698
has comment: http://stackoverflow.com/comment/42643229
downvote count: 0
score: 1
has body: One option would be to add your DBTreeNode List as a member of BST Node along with other fields like Left, Right, etc... Then add accessors (getter, setter) for DBTreeNode. Hope this helps. Good Luck! Here is an Example: public class BST&lt;Key extends Comparable&lt;Key&gt;, Value&gt; { private Node root; // root of BST private class Node { private Key key; // sorted by key private Value val; // associated data private Node left, right; // left and right subtrees private int N; // number of nodes in subtree private DBTreeNode VehicleDetails; // your list public Node(Key key, Value val, int N) { this.key = key; this.val = val; this.N = N; this.VehicleDetails = new DBTreeNode(); // initialize your list } public DBTreeNode getDetails(){ return this.VehicleDetails; } public void addDetails(DBTreeNode details){ for(DBTreeNodeElement detail : details) this.VehicleDetails.add(detail); } }
has comment: http://stackoverflow.com/comment/42648208
has comment: http://stackoverflow.com/comment/42648836

http://stackoverflow.com/comment/42527257
has text: Since the loading page redirects to the Results page, it must have an "src" attribute. You can set it to null using JavascriptExecutor so that the redirection doesn't happen to the Result's page. ( FYI, It's not concrete, just a guess. You can give it a shot though)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26997606
score: 0

http://stackoverflow.com/q/26992229
has title: Java Dynami dispatch
tagged with: java
has body: Here i am getting problem with a code and the is : class Hello259 {} class Lab259 { public static void main (String []args) { Object obj = new Hello259 () ; System.out.println (obj instanceof String) ; System.out.println (obj instanceof Hello259) ; System.out.println (obj instanceof Object) ; } } and it is error : Lab259.java:5: error: incompatible types Object obj = new Hello259 () ; ^ required: Object found: Hello259 Lab259.java:6: error: inconvertible types System.out.println (obj instanceof String) ; ^ required: String found: Object Lab259.java:7: error: inconvertible types System.out.println (obj instanceof Hello259) ; ^ required: Hello259 found: Object 3 errors As we all know that "Object class " is super class of all sub class , then why it is giving such error. Doesn't it follow the Dynamic dispatch concept.
type: Question
score: -2
upvote count: 0
has comment: http://stackoverflow.com/comment/42515956
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26993608

http://stackoverflow.com/comment/42531073
score: 0
comment on: http://stackoverflow.com/q/27000405
type: Comment
has text: consider overriding the ssl trustmanager. I think there are other questions on StackOverflow that discuss doing that in Java.
type: QuestionComment

http://stackoverflow.com/comment/42599685
comment on: http://stackoverflow.com/q/27040096
type: Comment
type: QuestionComment
has text: Yes, but always compare `"tekocina1"` with some other string
score: 0

http://stackoverflow.com/comment/42656333
type: Comment
comment on: http://stackoverflow.com/a/27071548
type: AnswerComment
has text: Yes, instead of the scheduled taqsk you could also have a control thread which loops/sleeps. Or you start all tasks at the beginning (with increasing initial delays). But in all cases it gets submitted to the pool and that one execute with the maximum parallelity configured.
score: 0

http://stackoverflow.com/q/27104715
possible better answer: http://stackoverflow.com/a/27104928
has answer: http://stackoverflow.com/a/27104928
has comment: http://stackoverflow.com/comment/42712740
tagged with: jcombobox
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27104743
tagged with: java
tagged with: swing
has body: I am trying to remove an item listener from one of my JComboBoxes. Below is the code. clientNameCombo.removeItemListener(clientNameCombo.getItemListeners()[clientNameCombo.getItemListeners().length-1]); I dynamically add the ItemListener to the above combo box. However, sometimes when the above code is running, it gives the error: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1 at UI.MainUIHolder$CoreClientOtherPaymentTypeComboAction.itemStateChanged(MainUIHolder.java:10031) at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1223) at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1280) at javax.swing.JComboBox.contentsChanged(JComboBox.java:1329) at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:118) at javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.java:93) at javax.swing.JComboBox.setSelectedItem(JComboBox.java:576) at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:622) at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:834) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290) at java.awt.Component.processMouseEvent(Component.java:6525) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:498) at java.awt.Component.processEvent(Component.java:6290) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4881) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2739)…
has comment: http://stackoverflow.com/comment/42712776
linked to: http://stackoverflow.com/q/27103957
has title: Removing `ItemListener` fires `ArrayIndexOutOfBounds`
accepted answer: http://stackoverflow.com/a/27104743
type: Question
tagged with: indexoutofboundsexception
tagged with: itemlistener
score: 0
answer count: 2

http://stackoverflow.com/q/27093636
type: Question
score: 3
has answer: http://stackoverflow.com/a/27106969
answer count: 1
downvote count: 0
favorite count: 0
tagged with: apache-felix
tagged with: osgi
type: UnansweredQuestion
has body: I've spent a long time on learning OSGi, but I still feel as though a crucial piece of the puzzle is missing. This is my use case: I am using JAX-RS (Grizzly) to create a REST API. I have an interface that has many various implementations. My solution should be able to add new implementations at any time. Based on some form of input, I have to get a hold of one these specific instances. For example, lets say I register two interface implementations with Felix Interface A and Interface B. A user should be able to ask for Implementation B By using the command line we get from running felix.jar(Apache Felix Gogo ) I have been able to install and start my own bundles. The problem I now face is how I from one of my controllers is supposed to retrieve any of these implementation. Here is the code for the activator of one of my implementations. public class MyClassActivator implements BundleActivator { @Override public void start(BundleContext context) throws Exception { System.out.println("Starting ImplementationA"); Hashtable&lt;String, String&gt; props = new Hashtable&lt;&gt;(); props.put("Identifier", "ImplementationA"); context.registerService(MyInterface.class.getName(), new MyClassA(), props); } @Override public void stop(BundleContext context) throws Exception { System.out.println("Stopping ImplementationA"); } private class ImplementationA implements MyInterface { /*my implementation*/ } } From one of my JAX-RS classes, I want to, somehow, do this: MyInterface myclassA = getBundle("ImplementationA"); The String ImplementationA is the same string I placed in the props map. What I have tried so far is BundleContext bc = FrameworkUtil.getBundle(MyInterface.class).getBundleContext(); This however just returns null, it doesn't seem to actually be "talking" to my felix instance. So my questions are how do I get an interface from Felix? And is what I want to do even possible with OSGi?
upvote count: 3
tagged with: java
has title: Getting a specific implementation from Felix

http://stackoverflow.com/q/27087969
has body: I am trying to use gson in my android project .So i downloaded Gson . then i did the following: Right click on project -&gt; build path -&gt; add libraries Now i can see that the jar file is in: Project -&gt; properties -&gt; java build path -&gt; libraries tab But when I import com.google.gson.Gson there is an error "The import com.google cannot be resolved". com.google is underlined with red but gson.Gson is not underlined . What am i missing ?? Thanks in advance !!
has comment: http://stackoverflow.com/comment/42683784
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42689946
has comment: http://stackoverflow.com/comment/42691388
linked to: http://stackoverflow.com/q/1334802
downvote count: 0
score: 1
has title: Can not add gson to android project properly
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42692745
answer count: 0
tagged with: java
tagged with: gson
upvote count: 1
type: Question

http://stackoverflow.com/a/27119517
type: Answer
has comment: http://stackoverflow.com/comment/42740639
answers question: http://stackoverflow.com/q/27115606
score: 0
has body: Try something like this float mixedToDecimal(String data) // data would be like this "1 5/8"; String[] parts = data.split(" "); if(!(parts.lenght &gt; 0)) // this mean that if data is NOT mixedfraction then just return -1 return -1; float value = Integer.parseInt(parts[0]); if (parts.length &gt; 1) { // has fractional part parts = parts[1].split("/"); float numerator = Integer.parseInt(parts[0]); float denominator = Integer.parseInt(parts[1]); value += numerator / denominator; } // value contains 1.625 return value;

http://stackoverflow.com/a/27011174
has comment: http://stackoverflow.com/comment/42552511
has body: This seems to a gzip archive. Convert the hex values to bytes, store it in a file, and run gunzip on that.
type: Answer
has comment: http://stackoverflow.com/comment/42549343
has comment: http://stackoverflow.com/comment/42549297
answers question: http://stackoverflow.com/q/27010986
score: 0

http://stackoverflow.com/comment/42744796
has text: Thank you. So is there anyway I can access var from Parent in Child class?
type: Comment
comment on: http://stackoverflow.com/a/27121904
score: 0
type: AnswerComment

canvas
tags question: http://stackoverflow.com/q/27051770
tags question: http://stackoverflow.com/q/27113337
tags question: http://stackoverflow.com/q/27083027
tag name: canvas
tags question: http://stackoverflow.com/q/27115966
tags question: http://stackoverflow.com/q/27136250
type: Tag

import
tags question: http://stackoverflow.com/q/27082666
tags question: http://stackoverflow.com/q/27081406
type: Tag
tags question: http://stackoverflow.com/q/27114776
tags question: http://stackoverflow.com/q/27091994
tags question: http://stackoverflow.com/q/27083440
tags question: http://stackoverflow.com/q/27080598
tag name: import
tags question: http://stackoverflow.com/q/27048157
tags question: http://stackoverflow.com/q/27045900
tags question: http://stackoverflow.com/q/27129630
tags question: http://stackoverflow.com/q/27131302
tags question: http://stackoverflow.com/q/27077573
tags question: http://stackoverflow.com/q/27117205
tags question: http://stackoverflow.com/q/27079423

http://stackoverflow.com/comment/42533962
comment on: http://stackoverflow.com/a/27001901
has text: Okay then.. well glad we could close that book.
type: AnswerComment
score: 0
type: Comment

dicom
tag name: dicom
tags question: http://stackoverflow.com/q/27030667
type: Tag

http://stackoverflow.com/a/27050659
has comment: http://stackoverflow.com/comment/42635471
has comment: http://stackoverflow.com/comment/42635779
type: Answer
answers question: http://stackoverflow.com/q/27048239
has comment: http://stackoverflow.com/comment/42635692
has body: Try this instead: DetachedCriteria dc = DetachedCriteria.forClass(Patient.class, "patient"); dc.add(Restrictions.eq("krankenstand", true)); DetachedCriteria subquery = DetachedCriteria.forClass(Ueberweisung.class); subquery.add(Restrictions.isNull("abrechnungsDatum")); dc.add(Subqueries.ltAll(0, subquery));
score: 0

http://stackoverflow.com/a/27009032
answers question: http://stackoverflow.com/q/27008906
has comment: http://stackoverflow.com/comment/42546140
score: 0
has comment: http://stackoverflow.com/comment/42546837
has comment: http://stackoverflow.com/comment/42546444
has comment: http://stackoverflow.com/comment/42546817
type: Answer
has comment: http://stackoverflow.com/comment/42567239
has comment: http://stackoverflow.com/comment/42546593
has comment: http://stackoverflow.com/comment/42546719
has body: Change ArrayList&lt;integer&gt; myList = new ArrayList&lt;&gt;(); to static ArrayList&lt;Integer&gt; myArrayList = new ArrayList&lt;&gt;(); And move it out of main into the class so you can use it in dataInput() like this: int i = input.nextInt(); myArrayList.add( i ); There is certainly more to fix but that should get you over your ArrayList blues. If you look closely at how mainMenu() is used in main you should see how to use seriesMenu() as well. seriesMenu() returns a value that you don't do anything with. It's not saved in a var like mainMenu() return is saved in menuOption. seriesMenu() needs a do while loop of it's own. Also, the while do while construct you have going around the switch is pretty wacky. Don't think you need it to be any more complicated than a single do while for the mainMenu and a single do while for the seriesMenu(). You'll need to change the rest of your code so it works with ArrayList: //Reads input from keyboard (menu, values, etc) static void dataInput() { Scanner input = new Scanner(System.in); System.out.print(" Enter a Number: "); int i = input.nextInt(); myArrayList.add( i ); } //displays array static void display(ArrayList&lt;?&gt; args) { for (int i = 0; i &lt; args.size(); i++) { System.out.println(args.get(i)); } } Note that dataInput() no longer returns anything so change myList[counter] = dataInput(); to just dataInput(); OK, I'll give you a big hint about the inner do while loop Note how the pattern goes do-switch-while. You want to do the same pattern on the inner switch. do { menuOption = mainMenu(); switch (menuOption) { ... } } while (menuOption != 'q'); Make the switch in case: a look the same: do { seriesOption = seriesmenu(); switch (seriesOption) { ... } } while (seriesOption != 'q');
has comment: http://stackoverflow.com/comment/42546115

http://stackoverflow.com/q/27025134
accepted answer: http://stackoverflow.com/a/27025246
tagged with: random
tagged with: integer
favorite count: 0
possible better answer: http://stackoverflow.com/a/27025252
has comment: http://stackoverflow.com/comment/42573722
has answer: http://stackoverflow.com/a/27025252
downvote count: 1
type: AnsweredQuestion
has body: I'm kind of confused. As soon as i is 16 and above mit randomly choosen x is 0. How come? Random random = new Random(); for(int i = 1; i &lt; 20; i++) { int[] input = generateArray( (int)Math.round(Math.pow(2, i)), (int)Math.round(Math.pow(2, i+i)) ); int x = input[random.nextInt(input.length-1)]; System.out.println(BinarySearch.go(input, x)); } Sorry, I forgot to show you generateArray: public static int[] generateArray(int amount, int max) { int[] randomNumbers = new int[amount]; double delta = max / (float)amount; Random random = new Random(); for (int i = 0; i &lt; randomNumbers.length; i++) { randomNumbers[i] = (int)Math.round(i*delta + random.nextDouble() * delta); } return randomNumbers; } Basically generates an int array of length amount and fills it with randomly (bound = amount * 2) found increasing integers.
tagged with: java
has answer: http://stackoverflow.com/a/27025246
type: Question
answer count: 2
has title: JAVA Random.nextInt(int n) returning 0 for n >= 2^16
has comment: http://stackoverflow.com/comment/42573729
upvote count: 0
score: -1

http://stackoverflow.com/comment/42675064
has text: I'm thinking that I need to check weather or not the student exists in the database (other tables). I can not add a student which does not exist, therefore I check if the student exists in order to add student. Am I thinking about this in the wrong way? I mean, if I get rid of the for-loop and just write make the inserts statement, what will prevent me from writing a ID which does not exsist?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27081976
type: Comment

http://stackoverflow.com/comment/42694889
type: Comment
has text: here's the full code: http://ideone.com/d2IGwj
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27094475

http://stackoverflow.com/comment/42810333
comment on: http://stackoverflow.com/a/27150276
has text: The IPv6 is correct. I believe SymmetricDS is using the port as part of the IP.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42599656
type: AnswerComment
has text: @TheDubleM You haven't shown where you initialize `tmp.opisTovora`. You should try to print `tmp.opisTovora.length` before the line where the exception occurs.
type: Comment
comment on: http://stackoverflow.com/a/27040130
score: 0

http://stackoverflow.com/a/27077947
has body: To check if a number is prime, you should check if the number is divisible by 1 and itself. Here is a simple code snippet that does it. public static void prime (int n){ int countZero=0; //counts the number of times n is divisible by another number //@var div is the divisor for (int div=1;div&lt;=n;div++){ if (n%div==0){ countZero++; } //n is divisible by 1 and itself if (countZero==2){ System.out.println(n+", is a prime number"); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27077644

http://stackoverflow.com/comment/42790346
comment on: http://stackoverflow.com/a/27146464
score: 0
type: AnswerComment
has text: sure but i didn't understand it yet.
type: Comment

http://stackoverflow.com/q/27074744
has answer: http://stackoverflow.com/a/27083213
tagged with: alarmmanager
has title: Setting up AlarmManager to run when Android app isn't running?
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/6004237
favorite count: 0
tagged with: android
has body: I've looked at several guides and I've basically done this: Main.java public class Main extends Activity { PendingIntent pendingIntent; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("America/New_York")); cal.set(Calendar.HOUR_OF_DAY, 22); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); Intent myIntent = new Intent(Main.this, Receiver.class); pendingIntent = PendingIntent.getBroadcast(Main.this, 0, myIntent,0); AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); alarmManager.set(AlarmManager.RTC, cal.getTimeInMillis(), pendingIntent); } } Receiver.java public class Receiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "I'm running", Toast.LENGTH_SHORT).show(); } } AndroidManifest.xml also contains &lt;receiver android:name=".Receiver"/&gt;. So, from what I've read, the above code should show a toast whenever it is 10 pm in New York, whether or not the app is actually running. At present, it does nothing, even if the app is running. It looks like the Receiver class isn't even being called. What am I missing?
accepted answer: http://stackoverflow.com/a/27083213
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/27074772
upvote count: 2
has answer: http://stackoverflow.com/a/27074772
tagged with: java
tagged with: android-pendingintent
type: Question

http://stackoverflow.com/q/27104627
type: Question
has title: Identify Time Spent in Rendering in Swing Application
has comment: http://stackoverflow.com/comment/42712647
has comment: http://stackoverflow.com/comment/42716925
score: 0
has body: We have Swing Application and its slow. It fetches data using web services. This data fetching is done by SwingWorker in a separate thread. When data arrives its rendered. I would like to identify whether fetching data or its rendering is the culprit. Tried profiling with YJP but could not make much headway. Though it identifies time spent in "paint()" method but I think that's not sufficient. Any pointers to demarcate the boundaries and find time spent in rendering will be appreciated. How to do performance testing of a swing application ?
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/42716587
tagged with: performance
answer count: 0
tagged with: java

http://stackoverflow.com/comment/42535105
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27002664
type: Comment
has text: When you create the style/theme, you create that consistency. It's like css for Android. You can apply it to Fragments, or other activities.

http://stackoverflow.com/q/27041017
possible better answer: http://stackoverflow.com/a/27041065
favorite count: 0
has answer: http://stackoverflow.com/a/27041081
accepted answer: http://stackoverflow.com/a/27041081
has body: Hey guy's so am trying to replace all characters and numbers to get the /hello/what/ only without the REMOVEThis4.PNG i don't want to use string.replace("REMOVEThis4.PNG", ""); cause i wanna use it on other strings not only that Any help is great my code String sFile = "/hello/what/REMOVEThis4.PNG"; if (sFile.contains("/")){ String Replaced = sFile.replaceAll("(?s)", ""); System.out.println(Replaced); } I want the the output to be /hello/what/ Only thanks alot!
downvote count: 2
has answer: http://stackoverflow.com/a/27041065
upvote count: 1
has answer: http://stackoverflow.com/a/27041140
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has title: Java Replacing Help Needed
answer count: 3

http://stackoverflow.com/comment/42625745
type: AnswerComment
score: 0
has text: Hi, Tried to call notify and wait method on list, whenever list.wait() method called in Producer i am getting below error and even increased arraylist size 10 to 20, still getting the same error. `Exception in thread "Thread-1" java.lang.IndexOutOfBoundsException: Index: 10, Size: 10 at java.util.ArrayList.RangeCheck(ArrayList.java:547) at java.util.ArrayList.remove(ArrayList.java:387) at Consumer.consumer(ConsumerAndProducerMain.java:112) at ConsumerAndProducerMain$2.run(ConsumerAndProducerMain.java:41) at java.lang.Thread.run(Thread.java:619)`
type: Comment
comment on: http://stackoverflow.com/a/27041204

http://stackoverflow.com/q/27100131
answer count: 3
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/27100186
favorite count: 0
has comment: http://stackoverflow.com/comment/42704727
has answer: http://stackoverflow.com/a/27100145
has title: What is the reason behind the result of this code?
has answer: http://stackoverflow.com/a/27102363
possible better answer: http://stackoverflow.com/a/27100145
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/27100186
type: AnsweredQuestion
has body: class Abc { public Abc() { System.out.println("constructor A"); } } class Bb extends Abc { public Bb() { super(); // Calls Abc() System.out.println("constructor B"); } } public class X { public static void main(String args[]) { Bb b = new Bb(); } } The answer is: Constructor A Constructor B Can anyone tell the reason behind this?
tagged with: java
downvote count: 3
score: -1

http://stackoverflow.com/q/27126718
type: Question
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/42754531
score: 0
has comment: http://stackoverflow.com/comment/42753887
tagged with: file-permissions
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42754466
tagged with: maven
answer count: 0
has title: Can't import Maven dependencies/jars (file permission issue)
tagged with: java
has body: I copied the .m2 folder in my home directory from my backup. when I import the project in intellij idea and try to run it, all maven imports show: Cannot resolve symbol "***". Then I found that there was a permission problem in .m2 folder. I set its permissions after some research: All directory has permission : drwxrwxr-x (775) All files has permission : rw-rw-r (664) But after these changes it still wasn't working. So I set all file's permission to rwxrwxrwx (777) (Only for testing) but still it's not working. So what permission should I set to ~/.m2 file and folder for working perfect. I'm thankful for your answer and explanation. Thanks.
has comment: http://stackoverflow.com/comment/42754485

http://stackoverflow.com/comment/42792940
type: AnswerComment
comment on: http://stackoverflow.com/a/27148389
score: 0
type: Comment
has text: I have created a copy constructor with setting all values but the primary key and it worked. Thanks.

http://stackoverflow.com/comment/42769465
comment on: http://stackoverflow.com/q/27115009
has text: @trashgod thanks, I will delete this question and create new complete! Unfortunately, 'useBuffer' don't work for me :(
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/29819786
type: Answer
has comment: http://stackoverflow.com/comment/47766204
has body: This is caused when java is updated. You have to delete in environement path : C:**ProgramData\Oracle\Java\javapath**
has comment: http://stackoverflow.com/comment/73317355
has comment: http://stackoverflow.com/comment/104835234
score: 14
has comment: http://stackoverflow.com/comment/48317915
upvote count: 14
downvote count: 0
answers question: http://stackoverflow.com/q/27019786

http://stackoverflow.com/comment/42761704
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27129310
has text: You can find the ProjLibrary on github for more details in implementation. https://github.com/Cospel/ProjLibrary
score: 0

http://stackoverflow.com/comment/42736474
score: 0
type: QuestionComment
type: Comment
has text: relevant keyword means the keyword which is relevant to the user based on the user query. If I try this for a query as 'soccer game' then soccer is a relevant keyword for me in this case.
comment on: http://stackoverflow.com/q/27094295

swagger-ui
tag name: swagger-ui
type: Tag
tags question: http://stackoverflow.com/q/27132766

http://stackoverflow.com/a/27049025
has comment: http://stackoverflow.com/comment/42615970
has body: It's because you didn't consume the line separator when entering the number. When you provide the first input on your keyboard you are doing this: Press 1 Press Enter When pressing enter, you pass a line separator. Now nextInt() will consume the '1' and the line separator (which is still in the buffer) token will be consumed by the first nextLine() call in your first case in the switch. That's why you go to "Enter StudentId" directly. To fix this, add a nextLine() call just after nextInt(): int x=abir.nextInt(); abir.nextLine(); //consume the line separator
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/27048969
type: Answer

http://stackoverflow.com/comment/42712293
type: AnswerComment
type: Comment
has text: The code in the question doesn't compile because the viewController is not initialized. So, fix this issue. Then look at your method call: it specifies the types of the variables as if it was a method declaration.It must not. A method call is like `viewController.createQuestion(questionId, theQuestion, category, correctAnswer)`. Why are you doing Spring MVC if you don't know how to use variables and methods? Do basic things first.
score: 1
comment on: http://stackoverflow.com/a/27103929

http://stackoverflow.com/comment/48532885
type: AnswerComment
comment on: http://stackoverflow.com/a/27153572
type: Comment
has text: I used the same github example as a template and as soon I define a bean with a custom property like ${...} I got this error: Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'xxx' in string value "${xxx}" I debugged it and it's like Spring Batch has its own Placeholder and it's unable to the one is defined by Spring Boot. Any idea how to override this behaviour?
score: 0

http://stackoverflow.com/comment/42933969
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27032445
has text: @user2921180 : Have you seen my answer? Is `---start---` in holidays ? Can you see data in Netbeans ? [Netbeans Database)](http://stackoverflow.com/a/16764522/1322642) : look at the connection string !

http://stackoverflow.com/a/27106282
answers question: http://stackoverflow.com/q/27106152
upvote count: 1
downvote count: 1
has body: String[] array = new String[]{"String 1", "String 2", "String 3"}; for(int i=0; i &lt; array.length; i++) { System.out.println(array[i]); wordCount=0; while (s.hasNext()) { totalCount++; if (s.next().equals(array[i])) wordCount++; } System.out.println("each Word count: " + wordCount); }
score: 0
type: Answer

http://stackoverflow.com/q/27107331
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/34009260
has body: I just wanted to change the Icon and the name of my application. I changed in the strings.xml file the "app_name". Linak But since i clicked on this line in the AndroidManifest.xml file: <application android:icon="@drawable/linak120x120" android:label="@string/Linak" <-----this line nothing works anymore. The error message is : Error: No resource found that matches the given name (at 'label' with value '@string/Linak'). Even when I want to delete or Undo this line the error appears.
has title: No resource found that matches the given name at label
tagged with: android
has comment: http://stackoverflow.com/comment/42717939
has comment: http://stackoverflow.com/comment/42719727
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/34009260
tagged with: java
has answer: http://stackoverflow.com/a/54479696
type: Question
has answer: http://stackoverflow.com/a/27107381
accepted answer: http://stackoverflow.com/a/27107381
tagged with: manifest

http://stackoverflow.com/a/27073388
has comment: http://stackoverflow.com/comment/42658776
score: -1
has comment: http://stackoverflow.com/comment/42658766
downvote count: 1
answers question: http://stackoverflow.com/q/27073319
has body: You are never calling a print method. You can use: System.out.println(route); to print out the route String.
type: Answer
upvote count: 0

http://stackoverflow.com/comment/42734920
has text: @tomss That's not the real code. What's the real code? and the real exception?
type: AnswerComment
comment on: http://stackoverflow.com/a/27115918
score: 0
type: Comment

http://stackoverflow.com/comment/42674966
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27082872
type: Comment
has text: plus rect1.intersect(rect2) would be a better solution for simple collision detection

http://stackoverflow.com/comment/42556529
comment on: http://stackoverflow.com/q/27014743
has text: Thanks Andrew, using Multiple JFrames is a good practice but am in the final stages of my application and this would change the whole architecture. Any solution to my problem??
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42560022
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27015856
has text: @AshleyFrieze , yes I can open the page .
score: 0

http://stackoverflow.com/q/27132078
tagged with: javacard
tagged with: java
tagged with: apdu
type: Question
has title: Extended APDU in NetBeans Emulator not being parsed
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27156991
tagged with: netbeans
type: UnansweredQuestion
has body: I am using the Netbeans IDE for the JavaCard 3.0.2 RE. I want to send to my applet an Extended APDU. I am trying to to that through scripts. I am using a 3 byte Lc and my class implements the ExtendedLength interface. However, when I try to send the Extended APDU through the script, the NetBeans build.xml gives me "Input data length != Lc around line ... " . I am trying to send 275 characters, apart from the header, so my command is: CLA INS P1 P2 Lc Lch Lcl Data End 0xAB 0x00 0x00 0x00 0x00 0x01 0x13 ....... 0x7F; The header parameters (CLA, INS, etc) are custom and I have written code to process this kind of command. However, the APDU is not even accepted by my method, because I use some print command which are not displayed. I think the problem has to do with the NetBeans simulator accepting Extended APDUs. If I change the APDU to normal length and not Extended, everything is fine. Do you know what I have to do?

http://stackoverflow.com/q/27055061
has comment: http://stackoverflow.com/comment/42626479
tagged with: java
tagged with: image-processing
tagged with: image
has body: I am very new to this are of java and I have no idea about how can solve fallowing scenario... I have data set of 500 users. That contains X and Y coordination with the system time for every 100 ms I want to connect all pixel points according to system time and generate an image. How can I do it with JAVA. Could anyone please give me some instructions to solve this problem?
score: 0
tagged with: graph-drawing
has title: Draw and generate an image by connecting pixel points in JAVA
answer count: 0
tagged with: pixel
has comment: http://stackoverflow.com/comment/42640263
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/27392066
type: Answer
has body: Make sure your entities, and the objects that make up your composite primary key, have appropriate implementations of hashCode() and equals(). I seem to remember there being some underlying changes in hash-code usage and/or object equality checking between Hibernate 3 and 4.
answers question: http://stackoverflow.com/q/27126075
score: 0

http://stackoverflow.com/q/27035174
has comment: http://stackoverflow.com/comment/42591374
type: UnansweredQuestion
upvote count: 1
has body: When i start tomcat in eclipse indigo it shows below error.pls any one give solutions for this error... java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.digester.Digester.setRulesValidation(Z)V at org.apache.catalina.startup.Catalina.createStartDigester(Catalina.java:255) at org.apache.catalina.startup.Catalina.load(Catalina.java:474) at org.apache.catalina.startup.Catalina.load(Catalina.java:562) ... 6 more'
type: Question
tagged with: jakarta-ee
tagged with: server
has comment: http://stackoverflow.com/comment/42593125
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42591045
tagged with: eclipse
has answer: http://stackoverflow.com/a/30588865
has comment: http://stackoverflow.com/comment/42593305
has title: When i start tomcat in eclipse shows error java.lang.reflect.InvocationTargetException
has comment: http://stackoverflow.com/comment/42591967
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42590989
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/42591234

websphere-portal
tags question: http://stackoverflow.com/q/27061949
tag name: websphere-portal
tags question: http://stackoverflow.com/q/27045494
type: Tag

http://stackoverflow.com/q/27026109
tagged with: arrays
accepted answer: http://stackoverflow.com/a/27026210
has answer: http://stackoverflow.com/a/27026209
possible better answer: http://stackoverflow.com/a/27026209
has body: I have to read a text file and make the first number of each line a size of an array. Then I had to populate a 3rd array with the first two arrays. No matter what I try I always get the contents of the first array into the 3rd array, but I get an out of bounds exception going to the 2nd. What am I doing wrong? import java.util.*; import java.io.*; public class sort { public static void main (String[] args) { File file = new File("twoLists.txt"); try { Scanner read = new Scanner(file); int size = read.nextInt(); //array 1 size and population int list1[] = new int[size]; for (int i = 0; i &lt; list1.length; i++) { list1[i] = read.nextInt(); } //array2 size and population int size2 = read.nextInt(); int list2[] = new int[size2]; for (int i = 0; i &lt; list2.length; i++) { list2[i] = read.nextInt(); } //combine the arrays int list3[] = new int[list1.length + list2.length]; for (int i = 0; i &lt; list3.length; i++) { //if i is &lt; the length of list 1 populate the array //with contents of list if (i &lt; list1.length) { list3[i] = list1[i]; } if (i &gt; list1.length) { list3[i] = list2[i]; } } } catch (FileNotFoundException e) { e.printStackTrace(); } } }
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27026210
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42575562
has title: Using elements of 2 arrays to populate a 3rd. Out of bounds error
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/42575551
has comment: http://stackoverflow.com/comment/42575595
answer count: 3
has answer: http://stackoverflow.com/a/27026338

http://stackoverflow.com/a/27111384
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27111126
has body: Generally speaking, the garbage collector will run when enough garbage has accumulated. How much time it consumes depends roughly on how many total objects there are on the heap. A byte[40000] is a medium-sized object, but 60 per second adds up to 2.4 MB/s, or nearly 150 MB/min. That's pretty substantial for a small device such as you would expect to find running Android (and also pretty substantial for your data plan, if you're actually receiving data at that rate). As a general principle, you should size your buffer appropriately for the amount of data you need or realistically expect to receive per I/O transaction. Having done that, you want to reuse that buffer and avoid unnecessarily copying it. Those are both generally possible. You present no code, so I cannot begin to guess why your buffer is being copied.
accepted answer of: http://stackoverflow.com/q/27111126
score: 2

http://stackoverflow.com/a/27021851
upvote count: 1
has comment: http://stackoverflow.com/comment/42586941
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27011442
downvote count: 0
has body: In your URL domain.com:8080/railo/railo-context/... is the first railo the context path? Basically, did you deploy a Railo war but not in the / context? If so, you might need to modify the /railo-context/ virtual mapping in your railo-server.xml file to map to "/railo/railo-context/" Also, check any rewrite rules set up.
accepted answer of: http://stackoverflow.com/q/27011442
type: Answer
score: 1

http://stackoverflow.com/q/27050935
tagged with: jdbc
has comment: http://stackoverflow.com/comment/42683508
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42681290
downvote count: 0
has body: Currently, I have created a simple Java application that connects to my Google Cloud SQL database the normal way: try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://-google-cloud-sql-ip:-port-/-projectname-","-user-","-password-"); Statement st = con.createStatement(); } catch (Exception ex) { ex.printStackTrace(); } My only concern is that the password is placed here as plain text. It is not protected in any way. I do know that it is possible to protect the source code with something like yGuard. Also, I have to register my external IP address in Google Cloud for it to work. Therefore, I was wondering if I could use some sort of OAuth method to make a database connection to the Cloud SQL database. I'd prefer a connection method that is independent of my computer's physical location, so I can connect anywhere I want (if I have an internet connection). Is there a better method than the one presented above, or is this the only way? And if so, please let me know how to protect the plain text password. Any help is much appreciated!
has answer: http://stackoverflow.com/a/30583329
has title: Connection methods to Google Cloud SQL Database with Java JDBC
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/42679075
tagged with: java
score: 4
answer count: 1
tagged with: google-cloud-sql
favorite count: 0
has comment: http://stackoverflow.com/comment/42717875
accepted answer: http://stackoverflow.com/a/30583329

atomic
type: Tag
tags question: http://stackoverflow.com/q/27089196
tag name: atomic
tags question: http://stackoverflow.com/q/27114521

http://stackoverflow.com/a/35911574
accepted answer of: http://stackoverflow.com/q/27050820
type: AcceptedAnswer
downvote count: 0
has body: you need to delete these jar files binding between Hadoop and Hive rm lib/hive-jdbc-2.0.0-standalone.jar rm lib/log4j-slf4j-impl-2.4.1.jar
type: Answer
score: 9
answers question: http://stackoverflow.com/q/27050820
upvote count: 9

http://stackoverflow.com/comment/42613275
type: Comment
comment on: http://stackoverflow.com/a/27022940
score: 0
has text: @PeltierCooler this is rather weird. Are you using AndroidStudio? If so post your `build.gradle` from the `app` folder. Also try using full name `net.stuffilike.strybing.MainActivity` instead of `.MainActivity`.
type: AnswerComment

http://stackoverflow.com/q/27025766
upvote count: 1
has answer: http://stackoverflow.com/a/27025858
has answer: http://stackoverflow.com/a/27026846
has answer: http://stackoverflow.com/a/27047254
tagged with: recursion
has comment: http://stackoverflow.com/comment/42574940
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27026241
type: Question
has answer: http://stackoverflow.com/a/39753476
downvote count: 0
has comment: http://stackoverflow.com/comment/42579493
has comment: http://stackoverflow.com/comment/42574935
has body: So I'm doing this exercise and my teacher says that he wants the num/10 in this line:System.out.print(numDigits(num/10)); in the method (so that if the original number is 0 then it will return 1 digit rather than 0), but I have no idea where he wants it. (*must be done with recursion to count the number of digits of a number) To me this way is simple, but I guess if you're writing a lot of code you don't want to keep typing x/10. import java.util.*; public class NumDigits { public static void main(String[]args) { int num; Scanner input = new Scanner(System.in); num = input.nextInt(); input.close(); System.out.print(numDigits(num/10)); } public static int numDigits(int x) { if (x == 0) {return 1;} else { return 1 + numDigits(x/10); } } } I guess I could do this, but it takes more code... : / import java.util.*; public class NumDigits { public static void main(String[]args) { int num; Scanner input = new Scanner(System.in); num = input.nextInt(); input.close(); System.out.print(numDigits(num, num)); } public static int numDigits(int x, int num) { if (num == 0) {return 1;} else if (x == 0) {return 0;} else { return 1 + numDigits(x/10, num); } } }
favorite count: 0
answer count: 5
type: UnansweredQuestion
has title: A Recursion method that returns number of digits, help for 0

http://stackoverflow.com/a/79266152
has body: In Spring Framework, some bean names are predefined or convention-based, meaning they are expected to have specific names for certain functionalities to work correctly. The CommonsMultipartResolver bean is one such bean where the name is convention-based, and it is expected to be named multipartResolver by default. Changing it to multiPartResolver or any other name may cause issues because Spring might not be able to automatically recognize it as the bean responsible for handling file uploads.
score: 0
answers question: http://stackoverflow.com/q/27101931
type: Answer

http://stackoverflow.com/q/27117205
answer count: 2
upvote count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/27124679
has body: I have a file, lets say data.txt which contains data in the following format 1 12 2 84 3 82 9 82 3 1 3 2 The first number indicates what index of the array the second number should be added to. I am having trouble working this out... I wanted to create a method that parses through the .txt file and adds the values to the appropriate index then returns the array with all the numbers added up.
favorite count: 0
tagged with: java.util.scanner
has title: Reading ints from file and storing value to an array
has answer: http://stackoverflow.com/a/27117316
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42736773
downvote count: 0
score: 1
tagged with: java
tagged with: import
type: Question

http://stackoverflow.com/comment/42726634
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27093452
has text: @MartinIbl Check output the appender, you can use http://logging.apache.org/chainsaw/
score: 0

http://stackoverflow.com/a/27064300
has comment: http://stackoverflow.com/comment/42662457
has comment: http://stackoverflow.com/comment/42654774
type: Answer
answers question: http://stackoverflow.com/q/27063164
has comment: http://stackoverflow.com/comment/42663546
has comment: http://stackoverflow.com/comment/42665587
has comment: http://stackoverflow.com/comment/42667235
score: 0
has body: Why do you not just use @Before("execution(* com.full.name.of.Class.someMethod(java.io.Serializable))") That specifically targets the method you want, you do not need to put the annotation to specify the target
has comment: http://stackoverflow.com/comment/42674187

http://stackoverflow.com/comment/120835955
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27100835
has text: what if one wants to use `acceptChanges()` without arguments? is it even possbie?

http://stackoverflow.com/q/27035862
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27040659
type: Question
has body: Is there a way to trace transactions end to end over distributed applications system using Spring AOP or AspectJ, without changing the existing codes? The web service interactions between applications may be RMI, SOAP or REST? I am looking for a general approach and just want to know if it possible using Spring AOP and AspectJ.
has answer: http://stackoverflow.com/a/27040659
tagged with: spring-aop
tagged with: aspectj
upvote count: 1
has title: Trace transactions end to end over distributed applications systems
answer count: 1

http://stackoverflow.com/comment/42522730
has text: @Dhruv2: See [tag:embedded-resource] for additional guidance.
type: AnswerComment
comment on: http://stackoverflow.com/a/26994794
type: Comment
score: 1

http://stackoverflow.com/q/27022447
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27023040
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27023716
has answer: http://stackoverflow.com/a/27023040
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27090945
accepted answer: http://stackoverflow.com/a/27110210
has body: on the homepage of my app i have edittexts that represent counters for each row in my list. whenever i change activity and return back to my main screen all the numbers disappear, the same happens when I close the app and open it again. How do i make the numbers stay? My main activity where I call the row layout with the edittexts import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class MyActivity extends Activity implements MyAdapterInterface{ private CustomCursorAdapter customAdapter; public ListView list1; //instantiating the database class com.example.rory.dripdrop.DBAdapter db = new com.example.rory.dripdrop.DBAdapter(this); public MyActivity mMyActivity; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); list1 = (ListView)findViewById(R.id.data_list); db.open(); mMyActivity = this; //button and listener for add activity Button addBtn = (Button)findViewById(R.id.add); addBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(MyActivity.this, Add.class); startActivity(i); } }); //button and listener for delete activity Button deleteBtn = (Button)findViewById(R.id.delete); deleteBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(MyActivity.this, Delete.class); startActivity(i); } }); //button and listener for update activity Button updateBtn = (Button)findViewById(R.id.update); updateBtn.setOnClickListe…
downvote count: 0
has title: Saving EditTexts on App close
favorite count: 0
has answer: http://stackoverflow.com/a/27023131
answer count: 5
tagged with: android
linked to: http://stackoverflow.com/q/16769654
has answer: http://stackoverflow.com/a/27110210

http://stackoverflow.com/a/40418061
type: Answer
answers question: http://stackoverflow.com/q/26995395
upvote count: 5
downvote count: 0
has body: As I'm exploring adding filter and Interceptor, I'm prettry sure that's caused by async calling. You use a DeferredResult here, which spring will do the filter in origin thread and filtering it again in a new thread. If you set log level to Debug, you will notice log like this. 15:14:06.948 [http-nio-8199-exec-5] DEBUG o.s.s.w.h.writers.HstsHeaderWriter - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@efe6068 15:14:06.948 [http-nio-8199-exec-5] DEBUG o.s.s.w.c.SecurityContextPersistenceFilter - SecurityContextHolder now cleared, as request processing completed 15:14:06.948 [http-nio-8199-exec-5] DEBUG o.s.b.w.f.OrderedRequestContextFilter - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@163cab73 15:14:07.148 [http-nio-8199-exec-6] DEBUG o.s.b.w.f.OrderedRequestContextFilter - Bound request context to thread: SecurityContextHolderAwareRequestWrapper[ FirewalledRequest[ org.apache.catalina.core.ApplicationHttpRequest@42f1262]] In a word, it's executed once in one thread, but here're two threads. As I digged the google, I found there's no good solution. If you have something like auth in request, a walk around way is add security.filter-dispatcher-types=REQUEST, ERROR Then the new thread(async one) will not get the security context. You need to check it and stop the filter chain inside it. Or you just use the tranditional sync call like: @RequestMapping(value = "/test", method = RequestMethod.GET) public String test() { return "blank"; } I found another helpful answer. https://jira.spring.io/browse/SPR-12608 Hope it helps!
score: 5

http://stackoverflow.com/a/27150261
upvote count: 3
has comment: http://stackoverflow.com/comment/42797642
type: Answer
has comment: http://stackoverflow.com/comment/42800060
has comment: http://stackoverflow.com/comment/42795050
has comment: http://stackoverflow.com/comment/42795003
has comment: http://stackoverflow.com/comment/42800644
answers question: http://stackoverflow.com/q/27150125
downvote count: 0
has comment: http://stackoverflow.com/comment/42798172
has comment: http://stackoverflow.com/comment/42799982
accepted answer of: http://stackoverflow.com/q/27150125
has comment: http://stackoverflow.com/comment/42803646
has comment: http://stackoverflow.com/comment/42800278
has comment: http://stackoverflow.com/comment/42798973
score: 3
has comment: http://stackoverflow.com/comment/42801699
has comment: http://stackoverflow.com/comment/42798701
has comment: http://stackoverflow.com/comment/42795084
has comment: http://stackoverflow.com/comment/42797293
has comment: http://stackoverflow.com/comment/42800364
has comment: http://stackoverflow.com/comment/42803326
has comment: http://stackoverflow.com/comment/42798479
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42799193
has body: Please take a look at this page. It has examples how to convert it back and forth. Here is the 12hrs to 24hrs conversion. import java.text.SimpleDateFormat; import java.text.DateFormat; import java.util.Date; import java.text.ParseException; String input = "2014-12-20 10:22:12 PM"; //Format of the date defined in the input String DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss aa"); //Desired format: 24 hour format: Change the pattern as per the need DateFormat outputformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null; String output = null; try{ //Converting the input String to Date date= df.parse(input); //Changing the format of date and storing it in String output = outputformat.format(date); //Displaying the date System.out.println(output); } catch (ParseException pe) { pe.printStackTrace(); }
has comment: http://stackoverflow.com/comment/42800087
has comment: http://stackoverflow.com/comment/42797815

http://stackoverflow.com/q/27022943
tagged with: for-loop
answer count: 3
tagged with: string
accepted answer: http://stackoverflow.com/a/27022993
score: 0
has answer: http://stackoverflow.com/a/27023127
has body: I have two Strings,A and B, A has the value of "ABCDE" and B the value of "12345" and I would like to make a for loop that makes the String C, to have the value of "A1B2C3D4E5", the problem is that the value of A and B may vary, A and B can be equal or A greater than B just by one character, only these two options are possible: if(A.length()&gt;B.length()){ B=B+"_"; } int length=A.length()+B.length(); for(int count = 0; count == length;count++){ C=C+A.charAt(count)+B.charAt(count); } System.out.println(C); But nothing prints out.
has answer: http://stackoverflow.com/a/27022993
possible better answer: http://stackoverflow.com/a/27023127
type: AnsweredQuestion
has title: Java for loop prob
has comment: http://stackoverflow.com/comment/42570024
tagged with: java
has answer: http://stackoverflow.com/a/27023341
type: Question

http://stackoverflow.com/comment/42554844
has text: and the java code is???
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27014516
score: 1

http://stackoverflow.com/comment/42705547
comment on: http://stackoverflow.com/a/27090699
score: 0
type: AnswerComment
type: Comment
has text: From the name of your generated lexer, `AnnotationParserLexer `, I think you've put all the rules in one file, which you shouldn't. I specifically mentioned in my answer that you needed to define a separate lexer- and parser-grammar.

http://stackoverflow.com/q/27045979
has comment: http://stackoverflow.com/comment/42610633
type: AnsweredQuestion
has body: I'm struggling with a little problem, I never wrote a bash script before and it may be a little thing for someone who knows how it's done correctly. I have the following folder structure (cannot be changed): MyApp.app |_Contents |_Java |_MyApp.jar |_MacOS |_launch.sh The launch.sh script should start the MyApp.jar executable and currently looks as follows: #!/bin/bash SCRIPT_DIR=$(cd "$(dirname "$0")/../Java"; pwd) exec "$SCRIPT_DIR/jre/bin/java" -Xms256m -XX:PermSize=64m -jar "MyApp.jar" When starting the launch.sh script, the second line should change the current working directory from MyApp.app/Contents/MacOS to MyApp.app/Contents/Java in order to call subsequently java -jar MyApp.jar (3rd line) with its correct root directory as working directory... But as soon as the MyApp.jar starts, I print out the current working directory within my Java application with: System.out.println(System.getProperty("user.dir")); ... and it prints out the directory of the launch.sh script, namely MyApp.app/Contents/MacOS instead of MyApp.app/Contents/Java. Any ideas how to properly change the directory within the bash scripts are highly appreciated : ) ... ?!
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27046269
has answer: http://stackoverflow.com/a/27072993
type: Question
answer count: 2
has title: How to change current working directory within a bash script on Mac OS X?
downvote count: 0
possible better answer: http://stackoverflow.com/a/27072993
tagged with: bash
has comment: http://stackoverflow.com/comment/42610503
has comment: http://stackoverflow.com/comment/42610678
tagged with: shell
has answer: http://stackoverflow.com/a/27046269
tagged with: macos
favorite count: 0

http://stackoverflow.com/q/27149042
has body: I am studying the Struts2 in Action and come to know that Controller in Struts 2 is FilterDispatcher and Model is Action. But previously I knew that Action and FilterDispatcher both are Controllers and Struts does not provide support to Model layer. Which one of the above is wrong?
favorite count: 0
has answer: http://stackoverflow.com/a/27172828
type: UnansweredQuestion
upvote count: 1
tagged with: model-view-controller
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27149300
tagged with: struts
type: Question
answer count: 2
downvote count: 0
has title: Confusion in Struts 2 MVC architecture
tagged with: struts2
tagged with: architecture

http://stackoverflow.com/a/27090525
score: 0
has comment: http://stackoverflow.com/comment/42688117
has body: I just want to suggest a solution that may help you. Try to read file content and assigned into string variable. Now use string.replaceAll method to (* and _) to * = true and _ = false. Than write updated string into file.
answers question: http://stackoverflow.com/q/27090467
type: Answer
has comment: http://stackoverflow.com/comment/42688176
has comment: http://stackoverflow.com/comment/42688216

http://stackoverflow.com/q/27009494
linked to: http://stackoverflow.com/q/7229226
has answer: http://stackoverflow.com/a/27034893
answer count: 1
score: 0
has title: JLabel text in narrow column instead of spread out
has comment: http://stackoverflow.com/comment/42556407
has body: I am trying to have a frame that has a JLabel on it. I have succeeded in adding it to the frame but the text shows up in a narrow column instead of taking up more space in the window. How do I fix this? I tried using the html with no luck. EDIT: The intro panel is the one I am having trouble with. import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DecimalFormat; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class Window implements ActionListener{ JFrame frame = new JFrame("Loan Program"); JFrame intro = new JFrame("Welcome To The Loan Program!"); JPanel panel = new JPanel(new GridBagLayout()); JPanel panel2 = new JPanel(new GridBagLayout()); JPanel panel3 = new JPanel(new GridBagLayout()); JPanel descriptionPanel = new JPanel(new GridBagLayout()); JPanel descriptionPanel1 = new JPanel(new GridBagLayout()); GridBagConstraints g = new GridBagConstraints(); JButton calculate; JButton cancel; JButton reset; JButton introOk; JLabel loanAmount; JLabel loanInterest; JLabel loanPeriod; JLabel monthlyRepayment; JLabel introLabel; JTextField laField; JTextField liField; JTextField lpField; JTextField mrField; DecimalFormat df = new DecimalFormat("#.##"); public Window() { g.insets = new Insets(10, 10, 20, 10); //For the spacing between elements //Initalizing components introLabel = new JLabel(); introOk = new JButton("Ok"); //Setting up text for intro panel String text = " Loan Program 1.0 "; text = text + "This program lets you calculate the various aspects of loans "; text = text + "If you are leaving a field empty then use 0 for its place "; text = text + " Text Fields To Enter "; text = text + "Monthly Payment: Enter values for: Loan Period, Loan Amount, and Loan Interest. Enter 0 for Monthly Payment. "; text = text…
tagged with: jlabel
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: components
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/42555273
has comment: http://stackoverflow.com/comment/42588714

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/27096589
type: Tag

http://stackoverflow.com/comment/45057130
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28228388
has text: The line above can be used to "get rid of" a ^Z in the Scanner object "input". Insert the line before the next read. Note, however, that if there is no data at all, the Scanner object "input" will pause execution at this line and wait for input.

http://stackoverflow.com/comment/42577970
has text: for the sake of all comments I have edited my post and there I attached my errors. please look on it.
score: 0
comment on: http://stackoverflow.com/q/27026430
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27059174
has comment: http://stackoverflow.com/comment/42633285
type: UnansweredQuestion
has body: I am trying to design a mobile chat application with a targeted user over 3lac, I have seen articles related to XMPP server and client approach, node.js with socket.io, but the confusion is which will scale up for so many users. Can this also be achieved using java socket api for so many users.
tagged with: sockets
tagged with: node.js
downvote count: 0
score: 1
tagged with: java
has title: is it good to implement real time chat application in java using sockets for mobile platforms
linked to: http://stackoverflow.com/q/1086380
has answer: http://stackoverflow.com/a/27059847
tagged with: chat
type: Question
tagged with: mobile
answer count: 1
has comment: http://stackoverflow.com/comment/42633615
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/42682663
comment on: http://stackoverflow.com/q/27087203
type: Comment
type: QuestionComment
score: 0
has text: which API level are you using?

http://stackoverflow.com/comment/42612061
type: Comment
has text: Hard to say since it's a 3rd party framework. You should look into its configuration. There's no surefire way to detect a deadlock, so that can easily be a false positive.
comment on: http://stackoverflow.com/a/27044746
score: 0
type: AnswerComment

http://stackoverflow.com/a/27012362
upvote count: 2
answers question: http://stackoverflow.com/q/27012247
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If in doubt about what happens it's fairly easy to test: static class A { public void x() { System.out.println("A.x"); y(); } public void y() { System.out.println("A.y"); } } static class B extends A{ public void y() { System.out.println("B.y"); } } public static void main(String[] args) { A b = new B(); b.x(); } The output is A.x B.y So you can see that is does call the overrided method.
accepted answer of: http://stackoverflow.com/q/27012247
score: 2

http://stackoverflow.com/a/27109673
answers question: http://stackoverflow.com/q/27058249
has comment: http://stackoverflow.com/comment/42793634
has body: Here you go. I had to change the whole program. :) Don't forget the imports again ;) // create the array lists to save the data private static List&lt;String&gt; readTerms = new ArrayList&lt;String&gt;(); private static BufferedWriter bw; public static void main(String[] args) throws Exception { openWriter(); readData(); closeWriter(); } public static void readData() throws Exception { // create readers BufferedReader data = new BufferedReader(new FileReader(new File( "Test.csv"))); BufferedReader term = new BufferedReader(new FileReader(new File( "Terms.txt"))); // read the data and save it into the array lists String line; while ((line = term.readLine()) != null) { readTerms.add(line); } while ((line = data.readLine()) != null) { processLine(line); } // close the readers data.close(); term.close(); } public static void processLine(String line) throws Exception{ String[] splitLine = line.split(","); String finalLine = ""; for(int i = 0; i &lt; splitLine.length; i++){ for(String k : readTerms){ if(splitLine[i].contains(k)){ finalLine += splitLine[i] + ","; } } } finalLine = finalLine.substring(0, finalLine.length() - 1); saveLine(finalLine); } public static void saveLine(String line) throws Exception{ bw.write(line); bw.newLine(); } public static void openWriter() throws Exception{ bw = new BufferedWriter(new FileWriter(new File("words.txt"))); } public static void closeWriter() throws Exception{ bw.close(); }
has comment: http://stackoverflow.com/comment/42776380
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42793658

http://stackoverflow.com/a/27142095
has comment: http://stackoverflow.com/comment/42781638
answers question: http://stackoverflow.com/q/27141685
has comment: http://stackoverflow.com/comment/42781342
has comment: http://stackoverflow.com/comment/42781498
type: Answer
has comment: http://stackoverflow.com/comment/42781869
has comment: http://stackoverflow.com/comment/42782030
has comment: http://stackoverflow.com/comment/42782384
accepted answer of: http://stackoverflow.com/q/27141685
has comment: http://stackoverflow.com/comment/42781743
has comment: http://stackoverflow.com/comment/42781908
has comment: http://stackoverflow.com/comment/42782077
has comment: http://stackoverflow.com/comment/42781340
has comment: http://stackoverflow.com/comment/42781234
has comment: http://stackoverflow.com/comment/42782274
has comment: http://stackoverflow.com/comment/42782054
score: 0
has comment: http://stackoverflow.com/comment/42781365
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42782192
has body: By default all the instance variables of a class are assigned to null in Java. So in your Game class the instance variables are declared like this: public class Game { .... Room currentRoom; String currentMessage; .... } So obviously the variables are not having any objects so they are null. Now from your main method you are doing like this: public static void main(String args[]){ Game g = new Game(); System.out.println(g.getMessage()); g.move("west"); .... } Coming to first line Game g = new Game(); here Java calls the your constructor so the code is: public Game() { ArrayList &lt;Item&gt; myArray = new ArrayList(); currentRoom = hallway; } Here you are assigning the reference currentRoom to hallway which is also null because you are not assigned hallway to any object. Now coming to next line, the getMessage() method of Game class is just returning currentMessage instance variable which is null. So the output of g.getMessage() is null. The next line of main method which is g.move(..), so coming to your move() method: public void move(String direction) { Room nextRoom = currentRoom.getNeighbor(direction); ... } Here you are trying to access the variable currentRoom without initialising it so it still null object so you are getting java.lang.NullPointerException Update: So change the code like this: public Game() { createRooms(); myArray = new ArrayList(); currentRoom = hallway; } in above code you can see that now we are calling createRooms() and also myArray is initialized properly instead of creating a new variable. Also you need to initialize the myNeighbor variable of Room class like this: public Room(String pDescription, Item pItem) { description = pDescription; item = pItem; myNeighbor = new HashMap &lt;String, Room&gt; (); } New Update: Change your move method like this: public void move(String direction) { Room nextRoom = currentRoom.getNeighbor(direction); if (nextRoom == null){ currentMessage = "You can't go in that direction"; } else{ currentRoom = nextRo…

http://stackoverflow.com/q/27105569
tagged with: java
type: Question
has title: How to implement generic resource using REST with Dropwizard
has body: How to implement generic resource using REST with Dropwizard to fetch the list of entity.So that we can use this generic resourse just by giving the entity name.
upvote count: 0
tagged with: dropwizard
answer count: 1
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/27124485
type: UnansweredQuestion
downvote count: 2
score: -2

http://stackoverflow.com/comment/42567551
comment on: http://stackoverflow.com/q/27021465
type: Comment
type: QuestionComment
score: 0
has text: @Ryan: You're incorrect about that. `a++` returns the value of `a` before the increment.

http://stackoverflow.com/a/27127400
score: 0
has body: Move the PDF so you can read it from the classpath. If you are using Maven put it in src/main/resources. Otherwise put it in some package. You can then read it using getResourcesAsStream() method of java.lang.class. InputStream in = this.getClass().getResourcesAsStream("/test.pdf"); //classpath root InputStream in = this.getClass().getResourcesAsStream("/my/package/name/test.pdf"); //from some package Updated final Button viewBtn= new Button("View Policy Schedule"); viewBtn.addClickListener( newButton.ClickListener() public void buttonClick(ClickEvent event) { Window window = new Window(); window.setResizable(true); window.setCaption("Claim Form Covering Letter PDF"); window.setWidth("800"); window.setHeight("600"); window.setModal(true); window.center(); StreamResource.StreamSource s = new StreamResource.StreamSource() { public InputStream getStream() { try { return this.getClass().getResourcesAsStream("/test.pdf"); } catch (Exception e) { e.printStackTrace(); return null; } } }; StreamResource r = new StreamResource(s, fileName); Embedded e = new Embedded(); e.setSizeFull(); e.setType(Embedded.TYPE_BROWSER); r.setMIMEType("application/pdf"); e.setSource(r); window.setContent(e); UI.getCurrent().addWindow(window); } });
type: Answer
answers question: http://stackoverflow.com/q/27126765

http://stackoverflow.com/comment/42587795
type: QuestionComment
has text: That was not included but that is guaranteed to work as my professor gave us that portion of the code.
comment on: http://stackoverflow.com/q/27032445
score: 0
type: Comment

http://stackoverflow.com/comment/42570622
has text: If I had to guess, I'd say that your original code is probably a hair faster as I'm not sure of the internals of `Stream.map` as well as if `toArray` involves resizing the array at any point internally.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27008483

http://stackoverflow.com/q/27013971
score: 4
tagged with: caching
upvote count: 4
has body: Thanks to this forum (How to automatically refresh Cache using Google Guava?), I learn about Guava. I wanted to ask some information about the above topic (How to automatically refresh Cache using Google Guava?) but I can't to write comments for questions because my reputation is too low. Consequently, I have to create a new topic. Thank you for your understanding. Seeing this code, LoadingCache&lt;K, V&gt; cache = CacheBuilder.newBuilder() .refreshAfterWrite(15, TimeUnit.MINUTES) .maximumSize(100) .build(new MyCacheLoader()); if one entry A is loaded with her value at least one time, is really the above code sufficient to reload automatically every 15 minutes the value associated to the key A ? Of course, as mentioned by Frank, "I override the CacheBuilder.reload(K, V) method in MyCacheLoader so it performs asynchronously." Or does i have code to add ? If yes, where ? Thank you very much PS: JB, the javadoc is perfect but my level in english is low. In fact, the overridden reload of my CacheLoader see if a real reload has to be performed for a key, and if yes, realize a real reload for that key; otherwise do not make a real reload of the cache for that key. And, even in the second case (no real reload), does I have a call of my overridden reload method every 15 minutes ? I think so but am I right ? Thanks
downvote count: 0
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/11463675
has comment: http://stackoverflow.com/comment/115142121
has answer: http://stackoverflow.com/a/27059811
accepted answer: http://stackoverflow.com/a/27059811
has title: Automatic cache refresh with Guava
has comment: http://stackoverflow.com/comment/42555497
has comment: http://stackoverflow.com/comment/42561116
type: AnsweredQuestion
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/42554204
linked to: http://stackoverflow.com/q/17456955
type: Question

http://stackoverflow.com/comment/42721207
comment on: http://stackoverflow.com/a/27107568
type: AnswerComment
type: Comment
score: 0
has text: what happens if you paste the url into the windows search bar?

http://stackoverflow.com/comment/42624967
type: AnswerComment
comment on: http://stackoverflow.com/a/27035736
type: Comment
has text: Hi @JCS, see my updated answer if you found any problem with current modification, thanks!
score: 0

http://stackoverflow.com/q/27035605
has comment: http://stackoverflow.com/comment/42592089
has title: Why doesn't my if statement work with (red || green || blue) > 255
answer count: 4
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27035641
possible better answer: http://stackoverflow.com/a/27035628
has answer: http://stackoverflow.com/a/27035636
has answer: http://stackoverflow.com/a/27035628
accepted answer: http://stackoverflow.com/a/27035641
has body: here's my code: import java.util.Scanner; public class RGBColor { // instance variables private int _red; private int _green; private int _blue; /** * Constructor for objects of class RGBColor */ public RGBColor() { // initialise instance variables _red=_green=_blue=0; } public RGBColor(int red, int green, int blue) { if(((red || green || blue) &gt; 255) || ((red || green || blue) &lt; 0)) red=_green=_blue=0; else { _red = red; _green = green; _blue = blue; } } public RGBColor(RGBColor other) { System.out.print("Please enter 3 integers which will represent colors: "); System.out.println("First one, RED."); Scanner getColors = new Scanner(System.in); System.out.println("Second one, GREEN."); Scanner getGreen = new Scanner(System.in); System.out.println("Third one, BLUE."); Scanner getBlue = new Scanner(System.in); } public int getRed() { return _red; } public int getGreen() { return _green; } public int getBlue() { return _blue; } public void setRed(int num) { if(((red || green || blue) &gt; 255) || ((red || green || blue) &lt; 0)) break; else _red = num; } public void setGreen(int num) { _green = num; } public void setBlue(int num) { blue_ = num; } } I'm having problems in this line: if(((red || green || blue) &gt; 255) || ((red || green || blue) &lt; 0)) bad operand types for binary operator ||. Any ideas how to fix it? My code is very simple so I believe I don't have to explain anything. I just don't understand why I can't check if integer is greater than 255 for e.g. Thanks on advance!
has answer: http://stackoverflow.com/a/27035826
score: 0

http://stackoverflow.com/a/27009352
downvote count: 0
type: Answer
has body: use Integer.parseInt(key.nextLine()); public class ObjectArray{ public static void main(String args[]) { Scanner key = new Scanner(System.in); Two[] obj = new Two[3]; for (int i = 0 ; i &lt; 3 ; i++) { obj[i] = new Two(); obj[i].name = key.nextLine(); obj[i].grade = key.nextLine(); obj[i].roll = Integer.parseInt(key.nextLine()); } for (int i = 0 ; i &lt; 3 ; i++) { System.out.println("Name = " + obj[i].name + " Grade = " + obj[i].grade + " Roll = " + obj[i].roll); } } } class Two { int roll; String name, grade; } output a a 1 b b 2 c c 3 Name = a Grade = a Roll = 1 Name = b Grade = b Roll = 2 Name = c Grade = c Roll = 3
score: 1
answers question: http://stackoverflow.com/q/27009151
upvote count: 1

http://stackoverflow.com/a/27148880
answers question: http://stackoverflow.com/q/27148735
score: 0
has comment: http://stackoverflow.com/comment/42793284
type: Answer
has body: Do a details.endswith(".csv") on the file name. (NOTE!! Un-tested code) if(details.endsWith(".csv")) { CsvFiles.add(details); } With your code (and some clean up): private static ArrayList&lt;String&gt; CsvFiles(FTPFile[] files) { ArrayList&lt;String&gt; CsvFiles = new ArrayList&lt;&gt;(); // get list of files on given path for (FTPFile file : files) { if(file.getName().endsWith(".csv")) { CsvFiles.add(details); } } return CsvFiles; }

http://stackoverflow.com/a/27083842
answers question: http://stackoverflow.com/q/27083821
has body: If I understand your question then you could pass a negative value as the second argument to Calendar.add(int field, int value) like int amount = -10; cal.add(Calendar.MILLISECOND, amount); to subtract 10 milliseconds from the Calendar cal.
has comment: http://stackoverflow.com/comment/42717572
score: 1
has comment: http://stackoverflow.com/comment/42717977
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27083821

http://stackoverflow.com/comment/42714623
comment on: http://stackoverflow.com/a/27104644
score: 0
type: AnswerComment
has text: You mean the Jar created by IntelliJ?
type: Comment

http://stackoverflow.com/comment/42701560
type: QuestionComment
comment on: http://stackoverflow.com/q/27097901
score: 0
has text: why `job.setInputFormatClass` is commented ?
type: Comment

http://stackoverflow.com/a/27107429
score: 0
answers question: http://stackoverflow.com/q/27099683
has comment: http://stackoverflow.com/comment/42730351
type: Answer
has body: I think this might be caused by version issues in birt pom.xml of the maven repository. I got many troubles with Maven in this version. You should try this: set the BIRT maven dependency to "provided" in your project, and add "manually" all jars to your app from the official Eclipse birt-runtime 4.4.0 package. For example, on my side i created a custom local Maven dependency in Netbeans to handle this and it works pretty well. I hope it will help.
has comment: http://stackoverflow.com/comment/42776397
has comment: http://stackoverflow.com/comment/42744666

http://stackoverflow.com/comment/42597314
comment on: http://stackoverflow.com/a/27038698
score: 0
type: AnswerComment
has text: This did work, thanks! Any idea how can I move to other pair of strings?
type: Comment

http://stackoverflow.com/q/27069486
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27070596
accepted answer: http://stackoverflow.com/a/27070596
has comment: http://stackoverflow.com/comment/42652960
has body: First i want to retrieve patient linked list from AddPatient() method and show it on ListPatient() Method. I try to retrieve by changing public static void ListPatient(); method to public static void ListPatient(ListInterface&lt;PatientDetails&gt; patient) but it doesn't work package dsa; import dsa.LList; import dsa.ListInterface; import java.sql.Time; import java.util.Date; import java.util.Scanner; public class EmergencyClinic { public static void main(String[] args){ MainMenu(); } public static void MainMenu(){ int n = 0; Scanner scan = new Scanner(System.in); System.out.println("Welcome to Emergency Clinic!"); System.out.println("1. Add Patient"); System.out.println("2. Serve Patient"); System.out.println("3. List Patient"); System.out.print("Please choose your option :"); n = scan.nextInt(); switch(n){ case 1: AddPatient(); break; case 2: ServePatient(); break; case 3: ListPatient(); break; default : System.out.println("Sorry! Invalid Input. Returning to main menu...\n"); MainMenu(); break; } } public static void AddPatient(){ ListInterface&lt;PatientDetails&gt; patient = new LList&lt;PatientDetails&gt;(); Scanner scan = new Scanner(System.in); int num=0; System.out.print("Please Enter Name :"); String name = scan.nextLine(); System.out.print("Please Enter IC No :"); String ic = scan.nextLine(); System.out.print("Please Enter Contact Number :"); String contactNum = scan.nextLine(); System.out.print("Please Enter Gender :"); String gender = scan.nextLine(); Date date = new Date(); Long time = date.getTime(); System.out.print("Please Enter Reason :"); String reason = scan.nextLine(); System.out.print("Please Enter Seriousness :"); String seriousness = scan.nextLine(); if(patient.isEmpty()) { patient.add(new PatientDetails(name, ic, contactNum, gender,date ,time ,reason,seriousness )); } MainMenu(); } public static void ServePatient(){ } public static void ListPatient(){ ListInterface&lt;PatientDetails&gt; patient = new LList&lt;PatientDetails&gt;(); System.out.p…
score: 0
possible better answer: http://stackoverflow.com/a/27070185
has answer: http://stackoverflow.com/a/27070185
has title: How to pass or retrieve linked list from one method to another method?

http://stackoverflow.com/q/27141033
tagged with: variables
favorite count: 0
score: -3
has answer: http://stackoverflow.com/a/27141044
has answer: http://stackoverflow.com/a/27141116
type: AnsweredQuestion
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/27141116
type: Question
accepted answer: http://stackoverflow.com/a/27141044
answer count: 2
has comment: http://stackoverflow.com/comment/42779516
has title: Java - "i" cannot be resolved as a variable issue
upvote count: 0
has body: I am working on this program and I keep getting this error in Java Eclipse saying that "i cannot be resolved to a variable." when I try to get the output.. Here is the relevant code. for (int i = 0; i &lt; animal.length; i++){ animal[i].move(); animal[i].makeSound(); if (animal[i] instanceof Leopard) animal[i].findTree(); if (animal[i] instanceof Bat) animal[i].locateInsect(); if (animal[i] instanceof Chameleon) animal[i].changeColor(); } System.out.println(animal[i].getName()); System.out.println(); This is the line that shows the error but I am not sure why its causing an error message. System.out.println(animal[i].getName());

http://stackoverflow.com/a/27096287
type: AcceptedAnswer
has body: The problem is with this line: String query = "insert into ChampionData(`Champion`,`User`,`TimeStamp`,`Opponet`,`Lane`,`Role`,`Kills`,`Deaths`,`Assists`,`CS`,`Gold`,`W/L`,`TotalGameTime`) values(?,?,?,?,?,?,?,?,?,?,?,?)"; The table ChampionData has 13 columns: `Champion` `User` `TimeStamp` `Opponet` `Lane` `Role` `Kills` `Deaths` `Assists` `CS` `Gold` `W/L` `TotalGameTime` While the row you're trying to insert has only 12 columns (as evidenced by the 12 question marks)
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42698127
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27096232
answers question: http://stackoverflow.com/q/27096232
upvote count: 2

http://stackoverflow.com/a/26995557
downvote count: 0
answers question: http://stackoverflow.com/q/26995358
has body: Yes, It is possible with eclipse custom templates. Open Window -&gt; Preferences and type Templates into the search box. Refer this official help guide to understand easily.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/27096850
type: Question
has comment: http://stackoverflow.com/comment/42734769
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27116102
tagged with: ant
tagged with: java
score: 0
answer count: 1
has title: Ant 'fail unless' failing even though property exists
favorite count: 0
has comment: http://stackoverflow.com/comment/42730663
has body: I have an Ant script that is failing where it shouldn't. properties file: application.foo.name=foo application.foo.path=[path-to-foo] application.foo.file=foo.jar appName= code: <equals arg1="${appName}" arg2="" /> <isset property="${appName}" /> <equals arg1="${appSelected}" arg2="true" /> <antcall inheritAll="true" target="deploy" /> <echo message="Deploying from property: application.${appName}.file" /> <propertycopy silent="true" name="appFile" from="application.${appName}.file" /> <propertycopy silent="true" name="appPath" from="application.${appName}.path" /> <echo message="appFile: ${appFile}" /> <fail unless="${appFile}" message="appfile: ${appFile} No application with the name ${appName} is defined in your properties file." /> output: [echo] Deploying from property: application.foo.file [echo] appFile: foo.jar ERROR: The following error occurred while executing this line: appfile: foo.jar No application with the name foo is defined in your properties file. It's even printing out the value of the property, but thinks it doesn't exist! Any reason why?
has answer: http://stackoverflow.com/a/27116102
tagged with: ant-contrib
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/42721717
type: AnswerComment
comment on: http://stackoverflow.com/a/27107880
score: 0
type: Comment
has text: Are you sure that method shouldn't be static? Or remove the parameter: `public boolean isFirst() { return this == first }`

http://stackoverflow.com/q/27008458
upvote count: 0
has comment: http://stackoverflow.com/comment/42545083
has comment: http://stackoverflow.com/comment/42545079
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27008549
has title: What is Java result:3?
has comment: http://stackoverflow.com/comment/42545065
type: Question
tagged with: java
has body: I'm currently learning programming (java) and I've been using a program that runs on command prompt but as an exercise, I've been asked to run it on netbeans and to find out how it can work on it. When I run the program this is the output that I got. run: Please specify a path to a pricing catalogue file Java Result: 3 BUILD SUCCESSFUL (total time: 0 seconds) I've spent several hours on this issue but I was not able to sort it out. Can anybody help me with it please. Here is the codes. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.StringTokenizer; public class Grocery { private static Catalogue pricingCatalogue; private static HashMap&lt;String, Double&gt; inputItemList = new HashMap&lt;String, Double&gt;(); private static ArrayList&lt;PurchasedProduct&gt; purchasedItemList; public static void main(String[] args) { if( args.length != 1 ) { System.err.println( "" ); System.exit( 3 ); } generateCatalogue( args[0] ); gatherUserInput(); rateItem(); printItemizedBill(); } private static void generateCatalogue( String inputFile ) { try { List&lt;String&gt; lines = Files.readAllLines( Paths.get(inputFile), Charset.defaultCharset() ); pricingCatalogue = new Catalogue(); Boolean compareIgnoreCase = false; for (String line : lines) { StringTokenizer token = new StringTokenizer( line, "|" ); String productName = (String)token.nextElement(); String rateName = (String)token.nextElement(); String rateDescr = (String)token.nextElement(); Double effectiveQuantity = new Double( (String)token.nextElement() ); Double effectivePrice; String tierPrice; Rate newRate; Product newProduct; if( effectiveQuantity == -1 ) { tierPrice = (String)token.nextElement(); newRate = new Rate( rateName, rateDescr, tierPrice ); } …
score: -1
answer count: 1
downvote count: 1
tagged with: java-io
favorite count: 0
has comment: http://stackoverflow.com/comment/42545147
has comment: http://stackoverflow.com/comment/42545126
has comment: http://stackoverflow.com/comment/42545391

http://stackoverflow.com/comment/42711477
has text: @CocoNess I meant axis-aligned.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27103771

http://stackoverflow.com/comment/42623468
type: Comment
comment on: http://stackoverflow.com/a/27035218
type: AnswerComment
has text: In that pic, if I were to move my mouse past the center point of the tile my mouse is on, then it would move over the correct tile. So yes. I've tried offsetting it so that instead of the center of the tile, it's on the edge of the tile. And the worked somewhat, except that it only works perfectly if my mouse were in the center of the edge of said tile, if you get what I'm saying. Basically it is acting as if the bounding box of each tile is a rectangle, not a diamond
score: 0

http://stackoverflow.com/comment/42654980
comment on: http://stackoverflow.com/q/27071044
score: 0
type: Comment
type: QuestionComment
has text: Why do you need to create a stored procedure from code like this? And why are you selecting *?

http://stackoverflow.com/q/27136131
has body: I create JFreeChart program that can: move points of splines don't allow to cross black splines (boundary splines) create new splines in real-time (as Grapher) mouse wheel zoom For adding new series to dataset I use this function: public static XYSeriesCollection createSplineDataset(File[] polFiles) { dataset = new XYSeriesCollection(); for (File polFile : polFiles) { XYSeries series = new XYSeries(polFile.getName()); Scanner s = null; try { s = new Scanner(new File(polFile.getAbsolutePath())); }catch (FileNotFoundException ex) { System.out.println("Scanner error!"); } s.useLocale(Locale.US); while (s.hasNext()) { float x = s.nextFloat(); float y = s.nextFloat(); series.add(x, y); } dataset.addSeries(series); } return dataset; } Main program (there 500+ strings of code, so this is part of it): public class SplineDemo { // declaration of variables private static void display(){ final File[] polFiles = new File("FORPLOT").listFiles(); polFiles[0] = new File("FORPLOT/InitPolin1"); polFiles[1] = new File("FORPLOT/InitPolin0"); for (int i = 2; i &lt;= 36; i++) polFiles[i] = new File("FORPLOT/P"+(i-2)); dataset = JFunc.createSplineDataset(polFiles); // create dataset // --------some code----------- NumberAxis domain = new NumberAxis("\u03C1"); NumberAxis range = new NumberAxis("g(\u03C1)"); SplineRenderer r = new SplineRenderer(20); xyplot = new XYPlot(dataset, domain, range, r); final XYLineAndShapeRenderer render = (XYLineAndShapeRenderer) xyplot.getRenderer(); render.setBaseShapesVisible(true); final JFreeChart chart = new JFreeChart(xyplot); // --------some code----------- chartPanel = new ChartPanel(chart){ @Override public Dimension getPreferredSize() { return new Dimension(640, 480); } }; chart.removeLegend(); chartPanel.addMouseListener(new MouseListener() { //------ for creating new splines and to move points of splines --------- }); chartPanel.addMouseWheelListener(new MouseWheelListener() { //--------- zoom ------------ }); chartPanel.addMouseMotionListener(new…
has title: Java Swing - JFreeChart app works slowly
tagged with: swing
score: 2
tagged with: performance
tagged with: java
tagged with: jfreechart
has answer: http://stackoverflow.com/a/27177515
has comment: http://stackoverflow.com/comment/42844213
has comment: http://stackoverflow.com/comment/42775752
type: Question
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/27115009
linked to: http://stackoverflow.com/q/11870416
favorite count: 0
has comment: http://stackoverflow.com/comment/43152771
upvote count: 2
linked to: http://stackoverflow.com/q/13205251
type: UnansweredQuestion

http://stackoverflow.com/comment/42557228
comment on: http://stackoverflow.com/q/27015856
type: Comment
score: 0
has text: I run the following commands : mvn install ,cd webapp,mvn jetty:run-war
type: QuestionComment

http://stackoverflow.com/a/27005028
score: 0
type: Answer
has body: I've had problems in axis and axis 2 swnding lists of lists and such. You don't need the matrix to be n-dimensional. Just send one big one-dimensional array and the dimensions after peopcessing. In your case ad width and heigth and send all the ints as a one big row in order. Another way: bytearray them and encode in base64
answers question: http://stackoverflow.com/q/27003743
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27003743
has comment: http://stackoverflow.com/comment/42541817

http://stackoverflow.com/q/27021626
favorite count: 0
possible better answer: http://stackoverflow.com/a/27021990
has comment: http://stackoverflow.com/comment/42593147
has answer: http://stackoverflow.com/a/27021990
has answer: http://stackoverflow.com/a/27022227
tagged with: css
type: AnsweredQuestion
tagged with: twitter-bootstrap
upvote count: 1
has body: Gwt uses standardized css class names such as .gwt-Image .gwt-Button and so on. This prevents me from using these classes with popular css frameworks such as bootstrap. Is there a way I can override these default style names and use bootstrap or foundation compliant class names ?
type: Question
tagged with: gwt
accepted answer: http://stackoverflow.com/a/27022227
score: 1
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/27027694
has title: Overriding the default widget class names in gwt
downvote count: 0

http://stackoverflow.com/a/27049097
answers question: http://stackoverflow.com/q/27049059
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The problem is that you have multiple returns in the same function. When a return executes the function exits meaning that the code below will never be able to be run and thus it is unreachable. So in this: public int function(){ value = 0 //do stuff return value //do more things } "do more things: will never be able to be run because the function stops running as soon as return value is encountered. This code is said to be unreachable. Put your code in multiple functions, each with only one return, and then call those functions from your main or wherever you want to use them as necessary
has comment: http://stackoverflow.com/comment/42616383
score: 5
accepted answer of: http://stackoverflow.com/q/27049059
upvote count: 5
has comment: http://stackoverflow.com/comment/42621298

http://stackoverflow.com/a/29145500
answers question: http://stackoverflow.com/q/26997861
type: Answer
has body: junit-4.11.jar and junit-License.html causes problem of supporting 0 devices on playstore. Please check which library or jar file in your is using this. Then you have to remove them and then upload your app. In my case, core.jar had these files, just open the jar file using winrar, go to lib folder and delete these 2 files. There will be no problem in functioning of jar file by doing this.
score: 0

http://stackoverflow.com/a/27113230
has body: You also can use RegEx that'll find all values in ${} \b*\u0024\{([\w\s]*)\}\B where u0024 is a $ in unicode and test in regexplanet Here is an example of code: Pattern pattern = Pattern.compile("\\b*\u0024\\{([\\w\\s]*)\\}\\B"); String data = ...//String to parse Matcher matcher = pattern.matcher(data); // check all occurrence while (matcher.find()) { ... }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27112768
downvote count: 0

http://stackoverflow.com/comment/42720880
score: 0
type: AnswerComment
has text: FWIW The annotation you mention is for the L2 cache not L1
type: Comment
comment on: http://stackoverflow.com/a/27107559

http://stackoverflow.com/a/27150394
has body: You have to parse the string first as a date and then format the date: SimpleDateFormat dateFormatP = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); Date parsedDate = dateFormatP.parse(reqJsonObj.getString(FROM_DATE)); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.format(parsedDate );
answers question: http://stackoverflow.com/q/27150278
upvote count: 1
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42655345
comment on: http://stackoverflow.com/q/27071351
type: QuestionComment
has text: Can you provide example of what you set third parameter to?
score: 1
type: Comment

http://stackoverflow.com/q/27145591
type: Question
has comment: http://stackoverflow.com/comment/42789510
tagged with: graphics
tagged with: java
has comment: http://stackoverflow.com/comment/42787006
has comment: http://stackoverflow.com/comment/42787430
has title: Why do my original components disappear when I operate ActionListener?
upvote count: 0
has comment: http://stackoverflow.com/comment/42788795
score: -2
answer count: 1
tagged with: user-interface
has body: --------------------------------------------------------EDITED------------------------------------------------------------------ The adding section works nicely now the button! I added newly implementation with the same logic, but this time around, deleting the section that was just added. I tried it out but the problem is that it doesn't delete the section just added. Also, I would like to use g.addString when adding section but how do I go about doing so? Thank you so much! import java.awt.Font; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class Main { private JFrame jf; private JTextField jtf1; private JTextField jtf2; private Panel p; private JComboBox jcb1; private JComboBox jcb2; private JButton button; private String tools[] = {""}; //ActionListener Variables private int string1 = 170; private int string2 = 170; private int yJtf1 = 140; private int yJtf2 = 165; private int cb1 = 143; private int cb2 = 168; private int count = 0; public Main() { jf = new JFrame(); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(700, 700); p = new Panel(); jtf1 = new JTextField("", 20); jtf2 = new JTextField("", 20); jcb1 = new JComboBox(tools); jcb2 = new JComboBox(tools); button = new JButton("+"); p.add(jtf1); jtf1.setBounds(75, 30, 135, 25); p.add(jtf2); jtf2.setBounds(75, 60, 135, 25); p.add(button); plusButton.setBounds(350, 153, 41, 25); button.addActionListener(new ButtonClicked()); p.add(button2); plusButton.setBounds(350, 153, 41, 25); minusButton.addActionListener(new NewButtonClicked()); p.add(jcb1); jcb1.setBounds(80, 143, 80, 20); p.add(jcb2); jcb2.setBounds(80, 168, 80, 20); jf.add(p); jf.setVisible(true); ` } public class Panel extends JPanel { public Panel() { this.setLayout(null); } public void paintComponent(Graphics g…
has answer: http://stackoverflow.com/a/27145949
favorite count: 0
linked to: http://stackoverflow.com/q/5665156
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/42788077
has comment: http://stackoverflow.com/comment/42787478
tagged with: swing

http://stackoverflow.com/a/27060003
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Please take a look at: Google App Engine (Java) -> Storing Data -> Datastore -> Entities, Properties, and Keys In section "Properties and value types" you will find the supported/allowed property types. For date and time properties only java.util.Date is supported. This means you need to convert the org.joda.time.LocalDate to a java.util.Date instance before setting the property of an entity. Please refer on following post for conversation: How to convert Joda LocalDate to java.util.Date?
answers question: http://stackoverflow.com/q/27059473
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27059473

http://stackoverflow.com/q/27148728
tagged with: time
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27149057
has answer: http://stackoverflow.com/a/27148907
tagged with: java
has body: I have a CSV file which contains the following data: red, 03/11/2014, 11:00, 10 blue, 04/11/2014, 12:00, 15 pink, 03/11/2014, 15:00, 50 blue, 05/11/2014, 14:00, 15 pink, 02/11/2013, 12:00, 10 green, 03/12/2014, 23:00, 1 red, 03/11/2013, 23:11, 11 I am trying to print the date and the time but keeps failing. The code works fine when public static final String DATE_TIME_FORMAT_DATA = "dd/MM/yyyy HH:mm"; is changed to public static final String DATE_FORMAT = "dd/MM/yyyy"; but that will only print the date. The code: import java.io.File; import java.io.FileNotFoundException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.Scanner; public class RangeCalculator { private File file; public static final String DATE_TIME_FORMAT_DATA = "dd/MM/yyyy HH:mm"; public class Entry { String colour; String date; String time; String noise; public Entry(String colour, String date, String time, String noise) { super(); this.colour = colour; this.date = date; this.time = time; this.noise = noise; } // implement getters and setters here if necessary @Override public String toString() { return "Entry [colour=" + colour + ", date=" + date + ", time=" + time + ", noise=" + noise + "]"; } } public RangeCalculator(String fileName) { file = new File(fileName); } private List&lt;Entry&gt; computeRange(String from, String to) throws FileNotFoundException, ParseException { List&lt;Entry&gt; result = new LinkedList&lt;&gt;(); SimpleDateFormat formatter = new SimpleDateFormat(DATE_TIME_FORMAT_DATA); Date fromDate = formatter.parse(from); Date toDate = formatter.parse(to); Scanner scanner = new Scanner(file); scanner.useDelimiter("[,\n]"); // maybe you want/need to skip the first line of the file // if (scanner.hasNextLine()) { // scanner.nextLine(); // } while (scanner.hasNextLine()) { String color = scanner.next(); String date = scanner.next().substring(1); String time = scanner.next().sub…
type: Question
has title: printing date and time java
tagged with: date
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42792632

http://stackoverflow.com/comment/42765839
type: QuestionComment
has text: Note that even if you did have multiple threads, *local variables* still aren't normally shared. If you start two threads, and both threads call a `mainProcess` method, and that method has a local variable (like `a` in your example), each method would still have its own copy of that variable and there wouldn't be a concurrency issue.
score: 2
comment on: http://stackoverflow.com/q/27133521
type: Comment

http://stackoverflow.com/q/27055503
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42627390
has body: I am using JSONArray for saving dynamic values,the values can be integer or double values,I need to find average and median for those values in JSONArray,for that I am saving the values in arraylist and trying to find average,since the list consist of integer or double values it is showing Classcast exception.Please give me solution for finding average and median for arraylist values(Integer or double values).I have tried with code below but it looping double the array size.... for (Object o : list) { if (o.getClass().equals(Integer.class)) { handleint(list); } else if (o.getClass().equals(Double.class)) { handledouble(list); } } for(Object obj: list){ if(obj instanceof Double) { sum1 = sum1 + ((Double) obj).doubleValue(); average = sum1 / list.size(); } else if(obj instanceof Integer) { sum1 = sum1 + ((Double) obj).doubleValue(); average = sum1 / list.size(); } }
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42627341
type: Question
has comment: http://stackoverflow.com/comment/42627681
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42627598
has comment: http://stackoverflow.com/comment/42627243
has comment: http://stackoverflow.com/comment/42627567
has title: Find average of dynamic arraylist with decimal and integer values java
has answer: http://stackoverflow.com/a/27055550
tagged with: java
has answer: http://stackoverflow.com/a/27055554
tagged with: arrays

http://stackoverflow.com/q/27111428
has comment: http://stackoverflow.com/comment/42728843
type: Question
has comment: http://stackoverflow.com/comment/42726076
has body: I am refactoring some Java code that generates some HTML using many raw StringBuilder.append operations. In order to be more expressive and easier to read/maintain I'd like to use a simple templating system like Apache Velocity instead. In the code snippet below, MyClass takes a string, which holds the contents of the template (loaded from a file), and instantiates a corresponding org.apache.velocity.Template object. Now, I understand that in many applications there could be multiple templates and it might be handy to be able to look them up by name, but in my application there is just one and I never need to look it up because I have a reference to it. My questions are then: Why do I need to define a name for each template when I parse it? (e.g. to satisfy the signature of org.apache.velocity.runtime.RuntimeServices.parse) Am I missing something here / doing something horribly wrong? public class MyClass { private static final String TEMPLATE_NAME = "dummy name"; private Template template; public MyClass(String templateString) throws ParseException { Velocity.init(); loadTemplate(templateString); } private void loadTemplate(String templateString) throws ParseException { RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices(); SimpleNode templateContent = runtimeServices.parse(templateString, TEMPLATE_NAME); template = createTemplate(runtimeServices, templateContent); } private Template createTemplate(RuntimeServices runtimeServices, SimpleNode templateContent) { Template template = new Template(); template.setRuntimeServices(runtimeServices); template.setData(templateContent); template.initDocument(); return template; } }
has comment: http://stackoverflow.com/comment/42728941
has comment: http://stackoverflow.com/comment/42730141
downvote count: 0
has title: Why do velocity templates require a name?
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: velocity
answer count: 0
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/43922499
comment on: http://stackoverflow.com/a/27020488
type: Comment
score: 6
type: AnswerComment
has text: I didn't need to add the path to the `ini` file, because the x64 installer just made new symlinks in `C:\ProgramData\Oracle\Java\javapath` pointing to the x64 binaries. Of course the next time an x86 update is installed, this is going to point back to x86 binaries until the update for x64 is installed. It's better to add the path, but you will need to update it each time there is an update to Java 8 x64.

http://stackoverflow.com/comment/42621100
type: Comment
has text: I guess hibernate may let you load SimulationStats lazily. Please also include how you're mapping your entities to tables. I mean, I think hibernate will first execute the query and only after that it will create objects and fill them with values (not sure, but it makes sense for me), so you may have to tell hibernate not to load your stats by default.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27051866

http://stackoverflow.com/comment/42692018
comment on: http://stackoverflow.com/q/27092858
has text: But there is no insertion here at all. It is swapping two characters. I think you need to formalize the rules of input transformation to make this question answerable.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42530667
has text: No, I don't : `I would suggest you a ternary operator`
comment on: http://stackoverflow.com/a/26999974
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42541740
type: QuestionComment
score: 2
has text: It's easy, pick each character an put an ".*" before it (and another at the end of the string). You will have build your RegEx... not the best solution (for the best solution I will recommend Stack Exchange), but solves your problem. I think, haha.
comment on: http://stackoverflow.com/q/27006267
type: Comment

http://stackoverflow.com/q/27058092
has comment: http://stackoverflow.com/comment/42633964
upvote count: 1
has title: ArrayIndexOutOfBoundsException coming in this array using java?
accepted answer: http://stackoverflow.com/a/27058881
possible better answer: http://stackoverflow.com/a/27058155
answer count: 6
has comment: http://stackoverflow.com/comment/42631575
has answer: http://stackoverflow.com/a/27058995
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42633919
has answer: http://stackoverflow.com/a/27058217
tagged with: indexoutofboundsexception
has body: I have an array of numbers in Java and need to output the ones that consist of only duplicated digits. However, my code throws an ArrayIndexOutOfBoundsException. Where is the problem? int[] inputValues= {122, 2, 22, 11, 234, 333, 000, 5555, 8, 9, 99}; for (int i = 0; i &lt; inputValues.length; i++) { int numberLength = Integer.toString(inputValues[i]).length(); // System.out.println(numberLength); if (numberLength &gt; 1) { //more than one digit in the number String s1 = Integer.toString(inputValues[i]); String[] numberDigits = s1.split(""); for (int j = 1, k = 1; j &lt; numberDigits.length; k++) { if (numberDigits[j].equals(numberDigits[k + 1])) { System.out.println("Duplicate values are:"); //I need to print 22,11,333,000,5555,99 } } } }
downvote count: 1
has answer: http://stackoverflow.com/a/27058881
has answer: http://stackoverflow.com/a/27058592
has comment: http://stackoverflow.com/comment/42632878
tagged with: arrays
has comment: http://stackoverflow.com/comment/42631494
has answer: http://stackoverflow.com/a/27058794
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42633618
favorite count: 0
has answer: http://stackoverflow.com/a/27058155
type: Question

http://stackoverflow.com/q/27011985
has body: I am newbie to java, and developing a real life project. I have many methods and about 2500 lines of code thus far. Many of the methods are slightly different(usually a difference of mere a single identifier) due to which i have to copy the code again and again with slight changes. What i want is to pass a method as parameter to another method, I've gone through lambda expressions but i could not find it enough appealing, off-course due to my own conceptual shortcomings. because it tells to define functional interface of each method to be passed. but as per my thoughts it would not give me a generic code so that i would be able to simply add some other Tables in future. i am putting a piece of code to demonstrate and better explain my problem. if(houseTabPanel.getComponentCount()==0){ houseTableDb(); } if(isSelected){ selection(houseTable); } else { houseTable.setColumnSelectionAllowed(false); houseTable.setRowSelectionAllowed(false); houseTable.setCellSelectionEnabled(false); Rselection(houseTable); } now i have different methods named houseTableDb() , plotTableDb() , adminTableDb() etc. i want to make a method of this piece of code and pass plotTableDb() etc as parameter.. something like... public void genericMethod(JPanel p, JTable t, some method reference to use instead of houseTableDb){} pardon me if am not descriptive enough.. any response would be truly appreciated by core of the heart.
has answer: http://stackoverflow.com/a/27012144
accepted answer: http://stackoverflow.com/a/27012144
possible better answer: http://stackoverflow.com/a/27012086
type: Question
has answer: http://stackoverflow.com/a/27012086
type: AnsweredQuestion
tagged with: java
tagged with: methods
answer count: 2
score: 0
has title: How to pass a concrete method as parameter to another concrete method
tagged with: arguments
linked to: http://stackoverflow.com/q/2186931
has comment: http://stackoverflow.com/comment/42550727

http://stackoverflow.com/a/27040910
type: Answer
has comment: http://stackoverflow.com/comment/42628105
answers question: http://stackoverflow.com/q/27040439
has comment: http://stackoverflow.com/comment/42630676
has comment: http://stackoverflow.com/comment/42632559
has comment: http://stackoverflow.com/comment/42865969
upvote count: 1
has comment: http://stackoverflow.com/comment/42866118
has body: A revid always span modifications in multiple tables! Yes, the inserts are called at the end of the transaction, but: If you use optimistic transaction isolation, a transaction can read the uncommitted state of another transactions that are currently active but not yet committed. If you become a integrityconstraintsviolation the column rev_id is unfortunatelly configured "unique". This is a wrong database schema! Correct the schema by removing the Uniqueness of the column rev_id! The rev_id-Column in the global-hibernate-relationtable must be unique because it is a Primary-Key! (the global-hibernate-relationtable usually contains also a timestamp).
downvote count: 0
score: 1

http://stackoverflow.com/comment/42642971
has text: So don't make it static. Why your method needs to be static? I edited my answer to fit in your case.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27064427

http://stackoverflow.com/a/27061507
has comment: http://stackoverflow.com/comment/53527642
upvote count: 1
score: 1
downvote count: 0
has body: You can implement sessionListener and in that you do redirect in case of session expire.Refer this link http://www.mkyong.com/servlet/a-simple-httpsessionlistener-example-active-sessions-counter/
type: Answer
answers question: http://stackoverflow.com/q/27059519

http://stackoverflow.com/comment/42593885
has text: Seriously, who are those complete idiots that downvote questions without giving a reason at all ?
type: QuestionComment
comment on: http://stackoverflow.com/q/27012567
score: 0
type: Comment

http://stackoverflow.com/q/27047132
has answer: http://stackoverflow.com/a/27047219
accepted answer: http://stackoverflow.com/a/27048488
has comment: http://stackoverflow.com/comment/42613086
has body: I am working on project where I need to copy some part of each line from 1st text file to other. In the first text each data is separated by splitter --@ (which i have used). I want to get the 1st two parts of actual 4 parts total of 3 splitters Ex: Hello--@StackOverflow--@BMWCar--@Bye. I just want to fetch 1st 2 parts .ie. Hello--@StackOverflow from all the lines of first text file to second text file. I have tried everything and could not get it to work. Please help me out of this. :)
has title: Copy part of line from 1 text to 2nd text file
has comment: http://stackoverflow.com/comment/42616195
has comment: http://stackoverflow.com/comment/42612563
has comment: http://stackoverflow.com/comment/42617531
has answer: http://stackoverflow.com/a/27047300
answer count: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42612600
tagged with: file
has answer: http://stackoverflow.com/a/27048488
type: Question
has answer: http://stackoverflow.com/a/27047271
score: 0
has comment: http://stackoverflow.com/comment/42615643
possible better answer: http://stackoverflow.com/a/27047219

http://stackoverflow.com/comment/42702475
comment on: http://stackoverflow.com/a/27098748
has text: (a) Why? And (b) what don't you understand about how to perform benchmarks? Just test and measure.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27046614
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: LibGDX smooth admob interstitial between screens
has body: I am looking to implement admob interstitals between screens in my libGDX game. I am loading the ad when the MainMenuScreen class is called(every four times) I have it working except every time I show the ad my game screen and main menu screen jitter/jump between each other for a second or two before the ad is shown, resulting in a very bad transition. If anyone could help me achieve a smoother showing of the ad, that'd be great. Android AndroidLauncher class public class AndroidLauncher extends AndroidApplication implements ActionResolver { //Code omitted public void showOrLoadInterstital() { j++; try { runOnUiThread(new Runnable() { public void run() { if (interstitialAd.isLoaded() &amp;&amp; (i&lt;12) &amp;&amp; (j%4==0)) { interstitialAd.show(); i++; } else if (!interstitialAd.isLoaded()) { AdRequest interstitialRequest = new AdRequest.Builder().build(); interstitialAd.loadAd(interstitialRequest); } } }); } catch (Exception e) { } } LibGDX GameScreen class public class GameScreen implements Screen { //Code omitted @Override public void render(float delta) { //Code omitted dispose(); game.setScreen(new MainMenuScreen(game)); } } LIBGDX MainMenuScreen class public class GameScreen implements Screen { //Code omitted @Override public void show() { game.actionResolver.showOrLoadInterstital(); } }
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: admob
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/42618090
downvote count: 0

http://stackoverflow.com/comment/42796902
has text: @elvas, I tried to tag 200k words, but the Java Command failed again. I tagged 100k words and it worked fine. I kept increasing 10k words every time until it reached 140k words and it worked fine. Then increasing to 150k words caused the JAVA COMMAND to fail again. Now I have to split the large files into small slices of 140k words and process 10 slices at a time using glob module. Thank you for your kind help. Your suggestions were so insightful.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27117107

http://stackoverflow.com/comment/42518045
comment on: http://stackoverflow.com/q/26993646
has text: It means you are doing really messy work :p, What is your scenario?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42676087
comment on: http://stackoverflow.com/a/27083320
type: Comment
score: 0
has text: That's elegant. I hate how sometimes the most obvious solutions become oblivious when you're staring at a project for awhile. Thank you.
type: AnswerComment

http://stackoverflow.com/a/27099510
has body: JavaDoc says about finalize(): Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. So, your finalize method invokes when GC will start.
type: Answer
accepted answer of: http://stackoverflow.com/q/27099322
upvote count: 1
answers question: http://stackoverflow.com/q/27099322
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/42776349
score: 6
comment on: http://stackoverflow.com/q/27139265
has text: What does the API tell you?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26995906
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42565494
has body: You need tcp server socket communication > http://developer.android.com/reference/java/net/Socket.html
type: Answer
has comment: http://stackoverflow.com/comment/42522508
accepted answer of: http://stackoverflow.com/q/26995859
has comment: http://stackoverflow.com/comment/42522647
answers question: http://stackoverflow.com/q/26995859
score: 0

http://stackoverflow.com/comment/42648981
type: AnswerComment
has text: @DavidCa1226 Your comment makes no sense, as the same restrictions apply to your lists
comment on: http://stackoverflow.com/a/27067764
type: Comment
score: 1

http://stackoverflow.com/comment/42778032
has text: @Robin Jcombox and what sir?do i need to use other stuff for that please explain further
score: 0
comment on: http://stackoverflow.com/q/27118725
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27101278
has body: The most authentic way to fetch timestamp is: long timeStamp = Calendar.getInstance().getTime().getTime();
type: Answer
answers question: http://stackoverflow.com/q/27098522
score: 0

jpype
tag name: jpype
tags question: http://stackoverflow.com/q/27068092
type: Tag

http://stackoverflow.com/q/27151940
has answer: http://stackoverflow.com/a/29821360
tagged with: restfb
type: Question
has title: How to get attached comment pictures in Facebook with restfb?
answer count: 1
has body: I'm having troubles getting the attached image of a comment to a status update in a Facebook page using restfb. I'm commenting a status update in the page (did by myself) and adding a picture. I'd like to get that picture, but the Comment object returned has always the attachment set to null...here is the code: JsonObject commentAsObject = FacebookUtils.getCommentAsObject(access_token, commentId); Comment comment = FacebookUtils.getComment(access_token, commentId); if (comment.getAttachement() != null) //Do something The commentId is valid, I build the permalink using that ID and it works...and the returned Comment object has all the values, like message OK, but the picture is not present...thus, does restfb return any of this? Thanks!
type: UnansweredQuestion
tagged with: facebook
score: 0
tagged with: java

http://stackoverflow.com/comment/42611769
has text: already done this..created a set of timeslot overridden compare to method , and compare method
score: 0
comment on: http://stackoverflow.com/a/27046725
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42738383
type: Comment
has text: I swear it's always the little things I seem to keep making errors on lol. Thank you for the help.
comment on: http://stackoverflow.com/a/27118207
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42619869
type: AnswerComment
comment on: http://stackoverflow.com/a/27030444
type: Comment
has text: @MicroGodrad If the file doesn't start with 0xAC it can't be the result of serialization. This one starts with 0x0A, which is a line feed. Examine your assumptions. Or possibly you need to set binary mode on the FTP transfer.
score: 0

http://stackoverflow.com/comment/42789606
comment on: http://stackoverflow.com/q/27143007
type: Comment
type: QuestionComment
has text: Yes, you can define init parameter named as `show-portlet-access-denied` in portlet's portlet.xml
score: 1

http://stackoverflow.com/comment/42763749
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27131692
type: Comment
has text: I can see the text behind the ad.My text is bold does that make any difference ?

http://stackoverflow.com/a/27025252
downvote count: 0
answers question: http://stackoverflow.com/q/27025134
score: 1
has body: Consider Math.round(Math.pow(2, i + i)) where i = 16 (similar results if i is bigger than 16). That is 2^32 which, in binary, is representable as &lt;leading 0s&gt;1 00000000 00000000 00000000 00000000 which is a long, it can't fit in a int. You perform the cast, which discards the leading bits, and get an int value of 0.
upvote count: 1
type: Answer

http://stackoverflow.com/a/27048488
has comment: http://stackoverflow.com/comment/42615557
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42616580
accepted answer of: http://stackoverflow.com/q/27047132
has comment: http://stackoverflow.com/comment/42615379
type: Answer
has body: I am little late, but below code will work as well : String str = "Hello--@StackOverflow--@BMWCar--@Bye."; String strResult = str.split("(?&lt;!\\G\\w+)(?:--@)")[0]; System.out.println(strResult); \G is previous match, (?&lt;!regex) is negative lookbehind. [Update] In your case, can we use below code? The solution is based on the file you provided import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Test{ public static void main (String[] args) throws IOException { BufferedReader in = new BufferedReader(new FileReader("abc.txt")); String line; while((line = in.readLine()) != null) { System.out.println(line.substring(0,line.lastIndexOf("--@"))); } in.close(); } }
has comment: http://stackoverflow.com/comment/42616239
has comment: http://stackoverflow.com/comment/42615957
answers question: http://stackoverflow.com/q/27047132

http://stackoverflow.com/a/27077638
score: 0
answers question: http://stackoverflow.com/q/27077068
has body: The other solutions on here so far all involve copying the entire array minus one element repeatedly. This is exceptionally slow. They run in O(n2) time. There is a way to do this in O(n) time, but with a List: public void print(final List&lt;?&gt; list) { if (list.isEmpty()) { return; } System.out.println(list.get(0)); print(list.subList(1, list.size())); } Because subList is a view and not a copy, this method would run in O(n) time as you would expect. Sadly is takes a List and not an array. Luckily there is a very easy way to get an Object array into a List: final String[] data = {"a", "b", "c", "d"}; List&lt;String&gt; list = Arrays.asList(data); This does not copy the array, it simply returns a view of the array as a List. Sadly this does not work for primitive arrays. For that you need to do something like: final int[] data = {1, 2, 3, 4}; Arrays.stream(data).boxed().collect(toList()); Which does require a copy. I would point out though that an O(n) copy followed by an O(n) print is still going to be much more efficient than a single O(n2) operation.
type: Answer

http://stackoverflow.com/q/27093711
tagged with: java
has body: I need to make a Telnet and SSH connection in java (similar to the one we have in Putty). Can you suggest me a good Java library that support both Telnet and SSH? If somebody can also give me some code example it will be wonderful.
has answer: http://stackoverflow.com/a/27093764
accepted answer: http://stackoverflow.com/a/27093764
type: Question
downvote count: 2
answer count: 1
favorite count: 0
tagged with: ssh
tagged with: telnet
upvote count: 0
has title: Java Telnet and SSH library
type: AnsweredQuestion
score: -2

http://stackoverflow.com/a/27027743
has comment: http://stackoverflow.com/comment/42579515
has comment: http://stackoverflow.com/comment/42592538
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42580020
accepted answer of: http://stackoverflow.com/q/27026815
answers question: http://stackoverflow.com/q/27026815
type: Answer
has comment: http://stackoverflow.com/comment/42589231
score: 2
upvote count: 2
has body: From what I'm seeing your configuration looks ok. But you are missing the Accept header, I'm not sure spring-mvc needs this header set to set the content type. But you can definitely configure spring to ignore the accept header. contentNegotiationManagerFactoryBean.setIgnoreAcceptHeader() It's worth a try or just set the header. mockMvc.perform(get('/..').accept(MediaType.APPLICATION_JSON));
has comment: http://stackoverflow.com/comment/42579945
has comment: http://stackoverflow.com/comment/42592797
has comment: http://stackoverflow.com/comment/42580959
has comment: http://stackoverflow.com/comment/42580176

http://stackoverflow.com/q/27112743
type: Question
has comment: http://stackoverflow.com/comment/42729272
has title: Cannot start native decoder aacdecoder
upvote count: 3
tagged with: aac
has comment: http://stackoverflow.com/comment/42728623
favorite count: 0
linked to: http://stackoverflow.com/q/24694868
has comment: http://stackoverflow.com/comment/42729171
type: UnansweredQuestion
tagged with: android
score: 3
has body: Hello everyone I'm trying to play an aac radio on my app usign this library, the problem is that when I code the basics It throws this: 11-24 16:33:55.591 4596-4626/ger.radio E/Decoder[OpenCORE]﹕ start() init failed status=30 11-24 16:33:55.592 4596-4626/ger.radio E/Decoder﹕ start() failed err=-1 11-24 16:33:55.593 4596-4636/ger.radio E/BufferReader﹕ Exception when reading: java.net.SocketException: Socket closed 11-24 16:33:55.595 4596-4626/ger.radio E/AACPlayer﹕ playAsync(): java.lang.RuntimeException: Cannot start native decoder at com.spoledge.aacdecoder.Decoder.start(Decoder.java:237) at com.spoledge.aacdecoder.AACPlayer.playImpl(AACPlayer.java:424) at com.spoledge.aacdecoder.AACPlayer.play(AACPlayer.java:386) at com.spoledge.aacdecoder.AACPlayer.play(AACPlayer.java:338) at com.spoledge.aacdecoder.AACPlayer$1.run(AACPlayer.java:296) at java.lang.Thread.run(Thread.java:841) And this is my code Button btn = (Button) findViewById(R.id.button); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (rep){ AACPlayer aacPlayer = new AACPlayer(); aacPlayer.stop(); }else{ AACPlayer aacPlayer = new AACPlayer(); aacPlayer.playAsync( "http://cast.direcnode.com:11320/stream" ); rep = true; } } });
answer count: 0
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/42629830
comment on: http://stackoverflow.com/q/27057132
has text: You could use a `JComboBox`, see [How to Use Combo Boxes](http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html) for more details, or you could use a `JRadioButton` or `JToggleButton` in a `ButtonGroup`, see [How to Use Buttons, Check Boxes, and Radio Buttons](http://docs.oracle.com/javase/tutorial/uiswing/components/button.html) for more details
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42774438
has text: You are aware that the two first files in each directory are usually `.` and `..`, which are the current directory and the parent directory respectively. You should check for them and skip them or you'll get some very strange results.
comment on: http://stackoverflow.com/q/27137447
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/44788323
type: Comment
has text: Could you explain what do you mean by "*You were all right*"? I can't refer which "you" whose solved your problem. Also, it'd be better if you could clarify the question by posting the full-but-short code, since it's kind of weird that some IDEs could run the code, but some couldn't.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/28211076

http://stackoverflow.com/q/27080565
has body: Is it possible to bold out specific letters within a word in itext? Consider this sentence, "this is a word". Could i make all the "i" withing that sentence bold? So the output would be like this: "this is a word" So to get the first word right (this), do i really have to create three chunks for one word and than add all the chunks together? Or is there another approach? With three chunks i mean something like this (i know its not working code but made it like this for readability): Chunk chunk1 = new Chunk("th"); Chunk chunk2 = new Chunk("i", bold); Chunk chunk3 = new Chunk("s"); Paragraph p = new Paragraph(); p.add(chunk1); p.add(chunk2); p.add(chunk3) There has to be a better way. Some "strings" i want colorized as well, like each letter in the string will have a different color, do i have to create chunks for each letter than combine them? With a EditText box in android to change each letter color i could use SpannableString. But its different with itext since it doesnt have the char. I hope you guys understand what i mean, i will post two methods on how i solved in android in an editText box. Now i just want a similar method for writing a colorized and bold text to a pdf. public SpannableString colorizeText(String text) { SpannableString spannableColor = new SpannableString(text); int x = 1; for(char letter : text.toCharArray()){ spannableColor.setSpan(new ForegroundColorSpan(returnCorrectColor(letter)), x-1, x, 0); x++; } return spannableColor; } private int returnCorrectColor(char letter) { String theLetter = Character.toString(letter); if (theLetter.contains("a")){ return Color.BLUE; } else if(theLetter.contains("o")){ return Color.GREEN; } return Color.RED; }
has answer: http://stackoverflow.com/a/27081059
accepted answer: http://stackoverflow.com/a/27081059
favorite count: 0
possible better answer: http://stackoverflow.com/a/50786599
upvote count: 4
has title: itext: make a single letter bold within a word
downvote count: 0
linked to: http://stackoverflow.com/q/26631815
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/50786599
tagged with: java
tagged with: itext
score: 4
type: Question
linked to: http://stackoverflow.com/q/13857273
answer count: 2

http://stackoverflow.com/a/26999235
accepted answer of: http://stackoverflow.com/q/26998681
upvote count: 2
has comment: http://stackoverflow.com/comment/42528814
answers question: http://stackoverflow.com/q/26998681
has body: One first thing: (1 &lt;&lt; (bitsCount)) - 1 This is a mistake because you are only performing integer arithmetic. You needed: (1L &lt;&lt; (bitsCount)) - 1 But anyway I assume bitsCount is 64. In Java you cannot shift by a number larger than 63 for a long and 31 for an int (JLS 15.19): If the promoted type of the left-hand operand is int, only the five lowest-order bits of the right-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator &amp; (§15.22.1) with the mask value 0x1f (0b11111). The shift distance actually used is therefore always in the range 0 to 31, inclusive. If the promoted type of the left-hand operand is long, then only the six lowest-order bits of the right-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator &amp; (§15.22.1) with the mask value 0x3f (0b111111). The shift distance actually used is therefore always in the range 0 to 63, inclusive. This is why you get 0, because the expression is reduced to (1 &lt;&lt; 0) - 1. You need to compute your max value a different way, for example: -1L &gt;&gt;&gt; (64 - bitsCount) or: BigInteger.ONE.shiftLeft(bitsCount).subtract(BigInteger.ONE) If you are testing a BigDecimal it would be safer to not use long at all here.
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/27001959
linked to: http://stackoverflow.com/q/2891361
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/68234980
type: UnansweredQuestion
tagged with: date
has comment: http://stackoverflow.com/comment/42533945
has answer: http://stackoverflow.com/a/27002052
has title: Calender class and changed TimeZone conflicts
has comment: http://stackoverflow.com/comment/42533819
has comment: http://stackoverflow.com/comment/42533974
type: Question
has comment: http://stackoverflow.com/comment/42533802
has comment: http://stackoverflow.com/comment/42533936
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42533892
answer count: 2
tagged with: calendar
has body: I would like to get the date format as yyyy-mm-ddT00:00:00 and different TimeZone as an output. But here i am getting the default Time Zone in the output to calendar date. Code part as:- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.set(Calendar.YEAR, 2014); cal.set(Calendar.MONTH, Calendar.NOVEMBER); cal.set(Calendar.DATE, 18); cal.set(Calendar.HOUR, 20); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); System.out.println("DateTime : " + cal.getTime()+ " \n Zone :: "+ calFrom.getTimeZone().getDisplayName()); The output as: DateTime : Wed Nov 19 05:30:00 IST 2014 Zone :: Greenwich Mean Time Here, i set the Time zone as GMT but in date it shows IST and how it can be converted to 2014-11-19T00:00:00 corrosponding to the changed Time Zone.

http://stackoverflow.com/comment/85035408
comment on: http://stackoverflow.com/a/27242903
type: AnswerComment
score: 0
has text: You probably want to use labels, not node names. As you've written this, your solution wont scale once you add another node to do DIFFERENT work.
type: Comment

http://stackoverflow.com/q/27130866
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java
tagged with: jboss
tagged with: servlets
type: Question
has body: I am deploying in jboss a simple web app with one servlet, a jsp file and an ease EJB. This is the code of the servlet: package webejb; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import ejb.Convert; import java.math.BigDecimal; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class test extends HttpServlet { private static final long serialVersionUID = 1L; @EJB(name = "ejb/Convert") private Convert converter; /** * @see HttpServlet#HttpServlet() */ public test() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String amount = request.getParameter("amount"); if (amount != null &amp;&amp; amount.length() &gt; 0) { BigDecimal d = new BigDecimal(amount); BigDecimal rupeeAmount = converter.dollarToRupees(d); out.println("&lt;p&gt;" + amount + " Dollars are " + rupeeAmount + " Rupees.&lt;p&gt;"); BigDecimal euroAmount = converter.rupeesToEuro(rupeeAmount); out.println(amount + " Dollars are " + euroAmount + " Euro."); } } When i include at the beginning of the class the annotation @WebServlet(“/test”) a get this error: 10:12:21,253 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "WebEJB.war" was rolled back with failure message {"JBAS014671: Failed services" =&gt; {"jboss.deployment.unit.\"WebEJB.war\".POST_MODULE" =&gt; "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"WebEJB.war \".POST_MODULE: Failed to process phase POST_…
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27137179
has title: Failed to process phase POST_MODULE of deployment

http://stackoverflow.com/q/27050314
tagged with: lambda
possible better answer: http://stackoverflow.com/a/27059057
tagged with: java-8
type: AnsweredQuestion
score: 3
has title: Is there a standard Java 8 FunctionalInterface for a block throwing a checked exception?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42618378
type: Question
has body: Callable throws Exception, Runnable doesn't. Is there anything standard that looks like @FunctionalInterface public interface TypedBlock&lt;E extends Exception&gt; { public void run() throws E; }
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42618388
has answer: http://stackoverflow.com/a/27050629
has comment: http://stackoverflow.com/comment/42618533
favorite count: 0
has comment: http://stackoverflow.com/comment/42618233
has answer: http://stackoverflow.com/a/27059057
accepted answer: http://stackoverflow.com/a/27050629

2d
tags question: http://stackoverflow.com/q/27082966
tags question: http://stackoverflow.com/q/27009184
tags question: http://stackoverflow.com/q/27047571
tags question: http://stackoverflow.com/q/27118220
tag name: 2d
tags question: http://stackoverflow.com/q/27005210
type: Tag
tags question: http://stackoverflow.com/q/27104922

http://stackoverflow.com/comment/42654465
comment on: http://stackoverflow.com/a/27070849
has text: Error occurs: cannot find symbol - method contains(java.lang.String). With the ".contains" highlighted.
type: AnswerComment
score: 0
type: Comment

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/27041802
tag name: maven-jaxb2-plugin

http://stackoverflow.com/a/27032668
has body: KeyListener is fickle mistress. It what's all the attention all the time or it isn't going to talk to you. What does this mean? In order for a KeyListener to raise events, the component is registered to must HAVE focus AND be focusable... This means that the moment that another component becomes focused (like a button), the KeyListener will no longer respond. Instead, you should use the key binding API, which was designed to overcome this issue. See How to Use Key Bindings for more details
type: Answer
accepted answer of: http://stackoverflow.com/q/27032607
upvote count: 3
answers question: http://stackoverflow.com/q/27032607
has comment: http://stackoverflow.com/comment/42587132
type: AcceptedAnswer
downvote count: 0
score: 3

http://stackoverflow.com/comment/47773236
type: AnswerComment
has text: I've found that if you use Maven or Ivy, this problem disappears: automatically downloads sources and javadocs. Anyway, I turned from Play! into Vaadin, I felt more comfortable with it.
comment on: http://stackoverflow.com/a/29791519
score: 0
type: Comment

http://stackoverflow.com/q/27016267
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27016657
downvote count: 0
upvote count: 3
answer count: 2
tagged with: retrofit
has body: i want to send user:user in the post request body. I am using retrofit lib. please suggest me. I have tried already like this @POST(/login) void login(@BODY String s,Callback&lt;LoginResponse&gt;) And called this as login("user:user",Callback&lt;LoginResponse&gt;)
linked to: http://stackoverflow.com/q/21398598
has title: raw string in post request body using retrofit
favorite count: 0
has answer: http://stackoverflow.com/a/30387286
type: UnansweredQuestion

http://stackoverflow.com/comment/42654620
score: 0
comment on: http://stackoverflow.com/a/27070978
type: AnswerComment
type: Comment
has text: ok, that much makes sense. I've updated question though, as I'm also getting matches for `Zig`s, which are definitely not `Bar`s.

http://stackoverflow.com/q/27113959
has comment: http://stackoverflow.com/comment/42731127
has comment: http://stackoverflow.com/comment/42731717
has title: Java Object compare with two fields for graphs
answer count: 0
type: UnansweredQuestion
has body: I trying to merge a bunch of graphs into one. Keeping the vertices and then adding the edges one by one. I have an edge object and a graph object, made up of edges. An edge consists of u and v (weight but its nominal). In other words my graph G' would have all of Gi's nodes and consist of all edges that occur in every G0...Gn. I want to merge them an make one graph to BFS from source to destination later to simulate a changing wireless network. The code is java. For example the 2 graphs A-B-C, A-C would become a A-B-C with a new path from A-C (I can't draw it). to build(third parameter is nominal weight): Graph G1 = new Graph(2); G1.buildGraph(A,B,1); G1.buildGraph(B,C,1); Graph G2 = new Graph(3); G2.buildGraph(A,B,1); G2.buildGraph(A,C,1); G2.buildGraph(B,C,1); Take the two above and create a third. The problem is I can't repeat edges and I don't know how to set the object compare up for a hash or some efficient way of filtering out the repeated edges. I thought of looking for common sub-graphs between them which seem to me to be the same thing but that is NP complete. I can post code if need be, I don't know how to hash using two fields in an object. I think I have to compare each u,v as a pair when creating the new graph to make sure I don't repeat the edge, I don't know how to do this other than comparing to them all which is an awful run time. Thanks
type: Question
tagged with: java
tagged with: graph
score: 0
has comment: http://stackoverflow.com/comment/42753610

http://stackoverflow.com/comment/42622695
comment on: http://stackoverflow.com/a/27052658
type: Comment
has text: Sorry for poor visibility, small comments. The code is the code of the table. Construction is a boolean just to be sure I don't listen to program inputs. When this code is executed, I get a crash that looks like an infinite loop.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42611303
type: Comment
type: QuestionComment
has text: @sreisman yes i m not getting any clue how to compare the slots , not tables , every slot will have tables associated , 3 tables are different tables out of four total tables reserved from 9 a.m to 11 p.m , can u please give example using hashmap chaning to find collisions and how to get list of free tables for any time
score: 0
comment on: http://stackoverflow.com/q/27046368

http://stackoverflow.com/comment/42785625
score: 0
comment on: http://stackoverflow.com/a/27098654
type: Comment
has text: Please read the docs, it specifically mentions how to serve a range: https://cloud.google.com/appengine/docs/java/blobstore/#Java_Serving_a_blob
type: AnswerComment

http://stackoverflow.com/q/27081161
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27081260
favorite count: 0
type: UnansweredQuestion
has body: I have a problem with that i can't get my string to be named with a string! here is my code. public class Load { int num = 0; public String getstuff(){ num++; String snum = new String("" + num); return snum; } String name = this.getstuff(); public void AddString(String f, int v){ String name = this.name; String name = new String(f + v); } public Load(String s){ } }
upvote count: 1
has title: How to name a component with a string
tagged with: swing
downvote count: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42671817

http://stackoverflow.com/a/27118805
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27118495
has body: You answered your own question. Move it to another JVM and then make service calls to that JVM. If the server crashes, communications to the JVM will be lost, but your app server will still be running and can handle the failed communications gracefully. Your options are, put the code in another app server and create a service API using JSON, Web Services etc, whatever you are more comfortable with. Or, depending on what the C code is doing, maybe just a socket level API. Of course your C code could handle it's own sockets if you were up to writing that. But keeping it in an App server is probably best for management and monitoring reasons. And it would be quicker and more flexible in creating the API. You would have to use your judgement as to which is the best solution for you.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42704813
comment on: http://stackoverflow.com/q/27100215
score: 0
type: Comment
type: QuestionComment
has text: use notifyDataSetChanged();

http://stackoverflow.com/q/27141599
tagged with: android
has comment: http://stackoverflow.com/comment/42780747
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/27141722
has comment: http://stackoverflow.com/comment/42780756
tagged with: java
has body: package prgms; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; class new_experi { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out = new BufferedWriter(new FileWriter("C://Users//sihi//Desktop//output.txt")); try { String inputLine = null; do { inputLine = in.readLine(); out.write(inputLine); out.newLine(); } while (!inputLine.equalsIgnoreCase("eof")); System.out.print("Write Successful"); } catch (IOException e1) { System.out.println("Error during reading/writing"); } finally { out.close(); in.close(); } } } i am getting output but the last line i.e "write successfully" is not copied to the file.
has answer: http://stackoverflow.com/a/27141628
type: Question
answer count: 2
has title: how to copy the console output into a file in java?

http://stackoverflow.com/comment/42696556
comment on: http://stackoverflow.com/q/27094716
score: 0
has text: @AbbasA.Ali *"some lines of code"* doesn't make a runnable example. If we are unable to replicate your issue, it's unlikely we can solve it. Everything else is guess work. Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27044330
score: 1
tagged with: java
tagged with: struts2
tagged with: servlets
type: Question
linked to: http://stackoverflow.com/q/16611088
accepted answer: http://stackoverflow.com/a/27044805
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/42608517
linked to: http://stackoverflow.com/q/16297721
linked to: http://stackoverflow.com/q/18825308
has title: How to download localy file with Struts 2
has body: I want to download xml file with my struts application. I recup my xml in JAVA (in my action) . When I click to my link, the download window doesn't open . This my code : ACTION : @Action(value = "download", results = { @Result(name = "success", type = "redirectAction", params = { "actionName", "testMM"}), @Result(name = "input", location = "testMM.jsp") }) public String dowload() { setFilePath(getSession().get("filePath", String.class)); setFileName(getSession().get("fileName", String.class)); try { fileInputStream = new FileInputStream("c://mm.xml"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return SUCCESS; } /** * @return the fileInputStream */ public InputStream getFileInputStream() { return fileInputStream; } MY JSP: &lt;s:url id="fileDownload" namespace="/adminMM" action="download" &gt;&lt;/s:url&gt; &lt;s:a style="width: 300px; maring: 15px 25px;" href="%{fileDownload}"&gt;&lt;s:text name="%{resultFileName}" /&gt;&lt;/s:a&gt; Please I need help . I can give you more information .
has answer: http://stackoverflow.com/a/27044805
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42607650

oop
tags question: http://stackoverflow.com/q/27118951
tags question: http://stackoverflow.com/q/27098382
tags question: http://stackoverflow.com/q/27067119
tags question: http://stackoverflow.com/q/26992209
tags question: http://stackoverflow.com/q/27141270
tags question: http://stackoverflow.com/q/27056764
tag name: oop
tags question: http://stackoverflow.com/q/27052799
tags question: http://stackoverflow.com/q/27148701
tags question: http://stackoverflow.com/q/27115986
tags question: http://stackoverflow.com/q/27141021
tags question: http://stackoverflow.com/q/27137247
tags question: http://stackoverflow.com/q/27001697
tags question: http://stackoverflow.com/q/27098294
tags question: http://stackoverflow.com/q/27131405
tags question: http://stackoverflow.com/q/27149392
tags question: http://stackoverflow.com/q/27126658
tags question: http://stackoverflow.com/q/27136143
tags question: http://stackoverflow.com/q/27088194
tags question: http://stackoverflow.com/q/27147175
type: Tag
tags question: http://stackoverflow.com/q/27054064
tags question: http://stackoverflow.com/q/27066851
tags question: http://stackoverflow.com/q/27090959

http://stackoverflow.com/q/27008928
score: 0
has answer: http://stackoverflow.com/a/73407915
has comment: http://stackoverflow.com/comment/42583786
has comment: http://stackoverflow.com/comment/42546201
answer count: 1
has comment: http://stackoverflow.com/comment/42545937
tagged with: applet
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42585240
tagged with: italic
tagged with: fonts
tagged with: java
has title: Why does java.awt.font.TextLayout.draw() result into incorrect spacing between Words/Characters when oblique(Italic/Bold Italic) fonts are used?
has body: I am writing the same Attributed String using TextLayout.draw() on an Applet as well as on a Frame In TextLayout, incorrect spacing between Words/Characters are observed when oblique(Italic/Bold Italic) fonts are used on an Applet, while the same Attributed String is rendered correctly on a Frame Below is a stand alone code to demonstrate the difference between writing an AttributedString using java.awt.font.TextLayout on an Applet as well on a Frame Below code is for demonstrating TextLayout on a Frame. This works Fine. import java.awt.BorderLayout; import java.awt.Component; import java.awt.Font; import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ComponentEvent; import java.awt.font.FontRenderContext; import java.awt.font.TextAttribute; import java.awt.font.TextLayout; import java.text.AttributedString; import javax.swing.JPanel; public class GraphViewer extends Frame { public static void main(String[] args) { Component viewer = new GraphViewer(new test()); viewer.show(); } public GraphViewer( Component component) { setLayout(new BorderLayout(0,0)); setVisible(true); setSize(800,600); setTitle("Viewer"); add("Center", component); addWindowListener(new SymWindow()); } public void paint(Graphics2D graphics) { graphics.clearRect(0,0,800, 600); super.paint(graphics); } public class SymComponent extends java.awt.event.ComponentAdapter { public void ComponentResized(ComponentEvent event) { Object object = event.getSource(); if(object == GraphViewer.this) { } } } public class SymWindow extends java.awt.event.WindowAdapter { public void windowClosing(java.awt.event.WindowEvent event) { Object object = event.getSource(); if (object == GraphViewer.this) FrameApp_WindowClosing(event); } void FrameApp_WindowClosing(java.awt.event.WindowEvent event) { setVisible(false); // hide the Frame dispose(); // free the system resources System.exit(0); // close the application } } } class test extends JPanel { public Font getFont() { retur…
type: Question
has comment: http://stackoverflow.com/comment/42546082
tagged with: layout
has comment: http://stackoverflow.com/comment/42546027

http://stackoverflow.com/comment/42558993
has text: Is it possible that the users that I have in the database aren't authorised to see this page? If you look at the spring-security.xml file I provided the addIncident page can be accessed by those with the `ROLE_USER` and `ROLE_ADMIN` roles. But I'm not sure if this can be mapped to users in the database?
comment on: http://stackoverflow.com/a/27015224
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27108642
has body: I need some help to use icons on my graph. To be exact I need two things: Icons as nodes. Icons beside the nodes. So I need the things shown in the first and last picture at the top row from the this tutorial. I think I have to write a stylesheet like: String styleSheet = "node {size: 100px; fill-mode: image-scaled;}" + "node.fun {fill-image: url('fun.gif');}" + "node.dull {fill-image: url('images/head.png');" + "}"; But somehow I don't get it running, I never get the icons. Could someone show me an example with icons for both of my variants? Secondly, I always have 5 Nodes. I get the following Form: But the Order of the Nodes is different every time. I need the same order, because I want to draw more than 1 graph and want to compare them.
has comment: http://stackoverflow.com/comment/99182706
downvote count: 0
favorite count: 0
tagged with: graphstream
type: UnansweredQuestion
score: 3
answer count: 0
has title: Graphstream with Icons in same order
upvote count: 3
tagged with: java
type: Question
tagged with: icons

http://stackoverflow.com/a/27249292
has comment: http://stackoverflow.com/comment/42981553
answers question: http://stackoverflow.com/q/27052623
score: 0
has body: This may help you To get all deprecated method : here I'm using java.util.Date class Method[] methods = java.util.Date.class.getMethods(); for (int i = 0; i &lt; methods.length; i++) { java.lang.annotation.Annotation annotations[] = methods[i] .getAnnotations(); for (int j = 0; j &lt; annotations.length; j++) { if (annotations[j] instanceof Deprecated) { System.out.println("Deprecated method Name : " + methods[i].getName()); } } }
type: Answer

http://stackoverflow.com/q/27012200
tagged with: prepared-statement
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/27013780
has body: I am selecting values based on the search query string for a Jquery JTable handled by Java Servlets. I am receiving the request parameter for filters as well as startPageIndex and recordPageIndex. But there was an Mysql error. kindly view the code / error below. Selecting columns based on Page if(filter != null &amp;&amp; !filter.trim().equals("")){ query = "SELECT C1, C2, C3, C4, C5" + "FROM DEPARTMENTS " + "WHERE C2= ? OR C3= ? OR C4= ? OR C5= ? " + "ORDER BY department ASC LIMIT " + "? , ? "; // the last two values used for table pagination pStmt = dbConnection.prepareStatement(query); pStmt.setString(1, filter.trim()); pStmt.setString(2, filter.trim()); pStmt.setString(3, filter.trim()); pStmt.setString(4, filter.trim()); pStmt.setInt(5, startPageIndex); pStmt.setInt(6, recordsPerPage); ResultSet rs = pStmt.executeQuery(query); System.out.println("query executed " + query); while (rs.next()) { // Stores in List used to populate in Jquery JTable } } MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? OR C3= ? OR C4= ? OR C5= ? ORDER BY C3 ASC ' at line 1
score: 0
answer count: 1
tagged with: jquery-jtable
accepted answer: http://stackoverflow.com/a/27013780
has comment: http://stackoverflow.com/comment/42551514
has title: Using Prepared Statement to select values for JQuery JTable
has comment: http://stackoverflow.com/comment/42552598
type: AnsweredQuestion
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/26992628
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26992796
accepted answer: http://stackoverflow.com/a/26992796
has answer: http://stackoverflow.com/a/26992746
answer count: 2
has comment: http://stackoverflow.com/comment/42516966
favorite count: 0
has comment: http://stackoverflow.com/comment/42516433
has title: JAVA Unitialised objects after try-catch block
has body: I am struggling with this code of try and catch block. What can I do to have the object initialized as in try catch block after that block? I know that after the try catch, the object values will be destroyed , but still , is there any way I can have them initialized after that block ? public static void main(String[] args) throws Error { Person p1=null;Person p2=null; Student s1=null;Student s2=null; Employe a=null; try{ p1 = new Person("Zeer", "Sohn", 1.7,2, 100); //Name , surname,height,age p2 = new Person("Zeer", "Mike", 1.63, 39); s1 = new Student("Johnson", "John", 1.9, 21, 2, 1); s2 = new Student("Deer", "Son", 1.52, 20, 1, 1); a = new Employe("Stewie", "Michael", 1.74, 44, 12, 440); }catch (Error.ErrorHeight e){ System.out.println("Error height:"+e.getMessage()); }catch (Error.ErrorAge e){ System.out.println("Error age: "+e.getMessage()); }catch (Error.ErrorSalary e){ System.out.println("Error salary"+e.getMessage()); } catch (Error e) { System.out.println("General error"+e.getMessage()); }; Person []p={p1,p2,s1,s2,a}; for (Person i : p) System.out.println(i); System.out.println(" "); System.out.println("Sort:"); c = new Comparator&lt;Person&gt;() { public int compare(Person o1, Person o2) { return o1.getAge() - o2.getAge(); } }; Arrays.sort(p, c);
possible better answer: http://stackoverflow.com/a/26992746
type: AnsweredQuestion
tagged with: java
downvote count: 2
type: Question
tagged with: try-catch

http://stackoverflow.com/comment/42636666
type: AnswerComment
score: 0
has text: If you don't want ascii, don't do `c = temp+'0'`, just do `c = temp`
type: Comment
comment on: http://stackoverflow.com/a/27023021

http://stackoverflow.com/q/27036240
has answer: http://stackoverflow.com/a/78923270
type: Question
tagged with: jakarta-ee
tagged with: jca
score: 4
upvote count: 4
answer count: 3
downvote count: 0
has title: What is the use of Java Connector Architecture (JCA)?
has answer: http://stackoverflow.com/a/27036411
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/100965561
has body: I am trying to extract a ZIP file using SDK zip API. I wrote the extraction code directly in my service class and my architect said the code has to be shifted to another module and should be implemented using JCA. I don't understand the use of JCA. He said it is a Java EE principle. All external systems, like the file system, should be accessed using JCA. If this is the procedure then what about the database? It is also an external resource to my Java application. Why should not I use JCA to access a database? I don't understand the importance and advantage at all. I tried to read online also. But I did not find any page which explains the advantages. Besides, there aren't any good tutorials which explains the development step by step. Most of the links are broken. What is the explanation?
has comment: http://stackoverflow.com/comment/42593971
tagged with: java
has answer: http://stackoverflow.com/a/27036368

http://stackoverflow.com/comment/42660795
type: AnswerComment
score: 0
type: Comment
has text: @dandavis Expression strings **are** complicated. Regexes are nice but they cannot solve every problem. Regexes do not deal well with things like nested parentheses.
comment on: http://stackoverflow.com/a/27074559

http://stackoverflow.com/a/27092888
upvote count: 5
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/27089627
has body: A Stage can contain one and only one Scene, and each Scene has one and only one root. So you need to manage the transition inside the root of a single scene. Simple example: import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.BorderPane; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.util.Duration; public class SlidingViews extends Application { @Override public void start(Stage primaryStage) { Rectangle rectangle1 = new Rectangle(300, 250); rectangle1.setFill(Color.RED); Button nextView = new Button("Next"); nextView.setPadding(new Insets(10)); BorderPane view1 = new BorderPane(rectangle1, null, null, nextView, null); BorderPane.setAlignment(nextView, Pos.CENTER); Group view2 = new Group(); Rectangle rectangle2 = new Rectangle(300, 250); rectangle2.setFill(Color.BLUE); view2.getChildren().add(rectangle2); StackPane root = new StackPane(view1); nextView.setOnAction(event -&gt; { root.getChildren().add(view2); double width = root.getWidth(); KeyFrame start = new KeyFrame(Duration.ZERO, new KeyValue(view2.translateXProperty(), width), new KeyValue(view1.translateXProperty(), 0)); KeyFrame end = new KeyFrame(Duration.seconds(1), new KeyValue(view2.translateXProperty(), 0), new KeyValue(view1.translateXProperty(), -width)); Timeline slide = new Timeline(start, end); slide.setOnFinished(e -&gt; root.getChildren().remove(view1)); slide.play(); }); Scene scene = new Scene(root, 400, 400); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }

http://stackoverflow.com/comment/42589035
type: QuestionComment
comment on: http://stackoverflow.com/q/27034028
has text: Probably your best bet is to read the file and count the number of newline chars
score: 0
type: Comment

http://stackoverflow.com/comment/42579345
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27028193
type: QuestionComment
has text: Dude, addLamp receive an `Lamp` object, which is added to the internal `ArrayList` of the class `Lamps`

http://stackoverflow.com/a/27083393
has comment: http://stackoverflow.com/comment/42747641
accepted answer of: http://stackoverflow.com/q/27058636
has comment: http://stackoverflow.com/comment/42712884
has comment: http://stackoverflow.com/comment/42752518
type: Answer
has comment: http://stackoverflow.com/comment/42756825
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/42705422
has comment: http://stackoverflow.com/comment/42750237
answers question: http://stackoverflow.com/q/27058636
has comment: http://stackoverflow.com/comment/42705170
type: AcceptedAnswer
downvote count: 0
has body: You can change error message using ValidationEventHandler. Eg: import javax.xml.bind.ValidationEvent; import javax.xml.bind.helpers.DefaultValidationEventHandler; public class MyValidationEventHandler extends DefaultValidationEventHandler { @Override public boolean handleEvent(ValidationEvent event) { if (event.getSeverity() == ValidationEvent.WARNING) { return super.handleEvent(event); } else { throw new RuntimeException("My custom message"); } } } To configure your endpoint to use this handler you can add a interceptor that inserts handler to the context. public class ValidationInterceptor extends AbstractPhaseInterceptor&lt;Message&gt; { public ValidationInterceptor() { super(Phase.READ); } public void handleMessage(Message message) throws Fault { message.setContextualProperty("jaxb-validation-event-handler", new MyValidationEventHandler()); } } Finally your endpoint looks like: @WebService(endpointInterface="org.jboss.test.schemavalidation.TestWS") @InInterceptors(classes = {ValidationInterceptor.class}) public class TestWSImpl implements TestWS{ public Integer sum(Integer a, Integer b) { return a + b; } } In JBoss 7 for this works you must add the dependency to cxf: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;jboss-deployment-structure&gt; &lt;deployment&gt; &lt;dependencies&gt; &lt;module name="org.apache.cxf" services="import" /&gt; &lt;/dependencies&gt; &lt;/deployment&gt; &lt;/jboss-deployment-structure&gt; You can see a full example in: https://github.com/fedesierr/schemavalidation-ws
has comment: http://stackoverflow.com/comment/42705192

http://stackoverflow.com/comment/42647341
comment on: http://stackoverflow.com/q/27066881
type: Comment
has text: I haven't looked at your code in too much detail, but my guess is the problem is caused by calling pop(). A stack is First-In, Last-Out data structure. I created a calculator program and I found it easier to add the operands to one structure and the operators to another. And, if this character is being entered manually to the text field, create an input validator that restrict entering non-numeric characters.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42954931
score: 0
type: AnswerComment
has text: That is no code issue. Just put some pictures on a different place with a file explorer. The gallery will find them. Then try again.
type: Comment
comment on: http://stackoverflow.com/a/27091151

http://stackoverflow.com/q/27136655
tagged with: arrays
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42775626
has comment: http://stackoverflow.com/comment/42772775
has comment: http://stackoverflow.com/comment/42777423
type: Question
has body: public static void main (String args[]) { String employees[][]= { {"Anderson " , "Varejao", "11.25", "40" , null, null, null, null, null, null, null}, {"Will" , "Cherry", "12.25", "35" , null, null, null, null, null, null, null}, {"Lebron" , "James", "60.25", "56" , null, null, null, null, null, null, null}, {"Kevin" , " Love", "25.25", "40" , null, null, null, null, null, null, null}, {"Kyrie" , "Irving", "14.25", "42" , null, null, null, null, null, null, null}, {"Dion" , "Waiters", "6.25", "40" , null, null, null, null, null, null, null}, {"Tristan" , "Thompson", "8.50", "40" , null, null, null, null, null, null, null}, {"Shawn", "Marion", "12.25", "38" , null, null, null, null, null, null, null}, {"Joe", "Harris", "10.25", "20" , null, null, null, null, null, null, null}, {"James", "Jones", "10.25", "25" , null, null, null, null, null, null, null}, }; bubbleSort(employees); } public static void bubbleSort(String t[][]) { for (int y=1;y&lt;t.length-1;++y) { if (t[y][1].compareTo(t[y+1][1])&gt;0) { String temp[]=t[y]; t[y]=t[y+1]; t[y+1]=temp; y=0; } } } Write a program which stores all the data for a payroll program in a 2 dimensional array. A. First Name B. Last Name C. Hourly Salary D. Number of hours worked When the user runs the program, have it calculate and store in the same 2D array the following: E. Gross pay F. 20 % income tax deducted G. Net pay H. Total Hours Worked for all employees I. Total Gross Pay for all employees J. Total Net Pay for all employees K. The name of the employee with the highest net pay (determined by the program). I am new with 2d arrays so please try to help me with this, i tried my best, i did as much as i could. Idk how i would do the strings from E-K?
has comment: http://stackoverflow.com/comment/42771678
has comment: http://stackoverflow.com/comment/42774816
has comment: http://stackoverflow.com/comment/42774151
favorite count: 0
has comment: http://stackoverflow.com/comment/42772244
answer count: 2
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/42777019
has comment: http://stackoverflow.com/comment/42772559
has answer: http://stackoverflow.com/a/27137163
tagged with: java
has title: Doing payroll program using 2d arrays
has comment: http://stackoverflow.com/comment/42773334
has answer: http://stackoverflow.com/a/27137461
has comment: http://stackoverflow.com/comment/42772158
has comment: http://stackoverflow.com/comment/42773247
upvote count: 0

http://stackoverflow.com/comment/42568353
has text: Adding to a 2d array would increase the time because i would need two for loops right?
comment on: http://stackoverflow.com/a/27021957
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27134216
has comment: http://stackoverflow.com/comment/42767345
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42767073
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/4689918
possible better answer: http://stackoverflow.com/a/27134360
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27134365
accepted answer: http://stackoverflow.com/a/27134365
has title: Background move in android
has body: I am making a project in android studio.I am trying to move background image by Thread on running the app but when i am running the app it gives a message 'unfortunately stopped' . How can I move background image by Thread or anything using android studio ? Anyone please help me ? //Xml: &lt;ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/bg2" android:scaleType="fitXY" android:id="@+id/image_id" /&gt; //java: image=(ImageView)findViewById(R.id.image_id); // image is an ImageView type object Thread an=new Thread(){ @Override public void run() { super.run(); for(;x&lt;=200;) { x++; image.setX(x); image.setY(0); System.out.println("Value of x: "+x); try { sleep(1000); }catch(Exception e) { System.out.println("Exception: "+e); } } } };an.start();
linked to: http://stackoverflow.com/q/3652560
has answer: http://stackoverflow.com/a/27134360

http://stackoverflow.com/a/27099886
has body: In Spring 3.2 which is annotation based the below code snippet will give you an idea for your problem: @RequestMapping("formSubmit.htm") public String onformSubmit(@ModelAttribute("TestBean") TestBean testBean,BindingResult result, ModelMap model, HttpServletRequest request) { String _result = null; if (!result.hasErrors()) { _result = performAction(request, dataStoreBean);//Method to perform action based on parameters recieved } if(testBean.getCondition()){ _result = "commonView"; }else{ _result = "methodSpecificView"; } return _result; } TestBean//Class to hold all the required setters and getters Explanation: As the request from your view comes to this method the ModelAttribute reference will hold all the values from view if the condition is obtained from the view than you can directly obtain it from model attribute and return the corresponding view. If your condition is obtained after applying certain logic than you can set the condition in the testBean and again get it to return the corresponding view.
downvote count: 0
answers question: http://stackoverflow.com/q/27098708
type: Answer
score: 1
upvote count: 1

tcp
type: Tag
tags question: http://stackoverflow.com/q/27073384
tags question: http://stackoverflow.com/q/27002620
tags question: http://stackoverflow.com/q/27151043
tags question: http://stackoverflow.com/q/27089419
tags question: http://stackoverflow.com/q/27096214
tags question: http://stackoverflow.com/q/27100917
tags question: http://stackoverflow.com/q/27078208
tags question: http://stackoverflow.com/q/27074054
tags question: http://stackoverflow.com/q/27067576
tag name: tcp

http://stackoverflow.com/q/27080961
downvote count: 0
tagged with: android
answer count: 1
has title: How to remove exif tags using Android ExifInterface
favorite count: 0
type: UnansweredQuestion
has body: Currently I'm working on Android application which has a function to remove EXIF tags. Built-in Android library (android.media.ExifInterface) doesn't allow to do it. It's only possible to edit existing values. That's why I thought I can overwrite them with some empty values like empty string, space, zero. Tags in EXIF specification have different types and I can't overwrite them with the same value. See: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html After some testing I replaced data with empty values provided below (in format they were displayed at the beginning). In comments I specified types of corresponding tags. private static final Map&lt;String, String&gt; emptyValues = new HashMap&lt;String, String&gt;(); static { emptyValues.put(ExifInterface.TAG_APERTURE, "0"); //rational64u emptyValues.put(ExifInterface.TAG_DATETIME, ""); //string emptyValues.put(ExifInterface.TAG_EXPOSURE_TIME, "0.0000" ); //rational64u emptyValues.put(ExifInterface.TAG_FLASH, "0" ); //int16u emptyValues.put(ExifInterface.TAG_FOCAL_LENGTH, " 0/0" ); //rational64u emptyValues.put(ExifInterface.TAG_GPS_ALTITUDE, "0/0" ); //rational64u emptyValues.put(ExifInterface.TAG_GPS_ALTITUDE_REF, "0" ); //string[2] emptyValues.put(ExifInterface.TAG_GPS_LATITUDE, "0/0,0/0000,00000000/00000" ); // rational64u emptyValues.put(ExifInterface.TAG_GPS_LATITUDE_REF, "0" ); //string[2] emptyValues.put(ExifInterface.TAG_GPS_LONGITUDE, "0/0,0/0,000000/00000 " ); //rational64u emptyValues.put(ExifInterface.TAG_GPS_LONGITUDE_REF, "0" ); //sting[2] emptyValues.put(ExifInterface.TAG_GPS_TIMESTAMP, "0:0:0 " ); //rational64u[3] emptyValues.put(ExifInterface.TAG_GPS_PROCESSING_METHOD, "0" ); //undef emptyValues.put(ExifInterface.TAG_GPS_DATESTAMP, " " ); //string[11] emptyValues.put(ExifInterface.TAG_IMAGE_LENGTH, "0" ); //int32u emptyValues.put(ExifInterface.TAG_IMAGE_WIDTH, "0" ); //int32u emptyValues.put(ExifInterface.TAG_ISO, " " ); //int16u emptyValues.put(ExifInterface.TAG_MAKE, " " ); //string…
has answer: http://stackoverflow.com/a/27081700
tagged with: exif
upvote count: 5
tagged with: java
type: Question
score: 5
has comment: http://stackoverflow.com/comment/122081055

http://stackoverflow.com/q/27144124
has title: Sending JSON array of strings using Jersey
has comment: http://stackoverflow.com/comment/42786921
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42785235
score: 0
has body: I am trying to send JSON array of string and perform some task on serverside. Here is my JS: var x = ["Salam","Saghol","11"] $.ajax({ url: '../rest/group/addusers', type: 'POST', data: JSON.stringify(x), contentType: 'application/json', dataType: 'json', async: false, success: function(msg) { alert(msg); } }); And my Java method: @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/addusers") public Response addUsersToGroup(List&lt;String&gt; users) { System.out.println(users); return Response.status(Response.Status.OK).entity("Salam").build(); } When I send the request I get "415 (Unsupported Media Type)" error message. Please help me just passing the array elements (Strings) to the method below. Thanks in advance. P.S. Here are my headers:
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: jersey
answer count: 1
has comment: http://stackoverflow.com/comment/42786408
has answer: http://stackoverflow.com/a/27146268
tagged with: jquery
has comment: http://stackoverflow.com/comment/42786764
has comment: http://stackoverflow.com/comment/42785549
accepted answer: http://stackoverflow.com/a/27146268
has comment: http://stackoverflow.com/comment/42784792
has comment: http://stackoverflow.com/comment/42786088

http://stackoverflow.com/q/27148964
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27149188
type: Question
has answer: http://stackoverflow.com/a/27148992
possible better answer: http://stackoverflow.com/a/27149013
downvote count: 0
has answer: http://stackoverflow.com/a/27149013
has body: I'm trying to match sentences without capital letters with regex in Java: "Hi this is a test" -&gt; Shouldn't match "hi thiS is a test" -&gt; Shouldn't match "hi this is a test" -&gt; Should match I've tried the following regex, but it also matches my second example ("hi, thiS is a test"). [a-z]+ It seems like it's only looking at the first word of the sentence. Any help?
tagged with: regex
answer count: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/27148992
has comment: http://stackoverflow.com/comment/42792849
upvote count: 1
tagged with: match
has title: match whole sentence with regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42792733
has answer: http://stackoverflow.com/a/27149504

http://stackoverflow.com/a/27008787
has comment: http://stackoverflow.com/comment/42545790
has body: In the following example. The "Document" is abstract class and "html" document. "MyDocument" and "pdf" are concrete class. As long as you provide parameter with valid string, you will get the corresponding concrete class. For example if you put "pdf" as a parameter, you will get pdf document. Document type is all you need to accept whatever type of documents you want to create. public Document CreateDocument(String type){ if (type.isEqual("html")) return new HtmlDocument(); if (type.isEqual("proprietary")) return new MyDocument(); if (type.isEqual("pdf")) return new PdfDocument (); } There is a better documented article thread in Examples of GoF Design Patterns in Java&#39;s core libraries
upvote count: 1
has comment: http://stackoverflow.com/comment/42546748
type: Answer
answers question: http://stackoverflow.com/q/27007107
downvote count: 0
score: 1

http://stackoverflow.com/a/27026399
upvote count: 1
answers question: http://stackoverflow.com/q/27026354
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42577277
has body: That line of code runs once per cell, if the cell's content length is 5. There could be up to 64 of these, since your spreadsheet is 32 x 2. But you're trying to put them into an array of length 32, which of course overspills its bounds.
has comment: http://stackoverflow.com/comment/42576310

http://stackoverflow.com/comment/42648951
comment on: http://stackoverflow.com/q/27067746
type: Comment
type: QuestionComment
score: 1
has text: It seems like you are trying to use parallel arrays (or in this case lists) where one list of objects is likely to be more suitable.

http://stackoverflow.com/q/27029529
has title: Java use system read in switch statements
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/42581885
tagged with: system.in
has answer: http://stackoverflow.com/a/27029669
tagged with: java-io
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42581712
accepted answer: http://stackoverflow.com/a/27029669
type: AnsweredQuestion
has body: I am trying the following switch statements using System.in.read(): char ch1, ch2; ch1 = (char) System.in.read(); switch(ch1) { case 'A': System.out.println("This A is part of outer switch."); ch2 = (char) System.in.read(); // ch2 = 'A'; switch(ch2) { case 'A': System.out.println("This A is part of inner switch"); break; case 'B': System.out.println("This B is part of inner switch"); break; } // end of inner switch break; case 'B': // ... ch2 = (char) System.in.read(); not seems to be executed, and unless explicitly state ch2 = 'A', the inner switch statements will not be executed. So how to make the second read() work?
tagged with: java

http://stackoverflow.com/a/27107381
has comment: http://stackoverflow.com/comment/42718481
has comment: http://stackoverflow.com/comment/42718334
has body: android:label="@string/app_name"
has comment: http://stackoverflow.com/comment/42721871
has comment: http://stackoverflow.com/comment/42718104
has comment: http://stackoverflow.com/comment/42718610
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42718567
accepted answer of: http://stackoverflow.com/q/27107331
has comment: http://stackoverflow.com/comment/42717990
type: Answer
answers question: http://stackoverflow.com/q/27107331

http://stackoverflow.com/a/26998513
has comment: http://stackoverflow.com/comment/42528279
has comment: http://stackoverflow.com/comment/42531693
has body: Your mEditText in your NoteFragment is null at this time, hence the NPE. Just init your member mEditText in onCreate() or onActivityCreated() of the fragment, not onCreateView(). That should ensure that mEditText is not null when you call your setters. Whatever happens, you should be protecting against a null mEditText in your setter functions. EDIT this is what I meant: public void setCustomFont(String fontName) { if(mEditText != null){ if(fontName.equals("Helvetica")) { mEditText.setTypeface(mHelvetica); } else if(fontName.equals("Helvetica-Neue")) { mEditText.setTypeface(mHelveticaNeue); } else if(fontName.equals("Impact")) { mEditText.setTypeface(mImpact); } else { mEditText.setTypeface(Typeface.DEFAULT); } } } EDIT 2: Oncreate will not be a good place. Basically you want to call your setter after the fragmentmanager has committed your change, so that mEditText has been initialized. EDIT 3 - Try this with your initial code: getFragmentManager().beginTransaction().replace(R.id.container, mNoteFragment).commit(); getFragmentManager().executePendingTransactions();
has comment: http://stackoverflow.com/comment/42527834
type: Answer
has comment: http://stackoverflow.com/comment/42528044
has comment: http://stackoverflow.com/comment/42527983
has comment: http://stackoverflow.com/comment/42528255
has comment: http://stackoverflow.com/comment/42531786
upvote count: 1
has comment: http://stackoverflow.com/comment/42528661
has comment: http://stackoverflow.com/comment/42528207
score: 1
has comment: http://stackoverflow.com/comment/42528604
answers question: http://stackoverflow.com/q/26998088
has comment: http://stackoverflow.com/comment/42528815
downvote count: 0

http://stackoverflow.com/comment/42520927
type: Comment
type: QuestionComment
score: 0
has text: The other way to provide a parameter is to set it in servlet. But I am not sure if it is exactly what you are trying to do
comment on: http://stackoverflow.com/q/26995126

http://stackoverflow.com/comment/42539054
type: QuestionComment
has text: Can you provide a sample output perhaps?
score: 2
comment on: http://stackoverflow.com/q/27004833
type: Comment

http://stackoverflow.com/q/27071088
has title: What am I doing wrong with this mule -jersey flow?
tagged with: mule-component
tagged with: java
has answer: http://stackoverflow.com/a/27072585
upvote count: 1
type: Question
tagged with: jersey
tagged with: mule
answer count: 2
downvote count: 0
has body: I'm trying to create a simple mule flow that extracts the header and passes the user-agent to a REST component that returns a status code based on the extracted user agent. Here's my mule flow &lt;flow name="restflowFlow1" doc:name="restflowFlow1"&gt; &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="9595" path="rest" doc:name="HTTP"/&gt; &lt;jersey:resources doc:name="REST"&gt; &lt;component class="com.test.RestClass"/&gt; &lt;/jersey:resources&gt; &lt;/flow&gt; And here is the corresponding class @Path("restClass") public class RestClass implements Callable { public Response getExample(String toBeValidated) { if(toBeValidated.contains("Apple")) { return Response.status(Status.OK).entity("hello " + toBeValidated).build(); } return Response.status(Status.UNAUTHORIZED).entity("hello " + toBeValidated).build(); } @Override public Object onCall(MuleEventContext eventContext) throws Exception { String requiredHeader= eventContext.getMessage().getProperty("user-agent", PropertyScope.INBOUND); return getExample(requiredHeader); } } When I try to run the above flow I get the following error: ERROR 2014-11-21 13:49:47,909 [[muletestproject].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: ******************************************************************************** Message : Failed to invoke JerseyResourcesComponent{restflowFlow1.component.418586223}. Component that caused exception is: JerseyResourcesComponent{restflowFlow1.component.418586223}. Message payload is of type: String Code : MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. String index out of range: -1 (java.lang.StringIndexOutOfBoundsException) java.lang.String:1875 (null) 2. Failed to invoke JerseyResourcesComponent{restflowFlow1.component.418586223}. Component that caused exception is: JerseyResourcesComponent{restflowFlow1.component.418586223}. Message payl…
score: 1
has answer: http://stackoverflow.com/a/32480586
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/27114816
has comment: http://stackoverflow.com/comment/42733212
has comment: http://stackoverflow.com/comment/42735382
accepted answer of: http://stackoverflow.com/q/27114691
upvote count: 17
has comment: http://stackoverflow.com/comment/42732507
answers question: http://stackoverflow.com/q/27114691
score: 17
has comment: http://stackoverflow.com/comment/42735257
has comment: http://stackoverflow.com/comment/99722370
has comment: http://stackoverflow.com/comment/99708823
type: AcceptedAnswer
downvote count: 0
has body: How can you sort a LinkedHashMap using the value? LinkedHashMap is not sorted, it is ordered by order of insertion. If your goal is to reorder the Map, you might do something like static &lt;K, V&gt; void orderByValue( LinkedHashMap&lt;K, V&gt; m, final Comparator&lt;? super V&gt; c) { List&lt;Map.Entry&lt;K, V&gt;&gt; entries = new ArrayList&lt;&gt;(m.entrySet()); Collections.sort(entries, new Comparator&lt;Map.Entry&lt;K, V&gt;&gt;() { @Override public int compare(Map.Entry&lt;K, V&gt; lhs, Map.Entry&lt;K, V&gt; rhs) { return c.compare(lhs.getValue(), rhs.getValue()); } }); m.clear(); for(Map.Entry&lt;K, V&gt; e : entries) { m.put(e.getKey(), e.getValue()); } } We put all the entries in a List, sort the List, then put the entries back in the Map in the new order. Here's a Java 8 translation for those inclined: static &lt;K, V&gt; void orderByValue( LinkedHashMap&lt;K, V&gt; m, Comparator&lt;? super V&gt; c) { List&lt;Map.Entry&lt;K, V&gt;&gt; entries = new ArrayList&lt;&gt;(m.entrySet()); m.clear(); entries.stream() .sorted(Comparator.comparing(Map.Entry::getValue, c)) .forEachOrdered(e -&gt; m.put(e.getKey(), e.getValue())); } (Which, out of curiosity, can be condensed to, although it is less efficient): static &lt;K, V&gt; void orderByValue( LinkedHashMap&lt;K, V&gt; m, Comparator&lt;? super V&gt; c) { new ArrayList&lt;&gt;(m.keySet()).stream() .sorted(Comparator.comparing(m::get, c)) .forEachOrdered(k -&gt; m.put(k, m.remove(k))); } Is there a way to insert entries into a LinkedHashMap so that they are inserted in order based on their value? No. See above. LinkedHashMap is not sorted. If your goal is to keep the Map sorted, you need to use a TreeMap; however there are problems with doing so. Entries in the Map need to have unique values. See here and here.
type: Answer

http://stackoverflow.com/a/27150064
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27148599
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27148599
has body: Thanks for @pskink, found out, need to build it like: "gradlew assemble" from the root of project.

http://stackoverflow.com/comment/42546082
type: Comment
type: QuestionComment
has text: The first thing I did was to remove `java.awt.Font graphicsFont = new java.awt.Font("Arial", Font.BOLD, 15);` and rely on the `Font` that was supplied by the `Graphics` context, as this should be the components `Font`. Next, I removed the reference to `Arial` in the `GraphViewer` and found the resulting rendering to be just about the same, so the issue has to do with the font, probably a variable width font...
comment on: http://stackoverflow.com/q/27008928
score: 0

http://stackoverflow.com/q/27013660
tagged with: java
type: Question
has body: I have this method: public void myMethod(Set&lt;Item&gt; items); When I try to call: Mockito.verify(instance.myMethod(Mockito.anySet()); I get this compilation error: The method verify(T) in the type Mockito is not applicable for the arguments (void) I get the same error even when I define an argument captor. How can I fix this?
has answer: http://stackoverflow.com/a/27013884
tagged with: mockito
answer count: 1
downvote count: 0
favorite count: 0
score: 2
accepted answer: http://stackoverflow.com/a/27013884
has title: Mockito verify method call with generic collection argument
has comment: http://stackoverflow.com/comment/42553526
upvote count: 2
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/42571225
type: AnsweredQuestion

http://stackoverflow.com/comment/42692852
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27092874
type: Comment
has text: Sorry but you lost me here; you say you are not responsible for the JSON and yet you paste in a comment what the JSON should be like (notwithstanding the missing semicolon). So, what is what?

gradle
tags question: http://stackoverflow.com/q/27059344
tags question: http://stackoverflow.com/q/27104466
tags question: http://stackoverflow.com/q/27010898
tags question: http://stackoverflow.com/q/27125630
type: Tag
tags question: http://stackoverflow.com/q/26992374
tags question: http://stackoverflow.com/q/27129911
tags question: http://stackoverflow.com/q/27047429
tags question: http://stackoverflow.com/q/27129629
tags question: http://stackoverflow.com/q/27106950
tags question: http://stackoverflow.com/q/27102930
tag name: gradle
tags question: http://stackoverflow.com/q/27004141
tags question: http://stackoverflow.com/q/27143678
tags question: http://stackoverflow.com/q/27094492
tags question: http://stackoverflow.com/q/27004899

http://stackoverflow.com/a/27100576
has body: When you call the method copy1(), the parameter is a copy of the reference of the object a obj. When you set it to this (obj = this;) the copy of the reference of the object is replaced by the current object, but the original object and the reference to the object at the place you are calling the copy1() method stays the same. You just change the copy of the reference of the object. When you call the method copy2(), no reference work is done there, and you are doing one by one matching of the variables (properties of the objects) and there is no copy of reference work there. You are changing the object itself. In this case, this.val = obj.val; would also work. For more understanding, check this topic and check how other languages like C or C++ handle parameter passing issue.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27100467
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/42752909
score: 1
has text: I suspect the answer to this is "whichever way your organisation's coding standards say you should do it". I prefer using `this.`, you just have to double check what you're typing.
comment on: http://stackoverflow.com/q/27126658
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/134451661
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27141686
has text: If I used log4j.appender.R.RollingPolicy.MaxIndex. How long will it take for old files to be deleted?

http://stackoverflow.com/comment/42710800
comment on: http://stackoverflow.com/a/27103455
has text: @New2Java `setData()`. BTW, it doesn't look like you need the return value of that method, so you can change it to void.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27003628
has comment: http://stackoverflow.com/comment/42537172
has body: I get an error saying this: This User is not allowed to add a field to _User. You can change this setting in the Data Browser. From testing, it seems that this only affects users signed in through Facebook. I don't really know what setting the error is talking about. The code isn't doing anything that special. The weird part is it used to work before. It is only recently that it started to throw an error. currUser = ParseUser.getCurrentUser(); currUser.put("username", username);//username currUser.put("email", email);//email currUser.saveInBackground();
has title: Editing user information within the app gives me an error with Parse
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42537516
has answer: http://stackoverflow.com/a/27050470
accepted answer: http://stackoverflow.com/a/27050470
tagged with: parse-platform
tagged with: android
tagged with: facebook
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/27105537
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42716293
has comment: http://stackoverflow.com/comment/42720599
tagged with: singleton
tagged with: applicationcontext
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
tagged with: autowired
has title: Inject Singleton via Spring
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42715515
has body: I am having two tabs and want to set a text in one tab and display it on another tab. Therefore, this text will be displayed in another class. I have the following architecture: My applicationContext: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="test.DELETEME" annotation-config="true" /&gt; &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /&gt; &lt;bean id="mainGUI" class="test.DELETEME.MainWdw" /&gt; &lt;/beans&gt; Here I inject the applicationContext: public class Singleton { /** * Application Context */ private static ApplicationContext ctx; public static void main(String[] args) { ctx = new ClassPathXmlApplicationContext("applicationContext_Test.xml"); MainWdw gui = ctx.getBean("mainGUI", MainWdw.class); gui.start(); } } Here I am creating my Tabs and setting my two TabPanels, ResultsPan and MainTabPan: @Component public class MainWdw extends JFrame { /** * UUID */ private static final long serialVersionUID = -4931876787108249107L; public static JTabbedPane tabbedPane; public static ResultsPan resultsTabPanel; @Autowired private MainTabPan mainTabPan; private …

http://stackoverflow.com/comment/42787583
has text: So I should create a seperate method `downloadXML` where I JUST download the XML and store it to a file. And then in MainActivity, I call both methods (and both will download the XML, but one will just store it, to other one will download it and use it) ?
comment on: http://stackoverflow.com/a/27145862
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42562539
score: 2
has text: And my point is since Google actually specifies that initializing arrays should be done so and so, according to their guidelines, OP:s question "would this be a problem..." is answered. Google thinks it is OK, but has an optional rule implemented in CodePro AnalytiX. So I gave this answer my +1.
comment on: http://stackoverflow.com/a/27016284
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27029220
has comment: http://stackoverflow.com/comment/42581338
has comment: http://stackoverflow.com/comment/42581794
has body: Make sure that you are, first, translating the Graphics context to fit within inthe imagable area... g2d.translate((int) pageFormat.getImageableX(), (int) pageFormat.getImageableY()); Next, make sure you are using the imageableWidth and imageableHeight of the PageFormat double width = pageFormat.getImageableWidth(); double height = pageFormat.getImageableHeight(); and not the width/height properties. Many of these things get translated from different contexts... graphics.drawImage(image, 0, 0, (int)width, (int)height, null); The getImageableWidth/Height returns the page size within the context of the page orientation Printing pretty much assumes a dpi of 72 (don't stress, the printing API can handle much higher resolutions, but the core API assumes 72dpi) This means that a page of 10x15cm should translate to 283.46456664x425.19684996 pixels. You can verify this information by using a System.out.println and dumping the results of getImageableWidth/Height to the console. If you're getting different settings, it's possible that Java has overridden the default page properties For example... Fit image into the printing area Setting print size of a jLabel and put a jRadiobutton on the print You have two choices... You could... Show the PrintDialog and ensure that the correct page settings are selected PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new PrinterResolution(300, 300, PrinterResolution.DPI)); aset.add(new MediaPrintableArea(0, 0, 150, 100, MediaPrintableArea.MM)); PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPrintable(new PrintTask()); // You Printable here if (pj.printDialog(aset)) { try { pj.print(aset); } catch (PrinterException ex) { ex.printStackTrace(); } } Or you could... Just manually set the paper/page values manually... public static void main(String[] args) { PrinterJob pj = PrinterJob.getPrinterJob(); PageFormat pf = pj.defaultPage(); Paper paper = pf.getPaper(); // 10x15mm double width = cmsToPixel(10, 72); double…
has comment: http://stackoverflow.com/comment/67187905
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27029166
has comment: http://stackoverflow.com/comment/67185432
accepted answer of: http://stackoverflow.com/q/27029166
has comment: http://stackoverflow.com/comment/67187204
type: Answer
has comment: http://stackoverflow.com/comment/67197256
upvote count: 4
has comment: http://stackoverflow.com/comment/42581379
downvote count: 0
has comment: http://stackoverflow.com/comment/67185594
has comment: http://stackoverflow.com/comment/42581420
has comment: http://stackoverflow.com/comment/42581808
score: 4

http://stackoverflow.com/q/27007492
has body: When trying to start the demo in Jbpm-distribution-6.2.0.CR2-installer.zip the service fails to start, ie the log says: Services which failed to start:service jboss.deployment.unit."jbpm-console.war".WeldStartService Earlier in the (very long) log I see an error trace referring to the problem: Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ProjectService with qualifiers @Default at injection point [BackedAnnotatedField] @Inject org.kie.workbench.common.services.backend.validation.JavaFileNameValidator.projectService I raised it as an issue on the JIRA but after a couple of weeks an no answer I'm trying here. I've tried it on several versions of 6.2.0 now: Beta2, CR1 and CR2. Since it is a complete show stopper for the demo I'm wondering if it is something peculiar to my machine. Does anyone else have this running okay?
answer count: 1
favorite count: 0
has title: kie workbench 6.2.0.CR2 installer fails to start: Unsatisfied dependencies
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/28551379
accepted answer: http://stackoverflow.com/a/28551379
tagged with: jbpm
upvote count: 1

http://stackoverflow.com/comment/42646767
has text: what are you trying to do? what do you think `i % 13` is doing?
score: 1
comment on: http://stackoverflow.com/q/27066632
type: Comment
type: QuestionComment

http://stackoverflow.com/a/28662480
accepted answer of: http://stackoverflow.com/q/27149890
has body: Read this: Java Agent HTTP Connection Errors This solved the problem for me. After many restarts and toggled settings, and much pulling of hair, I was able to find a set of steps that would either cause the problem or prevent it. To make the code work: Open the Notes client Run the Java agent HTTP connection works To get the error: Open the Notes client Open the Java Debug Console Run the Java agent HTTP connection fails There's something about opening the Java Debug Console before running the agent that causes Notes to use a COM.ibm.JEmpower.applet.http.HttpURLConnection to make the connection instead of a sun.net.www.protocol.http.HttpURLConnection, and the JEmpower version of the class is the one that's broken (per experimentation and the APAR mentioned previously). Oddly, if I run the agent and then open the debug console and then run the agent again, everything is fine. It's opening the debug console before I do anything that causes problems.
has comment: http://stackoverflow.com/comment/51490431
downvote count: 1
upvote count: 5
score: 4
has comment: http://stackoverflow.com/comment/45620531
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27149890
type: Answer

http://stackoverflow.com/a/27085337
upvote count: 2
has body: If you're asking whether the the app engine datastore supports cross-namespace entities, the answer is no. Entities live within a single namespace (the namespace embedded in the Entity key). It's possible to store, as an Entity property value, a key to an Entity in a different namespace, but I don't know enough about Objectify to say whether Objectify supports that, or whether you'd need to bypass Objectify to use a lower-level API. If you're asking whether you can use multiple namespaces with a HTTP request, the answer is clearly yes, since the handler starts in the default namespace until the namespace is changed by code within the handler. If you're asking whether you can use multiple namespaces within a datastore query (say, to join data from different namespaces), the answer (as I understand it) is no.
score: 2
has comment: http://stackoverflow.com/comment/42703614
has comment: http://stackoverflow.com/comment/71951740
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27075295
accepted answer of: http://stackoverflow.com/q/27075295
type: Answer

http://stackoverflow.com/comment/42637982
comment on: http://stackoverflow.com/q/27040088
has text: if it is easier, can you please put your code in github, I can send you a pull request with the fix. It is difficult to see what else could be off.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42581398
type: AnswerComment
type: Comment
has text: @user320087 Read the linked JavaDoc for more information. And start using a debugger to step through the program.
comment on: http://stackoverflow.com/a/27028835
score: 0

http://stackoverflow.com/comment/42728152
type: AnswerComment
comment on: http://stackoverflow.com/a/27112304
type: Comment
has text: Check out the values on the left side of your if (y and ya) and on the right side of your if (game.getHeight() and DIAMETER). If you do not have a debugger simply print them to System.out like System.out.println(y);... Maybe game.getHeight() does not do what it's supposed to do...
score: 0

http://stackoverflow.com/comment/42758361
type: Comment
type: QuestionComment
has text: @PatrickLouisFerrer Check out my answer I think it is what you are looking for...
comment on: http://stackoverflow.com/q/27129384
score: 0

http://stackoverflow.com/a/27150460
has comment: http://stackoverflow.com/comment/96473185
upvote count: 2
has comment: http://stackoverflow.com/comment/42795971
has comment: http://stackoverflow.com/comment/42796236
has body: Add this code to your program after obj.openConnection(); String encoded = Base64.encode(username+":"+password); con.setRequestProperty("Authorization", "Basic "+encoded);
answers question: http://stackoverflow.com/q/27150388
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42796045

http://stackoverflow.com/a/26993416
type: Answer
answers question: http://stackoverflow.com/q/26993126
score: 0
has body: Here is a solution that could correct that issue: In the Start menu, go to All Programs, then Accessories, then 'System Tools'. From there type 'Folder Options'. In the View tab of the dialog, clear the checkbox for "Hide extensions for known file types". Select OK. To fix the icons, try repair Office. In the control panel, go to Programs &amp; Features, right-click Microsoft Office(YEAR)-select Change. When the wizard opens, click on the Repair options, then press Continue.

http://stackoverflow.com/q/27009971
has comment: http://stackoverflow.com/comment/42547392
downvote count: 0
tagged with: sms
score: 6
has title: Android - Get result from change default SMS app dialog
accepted answer: http://stackoverflow.com/a/27010644
has answer: http://stackoverflow.com/a/43520518
has body: I am working on restoring SMS on KITKAT. Referring to this article I have added the things which are required to set my app as default app for SMS. After adding all required things in manifest file I have write the following code: if (android.os.Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) { mDefaultSmsApp = Telephony.Sms.getDefaultSmsPackage(mContext); Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, mContext.getPackageName()); mContext.startActivity(intent); } The above code shows this dialog but I am unable to get the result from this activity/dialog either user clicked on Yes or No because I want to add listener or get any code which should represent that the user clicked on these buttons. Thanks.
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42547338
has answer: http://stackoverflow.com/a/27010644
type: Question
answer count: 2
upvote count: 6
has comment: http://stackoverflow.com/comment/42547597
linked to: http://stackoverflow.com/q/29873599
possible better answer: http://stackoverflow.com/a/43520518
tagged with: android-4.4-kitkat
tagged with: android
has comment: http://stackoverflow.com/comment/42547666
favorite count: 0

http://stackoverflow.com/comment/42719157
comment on: http://stackoverflow.com/q/27107595
score: 0
has text: If you're using a HashSet, are you sure you have correctly overridden the `equals` and `hashCode` methods of `AbstractModule`, or otherwise left them both with the default implementation?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42559563
comment on: http://stackoverflow.com/a/27017042
score: 1
type: AnswerComment
has text: After reading this I've removed my answer, as it can be misleading. Another thing I learnt in SO!
type: Comment

http://stackoverflow.com/comment/42543167
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27006694
has text: Sure, technically you could also do that.
score: 0

http://stackoverflow.com/comment/42713922
type: QuestionComment
comment on: http://stackoverflow.com/q/27105279
score: 0
has text: Google and you will find loads of examples. Dont expect SO will provide you link when you could do the same. Please put some effort.
type: Comment

http://stackoverflow.com/q/27098228
has answer: http://stackoverflow.com/a/27102560
type: Question
possible better answer: http://stackoverflow.com/a/28134032
tagged with: java
has body: I am starting struts2 based application with Jboss provided JPA libraries. I have configured data-source in standalone.xml I can see from the jboss administration console that the datasource is created. and the presistence.xml files are read and processed. But if I check the EntityManager instance in Action Class. It always says null. Here is my persistence.xml and Action class snippet <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence java:jboss/datasources/mysqlDS <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.use_sql_comments" value="true" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> Struts2 Action Class: public class RegistrationAction extends ActionSupport implements SessionAware,Preparable ,ModelDriven{ /** * */ private static final long serialVersionUID = 1L; @PersistenceContext(unitName="primary") private EntityManager em; @Override public Object getModel() { // TODO Auto-generated method stub return null; } @Override public void prepare() throws Exception { if(em==null) System.out.println(" EM is null still.."); //even Persistence.createEntityManagerFactory("primary"); returning NULL } @Override public void setSession(Map<String, Object> arg0) { // TODO Auto-generated method stub } public EntityManager getEm() { return em; } public void setEm(EntityManager em) { this.em = em; } }
has comment: http://stackoverflow.com/comment/42704167
tagged with: struts2
linked to: http://stackoverflow.com/q/26973033
answer count: 2
tagged with: jpa
downvote count: 0
accepted answer: http://stackoverflow.com/a/27102560
tagged with: jboss7.x
favorite count: 0
has comment: http://stackoverflow.com/comment/42702341
tagged with: cdi
has comment: http://stackoverflow.com/comment/42702956
has comment: http://stackoverflow.com/comment/42705738
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/28134032
has title: JPA EntityManager not initialized in struts2 and JBOSS 7.1

http://stackoverflow.com/a/27085418
answers question: http://stackoverflow.com/q/27085291
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27085291
type: Answer
has body: you "could" also construct and display a java.awt.Window and either draw text directly to the screen, or place a TextArea in the Window, and keep appending text to it (and removing lines off the top to keep from overflowing the text buffer). additionally, you could create a Swing Window and either draw directly to the window or add a JTextArea to it, and likewise, append and trim lines as the game progresses.

http://stackoverflow.com/a/27046097
has comment: http://stackoverflow.com/comment/42617445
score: 0
type: Answer
has body: Use String.split(regex). In String regex, you put the characters you have to remove like in String regex = ",0123456789\\.".
answers question: http://stackoverflow.com/q/27046045

http://stackoverflow.com/comment/42578450
score: 1
type: Comment
type: QuestionComment
has text: So in your string `test " abcd \" ef" test` you want output as: `abcd \" ef` ?
comment on: http://stackoverflow.com/q/27027523

http://stackoverflow.com/comment/42520982
type: Comment
type: QuestionComment
has text: tod, i wrote, i have no idea
score: 0
comment on: http://stackoverflow.com/q/26995084

http://stackoverflow.com/a/27049703
has comment: http://stackoverflow.com/comment/42617004
upvote count: 2
has comment: http://stackoverflow.com/comment/42617499
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27049547
accepted answer of: http://stackoverflow.com/q/27049547
has body: From ConcurrentModificationException Javadoc: Note that this exception does not always indicate that an object has been concurrently modified by a different thread. (...) For example, if a thread modifies a collection directly while it is iterating over the collection with a fail-fast iterator, the iterator will throw this exception. The bug is adding a child into the collection while also iterating over it. The fault is only detected by the iterator, when it is incremented in the for loop.
type: Answer

http://stackoverflow.com/a/27170965
has comment: http://stackoverflow.com/comment/42843292
answers question: http://stackoverflow.com/q/27139893
type: Answer
downvote count: 0
has body: You can try add the following jboss-classloading.xml to your WEB-INF folder: &lt;classloading xmlns="urn:jboss:classloading:1.0" name="mywar.war" domain="mywar_domain" parent-domain="Ignored" export-all="NON_EMPTY" import-all="true"&gt; &lt;/classloading&gt; In this case, put the war's classloader in the mywar_domain which is shared with all other applications that don't define their own domain. Also choose to look at all other classes exported by other applications import-all and to expose all our classes to other classes export-all. What you get when you deploy this file, is that the Web application classloader will act as top-level Classloader so there will be no conflict with the same classes in the server's library. See also: JBoss 5 - ClassLoading Demystifying the JBoss5 jboss-classloading.xml file Anyway JBoss AS 6 is out of date, and have a lot of de bugs unresolved. You would have to see the possibility of using a newer version (Wildfly or JBoss EAP 6).
score: 1
upvote count: 1

http://stackoverflow.com/a/27016438
downvote count: 0
score: 1
has body: Why not use split and join? var arr = str.Split('\n'); var newStr = string.Join("", arr);
answers question: http://stackoverflow.com/q/27016004
upvote count: 1
type: Answer

http://stackoverflow.com/comment/42608594
has text: http://stackoverflow.com/questions/9152241/find-the-max-allocated-heap-size-during-the-execution-using-vm-command-line
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27044896

http://stackoverflow.com/comment/42703874
has text: try do decompile the jar files, use JDGui: http://jd.benow.ca/
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27099552

http://stackoverflow.com/a/27122744
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27122613
answers question: http://stackoverflow.com/q/27122613
type: Answer
upvote count: 1
score: 1
has body: The documentation you read describes what the service() method of HttpServlet does by default. Since your servlet overrides the service() method and provides a different implementation, it doesn't do that anymore. Instead, it does... what the code in the method does. A servlet doesn't "load a JSP". I don't see how JSPs have any relation to the servlet code you posted. Maybe gotoPage() does tell the container to forward the request to a JSP. You should look at the documentation and/or code of that method to know what it does.

http://stackoverflow.com/q/27114691
has comment: http://stackoverflow.com/comment/42732350
linked to: http://stackoverflow.com/q/2770321
linked to: http://stackoverflow.com/q/2864840
answer count: 4
has comment: http://stackoverflow.com/comment/42732353
has body: How can you sort a LinkedHashMap using the value ? Is there a way to insert entries into a LinkedHashMap so that they are inserted in order based on their value ?
has answer: http://stackoverflow.com/a/27114873
has title: Sorting LinkedHashMap by value
has answer: http://stackoverflow.com/a/77584298
tagged with: linkedhashmap
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/109383
has answer: http://stackoverflow.com/a/27114816
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/27114816
type: Question
upvote count: 7
possible better answer: http://stackoverflow.com/a/27114873
has answer: http://stackoverflow.com/a/27115424
favorite count: 0

http://stackoverflow.com/comment/42632461
comment on: http://stackoverflow.com/q/27024471
score: 0
type: Comment
type: QuestionComment
has text: @jigar: I am not sure where it is connecting to. The build script is already created by other people and I am trying configure accordingly in the local system. Can you please explain your question a bit?

http://stackoverflow.com/q/27116477
downvote count: 0
score: 1
has title: Objectify - java.lang.IllegalStateException: Embedded Map keys must be of type String/Enum/Key<?> or field must specify @Stringify
favorite count: 0
tagged with: objectify
type: Question
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/27137043
possible better answer: http://stackoverflow.com/a/27116478
tagged with: java
has answer: http://stackoverflow.com/a/27116478
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/27137043
has body: I have an Objectify entity that's failing to get registered. Here's a stripped-down version of the class: @com.googlecode.objectify.annotation.Entity public class Insight { @com.googlecode.objectify.annotation.Id long id; public Map&lt;Date, Double&gt; timeseries; } Here is the error I'm getting: java.lang.IllegalStateException: Embedded Map keys must be of type String/Enum/Key&lt;?&gt; or field must specify @Stringify I believe the error is occurring during Objectify registration: class OfyService { static { factory().register(Insight.class); } It's hard to tell though because there are lots of stack traces because the code is in a static block.
type: AnsweredQuestion

http://stackoverflow.com/a/27059221
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27059124
has body: Override concept is to redefine a method of a parent class into a child class: public class ParentClass { public void method() { System.out.println("parent"); } } public class ChildClass extends ParentClass{ @Override public void method() { System.out.println("child"); } } new ParentClass().method(); new ChildClass().method(); This will output: parent child

http://stackoverflow.com/a/27094845
has comment: http://stackoverflow.com/comment/42740899
answers question: http://stackoverflow.com/q/27086986
type: Answer
has body: Something is wrong here and I don’t see what it is clearly, since we only have a small piece of the puzzle. As @EJP suggested, you may only have a single connection [modem?] to the internet. When thread 1 connects and waits for a response, threads 2-n waits on the connection. Therefore, what you are essentially doing is single threading. If you can multiplex somehow then maybe you can speed things up. Such as the way a browser does new tabs: open in new tab open in new tab etc. Everything goes out, but the browser doesn’t wait for each reply; it handles replies asynchronously. That won’t work if the destination is not multiplexed as well.
score: 0

http://stackoverflow.com/comment/42715765
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27106068
type: Comment
has text: Apparantly the constructor in the superclass is supposed to be empty.

return
tags question: http://stackoverflow.com/q/27005901
tags question: http://stackoverflow.com/q/27117764
tags question: http://stackoverflow.com/q/27097372
type: Tag
tags question: http://stackoverflow.com/q/27026203
tags question: http://stackoverflow.com/q/27069786
tag name: return
tags question: http://stackoverflow.com/q/27117522
tags question: http://stackoverflow.com/q/27063820
tags question: http://stackoverflow.com/q/27016822
tags question: http://stackoverflow.com/q/27123120
tags question: http://stackoverflow.com/q/27136812
tags question: http://stackoverflow.com/q/27142891
tags question: http://stackoverflow.com/q/27118304

http://stackoverflow.com/comment/42704990
type: Comment
type: QuestionComment
has text: Yes, I was importing from the wrong package. Fixed it now, thanks.
comment on: http://stackoverflow.com/q/27100099
score: 0

http://stackoverflow.com/comment/42562090
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27016449
has text: hmm.. try changing socket timeout,something like: socket.setSoTimeout(2000) and then try sending the packet directly to this device using its ip address without broadcast. Also,are u using an emulated device ?

http://stackoverflow.com/a/27010843
upvote count: 1
answers question: http://stackoverflow.com/q/27010388
has body: The order of addresses returned by java.net.InetAddress.getAllByName is undefined. If it works on one platform for you then it's just a happy accident. Remember that the results may not always come from a hosts file, but from the result of a DNS lookup (where the order is also undefined).
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/42544077
has text: Yes, but one must stress that synchronized collections must be used with caution, since each individual method is synchronized, but problems start to arise when you have multiple threads doing different things to a synchronized collection in between collection method calls. So all in all, it's important not to dismiss `synchronized` on multi-threaded scenarios.
type: AnswerComment
comment on: http://stackoverflow.com/a/27007622
score: 0
type: Comment

http://stackoverflow.com/q/27140730
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has body: I'm trying to write a quick java program to take a csv and create insert statements in SQL. I don't need all the columns or else I would have just directly imported the data through the csv. My particular problem comes when I actually write out to the file. The writer should be outputting over 200 lines to the file but only does 190 or so. I'm using eclipse and was wondering if eclipse shuts the program down before the IO is done but I'm not sure how to check that. Here is the code that does the writes: FileWriter fw = new FileWriter("CountriesOut.csv"); CSVWriter writer = new CSVWriter(fw); for (int i = 0; i &lt; line.size(); i++) { fw.write("INSERT INTO Country (CountryID, CountryName, CountryLocation, SummerFirstAppearance, WinterFirstAppearance) VALUES ("); writer.writeNext(line.get(i)); fw.write(");\n"); } I'm using openCSV to parse and eclipse for an IDE. Also relevant is that it cuts off in the middle of lines so I know its not just terminating at some point during the loop.
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27140872
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has title: Java fileWriter is not writing all of my output to a file

http://stackoverflow.com/comment/42601782
has text: try the updated one, make a single program.let me know work or not
type: AnswerComment
comment on: http://stackoverflow.com/a/27041057
score: 0
type: Comment

http://stackoverflow.com/comment/42817408
type: Comment
comment on: http://stackoverflow.com/a/27138685
score: 0
type: AnswerComment
has text: The textfield in the parent frame for which I am trying to show a "suggestion dropdown" when the user types. Maybe I should adjust the SSCCE to reflect this.

http://stackoverflow.com/comment/42563876
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27019444
has text: if i cast i am generating only one class objects right every time..but they will be changing depending on what operation i wana do..

http://stackoverflow.com/comment/42571090
type: Comment
comment on: http://stackoverflow.com/q/26998179
type: QuestionComment
has text: Can you post a link to the website? If not, can you find from your devs. what framework they are using for this widget?
score: 0

http://stackoverflow.com/a/27008537
type: Answer
score: 0
has body: You never initialze the 2nd dimineion of your code array, and so it remains null, since all arrays must be initialized before you start to fill them. So do that: char[][] code = new char[w][]; for (int i = 0; i &lt; w; i++) { // **** here **** code[i][] = new char[words[i].length()]; // ***** for (int j = 0; j &lt; words[i].length(); j++) { code[i][j] = words[i].charAt(j); }
answers question: http://stackoverflow.com/q/27008163

http://stackoverflow.com/comment/42805395
comment on: http://stackoverflow.com/a/27137071
has text: I did not get ,where? I tried doing this way as well for(List<String> reportDescr:reportDescription){ rg.setReportDescr(reportDescr);
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27096050
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42697670
has comment: http://stackoverflow.com/comment/42697581
has comment: http://stackoverflow.com/comment/42697600
has answer: http://stackoverflow.com/a/27096226
type: Question
score: 0
has body: I am trying to print in scrollable dialog box using a void print() function but I can't seem to figure this out. Is it possible to use the function as is? rslt = JOptionPane.showConfirmDialog(this, tempPanel, univ.printList, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
tagged with: printing
has comment: http://stackoverflow.com/comment/42697720
answer count: 1
tagged with: awt
has comment: http://stackoverflow.com/comment/42697564
accepted answer: http://stackoverflow.com/a/27096226
tagged with: joptionpane
has title: Java: How to print to a scrollable dialog using a void Print() function?
tagged with: swing

http://stackoverflow.com/comment/44332959
type: Comment
comment on: http://stackoverflow.com/a/27890707
type: AnswerComment
has text: I tried that one but it seems not working, for me the `context` is always coming as `empty` and URL is always coming as `http://site-la-www.mysite.com/`
score: 0

http://stackoverflow.com/a/27142293
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27127304
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27127304
has body: Ok, this is a hint, binar trees have a root node, which in most cases is a middle value. At any level in a B-Tree there is exactly two nodes, usually the left node has value less than the parent node and right node has value more than the parent node. The primary idea is to search for a value as fast as possible. In your case, the parent node will have 50 and left node would be 0-49 and right node 51-100. In your case, since there are 3 subjects the tree shall be 3 binary trees with the top node as abstract.

http://stackoverflow.com/comment/42778531
score: 1
type: QuestionComment
has text: Here is the complete code: http://ideone.com/9PSFz8
comment on: http://stackoverflow.com/q/27140436
type: Comment

http://stackoverflow.com/a/27149093
score: 3
accepted answer of: http://stackoverflow.com/q/27148856
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27148856
upvote count: 3
type: Answer
has body: Prims algorithm uses the weight of the edge to determine the best path. Posting the vertex to the PriorityQueue will not work. I am guessing your Edge class will implement Comparable by comparing their lengths.
downvote count: 0

http://stackoverflow.com/comment/42677121
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27084006
score: 0
has text: You don't see any errors when you double-click on the jar to run it, right? What about when you run the jar file from the command line (with `java -jar`)?

http://stackoverflow.com/q/27045832
type: Question
has body: For a university assignment, from the console I need to be able to read in multiple lines until the user enters Ctrl+Z. That I have no issue with, my problem lies with me being unable to read anything in from System.in after that because it always throws a NoSuchElementException. The following is the code that I am using for reading in the multiple lines, it was provided by the instructor and so I don't want to change it. System.out.println("To terminate input, type the correct end-of-file indicator "); System.out.println("when you are prompted to enter input."); System.out.println("On UNIX/Linux/Mac OS X type &lt;ctrl&gt; d"); System.out.println("On Windows type &lt;ctrl&gt; z"); Scanner input = new Scanner(System.in); while (input.hasNext()) { //Processes input addFileIntoDirectory(input.nextLine()); } I understand that this is caused by the Ctrl+Z which equates to an EOF marker, but I don't know how to move past it. No matter how many reads after it I do, regardless of if I have typed more to the console, I just instantly get back another NoSuchElementException. I have tried having a separate scanner for the menu, closing the scanner above and opening a new one for the menu but neither works. Is there a way to flush/purge System.in or to reset it? Please let me know if you would like more details. I have kept the rest of the program vague as it is homework. EDIT 1: Assignment says "The system provides a textual selection menu as follows, and runs in loop." Which means the program is not to terminate on Ctrl+Z. add files from user inputs display the whole directory display the size of directory exit Please give a selection [0-4]:
has title: Continue reading console input after Ctrl+Z in Java
has comment: http://stackoverflow.com/comment/42610499
score: 0
has comment: http://stackoverflow.com/comment/42611632
answer count: 1
has comment: http://stackoverflow.com/comment/42613051
tagged with: java.util.scanner
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28228388
tagged with: java
has comment: http://stackoverflow.com/comment/42611714

http://stackoverflow.com/comment/42717381
type: Comment
comment on: http://stackoverflow.com/a/27095467
has text: @AndyThomas: The exact count is irrelevant here because of the O-notation. I'm not saying it's an exact count, but that everything with a power below 2 can be safely ignored. (Faulhaber's formula tells you that any sum of a polynomial of degree `x` results in a polynomial of degree `x+1`)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42749458
comment on: http://stackoverflow.com/a/27124657
score: 0
type: AnswerComment
has text: Can you please give me an example code? Coz i also have to update the Spinner. That is, make changes in the UI. Which is I guess not allowed by threads apart from main thread in android.
type: Comment

http://stackoverflow.com/comment/42544027
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27007752
has text: what is n? The length of the array?

http://stackoverflow.com/comment/43034621
type: Comment
has text: Please see my update. Hope it be helpful :-) @Necros
comment on: http://stackoverflow.com/a/27127830
score: 1
type: AnswerComment

http://stackoverflow.com/a/40867266
has body: There was an issue in cglib, pointed by Rafael Winterhalter in his answer, which prevented cglib from working winth java 8 classes. It was fixed in cglib 3.2.0. Updating to the latest version (3.2.4) solves the problem.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27092857
downvote count: 0

http://stackoverflow.com/comment/42738939
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27118385
has text: You are right, it should use the unique constructor of State.

monitoring
tags question: http://stackoverflow.com/q/27009772
tags question: http://stackoverflow.com/q/27099521
type: Tag
tag name: monitoring

http://stackoverflow.com/a/27210504
accepted answer of: http://stackoverflow.com/q/27140409
type: AcceptedAnswer
has body: The new VM which is created by the Trace has different class path. If you want to run the program in eclipse you need to add the following code in your trace program. Connector.Argument options =(Connector.Argument)arguments.get("options"); options.setValue("-cp \"F:\\Workspace\\TraceProgram\\bin\""); Where -cp set the class path to newly created VM, you need to change to your eclipse work directory. It is worked for me.
upvote count: 7
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/27140409

http://stackoverflow.com/comment/42741311
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27114531
has text: we don't know right in our entire application having different data logs means lakh of logs are there that time what i will do? if i need to filter particular logs after getting error or exception in application at run time.

http://stackoverflow.com/a/34106436
answers question: http://stackoverflow.com/q/27013834
upvote count: 0
has comment: http://stackoverflow.com/comment/65470797
has comment: http://stackoverflow.com/comment/65575098
type: Answer
has body: The solution that actually fits your question: // Initialize the stream. final InputStream inputStream = socket.getInputStream(); // Header end flag. boolean headerEnded = false; byte[] bytes = new byte[2048]; int length; while ((length = inputStream.read(bytes)) != -1) { // If the end of the header had already been reached, write the bytes to the file as normal. if (headerEnded) foutStream.write(bytes, 0, length); // This locates the end of the header by comparing the current byte as well as the next 3 bytes // with the HTTP header end "\r\n\r\n" (which in integer representation would be 13 10 13 10). // If the end of the header is reached, the flag is set to true and the remaining data in the // currently buffered byte array is written into the file. else { for (int i = 0; i &lt; 2045; i++) { if (bytes[i] == 13 &amp;&amp; bytes[i + 1] == 10 &amp;&amp; bytes[i + 2] == 13 &amp;&amp; bytes[i + 3] == 10) { headerEnded = true; foutputStream.write(bytes, i+4, 2048-i-4); break; } } } } inputStream.close(); foutStream.close();
has comment: http://stackoverflow.com/comment/61347112
downvote count: 1
score: -1

http://stackoverflow.com/comment/42724637
score: 1
type: QuestionComment
has text: Was my answer helpful to you? If so, please consider upvoting and/or accepting.
type: Comment
comment on: http://stackoverflow.com/q/27042426

http://stackoverflow.com/a/27032267
score: 0
answers question: http://stackoverflow.com/q/27032139
type: Answer
has body: As mdnghtblue's comment says, change it too for(int i = 0; i &lt; scoreArray.length; i++){ for(int j = 0; j &lt; scoreArray[i].length; j++){ double temp = in.nextDouble(); scoreArray[i][j] = temp; } } Also missing a little {' :P if(i == scoreArray[0].length){ System.out.print(" Average"); } else if(i == 1) { // { was missing System.out.print(" Weight "); } else{ System.out.print(" Grade"+(i+compensate)+" "); }

http://stackoverflow.com/comment/42608648
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27041309
score: 0
has text: thanks. ironically, because of the renames- I had to go back and change a few things. This actually lead me to find the real problem- I'm an idiot and forgot to actually add the action listener to the button. That aside, your method worked perfectly once I added the action listener- so thanks!

http://stackoverflow.com/comment/42644418
score: 0
type: QuestionComment
has text: it will not be necessarily all the child nodes, there will be evaluation of every node if i will generate child nodes or not so it might stop at the third level, but how do i get it to generate automatically
comment on: http://stackoverflow.com/q/27065069
type: Comment

http://stackoverflow.com/q/27024724
has answer: http://stackoverflow.com/a/27024785
has answer: http://stackoverflow.com/a/27025074
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/42574016
has answer: http://stackoverflow.com/a/27025257
tagged with: java
type: Question
tagged with: acronym
tagged with: arrays
tagged with: string
has body: I'm working on a method which gets as an input an array of Strings and returns an array of its Acronyms that are only capital letters. For example: [United Nations, United Federation of Planets, null, , ignore me] -&gt; [UN, UFP, null, , ] For some reason my code does not return anything, and it also shows me that the null check is a dead code and I can't figure out why. public static String[] convertStringsToAcronyms(String[] input) { int itemCount = input.length; String[] result = new String[itemCount]; int k = 0; for (String words : input) { boolean checklowercase = words.toLowerCase().equals(words); if (checklowercase || (words == "")) result[k] = ""; if (words == null) result[k] = null; String add = ""; String[] ary = words.split(""); for (String letter : ary) { char firstletter = letter.charAt(0); if (Character.isUpperCase(firstletter)) add = add + firstletter; } result[k] = add; k++; add = ""; } return result; }
answer count: 3
has title: Trouble Converting a String to Acronyms
tagged with: dead-code

http://stackoverflow.com/q/27088511
answer count: 2
has title: Java Generics and containers of mixed types
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42684675
tagged with: generics
has answer: http://stackoverflow.com/a/27100461
has body: I have a question about using mixed generic types in a container. I have something like this: interface Processor&lt;T&gt; { T process(T value); } class StringProcessor implements Processor&lt;String&gt; { String process(String value); } Then I have another parameterized class or interface that uses the processor. And I want to ensure that the processor that we set to the Element can deal with elements of this type (T) class Element&lt;T&gt; { &lt;U&gt; void setProcessor(U extends Processor&lt;? extends T&gt; processor); } All of this works fine. My issue comes when I have to put my elements in a container. This container can contain elements of different types (Element&lt;String&gt;, Element&lt;Integer&gt;, ... ). When I get the elements out of the container I cannot assign a new calcultor to the element, because using ? makes me lose the typing. List&lt;Element&lt;?&gt;&gt; container = new ArrayList&lt;Element&lt;?&gt;&gt;(); Element&lt;String&gt; strElement =new Element&lt;String&gt;(); strElement.setProcessor(new StringProcessor()); Element&lt;Integer&gt; intElement =new Element&lt;Integer&gt;(); intElement.setProcessor(new IntegerProcessor()); container.add(strElement); container.add(intElement); But: Element&lt;?&gt; e = container.get(0); e.setProcessor(new StringProcessor()); // This does not compile because the the compiler is expecting a processor of type U extends Processor&lt;#1of?&gt; and not a StringProcessor. This works with Rawtypes but do you think there is a way to manage this cleanly with generics? I have read the pattern from "Effective Java", but when I am reading elements from my container I can't predict what the return type will be. The only fix I have found so far is making Element not generic, but by doing so I am losing the type safety. Any idea welcome? Regards Gilles
upvote count: 1
has answer: http://stackoverflow.com/a/27088950
accepted answer: http://stackoverflow.com/a/27088950
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42684745
type: Question
possible better answer: http://stackoverflow.com/a/27100461

http://stackoverflow.com/comment/42718251
score: 0
type: QuestionComment
has text: In your own component, use `java.awt.font.TextLayout`.
type: Comment
comment on: http://stackoverflow.com/q/27106736

http://stackoverflow.com/a/27091989
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27074419
has body: You can consume a REST web service from whatever technology you want, including ASP.NET. Have a look at ASP.NET's HttpClient and its accompanying example: Calling a Web API From a .NET Client in ASP.NET Web API 2

http://stackoverflow.com/a/27071005
answers question: http://stackoverflow.com/q/27070974
has comment: http://stackoverflow.com/comment/42654833
type: Answer
has body: Specify them before your main class name and those would be available as System properties for(String arg: args){ System.out.println(arg); } System.out.println(System.getProperty("key1")); with java -Dkey1=val1 com.abcd.Main arg0 arg1 and java -com.abcd.Main arg0 arg1 Dkey1=val1 you will get to know
has comment: http://stackoverflow.com/comment/42654890
score: 0
has comment: http://stackoverflow.com/comment/42654763
has comment: http://stackoverflow.com/comment/42654803

http://stackoverflow.com/a/27095296
score: 0
type: Answer
has body: I try the MadProgrammer solution and it works: String dateInString = "Friday 10 November 2014"; //String dateInString = "Viernes 10 Noviembre 2014"; Locale localeList[] = DateFormat.getAvailableLocales(); Date date = null; for (Locale l : localeList) { try { SimpleDateFormat formatter = new SimpleDateFormat("EEEE dd MMMM yyyy", l); date = formatter.parse(dateInString); System.out.println("Trying with locale: " + l.toString()); break; } catch (ParseException e) { } } Thanks
answers question: http://stackoverflow.com/q/27094317

http://stackoverflow.com/a/27066626
downvote count: 0
has comment: http://stackoverflow.com/comment/42646893
upvote count: 8
has comment: http://stackoverflow.com/comment/42647426
answers question: http://stackoverflow.com/q/27064496
has comment: http://stackoverflow.com/comment/42928805
type: Answer
has comment: http://stackoverflow.com/comment/42647945
has comment: http://stackoverflow.com/comment/42647682
score: 8
has comment: http://stackoverflow.com/comment/42647277
has comment: http://stackoverflow.com/comment/42647598
accepted answer of: http://stackoverflow.com/q/27064496
has comment: http://stackoverflow.com/comment/42647057
has body: What about something like this using clojure.core/file-seq (require '[clojure.java.io :as io]) (import '[java.util.zip ZipEntry ZipOutputStream]) (with-open [zip (ZipOutputStream. (io/output-stream "foo.zip"))] (doseq [f (file-seq (io/file "/path/to/directory")) :when (.isFile f)] (.putNextEntry zip (ZipEntry. (.getPath f))) (io/copy f zip) (.closeEntry zip)))
type: AcceptedAnswer

http://stackoverflow.com/a/27075840
score: 0
has comment: http://stackoverflow.com/comment/42662991
has comment: http://stackoverflow.com/comment/42663012
has body: I suggest you use a PreparedStatement and a Date bind parameter. Also, you can use try-with-resources. Putting it all together, something like String sql = "UPDATE DataNov2014 SET Datee = ?"; DateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); try (PreparedStatement ps = conn.prepareStatement(sql)) { Date theDate = sdf.parse("11-22-2014 00:00:00"); ps.setDate(1, new java.sql.Date(theDate.getTime())); int count = ps.executeUpdate(); if (count &gt; 0) { System.out.printf("Query updated %d rows.%n", count); } else { System.out.println("Query didn't update any rows"); } } catch (Exception e) { e.printStackTrace(); }
type: Answer
answers question: http://stackoverflow.com/q/27075760

http://stackoverflow.com/a/26999749
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26999681
answers question: http://stackoverflow.com/q/26999681
type: Answer
has body: The list numbers contains String objects, so casting the elements to double will throw an exception. You could have avoided this runtime exception if you had used the generic type ArrayList properly: ArrayList&lt;String&gt; numbers = new ArrayList&lt;String&gt;(); This would allow the compiler to detect ahead of time the type incompatibility. To read the double value of the string, you can use Double#parseDouble(String): sum = sum + Double.parseDouble(numbers.get(j)); Alternatively you can change the type parameter of numbers to Double and convert the value when adding the element to the list: ArrayList&lt;Double&gt; numbers = new ArrayList&lt;Double&gt;(); ... numbers.add(Double.parseDouble(line));

http://stackoverflow.com/comment/42599231
has text: I'm in exactly the same position as you :-) I also have the response code 25 after struggling with the mangled c# code. I've no idea how to resolve the Error Code, have you made nay progress?
comment on: http://stackoverflow.com/a/27016445
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27019855
linked to: http://stackoverflow.com/q/18745072
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/42565435
tagged with: swing
accepted answer: http://stackoverflow.com/a/27028755
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26848647
downvote count: 0
has title: How to refresh custom bean in NetBeans?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27028755
type: Question
has body: I want to design a relatively complex UI in NetBeans IDE. I believed that bring all these components together in one Panel can intensify difficulty of maintenance of such Panel. For this purpose I've broken down this structure in multiple custom beans extending JPanel. And in the main Panel I've included them by Choose Bean button in the palette toolbar. Every things looks OK but when I change one of the child beans, the change does not take place on the imported custom bean in main Panel. Please point me out how can I reload that bean? Thanks
has comment: http://stackoverflow.com/comment/42564558
has comment: http://stackoverflow.com/comment/42581028
tagged with: matisse
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/42570047
type: QuestionComment
has text: See the answer below.
comment on: http://stackoverflow.com/q/27022627
score: 0
type: Comment

http://stackoverflow.com/comment/42714222
has text: Still the same issue, the left slider works the right slider doesnt.
type: Comment
comment on: http://stackoverflow.com/a/27102850
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42835049
has text: I am trying a code in which i have to make a vonnection to com.google.enterprise.apis.client.GsaClient for which i have to give the URL port numberb and credentilas on doing so i am receiving following error Exception in thread "main" com.google.gdata.util.AuthenticationException: Error authenticating (check service name)
type: Comment
comment on: http://stackoverflow.com/a/27170443
score: 0
type: AnswerComment

http://stackoverflow.com/a/27133918
upvote count: 1
has body: There is a lot to be said about sticking to the basics. Here are some broad concepts that I think could be helpful to keep in mind. Implicit Intents In Android you can have what are called Implicit Intents which essentially mean that you can have your app say "I need something that can do this for me", and the Android OS will look for apps which can accomplish the task for you. Using implicit intents and intent-filters you could create several separate apps to accomplish each task within the scope of your solution. That way each application could accomplish a portion of your solution and could still work independently. Fragments Fragments are re-usable UI components that can be plugged into your Activities willy-nilly. Create one, keep is loosely coupled, and you can re-use it throughout your app and any other apps you create later. Good Object-Oriented Design There is a lot to be said about simple, good object oriented design. By keeping your program logic away from your activities in separate classes (and keeping those classes highly cohesive and very loosely coupled), they can be easily re-used/recombined into other software/application. Although the above is fairly broad. It's fair to say, just keep it simple and you should be able to re-use code in whichever new applications you need. I hope this helps. References: Implicit Intents Fragments High Cohesion Loose Coupling
downvote count: 0
has comment: http://stackoverflow.com/comment/42995828
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27133314

http://stackoverflow.com/a/27037550
answers question: http://stackoverflow.com/q/27036263
has body: If you look in your home directory, you should find a couple of files used by appcfg: .appcfg_oauth2_tokens_java and .appcfg_cookies. Deleting the former (I think) will prompt appcfg to retrigger the oauth process. So... I guess if you have multiple oauth token files, you can create a short shell script that takes the username as an argument then copies the oauth token file you need to .appcfg_oauth2_tokens_java just before the appcfg update.
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42596287
upvote count: 2
has comment: http://stackoverflow.com/comment/42702101
type: Answer

http://stackoverflow.com/comment/42559480
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27013903
has text: Your query needs some correction. I.e., second join is not being used. Alias `u` is undefined. If you require "XXyy" to be the creator, use an inner join.

http://stackoverflow.com/comment/42712363
score: 0
type: Comment
has text: Wow that was indeed silly. I skipped the message converters chapter. So of course to remove this limitation and work with simple POJOs, it's best to use a better converter, with [JSON](http://docs.spring.io/spring-amqp/docs/1.4.0.RELEASE/reference/html/amqp.html#d4e987) being the most likely candidate. One small gotcha when trying to apply this: must set msg converter on both the amqpTemplate (on the sending side) and the listener container (for the receiving end).
comment on: http://stackoverflow.com/a/27103873
type: AnswerComment

http://stackoverflow.com/comment/42611505
type: QuestionComment
type: Comment
has text: @AbhishekDeyDas Thanks. They may end up picking this as it's along the lines of what they want.
comment on: http://stackoverflow.com/q/27046316
score: 0

http://stackoverflow.com/q/27136055
possible better answer: http://stackoverflow.com/a/27145060
has body: How do I go about if my replyToQueueManagerName and replyToQueueName is not in the same MQEnvironment as my requestQueueuManagerName and requestQueueName? Example: //MQEnvironment for requestMessage MQEnvironment.hostname = requestMessageHost; MQEnvironment.channel = requestMessageChannel; MQEnvironment.port = requestMessagePort MQQueueManager qMgr = new MQQueueManager(requestQueueuManagerName); MQQueue inputQueue = qMgr.accessQueue(requestQueueName,MQC.MQOO_OUTPUT); MQMessage requestMessage = new MQMessage(); MQPutMessageOptions pmo = new MQPutMessageOptions(); requestMessage.writeString(sampleXmlRequest); requestMessage.replyToQueueManagerName = replyToQueueManagerName; requestMessage.replyToQueueName = replyToQueueName; In VB.NET one can connect to QueueManagers and Queues that reside on different environments.
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/27140977
accepted answer: http://stackoverflow.com/a/27140977
type: AnsweredQuestion
score: 1
tagged with: java
has title: .replyToQueueManagerName and replyToQueueName on different MqEnvironment
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/27145060
favorite count: 0
tagged with: ibm-mq

http://stackoverflow.com/a/26999028
answers question: http://stackoverflow.com/q/26998680
type: Answer
has body: finish() will call the finish() method on your class. super.finish() will call the finish() method on your parent class super is dedicated to parent class always.
score: 0

http://stackoverflow.com/q/27038803
has body: The code below is a very inefficient algorithm to do multiplication. It was written as test purpose. I believe I have written the same code but in different languages. Right below is the result of running the code. OS: Windows 7 language: C (as a subset of C++) compiler: Visual C++ optimization option: /Ox /Oi /Ot /Oy /GL running time (seconds): 40 +/- 1 compiler: MinGW/gcc optimization option: -O3 march=native running time (seconds): 81 +/- 1 compiler: MinGW/g++ optimization option: -O3 march=native running time (seconds): 82 +/- 1 language: Java compiler: Oracle JDK VM: Oracle JVM running time (seconds): 18 +/- 1 I believe I have done something awful in my C code that the compiler with full optimization cannot in whatever way optimize out. If there are any big problem please let me know. I am planning a project that has a part dealing with large amount of computation. I decided to write this core computation part in C, but with this kind of result I may rather write everything in Java; it is lot more easier and even faster? I still believe in C, so if there are any problem in my code please let me know. What I expected was that the Java version should be 1.5 times or more slower, but it somehow outperforms C. Test.c #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;time.h&gt; typedef signed char byte; typedef struct _Array { byte *data; int len; } Array; void new_Array(Array *a, int len) { a-&gt;data = (byte *)malloc(len * sizeof(byte)); a-&gt;len = len; } void del_Array(Array *a) { free(a-&gt;data); } typedef struct _BUI { Array num; int len; } BUI[1]; void new_BUI(BUI b, const char *s) { int len = strlen(s); b-&gt;len = len; new_Array(&amp;b-&gt;num, len); for (int i = 0; i &lt; len; ++i) { b-&gt;num.data[i] = s[len - i - 1] - '0'; } } void del_BUI(BUI b) { del_Array(&amp;b-&gt;num); } int BUI_cmp(const BUI a, const BUI b) { if (a-&gt;len &gt; b-&gt;len) { return 1; } if (a-&gt;len &lt; b-&gt;len) { return -1; } for (int i…
tagged with: c++
has answer: http://stackoverflow.com/a/27043304
upvote count: 1
has answer: http://stackoverflow.com/a/27040462
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27042306
tagged with: performance
has answer: http://stackoverflow.com/a/27042306
has comment: http://stackoverflow.com/comment/42608496
tagged with: java
downvote count: 3
tagged with: http://stackoverflow.com/tag/c
type: Question
has title: Java is 2+ times faster than C (as a subset of C++)
score: -2
accepted answer: http://stackoverflow.com/a/27040462
favorite count: 0
tagged with: optimization
answer count: 3

http://stackoverflow.com/q/26996565
has answer: http://stackoverflow.com/a/29615675
type: Question
has comment: http://stackoverflow.com/comment/42526815
has comment: http://stackoverflow.com/comment/60333690
has body: I am using WebLogic 10.2c. My webapp containing a jax-rs resource works fine in the grizzley but when it is deployed into WebLogic according to http://docs.oracle.com/cd/E17904_01/web.1111/e13734/rest.htm, it throws a NoClassDefFoundError as shown below. The weird thing is that this class can indeed be loaded by my webapp with class.forName() done in my servlet. So, somehow that class has become unavailable for jersey itself. Any idea on how to troubleshoot? I've tried using jersey as a shared library (and thus not including into my .war file) and including jersey into my .war file. Either makes any difference. Error 500--Internal Server Error java.lang.NoClassDefFoundError: com/sun/jersey/api/uri/UriComponent$Type at com.sun.jersey.api.uri.UriBuilderImpl.appendPath(UriBuilderImpl.java:497) at com.sun.jersey.api.uri.UriBuilderImpl.appendPath(UriBuilderImpl.java:485) at com.sun.jersey.api.uri.UriBuilderImpl.replacePath(UriBuilderImpl.java:244) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:844) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:352) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHan…
answer count: 1
downvote count: 0
tagged with: jax-rs
favorite count: 0
tagged with: weblogic-10.x
has title: NoClassDefFoundError on a class provided by jersey-core (UriComponent$Type)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42764629
upvote count: 1
tagged with: spring
score: 1
tagged with: java

http://stackoverflow.com/q/27113417
has answer: http://stackoverflow.com/a/27256922
has comment: http://stackoverflow.com/comment/42968048
has comment: http://stackoverflow.com/comment/42979912
tagged with: java
tagged with: scenebuilder
tagged with: javafx
type: Question
has body: I got a class that extends from TextField. I inserted the control manually into the fxml file and included an import statement. Now I can't see the controls in the Scene Builder version 2.0. Instead I get a message stating: "Selection contains unresolved reference". How would I go about and resolve them? Edit: I think I was not clear in stating where my problem lies. It seems to me that I should be able to set the classpath that points to the class of my custom control. Some websites like this one tell me to choose a menu entry called Resolve Unknown Types. Since this menu entry does not exist in my version of Scene Builder I thought that there must exist some new mechanism which resolves these kind of issues. That's the reason why I was so vague in my question. In hindsight that might have not been a good idea. FocusedTextField.java: package de.foo.bar.gui; import javafx.beans.property.StringProperty; import javafx.scene.control.TextField; public class FocusedTextField extends TextField{ public void setStringProperty(StringProperty stringProperty){ focusedProperty().addListener((observable, oldValue, newValue) -&gt; stringProperty.setValue(getText())); } } Excerpt from FooDialog.fxml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import de.foo.bar.gui.*?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;AnchorPane&gt; &lt;children&gt; &lt;FocusedTextField fx:id="fooField" /&gt; &lt;FocusedTextField fx:id="barField" /&gt; &lt;/children&gt; &lt;/AnchorPane&gt;
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43195246
has answer: http://stackoverflow.com/a/57242812
has comment: http://stackoverflow.com/comment/42980754
type: UnansweredQuestion
has title: Selection contains unresolved reference
has answer: http://stackoverflow.com/a/47940446
has comment: http://stackoverflow.com/comment/42981547

http://stackoverflow.com/a/27090343
has comment: http://stackoverflow.com/comment/44003590
answers question: http://stackoverflow.com/q/27090074
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27090074
score: 2
has body: As Aman said in the comments, just install Java again. It looks like it's a widespread problem. Here's a link to get a version from Apple that should work. Here's a link to get the JDK from Oracle that should work. You can read more about the issue here.
has comment: http://stackoverflow.com/comment/42693174
has comment: http://stackoverflow.com/comment/42697212
has comment: http://stackoverflow.com/comment/42698340
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/27054987
has body: Returned value is correct as there is nothing between % separators. For example for value "1%2%%4" it should return {"1", "2", "", "4"} array.
answers question: http://stackoverflow.com/q/27054855
accepted answer of: http://stackoverflow.com/q/27054855
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/42787395
type: Comment
comment on: http://stackoverflow.com/q/27145608
score: 0
has text: @MadProgrammer Yes Exactly
type: QuestionComment

http://stackoverflow.com/comment/42834054
type: Comment
type: QuestionComment
has text: @GabrielAramburu : Perfect!!! That was causing the problem, but I didn't remove the StatefulTimeout annotation(since it is a requirement for my assignment :) ), rather, I am performing EJB lookup before each method call from bean, so that the session timeout doesn't occur and the EJB is found on each instance. Which of the following solutions is better: 1. Removing the StatefulTimeout annotation. 2. Or, doing EJB lookup before each EJB method call. Do let me know. Thanks.
comment on: http://stackoverflow.com/q/27126376
score: 0

http://stackoverflow.com/q/27045303
tagged with: http://stackoverflow.com/tag/html
has title: How to invoke the servlets correctly if .html files are placed inside a folder within Web Content?
has comment: http://stackoverflow.com/comment/42666132
tagged with: eclipse-luna
tagged with: tomcat7
accepted answer: http://stackoverflow.com/a/27062258
has comment: http://stackoverflow.com/comment/42614010
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42621231
has comment: http://stackoverflow.com/comment/42624185
tagged with: java
tagged with: servlets
type: Question
has body: I am able to invoke the servlets correctly if I place the .html files under Web-Content and fail to invoke the servlets if I place them after creating a new folder within Web-Content? The one selected(in blue) when run is able to invoke the specified servlet. But for the 2 files placed under folder javaTpoint, after running these files, Error 404 renders. If I move to the location where the selected one is, then the case works fine. I have to create the folders so as to better streamline the file in web applcn.
answer count: 1
has answer: http://stackoverflow.com/a/27062258
score: 0

http://stackoverflow.com/comment/65967162
score: 0
has text: To be explicit, `%s` is for string not for `short`.
comment on: http://stackoverflow.com/q/27006259
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42737584
type: Comment
type: QuestionComment
has text: How come Java doesn't complain this overflow error then ? Is there a way to make this error show up ?
comment on: http://stackoverflow.com/q/27117379
score: 0

http://stackoverflow.com/comment/42674649
type: Comment
type: QuestionComment
score: 1
has text: This question appears to be off-topic because it is about basic knowledge of object oriented programming. Explaining how objects and methods work is too broad and can be found in plenty of (official) tutorials online.
comment on: http://stackoverflow.com/q/27082711

http://stackoverflow.com/q/27112213
tagged with: public-key-encryption
has answer: http://stackoverflow.com/a/27116232
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
has title: ECC Encryption and Decryption in Java
type: Question
tagged with: java
has body: Can we encrypt large files with ECC or it is like RSA works for small only? can anyone please recommend a good website for ECC Java implementation. Thanks
has answer: http://stackoverflow.com/a/62919367
upvote count: 4
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/42729825
score: 0
has comment: http://stackoverflow.com/comment/42727600

http://stackoverflow.com/comment/42718766
comment on: http://stackoverflow.com/q/27107794
score: 0
type: QuestionComment
type: Comment
has text: Can you show some code?

http://stackoverflow.com/q/26994555
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4971877
has answer: http://stackoverflow.com/a/26994712
tagged with: java
has comment: http://stackoverflow.com/comment/42519916
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26994643
type: Question
has comment: http://stackoverflow.com/comment/42520469
has title: Sending post data from JSP to a Java Servlet
tagged with: servlets
score: 0
answer count: 3
tagged with: jsp
has body: I am trying to send data from a JSP file to a Java Servlet. I've seen so many examples on here on how to do it, and I believe I am doing it the right way, but for some reason the doPost() methods is not being called inside my servlet. Here is what I added to my web.xml file: <?xml version="1.0" encoding="ISO-8859-1"?> loginServlet src.action.LoginServlet loginServlet /login Here is my JSP file Username Password Here is my Java servlet: package action; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class LoginServlet */ @WebServlet("/login") public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; public LoginServlet() { super(); // TODO Auto-generated constructor stub } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String username = (request.getAttribute("username")).toString(); System.out.println("asd"); String password = (String) request.getAttribute("password"); System.out.println(username); } } It's giving me an error on import javax.servlet.annotation.WebServlet; and on @WebServlet("/login") It's because they were only implemented in the spec v3.0, while I am only allowed to use spec v2.5 (required to at work). Anyone has any idea how to solve this issue? My directory:
favorite count: 0
has answer: http://stackoverflow.com/a/26994648

http://stackoverflow.com/comment/42745616
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27121651
type: Comment
has text: @A@Krishna by default is GET

http://stackoverflow.com/comment/42622928
score: 2
comment on: http://stackoverflow.com/q/27052943
has text: no, A is a *subclass* of Object, just like how String is a subclass of Object.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42640879
type: AnswerComment
has text: i edited code to treat the value greater than 59 seconds
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27060833

http://stackoverflow.com/a/27128473
has comment: http://stackoverflow.com/comment/42821736
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27126510
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27126510
type: Answer
has body: Now that you have posted it, the answer to how to mock it is here. testing-java-sockets
score: 2
downvote count: 1

http://stackoverflow.com/q/27106517
has title: How to create a data folder for my application?
linked to: http://stackoverflow.com/q/8387252
tagged with: download
tagged with: file
has body: I wrote this code for downloading some files in my android application but now downloaded files are in the root without any special order and it looks very bad! So I want to know how can I add a folder for my application's downloaded files? A code line to explain the path of output : OutputStream output = new FileOutputStream(Environment.getExternalStorageDirectory() + "/" + downloadedfileName); And here is my code: private class DownloadFileFromURL extends AsyncTask&lt;String, String, String&gt; { private String downloadedfileName; private ProgressDialog pDialog; @Override protected void onPreExecute() { super.onPreExecute(); Toast.makeText(getApplicationContext(), "بارگذاری...", Toast.LENGTH_SHORT).show(); pDialog = new ProgressDialog(DownloadActivity.this); pDialog.setMessage("کتاب در حال بارگذاري، لطفا منتظر بمانيد..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub pDialog.dismiss(); AlertDialog.Builder builder = new AlertDialog.Builder(DownloadActivity.this) .setTitle("دانلود کتاب با موفقیت انجام شد") .setMessage("از دانلود شما سپاس‌گذاریم.") .setNeutralButton("خواهش میکنم", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { Intent i = new Intent(DownloadActivity.this, LibActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); DownloadActivity.this.startActivity(i); DownloadActivity.this.finish(); } }); builder.create().show(); } public void setDownloadedFileName(String downloadedfileName){ this.downloadedfileName = downloadedfileName; } /** * Downloading file in background thread * */ @Override protected String doInBackground(String... surl) { int count; try { URL url = new URL(surl[0]); URLConnection conection = url.openConnection(); conection.connect(); // this will be useful so that you can show a typical 0-100% // progress bar int lenghtOfFile = conection.getContentLength();…
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42716464
linked to: http://stackoverflow.com/q/2130932
type: Question
has comment: http://stackoverflow.com/comment/42716320
accepted answer: http://stackoverflow.com/a/27106575
downvote count: 2
answer count: 1
linked to: http://stackoverflow.com/q/17794974
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/27106575
tagged with: android
tagged with: outputstream

http://stackoverflow.com/q/27119687
upvote count: 1
has comment: http://stackoverflow.com/comment/42740791
has answer: http://stackoverflow.com/a/27123944
favorite count: 0
tagged with: ajax
linked to: http://stackoverflow.com/q/5525795
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27128285
has comment: http://stackoverflow.com/comment/42740847
has title: AJAX response is not retaining the order of LinkedHashMap returned from the server
has body: I am using a LinkedHashMap to store map entries sorted by some business rule and I am sending it to the client, but my AJAX response always gets sorted by the map key. My sort function: protected Map&lt;Long, String&gt; sortWarehousesMap(Map&lt;Long, String&gt; warehousesMapTemp) { List&lt;Map.Entry&lt;Long, String&gt;&gt; entries = new ArrayList&lt;Map.Entry&lt;Long, String&gt;&gt;(warehousesMapTemp.entrySet()); Collections.sort(entries, new Comparator&lt;Map.Entry&lt;Long, String&gt;&gt;() { public int compare(Map.Entry&lt;Long, String&gt; a, Map.Entry&lt;Long, String&gt; b) { return a.getValue().compareTo(b.getValue()); } }); Map&lt;Long, String&gt; sortedWarehousesMapTemp = new LinkedHashMap&lt;Long, String&gt;(); for (Map.Entry&lt;Long, String&gt; entry : entries) { sortedWarehousesMapTemp.put(entry.getKey(), entry.getValue()); } return sortedWarehousesMapTemp; } Please help me what am I doing wrong.
downvote count: 0
type: Question
tagged with: linkedhashmap
score: 1
tagged with: java
tagged with: javascript
tagged with: response
answer count: 2

http://stackoverflow.com/a/27059490
has body: Of course you could "delete" rows in a Table(?) only via "HTML". You only need a &lt;form&gt;-Element which transfers your wishes to the server, which in response sends you an updated version of the page. Although that is awkward and not really smart - it is possible.
has comment: http://stackoverflow.com/comment/42633725
upvote count: 1
has comment: http://stackoverflow.com/comment/42633798
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27059384
type: Answer
answers question: http://stackoverflow.com/q/27059384
has comment: http://stackoverflow.com/comment/42634254

http://stackoverflow.com/a/27172374
answers question: http://stackoverflow.com/q/27132411
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42835682
upvote count: 1
has body: So I built it using the @helper.repeat. The best example is in the samples provided by Play. It's called forms. For a quick reference, the description can be found here - https://www.playframework.com/documentation/2.2.x/JavaFormHelpers @helper.inputText(userForm("name")) @helper.repeat(userForm("emails"), min = 1) { emailField =&gt; @helper.inputText(emailField) } For the address example: @(form: Form[User]) @helper.form(action=routes.User.add()) { &lt;label&gt;Add User&lt;label&gt; @text(form("name"), label="Name") @helper.repeat(form("addresses"), min= 1){ address =&gt; @helper.inputText(address("street")) @helper.inputText(address("house")) } &lt;input type="submit" class="btn btn-primary" value="Save" /&gt; } Validation works as normal if you add the required annotaion over street and house. The only thing you need to do is add the @Valid (javax.validation.Valid) annotation over the list of addresses. @Valid public List&lt;Address&gt; addresses; For adding and removing addresses, the sample is the best to look through.
type: Answer

http://stackoverflow.com/q/27101738
has comment: http://stackoverflow.com/comment/42740857
answer count: 0
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42708046
has body: private HomePieceOfFurniture adjustPieceOfFurnitureElevation(HomePieceOfFurniture piece) { // Search if another piece at floor level contains the given piece to elevate it at its height if (!piece.isDoorOrWindow() &amp;&amp; piece.getElevation() == 0) { float [][] piecePoints = piece.getPoints(); HomePieceOfFurniture highestSurroundingPiece = null; float highestElevation = Float.MIN_VALUE; for (HomePieceOfFurniture homePiece : this.home.getFurniture()) { if (homePiece != piece &amp;&amp; !homePiece.isDoorOrWindow() &amp;&amp; isPieceOfFurnitureVisibleAtSelectedLevel(homePiece)) { Shape shape = getPath(homePiece.getPoints()); boolean surroundingPieceContainsPiece = true; for (float [] point : piecePoints) { if (!shape.contains(point [0], point [1])) { surroundingPieceContainsPiece = false; break; } } if (surroundingPieceContainsPiece) { float elevation = homePiece.getElevation() + homePiece.getHeight(); //pravin if (elevation &gt; highestElevation) { try{ HomePieceOfFurniture table=homePiece; HomePieceOfFurniture newpiece=piece; if(table.getName().contains("able")) { if(newpiece.isunfolded()|| newpiece.isfolded()) { FurnitureCatalog catalog1=preferences.getFurnitureCatalog(); FurnitureCategory category1=catalog1.getCategories().get(0); CatalogPieceOfFurniture piece2= category1.getFurniture().get(6); HomePieceOfFurniture piece3=createHomePieceOfFurniture(piece2); float h=(float)piece3.getHeight(); float w=(float)piece3.getWidth(); float d=(float)piece3.getDepth(); FinalHeight=h; FinalWidth=w; FinalDepth=d; Content newModel= piece3.getModel(); String name=piece3.getName(); Content icon=piece3.getIcon(); String id=piece3.getCatalogId(); newpiece.setModel(newModel); newpiece.setName(name); newpiece.setIcon(icon); // newpiece.setId(id); newpiece.setHeight(FinalHeight); newpiece.setWidth(FinalWidth); newpiece.setDepth(FinalDepth); newpiece.setFolded(true); newpiece.setunFolded(false); twoDView.setBackground(Color.decode(ConstantColorsFonts.ButtonNotClicked)); } } if (table…
score: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/42708196
has title: how to refreshing 3d view in java?

http://stackoverflow.com/q/27058057
has body: I need help with iris comparing. I've already segment and normalize my iris images. Now I want to extraxt features, add it to database, or just simply in list of feature vector, and then compare it with other features vector. I want my application to decide if such iris is already in database or not. Of course images are diffenent, they were done in different light, angle etc. I thought that Gabor filter would be helpful, so I it to 12 different parameters values: Mat kernel = Imgproc.getGaborKernel(new Size(25, 25), sigma, theta, lambda, gamma, psi, CvType.CV_64F); Scalar sum = Core.sumElems(kernel); //kerner normalization Core.divide(kernel, sum, kernel); Imgproc.filter2D(floatSource, dest, CvType.CV_64F, kernel); Then I compute 12 Hamming distances using this function: dist_ham = Core.norm(it1.next(), it2.next(), Core.NORM_HAMMING); And get the average. And... it does not work. Hamming distanse is similar when I am comparing 2 different images of the same iris or 2 different irises. How can I make my algorithm better? Maybe I should use some implemented in openCV mathers to obtain good results? For me it don't matter which algorithm I will use, I just want have good results. And I'm a little begginer. Some sample pictures: Person one img1: Normalized iris for person one img1: Person one img2: Normalized iris for person one img2: Hamming distance for this example is about 29000 (and this is the lowest distance i got, in the most part i got about 30000 - 31000 for the same person iris) Hamming distance for different persons is about 31000 (depends on tested image)
tagged with: image-processing
has comment: http://stackoverflow.com/comment/58346177
has comment: http://stackoverflow.com/comment/42636717
has comment: http://stackoverflow.com/comment/48262197
has comment: http://stackoverflow.com/comment/42637097
has comment: http://stackoverflow.com/comment/42665184
tagged with: iris-recognition
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43173993
favorite count: 0
has comment: http://stackoverflow.com/comment/43212493
has comment: http://stackoverflow.com/comment/42632636
has answer: http://stackoverflow.com/a/41216940
score: 2
has comment: http://stackoverflow.com/comment/48012457
upvote count: 2
type: UnansweredQuestion
has title: Comparing irises images with opencv
type: Question
has comment: http://stackoverflow.com/comment/42635967
tagged with: opencv
tagged with: java
has comment: http://stackoverflow.com/comment/43170446

http://stackoverflow.com/comment/42845264
has text: Yes, Is it possible then to implement transactions on top of a generic file system that doesn't have its own built-in mechanism?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27099007

http://stackoverflow.com/comment/42786901
type: Comment
comment on: http://stackoverflow.com/a/27144519
score: 0
type: AnswerComment
has text: Oops, that was a cut and paste error on my part. See update, call function then check for `null`. As for why it works on one phone or and not another -- maybe location services are disabled on the phone it is crashing on. Either way, to avoid the crash make sure you are actually getting a location back.

http://stackoverflow.com/q/27117193
has comment: http://stackoverflow.com/comment/42736683
accepted answer: http://stackoverflow.com/a/27117376
linked to: http://stackoverflow.com/q/363681
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/64687222
tagged with: java
possible better answer: http://stackoverflow.com/a/53842655
has answer: http://stackoverflow.com/a/27117376
has answer: http://stackoverflow.com/a/27117218
has body: I'm new to programming java and i need to make random integers between 2 values. I could not find any relevant info in the oracle tutorials. because i'm new to java, most of what i researched i don't understand. I have looked at the following: http://docs.oracle.com/javase/7/docs/api/java/util/Random.html Generating a Random Number between 1 and 10 Java http://www.javapractices.com/topic/TopicAction.do?Id=62 How do I generate random integers within a specific range in Java? Getting random numbers in Java i have tried: import java.util.Random; public static void main(String[] args) { Random randint = new Random(); System.out.println(randint); result: java.util.Random@52e922 it appears to be printing the type of randint. so, how do i create a random integer between 2 values, and then print the result to the screen?
type: Question
has comment: http://stackoverflow.com/comment/42736709
tagged with: random
has comment: http://stackoverflow.com/comment/42738582
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42736700
has comment: http://stackoverflow.com/comment/42738406
has answer: http://stackoverflow.com/a/27117225
has title: random integers between 2 values
has comment: http://stackoverflow.com/comment/42740294
has answer: http://stackoverflow.com/a/53842655
linked to: http://stackoverflow.com/q/20389890
has comment: http://stackoverflow.com/comment/42736696
linked to: http://stackoverflow.com/q/5887709
score: 2
upvote count: 2
answer count: 5
has comment: http://stackoverflow.com/comment/42737228

http://stackoverflow.com/q/27132659
has title: Is java toBinaryString Incorrect?
type: Question
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/4421400
has comment: http://stackoverflow.com/comment/42764196
has comment: http://stackoverflow.com/comment/42764316
favorite count: 0
has body: I have this Code: String hexCode = "A1E1F1"; int länge = hexCode.length (); int i; for (i = 0; i &lt;= länge - 1 ; i ++) { char pos = hexCode.charAt(i); String binCode = Integer.toBinaryString(pos); System.out.print ( binCode); When I run it I get this result: 100000111000110001011100011000110110001 Which I don't believe is correct. Shouldn't it be: 101000011110000111110001 Are these results actually the same? Why does java give me the first result?
has comment: http://stackoverflow.com/comment/42764344
has answer: http://stackoverflow.com/a/27132753
has comment: http://stackoverflow.com/comment/42764132
type: UnansweredQuestion
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/27132748
score: -1
has comment: http://stackoverflow.com/comment/42764127

http://stackoverflow.com/comment/42792946
type: Comment
comment on: http://stackoverflow.com/q/27148868
has text: Add `setDebug(true)` to your `Session` object and watch the logs for hints.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42777019
has text: Monty, please refer to some [guidelines](http://meta.stackexchange.com/questions/10811/how-do-i-ask-and-answer-homework-questions) on how to ask questions of this kind. In a word, just show what you tried, and then folks here will be more than happy to help unlock the problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27136655
score: 0

http://stackoverflow.com/a/27100675
has comment: http://stackoverflow.com/comment/55878203
has comment: http://stackoverflow.com/comment/55957308
answers question: http://stackoverflow.com/q/27096363
has comment: http://stackoverflow.com/comment/55920087
upvote count: 21
type: AcceptedAnswer
has body: In H2 version 1.3.x, the database file &lt;databaseName&gt;.h2.db is the default. (The storage engine "PageStore" is used). In H2 version 1.4.x, the database file &lt;databaseName&gt;.mv.dbis the default. (The storage engine "MVStore" is used). The MVStore is still beta right now (November 2014). But you can disable the MVStore by appending ;mv_store=false to the database URL.
has comment: http://stackoverflow.com/comment/55985038
type: Answer
downvote count: 0
score: 21
accepted answer of: http://stackoverflow.com/q/27096363

http://stackoverflow.com/q/27138222
favorite count: 0
has answer: http://stackoverflow.com/a/27138240
type: UnansweredQuestion
has body: This is a question about java local variables (Following code in the same method) boolean userWantsToSave; userWantsToSave = true; Eclipse throws The value of the local variable userWantsToSave is not used, my question is why? Since the variable is assigned true, why is it still not used?
has comment: http://stackoverflow.com/comment/42775704
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27138250
type: Question
has answer: http://stackoverflow.com/a/44723633
has comment: http://stackoverflow.com/comment/42774423
has comment: http://stackoverflow.com/comment/42774458
has title: Java local variable
answer count: 3
has comment: http://stackoverflow.com/comment/42774381
downvote count: 0

http://stackoverflow.com/comment/42790179
score: 0
type: Comment
has text: I thought the entire object is overwritten.
comment on: http://stackoverflow.com/a/27147410
type: AnswerComment

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/27117377
type: Tag

http://stackoverflow.com/comment/42849218
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27144781
has text: Do you have a cause exception (what caused the InvocationTargetException?)

http://stackoverflow.com/comment/42740637
comment on: http://stackoverflow.com/a/27119596
type: AnswerComment
score: 0
type: Comment
has text: Otherwise stack will overflow. Means that your base condition will never hit. Or in other words you are call a function again and again infinite times. If you found my answer helpful then please mark it correct.

http://stackoverflow.com/comment/42780668
comment on: http://stackoverflow.com/a/27102951
has text: have you check both file are mp3? or try with some new files because i have checked the code it working properly.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42611516
comment on: http://stackoverflow.com/q/27046368
type: Comment
type: QuestionComment
score: 0
has text: From looking at that problem description it seems like you would want to use a stack to hold all available tables. When a table is being used it would be popped off the stack. If there are no tables in the stack then there are none available.

getparameter
tag name: getparameter
type: Tag
tags question: http://stackoverflow.com/q/27080512

http://stackoverflow.com/comment/42773794
type: Comment
comment on: http://stackoverflow.com/q/27086867
type: QuestionComment
has text: Yes. 'Subh'... thats correct. Can you please help
score: 0

http://stackoverflow.com/comment/42589975
has text: sorry i forgot to mention you even have to resize the panel to make sure the components are visible
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27034459
type: Comment

http://stackoverflow.com/q/27047145
downvote count: 1
has title: Running Someone else's Source Code
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/42612722
has body: So I found source code for a game I want to examine (read, not a virus). The link is in the description of the video below: https://www.youtube.com/watch?v=AA1XpWHhxw0 So I downloaded it and extracted the files. The game should be run from /src/com/neet/DiamondHunter/Main/Game.java. I then tried to run Game.java from the command line: C:\...Diamond Hunter\src\com\neet\DiamondHunter\Main&gt; javac Game.java and get the following error: Game.java:15: error: cannot find symbool window.add(new GamePanel()); ^ symbol: class GamePanel location: class Game I cannot for the life of me, figure out what the problem is. Both Game.java and GamePanel.java exist, are in the same package, in the same folder, but the compiler doesn't find GamePanel when running Game. I have had this problem with code I've downloaded before. The program is not an applet, and I haven't been misspelling things. Could someone help me run these files, or give me some insight into what is/isn't happening?
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42612470
favorite count: 0
has answer: http://stackoverflow.com/a/27047282
tagged with: compiler-errors
type: UnansweredQuestion

http://stackoverflow.com/comment/42529355
comment on: http://stackoverflow.com/a/26999522
score: 1
type: AnswerComment
type: Comment
has text: You can remove elements from the list parameter. You can also add a null reference but that's not very useful.

http://stackoverflow.com/q/27120530
has answer: http://stackoverflow.com/a/27122238
has body: I have written a selenium code to select a button on browser and to click it but I want selenium to wait for few seconds when it moves to that element.How can I do this? following is my tried code , but it did't work for me. My code : Actions actionobj = new Actions(fd1); actionobj.moveToElement(heatmap); actionobj.perform(); fd1.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); Actions action2 = new Actions(fd1); action2.click(heatmap); action2.perform(); My code works fine but it does't stop for 10 seconds when mouse is moved to button.I have also tried Thread.sleep() but that also did't work.
has comment: http://stackoverflow.com/comment/42742653
downvote count: 0
has title: Wait for few seconds in selenium?
has comment: http://stackoverflow.com/comment/42742591
has comment: http://stackoverflow.com/comment/42742728
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/42742688
has answer: http://stackoverflow.com/a/27120881
has answer: http://stackoverflow.com/a/27120602
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/27121048
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/27120921
accepted answer: http://stackoverflow.com/a/27120881
has answer: http://stackoverflow.com/a/27120921

http://stackoverflow.com/q/27063950
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27065676
has title: Vaadin, Gwt, gwt + something server-side, something else at all?
tagged with: gwt
tagged with: java
tagged with: vaadin
type: Question
answer count: 2
tagged with: ria
score: 0
has body: I'm working to learn some good frameworks (o set of frameworks/languages) for to build some RIA java based, not exclusively business-oriented ones. I'm at my start so excuse me for so general question. Actually I've spent some time on GWT, and i like that philosophy. Problem is Java 8; I'm working with Java 8, and there is an incompatibility with GWT; I know is only matter of time to be resolved, but in the meantime i'm working around. Now, I've understood (?) that GWT is the best for to build client-side RIAs but lack somewhere in the server-side aspect, and it probably need to be reinforced in some way. But what's means "reinforcing"? what can be the "good partner" server-side for GWT? I've gived a look at Vaadin, but i don't like so much that philosophy: the Gwt idea to spare the elaboration load from server and client is winning, in my opinion, while in Vaadin, if i don't understand wrong, the elaboration is almost only server-side. Now the question is: what is the best 2014 practice road? Only GWT ? GWT + server side add on's (and what addons?)? Vaadin? Or something different?
has comment: http://stackoverflow.com/comment/42648789
has answer: http://stackoverflow.com/a/27065497

http://stackoverflow.com/comment/42719314
comment on: http://stackoverflow.com/a/27102560
type: AnswerComment
score: 0
type: Comment
has text: You can install [**Weld** (reference CDI implementation) or **OpenWebBeans** (Apache CDI implementation)](http://balusc.blogspot.it/2013/10/how-to-install-cdi-in-tomcat.html) in Tomcat as described in BalusC's blog post, or simply use [TomEE (Tomcat on steroids)](http://tomee.apache.org/), I've never heard anyone talking bad of it, anywhere. If you want EclipseLink out of the box, you need [**TomEE PluME**](http://tomee.apache.org/comparison.html)

http://stackoverflow.com/comment/42773792
has text: Thanks! I made c = 0 just before the last return statement, and now it's only returning that first month. How can I make it so that it returns the 1st month, then 2nd, then 3rd...etc? Thanks for all your help though, I really appreciate it!
type: Comment
comment on: http://stackoverflow.com/a/27137781
score: 0
type: AnswerComment

http://stackoverflow.com/a/57321693
type: Answer
answers question: http://stackoverflow.com/q/27051034
has body: There's mixed pickup and delivery VRP experimental code here, which works. We don't have a polished out-of-the-box example yet, but we it's on long-term roadmap.
score: 0

http://stackoverflow.com/a/27010679
answers question: http://stackoverflow.com/q/27009657
has comment: http://stackoverflow.com/comment/42549147
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42551891
has body: Really, focus your efforts within the CellEditor itself, that's it's job. There is no need to extend from JTable or screw around with it. import java.awt.Component; import java.awt.EventQueue; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractCellEditor; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellEditor; public class TestCellEditor { public static void main(String[] args) { new TestCellEditor(); } public TestCellEditor() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } List&lt;String&gt; values = new ArrayList&lt;&gt;(5); values.add("Bananas"); values.add("Apples"); values.add("Oranages"); values.add("Grapes"); values.add("Pears"); ComboBoxTableCellEditor editor = new ComboBoxTableCellEditor(values); DefaultTableModel model = new DefaultTableModel(new Object[]{"Fruit"}, 5); JTable table = new JTable(model); table.getColumnModel().getColumn(0).setCellEditor(editor); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(table)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class ComboBoxTableCellEditor extends AbstractCellEditor implements TableCellEditor { private JComboBox editor; private List&lt;String&gt; masterValues; public ComboBoxTableCellEditor(List&lt;String&gt; masterValues) { this.editor = new JComboBox(); this.masterValues = masterValues; } @Override public Object getCellEditorValue() { return editor.getSelectedIte…
has comment: http://stackoverflow.com/comment/42551931
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42548659
has comment: http://stackoverflow.com/comment/42549978
accepted answer of: http://stackoverflow.com/q/27009657

http://stackoverflow.com/q/27049570
score: 0
has answer: http://stackoverflow.com/a/27050554
has title: In order to fill the properties of an object, what is more effective, to send the object as parameter to a method or return it from the method?
favorite count: 0
has comment: http://stackoverflow.com/comment/42616785
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has body: I have an object and I want to fill its properties inside of a method so, what is more effective, clean or according to any convention, to send the object as parameter (given that what I send is just a reference of the object) to the method or just declare inside the method an auxiliar object of that type, fill it, and return it? For example, should I do this: public class DataEntity{ public void setProperty(Type value) { } } public class EntityBuilder { public configureEntity(DataEntity toConfig){} } or this: public class DataEntity{ public void setProperty(Type value) { } } public class EntityFactory { public DataEntity createEntity(){} }
tagged with: object
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42616700

http://stackoverflow.com/comment/42792417
score: 0
type: AnswerComment
has text: why this still dose not work `Timestamp stamp = new Timestamp(1000 * mIssue.getReleaseTime());` where `mIssue.getReleaseTime() = 1416990366`
type: Comment
comment on: http://stackoverflow.com/a/27148674

http://stackoverflow.com/q/27147538
has comment: http://stackoverflow.com/comment/42790828
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/46513393
tagged with: java
has title: flames game logic using java giving error result?
has comment: http://stackoverflow.com/comment/42790560
type: Question
has comment: http://stackoverflow.com/comment/42790785
answer count: 6
score: 4
has answer: http://stackoverflow.com/a/32599030
has answer: http://stackoverflow.com/a/27148090
has answer: http://stackoverflow.com/a/76793389
upvote count: 4
has answer: http://stackoverflow.com/a/42355620
possible better answer: http://stackoverflow.com/a/27148085
has answer: http://stackoverflow.com/a/27148085
has body: Here I have created a flames game logic it is final string length is correct(eg:4 for two strings 'raja' and 'rani') based on length I need to show 'f' or 'l' or 'a' or 'm' or 'e' or 's'. I have written logic based on length that character is visible but that is not my concern. For length 4 result should be 'e'(in flames for length 4 first 'm' should remove then 'l' then 'f' then 'a' then 's' finally i need 'e' as output.Can anybody tell me idea. This is my code. public static void main(String[] args) { String name1 = "raja"; String name2 = "rani"; String s1 = name1; String s2 = name2; for (int i = 0; i &lt; name1.length(); i++) { for (int j = 0; j &lt; name2.length(); j++) { if (name1.charAt(i) == name2.charAt(j)) { name1 = name1.replaceFirst(String.valueOf(name1.charAt(i)), "#"); name2 = name2.replaceFirst(String.valueOf(name2.charAt(j)), "#"); } } } String result = name1 + name2; result = result.replaceAll("#", ""); int resultLength = result.length(); String baseInput = "flames"; char relationIs = 0; int temp = 0; if (resultLength &gt; 0) { temp = resultLength % baseInput.length(); } if (temp == 0 &amp;&amp; resultLength &gt;= 6) { relationIs = 's'; } else { int count = temp - 1; if (count &gt;= 0) { relationIs = baseInput.charAt(count); System.out.println("Relation Betw " + s1 + " and " + s2 + " is:"); } } switch (relationIs) { case 'f': System.out.println("friendship"); break; case 'l': System.out.println("Lovers"); break; case 'a': System.out.println("Affection"); break; case 'm': System.out.println("Marriage"); break; case 'e': System.out.println("Enemity"); break; case 's': System.out.println("Siblings"); break; default: System.out.println("FLAME Test works only for different names"); break; } } Logic follows this order:only forward direction remove 4 character. if length=4 step 0:flames ('f' as 1) step 1:flaes (here 'e' as 1) step 2:faes (here 'a' as 1) step 3:aes (here 'a' as 1) step 4:es (here 'e' as 1) step 5:e //output. Your help will be appreciated.
has comment: http://stackoverflow.com/comment/42790694
downvote count: 0
accepted answer: http://stackoverflow.com/a/27148090
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/42716917
comment on: http://stackoverflow.com/a/27106691
score: 0
type: Comment
has text: @pawankumar It's alright you can upvote that will assign 10 points (click up arrow by question) also you can accept this question as the right answer that will give 15 points.
type: AnswerComment

http://stackoverflow.com/comment/42699379
type: QuestionComment
comment on: http://stackoverflow.com/q/27096743
score: 1
has text: I think "area under the curve of a normal distribution" = "cumulative distribution function of the normal distribution"? If so, you can compute it from the complementary error function, `erfc()`, like so: `standard_normal_cdf(x) = 0.5*erfc(-sqrt(0.5)*x); normal_cdf (x,mu,sigma) = standard_normal_cdf ((x-mu)/sigma);` How to import `erfc()` is shown in [this question](http://stackoverflow.com/questions/16221406/use-of-erfc-function-commons-apache-org-library)
type: Comment

http://stackoverflow.com/comment/42734739
has text: You can read/write to binary (or bytes/octets really). Hexadecimals is a method of *representing* binary data, it isn't the value of the hexadecimal data. So you don't read / write to hex normally, that's just how the bytes are diplayed.
comment on: http://stackoverflow.com/q/27106907
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27069386
tagged with: el
has body: I have a JSP page with JSTL and I want to separate an user from other with an &lt;hr&gt; tag. How can I solve it? &lt;c:forEach var="user" items="${list_users}"&gt; &lt;c:out value="${user.name}"/&gt; &lt;c:out value="${user.surname}"/&gt; &lt;/foreach&gt;
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27069745
tagged with: java
possible better answer: http://stackoverflow.com/a/27069726
downvote count: 1
type: Question
answer count: 2
tagged with: jstl
has answer: http://stackoverflow.com/a/27069745
tagged with: jsp
has title: Separate item in foreach tag (jstl)
score: 0
has answer: http://stackoverflow.com/a/27069726
favorite count: 0

http://stackoverflow.com/a/27024785
score: 1
answers question: http://stackoverflow.com/q/27024724
has body: The null check is dead code because prior to it you access the words variable, so if it's null, you'll get a NullPointerException before the null check. boolean checklowercase = words.toLowerCase().equals(words); .... if (words == null) // this can never be true result[k] = null; // this is dead code
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/27051402
type: Answer
answers question: http://stackoverflow.com/q/27002355
score: 1
upvote count: 1
has body: This seems to be a release problem of 3.11-Beta3 :( For the time being, please add the ooxml-security.jar to your pom.xml: org.apache.poi ooxml-security 1.0 Until it's staged to central, you'll need to add the apache repo: apache-repo Apache Repo https://repository.apache.org/service/local/repositories/releases/content/ Update: will be fixed by 1640846 i.e. the next poi release
has comment: http://stackoverflow.com/comment/42657576
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27002355
has comment: http://stackoverflow.com/comment/42677818

http://stackoverflow.com/comment/42546714
type: Comment
type: QuestionComment
has text: @nitish005 nope; even if `y` is a `float`, `y + "C"` will be a `String`
comment on: http://stackoverflow.com/q/27009284
score: 0

http://stackoverflow.com/q/27109487
has title: How to perform integer range query in apache lucene?
linked to: http://stackoverflow.com/q/5026185
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42722746
tagged with: lucene
score: 0
has answer: http://stackoverflow.com/a/27351831
answer count: 1
type: UnansweredQuestion
has body: I am using the apache lucene to perform fulltext search in my application. Now I have to perform a range query to search records between two integers. I have created my index using following code private void set(String fieldName, String fieldValue, Document luceneDocument, LuceneOptions options, Float boost) { if (fieldName != null &amp;&amp; fieldValue != null) { Field luceneField = new Field(fieldName, fieldValue.toLowerCase(), options.getStore(), options.getIndex(), options.getTermVector()); luceneField.setBoost(boost); luceneDocument.add(luceneField); } } The above method creates the lucene indexes for my field name "magnitude" which possible values are positive and negative integers in between the range of -999 to 9999. Now if I create a lucene range query like (magnitude:[10 to 345]) or (magnitude:[10 to null]). I am not getting the correct number of records.

http://stackoverflow.com/comment/42745424
comment on: http://stackoverflow.com/a/27121524
type: AnswerComment
score: 0
type: Comment
has text: I ment my code. If I was about to use your code, could you help me to edit my input so it works for your code, please? It would help me very much.

http://stackoverflow.com/comment/42614504
score: 3
has text: Because the scope of `qst` is in the if block body, so invisible outside. (you should also have a warning)
comment on: http://stackoverflow.com/q/27048334
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27054294
answers question: http://stackoverflow.com/q/27054172
type: Answer
score: 3
downvote count: 0
has body: The scope of your first 'v' is limited to the first for loop. So in the second loop, the 'v' you use in the subscript is not declared when it is first used. What do you expect to do in the second 'for'? Print everything inside list2 ? If yes, then you need to make a nested for loop like this: for(ArrayList&lt;&gt; innerList : list2) for(int i : innerList) System.out.println(i); Notice that as list2 contains ArrayLists and not ints, then you cannot do the for as you had it in your code (the iterating variable cannot be an int).
upvote count: 3

http://stackoverflow.com/comment/42610967
type: AnswerComment
comment on: http://stackoverflow.com/a/27044717
score: 0
type: Comment
has text: Thank you. This helps for now. Let me evaluate the answer before i come up with some more questions. :).

http://stackoverflow.com/q/27063001
answer count: 1
has comment: http://stackoverflow.com/comment/42639969
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27063193
score: 2
has title: running time of flush() for output stream
tagged with: java
type: Question
upvote count: 2
has body: I am trying to submit solution (using some online compiler that has compile time constraints) for sorting an array- here is my code snippet- class TSORT { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter bw = new PrintWriter(System.out, false); int t = Integer.parseInt(br.readLine()); int[] list = new int[1000001]; for(int i = 0; i &lt; t; i++){ int n = Integer.parseInt(br.readLine()); list[n]++; } int r=0; for(int i = 0; i &lt; 1000001; i++){ if(list[i] &gt; 0){ for(int j = 0; j &lt; list[i]; j++){ bw.println(i); // if I use bw.flush() here, time limit gets exceeded. } } } bw.flush(); } } This code gets submitted successfully, but if I use flush() as true (automatic flushing- new PrintWriter(System.out, true);), the compiler shows TIME LIMIT EXCEEDED . My question is - how should I use flush() to get best compile time?
downvote count: 0
favorite count: 0
tagged with: flush

http://stackoverflow.com/comment/54162566
type: Comment
score: 3
type: AnswerComment
has text: This way will kill static file loading
comment on: http://stackoverflow.com/a/27236734

http://stackoverflow.com/comment/42601064
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27028288
has text: Here is the link for the stdout : https://drive.google.com/file/d/0B_JF7yvk3X13OEpzT3kxaS1rME0/view?usp=sharing
score: 0

http://stackoverflow.com/comment/42786734
type: Comment
type: QuestionComment
has text: probably so that you would be able to initiate the program flow without everything having to be in `static` context.
comment on: http://stackoverflow.com/q/27145430
score: 0

local
tags question: http://stackoverflow.com/q/27096561
tags question: http://stackoverflow.com/q/26997290
type: Tag
tag name: local
tags question: http://stackoverflow.com/q/27095847

http://stackoverflow.com/comment/42889399
type: AnswerComment
has text: I think you are using it in a wrong way. Try this: javac -classpath %CLASSPATH%;c:\progs\jaxrsri\c:\progs\jaxrs-ri\api\javax.ws.rs-api-2.0??.1.jar;c:\progs\jaxrs-ri\api\javax.ws.rs-api-2.0.1.jar;c:\progs\jaxrs-ri\api\java??x.ws.rs-api-2.0.1.jar; *.java
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27134623

http://stackoverflow.com/q/27054792
tagged with: mysql
tagged with: jsp
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27066430
tagged with: el
accepted answer: http://stackoverflow.com/a/27066430
has body: I am trying to create a simple DB web application using MySQL, JDBC, Netbeans. I have the following code in a .jsp page &lt;c:if ${sessionScope.Staff.getStatus() == sessionScope.Staff.financial_staff_status} &gt; Financial staff &lt;/c:if&gt; where sessionScope.Staff contains an object of Staff Data type: public class StaffData { //constants public final byte default_staff_status = 0; public final byte financial_staff_status = 1; public final byte legal_staff_status = 2; public final byte secretarial_staff_status = 3; //other data StaffData() { //initializations } void authenticate(int staff_num, String passwd) throws ClassNotFoundException, SQLException { //connect to sever, blah, blah } public String getName() { return this.name; } public int getNumber() { return this.staff_number; } public byte getStatus() { return this.status; } } I am setting the session object in advance: request.getSession().setAttribute("Staff", currentStaff); I am getting the following error: javax.el.PropertyNotFoundException: Property 'financial_staff_status' not found on type staff.StaffData In the staff data object in the session, public methods such as getName() can be accessed, but public members such as financial_staff_status cannot. Why am I getting this problem? The problem seems to be with the final variables. Non final variables can easily be accessed without a problem.
answer count: 1
has title: JSP-EL session variable access error: javax.el.PropertyNotFoundException despite said property being public
tagged with: if-statement
score: 0
tagged with: java

http://stackoverflow.com/comment/42606382
comment on: http://stackoverflow.com/q/27039986
score: 0
type: Comment
type: QuestionComment
has text: Neither username nor timestamp are particularly secret, right? You could create a token that contains both together with some kind of signature (HMAC). That way you can prevent/detect tampering and yet easily read the data. I can post some sample code if you're interested in this approach.

http://stackoverflow.com/comment/42726576
has text: Do you have another comparator for `sortByValue`? Or are you using the above `comapreTo`?
comment on: http://stackoverflow.com/q/27111676
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42570924
type: Comment
has text: I think you want to break line in the first loop instead of the second one. @gtgaxiola I think he does that because the output to look like a table.
type: QuestionComment
comment on: http://stackoverflow.com/q/27023446
score: 0

http://stackoverflow.com/comment/42699675
has text: @Michael Goldstein I am not sure I understand your point. I did not state that the CDF of the normal distribution is not an integral. I said *we* do not need to integrate because there is a commonly used and readily available function (also an integral :-) from which it can be computed.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27096743

http://stackoverflow.com/comment/42622468
has text: @TheMountainFurnaceGabriel: Do you not know about the difference between `str` and `bytes`, and text and binary file objects? Let me edit the answer.
comment on: http://stackoverflow.com/a/27052282
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27099297
score: 0
has comment: http://stackoverflow.com/comment/42703791
upvote count: 1
has comment: http://stackoverflow.com/comment/42703381
has comment: http://stackoverflow.com/comment/42703649
has comment: http://stackoverflow.com/comment/42704938
tagged with: method-call
favorite count: 0
has comment: http://stackoverflow.com/comment/42704700
has comment: http://stackoverflow.com/comment/42703325
has title: How to use this method?
has comment: http://stackoverflow.com/comment/42703151
has comment: http://stackoverflow.com/comment/42703174
has comment: http://stackoverflow.com/comment/42703438
has comment: http://stackoverflow.com/comment/42703922
has comment: http://stackoverflow.com/comment/42703390
tagged with: recursive-backtracking
has comment: http://stackoverflow.com/comment/42703975
answer count: 0
has comment: http://stackoverflow.com/comment/42703287
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/42703520
has comment: http://stackoverflow.com/comment/42704779
has comment: http://stackoverflow.com/comment/42704089
has comment: http://stackoverflow.com/comment/42703506
has comment: http://stackoverflow.com/comment/42703959
has body: I am very close to finishing my task, but I can't figure out how to call findChange() correctly. My guess is that it needs to be in the main method. But when findChange(); call it, it asks for int, List&lt;Integer&gt;, List&lt;Integer&gt; so how do I do this "correctly" so to speak. CODE import java.io.*; import java.util.*; import java.lang.*; public class homework5 { public static int change; public static void main(String[] args) throws FileNotFoundException { //begin main ArrayList&lt;Integer&gt; coinTypes = new ArrayList&lt;Integer&gt;();//array to store //coin types Integer i; File f = new File (args[0]); Scanner input = new Scanner(f); //initialize scanner input.nextLine(); while(input.hasNextInt()) { i = input.nextInt(); coinTypes.add(i); } change = coinTypes.get(coinTypes.size()-1); //this will add all ints coinTypes.remove(coinTypes.size()-1); System.out.println("Found change"); //used for debugging System.out.println("Change: " + change); //findChange(); ideal spot to call the method //System.out.println(coinTypes); } boolean findChange(int change, List&lt;Integer&gt; coinTypes, List&lt;Integer&gt; answerCoins) { //contains means of //finding the change solutions if(change == 0) { return true; //a solution } if(change &lt; 0) { return false; //if negative it can't be a solution } else { for(Integer coin : coinTypes) { if(findChange(change - coin, coinTypes, answerCoins)){ answerCoins.add(coin); //if it works out add it to the return true; //solution List } } } List&lt;Integer&gt; answer = new ArrayList&lt;Integer&gt;(); boolean canFindChange = findChange(change, coinTypes, answer); if(canFindChange) { //if there is a solution, print it System.out.println(answer); } else { System.out.println("No change found"); } return false; //else return false } } This program calculates all the different ways to show change for a certain amount of money ie: 143 ($1.43). All I gotta do is call findChange() to main and it should work, what am I missing? EDIT I just reali…
tagged with: java
has comment: http://stackoverflow.com/comment/42703389
type: Question

http://stackoverflow.com/comment/42545088
score: 0
comment on: http://stackoverflow.com/q/27008165
type: Comment
type: QuestionComment
has text: I will do that now, and return if it DOES NOT work, thanks!

http://stackoverflow.com/q/27030667
has body: I am trying to read (and then store to 3rd party local db) certain DICOM object tags "during" an incoming association request. For accepting association requests and storing locally my dicom files i have used a modified version of dcmrcv() tool. More specifically i have overriden onCStoreRQ method like: @Override protected void onCStoreRQ(Association association, int pcid, DicomObject dcmReqObj, PDVInputStream dataStream, String transferSyntaxUID, DicomObject dcmRspObj) throws DicomServiceException, IOException { final String classUID = dcmReqObj.getString(Tag.AffectedSOPClassUID); final String instanceUID = dcmReqObj.getString(Tag.AffectedSOPInstanceUID); config = new GlobalConfig(); final File associationDir = config.getAssocDirFile(); final String prefixedFileName = instanceUID; final String dicomFileBaseName = prefixedFileName + DICOM_FILE_EXTENSION; File dicomFile = new File(associationDir, dicomFileBaseName); assert !dicomFile.exists(); final BasicDicomObject fileMetaDcmObj = new BasicDicomObject(); fileMetaDcmObj.initFileMetaInformation(classUID, instanceUID, transferSyntaxUID); final DicomOutputStream outStream = new DicomOutputStream(new BufferedOutputStream(new FileOutputStream(dicomFile), 600000)); //i would like somewhere here to extract some TAGS from incoming dicom object. By trying to do it using dataStream my dicom files //are getting corrupted! //System.out.println("StudyInstanceUID: " + dataStream.readDataset().getString(Tag.StudyInstanceUID)); try { outStream.writeFileMetaInformation(fileMetaDcmObj); dataStream.copyTo(outStream); } finally { outStream.close(); } dicomFile.renameTo(new File(associationDir, dicomFileBaseName)); System.out.println("DICOM file name: " + dicomFile.getName()); } @Override public void associationAccepted(final AssociationAcceptEvent associationAcceptEvent) { .... @Override public void associationClosed(final AssociationCloseEvent associationCloseEvent) { ... } I would like somewhere between this code to intercept a metho…
tagged with: dicom
answer count: 1
type: UnansweredQuestion
tagged with: java
tagged with: dcm4che
has title: Read PDVInputStream dicomObject information on onCStoreRQ association request
type: Question
has answer: http://stackoverflow.com/a/27256822
score: 0

http://stackoverflow.com/q/27030566
tagged with: java
type: Question
tagged with: cloudera
tagged with: apache
answer count: 1
has answer: http://stackoverflow.com/a/27054596
score: 0
has body: ]# /etc/init.d/flume-master start Starting Flume master daemon (flume-master): starting master, logging to /var/log/flume/flume-flume-master-localhost.localdomain.log /usr/lib/flume/bin/flume: line 193: java: command not found /usr/lib/flume/bin/flume: line 271: exec: java not found When i execute flume-master and flume-node, that message is appeared. I just follow the menual in flume installation guide(http://www.cloudera.com/content/cloudera/en/documentation/archives/cdh3/v3u6/CDH3-Installation-Guide/cdh3ig_topic_10.html) I use jdk1.8.0_25 and set java on ~/.bashrc and /etc/profile. Please help me
accepted answer: http://stackoverflow.com/a/27054596
tagged with: flume
has title: Flume can not found java (java: command not found, exec: java: not found)
tagged with: cloudera-cdh
type: AnsweredQuestion

http://stackoverflow.com/comment/42951754
comment on: http://stackoverflow.com/a/27091151
score: 0
type: AnswerComment
type: Comment
has text: Your code now makes absolutely no sense with a file chooser and temp_image ? and using getFilesDir(). A complete mess.

http://stackoverflow.com/a/27102570
type: AcceptedAnswer
type: Answer
has body: Answering my own question. For second example public static boolean makePal(String input){ HashMap&lt;Character, Integer&gt; map = new HashMap&lt;&gt;(); int value =1, numberOfOddOccurence = 0; //find the number of occurrences for(int i=0; i&lt;input.length(); i++){ char key = input.charAt(i); if(!map.containsKey(key)){ map.put(key, value); }else{ map.put(key, map.get(key)+1); } } //find the number of char with odd counts for(Map.Entry&lt;Character, Integer&gt; a : map.entrySet()){ if(a.getValue()%2==1){ numberOfOddOccurence++; } } if(numberOfOddOccurence&gt;1) return false; else{ char [] charArray = new char[input.length()]; int cursor = 0; for(Map.Entry&lt;Character, Integer&gt; a : map.entrySet()){ if(a.getValue()%2==0){ charArray[cursor] = (char)(a.getKey()); charArray[input.length()-cursor-1] = (char)(a.getKey()); cursor++; }else{ charArray[(int) Math.ceil(input.length()/2)] = (char) (a.getKey()); } } System.out.println(String.valueOf(charArray)); } return true; }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27092858
accepted answer of: http://stackoverflow.com/q/27092858
upvote count: 1

http://stackoverflow.com/q/27144988
has comment: http://stackoverflow.com/comment/42785984
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42786387
type: Question
has body: when i connect Apollo MQ i am getting connection as true. but if i try to fetch messages from the queue i am getting message as null. my connection code is ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(uName, pass, asBroker); connection = factory.createConnection(); connection.start(); session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); brokerConnected = true; code for receiving message from queue public Syncable receive(String queue) throws ActiveSyncMQException { ObjectMessage message = null; Syncable syncPojo = null; try{ Destination destination = session.createQueue(queue); MessageConsumer consumer = session.createConsumer(destination); message = (ObjectMessage) consumer.receive(10000); syncPojo = (Syncable) message.getObject(); }catch(JMSException jmsEx){ throw new ActiveSyncMQException("JMS exception while receiving message from queue("+queue+")", jmsEx); } catch(Exception ex){ throw new ActiveSyncMQException("Exception while receiving message from queue("+queue+")", ex); } return syncPojo; }
has comment: http://stackoverflow.com/comment/42786472
has title: i can't take message from Apollo MQ.
score: 0

http://stackoverflow.com/q/27090034
accepted answer: http://stackoverflow.com/a/27091420
upvote count: 1
type: Question
has body: I am trying to check database for username availability. I don't know where it went wrong but it just keep saying "Checking availability" and never returns the answer. Below is my code. index.jsp; &lt;html&gt; &lt;head&gt; &lt;title&gt;Username Availability&lt;/title&gt; &lt;style type="text/css"&gt; .flable { color: gray; } .status { font-family: verdana; font-size: 12px; } .uname { color: blue; } &lt;/style&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js "&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $(".uname").change(function(){ var uname = $(this).val(); if(uname.length &gt;= 3){ $(".status").html("&lt;img src='images/loading.gif'&gt;&lt;font color=gray&gt; Checking availability...&lt;/font&gt;"); $.ajax({ type: "POST", url: "check", data: "uname="+ uname, success: function(msg){ $(".status").ajaxComplete(function(event, request, settings){ $(".status").html(msg); }); } }); } else{ $(".status").html("&lt;font color=red&gt;Username should be &lt;b&gt;3&lt;/b&gt; character long.&lt;/font&gt;"); } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;label class="flable"&gt;User Name :&lt;/label&gt; &lt;input type="text" class="uname" /&gt;&amp;nbsp;&lt;span class="status"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; CheckAvailibilty.java: import java.io.*; import java.sql.*; import javax.servlet.ServletException; import javax.servlet.http.*; public class CheckAvailability extends HttpServlet { private static final long serialVersionUID = -734503860925086969L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String connectionURL = "jdbc:mysql://localhost:3306/quora"; // students is my database name Connection connection = null; Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = …
has title: Ajax not working with JSP in username availability
tagged with: jquery
tagged with: servlets
answer count: 1
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/27091420
favorite count: 0
tagged with: ajax
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/27124263
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27123410
upvote count: 4
answers question: http://stackoverflow.com/q/27123410
downvote count: 0
score: 4
has body: Doing so solved my problem. Sorry for the newb question. Process myProcess = null;

http://stackoverflow.com/comment/42787595
type: QuestionComment
has text: I suppose that you want the two plugins to work independently from each other, right? If that is the case, you should make sure that both plugins can operate without the other, i.e. jar dependencies are declared independently for each plugin.
type: Comment
comment on: http://stackoverflow.com/q/27145960
score: 0

http://stackoverflow.com/comment/42784612
score: 0
type: AnswerComment
has text: Having a look at the source of `org.dbunit.database.DatabaseConnection`, it could also be a missing slf4j jar. dbunit uses slf4j for logging and tries to initialize the slf4j classes when the `DatabaseConnection` is initialized.
type: Comment
comment on: http://stackoverflow.com/a/27143983

http://stackoverflow.com/comment/42959820
has text: We should probably note that "thread in C++" is more complex in the first place: the language-level multithreading support only came about in C++11, and threads were previously provided by platform-specific libraries like POSIX pthreads and Windows threads. Java = one abstraction, many implementations; C++ = many abstractions, many implementations.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27241327
score: 1

http://stackoverflow.com/comment/42557512
score: 0
type: QuestionComment
has text: one more thing to add, exception is coming while I am starting deploying war in tomcat. Although war deployed successfully and there is no issue afterward regarding functionality so far. But I need to find the reason of this exception.
type: Comment
comment on: http://stackoverflow.com/q/27014942

class-variables
tag name: class-variables
tags question: http://stackoverflow.com/q/27060548
type: Tag

http://stackoverflow.com/comment/42585814
type: Comment
has text: Please post the entire exception, message, and stack trace, in your question; also the code you are now using.
comment on: http://stackoverflow.com/a/27030444
type: AnswerComment
score: 0

http://stackoverflow.com/q/27000555
has comment: http://stackoverflow.com/comment/42591428
has comment: http://stackoverflow.com/comment/42534095
has title: Joda-Time ignoring locale on en-US server
has comment: http://stackoverflow.com/comment/42533390
type: Question
tagged with: jodatime
has comment: http://stackoverflow.com/comment/42537671
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42539346
has comment: http://stackoverflow.com/comment/42532937
has answer: http://stackoverflow.com/a/27002964
has comment: http://stackoverflow.com/comment/42531513
has comment: http://stackoverflow.com/comment/42570982
has comment: http://stackoverflow.com/comment/42531370
favorite count: 0
has comment: http://stackoverflow.com/comment/42531334
has body: I'm using Joda-Time to convert my string dates to timestamp. In my pt-BR machine everything works fine. However, on an en-US server Joda ignores the custom locale. On my laptop (Windows 8 pt-BR): Locale.setDefault(new Locale("pt", "BR")); DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("dd-MMM-yy"); dateFormatter.parseLocalDate("13-Out-14").toDateTimeAtStartOfDay().getMillis(); This code runs flawlessly. The word for October in portuguese is Outubro. Locale.setDefault(new Locale("en", "US")); DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("dd-MMM-yy"); dateFormatter.parseLocalDate("13-Oct-14").toDateTimeAtStartOfDay().getMillis(); The code above works fine as well. The JVM recognizes the new locale and converts the date. However, when I try to run the first piece of code on a Windows Server 2012 en-US I get an exception. java.lang.IllegalArgumentException: Invalid format: "13-Out-14" is malformed at "Out-14" at org.joda.time.format.DateTimeFormatter.parseLocalDateTime(DateTimeFormatter.java:854) at org.joda.time.format.DateTimeFormatter.parseLocalDate(DateTimeFormatter.java:798) at br.com.luminiti.pro.service.DataUtil.dataStringToLong(DataUtil.java:155) And if I change Out to Oct it converts with no problem. So it seems the JVM is using the language of the machine itself. How to resolve this issue? Thanks!
accepted answer: http://stackoverflow.com/a/27002964
has comment: http://stackoverflow.com/comment/42531384
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42560244
has comment: http://stackoverflow.com/comment/42538402
has comment: http://stackoverflow.com/comment/42567273
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42531810

http://stackoverflow.com/comment/42658422
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27071656
has text: And once again you can't cast an object to something it is not. Ie, you cannot cast a List to a Set. If you think you should be able to, you don't adequately understand object-oriented programming.

http://stackoverflow.com/q/27089976
has comment: http://stackoverflow.com/comment/42687065
tagged with: java
linked to: http://stackoverflow.com/q/2845346
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27090039
has body: I'm currently learning computer science in high school and using "ReadyToProgram Java". We're trying make a pong game using basic shapes and classes etc. The way my game updates its view is to clear the whole screen and then redraw the paddle and pong in a while loop. It's flashes constantly! When I used Turing in the past grade, we had a command called view.update, where it runs the program off screen and only when you use view.update the program will update the screen. Is there something similar in java? Thanks!
has comment: http://stackoverflow.com/comment/42687000
type: UnansweredQuestion
has title: How do I run my java program off screen and update the view when I ask it to?

http://stackoverflow.com/q/27119727
answer count: 2
tagged with: encoding
has comment: http://stackoverflow.com/comment/42741001
tagged with: string
has body: I have a String with some special characters like this one. "45” £800 77” " - &gt; might also have some other special chars Note that above string its not double quotes. I want to display the String as it is, but for some reason its not processing and i am not able to proceed further. What is the best way to encode this ? I have tried the below : String out = null; try { out = new String(s.getBytes("UTF-8"), "ISO-8859-1"); } catch (java.io.UnsupportedEncodingException e) { return null; } return out; But it adds some special symbols to the specials chars. I am trying to add this string in paypal payment screen , where we display item name.
score: 0
has answer: http://stackoverflow.com/a/27119855
tagged with: android
has comment: http://stackoverflow.com/comment/42740874
tagged with: utf-8
has title: Encoding Special Characters in String
has comment: http://stackoverflow.com/comment/42836128
has comment: http://stackoverflow.com/comment/42740969
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27119792
has comment: http://stackoverflow.com/comment/42741038
tagged with: java
has comment: http://stackoverflow.com/comment/42740849
type: Question

fragmentpageradapter
tags question: http://stackoverflow.com/q/27037651
type: Tag
tag name: fragmentpageradapter
tags question: http://stackoverflow.com/q/27050099

http://stackoverflow.com/comment/42721826
type: QuestionComment
score: 0
has text: Minus Voter, please provide feedback.
type: Comment
comment on: http://stackoverflow.com/q/27109365

http://stackoverflow.com/a/27796448
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27028400
upvote count: 1
has body: You are right with the assumption that these parts are repetitive and therefore evitable. Netbeans shows you a way to realize it when you use the wizard to create JSF Pages form Entity Classes. The result looks like this: AbstractFacade.java: public abstract class AbstractFacade&lt;T&gt; { private final Class&lt;T&gt; entityClass; public AbstractFacade(Class&lt;T&gt; entityClass) { this.entityClass = entityClass; } protected abstract EntityManager getEntityManager(); public void create(T entity) { getEntityManager().persist(entity); } public T edit(T entity) { return getEntityManager().merge(entity); } public void remove(T entity) { getEntityManager().remove(getEntityManager().merge(entity)); } // some more find helper methods ... } ConcreteEntityFacade.java: public class ConcreteEntityFacade extends AbstractFacade&lt;ConcreteEntity&gt; { @PersistenceContext private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public ConcreteEntityFacade() { super(ConcreteEntity.class); } } I hope that helps.

http://stackoverflow.com/q/27106107
has comment: http://stackoverflow.com/comment/42715672
possible better answer: http://stackoverflow.com/a/27106159
has answer: http://stackoverflow.com/a/27106159
type: Question
has answer: http://stackoverflow.com/a/27106146
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/42715486
has body: In my Java Project, i want to read values from txt file to List method.Values seems like; 1 kjhjhhkj 788 4 klkkld3 732 89 jksdsdsd 23 Number of row changable. I have tried this codes and getting same values in all indexes. What can i do? String[] dizi = new String[3]; List&lt;String[]&gt; listOfLists = new ArrayList&lt;String[]&gt;(); File f = new File("input.txt"); try { Scanner s = new Scanner(f); while (s.hasNextLine()) { int i = 0; while (s.hasNext() &amp;&amp; i &lt; 3) { dizi[i] = s.next(); i++; } listOfLists.add(dizi); } } catch (FileNotFoundException e) { System.out.println("Dosyaya ba?lanmaya çal???l?rken hata olu?tu"); } int q = listOfLists.size(); for (int z = 0; z &lt; q; z++) { for (int k = 0; k &lt; 3; k++) { System.out.print(listOfLists.get(z)[k] + " "); } }
accepted answer: http://stackoverflow.com/a/27106146
tagged with: arraylist
type: AnsweredQuestion
has title: List<String[]> method Adding always same values

postman
tags question: http://stackoverflow.com/q/27123044
tags question: http://stackoverflow.com/q/27001382
tag name: postman
type: Tag

http://stackoverflow.com/q/27132824
has comment: http://stackoverflow.com/comment/42764892
has title: Android change order of cursor
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27133177
linked to: http://stackoverflow.com/q/3695224
has comment: http://stackoverflow.com/comment/42764695
has comment: http://stackoverflow.com/comment/42764355
has body: I googled a lot but didn't find any answer to my problem: I got a Cursor that queries a table that contains a latitude and a longitude. I want to order a ListView by the distance to the user. The second answer in here showed me how to order by distance. But now let's say the user moves and the second item is now more near than the first one. How can I reorder my list now? Not sure if i could provide any code that would be helpful, because it's more or less a generic question. thanks alot
tagged with: java
linked to: http://stackoverflow.com/q/14503006
type: Question
has comment: http://stackoverflow.com/comment/42764880
tagged with: location
has comment: http://stackoverflow.com/comment/42766104
has comment: http://stackoverflow.com/comment/42764621
has comment: http://stackoverflow.com/comment/42765076
score: 0
has comment: http://stackoverflow.com/comment/42764639
tagged with: sqlite
answer count: 1
linked to: http://stackoverflow.com/q/3669325
has comment: http://stackoverflow.com/comment/42764501

http://stackoverflow.com/comment/42522580
comment on: http://stackoverflow.com/q/26996018
score: 0
has text: "a hash function is used to generate a unique key for every item in the array" - not usually... normally you need to deal with hash collisions. (It's unclear to me why you're reinventing the wheel here to start with... is it just to understand hash tables better?)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42770881
has text: I was under the impression that Eclipse came with its own Java compiler, so there shouldn't be a problem with some other compiler failing to generate debug information (or being told not to generate it). At least I'd think ... If you get Eclipse to rebuild the source, would it then be able to find line number info?
score: 0
comment on: http://stackoverflow.com/q/27135033
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42667871
type: Comment
type: AnswerComment
has text: Currently Bndtools only works with Eclipse unfortunately. There is work being done to port this to Intellij however (by Intellij): https://youtrack.jetbrains.com/issue/IDEA-100812
comment on: http://stackoverflow.com/a/27075601
score: 0

http://stackoverflow.com/comment/42538132
type: Comment
type: QuestionComment
score: 2
has text: Yes, use a regular expression.
comment on: http://stackoverflow.com/q/27004391

http://stackoverflow.com/comment/42721723
type: AnswerComment
has text: @TonyD I like "linked to", we'll go with that :)
type: Comment
comment on: http://stackoverflow.com/a/27108869
score: 0

http://stackoverflow.com/comment/42582309
score: 0
type: QuestionComment
type: Comment
has text: What makes you think that Tiles can be configured without a tiles definition file somewhere?
comment on: http://stackoverflow.com/q/27027468

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/27011874
tag name: httpsurlconnection
tags question: http://stackoverflow.com/q/27075678

http://stackoverflow.com/a/55524593
answers question: http://stackoverflow.com/q/27099448
has body: Not the prettiest solution but what worked for me which also includes some debug was: String pathToJSF = FacesContext.getCurrentInstance().getExternalContext().getRealPath("/"); System.out.println("Real Path is: " + pathToJSF); String fileSeparator = File.separator; System.out.println("JBoss log directory is: " + pathToJSF.substring(0, pathToJSF.indexOf("standalone" + fileSeparator) + ("standalone" + fileSeparator).length()) + "log" + fileSeparator); String jbossLogFile = pathToJSF.substring(0, pathToJSF.indexOf("standalone" + fileSeparator) + ("standalone" + fileSeparator).length()) + "log" + fileSeparator + "server.log"; This worked on windows with the following debug output: Real Path is: C:\jboss-eap-7.1.0_non_community\jboss-eap-7.1\standalone\deployments\My.ear\My.war JBoss log directory is: C:\jboss-eap-7.1.0_non_community\jboss-eap-7.1\standalone\log\ Also of note, this only works with JBoss EAP 6 or greater as I'm specifying/looking for "standalone" which didn't exist in previous JBoss versions. This may not be good to do it this way, but I did have a need to grab the servers log file and make it available and included in a downloadable zip file Now reading the file and displaying it in the JSF page I leave up to you as I'm pretty sure you know how to do that! This was also tested on linux
score: 0
type: Answer

http://stackoverflow.com/comment/42792684
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27148817
has text: Why are you catching the exception that you just throw and doing nothing with it?
score: 0

http://stackoverflow.com/q/27121232
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: ejb
tagged with: jpa
has answer: http://stackoverflow.com/a/27125349
score: 0
has body: Could anyone help me? There is a SessionScoped Managed Bean and one Stateless Ejb and one other Stateful Ejb.. The serachCustomer() method in the MB call the injected DaoEjbTst searcCustomer() method which return with an instance of BCus entity object. I injected in to Stateless DaoEjbTst Ejb the other Stateful CustomerSession EJB and when the entity instance is ready in the DaoEjbTst EJB i call the CustomerSession EJB setActualCustomer method and i give as paramter the entity instance for this method and try to store it... Then when i try to get this "stored" entity instance with another showTstDate() method in the ManagedBean it's throws NullPointer Exception.. And i dont know why.. Why doesn't exist the public BCus actualCustomer paramter in the stateful ejb? I tryed to create @PreDestroy and @PrePassivate and @Remove methods in the Stateful Ejb to check if the container remove it but this methods never invoked by the container.. So i'm sure the ejb exist.. but inspite of this i can't access it :( I don't use interfaces. Here is my managedbean: @EJB private DaoEjbTst daoEjb; @EJB private CustomerSession customerSession; public void serachCustomer() throws IOException { FacesContext ctx = FacesContext.getCurrentInstance(); if (daoEjb.searcCustomer(custNo)) { ctx.getExternalContext().redirect("showCustomer.xhtml"); } else { ctx.getExternalContext().redirect("test.xhtml"); } } public String showTstDate() { log.info("MB EJB EXIST: " + customerSession); return "Test: " + customerSession.getActualCustomer().getCustName(); } Here is my DaoEjbTst: @Stateless public class DaoEjbTst { private final Logger log = Logger.getLogger("DaoEjbTst.class"); @EJB private CustomerSession customerSession; public CustomerSession getCustomerSession() { return customerSession; } public void setCustomerSession(CustomerSession customerSession) { this.customerSession = customerSession; } @PersistenceContext(unitName = "TestAppPU") private EntityManager em; public boolean searcCustomer(String…
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42745403
has title: Statefull Ejb and Session scoped Managed bean Inject null pointer

http://stackoverflow.com/comment/42642381
type: Comment
type: QuestionComment
has text: made a workaround like this : 'for(Object i : privPickList.getTarget()) { tempSelectedPrivilges.add(Integer.parseInt(i.toString())); }'
score: 0
comment on: http://stackoverflow.com/q/27056292

http://stackoverflow.com/comment/42666605
type: Comment
comment on: http://stackoverflow.com/a/27077847
has text: @owlstead Thank you, I didn't know how to implement the cloneMap fn only ;)
score: 0
type: AnswerComment

http://stackoverflow.com/q/27053149
tagged with: swing
has comment: http://stackoverflow.com/comment/42623290
tagged with: java
has comment: http://stackoverflow.com/comment/42623296
has comment: http://stackoverflow.com/comment/42623802
linked to: http://stackoverflow.com/q/7441625
type: Question
has title: Simple Java Calculator using GU
has comment: http://stackoverflow.com/comment/42623867
tagged with: user-interface
duplicate of: http://stackoverflow.com/q/5769669
score: 0
has body: I'm trying to make a Simple Java Calculator. Right now I am stuck on how to convert the string that is entered by the user on the calculator to a double so that the operation can execute in the equals part of the program. InFixPostOut is supposed to be used as well. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.regex.Pattern; import java.util.regex.Matcher; class Calculator2 extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; JButton btn1 = new JButton("1"); JButton btn2 = new JButton("2"); JButton btn3 = new JButton("3"); JButton btn_add = new JButton("+"); JButton btn4 = new JButton("4"); JButton btn5 = new JButton("5"); JButton btn6 = new JButton("6"); JButton btn_sub = new JButton("-"); JButton btn7 = new JButton("7"); JButton btn8 = new JButton("8"); JButton btn9 = new JButton("9"); JButton btn_mult = new JButton("*"); JButton btn0 = new JButton("0"); JButton btn_dot = new JButton("."); JButton btn_del = new JButton("DEL"); JButton btn_div = new JButton("/"); JButton btn_lpr = new JButton("("); JButton btn_rpr = new JButton(")"); JButton btn_pow = new JButton("^"); JButton btn_equ = new JButton("="); JTextArea txt = new JTextArea(); String str_number = ""; public Calculator2() { JFrame frame = new JFrame("Simple Java Caculator"); frame.setSize(320,420); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setVisible(true); frame.setLayout(new GridLayout(2,1)); JPanel HeadPanel = new JPanel(); JPanel NumberPanel = new JPanel(); JPanel LabelPanel = new JPanel(); LabelPanel.setBackground(Color.LIGHT_GRAY); HeadPanel.setBackground(Color.LIGHT_GRAY); NumberPanel.setLayout(new GridLayout(5,4)); //LabelPanel.setLayout(new BorderLayout()); LabelPanel.setLayout(new GridLayout(1,1)); NumberPanel.add(btn1); btn1.addActionListener(this); NumberPanel.add(btn2); btn2.addActionListener(this); NumberPanel.add(btn3); btn3.addActionListener(this); NumberPanel.add(btn_ad…
answer count: 0
has comment: http://stackoverflow.com/comment/42623356
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5769669

http://stackoverflow.com/comment/42828188
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27164221
type: Comment
has text: whatever rpc you use, you meet the problem of "saturation of the server", but pay attention to the question "Rejecting requests when saturation is reached", if 1-billion client request coming to a RMI server in a second, you say there's no way but let the server hold all of the connections, I say there's a way to reject many of them, that's all my answer. your comment exhibit zero comprehension of the question.

http://stackoverflow.com/a/27766429
answers question: http://stackoverflow.com/q/27075678
downvote count: 0
has body: I used this solution, maybe it can help you: First you need an extension class of SSLSocketFactory to attach a HandshakeCompletedListener to the sockets created by the SSLSocketFactory: (inspired by How to override the cipherlist sent to the server by Android when using HttpsURLConnection?) public class SecureSSLSocketFactory extends SSLSocketFactory { private final SSLSocketFactory delegate; private HandshakeCompletedListener handshakeListener; public SecureSSLSocketFactory( SSLSocketFactory delegate, HandshakeCompletedListener handshakeListener) { this.delegate = delegate; this.handshakeListener = handshakeListener; } @Override public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { SSLSocket socket = (SSLSocket) this.delegate.createSocket(s, host, port, autoClose); if (null != this.handshakeListener) { socket.addHandshakeCompletedListener(this.handshakeListener); } return socket; } // and so on for all the other createSocket methods of SSLSocketFactory. @Override public String[] getDefaultCipherSuites() { // TODO: or your own preferences return this.delegate.getDefaultCipherSuites(); } @Override public String[] getSupportedCipherSuites() { // TODO: or your own preferences return this.delegate.getSupportedCipherSuites(); } Then you need an implementation of the HandshakeCompletedListener interface. You must implement the handshakeCompleted method: public class MyHandshakeCompletedListener implements HandshakeCompletedListener { @Override public void handshakeCompleted(HandshakeCompletedEvent event) { SSLSession session = event.getSession(); String protocol = session.getProtocol(); String cipherSuite = session.getCipherSuite(); String peerName = null; try { peerName = session.getPeerPrincipal().getName(); } catch (SSLPeerUnverifiedException e) { } } In handshakeCompleted you can get the protocol version (maybe TLSv1.2), and by the way also the information on cipher suite etc., that is also accessible via HttpsConnection. …
type: Answer
score: 11
upvote count: 11

http://stackoverflow.com/comment/42526920
score: 0
has text: I'm almost sure Java EE isn't called J2EE anymore since Java EE 5
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26996651

http://stackoverflow.com/comment/101349588
type: Comment
type: AnswerComment
has text: This worked for me as well (thanks so much!). I came across this thread as well (https://community.yellowfinbi.com/topic/yf-authentication-error-error-code-25-from-net-code) but the solution around the serialization was unclear and after much tinkering this comment was the solution for me in C#.
comment on: http://stackoverflow.com/a/32903107
score: 0

http://stackoverflow.com/q/27121283
upvote count: 1
type: Question
tagged with: arrays
has title: How to print shortest String from ArrayList (Java)
has answer: http://stackoverflow.com/a/78961351
has body: Ok so the goal is to print the smallest length string ( for example, if input is "co", "college", "colleges", "university" I want it to print out co. I've tried the college.compareTo( ____ ); as well as a couple other things but I can't seem to get it to print it out. Also it isn't anything fancy (if you've read/have head first java 2nd edition then we are on chapters 5/6) I'd rather if you can link me to a video that will show the process of what needs to be done with an explanation but anything is helpful :s been staring at this coding for a couple weeks and kinda went brain dead on it... This is what I have so far (accepts strings from user); ArrayList &lt;String&gt; colleges = new ArrayList &lt;String&gt; ( ) ; String input; Scanner scan = new Scanner(System.in) ; while (true) { System.out.println("Please enter your college (Press Enter twice to quit) "); input = scan.nextLine(); if (input.equals ("")) { break; } else { colleges.add(input.toUpperCase () ); }// end of if else statement }// end of while loop System.out.println("The following " + colleges.size() + " colleges have been entered:"); for ( String college : colleges) { System.out.println("\n" + college ); System.out.println("Character count: " + college.length( ) ); }// end of for each loop
tagged with: arraylist
downvote count: 0
tagged with: string
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27121391
answer count: 4
has answer: http://stackoverflow.com/a/27121409
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27124376

http://stackoverflow.com/comment/42764431
has text: @TJamesBoone God bless your soul, it works perfectly, i didn not know that i can locate using strings and then parse into integer .. that's too acvanced for me , but it works!
comment on: http://stackoverflow.com/q/27130534
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27059412
type: Answer
has body: There are several ways to skip the first element of the iterator. For example : boolean first = true; for(Iterator &lt;Vertex&gt; it = adjList[i].iterator(); it.hasNext();) { if (first) { // skip first it.next(); first = false; } else { // handle the rest } }
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27059350

http://stackoverflow.com/a/26998283
accepted answer of: http://stackoverflow.com/q/26997008
type: Answer
answers question: http://stackoverflow.com/q/26997008
has body: As José points out in his answer, if you are setting a graphic in your cell, you (probably) need to apply the css style class to the graphic (depending on what that graphic is). If you are simply calling setText(...) your code should work. The reason that a Label set as the graphic doesn't inherit -fx-text-fill from the table cell is that the Label also has a setting for -fx-text-fill. In the default stylesheet, both TableCell and Label have this set as follows: -fx-text-fill: -fx-text-background-color ; fx-text-background-color is a looked-up color that is defined as a ladder, as follows: -fx-text-background-color: ladder( -fx-background, -fx-light-text-color 45%, -fx-dark-text-color 46%, -fx-dark-text-color 59%, -fx-mid-text-color 60% ); This (fairly complex) setting means that the value of -fx-text-background-color depends on the value of -fx-background. If -fx-background is less than 45% of maximum intensity (i.e. it's dark), the value of -fx-text-background-color is set to -fx-light-text-color. If -fx-background is between 46% and 59% intensity, the value is equal to -fx-drak-text-color. If it is 60% or more, it's set to -fx-mid-text-color. The idea here is that the text color will automatically adjust to the background to remain visible. The values of -fx-dark-text-color, -fx-mid-text-color, and -fx-light-text-color are set to black, a dark gray (#333), and white, respectively. Since Label does not override the value of -fx-text-background-color, you can achieve what you need by just changing the value of that for your table cell: .styleImportant { -fx-text-background-color: red ; } Now this overrides the looked-up color value for the table cell, and since the graphic inside the cell doesn't override that value itself, it inherits it from the cell. A more sophisticated way to do this is to redefine the -fx-[light|mid|dark]-text-colors. The advantage of this is that the colors will adjust appropriately if you change the background: in particular if the cell is …
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/42567443
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42719669
downvote count: 0

http://stackoverflow.com/q/27140183
type: Question
has answer: http://stackoverflow.com/a/27140249
has title: JDBC claims table does not exist
has comment: http://stackoverflow.com/comment/42778112
has comment: http://stackoverflow.com/comment/42784725
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc
has body: I am using the embedded h2 database inside of the play framework. I am trying to insert some test data into it, then retrieve that data. as you can see, the right side shows me that there is indeed a suscribers table, but when being run, I get this: What am I doing wrong?
has comment: http://stackoverflow.com/comment/42778201
has comment: http://stackoverflow.com/comment/42778122
score: 1
tagged with: java
tagged with: h2
upvote count: 1
has comment: http://stackoverflow.com/comment/42778030

http://stackoverflow.com/comment/42710237
type: QuestionComment
comment on: http://stackoverflow.com/q/27103143
score: 0
type: Comment
has text: Define this method at parent level either BaseActivity or BaseFragmentActivity.

http://stackoverflow.com/q/26995104
has comment: http://stackoverflow.com/comment/42521055
type: Question
answer count: 2
score: 5
favorite count: 0
has comment: http://stackoverflow.com/comment/42520906
has title: Circles drawn mainly in X an Y axises, WHY?
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/26997838
has body: I have created a loop using processing that draws circles, the overall shape should be a circle. However they are mainly drawn close to X and Y axis. I have randomized the angle for the calculus of its location, I cannot see where the problem is. Code as follows: for (int omega = 0; omega&lt;1080; omega++){ //loop for circle creation radius = (int)random(80); //random radius for each circle int color1= (int)random(100); //little variation of color for each circle int color2= (int)random(100); int locationY = (int)(sin(radians(omega))*random(width/2+1)); //location calcualtion int locationX = (int)(cos(radians(omega))*random(width/2+1)); fill(0,color1+200,color2+200,50); ellipse(locationX,locationY,radius,radius); //draw circles }
tagged with: processing
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26997838
has answer: http://stackoverflow.com/a/27000751
accepted answer: http://stackoverflow.com/a/27000751
tagged with: math
tagged with: java

http://stackoverflow.com/a/27019927
has body: You are replacing value of array in each iteration i by 9 (1,3,5,7,9 respectively) Try Below for(int i=0; i&lt;5; ){ for(int j=1; j &lt;= 10; j=j+2,i++){ element[i] = j; } } You can also write this in one for loop for(int j=1,i=0 ; j &lt;= 10 &amp;&amp; i&lt;5; j=j+2,i++){ element[i] = j; } Output
upvote count: 1
has comment: http://stackoverflow.com/comment/42564593
downvote count: 0
answers question: http://stackoverflow.com/q/27019748
type: Answer
score: 1

http://stackoverflow.com/q/27018826
score: 0
answer count: 1
tagged with: applet
has body: I have faced interesting issue where my signed Java applet is unable to run process via ProcessBuilder only under Windows 7 32bit. I've tested applet on Windows 7 64 bit, Windows Vista 32bit and Windows 8 32/64 bits with Java 7 and Java 8 and it was working flawlessly. Problem seems to be that the application which I'm trying to run from my applet needs higher permissions which Java cannot provide. So what I'm looking to hear is there any workaround (registry patch or something) in order to provide needed security rights for Java? Tested solutions: Applet manifest modified with added line: Permissions: all-permissions; Run as Administrator IE, Mozilla browsers; Modified c:\Program Files\Java\jre7\lib\security\java.policy with line: permission java.security.AllPermission;
tagged with: windows
tagged with: processbuilder
type: UnansweredQuestion
has title: Processbuider do not execute application only in windows 7 32bit
has answer: http://stackoverflow.com/a/27060462
tagged with: java
type: Question

http://stackoverflow.com/a/27035409
answers question: http://stackoverflow.com/q/26999113
has body: This problem seems to be reported here (Though I'm using a different version of Mule): http://www.mirthcorp.com/community/issues/i#browse/MIRTH-1990 Finally, I solved it replacing fileAge by sizeCheckWaitTime.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26999113
score: 1

http://stackoverflow.com/comment/42596972
has text: i am not getting it sir..can you please change my code or else..?Thank you for replying me as fast as possible.!
score: 0
comment on: http://stackoverflow.com/q/27038685
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26993203
has body: I tried to do it with Gson, but you do not have to run the code to see that it does not make much sense: final Map&lt;List&lt;Double&gt;, List&lt;Double&gt;&gt; map = new Gson().fromJson("{[111,222]=[333,444], [555,666]=[777,000]}", Map.class); I get a MalformedJsonException. Has anybody an idea how to do this without having to create a custom class? It must not be Json-related, also other approaches are welcome. And it has not to be a map, it can be a list of pairs, anyway I will never search using a list as a key, I will just iterate over it. I am looking forward to reading your fresher ideas :)
possible better answer: http://stackoverflow.com/a/26993383
type: Question
has comment: http://stackoverflow.com/comment/42522727
has answer: http://stackoverflow.com/a/26999495
has comment: http://stackoverflow.com/comment/42517433
answer count: 2
tagged with: serialization
has comment: http://stackoverflow.com/comment/42528100
accepted answer: http://stackoverflow.com/a/26999495
tagged with: dictionary
has answer: http://stackoverflow.com/a/26993383
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42528015
score: 0
has title: Transform Map<List<Long>,List<Long>> to String and Back
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/42689515
has text: @mastov yup, I deleted them. Only left yours so you would get the notice of my reply.
type: Comment
comment on: http://stackoverflow.com/q/27034711
score: 0
type: QuestionComment

http://stackoverflow.com/a/27138812
answers question: http://stackoverflow.com/q/27138175
upvote count: 3
score: 3
downvote count: 0
type: Answer
has body: max_user_connections is a server setting in my.ini: see here. It has nothing to do with the connection pool, Java, etc.

http://stackoverflow.com/q/27025141
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/42573773
has body: Lets say I have the classes DrugAmount: package core; public abstract class DrugAmount { boolean drugInMg = false; boolean drugInMl = false; double numberofAmpoules = 0.0; double ampoulesInML = 0.0; double ampoulesInMG = 0.0; public DrugAmount() { } public DrugAmount(int numberOfAmpoules) { setNumberofAmpoules(numberOfAmpoules); } // SETTER: private void setNumberofAmpoules(int numberOfAmpoules) { this.numberofAmpoules = numberOfAmpoules; } // GETTER: public double getNumberOfAmpoules() { return numberofAmpoules; } public double getAmpoulesInML() { return ampoulesInML; } public double getAmpoulesInMG() { return ampoulesInMG; } public boolean isDrugInMl() { return drugInMl; } public boolean isDrugInMg() { return drugInMg; } } And the classes DrugAmountMg: package core; public class DrugAmountMg extends DrugAmount { public DrugAmountMg(double drugAmount) { super(); setDrugInMg(); setAmpoulesMG(drugAmount); setNumberOfAmpoules(); turnDrugFromMgToMl(); } public DrugAmountMg(int drugAmount) { super(drugAmount); setDrugInMg(); setAmpoulesMG(); turnDrugFromMgToMl(); } private void setNumberOfAmpoules() { numberofAmpoules = ((1 / Ampoule.AMOUNT_OF_ONE_AMPOULE_IN_MG) * getAmpoulesInMG()); } private void setAmpoulesMG() { ampoulesInMG=(Ampoule.AMOUNT_OF_ONE_AMPOULE_IN_MG*getNumberOfAmpoules()); } private void setAmpoulesMG(double drugAmount) { ampoulesInMG=drugAmount; } private void turnDrugFromMgToMl() { if (isDrugInMg()) { ampoulesInML=(Ampoule.AMOUNT_OF_ONE_AMPOULE_IN_ML / Ampoule.AMOUNT_OF_ONE_AMPOULE_IN_MG) * getAmpoulesInMG(); } } private void setDrugInMg() { drugInMg = true; } } Like you can see there are "package private" object variables in the class DrugAmount - is this good java practice? Or should I modify them to private and declare new object variables in the child class DrugAmountMg and assign them the value of the DrugAmount-variables by getter-methods?
tagged with: class
score: 0
answer count: 1
tagged with: variables
has title: Designing correctly Java Classes
tagged with: private
has answer: http://stackoverflow.com/a/27026167
has comment: http://stackoverflow.com/comment/42578792
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27026167

http://stackoverflow.com/q/26995374
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26995455
score: 1
tagged with: java
tagged with: loops
upvote count: 1
has body: public class Valtiotesti { public static void main(String[] args) { Scanner lukija = new Scanner(System.in); String nimi, pääkaupunki; int asukasluku; ArrayList&lt;Valtio&gt; valtiot = new ArrayList&lt;Valtio&gt;(); do{ System.out.println("Anna valtion nimi: "); nimi = lukija.nextLine(); if(nimi.length()&gt;0){ System.out.println("Anna ko. valtion pääkaupunki: "); pääkaupunki = lukija.nextLine(); System.out.println("Anna ko. valtion asukasluku: "); asukasluku = lukija.nextInt(); Valtio valtio = new Valtio(nimi, pääkaupunki, asukasluku); valtiot.add(valtio); } } while(nimi.length()&gt;0); } } I have this problem with my code: I want to read countries into ArrayList containing country's name (nimi), capital (pääkaupunki), and population (asukasluku), until the user enters empty string as name of the country (just presses enter). However when the code enters next round, netbeans just prints out the question: "Anna valtion nimi: " (give country's name), and finishes the program (BUILD SUCCESSFUL), WITHOUT giving the chance to enter new Country...
type: Question
tagged with: do-while
accepted answer: http://stackoverflow.com/a/26995455
answer count: 1
has title: Do-while loop issue
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42746784
comment on: http://stackoverflow.com/a/27119884
type: AnswerComment
score: 0
type: Comment
has text: You mean, iterating over every key of the `thumbCache` map and invoke `recycle` method?

http://stackoverflow.com/comment/42583421
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27030565
has text: So you want some way easier than the method idea? I don't quite get what you're saying
score: 0

http://stackoverflow.com/comment/42672489
type: Comment
comment on: http://stackoverflow.com/a/27081476
has text: @Johntroen Your input string certainly looks like XML. Does it allow character entities? What if the text between ` ` and ` ` has a `<` character in it?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42738410
comment on: http://stackoverflow.com/q/27118183
has text: I'm trying to learn this on my own - it isn't for school or anything. But yes, you have a point. My attempt was the normal for-loop, but I couldn't shift it over as I just learned how to use Arrays.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42611921
comment on: http://stackoverflow.com/a/27036926
type: AnswerComment
score: 0
type: Comment
has text: @mKorbel My predecessor liked keeping copious amounts of data in multiple dimensional arrays...no, storage of complex data in arrays is never a good idea, they are to difficult to manage and maintain

http://stackoverflow.com/a/27121576
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27121469
has body: Couldn't read row 0, col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it
type: Answer

http://stackoverflow.com/comment/42729763
has text: In main method parse your incoming String and do a push of each char. Then do a pop till your stack is empty. Make sure your popped chars are appended to each other. That's all
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27113470

http://stackoverflow.com/q/27144930
tagged with: java
tagged with: bpmn
score: 0
answer count: 1
has title: Camunda BPMN - accessing variables inside a thread
tagged with: camunda
tagged with: spring
has body: In a Camunda process flow, I'm trying to access variables that are created inside a RabbitMQ onMessage thread ... In short, I have a RabbitMQ consumer listening to a queue, once a message is published to the queue, onMessage is executed and inside this onMessage I start the BPMN process. @Component("MyProcessor") public class MyProcessor implements ChannelAwareMessageListener { public final void onMessage(Message message, Channel channel){ // create some variables based on the message .... // do some database lookups based on the message .... // enrich message based on some other factors .... SomeService service = new SomeService(message); if (service.isThisOrThatEnabled()){ System.out.println("Yes, it's enabled"); } .... runtimeService.startProcessInstanceByKey("ABC"); .... } } So based on the incoming message, I set certain variables with a scope that doesn't go outside onMessage. When I call a service task or use an expression inside a service task in Camunda: ${MyProcessor.isThisOrThatEnabled() == true} This will obviously call the singleton annotated with @Component and have no access to the actual message in onMessage. If MyProcessor.isThisOrThatEnabled wraps service.isThisOrThatEnabled, I'll probably get a null pointer exception as service is not initialized when the Singleton is created, only inside the onMessage thread. So to sum up my question, how do I access variables in BPMN that are inside a thread ... 1: If singletons are the wrong way to access variables in a thread, how else should I be accessing them? Is it possible to inject that SomeService instance into the BPMN flow? 2: If service tasks are the wrong component to be using to access these variables, which component should I be using instead?
accepted answer: http://stackoverflow.com/a/27145609
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/27145609

http://stackoverflow.com/a/27098608
accepted answer of: http://stackoverflow.com/q/27098303
type: Answer
score: 1
has body: What you're suggesting is fine-grained parallelism, which can cause problems because of the memory hierarchy - if two threads are operating on alternating indices of the same array/matrix then they're going to have to essentially write directly to main memory (e.g. by flushing their caches after every operation) which is probably going to cause your multi-threaded program to run considerably slower than your single-threaded program. As much as possible, try to have your threads write to completely different segments of memory, e.g. entirely different arrays/matrices or at least different sections of the same array/matrix (e.g. thread1 writes to the first half of an array while thread2 writes to the second half - hopefully their array segments will be on different cache lines and they won't need to write to main memory to maintain coherency); if your threads are operating on the same memory segments then try to have them do so at different times, so that they can calculate their intermediate results in cache prior to flushing their final results to main memory. So in your case, are method1, method2, and method3 independent of each other? If so then use a different thread for each method. If they're not independent, e.g. method1 must precede method2 must precede method3, then you could use a pipeline approach: Thread1 executes method1 on the first N elements of the matrix, then Thread2 executes method2 on the first N elements of the matrix while Thread1 executes method1 on the second N elements of the matrix, then Thread3 executes method3 on the first N elements of the matrix while Thread2 executes method2 on the second N elements of the matrix while Thread1 executes method1 on the first N elements of the matrix, and so on until all matrix elements have been processed. If your threads need to talk to each other (e.g. to pass around matrix segments for pipelining) then I prefer to use something like a BlockingQueue: Method1 and Method2 would share a queue, with Method1…
answers question: http://stackoverflow.com/q/27098303
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42597149
has text: @GangadharB Why do you expect 111 and/or 222 to be in the output ? For me, the "duplicate" of 111 would be 111111, not 222.
comment on: http://stackoverflow.com/a/27038585
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27060994
tagged with: java
score: -4
type: Question
tagged with: arraylist
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/27061160
has title: synchronizing ArrayList and wait
answer count: 1
has comment: http://stackoverflow.com/comment/42637737
favorite count: 0
has comment: http://stackoverflow.com/comment/42640483
has comment: http://stackoverflow.com/comment/42636329
has body: I'm synchronizing ArrayList used by 2 threads. notify and wait pattern. the thread notified but the arrayList contain the old values Although the other thread prints new values. Th1: synchronized( pairsBarBuffers ) { try { pairsBarBuffers.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Th2: synchronized (pairs15MBarBuffers) { if( countSamples == 0 ){ return; } updateBarBuffer( pairs15MBarBuffers , countSamples ); pairs15MBarBuffers.notify(); countSamples = 0; }
tagged with: multithreading
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27061160

http://stackoverflow.com/comment/42689496
comment on: http://stackoverflow.com/a/27090993
has text: From your explanation, is it correct if I don't know the number of instances from class C...e.g. in situations where it depends on user input(and I never declare earlier in the attribute section of the code like you have shown)...does it mean I should use the dotted line version??
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42960025
has text: Can you please try your suggestion and say. Let me try.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27228501

http://stackoverflow.com/comment/42689058
comment on: http://stackoverflow.com/q/27090959
type: Comment
type: QuestionComment
score: 1
has text: *"FirstPanel and SecondPanel wich extends JPanel"* It is likely neither of those should extend `JPanel`. Instead they should just be instances of panel. Making them a separate class has caused this difficulty, and though it is possible to correct it while they are still extending panel, it makes little sense to do so.

http://stackoverflow.com/a/27135678
upvote count: 1
has body: Since you have found 'true' you must break the execution. for (int i = 0; i &lt; x.Length; i++) { if (x[i].Equals(s)) { b = true; break; } else { b = false; } }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27135542
answers question: http://stackoverflow.com/q/27135542
type: AcceptedAnswer
type: Answer
score: 1

http://stackoverflow.com/comment/42729163
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27113154
type: Comment
has text: You're reading and writing cocurrently to a HashMap, that is not thread-safe.

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/27025610
type: Tag
tags question: http://stackoverflow.com/q/27059587
tags question: http://stackoverflow.com/q/27131049
tags question: http://stackoverflow.com/q/27070108
tags question: http://stackoverflow.com/q/27009373
tags question: http://stackoverflow.com/q/27133351
tags question: http://stackoverflow.com/q/27086255
tags question: http://stackoverflow.com/q/27053117
tags question: http://stackoverflow.com/q/27106907
tags question: http://stackoverflow.com/q/27037364
tags question: http://stackoverflow.com/q/27064383

http://stackoverflow.com/comment/42652624
type: AnswerComment
type: Comment
score: 0
has text: so how to use it alone?
comment on: http://stackoverflow.com/a/27067488

http://stackoverflow.com/a/27127896
upvote count: 1
answers question: http://stackoverflow.com/q/27119768
score: 1
downvote count: 0
has body: The is a simple (but not efficient) way of doing it without conversion to string. You can perform insertion sort on digits by extracting them from number using modulo and division, comparing them, and swapping if needed. There will be at most 9*8 comparsions need. Here is code in C++ int sortDigits(int number) { for(int j = 0; j &lt; 9; ++j) //because number can have 9+1 digits (we don't need 10 because digits are sorted in pairs) { int mul = 1; for(int i = 0; i &lt; 8; ++i) //because with i == 7 mul * 10 is biggest number fitting in int (will extract last digit) { if (mul * 10 &gt; number) break; //by doing that we ensure there will be no zeroes added to number int digitRight = number / mul % 10; int digitLeft = number / (mul * 10) % 10; if(digitRight &gt; digitLeft) //swapping digits { /* number -= digitLeft * mul * 10; number += digitLeft * mul; number -= digitRight * mul; number += digitRight * mul * 10; */ number -= digitLeft * mul * 9; number += digitRight * mul * 9; } mul *= 10; } } return number; }
type: Answer

http://stackoverflow.com/a/27193206
has body: In my opinion, using verbose method name is a better solution. It's more understandable, your code will require less comments It's easier to maintain, you can change the implementation without impacting existing signatures. You still can add a new signature, without regression. But be careful, in some situation it's preferable to add some parameters Example 1 private List&lt;Element&gt; getElementsByType(MyTypeEnum type); public List&lt;Element&gt; getElementsOfType1(); public List&lt;Element&gt; getElementsOfType2(); public List&lt;Element&gt; getElementsOfType3(); /* VS */ public List&lt;Element&gt; getElementsByType(MyTypeEnum type); Both implementations are good, it depends on you, on the size of MyTypeEnum, on its capacity to increase in size. What do you want to expose ? Do you want the caller of getElements*** to be able to get all type of Element ? Example 2 public void log(Level l, String s, Exception e); /* VS */ public void logInfo(String s); public void logWarning(String s); public void logError(String s, Exception e); In this case, the second part is better. Because it more readable, easy to understand on the first look. And because when you log in INFO and WARNING level, you don't need to specify an Exception. So Specializing the method is a good thing. However, it's important to keep the method public void log(Level l, String s, Exception e); public and not private because it could be useful to use this generic method in some cases. Conclusion It really depends on the situation but if you have the possibility to add specific methods, with verbose names, which specialize a target behavior, do it.
accepted answer of: http://stackoverflow.com/q/27035474
answers question: http://stackoverflow.com/q/27035474
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/42939586
has comment: http://stackoverflow.com/comment/98362659
score: 9
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/a/27117107
has comment: http://stackoverflow.com/comment/42737050
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/27116495
has comment: http://stackoverflow.com/comment/42737075
downvote count: 0
has comment: http://stackoverflow.com/comment/42737200
has comment: http://stackoverflow.com/comment/42737232
score: 4
has body: After your import lines add this line: nltk.internals.config_java(options='-xmx2G') This will increase the maximum RAM size that java allows Stanford POS Tagger to use. The '-xmx2G' changes the maximum allowable RAM to 2GB instead of the default 512MB. See What are the Xms and Xmx parameters when starting JVMs? for more information If you're interested in how to debug your code, read on. So we see that the command fail when handling huge amount of data so the first thing to look at is how the Java is initialized in NLTK before calling the Stanford tagger, from https://github.com/nltk/nltk/blob/develop/nltk/tag/stanford.py#L19 : from nltk.internals import find_file, find_jar, config_java, java, _java_options We see that the nltk.internals package is handling the different Java configurations and parameters. Then we take a look at https://github.com/nltk/nltk/blob/develop/nltk/internals.py#L65 and we see that the no value is added for the memory allocation for Java.
has comment: http://stackoverflow.com/comment/42796902

http://stackoverflow.com/a/27048712
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27048175
type: Answer
downvote count: 0
has body: You're re-declaring your JComboBox variable in the constructor and thus shadowing the field found in the class. By doing this the field remains null: public class Lab8 extends JPanel { private JPanel text; private JComboBox input; // this guy remains null // .... etc .... public Lab8() { Integer [] select = {1,2,3,4}; // the line below initializes a local input variable. // this variable is visible only inside of the constructor JComboBox input = new JComboBox(select); // ***** here **** Don't re-declare the variable: public class Lab8 extends JPanel { private JPanel text; private JComboBox input; // .... etc .... public Lab8() { Integer [] select = {1,2,3,4}; // JComboBox input = new JComboBox(select); // ***** here **** input = new JComboBox(select); // ***** note difference? *****
score: 3
answers question: http://stackoverflow.com/q/27048175

http://stackoverflow.com/q/27106675
has answer: http://stackoverflow.com/a/27106695
tagged with: java
score: -3
has comment: http://stackoverflow.com/comment/42751055
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42747468
possible better answer: http://stackoverflow.com/a/27106691
tagged with: string
has answer: http://stackoverflow.com/a/27106691
favorite count: 0
accepted answer: http://stackoverflow.com/a/27106695
has body: I want to round the decimal values of string.below is the example String Result = "19292.5" i want the output of result to round to 19292 In short i want to remove the ending .5 decimal value.
type: Question
has comment: http://stackoverflow.com/comment/42716640
has comment: http://stackoverflow.com/comment/42747527
answer count: 2
upvote count: 1
has title: Rounding String values in Java

http://stackoverflow.com/comment/42798284
has text: Ok...putting some code into the inner loop works fine. I thought that the object was initialized also if there was not declared operations on it. If you want write an official response I will accept it :-)
comment on: http://stackoverflow.com/q/27151711
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27029257
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27029192
has body: All this code does is reverse an array. It goes all the way to array.length/2 (other wise if it went to length it would swap, then swap back doing nothing). The temp doesn't need to be an array because it's just a variable to hold on to old values while the swap is happening. The final two lines of the code is where the swap actually happens. So if you provide input of {1, 2, 3, 4, 5} it will output {5, 4, 3, 2, 1}. If you look at when i =0: numbers[0] = 1, numbers[4] = 5, temp will become 1, then numbers[0] will become 5, then numbers[4] will become the value of temp (1). So after that first iteration of the loop, your array will look like this: {5, 2, 3, 4, 1}

http://stackoverflow.com/a/27151040
type: AcceptedAnswer
type: Answer
has body: Here is an example test where AuthenticationServicePort is mocked, using JMockit 1.13: public class AuthenticationModuleTest { @Tested AuthenticationModule authentication; @Mocked AuthenticationServicePort authenticationService; @Mocked AuthenticationService port; @Test public void validateUser() { final String userName = "tester"; final String password = "12345"; authentication.setUserName(userName); authentication.setPassword(password); new Expectations() {{ port.login(userName, password); result = true; }}; boolean validated = authentication.validateUser(); assertTrue(validated); } }
accepted answer of: http://stackoverflow.com/q/27031954
score: 0
answers question: http://stackoverflow.com/q/27031954

http://stackoverflow.com/comment/42799147
has text: it is suppose to return the email that is being entered by the user
comment on: http://stackoverflow.com/q/27152298
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42624778
score: 0
has text: `Integer.parseInt` expects a `String`, you need to convert `char` to a `String`. Once that's done (and discarding numbers of less than 3 digits), works okay for me...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27054010

http://stackoverflow.com/a/27085292
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27084901
has body: Make sure your login use the same parse init session as main activity. Create new user in your app. Verify parse dashboard shows the new entry in User table. Use curl to log on to your app from terminal session ( cmd) if on windows os. If u can curl cli log on following log on instruction in parse rest Api docs, then u know u r log on activity has bug.

http://stackoverflow.com/comment/42682285
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27086992
has text: The above program is working fine but i need a program which can count the occurrence of WORD and not alphabet. above program can count the occurrence of alphabet.
score: 0

http://stackoverflow.com/comment/42518302
type: Comment
has text: I am using ArrayAdapter<Strig>.
comment on: http://stackoverflow.com/a/26993821
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42670527
score: 0
type: Comment
type: QuestionComment
has text: Try using `double` (Or `BigInteger`, if you want an exact result)
comment on: http://stackoverflow.com/q/27080357

http://stackoverflow.com/comment/42587151
comment on: http://stackoverflow.com/q/27015975
type: Comment
type: QuestionComment
has text: For the Data Source.
score: 0

http://stackoverflow.com/comment/134035278
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27975278
has text: Just for the sake of mansplaining, use try-with-resources.

http://stackoverflow.com/comment/42706683
type: Comment
has text: If you would have debugged and checked the call stack, you would have seen who is calling `paintIcon`.
type: QuestionComment
comment on: http://stackoverflow.com/q/27101243
score: 1

http://stackoverflow.com/q/27032139
has comment: http://stackoverflow.com/comment/42586068
has answer: http://stackoverflow.com/a/27032370
has comment: http://stackoverflow.com/comment/42586168
score: 0
has answer: http://stackoverflow.com/a/27032267
has answer: http://stackoverflow.com/a/27032268
tagged with: multidimensional-array
answer count: 3
tagged with: java.util.scanner
has title: Write over 2D array values with Scanner input
accepted answer: http://stackoverflow.com/a/27032268
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am having difficulty with the getCategoryWeights method (at the bottom of my code) I am writing. It is supposed to change the values of the weight column based on the user's input, but I can't figure out why it isn't working. Here is my program so far: package gradeprojector; //Done // Print a welcome message // printWelcomeMessage(); // Get the number of gradebook categories. // int categories = getGradebookCategories(); // Get the maximum number of assignments in a category. // int maxAssignments = getMaximumAssignments(); // Create the 2D array to hold assignment scores // double[][] scoreArray = getScoreArray(categories, maxAssignments); //Not Done // Get the category weights // getCategoryWeights(scoreArray); // Get the category scores // getScores(scoreArray); // Compute the category averages // computeCategoryAverages(scoreArray); // Compute the overall average // double overallAverage = computeOverallAverage(scoreArray); // Compute the final exam scores needed to get a certain grade (just do A,B,C,D) // double[] targetFinalScores = getTargetFinalScores(overallAverage); // Print target final exam scores // printTargetFinalExamScoes(targetFinalScores); import java.util.*; public class GradeProjector { public static void main(String[] args) { // TODO code application logic here printWelcomeMessage(); int categories = getGradebookCategories(); int maxAssignments = getMaximumAssignments(); double[][] scoreArray = getScoreArray(categories, maxAssignments); printScoreArray(scoreArray, maxAssignments); scoreArray = getCategoryWeights(scoreArray); printScoreArray(scoreArray, maxAssignments); } // printWelcomeMessage(); public static void printWelcomeMessage(){ System.out.println("Welcome!"); } // Get the number of gradebook categories. public static int getGradebookCategories(){ Scanner in = new Scanner(System.in); System.out.print("Enter the number of gradebook categories: "); int categories = in.nextInt(); return categories; } // Get the maximum number of assignm…
possible better answer: http://stackoverflow.com/a/27032267

http://stackoverflow.com/a/27141613
has body: You cannot do this in the class like this. You have to call other class methods from a method/block. public class Tester { Automobile myBmw = new Automobile(24); public Tester(){ // It may be any other function myBmw.fill(20); myBmw.takeTrip(100); myBmw.reportFuel(); } // OR if you miss the main() public static void main(String args[]){ Automobile myBmw = new Automobile(24); myBmw.fill(20); myBmw.takeTrip(100); myBmw.reportFuel(); } }
score: 0
answers question: http://stackoverflow.com/q/27141578
has comment: http://stackoverflow.com/comment/42780580
type: Answer
has comment: http://stackoverflow.com/comment/42780553

http://stackoverflow.com/comment/42639835
comment on: http://stackoverflow.com/q/27062900
score: 3
type: QuestionComment
type: Comment
has text: I believe that this command also catches the current instance, so it terminates all other instances, and this one as well.

http://stackoverflow.com/comment/42530857
type: QuestionComment
has text: As @John wrote, there is no such thing as **ResultContainData<Boolean>.class**, try **ResultContainData.class**.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27000227

http://stackoverflow.com/comment/42738524
type: AnswerComment
score: 0
type: Comment
has text: where would i need to implement this?
comment on: http://stackoverflow.com/a/27118309

http://stackoverflow.com/q/26994248
type: Question
has comment: http://stackoverflow.com/comment/42519094
has body: I install intellij idea 14 and tomcat 8, and i create a Spring MVC project with the default template. I didnt change anything just configure my tomcat path in the IDE. I tried to run my default application i saw in the Event log that compilation completed successfully, but if i go to localhost:8080 i get this error: http://pastebin.com/cHgw4G0K Whats wrong with my server, or app, or IDE config? Here is my sourcecodes: HelloController.java @Controller @RequestMapping("/") public class HelloController { @RequestMapping(method = RequestMethod.GET) public String printWelcome(ModelMap model) { model.addAttribute("message", "Hello world!"); return "hello"; } } mvc-dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.springapp.mvc"/> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=".jsp"/> </beans> web.xml Spring MVC Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / hello.jsp ${message} Why i got class not found exception?
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/42527343
tagged with: tomcat
answer count: 2
has comment: http://stackoverflow.com/comment/42519249
downvote count: 0
has answer: http://stackoverflow.com/a/27981153
favorite count: 0
has comment: http://stackoverflow.com/comment/42528192
has comment: http://stackoverflow.com/comment/42527212
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/28181745
has title: Class not found Spring MVC
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/42769953
has text: by another thread interuppting it does it mean the scenario I listed above, one is trying to write and other interuppts by trying to read or thread.interupt
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27135833
type: Comment

http://stackoverflow.com/comment/42714164
has text: The problem is that you know what "matched ones" means but I don't as I see only the rule which doesn't do what you expect.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27105033
type: AnswerComment

http://stackoverflow.com/q/27076604
has answer: http://stackoverflow.com/a/27076815
tagged with: java
has comment: http://stackoverflow.com/comment/42664020
accepted answer: http://stackoverflow.com/a/27076815
has title: hash map with arraylist and create new arraylist out of it
answer count: 1
downvote count: 0
has body: I am trying to clean my code and want to used optimised approches in the code. Currently I have hashmap of this type private HashMap&lt;String, ArrayList&lt;allProperty&gt;&gt; fData; So The data is coming from server in every 5 second. and I am updating this hashmap every 5 second something like this fData.put("Student", allStudent); fData.put("Emp", allEmp); fData.put("Other", allOther); So from allproperty class object, there is marks fields and I am trying to extract that marks field for all key and creating new arraylist of integer so that I can append the marks in created arraylist by every 5 second. I was using different arraylist for each student, emp and other before and it was working fine but it seems like alot of repeation of code. That is why I am trying to achieve it with hash map I am trying soemthing like this but it is not appending data ... for (String type: allTypes) { if(fData.get(type).size() &gt; 0){ arraySort(fData.get(type)); temp = new ArrayList&lt;Integer&gt;(); temp.add(fData.get(type).get(0).marks); } cData.put(type, temp); cType is hashMap of type given below and private HashMap&lt;String, ArrayList&lt;Integer&gt;&gt; cData; where allTypes is signalTypes.add("Student"); signalTypes.add("Emp"); signalTypes.add("Other"); at the end I want three new arraylist with key and able to append data in every 5 seconds. Thanks
has comment: http://stackoverflow.com/comment/42664107
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42664088
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/42664079
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/42664048

http://stackoverflow.com/comment/42692137
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27092296
has text: I tried to insert the String as it is. Looks good but if I open the file in another editor than NetBeans, then this Editor cannot recognize the file as UTF-16-BE. That's why I want to write the BOM in the beginning, so that other editors can easily detect the charset of my saved files.
type: AnswerComment

http://stackoverflow.com/comment/42589862
score: 0
comment on: http://stackoverflow.com/a/27034497
type: Comment
has text: but it's the same that my approche not ? what gonna I win with using tiles ?
type: AnswerComment

http://stackoverflow.com/comment/42556661
has text: I already added Apache Tomcat in to class path. Is it possible to add two servers? My server folder contain both Tomcat and jena-fuseki-1.0.1. How can I add jena-fuseki-1.0.1 into class path? Isn't it a problem to add to servers?
comment on: http://stackoverflow.com/a/27015503
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42781595
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27141999
has text: You use `setScale` just like in your code. And it works then (I tested). The rounding works properly with BigDecimal. Your problem is that the floating point you put into BigDecimal was already broken (slighly off the rounding point).

http://stackoverflow.com/comment/42819490
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27142096
has text: Thank you SO much! Now I need to make the opponent board with the bombs and go 1 turn each and validate when the person wins. It's my final project due in two weeks so I'll probably come back with more questions :p thanks again.
score: 1

http://stackoverflow.com/q/27027468
has comment: http://stackoverflow.com/comment/47417110
has body: I need Your help. I am trying to configure Spring4 to work with Tiles3. But I would like to be done with no xml. I've done some configuration already: package com.derp.common.init; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration.Dynamic; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.filter.HiddenHttpMethodFilter; import org.springframework.web.servlet.DispatcherServlet; public class Initializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(WebAppConfig.class); servletContext.addListener(new ContextLoaderListener(ctx)); ctx.setServletContext(servletContext); Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setAsyncSupported(true); servlet.setLoadOnStartup(1); // Allow to use Put and Delete method for REST architecture registerHiddenFieldFilter(servletContext); } private void registerHiddenFieldFilter(ServletContext aContext) { aContext.addFilter("hiddenHttpMethodFilter", new HiddenHttpMethodFilter()).addMappingForUrlPatterns(null ,true, "/*"); } } end: package com.derp.common.init; import java.util.HashMap; import java.util.Map; import java.util.Properties; import javax.annotation.Resource; import javax.sql.DataSource; import org.apache.tiles.Attribute; import org.apache.tiles.Definition; import org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.conte…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42590109
has comment: http://stackoverflow.com/comment/42612093
has comment: http://stackoverflow.com/comment/43930473
tagged with: spring-4
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42582309
has comment: http://stackoverflow.com/comment/47434068
type: Question
has title: Spring4 & Tiles3 config programatically error: Caused by: java.io.FileNotFoundException:
tagged with: tiles-3
tagged with: configuration
score: 0

http://stackoverflow.com/a/27078529
upvote count: 24
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27078476
type: Answer
answers question: http://stackoverflow.com/q/27078476
has body: You are inheriting from ActionBarActivity. Hence, you need to use getSupportActionBar(), not getActionBar(), to get at the appcompat-v7-supplied action bar backport.
score: 24

http://stackoverflow.com/comment/42594993
comment on: http://stackoverflow.com/q/27034650
score: 0
has text: When i delete the extends JPanels it doesnt work... I have to extend it
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27029036
accepted answer: http://stackoverflow.com/a/27029078
tagged with: java
type: Question
tagged with: arrays
tagged with: int
score: 0
has title: Unable to declare array with many elements
has body: my program needs to use some prime numbers between 100 and 10000 many times, so i wrote another program which creates this numbers like this : {101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953…
has answer: http://stackoverflow.com/a/27029078
answer count: 1
tagged with: netbeans
linked to: http://stackoverflow.com/q/15630998
type: AnsweredQuestion

http://stackoverflow.com/comment/42642881
score: 1
comment on: http://stackoverflow.com/q/27044987
type: Comment
type: QuestionComment
has text: The scrolling occurs before the image is loaded asynchronously, so when the image eventually is loaded, it pushes the text downwards. It does not stop scrolling at the image, this is just a coincidence. Unfortunately I don't know whether you can listen for an "image loaded event". If you are the one controlling the content, you could probably work around this by first downloading the images yourself and then referencing them from a local repository (and perhaps delaying the scrolling a bit more using a `javax.swing.Timer` instead of an `invokeLater`).

http://stackoverflow.com/a/27069042
has comment: http://stackoverflow.com/comment/124415022
has comment: http://stackoverflow.com/comment/107538884
upvote count: 36
has comment: http://stackoverflow.com/comment/139904406
has body: Use MockitoAnnotations.initMocks to initiate the @Mock and @InjectMocks objects. Your test would look something like: @Mock FastPowering fastPower; @InjectMocks Controller controller; @Before public void setup() { MockitoAnnotations.initMocks(this); } @Test public void test() { .... }
score: 33
has comment: http://stackoverflow.com/comment/130346266
answers question: http://stackoverflow.com/q/27065195
type: Answer
has comment: http://stackoverflow.com/comment/83504178
has comment: http://stackoverflow.com/comment/124416395
downvote count: 3

http://stackoverflow.com/a/27044073
has comment: http://stackoverflow.com/comment/42631296
has comment: http://stackoverflow.com/comment/42608773
accepted answer of: http://stackoverflow.com/q/27043567
has comment: http://stackoverflow.com/comment/42608643
has comment: http://stackoverflow.com/comment/42610782
answers question: http://stackoverflow.com/q/27043567
has comment: http://stackoverflow.com/comment/42610154
has comment: http://stackoverflow.com/comment/42625274
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42615515
has comment: http://stackoverflow.com/comment/42609521
has comment: http://stackoverflow.com/comment/42615085
score: 0
has comment: http://stackoverflow.com/comment/42609169
has comment: http://stackoverflow.com/comment/42611370
type: Answer
has comment: http://stackoverflow.com/comment/42621736
has body: The main difference between a pthreads and Java lock is that the Java counterpart is reentrant. This means that in Java it won't deadlock if you acquire the same lock that is already acquired (note that pthreads might have reentrant implementations as well). Note that the modern implementation of Java Semaphore class (and other classes from java.util.concurrent package) uses directly CPU instructions such as Compare-and-Swap not a system call provided by the OS (or similar instructions if the hardware does not support it).
has comment: http://stackoverflow.com/comment/42608203
has comment: http://stackoverflow.com/comment/42608830
has comment: http://stackoverflow.com/comment/42607381

http://stackoverflow.com/comment/42789999
score: 4
has text: That's basically what `System.out.printf` does...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27147262

http://stackoverflow.com/a/27055823
answers question: http://stackoverflow.com/q/27055752
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: first way is better, use reflections only when don't have other options. in one application there should be one approach to solve one kind of problem. I think the first approach is fine. (much better then if/else blocks)
type: Answer
accepted answer of: http://stackoverflow.com/q/27055752

http://stackoverflow.com/q/27088194
has comment: http://stackoverflow.com/comment/42684091
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27088209
has body: I've just recently stumbled upon this when trying to simplify my class' constructors that have about 50% of identical codes. It seems like I couldn't re-use my former constructor definition (which handles initialization) from another constructor that overloads it. For the sake of clarity, this is what I've been trying to say: public MusicOrganizationHelper(Context context) { mContext = context; // More object initializations using 'context'.. } public MusicOrganizationHelper(Context context, ArrayList&lt;String&gt; fileUris) { MusicOrganizationHelper(context); // Why can't I do this? for (String uri : fileUris) { if (uri != null &amp;&amp; !uri.equalsIgnoreCase("")) { try { AudioFile audioFile = read(uri); mAudioFileMap.put(audioFile, audioFile.getTagOrCreateAndSetDefault()); } catch (CannotReadException e) { e.printStackTrace(); } } } } I know this could be easily produced by making some sort of private void init(context) method but I'm just curious: why can't I call constructors like any other method even from within its class definition? They seems pretty similar to me (them constructors and 'peasant' methods). I'm sorry if this turns out to be an obvious thing. I'm relatively new to Java and OOP in general. Thanks in advance!
has comment: http://stackoverflow.com/comment/42684103
tagged with: constructor
score: 0
has title: How could I use a constructor without 'new' in Java?
type: AnsweredQuestion
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/27088209

http://stackoverflow.com/comment/42523979
type: QuestionComment
comment on: http://stackoverflow.com/q/26996415
has text: I ran your code and I think I am understanding what is going on, how is your newFile.txt set up. In my file I have like "Hello - a greeting word" is that similar to yours?
score: 0
type: Comment

http://stackoverflow.com/q/27104259
tagged with: hashcode
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42712052
type: Question
has comment: http://stackoverflow.com/comment/42712342
has body: We have a class named Subscriber, that extends "HashMap". We have many instances of this class in a list, and each instance has a set of entries set to the map, one of these are "status". Our program is updating the "status" value by calling a method on the Subscriber, that does a simple put to the HashMap. Our program can be running for multiple days (weeks) without any issues, but some times we have seen strange behaviour in some other parts of the system, that uses data from the HashMap. For us, it looks like there is a duplicate key in one or more of the Subscriber instances. We manage to create a jmap dump, and based on the dump it looks for me that we have the "status" set twice when I look at the dump in VisualVM. We are currently running Java version: 1.7.0_25 (Oracle) How is this possible? Or do I read the VisualVM wrong?
tagged with: hashmap
has comment: http://stackoverflow.com/comment/42712376
has comment: http://stackoverflow.com/comment/42712226
score: 3
has title: How come my HashMap have a duplicate key?
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42714034
favorite count: 0
has comment: http://stackoverflow.com/comment/42712128
has comment: http://stackoverflow.com/comment/42712217
tagged with: visualvm
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42712211
has comment: http://stackoverflow.com/comment/42715162
has answer: http://stackoverflow.com/a/27104781
tagged with: jmap
has comment: http://stackoverflow.com/comment/42712296

http://stackoverflow.com/q/27034605
accepted answer: http://stackoverflow.com/a/27035253
tagged with: android
type: AnsweredQuestion
tagged with: gridview
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27034679
has answer: http://stackoverflow.com/a/27035253
score: 0
possible better answer: http://stackoverflow.com/a/27034679
answer count: 2
has comment: http://stackoverflow.com/comment/42589980
has title: Grid view onclick is not working
has body: I need to make ItemClickListener on grid view. I am adding buttons dynamically on gridvie. Using Base adapter. I need to onItemClickListener in my activity not on baseadapter class. My xml code : &lt;GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="match_parent" android:layout_height="match_parent" android:columnWidth="90dp" android:gravity="center" android:horizontalSpacing="10dp" android:numColumns="auto_fit" android:stretchMode="columnWidth" android:verticalSpacing="10dp" /&gt; DirectOrder class: public class DIrectOrder extends Activity { DbHelper db; ArrayList&lt;HashMap&lt;String, String&gt;&gt; category = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; items = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); BaseAdapter baseAdapter; LinearLayout categroyLayout; String strCategory = ""; GridView grdView; static String[] itemName = new String[10];; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setContentView(R.layout.cash_directorder); db = new DbHelper(DIrectOrder.this); grdView = (GridView) findViewById(R.id.gridview); categroyLayout = (LinearLayout) findViewById(R.id.lay_category); category = db.retrieve_category_name(); strCategory = category.get(0).get("name"); items = db.retrieve_item_details(strCategory); for (int i = 0; i &lt; category.size(); i++) { Button butCategory = new Button(this); butCategory.setText(category.get(i).get("name")); butCategory.setId(Integer.parseInt(items.get(i).get("Id"))); categroyLayout.addView(butCategory); } Log.i("Item name ::::", "" + items.get(0).get("Item_Name")); for (int i = 0; i &lt; items.size(); i++) { itemName[i] = items.get(i).get("Item_Name"); } grdView.setAdapter(new categoryAdapter(this, itemName)); // I need on click of the gridview o…

http://stackoverflow.com/q/27083920
has answer: http://stackoverflow.com/a/27150906
score: 0
answer count: 3
tagged with: sql
tagged with: sqlite
has title: SQLite How To - Sum by Value in a JOIN
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27084085
upvote count: 1
possible better answer: http://stackoverflow.com/a/27087769
has body: I have a sample sqlite database that currently has 7 entries which is queried via: String selectQuery = "SELECT * FROM " + TABLE_TRANSACTIONS + " x " + "JOIN (SELECT " + KEY_TYPE_ID + ", COUNT(*) count FROM " + TABLE_TRANSACTIONS + " GROUP BY " + KEY_TYPE_ID + " ORDER BY count DESC) y " + "ON x.type_id = y.type_id " + //type_id vs. KEY_TYPE_ID as alias won't recognize KEY_TYPE_ID "WHERE x.type_id = " + TagData.TYPE_EXPENSE; The output is: Type A = 2500 Type A = 2599 Type B = 45000 Type C = 299 Type C = 2699 Type C = 10000 Type C = 12000 which correctly groups my types by their respective values. However, the ideal output would be: Type B = 45000 Type C = 24998 Type A = 5099 where each type is then ordered by the sum of each type. Is this possible? If so what else should I be doing in my query? I'm relatively new to SQL and haven't been able to figure this out yet. Thank you in advance for any insight. EDIT Based on your input @CL. I now have a more simplified query: String selectQuery = "SELECT *, SUM(" + KEY_AMOUNT + ") AS amount_sum " + "FROM " + TABLE_TRANSACTIONS + " " + "GROUP BY " + KEY_LABEL_ID + " " + "ORDER BY amount_sum DESC"; which works as expected when I use sqlfiddle at http://www.sqlfiddle.com/#!5/b3615/1 but not when I use the query in Android. In Android, only the most recent entry for each label type is returned. The SUM doesn't seem to actually do its job. What am I missing here?
accepted answer: http://stackoverflow.com/a/27150906
has answer: http://stackoverflow.com/a/27087769
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
tagged with: database

http://stackoverflow.com/a/27004762
has comment: http://stackoverflow.com/comment/42569987
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/27002423
upvote count: 6
has comment: http://stackoverflow.com/comment/66286965
has body: Did you try to remove the ~/.sbt/repositories file? The defaults should be enough. If this still not work, try to update your sbt launcher to the last version. Also a good practice is to have a file build.properties in the my_project/project directory with that line inside: sbt.version=0.13.6 This will enforce the sbt version for the project, instead of using the version of the launcher.
type: Answer

http://stackoverflow.com/comment/42625147
has text: Java is case sensitive, `First` is not the same as `first`...You might like to have a read through [Code Conventions for the Java TM Programming Language](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html), it will make it easier for people to read your code and for you to read others
comment on: http://stackoverflow.com/q/27054010
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27037251
type: Question
accepted answer: http://stackoverflow.com/a/27037330
tagged with: command-line-arguments
answer count: 2
possible better answer: http://stackoverflow.com/a/27037429
has answer: http://stackoverflow.com/a/27037330
upvote count: 1
linked to: http://stackoverflow.com/q/2670956
favorite count: 0
tagged with: input
has body: I'm trying to display an error message if the user supplies no command line arguments. I'm getting an error when I type "java sheet12t1" into cmd. I have the rest of my program nailed down, it's just that this part won't work. The question I'm working with is below, along with my code. This is the question I'm working with: https://i.sstatic.net/YNMJF.png public class sheet12t1 { public static void main(String[] args) { int projectCategory = Integer.parseInt(args[0]); int keyServiceType = Integer.parseInt(args[1]); if (args.length != 2) System.out.println("Please enter: java sheet12t1 projectCategory serviceType"); else if (args.length == 0) System.out.println("Please enter two valid inputs."); else if (projectCategory &lt; 1 || projectCategory &gt; 3) System.out.println("Please enter valid inputs."); else if (keyServiceType &lt; 1 || keyServiceType &gt; 3) System.out.println("Please enter valid inputs."); else { double result = calculateProjectCost(projectCategory, keyServiceType); System.out.println("Total project cost: " + result); } } public static double calculateProjectCost(int projectCategory, int keyServiceType) { double totalCost = 10000; if (projectCategory == 1) { if (keyServiceType == 1) totalCost += 5600.5; else if (keyServiceType == 2) totalCost += 5500; else totalCost += 6000; } else if (projectCategory == 2) { if (keyServiceType == 1) totalCost += 10600.5; else if(keyServiceType ==2) totalCost += 11000; else totalCost += 13500; } else { if (keyServiceType == 1) totalCost += 17000; else if(keyServiceType == 2) totalCost += 22000; else totalCost += 25000; } return totalCost; } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27037429
downvote count: 0
score: 1
has title: How do I check if a user inputs nothing so I can display an error message
tagged with: java
tagged with: methods

http://stackoverflow.com/comment/42741843
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27120010
has text: `volatile boolean stopped = false` you can google it. There are other methods but somehow you have to make sure that the change of stopped var can be seen where it is checked.

http://stackoverflow.com/comment/74659409
score: 0
type: Comment
has text: Did you ever find a solution for this?
type: QuestionComment
comment on: http://stackoverflow.com/q/27046350

recaptcha
tag name: recaptcha
tags question: http://stackoverflow.com/q/26992625
type: Tag

http://stackoverflow.com/a/27050629
type: Answer
downvote count: 0
score: 3
has body: No, there is no built in functionality as I know. But you can use an external library for that (and many other cool features). You can either use JOOL, where you can use the Unchecked class for this. The example from there page demonstrates this with an IOException Arrays.stream(dir.listFiles()).forEach( Unchecked.consumer(file -&gt; { System.out.println(file.getCanonicalPath()); }) ); Another (and in my opinion better) approach would be to use a functional designed library like Functionaljava. A good approach would be to wrap your task in a Validation to decide afterwards, if the result was successful. This could look like this: TypedBlock&lt;IOException&gt; foo = ...; // do your work final Validation&lt;IOException, Unit&gt; validation = Try.f(() -&gt; { foo.run(); return Unit.unit(); // Unit equals nothing in functional languages })._1(); // check if we got a failure if (validation.isFail()) { System.err.println("Got err " + validation.fail()); } // check for success if (validation.isSuccess()) { System.out.println("All was good :-)"); } // this will just print out a message if we got no error validation.forEach(unit -&gt; System.out.println("All was good"));
accepted answer of: http://stackoverflow.com/q/27050314
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27050314
upvote count: 3

http://stackoverflow.com/q/27138969
has comment: http://stackoverflow.com/comment/42776946
has comment: http://stackoverflow.com/comment/42776212
type: Question
tagged with: graphics
tagged with: awt
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/42775854
has body: I am using Eclipse Helios and JDK 1.5 to run a program that deals with JAVA graphics, the objective is to write an abstract class that draws the diagram for a function. The problem I am having very bizarre! I run it on my machine it compiles and outputs the desired result, but it still shows errors in the program and the entire project(the red X's on the file), I tried cleaning the project, recompile and re-run it again but it still keeps happening. I also tried running it on 2 other different machines where only the axes show up and not the other curves. I cant find an explanation for it. Any suggestions as to what is wrong? import java.awt.*; import javax.swing.*; public class Thirteen extends JFrame { public Thirteen() { setLayout(new GridLayout(2, 2)); add(new DrawParabola()); add(new DrawSineWave()); add(new DrawCosineWave()); add(new DrawTangent()); } public static void main(String[] args) { Thirteen frame = new Thirteen(); frame.setTitle("Exercise15_13"); frame.setSize(800, 400); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); } } abstract class AbstractDrawFunction extends JPanel { /** Polygon to hold the points */ private Polygon p = new Polygon(); protected AbstractDrawFunction() { drawFunction(); } /** Return the y-coordinate */ abstract double f(double x); /** Obtain points for x-coordinates 100, 101, ..., 300 */ public void drawFunction() { for (int x = -100; x &lt;= 100; x++) { p.addPoint(x + 200, 200 - (int)f(x)); } } /** Implement paintComponent to draw axes, labels, and * connecting points */ protected void paintComponent(Graphics g) { super.paintComponent(g); // Draw x axis g.drawLine(30, 100, 370, 100); g.drawLine(370, 100, 360, 105); g.drawLine(370, 100, 360, 95); g.drawString("X", 370, 80); // Draw y axis g.drawLine(200, 30, 200, 160); g.drawLine(200, 30, 195, 40); g.drawLine(200, 30, 205, 40); g.drawString("Y", 220, 30); } } class DrawParabola extends AbstractDrawFunction { protected dou…
answer count: 0
has title: Program runs but shows errors in the IDE
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/27137259
has comment: http://stackoverflow.com/comment/42772921
has answer: http://stackoverflow.com/a/27137451
has body: I want to know if (and how) I can put my reversed array from my method ArrayReverse in the array result(where the ?????????? are) in my main method. The code should print out "Funktioniert" My code: public class blubb { public static void main(String[] args) { char[] array = {'t', 'r', 'e', 'i', 'n', 'o', 'i', 't', 'k', 'n', 'u', 'F'}; char[] result= new char[??????????]; result=ArrayReversed(array); for (int i = 0; i &lt; ergebnis.length; i++) { System.out.println(ergebnis[i]); } } public static char[] ArrayReversed(char[] arr) { char [] blubb= new char[arr.length]; for (int i = arr.length-1; i &gt;=0; i--) { blubb[i]=arr[i]; } return blubb; } }
has title: How to put an array from a method in an array in the calling method?
possible better answer: http://stackoverflow.com/a/27137336
answer count: 4
has answer: http://stackoverflow.com/a/27137336
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42772662
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27137478
has comment: http://stackoverflow.com/comment/42772783
has answer: http://stackoverflow.com/a/27137339
accepted answer: http://stackoverflow.com/a/27137451
score: 0
tagged with: arrays

http://stackoverflow.com/comment/42572960
type: QuestionComment
comment on: http://stackoverflow.com/q/27023049
has text: No I never call reset, do I need to?
score: 0
type: Comment

http://stackoverflow.com/q/27035264
has comment: http://stackoverflow.com/comment/42612355
tagged with: android
has comment: http://stackoverflow.com/comment/42624996
answer count: 0
has comment: http://stackoverflow.com/comment/42634349
score: 1
tagged with: java
has body: I have a glass app in which I used Navigation functionality by follow below link : https://developers.google.com/glass/develop/gdk/starting-glassware and the code I used : Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("google.navigation:ll=37.91357,-122.073062&amp;mode=d&amp;title=DARULISLAM MASJID")); startActivity(intent); I have attached screenshot also. here 's the logcat : V/GlassNotification( 573): skipping since notification not whitelisted I/NavigationService( 7774): START_REDELIVER_INTENT I/SoftOMXPlugin( 126): Created OMXPlugin : OMX.google.raw.decoder I/AudioPlayer( 126): mLatencyUs = 176000 I/NavigationService( 7774): onStartCommand: 50 Intent { act=android.intent.actio n.VIEW dat=google.navigation:ll=37.91357,-122.073062&amp;mode=d&amp;title=DARULISLAM MAS JID flg=0x400000 cmp=com.google.glass.maps/.NavigationService } V/GlassNotification( 573): Received notification id: 1 packageName: com.google. glass.maps V/GlassNotification( 573): skipping since notification not whitelisted D/dalvikvm( 7774): GC_CONCURRENT freed 1964K, 21% free 10400K/13120K, paused 22m s+5ms, total 124ms D/dalvikvm( 7774): WAIT_FOR_CONCURRENT_GC blocked 98ms D/dalvikvm( 7774): WAIT_FOR_CONCURRENT_GC blocked 88ms D/dalvikvm( 7774): WAIT_FOR_CONCURRENT_GC blocked 91ms D/dalvikvm( 7774): WAIT_FOR_CONCURRENT_GC blocked 82ms I/NavigationManager( 7774): StartNavigating: mode=0 D/dalvikvm( 7774): WAIT_FOR_CONCURRENT_GC blocked 97ms I/NavigationService( 7774): START_REDELIVER_INTENT D/CardScrollView( 7774): Activating. E/c ( 7774): RuntimeException while executing runnable com.google.glass.ma ps.MapHelper$6@41c5bd48 with executor com.google.common.util.concurrent.t@41f2e1 20 E/c ( 7774): java.util.concurrent.CancellationException: Task was cancelle d. E/c ( 7774): at com.google.common.util.concurrent.AbstractFuture.canc ellationExceptionWithCause(SourceFile:393) E/c ( 7774): at com.google.common.util.concurrent.AbstractFuture$Sync .getValue(SourceFile:310) E/c ( …
tagged with: google-gdk
type: Question
has comment: http://stackoverflow.com/comment/42613123
upvote count: 1
has comment: http://stackoverflow.com/comment/42626095
downvote count: 0
favorite count: 0
tagged with: google-glass
has title: navigation to a location is not working google glass
type: UnansweredQuestion

http://stackoverflow.com/comment/125150337
comment on: http://stackoverflow.com/q/27144132
has text: Please use Query Type as Update Statement. For more info refer to [https://stackoverflow.com/a/55116782/10514096](https://stackoverflow.com/a/55116782/10514096)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42614484
type: Comment
has text: try to add the dependency ** org.apache.cxf cxf-rt-transports-local 3.0.2 ** and test
type: QuestionComment
comment on: http://stackoverflow.com/q/27046031
score: 0

http://stackoverflow.com/a/27067503
type: Answer
has comment: http://stackoverflow.com/comment/42648350
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/27067498
answers question: http://stackoverflow.com/q/27067498
type: AcceptedAnswer
downvote count: 0
has body: The exception occurs when i reaches testLength, since the index starts from zero and ends at the length of the string minus 1. Change for(int i = 1; i &lt;= testLength; i++){ to for(int i = 0; i &lt; testLength; i++){

http://stackoverflow.com/q/27059855
has comment: http://stackoverflow.com/comment/46852055
favorite count: 0
has title: Error injecting: com.google.appengine.devappserver.DevAppServerRunner?
has body: I am not able to deploy my App Engine project locally. mvn clean install results in Build Success but when I execute mvn appengine:devserver, I get the following error: [WARNING] Error injecting: com.google.appengine.devappserver.DevAppServerRunner java.lang.TypeNotPresentException: Type com.google.appengine.devappserver.DevAppServerRunner not present at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:115) at org.eclipse.sisu.space.NamedClass.load(NamedClass.java:46) at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48) at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55) at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70) at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100) at org.eclipse.sisu.plexus.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:133) at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109) at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55) at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68) at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047) at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993) at com.google.inject.Scopes$1$1.get(Scopes.java:59) at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82) at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51) at org.codehaus…
upvote count: 5
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: maven
tagged with: java
type: Question
score: 5

http://stackoverflow.com/a/33728116
type: Answer
score: 11
upvote count: 11
downvote count: 0
answers question: http://stackoverflow.com/q/27137479
has body: The easiest way (for me) is to do a right click in your editor and select "Run ClassName.main()". See screenshot. Using Android Studio version 1.4.1.

http://stackoverflow.com/a/27652035
answers question: http://stackoverflow.com/q/27072340
accepted answer of: http://stackoverflow.com/q/27072340
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
has body: So I checked - it's not asynchronous and uses regular fopen/fwrite. Relevant code from jdk8u: gcLogFileStream::gcLogFileStream(const char* file_name) { _cur_file_num = 0; _bytes_written = 0L; _file_name = make_log_name(file_name, NULL); // gc log file rotation if (UseGCLogFileRotation &amp;&amp; NumberOfGCLogFiles &gt; 1) { char tempbuf[FILENAMEBUFLEN]; jio_snprintf(tempbuf, sizeof(tempbuf), "%s.%d" CURRENTAPPX, _file_name, _cur_file_num); _file = fopen(tempbuf, "w"); } else { _file = fopen(_file_name, "w"); } if (_file != NULL) { _need_close = true; dump_loggc_header(); } else { warning("Cannot open file %s due to %s\n", _file_name, strerror(errno)); _need_close = false; } } void gcLogFileStream::write(const char* s, size_t len) { if (_file != NULL) { size_t count = fwrite(s, 1, len, _file); _bytes_written += count; } update_position(s, len); }

http://stackoverflow.com/comment/42719177
score: 0
comment on: http://stackoverflow.com/q/27096255
type: Comment
type: QuestionComment
has text: Thanks, but the rest of the logs seem to indicate that there weren't any other issues. I can navigate to my-app.elasticbeanstalk.com and the page displays correctly, so doesn't that mean that it was deployed correctly? The only issue I find is that the rest calls get a 404 error. I see " Command CMD-AppDeploy stage 1 completed." and "Command CMD-AppDeploy succeeded" What other information should I look for on the logs?

http://stackoverflow.com/comment/42670722
comment on: http://stackoverflow.com/a/27079754
score: 0
type: Comment
has text: thanx..your code is working but list is displaying fully qulified class name..but i want to initialise show class members from serialized file..actually i've got an assignment in which they privide me a serialised file,show class and ask me to implement a method that will initialise show class using deserialization..please help me..
type: AnswerComment

http://stackoverflow.com/q/27061613
type: Question
answer count: 2
has title: Is it OK to copy and display Oracle's API Javadoc in my UI
tagged with: api
downvote count: 0
has comment: http://stackoverflow.com/comment/42638369
has comment: http://stackoverflow.com/comment/42638030
tagged with: oracle-database
has answer: http://stackoverflow.com/a/27062194
possible better answer: http://stackoverflow.com/a/27061728
favorite count: 0
has answer: http://stackoverflow.com/a/27061728
upvote count: 2
has body: I have a user interface that allows users to do String manipulation (among other things). Behind the scenes, I call static methods (e.g., java.lang.String.toUpperCase(), java.lang.String.toLowerCase(), java.lang.String.regionMatches(), etc.). The UI is intended to be used by non-programming individuals, and displays things like the parameters that they need to provide to do the String manipulation. I wanted to provide some help for the users and was wondering if it is legal to copy and paste from the Oracle Javadoc the descriptions of the parameters and include in my help (e.g., regionMatches) Parameters: toffset - the starting offset of the subregion in this string. other - the string argument. offset - the starting offset of the subregion in the string argument. len - the number of characters to compare. Thanks for any information on this.
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/27062194
tagged with: java
tagged with: javadoc

http://stackoverflow.com/comment/42775670
has text: To start with, you've broken the paint chain, meaning that the component is no longer updating itself correctly...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27138867

http://stackoverflow.com/q/27082097
has comment: http://stackoverflow.com/comment/42674088
upvote count: 1
has body: What is the most efficient way (in Java) to round an integer in 30 increments. My output will be an Integer: Here is my code that returns minutes in integer. long different = endTime.getTime() - startTime.getTime(); int idiff = TimeUnit.MILLISECONDS.toMinutes(different) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(different)); Now I want to round up this integer. For example: Any number &lt;= 30 = round up to 30: Any number between 31 to 60 = round up to 60 Any number between 61 to 90 = round up to 90 Any number between 91 to 120 = round up to 120 Any number between 121 to 150 = round up to 150
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: datetime
has answer: http://stackoverflow.com/a/27082150
has comment: http://stackoverflow.com/comment/42673576
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/27082139
type: Question
answer count: 2
tagged with: routes
has comment: http://stackoverflow.com/comment/42673904
score: 0
has title: Round up in 30 min (nearest half-hour) increments:

http://stackoverflow.com/a/27054282
has comment: http://stackoverflow.com/comment/42625209
score: 0
has comment: http://stackoverflow.com/comment/42625295
type: AcceptedAnswer
has body: Few Changes. 1.) looping was not correct. should be as below, if num &gt; 1 then concatenate in loop. if (num &gt; 1) { for (int i = 0 ; i &lt; num ; i++) { finish = finish.concat(state); } } else { finish = finish.concat(state); } 2.) finish.concat(state) returns a new String, so you have to assign in to the finish variable finish = finish.concat(state); // **remember Strings are immutable** Complete program public class multiConcat { public static void main(String[] args) { int num = 0; String finish = ""; Scanner reader = new Scanner(System.in); System.out.println("Type a word: "); String state = reader.next(); System.out.println("Number of Concatenation: "); num = reader.nextInt(); if (num &gt; 1) { for (int i = 0 ; i &lt; num ; i++) { finish = finish.concat(state); } } else { finish = finish.concat(state); } System.out.println(finish); } } output Type a word: ankur Number of Concatenation: 2 ankurankur Type a word: ankur Number of Concatenation: 1 ankur Type a word: ankur Number of Concatenation: 3 ankurankurankur
answers question: http://stackoverflow.com/q/27054215
has comment: http://stackoverflow.com/comment/42625183
type: Answer
accepted answer of: http://stackoverflow.com/q/27054215
has comment: http://stackoverflow.com/comment/42625282
has comment: http://stackoverflow.com/comment/42625221
has comment: http://stackoverflow.com/comment/42625272

http://stackoverflow.com/a/27120009
type: Answer
has body: This is happening because you are getting only a thumbnail representation of the image.. For getting the image in it's exact size you have to pass an URI as an EXTRA_OUTPUT parameter for camera intent //create file at path where you like File photo = new File(); URI resultUri = Uri.fromFile(photo); intent.putExtra(MediaStore.EXTRA_OUTPUT, resultUri); //this resultUri would be your final image
answers question: http://stackoverflow.com/q/27117908
has comment: http://stackoverflow.com/comment/42741654
has comment: http://stackoverflow.com/comment/42767549
has comment: http://stackoverflow.com/comment/42741664
score: 0
has comment: http://stackoverflow.com/comment/42765767
has comment: http://stackoverflow.com/comment/42746119
has comment: http://stackoverflow.com/comment/42764749

http://stackoverflow.com/comment/42763324
has text: The form has no action
comment on: http://stackoverflow.com/q/27131420
type: Comment
type: QuestionComment
score: 0

final
tags question: http://stackoverflow.com/q/27095847
tags question: http://stackoverflow.com/q/27133054
tags question: http://stackoverflow.com/q/27103651
tags question: http://stackoverflow.com/q/26997649
type: Tag
tags question: http://stackoverflow.com/q/27036185
tags question: http://stackoverflow.com/q/27092830
tag name: final
tags question: http://stackoverflow.com/q/27078702

http://stackoverflow.com/comment/42591268
type: QuestionComment
has text: return convertView instead linear in getView();
score: 0
comment on: http://stackoverflow.com/q/27035156
type: Comment

http://stackoverflow.com/comment/42780706
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27141248
score: 0
has text: The problem is that once the server started, a process called java.exe will run, and the ram will increase by time, when it reach to the limit of the java virtual memory. The server will stop. I have no idea why, I tried debug but I found nothing weird.

http://stackoverflow.com/comment/78537888
has text: Could not delete the test folders but my system is windows there is there any file permission kind of thing or those files are opened somewhere behind the scenes that I don't know, and those files are jar files.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27147432

http://stackoverflow.com/a/29165107
has body: There are some alternatives that could solve your problem: Open the Test Object Map; select from the map the object that represents the document document_eBenefitsHome; modify the .url property using regular expression, so that the URLs of the two pages you cited in your question match the regex. Find dinamically the document object using the find method. Once the page containing the link you want to click was fully loaded, try to use this code to find the document: find(atDescendant(".class", "Html.HtmlDocument"), false). The false boolean value allow the find method to search also among object that are not previously recorded.
answers question: http://stackoverflow.com/q/27043345
score: 0
type: Answer

http://stackoverflow.com/a/27063234
type: Answer
has body: No you cannot assign a thread to a specific core in Java (Java Multithreading - Assign threads to processor cores) Generally you can expect the Operating system to more or less optimally manage the runtime of the threads. This includes e.g. prevention of starvation.
answers question: http://stackoverflow.com/q/27061762
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/a/27094170
type: Answer
has body: You should try this: private void render(){ BufferStrategy bs = this.getBufferStrategy(); if(bs == null){ this.createBufferStrategy(3); bs = this.getBufferStrategy(); // reassign bs } Graphics g = bs.getDrawGraphics(); g.dispose(); bs.show(); }
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/27094151
downvote count: 0
has comment: http://stackoverflow.com/comment/42694224

http://stackoverflow.com/comment/42749954
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27124202
has text: possible duplicate of [Play audio file from the assets directory](http://stackoverflow.com/questions/3289038/play-audio-file-from-the-assets-directory)

http://stackoverflow.com/comment/42785549
type: QuestionComment
comment on: http://stackoverflow.com/q/27144124
has text: Could you use firebug to check if the contentType header has indeed been set properly.
score: 1
type: Comment

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/27150141
tags question: http://stackoverflow.com/q/27037430
type: Tag
tags question: http://stackoverflow.com/q/27040185
tags question: http://stackoverflow.com/q/27026107
tags question: http://stackoverflow.com/q/27046580

http://stackoverflow.com/comment/42748997
has text: If you dont know how big the .db file is, dont use an array of string, use an ArrayList
type: QuestionComment
comment on: http://stackoverflow.com/q/27124283
score: 0
type: Comment

http://stackoverflow.com/comment/42764222
type: QuestionComment
comment on: http://stackoverflow.com/q/27132169
type: Comment
has text: Oh, I guess we should ask: did you roll back those Eclipse.ini changes you made? Because those resources are shared, and, especially on Windows, you are going to get resource contention fast if Eclipse is grabbing all the PermGen or whatever.
score: 0

nexus
type: Tag
tags question: http://stackoverflow.com/q/27147413
tags question: http://stackoverflow.com/q/27015933
tag name: nexus

http://stackoverflow.com/a/27136012
has body: Use cache. Execute request with some cache key spiceManager.execute(request, "your_cache_key", DurationInMillis.ALWAYS_EXPIRED, new AccessTokenResponseRequestListener()); and in listener remove response on this request from cache if it returned successfully before you switched to another activity as you do not want to cache the account information as per your requirement. @Override public void onRequestFailure(SpiceException e) { .... spiceManager.removeDataFromCache(AccessTokenResponse.class); .... } @Override public void onRequestSuccess(AccessTokenResponse accessToken) { if (accessToken == null) { return; } .... spiceManager.removeDataFromCache(AccessTokenResponse.class); .... } In onStart try to get cached response if you switched to another activity and now come back to the previous activity. This return response which arrive after you call spiceManager.shouldStop(). Otherwise return null. spiceManager.getFromCache(AccessTokenResponse.class, "your_cache_key", DurationInMillis.ALWAYS_RETURNED, new AccessTokenResponseRequestListener());
accepted answer of: http://stackoverflow.com/q/27092185
answers question: http://stackoverflow.com/q/27092185
type: Answer
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/42554863
comment on: http://stackoverflow.com/q/27012833
score: 0
type: Comment
type: QuestionComment
has text: TAbstractReportView is my custom class from project main, TAbstractViewModule is also custom class from project A and I think that is the problem. Maven complains about class from other project, but is strange becouse other libs works fine, and even A project refers to some libs and compiles fine.

http://stackoverflow.com/a/27033074
answers question: http://stackoverflow.com/q/27032650
score: 0
type: AcceptedAnswer
type: Answer
has body: Dim skey As SecretKeySpec = New SecretKeySpec(key, "DESede") Of course, getting this to work properly depends on how you translated the SecretKeySpec definition.
accepted answer of: http://stackoverflow.com/q/27032650

http://stackoverflow.com/comment/42733052
comment on: http://stackoverflow.com/q/27115142
has text: Learn to use the `BigDecimal` class instead of `double`.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/a/27047125
type: Answer
answers question: http://stackoverflow.com/q/27046901
has body: Highlight and Overview already inherits from Fragment,so why are u casting them to fragments again? I will suggest you do it this way. public void selectFrag(View view){ Fragment fr; if (view.getId() == R.id.txt_highlite) { fr = new Highlight(); } else{ fr = new Overview(); } FragmentManager fm = getFragmentManager(); FragmentTransaction fragmentTransaction = fm.beginTransaction(); fragmentTransaction.replace(R.id.place_holder, fr); fragmentTransaction.commit(); } and ensure your Fragment importations are consistently either from the Support library or otherwise
score: 0

http://stackoverflow.com/comment/42760076
type: AnswerComment
type: Comment
has text: No I dont think thats the solution to the problem, it could go through and produce x amount of arrays... It was my reason why I opted for a list array as it will need to be dynamic.
comment on: http://stackoverflow.com/a/27130593
score: 0

http://stackoverflow.com/comment/42677076
type: AnswerComment
has text: Ok thanks that makes more sense just as a side not how would you recommend stopping this class/method with a boolean value you change etc?
type: Comment
comment on: http://stackoverflow.com/a/27083738
score: 0

http://stackoverflow.com/a/27063403
type: Answer
has comment: http://stackoverflow.com/comment/42640810
downvote count: 1
answers question: http://stackoverflow.com/q/27063294
score: -1
upvote count: 0
has body: I personally suggest you to go for GridView and customize this as per your need GridView Hope this helps.

http://stackoverflow.com/comment/42594047
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27035498
has text: yes I use double "\" (in other case code not compile)

http://stackoverflow.com/q/27007995
type: AnsweredQuestion
has body: My application displays dates in different formats based on user settings. I want to test that it displays correct date format. I have the displayed date as a string (2014/12/31). I do not want to verify the actual date, but just the format. Ex: When user selects yyyy/dd/MM format, it should display it in that format.
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/42544436
has comment: http://stackoverflow.com/comment/42545045
type: Question
possible better answer: http://stackoverflow.com/a/27008075
has answer: http://stackoverflow.com/a/27008156
tagged with: javascript
tagged with: date
has title: how to compare date format
score: 0
has answer: http://stackoverflow.com/a/27008075
upvote count: 1
has comment: http://stackoverflow.com/comment/42545000
has answer: http://stackoverflow.com/a/27008189
favorite count: 0
has comment: http://stackoverflow.com/comment/42544490
has answer: http://stackoverflow.com/a/27008043
accepted answer: http://stackoverflow.com/a/27008043
tagged with: robotium
answer count: 4
has comment: http://stackoverflow.com/comment/42544577

http://stackoverflow.com/q/27027330
tagged with: performance
has comment: http://stackoverflow.com/comment/42577762
has title: Java : performance of the instance without variable
upvote count: 3
has comment: http://stackoverflow.com/comment/42577920
downvote count: 2
answer count: 3
has body: I had a class like this : class Test { public static test getInstance() { return new test() } public void firstMethod() { //do something } public void secondMethod() { //do something } public void thirdMethod() { //do something } } in the another class if we calling Test.getInstance().methodName() several times with different method, what happening? Which one will be faster and using low memory in following codes? Test.getInstance().firstMethod() Test.getInstance().secondMethod() Test.getInstance().thirdMethod() or Test test = Test.getInstance(); test.firstMethod(); test.secondMethod(); test.thirdMethod();
has answer: http://stackoverflow.com/a/27027698
has answer: http://stackoverflow.com/a/27027384
favorite count: 0
has comment: http://stackoverflow.com/comment/42577841
has comment: http://stackoverflow.com/comment/42577845
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42577768
score: 1
has comment: http://stackoverflow.com/comment/42577817
has comment: http://stackoverflow.com/comment/42577958
tagged with: java
has answer: http://stackoverflow.com/a/27027760
type: Question

http://stackoverflow.com/comment/42790454
comment on: http://stackoverflow.com/q/27144443
type: QuestionComment
type: Comment
has text: What if current day's time 00:30 already passed? It would never work....
score: 0

http://stackoverflow.com/q/27088398
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/27088537
has body: I found it hard to formulate this question. Basically I want some new code wrap around the old one. I am used to do this in some editors by simply selecting the old, type the new and once I am done it will automatically replace the old code inside the new. Here is what I mean: int i = 5; Now I want to print this but I forgot to write System.out.prinln() first. int // oeps I forgot that I wanted to System.out.println this statement Now I could of course delete int, write the System.out.println() and write int again. But I don't want that. I want the it remembers what I (over)wrote and put it back as parameter. Here is it visually: Select the old: Start typing and replace the old by doing so: Almost finished: Here is where the magic happens, the old line appears as paramater input. This is what I want, but it does not work like this automatically: Can Intellij already do this? I often start by typing something which is wrapped up by some other in-line code later.
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27089912
possible better answer: http://stackoverflow.com/a/27088537
has title: Select some code, overwrite it by some method name and automatically input previously selected code when finished as parameter [in Intellij]
has comment: http://stackoverflow.com/comment/42684459
accepted answer: http://stackoverflow.com/a/27089912
has comment: http://stackoverflow.com/comment/42684569
has comment: http://stackoverflow.com/comment/42684433
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42684510
tagged with: java
has comment: http://stackoverflow.com/comment/42684415
type: Question

http://stackoverflow.com/comment/42568479
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27021910
has text: @eis The context matters: but basically a `get` that might return null is as of Java 8 becoming bad style. Maybe not if there would have been an `?:` orElse operator. (BTW really scary is JavaScript, see the internals of jQuery. Using returnal of undefined and such niceties.)

http://stackoverflow.com/a/27122617
answers question: http://stackoverflow.com/q/27053097
score: 0
has body: I suppose you set only one side of the relationship, and not both. As you have a bidirectional relationship you should set them both before persisting/merging, like: userLegalName.setUser(user); user.setUserLegalName(userLegalName); entityManager.persist(userLegalName); entityManager.persist(user);
type: Answer

http://stackoverflow.com/a/27083378
accepted answer of: http://stackoverflow.com/q/27051271
downvote count: 0
has comment: http://stackoverflow.com/comment/42724223
answers question: http://stackoverflow.com/q/27051271
upvote count: 2
type: AcceptedAnswer
has body: To me a java Class with individual cursor record fields , as it members and a Array of instances of this class seems the proper way to represent a plsql CURSOR. I disagree. If you have a stored function or procedure that either returns a ref cursor or has a ref cursor as an OUT parameter, the ref cursor comes out of JDBC as a ResultSet. So, if it were possible to call a stored procedure with a SYS_REFCURSOR parameter, I'd suspect that a ResultSet would be what you would need to pass. In fact, my suspicions are confirmed. If you take a look at Oracle's extension to CallableStatement, OracleCallableStatement, it inherits a setCursor(int, ResultSet) method from its superinterface OraclePreparedStatement. Therefore, you could cast the CallableStatement to OracleCallableStatement, call the setCursor method, and away you go. Except this approach doesn't actually work. If you try calling setCursor on an OracleCallableStatement, you will get an exception java.sql.SQLException: Unsupported feature. You can try callingsetObject with a ResultSet, but you will only get another java.sql.SQLException: Invalid column type exception. Here's a test class you can run to verify either case. It calls one stored procedure to get a ref cursor (and hence a ResultSet) and then tries to pass it to the other: import java.sql.*; import oracle.jdbc.OracleTypes; import oracle.jdbc.OracleCallableStatement; public class JavaRefCursorTest { public static void main(String[] args) throws Exception { Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:XE", "user", "password"); try (CallableStatement cstmt1 = conn.prepareCall( "{ call java_ref_curs_test.get_ref_cursor(?)}")) { cstmt1.registerOutParameter(1, OracleTypes.CURSOR); cstmt1.execute(); try (ResultSet rSet = (ResultSet)cstmt1.getObject(1)) { try (CallableStatement cstmt2 = conn.prepareCall( "{ call java_ref_curs_test.print_refcursor(?)}")) { // Uncomment the next line to call setCursor: // ((OracleCallableStatemen…
type: Answer
score: 2

http://stackoverflow.com/comment/42789958
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27132622
score: 0
has text: You need to know that why? And of course if the server rejects requests you can't know *anything* further about the server from the client end.

http://stackoverflow.com/a/27028810
answers question: http://stackoverflow.com/q/27027792
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/42615840
has body: I'm going to shorten your example because you have a lot of things going on that I don't think really apply to the question you've asked. enum constants are basically just public static final instances of the enum class. Therefore you are able to declare abstract methods and override them on each constant. enum ClassAEffect { A { @Override void apply(ClassA theA) { theA.effectA(); } }, B { @Override void apply(ClassA theA) { theA.effectB(); } }, C { @Override void apply(ClassA theA) { theA.effectC(); } }; abstract void apply(ClassA theA); } class ClassD { List&lt;ClassAEffect&gt; effects = new ArrayList&lt;&gt;(); void add(ClassAEffect effect) { effects.add(effect); } void apply(List&lt;ClassA&gt; list) { for(ClassA theA : list) for(ClassAEffect effect : effects) effect.apply(theA); } } ClassD theD = new ClassD(); theD.add(ClassAEffect.B); theD.apply(Arrays.asList(new ClassA())); enum may or may not be appropriate. For example if your design demanded effects for multiple classes, it may be much better to use regular interfaces. interface Effect&lt;T&gt; { void apply(T theT); } Effect&lt;ClassA&gt; classAEffectA = new Effect&lt;&gt;() { @Override public void apply(ClassA theA) { theA.effectA(); } }; As another answer notes, this is basically like command pattern and Wikipedia contains a Java example strikingly similar to your own. Also, in Java 8, you may use method references directly. class ClassD implements Consumer&lt;List&lt;ClassA&gt;&gt; { List&lt;Consumer&lt;ClassA&gt;&gt; effects = new ArrayList&lt;&gt;(); void add(Consumer&lt;ClassA&gt; effect) { effects.add(effect); } @Override public void accept(List&lt;ClassA&gt; theList) { for(ClassA theA : theList) for(Consumer&lt;ClassA&gt; effect : effects) effect.accept(theA); } } ClassD theD = new ClassD(); // ClassA::effectB implicitly creates a Consumer&lt;ClassA&gt; // that calls effectB on the ClassA that is passed to it theD.add(ClassA::effectB); theD.accept(Arrays.asList(new ClassA()));
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27027792

http://stackoverflow.com/comment/44040769
type: AnswerComment
comment on: http://stackoverflow.com/a/27817365
type: Comment
has text: this works for my situation, when only the plugin.xml had changes
score: 0

http://stackoverflow.com/comment/42529543
comment on: http://stackoverflow.com/q/26999647
score: 0
type: Comment
type: QuestionComment
has text: Stop using scriptlets. Use servlets as controller instead.

http://stackoverflow.com/comment/42742607
type: QuestionComment
has text: @Vince Emigh Can you explain why. I'm looking for something in-depth.
comment on: http://stackoverflow.com/q/27120079
score: 0
type: Comment

http://stackoverflow.com/q/27003994
tagged with: encryption
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27004228
has title: Decipher encrypted text file
answer count: 1
score: 0
has body: I have deciphering method that should open a test file with encrypted text, then read and decipher each line of text that I read in from the input file. The text file is called mystery.txt. I can get the method to work when only inputting single characters but I can't get it to work where I open the .txt file and decipher line by line. Dechiphering method: public static String cipherDecipherString(String text) { // These are global. Put here for space saving private static final String crypt1 = "cipherabdfgjk"; private static final String crypt2 = "lmnoqstuvwxyz"; // declare variables int i, j; boolean found = false; String temp="" ; // empty String to hold converted text readFile(); for (i = 0; i &lt; text.length(); i++) // look at every chracter in text { found = false; if ((j = crypt1.indexOf(text.charAt(i))) &gt; -1) // is char in crypt1? { found = true; // yes! temp = temp + crypt2.charAt(j); // add the cipher character to temp } else if ((j = crypt2.indexOf(text.charAt(i))) &gt; -1) // and so on { found = true; temp = temp + crypt1.charAt(j); } if (! found) // to deal with cases where char is NOT in crypt2 or 2 { temp = temp + text.charAt(i); // just copy across the character } } return temp; } My readFile method: public static void readFile() { FileReader fileReader = null; BufferedReader bufferedReader = null; String InputFileName; String nextLine; clrscr(); System.out.println("Please enter the name of the file that is to be READ (e.g. aFile.txt: "); InputFileName = Genio.getString(); try { fileReader = new FileReader(InputFileName); bufferedReader = new BufferedReader(fileReader); nextLine = bufferedReader.readLine(); while (nextLine != null) { System.out.println(nextLine); nextLine = bufferedReader.readLine(); } } catch (IOException e) { System.out.println("Sorry, there has been a problem opening or reading from the file"); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { System.out.println("An error occurre…
type: UnansweredQuestion

http://stackoverflow.com/q/26994464
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26998831
tagged with: java
type: Question
tagged with: jakarta-ee
score: 0
answer count: 1
has title: Why does managed-bean method invokes before filter invokation in post request
has body: I have a filter which's used to set character-encoding filter. web.xml: encodingFilter ua.com.winforce.online.site.http.filter.EncodingFilter encodingFilter *.html encodingFilter * The filter itself: public class EncodingFilter implements Filter { private static final String ENCODING = "UTF-8"; FilterConfig config; public void init(FilterConfig filterConfig) throws ServletException { this.config = filterConfig; } public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { request.setCharacterEncoding(ENCODING); filterChain.doFilter(request, response); } public void destroy() { } } A piece of markup user submit a form: <h:form> <h:commandLink styleClass="ruski-button green-g full-width" action="#{supportController.save}" > </h:commandLink> </h:form> The thing is the filter's method doFilter invokes before the supportController.save method when the post request comes. But I need to set character encoding before supportController.save invokation. How can I do that?

http://stackoverflow.com/comment/42608102
comment on: http://stackoverflow.com/q/27043582
score: 0
type: Comment
has text: It extends JComponent
type: QuestionComment

http://stackoverflow.com/comment/42535196
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27000094
has text: Quality answers guys, really informative and helpful can't thank you enough. I'd up vote you all but I don't have enough reputation haha so yeah thanks again.
score: 0

http://stackoverflow.com/comment/42729721
score: 0
comment on: http://stackoverflow.com/q/27113045
type: QuestionComment
type: Comment
has text: You may want a [Guava `Striped`](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/util/concurrent/Striped.html), which can be more efficient here...

http://stackoverflow.com/a/27647628
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/47943923
downvote count: 0
answers question: http://stackoverflow.com/q/27066437
type: Answer
has body: Now I recognize that my question was about testing an API. The best solution for it is to use Postman. The tool is really easy to learn and request results are in a better form.

http://stackoverflow.com/comment/42660791
has text: if you mandate parens around replaced subsets, you _might_ be able to get away with naive substitution, we would need to know more about the input possibilities. if not a parser is a sure fire, if complicated, way to solve the problem.
type: Comment
comment on: http://stackoverflow.com/q/27074529
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42546229
has text: please provide the exception logs.
comment on: http://stackoverflow.com/q/27009151
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42634221
type: AnswerComment
comment on: http://stackoverflow.com/a/27058643
score: 0
type: Comment
has text: Gave it a try again and it worked this time .. think i missed something last time .. thanks a lot @M. Deinum for simple and elegant solution.

http://stackoverflow.com/comment/42732935
score: 0
comment on: http://stackoverflow.com/q/27114909
type: Comment
has text: Thanks a lot! doesn't help tho
type: QuestionComment

http://stackoverflow.com/comment/126323244
score: 0
type: Comment
has text: How do you catch this error? I want to check if the mediaPlayer == null due to a faulty uri, then do stuff.
comment on: http://stackoverflow.com/a/27129785
type: AnswerComment

http://stackoverflow.com/q/27126455
upvote count: 0
has answer: http://stackoverflow.com/a/27128282
favorite count: 0
has answer: http://stackoverflow.com/a/27126932
tagged with: regex
has comment: http://stackoverflow.com/comment/42754880
answer count: 4
has comment: http://stackoverflow.com/comment/42756065
type: UnansweredQuestion
downvote count: 1
has body: I'm trying to validate the given string. It should allow (a-z, white space between words,commas,dots only). I tried this but it doesn't work: final String name = "/^[a-z]+(\s+[a-z]+)*$/i"; Pattern pattern = Pattern.compile(name ); Matcher matcher = pattern.matcher("Ravi is a java developer"); System.out.println("***********"+matcher.matches()); please suggest to me. Thanks in advance.
has answer: http://stackoverflow.com/a/27126646
has title: Java Regex to Validate Full Name allow only Spaces ,Letters,commas, dots in java
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/27126598
has comment: http://stackoverflow.com/comment/42752735
type: Question

http://stackoverflow.com/comment/42598851
comment on: http://stackoverflow.com/a/27039597
type: Comment
has text: why oncreate is hidden by catch? i mean every time, it throws an explicit exception?!
score: 0
type: AnswerComment

http://stackoverflow.com/a/27073631
type: Answer
upvote count: 2
has body: You can put an eclipse.ini file next to the eclipse.exe file. This works for Eclipse itself but also for an RCP application. In it, you can specify -vm &lt;vm-path&gt; (search with Google for eclipse.ini and vm and you'll find plenty of information)
answers question: http://stackoverflow.com/q/27073367
score: 2
has comment: http://stackoverflow.com/comment/42660094
downvote count: 0

http://stackoverflow.com/a/27059847
has comment: http://stackoverflow.com/comment/42636453
answers question: http://stackoverflow.com/q/27059174
downvote count: 0
type: Answer
has body: The implementation language has little impact on the scalability of the solution when compared to the skill of the developers with the language in question, and the design of the solution. The two main scaling challenges when working on a chat program are 1) the C10K problem and 2) scaling real time notifications in a social graph, which is O(numPeople*numPeopleSubscribedToPerson*numDevicesPerPerson*rateOfInteractions). Researching facebook, twitter and gmail designs will help you to understand problems the with scaling the rate of message growth and how to model a solution for the web (hint: use push/long polling web techniques and favoring asynchronous solutions over blocking synchronous ones is the way to go). This link is a good start How does facebook, gmail send the real time notification? and Varnish documents their solution to the C10K problem here. As far as Java Sockets go, they are fine. However the common gotcha is with the thread handling. Avoid allocating one thread per socket. That will hit scaling problems at around 1-10k users depending on a few factors including OS configuration. When using Java, go with Java NIO and make sure that the thread usage does not grow with the number of users logged in to the server. The advantage of languages like node.js is that they advocate these best practices from the beginning, where as good asynchronous techniques were late to the game in the Java world. But they do exist.
upvote count: 2
score: 2

http://stackoverflow.com/comment/42547027
score: 0
has text: I would look in the war and/or in target - that will provide a clue as to what extra stuff is accumulating.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27009748

http://stackoverflow.com/comment/42659696
type: Comment
comment on: http://stackoverflow.com/q/27049059
type: QuestionComment
score: 0
has text: Please remember to choose a best answer

http://stackoverflow.com/a/27065300
has body: Use generics: class UserCacheLoader extends CacheLoader&lt;Long, User&gt; { @Override public User load(Long key) throws Exception { // ??? } } store(User) can be implemented with Cache.put, just like you'd expect. getKeys() can be implemented with cache.asMap().keySet().
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27065149
type: Answer
answers question: http://stackoverflow.com/q/27065149
downvote count: 0
score: 1

http://stackoverflow.com/comment/42871548
has text: Do you mean your tiff-to-pdf converter produces invalid PDF, however other online converters produce good PDFs? Did you contact viewer.js support?
comment on: http://stackoverflow.com/q/27143506
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27034042
has body: Executors.newFixedThreadPool(3).submit(() -&gt; 1); //Callable Executors.newFixedThreadPool(3).submit(() -&gt; {doSmth();}); //Runnable
type: AcceptedAnswer
upvote count: 13
accepted answer of: http://stackoverflow.com/q/27033976
type: Answer
answers question: http://stackoverflow.com/q/27033976
downvote count: 0
score: 13
has comment: http://stackoverflow.com/comment/95129009

http://stackoverflow.com/comment/127931581
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/72417666
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).

http://stackoverflow.com/comment/42528713
type: AnswerComment
has text: ohhh, yeees! I am so dumb to ignore the "if" statement there. So I think in this case it should be `divisor < number` to make it work although it is not necessary... But really thanks for the detailed explanation! :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26999025

http://stackoverflow.com/comment/42664525
type: Comment
has text: The "beautiful" series feature nice books, but I would not recommend it as a starting point.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27076767

http://stackoverflow.com/comment/72323696
has text: Another suggestion. Don't run 64bit version (your project should be very large for this). 32bit version works faster and eats less memory. Hope all this will help.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/42178740
type: Comment

jpql
tags question: http://stackoverflow.com/q/27061162
tag name: jpql
tags question: http://stackoverflow.com/q/27067190
tags question: http://stackoverflow.com/q/27095581
tags question: http://stackoverflow.com/q/27050989
type: Tag
tags question: http://stackoverflow.com/q/27117840

http://stackoverflow.com/comment/42722387
score: 0
type: QuestionComment
type: Comment
has text: You have apparently used some sort of JSON kit to produce a "POJO", but you don't understand what you're doing or how JSON works. You're best advised to use a simpler JSON kit that produces something like JSONObjects and JSONValues until you "get" JSON.
comment on: http://stackoverflow.com/q/27108965

http://stackoverflow.com/comment/42692394
type: Comment
has text: Thank you for the reply. But when i don't set the images programmatically, [just set the image in the layout], it works perfectly fine. Also the size of the images are not too big, it is in terms of kilobytes. Still wondering why this is happening
comment on: http://stackoverflow.com/a/27093242
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42655557
comment on: http://stackoverflow.com/a/27068016
score: 0
type: Comment
type: AnswerComment
has text: Hey, sorry, I don't have any specific recommendation because there's a lot of code there (in your link), so I couldn't follow what was actually changing when a user deletes a recent folder. But I think some basic debugging will probably allow you to find the issue. Just attach a debugger and inspect the array or list that you passed to the adapter and see if its content changes as you expect. Good luck :)

http://stackoverflow.com/q/27104065
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27104294
upvote count: 0
has title: How do i process Request & Response from Gwt to PHP and Vice Versa?
score: -1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27104294
tagged with: php
tagged with: gwt
type: AnsweredQuestion
has body: RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url)); try { builder.sendRequest(requestdata, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { int result = response.getStatusCode(); System.out.println(result); } @Override public void onError(Request request, Throwable exception) { } }); } catch (RequestException ex) { Logger.getLogger(MainEntryPoint.class.getName()).log(Level.SEVERE, null, ex); } This is My Code to Send Request . How Can i process Request and Response According to This Code
tagged with: java

http://stackoverflow.com/comment/42547114
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27009748
has text: unzip the war and look for suspicious things (directories with lots of files, or huge files).

http://stackoverflow.com/a/27034083
answers question: http://stackoverflow.com/q/27034010
score: 0
has body: Try to check EditText value before use it : if(value1.getText().toString().trim().length()&gt;0){ val1 = Integer.parseInt(value1.getText().toString()); } if(value2.getText().toString().trim().length()&gt;0){ val2 = Integer.parseInt(value2.getText().toString()); }
type: Answer
has comment: http://stackoverflow.com/comment/42596275

http://stackoverflow.com/q/27072961
tagged with: data-structures
has body: So I have created a class for my generic tree and the Node class that goes along with it. The classes are as follows: public class DirectoryTree&lt;E&gt; implements Serializable { protected Node&lt;E&gt; root; protected Node&lt;E&gt; child; public DirectoryTree() { root = null; }//end constructor protected DirectoryTree(Node&lt;E&gt; root) { this.root = root; } public boolean isLeaf() { return root.children == null; } public DirectoryTree&lt;E&gt; getTree() { if (root != null) { return new DirectoryTree&lt;E&gt;(root); }//end if else { return null; }//end else } public Node&lt;E&gt; getRoot() { return root; } public Node&lt;E&gt; getChild() { return child; } public String toString() { return null; }//end toString() } class Node&lt;E&gt; implements Serializable { protected Node&lt;E&gt; parent; protected E data; protected ArrayList&lt;Node&lt;E&gt;&gt; children; public Node(E data) { this.data = data; children = new ArrayList&lt;Node&lt;E&gt;&gt;(); } public Node&lt;E&gt; getParent() { return parent; } public ArrayList&lt;Node&lt;E&gt;&gt; getChildren() { return this.children; } public int getNumberOfChildren() { return getChildren().size(); } public boolean hasChildren() { return getChildren().size() &gt; 0; } public void addChild(Node&lt;E&gt; child) { int counter = 0; for (int i = 0; i &lt; children.size(); i++) { if (child == children.get(i)) { System.out.println("directory exists"); counter++; } } if (counter == 0) { children.add(child); } else { } } public E getData() { return this.data; } public String toString() { return data.toString(); } } I am wondering whether my 2 classes are set up correctly for a generic tree. Also, I am not sure how to even implement this tree into a program. My program is supposed to be a program that creates directories and files and puts them in the tree. My root directory must be named /. So far my main class is (i just started it): public class Driver { public static void main(String[] args) { Scanner in = new Scanner(System.in);…
has comment: http://stackoverflow.com/comment/42659194
score: 0
tagged with: directory
has comment: http://stackoverflow.com/comment/42659212
tagged with: generics
accepted answer: http://stackoverflow.com/a/27073941
has answer: http://stackoverflow.com/a/27073941
type: Question
tagged with: tree
has title: Trouble Implementing Generic Tree
type: AnsweredQuestion
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/42659708

http://stackoverflow.com/a/27042497
score: 0
answers question: http://stackoverflow.com/q/27030964
type: Answer
has body: I would first try to derive all the information, that is still left in the chunks, and then use some kind of (intelligent) brutforce. For the following I assume that every chunk is 2 characters wide, and that .,!,? are used at the end of the sentence, commas and semicolons within the sentence. After a comma or semicolon, there is a space. I further assume that all sentences that are considered here, can be cut into 2 character wide chunks. May x be an arbitrary character, and _ denotes a space. Let's take a look at what we know: x_, if the space is at the end, the chunk forms a word ending, or a word that consists of only one character. X_ with an uppercase letter, is also a candidate for the sentence's first word, with exception of I_, or other one char words, that are written in capital letters and can occur in the middle of the sentence. _x, if the space is at the beginning, the character is a word prefix. It is not the first chunk of the sentence, and not the last chunk. x!, x?, x. and combinations with other punctuation marks that delimit a sentence are the last chunk of the sentence x´ forms a genitive for words ending with an s sound, so this is another word ending, if x has an s sound. x´ if x does not have a s sound, it forms a regular genitive and a furter s_ chunk is to be expected. ´s is an wordending of a word in genitive case. NOTE I've applied these apostrophe rules only to genetive, but they are cases like they're and so on. You have to create rules for these cases to, if you want to include them. Maybe it would be easier to avoid these short forms for the beginning. number of words is number of _ + 1, but only if there are spaces after commas and semicolons! Maybe can add more rules, e. g. a_ or _a has a rather chance of forming a word on its own, but it could also be just a word end or start. After you have all the rules, apply the ones that are bullet proof. Find the last chunk of the sentences by use of the puctuation rule. Find the word beginnin…

http://stackoverflow.com/comment/42674580
type: Comment
comment on: http://stackoverflow.com/a/27082017
has text: @shekharsuman you started by insulting the OP ('poor design'), that may have led to some unfavorable thought. But the net vote was 0 when you deleted it, so I'm not sure what all the fuss is about.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27118220
score: -2
tagged with: arrays
has title: Move one element of an 2d array to an empty index using java
answer count: 1
has comment: http://stackoverflow.com/comment/42738513
favorite count: 0
has answer: http://stackoverflow.com/a/27118315
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42738496
has comment: http://stackoverflow.com/comment/42738407
has body: I am attempting to move an element in a 2d array from its current position to a spot that is equal to ' '. for (int r = 0 ; r &lt; tissue.length ; r++ ){ for (int s = 0 ; s &lt; tissue[i].length ; s++ ){ if ((isSatisfied(tissue, row , column , threshold) == false){ int totalMoves = 0; totalMoves++; for (int t = 0 ; t &lt; tissue.length ; t++ ){ for (int u = 0 ; u &lt; tissue[i].length ; u++ ){ if ([t][u] == ' '){ [r][s] = [t][u]; } } } } } }
tagged with: 2d
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/42738522
type: Question
has comment: http://stackoverflow.com/comment/42738510

http://stackoverflow.com/comment/42644305
score: 0
has text: So I assume stmt.setString should be assigned upto 10 as well. eg: stmt.setString(1,name1); stmt.setString(2,name2);....stmt.setString(10,name10);
type: Comment
comment on: http://stackoverflow.com/a/27065205
type: AnswerComment

http://stackoverflow.com/comment/42596819
comment on: http://stackoverflow.com/a/27038261
type: AnswerComment
score: 0
has text: Haresh thanks for your thought, but unfortunately nothing changed although i addes the if conditions and intialized result textview.
type: Comment

http://stackoverflow.com/comment/42782541
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27142785
has text: I think this was very basic question and most of people not aware of Jsoup library as it not that much popular, which is third party.

http://stackoverflow.com/comment/42579094
type: Comment
type: QuestionComment
has text: 1) Find the index of the desired country in the first array. 2) Use the index on the second array. 3) Profit!
score: 1
comment on: http://stackoverflow.com/q/27028033

http://stackoverflow.com/a/26998731
type: Answer
downvote count: 0
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26998680
accepted answer of: http://stackoverflow.com/q/26998680
upvote count: 5
has body: finish() will call the finish() method on your class. super.finish() will call the finish() method on your parent class. Unless your are overriding the finish() method in your Activities (which you shouldn't), the two will do the exact same thing.

http://stackoverflow.com/comment/121186478
has text: Any updates on this feature?
score: 0
comment on: http://stackoverflow.com/q/27136037
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42544700
comment on: http://stackoverflow.com/q/27004342
score: 1
has text: What do you think `new Scanner(name)` does? You may want to take a look at the documentation for the relevant constructor and see what it says.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27015856
answer count: 0
has title: Error while executing maven project
type: UnansweredQuestion
tagged with: maven
type: Question
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/42558584
has comment: http://stackoverflow.com/comment/42557228
score: 0
has comment: http://stackoverflow.com/comment/42560022
tagged with: jpa
has comment: http://stackoverflow.com/comment/42557166
has comment: http://stackoverflow.com/comment/42562690
tagged with: spring
has body: I create a maven project HTTP ERROR: 503 Problem accessing /. Reason: SERVICE_UNAVAILABLE Powered by Jetty:// I got the following error org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://activemq.apache.org/schema/core] Offending resource: ServletContext resource [/WEB-INF/spring/app-jpa-config.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) <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:jms="http://www.springframework.org/schema/jms" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <context:component-scan base-package="com.myapp.entities.*" /> <tx:annotation-driven transaction-manager="transactionManager" /> <amq:broker id="broker" useJmx="false" persistent="false"> <amq:transportConnectors> <amq:transportConnector uri="tcp://localhost:0" /> </amq:transportConnectors> </amq:broker> org.hibernate.dialect.PostgreSQLDialect false false update after_transaction com.myapp.entities </beans>

http://stackoverflow.com/comment/42734187
type: AnswerComment
has text: How would I do the code to check if an argument was passed? If doing an if statement it throws this exception if (args[0]!=null){ filename = args[0]; }
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27115564

http://stackoverflow.com/a/27152026
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27151146
has body: Using the trace command usually gives you the answer why certain dependency can't be downloaded. In your case it will look like: http://foo.address.com:8081/artifactory/repo/org/eclipse/persistence/javax.persistence/2.0.3/javax.persistence-2.0.3.pom?trace Once you will run it you will be able to see that this artifact is not found in the eclipse repo, nor in maven central. 2.0.5 works, BTW.
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/42799883

http://stackoverflow.com/a/27159677
has comment: http://stackoverflow.com/comment/42918084
downvote count: 0
type: Answer
score: 2
has body: I don't know Scala, but in Java varargs is just an array. So in Java it will work this way, with one warning: package tests.StackOverflow.q27052394; import java.util.Arrays; public class Runner { public interface Bar { public abstract void bar(java.lang.String ... ss); } public static class Baz implements Bar { public void bar(java.lang.String[] array) { System.out.println(Arrays.toString(array)); } } public static void main(String[] args) { Bar b = new Baz(); b.bar("hello", "world"); } } May be if you can fool Scala the same way, you will overcome the bug.
upvote count: 2
answers question: http://stackoverflow.com/q/27052394

http://stackoverflow.com/q/27112293
has comment: http://stackoverflow.com/comment/42730500
has answer: http://stackoverflow.com/a/27115304
score: -2
accepted answer: http://stackoverflow.com/a/27115304
tagged with: java
has comment: http://stackoverflow.com/comment/42727527
has comment: http://stackoverflow.com/comment/42730459
possible better answer: http://stackoverflow.com/a/27112773
answer count: 2
tagged with: power-series
upvote count: 0
has comment: http://stackoverflow.com/comment/42731483
has comment: http://stackoverflow.com/comment/42730402
has title: Using biginteger to find the sequence of sum of powers
has comment: http://stackoverflow.com/comment/42730433
favorite count: 0
has comment: http://stackoverflow.com/comment/42727949
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27112773
tagged with: biginteger
downvote count: 2
has comment: http://stackoverflow.com/comment/42727530
has comment: http://stackoverflow.com/comment/42727728
type: Question
has body: Sum(N) =1^1+2^2+3^3+...+N^N Using Java, How would I use BigInteger to find the smallest integer N such that the value of Sum(N) is larger than 10^20? I'm really stuck,please give me some advice This is what I have so far: import java.math.BigInteger; public class PROJECTV1 { public static void main(String [] args) { BigInteger bResult= bigFunctionExample_2(); System.out.println(" =&gt; result_got:"+ bResult); System.out.println(); //newline }// end_main public static BigInteger bigFunctionExample_2() { BigInteger bSum = BigInteger.ZERO; BigInteger bTmp; String sSum; // BigInteger bResult =0; for (int i=1; ; i++) { bTmp = BigInteger.valueOf(i); bTmp = bTmp.pow(i); // i^i bSum = bSum.add(bTmp); // sum = i^i+ (i-1)^(i-1)+ .... sSum = bSum.toString(); if ( sSum.length() &gt;21) { System.out.println("i="+i +" bSum ="+bSum); break; }// }//end_for return bSum; // result } // end_bigFunctionExample_2 }

http://stackoverflow.com/q/26992353
score: 1
tagged with: java
upvote count: 1
tagged with: collections
possible better answer: http://stackoverflow.com/a/26992789
has title: Efficient way to compare different types of List of Objects
type: Question
accepted answer: http://stackoverflow.com/a/26992859
has body: public class State{ String code; int occurValue; int name; } public class Equi{ String code; int occurValue; int macAddress; } Having 2 classes of different types. I'm having a List&lt;State&gt; and List&lt;equi&gt;. In these lists if code and occurValue is same, I need to move that to different List. How can I achieve this, googling gave me so many options line Comparable, Comparator. Let me know which is the most efficient way to achieve this. Thanks in advance.
downvote count: 0
tagged with: comparable
tagged with: comparator
answer count: 3
has comment: http://stackoverflow.com/comment/42516185
has comment: http://stackoverflow.com/comment/42516099
favorite count: 0
has answer: http://stackoverflow.com/a/26992795
has answer: http://stackoverflow.com/a/26992859
has answer: http://stackoverflow.com/a/26992789
type: AnsweredQuestion

http://stackoverflow.com/a/27128083
accepted answer of: http://stackoverflow.com/q/27128015
answers question: http://stackoverflow.com/q/27128015
type: Answer
has body: Well there is a difference in the HTTP request. In first example, you send HTTP request with given URL and empty body. In second, you send HTTP request with shorter URL but body with parameters. If there will be different behavior on the server depends on how server (or framework it uses) handles such requests. If you want to see a difference on the HTTP level, use some tool for inspecting ingoing and outgoing packets (requests), e.g. Wireshark.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/27050036
has comment: http://stackoverflow.com/comment/42728486
downvote count: 0
tagged with: neo4j
has body: When shutting down the noo4j DB I receive this error: [org.neo4j]: Exception when stopping org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource@45673f68 java.nio.DirectByteBuffer[pos=16 lim=1048576 cap=1048576], 1586985 java.lang.IllegalArgumentException: java.nio.DirectByteBuffer[pos=16 lim=1048576 cap=1048576], 1586985 at org.neo4j.test.impl.EphemeralFileSystemAbstraction$DynamicByteBuffer.put(EphemeralFileSystemAbstraction.java:966) at org.neo4j.test.impl.EphemeralFileSystemAbstraction$EphemeralFileData.write(EphemeralFileSystemAbstraction.java:680) at org.neo4j.test.impl.EphemeralFileSystemAbstraction$EphemeralFileChannel.write(EphemeralFileSystemAbstraction.java:488) at org.neo4j.kernel.impl.nioneo.store.StoreFileChannel.write(StoreFileChannel.java:160) at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore$1.perform(CommonAbstractStore.java:579) at org.neo4j.kernel.impl.util.FileUtils.windowsSafeIOOperation(FileUtils.java:367) at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.close(CommonAbstractStore.java:572) at org.neo4j.kernel.impl.nioneo.store.NeoStore.closeStorage(NeoStore.java:289) at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.close(CommonAbstractStore.java:552) at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.stop(NeoStoreXaDataSource.java:507) at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.stop(LifeSupport.java:527) at org.neo4j.kernel.lifecycle.LifeSupport.stop(LifeSupport.java:155) at org.neo4j.kernel.impl.transaction.XaDataSourceManager.stop(XaDataSourceManager.java:185) at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.stop(LifeSupport.java:527) at org.neo4j.kernel.lifecycle.LifeSupport.stop(LifeSupport.java:155) at org.neo4j.kernel.lifecycle.LifeSupport.shutdown(LifeSupport.java:185) at org.neo4j.kernel.InternalAbstractGraphDatabase.shutdown(InternalAbstractGraphDatabase.java:822) at org.neo4j.test.ImpermanentGraphDatabase.shutdown(ImpermanentGraphDatabase.java:170) at org.springframework.data.…
favorite count: 0
has title: neo4j Exception when stopping org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/42644450
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42658089
has comment: http://stackoverflow.com/comment/42655076

http://stackoverflow.com/a/27019081
has body: You could compose your constraints. But with that you would get only one error for any of the constraints specified, not sure if thats acceptable in your use case.
score: 1
answers question: http://stackoverflow.com/q/27018180
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42563103
upvote count: 1

http://stackoverflow.com/comment/43096227
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27295331
type: AnswerComment
has text: Hey found it. There is a way to upload using dynamodb java API. I have used put request and it worked. Thanks.

http://stackoverflow.com/a/27094374
accepted answer of: http://stackoverflow.com/q/27094173
downvote count: 0
answers question: http://stackoverflow.com/q/27094173
has body: If you would declare your txtQuantity as final and then pass an anonymous new TextWatcher() { ... } into the addTextChangedListener, then you could directly use txtQuantity inside the afterTextChanged(Editable s) method. Hope this helps.
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/42694999

http://stackoverflow.com/comment/92131806
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27006517
has text: "this" does not work in static method, any workaround to do it in static methods? @Thilo
type: Comment

resin
type: Tag
tag name: resin
tags question: http://stackoverflow.com/q/27011442
tags question: http://stackoverflow.com/q/27108374

http://stackoverflow.com/a/27076231
accepted answer of: http://stackoverflow.com/q/27074622
answers question: http://stackoverflow.com/q/27074622
score: 0
type: AcceptedAnswer
has body: Iterating over the map you'll get one more collection you need to iterate in another loop before you can get properties of the object. <c:forEach items="${classList}" var="list"> Your student from ${list.key} <c:forEach items="${list.value}" var="student"> ${student.name} ${student.age} </c:forEach> </c:forEach>
type: Answer

saml
tags question: http://stackoverflow.com/q/27092407
tags question: http://stackoverflow.com/q/27133966
type: Tag
tags question: http://stackoverflow.com/q/27050545
tag name: saml

http://stackoverflow.com/q/27053036
has answer: http://stackoverflow.com/a/78182944
upvote count: 3
has answer: http://stackoverflow.com/a/33292422
tagged with: java
has title: Spark UnsupportedOperationException: empty collection
type: Question
score: 3
has answer: http://stackoverflow.com/a/38444714
has answer: http://stackoverflow.com/a/28674206
tagged with: apache-spark
has body: Does anyone knows possible causes of this error while trying to execute spark mllib ALS using hands on lab provided by Databricks? 14/11/20 23:33:38 WARN Utils: Set SPARK_LOCAL_IP if you need to bind to another address 14/11/20 23:33:39 WARN SizeEstimator: Failed to check whether UseCompressedOops is set; assuming yes Got 27980 ratings from 24071 users on 4211 movies. Training: 27989, validation: 0, test: 0 Exception in thread "main" java.lang.UnsupportedOperationException: empty collection at org.apache.spark.rdd.RDD$$anonfun$reduce$1.apply(RDD.scala:806) at org.apache.spark.rdd.RDD$$anonfun$reduce$1.apply(RDD.scala:806) at scala.Option.getOrElse(Option.scala:120) at org.apache.spark.rdd.RDD.reduce(RDD.scala:806) at MovieLensALS$.computeRmse(MovieLensALS.scala:149) at MovieLensALS$$anonfun$main$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcVD$sp$1.apply$mcVI$sp(MovieLensALS.scala:95) at MovieLensALS$$anonfun$main$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcVD$sp$1.apply(MovieLensALS.scala:93) at MovieLensALS$$anonfun$main$1$$anonfun$apply$mcVI$sp$1$$anonfun$apply$mcVD$sp$1.apply(MovieLensALS.scala:93) at scala.collection.immutable.List.foreach(List.scala:318) at MovieLensALS$$anonfun$main$1$$anonfun$apply$mcVI$sp$1.apply$mcVD$sp(MovieLensALS.scala:93) at MovieLensALS$$anonfun$main$1$$anonfun$apply$mcVI$sp$1.apply(MovieLensALS.scala:93) at MovieLensALS$$anonfun$main$1$$anonfun$apply$mcVI$sp$1.apply(MovieLensALS.scala:93) at scala.collection.immutable.List.foreach(List.scala:318) at MovieLensALS$$anonfun$main$1.apply$mcVI$sp(MovieLensALS.scala:93) at MovieLensALS$$anonfun$main$1.apply(MovieLensALS.scala:93) at MovieLensALS$$anonfun$main$1.apply(MovieLensALS.scala:93) at scala.collection.immutable.List.foreach(List.scala:318) at MovieLensALS$.main(MovieLensALS.scala:93) at MovieLensALS.main(MovieLensALS.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.Del…
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: scala
has comment: http://stackoverflow.com/comment/42623793
answer count: 4

http://stackoverflow.com/comment/42542736
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27003907
has text: (1) Never ignore an exception, and (2) when you catch an exception, *print the exception,* not just some error message of your own devising. Otherwise debugging becomes a mere guessing game.
score: 0

http://stackoverflow.com/comment/43031400
type: QuestionComment
comment on: http://stackoverflow.com/q/26994886
score: 0
has text: @kleopatra:Why not clear the delete/list?
type: Comment

http://stackoverflow.com/comment/42722260
type: QuestionComment
comment on: http://stackoverflow.com/q/27109391
has text: I'm not sure I understand what you mean before and after current line not entire file? If the file is stored in text then replaceAll will look at entire file.
score: 0
type: Comment

http://stackoverflow.com/comment/42763548
type: Comment
comment on: http://stackoverflow.com/a/27132376
score: 0
has text: Good point that I missed. This error is happening when the class is *run* not during ordinary IDE operations. Good catch.
type: AnswerComment

http://stackoverflow.com/comment/42583240
type: Comment
type: QuestionComment
has text: It can't get past the try statement. If I comment st.executeQuery(request) it does pass.
comment on: http://stackoverflow.com/q/27030462
score: 0

http://stackoverflow.com/q/27039720
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27040671
tagged with: java
has title: How to setup conditionals for BPMN2 Exclusive Gateway
type: Question
tagged with: bpmn
score: 4
upvote count: 4
accepted answer: http://stackoverflow.com/a/27040671
answer count: 1
downvote count: 0
favorite count: 0
tagged with: camunda
has body: I'm using Camunda BPMN2 for the first time in my spring project and trying to get my head around a couple of things ... In my applicationContext, I have the following block to setup Camunda: &lt;!-- Setup BPMN Process Engine --&gt; &lt;bean id="processEngineConfiguration" class="org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration"&gt; &lt;property name="processEngineName" value="engine" /&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;property name="transactionManager" ref="transactionManager" /&gt; &lt;property name="databaseSchemaUpdate" value="true" /&gt; &lt;property name="jobExecutorActivate" value="false" /&gt; &lt;property name="deploymentResources" value="classpath*:*.bpmn" /&gt; &lt;/bean&gt; &lt;bean id="processEngine" class="org.camunda.bpm.engine.spring.ProcessEngineFactoryBean"&gt; &lt;property name="processEngineConfiguration" ref="processEngineConfiguration" /&gt; &lt;/bean&gt; &lt;bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /&gt; &lt;bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" /&gt; &lt;bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" /&gt; &lt;bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" /&gt; &lt;bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" /&gt; &lt;context:annotation-config /&gt; I've setup two services: @Component(value="service1") public class Service1 implements JavaDelegate { @Override public void execute(DelegateExecution execution) throws Exception { System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"); System.out.println("SERVICE1"); System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"); } } and @Component(value="service2") public class Service2 implements JavaDelegate { @Override public void execute(Dele…
tagged with: spring

http://stackoverflow.com/comment/42953965
type: Comment
comment on: http://stackoverflow.com/a/27091151
has text: Choose a picture from the gallery that is not on sdcard as apparently you are not allowed to write there. Pick it from external memory where your app can write.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27054437
has comment: http://stackoverflow.com/comment/42625509
tagged with: java
has comment: http://stackoverflow.com/comment/42625553
has body: I've come across the need to reference/access global variables from my main class. I am using another class which also involves a thread (for networking stuff). Basically I was wondering if I can do it the following way (I've checked and I don't get any compilation errors): public class One { public static int number; public static void main(String [] args) { number = 5; Two two = new Two(); System.out.println(number); } } public class Two { public Two() { One.number = 10; } } And if so, is that acceptable? Is there a better way (other then normally passing the arguments)? Thanks for taking the time to read this, sorry if I'm being confusing (tired x.x).
type: Question
answer count: 2
has title: Referencing global variables in my main class?
has comment: http://stackoverflow.com/comment/42625847
has comment: http://stackoverflow.com/comment/42625756
score: 0
has answer: http://stackoverflow.com/a/27054511
has comment: http://stackoverflow.com/comment/42625671
has comment: http://stackoverflow.com/comment/42625527
has comment: http://stackoverflow.com/comment/42625587
has answer: http://stackoverflow.com/a/27054526
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42625627

http://stackoverflow.com/a/27163688
has comment: http://stackoverflow.com/comment/42984656
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27096717
score: 3
answers question: http://stackoverflow.com/q/27096717
type: Answer
has body: Try this one. Since i had the same issue that you faced. I have fixed by using the below code. ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentEncoding("UTF-8"); size = inputStream.available(); metadata.setContentLength(size); TransferManager transferManager = new TransferManager(credentialsProvider); Upload upload = transferManager.upload(bucket_name, key, images3, metadata); upload.waitForCompletion();
upvote count: 3

http://stackoverflow.com/q/26992374
tagged with: gradle
has comment: http://stackoverflow.com/comment/42516120
type: Question
has comment: http://stackoverflow.com/comment/42516231
has comment: http://stackoverflow.com/comment/42516195
score: 0
has body: Lets say I have a compiled Java program called launchProgramm.class. It takes 2 parameters of String. And I have a gradle build script android { ... } What I need is to launch my launchProgramm from gradle script and give it 2 parameters. How can I do that? Listen, I need to do some things with .apk file after all gradle build is finished. Lets say I want to copy it to another directory or open it and change some files. Is ip possible?
tagged with: android
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42516407
linked to: http://stackoverflow.com/q/21358466
has comment: http://stackoverflow.com/comment/42523034
has title: launch Java program from gradle
tagged with: java

http://stackoverflow.com/a/27018698
type: Answer
score: 1
has body: The first answer you have linked to correctly tells you what Class&lt;?&gt; means. The ... is called varargs, and means 0 or more arguments. So the argument Class&lt;?&gt;... means any number of arguments of any type of Class. For more info on varargs, see https://docs.oracle.com/javase/1.5.0/docs/guide/language/varargs.html
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27018591
answers question: http://stackoverflow.com/q/27018591

http://stackoverflow.com/comment/42715268
comment on: http://stackoverflow.com/q/27105082
score: 0
type: QuestionComment
has text: Ok, looks like something is wrong with the datasource used by your cfpPU persistent unit. Can you share your persistence.xml and your datasource config?
type: Comment

http://stackoverflow.com/q/27103495
tagged with: dynamic
has title: Create a container with object specified dynamically in JAVA
tagged with: java
has answer: http://stackoverflow.com/a/27104091
has body: I want to crate a container in JAVA that will have containers which (the latter) will hold entries of objects whose class will be dynamically defined. I cannot find any way of how to do this. Can anyone indicate me either an official way to do it (if there is such) or a generic way or an other approach if my is not correct? To be more specific, I try to do something like: Vector&lt;Vector&lt; of what? &gt; &gt; myVector; The of what? should be dynamically assigned for each vector that belongs in the outer one. Thank you.
type: Question
answer count: 2
tagged with: vector
score: 0
has answer: http://stackoverflow.com/a/27103546
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42710843
tagged with: object

http://stackoverflow.com/comment/42624757
score: 0
type: Comment
type: QuestionComment
has text: What if the number doesn't have three digits?
comment on: http://stackoverflow.com/q/27054010

http://stackoverflow.com/q/27139231
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42776391
type: AnsweredQuestion
tagged with: json-c
has answer: http://stackoverflow.com/a/27151702
tagged with: youtube
type: Question
accepted answer: http://stackoverflow.com/a/27151702
tagged with: java
has body: i know how to parse Json in android. but i can't seem to wrap my head around parsing JSONC from Youtube using GSON. i just need to parse the title of the video. Thanks here is the url http://gdata.youtube.com/feeds/api/videos/iS1g8G_njx8?v=2&amp;alt=jsonc
answer count: 1
has title: Parse Youtube JSONC with GSON

http://stackoverflow.com/a/27101458
type: Answer
has comment: http://stackoverflow.com/comment/42754781
has body: Is It correct to use Criteria to filter information? / When is useful to use it? No. Hibernate Search Lucene should not be mixed with Hibernate ORM Criteria queries. That is not supported. All you can set via the criteria API is the fetch mode for associations. Should I index the property "age" using @Field? Yes. Should I index all entity's properties that I need to use to filter? Absolutely. The most efficient way to search when using Hibernate Search is to make sure all information needed for the search is indexed and searchable via the Lucene index. You then use for example boolean queries to combine different search criteria. You also might want to think about how to index certain properties. For example, if you have numbers you can index them as numeric fields (see @NumericField). This will speed up range queries against these fields. In some cases you might even want to use a custom bridge. It all depends on your use-case and what you want to search for. How about performance, using indexed values or not? Provided you need full text search capabilities and you are going to use Hibernate Search, the best approach is to just use Hibernate Search queries. How to choose which values has to be indexed by lucene? You know your domain model best. You should know which fields you need to search on right now. These are the minimum fields you need to index now. If there are other fields you might need later, add them as well, unless you are really worried about index size. However, that is often not a problem. And even if you get it wrong and need to index fields later on, it is just a question of adding the required annotations and then rebuilding the index. For that particular purpose Search offers a very powerful mass indexer API. I hope this helps.
accepted answer of: http://stackoverflow.com/q/27070234
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27070234
score: 2
has comment: http://stackoverflow.com/comment/42755657
upvote count: 2

http://stackoverflow.com/comment/42582773
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27029925
score: 0
has text: There's no URI "matching" for query parameters. They're not part of the path. If a path match is found, you should just validate the date yourself or some other form of validation, _post_ path matching. That's the purpose of query params, so they can be used for processing. Paths are used for matching to locate a resource, that's not the job of query params

http://stackoverflow.com/q/27029264
linked to: http://stackoverflow.com/q/14539072
tagged with: classpath
has title: How to check if I set CLASSPATH correctly? (Junit error)
type: Question
has answer: http://stackoverflow.com/a/27029536
tagged with: java
tagged with: eclipse
score: 0
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/42581729
type: UnansweredQuestion
has body: I installed Junit and tried to follow one of to tutorial videos on YouTube. I added junit-4.11 to my CLASSPATH correctly but when I run my Junit test, I get initializationError. echo %CLASSPATH% shows the junit-4.11.jar correctly. What could be causing this? package test; public class Junit { public String concatenate(String one, String two) { return one + two; } public int multiply(int number1, int number2) { return number1 * number2; } } package test; import static org.junit.Assert.*; import org.junit.Test; public class MultiplyTest { @Test public void testMultiply() { Junit test = new Junit(); int result = test.multiply(3,4); assertEquals(12, result); } } java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing 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 org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.&lt;init&gt;(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.&lt;i…

http://stackoverflow.com/comment/42777066
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27139583
has text: Seems to be an issue with java versions. See http://stackoverflow.com/questions/9091713/unsupported-class-version-error and http://stackoverflow.com/questions/6066103/what-is-the-reason-for-unsupportedclassversionerror

http://stackoverflow.com/q/27069547
tagged with: java
tagged with: aop
has comment: http://stackoverflow.com/comment/42656912
has comment: http://stackoverflow.com/comment/42656478
tagged with: aspectj
answer count: 2
has title: Converting from Spring AOP to AspectJ
accepted answer: http://stackoverflow.com/a/27076257
has answer: http://stackoverflow.com/a/27075832
score: 0
tagged with: spring-aop
possible better answer: http://stackoverflow.com/a/27075832
type: AnsweredQuestion
has body: I'm migrating some code that uses Spring AOP to AspectJ aspects (weaved at compile time). I'm looking for feedback on how I can modify the pointcut so that that they behave the same after the migration? Currently Spring AOP Aspects only function as 'Proxies' and therefore only work from external callers on public/interface methods. Now that I've switched to AspectJ weaving; even method calls from within the class to itself are being weaved. This is causing me a big headache and I was wondering if i can change the pointcut to somehow still behave as if it was still a proxy ? (i.e. exclude calls from within itself at any point in the type hierarchy such as calling an inherited function)
type: Question
has answer: http://stackoverflow.com/a/27076257

http://stackoverflow.com/comment/42759138
has text: this just gives me a path on my console "D:\Execution\Java>", which I think is the default path of my cmd prompt.
comment on: http://stackoverflow.com/a/27129933
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27034248
accepted answer of: http://stackoverflow.com/q/27030711
answers question: http://stackoverflow.com/q/27030711
upvote count: 1
has body: The gravity is a force, which is applied to every (dynamic) body in the world in every step. That means, that the velocity of those affected object increases every frame. Thats just the expected result, think about the reality: If you jump from a high place, you get faster and faster, until you hit the ground (or air resistance limits your speed). If you want to move with a constant speed (in Box2D), you should do something like that: Vector2 vel = this.player.body.getLinearVelocity(); if (vel.x &lt; MAX_VELOCITY) { circle.applyLinearImpulse(impulse.x, impulse.y, pos.x, pos.y, wake); Where impulse.x is a float, defining the impulse strength applyed in x-direction, impulse.y is the same for y-direction, pos.x and pos.y is the position, to which you want to apply the impulse (if not the center, the body will get some torque-effect) and the boolean wake defines, if the body should wake up.
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/27058976
has body: I do not know about yours, but co-references created manually using the Co-reference Editor are stored in a document feature. The feature name seems to be "MatchesAnnots" and the type Map&lt;String, List&lt;List&lt;Integer&gt;&gt;&gt;. In my case, following code prints as name: null (the default annotation set) followed by all co-reference chains present in it. Object obj = document.getFeatures().get("MatchesAnnots"); @SuppressWarnings("unchecked") Map&lt;String, List&lt;List&lt;Integer&gt;&gt;&gt; map = (Map&lt;String, List&lt;List&lt;Integer&gt;&gt;&gt;) obj; for (Entry&lt;String, List&lt;List&lt;Integer&gt;&gt;&gt; e : map.entrySet()) { System.err.println("as name: "+ e.getKey()); for (List&lt;Integer&gt; chain : e.getValue()) { System.err.println("chain : "+ chain); } }
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/42633825
has comment: http://stackoverflow.com/comment/42654478
accepted answer of: http://stackoverflow.com/q/27035648
has comment: http://stackoverflow.com/comment/42633892
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27035648

http://stackoverflow.com/a/27071423
has comment: http://stackoverflow.com/comment/42662848
score: 0
type: Answer
has body: Servlet responds to http request (normaly) note that a JSP is transformed to a servler. A EJB it's totaly diferent, EJB define your business model. It seems you are confused about what remote accessing is, it means that you can have a EJB deployed in a different server running in a different JVM and that your servlets can access it. In the other side you can have local EJBs which run in the same server has the rest of your webapp and in the same JVM as your servlets and jsps. Depending on whether you EJB is local or remote the implementation differs in some little aspects (in remote EJBs you need to create an interface and other things, I won't enter in details, I'll add a link about this). If you want to understand what's the difference between servlets, jsps and ebjs, you should understand what MVC (Model View Controller) is. Normally Controller is defined by servlets, which receive the http request from the client and delegate the actions that they do in EJBs and JSPs. The View is defined by JSPs ( I assume you already understand what they are). And EJBs are the Model, they define your business model, they don't serve http requests, they just perform simple actions over your "model" like update/select/insert data in your database, and many other things. See more in: https://docs.oracle.com/javaee/7/tutorial/doc/ejb-intro.htm#GIJSZ for EJB Also I recomend you the following two books: Head First Servlets and JSP http://shop.oreilly.com/product/9780596005405.do Head First EJB http://shop.oreilly.com/product/9780596005719.do
has comment: http://stackoverflow.com/comment/42729074
has comment: http://stackoverflow.com/comment/42656949
answers question: http://stackoverflow.com/q/27070711

http://stackoverflow.com/a/27092865
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42691985
answers question: http://stackoverflow.com/q/27092832
has body: Replace: for (int i : appWidgetIds) { int appWidgetId = appWidgetIds[i]; with: for (int appWidgetId : appWidgetIds) { If you use the enhanced for syntax for iterating over a collection, you are iterating over the values of the collection, not array indices.
accepted answer of: http://stackoverflow.com/q/27092832
type: AcceptedAnswer

http://stackoverflow.com/comment/42759598
score: 0
has text: Thanks. I've tried this: `List spaceBodies = space.getBodies(); for (int i = 0; i < spaceBodies.size(); i++) { // Iterate through World bodies if (spaceBodies.get(i) instanceof lander.ShipFragmentPool.Fragment)` And this: `List spaceBodies = space.getBodies(); for (Object spaceBody : spaceBodies) { if (spaceBody instanceof lander.ShipFragmentPool.Fragment)` Both perform at 7 FPS. The second does not appear to recognise the spaceBody object as an instance of ShipFragmentPool.Fragment. Sorry about format - can't work it out. :/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27125939

conflict
tag name: conflict
tags question: http://stackoverflow.com/q/27048865
type: Tag

http://stackoverflow.com/comment/42700024
type: AnswerComment
score: 0
has text: It says that e.getKey is undefined for the type integer, but e.valuePerCharacter.values()) only works with integer in front of it, any ideas?
type: Comment
comment on: http://stackoverflow.com/a/27097194

http://stackoverflow.com/a/27116908
answers question: http://stackoverflow.com/q/27116889
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42736489
has body: A queue and a thread pool should be good.Publish your messages on a queue, let the workers thread pick messages from the queue and save them in database. Depending on your requirement/load, you may tune your queue and thread pool size.
score: 0
type: Answer

http://stackoverflow.com/comment/42764975
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27064970
type: Comment
has text: The job mentioned above doesn't require programming, it is run from the command line as ```mahout spark-rowsimilarity```. That will give you a list of command line options. If you build Mahout you can run it locally without creating a Spark cluster by specifying ```mahout spark-rowsimilarity -ma local[4]``` or however many cores you want to give Spark. Creating a Spark cluster on top of Hadoop (which Spark uses for its distributed file system) is best treated as a separate question. Some tutorials are here: https://spark.apache.org/documentation.html

http://stackoverflow.com/q/27060486
has body: Whenever i try and run my code i get an error array out of bounds. trans = new ArrayList&lt;List&lt;Transition&gt;&gt;(5); ArrayList&lt;Transition&gt; t = new ArrayList&lt;Transition&gt;(5); for (j = 0; j &lt;5; j++) trans.get(j).addAll(t); // &lt;- Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
has title: adding arrayList to arraylist using loop
has answer: http://stackoverflow.com/a/27060572
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27060561
has comment: http://stackoverflow.com/comment/42635386
tagged with: java
accepted answer: http://stackoverflow.com/a/27060572
type: AnsweredQuestion
tagged with: arraylist
type: Question
has comment: http://stackoverflow.com/comment/42635519
possible better answer: http://stackoverflow.com/a/27060565
has answer: http://stackoverflow.com/a/27060565

http://stackoverflow.com/a/27103848
has body: Adding -Dbasedir=${basedir} to the exec.args parameter works: exec.args=-classpath %classpath -Dbasedir=${basedir} ${packageClassName} Netbeans does not know about that variable, so it looks like the exec-maven-plugin evaluates that string.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27103325

http://stackoverflow.com/q/27103347
score: 1
tagged with: java
upvote count: 1
tagged with: swing
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/42710538
linked to: http://stackoverflow.com/q/26795598
tagged with: tooltip
linked to: http://stackoverflow.com/q/6377608
tagged with: base64
has body: I wonder if it is possible to draw a BufferedImage to a regular tooltip. As described here, an image may be placed into a tooltip by using HTML and an image element pointing to the URL of the image. So I tried to encode the BufferedImage in base64 like this and used the following HTML as tooltip text: "&lt;html&gt;&lt;img src=\"data:image/png;base64," + Base64.encode(out.toByteArray()) + "\"&gt;&lt;/html&gt;" Unfortunately this doesn't work. Am I missing something or are the HTML capabilities of a tooltip too limited to support base64 encoded images? Is there any other way to display a dynamically generated image like a tooltip?
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42711270
has title: How to draw a BufferedImage to a tooltip
answer count: 0

http://stackoverflow.com/comment/45858574
comment on: http://stackoverflow.com/a/28779564
type: AnswerComment
score: 0
type: Comment
has text: Sorry i haven't mark the question as resolve. It work great. The problem was a silent catch make by another dev. It's not the hibernate fault

http://stackoverflow.com/q/27133260
has answer: http://stackoverflow.com/a/27137206
tagged with: many-to-many
downvote count: 0
has answer: http://stackoverflow.com/a/27136564
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
score: 5
has body: I am new in hibernate and I have next situation: @Entity class Post { @Id id; @ManyToMany @JoinTable(name = "ATag", joinColumns = @JoinColumn(name = "post_id"), inverseJoinColumns = @JoinColumn(name = "tag_id")) Set&lt;Tag&gt; tags; } @Entity class Tag { @Id Long id; String name; } table tag has constraint unique on the name field. If I save post object with tag which name already exists it will return error like: Nov 25, 2014 9:23:13 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: ERROR: duplicate key value violates unique constraint "tags_name_key" Detail: Key (name)=(ert) already exists. org.hibernate.exception.ConstraintViolationException: could not execute statement how can I handle this situation?
favorite count: 0
upvote count: 5
type: UnansweredQuestion
has title: How to save data with unique field in many-to-many relationship using JPA and Hibernate

http://stackoverflow.com/q/27150388
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: Below is the Code Written by me. But when i send the request i am getting Response Code 401 : Unathorized. String url = "SAMPLE_URL"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); // optional default is GET con.setRequestMethod("GET"); //add request header //con.setRequestProperty("User-Agent", USER_AGENT); int responseCode = con.getResponseCode(); System.out.println("\nSending 'GET' request to URL : " + url); System.out.println("Response Code : " + responseCode);
score: 1
tagged with: java
has title: How to Pass Username and Password in GET Request in Java
type: Question
answer count: 1
downvote count: 0
tagged with: httpclient
has answer: http://stackoverflow.com/a/27150460

http://stackoverflow.com/q/27077075
has answer: http://stackoverflow.com/a/27077183
tagged with: java
tagged with: mysql
has body: I have installed mysql in my computer.and also have jetty.. My requirement:- I have a database student with table name ari; ari table is:- +----+-------+ | id | name | +----+-------+ | 22 | Sandy | +----+-------+ from My Android program I want to fetch it from database..I have done this:- MainActivity3.java public class MainActivity3 extends Activity { private static final String url = "jdbc:mysql://localhost:3306/student"; private static final String user = "root"; private static final String pass = "root"; TextView tv; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView)findViewById(R.id.textView1); Connect(); } private class Connect extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { String response = ""; try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url, user, pass); String result = "Database connection success\n"; Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select * from ari"); ResultSetMetaData rsmd = rs.getMetaData(); while(rs.next()) { result += rsmd.getColumnName(1) + ": " + rs.getInt(1) + "\n"; result += rsmd.getColumnName(2) + ": " + rs.getString(2) + "\n"; } tv.setText(result); } catch(Exception e) { e.printStackTrace(); tv.setText(e.toString()); } return response; } @Override protected void onPostExecute(String result) { tv.setText(result); } } public void Connect() { Connect task = new Connect(); task.execute(); } } But its showing the error:-- FATAL EXCEPTION: AsyncTask #1 Process: com.TourBus.info, PID: 32102 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at j…
type: Question
score: 0
answer count: 1
has title: android mysql with java code not responding
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/42744123
type: Comment
type: QuestionComment
score: 2
has text: Are you sure that it doesn't point to `assertNotNull(member.getName());`? Refresh your project, rebuild and rerun. Breakpoints can stay fixed on lines if you edit the code around them they don't move with it sometimes. Other than that try putting `assert registry != null` and ensuring the parameters are also not null with more asserts or `if (blah != null) {..}` blocks to make sure that nothing you want to use is null where it shouldn't be.
comment on: http://stackoverflow.com/q/27120070

http://stackoverflow.com/q/27150125
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42794927
has comment: http://stackoverflow.com/comment/42801712
has title: Convert time to 24 hours format
downvote count: 1
linked to: http://stackoverflow.com/q/7693324
has body: I have some time value which is in String format (for example 12:45 AM and 7:00 PM). I wonder how should I convert it into the 24 hours format (for example 12:45 and 19:00). Should the output be in long format?
possible better answer: http://stackoverflow.com/a/27150222
has answer: http://stackoverflow.com/a/27150230
has answer: http://stackoverflow.com/a/27150222
tagged with: time
has comment: http://stackoverflow.com/comment/42796445
has comment: http://stackoverflow.com/comment/42798597
linked to: http://stackoverflow.com/q/12473550
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27150261
accepted answer: http://stackoverflow.com/a/27150261
upvote count: 1
has comment: http://stackoverflow.com/comment/42804406
has comment: http://stackoverflow.com/comment/42794829
favorite count: 0

http://stackoverflow.com/comment/42755050
comment on: http://stackoverflow.com/a/27115326
type: AnswerComment
score: 0
type: Comment
has text: Unfortunately, with your code I get the following error: groovy.lang.MissingMethodException: No signature of method: script1000001.setProperty() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String, java.lang.String) values: [attrList, a, b, c] Possible solutions: setProperty(java.lang.String, java.lang.Object), setProperty(java.lang.String, java.lang.Object), getProperty(java.lang.String), getProperty(java.lang.String), getProperties()...

thumbnail-toolbar
type: Tag
tags question: http://stackoverflow.com/q/27024005
tag name: thumbnail-toolbar

http://stackoverflow.com/q/27075593
has answer: http://stackoverflow.com/a/27078434
has comment: http://stackoverflow.com/comment/42662484
type: UnansweredQuestion
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/42663162
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42662440
has answer: http://stackoverflow.com/a/27077034
has title: saving a group of files to a bigger file
has body: Is it possible to save a group of files into a bigger, custom file? For my program, I looking for a means to package a number of files (lets say 15 sound files) as sub-files of one larger file. Reason being is that I want to protect the files that I have for my program to keep other users from directly having access and/or changing them. Something else similar to a zip or jar or just a custom version of the two.
score: 0
has comment: http://stackoverflow.com/comment/42666854

http://stackoverflow.com/a/27095546
score: -1
has comment: http://stackoverflow.com/comment/42696961
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27095429
downvote count: 1
has body: You have list. list1 now create new list for example list2 and now simply assigns list2 into list1 list2 = list1 list2 is only refference to list1. Data in these two lists are in memory only once. If you change elements in list1, it also changes in list2.

http://stackoverflow.com/comment/42783899
score: 0
comment on: http://stackoverflow.com/q/27143454
type: Comment
type: QuestionComment
has text: Please check this link for valid `url-patterns` http://javapapers.com/servlet/what-is-servlet-mapping/

http://stackoverflow.com/q/27121832
has comment: http://stackoverflow.com/comment/42744576
linked to: http://stackoverflow.com/q/5630486
answer count: 2
has body: I need to modify some functionality of a class in a jar file. Because I need to retain most functionality, I thought of extending the needed class and overriding the methods that should change. But some of the variables are declared private so I cannot access them. Therefore what happens if I declare an Object with the same name in child class? (see example) package abc; class Parent { private Object var; String func_1() { //do something to var func_2(); } void func_2() { //do something to var } } And the child class : package abc; class Child extends Parent { private Object var; /* @Override */ String func_1(){ //do something to var func_2(); } } Will func_2 manipulate var of Parent or var of child?
upvote count: 0
accepted answer: http://stackoverflow.com/a/27121904
favorite count: 0
has answer: http://stackoverflow.com/a/27121927
has comment: http://stackoverflow.com/comment/42744627
possible better answer: http://stackoverflow.com/a/27121927
has comment: http://stackoverflow.com/comment/42744602
type: AnsweredQuestion
has title: If child class has a variable with same name as private variable in parent what will be used?
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27121904
score: -1

http://stackoverflow.com/q/27015701
has answer: http://stackoverflow.com/a/27032007
has answer: http://stackoverflow.com/a/27016116
has comment: http://stackoverflow.com/comment/42557650
has comment: http://stackoverflow.com/comment/42557155
has comment: http://stackoverflow.com/comment/42556844
answer count: 3
score: 2
has body: I currently have several runnable classes, each printing a string upon completion using System.out.println(). In the main() I execute them using a ExecutorService ,executor.execute() for each of them. I am wondering after executing those threads, how to get the output stream from them for future use ? Pretty much like using .getInputStream for processes but there's no such method in the Thread class. Thanks! There's a class which implements runnable interface like this: public class A implements Runnable { public void run() { System.out.println(5); //this thread always print out number 5 } } and in the main function I need to get the printed number and store it public static void main(String[] args) { ExecutorService ThreadPool = Executors.newFixedThreadPool(1); ThreadPool.execute(new A()); //This statement will cause the thread object A //to print out number 5 on the screen ThreadPool.shutdown(); ...... } Now I need to get the printed number 5 and store it into, say an integer variable.
has comment: http://stackoverflow.com/comment/42557922
has title: How to get the output stream from a thread
has comment: http://stackoverflow.com/comment/42557101
favorite count: 0
has comment: http://stackoverflow.com/comment/42557271
has comment: http://stackoverflow.com/comment/42557023
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/27016857
has comment: http://stackoverflow.com/comment/42560216
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42559162
has comment: http://stackoverflow.com/comment/42556947
downvote count: 0

http://stackoverflow.com/comment/42591384
comment on: http://stackoverflow.com/a/27034367
type: AnswerComment
score: 0
type: Comment
has text: @GangadharB: Well that doesn't tell us anything about what you tried, what debugging you've done, what the output was, etc.

http://stackoverflow.com/comment/42882309
type: Comment
comment on: http://stackoverflow.com/a/27134623
type: AnswerComment
has text: Thank you - also, sorry to respond so late (I had to work....) But I will try this.
score: 0

http://stackoverflow.com/q/27051970
has title: Add JApplet to JPanel
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/42621034
linked to: http://stackoverflow.com/q/12449889
score: 0
has comment: http://stackoverflow.com/comment/42649535
answer count: 1
tagged with: applet
has body: I am developing my new application in Swing and I want to reuse JChempaint in this application. I have the jar file of JChempaint applet (which is developed in Swing using JApplet). Basically, I want to add jar file to JPanel in my new application. In anyway, is this possible? JChempaint being open source, I also have the source code. How can I add the JChempaint applet to a panel? Following are the details after trying to implement the suggestions------ I started with my project and tried to develop a skeleton to embed the JChemPaint window in it. Following is the code of my layout: package LearnSwingPkg; import java.awt.BorderLayout; class SplitPane extends JFrame { private JPanel panel1; private JPanel panel2; private JScrollPane panel3; private JScrollPane panel4; protected JSplitPane split; public SplitPane(){ super("Learn Swing"); JFrame.setDefaultLookAndFeelDecorated(true); setSize(900, 700); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocation(0,0); setTitle( "Split Pane Application" ); JPanel topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); // Create the panels createPanel1(); createPanel2(); createPanel3(); createPanel4(); JSplitPane spLeft = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,panel1, panel3); JSplitPane spRight = new JSplitPane(JSplitPane.VERTICAL_SPLIT,true, panel2, panel4); split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,spLeft, spRight); split.setOneTouchExpandable(true); getContentPane().add(split, BorderLayout.CENTER); } //top left public void createPanel1(){ panel1 = new JPanel(); panel1.setLayout( new BorderLayout() ); panel1.add((new TextArea("Panel1"))); panel1.setPreferredSize( new Dimension( 450, 400 ) ); panel1.setMaximumSize(new Dimension(450, 400)); } //top right public void createPanel2(){ panel2 = new JPanel(); panel2.setLayout( new BorderLayout() ); panel2.add((new TextArea("Panel2"))); panel2.setPreferredSize( new Dimension( 450, 400 ) ); panel2.setMaximumSize(new D…
has answer: http://stackoverflow.com/a/27052959
type: UnansweredQuestion

http://stackoverflow.com/q/27147494
type: UnansweredQuestion
has body: I am working on integration test with JUnit. I have a some services ( Spring Services @Service) to test. So i create a test class to test services. I have : MyTestClass => ServicesToTest When i execute my test, i cannot set a breakpoint and see what's happening in service classe. I know that when using Spring Service, Spring create some proxy to provide access to service. I don't know really if it is related to Spring. How i can debug my Test class. For information my test classes is configured as below : @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:test-context.xml") @Transactional public class MyTestClass(){ //Injection of dao and services + test method. } What's wrong, please ?
has comment: http://stackoverflow.com/comment/42802787
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/27154217
has comment: http://stackoverflow.com/comment/42798714
tagged with: java
has title: How to debug my Test Classes?
type: Question
score: 0
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/42799035

http://stackoverflow.com/q/27020021
score: 0
answer count: 1
tagged with: countdown
has answer: http://stackoverflow.com/a/27020627
tagged with: timer
type: UnansweredQuestion
tagged with: countdowntimer
tagged with: android
has title: how to display the end and start time android countdowntimer
tagged with: java
type: Question
has body: when i run the code below i can not display the start and the end time like 00:00:00 every time the timer start, in the future i want to let the user define how many countdown timer he need and time for each one with repeat on them so any assist for display is vital and if someone can improve the code for the next step i will very appreciate that. Thank for the assist, repeterTimer = new CountDownTimer(3000, 1000) { @Override public void onTick(long millisUntilFinished) { isRunning = true; meditiongong.setLooping(false); long millis = millisUntilFinished; String hms = String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(millis), TimeUnit.MILLISECONDS.toMinutes(millis) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(millis)), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis))); textViewTimer.setText(hms); } @Override public void onFinish() { textViewTimer.setText("00:00:00"); isRunning = false; meditiongong.start(); if (repeater) { numRepeat ++ ; numOfRepeat.setText("" + numRepeat); repeterTimer.start(); } else { meditiongong.setLooping(true); } } }; }

http://stackoverflow.com/q/27098444
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/27098972
has comment: http://stackoverflow.com/comment/42702439
score: 0
has comment: http://stackoverflow.com/comment/42701862
answer count: 1
type: UnansweredQuestion
has body: I have a homework assignment where I have to alter a color selector (it has 3 sliders, RGB and displays the color) so that there are text fields and when a value is typed into the field, it changes the slider as well. I get the basic idea however I'm having trouble finding a solution to text-fields being changed, they'll only work with Action Event. Here's my code package colorchooser; import java.util.Vector; import java.awt.Color; import javax.swing.event.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; /** * * @author - */ public class ColorChooser extends javax.swing.JPanel implements ChangeListener, ActionListener{ private Vector listeners; /** * Creates new form ColorChooser */ public ColorChooser() { initComponents(); listeners = new Vector(); sldRed.addChangeListener(this); sldGreen.addChangeListener(this); sldBlue.addChangeListener(this); txtRed.addActionListener(this); // Variables declaration - do not modify private javax.swing.JButton btnSetColor; private javax.swing.JLabel lblBlue; private javax.swing.JLabel lblGreen; private javax.swing.JLabel lblRed; private javax.swing.JSlider sldBlue; private javax.swing.JSlider sldGreen; private javax.swing.JSlider sldRed; private javax.swing.JTextField txtBlue; private javax.swing.JTextField txtGreen; private javax.swing.JTextField txtRed; // End of variables declaration @Override public void stateChanged(ChangeEvent ce) { int r = sldRed.getValue(); int g = sldGreen.getValue(); int b = sldBlue.getValue(); Color color = new Color(r,g,b); fireColorEvent(new ColorEvent(this,color)); txtRed.setText(Integer.toString(r)); txtGreen.setText(Integer.toString(g)); txtBlue.setText(Integer.toString(b)); } public void addColorListener(ColorListener colorListener){ listeners.addElement(colorListener); } public void actionPerformed(ActionEvent ae) { if(ae.getSource()==btnSetColor){ try { if(Integer.parseInt(txtRed.getText()) &lt;= 255){ sldRed.setValue(Integer.parseInt(t…
tagged with: swing
has title: Java: Adding a text field to a ChangeEvent
tagged with: java

http://stackoverflow.com/comment/42781197
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27141941
has text: sorry i misread your question a little bit wait a few mins :)

http://stackoverflow.com/comment/42622943
type: QuestionComment
comment on: http://stackoverflow.com/q/27052943
has text: @Mike'Pomax'Kamermans and there is no relation between `A and String`, am i correct, so cannot do casting..??
score: 0
type: Comment

http://stackoverflow.com/q/27010513
answer count: 2
linked to: http://stackoverflow.com/q/5283047
has answer: http://stackoverflow.com/a/27011340
score: 0
has answer: http://stackoverflow.com/a/27011030
has title: Compare two arrays to get the missing array and new array in java
favorite count: 0
has comment: http://stackoverflow.com/comment/42548154
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42548356
tagged with: java
has body: I have an array which shows the cities selected in database as cities=["1","3"] where 1 is Bombay and 3 is bangalore Now while editing the user deselects Bombay and selects chennai, The new array is ["2","3"] HTML: Bombay Chennai Bangalore Delhi Calcutta How to get an array which contains the missing values(1) and an array for newly selected (2) so that when compared with selected array, if it is missing should update else should insert in database
upvote count: 1
linked to: http://stackoverflow.com/q/13732312
downvote count: 1
type: Question

http://stackoverflow.com/a/36351571
has body: Note that on Ubuntu, the 'maven' package is newer than the 'maven2' package. The following commands fixed it for me: sudo apt-get remove maven2 sudo apt-get install maven
downvote count: 0
answers question: http://stackoverflow.com/q/27076512
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/59045806
type: Comment
comment on: http://stackoverflow.com/a/35684007
type: AnswerComment
has text: Nonsense. The `close()` already implicitly invokes `flush()`. The upcast can also impossibly solve OP's problem. OP's problem is caused elsewhere. There are way too much problems in the code snippet posted so far and OP seems to be not at all aware about the fact that his servlet code is not thread safe at all.
score: 0

http://stackoverflow.com/comment/42690429
type: Comment
comment on: http://stackoverflow.com/a/27091151
has text: Add the READ_EXTERNAL_STORAGE permission?
score: 0
type: AnswerComment

http://stackoverflow.com/q/27069566
has title: ArrayList vs HashMap — Lots of Iterating and Object Manipulation
tagged with: arraylist
has body: Basically, I have some data structure of a ton of objects, and this structure will be accessed by multiple threads and will need to account for that. A lot of iteration and object manipulation will need to be performed constantly (each main loop iteration can result in every single object in the data structure being modified in a worst case, nothing modified in best/normal case). Currently, I am using a CopyOnWriteArrayList as my structure. Additionally, on each iteration, I make sure not to add duplicates, in an attempt to keep the size of the list down. Using locks/synchronized is not ideal as I want to avoid holding up the threads for these operations. As far as I can tell, my options for this are as follows: Run a contains() check for each element to be added Create a HashSet from the list and convert it back (essentially removing all duplicates) Use a ConcurrentHashMap instead of a list for the data structure Something else? I am aware that ArrayLists are much better with iteration while object manipulation and duplicate checking are better handled by strictly using a HashMap. Since my case will need both, I'm wondering what the best solution is here. I should also mention that the ordering of the elements is a non-issue. Edit: To clarify this further, the collection will be having elements constantly added, removed, and modified. To which degree depends on each specific run time (based off of generally random events), so I'm cautious about making any assumptions about how often it will occur. The only thing that is guaranteed to happen is that the collection will be iterated through completely each time, performing multiple checks on each element.
accepted answer: http://stackoverflow.com/a/27071159
answer count: 1
downvote count: 0
tagged with: copyonwritearraylist
favorite count: 0
has comment: http://stackoverflow.com/comment/42652104
has comment: http://stackoverflow.com/comment/42652268
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/27071159
has comment: http://stackoverflow.com/comment/42653898
type: Question
score: 3
tagged with: hashmap

http://stackoverflow.com/comment/42791393
comment on: http://stackoverflow.com/q/27148017
score: 0
has text: possible duplicate of [PreparedStatement IN clause alternatives?](http://stackoverflow.com/questions/178479/preparedstatement-in-clause-alternatives)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42593140
type: Comment
has text: There is no index called number. I can iterate through only index values such as 0,1,2,3 etc.. So Please give me some other solution. Its not working for me
type: AnswerComment
comment on: http://stackoverflow.com/a/27035884
score: 0

http://stackoverflow.com/comment/42664054
type: Comment
has text: I will accept any answer who can explain me why this fixes my problem.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27076662

http://stackoverflow.com/comment/42677591
score: 0
type: Comment
has text: @yts there can be situation when collection does not have *exact* match, but sub-range is not empty.
type: QuestionComment
comment on: http://stackoverflow.com/q/27084154

http://stackoverflow.com/comment/42629270
comment on: http://stackoverflow.com/a/27056673
type: AnswerComment
score: 0
type: Comment
has text: Yeah, I just had a closer look at your code. It's a little wonky. You shouldn't be setting another `WebViewClient` inside the `shouldOverrideUrlLoading()` method. Override both methods you need in one client, and set it one time.

named-query
type: Tag
tag name: named-query
tags question: http://stackoverflow.com/q/27115919

http://stackoverflow.com/comment/42737751
has text: Using Object streams to send files is grossly inefficient and not very portable. Just open up a BufferedInput/OutputStream and write it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27117302
score: 0

java.util.scanner
tags question: http://stackoverflow.com/q/27004342
tags question: http://stackoverflow.com/q/27085277
tags question: http://stackoverflow.com/q/27070802
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/26996939
tags question: http://stackoverflow.com/q/27144910
tags question: http://stackoverflow.com/q/27078488
tags question: http://stackoverflow.com/q/27032139
tags question: http://stackoverflow.com/q/27070523
tags question: http://stackoverflow.com/q/27085050
tags question: http://stackoverflow.com/q/26996869
tags question: http://stackoverflow.com/q/27086092
tags question: http://stackoverflow.com/q/27111318
tags question: http://stackoverflow.com/q/27090467
tags question: http://stackoverflow.com/q/27093497
tags question: http://stackoverflow.com/q/27004751
tags question: http://stackoverflow.com/q/27141183
tags question: http://stackoverflow.com/q/27061291
tags question: http://stackoverflow.com/q/27073081
type: Tag
tags question: http://stackoverflow.com/q/27011662
tags question: http://stackoverflow.com/q/27028484
tags question: http://stackoverflow.com/q/27079607
tags question: http://stackoverflow.com/q/27000406
tags question: http://stackoverflow.com/q/27097862
tags question: http://stackoverflow.com/q/27028745
tags question: http://stackoverflow.com/q/27083110
tags question: http://stackoverflow.com/q/27117205
tags question: http://stackoverflow.com/q/27084284
tags question: http://stackoverflow.com/q/27095582
tags question: http://stackoverflow.com/q/27045832
tags question: http://stackoverflow.com/q/27113689
tags question: http://stackoverflow.com/q/27085567

http://stackoverflow.com/a/27070124
has comment: http://stackoverflow.com/comment/42653123
accepted answer of: http://stackoverflow.com/q/27034885
downvote count: 0
answers question: http://stackoverflow.com/q/27034885
score: 3
has body: Being a noob in this field, I missed several installation steps not shown in the website: Git needs to be set in the PATH environment variable. You need to run this command in order to manually install bower: npm install -g bower None of these steps are shown in the installation guidelines so I will try to contact the JHipster support in case they modify their website (and save other people´s time).
upvote count: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/27093354
type: Answer
has body: Given int[m][n] b populated with data, I would approach it as follows: for (int[] a : b) Arrays.sort(a); // sort each jumper's results List&lt;Integer&gt; podium = new ArrayList&lt;&gt;(m); // to hold indexes of podium order for (int i = 0; i &lt; m; i++) podium.add(i); // sort the indexes based on the highest jump of the jumper at that index Collections.sort(podium, new Comparator&lt;Integer&gt;() { public int compare(Integer o1, Integer o2) { // compare the highest jumps in reverse order return Integer.compare(b[o2][n - 1], b[o1][n - 1]); } }); Now podium contains the indexes if the jumpers in highest to lowest order of their best jumps. The indexes of 1st, 2nd and 3rd are: for (Integer i : podium.subList(0, 3)) System.out.println(i);
has comment: http://stackoverflow.com/comment/42704335
has comment: http://stackoverflow.com/comment/42710091
answers question: http://stackoverflow.com/q/27089073
score: 0

http://stackoverflow.com/a/27069341
accepted answer of: http://stackoverflow.com/q/27068611
upvote count: 12
score: 12
type: AcceptedAnswer
downvote count: 0
has body: Tell the configuration class that your properties is in the classpath. Otherwise, it will look in the Servlet context by default since it's a web context. @PropertySource("classpath:jdbc.properties")
type: Answer
answers question: http://stackoverflow.com/q/27068611

http://stackoverflow.com/q/27096182
has title: (identifier expected) getter/setter and objects
score: 1
tagged with: java
tagged with: setter
type: Question
has body: I've got a problem with my programm. When i try to compile following i just receive the message: Tutorium.java:15: error: &lt;identifier&gt; expected public void settName(vorlesung.lectureName) { ^ So my Code: Tutorium.java public class Tutorium { private Vorlesung vorlesung; public String tName; private int tNumber; public int gettNumber() { return this.tNumber; } public String gettName() { return this.tName; } public void settName(vorlesung.lectureName) { this.tName = vorlesung.lectureName; } public String toString() { return (this.tName + ", " + this.tNumber); } public Tutorium(int tNumber){ this.tNumber = tNumber; } } Vorlesung.java public class Vorlesung { public String lectureName; private int lectureNumber; private int lecture; private Dozent dozent; private String lecturerlName; public String getlectureName(){ return this.lectureName; } public int lectureNumber(){ return this.lectureNumber; } public int lecture(){ return this.lecture; } public String getlecturer(){ this.lecturerlName = dozent.lecturerlName; return this.lecturerlName; } public String toString() { return (this.lectureName + ", " + this.lectureNumber); } public Vorlesung(String lectureName, int lecture) { this.lectureName = lectureName; this.lecture = lecture +1; this.lectureNumber = this.lecture -1; this.lecturerlName = lecturerlName; }} My Main-Method: public class MainVorlesung { public static void main(String[] args) { Student student = new Student("STUDENTNAME", "STUDENTLASTNAME", 178, 1); Vorlesung vorlesung = new Vorlesung("Programmieren", 13341); Tutorium tutorium = new Tutorium(3); Dozent dozent = new Dozent("LECTURERFIRSTNAME", "LECTURERLASTNAME", 815); System.out.println(student.toString()); System.out.println(vorlesung.toString()); System.out.println(tutorium.toString()); System.out.println(dozent.toString()); }} My goal is to set the value of tName equal the value of vorlesung.lectureName. Why can't i do this that way? I appreciate every help. :) Thanks
downvote count: 0
tagged with: getter
has answer: http://stackoverflow.com/a/27096384
answer count: 3
accepted answer: http://stackoverflow.com/a/27096384
has answer: http://stackoverflow.com/a/27096210
has comment: http://stackoverflow.com/comment/42697842
favorite count: 0
has comment: http://stackoverflow.com/comment/42698204
upvote count: 1
has comment: http://stackoverflow.com/comment/42697809
possible better answer: http://stackoverflow.com/a/27096209
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/42697860
has answer: http://stackoverflow.com/a/27096209

http://stackoverflow.com/a/27046073
upvote count: 1
downvote count: 0
has body: The foreach loop will use an Iterator to go through your list, forbidding the change you're trying to make with primes.add(no). As your list is an ArrayList, you can access the i-th element at no additional cost with primes.get(i) and the size by primes.size(). An easy way out would be: for (int idx = 0; idx &lt; primes.size(); idx++){ int i = primes.get(idx); if (no % i != 0) { no2 = no2 + 1; if(primes.size() == no2){ System.out.println(primes.get(primes.size() - 1)); primes.add(no); } } }
type: Answer
answers question: http://stackoverflow.com/q/27045951
has comment: http://stackoverflow.com/comment/42610739
score: 1

http://stackoverflow.com/q/27064871
answer count: 1
accepted answer: http://stackoverflow.com/a/27067181
has title: group files after pathnames
score: 0
has comment: http://stackoverflow.com/comment/42644202
has comment: http://stackoverflow.com/comment/42643719
tagged with: shell
has body: i am trying to write a jave code that does the following, but atm have no clue how to realize this: let us say: i have 7 files in different or equal paths on local system, that i want to copy somewhere else using as few pathnames in my shell command as possible correctfiles are the files i want, somefiles i do not care about for instance i do not want : copy C:\tmp\folder1\subfolder12\correctfile3 &amp;&amp; copy C:\tmp\folder1\subfolder12\correctfile4 instead i want the Uberfolder whenever possible: copy C:\tmp\folder1\subfolder12\ and that demands that there is no somefile in copy C:\tmp\folder1\subfolder12 because i do not want to transfer somefile e.g. C:\tmp\folder1: somefile1, somefile2 C:\tmp\folder1\subfolder11: correctfile1, correctfile2 C:\tmp\folder1\subfolder12: correctfile3, correctfile4 C:\tmp\folder2\subfolder21: correctfile5 C:\tmp\folder2\subfolder22: correctfile6, correctfile7 so in this example i could use copy C:\tmp\folder2 because alle files in that folder are correctfiles and for the others i would have to copy C:\tmp\folder1\subfolder11 copy C:\tmp\folder1\subfolder12 because there are somefiles in Uberfolder C:\tmp\folder1 that i do not want to transfer how could i achieve this? a java class that sort of groups the files according to pathnames, using as few pathnames as possible
has comment: http://stackoverflow.com/comment/42644056
has answer: http://stackoverflow.com/a/27067181
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42644720

http://stackoverflow.com/q/27099292
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27114447
downvote count: 1
type: Question
tagged with: java
tagged with: servlets
has body: I'm using smack library to receive messages from my android application to the server. Below is my code: String username=this.GCM_SENDER_ID+"@gcm.googleapis.com"; String password=this.GCM_SERVER_KEY; config = new ConnectionConfiguration(GCM_SERVER, GCM_PORT); config.setSecurityMode(SecurityMode.enabled); config.setReconnectionAllowed(true); config.setRosterLoadedAtLogin(false); config.setSendPresence(false); config.setSocketFactory(SSLSocketFactory.getDefault()); config.setDebuggerEnabled(false); connection=new XMPPTCPConnection(config); connection.connect(); connection.addConnectionListener(new AppConnectionListener()); connection.addPacketListener(new AppPacketListener(),new PacketTypeFilter(Message.class)); connection.addPacketInterceptor(new AppPacketInterceptor(), new PacketTypeFilter(Message.class)); connection.login(username, password); Now, when a new message receives at the server, AppPacketListener is called. What i want is to call a java servlet's doGet method or to send a get request to some other jsp page. How do i do it?? any tips?
upvote count: 0
answer count: 1
tagged with: jsp
favorite count: 0
score: -1
has title: How to call java servlet's doGet method from smack library's packetlistener?
tagged with: smack

http://stackoverflow.com/q/27012459
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/27012504
tagged with: java
tagged with: hibernate
score: -1
type: Question
has answer: http://stackoverflow.com/a/27012494
favorite count: 0
has answer: http://stackoverflow.com/a/27012551
answer count: 3
has body: I am trying to use a createQuery to get data. Servlet.service() for servlet spring-mvc threw exception java.lang.ClassNotFoundException: org.springframework.dao.DuplicateKeyException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.openSession(OpenSessionInViewFilter.java:171) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:114) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http…
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42551370
linked to: http://stackoverflow.com/q/20483939
has title: java.lang.ClassNotFoundException: org.springframework.dao.DuplicateKeyException

http://stackoverflow.com/comment/42811131
comment on: http://stackoverflow.com/a/27149641
score: 0
type: AnswerComment
has text: If you do repost on code review give us a link here and I'll move over there. You may want to expand the complexity of your question over there to help us understand what you are trying to represent.
type: Comment

http://stackoverflow.com/comment/42669909
comment on: http://stackoverflow.com/q/27080020
score: 0
type: Comment
type: QuestionComment
has text: I edited to where I added the array.

http://stackoverflow.com/comment/42746837
comment on: http://stackoverflow.com/q/27104589
score: 0
type: Comment
type: QuestionComment
has text: Please always give full trace of the exception, not just one line. `InvocationTargetException` does not really mean anything specific enough.

http://stackoverflow.com/a/35110609
answers question: http://stackoverflow.com/q/27096670
has comment: http://stackoverflow.com/comment/125937202
downvote count: 1
score: -1
upvote count: 0
has body: It might be too late, but I see that many solutions posted here use O(n^2) time complexity, this is okay for small inputs, but as you go ahead with large inputs, you might want to reduce time complexity. Here is something which I worked on to do the same in linear time complexity. NOTE : The second solution posted by Arunkumar is constant time complexity. private int getDigits(int num) { int sum =0; while(num &gt; 0) { //num consists of 2 digits max, hence O(1) operation sum = sum + num % 10; num = num / 10; } return sum; } public int addDigits(int N) { int temp1=0, temp2= 0; while(N &gt; 0) { temp1= N % 10; temp2= temp1 + temp2; temp2= getDigits(temp2); // this is O(1) operation N = N/ 10; } return temp2; } Please ignore my variable naming convention, I know it is not ideal. Let me explain the code with sample input , e.g. "12345". Output must be 6, in a single traversal. Basically what I am doing is that I go from LSB to MSB , and add digits of the sum found, in every iteration. The values look like this Initially temp1 = temp2 = 0 N | temp1 ( N % 10) | temp2 ( temp1 + temp2 ) 12345 | 5 | 5 1234 | 4 | 5 + 4 = 9 ( getDigits(9) = 9) 123 | 3 | 9 + 3 = 12 = 3 (getDigits(12) =3 ) 12 | 2 | 3 + 2 = 5 (getDigits(5) = 5) 1 | 1 | 5 + 1 = 6 (getDigits(6) = 6 ) Answer is 6, and we avoided one extra loop. I hope it helps.
type: Answer

http://stackoverflow.com/q/27040096
has comment: http://stackoverflow.com/comment/42599685
score: 0
has comment: http://stackoverflow.com/comment/42599560
upvote count: 1
has comment: http://stackoverflow.com/comment/42600072
has comment: http://stackoverflow.com/comment/42599625
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42599711
favorite count: 0
tagged with: equals
has comment: http://stackoverflow.com/comment/42599976
type: AnsweredQuestion
has title: Java equals causes ArrayIndexOutOfBoundsException
has comment: http://stackoverflow.com/comment/42599667
has comment: http://stackoverflow.com/comment/42599647
has answer: http://stackoverflow.com/a/27040130
accepted answer: http://stackoverflow.com/a/27040130
tagged with: java
has body: I want to compare two Strings in two different arrays. Strings are stored in s1 and s2 variables. This part works great, but if I add if condition, if(s1.equals(s2)){/*...*/}, I get ArrayIndexOutOfBoundsException. Look at these two screen shots: In both cases arrays have same values. The only thing that was changed is the if condition. Image#1 Image#2 Code: Vagon tmp = first; int stevec = 1; while(tmp != null){ double trenutenVolumen = 0; for(int j = 0; j &lt; tmp.opisTovora.length; j++){ trenutenVolumen += tmp.volumenTovora[j]; } double lahkoDodamVolumna = tmp.volumen-trenutenVolumen; double lahkoDodamTeze = lokomotiva.najvecjaMasa-trenutnaTeza; System.out.println("len: "+tmp.opisTovora.length); if(tmp.tipTovora == tipTovora[0] &amp;&amp; lahkoDodamVolumna &gt;= volumenTovora[0] &amp;&amp; trenutnaTeza+tezaTovora &lt;= lokomotiva.najvecjaMasa){ if(!tmp.tipTovora){ String s1 = tmp.opisTovora[0]; String s2 = opisTovora[0]; //if(s1.equals(s2)){ System.out.println(s1 + " == " + s2); System.out.println("LAHKO DODAM TOVOR #" + (i+1) + " =&gt; V VAGON #" + stevec); break; //} } if(tmp.tipTovora){ System.out.println("LAHKO DODAM TOVOR #" + (i+1) + " =&gt; V VAGON #" + stevec); break; } } stevec++; tmp = tmp.next; }
type: Question
has comment: http://stackoverflow.com/comment/42599715
tagged with: indexoutofboundsexception

http://stackoverflow.com/q/27024102
has comment: http://stackoverflow.com/comment/42572594
has comment: http://stackoverflow.com/comment/42572235
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27024141
tagged with: inheritance
has comment: http://stackoverflow.com/comment/42572455
type: Question
has comment: http://stackoverflow.com/comment/42572112
has body: I am trying to implement a constructor for a subclass, however I keep getting "error: class, interface, or enum expected" when I compile. My code for the overall looks like this: public class Super{ //methods go here, no constructor. } Here is what I tried but it did not work: public class Sub extends Super{ private boolean myCondition; public Sub(boolean condition){ super(); myCondition = condition; } } I would assume that I would not need to call super() in the subs constructor as the compiler should implicitly call it. Thanks.
tagged with: constructor
has title: How to declare a constructor in a subclass when the superClass does not have a constructor
answer count: 1
score: 0
tagged with: java

http://stackoverflow.com/q/27013869
has body: I wrote a method which gets as an input an array of numbers and an integer (which will be the delimiter) the method will return a 2D array that is sliced according to the delimiter not including the delimiter. Examples: splitArrayNyNum([0, 0, 0, 3, 1, 1, 1], 3) -&gt; [[0, 0, 0], [1, 1, 1]] splitArrayNyNum([1, 2, 3, 1, 2, 3, 1, 1, 2, 2, 3, 1], 3) -&gt; [[1, 2], [1, 2], [1, 1, 2, 2], [1]] splitArrayNyNum([3 , 1 ,3 ,3], 3) -&gt; [[1]] For some reason when I move my mouse over the name of the method I get the error that my function should return int[][] This is my code: public static int[][] splitArrayByNum(int[] input, int number){ if (input[0]==number) for ( int i = 0 ; i &lt; input.length - 1 ; i++ ) { input[ i ] = input[ i + 1 ] ; } if ((input[(input.length)-1])==number) for ( int i = (input.length)-1 ; i &lt; input.length - 1 ; i++ ) { input[ i ] = input[ i + 1 ] ; } int count = 0; for (int i = 0; i &lt; input.length; i++) { if (input[i] == number) { count++; } int[][] result = new int[count][]; int firstindex=0; int lastindex=0; for (int j=0; j&lt;input.length; j++){ if (input[j]==number){ result[j]=Arrays.copyOfRange(input, firstindex, lastindex); firstindex=lastindex=j; } lastindex++ ; } return result ; }
tagged with: delimiter
favorite count: 0
has comment: http://stackoverflow.com/comment/42553927
type: AnsweredQuestion
has title: Method does not return anything at all
accepted answer: http://stackoverflow.com/a/27014083
score: 1
tagged with: java
tagged with: error-handling
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/27014083
tagged with: arrays
downvote count: 0
answer count: 1
upvote count: 1

http://stackoverflow.com/comment/42664303
score: 0
type: Comment
type: QuestionComment
has text: Sharing is usually done through version control systems. If you use a build tool (maven, ant, gradle, sbt) that both supports, that would be the ideal.
comment on: http://stackoverflow.com/q/27076793

http://stackoverflow.com/comment/42547422
has text: @singhal : yes i do the syso before comparing values are correct
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27009945

http://stackoverflow.com/comment/42694334
score: 0
type: Comment
type: QuestionComment
has text: Thanks Sujan! No, I am not creating a new connection for every insert. I just updated the post with new code.
comment on: http://stackoverflow.com/q/27094056

http://stackoverflow.com/comment/42698501
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27096435
score: 0
has text: possible duplicate of [Big-O value for iteration sof a while loop](http://stackoverflow.com/questions/26052207/big-o-value-for-iteration-sof-a-while-loop)

http://stackoverflow.com/q/27017735
score: 0
answer count: 1
tagged with: extends
linked to: http://stackoverflow.com/q/2745265
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27017874
has comment: http://stackoverflow.com/comment/42560745
duplicate of: http://stackoverflow.com/q/2745265
has body: In extension of a question about the same topic: Is List<Dog> a subclass of List<Animal>? Why aren't Java's generics implicitly polymorphic? I had a follow-up question. Given that you have classes Animal - parent Dog - child Why can't you return a List when you defined your return type as List? private class Animal{}; private class Dog extends Animal{}; public List<Animal> makeAnimalListOfDogs(Dog dog1, Dog dog2){ List<Dog> dogs = new List<Dog>; dogs.add(dog1); dogs.add(dog2); return dogs; } This might seem a useless example, but it is just to clarify the problem. If you try this, you will get the error: Type mismatch: cannot convert from List<Dog> to List<Animal> It is off course possible by replacing return dogs by the following snippet List<Animal> animals = new ArrayList<Animals>(); animals.addAll(dogs) return animals; So the problem is not how to make this work, but WHY doesn't it work. The list dogs IS a list containing animals, given the fact that a dog is an animal, right?
has comment: http://stackoverflow.com/comment/42560657
tagged with: list
tagged with: java
type: Question
has title: Return subclass when superclass is defined as return type
tagged with: data-structures

http://stackoverflow.com/q/27007233
has body: Apart from using class-level validations, is there a way to access the parent bean of a field-level validation annotation from within its validator class? For example: public class CustomValidator implements ConstraintValidator&lt;CustomValidation, String&gt; { @Override public void initialize(final CustomValidation constraintAnnotation) { } @Override public boolean isValid(final String fieldValue, final ConstraintValidatorContext context) { // is there a way to access the parent object here? } }
has title: Is there a way to access the target bean from within a Bean Validation field-level ConstraintValidator?
has answer: http://stackoverflow.com/a/27060487
answer count: 1
accepted answer: http://stackoverflow.com/a/27060487
favorite count: 0
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: nhibernate-validator
tagged with: java
type: Question
tagged with: bean-validation
tagged with: validation
downvote count: 0

http://stackoverflow.com/q/27046463
type: Question
has body: I am writing to ask if anyone knows how to go about this. I do not need the code, I would just like the logic behind doing this. So I have a set {A,B,C,D,E}. Now I want to find all combinations of and or OR operators amongst the values in the set. Some examples below. A and B and C and D and E A and B and C and D or E A and B and C or D and E From what I know there is 2^n-1 possibilities in the case above. So in the specific example above we would have 8 combinations. In addition to the Above the values in the set can have two possibilities. For simplicities sake lets say A can be True or False. Likewise B,C,D and E. So what we would potentially have is something like the following : A=True and B=True and C=True and D=True and E=True A=True and B=True and C=True and D=True and E=False A=True and B=True and C=True and D=True or E=True and so on. So taking this into account we would have 2^(2 * n-1) combinations. So in our specific example above again we would have 16 combinations for a set of 4. Is there an algorithm that already does this? If not would anyone have some logic to implement this in Java Thanks,
has answer: http://stackoverflow.com/a/27052455
answer count: 2
tagged with: algorithm
upvote count: 0
tagged with: logic
has answer: http://stackoverflow.com/a/27046748
tagged with: permutation
has title: Finding all Logical Combinations of a Set
score: -1
has comment: http://stackoverflow.com/comment/42611206
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42611340
tagged with: combinations
tagged with: java
has comment: http://stackoverflow.com/comment/42622103
downvote count: 1
has comment: http://stackoverflow.com/comment/42611259

http://stackoverflow.com/q/27063729
tagged with: design-patterns
has answer: http://stackoverflow.com/a/27064063
answer count: 1
tagged with: java
type: UnansweredQuestion
has title: How to create a proxy for methods?
downvote count: 0
has comment: http://stackoverflow.com/comment/42641765
has comment: http://stackoverflow.com/comment/42641802
favorite count: 0
type: Question
score: 1
has body: The problem I have a service class that contains several methods, as shown below. The specifics of what this class is doing is described at the end of this post. public class Service{ public Foo m_a( /* args_a */ ){ ... } public Bar m_b( /* args_b */ ){ ... } // and so on } All public methods in that service have one thing in common : they call an init() method before doing anything else. So, my service rather looks like this : public class Service{ private int attr; private void init(int val){ this.attr = val; } public Foo m_a(int val_a, ...){ init(val_a); // time for business A } public Bar m_b(int val_b, ...){ init(val_b); // time for business B } // and so on } Since other methods may be added to Service in the future, I think the design above is quite poor. The guy that implements a new method for this class might not follow the rule of calling init(val_x) first, and it may lead to errors. Draft of a solution To ensure that init() is always called, I can create some proxy method that does the job systematically : public class Service{ // Init method private int attr; private void init(int val){ this.attr = val; } /* * The only public method in the service is a proxy, * that always calls init() before calling the actual requested method */ public Object invoke(String method, int val, Map&lt;String,Object&gt; args){ init(val); switch(method){ case "m_a": return m_a(args.get("name"),...); case "m_b": return m_b(args.get("myArg"),...); default: // launch some exception } } private Foo m_a( /* args_a */ ){ ... } private Bar m_b( /* args_b */ ){ ... } // and so on } I think it's a much nicer approach, and a developper that has to maintain the code will have no difficulty to understand what's going on. However I see a large drawback in this solution : the usability for the user ! One must put all its arguments in a Map object before calling the invoke method, instead of entering the arguments directly in the method signature The returned type of invoke is Object, whic…
has comment: http://stackoverflow.com/comment/42642031
upvote count: 1

http://stackoverflow.com/q/27130764
tagged with: entitymanager
has answer: http://stackoverflow.com/a/42839832
favorite count: 0
type: UnansweredQuestion
answer count: 4
has title: How to call a PL/SQL stored function through Java EntityManager
upvote count: 3
has answer: http://stackoverflow.com/a/61752338
has answer: http://stackoverflow.com/a/27130885
type: Question
has answer: http://stackoverflow.com/a/27133976
tagged with: java
has body: I have this function create or replace FUNCTION IFRS_FUNCTION_TEST RETURN NUMBER IS estado NUMBER; excepciones NUMBER; title_code VARCHAR2(150 char); colgaap_code VARCHAR2(150 char); ifrs_code VARCHAR2(150 char); v_causacion VARCHAR2(150 char); pyg_diario_value VARCHAR2(150 char); fecha_valoracion VARCHAR2(150 char); pyg_dialogo VARCHAR2(150 char); CURSOR ifrscursor IS SELECT no_asignado_por_la_entidad, codigo_puc FROM IFRS_351 WHERE no_asignado_por_la_entidad LIKE 'W%' FOR UPDATE; BEGIN BEGIN estado:=0; excepciones:=0; OPEN ifrscursor; LOOP FETCH ifrscursor INTO title_code, colgaap_code; EXIT WHEN ifrscursor%NOTFOUND; SELECT cta_ifrs into ifrs_code FROM ifrs_tabla_homo_351 WHERE codigo_puc_colgaap = colgaap_code; UPDATE IFRS_351 SET codigo_puc = ifrs_code WHERE CURRENT OF ifrscursor; BEGIN SELECT saldo, pyg_diario into v_causacion, pyg_diario_value FROM IFRS_INV_OBL WHERE nro_titulo=title_code; UPDATE IFRS_351 SET vr_mercado_o_valor_presente_ = v_causacion, causacion_valoracion_cuentas = pyg_diario_value WHERE CURRENT OF ifrscursor; EXCEPTION WHEN NO_DATA_FOUND THEN excepciones:=excepciones+1; END; END LOOP; CLOSE ifrscursor; EXCEPTION WHEN OTHERS THEN estado:=SQLCODE; END; RETURN(estado); How can I get the estado value of this function with Java EntityManager? I tried with SELECT IFRS_FUNCTION_TEST() FROM DUAL; but I always obtain the error code 14551.
tagged with: plsql
tagged with: sql
score: 3
downvote count: 0

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/27056672
tags question: http://stackoverflow.com/q/26995116
tags question: http://stackoverflow.com/q/27147737
tags question: http://stackoverflow.com/q/27104357

http://stackoverflow.com/a/42211786
answers question: http://stackoverflow.com/q/27078702
has body: final cant override private can't use in outside class such as subclass. private methods are implicitly final so you can't override. final method not always private so you can access in subclass if this is not private.
type: Answer
score: 0

jax-ws
tags question: http://stackoverflow.com/q/27025708
tags question: http://stackoverflow.com/q/27042286
tags question: http://stackoverflow.com/q/27130105
tags question: http://stackoverflow.com/q/27068743
type: Tag
tags question: http://stackoverflow.com/q/26997331
tag name: jax-ws

http://stackoverflow.com/comment/42685272
comment on: http://stackoverflow.com/a/27088754
score: 0
type: AnswerComment
has text: Thanks. That solved the issue. But I don't understand how that background code made the entire app crash. Is there an explanation for this??
type: Comment

http://stackoverflow.com/q/27117309
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: fault-tolerance
has body: I am trying to understand how Hystrix works with non-fault errors and the HystrixBadRequestException, particularly in the area of validation. I use JSR-303 bean validation (Hibernate validator) for all my beans: public class User { @Min(1L) private Long id; @NotNull @Email private String email; } public class UserValidator { private Validator validator; // Throw exception if the user is invalid; return void otherwise. public void validateUser(User user) { Set&lt;ConstraintViolation&lt;User&gt;&gt; violations = validator.validate(user); if(!violations.isEmpty()) { return new BadEntityException(violations); } } } // Hystrix command. public class SaveUserCommand extends HystrixCommand&lt;User&gt; { public User user; public void doSaveUser(User user) { this.user = user; execute(); } @Override protected User run() { // Save 'user' somehow } @Override protected User getFallback() { return null; } } // My service client that uses my Hystrix command. public class UserClient { private SaveUserCommandFactory factory = new SaveUserCommandFactory(); private UserValidator validator = new UserValidator(); public User saveUser(User user) { SaveUserCommand saveUserCommand = factory.newSaveUserCommand(); validator.validate(user); user = saveUserCommand.doSaveUser(user); return user; } } While this should work, I feel like the HystrixBadRequestException was created for this purpose, and I could somehow be putting the validator inside the command (not outside of it). According to the docs, this exception was intended for non-fault exceptions, including illegal arguments. I'm just not seeing how I could put my validation inside the command and leverage it (such that failed validations don't count against my metrics/stats).
upvote count: 1
answer count: 1
favorite count: 0
tagged with: exception
accepted answer: http://stackoverflow.com/a/27206058
tagged with: hystrix
downvote count: 0
has answer: http://stackoverflow.com/a/27206058
has title: Hystrix: HystrixBadRequestException for failed validations
type: Question

http://stackoverflow.com/comment/42564802
comment on: http://stackoverflow.com/a/27020077
type: AnswerComment
has text: It's not necessarily a memory leak. The process may be hanging on to committed memory out of convenience. Memory usage (as viewed from the OS perspective) is complicated.
score: 0
type: Comment

http://stackoverflow.com/q/27095520
has title: reverse array method not working
favorite count: 0
has answer: http://stackoverflow.com/a/27095643
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27095566
tagged with: java
downvote count: 3
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27095549
has body: Why doesn't this work, but when I move the for loop from the main method to the reverse method it does? public class ReverseArray { public static void main(String[] args) { int[] list = {1, 2, 3, 4, 5}; reverse(list); for (int i = 0; i &lt; list.length; i++) { System.out.print(list[i] + " "); } } public static void reverse(int[] list) { int[] temp = new int[list.length]; for (int i = 0; i &lt; list.length; i++) { temp[i] = list[(list.length - 1) - i]; } list = temp; } }
possible better answer: http://stackoverflow.com/a/27095561
score: -2
accepted answer: http://stackoverflow.com/a/27095643
has answer: http://stackoverflow.com/a/27095561

http://stackoverflow.com/a/27130888
has comment: http://stackoverflow.com/comment/42762747
has comment: http://stackoverflow.com/comment/42769732
score: 0
answers question: http://stackoverflow.com/q/27119049
has body: I found out that the problem was actually with the @test order execution. I didn't realize that junit doesn't run tests in order, I'll be looking into the test suite fixtures.
type: Answer
has comment: http://stackoverflow.com/comment/42760867

http://stackoverflow.com/comment/42581028
score: 1
comment on: http://stackoverflow.com/q/27019855
has text: @mKorbel I think OP means he is adding a custom bean using Mattise (NetBeans' GUI builder) as described [here](http://stackoverflow.com/questions/26848647/custom-bean-class-for-gui-component-in-netbeans/26852264#26852264). Don't think OP has a problem with its bean itself but the target panel not being updated (again, in Matisse Design view) when he edits this custom bean.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42563529
type: Comment
has text: did you tried to cast to chield before getting instance?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27019444

http://stackoverflow.com/comment/42790172
score: 0
type: AnswerComment
type: Comment
has text: this is comming when i open that broken image icon
comment on: http://stackoverflow.com/a/27147104

http://stackoverflow.com/comment/42798597
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27150125
has text: @Joiner Yeah, I need the output to be long format
score: 0

http://stackoverflow.com/q/27080020
has comment: http://stackoverflow.com/comment/42670076
has title: How do I set an array equal to all these inputs?
has comment: http://stackoverflow.com/comment/42669909
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27083021
has body: This program allows the user to create multiple clients. How do I allow an array to be equal to all these inputs? When I display the array the only thing that is shown is the last client added. static String [] clients = new String[100]; void getClient() { String input = new String (" "); for(int i = 0; i &lt; ccount; i++) clients[i] = input; { input = JOptionPane.showInputDialog("Enter client ID: "); while(checkClientID(input) == false) { input = JOptionPane.showInputDialog("Invalid! Only 9 digits allowed. Re-enter client ID: "); }//end while clientID = input; input = JOptionPane.showInputDialog("Enter client name: "); while(checkCname(input) == false) { input = JOptionPane.showInputDialog("Invalid! Only 50 alphabetical characters allowed! Re-enter client name: "); }//end while cname = input; input = JOptionPane.showInputDialog("Enter client address: "); caddress = input; input = JOptionPane.showInputDialog("Enter client email: "); while(checkCemail(input) == false) { input = JOptionPane.showInputDialog("Invalid! Must enter at least one character before @ and .com at end, Re-enter email: "); }//end while cemail = input; input = JOptionPane.showInputDialog("Enter monthly service fees: "); while(checkCfees(input) == false) { input = JOptionPane.showInputDialog("Invalid! Must enter real number with two decimal places, Re-enter monthly service fees: "); }//end while cfees = input; input = JOptionPane.showInputDialog("Enter Employee ID assigned to client: "); while(checkEmpID(input) == false) { input = JOptionPane.showInputDialog("Invalid! Only 9 digits allowed. Re-enter employee ID: "); }//end while cempID = input; mainMenu(); }//end for }//end getClient
has comment: http://stackoverflow.com/comment/42670411
has comment: http://stackoverflow.com/comment/42669959
score: 0
answer count: 1

http://stackoverflow.com/q/27069913
score: 0
tagged with: user-interface
answer count: 1
accepted answer: http://stackoverflow.com/a/27070167
has title: Java LayoutGrid to display another Class
tagged with: swing
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27070167
tagged with: java
has body: I am working on a simple GUI that consists of 3 Java Classes: 1 - the buttons 2 - the screen 3 - Displays the Screen and the Buttons side by side. The concept of the GUI is to somewhat mimic this, but only with the big screen and the buttons: http://www2.explorando.com.br/wp-content/uploads/2008/10/b1183-urna-eletronica-brasileira.jpg My idea for the 3rd class was to make a GridLayout of 1x2 and somehow display the other two classes on the same Grid. How can I do that? Not sure if the code is important here, but here it goes, Class Buttons: package apresentacao; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TelaUrna extends JFrame{ private JButton tecla1; private JButton tecla2; private JButton tecla3; private JButton tecla4; private JButton tecla5; private JButton tecla6; private JButton tecla7; private JButton tecla8; private JButton tecla9; private JButton tecla0; private JButton teclaBranco; private JButton teclaCorrige; private JButton teclaConfirma; private JButton teclaVazia; private JButton teclaVazia2; public TelaUrna() { //instanciar os componentes!!! tecla1 = new JButton(); tecla2 = new JButton(); tecla3 = new JButton(); tecla4 = new JButton(); tecla5 = new JButton(); tecla6 = new JButton(); tecla7 = new JButton(); tecla8 = new JButton(); tecla9 = new JButton(); tecla0 = new JButton(); teclaBranco = new JButton(); teclaCorrige = new JButton(); teclaConfirma = new JButton(); teclaVazia = new JButton(); teclaVazia2 = new JButton(); //configura o container Container container = getContentPane(); container.setLayout(new GridLayout(5, 3)); //configurar os componentes tecla1.setText("1"); tecla1.setForeground(Color.WHITE); tecla1.setBackground(Color.BLACK); tecla2.setText("2"); tecla2.setForeground(Color.WHITE); tecla2.setBackground(Color.BLACK); tecla3.setText("3"); tecla3.setForeground(Color.WHITE); tecla3.setBackground(Color.BLACK); tecla4.setText("4"); tecla4.setForeground(Color.WHITE); tecla4.setBackground(Color.BLACK); tec…

http://stackoverflow.com/a/27065776
score: 1
upvote count: 1
has body: Presuming myProject is your project name, and icons is a simple folder in the project, then saying new Image(null, "icons/settings.png"); is enough. I also recommend: Reading this Properly managing your resources
downvote count: 0
answers question: http://stackoverflow.com/q/27065045
type: Answer

http://stackoverflow.com/comment/42788024
has text: Understood, will think about the design. Thanks!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27145862
type: Comment

http://stackoverflow.com/q/27130429
has comment: http://stackoverflow.com/comment/42763133
tagged with: tomcat
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32206491
linked to: http://stackoverflow.com/q/30500125
has body: I have a Java 1.6 web app in Tomcat with a REST api using Jersey 1.x. In a ContainerRequestFilter, I want to set a property and then retrieve it later. I started with this code in my filter class: containerRequest.getProperties().setProperty("programId","foo"); But how exactly do I retrieve this later? The spec says, "In a Servlet container, the properties are synchronized with the ServletRequest and expose all the attributes available in the ServletRequest. Any modifications of the properties are also reflected in the set of properties of the associated ServletRequest." When I try to retrieve the property, I have a handle to the HttpServletRequest object, but that object doesn't have a ".getProperties()" method. To solve this, I ended up adding a line like this to my filter class: HttpServletRequest.setAttribute("programId", "foo"); Which I was able to pull out later with (String)request.getAttribute("programId"). But I'm curious how those properties are supposed to be retrieved.
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jersey
tagged with: servlets
answer count: 1
downvote count: 0
has title: How to retrieve Jersey ContainerRequest properties?

http://stackoverflow.com/q/27084225
has comment: http://stackoverflow.com/comment/42677711
has comment: http://stackoverflow.com/comment/42677520
has title: Write object toString() to file, formatted neatly in Java
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42677850
favorite count: 0
has answer: http://stackoverflow.com/a/27084410
has comment: http://stackoverflow.com/comment/42677740
tagged with: file-io
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42677704
has comment: http://stackoverflow.com/comment/42677479
score: 1
tagged with: java
has body: I have a polymorphic HashSet that I want to write the toString() of each object in that HashSet to a file so that is is formatted the way it looks when printed to the console. I am able to write everything to the file, but each object is being printed out on one line. I would like to have each object printed the way it's toString() is formatted (every field printed on a new line). Any help would be greatly appreciated. I have tried a bunch of things, but this is what I currently have for my method: public void employeeWriter(String fileName, HashSet&lt;Employee&gt; employees) { try { PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(fileName, false))); for (Employee e : employees) { pw.println(e); } pw.close(); } catch (IOException e) { System.err.println("Error writing to file in employeeWriter()"); e.printStackTrace(); } } Here is the Employee toString() - Every child of Employee has its own toString() method which prints this toString() plus its own unique fields. @Override public String toString() { String output = "\n\t--Employee--" + "\nName:" + "\t\t" + getName() + "\nTitle:" + "\t\t" + this.getClass().getSimpleName() + "\nID: " + "\t\t" + getId() + "\nHire Year:" + "\t\t" + getHireYear() + "\nTax Rate:" + "\t\t" + percentFormatter.format(getTaxRate()) + "\nPay Before Taxes:" + "\t" + formatter.format(getWeeklySalaryBeforeTaxes()) + "\nPay After Taxes:" + "\t" + formatter.format(getWeeklySalaryAfterTaxes()) + "\nWeekly Taxes:" + "\t\t" + formatter.format(getWeeklyTaxes()); return output; }
upvote count: 1
has answer: http://stackoverflow.com/a/27084448
type: Question

http://stackoverflow.com/a/27128533
downvote count: 0
has comment: http://stackoverflow.com/comment/42762413
type: Answer
upvote count: 1
score: 1
has body: ConcurrentHashMap in general suites for my needs but I didn't find way to make take operation atomic Why not use remove in ConcurrentHashMap? Seems it is what you need.
answers question: http://stackoverflow.com/q/27122988

http://stackoverflow.com/comment/42594703
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27036995
has text: Yes, there are ways to do this. What have you tried?

http://stackoverflow.com/a/27105033
has body: Objects of class C are: C(101, "BU1", 1,"2014-11-23"); C(101, "BU1", 2,"2014-11-24"); C(101, "BU1", 3,"2014-11-25"); C(101, "BU1", 4,"2014-11-26") Let's assume that we have A(101,...) B("BU1") Then the pattern C(iValue == $iVal, bId == $bVal,$lsequence : sequence,...) matches any of these C objects, binding $lsequence to 1, 2, 3 and so on. For the first binding, the rule doesn't fire, because no C fact matches sequence == 1-1 For each of the values 2, 3, 4 and so on, the rule will match and collect exactly on C fact into the list, i.e., the one with seuqnce == 1, 2, 3,... respectively. Perhaps this does what you want - but I'm only guessing. rule "collect_other" when $lineItem2: A( $iVal: iValue, $qd2 : quantity ) B( $bVal : bId ) $rowLowerOther: C(iValue == $iVal, bId == $bVal, $lsequence : sequence, $jValue: jAvlDate) not C( iValue == $iVal, bId == $bVal, sequence &lt; $lsequence ) $rowHigherOther : List() from collect(C(iValue == $iVal, bId == $bVal, jAvlDate != $jValue)) then //... end
has comment: http://stackoverflow.com/comment/42714164
accepted answer of: http://stackoverflow.com/q/27102897
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27102897
score: 1
has comment: http://stackoverflow.com/comment/42713684
type: Answer
has comment: http://stackoverflow.com/comment/42714289
upvote count: 1

http://stackoverflow.com/comment/42790196
type: AnswerComment
comment on: http://stackoverflow.com/a/27147405
type: Comment
has text: That makes sense, I had thought the entire object is overwritten.
score: 0

http://stackoverflow.com/comment/42541626
has text: Thanks, will look into OSGi too. Is the main concern with duplicates the enlarged memory footprint of your application? I think that running with exact declared dependency versions is usually more significant than RAM usage?
comment on: http://stackoverflow.com/a/27005658
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42616195
comment on: http://stackoverflow.com/q/27047132
score: 0
type: QuestionComment
has text: Sorry but its not working when the name contains dash(-) .ie. if `Hello--@StackOverflow--@BMWCar--@Bye.' conatains `He-llo--@StackOverflow--@BMWCar--@Bye.' is not working. (He-llo). There size is not being displayed http://picpaste.com/Capture-Uuxd0Rkk.PNG
type: Comment

http://stackoverflow.com/comment/42721491
type: QuestionComment
has text: What i posted was a snippet, I didn't think I needed to post my entire code. The bLine is initialised elsewhere. Should i post the whole thing?
comment on: http://stackoverflow.com/q/27109083
score: 0
type: Comment

http://stackoverflow.com/q/27079462
score: 0
tagged with: java
answer count: 1
type: UnansweredQuestion
has title: java how can we know if field is array of inner classes?
type: Question
has body: I read this tutorial: http://jroller.com/eyallupu/entry/two_side_notes_about_arrays But still cant figure out how to distinguish between primitive, arrays and classes (in reflection) For example: I have the following class: class MainClass { public MainClass() { memberSubClass = new SubClass(); arrayMemberSubClass = new SubClass[3]; for (int i = 0; i &lt; 3; i++) { arrayMemberSubClass[i] = new SubClass(); } array_int_member = new int[5]; } class SubClass { public int x; public short y; } public SubClass memberSubClass; public SubClass[] arrayMemberSubClass; public int int_member; public int[] array_int_member; } And I have the folloing method (in other class): public void doSometing(Object obj) { Field[] fields = obj.getClass().getFields(); for (Field field : fields) { if (field.getType().isArray()) { if (field.getType().isPrimitive()) { logger.debug(field.getName() + " is array of primitives"); } else { logger.debug(field.getName() + " is array of classes"); } } else { if (field.getType().isPrimitive()) { logger.debug(field.getName() + " is primitives"); } else { logger.debug(field.getName() + " is class"); } } } } The output is: 0 [main] DEBUG Logic - memberSubClass is class 1 [main] DEBUG Logic - arrayMemberSubClass is array of classes 1 [main] DEBUG Logic - int_member is primitives 1 [main] DEBUG Logic - array_int_member is array of classes I expected to get the follwing output: 0 [main] DEBUG Logic - memberSubClass is class 1 [main] DEBUG Logic - arrayMemberSubClass is array of classes 1 [main] DEBUG Logic - int_member is primitives 1 [main] DEBUG Logic - array_int_member is array of primitives What am I doing wrong ?
has answer: http://stackoverflow.com/a/27079677
tagged with: reflection

http://stackoverflow.com/comment/42571115
score: 0
comment on: http://stackoverflow.com/a/27023545
type: Comment
has text: @SamIam That all depends on the values the OP wants to convert in each direction. If the OP wants to convert from C to F values between 31 and 40, but wants to convert from F to C values between 30 and 120, you either need two variables, or you need to calculate j as a function of i.
type: AnswerComment

http://stackoverflow.com/a/27069444
type: Answer
has comment: http://stackoverflow.com/comment/42716470
has body: Be aware that @Transaction is moot when you have a separate thread as Transactions are typically thread bound. You will need to get a new entityManager from the factory inside the run(). Also go for @Async which is much cleaner. Again be aware of transactionality with @Async @Async and @Transactional: not working As a general rule of thumb if you want to make some work async - treat that as a single unit of work and a separate transaction.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42725466
has comment: http://stackoverflow.com/comment/42719625
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27066098
has comment: http://stackoverflow.com/comment/42719551
answers question: http://stackoverflow.com/q/27066098
has comment: http://stackoverflow.com/comment/42725215

http://stackoverflow.com/comment/42639710
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27062486
has text: Please forgive me if this was an easy question == 1. read Oracle tutorial How to use Tables, 2. daily asked questions about JTable + JDBC, part of JCalendars has own TableCellEditor/Renderer in API
type: Comment

http://stackoverflow.com/a/27165037
has comment: http://stackoverflow.com/comment/83858182
answers question: http://stackoverflow.com/q/27037896
score: 7
has body: By default wrapping root node in Jackson is disabled. You can wrap inner objects but if you want to wrap root node you need to enable jackson feature for it (https://jira.codehaus.org/browse/JACKSON-747): ObjectMapper objectMapper = new ObjectMapper(); objectMapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); objectMapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); When you enabled these features you already said Jackson to wrap the root element and you don't need @JsonTypeInfo and @JsonTypeName anymore. You can simple delete them. But now you need to customize the root node name and you can use @JsonRootName for it. Your classes should look like this: @JsonIgnoreProperties(ignoreUnknown = true) @JsonRootName("amountTransaction") @JsonInclude(JsonInclude.Include.NON_NULL) public class AmountTransaction { private String clientCorrelator; private String endUserId; ............... } And @JsonIgnoreProperties(ignoreUnknown = true) @JsonRootName("paymentTransactionNotification") @JsonInclude(JsonInclude.Include.NON_NULL) public class PaymentTransactionNotification { private AmountTransaction amountTransaction; ............. } I've tried and Jackson converted both JSON requests as expected.
has comment: http://stackoverflow.com/comment/42829666
upvote count: 7
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27037896

http://stackoverflow.com/comment/42709961
score: 0
type: AnswerComment
has text: So, do you have problems now?
type: Comment
comment on: http://stackoverflow.com/a/27102332

http://stackoverflow.com/comment/42634142
has text: @user3293135 you can use simple java concatenation with variables.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27040079

http://stackoverflow.com/a/48620898
type: Answer
upvote count: 3
score: 3
has body: private void adjustViewerLayoutAndLookAndShow(JasperViewer viewer) { Container contentPane = viewer.getContentPane(); JRViewerToolbar toolbar = (JRViewerToolbar) ((JRViewer)((JPanel)contentPane.getComponents()[0]).getComponent(0)).getComponent(0); JButton btnSave = (JButton) toolbar.getComponent(0); btnSave.setEnabled(false); JButton btnPrint = (JButton) toolbar.getComponent(1); btnPrint.setEnabled(false); viewer.setTitle(extraInfo); viewer.setVisible(true); }
downvote count: 0
answers question: http://stackoverflow.com/q/27050515

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/27098385

http://stackoverflow.com/q/27117732
has comment: http://stackoverflow.com/comment/42737781
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/27117889
has comment: http://stackoverflow.com/comment/42738298
tagged with: sorting
has body: I'm trying to use the following code to sort an ArrayList of object based on date in desc order: List&lt;GalleryBean&gt; gallery_beans = this.galleryAdapter.getGalleryImageList(); Collections.sort(gallery_beans, new Comparator&lt;GalleryBean&gt;() { public int compare(GalleryBean bean1, GalleryBean bean2) { final int BEFORE = -1; final int EQUAL = 0; final int AFTER = 1; /* if(bean1.getMediaDate() &gt; bean2.getMediaDate()){ Log.i("Collections.sort----&gt;", "move bean1 name, long, date ---&gt; ," + bean1.getMediaName() + ", " + bean1.getMediaDate() + ", " + new Date(bean1.getMediaDate()) + ", AFTER bean2 name, long, date ---&gt; "+ bean2.getMediaName() + ", " + bean2.getMediaDate() + ", " + new Date(bean2.getMediaDate())); return AFTER; } else if(bean1.getMediaDate() &lt; bean2.getMediaDate()){ Log.i("Collections.sort----&gt;", "move bean1 name, long, date ---&gt; ," + bean1.getMediaName() + ", " + bean1.getMediaDate() + ", " + new Date(bean1.getMediaDate()) + ", BEFORE bean2 name, long, date ---&gt; "+ bean2.getMediaName() + ", " + bean2.getMediaDate() + ", " + new Date(bean2.getMediaDate())); return BEFORE; } else { return EQUAL; } */ return (int) (bean1.getMediaDate() - bean2.getMediaDate()); } }); for (Iterator&lt;GalleryBean&gt; it = gallery_beans.iterator(); it.hasNext(); i++) { GalleryBean gallery_bean = it.next(); Log.i("ITERATOR----&gt;", "gallery_bean name ---&gt; " + gallery_bean.getMediaName() + " gallery_bean long date ---&gt; " + gallery_bean.getMediaDate() + " gallery_bean date ---&gt; " + new Date(gallery_bean.getMediaDate()*1000)); } From my research the commented out code should work but seems to do nothing. The remaining line does some sorting but it isn't correct either. Here is a snippet of the log output from the return (int) * code below. I'm trying to sort based on date in long unix format. Any help is much appreciated. Regards, JT_Dylan 11-24 21:03:47.407: I/ITERATOR----&gt;(3949): gallery_bean name ---&gt; IMG_20140815_140338.jpg gallery_b…
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42737935
has answer: http://stackoverflow.com/a/27117926
has comment: http://stackoverflow.com/comment/42737975
tagged with: android
has title: Android Collections.sort - doesn't work properly
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/27062825
favorite count: 0
accepted answer: http://stackoverflow.com/a/27187140
upvote count: 2
tagged with: oracle-adf
tagged with: selenium
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42652733
tagged with: java
has comment: http://stackoverflow.com/comment/42653856
type: Question
downvote count: 4
tagged with: automated-tests
score: -2
has answer: http://stackoverflow.com/a/27187140
has body: I'm trying to run a Selenium WebDriver test that works on Firefox and Chrome but "surprisingly" (or not) doesn't work on Internet Explorer 11. so far I've been able to discover that the problem is related to the fact that I am using AJAX and IE does not have the updated DOM Tree after the AJAX request. So, How Can I force to reload a part of the DOM tree after a ajax request? -- All the problems are related with timeout because selenium couldn't find some Element. My Jdev version is Oracle JDeveloper 11g Release 1 (11.1.1.6.0)
tagged with: ajax
has title: Selenium WebDriver test of a Oracle ADF Task Flow application doesn't work on Internet Explorer 11
answer count: 1

http://stackoverflow.com/comment/42677950
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27084448
score: 0
has text: Thanks for that explanation, I will try using System.lineSeparator(). I thought about printing each field with the PrintWriter, but then I would have to account for the unique fields that different Employees have, which would defeat the purpose of polymorphism.

http://stackoverflow.com/q/27093497
has comment: http://stackoverflow.com/comment/42692820
has title: how many letter occur in a text?
upvote count: 0
tagged with: java.util.scanner
type: UnansweredQuestion
has body: I got it working but it is also counting the spaces between the words that are being typed. All i care is for the letters to be count and not the spaces. How or what can i do to change this? where am i messing up or missed something import java.util.Scanner; public class LetterCount { public static void main (String[] args) { System.out.println("Type something "); Scanner n = new Scanner (System.in); String s = ""; s = n.nextLine(); char []c = s.toCharArray(); int sz = c.length; int i =0, j=0, counter=0; for (i=0; i&lt;sz; i++){ counter =0; for(j=0; j&lt;sz; j++) { if (j&lt; i&amp;&amp; c[i] == c[j]) { break; } if (c[j] == c[i]) { counter++; } if (j==sz-1) { System.out.println("the character "+c[i]+" is present "+counter+" times"); } } } } }
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42693691
linked to: http://stackoverflow.com/q/5455794
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/27094442
tagged with: arrays
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/27099547
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/42703578
answer count: 3
has comment: http://stackoverflow.com/comment/42703601
favorite count: 0
has title: How would I make a String which includes brackets? - java
has answer: http://stackoverflow.com/a/27099695
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42703627
upvote count: 1
score: 1
has answer: http://stackoverflow.com/a/27099591
tagged with: java
has answer: http://stackoverflow.com/a/27099609
type: Question
has body: So when i try String string1 = "{"needs_reward":false,"has_voted":false,"sites":[{"id":3922,"name":"RuneTopList","has_voted":false,"vote_url":"http://api.runetoplist.com/vote/out?siteid=3922"},{"id":4613,"name":"RuneLocus","has_voted":false,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4613"},{"id":4339,"name":"UltimatePrivateServers","has_voted":true,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4339"},{"id":4340,"name":"TopG","has_voted":true,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4340"},{"id":4341,"name":"MMORPGToplist","has_voted":true,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4341"},{"id":4622,"name":"Rune-Server","has_voted":true,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4622"},{"id":4623,"name":"GTop100","has_voted":true,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4623"},{"id":4828,"name":"GamingTopList","has_voted":true,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4828"},{"id":4829,"name":"RSPS-List","has_voted":true,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4829"},{"id":4861,"name":"Top100Arena","has_voted":true,"vote_url":"http://api.runetoplist.com/vote/out?siteid=4861"}]}" I get errors because it contains brackets, how would i set this as a string? Thanks for the help.

http://stackoverflow.com/comment/42804736
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27147916
has text: Why/how is `find` not working? Why do you need query conditions if you are bringing the whole collection into memory?

http://stackoverflow.com/a/27019817
has body: change suma.lenght to suma.length, length is the function to find length of array
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27019783

http://stackoverflow.com/comment/42743987
comment on: http://stackoverflow.com/a/27121226
type: Comment
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42585579
score: 5
type: Comment
type: QuestionComment
has text: It is better to show the code
comment on: http://stackoverflow.com/q/27031896

http://stackoverflow.com/comment/42687832
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27090467
has text: So, your immediate problem is that the file is not found. Fix that one first. Make sure the file `seed.txt` exists in the directory where you launch the program. Or use the absolute path of the file.
type: QuestionComment

utf-8
tags question: http://stackoverflow.com/q/27043945
tags question: http://stackoverflow.com/q/27033953
tags question: http://stackoverflow.com/q/27047223
tags question: http://stackoverflow.com/q/27119727
tags question: http://stackoverflow.com/q/27013487
tag name: utf-8
tags question: http://stackoverflow.com/q/27073894
type: Tag

http://stackoverflow.com/comment/42711187
type: QuestionComment
comment on: http://stackoverflow.com/q/27103388
score: 0
has text: I have called the method setData() instead of variable, and removed question 10 that is outside the array parameters. My call to method is advising over ride able method in constructor. Still does not display data.
type: Comment

http://stackoverflow.com/comment/42741295
comment on: http://stackoverflow.com/q/27119770
score: 0
type: Comment
type: QuestionComment
has text: *Bounced means in what sense ?* Wrong sender or wrong domain or something else ?

http://stackoverflow.com/q/27109953
tagged with: jackson
score: 4
upvote count: 4
answer count: 2
accepted answer: http://stackoverflow.com/a/27117097
downvote count: 0
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/27245614
has body: I am trying to Convert following POJO to a JSON in @RestController: @Entity @Table(name="user_location") @NamedQuery(name="UserLocation.findAll", query="SELECT u FROM UserLocation u") public class UserLocation implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private String addr1; private String addr2; private String landmark; private BigDecimal lat; private BigDecimal lng; private String zipcode; //bi-directional many-to-one association to City @ManyToOne private City city; //bi-directional many-to-one association to State @ManyToOne private State state; public UserLocation() { } //Getter - Setters } Nested City.java is as follow: @Entity @NamedQuery(name="City.findAll", query="SELECT c FROM City c") @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property="@id", scope = City.class) public class City implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private String name; //bi-directional many-to-one association to State @ManyToOne @JsonIgnore private State state; //bi-directional many-to-one association to UserLocation @OneToMany(mappedBy="city") @JsonIgnore private List&lt;UserLocation&gt; userLocations; public City() { } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } @JsonProperty("state") public State getState() { return this.state; } public void setState(State state) { this.state = state; } public List&lt;UserLocation&gt; getUserLocations() { return this.userLocations; } public void setUserLocations(List&lt;UserLocation&gt; userLocations) { this.userLocations = userLocations; } public UserLocation addUserLocation(UserLocation userLocation) { getUserLocations().add(userLocation); userLocation.setCity(this); return…
possible better answer: http://stackoverflow.com/a/27245614
tagged with: spring-mvc
has title: Jackson with Spring MVC duplicate nested objects not deserializing
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27117097
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/42630566
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27057679
has text: did you run grunt to install your js dependencies?
score: 0

http://stackoverflow.com/a/27017186
has comment: http://stackoverflow.com/comment/42559826
answers question: http://stackoverflow.com/q/27010184
has comment: http://stackoverflow.com/comment/42560941
type: Answer
score: 2
downvote count: 0
has body: Pointcuts in Spring AOP or AspectJ cannot only be based on manually added annotations, but also on other common traits of the methods you want to intercept, such as package name patterns, class name patterns, method name patterns, method signatures (certain parameter types), class hierarchies (e.g. macht all subclasses of a certain class or interface) and any combinations thereof. You can probably get pretty far with that. But in order to give a more concrete answer I would have to know more about your code. Update: Now that you told me the common denominator, I have an idea for you: package de.scrum_master.aspect; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.web.bind.annotation.RequestMapping; public aspect RequestMappingInterceptor { @Pointcut( "within(@org.springframework.stereotype.Controller *) &amp;&amp; " + "@annotation(requestMapping) &amp;&amp; " + "execution(* *(..))" ) public void controller(RequestMapping requestMapping) {} @Before("controller(requestMapping)") public void advice(RequestMapping requestMapping, JoinPoint thisJoinPoint) { System.out.println(thisJoinPoint); System.out.println(" " + requestMapping); System.out.println(" " + requestMapping.method()[0]); } } This example intercepts all public methods in all controllers and additionally binds the request mapping annotation to a parameter which you can easily evaluate.
has comment: http://stackoverflow.com/comment/42562797
has comment: http://stackoverflow.com/comment/42561793
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27010184

http://stackoverflow.com/comment/42775949
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27139043
has text: You beat me by a little bit... that's the result I get, the questioner's program produces the same answer as the calculator but shifted left by 1 bit.
type: AnswerComment

jboss
tags question: http://stackoverflow.com/q/27143854
tags question: http://stackoverflow.com/q/27126141
tags question: http://stackoverflow.com/q/27092941
tags question: http://stackoverflow.com/q/27129245
tags question: http://stackoverflow.com/q/27123154
tags question: http://stackoverflow.com/q/27123737
tags question: http://stackoverflow.com/q/27016330
tags question: http://stackoverflow.com/q/27129573
tags question: http://stackoverflow.com/q/27099448
tag name: jboss
tags question: http://stackoverflow.com/q/27099163
tags question: http://stackoverflow.com/q/27017672
tags question: http://stackoverflow.com/q/27039249
tags question: http://stackoverflow.com/q/26999016
tags question: http://stackoverflow.com/q/27012022
tags question: http://stackoverflow.com/q/27084247
type: Tag
tags question: http://stackoverflow.com/q/27071747
tags question: http://stackoverflow.com/q/27088157
tags question: http://stackoverflow.com/q/27079164
tags question: http://stackoverflow.com/q/27076049
tags question: http://stackoverflow.com/q/27072758
tags question: http://stackoverflow.com/q/27019584
tags question: http://stackoverflow.com/q/27139893
tags question: http://stackoverflow.com/q/27006345
tags question: http://stackoverflow.com/q/27058636
tags question: http://stackoverflow.com/q/27042164
tags question: http://stackoverflow.com/q/27135796
tags question: http://stackoverflow.com/q/27133231
tags question: http://stackoverflow.com/q/27066037
tags question: http://stackoverflow.com/q/27050827
tags question: http://stackoverflow.com/q/27060259
tags question: http://stackoverflow.com/q/27103847
tags question: http://stackoverflow.com/q/27001497
tags question: http://stackoverflow.com/q/27130866
tags question: http://stackoverflow.com/q/27133633
tags question: http://stackoverflow.com/q/26995995
tags question: http://stackoverflow.com/q/27105082
tags question: http://stackoverflow.com/q/27148130

http://stackoverflow.com/q/27031464
type: Question
has comment: http://stackoverflow.com/comment/42585257
accepted answer: http://stackoverflow.com/a/27031582
tagged with: java
score: 0
has title: Manipulate all elements of an array at once
tagged with: arrays
possible better answer: http://stackoverflow.com/a/27031521
has answer: http://stackoverflow.com/a/27031521
favorite count: 0
has body: I'm assuming the answer is no, but I'm looking for a way to manipulate all of the elements in an array at once, rather than writing a loop. For example, the code below creates two arrays and then errors. Obviously the commented lines don't work, but I would like to avoid writing a loop for every function I need to apply. package com.company; import java.util.Arrays; public class Main { public static void main(String[] args) { int[] foo = new int[10]; int[] bar = new int[10]; for (int i = 0; i &lt; 10; i++){ bar[i]=i; } foo += bar; // want to add elements of these arrays pairwise. this fails. bar += 1; // want to add 1 to each element of the array. this also fails. System.out.println(Arrays.toString(foo)); } }
has comment: http://stackoverflow.com/comment/42584912
has answer: http://stackoverflow.com/a/27031633
has comment: http://stackoverflow.com/comment/42584945
has answer: http://stackoverflow.com/a/27031582
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27032188
upvote count: 1
has comment: http://stackoverflow.com/comment/42584917
downvote count: 1