http://stackoverflow.com/q/26313893
has answer: http://stackoverflow.com/a/26314351
score: 0
tagged with: exception
accepted answer: http://stackoverflow.com/a/26313920
tagged with: throw
has title: check condition using try and catch block-java
has body: I understand the basic try-catch, where we put methods that could possibly throw exceptions in the try block. But when we need to check if something is wrong, and throw an exception, is it correct to use the code below? And the exception is caught, the program will continue to execute? I can't tell why the try is needed here, but without it eclipse says 'syntax error'. Thanks for your help in advance! public run (){ if (something !=true) { try{ throw new Exception(); }catch (Exception e){ }
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26313920
type: Question
tagged with: try-catch
answer count: 2
possible better answer: http://stackoverflow.com/a/26314351

http://stackoverflow.com/comment/41314766
comment on: http://stackoverflow.com/q/26325071
score: 0
type: Comment
type: QuestionComment
has text: YeahYeah, I want to print 4 elememts at a time. @Limantara

http://stackoverflow.com/a/26217632
has body: Add the -ea option to your java command line when you run your program
downvote count: 0
answers question: http://stackoverflow.com/q/26217590
score: 6
type: Answer
upvote count: 6

http://stackoverflow.com/q/26330088
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26335867
tagged with: java
linked to: http://stackoverflow.com/q/1689096
type: Question
has title: How to convert bounding box coordinates to radius?
has comment: http://stackoverflow.com/comment/41324183
accepted answer: http://stackoverflow.com/a/26335867
has comment: http://stackoverflow.com/comment/41324314
has comment: http://stackoverflow.com/comment/41324213
score: 0
tagged with: openstreetmap
has body: I am given a bounding box, latitude and longitude, which are the following: Bounding box = 59.3518076,59.5915769,24.55017,24.9262831 Latitude = 59.4372155 Longitude = 24.7453688 My question is, how do i convert bounding box into radius using those 3 parameters?
has comment: http://stackoverflow.com/comment/41324133
answer count: 1
tagged with: nominatim

http://stackoverflow.com/q/26262940
has comment: http://stackoverflow.com/comment/41200913
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41200880
tagged with: scala
has answer: http://stackoverflow.com/a/26264086
tagged with: scalafx
type: AnsweredQuestion
tagged with: java
has body: The code I'm running is from the homepage of http://www.scalafx.org. There are no compiler warnings but when it runs I get the exception. I first tried using jdk 1.7 with Scala 2.11 and ScalaFX 2.9.3-2.2.67 and got the equivalent error. I still get it with jdk 1.8 with Scala 2.11 and ScalaFX 2.11-8.0.20-R6. I'm hoping I'm stupidly missing something simple. This is all that gets written to the console: "C:\Program Files (x86)\Java\jdk1.8.0_20\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\rt.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\sunpkcs11.jar;C:\Pro…
type: Question
has title: ClassNotFoundException: HelloStageDemo
accepted answer: http://stackoverflow.com/a/26264086
tagged with: intellij-idea

http://stackoverflow.com/a/26255114
has body: Use AsyncTask on Network Operations. This is an example: private class YourTask extends AsyncTask&lt;Void, Void, String&gt; { @Override protected String doInBackground(Void... arg0) { String xml = null; try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // return XML return xml; } @Override protected void onPostExecute(String result) { // result is your xml. You can use it here. } @Override protected void onPreExecute() {} @Override protected void onCancelled() {} } You can call this thread with new YourTask().execute((Void)null); Good luck.
score: 0
answers question: http://stackoverflow.com/q/26254937
type: Answer

http://stackoverflow.com/comment/41168308
has text: As an aside, you can make your code nicer by creating a single named class that implements `Runnable` and takes a name (`"t1"`, `"t2"` and so on) as a constructor argument.
score: 1
comment on: http://stackoverflow.com/q/26244778
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41271519
score: 0
comment on: http://stackoverflow.com/q/26300203
has text: I downloaded this `com.microsoft.tfs.sdk-11.0.0.jar` before make the question but I couldn't find out how to use it to make what I want to do.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26199245
tagged with: string-formatting
upvote count: 1
downvote count: 1
has body: I need a little bit of advice on a project I'm working on. I am creating an ascii ticket that bases its content on what you input into a scanner. Each line should contain 51 characters between borders and include the event , date/time, and location. The event gets its own line and the date/time and location share a line. Heres what it ought to look like |_________________YOUR EVENT HERE___________________| |DATE AND TIME___________________EVENT LOCATION HERE| The underscores are just there to show you how much space is between border and string, it does not actually show up in the program. I understand you should use a for loop to determine how many spaces go before and after your string, but i'm lost as to how to accomplish this.
type: AnsweredQuestion
tagged with: java
tagged with: ascii
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/26199911
has title: Center a string on a line of a specific number of characters
answer count: 1
score: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26199911

http://stackoverflow.com/q/26350667
answer count: 1
has title: Changing the way my code prints out
tagged with: string-formatting
has comment: http://stackoverflow.com/comment/41361925
type: AnsweredQuestion
tagged with: java
score: 0
tagged with: formatting
has answer: http://stackoverflow.com/a/26350809
type: Question
has comment: http://stackoverflow.com/comment/41361893
has body: I need help figuring out how to change the way my code prints out, I understand that it is going to do something dealing with n, n-1, n-2,... etc for the spacing, but how do I do this so that I get this 1 2 1 3 2 1 ... 3 2 1 instead of this 1 1 2 1 2 3 1 2 3... . //A program that displays the pattern of a number entered in increasing order import java.util.Scanner; public class DisplayPattern { public static void main(String ar[]) { //Initialize Scanner Scanner input = new Scanner(System.in); //Get user input/ start loop while (true) { //Receive user input System.out.println("Enter a positive integer to display pattern: "); int x = input.nextInt(); //Show user output displayPattern(x); //Continuation of loop System.out.println("Do you want to continue (Y/N)?"); String s = input.nextLine(); s = input.nextLine(); s = s.toLowerCase(); if (s.charAt(0) == 'n') break; } } public static void displayPattern(int n) { //Create pyramid of numbers with increasing order for(int i=1;i&lt;=n;i++) { for(int j=i;j&gt;0;j--) { System.out.print(" "+j); } System.out.print("\n"); } } }
accepted answer: http://stackoverflow.com/a/26350809

http://stackoverflow.com/comment/41253608
has text: If you want to optimize heap usage, make sure the `Strings` in your `List` get removed from the `List` and all references are release as soon as you are done with them. There is no deep profiling to this, that is Java 101. Unless you are getting `OutOfMemoryExceptions` there is no problem here. Just look at the `Related` side bar, this has been discussed ad nauseum on Stackoverflow.
comment on: http://stackoverflow.com/q/26290043
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/q/26215498
has answer: http://stackoverflow.com/a/26383555
has answer: http://stackoverflow.com/a/26383254
has title: Send back to MainActivity after logged in to Facebook
downvote count: 0
tagged with: facebook-graph-api
has answer: http://stackoverflow.com/a/26345799
accepted answer: http://stackoverflow.com/a/26345799
favorite count: 0
has body: I followed a Facebook tutorial to make a loginbutton for my app, and it works with login, but I have some questions that I would need help from you guys. I have one Activity &amp; one Fragment. When you start up my app, you will see a png-image that is the logo, plus a 'login to facebook' button. When you press the login button, you will be sent to Facebook for the auth, and after the log in you will be send back to the MainActivity again. Now the MainActivity have the logo and the Facebook button says 'log out'. So this is fine, but my question is: What is the best thing to do AFTER you logged in?? Create a new class that you will be sent after the login, or be send back to the MainActivity? What do real programmer do after the auth? And if its better to send back to the MainActivity, how then can I remove the logo png image after login? I mean, that is nice to have before you login, but after the login, the picture should be gone. Same thing with the Facebook LOGOUT button, how do I remove it, or atleast put it somewhere else? I though to make an Actionbar to but the logout button there. This is the core I use for the Activity &amp; the Fragment. So, should I do a new class to send the user after login, or should i send the user mack to the activity, and if yes, how remove the logo/logout button after logged in? Thank you. EDIT: IF the best way is to create a new class and send the user to the new class after login, WHERE in the code should I write that? I tried OnClickListener, but it never sends the user to the new class AFTER LOGIN. Thank you. LoginACTIVITY. import android.os.Bundle; import android.support.v4.app.FragmentActivity; import com.facebook.widget.LoginButton; public class LoginActivity extends FragmentActivity { private LoginFragment loginFragment; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { // Add the fragment on initial activity setup loginFragment = new LoginFrag…
has answer: http://stackoverflow.com/a/26382028
has answer: http://stackoverflow.com/a/26215976
answer count: 5
tagged with: android
possible better answer: http://stackoverflow.com/a/26383555
tagged with: android-studio
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: authentication
upvote count: 1
type: Question

http://stackoverflow.com/comment/41217125
type: Comment
type: QuestionComment
score: 0
has text: Instead of DistributedCache.addCacheFile(new URI("/user/training/listOfWords"), conf); try this DistributedCache.addCacheFile(new URI("/user/training/listOfWords"), job.getConfiguration());
comment on: http://stackoverflow.com/q/26241628

jhipster
tag name: jhipster
tags question: http://stackoverflow.com/q/26223959
type: Tag
tags question: http://stackoverflow.com/q/26348877
tags question: http://stackoverflow.com/q/26219052

http://stackoverflow.com/q/26221990
linked to: http://stackoverflow.com/q/513832
tagged with: android
has answer: http://stackoverflow.com/a/26222010
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41125620
upvote count: 2
has comment: http://stackoverflow.com/comment/41126039
has comment: http://stackoverflow.com/comment/41125503
downvote count: 1
has comment: http://stackoverflow.com/comment/41125846
has comment: http://stackoverflow.com/comment/41142830
type: AnsweredQuestion
has body: I have a String response_content of length=1 in a java project and I know that it equals to 1 (ASCII 49). I know this, because the following lines (in Eclipse with android ADT+SDK) Log.i("GET RESPONSE", response_content); Log.i("GET RESPONSE", response_content.length()); Log.i("GET RESPONSE", response_content.codePointAt(0)); produce this output: 1 1 49 But why do these lines always return false? if (response_content.equals(1)) {...} if (response_content == "1") {...} I know equals() is the adequate way, == is just for testing purposes. Is there another way of telling me, what the string really contains or is there a mistake I don't see?
possible better answer: http://stackoverflow.com/a/26222059
has title: String-Comparison in java does not match
score: 1
accepted answer: http://stackoverflow.com/a/26222010
tagged with: java
has answer: http://stackoverflow.com/a/26222059
has comment: http://stackoverflow.com/comment/41125472
has comment: http://stackoverflow.com/comment/41125524
has comment: http://stackoverflow.com/comment/41125455
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41127991
tagged with: string-comparison
has comment: http://stackoverflow.com/comment/41152704
has comment: http://stackoverflow.com/comment/41125444

http://stackoverflow.com/q/26283815
has comment: http://stackoverflow.com/comment/41239367
linked to: http://stackoverflow.com/q/79041428
has comment: http://stackoverflow.com/comment/41257556
has title: Button not functioning
has comment: http://stackoverflow.com/comment/41239418
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/41257817
has comment: http://stackoverflow.com/comment/41239949
has answer: http://stackoverflow.com/a/26284134
has comment: http://stackoverflow.com/comment/41240186
score: 0
tagged with: java
answer count: 1
has body: I'm developing an app.. In my MainActivity, once the main layout appears user is given a button, which leads to another class. I ran the app on my phone, unfortunately, when i press the button nothing happens. Below I've included the button function and the class that to be called after the button press. package com.androidhive.googleplacesandmaps; import java.util.ArrayList; import java.util.HashMap; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.text.Html; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Button; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; public class MainActivity extends Activity { // flag for Internet connection status Boolean isInternetPresent = false; // Connection detector class ConnectionDetector cd; // Alert Dialog Manager AlertDialogManager alert = new AlertDialogManager(); // Google Places GooglePlaces googlePlaces; // Places List PlacesList nearPlaces; // GPS Location GPSTracker gps; // Button Button btnShowOnMap; // Progress dialog ProgressDialog pDialog; // Places Listview ListView lv; // ListItems data ArrayList<HashMap<String, String>> placesListItems = new ArrayList<HashMap<String,String>>(); // KEY Strings public static String KEY_REFERENCE = "reference"; // id of the place public static String KEY_NAME = "name"; // name of the place public static String KEY_VICINITY = "vicinity"; // Place area name @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); cd = new ConnectionDetector(getApplicationContext()); // Check if Internet present isInternetPresent = cd.isConnectingToInternet(); if (!isInternetPresent) { …
type: UnansweredQuestion

java
tags question: http://stackoverflow.com/q/26293573
tags question: http://stackoverflow.com/q/26281504
tags question: http://stackoverflow.com/q/26263211
tags question: http://stackoverflow.com/q/26321352
tags question: http://stackoverflow.com/q/26331221
tags question: http://stackoverflow.com/q/26279805
tags question: http://stackoverflow.com/q/26285861
tags question: http://stackoverflow.com/q/26203674
tags question: http://stackoverflow.com/q/26349046
tags question: http://stackoverflow.com/q/26330809
tags question: http://stackoverflow.com/q/26321331
tags question: http://stackoverflow.com/q/26332364
tags question: http://stackoverflow.com/q/26327487
tags question: http://stackoverflow.com/q/26314313
tags question: http://stackoverflow.com/q/26311771
tags question: http://stackoverflow.com/q/26306269
tags question: http://stackoverflow.com/q/26203676
tags question: http://stackoverflow.com/q/26316036
tags question: http://stackoverflow.com/q/26194617
tags question: http://stackoverflow.com/q/26217127
tags question: http://stackoverflow.com/q/26319515
tags question: http://stackoverflow.com/q/26335025
tags question: http://stackoverflow.com/q/26316361
tags question: http://stackoverflow.com/q/26230862
tags question: http://stackoverflow.com/q/26300395
tags question: http://stackoverflow.com/q/26330519
tags question: http://stackoverflow.com/q/26219804
tags question: http://stackoverflow.com/q/26349636
tags question: http://stackoverflow.com/q/26330779
tags question: http://stackoverflow.com/q/26214782
tags question: http://stackoverflow.com/q/26336495
tags question: http://stackoverflow.com/q/26353020
tags question: http://stackoverflow.com/q/26281417
tags question: http://stackoverflow.com/q/26263152
tags question: http://stackoverflow.com/q/26299343
tags question: http://stackoverflow.com/q/26290831
tags question: http://stackoverflow.com/q/26295200
tags question: http://stackoverflow.com/q/26265564
tags question: http://stackoverflow.com/q/26322804
tags question: http://stackoverflow.com/q/26353640
tags question: http://stackoverflow.com/q/26315574
tags question: http://stackoverflow.com/q/26285627
tags question: http://stackoverflow.com/q/26280293
tags question: http://stackoverflow.com/q/26341152
tags question: http://stackoverflow.com/q/26279208
tags question: http://stackoverflow.com/q/26325896
tags question: http://stackoverflow.com/q/26242545
tags question: http://stackoverflow.com/q/26349006
tags question: http://stackoverflow.com/q/26336029
tags question: http://stackoverflow.com/q/26322735
tags question: http://stackoverflow.com/q/26319500
tags question: http://stackoverflow.com/q/26278451
tags question: http://stackoverflow.com/q/26323398
tags question: http://stackoverflow.com/q/26353517
tags question: http://stackoverflow.com/q/26246291
tags question: http://stackoverflow.com/q/26199417
tags question: http://stackoverflow.com/q/26327895
tags question: http://stackoverflow.com/q/26260200
tags question: http://stackoverflow.com/q/26311784
tags question: http://stackoverflow.com/q/26214019
tags question: http://stackoverflow.com/q/26328390
tags question: http://stackoverflow.com/q/26288284
tags question: http://stackoverflow.com/q/26248205
tags question: http://stackoverflow.com/q/26337629
tags question: http://stackoverflow.com/q/26252551
tags question: http://stackoverflow.com/q/26312114
tags question: http://stackoverflow.com/q/26195233
tags question: http://stackoverflow.com/q/26297409
tags question: http://stackoverflow.com/q/26226531
tags question: http://stackoverflow.com/q/26281165
tags question: http://stackoverflow.com/q/26322409
tags question: http://stackoverflow.com/q/26352244
tags question: http://stackoverflow.com/q/26205628
tags question: http://stackoverflow.com/q/26342175
tags question: http://stackoverflow.com/q/26204201
tags question: http://stackoverflow.com/q/26196037
tags question: http://stackoverflow.com/q/26250493
tags question: http://stackoverflow.com/q/26298430
tags question: http://stackoverflow.com/q/26349852
tags question: http://stackoverflow.com/q/26200851

http://stackoverflow.com/comment/41266736
has text: I'm afraid I already read that one but thanks anyway I'll continue my drilling and let you know If I find anything usefull ;)
score: 0
comment on: http://stackoverflow.com/q/26280720
type: Comment
type: QuestionComment

edit-distance
type: Tag
tag name: edit-distance
tags question: http://stackoverflow.com/q/26214206

http://stackoverflow.com/q/26268988
tagged with: android
accepted answer: http://stackoverflow.com/a/26269091
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41212481
tagged with: import
has title: effects of extra imported classes in java
possible better answer: http://stackoverflow.com/a/26268998
has answer: http://stackoverflow.com/a/26268998
has body: in http://source.android.com/source/code-style.html I read about use fully qualify imports. But I am curious about the negative affects of not using imports explicitly. For instance, if I use the following code package blabla; import foo.*; import hee.*; import lee.*; ... ... public class ImportKing { ... } from my understanding, when this class--ImportKing is used anywhere in the project, the classloader will load any classes it imported, therefore will consume extra system memory for needless imports. testing code: //import java.*; public class ImportKing { public static void main(String[] args) { while(true) { System.out.println("running"); } } } testing result: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND shanwu 3316 39.8 0.6 3182012 52196 pts/0 Sl+ 09:25 0:03 java ImportKing with extra imports shanwu 3440 43.7 0.6 3182012 52752 pts/0 Sl+ 09:27 0:03 java ImportKing without extra imports I didn't see any negative effects on program performance for extra imports. Is extra imports handled by java compiler, so we don't have problem like wasting system memory?
linked to: http://stackoverflow.com/q/147454
has answer: http://stackoverflow.com/a/26269091
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41214654
tagged with: classloader
type: Question
answer count: 2

http://stackoverflow.com/comment/41334301
score: 0
has text: You just "assume" your decompiler successfully decompiled the entire .apk with all its .class files in it so youre able to rebuild and run it again... i hardly doubt that in the first place while in your case it is possible you just dont have the dependency containing iching.android.contentprovider packed to the rest of the application correctly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26335471

http://stackoverflow.com/a/26297706
has body: Most probably the ant thinks, that there is a path involved, that needs fixing. The executable usually only point to the binary and then you add the args. ant.exec(executable: 'rmdir', failonerror: true) { arg(value: '/Q') arg(value: '/S') arg(value: '&lt;path to folder&gt;') } And BTW: there is also ant.delete(dir:'&lt;path to folder&gt;')
downvote count: 0
answers question: http://stackoverflow.com/q/26293817
has comment: http://stackoverflow.com/comment/41266580
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41267491

http://stackoverflow.com/comment/41342837
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26339005
score: 0
has text: Can you confirm version `2.1.1` of [sonar checkstyle plugin](http://docs.codehaus.org/display/SONAR/Checkstyle+Plugin) is being used?

http://stackoverflow.com/comment/41351446
comment on: http://stackoverflow.com/a/26344916
score: 0
type: AnswerComment
has text: How can `curr_hour` be both less than 1 *and* more than 14? (I'm personally treating the end as exclusive and the start as inclusive... that's a common approach.)
type: Comment

http://stackoverflow.com/comment/41301652
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26317982
has text: _I have to write a program for class_ ... then do. If you need help, come back with a specific problem
score: 0

http://stackoverflow.com/a/26340055
has body: Here is an example of what you could do with Java 8 : public List&lt;String&gt; getMostRepeatedWords(String s) { Map&lt;String,Integer&gt; map = new HashMap&lt;&gt;(); String[] words = s.split("\\s+"); for (String word : words) map.put(word,map.containsKey(word) ? map.get(word) + 1 : 0); List&lt;Entry&lt;String,Integer&gt;&gt; tmp = new ArrayList&lt;&gt;(map.entrySet()); Collections.sort(tmp,(e1,e2) -&gt; Integer.compare(e2.getValue(),e1.getValue())); return tmp.stream().map(e -&gt; e.getKey()).collect(Collectors.toList()); } This method computes the complete list of the words sorted by decreasing number of occurrences. If you don't need the whole list, you should rather store the entries of the map in an array and then apply a quickselect on it, with a custom Comparator. Let me know if you are interested and I'll go in further details.
downvote count: 0
answers question: http://stackoverflow.com/q/26339547
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/26352510
accepted answer: http://stackoverflow.com/a/26372191
has title: Java program hangs on TTransport transport = new THttpClient("this.host.com")
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I'm writing a Thrift application that can take input from an outside website and process it. However, the program is hanging at the line: TTransport transport = new THttpClient("this.host.com"); And I'm not sure why it's happening. It's not giving me any error messages and such but it also doesn't progress forward. It just hangs when I receive a request from a client that calls buildModel(). Here's my code: private void buildModel() throws UnknownHostException { // Map of user preferences by Mahout user id FastByIDMap&lt;Collection&lt;Preference&gt;&gt; userIDPrefMap = new FastByIDMap&lt;Collection&lt;Preference&gt;&gt;(); System.out.println("Building model"); try { TTransport transport = new THttpClient(this.host); TProtocol protocol = new TBinaryProtocol(transport); MyCustomDatabase.Client client = new MyCustomDatabase.Client(protocol); ConnectionParams con_params = new ConnectionParams(); con_params.setUser(this.username); con_params.setPassword(this.password); Connection con = client.open_connection(con_params); ResultSet res = client.execute_sql(con, "select * from " + this.database + "." + this.tableName, null); for (Tuple t : res.getTuples()) { List&lt;ByteBuffer&gt; cells = t.getCells(); int userID = Integer.parseInt(new String(cells.get(0).array())); int itemID = Integer.parseInt(new String(cells.get(1).array())); int ratingValue = Integer.parseInt(new String(cells.get(2).array())); Collection&lt;Preference&gt; userPrefs = userIDPrefMap.get(userID); if (userPrefs == null) { userPrefs = Lists.newArrayListWithCapacity(2); userIDPrefMap.put(userID, userPrefs); } userPrefs.add(new GenericPreference(userID, itemID, ratingValue)); } } catch(Exception e) { e.printStackTrace(); } this.delegate = new GenericDataModel(GenericDataModel.toDataMap(userIDPrefMap, true)); } Any help greatly appreciated!
tagged with: thrift
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26372191

http://stackoverflow.com/comment/41260268
comment on: http://stackoverflow.com/a/26294408
type: AnswerComment
has text: I have attempted the third solution except i must have done something wrong as the output is incorrect, i have updated my original code to show what i have done.
score: 0
type: Comment

http://stackoverflow.com/q/26226989
type: Question
has answer: http://stackoverflow.com/a/26227057
accepted answer: http://stackoverflow.com/a/26227057
possible better answer: http://stackoverflow.com/a/26227033
tagged with: arraylist
answer count: 3
upvote count: 1
downvote count: 0
has title: How to get the actual integer value from an array list
tagged with: towers-of-hanoi
favorite count: 0
has answer: http://stackoverflow.com/a/26227033
has answer: http://stackoverflow.com/a/26227107
has comment: http://stackoverflow.com/comment/41135781
type: AnsweredQuestion
has body: I am using an ArrayList of ArrayLists for a data structure to play a game of towers of hanoi. The game is constructed and initialized as follows: private ArrayList&lt;ArrayList&gt; lists = new ArrayList&lt;ArrayList&gt;(); private ArrayList&lt;Integer&gt; peg1 = new ArrayList&lt;Integer&gt;(); private ArrayList&lt;Integer&gt; peg2 = new ArrayList&lt;Integer&gt;(); private ArrayList&lt;Integer&gt; peg3 = new ArrayList&lt;Integer&gt;(); //Constructor public TowersOfHanoi() { lists.add(null); lists.add(peg1); lists.add(peg2); lists.add(peg3); } public ArrayList initializeGame(int n) { for (int i = 0; i &lt; n; i++) { peg1.add(i+1); } return peg1; } } I am trying to use a Boolean method to do a check and make sure the user doesn't try to move a larger disc on top of a smaller disc, however, I don't understand how I would grab the the integer value stored in the arrayList. The integer values should serve as a way to gauge the diameter of the discs. I.E. 1 is smaller than two is smaller than 3 etc. This is the code I have come up with... I believe I am just getting the indexes and not the actual values of the integers stored there. How can I get the actual values? public boolean isMoveLegal(int moveFrom, int moveTo){ ArrayList&lt;Integer&gt; fromPeg = lists.get(moveFrom); int x = (fromPeg.remove(0)).intValue(); ArrayList&lt;Integer&gt; toPeg = lists.get(moveTo); int y = (toPeg.get(0)).compareTo(x); if(x&lt;y){ System.out.println("illegal move"); } return false; }
has comment: http://stackoverflow.com/comment/41135129
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41135170
has comment: http://stackoverflow.com/comment/41135138

http://stackoverflow.com/comment/41285594
comment on: http://stackoverflow.com/a/26308913
type: AnswerComment
score: 0
type: Comment
has text: Ah I can see, I have just removed it.

http://stackoverflow.com/comment/41133739
has text: np. but contains does not make it brute-force. I am also curious to see the answer of this question. Was she expecting you to use indexes? :-)
comment on: http://stackoverflow.com/q/26226176
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26311241
type: Answer
has comment: http://stackoverflow.com/comment/41289756
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41289777
answers question: http://stackoverflow.com/q/26311208
has comment: http://stackoverflow.com/comment/41289826
has body: If you're just running the same code, trying to update entity instead of saving it, it'll gonna fail. To update an entity with this method, you must not create a new ItemType, but get it from db, using session.get(ItemType.class, id); - that way hibernate will understand, that this entity is already in db, and try to update it, not to save a new one
downvote count: 0

utf
tag name: utf
tags question: http://stackoverflow.com/q/26202236
type: Tag

http://stackoverflow.com/q/26288284
has comment: http://stackoverflow.com/comment/41248217
tagged with: java
has comment: http://stackoverflow.com/comment/41248102
type: Question
has comment: http://stackoverflow.com/comment/41248080
tagged with: arrays
has comment: http://stackoverflow.com/comment/41248255
tagged with: iteration
has comment: http://stackoverflow.com/comment/41248156
score: 0
has title: how to iterate to a specific element location in an array
answer count: 0
has comment: http://stackoverflow.com/comment/41248379
type: UnansweredQuestion
has body: I have a line of DNA(genetics) text. A like is 3 BILLION elements wide if inserted into an array. I have another file with the specific location numbers of the items i want. I would like to go straight to that elementLocation and get the value in there. What is the most efficient way to do this? In other words, tellling java to "go to location 2234834 and get me the item in there.", but in an iterative manner...I have about 1 Milllion locations to go through

http://stackoverflow.com/a/26281624
score: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/41235940
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/41235128
answers question: http://stackoverflow.com/q/26281350
has comment: http://stackoverflow.com/comment/41237051
has body: PQcopy is just a second reference to the actual PriorityQueue object. You want to clone the original PQ instead of just assigning the reference. PriorityQueue has a constructor which does this for you: PriorityQueue&lt;PQExample&gt; PQCopy = new PriorityQueue&lt;PQExample&gt;(PQ) Incidentally, you should follow capitalization conventions for Java - starting variable names with capital letters is frowned upon.

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/26304174
tags question: http://stackoverflow.com/q/26267378
tags question: http://stackoverflow.com/q/26270795
tags question: http://stackoverflow.com/q/26211215
tag name: jfreechart

http://stackoverflow.com/q/26280157
type: Question
has body: I want to do jpeg lossless compression while uploading file, this is testing code I have written, am not able to execute it (run time error), attached exception code, did I iss anything InputStream inputStream = new FileInputStream("E:\\pics\\Original\\testCompress\\bouncy-crayon-playland-2.JPG"); BufferedImage image = ImageIO.read(inputStream); JPEGImageWriter writer = (JPEGImageWriter) ImageIO.getImageWritersByFormatName("JPEG-LS").next(); ImageWriteParam param = writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionType("JPEG-LS"); writer.setOutput(ImageIO.createImageOutputStream(new File("E:\\pics\\Original\\testCompress\\bouncy-crayon-playland-2-compressed.JPG"))); writer.write(null, new IIOImage(image, null, null), param); It's giving error: Exception in thread "main" java.util.NoSuchElementException at javax.imageio.spi.FilterIterator.next(Unknown Source) at javax.imageio.ImageIO$ImageWriterIterator.next(Unknown Source) at javax.imageio.ImageIO$ImageWriterIterator.next(Unknown Source) Any suggestions ?
score: -1
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/17187880
favorite count: 0
has title: Java Advanced Imaging error while doing jpeg lossless compression
has answer: http://stackoverflow.com/a/26281826
accepted answer: http://stackoverflow.com/a/26281826
type: AnsweredQuestion
tagged with: java
downvote count: 1

http://stackoverflow.com/q/26300181
has title: Google Calendar API (Java) - Invalid time format when creating Google Calendar Event
possible better answer: http://stackoverflow.com/a/26300919
favorite count: 0
tagged with: google-calendar-api
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26300919
has body: I'm using Java Google API client and I'm trying to create a Google Calendar Event.My authentication and calendar service initialization works (I'm able to log in and fetch my calendars events). The problem occurs when creating the event. Here is my code: Event event = new Event(); event.setSummary( title ); event.setStart( new EventDateTime().setDate( new DateTime( new Date() ) ) ); event.setEnd( new EventDateTime().setDate( new DateTime( new Date() ) ) ); return _calendarService.events().insert( GOOGLE_CALENDAR_ID, event ).execute(); Here is the error I get: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "errors" : [ { "domain" : "global", "message" : "Invalid value for: \"T\" found, can only parse bare date string: 2014-10-10T15:58:06.165+03:00", "reason" : "invalid" } ], "message" : "Invalid value for: \"T\" found, can only parse bare date string: 2014-10-10T15:58:06.165+03:00" } Any ideas what I'm doing wrong here?
type: Question
has answer: http://stackoverflow.com/a/26304675
accepted answer: http://stackoverflow.com/a/26304675
score: 1
tagged with: java
answer count: 2
upvote count: 1

http://stackoverflow.com/q/26247466
has answer: http://stackoverflow.com/a/45927547
has answer: http://stackoverflow.com/a/45777911
has answer: http://stackoverflow.com/a/51585651
has answer: http://stackoverflow.com/a/30398936
type: AnsweredQuestion
score: 2
tagged with: numbers
upvote count: 2
tagged with: java
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/41173112
answer count: 8
has title: Java Prime Number Method
has comment: http://stackoverflow.com/comment/48886638
has answer: http://stackoverflow.com/a/42278343
has comment: http://stackoverflow.com/comment/41173158
has body: The question is exactly as follows: Write a method that determines whether a number is prime. Then use this method to write an application that determines and displays all the prime numbers less than 10,000. I have already written a program that finds all prime numbers up to 10,000, but then found a simpler and more efficient one on StackOverflow, and that is this: package prime; import java.util.Scanner; public class Prime { public static void main(String[] args) { for(int i = 1; i &lt;= 10000; i++) { int factors = 0; int j = 1; while(j &lt;= i) { if(i % j == 0) { factors++; } j++; } if (factors == 2) { System.out.println(i); } } } } Since I am very new to Java and am especially not good at methods, this problem is especially difficult for me. I tried making a method, but nothing is being returned, and when I try to return something I get error after error after error. The help I need is mainly just Pseudo-Code for what I should do to tackle this problem; I'm not asking you for the answer, I'm just asking for a start.
has comment: http://stackoverflow.com/comment/41173094
has answer: http://stackoverflow.com/a/26247563
downvote count: 0
has answer: http://stackoverflow.com/a/26247591
has answer: http://stackoverflow.com/a/53254113
favorite count: 0
accepted answer: http://stackoverflow.com/a/26247563
possible better answer: http://stackoverflow.com/a/45927547

http://stackoverflow.com/a/26255871
has comment: http://stackoverflow.com/comment/41191039
answers question: http://stackoverflow.com/q/26254665
score: 3
accepted answer of: http://stackoverflow.com/q/26254665
has comment: http://stackoverflow.com/comment/41190799
has body: I recommend using XML files and using JAXB to load them. Why? Because of the following pros: Because it is awefully simple. No external libraries are needed. The config file is well readable (simple XML), it can be edited with any text editors or advanced XML editors. It is flexible enough to add other data later on to the parameters. Also very easy to modify/save parameters from code at runtime (see at the end). Thanks to XML you don't have to worry about character encoding (like in case of properties files). Modelling: First you need to create classes to "model" your parameters: class Parameters { @XmlElement(name = "item") public List items; } class Item { public String fileName; public String contentType; } Example input XML file: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> item1.txt individual item2.txt group Loading the parameters And this is how you can load it, it's only 1 method call: Parameters p = JAXB.unmarshal(new File("params.xml"), Parameters.class); for (Item item : p.items) System.out.println(item.fileName + ": " + item.contentType); Output: item1.txt: individual item2.txt: group Alternative (simplified) XML input To make the input XML file shorter, more easily readable, we can make the following change: class Item { @XmlAttribute public String fileName; @XmlAttribute public String contentType; } Here we basically specified to store/read the data of an Item as XML attributes and not as child elements. With this modification the input XML: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Modifying and Saving parameters at runtime If we want to modify the parameters and save them at runtime, it is just as easy as loading them: one line only. Below I modify the first item, and I also create and add a new third item: // Modify item #1 p.items.get(0).fileName = "item11.txt"; p.items.get(0).contentType = "short"; // Create and add a new item Item item3 = new Item(); item3.fileName = "item3.txt"; item3.contentType = "newtype"; p.items.ad…
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/comment/41131649
comment on: http://stackoverflow.com/a/26220713
score: 0
type: AnswerComment
has text: @maaartinus Ah, if only all optimization problems were that easy!
type: Comment

http://stackoverflow.com/q/26246308
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/41171227
type: Question
has title: How to combine the GUI class and the scanner class?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26246328
score: 1
has body: I'm new in java and well I'm trying to create a program that will first ask the user to for some number and will output a volume, area and so on. Also I want to display a rectangle I don't know how that can be done because my program runs fine it just won't display the rectangle. What can I do? package testchap3; import java.util.*; import javax.swing.JApplet; import java.awt.*; public class Chapter_3 extends JApplet { public void paint(Graphics page) { page.drawRect(50,50,60,60); } public static void main(String[] args) { int lenght,width,height,volume,Area,Perimeter; Scanner scan = new Scanner(System.in); System.out.println("What is the lenght:"); lenght = scan.nextInt(); System.out.println("What is the height:"); height = scan.nextInt(); System.out.println("What is the width:"); width= scan.nextInt(); volume = (lenght*height*width); Area= volume/height; Perimeter= lenght+width+lenght+width; System.out.println("Your volume is:"+volume); System.out.println("Your Area is:"+ Area); System.out.println("Your perimeter is:"+Perimeter); } }
favorite count: 0
type: UnansweredQuestion
tagged with: java.util.scanner
tagged with: java
has comment: http://stackoverflow.com/comment/41171037

http://stackoverflow.com/comment/41922915
type: AnswerComment
has text: I understand now, since MIDI needs a soundbank, it's not possible to know if the note is fading out. I guess I could still fade out the colour, if I find an instrument with a nice fade out time. Thank you for all your help. Now I've got the fun part of tinkering with my program, and maybe adding more things, so I can learn more about java.
type: Comment
comment on: http://stackoverflow.com/a/26272775
score: 0

http://stackoverflow.com/comment/41195113
has text: There is nothing in Java that supports what you want (making an object immutable without changing the class / writing the class to be immutable in the first place)
score: 0
comment on: http://stackoverflow.com/q/26259957
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26276507
has comment: http://stackoverflow.com/comment/41228468
type: Answer
has body: To make use of updatable ResultSet , your table must contain primary key column. It is the link between data present in ResultSet and DB. Since I infer from your comments your table does not contain primary key, you can delete row using sql query. String sql = "DELETE FROM contact WHERE first_name='test'"; stmt.executeUpdate(sql);
score: 0
answers question: http://stackoverflow.com/q/26271469
has comment: http://stackoverflow.com/comment/41255957

http://stackoverflow.com/q/26318575
has answer: http://stackoverflow.com/a/26318599
possible better answer: http://stackoverflow.com/a/26318621
accepted answer: http://stackoverflow.com/a/26318613
has comment: http://stackoverflow.com/comment/41303085
has answer: http://stackoverflow.com/a/26318645
has title: Instead of using for loop, how do I make a loop where you tell it the amount of times you want it to loop?
type: AnsweredQuestion
has body: How would I create a loop where it has a condition, but in addition you can decide how many times you want it to loop. I know that the for loop does this, but what if I want a specific integer to determine how many times it will loop? Example //for loop below for(int x = 0; x &lt; 10; x++) { } Instead of doing the for loop (above), is there a way to choose a specific number of times you want it to loop, so that you can enter an integer variable in a properly which will tell it how many times you want it to loop?
type: Question
has answer: http://stackoverflow.com/a/26318639
has answer: http://stackoverflow.com/a/26318613
score: 0
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/41302580
has answer: http://stackoverflow.com/a/26318621
answer count: 5

http://stackoverflow.com/q/26337240
tagged with: java
has comment: http://stackoverflow.com/comment/41337384
tagged with: authentication
type: Question
has comment: http://stackoverflow.com/comment/41337484
tagged with: active-directory
score: 0
has comment: http://stackoverflow.com/comment/41400315
tagged with: ldap
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41338381
tagged with: spring
has body: We have a customer, which uses LDAP for most of the applications deployed in its Enterprise. Naturally, our product also uses same LDAP for authentication. While performing the authentication check (not using IWA), we are accepting username/password using form based interface. Later service queries LDAP using Spring LDAPTemplate to check if the provided credentials are valid. In case of invalid credentials, service internally maintains a count against the user id. If that count has cross the specified limit, it locks user and does not allow to login in our product. While the failed count was implemented with the intention of throttling invalid attempts at Product level and there by ensuring LDAP account doesn't get locked (LDAP lock count could be higher). Hence even if the user gets locked in our product, with the legitimate credentials he can still continue with other apps. The situation may arise, if someone tries to login in our product using someone else's credentials. Is this thought correct? OR we should get rid of locking feature at the product level and continue to make request to LDAP, till the account gets locked at LDAP? Scenario Organization XYZ Ltd. has LDAP which is used for Product A, Product B and also for Windows OS authentication. LDAP has login failure count as 15. There are two users Mr. P, Mr. Q. Locking at product level (Max login fail count is 5) Mr. Q, tries to login in Product A, using user id of Mr. P with incorrect password. Mr. Q, tries 5 times and hence Mr. P's account is locked in product. LDAP login failure count is updated to 5. Mr. P tries to login in Product A and he gets a message as Account is locked. Mr. P has still access to Windows OS and he can still access other applications. No Locking at product level Mr. Q, tries to login in Product A, using user id of Mr. P with incorrect password. Mr. Q, tries 15 times and hence Mr. P's account is locked in product. LDAP login failure count is updated to 15. Mr. P tries to login in Prod…
has title: LDAP authentication throttling
has comment: http://stackoverflow.com/comment/41342204
answer count: 0

http://stackoverflow.com/a/26285958
has comment: http://stackoverflow.com/comment/41244809
answers question: http://stackoverflow.com/q/26285297
has body: I'm not sure how a solution that uses a while loop and recursion would loop like, since I can't read your professor's mind, but I can think of two different solutions that use one or the other. Using while loop : You don't run your algorithm an arbitrary number of iterations (100000 in your example) and hope that you got close enough to the expected result. You use a while loop, and on each iteration you check if your current calculation of Pi is close enough to your target. public static double Algorithm() { int m = 1; double Pi = 0.0; while (countDigits(Pi) &lt; 6) { Pi += 4*(Math.pow(-1, m-1)/((2*m)-1)); // I'm assuming this formula works m++; } return Pi; } Using recursion : The same solution can be translated into a recursion. This time, you supply an initial index m (1) and an initial value of Pi (0) to Algorithm. The method adds the m'th term to Pi. If the new value of Pi is not good enough (determined by countDigits), you make a recursive call that would add the m+1th term to Pi and check again if the new value is good enough. The recursion would stop when the value of Pi is 6 digits accurate. public static double Algorithm(int m,double Pi) { Pi += 4*(Math.pow(-1, m-1)/((2*m)-1)); if (countDigits(Pi) &lt; 6) Pi += Algorithm(m+1,Pi); return Pi; } You call the method with : Algorithm (1,0.0);
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26285297
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41245619
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41245055
has comment: http://stackoverflow.com/comment/41245401

http://stackoverflow.com/comment/41251215
type: Comment
type: QuestionComment
has text: If you're starting with an app, i strongly recommend that you use Java EE 7, then you can use the @Schedule
comment on: http://stackoverflow.com/q/26290096
score: 2

http://stackoverflow.com/a/26262050
has comment: http://stackoverflow.com/comment/41199357
answers question: http://stackoverflow.com/q/26261095
accepted answer of: http://stackoverflow.com/q/26261095
downvote count: 0
score: 1
has body: A method call in a GString needs curly brackets, otherwise the parents don't get parsed as part of the call: class Foo { def getBar() { 'get bar' } def bar() { 'method bar' } } foo = new Foo() assert "$foo.bar()".toString() == "get bar()" assert "${foo.bar()}".toString() == "method bar"
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41199446
upvote count: 1
type: Answer

http://stackoverflow.com/a/26204041
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/26203984
downvote count: 0
type: Answer
has body: No, -q switch is used to suppress all the messages that are logged to console (except error level) and print statement. If You execute the following script: task lol lol &lt;&lt; { println '1' } lol &lt;&lt; { logger.lifecycle '2' } without -q switch You'll get both 1 and 2 in output. With -q switch only 1 will be printed. &lt;&lt; operator is completely different thing - it's used to add action to a task. See this answer for details.

http://stackoverflow.com/q/26210694
has answer: http://stackoverflow.com/a/26210783
tagged with: path
type: AnsweredQuestion
has title: Java - Display relative path to a root directory
tagged with: java
accepted answer: http://stackoverflow.com/a/26210783
type: Question
has body: I am writing a small Java program to list files in a root directory recursively. This is the code I used. public static void displayDirectoryContents(File dir) { File[] files = dir.listFiles(); for (File file : files) { if (file.isDirectory()) { displayDirectoryContents(file); } else { System.out.println(file.getPath()); } } } public static void main(String[] args) throws IOException { File currentDir = new File("root-direcotry"); displayDirectoryContents(currentDir); } The result I got is something like: root-direcotry/1.txt root-direcotry/2.txt root-direcotry/t1/a.txt root-direcotry/t2/b.txt root-direcotry/t4/c.txt My question is can I just display the relative path without the "root-direcotry"? i.e. What I want to achieve is displaying: /1.txt /2.txt /t1/a.txt /t2/b.txt /t4/c.txt I prefer not using any String method to just not display that part. Thank you!
answer count: 1
score: 0

http://stackoverflow.com/comment/41167846
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26244312
type: QuestionComment
has text: What you are asking for makes no sense in Android. Your design is wrong. What are you trying to do? Why would you want to call the constructor of a super class? Are you aware that you should NEVER create activities anyway other than via an `Intent'?

http://stackoverflow.com/q/26236683
type: AnsweredQuestion
downvote count: 0
has title: Hiding methods in subclass
tagged with: methods
tagged with: member-hiding
type: Question
has answer: http://stackoverflow.com/a/26237048
tagged with: java
tagged with: inheritance
score: 4
possible better answer: http://stackoverflow.com/a/26236943
tagged with: method-hiding
accepted answer: http://stackoverflow.com/a/26236763
has body: I have a abstract superclass with some implemented methods. Is it possible to hide methods from this superclass in an subclass inheriting from this superclass? I don't want to have some methods visible from the superclass in some of the subclasses. Last but not least, is it possible to change the number of arguments for a method in the subclass which has the same name in the superclass? Let's say we have a method public void test(int a, int b) in the superclass but now I want a method public void test(int a) in the subclass which calls the superclass function and the method from the superclass not visible anymore.
favorite count: 0
has answer: http://stackoverflow.com/a/26236763
upvote count: 4
has answer: http://stackoverflow.com/a/26236955
answer count: 4
has answer: http://stackoverflow.com/a/26236943

http://stackoverflow.com/comment/41082055
has text: It would be better to initialize the array in a `for` loop; for example: `char[] c = new char[26]; for (char letter = 'a'; letter <= 'z'; letter++) c[letter-'a'] = letter;`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26198550

http://stackoverflow.com/comment/41363489
score: 0
type: Comment
type: QuestionComment
has text: @user2864740 that is irrelevant, the title of question is "Does MySQL index foreign key columns automatically?"
comment on: http://stackoverflow.com/q/26351715

http://stackoverflow.com/q/26305917
tagged with: http-redirect
upvote count: 1
has comment: http://stackoverflow.com/comment/41279856
has comment: http://stackoverflow.com/comment/41279980
has answer: http://stackoverflow.com/a/26306144
score: 1
has answer: http://stackoverflow.com/a/26306048
tagged with: java
has body: String contextPath="http://chf-www05/manuals"; response.sendRedirect(contextPath +"/zseries9.pdf"); This redirect is from a servlet and it is redirecting to a PDF residing on an external webserver. The task is the pdf should open in a new window when this servlet is being called. I tried the 'window.open' using a '' tag but it didn't work as desired.
has comment: http://stackoverflow.com/comment/41279908
has comment: http://stackoverflow.com/comment/41279925
tagged with: servlets
type: Question
answer count: 3
has title: response.sendRedirect should open in a new window
downvote count: 0
has comment: http://stackoverflow.com/comment/41279852
favorite count: 0
has answer: http://stackoverflow.com/a/26305964
tagged with: http://stackoverflow.com/tag/pdf
type: UnansweredQuestion

http://stackoverflow.com/comment/41263464
has text: @Aleksandr M, I m new in struts2 and I am working on the project where I was facing this problem, as Roman Suggested me, I read about <interceptor-ref name="basicStack"> and tried to understand what is does, and applied but It doesn't not worked. I didn't understand what is going but It works now.
comment on: http://stackoverflow.com/a/26243070
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26334802
downvote count: 0
type: Answer
has body: According to the oracle Javadoc: http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newDirectoryStream(java.nio.file.Path) When not using the try-with-resources construct, then directory stream's close method should be invoked after iteration is completed so as to free any resources held for the open directory. What You do wrong is calling the newDirectoryStream in the for loop, so You cannot use it's methods. I only think, You should do it that way (If You don't want to use try-with-resources): DirectoryStream&lt;Path&gt; dirStream = Files.newDirectoryStream(FileSystems.getDefault().getPath("/proc"), "[0-9]*"); for (Path processPath : dirStream) { // your logic } dirStream.close();
answers question: http://stackoverflow.com/q/26334421
upvote count: 3
score: 3

http://stackoverflow.com/q/26284022
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41239785
has body: Is Joda parsing this ISO 8601 datetime string incorrectly? DateTimeFormatter f = DateTimeFormat.forPattern("EEE MMM ee kk:mm:ss z y").withZone(DateTimeZone.UTC).withLocale(Locale.US); DateTimeFormatter dtf = ISODateTimeFormat.dateTimeNoMillis(); dt = dtf.parseDateTime("2015-04-01T11:40:59Z"); System.out.println(f.print(dt)); This outputs Wed Apr 03 11:40:59 UTC 2015 but notice the input string specified April 01
tagged with: date
type: Question
tagged with: jodatime
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26284113
accepted answer: http://stackoverflow.com/a/26284113
has title: Is JodaTime parsing this datetime incorrectly?
favorite count: 0
tagged with: datetime
tagged with: date-parsing
downvote count: 0
score: 1

unit-testing
tags question: http://stackoverflow.com/q/26342874
tags question: http://stackoverflow.com/q/26279041
tags question: http://stackoverflow.com/q/26329661
tags question: http://stackoverflow.com/q/26326228
tags question: http://stackoverflow.com/q/26229954
tags question: http://stackoverflow.com/q/26201389
tags question: http://stackoverflow.com/q/26334277
tags question: http://stackoverflow.com/q/26332340
tags question: http://stackoverflow.com/q/26323173
tags question: http://stackoverflow.com/q/26345650
tags question: http://stackoverflow.com/q/26251223
tags question: http://stackoverflow.com/q/26348871
tags question: http://stackoverflow.com/q/26329977
type: Tag
tags question: http://stackoverflow.com/q/26320127
tags question: http://stackoverflow.com/q/26274705
tag name: unit-testing
tags question: http://stackoverflow.com/q/26234385
tags question: http://stackoverflow.com/q/26296653
tags question: http://stackoverflow.com/q/26269575
tags question: http://stackoverflow.com/q/26245288
tags question: http://stackoverflow.com/q/26252794
tags question: http://stackoverflow.com/q/26335288
tags question: http://stackoverflow.com/q/26279787
tags question: http://stackoverflow.com/q/26323930

http://stackoverflow.com/comment/41271129
type: Comment
score: 2
has text: "Swing programs should override `paintComponent()` instead of overriding `paint()`."—[*Painting in AWT and Swing: The Paint Methods*](http://www.oracle.com/technetwork/java/painting-140037.html#callbacks).
type: QuestionComment
comment on: http://stackoverflow.com/q/26301007

apache
tags question: http://stackoverflow.com/q/26209693
tag name: apache
tags question: http://stackoverflow.com/q/26208245
tags question: http://stackoverflow.com/q/26290633
tags question: http://stackoverflow.com/q/26323044
tags question: http://stackoverflow.com/q/26326654
tags question: http://stackoverflow.com/q/26235176
tags question: http://stackoverflow.com/q/26275484
tags question: http://stackoverflow.com/q/26327722
tags question: http://stackoverflow.com/q/26206474
tags question: http://stackoverflow.com/q/26352637
tags question: http://stackoverflow.com/q/26241918
tags question: http://stackoverflow.com/q/26250309
tags question: http://stackoverflow.com/q/26317659
tags question: http://stackoverflow.com/q/26339242
tags question: http://stackoverflow.com/q/26292885
tags question: http://stackoverflow.com/q/26345628
tags question: http://stackoverflow.com/q/26206466
tags question: http://stackoverflow.com/q/26335089
tags question: http://stackoverflow.com/q/26339757
type: Tag
tags question: http://stackoverflow.com/q/26290294
tags question: http://stackoverflow.com/q/26329188

http://stackoverflow.com/q/26327239
upvote count: 7
tagged with: java-8
has title: Java 8 Hash Map
type: AnsweredQuestion
tagged with: java-stream
score: 7
tagged with: java
has body: I have a map Map&lt;String, List&lt;Double&gt; and I would like to find the maximum (or minimum) value in all of the lists. The function should return the maximum (or minimum) value and the key belonging to that value. The signature may be public static Pair&lt;String,Double&gt; getKeyValue(Map&lt;String, List&lt;Double&gt;&gt; map, BinaryOperator&lt;Double&gt; function) which gets the map and the function Double::max or Double::min How can i implement this efficiently (and beautifully) using java 8, stream api ?
type: Question
accepted answer: http://stackoverflow.com/a/26347328
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26327379
has answer: http://stackoverflow.com/a/26327379
has answer: http://stackoverflow.com/a/26347328

http://stackoverflow.com/q/26230811
type: Question
type: AnsweredQuestion
tagged with: nio
accepted answer: http://stackoverflow.com/a/26231220
answer count: 3
score: 5
favorite count: 0
has answer: http://stackoverflow.com/a/26231139
has answer: http://stackoverflow.com/a/50104731
upvote count: 6
linked to: http://stackoverflow.com/q/6619516
possible better answer: http://stackoverflow.com/a/26231139
has answer: http://stackoverflow.com/a/26231220
has title: Wrapping InputStream to non blocking ReadableByteChannel
tagged with: java
has body: Is it possible to create non blocking ReadableByteChannel from InputStream object? Channel.newChannel(inputStream) - produces channel which could be blocked by blocked InputStream.read invocation
downvote count: 1

http://stackoverflow.com/a/26206880
answers question: http://stackoverflow.com/q/26206823
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26206823
has comment: http://stackoverflow.com/comment/41096900
has body: in this check if(ja.get(i) &gt; 0){ ja.set(i, 1); } if(ja.get(i) &lt; 0){ ja.set(i, -1); }else{ ja.set(i, 0); } an else is missing. correct it to if(ja.get(i) &gt; 0){ ja.set(i, 1); } else if(ja.get(i) &lt; 0){ ja.set(i, -1); } else { ja.set(i, 0); } you are currently first checking, if the number is greater than 0. after that you always check, if the number is smaller than 0. eg: you have a 42: check if > 0 => entry set to 1 after that: check if &lt; 0 => false, so set to 0
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26242246
downvote count: 0
has body: When you remove the ith element, the i+1th element becomes the ith element. And since you increment i in each iteration, you skip half of the elements in the list. This loop would remove all the elements : for(int i = 0; i &lt; list.size();) { list.remove(i); } Javadoc : public E remove(int index) Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Now, if you wish to iterate over all the elements of the list while removing just some of them, you can do the following : for(int i = 0; i &lt; list.size(); i++) { if (someCondition) { list.remove(i); i--; } } This will make sure you don't skip any element.
type: Answer
answers question: http://stackoverflow.com/q/26242227
score: 10
upvote count: 10

http://stackoverflow.com/a/26295648
downvote count: 0
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41261288
answers question: http://stackoverflow.com/q/26295574
has comment: http://stackoverflow.com/comment/41260927
has body: That is because BufferedImage[] img = null; You have to initialize img array with BufferedImage[] img = new BufferedImage[s.length];

http://stackoverflow.com/comment/41146801
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26233227
has text: OK then post your logcat so that i can figure out clearly what is the problem
score: 1

http://stackoverflow.com/comment/41299651
type: AnswerComment
comment on: http://stackoverflow.com/a/26311883
score: 0
has text: If you read the stacktrace, Spring is already creating a proxy for the class.
type: Comment

http://stackoverflow.com/a/26351791
has comment: http://stackoverflow.com/comment/41364244
has body: You never initialize hand, which is a member variable of your Game class. ArrayLists must be initialized before you can invoke their methods. The following line from dealCard() will always throw a NullPointerException: hand.add(tempCard); Modify the line where hand is declared to look like this: private ArrayList&lt;Card&gt; hand = new ArrayList&lt;Card&gt;(); As Radiodef mentions, it would be even better to use a standard constructor.
type: Answer
answers question: http://stackoverflow.com/q/26351644
score: 0

http://stackoverflow.com/comment/41175515
has text: great just need a way to turn that for into a recursive method too
score: 0
comment on: http://stackoverflow.com/a/26248563
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26310228
answers question: http://stackoverflow.com/q/26310046
has comment: http://stackoverflow.com/comment/41289371
upvote count: 3
type: Answer
has body: Sort the ranges by their starting dates Combine adjacent ranges if they overlap. This will leave you with ranges that do not overlap.
score: 3
has comment: http://stackoverflow.com/comment/41294114
downvote count: 0

http://stackoverflow.com/q/26274382
tagged with: java
has answer: http://stackoverflow.com/a/26274689
has comment: http://stackoverflow.com/comment/41222005
has comment: http://stackoverflow.com/comment/41222231
answer count: 2
tagged with: sql
has body: itemID STRING purchesPrice DOUBLE quantity DOUBLE vendor STRING unitM STRING jcombo1=CB_vendor.getSelectedItem().toString(); jcombo2=CB_unit.getSelectedItem().toString(); conn=ShopDb.database(); Sql_insert="insert into table itemmanag(itemID,purchesPrice,sellPrice,quantity,vendor,unitM) values ( "+txt_itemID.getText()+"','"+Item_Pprice.getText()+"','"+txt_itemSprice.getText() +"','"+txt_qunti.getText()+"','" +jcombo1+"','"+jcombo2+ " ')"; ERROR: you have an error in your sql syntax ; check the manual that corresponds to your MYSQL SERVER version for the right syntanx to use near"table itemmanage(itemID,purchesPrice,quantity,vendor, unitM)values(DA atline 1
upvote count: 0
score: -6
favorite count: 0
accepted answer: http://stackoverflow.com/a/26274689
has comment: http://stackoverflow.com/comment/41221922
has comment: http://stackoverflow.com/comment/41222124
downvote count: 6
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26274756
has comment: http://stackoverflow.com/comment/41221928
tagged with: syntax
has answer: http://stackoverflow.com/a/26274756
has comment: http://stackoverflow.com/comment/41222131
type: Question
has title: Java GUI syntax error in SQL statment

selenium-webdriver
tags question: http://stackoverflow.com/q/26285474
tags question: http://stackoverflow.com/q/26335815
tags question: http://stackoverflow.com/q/26237774
tags question: http://stackoverflow.com/q/26252277
tags question: http://stackoverflow.com/q/26250493
tags question: http://stackoverflow.com/q/26201817
tags question: http://stackoverflow.com/q/26283231
tags question: http://stackoverflow.com/q/26281027
tags question: http://stackoverflow.com/q/26304224
tags question: http://stackoverflow.com/q/26340508
tags question: http://stackoverflow.com/q/26273252
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/26291324
tags question: http://stackoverflow.com/q/26250959
tags question: http://stackoverflow.com/q/26205915
tags question: http://stackoverflow.com/q/26213341
tags question: http://stackoverflow.com/q/26341338
tags question: http://stackoverflow.com/q/26216417
tags question: http://stackoverflow.com/q/26353574
tags question: http://stackoverflow.com/q/26301176
tags question: http://stackoverflow.com/q/26269952
tags question: http://stackoverflow.com/q/26222205
tags question: http://stackoverflow.com/q/26276619
tags question: http://stackoverflow.com/q/26314220
type: Tag
tags question: http://stackoverflow.com/q/26221530
tags question: http://stackoverflow.com/q/26264492
tags question: http://stackoverflow.com/q/26293572
tags question: http://stackoverflow.com/q/26296150
tags question: http://stackoverflow.com/q/26335339
tags question: http://stackoverflow.com/q/26339842

http://stackoverflow.com/comment/41109519
type: QuestionComment
has text: possible duplicate of [Check if file with "ftp" url exists using java](http://stackoverflow.com/questions/18316468/check-if-file-with-ftp-url-exists-using-java)
comment on: http://stackoverflow.com/q/26213696
score: 0
type: Comment

http://stackoverflow.com/comment/41122992
has text: Oh i see, Thank you. But what changes should i make to make sure the sum method can handle the non-numeric exception? Since the exercise is about making the sum, subtract, multiply and divide methods handling the non-numeric input
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26220669

http://stackoverflow.com/comment/49881088
has text: In case anyone wonders why the old question got closed as a duplicate, Meta has the [answer](http://meta.stackexchange.com/q/147643/135744).
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26215616

http://stackoverflow.com/q/26199817
downvote count: 0
answer count: 1
tagged with: bubble-sort
tagged with: sorting
favorite count: 0
has body: The task was to modify bubble sort so that it’s bidirectional. This means the "in" index will first carry the largest item from left to right, but when it reaches "out", it will reverse and carry the smallest item from right to left. The bubbleSort() method is just the normal way it was presented in an example. My code is in the method bidiBubbleSort(). For some reason when I ran the program it gave me an output that was sorted, but not correctly. I manually did each step on a piece a paper with a pencil but I don't know what I'm overlooking. Unsorted: 7 6 5 4 3 2 1 and Sorted: 6 4 2 1 3 5 7 class ArrayBub { private long[] a; // ref to array a private int nElems; // number of data items // -------------------------------------------------------------- public ArrayBub(int max) // constructor { a = new long[max]; // create the array nElems = 0; // no items yet } // -------------------------------------------------------------- public void insert(long value) // put element into array { a[nElems] = value; // insert it nElems++; // increment size } // -------------------------------------------------------------- public void display() // displays array contents { for(int j=0; j&lt;nElems; j++) // for each element, System.out.print(a[j] + " "); // display it System.out.println(""); } // Beginning of my code ------------------------------------------------------- public void bidiBubbleSort() { int out, x, y; int in = 0; for(x=0, out=nElems-1; out&gt;x; out--, x++) // outer loop (backward) for(in=x; in&lt;out+1; in++) // inner loop (forward) if( in&lt;out ) if( a[in] &gt; a[in+1] ) // out of order? swap(in, in+1); // swap them else // (in==out) for(y=out-1; y&gt;x; y--) // reverse if( a[y] &lt; a[y-1] ) swap(y, y-1); } // End of my code ------------------------------------------------------------- public void bubbleSort() { int out, in; for(out=nElems-1; out&gt;1; out--) // outer loop (backward) for(in=0; in&lt;out; in++) // inner loop (forward) if( a[in] &gt; a[in+1] ) // …
type: UnansweredQuestion
upvote count: 1
has title: Modified bubble sort, but not working correctly
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26200641

http://stackoverflow.com/q/26268845
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41212419
upvote count: 0
tagged with: java
has title: Java Isn't Displaying gui right
type: Question
has comment: http://stackoverflow.com/comment/41212266
score: -1
has body: I have a simple gui and when I run is it is perfect, but occasionally it doesn't display right. I have a circle in a JPanel. When it runs right it displays in the middle for the JFrame like I intended it to, but when it does not work right the circle appears closer to the bottom of the screen. How can I fix this so it displays right each time? Is my code incorrect (I hope not! :) ), or is it some bug in java. So here is my code: Update: It seems that the window height is changing. Run.java-------------------------------------------------------------------------------- import javax.swing.JFrame; public class Run { public static void main(String args[]) { Window w = new Window(); w.setSize(800, 500); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setVisible(true); } } Window.java---------------------------------------------------------------------------- import javax.swing.JFrame; public class Window extends JFrame { public Window() { super("Wheel"); Gui g = new Gui(); add(g); } } Gui.java-------------------------------------------------------------------------------- import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; public class Gui extends JPanel { private Color wheelColor = new Color(0, 0, 255); public Gui() { setOpaque(true); setBackground(new Color(255, 0, 0)); } public void paintComponent(Graphics g) { g.setColor(wheelColor); g.fillOval(40, 40, 420, 420); } } Also I'm using Ubuntu, I don't know if that would affect it at all. Thanks in advance.
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/41212175
has comment: http://stackoverflow.com/comment/41212185
tagged with: user-interface
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26268863
favorite count: 0

http://stackoverflow.com/a/26310137
answers question: http://stackoverflow.com/q/26310090
score: 0
has comment: http://stackoverflow.com/comment/41287723
type: AcceptedAnswer
has body: If you want to compile you need to initialize first .. String compPlay = "";
type: Answer
accepted answer of: http://stackoverflow.com/q/26310090

http://stackoverflow.com/comment/41182471
type: Comment
has text: I have given the current time in milliseconds so you just replace with your milliseconds time
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26252948

http://stackoverflow.com/a/26294408
has comment: http://stackoverflow.com/comment/41259798
has body: Use ArrayList if you are not sure how many lines in the text file: ArrayList&lt;Double&gt; gpaList = new ArrayList&lt;Double&gt;(); while(in.hasNextLine()) { int gp = 0; double gpa = 0; String line = in.nextLine(); if(line.length() == 0) { continue; } line = line.substring(line.length()-15, line.length()); String[] letters = line.split(" "); for (int i = 0; i &lt; letters.length; i++) { if (letters[i].equals("H")) { gp += 7; } else if (letters[i].equals("D")) { gp += 6; } else if (letters[i].equals("C")) { gp += 5; } else if (letters[i].equals("P")) { gp += 4; } else if (letters[i].equals("F")) { gp += 0; } } gpaList.Add(gp / letters.length); } If you insist to use Array, then you can do, Assuming that you the number of line in your txt file is not more than 8 int count = 0; Double[] gpaList = new Double[8]; while(in.hasNextLine()) { .... .... for (int i = 0; i &lt; letters.length; i++) { .... .... } gpaList[count++] = gp / letters.length; } But if you don't know how many Grades are there, the nearest solution would be count the line first. Scanner in = new Scanner(new File("Grades.txt")); Scanner in2 = new Scanner(new File("Grades.txt")); int size = 0; while(in2.hasNextLine()) { size++; } int count = 0; Double[] gpaList = new Double[size]; while(in.hasNextLine()) { .... .... for (int i = 0; i &lt; letters.length; i++) { .... .... } gpaList[count++] = gp / letters.length; System.out.println(Arrays.toString(gpalist)); }
has comment: http://stackoverflow.com/comment/41261403
answers question: http://stackoverflow.com/q/26294257
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41262118
has comment: http://stackoverflow.com/comment/41261753
type: Answer
has comment: http://stackoverflow.com/comment/41260268
has comment: http://stackoverflow.com/comment/41259380
has comment: http://stackoverflow.com/comment/41258735
upvote count: 1
has comment: http://stackoverflow.com/comment/41259208
has comment: http://stackoverflow.com/comment/41259398
has comment: http://stackoverflow.com/comment/41261017
has comment: http://stackoverflow.com/comment/41259059

http://stackoverflow.com/a/26224613
score: 1
has body: In order to stop a thread ,first create a thread like this Thread thread = new Thread(run); and in order to start the thread call thread.start(); The start method will call run method but if you call run() method directly then no new thread will be created and the code will be executed in the existing thread. In order to stop the method you can use interrupt
answers question: http://stackoverflow.com/q/26224414
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/26209602
accepted answer of: http://stackoverflow.com/q/26209563
has body: You can do this String input = sc.next(); System.out.println("Plural form : " + PluralForm(input)); This should work, give it a spin
answers question: http://stackoverflow.com/q/26209563
has comment: http://stackoverflow.com/comment/41102083
has comment: http://stackoverflow.com/comment/41102159
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41102421
has comment: http://stackoverflow.com/comment/41102138
has comment: http://stackoverflow.com/comment/41102072
type: Answer
has comment: http://stackoverflow.com/comment/41102182
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41102237
has comment: http://stackoverflow.com/comment/41102204

http://stackoverflow.com/comment/41325055
type: QuestionComment
has text: Thanks for your replies. I changed it to glGetProgramInfoLog() and now I actually have an error message to work with: ERROR: Duplicate function definitions for "main"; prototype: "main()" found.
comment on: http://stackoverflow.com/q/26330442
score: 0
type: Comment

http://stackoverflow.com/comment/41206290
comment on: http://stackoverflow.com/q/26264520
type: QuestionComment
score: 0
type: Comment
has text: Well I'm going to be blunt and say this is a really infrequent use case that, frankly, demands you set your 200 breakpoints, and in the future, add some tracing options.

http://stackoverflow.com/q/26294723
has comment: http://stackoverflow.com/comment/41259111
accepted answer: http://stackoverflow.com/a/26295312
upvote count: 2
tagged with: vaadin7
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: vaadin
type: Question
has answer: http://stackoverflow.com/a/26295312
tagged with: session
has title: Session timeout does't work vaadin
tagged with: servlets
has body: I'm developing an vaadin web application and I added the following snippet of code in my web.xml. 30 Now i noted the also after 30 minutes my users are able to use the appllication and I don't want this. I read somethings about this problem on vaadin book, but I don't undestrand somethings. From vaadin book: Session Timeout After User Inactivity In normal servlet operation, the session timeout defines the allowed time of inactivity after which the server should clean up the session. The inactivity is measured from the last server request. Different servlet containers use varying defaults for timeouts, such as 30 minutes for Apache Tomcat. You can set the timeout under with: In a web.xml: 30 The session timeout should be longer than the heartbeat interval or otherwise sessions are closed before the heartbeat can keep them alive. As the session expiration leaves the UIs in a state where they assume that the session still exists, this would cause an Out Of Sync error notification in the browser. However, having a shorter heartbeat interval than the session timeout, which is the normal case, prevents the sessions from expiring. If the closeIdleSessions parameter for the servlet is enabled (disabled by default), Vaadin closes the UIs and the session after the time specified in the session-timeout parameter expires after the last non-heartbeat request. In a web.xml: <servlet> ... closeIdleSessions true Now I think the problem is that my application server leaves the UIs in a state where they assume that the session still exists but I'm not able to understand What is the heartbeat? and What the closeSessionId do precisely?
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/41129594
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26224059
has text: If it was a *sorted* array of booleans such could be found in O(1) :D
type: QuestionComment

http://stackoverflow.com/comment/41140217
has text: Sorry I forgot to mention that its TextViews
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26229607
score: 0

http://stackoverflow.com/a/26210725
score: 2
has comment: http://stackoverflow.com/comment/41125428
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26210641
upvote count: 2
has body: From eclemma documentation - http://www.eclemma.org/jacoco/trunk/doc/counters.html Instructions (C0 Coverage) - The smallest unit JaCoCo counts are single Java byte code instructions. Instruction coverage provides information about the amount of code that has been executed or missed. This metric is completely independent from source formatting and always available, even in absence of debug information in the class files.

http://stackoverflow.com/q/26338721
has comment: http://stackoverflow.com/comment/41339947
has body: This is my code: URL url = new URL("http://superchillin.com/login2.php"); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); urlConnection.setUseCaches(false); urlConnection.setRequestMethod("POST"); String data = "email="+URLEncoder.encode(name, "UTF-8")+"&amp;password="+URLEncoder.encode(pass, "UTF-8"); urlConnection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); urlConnection.setRequestProperty("Accept-Encoding", "gzip,deflate"); urlConnection.setRequestProperty("Accept-Language", "en-US,en;q=0.8,lt;q=0.6"); urlConnection.setRequestProperty("Cache-Control", "max-age=0"); urlConnection.setRequestProperty("Connection", "keep-alive"); urlConnection.setRequestProperty("Content-Length", Integer.toString(data.getBytes().length)); urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); urlConnection.addRequestProperty("Cookie", "place=1"); urlConnection.addRequestProperty("Cookie", "lvca_unique_user=1"); urlConnection.setRequestProperty("Host", "superchillin.com"); urlConnection.setRequestProperty("Origin", "http://superchillin.com"); urlConnection.setRequestProperty("Referer", "http://superchillin.com/login.php"); urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36"); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setInstanceFollowRedirects(true); DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream()); wr.writeBytes(data); wr.flush(); wr.close(); After that code I only read the response. It redirects me to "login.php" and is trying to set cookie "place=1"... Connecting via browser works great. The reason for so many headers is I thought they may be the problem so I copied all headers from which I see when using a browser. The response code is 200. I also noticed that if password or email is incorrec…
downvote count: 1
upvote count: 0
type: UnansweredQuestion
tagged with: http
has title: Program can not login into website
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/26339093
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41340084

http://stackoverflow.com/comment/41315304
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26325480
has text: It is not really clear what you want. Do you want something like this `System.err.println("Values out of range");`?
score: 0

http://stackoverflow.com/q/26298161
tagged with: dice
possible better answer: http://stackoverflow.com/a/26299040
has comment: http://stackoverflow.com/comment/41265343
answer count: 4
accepted answer: http://stackoverflow.com/a/26298317
has title: Dice rolling program, but I need to transfer input data from a different class
has answer: http://stackoverflow.com/a/26298222
has answer: http://stackoverflow.com/a/26298216
type: AnsweredQuestion
tagged with: java
has body: I'm trying to create a program that will roll 2 different die, that could either be automatically 6 sided or custom sided as decided by the user. As of right now I've gotten this far and need help figuring out how to get anything to happen from the roll() method, I've tried running it and it won't give me the random int it should. Any ideas? import java.util.*; import java.lang.*; public class RollOfTheDice { public static void main(String[] args) { Die firstDie, secondDie, face; firstDie = new Die(); secondDie = new Die(); face = new Die(); face.getSides(); firstDie.roll(); secondDie.roll(); System.out.println("First die roll results:."); } } class Die { int numberOfSides; //field value public Die() //constructor { numberOfSides = 6; } public int getSides()//get method { Scanner inputDevice = new Scanner (System.in); System.out.println("If looking for a custom sided die, please enter number of sides now:"); numberOfSides = inputDevice.nextInt(); return numberOfSides; } public void setSides(int Sides) //setmethod { numberOfSides = Sides; } public int roll() { //return a random-generated integer value between 1 and amount of sides int rollResult = ((int)(Math.random() * 100)% numberOfSides + 1); return rollResult; } }
type: Question
score: 0
has answer: http://stackoverflow.com/a/26299040
has answer: http://stackoverflow.com/a/26298317

http://stackoverflow.com/q/26195804
has comment: http://stackoverflow.com/comment/41076814
has title: Java: How to create a room with people having random birthdays?
favorite count: 0
has answer: http://stackoverflow.com/a/26195856
upvote count: 2
type: UnansweredQuestion
score: 1
tagged with: math
tagged with: java
tagged with: probability
downvote count: 1
has body: This is my second day on Java. I came across an interesting question on the Birthday Paradox. Generate a random birthday. Create a Person with a random birthday. Build a function to check if two persons have the same birthday. Create a Room with a given number of persons n. Build a function to check if at least two persons in a Room have the same birthday. However, I am stuck on how to create a 'Room' with 'persons' and then comparing the persons' birthdays. Does anyone know how to do this? Thank you for your effort and time! :) class Person { int age; } class Room { int Person; } public class BirthdayParadox { public static void main(String[] args) { int x = (int) (Math.random() * 364); int y = (int) (Math.random() * 364); long r = Math.round(x); long s = Math.round(y); Person person1 = new Person(); person1.age = (int) r; Person person2 = new Person(); person2.age = (int) s; if (person1.age == person2.age) { System.out.println("Same!"); } else if (person1.age != person2.age) { System.out.println(person1.age + " " + person2.age); } } }
type: Question
tagged with: object-oriented-database
answer count: 2
tagged with: birthday-paradox
has answer: http://stackoverflow.com/a/26195882

http://stackoverflow.com/a/26284669
answers question: http://stackoverflow.com/q/26284475
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26284475
has body: One does not instantiate a local variable and your saying that makes me think you may be considering this as coming at a cost. Local variables are absolutely free: they are just names given to memory locations which will exist anyway on the method's stack frame. As opposed to that, your second example declares an instance variable, and that one does come at a cost: each instance of your class will have to reserve memory on the heap for it, even though you use it only while executing the method. So, I think the advice is unanymous: do not declare instance variables unless you need them to hold long-lived object state.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26314437
has comment: http://stackoverflow.com/comment/41295298
tagged with: android-studio
score: 2
has comment: http://stackoverflow.com/comment/41295182
type: AnsweredQuestion
upvote count: 2
has body: I've this error: Error:(78, 56) error: no suitable constructor found for ImageViewTouch(Viewpager_activity) constructor ImageViewTouch.ImageViewTouch(Context,AttributeSet,int) is not applicable (actual and formal argument lists differ in length) constructor ImageViewTouch.ImageViewTouch(Context,AttributeSet) is not applicable (actual and formal argument lists differ in length) But this error I came out only after update Android Studio from 0.6.1 to 0.8.9, I did not have that error before the upgrade, in fact, the code that I put below worked perfectly before the update. At most, I have the application with that code on the Nexus 5, and has no problems. Viewpager_layout.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:background="#00A600" android:id="@+id/layoutesterno"&gt; &lt;com.ruar.imagegallery.app.ImageViewTouchViewPager android:id="@+id/imagepager" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/relativeLayout" /&gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="70dp" android:layout_gravity="bottom" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:id="@+id/relativeLayout" android:background="#008A00"&gt; &lt;ImageButton android:layout_width="60dp" android:layout_height="fill_parent" android:id="@+id/saveBtn" android:background="@drawable/save" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /&gt; &lt;ImageButton android:layout_width="60dp" android:layout_height="62dp" android:id="@+id/shareBtn" android:background="@drawable/share" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:…
has title: Error: no suitable constructor after update Android Studio from 0.6.1 to 0.8.9
has comment: http://stackoverflow.com/comment/41295687
has comment: http://stackoverflow.com/comment/41295549
type: Question
accepted answer: http://stackoverflow.com/a/26314850
has comment: http://stackoverflow.com/comment/41296392
has comment: http://stackoverflow.com/comment/41295594
tagged with: java
has comment: http://stackoverflow.com/comment/41295213
has comment: http://stackoverflow.com/comment/41295659
has comment: http://stackoverflow.com/comment/41295098
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41295336
favorite count: 0
has comment: http://stackoverflow.com/comment/41295430
tagged with: android
has answer: http://stackoverflow.com/a/26314850

http://stackoverflow.com/q/26209730
linked to: http://stackoverflow.com/q/4000169
tagged with: arrays
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41102372
has title: Array index out of bounds exception 2 Java and other errors
has comment: http://stackoverflow.com/comment/41106851
has answer: http://stackoverflow.com/a/26209766
has answer: http://stackoverflow.com/a/26209775
type: Question
has comment: http://stackoverflow.com/comment/41102407
has body: Compiled this code via cmd line creating Bar.Class import java.util.Map; import java.util.HashMap; public class Bar { private static final String[][] pos = new String[][] {{"X0","Y0"},{"X1","Y1"},{"X2","Y2"}}; public Bar() {} public static String getAtPosition(int x, int y) { return pos[x][y]; } public static void main(String[] args) { Bar bar = new Bar(); try { for (int x = 0; x &lt; pos.length; x++) { for (int y = 0; y &lt; pos.length; y++) { System.out.println(bar.getAtPosition(x,y)); } } } catch (Exception e) { e.printStackTrace(); } } } getting the following errors when entering java Bar X0 Y0 java.lang.ArrayIndexOutOfBoundsException: 2 at Bar.getAtPosition&lt;Bar.java:12&gt; at Bar.main&lt;Bar.java:23&gt; This code was provided by a company with whom I have an interview with they require comments explaining each source line and the results of the program when ran. any help would be appreciated, I've only been learning java for a few days and I've spent hours on this today.
answer count: 2
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41102359
tagged with: indexing

http://stackoverflow.com/comment/41184656
comment on: http://stackoverflow.com/a/26254111
type: AnswerComment
has text: Yes. The URI is the location address. If you never had a URI, then your app would never know where to send/receive the request.
score: 0
type: Comment

http://stackoverflow.com/comment/41290416
comment on: http://stackoverflow.com/a/26311257
type: Comment
score: 1
type: AnswerComment
has text: OP explicitly said this is homework question.. Why would you post the answer? Also, what does your code do? Simply posting code with no comments or explanation doesn't make a good answer.

http://stackoverflow.com/q/26336029
has comment: http://stackoverflow.com/comment/41347609
has comment: http://stackoverflow.com/comment/41349534
possible better answer: http://stackoverflow.com/a/26352650
has answer: http://stackoverflow.com/a/26352650
has comment: http://stackoverflow.com/comment/41350502
has comment: http://stackoverflow.com/comment/41350603
has title: link jQuery file with Spring MVC
tagged with: spring
has body: I have an issue in linking jQuery file, have placed the .js file under WebContent --js -----toggle.js file structure is shown in... (https://i.sstatic.net/4lZpj.png) Web.xml file <?xml version="1.0" encoding="UTF-8"?> FirstSpringMVCProject spring-dispatcher org.springframework.web.servlet.DispatcherServlet spring-dispatcher / Spring-dispatcher-servlet.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" 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.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <context:component-scan base-package="com.gontuseries.studentadmissioncontroller" /> <mvc:resources mapping="/css/**" location="/css/" /> <mvc:resources mapping="/js/**" location="/js/" /> <mvc:annotation-driven/> /WEB-INF/ .jsp but .js file is not linked up, please give me a directions, thanks in advance!!!
has answer: http://stackoverflow.com/a/26356258
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41350179
tagged with: java
type: Question
answer count: 2
tagged with: javascript
tagged with: jquery
accepted answer: http://stackoverflow.com/a/26356258
has comment: http://stackoverflow.com/comment/41350840
score: 0

http://stackoverflow.com/q/26219486
tagged with: stream
tagged with: input
tagged with: output
downvote count: 1
type: AnsweredQuestion
has body: I don't know why but outStream = new FileOutputStream(file) and inStream = new FileInputStream(new File(file1.getName())) throw an exception. I have no idea what to do. Here's some code of this: File tempf = new File(cmds[1]); //cmds is a String with filename cmds[1] and pathname cmds[2] where to move the file File tempw = new File(cmds[2]); if(!tempf.isAbsolute() || !tempw.isAbsolute()){//here i make paths absolute tempf = new File(tempf.getAbsolutePath()); tempw = new File(tempw.getAbsolutePath()); } String from = cmds[1]; String where = cmds[2]; File file1 = tempf; File file2 = new File (tempw.toString() + "/" + new File(cmds[1]).getName()); InputStream inStream = null; OutputStream outStream = null; try { inStream = new FileInputStream(new File(file1.getName())); //throws an exception outStream = new FileOutputStream(file2); //throws an exception too byte[] buffer = new byte[16384]; int length; while ((length = inStream.read(buffer)) &gt; 0) { outStream.write(buffer, 0, length); } if (inStream != null) inStream.close(); if (outStream != null) outStream.close(); file1.delete(); } catch (IOException e) { System.err.println("permission denied"); } } else { System.err.println("incorrect syntax"); } continue; } Looks like everything should work fine but it doesn't. I am getting java.io.FileNotFoundException: C:\Users\Maxim\IdeaProjects\Testing\OneDrive\1234.txt But as I see it's wrong path. Real path is C:\Users\Maxim\OneDrive UPD! It's found out that the problem is that getAbsolutePath() returns a path where the project is, but it's not the path I need. I need C:\Users\Maxim\OneDrive BUT it returns C:\Users\Maxim\IdeaProjects\Testing\OneDrive BUT! .../Testng doesn't have OneDrive!
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/41120498
upvote count: 0
has title: Incorrect path to file
tagged with: exception
has comment: http://stackoverflow.com/comment/41120508
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26219567
accepted answer: http://stackoverflow.com/a/26219567

http://stackoverflow.com/comment/41269703
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26300192
has text: I hear that they're in your workspace metadata. But you're saying they're not appearing in your IDE when you open the workspace. One of the things I would try would be to import at least one of the existing projects. If it doesn't work, you've lost half a minute. If it does work, you've found a way to address the problem. Note that you can select multiple projects to import in the dialog.

http://stackoverflow.com/a/26373636
has comment: http://stackoverflow.com/comment/41477578
answers question: http://stackoverflow.com/q/26285133
downvote count: 0
has comment: http://stackoverflow.com/comment/41514991
score: 3
has comment: http://stackoverflow.com/comment/41430751
has comment: http://stackoverflow.com/comment/41477647
has body: As I mentioned earlier, the other choice is to use kernel trace, which can be done by perf tool. # apt-get install linux-tools-3.13.0-35-generic # perf list | grep kill syscalls:sys_enter_kill [Tracepoint event] syscalls:sys_exit_kill [Tracepoint event] syscalls:sys_enter_tgkill [Tracepoint event] syscalls:sys_exit_tgkill [Tracepoint event] syscalls:sys_enter_tkill [Tracepoint event] syscalls:sys_exit_tkill [Tracepoint event] # perf record -a -e syscalls:sys_enter_kill sleep 10 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 1.634 MB perf.data (~71381 samples) ] // Open a new shell to kill. $ sleep 9999 &amp; [1] 2387 $ kill -9 2387 [1]+ Killed sleep 9999 $ echo $$ 9014 // Dump the trace in your original shell. # perf script ... bash 9014 [001] 1890350.544971: syscalls:sys_enter_kill: pid: 0x00000953, sig: 0x00000009
upvote count: 3
has comment: http://stackoverflow.com/comment/41445261
type: Answer
has comment: http://stackoverflow.com/comment/41752226

http://stackoverflow.com/comment/41341553
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26339440
has text: You can use comparator but I think this is the faster way. And yes why downvotes?

http://stackoverflow.com/a/32027719
type: Answer
has body: I would suggest looking at the other TaskExecutor options in the spring framework. In the worst-case, you could configure your own ThreadPoolTaskExecutor to use a cached threadpool, though I would caution against this if the number of concurrent jobs you might have running is large or unbounded. This other SO post provides an example of this sort of configuration.
answers question: http://stackoverflow.com/q/26257148
score: 0

http://stackoverflow.com/q/26327043
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41318159
has comment: http://stackoverflow.com/comment/41318449
type: Question
has comment: http://stackoverflow.com/comment/41318155
tagged with: adt
has title: ADT, typedef and representation independence in Java
has comment: http://stackoverflow.com/comment/41318699
score: 0
has comment: http://stackoverflow.com/comment/41318391
has comment: http://stackoverflow.com/comment/41319081
linked to: http://stackoverflow.com/q/1195206
tagged with: typedef
has body: I would like to define an ADT that has the same interface as a java.util.Map. However I read that it is an anti-pattern to make it MyType extends Map as explained here: Is there a Java equivalent or methodology for the typedef keyword in C++? Since in Java there is no equivalent to the C/C++ typedef there is no way to define a true type synonym. I am thinking about these 2 solutions: Define a concrete wrapper/forwarding class for java.util.Map, but this would force me to code against a class instead of coding against an interface. I was looking at Guava's ForwardingMap but this is a class and not an interface. Define my own interface which mimics java.util.Map and an implementation that wraps a java.util.Map. I don't like this duplication but I don't see any workaround that gives me the benefits of being able to program against an interface and representation independence. Would it make sense to write something like public interface MyType&lt;K,V&gt; extends Map&lt;K,V&gt; and then: public class MyTypeImpl&lt;K, V&gt; extends ForwardingMap&lt;K, V&gt; implements MyType&lt;K, V&gt; { final Map&lt;K, V&gt; delegate; public MyTypeImpl() { this(new HashMap&lt;K, V&gt;()); } public MyTypeImpl(Map&lt;K, V&gt; delegate) { this.delegate = delegate; } @Override protected Map&lt;K, V&gt; delegate() { return delegate; } }
tagged with: guava
answer count: 0

http://stackoverflow.com/q/26348442
has answer: http://stackoverflow.com/a/26348645
answer count: 2
upvote count: 1
has title: LibGDX not using Android asset folder
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/28011033
has body: I am having a problem with a libGDX project reading the assets folder when compiling the Android or IOS build. While trying to access a file in the assets folder under the android module, I always seem to get a FileNotFoundException in IOS or Android, but not when running it on the Desktop. My desktop config points the android asset directory like it should. When executing the following code : public void readGameMap() throws IOException { readGameMap("gameMap.txt"); } public void readGameMap(String path) throws IOException { Scanner s = new Scanner(Gdx.files.internal(path).file()); int i = 0; while ((s.hasNextLine())) { String str = s.nextLine(); if (str.length() &lt; maze.length) throw new IOException("Incorrect game_map.txt structure"); for (int j = 0; j &lt; str.length(); j++) { Object temp; switch (str.charAt(j)) { case '1': temp = new Wall(); break; case '3': temp = new Dot(); break; default: temp = new Object(); break; } maze[j][i] = temp; } i++; } s.close(); } The file not found exception is thrown. My folder structure is as follows: -Android -assets -gameMap.txt -Desktop -IOS -HTML -core
downvote count: 0
score: 1
type: Question
tagged with: libgdx
tagged with: java

http://stackoverflow.com/comment/41312450
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26322210
score: 0
has text: also GestureDetector can be helpful for scrolling implementation

http://stackoverflow.com/comment/41308180
comment on: http://stackoverflow.com/q/26321367
score: 0
type: Comment
has text: @dramzy can you link me to a good tutorial/project example using `MigLayout`?
type: QuestionComment

http://stackoverflow.com/a/26345767
answers question: http://stackoverflow.com/q/26345486
has comment: http://stackoverflow.com/comment/41355401
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41353680
type: Answer
upvote count: 1
has body: I'm not sure what row-major means, but I'll assume it means that the elements are positioned in the 1-dim array by row (i.e. the first c elements form the first row, the next c elements form the second row, etc...). The constructor is simple - you create an array of r*c elements. Getting the (i,j) element is a matter of math - find a formula that given a row index i and a column index j, calculates the location in the array of the (i,j) element. Hint - the formula involves multiplying the request row by the column length. Getting a row array is straight forward, since the elements of the 1-dim array that represent a single row at contiguous. As I mentioned before, the first c elements are the first row, etc... Getting a column array involves finding the (i,j) element for each i (when j is constant).
score: 1
accepted answer of: http://stackoverflow.com/q/26345486
downvote count: 0

http://stackoverflow.com/comment/41290076
type: Comment
comment on: http://stackoverflow.com/a/26311401
has text: @Tacent , if you got the solution , you should accept the answer. Just click on the correct sign.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26281995
type: Question
has comment: http://stackoverflow.com/comment/41241944
tagged with: jpa
downvote count: 0
has body: I am new in Spring and Hibernate org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: xv/profilemanager/exceptions/InvalidPasswordException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) 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:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(Fram…
has comment: http://stackoverflow.com/comment/41236863
has comment: http://stackoverflow.com/comment/41236691
favorite count: 0
has title: BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/41236372
score: 1
tagged with: java
tagged with: hibernate

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

http://stackoverflow.com/comment/41313250
score: 0
type: Comment
has text: I also need for an ignore case operation. For example: String part = "TH.".
comment on: http://stackoverflow.com/a/26324223
type: AnswerComment

http://stackoverflow.com/q/26218301
answer count: 3
has title: why am i getting zero while i have initialized my instance variables?
has answer: http://stackoverflow.com/a/26218342
has comment: http://stackoverflow.com/comment/41118141
tagged with: constructor
has comment: http://stackoverflow.com/comment/41118407
accepted answer: http://stackoverflow.com/a/26218335
has body: i have a simple java program below. i have declared instance integer variable "x1" and "x2", initialize them from parameters in my class constructor. i have also declared an integer variable "diff" that works out the difference between "x1" and "x2" but the variable returns zero!! i don't know where the problem is and my constructor parameters are not zero!!!. i will appreciate any help public class Smallest { int x1; int x2; public Smallest(int a,int b){ this.x1=a; this.x2=b; } int diff = x2 - x1; public void draw(){ System.out.println("X1= "+ x1 +"\n X2= "+ x2 +"\n diff= " +diff); } public static void main(String[] args) { Smallest small=new Smallest(10,20); small.draw(); } } here's the output X1= 10; X2= 20; diff= 0;
upvote count: 1
has comment: http://stackoverflow.com/comment/41119087
possible better answer: http://stackoverflow.com/a/26218326
has answer: http://stackoverflow.com/a/26218326
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41118385
type: Question
downvote count: 0
tagged with: variables
has answer: http://stackoverflow.com/a/26218335
favorite count: 0
tagged with: class

http://stackoverflow.com/a/43343168
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26254604
has body: Create a runner class something like this and you should be able to execute. There is also no need to write step definitions manually, just create a feature file and run it, it will create a snippet of the step definition which can be used to create a step definition class: A class file called Runnerclass is required to run the cucumber: @RunWith(Cucumber.class) @CucumberOptions(plugin={"pretty","html:format"}, features = "Features/name.feature",glue={"path where step definitions exist"}) public class RunnerClass { }
upvote count: 1

http://stackoverflow.com/q/26204201
has title: Android, how can I implement rounded corners for ImageButton and then change the color programatically?
tagged with: android-styles
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26212762
type: Question
has body: I have ImageButton on the layout of my application and I want to have rounded corners for this ImageButton, so I'm using style like: &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;stroke android:width="1dp" android:color="@android:color/black" /&gt; &lt;corners android:radius="15dp" /&gt; &lt;solid android:color="@android:color/black"/&gt; &lt;/shape&gt; and then I'm using android:background="@drawable/my_rounded_shape.xml"/&gt; The problem is that after this I want to change background color from black to some custom color, but I can't modify style programmatically and there is no way to generate new style with corners but with different color and apply to my ImageButton. Could you clarify is there any way to do it or any workaround?
has comment: http://stackoverflow.com/comment/41095208
linked to: http://stackoverflow.com/q/15194522
tagged with: android-imagebutton
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26204626
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1

http://stackoverflow.com/q/26241630
tagged with: java
has comment: http://stackoverflow.com/comment/41164387
has comment: http://stackoverflow.com/comment/41164450
has body: I have a dataset with now equal lines of elements. I am attempting to use a Distributed Cache in MapReduce. The the data looks like: 3467 r009345, r234956, r453437 8462 r6364785, r3450344, r0489832, r99982523 10093, r542557, r0922352 Code looks like this: for(Path p: genes2snps) { if(p.getName().equals("genes2snps.txt")); { BufferedReader reader = new BufferedReader(new FileReader(p.toString())); String line = reader.readLine(); while(line != null) { //String[] tokens = line.split("\t"); String[] tokens = line.split("\t", limit) String geneID = tokens[0]; String state = tokens["\^0"]; } } } I Would like to say, use array[0] as a key and array[NOT 0] as the value. How do I do this is Regex?
has comment: http://stackoverflow.com/comment/41164277
score: 0
has comment: http://stackoverflow.com/comment/41162064
has title: Tryign to use Regex for numerals
has comment: http://stackoverflow.com/comment/41164250
tagged with: regex
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41162278
type: Question

http://stackoverflow.com/q/26262824
tagged with: arrays
answer count: 1
tagged with: search
tagged with: matrix
has title: How would I modify my code to search a multidimensional array diagonally from left to right and right to left?
tagged with: multidimensional-array
type: UnansweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26263011
type: Question
has body: I have this code for searching a multidimensional array from left to right and right to left. What I need to do now is to search the array from the top left to the bottom right,the top right to the bottom left, the bottom left to the top right, and the bottom right to the top left. What would I need to change in my existing methods to make a new method to do what I want? // Left to Right public static String findLeftToRight (char[][]board, String word) { char[] letters = word.toCharArray(); for (int i = 0; i &lt; board.length; i++){ for (int j = 0; j &lt; board[i].length; j++) { boolean found = true; for (int k = 0; k &lt; letters.length; k++) { if ((j+k &gt;= board[i].length) || (letters[k] != board[i][j+k])) { found = false; break; } } if (found) { return "String " + word + " found in row=" + i + " col=" +j; } } } return "String " + word + " not found"; } // end findLeftToRight // Right to Left public static String findRightToLeft (char[][]board, String word) { char[] letters = word.toCharArray(); for (int i = board.length-1; i &gt; -1; i--){ for (int j = board[i].length-1; j &gt; -1; j--) { boolean found = true; for (int k = 0; k &lt; letters.length; k++) { if ((j - k &lt; 0) || (letters[k] != board[i][j-k])) { found = false; break; } } if (found) { return "String " + word + " found in row=" + i + " col=" +j; } } } return "String " + word + " not found"; } // end findLeftToRight

http://stackoverflow.com/q/26346853
has body: I am new to Spring and trying to develop some REST API. I have two types of users: Sellers and Customers. Each has a separate model, DAO class and table in MySQL database and I am using Hibernate to access it. I have come across various tutorials, such as: http://www.mkyong.com/spring-security/spring-security-hibernate-annotation-example/ , and answers on this site, but I am still not sure how I can implement this for multiple user types. I was thinking about using different URLs for each login, i.e. /sellerlogin and /customerlogin, but I am not sure exactly how this would work and how I can get different UserDetails object based on the URL. What is the best way to go about this? Any links to references, tutorials, examples and other relevant answers would be greatly appreciated as I am pretty clueless when it comes to Spring Security.
tagged with: spring
type: Question
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41355275
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
has title: Spring security and hibernate for multiple user types
has answer: http://stackoverflow.com/a/26359838
linked to: http://stackoverflow.com/q/4783063
score: 2
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/26249089
answer count: 1
accepted answer: http://stackoverflow.com/a/26249226
tagged with: client
type: AnsweredQuestion
has title: Java Remote Client GUI
tagged with: java
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/9554636
has answer: http://stackoverflow.com/a/26249226
has body: I've set up a Server which runs and accepts connections from my Remote Client, and now I'm working on my GUI. Before anything else, my goal here is to create a nice looking client that will have a login screen (login/pw), and then a nice layout with my options/perhaps a chat box after the user has logged in. I've searched a lot online and used this site to set up my server and get things working, but I've got a bit of a problem with the GUI/theory and hope someone here can guide me a bit. At the moment, I've set up a class called ClientGUI which is called from my main class, and this produces a 420x240 size screen. After placing my login/password JTextField boxes here, is it "proper" to set up the other GUI's the way I've outlined below? I'm not sure if I should be putting them under one class or how I would advance from one GUI to the next. I'm thinking I should repaint and resize the screen as necessary, but I am not sure how to set it all up. A brief outline would be helpful (you don't need to give me exact code). public class ClientGUI extends JFrame { public ClientGUI() { setSize(420,240); setVisible(true); setTitle("Title"); setResizable(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(null); } public loginGUI() { //code for my login/pw boxes, images, listener for entering information } public afterlogginginGUI() { } paint() { //not too sure about how this should be setup either. Should I do all my textfield //and image work in paint()? } } I have never made anything like this, so I have the feeling I'm not setting this up in an ideal way. An alternative is to have a different java class extending JFrame for each 'screen' I want, but if I do it this way, would I do it like this? In my main RemoteClient class: main { ClientGUI(); //display whatever LoginGUI(); //listen for login info if (loginIsValid) { afterlogginginGUI(); } }
score: 0
tagged with: user-interface

http://stackoverflow.com/a/26203413
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26203375
has comment: http://stackoverflow.com/comment/41090226
score: 3
answers question: http://stackoverflow.com/q/26203375
downvote count: 0
has body: Because the default behavior of a thread constructed with a Runnable is to delegate to the runnable passed as argument to the constructor. But you overrode run() in the thread itself, so instead of delegating to the runnable, it executes the code inside the overridden run() method. For the record, here's the default implementation of Thread.run(), that you overrode: private Runnable target; public void run() { if (target != null) { target.run(); } }
upvote count: 3

http://stackoverflow.com/comment/41149675
score: 0
type: AnswerComment
type: Comment
has text: i updated my code but not working @Inneke De Clippel
comment on: http://stackoverflow.com/a/26234073

http://stackoverflow.com/comment/97774414
type: Comment
comment on: http://stackoverflow.com/a/52271489
score: 0
has text: Sam with my case as well.
type: AnswerComment

http://stackoverflow.com/comment/73241362
comment on: http://stackoverflow.com/a/26325606
score: 0
type: AnswerComment
has text: @PeterT: Completely disagree. That is, in C++, especially Modern C++, we do a whole lot with compile-time-known types, so this is a perfectly valid answer (even if it should be edited).
type: Comment

http://stackoverflow.com/q/26250455
tagged with: java
score: -1
has title: latitude and longitude values giving null
tagged with: eclipse
tagged with: android-emulator
type: Question
answer count: 2
favorite count: 0
tagged with: android
downvote count: 1
has body: I am a newcomer for android programming and stack overflow. MY problem here is mylongitudey in onclick method is giving null value. I have 3 activities.Below one is one among them. I want the latitude and longitude from google map and to send those points into another activity. The main problem here is, it is not giving the latitude and longitude value instead Toasting null value. I couldn't find what was the mistake . Can anyone help me? Thanks in advanced. SharedPreferences points; SharedPreferences.Editor ed; Address returnedAddress; double mylongitudey,mylatitudey; String latilongi; ImageView iv; Button manual,proceed; GoogleMap map; LatLng mylat ; String latlong; Marker mymarker; boolean markerclicked; double mylatitudeyd,mylongitudeyd; String addstringaa; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.two_buttons); actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.BLACK)); getActionBar().setDisplayHomeAsUpEnabled(true); Toast.makeText(this,"Please select the destination by long click", Toast.LENGTH_LONG).show(); LatLng mylat; final GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); map.setOnMarkerDragListener(this); map.setTrafficEnabled(true); // map.setOnMyLocationButtonClickListener(this); SharedPreferences shared = getSharedPreferences("map", 0); String mylats = (shared.getString("twolati", "NoValue")); String mylong= (shared.getString("twolong", "NoValue")); double dmylats = Double.valueOf(mylats); double dmylong = Double.valueOf(mylong); map.animateCamera(CameraUpdateFactory.zoomTo(15)); mylat = new LatLng(dmylats, dmylong); try { Toast.makeText(this, "This is"+mylats,Toast.LENGTH_LONG).show(); } catch (Exception e) { Toast.makeText(this,"problem in mylat",0); e.printStackTrace(); } map.moveCamera(CameraUpdateFactory.newLatLngZoom(mylat, 13)); map.addMarker(new MarkerOptions().position(mylat).title("You are …
upvote count: 0
possible better answer: http://stackoverflow.com/a/26250672
has answer: http://stackoverflow.com/a/26250672
has answer: http://stackoverflow.com/a/26251015
accepted answer: http://stackoverflow.com/a/26251015
type: AnsweredQuestion

http://stackoverflow.com/comment/41266146
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26291223
type: Comment
has text: `ignoreContextParams` being already set to `true` did not make any change. i.e I am able to get and view parameters, which should not according to docs.

happens-before
tags question: http://stackoverflow.com/q/26204900
tag name: happens-before
type: Tag

http://stackoverflow.com/a/26222010
accepted answer of: http://stackoverflow.com/q/26221990
score: 1
has comment: http://stackoverflow.com/comment/41125498
downvote count: 1
has body: must be response_content.equals("1") otherwise a String object gets compared to an Integer object response_content == "1" may return true but doesn't have to because those can be different "1" strings.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26221990
has comment: http://stackoverflow.com/comment/41125545
upvote count: 2
type: Answer

http://stackoverflow.com/comment/41356023
score: 0
has text: Do you have explicit no argument constructor for class `Properties`? If so, please post it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26347415

http://stackoverflow.com/comment/76437650
type: Comment
comment on: http://stackoverflow.com/a/26333695
score: 1
has text: This approach only works if you intend to use the input as a HTML output later on. About deprecation, v3.6 of commons-lang is still there and works fine with org.apache.commons.text.[StringEscapeUtils](https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringEscapeUtils.html).
type: AnswerComment

http://stackoverflow.com/a/26331843
has comment: http://stackoverflow.com/comment/41327721
has comment: http://stackoverflow.com/comment/41327770
upvote count: 1
has comment: http://stackoverflow.com/comment/41327634
accepted answer of: http://stackoverflow.com/q/26331799
answers question: http://stackoverflow.com/q/26331799
score: 1
has comment: http://stackoverflow.com/comment/41327688
type: AcceptedAnswer
downvote count: 0
has body: The process is relatively simple... Start by loading the character image... public class Keying extends JPanel { //public Rectangle character; private java.awt.BufferedImage character; private java.awt.Point characterLocation; //... public Keying(Display f, Images i) throws IOException { character = javax.ImageIO.read(...); characterLocation = new Point(0, 0); //... See Reading/Loading an Image for more details... Then, you simply want to paint the character image... @Override protected void paintComponent(Graphics g) { g.drawImage(character, characterLocaiton.x, characterLocation.y, this); Advice Avoid KeyListener, it's prone to focus issues you really don't want to deal with. Instead use key bindings, see How to Use Key Bindings for more details Avoid putting any logic within any of the paint routines, painting can occur at any time, many of which you don't control, this could have your character moving in directions you don't expect or faster than they should. Instead, this belongs within the main game loop which is responsible for updating the state and scheduling paint requests. NEVER change the state of the component from within any paint method, this could cause an infinite loop of paint requests, which will consume your systems resources. Within your context, don't call setBackground (by the time you call this, the background has already been painted anyway) or repaint
has comment: http://stackoverflow.com/comment/41327655
type: Answer

websocket
tags question: http://stackoverflow.com/q/26204654
tags question: http://stackoverflow.com/q/26315658
tags question: http://stackoverflow.com/q/26339242
tags question: http://stackoverflow.com/q/26207380
tags question: http://stackoverflow.com/q/26283020
type: Tag
tags question: http://stackoverflow.com/q/26264508
tags question: http://stackoverflow.com/q/26310691
tags question: http://stackoverflow.com/q/26313167
tags question: http://stackoverflow.com/q/26229850
tags question: http://stackoverflow.com/q/26339217
tag name: websocket
tags question: http://stackoverflow.com/q/26309286

http://stackoverflow.com/comment/41079714
has text: Are you sure you transcribed things correctly? For instance, it would recurse infinitely if you had written `gcd(r,b)` rather than `gcd(b,r)`, with or without a return.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26197320

http://stackoverflow.com/comment/41259843
type: QuestionComment
type: Comment
has text: Oops you're right, this attribute is required, I didn't saw it. But adding it didn't change anything (my parameters were already taken into account : initialSize is always respected).
comment on: http://stackoverflow.com/q/26280832
score: 0

http://stackoverflow.com/comment/41317247
comment on: http://stackoverflow.com/a/26326109
has text: Yes, `AccountOne myaccount=new AccountOne();` means you are creating an object of `AccountOne` class called `myaccount`.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26205429
score: 1
has body: Are you familiar with RandomAccessFile class? I assume you have a variable length of body to be written between Header+START and END+Footer markers? This means you cannot just overwrite body part and expect tailing bytes to be pushed forward. Maybe easiest implementation is how you started implement it anyway. Open RandomAccessFile access Find or skip to the end of START index, remember index Read bytes from the end backward until found a start of END index, bytes were put to a tailBuffer while reading backward (is backward ordered due to a reversed read-write) seek position back to STARTIndex+1 and write new body bytes to the end of start block call raf.setLength(startLen+bodylen+endLen) to trim or extend a new file length accordingly write tailBuffer to the end of file, make sure write is reversed in a proper order This could be one way to implement this, or just read everything to RAM find indexes, overwite file with new content. This is fine if RAM is not an issue.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26205165
answers question: http://stackoverflow.com/q/26205165
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26320490
accepted answer: http://stackoverflow.com/a/26320639
downvote count: 0
tagged with: aop
has title: Spring AOP: Xml vs AspectJ approach
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/26320639
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has body: So my question revolves around the use of Spring AOP with XML based schema versus using it with AspectJ. From looking around online I've been trying to figure out which approach to take for AOP. One particular scenario has me slightly confused; Suppose I have a number of classes with n number of methods, and I want to apply advice from my aspect class to certain methods/join points but not all, I can see when using AspectJ that this would be fairly straightforward - I just apply my aspect annotation to the methods that should use the advice. However, from what I've seen of the xml based approach, I would have to create a pointcut for each of these methods (assuming they can't be covered by one expression i.e. each method has a distinct name) and (if I was using the proxy based approach) a proxy class for each target/class. The AspectJ approach seems much tidier in this sense. So is my understanding of the two methods correct or have I missed out on some part of Spring AOP that can achieve a neater solution for the xml approach? Sorry for the long-winded explanation, but I wanted to make the scenario as clear as possible...
score: 1
tagged with: java
type: Question
tagged with: aspectj

http://stackoverflow.com/q/26228973
has body: I'm trying to override a method that adds a string to a list. But i want the method to not add the string if the string is a duplicate in the list. If it isn't a duplicate than add if not do nothing. Here is my code. I'm just confused why it is not working. public class Hw6 &lt;T extends Comparable&lt;? super T&gt;&gt; implements SortedListInterface&lt;T&gt; { private ListInterface&lt;T&gt; list; public Hw6() { list = new LList&lt;T&gt;(); } @Override public boolean add(T newEntry) { boolean results = false; if(!contains(newEntry)) { list.add(newEntry); results = true; } return results; } public boolean addPrivate(T newEntry) { int newPosition = Math.abs(getPosition(newEntry)); return list.add(newPosition, newEntry); } @Override public boolean remove(T anEntry) { boolean result = false; int position = getPosition(anEntry); if (position &gt; 0) { list.remove(position); result = true; } return result; } @Override public int getPosition(T anEntry) { int position = 1; int length = list.getLength(); while((position &lt;= length) &amp;&amp; (anEntry.compareTo(list.getEntry(position)) &gt; 0)) { position++; } if ((position &gt; length) || (anEntry.compareTo(list.getEntry(position)) != 0)) { position = -position; } return position; } @Override public T getEntry(int givenPosition) { return list.getEntry(givenPosition); } @Override public boolean contains(T anEntry) { boolean found = false; for (int index = 0; !found &amp;&amp; (index &lt; getLength()); index++) { if (anEntry.equals(list.getEntry(index))) found = true; } return found; } @Override public int getLength() { // TODO Auto-generated method stub return list.getLength(); } @Override public boolean isEmpty() { if(getLength() == 0) return true; else return false; } @Override public boolean isFull() { return false; } public static void main(String args[]) { LList&lt;String&gt; list = new LList&lt;String&gt;(); list.add("brad"); list.add("nick"); list.add("brad"); for(int i = 1; i &lt;= list.getLength(); i++) { System.ou…
tagged with: interface
has title: Creating an add method that doesn't add to the list if its a duplicate?
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/41138938
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41139200
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41139097
has comment: http://stackoverflow.com/comment/41138908
has answer: http://stackoverflow.com/a/26229163
accepted answer: http://stackoverflow.com/a/26229163

http://stackoverflow.com/q/26338373
upvote count: 2
type: UnansweredQuestion
has body: In Swing I was to add JTextArea into JScrollPane in order JTextArea to have scroll bars. When I do the same in JavaFX, the behavior is different. This example import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.ScrollPane; import javafx.scene.control.TextArea; import javafx.stage.Stage; public class SlideshowForSlipryPage2 extends Application { @Override public void start(Stage primaryStage) { primaryStage.setTitle("SlideshowForSlipryPage"); primaryStage.setScene( new Scene( new ScrollPane( new TextArea() {{ setPromptText("[PROMPT 1]"); }} ) , 300, 250 ) ); primaryStage.show(); } public static void main(String[] args) { launch(args); } } gives i.e. text area is wider than a window and shorter than it. Why and how to fix?
tagged with: scrollpane
has title: Why doesn't TextArea occupy entire area of ScrollPane in JavaFX? How to add scroll bars to TextArea in JavaFX?
tagged with: java-8
has answer: http://stackoverflow.com/a/26338611
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/31088267
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/38189002
answer count: 3
has comment: http://stackoverflow.com/comment/41339666
favorite count: 0
score: 2

http://stackoverflow.com/q/26335506
has title: Any difference in content extracted by pdfbox and itext
has comment: http://stackoverflow.com/comment/41335990
has body: I am evaluating pdfbox-1.8.6 and iText-4.2.0(free) for performance. I have noticed that content extraction is faster in iText, but searching words using regex in the content extracted by iText takes longer time than pdfbox. Extracted content and its size seems same in both cases. Can anybody explain me on this? My environment is ubuntu 12.04/java 1.7. EDIT: adding sample codes. pdfbox //in constructor fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); pdfDocument = PDDocument.load(bis); textStripper = new PDFTextStripper(); //in extarctContent method textStripper.setStartPage(pageNo); textStripper.setEndPage(pageNo); return textStripper.getText(pdfDocument); iText //in constructor fis = new FileInputStream(file); reader = new PdfReader(fis); pdfTextExtractor = new PdfTextExtractor(reader); //in extarctContent method return pdfTextExtractor.getTextFromPage(pageNo); searching words StopWatch searchTime = ... StopWatch pdfTime = ... for (int i = 1; i &lt;= pageCount; i++) { // fetch one page pdfTime.resume(); String pageContent = pdfParserService.extractPageContent(i); pdfTime.suspend(); if (pageContent == null) { pageContent = ""; } pageContent = pageContent.replace("-\n", "").replace("\n", "").replace("\\", " "); searchTime.resume(); Collection list = searchService.search(pageContent, wordList); searchTime.suspend(); } pdfTime.stop(); searchTime.stop(); System.out.println(pdfTime.getTime()); System.out.println(searchTime.getTime());
score: 0
has comment: http://stackoverflow.com/comment/41334589
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41340724
tagged with: itext
tagged with: performance
linked to: http://stackoverflow.com/q/22340674
tagged with: java
has comment: http://stackoverflow.com/comment/41337766
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/41382448
type: Question

http://stackoverflow.com/comment/41359238
has text: @PeterK Yes, this is really just a reasonable approximation if Joda is banned. Since OP has already assumed only 28 days in Feb, daylight saving is a relatively minor consideration :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26349008
type: AnswerComment

http://stackoverflow.com/q/26260831
has comment: http://stackoverflow.com/comment/41208789
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41197243
has title: Issue with running JAR from Desktop, but not from command line or Eclipse
accepted answer: http://stackoverflow.com/a/26271643
tagged with: swingworker
has comment: http://stackoverflow.com/comment/41196863
tagged with: concurrency
has comment: http://stackoverflow.com/comment/41197124
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26271643
possible better answer: http://stackoverflow.com/a/26261221
has answer: http://stackoverflow.com/a/26261221
tagged with: jar
has comment: http://stackoverflow.com/comment/41197464
has body: I am running into a peculiar issue (peculiar for me anyways) that seems to happen in a SwingWorker that I use for saving the result of another 'SwingWorker' thread as a tab-delimited file (just a spreadsheet of data). Here is the worker, that initializes and declares an object which organizes the data and writes each table row to a file (using BufferedWriter): // Some instance variables outside of the SwingWorker: // model: holds a matrix of numerical data (double[][]) // view: the GUI class class SaveWorker extends SwingWorker&lt;Void, Void&gt; { /* The finished reordered matrix axes */ private String[] reorderedRows; private String[] reorderedCols; private String filePath; // the path of the file that will be generated public SaveWorker(String[] reorderedRows, String[] reorderedCols) { // variables have been checked for null outside of the worker this.reorderedRows = reorderedRows; this.reorderedCols = reorderedCols; } @Override protected Void doInBackground() throws Exception { if (!isCancelled()) { LogBuffer.println("Initializing writer."); final CDTGenerator cdtGen = new CDTGenerator( model, view, reorderedRows, reorderedCols); LogBuffer.println("Generating CDT."); cdtGen.generateCDT(); LogBuffer.println("Setting file path."); filePath = cdtGen.getFilePath(); // stops inside here, jumps to done() LogBuffer.println("Path: " + filePath); } return null; } @Override protected void done() { if (!isCancelled()) { view.setLoadText("Done!"); LogBuffer.println("Done saving. Opening file now."); // need filePath here to load and then display generated file visualizeData(filePath); } else { view.setReorderOngoing(false); LogBuffer.println("Reordering has been cancelled."); } } } When I run the program from Eclipse, this all works perfectly fine. No issues whatsoever. Now I know there have been tons of question on here that are about Eclipse running fine while the runnable JAR fails. It's often due to not including dependencies or referring to them in the wrong way. But wh…
has comment: http://stackoverflow.com/comment/41197018
tagged with: io
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41197862

http://stackoverflow.com/comment/41211270
has text: Exactly, it says java.lang.nullpointerexception.
comment on: http://stackoverflow.com/q/26268300
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41176835
type: Comment
type: QuestionComment
score: 0
has text: well it keeps looping and only displays one of the urls which should be more in the string
comment on: http://stackoverflow.com/q/26249545

http://stackoverflow.com/a/26212405
upvote count: 1
has body: You might want to have a look at Guava Chars which has some pretty neat functions. Especially have a look at static boolean contains(char[] array, char target) Returns true if target is present as an element anywhere in array.
answers question: http://stackoverflow.com/q/26212337
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/41113820
has text: yeah.for different parameters the tags will be changed.i am trying to generate an xml from a swing window that will contain all package names and class names method names.user will select any of them through the dropdown.once he click submit xml should be generated.
score: 0
comment on: http://stackoverflow.com/q/26212541
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26201964
type: Question
has comment: http://stackoverflow.com/comment/41314094
has comment: http://stackoverflow.com/comment/41138007
has answer: http://stackoverflow.com/a/26202196
has comment: http://stackoverflow.com/comment/41263343
score: 0
tagged with: domino-designer-eclipse
has comment: http://stackoverflow.com/comment/41122595
answer count: 1
has comment: http://stackoverflow.com/comment/41109983
tagged with: web-services
has body: I am trying to consume a third party webservice in Lotus Notes. While creating consumer, I am getting "Name too long" error for few variables. I know, there is limit of 40 characters in creating variable in Lotus Notes. While I am trying to create Java consumer, its not getting created. When I am creating consumer using lotusscript, "name too long" error for the declarations, Const some42CharcaterlongName$ = "SomeTest" Const some42CharcaterlongName$ = "SomeTest" There are 20 such variables. I went through some articles and I found that consuming in java will solve this problem. I tried creating consumer in java, Notes will process for some time and then it will stop working. No error but no consumer created. Name too long error resolved - As @Emmanuel said, I just downloaded the wsdl locally and replaced the long names with shorter names and recreated the consumer and that's it...resolved. Running into another error - "Class or Type name not found" Any help on this?
has comment: http://stackoverflow.com/comment/41111140
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41137953
tagged with: java
has comment: http://stackoverflow.com/comment/41137855
has comment: http://stackoverflow.com/comment/41374858
tagged with: lotus-domino
has comment: http://stackoverflow.com/comment/41138745
has title: "Name too long" error while creating webservice consumer in Domino Designer 8.5.2
accepted answer: http://stackoverflow.com/a/26202196

http://stackoverflow.com/comment/41243146
type: Comment
comment on: http://stackoverflow.com/a/26282564
has text: That's all in the code already. It's right there. Everything you said about getting the field is already in the example I gave.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41265872
type: QuestionComment
type: Comment
has text: Where do you see an "instantiation of an interface"? I just see a *parameter* with an interface type. Perhaps you need to review the tutorial on interfaces? http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html
comment on: http://stackoverflow.com/q/26298494
score: 0

http://stackoverflow.com/a/26324596
has comment: http://stackoverflow.com/comment/41314000
has comment: http://stackoverflow.com/comment/41314225
score: 1
has comment: http://stackoverflow.com/comment/41313747
type: Answer
upvote count: 1
has body: Your mistake is in this line: if(items[r] != null){ When you create the array, since it is an array of object references, all its elements are null. So this condition causes it to never insert an item into the array. You shouldn't have a loop there anyway. You are supposed to keep the index of the next empty place in the array and use it to put the item in the array, and then increment (add one to) it.
has comment: http://stackoverflow.com/comment/41314374
has comment: http://stackoverflow.com/comment/41314055
downvote count: 0
answers question: http://stackoverflow.com/q/26324510

http://stackoverflow.com/q/26197671
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26197685
has body: I have a simple switch case statement, and I want to get the current case int. For example: case 5: // some code break; I want to get the 5. Ideas?
tagged with: java
tagged with: switch-statement
has title: Get current case number
type: Question
has answer: http://stackoverflow.com/a/26197770
possible better answer: http://stackoverflow.com/a/26197770
upvote count: 3
score: 0
answer count: 2
downvote count: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/26197685

http://stackoverflow.com/a/26194890
has comment: http://stackoverflow.com/comment/46880904
accepted answer of: http://stackoverflow.com/q/26194617
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41077163
answers question: http://stackoverflow.com/q/26194617
has body: Emanuele from Realm here. It looks like the annotation processor is not kicking in and your build file confirms that. Try adding something like: apt files('libs/realm-annotations-processor-0.70.0.jar') to your dependencies
type: Answer
has comment: http://stackoverflow.com/comment/41076674
score: 1
has comment: http://stackoverflow.com/comment/45910172
has comment: http://stackoverflow.com/comment/46705609
has comment: http://stackoverflow.com/comment/45932927

http://stackoverflow.com/q/26313951
tagged with: graphics
score: 0
has body: I'm trying to space some lines on a graphic I am creating however I cant seem yo be able to input a decimal number (3.5) as the value for the space between the lines in the graphics. at the moment I have input the value 4 into the code however this is wrong. the code I am using is below; for (int i = 0; i &lt; 3; i++) g.drawLine(185, 130 - 4*i, 260, 130 - 4*i); Does anyone have any suggestions as to how I would input the decimals as the value?
answer count: 1
has title: How do I use decimals when spacing a graphic
has answer: http://stackoverflow.com/a/26313985
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/51441181
upvote count: 1
downvote count: 1
score: 0
type: Answer
has body: import java.util.Stack; public class QueenSolver { private static final int NUM_QUEENS = 8; private static int[] board = new int[NUM_QUEENS]; public static void solve(int n) { int current = 0; int numSolutions = 0; Stack&lt;Integer&gt; s = new Stack&lt;&gt;(); while (true) { while (current &lt; n) { if (isBoardCorrect(s, current)) { s.push(current); board[s.size() - 1] = current; current = 0; } else { current++; } } if (s.size() == n) { printSolution(++numSolutions); } if (s.isEmpty()) { break; } if (s.peek() == n) { s.pop(); } current = s.pop() + 1; } } private static boolean isBoardCorrect(Stack&lt;Integer&gt; s, int currentPosition) { for (int i = 0; i &lt; s.size(); i++) { if (board[i] == currentPosition || currentPosition == board[i] || Math.abs(currentPosition - board[i]) == s.size() - i) { return false; } } return true; } private static void printSolution(int num) { System.out.print(num + ": "); for (int i = 0; i &lt; board.length; i++) { System.out.print("(" + i + "," + board[i] + ")"); if (i &lt; board.length - 1) { System.out.print(", "); } } System.out.println(); } public static void main(String[] args) { QueenSolver.solve(8); } }
answers question: http://stackoverflow.com/q/26227877

http://stackoverflow.com/comment/41321963
type: Comment
comment on: http://stackoverflow.com/q/26327274
type: QuestionComment
has text: possible duplicate of http://stackoverflow.com/questions/3713829/select-using-hibernate
score: 0

http://stackoverflow.com/q/26276918
tagged with: jscrollpane
upvote count: 1
tagged with: user-interface
downvote count: 0
has title: Prevent components inside jscrollpane from extending past horizontal edge
has comment: http://stackoverflow.com/comment/41263610
favorite count: 0
tagged with: matisse
has comment: http://stackoverflow.com/comment/41226595
answer count: 0
type: UnansweredQuestion
tagged with: swing
score: 1
has comment: http://stackoverflow.com/comment/41235083
tagged with: java
has body: In a project I'm doing I have a set of JTextPane's wrapped in JPanels inside a JFrame. The JTextPane's can be various sizes when the programming is actually running, and what size they will be cannot be predicted, unless it is hardcoded. To make sure that all of the JTextPane's (which are inside the JPanels) are viewable, I have put everything in a scroll pane. Here's the catch: I want the JTextPane's to extend past the bottom of the JScrollPane if needed, but I don't want them to extend past the side. I also want the JPanels/JTextPanes to take up as much space as possible horizontal, without requiring the use of a horizontal scroll bar. This means that if the window is resized horizontally, the JTextPanes need to resize to fill the horizontal space. The JTextPanes are wrapped first in a panel that uses the "GroupLayout" supplied with the Netbeans GUI builder, and then in a panel that uses a BoxLayout. The reason it is BoxLayout is that I add new elements (JTextPane's wrapped in a panel), to it via code. It is much easier to do this using BoxLayout. I tried setting the prefferred width of the JTextPane's to Integer.MAX_VALUE, but that just caused them to extend out of site to the right. I then tried disabling, the horizontal scrollbar, but the JTextPanes still extended to the right. Now I couldn't even scroll to see them! Finally I tried using an event to catch whenever the JFrame resized, then I would call methods to cause everything in the tree to resize. But this didn't seem to work at all. I did this by trying to set the preferred width of each JTextPane to the preferred width of the JFrame, but it didn't seem to have any effect. Here's what it looks like if I have the width of the inner JTextPane set to 427: Here's what I have if I leave the JTextPane's size at "Default" (which I believe is Integer.MAX_VALUE): In case it matters, I'm using the Netbeans GUI builder (Matisse), so I'd prefer a solution that didn't involve changing the layout manager, but I would b…
type: Question

http://stackoverflow.com/comment/41305860
score: 0
type: QuestionComment
type: Comment
has text: @AndrewThompson I am still learning Java, that huge app I spoken about is not developed by me. I tried to find an answer in Java Docs and in Google first, but no success. Thats why I came here.
comment on: http://stackoverflow.com/q/26319866

java.util.scanner
tags question: http://stackoverflow.com/q/26246308
tags question: http://stackoverflow.com/q/26345479
tags question: http://stackoverflow.com/q/26295071
tags question: http://stackoverflow.com/q/26350856
tags question: http://stackoverflow.com/q/26205672
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/26242176
tags question: http://stackoverflow.com/q/26309324
tags question: http://stackoverflow.com/q/26249049
tags question: http://stackoverflow.com/q/26263614
tags question: http://stackoverflow.com/q/26319569
tags question: http://stackoverflow.com/q/26269799
tags question: http://stackoverflow.com/q/26241322
type: Tag
tags question: http://stackoverflow.com/q/26349502
tags question: http://stackoverflow.com/q/26270005
tags question: http://stackoverflow.com/q/26259202
tags question: http://stackoverflow.com/q/26285483
tags question: http://stackoverflow.com/q/26223080
tags question: http://stackoverflow.com/q/26292262
tags question: http://stackoverflow.com/q/26251403
tags question: http://stackoverflow.com/q/26199617
tags question: http://stackoverflow.com/q/26318470
tags question: http://stackoverflow.com/q/26304064
tags question: http://stackoverflow.com/q/26228386
tags question: http://stackoverflow.com/q/26201407
tags question: http://stackoverflow.com/q/26196856
tags question: http://stackoverflow.com/q/26263678
tags question: http://stackoverflow.com/q/26307289
tags question: http://stackoverflow.com/q/26281220
tags question: http://stackoverflow.com/q/26265666
tags question: http://stackoverflow.com/q/26261579
tags question: http://stackoverflow.com/q/26311113
tags question: http://stackoverflow.com/q/26245468

http://stackoverflow.com/a/26335154
has body: You might not have noticed, but your run method waits for the callableService to finish execution before it returns. So you are not able to start two services concurrently. This is because Future.get() waits until the task computation completes. public static void run(Service callableService) { try { Future&lt;Callable&gt; future = executor.submit(callableService); run(future.get().restart()); // &lt;=== will block until task completes! } catch (InterruptedException | ExcecutionException e) { // Program will shutdown } } (You should have noticed that because of the InterruptionException that must be caught - it indicates that there is some blocking, long running operation going on). This also renders the execution service useless. If the code that submits a task to the executor always waits for the task to complete, there is no need to execute this task via executor. Instead, the submitting code should call the service directly. So I assume that blocking is not inteded in this case. Probably your run method should look something like that: public static void run(Service callableService) { executor.submit(() -&gt; { Service result = callableService.call(); run(result.restart()); return result; }); } This code snippet is just basic, you might want to extend it to handle exceptional situations.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41334822
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26324407
downvote count: 0
answers question: http://stackoverflow.com/q/26324407

http://stackoverflow.com/a/26223083
type: Answer
score: 1
upvote count: 1
has body: Java collections already have support for this with the retainAll call. Rather than return a new set, the intersection happens in place, which is why you must create a new ArrayList if you want to retain the original list1. retainAll returns a boolean if the calling object is modified ArrayList&lt;String&gt; list1 = new ArrayList&lt;String&gt;(); list1.add("A"); list1.add("B"); list1.add("C"); ArrayList&lt;String&gt; list2 = new ArrayList&lt;String&gt;(); list2.add("D"); list2.add("B"); list2.add("C"); ArrayList&lt;String&gt; intersection = new ArrayList&lt;String&gt;(list1); intersection.retainAll(list2); for(String s: intersection){ System.out.println(s); } Output: B C
answers question: http://stackoverflow.com/q/26222864
downvote count: 0

http://stackoverflow.com/comment/41262564
comment on: http://stackoverflow.com/q/26296628
score: 5
type: Comment
has text: ... `new File(file_path).exists()`?!
type: QuestionComment

http://stackoverflow.com/q/26264752
score: 1
has comment: http://stackoverflow.com/comment/41238444
favorite count: 0
type: Question
has title: Trying to mute sampled sound
upvote count: 1
tagged with: java
has body: I'm having a problem adding MUTE control. pardon me, I'm a beginner. private BooleanControl muteControl; private Clip audioClip; public void load(String audioFilePath) throws UnsupportedAudioFileException, IOException, LineUnavailableException { File audioFile = new File(audioFilePath); AudioInputStream ais = AudioSystem .getAudioInputStream(audioFile); AudioFormat format = ais.getFormat(); DataLine.Info info = new DataLine.Info(Clip.class, format); audioClip = (Clip) AudioSystem.getLine(info); muteControl = (BooleanControl) audioClip.getControl(BooleanControl.Type.MUTE); audioClip.addLineListener(this); audioClip.open(ais); } The line muteControl = (BooleanControl) audioClip.getControl(BooleanControl.Type.MUTE); keeps giving me an "IlligalArgumentException: Unsupported control type: Mute" I've also tried using MASTER_GAIN control which gave me ""IlligalArgumentException: Unsupported control type: MASTER_GAIN"
answer count: 0
tagged with: controls
type: UnansweredQuestion
tagged with: mute
has comment: http://stackoverflow.com/comment/41208878
tagged with: javax.sound.sampled
downvote count: 0

http://stackoverflow.com/q/26284445
accepted answer: http://stackoverflow.com/a/26284554
has comment: http://stackoverflow.com/comment/41240759
answer count: 2
has comment: http://stackoverflow.com/comment/41240713
has comment: http://stackoverflow.com/comment/41240635
has comment: http://stackoverflow.com/comment/41240774
has comment: http://stackoverflow.com/comment/41240679
tagged with: list
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41240550
has comment: http://stackoverflow.com/comment/41240967
has answer: http://stackoverflow.com/a/26284554
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41240702
tagged with: arrays
has body: I'm trying to read CSV file like this: 1,0,0,0,2,0,0,2, 0,2,0,0,0,0,0,5, 0,0,0,0,0,0,5,0, This is my expected outcome: [1, 5, 8] [2, 8,] [7] This is my Java coding: CSVReader a = new CSVReader(new FileReader("CM.csv")); List&lt;String[]&gt; aa = a.readAll(); List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); Object[] CM = new Object[3]; for (int i = 0; i &lt; aa.size(); i++) { for (int x = 0; x &lt; aa.get(i).length-1; x++) { if ( Integer.parseInt(aa.get(i)[x].trim()) &gt;= 1 ){ list.add(x+1); } } CM[i] = list; list.clear(); } for (int i = 0; i &lt; CM.length; i++) { System.out.print(CM[i]); System.out.print("\n"); } But I get Null outcome. If I delete the list.clear() line then get weird outcome like this : [1, 5, 8, 2, 8, 7] [1, 5, 8, 2, 8, 7] [1, 5, 8, 2, 8, 7] I want to store the list into the array, please ignore the way how i read the CSV file...
has comment: http://stackoverflow.com/comment/41241094
has comment: http://stackoverflow.com/comment/41240533
has title: Java store list to array
type: Question
has comment: http://stackoverflow.com/comment/41240726
possible better answer: http://stackoverflow.com/a/26284686
has answer: http://stackoverflow.com/a/26284686
has comment: http://stackoverflow.com/comment/41240538

http://stackoverflow.com/comment/41178737
comment on: http://stackoverflow.com/a/26249531
score: 0
type: AnswerComment
has text: how would I import everything to android studio?
type: Comment

http://stackoverflow.com/q/26290504
has body: I understand the question may not make sense at first, but I'll explain it here. First, I have the following C++ code, a simple Hello World. #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { printf("Hello World "); return(0); } Now I am calling it from within Java using this: long start = System.nanoTime(); Process p = Runtime.getRuntime().exec("/home/name/./test"); long totalTime = System.nanoTime() - start; System.out.println("Time: " + totalTime); After doing this a couple times i get the following output: Time: 8155128 Time: 732204 Time: 508819 Time: 662987 I wonder if this is a correct way to measure the time for the c++ code execution and i am want to know if there is an explanation on why always the first execution shows a time 10X bigger than the others (even if it's nanoseconds)
has title: How should i measure execution time of a C++ program when I execute it from Java code?
has comment: http://stackoverflow.com/comment/41252462
answer count: 1
linked to: http://stackoverflow.com/q/504103
tagged with: c++
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/26290551
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41251925

http://stackoverflow.com/q/26199750
has answer: http://stackoverflow.com/a/29925204
type: Question
has answer: http://stackoverflow.com/a/26259038
has answer: http://stackoverflow.com/a/39049789
has answer: http://stackoverflow.com/a/37949719
score: 15
tagged with: eclipse
upvote count: 15
has comment: http://stackoverflow.com/comment/41120361
has title: JBoss server 7.1 not starting in Eclipse Luna
has body: I have Eclipse Luna 4.4.1, and JBoss Server 7.1. The problem is when I start the Server, it never starts and after a long time it says Time Out Error. "JBoss is unable to start within 450 seconds". How to resolve this issue? The Console shows the following output and just hangs here for much time: 12:47:54,100 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA 12:47:54,438 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA 12:47:54,552 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting The Server never starts. I have changed the time settings but it never helps.
has answer: http://stackoverflow.com/a/26199791
downvote count: 0
has comment: http://stackoverflow.com/comment/45367248
tagged with: jboss7.x
favorite count: 0
has answer: http://stackoverflow.com/a/54316646
answer count: 9
possible better answer: http://stackoverflow.com/a/26259038
has comment: http://stackoverflow.com/comment/41085508
has answer: http://stackoverflow.com/a/26391583
accepted answer: http://stackoverflow.com/a/26391583
has answer: http://stackoverflow.com/a/36980439
type: AnsweredQuestion
tagged with: eclipse-luna
has answer: http://stackoverflow.com/a/38550529
tagged with: java

http://stackoverflow.com/q/26277580
downvote count: 2
upvote count: 1
answer count: 1
favorite count: 0
has body: I am writing a program that uses two different classes. One class contains the main method and the other class is a generic class Set that has a set of items of generic type T which uses ArrayList. This program finds the intersection of two sets. I want to use the toString() method but I don't know how to implement it in this specific situation when the data fields are not visible. import java.util.Random; //Generic class Set&lt;T&gt; class Set &lt;T&gt; { ArrayList&lt;T&gt; num = new ArrayList&lt;T&gt;(); /*Within this class I have (1) an add method, (2) a remove method, and (3) a method that returns true if the item is in the set and false if it is not in the set*/ //This is the intersection method public static &lt;T&gt; Set&lt;T&gt; intersection(Set&lt;T&gt; k, Set&lt;T&gt; p){ Set&lt;T&gt; abc = new Set&lt;T&gt; (); /*I have some other codes here to find the intersection of two different sets*/ return abc; } @Override /*Here is where I am completely lost I do not know how to use this method in order to print out the intersection of both sets*/ public String toString() { /*I don't know what to implement here in order to return a string that represents the current object*/ return; } } public class SecondClass { //MAIN METHOD public static void main(String [] args){ /* This program generates random numbers for two sets in order to find the intersection of both sets. */ Set&lt;Integer&gt; firstSet = new Set&lt;Integer&gt;(); Set&lt;Integer&gt; secondSet = new Set&lt;Integer&gt;(); Set&lt;Integer&gt; result = new Set&lt;Integer&gt;(); result = Set.intersection(firstSet,secondSet); //Display intersection? System.out.println(result.toString()); } }
has comment: http://stackoverflow.com/comment/41227474
has comment: http://stackoverflow.com/comment/41227384
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26277689
accepted answer: http://stackoverflow.com/a/26277689
has comment: http://stackoverflow.com/comment/41227407
has comment: http://stackoverflow.com/comment/41227562
type: Question
tagged with: tostring
has comment: http://stackoverflow.com/comment/41227363
score: -1
has title: Having Trouble Implementing toString() Method in (Java)

http://stackoverflow.com/q/26293264
has comment: http://stackoverflow.com/comment/41256448
tagged with: java
linked to: http://stackoverflow.com/q/15627883
has title: How to limit the user can only play the guessing game only for 5 times but it is not the user attempts on guessing in Java?
type: Question
has comment: http://stackoverflow.com/comment/41256409
has comment: http://stackoverflow.com/comment/41256416
has body: Here is my code: package playthegame; import java.util.*; public class PlayTheGame { public static void main(String[] args) { Random randomNumber = new Random(); int numberToGuess; int numberOfTries; int numberOfLimit = 5; int userInput; ArrayList&lt;Integer&gt; theInputs = new ArrayList(); Scanner in = new Scanner(System.in); int start = 0; boolean winTracker = false; int temp; while (0 == start) { numberToGuess = randomNumber.nextInt(10); userInput = 0; numberOfTries = 0; System.out.println("Please guess the number between 1 and 10: "); while (numberToGuess != userInput &amp;&amp; numberOfTries &lt; numberOfLimit) { userInput = in.nextInt(); temp = userInput; numberOfTries++; if (userInput == numberToGuess) { theInputs.add(userInput); System.out.println("You win!\n"); System.out.println("The guess number is " + numberToGuess+"\n"); System.out.println("It takes a total of " + numberOfTries + " guesses\n"); System.out.println("These are the guesses number : " + theInputs+"\n"); theInputs.clear(); } else if (userInput &lt; numberToGuess) { theInputs.add(userInput); System.out.println("Oppss, The number is too small\n"); System.out.println("Try next guess: \n"); } else if (userInput &gt; numberToGuess) { theInputs.add(userInput); System.out.println("Oppss, The number is too High\n"); System.out.println("Try next guess: \n"); } } if (numberToGuess != userInput) { System.out.println("=============================================================="); System.out.println("Oppss..You are out of Guess Limitation!The correct number is: " + numberToGuess); } } } } How to limit the user can only play the guessing game only for 5 times in Java if the user whether have won or lost playing the game? is there any possibility to set the user only play for 5 times?anyone, please help
answer count: 1
has comment: http://stackoverflow.com/comment/41256497
favorite count: 0
duplicate of: http://stackoverflow.com/q/15627883
upvote count: 2
has comment: http://stackoverflow.com/comment/41256507
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/41256795
has answer: http://stackoverflow.com/a/26293312
score: 1

http://stackoverflow.com/q/26341791
linked to: http://stackoverflow.com/q/6596399
upvote count: 1
linked to: http://stackoverflow.com/q/15732
has body: how to detect the duplicate elements in .xml file using java? I want to find the duplicate values in the xml file, if any of the duplicate element occurs then system should give an error/exceptionn
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/6596399
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26342280
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41345731
has title: Duplicates in XML
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/26342280

http://stackoverflow.com/comment/41170085
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26244593
has text: Romain Guy explains the scenarios for the memory leak in the comments on the original [blog post](http://www.curious-creature.org/2008/12/18/avoid-memory-leaks-on-android/).

http://stackoverflow.com/comment/41166185
type: Comment
has text: And if you start the TNS-Listener service from windows services form?? services.msc
comment on: http://stackoverflow.com/q/26242890
score: 0
type: QuestionComment

http://stackoverflow.com/q/26327664
has body: I am new to Play Framework. I have started learning it and so far I am enjoying it. I have started to learn Play Java. I have my controller and model set up as follow: Controller: package controllers; import play.mvc.Controller; import play.mvc.Result; //Import Product model import models.Product; public class Products extends Controller{ /** * List all Products */ public static Result list(){ Object allProducts = Product.findAll(); return ok((Content) allProducts); //return all products } } Model: package models; import java.util.List; import play.db.*; import play.api.db.DB; import com.avaje.ebean.Ebean; import com.avaje.ebean.Query; public class Product { public int id; public String name; public String description; public Product(){ } public Product(int id, String name, String description){ this.id = id; this.name = name; this.description = description; } public static String findAll(){ //Using ebean and MySql, fech the product table //and return all products } } To enable the use of MySql, I have already edited the /conf/application.conf as follow: db.default.driver=com.mysql.jdbc.Driver db.default.url="jdbc:mysql://localhost/play_db?characterEncoding=UTF-8" db.default.user=user db.default.password=pass ebean.default="models.*" I have a play_db database with one table shown as follow: My problem is how to fetch all the products in the Product model using ebean and MySQL. Can someone please point me to a simple crud tutorial which uses play java in combination with ebean and MySql? Thanks Anyone? NOTE By the way, I am using Play v.2.3.5 for Java
type: AnsweredQuestion
tagged with: playframework-2.0
has answer: http://stackoverflow.com/a/26330024
has title: Simple CRUD tutorial about Play Framework and MySQL using Ebean?
tagged with: playframework-2.3
score: 7
tagged with: java
tagged with: mysql
upvote count: 7
accepted answer: http://stackoverflow.com/a/26330024
type: Question
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/41172066
type: Comment
has text: Simply create a for loop to iterate through each character until it reaches the end of the string. Upon each iteration check the chars against '-' or '.' and if they appear, set to false.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26246780

http://stackoverflow.com/comment/41150765
type: AnswerComment
comment on: http://stackoverflow.com/a/26235395
type: Comment
has text: Great I am going to go and study the example you supplied,Thanks!
score: 1

http://stackoverflow.com/a/26449939
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/26322432
has body: com.pyx4me proguard-maven-plugin 2.0.4 package proguard 5.0 true ${project.build.finalName}.jar ${project.build.finalName}-small.jar ${project.build.directory} ${basedir}/config.pro ${java.home}/lib/rt.jar ${java.home}/lib/jsse.jar net.sf.proguard proguard 5.0 runtime
has comment: http://stackoverflow.com/comment/41541524
accepted answer of: http://stackoverflow.com/q/26322432

http://stackoverflow.com/q/26245098
linked to: http://stackoverflow.com/q/6592468
tagged with: netbeans
has title: cannot right click on Jframe or Jpanel in netbeans 8.0
has comment: http://stackoverflow.com/comment/41173355
type: UnansweredQuestion
upvote count: 1
tagged with: swing
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41171771
has body: Earlier it was working properly. But all of sudden it stopped responding, whenever I right click on JFrame or JPanel in design mode it doesn't respond. so now I cannot set the layout to null layout by this way.
type: Question
linked to: http://stackoverflow.com/q/25817867
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26304880
has body: However, I'm not sure if this run in O(n) time I do not think it runs in O(n). The moment you have to "find the next correct element and move it to the correct location", you need to Loop over the remainder of the array. Which means that for the worst case scenario (array with all positive elements at the start, and all negative elements at the end) you will loop for each of the positive elements one more time over half of the "unsorted" part of the array When you move the element back to the correct location, you move it position by position. This means you loop once more over the "unsorted" part of the array Not really sure yet how you would get it running in O(n) if you need to respect the requirement that the ordering must be respected without using a third array.
answers question: http://stackoverflow.com/q/26304587
score: 0
type: Answer

http://stackoverflow.com/comment/41208208
comment on: http://stackoverflow.com/a/26266646
type: Comment
has text: I don't care about the `flush()`. It is overwritten by FileOutputStream
type: AnswerComment
score: 0

http://stackoverflow.com/a/26288669
answers question: http://stackoverflow.com/q/26288324
score: 0
type: Answer
has body: Your telling the service to stop in your code. Because your using onBind() it appears that your not starting the service and instead binging to it. If you bind to a service the service automatically ends when your activity ends. If you want to keep your service running. Start the service to keep service running Bind to the service to have a service while app is running Set a notification so the service is in the foreground Change your manifest so the service runs in a separate process Start the service so you can return startsticky in the onStartCommand() to tell the os you want this to stick on @Override public int onStartCommand(Intent intent, int flags, int startId) { return Service.START_STICKY; } Start Service. Bind to the service only if you have a connection to communicate with the service back and forth with. This is returned from onBind() startService(new Intent(context, ServiceLocationRecorder.class)); // bind to the service if (!mIsBound) { // Bind to the service bindService(new Intent(context, ServiceLocationRecorder.class), mConnection, Context.BIND_AUTO_CREATE); mIsBound = true; } Binding to the service is used to setup a binder handler that you can communicate to and from the service with. Returning null in onBind() defeats the purpose of the onBind() event so you could skip this code. /** * When binding to the service, we return an interface to our messenger for * sending messages to the service. */ @Override public IBinder onBind(Intent intent) { return mMessenger.getBinder(); } set the service to the foreground you do this and the os will be less likely to end your service to get memory for another app. //this is done inside the service startForeground(R.id.action_record, getMyCustomNotification()); Run the service in its own process then GC will be able to collect your activity and keep the service running. s -->

http://stackoverflow.com/q/26208472
has comment: http://stackoverflow.com/comment/41099824
has body: I have a program to calculate the amount of paint needed to cover certain area. I have a button that that I have coded which is supposed to clear the text field but it is not working. I have used the exact same format in other programs and it has worked before but for some reason it is not working in this particular program. The error says cannot find symbol on the clearjbuttonactionperformed. Please help. /* FileName: PaintCalculator Name: Bhattarai Date: October.2014 */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*; public class PaintCalculator extends JFrame { // declarations Color black = new Color(0, 0, 0); Color white = new Color(255, 255, 255); Color light_gray = new Color(192, 192, 192); DecimalFormat currency; JTextField currencyJTextField; JLabel roomWidthJLabel; JTextField roomWidthJTextField; JLabel roomLengthJLabel; JTextField roomLengthJTextField; JLabel numberofGallonsJLabel; JTextField numberofGallonsJTextField; JLabel subTotalJLabel; JTextField subTotalJTextField; JLabel salesTaxJLabel; JTextField salesTaxJTextField; JLabel totalAmountJLabel; JTextField totalAmountJTextField; JButton enterJButton; JButton clearJButton; double roomWidth; double roomLength; double numberofGallons; double subTotal; double salesTax; double totalAmount; public PaintCalculator() { createUserInterface(); } public void createUserInterface() { Container contentPane = getContentPane(); contentPane.setBackground(white); contentPane.setLayout(null); // initialize components // input roomWidthJLabel = new JLabel (); roomWidthJLabel.setBounds (50, 20, 150, 20); roomWidthJLabel.setFont(new Font("Default", Font.PLAIN, 12)); roomWidthJLabel.setText ("Enter Width of Room (Ft):"); roomWidthJLabel.setForeground(black); roomWidthJLabel.setHorizontalAlignment(JLabel.LEFT); contentPane.add(roomWidthJLabel); roomWidthJTextField = new JTextField(); roomWidthJTextField.setBounds(230, 20, 100, 20); roomWidthJTextField.setFont(new Font("Default", Font.PLA…
score: 0
has title: clear jbutton - not clearing my text fields
has comment: http://stackoverflow.com/comment/41099821
has comment: http://stackoverflow.com/comment/41100682
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6592468
answer count: 0
tagged with: swing
type: Question
tagged with: java

http://stackoverflow.com/q/26332355
score: 0
has comment: http://stackoverflow.com/comment/41328421
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41329019
tagged with: string
type: UnansweredQuestion
tagged with: random
tagged with: byte
type: Question
has body: I need to write a function which can generate a random string of x bytes size in Java? for example - how can I generate a string which is 300 bytes or (+-50 bytes is also fine) in size and the encoding I will be using is UTF-8. I know how to generate a random String in Java but not sure how to get random string of predefined bytes - public static String generateString(Random random, String characters, int length) { char[] text = new char[length]; for (int i = 0; i &lt; length; i++) { text[i] = characters.charAt(random.nextInt(characters.length())); } return new String(text); }
has comment: http://stackoverflow.com/comment/41329061
has title: How to generate random string of predefined bytes in Java?
has comment: http://stackoverflow.com/comment/41329078
has answer: http://stackoverflow.com/a/26332476
has comment: http://stackoverflow.com/comment/41328460

http://stackoverflow.com/comment/41368362
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26351967
has text: maybe Duplicate: http://stackoverflow.com/questions/8756768/annotations-from-javax-validation-constraints-not-working
type: Comment

http://stackoverflow.com/comment/41368664
comment on: http://stackoverflow.com/a/26277922
has text: @JenkinsUser no, I would try working with dynamic views though (same setcs, but no update step)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41298392
has text: @ArtinRadpour Can you please post the whole code how you create your panel and add the components?
type: Comment
comment on: http://stackoverflow.com/a/26314737
score: 0
type: AnswerComment

http://stackoverflow.com/a/26295890
has comment: http://stackoverflow.com/comment/41262346
has comment: http://stackoverflow.com/comment/41262595
type: Answer
has comment: http://stackoverflow.com/comment/41262296
has comment: http://stackoverflow.com/comment/41263392
has comment: http://stackoverflow.com/comment/41263207
answers question: http://stackoverflow.com/q/26295574
has comment: http://stackoverflow.com/comment/41262643
accepted answer of: http://stackoverflow.com/q/26295574
has comment: http://stackoverflow.com/comment/41262235
has comment: http://stackoverflow.com/comment/41262745
has comment: http://stackoverflow.com/comment/41263292
has comment: http://stackoverflow.com/comment/41262216
score: 0
has comment: http://stackoverflow.com/comment/41262938
has comment: http://stackoverflow.com/comment/41262135
has comment: http://stackoverflow.com/comment/41262898
type: AcceptedAnswer
has body: i always equals 0 so your code will only fill the first element of your array. Here is the solution : BufferedImage[] img = new BufferedImage[s.length]; for(String st : s) { try { File fa = new File(st); img[i++] = ImageIO.read(fa); System.out.println(" inside try block the value of every string = " + st); } catch(Exception e) { e.printStackTrace(); } } edit Same issue with iic, it has to be initialized iic = new ImageIcon[img.length]; i = 0; for(BufferedImage bi : img) { iic[i] = new ImageIcon(bi); // [...]
has comment: http://stackoverflow.com/comment/41262888
has comment: http://stackoverflow.com/comment/41273372
has comment: http://stackoverflow.com/comment/41262429
has comment: http://stackoverflow.com/comment/41262665
has comment: http://stackoverflow.com/comment/41263141

http://stackoverflow.com/a/42278343
has body: /** * List all prime numbers from 101 to 200 * for responding your question, I think it is a good view to have it done * @ Joannama * */ public class PrimeNum { public static void main(String[] args) { for ( int i = 101; i &lt;= 200 ; i += 2) { // get rid of even number from 101 to 200 //because even number are never a prime number boolean f = true; //assume these numbers are prime numbers for ( int j = 2; j &lt; i; j++) { if ( i % j == 0) { f = false; // if the reminder = 0, //which means number is not a prime, //therefore f = false and break it break; } } if ( ! f) { continue; } System.out.print("\u0020" + i); } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26247466

http://stackoverflow.com/a/26197833
has comment: http://stackoverflow.com/comment/41080410
answers question: http://stackoverflow.com/q/26197815
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41080392
has body: This is Java, not JavaScript. Loops continue to loop when the condition remains true. Example of a loop that ends and an explanation why: for(var i = 0; i &lt; 5; i++) { //do something } Each iteration i increases by 1 (due to i++), and once the condition (being i &lt; 5) is no longer true, the loop breaks out and ends. In your loop, true will always be true.

http://stackoverflow.com/comment/41101124
has text: I agree, simple research should give you the answer to this question.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26209107

http://stackoverflow.com/a/38833412
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: I was facing this error and I had already 4.3.2.RELEASE for spring-web and spring-web-mvc. It is solved, this was due to defining spring-data-releasetrain. Removing that solved the problem.
answers question: http://stackoverflow.com/q/26238505

http://stackoverflow.com/a/26332978
type: Answer
has body: Download the MoboRobo software and then install your system.It will work fine.This software is not only Lenova,it for all devices.
answers question: http://stackoverflow.com/q/26331823
score: 0

http://stackoverflow.com/q/26247275
type: UnansweredQuestion
tagged with: android
has body: I'm working on a method to trim a wav file down to a selection made by the user. The basic idea is to use Javazoom's WaveFile class to write a wav file that contains only that sound data in the selection made by the user. The problem is, the code I have written works perfectly about half the time and the other half of the time it produces static. It seems to work and not work under the same exact same circumstances. The wav file is loaded at another time by MediaPlayer and as an input stream in other methods. Is this the likely source of the issue? I've tried to take care to close streams and release MediaPlayer, but continue to have the same issue. public void TrimToSelection(double startTime, double endTime){ // Time in seconds InputStream wavStream = null; // InputStream to stream the wav to trim File trimmedSample = null; // File to contain the trimmed down sample File sampleFile = new File(samplePath); // File pointer to the current wav sample // If the sample file exists, try to trim it if (sampleFile.isFile()){ trimmedSample = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC), "trimmedSample.wav"); if (trimmedSample.isFile()) trimmedSample.delete(); // Delete if already exists // Trim the sample down and write it to file try { wavStream = new BufferedInputStream(new FileInputStream(sampleFile)); // Javazoom class WaveFile is used to write the wav WaveFile waveFile = new WaveFile(); waveFile.OpenForWrite(trimmedSample.getAbsolutePath(), (int)audioFormat.getSampleRate(), (short)audioFormat.getSampleSizeInBits(), (short)audioFormat.getChannels()); // The number of bytes of wav data to trim off the beginning long startOffset = (long)(startTime * audioFormat.getSampleSizeInBits() * audioFormat.getSampleRate() / 4); // The number of bytes to copy long length = (long)(endTime * audioFormat.getSampleSizeInBits() * audioFormat.getSampleRate() / 4) - startOffset; wavStream.skip(44); // Skip the header wavStream.skip(startOffset); byte[…
tagged with: audio
has answer: http://stackoverflow.com/a/26247340
score: 0
tagged with: java
type: Question
tagged with: wav
answer count: 2
has answer: http://stackoverflow.com/a/26268347
has title: Trim wav file method using Javazoom sometimes works

http://stackoverflow.com/a/26332062
answers question: http://stackoverflow.com/q/26331861
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: One straightforward improvement over the algorithm you have posted would be to collect the head elements of the map into a list, rather than reconstructing a HashMap with just the head elements in it: public Iterator&lt;Node&lt;E&gt;&gt; heads() { List&lt;Node&lt;E&gt;&gt; heads = new ArrayList&lt;&gt;(); for (Node&lt;E&gt; e : graph.values()) { if (e.isHead()) heads.add(e); } return heads.iterator(); }

http://stackoverflow.com/comment/41198737
has text: Your comment is confusing. A) The example "{"name":"Bush","Id":0,"event":"Bush meet with Abdelaziz in 1998"}" doesn't describe a node, but an edge. B) Since nodes have IDs, they can be sorted easily, but how do you want the edges to be sorted? Please clarify.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26255297
type: Comment

http://stackoverflow.com/q/26334243
has answer: http://stackoverflow.com/a/26335582
tagged with: java
type: Question
has title: Alignment of Horizontal Layout in Vaadin
upvote count: 2
answer count: 2
has body: I have a mainlayout which is an absolute layout and inside that there is a horizontal layout which I want to allign in center and when the screen resolution is decreased then the horizontal layout should also move until its minnimum widht without decreading its own width.
possible better answer: http://stackoverflow.com/a/26334311
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26335582
tagged with: vaadin7
tagged with: css
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26334311

http://stackoverflow.com/q/26239326
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/13065359
has body: I try to call a web service java in a agent java. I have this error : error message: java.rmi.RemoteException: No operation description was found for the service {http://tempuri.org/}ServiceFichier error message: at org.tempuri.BasicHttpBinding_IServiceAccesFichierStub.getHelloWord(Unknown Source) error message: at JavaAgent.NotesMain(Unknown Source) error message: at lotus.domino.AgentBase.runNotes(Unknown Source) error message: at lotus.domino.NotesThread.run(Unknown Source) I call a web service with this code : public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); String test; URL endpoint; try { endpoint = new URL("http://nomserveur:numeroport/AccesFichier/ServiceAccesFichier.svc?wsdl"); ServiceFichierLocator service1 = new ServiceFichierLocator(); BasicHttpBinding_IServiceAccesFichierStub service = new BasicHttpBinding_IServiceAccesFichierStub(endpoint,service1); test = service.getHelloWord(); System.out.println(test + " ********************************************"); } catch (MalformedURLException e) { // TODO Bloc catch auto-généré e.printStackTrace(); } catch (Fault e) { // TODO Bloc catch auto-généré e.printStackTrace(); } catch (RemoteException e) { // TODO Bloc catch auto-généré e.printStackTrace(); } } catch(Exception e) { e.printStackTrace(); } } I import the web service in an web consumer in notes domino designer 9.0.1. The web service works and it built in dotnet.
has answer: http://stackoverflow.com/a/26442446
type: UnansweredQuestion
tagged with: lotus-domino
tagged with: web-services
tagged with: java
has title: call a service web in an agent JAVA, error : RemoteException: No operation description was found for the service
type: Question

http://stackoverflow.com/q/26281917
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26285670
upvote count: 1
has body: I'm going to create a simple register form app that when user insert their username and password, EditText in UI shows the id of their record in database. My app insert users into database correctly and show JSON output into EditText. For Example when I insert first user to my database, EditText show this: { "id": "1", "0":"1" } But, I want show this in EditText: 1 instead of { "id" : "1", "0" : "1" } activity_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00aeef" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginBottom="50dp" android:layout_marginTop="18dp" android:text="Register Example" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ffffff" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/textView3" android:layout_centerHorizontal="true" android:layout_marginTop="45dp" android:text="Username:" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ffffff" /&gt; &lt;EditText android:id="@+id/edt_username" android:layout_width="250dp" android:layout_height="40dp" android:layout_below="@+id/textView3" android:layout_centerHorizontal="true" android:background="#ffffff" android:ems="10" android:padding="5dp" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;Button android:id="@+id/btn_insert" android:layout_width="match_parent…
has answer: http://stackoverflow.com/a/26285064
type: Question
has title: Show catched JSON object from PHP in android application
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26285670
favorite count: 0
tagged with: android
tagged with: php
accepted answer: http://stackoverflow.com/a/26285064
type: AnsweredQuestion

http://stackoverflow.com/comment/41076353
score: 2
comment on: http://stackoverflow.com/a/26195565
type: AnswerComment
type: Comment
has text: No, you CAN'T have C extend both A and D. Not in Java. If one or both of them were interfaces, it could implement one or both. But all classes in Java extend exactly one class (Object if not specified).

http://stackoverflow.com/comment/41189243
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26256831
has text: cant you just set ridiculously long time to timeout? Like a 1000 years? Or two, just to be sure
score: 0

host
tags question: http://stackoverflow.com/q/26347734
tags question: http://stackoverflow.com/q/26326436
type: Tag
tags question: http://stackoverflow.com/q/26248002
tag name: host

http://stackoverflow.com/comment/41329402
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26261252
has text: Yes.... The output is c c, but i thought it should be c f. Why is the super.type, not calling the super class variable??
score: 0

http://stackoverflow.com/a/26287657
upvote count: 1
has body: You're asking about ForceAuthn (page 49, line 2042): ForceAuthn [Optional]: A Boolean value. If "true", the identity provider MUST authenticate the presenter directly rather than rely on a previous security context. If a value is not provided, the default is "false". However, if both ForceAuthn and IsPassive are "true", the identity provider MUST NOT freshly authenticate the presenter unless the constraints of IsPassive can be met
score: 1
answers question: http://stackoverflow.com/q/26273470
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41264696
type: AnswerComment
comment on: http://stackoverflow.com/a/26297560
score: 0
type: Comment
has text: Macro,your updated code is printing like this 7 9 8 4 6 5 1 3 2

http://stackoverflow.com/comment/41464791
has text: We need the whole stacktrace. From the look of it, the deployment does not have all the required classes. Please check your source code, weblogic.xml. You might be referring to antlr and it isn't there.
type: QuestionComment
comment on: http://stackoverflow.com/q/26353471
score: 0
type: Comment

http://stackoverflow.com/comment/41331262
type: QuestionComment
comment on: http://stackoverflow.com/q/26333970
has text: create a class that contains a long variable and a String array. Use this object collection to store the result.
score: 0
type: Comment

http://stackoverflow.com/q/26332560
type: Question
tagged with: sbt
tagged with: java
score: 0
answer count: 1
has body: Recently our project's dependencies artifact name has been changed so as the package names and some classes' names. Now we need to update our project dependencies for our next release. Problem is when invoking eclipse from play console it just doesn't do that if there's any compilation errors which of course is expected. I just want to update the eclipse project settings and fix compilation problems later.
has answer: http://stackoverflow.com/a/26469054
type: UnansweredQuestion
has title: Ho do I generate eclipse project without compiling or ignoring compilation errors using SBT and play framework?
tagged with: playframework-2.2
tagged with: playframework-2.0

http://stackoverflow.com/q/26329647
type: Question
tagged with: tostring
has comment: http://stackoverflow.com/comment/41323380
linked to: http://stackoverflow.com/q/27581
tagged with: java
has comment: http://stackoverflow.com/comment/41323365
score: 0
has answer: http://stackoverflow.com/a/26329914
has answer: http://stackoverflow.com/a/26329740
has title: How do I write an equals method that compares one team to another?
has comment: http://stackoverflow.com/comment/41323222
answer count: 4
has comment: http://stackoverflow.com/comment/41323236
tagged with: equals
has body: public class Team { private String name, sport; private int numOfWins, numOfLosses; public Team(String name, String Sport){ this.name= name; this.sport= Sport; numOfWins= 0; numOfLosses= 0; } public int addAnotherWin(){ return numOfWins++; } public int addAnotherLoss(){ return numOfLosses++; } public int getNumWins(){ return numOfWins; } public int getNumLosses(){ return numOfLosses; } public void resetWinsAndLosses(){ numOfWins= numOfWins*0; numOfLosses= numOfLosses*0; } public double getPercentOfGamesWon(){ double z= numOfWins/ numOfWins+numOfLosses; return z; } public boolean equals(){ } public String toString(){ } } So my equals method is suppose to compare two teams and return if they are equals if their PercentOfGamesWon is equal to each other, but I don't know how to write that, any help please? Another thing i need help with is the toString, i'm not sure what its for and what i'm suppose to write in it. I just started coding so sorry if this is a noob question.
has answer: http://stackoverflow.com/a/26329747
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26329904

http://stackoverflow.com/comment/41094773
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26205808
has text: I have read the answers on that question and still that does not answer how is it calling private static void confuse(RuntimeException object) not the other two

http://stackoverflow.com/comment/41106735
score: 0
comment on: http://stackoverflow.com/q/26212079
has text: _Doesn't work_ is **really** vague. How are you compiling it? How are you running it?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/52623541
type: Comment
score: 0
type: AnswerComment
has text: where is the log file generated?
comment on: http://stackoverflow.com/a/26290761

http://stackoverflow.com/a/26257016
downvote count: 0
upvote count: 8
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/26256891
answers question: http://stackoverflow.com/q/26256891
has body: If you define &lt;T extends Main&gt; T foo(); in Type Main you cant just return this, because T might be a subtype of Main, which Main of course isn't. So if you have MainSubType m = new Main().foo(); the Compiler wants to induce T as MainSubType but in face it is only of Type Main, so you have to parse it the hard way, which i cannot recommend here but that is how you go &lt;T extends Main&gt; T foo(){return (T) this}. If you do it like that you should indeed be able to compile the rest. If it doesn't work with the (T)-cast in foo(), you will need to provide more context/code.
type: AcceptedAnswer

http://stackoverflow.com/comment/41262265
has text: I have implemented the service layer which encrypt the new password and sends it to DAO layer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26296235
score: 0

http://stackoverflow.com/q/26314404
has comment: http://stackoverflow.com/comment/41298705
has answer: http://stackoverflow.com/a/26314526
has comment: http://stackoverflow.com/comment/41294921
type: Question
has title: Export JAR File and include Dependencies
answer count: 2
linked to: http://stackoverflow.com/q/7218506
has comment: http://stackoverflow.com/comment/41294843
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/26314481
favorite count: 0
has comment: http://stackoverflow.com/comment/41298596
type: UnansweredQuestion
score: 1
tagged with: java
has body: I have a Project in Eclipse and I want to use a library. When I debug this Project, it works. But when I export it, the JAR is not included, and I get a ClassNotFoundException. How can I export a Project, and include another (JAR-) File. It isn't a runnable JAR file. I already tried to copy the library in my project, doesn't work.
upvote count: 1
tagged with: eclipse

http://stackoverflow.com/q/26302476
has answer: http://stackoverflow.com/a/26302526
has title: Reading Multiple Values Into Array Error
tagged with: java
tagged with: file
tagged with: loops
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/41273510
accepted answer: http://stackoverflow.com/a/26302526
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41273465
has body: So I had to design a class that read in stock symbol,name,previous closing price and current price. I then made this driver to instantiate different arrays to do different things with it. I had trouble reading the data as a file. The file has strings and numbers so I decided to read all the data as strings and then parse the ones I needed into doubles. I believe the error occurs when I am reading from the file. I am getting this error: Exception in thread "main" java.lang.NumberFormatException: For input string: "AAPL" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.lang.Double.parseDouble(Double.java:538) at StockDriver.setStockData(StockDriver.java:31) at StockDriver.main(StockDriver.java:10) Any help would be appreciated. Here is my StockDriver code: import java.text.DecimalFormat; import java.io.*; import java.util.Scanner; import java.io.IOException; public class StockDriver { public static void main(String [] args) throws IOException{ Stock [] myStock = new Stock[10]; setStockData(myStock); displayStockData(myStock); } //end main public static void setStockData(Stock [] myStock) throws IOException { File infile = new File("stockData.txt"); if(!infile.exists()){ System.out.println("No file"); System.exit(0); } Scanner scan = new Scanner(infile); String symbol, name, previousClosingPriceString, currentPriceString; double previousClosingPrice, currentPrice; int i = 0; while(scan.hasNext() &amp;&amp; i &lt; myStock.length){ symbol = scan.nextLine(); name = scan.nextLine(); previousClosingPriceString = scan.nextLine(); previousClosingPrice = Double.parseDouble(previousClosingPriceString); currentPriceString = scan.nextLine(); currentPrice = Double.parseDouble(currentPriceString); myStock[i] = new Stock(symbol, name, previousClosingPrice, currentPrice); i++; } //end while } //end setStockData public static void displayStockData(Stock [] myStock) { DecimalFormat form…
type: AnsweredQuestion

http://stackoverflow.com/comment/41190302
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26248716
has text: @PabloDelgado Seriously? You don't accept my answer because printing the dots isn't recursive as well? You're just leeching for an exact answer to your homework assignment. You copying nem's code is a bad idea because it's more complicated than it needs to be with the extra boolean parameter. His answer is fine and it works, but I guarantee you that you didn't even try and look at the code. You copied, pasted, looked at the output and then said "YES IT'S SOLVED". That's pathetic. You could have easily done the dots by yourself. My answer provided the answer to the question. Hope you get a 0.
score: 0

http://stackoverflow.com/q/26319061
score: 0
has comment: http://stackoverflow.com/comment/41303500
has title: swapping nodes in single linked lists
tagged with: pointers
has comment: http://stackoverflow.com/comment/41304123
has comment: http://stackoverflow.com/comment/41303497
type: UnansweredQuestion
tagged with: linked-list
answer count: 0
tagged with: java
type: Question
has body: I searched around on stackoverflow and couldn't find a clear answer to this question. How can I swap node positions in a single linked lists? So far I have this... temp = curr.next; curr.next = prev; prev.next =temp; where curr is the current node and prev is lagging one node behind. It makes sense when I draw it out but I'm historically shaky on linked lists and keeping track of references so if anybody could confirm it for me or explain to me what's wrong I'd really appreciate it!

http://stackoverflow.com/a/26332400
has comment: http://stackoverflow.com/comment/41398385
has comment: http://stackoverflow.com/comment/41530817
has comment: http://stackoverflow.com/comment/41441483
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41346173
type: Answer
accepted answer of: http://stackoverflow.com/q/26329978
has comment: http://stackoverflow.com/comment/41437786
has comment: http://stackoverflow.com/comment/41364247
score: 1
has comment: http://stackoverflow.com/comment/41590461
has comment: http://stackoverflow.com/comment/41588780
upvote count: 1
has comment: http://stackoverflow.com/comment/41530760
has body: You MainWindow class should look something like this: public class MainWindow extends JFrame { private MainPanel mp = new MainPanel(); public static void main(String[] args) { new MainWindow(); } public MainWindow() { setContentPane(mp); setTitle("Calculateur sur 100"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); setVisible(true); } } Note the order: setContentPane then pack then setVisible. pack replaces setSize as it determines the preferred size of the window based on its components. I modified your MainPanel class: public class MainPanel extends JPanel { private JTextField tI = new JTextField("Pourcentage"); JPanel labelPanel = new JPanel(); public MainPanel() { setLayout(new BorderLayout()); tI.getDocument().addDocumentListener(new MyDocumentListener()); add(tI, BorderLayout.PAGE_START); add(labelPanel); } private int check() { int numL; try { numL = Integer.parseInt(tI.getText()); } catch (NumberFormatException exc) { return 0; } return numL &gt; 100? 100 : numL; } private void update(int numL) { labelPanel.removeAll(); for (int i = 0; i &lt; numL; i++) labelPanel.add(new JLabel(String.valueOf(i+1))); JFrame mainWindow = ((JFrame) SwingUtilities.getWindowAncestor(this)); mainWindow.pack(); mainWindow.repaint(); } class MyDocumentListener implements DocumentListener { @Override public void insertUpdate(DocumentEvent e) { update(check()); } @Override public void removeUpdate(DocumentEvent e) { update(check()); } @Override public void changedUpdate(DocumentEvent e) { } } } Explanation: The main panel has the text field separately from another panel which updates dynamically to contain the labels. The text field uses a DocumentListener instead of a KeyListener to listen to changes in its contents. This is the correct approach for many reasons I will not get into here unless really necessary. Whenever the text changes, a check method verifies that the input is a number. If it's not it returns 0. If it's more than 100 it retu…
has comment: http://stackoverflow.com/comment/41345863
has comment: http://stackoverflow.com/comment/41358281
answers question: http://stackoverflow.com/q/26329978
has comment: http://stackoverflow.com/comment/41347483

http://stackoverflow.com/comment/41334096
comment on: http://stackoverflow.com/q/26328028
has text: @xrcwrn but i want to know how can we send the value of file added in table to my action class
score: 0
type: Comment
type: QuestionComment

recursion
type: Tag
tags question: http://stackoverflow.com/q/26318146
tags question: http://stackoverflow.com/q/26351456
tags question: http://stackoverflow.com/q/26226531
tags question: http://stackoverflow.com/q/26282468
tags question: http://stackoverflow.com/q/26248252
tags question: http://stackoverflow.com/q/26315022
tag name: recursion
tags question: http://stackoverflow.com/q/26204695
tags question: http://stackoverflow.com/q/26197320
tags question: http://stackoverflow.com/q/26286746
tags question: http://stackoverflow.com/q/26269592
tags question: http://stackoverflow.com/q/26222864
tags question: http://stackoverflow.com/q/26353415
tags question: http://stackoverflow.com/q/26319323
tags question: http://stackoverflow.com/q/26197745
tags question: http://stackoverflow.com/q/26270200
tags question: http://stackoverflow.com/q/26285297
tags question: http://stackoverflow.com/q/26249027
tags question: http://stackoverflow.com/q/26288774
tags question: http://stackoverflow.com/q/26254485
tags question: http://stackoverflow.com/q/26328296

http://stackoverflow.com/comment/41302848
comment on: http://stackoverflow.com/q/26308859
has text: I think other people misunderstood your question. While question's quality could be improved, I don't think it has to be closed because it's a really interesting topic.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41097213
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26207026
has text: The two last paragraphs are not really clear (to me).
type: AnswerComment

http://stackoverflow.com/q/26321741
accepted answer: http://stackoverflow.com/a/26321891
favorite count: 0
has body: am building bookstore system one of the methods will ask the user to enter the book name then description then the book's code. My question is, how can i recall the try if there was "InputMismatchException". I mean the catch will print to the secreen "Wrong Input!" but i want to prompt the user to input again here is my code public void add(){ try{ System.out.println("Enter the book code :"); int c = s.nextInt(); try{ System.out.println("Eneter the book quantity"); int q = s.nextInt(); try{ System.out.println("Eneter the book description"); String d = s.next(); try{ System.out.println("Eneter the book cost price"); double cp = s.nextDouble(); try{ System.out.println("Eneter the book selling price"); double sp = s.nextDouble(); try{ System.out.println("Enter status: [a for available - u for unvailable]"); String input = s.next(); if(input.equals("a")) { System.out.println("available: "); } else if (input.equals("u")) { System.out.println("unavailable "); } else { System.out.println("Wrong Input"); } try{ System.out.println("enter the discount on the item \"if exsist\""); double dis = s.nextDouble(); }catch(InputMismatchException e){ System.out.println("Wrong Input"); } }catch(InputMismatchException e){ System.out.println("Wrong input"); } }catch(InputMismatchException e){ } }catch(InputMismatchException e){ System.out.println("WRONT INPUT!!"); } }catch(InputMismatchException e){ System.out.println("WRONG INPUT!!"); } } catch(InputMismatchException e){ System.out.println("Wrong input. NUMBERS only!!"); } } catch(InputMismatchException e){ System.out.println("You have to enter a NUMBER only"); }
has comment: http://stackoverflow.com/comment/41308564
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41308852
downvote count: 1
type: Question
has title: using try-catch, how can i recall the try again if the input was wrong?
has answer: http://stackoverflow.com/a/26321891
has comment: http://stackoverflow.com/comment/41308764
has comment: http://stackoverflow.com/comment/41308672
has comment: http://stackoverflow.com/comment/41308688
has comment: http://stackoverflow.com/comment/41308832
answer count: 1
has comment: http://stackoverflow.com/comment/41308565

http://stackoverflow.com/q/26276603
tagged with: java
has body: I want to include js and css files in my jsp, but I'm not able to do so. I'm new to the concept of spring MVC. For a long time, I've been working on this same topic. My index Page is like this Please login in google Chrome Welcome to my Twitter Clone Login User Name Password New User? Signup And my spring-dispatcher-servlet.xml is like this. <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.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <context:component-scan base-package="com.csc.student" /> <mvc:annotation-driven/> /WEB-INF/ .jsp </beans> My controller is like this. package com.csc.student; 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 StudentInfoController { @RequestMapping(value = "/indexPage.html", method = RequestMethod.GET) public ModelAndView getAdmissionFrom() { ModelAndView model = new ModelAndView("indexPage"); return model; } } Can some one help me in this? I'm struggling very hard but I'm not getting any solution. I have kept my js and css file in WEB-INF folder.
upvote count: 26
possible better answer: http://stackoverflow.com/a/26279012
has title: How to include js and CSS in JSP with spring MVC
has answer: http://stackoverflow.com/a/26279976
accepted answer: http://stackoverflow.com/a/26279976
type: Question
score: 26
has answer: http://stackoverflow.com/a/26279012
downvote count: 0
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/61013101
answer count: 9
has answer: http://stackoverflow.com/a/61363474
has answer: http://stackoverflow.com/a/32480456
has answer: http://stackoverflow.com/a/73172780
has answer: http://stackoverflow.com/a/26276720
has answer: http://stackoverflow.com/a/39098672
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38243268

http://stackoverflow.com/q/26258461
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26258804
tagged with: java
tagged with: servlets
type: Question
upvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/27912052
downvote count: 0
has title: Annotating WebSecurityConfigurerAdapter with @Configuration causes config to be invoked twice
has answer: http://stackoverflow.com/a/27912052
score: 4
tagged with: spring-security
accepted answer: http://stackoverflow.com/a/26258804
favorite count: 0
tagged with: spring-ioc
has body: When I create a WebSecurityConfigurerAdapter it is getting registered twice. I've created a configuration exactly the same as the Hello Web Security Java Configuration example from the reference docs. The configuration is working as expected, though beans and the filter chain gets registered twice as shown in the tomcat output. 00:32:01 INFO : Root WebApplicationContext: initialization started 00:32:01 INFO : Refreshing Root WebApplicationContext: startup date [Thu Oct 09 00:32:01 EST 2014]; root of context hierarchy 00:32:01 INFO : Registering annotated classes: [class com.acme.app.config.SecurityConfig] ______________ 00:32:02 INFO : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@26eed435, org.springframework.security.web.context.SecurityContextPersistenceFilter@cd9947, org.springframework.security.web.header.HeaderWriterFilter@354e8394, org.springframework.security.web.csrf.CsrfFilter@54fb62e3, org.springframework.security.web.authentication.logout.LogoutFilter@1df9cd96, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@4da923c6, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@1ee94efd, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@7d4b5722, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@26dde6a8, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7c58b660, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@6fd12384, org.springframework.security.web.session.SessionManagementFilter@24d4cc75, org.springframework.security.web.access.ExceptionTranslationFilter@1709e92c, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@2c46f137] 00:32:02 INFO : Root WebApplicationContext: initialization completed in 565 ms 00:32:02 INFO : Framewo…
has comment: http://stackoverflow.com/comment/41192158
has comment: http://stackoverflow.com/comment/41192694
tagged with: spring

http://stackoverflow.com/q/26227839
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41162811
type: Question
has comment: http://stackoverflow.com/comment/41147869
has comment: http://stackoverflow.com/comment/41136751
has title: Quickest, easiest way to acces (English) 'dictionary' in a Java/Scala-based app, using PostgreSQL, in Linux?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41136817
favorite count: 0
has answer: http://stackoverflow.com/a/26250104
tagged with: postgresql
tagged with: linux
has comment: http://stackoverflow.com/comment/41138128
has body: I have a Scala-based application (which thus has access to standard Java stuff), leveraging a PostgreSQL database, running on Linux. I mention the database and OS because, I know Postgres has some kind of dictionary for doing its text-search indexing, and I would think most Linux systems would have some sort of baseline dictionary, at least for simple things like spell-check. Whether it would be easy or practical to leverage these, though, is another matter. I don't need complete word definitions, but I need to be able to answer questions like the following: Which part of speech does a word belong to? (E.g., is word X a noun? Is it a verb?) Is a word plural? And if so, what's its singular form? (And vice versa.) The solution doesn't need to be super-fast, but it would be great if it's at least usable for servicing web-requests where a caching solution is used in combination. I know there are tons of options out there -- googling for "java dictionary" will unearth a load, but it's not at all clear which of these projects are still active, which are more usable (subjective, I know :P), nor which may be overkill for my purposes. Also, a solution that works either (a) with the stack I already have in place, or (b) as a simple sbt dependency would be ideal!
tagged with: scala
tagged with: dictionary
type: UnansweredQuestion

updatemodel
tags question: http://stackoverflow.com/q/26282606
type: Tag
tag name: updatemodel

http://stackoverflow.com/q/26324810
has body: After a user opens my application I don't want them to be able to get out. So when they press the home or back button it doesn't let them exit the app. I know there are ways using a service to keep the app always running in the background, but I don't even want them to even exit. Is this even possible, if so how? Without having to hack the kernel. I know this sounds odd, but it is not for a commercial app, but for my lab, it will never be on GooglePlay. The tablets will be given to little kids and they will take a test on it, so I can't have them using youtube or anything else. Related post: Android, How to make the task of the app unclosable? Only closable by task killing The answer by CommonWare seems to indicate that kernel hacking is the only way, but is it? Also I am using Android L.
has comment: http://stackoverflow.com/comment/41314148
tagged with: android
has comment: http://stackoverflow.com/comment/41314212
has comment: http://stackoverflow.com/comment/41314331
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41314380
has title: How to make an app unclosable?
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26324962
has comment: http://stackoverflow.com/comment/41314348
has comment: http://stackoverflow.com/comment/41314196
possible better answer: http://stackoverflow.com/a/51230167
type: Question
has answer: http://stackoverflow.com/a/51230167
answer count: 2
linked to: http://stackoverflow.com/q/11746875
has comment: http://stackoverflow.com/comment/41314326
downvote count: 0
has answer: http://stackoverflow.com/a/26324962
favorite count: 0
has comment: http://stackoverflow.com/comment/41314388
has comment: http://stackoverflow.com/comment/41314365

http://stackoverflow.com/q/26199473
tagged with: java
has answer: http://stackoverflow.com/a/26200053
type: Question
tagged with: google-cloud-datastore
downvote count: 0
accepted answer: http://stackoverflow.com/a/26200053
answer count: 1
favorite count: 0
upvote count: 1
has body: // Use Query.Builder to assemble a query Query.Builder q = Query.newBuilder(); q.addKindBuilder().setName("Trivia"); q.setFilter(makeFilter("__key__", PropertyFilter.Operator.EQUAL, makeValue(makeKey("Trivia", "hgtg")))); // Assemble a RunQueryRequest RunQueryRequest request = RunQueryRequest.newBuilder().setQuery(q).build(); RunQueryResponse response = Main.datastore.runQuery(request); Where the Key is hgtg and the Kind is Trivia. Also, would this query be considered Strongly Consistent? As far as I can tell this is only querying one Entity Group so it should be Strongly Consistent. Thanks! EDIT: I'm asking about Google Cloud Datastore which has a different Java API than App Engine.
type: AnsweredQuestion
has title: Is this the correct way to query by key with Java in Google Cloud Datastore?
score: 1

http://stackoverflow.com/q/26211439
has answer: http://stackoverflow.com/a/26211588
has body: Hi guys I'm new on java programming. I have my android app and I'm trying to build a matrix with values comes from the markers on a googlemap map. All is going well but when I try to assign to a matrix some values it goes in exception (NullPointerException). The markers datas I read from an xml file on the sd card and the xml parser works well. This is my code: for (int i = 0; i &lt; markers.getLength(); i++) { Element item = (Element) markers.item(i); Data[i][0] = item.getAttribute("name"); Data[i][1] = item.getAttribute("address"); Data[i][2] = item.getAttribute("lat"); } This is the statement of the matrix (some rows above): String [][]Data;
has comment: http://stackoverflow.com/comment/41105605
downvote count: 3
has comment: http://stackoverflow.com/comment/41105636
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41105713
has title: How can assign String values to Matrix in java?
score: -2
tagged with: java
tagged with: google-maps
tagged with: matrix
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/41105791
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41105908
tagged with: android

http://stackoverflow.com/a/26260754
type: Answer
has comment: http://stackoverflow.com/comment/41197396
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26260288
answers question: http://stackoverflow.com/q/26260288
has body: RelativeLayout ll = new RelativeLayout(this); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); ll.setLayoutParams(params); TextView textView = new TextView(this); // textView.; RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params1.addRule(RelativeLayout.CENTER_HORIZONTAL); textView.setLayoutParams(params1); // textView.setBottom(TRIM_MEMORY_BACKGROUND); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 48); textView.setText("hello"); ll.addView(textView); setContentView(ll);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41239772
has text: Yes, second argument is string, but this argument is not just any string, because it also is used by regex engine while replacing, and can contain some special characters, which are `$` - reference to match from group matched by regex (for instance `$1` represents match from group 1), ``\`` to let us escape `$`, so to represent ``\`` literal in this second argument you need to write it as `"\\\\"`.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26267402

http://stackoverflow.com/q/26263935
has comment: http://stackoverflow.com/comment/41202977
linked to: http://stackoverflow.com/q/3378501
has comment: http://stackoverflow.com/comment/41203039
has comment: http://stackoverflow.com/comment/41202818
has answer: http://stackoverflow.com/a/26265431
possible better answer: http://stackoverflow.com/a/26263983
has body: What is 'localhost' address for Android device? I'm testing a program using client and server at the same app. neither SERVER_IP ="http://localhost" nor "http://127.0.0.1" works for InetAddress serverAddr = InetAddress.getByName(SERVER_IP); socket = new Socket(serverAddr, SERVERPORT); it gives: Unable to resolve host "http://localhost": No address associated with hostname android What is the best way to use localhost? UPDATE Thanks to all comments: "http://localhost" is incorrecct. Right is "localhost" or "127.0.0.1" or "127.0.0.2", etc. But I hope the best solution is the marked answer.
answer count: 2
has comment: http://stackoverflow.com/comment/41202928
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41202906
favorite count: 0
has comment: http://stackoverflow.com/comment/41202745
accepted answer: http://stackoverflow.com/a/26265431
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/41214077
has comment: http://stackoverflow.com/comment/41214107
type: AnsweredQuestion
has title: What is localhost for Android?
has comment: http://stackoverflow.com/comment/41203117
tagged with: java
has comment: http://stackoverflow.com/comment/41203955
has answer: http://stackoverflow.com/a/26263983
type: Question
linked to: http://stackoverflow.com/q/4779963

http://stackoverflow.com/comment/41098450
type: Comment
comment on: http://stackoverflow.com/a/26199355
has text: @TheCrownedPixel What is the **exact** error message? And which version of HTTPURLConnection are you using?
type: AnswerComment
score: 0

http://stackoverflow.com/q/26205883
has comment: http://stackoverflow.com/comment/41094951
type: Question
has title: Can I use startsWith and endsWith in Java to check input?
has body: In Java can I use startsWith and endsWith to check a user input string? Specifically, to compare first and last Characters of the input? EDIT1: Wow you guys are fast. Thank you for the responses. EDIT2: So CharAt is way more efficient. So How do I catch the First and last Letter? char result1 = s.charAt(0); char result2 = s.charAt(?); EDIT3: I am very close to making this loop work, but something is critically wrong. I had some very good help earlier, Thank you all again. import java.util.Scanner; public class module6 { public static void main(String[]args){ Scanner scan = new Scanner(System.in); while(true){ System.out.print("Please enter words ending in 999 \n"); System.out.print("Word:"); String answer; answer = scan.next(); char aChar = answer.charAt(0); char bChar = answer.charAt(answer.length()-1); String MATCH = new String("The word "+answer+" has first and last characters that are the same"); String FINISH = new String("Goodbye"); if((aChar == bChar)); { System.out.println(MATCH); } if(answer !="999") { System.out.println(FINISH); break; } } } } The loop just executes everything, No matter what is input. Where did I go wrong?
score: -2
tagged with: java
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/41094886
has answer: http://stackoverflow.com/a/26205902
favorite count: 0
tagged with: break
has answer: http://stackoverflow.com/a/26205909
has answer: http://stackoverflow.com/a/26205900
type: UnansweredQuestion
downvote count: 2
tagged with: loops

http://stackoverflow.com/comment/41361943
comment on: http://stackoverflow.com/a/26350642
has text: I can see you adding 9 values, but I don't have access to your database, so it's impossible to know. Is the `ID` column auto incrementing?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41524707
has text: thank you so much. I am a bit novince, how would I use the API?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26197170
type: QuestionComment

http://stackoverflow.com/q/26219052
accepted answer: http://stackoverflow.com/a/26220636
tagged with: mysql
upvote count: 1
type: Question
tagged with: jhipster
answer count: 1
downvote count: 0
favorite count: 0
has body: Running with Spring Boot v1.1.7.RELEASE, Spring v4.0.7.RELEASE with hot reloading, etc. Hey JHipsters, I'm working on my first project with JHipster. I can successfully create an application that runs, authenticates, etc. My issues really began when I started to try to create and maintain entities. At this point I've created an entity successfully called "Employees" with all the supporting files that JHipster provides. I've also managed to add the fields that I wanted to that entity (which proved to be more difficult than I originally anticipated), but wasn't able to eliminate the sample fields without creating an error, so I've left them there. Now, maybe I'm missing something here, but when I go and save a group of values in my entity, as soon as I terminate my application, those values evaporate. Is JHipster designed to operate this way in developer mode? If so, how do I persist my values in the MYSQL database that JHipster created for me? Let me know if you need any more information from me to help.
tagged with: spring
has answer: http://stackoverflow.com/a/26220636
type: AnsweredQuestion
has title: JHipster Persist Data/Access Database
score: 1
tagged with: java

http://stackoverflow.com/comment/41364060
score: 0
comment on: http://stackoverflow.com/q/26350442
type: Comment
type: QuestionComment
has text: I don't believe that you can create EJBs this way. The EJB container controls the EJB lifecycle. Additionally, you would normally control the lifecycle of other managed beans by specifying their scope (@ RequestScoped, etc) and let CDI create them on demand at injection points.

http://stackoverflow.com/a/41737270
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/71394548
has body: I had the same problem (401 errors) for every single non-GET request. I finally got through this by looking to the CSRF documentation: http://documentation.bonitasoft.com/7.4?page=csrf-security (See the "Is there an impact on REST API calls?" section) After succesfull login, you have to put a special header in your request: key: X-Bonita-API-Token value: the one you got after your login (check the relevant cookie)
upvote count: 1
answers question: http://stackoverflow.com/q/26284249
type: Answer

http://stackoverflow.com/q/26269193
answer count: 8
has title: How to call a method function from another class?
score: 10
has answer: http://stackoverflow.com/a/26269334
tagged with: bluej
favorite count: 0
has answer: http://stackoverflow.com/a/26269286
has body: I'm writing a java project that has three different classes. This is what i have have so far. I'm just stuck on how do you call a method function from another class to another class. I have written 2 classes already. I got the "Date" class and "TemperatureRange" class done; now i'm trying to call those 2 classes into "WeatherRecord" class. I'm not sure if i'm explaining this right. public class WeatherRecord //implements Record { private String TemperatureRangetoday; private String TemperatureRangenormal; private String TemperatureRangerecord; public static void main (String[] args){ } } This is another class public class Date { public static String date(String date, String month, String year){ String rdate = date + " " +month + " " +year; return rdate; } } And here's another class public class TemperatureRange { public static String TempRange (String high, String low){ String rTempRange = high +"high" + " "+low+"low"; return rTempRange; } }
type: UnansweredQuestion
upvote count: 10
has answer: http://stackoverflow.com/a/26269404
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/71531292
has answer: http://stackoverflow.com/a/26269220
has answer: http://stackoverflow.com/a/26269275
has answer: http://stackoverflow.com/a/69153858
type: Question
has answer: http://stackoverflow.com/a/67109469

http://stackoverflow.com/a/36842856
has comment: http://stackoverflow.com/comment/95854315
has body: Asynchronous implementation with JDK 1.8: public static void setTimeout(Runnable runnable, int delay){ new Thread(() -&gt; { try { Thread.sleep(delay); runnable.run(); } catch (Exception e){ System.err.println(e); } }).start(); } To call with lambda expression: setTimeout(() -&gt; System.out.println("test"), 1000); Or with method reference: setTimeout(anInstance::aMethod, 1000); To deal with the current running thread only use a synchronous version: public static void setTimeoutSync(Runnable runnable, int delay) { try { Thread.sleep(delay); runnable.run(); } catch (Exception e){ System.err.println(e); } } Use this with caution in main thread – it will suspend everything after the call until timeout expires and runnable executes.
type: Answer
has comment: http://stackoverflow.com/comment/103384226
has comment: http://stackoverflow.com/comment/134058620
has comment: http://stackoverflow.com/comment/95898776
score: 65
upvote count: 67
has comment: http://stackoverflow.com/comment/95898471
answers question: http://stackoverflow.com/q/26311470
downvote count: 2

http://stackoverflow.com/comment/41142420
score: 0
has text: Thx for your answer! What do you exactly mean by `create a task that will attach to your jvm process and monitor its state.`. What do you mean by task?
comment on: http://stackoverflow.com/a/26230912
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26225235
has title: Extracting numbers from a String in Java by splitting on a regex
type: AnsweredQuestion
downvote count: 0
score: 7
favorite count: 0
has answer: http://stackoverflow.com/a/26225364
type: Question
has answer: http://stackoverflow.com/a/27644820
tagged with: regex
has body: I want to extract numbers from Strings like this: String numbers[] = "M0.286-3.099-0.44c-2.901,-0.436,,,123,0.123,.34".split(PATTERN); From such String I'd like to extract these numbers: 0.286 -3.099 -0.44 -2.901 -0.436 123 0.123 .34 That is: There can be garbage characters like "M", "c", "c" The "-" sign is to include in the number, not to split on A "number" can be anything that Float.parseFloat can parse, so .34 is valid What I have so far: String PATTERN = "([^\\d.-]+)|(?=-)"; Which works to some degree, but obviously far from perfect: Doesn't skip the starting garbage "M" in the example Doesn't handle consecutive garbage, like the ,,, in the middle How to fix PATTERN to make it work?
has answer: http://stackoverflow.com/a/26225571
answer count: 6
has answer: http://stackoverflow.com/a/26225340
tagged with: java
upvote count: 7
accepted answer: http://stackoverflow.com/a/26225340
possible better answer: http://stackoverflow.com/a/27629884
has answer: http://stackoverflow.com/a/27629884
has answer: http://stackoverflow.com/a/27626902
has comment: http://stackoverflow.com/comment/41132225

http://stackoverflow.com/a/26260009
type: Answer
upvote count: 4
downvote count: 0
has body: This looks like a JBoss bug. The package org.apache.log4j is not used in log4j 2 any more. The namespace in log4j 2 is org.apache.logging.log4j. So this is a log4j-1.x based log library, and it looks like it is a JBoss internal adaptation. I recommend you file a bug report with JBoss.
answers question: http://stackoverflow.com/q/26244173
score: 4

http://stackoverflow.com/comment/41090044
type: QuestionComment
score: 5
has text: _I have a classA with a lot of static variables._ **Alarm bells.** If you want to write testable code then pass these `static` variables into the constructor. If you want to write maintainable code then remove as many `static` variables as possible. `static` is evil!
comment on: http://stackoverflow.com/q/26203289
type: Comment

http://stackoverflow.com/a/26332842
has comment: http://stackoverflow.com/comment/41329405
has comment: http://stackoverflow.com/comment/41329952
has comment: http://stackoverflow.com/comment/41329715
answers question: http://stackoverflow.com/q/26332817
has comment: http://stackoverflow.com/comment/41329637
has comment: http://stackoverflow.com/comment/41329558
has comment: http://stackoverflow.com/comment/41329831
has comment: http://stackoverflow.com/comment/41329371
has comment: http://stackoverflow.com/comment/41330016
score: -1
has comment: http://stackoverflow.com/comment/41329586
has comment: http://stackoverflow.com/comment/41329763
downvote count: 1
has comment: http://stackoverflow.com/comment/41330232
has body: From your code, I don't see a variable named X. So I'm assuming you want a character comparison. if(s.nextLine().equals("X") &amp;&amp; s.nextInt() &lt;= 10) Wrap X with double quotes and it should solve your problem. EDIT: If you need to add a variable and check for x,y or z then do the following: import java.util.Scanner; public class ScannerAndKeyboard { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Welcome"); System.out.print( "Enter your name: " ); String name = s.nextLine(); System.out.println( "Hello " + name + "!" ); System.out.print("Please Enter letter and number: " ); String X = s.nextLine(); if((X.equalsIgnoreCase("x") || X.equalsIgnoreCase("y") || X.equalsIgnoreCase("z")) &amp;&amp; s.nextInt() &lt;= 10) System.out.println( "You choose "+X+" 10"); } } EDIT 2 If they are to be in the same line, then do this: import java.util.Scanner; public class ScannerAndKeyboard { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Welcome"); System.out.print( "Enter your name: " ); String name = s.nextLine(); System.out.println( "Hello " + name + "!" ); boolean stat = true; while(boolean) System.out.print("Please Enter letter and number: " ); String X = s.nextLine(); String[] X1 = X.split(" "); if((X1[0].equalsIgnoreCase("x") || X1[0].equalsIgnoreCase("y") || X1[0].equalsIgnoreCase("z")) &amp;&amp; Integer.parseInt(X1[1]) &lt;= 10) System.out.println( "You choose "+X1[0]+" "+X1[1]); stat = false; } else { System.out.println("Invalid Input!"); } }
has comment: http://stackoverflow.com/comment/41329788
type: Answer
has comment: http://stackoverflow.com/comment/41329806
upvote count: 0

http://stackoverflow.com/comment/41270188
has text: what is b?, not even defined in the function, are you sure it even compiles?
score: 0
comment on: http://stackoverflow.com/q/26300631
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41441483
has text: @Chax What is "can't"? It returns an `int` - you can divide it. If it's `0` you get an exception.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26332400
type: Comment

http://stackoverflow.com/comment/41147680
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26195355
has text: OK, i can see your point. So, we have to check whether it is useful to use Mono both on Windows and other OS too. If yes, we could compile the C# parts to libraries using Mono, and integrate them with JNI into the main app. This would work on Windows, Linux and Mac as well, right? This sounds like a quite feasible solution (as far as we can go without .Net on Windows. Hm... we have to check this. Do you see any alternative solutions? Thanks very much for your great support! This really helps me...
score: 0

http://stackoverflow.com/q/26245388
has body: Background In Java 101, we're taught: A String is immutable. Yes. Good. Thanks. Then we get to Java 102 (or perhaps Java 201), and we discover: A String isn't really immutable: you can change it using reflection. Ah. Fine. Either quite cute or immeasurably perverse, depending on your perspective. These things, thus far, have been discussed ad infinitum on Stack Overflow and elsewhere. I am taking this much for granted in framing this question. What I'm interested to ask is this: The question Once we discover that a String isn't really immutable, what are the implications for how we should write our code? Let me make that more specific in two respects. JVM Sandboxing Is it possible for a malicious class to use this trick to break the security of the JVM, and get up to tricks that it shouldn't? Are there places in the JDK, for instance, where a String is returned from a method, and it's safe only on the assumption that it can't be changed? Here's a promising start: String prop = "java.version"; // retrieve a System property as a String String s = System.getProperty(prop); System.out.println(s); // now mess with it Field field = String.class.getDeclaredField("value"); field.setAccessible(true); char[] value = (char[])field.get(s); value[0] = 'x'; //turns out we've changed not just the String we were //given but the underlying property too! System.out.println(System.getProperty(prop)); What this does is to retrieve a system property from the JVM, which comes back as a String, and then alter the String; the consequence is that the underlying property is changed too. Can this be used to wreak havoc? I'm not certain. It's worth noting that you have to have the right permissions to perform reflection. Is the security game already up by that point? It allows me here to get round not having permissions to change security properties, but is that to be expected, or is it a problem? Are there ways of extending this to do something much worse? Defensive cloning We're always told …
has comment: http://stackoverflow.com/comment/41169382
has comment: http://stackoverflow.com/comment/41170036
score: 6
accepted answer: http://stackoverflow.com/a/26245487
tagged with: security
has comment: http://stackoverflow.com/comment/41169985
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20945049
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41170056
type: Question
has title: What are the implications of Java strings not really being immutable?
answer count: 2
has comment: http://stackoverflow.com/comment/41197941
upvote count: 6
tagged with: immutability
tagged with: clone
has answer: http://stackoverflow.com/a/26245487
possible better answer: http://stackoverflow.com/a/26245501
tagged with: java
has answer: http://stackoverflow.com/a/26245501

http://stackoverflow.com/q/26305827
has comment: http://stackoverflow.com/comment/41281589
has comment: http://stackoverflow.com/comment/41281658
has body: Would like to first state that I am a computer science student and my University is strict on direct code copying so if you could please refrain from answers such as "it should look like this" it would be greatly appreciated. So basically my assignment is to create a JavaFX program that contains multiple green balls, and one red ball. All the balls must wrap around the pane (in an asteroids type of way) and if a red ball happens to collide with the green ball, the green ball is removed. I have multiple issues, but the key one I need to focus on is how to get all the balls from my ArrayList along with my one red ball to show up in the pane and move independently. They are all there in the pane (and bounce currently) but its like they are all bound together. I have given each ball random xy values and they should also all have random dx/dy values(their velocity). And I believe that is where my problem lies, each ball does not have their own dx/dy, thus I created a class that extends Circle to try and solve that problem but my getters and setters do not seem to be accessible. I also know the root of the problem lies in the moveBall() method as it is the method that needs to adjust values, but I cannot figure out the algorithm, and since my professor's office hours are over, I have came here in hopes of someone pointing me in the right direction. Here are the classses(I would also like to state, this is not fully my code; it's modified code from a Case Study exercise from "Intro To Java Programming 10th ed. by Y. Daniel Liang): EDIT: Corrected a small error. Main problem is getting all the balls to now move independently via the moveBall() method. EDIT 2: Assignment is OVER. Answers are are no longer restricted. Also added other methods that are not doing what I want addBallToPane() and checkForCollision() If anyone can tell me how I could repair these that would be great. Still want to solve this on my own, but with help :) import javafx.animation.KeyFrame; import java…
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/26307329
has comment: http://stackoverflow.com/comment/41280786
type: Question
has comment: http://stackoverflow.com/comment/41279952
tagged with: arraylist
score: 0
answer count: 1
has title: Creating Multiple Balls That Wrap Around Pane
type: UnansweredQuestion

http://stackoverflow.com/q/26284249
possible better answer: http://stackoverflow.com/a/41737270
downvote count: 0
has answer: http://stackoverflow.com/a/27038680
score: 1
has answer: http://stackoverflow.com/a/41737270
tagged with: java
tagged with: web-services
has title: Bonita Web API - 401 Unauthorized Error
type: Question
answer count: 2
upvote count: 1
tagged with: bonita
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/27038680
has body: I am trying to use Bonita Web API. I My code is below. As you can see I call the loginservice before calling any other API service. It logs in OK 200. But when I make the subsequent call to get the list of processes I get a 401 error. You get a JSESSIONID from the first call and you are suppose to pass it to the subsequent calls to authenticate you. var baseAddress = new Uri(&lt;base address&gt;); var cookieContainer = new CookieContainer(); using (var handler = new HttpClientHandler() { CookieContainer = cookieContainer }) using (var client = new HttpClient(handler) { BaseAddress = baseAddress }) { HttpResponseMessage result = client.PostAsync("/bonita/loginservice", new StringContent("login=&lt;username&gt;,password=&lt;password&gt;,redirect=false")).Result; client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage result2 = client.GetAsync("/bonita/API/bpm/process").Result; result2.EnsureSuccessStatusCode(); }
tagged with: c#-4.0
type: AnsweredQuestion

http://stackoverflow.com/a/26344399
score: 2
upvote count: 2
downvote count: 0
has body: As a side note, in Java 8: JLabel lbl[] = Arrays.stream(strLbl).map(s -&gt; new JLabel(s)).toArray();
type: Answer
answers question: http://stackoverflow.com/q/26344292

http://stackoverflow.com/a/26283080
has comment: http://stackoverflow.com/comment/71565798
has comment: http://stackoverflow.com/comment/101275808
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/57272261
has comment: http://stackoverflow.com/comment/41277497
has body: The reason the code you have is not working is that @Cache is not intended to work that way. If you want to cache the results of a query method execution, the easiest way is to use Spring's caching abstraction. interface PromotionServiceXrefRepository extends PagingAndSortingRepository&lt;PromotionServiceXref, Integer&gt; { @Query("…") @Cacheable("servicesByCustomerId") Set&lt;PromotionServiceXref&gt; findByCustomerId(int customerId); @Override @CacheEvict(value = "servicesByCustomerId", key = "#p0.customer.id") &lt;S extends PromotionServiceXref&gt; S save(S service); } This setup will cause results of calls to findByCustomerId(…) be cached by the customer identifier. Note, that we added an @CacheEvict to the overridden save(…) method, so that the cache we populate with the query method is evicted, whenever an entity is saved. This probably has to be propagated to the delete(…) methods as well. Now you can go ahead an configure a dedicated CacheManager (see the reference documentation for details) to plug in whichever caching solution you prefer (using a plain ConcurrentHashMap here). @Configuration @EnableCaching class CachingConfig { @Bean CacheManager cacheManager() { SimpleCacheManager cacheManager = new SimpleCacheManager(); cacheManager.addCaches(Arrays.asList(new ConcurrentMapCache("servicesByCustomerId))); return cacheManager; } }
accepted answer of: http://stackoverflow.com/q/26242492
type: Answer
answers question: http://stackoverflow.com/q/26242492
score: 64
has comment: http://stackoverflow.com/comment/92064801
has comment: http://stackoverflow.com/comment/100322383
has comment: http://stackoverflow.com/comment/75620120
downvote count: 2
upvote count: 66
has comment: http://stackoverflow.com/comment/124537370

http://stackoverflow.com/a/26274204
has comment: http://stackoverflow.com/comment/41223534
has comment: http://stackoverflow.com/comment/41272975
answers question: http://stackoverflow.com/q/26273821
has comment: http://stackoverflow.com/comment/41222741
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41223062
upvote count: 8
has comment: http://stackoverflow.com/comment/41221772
has body: For your first problem MongoDB has upsert so db.collection.update( {query for id}, {document}, {upsert: true} ) or in the Java driver yourCollection.update(searchObject, modifiedObject, true, false); If you want to set a custom ID you just set the _id key manually i.e. yourBasicDBObject.put("_id",yourCustomId) you just have to ensure it is unique for each document. You will also need to set the _id in your modifiedObject otherwise a new one will be generated. As for the bulk operations, just setting a custom ID for each document by giving the _id key should also work.
has comment: http://stackoverflow.com/comment/41271585
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/41270907
accepted answer of: http://stackoverflow.com/q/26273821

http://stackoverflow.com/comment/41341315
type: Comment
score: 2
has text: Doesn't the OPs method risk ending up with "0.0999999999123" in the list when the original element was "0.1"?
type: AnswerComment
comment on: http://stackoverflow.com/a/26339477

http://stackoverflow.com/q/26239636
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26239776
has comment: http://stackoverflow.com/comment/41158003
type: AnsweredQuestion
has title: Reading from inner JSON Object JAVA
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I think, I have the understanding of JSON down, but I am having a slight issue with reading inner objects, for example Cover in this situation. { "id": "19292868552", "about": "Build, grow, and monetize your app with Facebook.\nhttps://developers.facebook.com/", "can_post": false, "category": "Product/service", "checkins": 1, "company_overview": "Visit https://developers.facebook.com for more information on how to build, grow, and monetize your app.\n\nIf you have questions about using Facebook or need help with general inquiries, visit https://www.facebook.com/facebook or our Help Center at http://www.facebook.com/help.\n\nIf you need to report bugs, appeal apps, or ask detailed technical questions, visit the following:\nAppeal Apps: https://developers.facebook.com/appeal\nReport Bugs: http://developers.facebook.com/bugs\nTechnical Questions: http://facebook.stackoverflow.com/", "cover": { "cover_id": "10152004458663553", "offset_x": 0, "offset_y": 0, "source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-xap1/v/t1.0-9/s720x720/1466030_10152004458663553_1984809612_n.jpg?oh=97b895edc21d21c0f40a67a6de6077bd&amp;oe=54BBD66C&amp;__gda__=1422540117_30f73303c987294f8ffccd193d190941" }, "has_added_app": false, "is_community_page": false, "is_published": true, "likes": 3262128, "link": "https://www.facebook.com/FacebookDevelopers", "name": "Facebook Developers", "parking": { "lot": 0, "street": 0, "valet": 0 }, "talking_about_count": 10066, "username": "FacebookDevelopers", "website": "http://developers.facebook.com", "were_here_count": 0 } I was hoping to have this read from the JSON, it all works until I hit the Cover part. I have not tried to access the parking object yet, but I assume the issue will be the same. public FacebookCover createFacebookCoverObject (String json) throws JSONException { FacebookCover facebookCover = new FacebookCover(); JSONObject obj = new JSONObject(json); facebookCover.setAbout(obj.getString("about")); facebookCover.setCategory(obj.get…
type: Question
has comment: http://stackoverflow.com/comment/41173206
accepted answer: http://stackoverflow.com/a/26239776

http://stackoverflow.com/q/26266326
score: 0
tagged with: groovy
has answer: http://stackoverflow.com/a/26266485
has body: I have a plugin called TestPlugin that provides a GSP include in grails-app/views called _test-include.gsp. I'm importing TestPlugin into TestApp and trying to render it like this: &lt;g:render template="_test-include" plugin="${applicationContext.getBean('pluginManager').getGrailsPlugin('testPlugin')}"/&gt; I've also tried this: &lt;g:render template="_test-include" plugin="testPlugin"/&gt; Both result in an exception being thrown. Here's the error report from Grails: Message: Error mapping onto view [/index]: Error processing GroovyPageView: Error executing tag &lt;g:render&gt;: null Line | Method -&gt;&gt; 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 745 | run . . . in java.lang.Thread Caused by GroovyPagesException: Error processing GroovyPageView: Error executing tag &lt;g:render&gt;: null -&gt;&gt; 527 | runWorker in C:\temp\grails-test\test-app\grails-app\views\index.gsp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caused by GrailsTagException: Error executing tag &lt;g:render&gt;: null -&gt;&gt; 113 | doCall in C:/temp/grails-test/test-app/grails-app/views/index.gsp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Caused by NullPointerException: null -&gt;&gt; 936 | get in java.util.concurrent.ConcurrentHashMap - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 141 | getValue in grails.util.CacheEntry | 81 | getValue in '' | 58 | doCall in C__temp_grails_test_test_app_grails_app_views_index_gsp$_run_closure2 | 70 | run . . . in C__temp_grails_test_test_app_grails_app_views_index_gsp | 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor | 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker ^ 745 | run in java.lang.Thread
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26266485
tagged with: java
has title: Grails cannot render GSP included from a plugin
type: Question
answer count: 1
tagged with: grails

http://stackoverflow.com/comment/41319796
score: 0
type: AnswerComment
type: Comment
has text: Sorry for mixing up. But I saw a book with the title "TCP/IP sockets in java" so i thought it is the name of the protocol..
comment on: http://stackoverflow.com/a/26327572

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/26318668
tags question: http://stackoverflow.com/q/26323586
type: Tag
tags question: http://stackoverflow.com/q/26235602
tags question: http://stackoverflow.com/q/26247428
tags question: http://stackoverflow.com/q/26308354
tags question: http://stackoverflow.com/q/26227046
tags question: http://stackoverflow.com/q/26262023
tags question: http://stackoverflow.com/q/26311771
tags question: http://stackoverflow.com/q/26194607
tags question: http://stackoverflow.com/q/26326867
tags question: http://stackoverflow.com/q/26322863
tags question: http://stackoverflow.com/q/26313951

http://stackoverflow.com/q/26272240
tagged with: textwatcher
answer count: 1
has comment: http://stackoverflow.com/comment/41218190
favorite count: 0
has comment: http://stackoverflow.com/comment/41218328
has comment: http://stackoverflow.com/comment/41218225
has answer: http://stackoverflow.com/a/26272591
tagged with: android
has title: Getting last typed word in a string variable in Android
accepted answer: http://stackoverflow.com/a/26272591
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41218170
tagged with: java
downvote count: 3
upvote count: 1
has body: I need to get the typed words from textbox for further use. So i am using the TextWatcher and at onTextChanged event i am getting the edittext box Content. It gives the full content of the text box. But i need the typed word not the full content of the textbox. I need the last typed word in a string variable once the user press the spacebar. My code is here and temptype holding the full content. tt = new TextWatcher() { public void afterTextChanged(Editable s){ et.setSelection(s.length()); } public void beforeTextChanged(CharSequence s,int start,int count, int after){} public void onTextChanged(CharSequence s, int start, int before, int count) { et.removeTextChangedListener(tt); typed = typed + et.getText().toString(); String temptype; temptype = et.getText().toString(); if (temptype == " "){ showToast("Word: "+typed); } et.addTextChangedListener(tt); } }; et.addTextChangedListener(tt);
has comment: http://stackoverflow.com/comment/41218561
type: Question
score: -2

http://stackoverflow.com/a/26330436
has comment: http://stackoverflow.com/comment/41808080
has comment: http://stackoverflow.com/comment/41353351
has body: What your senior devs are referring to is, proper, white-box testing. When you are doing Unit testing, you want to test only the given unit. This becomes more complicated when you start involving things like a database, or some external web service. The point remains, however: you still only want to test the one piece of code the Unit test is intended for; not some database. Whether or not you have confidence in hibernate, or your database, is irrelevant. You need to "mock" the database transaction, the EntityManager, etc. I would look into something along the lines of EasyMock. Really its all up to you what you want to use. If you google for "mock junit" you will likely come up with a list of results where you can choose the framework that is right for you. The right framework for you, is a little beyond the scope of this discussion though. Once you find what you want to use, the idea is that inside of your Unit test, instead of getting a real EntityManager, you have a mock object which you have mocked in such a way that: the documentation says that A will happen if I invoke method C, so I told the mock framework about it so it can fake it for me, so I don't have to rely on things outside of my Unit test The reason why you want to mock an object like that, is because you can't rely on any other code that is not within that one Unit to work properly. Despite what you expect, and despite what the documentation says you should expect, if the code is written poorly, or in your case, if the database fails for some reason, then the unit test will fail. You can see how this might be a problem, because your function may execute flawlessly, but it fails because the database failed. This is not how unit testing is supposed to work - that's why its called unit testing...to test only a single unit at a time. ALWAYS mock complicated Objects or functionality. Leaving things like String#equals(java.lang.Object) is OK. With doing this, you want to find a good middle ground. If you…
accepted answer of: http://stackoverflow.com/q/26329977
score: 0
answers question: http://stackoverflow.com/q/26329977
has comment: http://stackoverflow.com/comment/41327628
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41352482
has comment: http://stackoverflow.com/comment/41327511
type: Answer
has comment: http://stackoverflow.com/comment/41350070
has comment: http://stackoverflow.com/comment/41352151
has comment: http://stackoverflow.com/comment/41353269
has comment: http://stackoverflow.com/comment/41352562
has comment: http://stackoverflow.com/comment/41327643

http://stackoverflow.com/q/26283548
has title: What is the right way to "pause" a route using camel with activemq?
type: Question
possible better answer: http://stackoverflow.com/a/26348518
accepted answer: http://stackoverflow.com/a/26298614
has answer: http://stackoverflow.com/a/26348518
has comment: http://stackoverflow.com/comment/41262129
has comment: http://stackoverflow.com/comment/41264509
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/41260996
has body: My basic problem is that I can only process 7000 messages from one of my queues (across all machines) in any 1 hour time period. I don't see a way to do this with camel or activemq, so I resorted to implementing my own route stopping/starting logic. I see a number of ways to do this, and I've tried a few of them (only to run into problems). camelContext.stopRoute(route): This works in that messages stop being processed, but when I call camelContext.startRoute(route), it leaks a tcp connection which eventually causes the activemq server to hit its limit and die. camelContext.suspendRoute(route): This also stops messages from being processed and does not leak connections, but it appears to kill active consumers (visible in the admin panel) that don't reactivate when I call camelContext.resumeRoute(route). I think that could eventually lead to no messages being processed off that queue at all, even if I resume. implementing a custom RoutePolicy. To be fair, I haven't tried this yet, but it seems that it would fall prey to the same problems I had according to the pause method I chose above. Is there a method for solving this problem that I haven't encountered yet?
answer count: 2
has answer: http://stackoverflow.com/a/26298614
upvote count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/41264332
type: AnsweredQuestion
downvote count: 0
tagged with: activemq-classic
score: 7
tagged with: java

http://stackoverflow.com/q/26238760
score: -1
tagged with: inheritance
tagged with: arraylist
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26238805
type: UnansweredQuestion
has title: Printing arraylist with toString override and inheritance?
tagged with: tostring
tagged with: java
has body: Background info: I have a class ellipse which inherits the color from a Shape class and a circle class that inherits from the ellipse class. In circle and ellipse I had to override the toString method and concatenate a string that displays either "Circle" or Ellipse and the area, perimeter, and color of the shape. In my main file I need to now print the entire arraylist of shapes "calling each stored object's toString method." I'm not sure how to tell it to invoke toString for circle when it's a circle and toString for ellipse when it's an ellipse. @Override public String toString() { return "Ellipse" + " " + super.getColor() + " "+ this.calcArea() + " " + this.calcPerimeter(); } That is my ellipse toString override method.
downvote count: 1
type: Question
tagged with: overriding

http://stackoverflow.com/q/26284510
has answer: http://stackoverflow.com/a/26288583
accepted answer: http://stackoverflow.com/a/26288583
type: AnsweredQuestion
has title: How to parse HH:mm:ss+/-HH:MM into a date object?
has answer: http://stackoverflow.com/a/26284929
tagged with: java
downvote count: 3
tagged with: date
type: Question
answer count: 2
score: -2
has comment: http://stackoverflow.com/comment/41247785
has comment: http://stackoverflow.com/comment/41241337
possible better answer: http://stackoverflow.com/a/26284929
has comment: http://stackoverflow.com/comment/41240660
favorite count: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/41247950
has body: I have an hour time 17:00:00-07:00 and I want to convert/parse it into (10 AM). How should I do it?
has comment: http://stackoverflow.com/comment/41242025
tagged with: time
upvote count: 1

http://stackoverflow.com/a/26276504
has body: If you just need to iterate over the bi-dimensional array: for (Object[] obj : matrix) { Integer currentInteger = (Integer) obj[0]; String currentDescription = (String) obj[1]; if (stringToCompare.equals(currentDescription)) { return currentInteger; } }
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26275865
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26275865
type: Answer

http://stackoverflow.com/comment/41089527
comment on: http://stackoverflow.com/q/26202956
has text: volatile offers 2 guarantees: visibility, and atomicity of assignment, even for 64-bits types (double and long). So it's used for one or the other, or both.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26244018
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Prevent App Engine from logging client file requests
has body: I'm working on an App Engine project in java. I have an index.html and some .js and .css files in the war directory. Everytime the files in the war directory are accessed, it is logged. So I have tons of log entries which are just saying these files were accessed, but the only thing I'm interested in is the calls to my API. Is there a way I can turn off logging of these client side files?
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26245077
accepted answer: http://stackoverflow.com/a/26245077
tagged with: google-app-engine

http://stackoverflow.com/comment/41144141
type: AnswerComment
score: 0
type: Comment
has text: That's a distinct possibility :-)
comment on: http://stackoverflow.com/a/26231155

http://stackoverflow.com/comment/41190971
type: Comment
has text: this code will produce an indexoutofbounds at the 2nd line (when i = 1)
comment on: http://stackoverflow.com/a/26257856
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41270973
has text: I think `all these exceptions` part is making a confusion. If you think it means 'all exceptions from both methods', of course it is wrong. If you understood it as 'all exceptions one of these methods throws, the one you want to implement', then it is a valid statement.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26300888

http://stackoverflow.com/q/26287074
accepted answer: http://stackoverflow.com/a/26333874
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/41331086
has comment: http://stackoverflow.com/comment/41325377
tagged with: jodatime
linked to: http://stackoverflow.com/q/26411379
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41325616
has comment: http://stackoverflow.com/comment/41325632
has body: After running a second activity that creates an object and stores it into an ArrayList inside of a Singleton I get this error when returning to the first Activity from the creation Activity. Logcat: 10-09 15:00:48.125: E/AndroidRuntime(4266): FATAL EXCEPTION: main 10-09 15:00:48.125: E/AndroidRuntime(4266): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nanospark.cnc/com.nanospark.cnc.ContactCreateActivity}: java.lang.RuntimeException: Failed to invoke public org.joda.time.Chronology() with no args 10-09 15:00:48.125: E/AndroidRuntime(4266): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 10-09 15:00:48.125: E/AndroidRuntime(4266): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 10-09 15:00:48.125: E/AndroidRuntime(4266): at android.app.ActivityThread.access$600(ActivityThread.java:141) 10-09 15:00:48.125: E/AndroidRuntime(4266): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 10-09 15:00:48.125: E/AndroidRuntime(4266): at android.os.Handler.dispatchMessage(Handler.java:99) 10-09 15:00:48.125: E/AndroidRuntime(4266): at android.os.Looper.loop(Looper.java:137) 10-09 15:00:48.125: E/AndroidRuntime(4266): at android.app.ActivityThread.main(ActivityThread.java:5103) 10-09 15:00:48.125: E/AndroidRuntime(4266): at java.lang.reflect.Method.invokeNative(Native Method) 10-09 15:00:48.125: E/AndroidRuntime(4266): at java.lang.reflect.Method.invoke(Method.java:525) 10-09 15:00:48.125: E/AndroidRuntime(4266): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 10-09 15:00:48.125: E/AndroidRuntime(4266): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-09 15:00:48.125: E/AndroidRuntime(4266): at dalvik.system.NativeStart.main(Native Method) 10-09 15:00:48.125: E/AndroidRuntime(4266): Caused by: java.lang.RuntimeException: Failed to invoke public org.joda.time.Chronology() with no args 10-09 15:00:48.125: E/AndroidRuntime(4266…
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/26333874
tagged with: android
has comment: http://stackoverflow.com/comment/41325576
has comment: http://stackoverflow.com/comment/41325371
score: 8
type: AnsweredQuestion
has title: Serializing custom object that contains JodaTime objects into JSON
has comment: http://stackoverflow.com/comment/41325628
type: Question
has comment: http://stackoverflow.com/comment/41325606

http://stackoverflow.com/a/26299974
accepted answer of: http://stackoverflow.com/q/26299281
answers question: http://stackoverflow.com/q/26299281
has comment: http://stackoverflow.com/comment/41316588
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: TransactionalAction is an example of request/response interceptor. It extends Action and provides Transactional annotation which targets controller type or method. Example of controller method annotated with action: @Transactional public static Result ok(){ return ok(); } More details. An example of action logging responses (mind, actions which do not provide annotations like Transactional, extend Action.Simple): public class LogAction extends Action.Simple { @Override public F.Promise&lt;Result&gt; call(Http.Context ctx) throws Throwable { F.Promise&lt;Result&gt; call = delegate.call(ctx); return call.map(r -&gt; { String responseBody = new String(JavaResultExtractor.getBody(r, 0L)); Logger.info(responseBody); return r; }); } } Usage, method definition: @With(LogAction.class) public static Result ok(){ return ok(); } Usage, class definition - all methods intercepted: @With(LogAction.class) public class BaseController extends Controller { .... } You can go one step forward, if you dont like @With annotation. Define custom annotation yourself: @With({ LogAction.class }) @Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) public @interface Log { } and use it this way: @Log public static Result ok(){ return ok(); } If your custom annotation accepts parameters, change LogAction definition this way: public class LogAction extends Action&lt;Log&gt; { // use configuration object to access your custom annotation configuration }
has comment: http://stackoverflow.com/comment/41280338
score: 3
upvote count: 3

http://stackoverflow.com/comment/41296229
has text: Does the spring guide work with tomcat 7 and Java 7? Could you paste here your gradle file?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26283020

http://stackoverflow.com/q/26336419
tagged with: java
has comment: http://stackoverflow.com/comment/41362312
type: Question
tagged with: jpa
downvote count: 0
has body: I am going to try to explain clearly my problem. Context: I am doing a web app with : glassfish v3, EclipseLink. My problem is about the low performances of a bidirectionnal oneToMany relationship. I have one class Event and one class photo. One Event can have one or more photos, and reciprocally, one can belong to 0 or only one event. Before: I did mapping by myself. So when I needed to load all Photo objects for a given Event, I simply used a query : select * from Photo p where p.event_id_fk = SOMETHING. It gave me for one query all needed Photo objects. Now: I used JPA annotation @OneToMany as follow : @Entity @Table( name = "photo" ) public class Photo{ @Id @GeneratedValue( strategy = GenerationType.IDENTITY ) @Column( name = "ID" ) private long idPhoto; @ManyToOne @JoinColumn( name = "EVENT_ID" ) private Event event; ... other fields ... And @Entity @Table( name = "event" ) public class Event { @Id @GeneratedValue( strategy = GenerationType.IDENTITY ) @Column( name = "ID" ) private Long idEvent; @OneToMany( mappedBy = "event", orphanRemoval = true, fetch = FetchType.LAZY ) private List&lt;Photo&gt; photos = new ArrayList&lt;Photo&gt;(); ... other fiels ... The problem is that when I select the List photos from Event object (just doing event.getPhotos() ), I can read the JPA generated query : Précis: SELECT ...ALL FIELDS... FROM photo_account WHERE (PHOTO_ID = ?) bind =&gt; [996] Précis: SELECT ...ALL FIELDS... FROM photo_account WHERE (PHOTO_ID = ?) bind =&gt; [997] Précis: SELECT ...ALL FIELDS... FROM photo_account WHERE (PHOTO_ID = ?) bind =&gt; [998] Précis: SELECT ...ALL FIELDS... FROM photo_account WHERE (PHOTO_ID = ?) bind =&gt; [999] (...) The result is one query for one photo. In practice, this selection is pretty slow. Therefore, I would like to know if it exists a way to load all objects by only one query? (custom query, parameters to configure...) and/or a best way to map/design the relationship between these objects? and more generally if I am doing…
tagged with: eclipselink
favorite count: 0
has title: Eclipselink - Onetomany - Poor performance
tagged with: one-to-many
tagged with: many-to-one
type: UnansweredQuestion
upvote count: 1
answer count: 0
score: 1

http://stackoverflow.com/comment/41318673
comment on: http://stackoverflow.com/q/26305168
score: 0
has text: How about executing `MyCaseServiceImpl.findOne` method outside of the persistence-context? The entities should be returned then as detached ones.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41079828
comment on: http://stackoverflow.com/a/26197509
type: Comment
score: 0
type: AnswerComment
has text: Thanks now it compiles fine, but it won't run. Now I'm getting a NoClassDefFoundError

http://stackoverflow.com/comment/41118200
score: 0
type: Comment
type: QuestionComment
has text: What kind of date picker are you talking about? At least indicate the package name in your question or the technology (like gwt, swing etc.). This should also be reflected in the added tags.
comment on: http://stackoverflow.com/q/26218240

http://stackoverflow.com/q/26222777
upvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26232231
score: -1
has body: I am having issues downloading attachments of type 'ItemAttachment' using EWS. Following is the code that i use to download attachments: PropertySet ps = new PropertySet(BasePropertySet.FirstClassProperties); ps.add(ItemSchema.MimeContent); ia = (ItemAttachment) attach; ia.load(ps); //ia.load(); System.out.println(ia.getItem().getSubject()); MimeContent mc = ia.getItem().getMimeContent(); String itemName = ia.getName().replace(" ","").replace(":","-").trim(); attname.add(itemName); System.out.println(itemName); byte[] contentBytes = mc.getContent(); theStream = new FileOutputStream( "C:\\Users\\502000317\\Desktop\\test\\" + itemName); ia.getItem().getAttachments(); theStream.write(contentBytes); theStream.flush(); but when I try to execute this, i get the follwing error : java.lang.ClassCastException: microsoft.exchange.webservices.data.PropertySet cannot be cast to microsoft.exchange.webservices.data.PropertyDefinitionBase at microsoft.exchange.webservices.data.PropertySet.writeAdditionalPropertiesToXml(Unknown Source) at microsoft.exchange.webservices.data.GetAttachmentRequest.writeElementsToXml(Unknown Source) at microsoft.exchange.webservices.data.ServiceRequestBase.writeBodyToXml(Unknown Source) at microsoft.exchange.webservices.data.ServiceRequestBase.writeToXml(Unknown Source) at microsoft.exchange.webservices.data.ServiceRequestBase.buildEwsHttpWebRequest(Unknown Source) at microsoft.exchange.webservices.data.ServiceRequestBase.validateAndEmitRequest(Unknown Source) at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(Unknown Source) at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(Unknown Source) at microsoft.exchange.webservices.data.ExchangeService.internalGetAttachments(Unknown Source) at microsoft.exchange.webservices.data.ExchangeService.getAttachment(Unknown Source) at microsoft.exchange.webservices.data.Attachment.internalLoad(Unknown Source) at microsoft.exchange.webservices.data.ItemAttachment.lo…
tagged with: exchangewebservices
answer count: 2
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/26232231
has answer: http://stackoverflow.com/a/26390501
accepted answer: http://stackoverflow.com/a/26390501
has title: ItemAttachment can't be downloaded using EWS
type: AnsweredQuestion

http://stackoverflow.com/comment/41118190
score: 0
type: QuestionComment
type: Comment
has text: possible duplicate of [gwt application logging, profiling, benchmarking](http://stackoverflow.com/questions/1628031/gwt-application-logging-profiling-benchmarking)
comment on: http://stackoverflow.com/q/26217769

http://stackoverflow.com/q/26246834
has title: Trying to search a grid of characters in java for a specific word. How can I search from right to left after searching from left to right?
tagged with: search
score: 0
has answer: http://stackoverflow.com/a/26246877
has body: I have the following code to search a grid of characters below from left to right to find a word. This works perfectly. // Left to Right public static String findLeftToRight (char[][]board, String word) { char[] letters = word.toCharArray(); for (int i = 0; i &lt; board.length; i++){ for (int j = 0; j &lt; board[i].length; j++) { boolean found = true; for (int k = 0; k &lt; letters.length; k++) { if ((j+k &gt;= board[i].length) || (letters[k] != board[i][j+k])) { found = false; break; } } if (found) { return "String " + word + " found in row=" + i + " col=" +j; } } } return "String " + word + " not found"; } // end findLeftToRight However, I cannot figure out how to search from right to left. Below is my attempt at searching from right to left, but it does not work. Can someone tell me what I'm doing wrong? // Right to Left public static String findRightToLeft (char[][]board, String word) { char[] letters = word.toCharArray(); for (int i = board.length-1; i &gt; -1; i--){ for (int j = board[i].length-1; j &gt; -1; j--) { boolean found = true; for (int k = 0; k &lt; letters.length; k++) { if ((j+k &lt;= board[i].length) || (letters[k] != board[i][j+k])) { found = false; break; } } if (found) { return "String " + word + " found in row=" + i + " col=" +j; } } } return "String " + word + " not found"; } // end findLeftToRight
answer count: 1
tagged with: multidimensional-array
accepted answer: http://stackoverflow.com/a/26246877
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41172848
type: Question

http://stackoverflow.com/comment/41430751
type: AnswerComment
comment on: http://stackoverflow.com/a/26373636
has text: Thanks, I tried it, it's strange. Sleep is caught with your example, but my process killed is NOT caught. That's really weird. "+++ killed by SIGKILL +++" could mean something else?
type: Comment
score: 0

http://stackoverflow.com/a/26284692
answers question: http://stackoverflow.com/q/26284650
type: Answer
has body: You have 2 options. Create an instance of HelloWorld and use new HelloWorld().name Make name static and use HelloWorld.name
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/a/26304895
score: 0
answers question: http://stackoverflow.com/q/26304783
type: Answer
has body: Regex and replaceAll() are your friends. Use, int count=string.replaceAll("\\d","").length(); This will replace all the numbers with empty strings and thus all you will be left with is -s

http://stackoverflow.com/a/26320934
has comment: http://stackoverflow.com/comment/41311525
type: Answer
has body: Does it make sense (more speed) to use BufferedOutputStream and BufferedInputStream in this case? Actually, it probably doesn't make sense1. The object stream implementation internally wraps the stream it has been given with a private class called BlockDataOutputStream that does buffering. If you wrap the stream yourself, you will have two levels of buffering ... which is likely to make performance worse2. And when I have to flush or should I not write a flush() statement? Yes, flushing is probably necessary. But there is no universal answer as to when to do it. On the one hand, if you flush too often, you generate extra network traffic. On the other hand, if you don't flush when it is needed, the server can stall waiting for an object that the client has written but not flushed. You need to find the compromise between these two syndromes ... and that depends on your application's client/server interaction patterns; e.g. whether the message patterns are synchronous (e.g. message/response) or asynchronous (e.g. message streaming). 1 - To be certain on this, you would need to do some forensic testing to 1) measure the system performance, and 2) determine what syscalls are made and when network packets are sent. For a general answer, you would need to repeat this for a number of use-cases. I'd also recommend looking at the Java library code yourself to confirm my (brief) reading. 2 - Probably only a little bit worse, but a well designed benchmark would pick up a small performance difference. UPDATE After writing the above, I found this Q&amp;A - Performance issue using Javas Object streams with Sockets - which seems to suggest that using BufferedInputStream / BufferedOutputStream helps. However, I'm not certain whether the performance improvement that was reported is 1) real (i.e. not a warmup artefact) and 2) due to the buffering. It could be just due to adding the flush() call. (Why: because the flush could cause the network stack to push the data sooner.)
has comment: http://stackoverflow.com/comment/41314794
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/41311480
has comment: http://stackoverflow.com/comment/41314813
has comment: http://stackoverflow.com/comment/41311393
answers question: http://stackoverflow.com/q/26320156
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26320156

http://stackoverflow.com/q/26319804
has comment: http://stackoverflow.com/comment/41305187
tagged with: java
tagged with: http://stackoverflow.com/tag/c
score: 4
has title: Adapting C fork code to a Java program
type: Question
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/4157303
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41305051
has answer: http://stackoverflow.com/a/26319967
possible better answer: http://stackoverflow.com/a/26320037
has answer: http://stackoverflow.com/a/26320037
has comment: http://stackoverflow.com/comment/41305139
has comment: http://stackoverflow.com/comment/41304935
type: AnsweredQuestion
has body: I am trying to create a small program using Java to fork two new child processes. It's for a beginner's programming class who's tutorials are in C, so I'm looking for some help to understand what this code tidbit is trying to do and what is the best way to adapt it to a Java-based program (to eventually build on it). ￼#include &lt;sys/types.h&gt; #include &lt;stdio.h&gt; #include &lt;unistd.h&gt; int main() { pid t pid; /*fork a child process*/ pid = fork(); if (pid &lt; 0) { /*error occurred*/ fprintf(stderr, "Fork Failed"); return 1; } else if (pid == 0) {/*child process */ execlp("/bin/ls", "ls", NULL); } else { /*parent process*/ /*parent will wait for the child to complete */ wait(NULL); printf("Child Complete"); } return 0; } UPDATE: I am supposed to attach an id to each child process and and its parent, printing the info when the child process executes and printing a termination notification when it terminates. I now see that this bit of code above lists the contents of the current directory and prints "Child Complete" when the process has terminated. Is the listing of the entire directory considered one process? If so, where/how does the second new child process come into the picture?
accepted answer: http://stackoverflow.com/a/26319967

http://stackoverflow.com/comment/41216826
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26271398
has text: Does this make difference, while considering time and space complexities?

http://stackoverflow.com/comment/41163878
comment on: http://stackoverflow.com/a/26242520
has text: :-D.. Im just so desparate that I dont know, what else to do. But it still doesn`t solve the problem.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/26242176
type: Question
answer count: 2
has body: Basically Im trying to make a program that allows a teacher to input grades for a test for each student then after they've inputted the grades it gives the teacher a sum of all the grades they inputted public static void grades(){ List&lt;Integer&gt; grade = new ArrayList&lt;Integer&gt;(); int gradetotal = IntStream.of(grades).sum;/* sum */ int gradelistnumber = 1; int inputedgrade = 0; while(inputedgrade != -1){ System.out.println("Enter Grade for student " + gradelistnumber + " (1-50): "); inputedgrade = sc.nextInt(); grade.add(inputedgrade); gradelistnumber++; } System.out.println("Class Average: " + gradetotal / 50 * 100); } I'm trying to figure out how to get the sum of the array list grades .
has title: How to get the sum of an Integer arraylist?
tagged with: arrays
has answer: http://stackoverflow.com/a/26242293
favorite count: 0
has comment: http://stackoverflow.com/comment/41163224
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/26242306
has comment: http://stackoverflow.com/comment/41163123
has comment: http://stackoverflow.com/comment/41163204
has answer: http://stackoverflow.com/a/26242306
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/41163326
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41163138
has comment: http://stackoverflow.com/comment/41163148
possible better answer: http://stackoverflow.com/a/26242293
has comment: http://stackoverflow.com/comment/41163056
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26285000
has comment: http://stackoverflow.com/comment/41163265
tagged with: sum
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/41163166

http://stackoverflow.com/comment/41092482
comment on: http://stackoverflow.com/a/26204295
type: AnswerComment
type: Comment
has text: @maaartinus: agreed. The answer is correct or incorrect depending on the definition of *you*. I read it as "there is a reference". You read it as "the method had a reference". I think we can agree that the answer could be clearer.
score: 1

http://stackoverflow.com/a/26264342
has comment: http://stackoverflow.com/comment/41268049
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/41226806
accepted answer of: http://stackoverflow.com/q/26254142
score: 2
has body: The settings you are using are attempting to bypass the cache. ("eclipselink.read-only", "true") causes it to bypass the first level cache, while the ("eclipselink.cache-usage", "DoNotCheckCache") makes the query go to the database instead of pulling data from the second level cache. Finally ("eclipselink.refresh", "true") refreshes the data in the shared cache rather then return the prebuilt object. Your facade must be using the same EntityManager for both requests even though you have made changes to the objects between the requests. As mentioned in the comments, an EntityManager is meant to be used as a transaction would, so that you are isolated from changes made during your transactions. If this doesn't work for you, you should clear or release the entityManager after the first call, so that the calls after the web-service modifications can be picked up. If applications outside this one are going to be making data changes frequently, you might want to look at disabling the shared cache as described here: https://wiki.eclipse.org/EclipseLink/FAQ/How_to_disable_the_shared_cache%3F And also implement optimistic locking to prevent either application from overwriting the other with stale data as described here: https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Mapping/Locking/Optimistic_Locking
answers question: http://stackoverflow.com/q/26254142
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41330276
score: 0
comment on: http://stackoverflow.com/q/26333309
type: Comment
type: QuestionComment
has text: Please provide a coherent question.

http://stackoverflow.com/comment/41328846
type: AnswerComment
comment on: http://stackoverflow.com/a/26332393
has text: Increment the `value` outside the loop, after it exits. Or set the condition as `i < 16+5`
score: 0
type: Comment

http://stackoverflow.com/q/26331578
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26331704
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26331704
tagged with: android
has answer: http://stackoverflow.com/a/26331694
favorite count: 0
has body: I am inflating R.id.itemView in order to add it to a gridLayout: View item = getLayoutInflater().inflate(R.id.itemView,null); However, I am getting this error when inflating it: Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f040015 type #0x12 is not valid That resource number corresponds to itemView (I checked it on R.java). Here is the file where itemView is located (color_view.xml in res/layout): <View android:id="@+id/itemView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="5dp" android:background="@drawable/color_shape" /> I tried cleaning,building and deleting R.java but it doesnt solve the problem. What is the cause of this problem?
has title: Resources$NotFoundException: Resource ID #0x7f040015
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/26331694
upvote count: 3

http://stackoverflow.com/comment/41360047
score: 0
type: AnswerComment
has text: Thank you. +1 for trying to help. I already tried what you suggest. But it just pushes the error message around. Are you willing to look at my other question which shows the result of doing what you suggest? here is the link: http://stackoverflow.com/questions/26347415/inputstream-getresourceasstream-null-pointer-exception
type: Comment
comment on: http://stackoverflow.com/a/26349641

http://stackoverflow.com/comment/41278962
has text: I don't know why the earlier answer suggesting JD and JAD decompilers got disappeared from this thread...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26304492

android-actionbaractivity
tags question: http://stackoverflow.com/q/26309438
tag name: android-actionbaractivity
type: Tag

http://stackoverflow.com/a/26209199
has comment: http://stackoverflow.com/comment/41150245
accepted answer of: http://stackoverflow.com/q/26206632
answers question: http://stackoverflow.com/q/26206632
upvote count: 2
type: Answer
downvote count: 1
score: 1
has body: This worked for me, and when I imported the library into SceneBuilder it worked fine: (Very basic) FXML: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import javafx.scene.layout.VBox?&gt; &lt;?import javafx.scene.control.Label?&gt; &lt;?import javafx.scene.control.ComboBox?&gt; &lt;fx:root xmlns:fx="http://javafx.com/fxml/1" type="VBox" fx:controller="application.LabeledComboBoxController"&gt; &lt;Label fx:id="label" /&gt; &lt;ComboBox fx:id="comboBox" /&gt; &lt;/fx:root&gt; Controller: package application; import javafx.beans.property.BooleanProperty; import javafx.beans.property.StringProperty; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.SingleSelectionModel; public class LabeledComboBoxController&lt;T&gt; { @FXML private Label label ; @FXML private ComboBox&lt;T&gt; comboBox ; public void setText(String text) { label.setText(text); } public String getText() { return label.getText(); } public StringProperty textProperty() { return label.textProperty(); } public ObservableList&lt;T&gt; getItems() { return comboBox.getItems(); } public void setItems(ObservableList&lt;T&gt; items) { comboBox.setItems(items); } public boolean isWrapText() { return label.isWrapText(); } public void setWrapText(boolean wrapText) { label.setWrapText(wrapText); } public BooleanProperty wrapTextProperty() { return label.wrapTextProperty(); } public SingleSelectionModel&lt;T&gt; getSelectionModel() { return comboBox.getSelectionModel(); } } Control: package application; import java.util.logging.Level; import java.util.logging.Logger; import javafx.beans.property.BooleanProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXMLLoader; import javafx.scene.control.SingleSelectionModel; import javafx.scene.layout.VBox; public class LabeledComboBox&lt;T&gt; extends VBo…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41143740
has comment: http://stackoverflow.com/comment/41115701

http://stackoverflow.com/comment/41171974
type: Comment
type: QuestionComment
has text: maybe its Temperature METHOD. try changing that one (in TempProg) to temperature (lowercase)
score: 0
comment on: http://stackoverflow.com/q/26246836

http://stackoverflow.com/q/26297274
has answer: http://stackoverflow.com/a/26298072
accepted answer: http://stackoverflow.com/a/26298072
tagged with: spring
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26297380
type: Question
has body: We are working on a web application where we are logging input and output of all the database calls in DAO classes. An example is: @Override public List&lt;Long&gt; findUsers(final List&lt;Long&gt; userIds) { LOGGER.info("findUsers: finding user ids by followeeId {} ", userIds); ... // hibernate DB call LOGGER.info("findUsers: number of ids founds are {}", userIdList.size()); This code will be present inside all the DAO classes, and the number of such classes is around 100, and it may go higher. My question is shall we continue logging the info in the same way or shall we go for Spring-AspectJ implementation? -We'll have an aspect defined for @Before and @After for all such methods. This aspect will call logger and log the required info. Will implementing Spring-AspectJ be a performance hit? Any pointers are appreciated. I have gone through the below SO questions, but need some more clarity with respect to the example quoted above. Performance impact of using aop Performance impact of using aop
tagged with: aspectj
linked to: http://stackoverflow.com/q/433475
score: 0
tagged with: spring-aop
answer count: 2
has answer: http://stackoverflow.com/a/26297380
has title: Performance impact of logging using Spring AspectJ

http://stackoverflow.com/comment/41144933
type: AnswerComment
has text: you also having same problem. it will print alway 'a' and int value of i
type: Comment
comment on: http://stackoverflow.com/a/26232608
score: 0

http://stackoverflow.com/comment/41147115
score: 0
type: AnswerComment
has text: @Mena, What `Regex` we should use if we have the string like: `0ND0-CATHAY BANK (FEDERAL SAVING)` and output should be: `0Nd0-Cathay Bank (Federal Saving)`. I don't know about `Regex`
type: Comment
comment on: http://stackoverflow.com/a/26232982

http://stackoverflow.com/a/26238583
has comment: http://stackoverflow.com/comment/41162942
has comment: http://stackoverflow.com/comment/41156330
has comment: http://stackoverflow.com/comment/41156359
has comment: http://stackoverflow.com/comment/41156391
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26237972
has body: Consider the Pane#getChildren method. You can loop in the list, and if you find a Pane, you can recursively call the method again. Be careful because not JavaFX elements are subclass of Pane. Note also that getChildren returns an ObservableList, so if you add an element to it, it will be shown on the stage.
has comment: http://stackoverflow.com/comment/41156430
answers question: http://stackoverflow.com/q/26237972
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41156312
has comment: http://stackoverflow.com/comment/41156556
type: Answer
has comment: http://stackoverflow.com/comment/41156632
score: 2
has comment: http://stackoverflow.com/comment/41157279

http://stackoverflow.com/q/26213916
has comment: http://stackoverflow.com/comment/41110062
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41110822
favorite count: 0
has comment: http://stackoverflow.com/comment/41110335
tagged with: jtableheader
tagged with: swing
tagged with: tablecellrenderer
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26214091
has title: Java JTable header word wrap
tagged with: java
type: Question
upvote count: 4
has body: I am trying to get the header on a table to have word wrap. I have managed to do this but the first data row is expanding. The code for the table is: public class GenerateTable extends JTable { private JCheckBox boxSelect = new JCheckBox(); private JTableHeader hdGen; public class LineWrapCellRenderer extends JTextArea implements TableCellRenderer { private static final long serialVersionUID = 1L; int rowHeight = 0; // current max row height for this scan @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { /* * row &lt; 0 means header */ if(row &gt;= 0) { setWrapStyleWord(false); return this; } setText((String) value); setWrapStyleWord(true); setLineWrap(true); // current table column width in pixels int colWidth = table.getColumnModel().getColumn(column).getWidth(); // set the text area width (height doesn't matter here) setSize(new Dimension(colWidth, 1)); // get the text area preferred height and add the row margin int height = getPreferredSize().height + table.getRowMargin(); // ensure the row height fits the cell with most lines, row = -1 for header if (column == 2 || height &gt; rowHeight) { table.setRowHeight(row, height); rowHeight = height; } return this; } } LineWrapCellRenderer lwHeader = new LineWrapCellRenderer(); public GenerateTable(GenerateTableModel model) { super(model); this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); /* * Select */ TableColumn colSelect = this.getColumnModel().getColumn(0); colSelect.setCellEditor(new DefaultCellEditor(boxSelect)); colSelect.setPreferredWidth(60); /* * category */ this.getColumnModel().getColumn(1).setResizable(false); this.getColumnModel().getColumn(1).setPreferredWidth(200); /* * Amount values */ for (int i=2;i&lt;model.getColumnCount();i++) { colSelect = this.getColumnModel().getColumn(i); colSelect.setPreferredWidth(100); colSelect.setResizable(false); colSelect.setHeaderRenderer(lwHeader); } } } The outp…
score: 4
accepted answer: http://stackoverflow.com/a/26214091
tagged with: jtable

http://stackoverflow.com/q/26330442
type: Question
has comment: http://stackoverflow.com/comment/41325422
has comment: http://stackoverflow.com/comment/41325055
accepted answer: http://stackoverflow.com/a/26330754
score: 4
has body: I've been following along with this tutorial, and that particular video is where my problem comes from. At that time in the video, he begins incorporating his Shader class (I copied everything exactly how he did it, by the way). Anyways, when I call the compileShader() method, which looks like this, public void compileShader() { glLinkProgram(program); if(glGetProgrami(program, GL_LINK_STATUS) == GL_FALSE) { System.err.println(glGetShaderInfoLog(program, 1024)); System.exit(1); } glValidateProgram(program); if(glGetProgrami(program, GL_VALIDATE_STATUS) == GL_FALSE) { System.err.println(glGetShaderInfoLog(program, 1024)); System.exit(1); } } My program crashes because the glGetProgrami(program, GL_LINK_STATUS) ALWAYS equals GL_FALSE (GL_FALSE == 0). Same for the glGetProgrami(program, GL_VALIDATE_STATUS), it returns GL_FALSE. By the way, I used glGetProgrami() instead of glGetProgram() because the latter is a deprecated method. Also, System.err.println(glGetShaderInfoLog(program, 1024)) doesn't print ANYTHING. After a thorough online search of the main problem, this was the only thread I could find that resembled my problem, it actually seems like the exact same problem. His solution is to change the 3D settings of his intel graphics card, but when I try to follow his steps, I don't have the same options he has for configuring 3D settings. As it turns out, the program my laptop has for configuring the intel graphics settings is different from his! So after spending hours looking online for solutions for getting his control panel, which was just installing drivers, none of which actually worked, I came across this thread. The third post says that those options are obsolete, and that the options I have are the only ones I need. But after messing around with the settings I have, NOTHING CHANGES. The program still crashes. I don't understand why glLinkProgram(program) isn't linking the program as well as why glGetShaderInfoLog() doesn't return anything. EDIT: private voi…
linked to: http://stackoverflow.com/q/8599607
has comment: http://stackoverflow.com/comment/41324947
tagged with: 3d
has answer: http://stackoverflow.com/a/26330754
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41324956
favorite count: 0
upvote count: 5
type: AnsweredQuestion
has title: OpenGL Shaders: glLinkProgram() and glValidateProgram() doesn't work
tagged with: shader
tagged with: opengl
tagged with: java
has comment: http://stackoverflow.com/comment/41325386

http://stackoverflow.com/comment/41124671
score: 0
comment on: http://stackoverflow.com/q/26221104
type: QuestionComment
has text: Well, I already tried that query directly, if you need some code, I'll show it to you : ResultSet rs = this.connection.createStatement().executeQuery(MY_QUERY); while(rs.next(){/**DOES NOT ENTER THIS LOOP**/} @AlexPoole
type: Comment

http://stackoverflow.com/comment/41356937
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26347801
has text: @HovercraftFullOfEels Ah, I see your point. The cast applies only to `points`, not the result of the division. So yes, this does look like a bug in Netbeans.
type: Comment

http://stackoverflow.com/comment/41090395
comment on: http://stackoverflow.com/q/26197421
has text: also, I am using Python 3.4 - most examples are using earlier non compatible versions of Python
score: 0
type: Comment
type: QuestionComment

apache-camel
tags question: http://stackoverflow.com/q/26207527
tags question: http://stackoverflow.com/q/26283548
tags question: http://stackoverflow.com/q/26274685
tags question: http://stackoverflow.com/q/26203783
tags question: http://stackoverflow.com/q/26331027
tags question: http://stackoverflow.com/q/26283426
tags question: http://stackoverflow.com/q/26303119
tag name: apache-camel
tags question: http://stackoverflow.com/q/26206955
tags question: http://stackoverflow.com/q/26346772
tags question: http://stackoverflow.com/q/26305332
tags question: http://stackoverflow.com/q/26286686
tags question: http://stackoverflow.com/q/26338527
tags question: http://stackoverflow.com/q/26311480
tags question: http://stackoverflow.com/q/26325607
tags question: http://stackoverflow.com/q/26313820
tags question: http://stackoverflow.com/q/26251855
type: Tag

http://stackoverflow.com/comment/41279604
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26305703
score: 0
has text: You cannot create a generic array directly. Use an `ArrayList<E>` instead.

http://stackoverflow.com/comment/41305272
score: 0
type: Comment
type: QuestionComment
has text: I'm using barcode Code39, i don't know if ZXing understand this format.
comment on: http://stackoverflow.com/q/26319923

http://stackoverflow.com/q/26340132
has comment: http://stackoverflow.com/comment/41370299
tagged with: java
has comment: http://stackoverflow.com/comment/41366620
has comment: http://stackoverflow.com/comment/41343075
has body: I am having an issue creating xa datasources in spring 4.0. I have setup my datasources in weblogic using an xa driver. I then added added jndi-lookups for the data sources in spring: <jee:jndi-lookup id="dataSourceOne" jndi-name="/jdbc/XAONE" resource-ref="true" /> <jee:jndi-lookup id="dataSourceTwo" jndi-name="/jdbc/XATWO" resource-ref="true" /> I have then created the configuration for the entity managers: <property name="dataSource" ref="dataSourceOne" /> <property name="jpaVendorAdapter" ref="jpaVendorAdapter" /> <property name="packagesToScan" value="..." /> <property name="dataSource" ref="dataSourceTwo" /> <property name="jpaVendorAdapter" ref="jpaVendorAdapter" /> <property name="packagesToScan" value="..." /> <property name="database" value="ORACLE" /> <property name="showSql" value="true" /> <property name="generateDdl" value="false" /> <property name="databasePlatform" value="org.hibernate.dialect.Oracle10gDialect" /> After this I have my transaction manager configured: <tx:annotation-driven /> <tx:jta-transaction-manager /> <property name="entityManagerFactory" ref="emfone" /> <qualifier value="tmOne"/> <property name="entityManagerFactory" ref="emftwo" /> <qualifier value="tmTwo"/> I have a service class method annotated with @Transactional that calls a DAO. The DAO uses both entity managers for persisting data. When the DAO tries to persist using the emftwo a no transaction in progress error is thrown. Does anybody know where I am going wrong? Thanks,
type: Question
tagged with: weblogic
has comment: http://stackoverflow.com/comment/41347482
tagged with: jpa
score: 0
has title: How to setup xa datasource using Spring and weblogic
answer count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41374958
tagged with: spring-mvc

http://stackoverflow.com/a/26434338
accepted answer of: http://stackoverflow.com/q/26342175
answers question: http://stackoverflow.com/q/26342175
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41523760
upvote count: 2
has body: It should have failed at the configureBlocking() call. You can't put channels acquired from Channels.newChannel() into non-blocking mode. See the Javadoc. Ergo you can't register them with a Selector either. In fact I would have thought it should fail at the typecast to SelectableChannel. Are you sure you haven't missed an exception?
score: 2

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

http://stackoverflow.com/a/26287489
has comment: http://stackoverflow.com/comment/53235381
has comment: http://stackoverflow.com/comment/41255811
has comment: http://stackoverflow.com/comment/41249135
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26285419
has comment: http://stackoverflow.com/comment/41260517
answers question: http://stackoverflow.com/q/26285419
downvote count: 0
has comment: http://stackoverflow.com/comment/41267325
has comment: http://stackoverflow.com/comment/41249105
score: 4
has comment: http://stackoverflow.com/comment/41255593
type: AcceptedAnswer
has body: does the images I have painted get streched, or do they stay small, even on big tablets? One of the greatest features of libgdx is that it lets you do things exactly as you want them. So, it is really your choice. With this snippet WIDTH = Gdx.graphics.getWidth(); HEIGHT = Gdx.graphics.getHeight(); camera = new OrthographicCamera(); camera.setToOrtho(false, WIDTH, HEIGHT); You would have a different viewport size in every different screen size. So your images would stay small. In the other hand, if you use predefined values for the viewport like: WIDTH = 800; HEIGHT = 480; camera = new OrthographicCamera(); camera.setToOrtho(false, WIDTH, HEIGHT); You would get the same viewport for every screen and the images would stretch to occupy the same space in each axis. This won't necessarily be the same for each axis. So a perfect square image in one screen may look like a rectangle in another screen with a different x-y ratio. There is a third option, you can fix one side and let the other be calculated, so you keep the ratio of your images (a square stays as square). You must decide what will be the fixed side. For a game like Super Mario Bros I would recommend you to fix the height and calculate the width: HEIGHT = 480; WIDTH = (Gdx.graphics.getWidth()/Gdx.graphics.getHeight())*HEIGHT; camera = new OrthographicCamera(); camera.setToOrtho(false, WIDTH, HEIGHT); Every screen would see the same height in the game world. But some screens would see more in the width than others. If thats a problem for you (you want them to see the same ammount of the world but keep the ratio too), than adding black bars to each side is an option. So my question is basically what is the optimal width and height to have on a libgdx game? The optimal solution is having a different set of images for several resolutions. And choosing whats the most appropiate at runtime. But that increases the game size a lot. Another dirty way is having only one big set and let the images shrink in lower resolut…
has comment: http://stackoverflow.com/comment/41282892

http://stackoverflow.com/q/26202307
favorite count: 0
has title: Removing a line from a txt file java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26202977
tagged with: java
downvote count: 2
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26202490
has answer: http://stackoverflow.com/a/26203886
has comment: http://stackoverflow.com/comment/41088254
has body: I have a large file in which I need to remove only a number of lines Is there any way to do this without opening a new file and copy the whole text? edit: the main problem is when it runs in more then one thread with large txt filse the program fails
has answer: http://stackoverflow.com/a/26202490
linked to: http://stackoverflow.com/q/1377279
score: -1
has comment: http://stackoverflow.com/comment/41088225
accepted answer: http://stackoverflow.com/a/26202977
answer count: 3
has comment: http://stackoverflow.com/comment/41088299
tagged with: string

nio
tags question: http://stackoverflow.com/q/26230811
tags question: http://stackoverflow.com/q/26197277
tags question: http://stackoverflow.com/q/26201320
tag name: nio
tags question: http://stackoverflow.com/q/26305927
type: Tag
tags question: http://stackoverflow.com/q/26283605
tags question: http://stackoverflow.com/q/26342175
tags question: http://stackoverflow.com/q/26235809

android
tags question: http://stackoverflow.com/q/26281517
tags question: http://stackoverflow.com/q/26210107
tags question: http://stackoverflow.com/q/26265524
tags question: http://stackoverflow.com/q/26252180
tags question: http://stackoverflow.com/q/26217897
tags question: http://stackoverflow.com/q/26285419
tags question: http://stackoverflow.com/q/26332033
tags question: http://stackoverflow.com/q/26283815
tags question: http://stackoverflow.com/q/26207851
tags question: http://stackoverflow.com/q/26320961
tags question: http://stackoverflow.com/q/26263543
tags question: http://stackoverflow.com/q/26208245
tags question: http://stackoverflow.com/q/26257590
tags question: http://stackoverflow.com/q/26259724
tags question: http://stackoverflow.com/q/26286501
tags question: http://stackoverflow.com/q/26310823
tags question: http://stackoverflow.com/q/26315922
tags question: http://stackoverflow.com/q/26325193
tags question: http://stackoverflow.com/q/26208640
tags question: http://stackoverflow.com/q/26202149
tags question: http://stackoverflow.com/q/26349126
tags question: http://stackoverflow.com/q/26325118
tags question: http://stackoverflow.com/q/26317268
tags question: http://stackoverflow.com/q/26267246
tags question: http://stackoverflow.com/q/26276754
tags question: http://stackoverflow.com/q/26259718
tags question: http://stackoverflow.com/q/26218754
tags question: http://stackoverflow.com/q/26297317
tags question: http://stackoverflow.com/q/26305806
tags question: http://stackoverflow.com/q/26294834
tags question: http://stackoverflow.com/q/26328925
tags question: http://stackoverflow.com/q/26264016
tags question: http://stackoverflow.com/q/26275543
tags question: http://stackoverflow.com/q/26297524
tags question: http://stackoverflow.com/q/26209787
tags question: http://stackoverflow.com/q/26248813
tags question: http://stackoverflow.com/q/26257180
tags question: http://stackoverflow.com/q/26211383
tags question: http://stackoverflow.com/q/26347158
tags question: http://stackoverflow.com/q/26340398
tags question: http://stackoverflow.com/q/26312020
tags question: http://stackoverflow.com/q/26251346
tags question: http://stackoverflow.com/q/26229452
tags question: http://stackoverflow.com/q/26267980
tags question: http://stackoverflow.com/q/26221231
tags question: http://stackoverflow.com/q/26335368
tags question: http://stackoverflow.com/q/26227095
tags question: http://stackoverflow.com/q/26267737
tags question: http://stackoverflow.com/q/26324764
tags question: http://stackoverflow.com/q/26250392
tags question: http://stackoverflow.com/q/26235026
tags question: http://stackoverflow.com/q/26233527
tags question: http://stackoverflow.com/q/26279832
tags question: http://stackoverflow.com/q/26213460
tags question: http://stackoverflow.com/q/26335471
tags question: http://stackoverflow.com/q/26303519
tags question: http://stackoverflow.com/q/26273545
tags question: http://stackoverflow.com/q/26319445
tags question: http://stackoverflow.com/q/26315093
tags question: http://stackoverflow.com/q/26236756
tags question: http://stackoverflow.com/q/26294985
tags question: http://stackoverflow.com/q/26200591
tags question: http://stackoverflow.com/q/26201234
tags question: http://stackoverflow.com/q/26233557
tags question: http://stackoverflow.com/q/26238815
tags question: http://stackoverflow.com/q/26254881
tags question: http://stackoverflow.com/q/26351894
tags question: http://stackoverflow.com/q/26215498
tags question: http://stackoverflow.com/q/26195929
tags question: http://stackoverflow.com/q/26265174
tags question: http://stackoverflow.com/q/26223035
tags question: http://stackoverflow.com/q/26275145
tags question: http://stackoverflow.com/q/26302502
tags question: http://stackoverflow.com/q/26214994
tags question: http://stackoverflow.com/q/26231001
tags question: http://stackoverflow.com/q/26283786
tags question: http://stackoverflow.com/q/26347234
tags question: http://stackoverflow.com/q/26249493
tags question: http://stackoverflow.com/q/26259080
tags question: http://stackoverflow.com/q/26298679

http://stackoverflow.com/q/26344388
score: 0
has answer: http://stackoverflow.com/a/26361479
has body: I think my Problem is not that hard, but I´m a beginner so it is hard for me. I have to read Keyboard Inputs (Numbers &lt; and > 256 and characters) and put all of that into an char[]. Example: Input 120 1101 AU 1050 Output char[0] = 0 char[1] = 120 char[2] = 4 char[3] = 77 ((4*256)+77 = 1101) char[4] = A char[5] = U char[6] = 4 char[7] = 26 ((4*256)+26 = 1050) The Problem is if i use scanner it and convert it to int it will give me 49 instead of 1101. If i use BufferedReader i cant convert str into int. I hope someone can help me with this. Thx
tagged with: java
tagged with: int
tagged with: char
accepted answer: http://stackoverflow.com/a/26361479
type: AnsweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/41350425
type: Question
tagged with: input
has comment: http://stackoverflow.com/comment/41350495
has title: integer and string to char (same value) java

http://stackoverflow.com/comment/41125834
has text: Please post something that compiles. This `String portionPhraseSub = simplePhrase.substring(portionPhrase);` will not compile.
score: 0
comment on: http://stackoverflow.com/q/26222155
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26196878
score: 0
has comment: http://stackoverflow.com/comment/41078658
type: Answer
answers question: http://stackoverflow.com/q/26196856
has body: In Java, the \ is the 'escape' character. If you use \ in a String declaration, it is never literally put into the String, but used to escape the character right after it. For instance, you can use it to escape the double quote: String str = "A double quote: \""; \\ You can also escape the escape character: String str = "A backslash : \\"; The escape character is also used in meta-characters like \n. If you want to literally use those in a string, you have to escape them as well: String str = "A newline character: \\n"; And that last example is exactly what Java does automatically for you if you retrieve the input from the System.in. It gets the literal \n, not the meta-character new-line. So to summarize: inputting \n via the System.in is equivalent to directly setting a String to \\n.

http://stackoverflow.com/comment/41327533
has text: Thank you so much for this explanation it is a wonderful!! I have one last question (Sorry for so many questions) How can we determine whether two inner loops will run O(n^2) vs O(n)? This is the origin of my confusion.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26331758
score: 0

http://stackoverflow.com/a/26218375
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41127543
accepted answer of: http://stackoverflow.com/q/26218165
has body: How are you going to represent the quantity in your model? You should create a new entity for FoodIngredients with this property(and links to both other tables) and map it using @OneToMany annotations in Food and Ingredients. Edit: You can use http://www.mkyong.com/hibernate/hibernate-many-to-many-example-join-table-extra-column-annotation/ for reference
answers question: http://stackoverflow.com/q/26218165
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41118869
type: Answer

http://stackoverflow.com/comment/41080981
type: AnswerComment
score: 0
type: Comment
has text: Thank you Anubian for the help!
comment on: http://stackoverflow.com/a/26198082

http://stackoverflow.com/a/26296274
type: Answer
has comment: http://stackoverflow.com/comment/41268305
has comment: http://stackoverflow.com/comment/41263148
has body: I guess that your code inside the userRepository.save() method is calling entityManager.persist(user); Instead you should be calling entityManager.merge(user); BY doing so, instead of inserting a new Role, Hibernate will check if a Role with the same ID already exists and if this is case, that Role will be attached to the User entity (provided that the cascade type includes Merge operation). The reason why you need to call merge is that you are using a Role entity which has been loaded (via systemRoleService.findOne("ROLE_ADMIN")) and then detached from persistence context, so this entity is detached when you try to save the User. If Role had not been detached, you could call persist() instead of merge() on the User entity.
has comment: http://stackoverflow.com/comment/41267597
answers question: http://stackoverflow.com/q/26295445
has comment: http://stackoverflow.com/comment/41262306
has comment: http://stackoverflow.com/comment/41268714
score: 0

http://stackoverflow.com/q/26214041
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41112206
has comment: http://stackoverflow.com/comment/41111630
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26216044
downvote count: 0
tagged with: data-structures
has answer: http://stackoverflow.com/a/26216118
possible better answer: http://stackoverflow.com/a/26216044
score: 1
favorite count: 0
tagged with: encryption
has body: I am writing a DES-like block cipher in Java. The cipher works with 64-bit blocks and I'm having a tough time deciding how to partition the data so that its useable. In case your wondering the data will be coming from a file and I'm just going to pad it with zeroes until the nearest multiple of 64. Here's what I've been thinking about. Store an array of longs. With an array of longs I can traverse over each block in the fewest amount of steps. But, will the logical operations, like XOR, work properly? Also when I have to split the 64-bit into 32-bits should I convert to ints or just keep using longs? And then there is the sign to worry about, but I think I could use the Long class to fix that. Store an array of byte arrays. This was my initial idea, but I'm seeing the limitations now. I would have to work with 8 elements per array rather than just one with the array of longs. This might not even matter I don't know. BitSets. I saw these and thought they were the answer I've been looking for, but when I started using them I realized that they are not suited to the problem at hand and a lot of the methods don't actually do what I thought they would do. I'm wondering how someone more experienced would do this. I think longs are the way to go, but I'm wondering if all the arithmetic will work. Am I on the right track or is there a better way?
accepted answer: http://stackoverflow.com/a/26216118
has title: Data type for blocks in DES-like algorithm in Java
type: AnsweredQuestion
tagged with: des

http://stackoverflow.com/a/26656875
score: 0
type: Answer
has body: Simple use a model class and using gson dependency map the json to a class model
answers question: http://stackoverflow.com/q/26227836

http://stackoverflow.com/comment/41289520
comment on: http://stackoverflow.com/a/26311087
type: Comment
score: 1
type: AnswerComment
has text: You could choose to write 16 different constructors (assuming that it is okay for your class to have any number of the booleans set by the user and have any number not set by the user) but typically you would only write constructors for the combinations that would only be frequently used. Or, for that matter, you could have one constructor that requires the users to specify everything, and the user could just write 'false' for all the boolean parameter.

http://stackoverflow.com/q/26248510
upvote count: 1
has comment: http://stackoverflow.com/comment/41189462
type: Question
has body: Im running into a problem while disposing of a screen. I am getting this error message when I try to dispose of my OrthogonalTiledMapRenderer. I looked around online and didnt find see any other examples of this or situations where this happened. Exception in thread "LWJGL Application" java.lang.IllegalArgumentException: buffer not allocated with newUnsafeByteBuffer or already disposed at com.badlogic.gdx.utils.BufferUtils.disposeUnsafeByteBuffer(BufferUtils.java:507) at com.badlogic.gdx.graphics.glutils.VertexArray.dispose(VertexArray.java:67) at com.badlogic.gdx.graphics.Mesh.dispose(Mesh.java:551) at com.badlogic.gdx.graphics.g2d.SpriteBatch.dispose(SpriteBatch.java:944) at com.badlogic.gdx.maps.tiled.renderers.BatchTiledMapRenderer.dispose(BatchTiledMapRenderer.java:152) at org.shawnhenry.rollypauly.screens.GameScreen.dispose(GameScreen.java:264) at org.shawnhenry.rollypauly.screens.GameScreen.hide(GameScreen.java:238) at org.shawnhenry.rollypauly.InputHandler.doTap(InputHandler.java:147) at org.shawnhenry.rollypauly.InputHandler.touchUp(InputHandler.java:117) at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:305) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:199) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) My implementation is quite simple. In my main method I initilize the renderer: renderer = new OrthogonalTiledMapRenderer(world.getTiledMap()); The render method called the renderer to draw objects like: renderer.render(backgroundLayers); and renderer.getSpriteBatch().draw(resume, world.getResumeButton().x, world.getResumeButton().y, world.getResumeButton().width, world.getResumeButton().height); Here is the trace through my various classes/functions mentioned in the error message: FROM "InputHandler" if(mainMenu.contains(x, y)){//Tapped the mainMenu button. //Gdx.app.log("InputHandler", "Hit menu button!"); gameScreen.getGame().setScreen(new LevelSelectScre…
tagged with: libgdx
score: 1
tagged with: java
has title: Error when disposing of OrthagonalTiledMapRenderer
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26266510
type: UnansweredQuestion

http://stackoverflow.com/q/26244778
downvote count: 0
has comment: http://stackoverflow.com/comment/41168308
has answer: http://stackoverflow.com/a/26244850
has comment: http://stackoverflow.com/comment/41168288
has comment: http://stackoverflow.com/comment/41223977
has body: I tried the following code: /* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; public class Main { static int i = 0; public static void main(String[] args) { new Thread(t1).start(); new Thread(t2).start(); new Thread(t3).start(); new Thread(t4).start(); new Thread(t5).start(); new Thread(t6).start(); } private static void countMe(String name){ i++; System.out.println("Current Counter is: " + i + ", updated by: " + name); } private static Runnable t1 = new Runnable() { public void run() { try{ for(int i=0; i&lt;2; i++){ countMe("t1"); } } catch (Exception e){} } }; private static Runnable t2 = new Runnable() { public void run() { try{ for(int i=0; i&lt;2; i++){ countMe("t2"); } } catch (Exception e){} } }; private static Runnable t3 = new Runnable() { public void run() { try{ for(int i=0; i&lt;2; i++){ countMe("t3"); } } catch (Exception e){} } }; private static Runnable t4 = new Runnable() { public void run() { try{ for(int i=0; i&lt;2; i++){ countMe("t4"); } } catch (Exception e){} } }; private static Runnable t5 = new Runnable() { public void run() { try{ for(int i=0; i&lt;2; i++){ countMe("t5"); } } catch (Exception e){} } }; private static Runnable t6 = new Runnable() { public void run() { try{ for(int i=0; i&lt;2; i++){ countMe("t6"); } } catch (Exception e){} } }; } and on ideone got the output: Current Counter is: 1, updated by: t1 Current Counter is: 2, updated by: t1 Current Counter is: 3, updated by: t2 Current Counter is: 4, updated by: t2 Current Counter is: 5, updated by: t3 Current Counter is: 6, updated by: t3 Current Counter is: 7, updated by: t4 Current Counter is: 8, updated by: t4 Current Counter is: 9, updated by: t5 Current Counter is: 10, updated by: t5 Current Counter is: 11, updated by: t6 Current Counter is: 12, updated by: t6 It seemed everything was going in a linear fashion that is the threads called the function countMe one by one, in the order I created them. Doesn't multiple t…
has comment: http://stackoverflow.com/comment/41214557
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41170007
has comment: http://stackoverflow.com/comment/41168264
has comment: http://stackoverflow.com/comment/41224030
score: 3
has answer: http://stackoverflow.com/a/26244855
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41226065
has comment: http://stackoverflow.com/comment/41168385
answer count: 2
has title: Learning Java, why didn't I get overlap of some threads?

http://stackoverflow.com/comment/41253250
has text: what is the purpose of ones(), twos(), etc methods? if they serve a similar purpose, you could create a generic function with a parameter 1, 2, etc.
type: QuestionComment
comment on: http://stackoverflow.com/q/26291247
type: Comment
score: 0

http://stackoverflow.com/comment/41087541
comment on: http://stackoverflow.com/a/26198723
has text: @Hele I think you would end up using `break` there as well, the way you did in the edit. The only place where you would continue with the loop is when `B` is "catching up" to `A`. Another problem with the nested loop approach is that once you run out of entries in `A`, your `B` loop would stop as well (because it is nested), so you would end up with another loop after the nested ones to process the remaining entries of `B`. I would go with a single loop, though, or with the other classic solution of three sequential loop (on A&B's overlap, then on remaining items of `A`, then on `B`).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41105546
type: QuestionComment
has text: Post Your `JSON` response
score: 0
comment on: http://stackoverflow.com/q/26211420
type: Comment

http://stackoverflow.com/a/26281836
has body: Here is the code - import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.ObjectMapper; @JsonIgnoreProperties(ignoreUnknown = true) class data { @JsonProperty("id") private String id ; @JsonProperty("name") private String name ; @JsonProperty("link") private String link; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } } public class aa { public static void main(String[] args) { ObjectMapper mapper = new ObjectMapper(); try { data[] d = mapper.readValue( "[{\"id\":\"142065955831788\",\"name\":\"Name1\",\"link\":\"http://www.somelink.com\"},{\"id\":\"160212467350470\",\"name\":\"Name2\",\"link\":\"http://www.somelink2.com\"}]", data[].class); for (data data1 : d) { System.out.println("-----"); System.out.println("Id : "+data1.getId()); System.out.println("Name : "+data1.getName()); System.out.println("Link : "+data1.getLink()); } } catch (IOException e) { e.printStackTrace(); } } } Your JSON also need to be changed. It should not contain data part as you are using array of its properties. Output - ----- Id : 142065955831788 Name : Name1 Link : http://www.somelink.com ----- Id : 160212467350470 Name : Name2 Link : http://www.somelink2.com
has comment: http://stackoverflow.com/comment/41254948
answers question: http://stackoverflow.com/q/26280235
has comment: http://stackoverflow.com/comment/41235546
score: 0
type: Answer

http://stackoverflow.com/comment/41230448
type: QuestionComment
has text: I need a relationship of entity so i can solve your problem
comment on: http://stackoverflow.com/q/26273993
score: 0
type: Comment

http://stackoverflow.com/a/55531903
upvote count: 7
has body: Try using JsonPatch String json ="{\"name\":\"John\"}"; JsonObject jo = Json.createReader(new StringReader(json)).readObject(); JsonPatch patch = Json.createPatchBuilder() .add("/last","Doe") .build(); jo = patch.apply(jo); System.out.println(jo);
score: 7
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26346060

http://stackoverflow.com/comment/41366808
comment on: http://stackoverflow.com/a/26353561
type: AnswerComment
has text: +1 for quote and it should be `@Override`.
type: Comment
score: 2

http://stackoverflow.com/q/26295075
has answer: http://stackoverflow.com/a/26295379
tagged with: jboss7.x
score: 0
has title: Is Hibernate also use connection pool as JDBC?
tagged with: jdbc
type: AnsweredQuestion
tagged with: connection-pooling
possible better answer: http://stackoverflow.com/a/26295379
has comment: http://stackoverflow.com/comment/41265785
has body: I use JBOSS 7.1 web server for my application. I configured JBOSS connection pool and use it for JDBC connections. I also use hibernate in my application. And i want to know if hibernate also use this connection pool or me need to configure other connection pool(for example c3p0) for hibernate?
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26295130
accepted answer: http://stackoverflow.com/a/26295130
answer count: 2

http://stackoverflow.com/comment/41164858
has text: @james: agreed, reworded.
type: AnswerComment
comment on: http://stackoverflow.com/a/26239703
type: Comment
score: 0

http://stackoverflow.com/comment/41209257
type: QuestionComment
has text: @AntonH Yup, I was thinking of it the wrong way. Thanks!
score: 0
comment on: http://stackoverflow.com/q/26267117
type: Comment

http://stackoverflow.com/comment/45443005
type: Comment
has text: Setting nearVal to 1 fixed a perspective warping issue for me, thanks.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26827449

http://stackoverflow.com/comment/41366992
comment on: http://stackoverflow.com/q/26353521
type: QuestionComment
has text: The core system is responsible for creating the context, since (at least Java 1.4), it's guaranteed to be an instance of `Graphics2D`, so there is no need to check for it. You should be calling `super.paint` from `paint`, not `super.paintComponents`, in fact, I'd discourage you from painting directly to top level containers like this and would encourage you to paint to something like a `JPanel` from within in its `paintComponent` method instead and then an the `JPanel` to the applet
type: Comment
score: 0

http://stackoverflow.com/comment/41328181
comment on: http://stackoverflow.com/q/26332251
type: Comment
type: QuestionComment
score: 1
has text: Tyler, if you want our help, I think that you're going to have to create and post an [mcve](http://stackoverflow.com/help/mcve/). Please check the link to see what this involves, but essentially you'd be creating and posting a small, actually a **minimal** compilable and runnable program that we can run and that demonstrates your problem for us.

http://stackoverflow.com/comment/41136753
has text: @AuroraBlaze Glad you could get something out of it. :) Welcome
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26227628

http://stackoverflow.com/a/26208763
has comment: http://stackoverflow.com/comment/41100408
answers question: http://stackoverflow.com/q/26208709
score: 0
type: Answer
has body: I suggest you call hasNextInt() before nextInt() instead of trying to catch the Exception. Something like, public int getInteger() { Scanner scan = new Scanner(System.in); while (scan.hasNextLine()) { if (scan.hasNextInt()) { return scan.nextInt(); } else { System.out.printf("%s is not an int%n", scan.nextLine()); } } return -1; }

http://stackoverflow.com/a/26296616
score: 2
answers question: http://stackoverflow.com/q/26296150
upvote count: 2
has body: driver.findElement(By.xpath("//div[@id='wwctrl_DateiImportSchritt2Csv_upload0']/‌​input")).sendKeys("Your path"); Use this it works for you Good Luck...
accepted answer of: http://stackoverflow.com/q/26296150
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26293292
has title: Java Weld CDI alternative Factory
tagged with: cdi
type: UnansweredQuestion
tagged with: weld
has body: In my production code I have an factory, this factory should be mocked in my test code. I have an interface which both factories implement: public interface FtpTransferFactory { FtpTransfer createFtpTransfer(String host, String machine); } Production code: @Default public class FtpTransferFactoryImpl implements FtpTransferFactory { public FtpTransferFactoryImpl() { } @Override public FtpTransfer createFtpTransfer(final String host, final String machine) { return new FtpTransfer(); // Some real ftp transfer object } } Test code: @Alternative public class FtpTransferFactoryTestImpl implements FtpTransferFactory { @Override public FtpTransfer createFtpTransfer(String host, String machine) { return ...; // Some real ftp transfer object, with different settings (test env) } } In the beans.xml located at src/test/resources: engine.FtpTransferFactoryTestImpl My implementing class: @Default public class SomeClass /** Ftp Factory */ @Default @Inject private FtpTransferFactory ftpFactory; ... } When I execute my unit tests my implementing class still ends up with the production factory instead of the test factory. However, when I put the -element into my src/main/resources (production) it does work. But I don't want that since i'm putting testing code into production code. I've seen several tutorials doing it via this method... what I'm a doing wrong?
type: Question
has comment: http://stackoverflow.com/comment/41294036
tagged with: dependency-injection
tagged with: jboss-weld
tagged with: java
has answer: http://stackoverflow.com/a/26306838
has comment: http://stackoverflow.com/comment/41260284
has comment: http://stackoverflow.com/comment/41260533
score: 0
has comment: http://stackoverflow.com/comment/41305569
answer count: 1

http://stackoverflow.com/a/26207026
has comment: http://stackoverflow.com/comment/41109207
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41097213
type: Answer
accepted answer of: http://stackoverflow.com/q/26206738
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26206738
has body: At first glance it feels wrong. But using a field as key is reasonable, perhaps a bit redundant but legitimate. It doesn't matter where the key's value comes from! Because the purpose of a Map is to retrieve elements. And doing it like that fairly does the job. If you feel that guilty, you may remove the field from the class if there aren't any side-effects. What may be wrong about that is - you're not using methods for the fields. Consider following scenerio: You'd like to combine two strings as new key. If you have referenced a field a thousand times, you are out of luck! You just have to replace all occurences of the field. This may lead to bugs and inconveniences if you accidentally replaced something else. But if you do have a method, you just change the part in the method and you're done.

http://stackoverflow.com/q/26221573
score: 0
has answer: http://stackoverflow.com/a/26222709
has comment: http://stackoverflow.com/comment/41126081
answer count: 1
tagged with: jinternalframe
has comment: http://stackoverflow.com/comment/41127617
tagged with: swing
accepted answer: http://stackoverflow.com/a/26222709
type: AnsweredQuestion
tagged with: java
type: Question
has body: How can I get a reference to the buttons at the top right of an instance of a JInternalFrame such as the close button or the maximize button? I would like to call setName on them.
has title: Get buttons at the top right of JInternalFrame

http://stackoverflow.com/q/26218410
accepted answer: http://stackoverflow.com/a/26234908
type: AnsweredQuestion
tagged with: ibm-mobilefirst
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26234908
tagged with: worklight-security
has body: I am building a Worklight 6.2 adapter that uses Java. I am also using authentication through custom login and authenticator Java code by implementing WorkLightAuthLoginModule and WorkLightAuthenticator. The authentication all works fine. My adapter code is implemented in the getProtectedAssets static method of class com.myStuff.myClass and is called from the adapter implementation with var returnval = com.myStuff.myClass.getProtectedAssets(); getProtectedAssets requires a username and password to connect to a back-end system. Currently I have those hard-coded in the method for testing, but I need to retrieve them from the Worklight session, presumably through the UserIdentity object I set in my custom login module's createIdentity method. Is there some way to get access to the user identity from within the adapter Java code?
answer count: 1
has title: Accessing UserIdentity from adapter Java code
tagged with: worklight-adapters

http://stackoverflow.com/q/26251424
has comment: http://stackoverflow.com/comment/41183387
answer count: 1
has comment: http://stackoverflow.com/comment/41180068
score: 0
tagged with: nullpointerexception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41180438
has body: File file = new File(getClass().getResource(filePath + "/createFile.xml").toURI()); I get an error of java.lang.NullPointerException in above line. Here filePath is string variable in which I have set my directory path from where I want to read file.
tagged with: java
tagged with: file
has title: Getting null pointer exception In FILE class
type: Question
has answer: http://stackoverflow.com/a/26251536

http://stackoverflow.com/comment/41258539
has text: Sounds like a dependency of a dependency. If you find which other car 1.17.1 comes from, you can exclude it somehow via gradle? In maven there is the `<excludes>` tag, for example.
comment on: http://stackoverflow.com/q/26290831
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41184173
type: QuestionComment
score: 0
has text: Look into [ObjectOutputStream](http://docs.oracle.com/javase/7/docs/api/java/io/ObjectOutputStream.html) and [ObjectInputSteam](http://docs.oracle.com/javase/7/docs/api/java/io/ObjectInputStream.html)
comment on: http://stackoverflow.com/q/26253929
type: Comment

http://stackoverflow.com/comment/41322682
type: QuestionComment
has text: I am required to use the extra method, so how should i go about that with out arrays.
score: 0
comment on: http://stackoverflow.com/q/26329105
type: Comment

jersey-2.0
tags question: http://stackoverflow.com/q/26241056
type: Tag
tags question: http://stackoverflow.com/q/26217068
tags question: http://stackoverflow.com/q/26308640
tags question: http://stackoverflow.com/q/26252526
tag name: jersey-2.0

http://stackoverflow.com/q/26318426
type: Question
score: 0
linked to: http://stackoverflow.com/q/2427473
answer count: 1
duplicate of: http://stackoverflow.com/q/2427473
has answer: http://stackoverflow.com/a/26319777
type: UnansweredQuestion
tagged with: rmi
has body: I've been trying to run an RMI example but have been getting the above error on both linux and windows. I have seen people with same problem online but in different situations. My server class is: import java.rmi.*; import java.rmi.server.*; public class CityServerImpl extends UnicastRemoteObject implements CityServer { CityServerImpl() throws RemoteException { super(); } public String getCapital(String country) throws RemoteException { System.out.println("Sending return string now - country requested: " + country); if (country.toLowerCase().compareTo("usa") == 0) return "Washington"; else if(country.toLowerCase().compareTo("ireland") == 0) return "Dublin"; else if (country.toLowerCase().compareTo("france") == 0) return "Paris"; return "Don't know that one!"; } public static void main(String args[]) { try { System.setSecurityManager(new RMISecurityManager()); System.out.println("Security manager set"); CityServerImpl cityServer = new CityServerImpl(); System.out.println("Instance of City Server created"); Naming.rebind("Capitals", cityServer); System.out.println("Name rebind completed"); System.out.println("Server ready for requests!"); } catch(Exception exc) { System.out.println("Error in main - " + exc.toString()); } } } I put the interface, CityServer class and my client class into a folder and put the following into the terminal. javac -cp . *.java rmic CityServerImpl rmiregistry &amp; java CityServerImpl And I get back: Security manager set Instance of City Server created Error in main - java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve") The 'Naming.rebind("Capitals", cityServer);' appears to be the problem. I have found mentions of a policy file but I have been told that this should run fine without one. Both the client and server would be running on the same PC. Any idea on how to get around this?
tagged with: java
has title: Error in main - java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve")

http://stackoverflow.com/comment/41268889
comment on: http://stackoverflow.com/q/26298973
type: Comment
type: QuestionComment
score: 1
has text: @trashgod for some reason I had a feeling the OP didn't write this code

http://stackoverflow.com/comment/41277058
type: AnswerComment
type: Comment
score: 0
has text: This won't work without constructor.
comment on: http://stackoverflow.com/a/26304383

http://stackoverflow.com/a/26272398
accepted answer of: http://stackoverflow.com/q/26269141
score: 1
has body: The problem is the following: player.render(delta); Which uses the SpriteBatch created in the Player class. This SpriteBatch does not use the Matrix of the Camera and therefore it always showes the same part of the world, where the Player runs out of the screen. There are now 2 posibilities: Use spriteBatch.SetProjectionMatrix(camera.combined). For this you need to store a reference to the camera inside the Player class. Or use a much cleaner solution: Separate the logic and the view. Use one class for drawing the map and the player. So in the WorldRenderer instead of calling player.render() you should draw the player there. You could use the renderers SpriteBatch for drawing (renderer.getSpriteBatch() should work). I guess that this SpriteBatch allready uses the camera.combined Matrix so you don't need to care about this. Hope it helps.
downvote count: 0
has comment: http://stackoverflow.com/comment/41240045
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26269141
upvote count: 1

http://stackoverflow.com/comment/41211485
comment on: http://stackoverflow.com/q/26268355
type: Comment
type: QuestionComment
score: 0
has text: Also `byteData[0].equals("FF")` should be `byteData[0] == (byte) 0xFF`, assuming `byteData` is a `byte[]` array. Comparing `byte`s against `String`s won't work.

http://stackoverflow.com/q/26341919
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26341947
has body: This is my sample program which creates a String Object public class TestingHeap { public static void main(String args[]) { String str = new String("Hi This is sample String"); try { //Thread.sleep(1111111); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } When i viewed the Heap Dump under VisualVM Tool the instances for that class is shown as zero This is the screenshot wrt to above statement If my assumption is wrong could you please let me know how to see the Objects present under Heap ??
accepted answer: http://stackoverflow.com/a/26341947
has title: Why Visual VM shows instances as zero for this String class?
type: AnsweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/comment/41310554
type: QuestionComment
comment on: http://stackoverflow.com/q/26322827
score: 0
has text: I am running tests on the add method. I have the numbers 1 5 2 4 6 8 7 11 25. Everytime it adds a node I get it to print the value to see if its gone left or right. I have noticed that 11 and 25 both say left when they should say right. So thats why I believe something is wrong. I am using an online BST visualizer to see where everything should be.
type: Comment

http://stackoverflow.com/comment/41257226
comment on: http://stackoverflow.com/q/26293405
score: 0
has text: It's about exposing a variable `v` as `Global v` so that it can be accessed anywhere. Regardless of the intent, there is no `Global` in Java so that answer stands. `public static volatile` only gets you so far as Swing is highly asynchronous.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26339317
has answer: http://stackoverflow.com/a/40957475
downvote count: 0
has body: I faced this question on one of interviews, so could you please tell whether SOAP Web services support only "POST" http method or there is some way to accept other methods on the server side?
tagged with: web-services
has answer: http://stackoverflow.com/a/60899732
tagged with: http
accepted answer: http://stackoverflow.com/a/26339467
possible better answer: http://stackoverflow.com/a/40957475
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/4646146
has answer: http://stackoverflow.com/a/26339467
upvote count: 95
tagged with: post
type: Question
has title: Do SOAP Web services support only "POST" http method
answer count: 3
tagged with: soap
favorite count: 0
score: 95

http://stackoverflow.com/comment/41334759
has text: `.*` *eagerly* matches. In any case I suspect the *real* question is really "How to map Unicode characters with accents to the English-letter equivalent?" eg. see http://stackoverflow.com/questions/18350798/removing-accents-from-string , http://stackoverflow.com/questions/3322152/is-there-a-way-to-get-rid-of-accents-and-convert-a-whole-string-to-regular-lette
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26335792
score: 1

http://stackoverflow.com/comment/45848332
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26245463
has text: @PratikButani-AndroidButs when you create particular `ViewHolder` you initialize it with some `View` which you can create in whatever way you prefer - in particular, you can inflate it from whatever XML layout resource you want.
type: Comment

http://stackoverflow.com/comment/41351776
has text: Define all the logic in something that isn't a subclass of `Application`. Then define two application classes, one with and one without the "progress bar". Note there's also a [version of the `launch` method](http://docs.oracle.com/javase/8/javafx/api/javafx/application/Application.html#launch-java.lang.Class-java.lang.String...-) that takes the application class as the first argument, so you could have a `main(...)` method that conditionally ran one or the other.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26344785

http://stackoverflow.com/a/38821477
answers question: http://stackoverflow.com/q/26259068
has body: To retrieve multiple entities by specifying their keys, you should use GetMulti instead of writing a query. https://cloud.google.com/appengine/docs/go/datastore/reference#GetMulti
score: 0
type: Answer

http://stackoverflow.com/comment/41125692
score: 0
has text: model is a Table Model (where i extract data)... I noticed that if i set a breakpoint to String nome=""; when the breakpoint is stopped here, the client has sent everything yet... Is that possible? I Tried to let the client wait the server (with a reader/writer) but the readLine() freeze anyway. The problem is that readLine() doesn't read never one line @CristianGreco the first negation is an error :P
comment on: http://stackoverflow.com/q/26221532
type: Comment
type: QuestionComment

output
tags question: http://stackoverflow.com/q/26270488
tags question: http://stackoverflow.com/q/26321808
tags question: http://stackoverflow.com/q/26219486
tags question: http://stackoverflow.com/q/26258902
tag name: output
tags question: http://stackoverflow.com/q/26261969
type: Tag
tags question: http://stackoverflow.com/q/26324862
tags question: http://stackoverflow.com/q/26241367

http://stackoverflow.com/q/26289203
type: AnsweredQuestion
has title: Serve up a Java Applet with Laravel
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41250763
accepted answer: http://stackoverflow.com/a/26366075
type: Question
has comment: http://stackoverflow.com/comment/41256584
has comment: http://stackoverflow.com/comment/41252484
has body: I'm trying to wrap my mind around how to deploy a Java applet in my Laravel app. To start with I'm just going to keep it simple and use the applet tag in a view: &lt;applet code="OHLib.class" width=0 height=0 /&gt; (The applet contains just helper functions ... no UI, so I set width and height to 0. Will that work?) When the browser requests that class from my web site, how to I serve it up? Do I define a route? I would like the java class to be located at www.mydomain.com/java/OHLib.class.
tagged with: laravel-4
downvote count: 0
answer count: 1
tagged with: applet
favorite count: 0
tagged with: php
has answer: http://stackoverflow.com/a/26366075
score: 2

http://stackoverflow.com/comment/41110769
score: 0
type: Comment
has text: you need to compare to another EntityObject not an int. Change your parameter type
comment on: http://stackoverflow.com/a/26213659
type: AnswerComment

http://stackoverflow.com/comment/41358345
type: AnswerComment
comment on: http://stackoverflow.com/a/26348712
score: 0
type: Comment
has text: your answer has been flagged as low quality answer, please provide some information

http://stackoverflow.com/comment/41304332
score: 9
comment on: http://stackoverflow.com/q/26318341
type: QuestionComment
type: Comment
has text: @JarrodRoberson Some people simply ask about how things work or why they work the way they do. If this is a rant, then it's **perfectly disguised** as I can't see here anything like this.

http://stackoverflow.com/q/26325490
has body: So I'm a beginner in java and I am making a pdf using iText in netbeans. I have no problem with making it, I can successfully make a pdf. But I want to let the user choose what to name the pdf file (which obviously means I am the one who should specify the name on my program). This is how it looks in my code: PdfWriter.getInstance(document,new FileOutputStream("thisIsaPdf.pdf")); but I don't want to manually put the name of the pdf file. So, what to do? I have tried the basic - instantiate a String variable ( String yourPdfName; ) to hold the value the user put (using JOptionPane.showInputDialog) but then it's a "syntax error" when I replace "thisIsaPdf.pdf" with yourPdfName inside the parentheses on that line of code like this: String yourPdfName = ""; yourPdfName = JOptionPane.showInputDialog("Name your pdf:"); PdfWriter.getInstance(document,new FileOutputStream(yourPdfName)); So what should I do? Please helppp. thank you
tagged with: itext
has comment: http://stackoverflow.com/comment/41315658
type: Question
has comment: http://stackoverflow.com/comment/41316317
has comment: http://stackoverflow.com/comment/41315600
upvote count: 0
has answer: http://stackoverflow.com/a/26326057
score: -1
answer count: 1
favorite count: 0
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/26326057
has comment: http://stackoverflow.com/comment/41315785
downvote count: 1
tagged with: pdf-generation
has comment: http://stackoverflow.com/comment/41316184
type: AnsweredQuestion
has title: How to let user choose the name of pdf in netbeans using iText?
tagged with: java
has comment: http://stackoverflow.com/comment/41315365
has comment: http://stackoverflow.com/comment/41315335

http://stackoverflow.com/comment/41340694
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26338611
type: AnswerComment
has text: Why shouldn't I do this for other panes? What makes ScrollPane so special?

http://stackoverflow.com/comment/41093916
has text: Okay, so my class file is located in the default package in the bin folder. How would this be displayed in terms of "com.mycompany.myproject.LicenseFiller"
comment on: http://stackoverflow.com/q/26205255
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41573612
type: Comment
has text: You are right. But I can't post the actual because it is proprietary code. Again Thank you.
comment on: http://stackoverflow.com/a/26464565
score: 0
type: AnswerComment

http://stackoverflow.com/a/26199749
type: AcceptedAnswer
has body: You can always use an array of Object - Object[]. Object[] objects = new Object[2]; objects[0] = "ABC"; objects[1] = Integer.valueOf("15");
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26199738
answers question: http://stackoverflow.com/q/26199738
score: 3
upvote count: 3

http://stackoverflow.com/comment/41158061
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26239416
has text: Don't forget if you use it several times you need reset `maxValue` before use
type: Comment

http://stackoverflow.com/comment/41182007
has text: which version of webdriver do you use? I don't see any problem while running selenium test even my host file entry does not have localhost value for 127.0.0.1.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26252277

http://stackoverflow.com/comment/41231842
comment on: http://stackoverflow.com/a/26279641
score: 0
type: Comment
type: AnswerComment
has text: Ok, thanks, it's an inner-class. PS: could you please make a up vote to leave the down vote thanks again !

http://stackoverflow.com/q/26283383
has answer: http://stackoverflow.com/a/26283632
has title: how can i read QR Code inside my own application
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41238423
type: Question
has answer: http://stackoverflow.com/a/26283620
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41238632
answer count: 2
has body: i am developing an application that i must scan QR Code's with phone's camera inside my application. what i must do for this? i searched for this topic but they do not hit the goal. thanks for your help.
has comment: http://stackoverflow.com/comment/41239930
upvote count: 0
has comment: http://stackoverflow.com/comment/41259832
has comment: http://stackoverflow.com/comment/41238491
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: -3

http://stackoverflow.com/comment/41325909
score: 1
has text: You should explain to him why the code acts that way
comment on: http://stackoverflow.com/a/26331076
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41130441
has text: Good points. Do you know where I can find out the details of what `Project` includes on the classPath? Since we're talking about, if I added tests, would I need to add the "generated" source set to the the test source set's path too?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26222328
type: AnswerComment

http://stackoverflow.com/q/26226986
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/26381707
favorite count: 0
has body: I'm using JCalendar and have setup a listener using a PropertyChangeListener. My problem is that this listener will not respond to an event on the current day, I assume because there is no change in the property. I want it to be able to respond to selecting today's date, as the calendar leads to a diary. When opened I still want the calendar to open on "today's" date, but to have a listener that will respond to pressing "today's" date. My code for the listener is below: final JCalendar calendar = new JCalendar(); calendar.getDayChooser().addPropertyChangeListener("day", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { if(Calendar.AddJob!=1){ JOptionPane.showMessageDialog(null,"No Entry Found"); frame.dispose(); String date = EditDate(calendar.getDate().toString()); WorkDiary.WorkDiaryGui(date); } if(Calendar.AddJob==1){ String date = EditDate(calendar.getDate().toString()); Calendar.AddJob=0; frame.dispose(); WorkDiaryAddJob.WorkDiaryAddJobGui(CalReg, date); } } });
has answer: http://stackoverflow.com/a/26229251
has title: JCalendar and PropertyChangeListener: event is not fired for current day
upvote count: 1
tagged with: swing
possible better answer: http://stackoverflow.com/a/26229251
tagged with: jcalendar
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26381707
tagged with: jdatechooser
linked to: http://stackoverflow.com/q/20337604

http://stackoverflow.com/a/26257344
downvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/138807547
accepted answer of: http://stackoverflow.com/q/26256720
has body: I tried @JsonSerialize(include = Inclusion.NON_NULL) intead of @JsonInclude(Include.NON_NULL) and it worked as expected.
answers question: http://stackoverflow.com/q/26256720
type: Answer
has comment: http://stackoverflow.com/comment/94278090
upvote count: 25
has comment: http://stackoverflow.com/comment/126300313
has comment: http://stackoverflow.com/comment/59701069
has comment: http://stackoverflow.com/comment/99182918
has comment: http://stackoverflow.com/comment/58034227
score: 21

http://stackoverflow.com/comment/41141642
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26229969
has text: Thanks. There is an application path is "/s".
score: 0

http://stackoverflow.com/comment/41175430
type: Comment
has text: Yes of course, call `t1.join()` first, but if you want sequential execution why are you using a thread?
type: AnswerComment
comment on: http://stackoverflow.com/a/26248649
score: 0

http://stackoverflow.com/comment/41195755
type: QuestionComment
has text: @BuhakeSindi, no framework. Just a post request from js.
comment on: http://stackoverflow.com/q/26260032
score: 0
type: Comment

http://stackoverflow.com/q/26304648
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26314000
has body: I want to run a shell script from a java program. My shell script(loop_shell.sh) is working fine when I am running it in terminal and even my Java program(Execute.java) is working fine while running with other commands like 'ls' etc. But when I try run shell script from the Java program, shell script is not printing the values which are inside a loop. Here are the codes for both shell script and Java Program respectively. loop_shell.sh:- #bin/sh i=0 j=0 timer=0; echo "u r in loop_shell.sh" while((i!=1)); do echo "waiting for the folder" done Execute.java:- import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.File; public class Execute { public static void main (String args[]) { String command="./loop_shell.sh"; String output=executeCommand1(command); System.out.println(output); } public static String executeCommand1(String command) { StringBuffer output = new StringBuffer(); Process p; try { File dir = new File("/home/vamz/Desktop/sudhir_personal/JAVA_IMPORTANT/");//path p = Runtime.getRuntime().exec(command,null,dir); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { output.append(line + "\n"); } } catch (Exception e) { e.printStackTrace(); } return output.toString(); } } Output:- u r in loop_shell.sh Expected Output:- u r in loop_shell.sh u r in loop_shell.sh u r in loop_shell.sh u r in loop_shell.sh u r in loop_shell.sh u r in loop_shell.sh ..........so on .... If u try to run both the programs u will get the same output. U can see that output is just printing "u r in loop_shell.sh" and qutting with out waiting for shell script to complete!! Can some one pls explain me what is happening ? and pls tell me how to run infinte loop script from a java program.
type: Question
tagged with: bash
possible better answer: http://stackoverflow.com/a/26304807
answer count: 2
accepted answer: http://stackoverflow.com/a/26314000
has answer: http://stackoverflow.com/a/26304807
tagged with: shell
favorite count: 0
has title: How to run infinte loop shell script from a java program
tagged with: linux
downvote count: 2
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/q/26337300
has title: Java.sql.SQLException: ORA-00604
tagged with: java
has comment: http://stackoverflow.com/comment/41337827
has body: I developed a website using jsp and servlet but it gives exception java.sql.SQLException: ORA-00604.After restarting the server it is working fine. Below is my code public class LoginCheck extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public LoginCheck() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub ArrayList<String> appAddList = new ArrayList<String>(); ArrayList<String> appNameList = new ArrayList<String>(); PrintWriter out = response.getWriter(); Calendar objCal1=Calendar.getInstance(); Calendar objCal2=Calendar.getInstance(); objCal2.set(1970,0,1,0,0,0); response.setDateHeader("Last-Modified",objCal1.getTime().getTime()); response.setDateHeader("Expires",objCal2.getTime().getTime()); response.setHeader( "Pragma" , "no-cache" ); response.setHeader( "Cache-Control" , "no-cache" ); response.addHeader("Cache-Control","no-store"); Cookie cookies[] = request.getCookies(); if(cookies != null) { for(int i = 0; i < cookies.length; i++) { cookies[i].setMaxAge(0); response.addCookie(cookies[i]); } } HttpSession session = request.getSession(); session.setAttribute( "user" , request.getParameter( "username" ) ); session.setAttribute( "pass" , request.getParameter( "pass" ) ); String user = (String)session.getAttribute( "user" ); String pass = (String)session.getAttribute( "pass" ); session.setMaxInactiveInterval(120); java.sql.Connection con = TSM.intf.Common.com.Common.Connection.getConnection(); Statement stmtEmpTable = n…
type: Question
has answer: http://stackoverflow.com/a/26337735
linked to: http://stackoverflow.com/q/2225221
has answer: http://stackoverflow.com/a/26337725
tagged with: servlets
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26337776
type: UnansweredQuestion
tagged with: oracle-database
tagged with: jdbc

http://stackoverflow.com/q/26332090
type: AnsweredQuestion
tagged with: android
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41328001
has comment: http://stackoverflow.com/comment/41328313
has body: I am having some major issues here after updating to android API 20, after creating a new android project on eclipse, I got flagged for tons of bus as you can see below Description Resource Path Location Type ActionBarActivity cannot be resolved to a type MainActivity.java /testone/src/com/example/testone line 8 Java Problem ActionBarActivity cannot be resolved to a type MainActivity.java /testone/src/com/example/testone line 12 Java Problem ActionBarActivity cannot be resolved to a type MainActivity.java /testone/src/com/example/testone line 32 Java Problem error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. styles.xml /testone/res/values-v14 line 8 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. styles.xml /testone/res/values line 7 Android AAPT Problem error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. styles.xml /testone/res/values-v11 line 7 Android AAPT Problem R cannot be resolved to a variable MainActivity.java /testone/src/com/example/testone line 13 Java Problem R cannot be resolved to a variable MainActivity.java /testone/src/com/example/testone line 19 Java Problem R cannot be resolved to a variable MainActivity.java /testone/src/com/example/testone line 29 Java Problem The import android.support.v7 cannot be resolved MainActivity.java /testone/src/com/example/testone line 3 Java Problem The method getMenuInflater() is undefined for the type MainActivity MainActivity.java /testone/src/com/example/testone line 19 Java Problem The method onCreate(Bundle) of type MainActivity must override or implement a supertype method MainActivity.java /testone/src/com/example/testone line 11 Java Problem The method onCreateOptionsMenu(Menu) of type MainActivity must override or implement a supertype method MainActivity.java /testone/src/com/example/testo…
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26333441
tagged with: java
has comment: http://stackoverflow.com/comment/41329100
accepted answer: http://stackoverflow.com/a/26333441
tagged with: eclipse
downvote count: 0
has comment: http://stackoverflow.com/comment/41330019
has title: Cannot reference main android Library
has comment: http://stackoverflow.com/comment/41329044
type: Question

http://stackoverflow.com/comment/85452724
comment on: http://stackoverflow.com/a/26243649
type: Comment
has text: @DeepSidhu1313: the jvm doesn't do anything to prevent starvation.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41347636
has text: yes, im trying to create a circle using the lat and long as center
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26342520
score: 0

http://stackoverflow.com/a/26318996
downvote count: 0
answers question: http://stackoverflow.com/q/26318856
type: Answer
accepted answer of: http://stackoverflow.com/q/26318856
has body: Simply, it would allow you to create standalone JavaScript programs and allow embedding JavaScript in Java. Java must be compiled into what is known as a "machine language" before it can be run. JavaScript is text-based and interpreted, and is interpreted by browsers. So being able to use this technology inside Java is a pretty cool thing. JRuby is another example of a scripting language that can run inside Java, as well as it's Python equivalent Jython. They are all just wrappers for languages to use inside Java. It is already possible to run dynamic languages on top of the JVM, but the goal is to ease new dynamic language implementations and increase their performance. One advantage I can think of is using JavaScript for the scripting of a Java game. Hope it helps :)
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41303416
type: AcceptedAnswer

http://stackoverflow.com/q/26205465
accepted answer: http://stackoverflow.com/a/26205519
downvote count: 0
tagged with: generics
favorite count: 0
has body: I don't know whether this can be done in Java. I can't find a solution for it. I want to examine all methods in a class and find out how the parameters of the method looks like with the generic info. If for example you have an interface and an implementer like the following: // Services are the objects i will examine public interface Service&lt;T extends DetailsModel&gt; { public Response findObject(RequestEvent&lt;T&gt; event); } public interface SomeObjectService extends Service&lt;SomeObject&gt; { Response findObject(RequestEvent&lt;SomeObject&gt; event); } public class SomeObjectServiceImpl extends SomeObjectService { public Response findObject(RequestEvent&lt;SomeObject&gt; event) {...} } // Events are the parameters of the services public interface Event&lt;T extends DetailsModel&gt; { Callback getCallback() } public abstract class AbstractEvent&lt;T&gt; implements Event&lt;T&gt; { public Callback getCallback() { return null; } } public class RequestEvent&lt;T&gt; extends AbstractEvent&lt;T&gt; { Handle&lt;T&gt; t; public Handle&lt;T&gt; getHandle() {...} } I have tried all kind of things to get the actual T out of RequestEvent when looking at SomeObjectServiceImpl. For example public &lt;D extends DetailsModel&gt; void configure(Service&lt;D&gt; service) { Method[] allDeclaredMethods = service.getClass().getDeclaredMethods(); for (Method declaredMethod : allDeclaredMethods) { try { Type[] parameterTypes = declaredMethod.getGenericParameterTypes(); if (parameterTypes.length == 1) { Type parameterType = parameterTypes[0]; if (Event.class.isAssignableFrom((Class&lt;?&gt;) parameterType)) { ParameterizedType type = ((ParameterizedType) ((Class) parameterType).getGenericSuperclass()); Type genericType = type.getActualTypeArguments()[0]; if (genericType != null &amp;&amp; genericType instanceof Class) { EventDescriber eventDescriber = new EventDescriber( (Class&lt;? extends Event&gt;) parameterType, (Class) genericType); } } } } catch (Exception e) { logger.warn("C…
has title: Examine generic type of a method parameter
type: AnsweredQuestion
score: 2
tagged with: reflection
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26205519
possible better answer: http://stackoverflow.com/a/38526523
has answer: http://stackoverflow.com/a/38526523
answer count: 2

http://stackoverflow.com/a/26256260
type: Answer
has body: if you have hard coded buttons in xml then set id in xml itself like this: &lt;Button android:id="@+id/btn_row_col" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:text="button1" /&gt; if you are adding it dynamically then: Button newBtn=new Button(); newBtn.setText("button"); newBtn.setId(yourId); //here setid to your button
answers question: http://stackoverflow.com/q/26255991
score: 0

http://stackoverflow.com/comment/41187620
has text: DYM taht standard disableXxxColor doesn't works or is/aren't this/those nested/inherits method(s) implemented from JTextComponents, I'm doubt in it, this L&F is comparable with Substance (has own Renderer/painters)
score: 0
comment on: http://stackoverflow.com/q/26255534
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26338425
answer count: 0
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/41339410
has comment: http://stackoverflow.com/comment/41341479
has title: Population of Jtable from Unix Output
tagged with: jtable
score: 0
type: UnansweredQuestion
has body: Please Help, i am trying to populate the Jtable from the output of UNIX box, I am executing the hive sql through shell and able to see the output in string format. I am trying to see the below output in table format. private void jButton1_actionPerformed() { if (textarea1.getText() == null || textarea1.getText().equals("")) { JOptionPane.showMessageDialog(contentPane,"Please Enter Your Sql."); } else { String cmd = "/opt/ibm/biginsights/hive/bin/hive -e 'SET hive.cli.print.header=true; " + textarea1.getText() + "'"; i=0; String sql =HiveJdbcClient; if (cmd != null) { int returnchannel = UnixConnection.getUnixChannel( UnixConnection.session, cmd); System.out.println("Return Status=" + returnchannel); if (returnchannel == 0) { resultPanel.removeAll(); resultPanel.updateUI(); resultPanel.add(scrollpane, 0); BufferedReader bf = null; StringBuffer sb = new StringBuffer(); String line; rs = UnixConnection.getUnixChannel(UnixConnection.session, cmd) try { bf = new BufferedReader(new InputStreamReader( UnixConnection.in)); while ((line = bf.readLine()) != null) { System.out.println("Return value=" + line); sb.append(line + "\n"); rs [i] = sb; i++; } System.out.println(sb); contentPane.updateUI(); } catch (Exception ex) { System.out.println(ex); } //JTable table = new JTable(DbUtils.resultSetToTableModel(rs)); table.setTableHeader(null); } } } }

http://stackoverflow.com/a/26208193
has comment: http://stackoverflow.com/comment/41099506
answers question: http://stackoverflow.com/q/26208179
has comment: http://stackoverflow.com/comment/41099919
has comment: http://stackoverflow.com/comment/41210887
type: AcceptedAnswer
has body: The short answer is, don't use KeyListener, use the Key Bindings API which will allow you to overcome these shortcomings and configure the level of focus required in order for them to be triggered. See How to Use Key Bindings for more details Updated First, you need to stop think in such absolute terms and start thinking in more abstract concepts. Your game shouldn't care HOW something is done, only when something IS down. The problem is not with the key bindings API but how you see the problem. For example, you shouldn't care HOW an "up" event is triggered, only that it was. This means that trigger could have come from a joystick, game controller, network server, mind control through the force and even the keyboard. The game would then react to this change in state accordingly. import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; public class KeyBindingsTest { public static void main(String[] args) { new KeyBindingsTest(); } public KeyBindingsTest() { 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 interface In…
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26208179
has comment: http://stackoverflow.com/comment/41210874
has comment: http://stackoverflow.com/comment/41100515
has comment: http://stackoverflow.com/comment/41099543
has comment: http://stackoverflow.com/comment/41100497
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41099520
has comment: http://stackoverflow.com/comment/41101926
has comment: http://stackoverflow.com/comment/41099826
has comment: http://stackoverflow.com/comment/41134717

http://stackoverflow.com/comment/41303401
score: 0
type: QuestionComment
type: Comment
has text: just so you might get help faster , i think these kind of questions are for superuser forums rather than stakcoverflow
comment on: http://stackoverflow.com/q/26318872

http://stackoverflow.com/q/26330471
has title: Getting images URL out of JSON
has comment: http://stackoverflow.com/comment/41324922
has body: Im new to JSON so i have a question about it. I want to get the images JSON object in JSONObject info. But what is the best way to do it? When i get a request back with JSON i got this: { "status" : "done", "info" : { "rating" : { "imdb" : [5.7000000000000002, 129331] }, "genres" : ["Action", "Crime", "Thriller"], "tmdb_id" : 584, "plot" : "It's a major double-cross when former police officer Brian O'Conner teams up with his ex-con buddy Roman Pearce to transport a shipment of \"dirty\" money for shady Miami-based import-export dealer Carter Verone. But the guys are actually working with undercover agent Monica Fuentes to bring Verone down.", "tagline" : "How Fast Do You Want It?", "original_title" : "2 Fast 2 Furious", "actor_roles" : { "Mark Boone Junior" : "Detective Whitworth", "Amaury Nolasco" : "Orange Julius", "Edward Finlay" : "Agent Dunn", "Cole Hauser" : "Carter Verone", "Ludacris" : "Tej", "Devon Aoki" : "Suki", "James Remar" : "Agent Markham", "Jin Auyeung" : "Jimmy", "Eric Etebari" : "Darden", "Paul Walker" : "Brian O'Conner", "Mo Gallini" : "Enrique", "Eva Mendes" : "Monica Fuentes", "Tyrese Gibson" : "Roman Pearce", "Thom Barry" : "Agent Bilkins", "Michael Ealy" : "Slap Jack" }, "collection" : "The Fast and the Furious Collection", "via_imdb" : true, "mpaa" : "PG-13", "via_tmdb" : true, "directors" : ["John Singleton"], "titles" : ["2 Fast 2 Furious", "The Fast and the Furious 2", "M\u00e1s r\u00e1pido, m\u00e1s furioso", "\u73a9\u547d\u95dc\u982d2 \u98c6\u98a8\u518d\u8d77", "Fast and the Furious Vol2", "The Fast and the Furious 2 - 2 Fast 2 Furious", "+ Veloses + Furiosos", "Rapide et dangereux 2", "Fast &amp; Furious 2", "Fast and Furious 2", "\ubd84\ub178\uc758 \uc9c8\uc8fc 2"], "imdb" : "tt0322259", "year" : 2003, "images" : { "disc_art" : ["http://assets.fanart.tv/fanart/movies/584/moviedisc/2-fast-2-furious-520e18cde06ab.png"], "poster" : ["https://image.tmdb.org/t/p/w154/3CrNPUulPGbsJIH2ZnLYomGIVrk.jpg", "http://ia.media-imdb.com/images/M/MV5BM…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41325003
has answer: http://stackoverflow.com/a/26330507
accepted answer: http://stackoverflow.com/a/26330507
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41325257
type: Question
has comment: http://stackoverflow.com/comment/41325987
score: 0
tagged with: android
answer count: 1

http://stackoverflow.com/comment/41314880
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26324147
has text: Read the 800+ voted answer on that question.

http://stackoverflow.com/a/26204295
has comment: http://stackoverflow.com/comment/41091801
type: AcceptedAnswer
has body: As long as an object is reachable through a chain of strong references from a GC root (a thread stack, or a static variable), it will not be garbage collected. It doesn't matter how convoluted the path to the object is.
accepted answer of: http://stackoverflow.com/q/26204274
score: 0
answers question: http://stackoverflow.com/q/26204274
has comment: http://stackoverflow.com/comment/41092412
type: Answer
has comment: http://stackoverflow.com/comment/41092482
has comment: http://stackoverflow.com/comment/41091849

http://stackoverflow.com/comment/41194188
score: 0
type: Comment
has text: Do not recommend relying on the client's clock for this. The client could be wrong by minutes, hours, or even years. Use the server's clock which you know is correct.
comment on: http://stackoverflow.com/a/26257938
type: AnswerComment

http://stackoverflow.com/q/26326167
favorite count: 0
accepted answer: http://stackoverflow.com/a/26570700
has comment: http://stackoverflow.com/comment/41415493
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26570700
tagged with: dns
tagged with: ip
type: Question
tagged with: performance
has body: I have troubles figuring out why resolving an IP takes so much longer then resolving the domain name. I do understand that the IP has to be converted in order to be used by the getByName method. But this: InetAddress address = InetAddress.getByName("google.com"); System.out.println("Reachable: " + address.isReachable(10000)); runs almost 20 times faster then this: InetAddress address = InetAddress.getByName("192.168.1.1"); System.out.println("Reachable: " + address.isReachable(10000)); My goal is to search a specific network segment for live hosts by IP-Adress. So going through this 65025 times to run from 192.168.1.1 till 192.168.255.255 doesn't seem to be to smart. :-( Is there a better way of doing this. Unfortunately calling the "ping-command" is not an option. Cheers, Stephanie
has title: InetAddress.getByName(FQDN) vs InetAddress.getByName(IP), performance issues
tagged with: java
upvote count: 2
tagged with: lan
answer count: 1

http://stackoverflow.com/a/26342863
has comment: http://stackoverflow.com/comment/41347878
has comment: http://stackoverflow.com/comment/41347752
has comment: http://stackoverflow.com/comment/41348232
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41348144
has comment: http://stackoverflow.com/comment/41348418
score: 3
has comment: http://stackoverflow.com/comment/41347660
type: Answer
has comment: http://stackoverflow.com/comment/41347697
accepted answer of: http://stackoverflow.com/q/26342786
upvote count: 3
has comment: http://stackoverflow.com/comment/41347822
has body: JSoup Try JSOUP API it is really easy to use Document doc = Jsoup.connect(YOUR_WEBSITE).get(); Elements tt = doc.select("title"); System.out.println(tt.text()); Your code import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.util.Scanner; public class Allrecipes { public static void main(String[] args) throws Exception { System.out.println("Colby Mehmen"); // http://allrecipes.com/Recipe/Cardamom-Maple-Salmon/Detail.aspx?soid=carousel_0_rotd&amp;prop24=rotd String str1 = ""; str1 = compare(); if (str1.contains("http://allrecipes.com")) { URL oracle = new URL(str1); BufferedReader in = new BufferedReader(new InputStreamReader( oracle.openStream())); String html = null; String line; while ((line = in.readLine()) != null) html += line; in.close(); String page = html; int start = page.indexOf("&lt;title&gt;"); int end = page.indexOf("&lt;/title&gt;"); String title = page.substring(start+7, end); System.out.println(title); }// end program } public static String compare() { Scanner input = new Scanner(System.in); System.out.println("Enter recipe URL: "); String str1 = input.next(); String str2 = "allrecipes.com"; String str3 = "http://"; boolean b = str1.contains(str2); if (b == true) { boolean c = str1.contains(str3 + str2); if (c == false) { str1 = str3 + str1; } }// endifif boolean d = str1 != str3 + str2; if (d == false) { System.out.println("ERROR"); } /* cOUT */System.out.println(str1); return str1; }// end compare }
answers question: http://stackoverflow.com/q/26342786

http://stackoverflow.com/a/26228593
answers question: http://stackoverflow.com/q/26228548
type: AcceptedAnswer
score: 0
has body: line.lastIndexOf(""") gives an error because the compiler cannot differentiate between the 3 " and when matches 2 of them to form a pair, the 3rd one remains unmatched. Use an escape character \. So line.lastIndexOf("\""); will do what you intend to do, get the index of the last occurence of ".
type: Answer
accepted answer of: http://stackoverflow.com/q/26228548

http://stackoverflow.com/q/26221530
tagged with: ajax
has answer: http://stackoverflow.com/a/26233916
type: UnansweredQuestion
tagged with: selenium-webdriver
score: 2
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: selenium
type: Question
has body: I have the following code but its not working public static String getHTMLResponse(String url){ String body = (String) js.executeScript("$.ajax({url:\""+ url + "\", success:function(result){ return result;}});"); return body; } For some reason this is always returning null. Has anyone tried to get a CURL response from ajax in webdriver? I was doing this in java before but I am getting certificate errors constantly and just want something more reliable. Thanks ahead of time!
has answer: http://stackoverflow.com/a/26223002
upvote count: 2
answer count: 2
has title: Selenium get HTML (or JSON) response from WebDriver
favorite count: 0

http://stackoverflow.com/q/26208263
accepted answer: http://stackoverflow.com/a/26208282
favorite count: 0
has comment: http://stackoverflow.com/comment/41099363
has answer: http://stackoverflow.com/a/26208282
upvote count: 0
has comment: http://stackoverflow.com/comment/41099359
tagged with: java
type: Question
type: AnsweredQuestion
score: -1
has body: I have a basic question in Java: Consider I have public void initialize(My_Class my_context) { super.initialize(my_Context); } public void work(My_Class2 elt) { String text = elt.getText(); My_Class3 var1 = new My_Class3(); String new_text = var1.my_method(text); I am having a problem because I am calling the work method many times, and each time it instantiates a My_Class3 object, which takes a lot of time. I would like to move the instantiation in the initialize method so that it is performed once. In order to do that, I tried to move My_Class3 var1 = new My_Class3(); into initialize and set it as a global variable so that var1 is found in the different calls of work. However, I cannot set it into a static variable. I am guessing this has something to do with the visibility of the initialize method, but I cannot change it. How can I instantiate a var1 variable of type My_Class3 in initialize and call it in work?
answer count: 1
downvote count: 1
has title: Visibility of a variable after changing its location

http://stackoverflow.com/a/26308987
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26308965
has body: If you are referencing a static field in another class you will need to use the name of that class to reference the field, so basically you need to change your main to this: public class RunPennyPinch { public static void main(String[] args) { System.out.print(Prizes.prizes[1]); } }

http://stackoverflow.com/comment/41275064
type: Comment
comment on: http://stackoverflow.com/a/26260204
has text: My simple app isn't working either. The only jars in the webapp are log4j-core, log4j-api and log4j-web.
type: AnswerComment
score: 0

http://stackoverflow.com/a/26262664
has comment: http://stackoverflow.com/comment/41202239
answers question: http://stackoverflow.com/q/26262279
has comment: http://stackoverflow.com/comment/41201232
has body: bind values[] to each key It might make more sense to use a HashMap to do that mapping for you, since that's what it's for. Beyond that, if you have two keys and each key has two values, you have 4 values, not 2 ;) In general, the get method in a tree structure is almost always implementable recursively. Here is a very general implementation of a get algorithm for a 2-3 tree in psudo-code. V get&lt;K, V&gt;(Node&lt;K, V&gt; node, K key) { if(node.is_leaf()) { return node.keys.get(key); // This will either return the value, or null if the key isn't in the leaf and thus not in the tree } if(key &lt; node.left_key) { return get(node.left_child, key); // If our key goes to the left, go left recursively } else if(node.two_node &amp;&amp; key &lt;= node.right_key) { return get(node.center_child, key) // If we have two keys, and we're less than the second one, we go down the center recursively } else { return get(node.right_child, key); // If we've gotten here, we know we're going right, go down that path recursively } } That should get you started in the right direction. Insertion/deletion for 2-3 trees is a bit more complicated, but this should at least get your head around how to think about it. Hint; Your Node class needs to be doubly-linked, that is each node/leaf needs to reference its parent node as well as its children, and the root is simply a node whose parent is null.
upvote count: 2
has comment: http://stackoverflow.com/comment/41202311
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26262279

http://stackoverflow.com/q/26272012
upvote count: 3
tagged with: simpledateformat
tagged with: java
has title: SimpleDateFormat ThreadSafe Suggestion-> creating new object is better or ThreadLocal is?
has comment: http://stackoverflow.com/comment/41217883
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41217941
downvote count: 0
has comment: http://stackoverflow.com/comment/41218038
has body: I am building an application in which there i have to format date. For formatting i am using SimpleDateFormatter class. As per my knowledge there are three ways to use this class with synchronization 1) create local variable with new SimpleDateFormatter("MM/dd/yyyy") 2) use synchronized keyword synchronized(this) { simpleDateFormatter.format(date); //use static object and then format with synchronization } 3) use thread local variable with Simple Date Formatter like this private static ThreadLocal&lt;SimpleDateFormat&gt; outDateFormatHolder = new ThreadLocal&lt;SimpleDateFormat&gt;() { @Override protected SimpleDateFormat initialValue() { return new SimpleDateFormat("MM/dd/yyyy"); } I am building web application, where i can receive multiple request and at some point i will be formatting the date. Now i know that if i have to format more than once in the same thread then ThreadLocal would have been better option. But according to current scenario every thread will format the date once. Question-> the whole question boils to the situation. What will be a better option 1 or 3, since option 2 will have performance issue. As i have to format only once, ---------> are option 1 and option 3 same ?, if they are not, which one is better in my case? ------> is there any other way to make it threadsafe which will not have performance or memory issue(as read in case of ThreadLocal). I am open to suggestion. Please share your opinions. Thank you for your time.
has comment: http://stackoverflow.com/comment/41218358
has comment: http://stackoverflow.com/comment/41218682
favorite count: 0
tagged with: thread-local
has answer: http://stackoverflow.com/a/26272308
has comment: http://stackoverflow.com/comment/41218619
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41218153
has comment: http://stackoverflow.com/comment/41218072
possible better answer: http://stackoverflow.com/a/26272118
accepted answer: http://stackoverflow.com/a/26272308
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26272118
score: 3
has comment: http://stackoverflow.com/comment/41217837

http://stackoverflow.com/comment/41342401
type: QuestionComment
has text: What was the output of Log.d("score", "Retrieved " + scoreList.size() + " scores") ?? If its >0 ,it means the user exists. Print the scoreList and see what it points to. Probably, the ParseInstallObject is causing an issue. Try the query with "code" instead of "attachedUser" to verify this.
comment on: http://stackoverflow.com/q/26339226
score: 0
type: Comment

http://stackoverflow.com/comment/41626569
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26285775
type: AnswerComment
has text: @piyush Copied my prev comment into answer's body.

http://stackoverflow.com/q/26311513
tagged with: rx-java
has answer: http://stackoverflow.com/a/44961849
has answer: http://stackoverflow.com/a/46514779
score: 42
tagged with: reactive-programming
has answer: http://stackoverflow.com/a/26311769
tagged with: java
has answer: http://stackoverflow.com/a/53832579
has title: Convert observable to list
has body: I am using RxJava. I have an Observable&lt;T&gt;. How do I convert it to List&lt;T&gt;? Seems to be a simple operation, but I couldn't find it anywhere on the net.
has answer: http://stackoverflow.com/a/26313904
accepted answer: http://stackoverflow.com/a/26311769
has answer: http://stackoverflow.com/a/26325556
upvote count: 42
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/26325556
has answer: http://stackoverflow.com/a/60609643
favorite count: 0
has answer: http://stackoverflow.com/a/44848981
type: Question
answer count: 8

http://stackoverflow.com/comment/41354678
has text: Alright, thank you! For some reason I thought save Instance State would transfer variables. One more question though, would it work to save say the state of a button? Like if it was visible or not?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26346653
score: 0

http://stackoverflow.com/q/26290805
tagged with: java
has answer: http://stackoverflow.com/a/26291218
answer count: 3
type: UnansweredQuestion
tagged with: batch-file
has answer: http://stackoverflow.com/a/26290923
tagged with: windows
has answer: http://stackoverflow.com/a/26291199
has body: I am writing a Java program and would be calling this in a DOS batch script....(it is a Swing based GUI application) I wish to get output from the Java program in the calling DOS script. I am planning to get this information out through the use of command line arguments - like (in the DOS script) java myProg var if (%var% == "loggedin") { } var is supposed to be populated with the output from myProg. The Java program myProg is supposed to set the value args[0] (in var) and I am assuming this will be remembered when control comes back to the DOS script. Is this possible? If not how can I achieve my use-case? What options do I have? How can I pass a flag (as "loggedin") from myProg to the calling DOS batch script?
has title: Java - Getting Output from the program ... Command line arguments?
type: Question
score: 0

http://stackoverflow.com/q/26238149
has answer: http://stackoverflow.com/a/26238610
has answer: http://stackoverflow.com/a/26243070
tagged with: jquery
score: 4
favorite count: 0
tagged with: struts2
tagged with: ajax
linked to: http://stackoverflow.com/q/23448616
linked to: http://stackoverflow.com/q/13153856
has comment: http://stackoverflow.com/comment/41163776
has title: How to get result on same page why input is required?
accepted answer: http://stackoverflow.com/a/26243070
downvote count: 1
type: AnsweredQuestion
has body: In my project I am updating details so I created action, but it gives me exception in response as No result defined for action org.employee.actions.EmployeeMyProfileAction and result input In struts.xml (Before) empMyProfile.jsp (After) empMyProfile.jsp emp-personal-form.jsp Ajax Call function checkPersonal(id) { if (checkEverythingP()) { $.ajax({ type : 'POST', url : 'savePersonalDetails', data : $('#personalform').serialize(), success : function(data) { alert('success'); }, error : function() { alert('error'); } }); } } It gives me success message in JQuery but It is not going to the action class declared. I didn't understand why it is happening after everything is correct. I referred many sites for this but not resolved. Please suggest me what is going wrong.
upvote count: 5
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26238610
tagged with: validation

http://stackoverflow.com/a/26245430
accepted answer of: http://stackoverflow.com/q/26245305
answers question: http://stackoverflow.com/q/26245305
has comment: http://stackoverflow.com/comment/41169736
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41169471
type: Answer
has body: Yes, however then it CAN NOT be pre empted before it finishes the execution? A lock doesn't stop a thread being pre-empted, but it does stop any other thread from obtaining the same lock. i.e. it looks the same, even though the thread can stop for a short time while holding a lock. as if synchronisation was not applied at all. The difference is that without synchronized it would be much faster. As it is such a simple operation. If you were doing something less trivial, the cost of synchronization would be relatively small. In any case, correctness is more important than speed in almost all cases.
upvote count: 1
has comment: http://stackoverflow.com/comment/41169791
has comment: http://stackoverflow.com/comment/41169843
score: 1

tomcat
tags question: http://stackoverflow.com/q/26234029
tags question: http://stackoverflow.com/q/26254259
tags question: http://stackoverflow.com/q/26299050
tags question: http://stackoverflow.com/q/26282098
tags question: http://stackoverflow.com/q/26248022
tags question: http://stackoverflow.com/q/26223646
tags question: http://stackoverflow.com/q/26294404
tags question: http://stackoverflow.com/q/26251199
tags question: http://stackoverflow.com/q/26252598
tags question: http://stackoverflow.com/q/26335119
tags question: http://stackoverflow.com/q/26295682
tags question: http://stackoverflow.com/q/26227344
tags question: http://stackoverflow.com/q/26252108
tags question: http://stackoverflow.com/q/26221027
tags question: http://stackoverflow.com/q/26258715
tags question: http://stackoverflow.com/q/26280832
tags question: http://stackoverflow.com/q/26341346
tags question: http://stackoverflow.com/q/26307029
tags question: http://stackoverflow.com/q/26279314
tags question: http://stackoverflow.com/q/26229289
tags question: http://stackoverflow.com/q/26229718
tags question: http://stackoverflow.com/q/26347873
tags question: http://stackoverflow.com/q/26276027
tags question: http://stackoverflow.com/q/26335089
tags question: http://stackoverflow.com/q/26214916
tags question: http://stackoverflow.com/q/26350970
tag name: tomcat
tags question: http://stackoverflow.com/q/26298670
tags question: http://stackoverflow.com/q/26250309
tags question: http://stackoverflow.com/q/26341859
tags question: http://stackoverflow.com/q/26304965
tags question: http://stackoverflow.com/q/26339052
tags question: http://stackoverflow.com/q/26228993
tags question: http://stackoverflow.com/q/26277985
tags question: http://stackoverflow.com/q/26324310
tags question: http://stackoverflow.com/q/26251193
tags question: http://stackoverflow.com/q/26206142
tags question: http://stackoverflow.com/q/26286235
tags question: http://stackoverflow.com/q/26326810
tags question: http://stackoverflow.com/q/26283850
tags question: http://stackoverflow.com/q/26252932
type: Tag
tags question: http://stackoverflow.com/q/26251999
tags question: http://stackoverflow.com/q/26343636
tags question: http://stackoverflow.com/q/26330148
tags question: http://stackoverflow.com/q/26257227
tags question: http://stackoverflow.com/q/26242303
tags question: http://stackoverflow.com/q/26323547
tags question: http://stackoverflow.com/q/26316591
tags question: http://stackoverflow.com/q/26342438
tags question: http://stackoverflow.com/q/26261400
tags question: http://stackoverflow.com/q/26257642
tags question: http://stackoverflow.com/q/26335921
tags question: http://stackoverflow.com/q/26213254
tags question: http://stackoverflow.com/q/26271697
tags question: http://stackoverflow.com/q/26348210
tags question: http://stackoverflow.com/q/26245817
tags question: http://stackoverflow.com/q/26346088
tags question: http://stackoverflow.com/q/26274132
tags question: http://stackoverflow.com/q/26284249

http://stackoverflow.com/a/26294987
type: AcceptedAnswer
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26259963
accepted answer of: http://stackoverflow.com/q/26259963
downvote count: 0
score: 1
has body: If you use CompoundPropertyModel for your form, then form components will search for a corresponding fields of the real model object, to apply values to (wicket:id of the form component must be equals to the name of the model's field and type of this field must be same as form component returns). But if there is no corresponding field in model, or we want to use independent form component, then we just need to use another model for such component. Your exception appeared due to the fact that DateTextField returns Date after convertion and your model have DateTime field. So, you have at least two ways to deal with this: Described in my comment way to use custom model for this field and convert Date value, fetched from form component at onSubmit method, to DateTime object. But, I think it is better to use your own converter. You can force your DateTextField to return DateTime object for your model. Look here or here (see URL TextField in src) for better understanding of how to achive this. You can implement your own converter relying to org.apache.wicket.datetime.DateConverter src.

http://stackoverflow.com/q/26300639
favorite count: 0
tagged with: parsing
upvote count: 2
type: UnansweredQuestion
tagged with: context-free-grammar
has comment: http://stackoverflow.com/comment/41270255
has body: I have the following context free grammar: E = (E) E = i | ε Given an input String, I have to determine whether this String is accepted by this grammar or not, with a recursive syntax analyzer. For example, if I have the input: ((i))&lt;- this is valid (((i))))&lt;- this is invalid ()&lt;- this is valid and I have the code that is supposed to do all of these public static boolean E() { int pOpen; pOpen = 0; if (lexico.equals("(")) { pOpen++; E(); } else if (lexico.equals("i")) { if (pOpen == 0) return true; //this is valid else verifyParenthesis(); } } public static boolean verifyParenthesis() { int pClose = 0; while ((lexico = nextSymbol()).equals(")")) pClose++; } But I am not sure how to verify that the number of open parentheses ( is the same as the number of close parentheses ). Do I have to use a while on the verifyParenthesis method?
score: 1
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26300938
has comment: http://stackoverflow.com/comment/41270392
has title: I don't know how to implement a recursive syntax analyzer
has comment: http://stackoverflow.com/comment/41270615
linked to: http://stackoverflow.com/q/2245962
answer count: 1

http://stackoverflow.com/a/31446156
answers question: http://stackoverflow.com/q/26271697
has body: The question should be, is jre1.5.0_08 compatible with the windows 2012 server OS because, that is the program that is used to run tomcat? The compatibility matrix for 1.5 published by Oracle does not list windows server 2012 so therefore it is not "officially" supported. The compatibility matrix for 1.6 published by Oracle does list windows server 2012. Using Stefan's suggestion the minimum version of tomcat that you should use on Windows Server 2012 is therefore Tomcat 7. Of course, the compatibility matrix for 1.4 published by Oracle does not list windows server 2012 - I mention this because that JRE is probably used by a lot of other installations that still use Tomcat 5. Update based on Dave's comment: Dave is quite correct. You can run any version of tomcat up to version 7 on java 6, which is the minimum java version that can be used with windows 2012.
type: Answer
has comment: http://stackoverflow.com/comment/50942899
score: 0

http://stackoverflow.com/q/26327403
tagged with: java
has comment: http://stackoverflow.com/comment/41319023
has comment: http://stackoverflow.com/comment/41319363
has answer: http://stackoverflow.com/a/26327696
type: Question
has comment: http://stackoverflow.com/comment/41319281
score: 0
has comment: http://stackoverflow.com/comment/41318867
answer count: 1
tagged with: events
accepted answer: http://stackoverflow.com/a/26327696
has body: I am creating my custom event listener for Tree. I have created a listener interface here it is public interface TreeActionListener extends EventListener { public void onAddNode(TreeEventObject eventObject); public void onRemoveNode(TreeEventObject eventObject); public void onRenameNode(TreeEventObject eventObject); public void onCreateNode(TreeEventObject eventObject); } Also I've created custom event object named TreeEventObject here is code public class TreeEventObject extends EventObject { private Object dataToPass =null; /** * Constructs a prototypical Event. * * @param source The object on which the Event initially occurred. * @throws IllegalArgumentException if source is null. */ public TreeEventObject(Object source, Object dataToPass) { super(source); this.dataToPass = dataToPass; } public Object getPassedData() { return this.dataToPass; } } And as mentioned in jdk pattern adapter is widely used. It used when I have a lot of methods in listener interface, but I need only one method. So I have created my adapter public class TreeActionAdapter implements TreeActionListener { @Override public void onAddNode(TreeEventObject eventObject) { } @Override public void onRemoveNode(TreeEventObject eventObject) { } @Override public void onRenameNode(TreeEventObject eventObject) { } @Override public void onCreateNode(TreeEventObject eventObject) { } } But I am a little confused about one thing. I want to write code as clean as possible and use patterns. So I wonder what is the most elegant way to do the next. I have class that has my listener as field. I have four different events that can be occurred. So what is the right way to fire events. I have some ideas, but don't know which is better. Create only one fireEvent method that should check what type of event has been performed. in case of else if. And if to do this way I should create for example enum and create field type in my event object and than in constructor to set it, and check it later in fireEvent method. An…
has title: Multiple event listener and adapter
tagged with: listener
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/26205923
accepted answer of: http://stackoverflow.com/q/26205512
answers question: http://stackoverflow.com/q/26205512
has body: Map&lt;String, Integer&gt; works well, thanks. public class Pojo { private Map&lt;String, Integer&gt; daily; private Map&lt;String, Integer&gt; average; }
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26208167
downvote count: 0
score: 12
type: AcceptedAnswer
has body: I wouldn't use getMany for this. I'd do this instead: return new Select() .from(Student.class) .innerJoin(StudentCourse.class).on("students.id = studentcourses.id") .where("studentcourses.course = ?", courseId) .execute();
answers question: http://stackoverflow.com/q/26207948
type: Answer
accepted answer of: http://stackoverflow.com/q/26207948
upvote count: 12

http://stackoverflow.com/q/26249126
has body: I'm am currently working on a export script for Blender, however I feel my question is more based around Python in general so I've posted it here. A friend created a conversion program in java for .obj files , which turns them into a custom binary file format. However, I want to skip that process and export the binary file directly from Blender. The file contains text, integers and floats, using utf-8, utf-16 and utf-32 formats. So far I have all the data exporting as a standard text file, so I just need to output it in the appropriate encoding/format. Here is the code he is using in Java for writing the data to the file in different encodings: import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class StreamConverter { //--------------------------------------------------- public static void buffer_write_string(DataOutputStream out,String text) throws IOException{ byte[] bytes = text.getBytes(); for(int i =0;i&lt;text.length();i++){ buffer_write_u8(out,bytes[i]); } } public static void buffer_write_u32(DataOutputStream out,int i) throws IOException{ ByteBuffer b = ByteBuffer.allocate(4); b.order(ByteOrder.LITTLE_ENDIAN); b.putInt(i); out.write(b.array()); } public static void buffer_write_u16(DataOutputStream out,int i) throws IOException{ out.write((byte) i); out.write((byte) (i &gt;&gt; 8)); } public static void buffer_write_s16(DataOutputStream out,int i) throws IOException{ out.write((byte) i); out.write((byte) (i &gt;&gt; 8)); } public static void buffer_write_s32(DataOutputStream out,int i) throws IOException{ ByteBuffer b = ByteBuffer.allocate(4); b.order(ByteOrder.LITTLE_ENDIAN); b.putInt(i); out.write(b.array()); } public static void buffer_write_u8(DataOutputStream out,int i) throws IOException{ out.writeByte((byte) i); } public static void buffer_write_s8(DataOutputStream out,int i) throws IOException{ out.writeByte((byte) i); } public static void buffer_…
has title: Exporting a binary based file with Python
tagged with: utf-16
score: 0
tagged with: python
tagged with: binary
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26249849
tagged with: utf-32
tagged with: java
answer count: 1

http://stackoverflow.com/comment/41096530
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26198475
has text: Thank you Daredesm, for your fast reply = )

http://stackoverflow.com/comment/41353861
comment on: http://stackoverflow.com/a/26344785
type: AnswerComment
has text: Please see my edit. From your answer, I understand that anything like what I suggested in my edit is impossible. And that the main code has to be run from start() in order to gain access to the correct instance of `button` that is displayed by JavaFX. Correct?
score: 0
type: Comment

http://stackoverflow.com/a/26312089
answers question: http://stackoverflow.com/q/26311978
downvote count: 0
upvote count: 2
has body: Because System.out is a PrintStream by default assigned (console output) any call to System.out.write(int) will convert the int value to an ASCII char. So if you want to print 65 you must System.out.write("65"); Everything depends on the Stream assigned to your writer.
type: Answer
score: 2

http://stackoverflow.com/comment/41452167
type: Comment
comment on: http://stackoverflow.com/q/26353471
has text: java.lang.NoClassDefFoundError: org/antlr/runtime/RecognitionException.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41107983
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26212581
has text: are you getting this error? Cannot refer to a non-final variable ka inside an inner class defined in a different method
score: 0

http://stackoverflow.com/q/26252591
tagged with: multiple-versions
has answer: http://stackoverflow.com/a/43643804
linked to: http://stackoverflow.com/q/52524112
has answer: http://stackoverflow.com/a/75033147
has answer: http://stackoverflow.com/a/64478886
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/40335318
has answer: http://stackoverflow.com/a/66491131
score: 503
linked to: http://stackoverflow.com/q/55834845
tagged with: macos
linked to: http://stackoverflow.com/q/14292698
favorite count: 0
has answer: http://stackoverflow.com/a/64738183
has comment: http://stackoverflow.com/comment/114463500
accepted answer: http://stackoverflow.com/a/29195815
type: Question
tagged with: homebrew-cask
has answer: http://stackoverflow.com/a/77364238
has answer: http://stackoverflow.com/a/77934854
linked to: http://stackoverflow.com/q/64917779
has answer: http://stackoverflow.com/a/61918234
tagged with: jenv
has answer: http://stackoverflow.com/a/73930077
linked to: http://stackoverflow.com/q/3987683
has body: How can I install an additional java on MacOS? I installed jdk8 and that works fine. But now I need a jdk7 installation for development purposes. When trying to install the old version via DMG file, i get a warning, that there is already a newer version of java installed and the installer quits. /usr/libexec/java_home -verbose Matching Java Virtual Machines (1): 1.8.0_20, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home How to install jdk7 in addition to this one?
has answer: http://stackoverflow.com/a/65902419
has answer: http://stackoverflow.com/a/45134206
has answer: http://stackoverflow.com/a/70514924
tagged with: java
upvote count: 503
linked to: http://stackoverflow.com/q/19039752
has title: Mac OS X and multiple Java versions
possible better answer: http://stackoverflow.com/a/26252993
has answer: http://stackoverflow.com/a/60433293
has answer: http://stackoverflow.com/a/38471619
has answer: http://stackoverflow.com/a/49672875
has answer: http://stackoverflow.com/a/75440610
has answer: http://stackoverflow.com/a/26252993
has answer: http://stackoverflow.com/a/47699905
answer count: 22
has answer: http://stackoverflow.com/a/32662139
has answer: http://stackoverflow.com/a/64479569
has answer: http://stackoverflow.com/a/29195815
downvote count: 0
linked to: http://stackoverflow.com/q/6141180
has comment: http://stackoverflow.com/comment/130562233

http://stackoverflow.com/comment/41149680
type: Comment
comment on: http://stackoverflow.com/a/26234908
score: 0
type: AnswerComment
has text: Yes, I considered WL.Server.getActiveUser(). That could work, but it is in the JavaScript API, not Java, so I would need to getActiveUser in JavaScript and then pass it into the Java routine. That's reasonable in this situation but I was hoping there was a way to get at the session data in Java in general.

http://stackoverflow.com/q/26335959
type: Question
has comment: http://stackoverflow.com/comment/41335078
has body: I know there are two types of casting that are implicit and explicit castings. I read different questions on the StackOverflow such as this, this and this but I am still wondering what is the cost of casting in Java and is it a good idea to avoid it? What is the best practice for it? There are 2 types of casting: String s = "Cast"; Object o = s; // implicit casting Object o = someObject; String s = (String) o; // explicit casting In this second case, there is overhead in runtime, because the two type must be checked and in case that casting is not feasible, the JVM must throw a ClassCastException. Someone said it is better to profile the application to make sure casting is useful or not.
linked to: http://stackoverflow.com/q/2165246
has title: What is the cost of casting in Java? Is it a good idea to avoid it?
tagged with: casting
has answer: http://stackoverflow.com/a/26336192
downvote count: 0
score: 18
has answer: http://stackoverflow.com/a/26336807
has comment: http://stackoverflow.com/comment/41335099
has comment: http://stackoverflow.com/comment/41336312
has answer: http://stackoverflow.com/a/26337040
duplicate of: http://stackoverflow.com/q/17764092
has answer: http://stackoverflow.com/a/26336788
favorite count: 0
has answer: http://stackoverflow.com/a/26336850
answer count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2170872
has comment: http://stackoverflow.com/comment/41359358
has comment: http://stackoverflow.com/comment/41335305
has comment: http://stackoverflow.com/comment/41335379
linked to: http://stackoverflow.com/q/17764092
linked to: http://stackoverflow.com/q/8803517
tagged with: java
upvote count: 18
linked to: http://stackoverflow.com/q/383947

http://stackoverflow.com/comment/41303647
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26319105
has text: You need to post your main method or show the order your methods are called

http://stackoverflow.com/comment/41089531
type: AnswerComment
has text: Not completely true. An object of the derived class will return `true` if asked if it's an `instanceof` the base class.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26202272

http://stackoverflow.com/q/26224417
has comment: http://stackoverflow.com/comment/41166729
has comment: http://stackoverflow.com/comment/41159173
has comment: http://stackoverflow.com/comment/41152564
tagged with: comparison
has comment: http://stackoverflow.com/comment/41130734
has comment: http://stackoverflow.com/comment/41130521
has comment: http://stackoverflow.com/comment/41130368
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26246517
accepted answer: http://stackoverflow.com/a/26246517
has body: So I have two XML files that are being parsed for information. I'm trying to think of a way to determine what elements from one XML file are missing from the other XML file. Now currently the results for both XML files are loaded into two different arrays but this is not good because its a lot of data to hold on to. I need to somehow figure out what is missing from one file without loading all the data permanently into memory since the XML files in question can be very very large. Here is an example of the xml. Just imagine the other file is missing one of the weakness.I'm already using the SAX parser to get the actual data. <wakness status="new" severity="low" id="14876"> Title1 <tool code="STRING" category="PERFORMANCE" name="aaa"/> <rule name="Method invokes inefficient new String(String) constructor"/> <line end="93" start="93"/> stuff Title2 <tool code="PARAMETER" category="SECURITY" name="bbb"/> <rule name="Servlet parameters unsafe"/> Title3 <tool code="FINAL" category="asd" name="vvv"/> <rule name="Field isn't final and can't be protected from malicious code"/> <line end="56" start="56"/> stuff Note: I'm programming this in Java and Assume that the elements are not sorted. the two ideas that come to mind are the easy way of loading both sets and comparing one against the other which dosent solve the memory problem. The other one would be to keep parsing the xml over and over without storing things but then its very process inefficient.
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: sax
upvote count: 1
has comment: http://stackoverflow.com/comment/41131869
type: Question
has title: Comparing two sets of XML data without loading all the comparison data into memory
has comment: http://stackoverflow.com/comment/41130425
tagged with: algorithm

http://stackoverflow.com/comment/41329938
score: 0
type: AnswerComment
type: Comment
has text: mmm no , i change int for char and i havethe same problem
comment on: http://stackoverflow.com/a/26333171

http://stackoverflow.com/a/26363759
type: Answer
score: 3
has body: To LISTEN on a specific network interface, you specify that interface either via its IP address (IPv4 or IPv6) or its hostname. Since this is a variant of localhost / loopback, then using IP address would be best. Eg: $ grep localhost /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 127.0.1.0 test.localhost Yes, those hosts are on different IPs, intentionally (and valid for the loopback interface). You could then setup the connector, using the jetty-distribution, for test.localhost:8080 by using the command line (this is jetty 9 syntax) $ java -jar /path/to/start.jar jetty.host=127.0.1.0 jetty.port=8080 You can also put those command line options into your ${jetty.base}/start.ini as separate lines. $ grep -E "jetty\.(host|port)" /path/to/my.base/start.ini jetty.host=127.0.1.0 jetty.port=8080 Once jetty is started, you can see what interface it is listening on $ netstat -tlnp | grep 8080 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp4 0 0 127.0.1.0:8080 :::* LISTEN 14480/java
downvote count: 0
answers question: http://stackoverflow.com/q/26326436
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26326436
upvote count: 3
has comment: http://stackoverflow.com/comment/68685798

http://stackoverflow.com/q/26218630
tagged with: architecture
type: AnsweredQuestion
has title: Correct design to prevent blackscreen issue in JFrame
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/26218979
type: Question
tagged with: swingworker
has body: In my application I have a main frame window GUI, that launches a task in an executor service. The submitted task generates output and stores in a file on Disk. As soon as the o/p is generated GUI (observer) is informed of the o/p generated. Here the problem is I am keeping a wait loop inside the main frame and as soon as a notification is received, the main panel is repainted on the main frame. For small tasks this works fine, but as the size of the threaded task increases. The wait loop time increases and the GUI main window turns black till computations are done. Can you please help me in correcting the design. Also How can a SwingWorker thread help in this case.
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26219309
accepted answer: http://stackoverflow.com/a/26218979
has answer: http://stackoverflow.com/a/26219309
tagged with: jframe

http://stackoverflow.com/q/26274770
has answer: http://stackoverflow.com/a/26275094
accepted answer: http://stackoverflow.com/a/26275148
tagged with: java
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/26275148
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/41222402
has body: I need to have a static byte array in my Java code. public static final byte[] TRANSPARENT_GIF_PIXEL = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, (byte) 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x21, (byte) 0xf9, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x40, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3b }; In my tests, running locally via JUnit under Eclipse with Windows 7, TRANSPARENT_GIF_PIXEL.length gives me 43 which is what I expect. Now if I upload my code to my dev server (Debian), mvn package it and run it and now I get 35 instead of the 43 expected. I guess this has to do with the environment but I really don't know why this would differ as I explicitly defined 43 bytes in my code. How can I guarantee to have exactly what I expect no matter the environment?
has comment: http://stackoverflow.com/comment/41222620
answer count: 2
possible better answer: http://stackoverflow.com/a/26275094
upvote count: 0
favorite count: 0
tagged with: byte
has comment: http://stackoverflow.com/comment/41222910
type: AnsweredQuestion
has title: byte[] length not the same depending on environment

http://stackoverflow.com/a/26303890
has comment: http://stackoverflow.com/comment/41276294
accepted answer of: http://stackoverflow.com/q/26303835
upvote count: 3
has body: You are missing Commons HttpClient as a dependency. You should add this to your dependencies: test 'commons-httpclient:commons-httpclient:3.1' Also be sure to import the correct class on your source code: org.apache.commons.httpclient.HttpClient
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26303835
score: 3
downvote count: 0

http://stackoverflow.com/a/35278896
has body: Using of ArrayDeque instead of LinkedList makes it a little bit faster ... Queue&lt;Integer&gt; q = new ArrayDeque&lt;&gt;();
answers question: http://stackoverflow.com/q/26280894
score: 0
type: Answer

http://stackoverflow.com/q/26254306
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26254714
type: Question
has title: playframework invoke onError method inside Globaj.java object
tagged with: invoke
tagged with: onerror
has body: I am working with global object in Playframework. I've already created methods: onHandlerNotFound (to invoke I have to enter address which is unhandled in routes) onBadRequest to invoke I have to enter address with wrong time parameter, like: Users/edit/t. Method to edit user expects f.e. integer. It can't handle string I've created method onError: public Promise<SimpleResult> onError(RequestHeader request, Throwable t) { Logger.error("Request: " + request + "generated error: " + t.toString()); return Promise.<SimpleResult>pure(internalServerError( views.html.errorPage.render("500", "Errors occured") )); } But I would like to test it. Please tell me how can I invoke this method to test it?
upvote count: 1
answer count: 1
tagged with: global
favorite count: 0
tagged with: playframework-2.2
accepted answer: http://stackoverflow.com/a/26254714
type: AnsweredQuestion

http://stackoverflow.com/comment/41142883
comment on: http://stackoverflow.com/q/26231263
type: QuestionComment
has text: What did you get, if not ?
type: Comment
score: 0

http://stackoverflow.com/comment/41269041
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26299935
type: QuestionComment
has text: [Concise Explanation of Two-dimensional arrays](http://math.hws.edu/javanotes/c7/s5.html)

http://stackoverflow.com/comment/41220507
has text: Is this `request` `HttpServletRequest`?
type: Comment
comment on: http://stackoverflow.com/q/26273567
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41079869
comment on: http://stackoverflow.com/q/26197510
score: 0
type: QuestionComment
has text: possible duplicate of [Bringing tab to front in JTabbedPane](http://stackoverflow.com/questions/1235644/bringing-tab-to-front-in-jtabbedpane)
type: Comment

http://stackoverflow.com/q/26332802
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26334019
type: Question
has title: Avoid already exists validation on update and do update in Spring MVC
answer count: 1
tagged with: spring-mvc
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/26463055
accepted answer: http://stackoverflow.com/a/26334019
has body: I am creating a simple CRUD using Spring MVC. I am using same form for insert and edit. I have created a validation for name field, to check whether the value already exists. How can I avoid this on edit validation and how can I do an update? Here is the code ItemController.java @RequestMapping(method = RequestMethod.POST) public String processForm( @Validated ItemForm itemForm, BindingResult result, Map model) { if (result.hasErrors()) { model.put("typeList", dao.getItemTypes()); return "itemmaster"; } dao.insertItems(itemForm); return "redirect:dashboard"; } and this the jsp page <form:form action="itemmaster.html" commandName="itemForm"> Name: <c:choose> <c:when test="${not empty name}"> <form:input path="nameUpdate" /> <form:errors cssStyle="color:red" path="nameUpdate"/> </c:when> <c:otherwise> <form:input path="name" /> <form:errors cssStyle="color:red" path="name"/> </c:otherwise> </c:choose> Description: <form:textarea path="description" /> <form:errors path="description" cssStyle="color:red"/> </form:form> Thanks in advance.

data-structures
tags question: http://stackoverflow.com/q/26210484
tags question: http://stackoverflow.com/q/26238077
tags question: http://stackoverflow.com/q/26324902
tag name: data-structures
tags question: http://stackoverflow.com/q/26214041
tags question: http://stackoverflow.com/q/26202756
tags question: http://stackoverflow.com/q/26334698
tags question: http://stackoverflow.com/q/26271376
tags question: http://stackoverflow.com/q/26334186
tags question: http://stackoverflow.com/q/26305703
tags question: http://stackoverflow.com/q/26223572
tags question: http://stackoverflow.com/q/26232087
type: Tag
tags question: http://stackoverflow.com/q/26273304

http://stackoverflow.com/q/26319535
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/53472793
favorite count: 0
has body: Is there a way to enable the "Do not track" option for selenium using chromedriver? None of the command line switches seem to help and this website says that the option is disabled when run with chromedriver even though my regular Chrome profile has it turned on. I want to use a temporary profile and not load my existing one though. Suggestions? Can the option be set automatically?
answer count: 3
has answer: http://stackoverflow.com/a/51733489
accepted answer: http://stackoverflow.com/a/26456037
tagged with: selenium-chromedriver
upvote count: 2
has title: Enabling Do Not Track
tagged with: google-chrome
has answer: http://stackoverflow.com/a/26456037
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/51733489
tagged with: java

http://stackoverflow.com/comment/41081874
type: Comment
type: QuestionComment
has text: I'm pretty sure you need to be using an input stream reader rather than a file reader. Consult [this](http://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html).
comment on: http://stackoverflow.com/q/26198647
score: 0

http://stackoverflow.com/comment/41088661
type: Comment
has text: No, was just attempting to further clarify/restate what's going on. In particular, it's often not understood that the *allocation* of the object and it's *initialization* are two separate steps, and the *allocation* is largely hidden.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26202240

http://stackoverflow.com/q/26242492
has body: I have a Spring Boot app with Spring Data JPA (hibernate backend) repository classes. I've added a couple custom finder methods, some with specific @Query annotation to tell it how to get the data. I have already set up EhCache for the hibernate 2nd level cache, but so far, the only way I can get these results caching is to enable the hibernate query cache. I'd prefer to define a specific cache and store the actual domain objects there just as if it were a normal finder. Below is my repo code: public interface PromotionServiceXrefRepository extends PagingAndSortingRepository&lt;PromotionServiceXref, Integer&gt; { @Query("SELECT psx FROM Customer c " + "JOIN c.customerProductPromotions cpp " + "JOIN cpp.productPromotion pp " + "JOIN pp.promotion p JOIN p.promotionServiceXrefs psx " + "WHERE c.customerId = ?1") @QueryHints(@QueryHint(name = "org.hibernate.cacheable", value = "true")) @Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region = "promotionServiceXrefByCustomerId") Set&lt;PromotionServiceXref&gt; findByCustomerId(int customerId); } And here is the "promotionServiceXrefByCustomerId" cache I defined, that is NOT being used: &lt;cache name="promotionServiceXrefByCustomerId" overflowToDisk="true" diskPersistent="true" maxEntriesLocalHeap="3000000" eternal="true" diskSpoolBufferSizeMB="20" memoryStoreEvictionPolicy="LFU" transactionalMode="off" statistics="true"&gt; &lt;/cache&gt; What am I doing wrong? If I enable StandardQueryCache then this data gets cached there and hibernate does not execute a query. But when I disable the query caching, this does not get cached. What am I doing wrong here? PLEASE HELP!
answer count: 3
has answer: http://stackoverflow.com/a/26283080
has answer: http://stackoverflow.com/a/26299594
has comment: http://stackoverflow.com/comment/41164955
has comment: http://stackoverflow.com/comment/41165427
favorite count: 0
tagged with: ehcache
possible better answer: http://stackoverflow.com/a/26299594
has answer: http://stackoverflow.com/a/52680872
score: 34
accepted answer: http://stackoverflow.com/a/26283080
upvote count: 34
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
tagged with: hibernate
tagged with: spring-data
type: Question
has title: How to cache results of a Spring Data JPA query method without using query cache?
downvote count: 0
has comment: http://stackoverflow.com/comment/41177208
has comment: http://stackoverflow.com/comment/41197782

http://stackoverflow.com/a/26341737
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26341309
score: 1
has body: Building a SELECT statement to return arbitrarily selected columns can be tricky (dynamic SQL) at best and dangerous (SQL Injection) at worst. If there are only 50 columns and the query used to pull them is relatively trivial*, I'd say write the query to pull all possible values for one user and then have the application sift and sort through the data they actually want to see. *It really does seem like the query should be trivial. At a super-high average of 25 bytes per column that'd be 1250 bytes, aka nothing in 21st century terms, and at maybe one row per table joined via primary key it should still be sub-100th-second work.

http://stackoverflow.com/a/26366656
accepted answer of: http://stackoverflow.com/q/26289173
answers question: http://stackoverflow.com/q/26289173
type: Answer
score: 1
upvote count: 1
has body: One thing that solved my problem (to 90%) was to give up regex partially where String.indexOf() made more sense out of a performance perspective. This post inspired me: Quickest way to return list of Strings by using wildcard from collection in Java I wrote my own implementation since the one in the link handles only full words, while I'm dealing with sentences. It helped with wildcards "*" and pipes "hel(l|lo)" in the performance perspective, the former more than the latter. Reason for this direction was several recommendations, and it improved performance by cutting down time on 200000 sentences from 1.5 hour down to 15 minutes.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41097717
has text: Haha yeah I wrote the first part with the Thread.sleep() and then decided to try to teach the preferred way. I even purposely put in bold that the second way is definitely not necessary to accomplish something so simple... At the same time it was good practice for me to write the deltaTime calculator way :D. @user3658616, when you say it didn't work, did you try the first way? All it is doing is cycling through each character of "message" in the for loop and adding it to the labelMessage, and then sleeping in between. (and of course you have to set the label text equal to it each time.)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26204713
score: 0

http://stackoverflow.com/comment/60403831
type: AnswerComment
score: 0
type: Comment
has text: This should be a comment not an answer.
comment on: http://stackoverflow.com/a/28084498

http://stackoverflow.com/comment/41178312
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26250364
has text: Can you show the layout xml ?

http://stackoverflow.com/comment/41144534
type: AnswerComment
has text: I yearn for the day when computers are fast enough and we can afford to take a performance hit and simply use base 10 to represent floating points exactly (like BigDecimal in Java or decimal in C#) Floating point arithmetic is way more pain than it should be.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26232166

http://stackoverflow.com/a/67109469
answers question: http://stackoverflow.com/q/26269193
score: 0
has comment: http://stackoverflow.com/comment/118629952
type: Answer
has body: import <path>; My main java program: import method; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner n = new Scanner(System.in); int a,b,c; double area,s; System.out.print("Enter the 1st side->"); a = n.nextInt(); System.out.print("Enter the 2nd side->"); b = n.nextInt(); System.out.print("Enter the 3rd side->"); c = n.nextInt(); s=(a+b+c)/2.0; area = Math.sqrt(s*(s-a)*(s-b)*(s-c)); System.out.println("Area is = "+area); //factorial function is contained in the class method System.out.print(method.factorial(a)); } }
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/26274816
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41222907
type: Answer
has comment: http://stackoverflow.com/comment/41223362
answers question: http://stackoverflow.com/q/26274624
score: 1
has comment: http://stackoverflow.com/comment/41223795
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26274624
has comment: http://stackoverflow.com/comment/41223475
has comment: http://stackoverflow.com/comment/41222796
has body: It has not any problem with the static variables. It has the problem that your variables are integers. If you divide an integer with an integer, you will get an integer. Thus, if you divide 3/5, you will get 0 (as integer), and not 0.6. If you multiply this with 100, you will get 0, too. The simplest solution were to first multiply with 100 and divide only after that! So: myPercentValue = quantity1 * 100 / quantity2; So you will get what you wanted. In my example, first you multiplied 3 with 100, so you got 300, and after you divided that with 5, you will get 60 as you wanted. Or alternatively, you could use floating point or double types, either by declaring the variables as floating point, or converting them on the fly. This is what @Gustek 's comment suggested, and it can be a good solution, too. But these complex conversions are often practically unneeded. A simple change in the operation ordering will also do what you want.
has comment: http://stackoverflow.com/comment/41223439

fxml
tags question: http://stackoverflow.com/q/26322735
tags question: http://stackoverflow.com/q/26328040
tags question: http://stackoverflow.com/q/26329342
tags question: http://stackoverflow.com/q/26325403
tag name: fxml
type: Tag
tags question: http://stackoverflow.com/q/26327554

http://stackoverflow.com/comment/41351451
score: 0
comment on: http://stackoverflow.com/q/26344756
type: Comment
type: QuestionComment
has text: Added additional info. Thanks @LuiggiMendoza. Will try with json-path.

http://stackoverflow.com/comment/41092344
score: 0
has text: Short of casting, a `Visitor Pattern` is a fairly simply way to do this.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26204556

http://stackoverflow.com/comment/41162715
score: 0
type: Comment
has text: First please show your full pom file and not only excerpts..furthermore have you tried a `mvn clean package`?
type: QuestionComment
comment on: http://stackoverflow.com/q/26233776

http://stackoverflow.com/q/26219304
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/26219646
tagged with: java
tagged with: apache-zookeeper
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26219646
has title: start standalone zookeeper server in java
has body: I am not able to figure out how to start zookeeper standalone server in java ? I know how to start the server with command line. I looked into the documentation of zookeeper but couldn't able to find anything related to this.

http://stackoverflow.com/comment/41263971
has text: But it's present in the JSON?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26297312

http://stackoverflow.com/q/26314029
tagged with: java
has body: im trying to create a login in my app, but everytime i login always unknown error, no error code in my logcat, and my logcat stopped at D/ZZZ﹕ ONCREATE LOGIN, can anyone help me solving this problem. this my code public class LoginTask extends AsyncTask <String, Void, Integer> { private final String LOG_TAG = LoginTask.class.getSimpleName(); private String cookiesave, user, pwd; private final String USERNAME = "txtUser"; private final String PASSWORD = "txtPassword"; private final String HTTP_URL = "http://10.0.2.2/gcm/index.php"; private final int UNKNOWN_ERROR = 0; private final int INVALID_LOGIN = 1; private final int SUCCESS_LOGIN = 2; private final int SERVER_ERROR = 5; private Context mContext; private TextView tvErr; private ProgressDialog pDialog; SharedPreferences preferences; public LoginTask (Context context, TextView tv){ mContext = context; tvErr = tv; } @Override protected void onPreExecute() { pDialog = new ProgressDialog(mContext); pDialog.setTitle("Signing in"); pDialog.setMessage("Please Wait..."); pDialog.setCancelable(false); pDialog.setIndeterminate(false); pDialog.show(); } @Override protected Integer doInBackground(String[] params) { // Untuk penyimpanan lokal (username, cookie, dsb) preferences = mContext.getSharedPreferences(Config.PREFERENCES, Context.MODE_PRIVATE); user = params[0]; pwd = params[1]; // Koneksi ke server DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(HTTP_URL); try { List<NameValuePair> loginList = new ArrayList<NameValuePair>(2); loginList.add(new BasicNameValuePair(USERNAME, user)); loginList.add(new BasicNameValuePair(PASSWORD, pwd)); httppost.setEntity(new UrlEncodedFormEntity(loginList)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); StatusLine statusLine = response.getStatusLine(); Log.d("ZZZ", "ONCREATE LOGIN"); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { List<Cookie> cookies = httpclient.getCookieStore().getCooki…
has comment: http://stackoverflow.com/comment/41295390
type: Question
has comment: http://stackoverflow.com/comment/41295061
answer count: 1
has title: android login unknown error
has comment: http://stackoverflow.com/comment/41295079
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41295215
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26314422
tagged with: authentication
tagged with: php
has comment: http://stackoverflow.com/comment/41295124

http://stackoverflow.com/q/26315437
favorite count: 0
type: UnansweredQuestion
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
score: 2
upvote count: 2
tagged with: java
type: Question
has body: Below is the code import java.io.File; import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.xml.sax.SAXException; public class XMLValidation { public static void main(String[] args) { System.out.println("request.xml validates agains xsd "+validateXMLSchema("request.xsd", "request.xml")); } public static boolean validateXMLSchema(String xsdPath, String xmlPath){ try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema; try { schema = factory.newSchema(new File(xsdPath)); Validator validator = schema.newValidator(); validator.validate(new StreamSource(new File(xmlPath))); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); return false; } } catch (IOException e) { System.out.println("Exception: "+e.getMessage()); } return true; } Below is the error that i get when i validate against the request xml and request xsd: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'soapenv:Envelope'. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1887) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumen…
has answer: http://stackoverflow.com/a/26315602
has title: unable to resolve org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'soapenv:Envelope'
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26332527
has answer: http://stackoverflow.com/a/26332572
has title: Class constant final variable
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26332621
possible better answer: http://stackoverflow.com/a/26332540
tagged with: java
type: Question
has body: This is my code. I need wordOfTheDay and answer to stay the same. I need a user to input an answer for "What is the word of the day" and "What is the answer to 3*8" and depending on their answer it will either be accepted as the correct answer or rejected and they try again. I keep getting this compiler error Error: cannot assign a value to final variable wordOfTheDay Error: cannot assign a value to final variable answer //The word of the day is Kitten import java.util.Scanner; public class SchmeisserKLE41 { public static final Scanner input = new Scanner(System.in); public static final String wordOfTheDay = "Kitten"; public static final int answer = 24; public static void main(String[] args) { int attempts = 3; System.out.printf("Please enter the word of the day:"); wordOfTheDay = input.nextLine(); do{ -- attempts; if(attempts == 0){ System.out.printf("Sorry! You've exhausted all your attempts!"); break; } System.out.printf("Invalid! Try again %d attempt(s) left.", attempts); wordOfTheDay = input.nextLine(); } while(!wordOfTheDay.equals("Kitten")); System.out.printf("\nWhat is the answer to 3 * 8?"); answer = input.nextInt(); System.exit(0); } }
tagged with: variables
score: 0
answer count: 3
tagged with: class-constants
has answer: http://stackoverflow.com/a/26332621
tagged with: final
has answer: http://stackoverflow.com/a/26332540

http://stackoverflow.com/a/26237070
score: 0
has comment: http://stackoverflow.com/comment/41154107
type: Answer
has comment: http://stackoverflow.com/comment/41153321
has comment: http://stackoverflow.com/comment/41153508
has comment: http://stackoverflow.com/comment/41154052
has comment: http://stackoverflow.com/comment/41153251
has comment: http://stackoverflow.com/comment/41153761
answers question: http://stackoverflow.com/q/26236459
has body: I think what you need isEclipseLink library for FetchGroup public Division findDivChildren(Integer id) { Division result = null; FetchGroup group = new FetchGroup("divChildren"); group.addAttribute("_id"); group.addAttribute("_children"); Query q = em.createQuery("Select d from Division d where d.id = :id").setParameter("id", id); q.setHint(QueryHints.FETCH_GROUP, group); result = q.getSingleResult() return (result); } This will return the division specified by the id, with only the _id and _children field supplied. This will drastically reduce the sql log because it will not grab the _parent Division (which would then select all of its children + parents etc...)
has comment: http://stackoverflow.com/comment/41153554

http://stackoverflow.com/q/26262186
has answer: http://stackoverflow.com/a/26262308
has title: Big O notation (Complexity)
tagged with: big-o
tagged with: complexity-theory
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41199555
has answer: http://stackoverflow.com/a/26262266
has comment: http://stackoverflow.com/comment/41199428
tagged with: java
has answer: http://stackoverflow.com/a/26262391
type: Question
has answer: http://stackoverflow.com/a/26262251
has answer: http://stackoverflow.com/a/26262268
score: 0
has body: What is the Big O of this loop? -> i understand that the loop itself is going to execute n times. But the task inside of the loop also executes n times right? So would that make this a O(n^2) or do i not combine them and its a simple O(n)? I personally think it is just O(n) because that is how many times the loop is executing but i would just like some clarification as to why or why not it would be? Any explanations would be helpful as i prepare for my midterm. for(int i = 0; i &lt; a.length;i++){ a[i] = b[i] }

http://stackoverflow.com/a/26216220
type: Answer
has body: If I understood you problem correctly, you need to change this line System.out.println(min + userArray[i] + max); to this: System.out.println(min.toString() + " " + userArray[i].toString() + " " + max.toString()); My guess is, that it is java you are using. That tag would be helpful, too. Edit: You only need to sort your array once, and these do nothing: Integer.toString(min); So the print routine could look like this: selectionSort(userArray); for (int i = 0; i &lt; userArray.length; i++) { System.out.println(min.toString() + " " + userArray[i].toString() + " " + max.toString()); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41114511
accepted answer of: http://stackoverflow.com/q/26215947
score: 0
has comment: http://stackoverflow.com/comment/41120879
answers question: http://stackoverflow.com/q/26215947

http://stackoverflow.com/comment/41207155
has text: just a dot will match any character, as expected: http://stackoverflow.com/questions/1480284/java-regular-expression-value-split-the-back-slash-dot-divides-by-char
type: AnswerComment
comment on: http://stackoverflow.com/a/26266175
type: Comment
score: 1

http://stackoverflow.com/comment/41210575
comment on: http://stackoverflow.com/a/26267936
type: AnswerComment
score: 0
type: Comment
has text: just because it doesn't require you to, doesn't mean that you can't. It just means that now you have a choice. But if you actually do utilize that choice, the program breaks.

http://stackoverflow.com/comment/41124200
has text: Be more specific about what the problem is. Just telling us that it doesn't work means we have to wildly guess as to what the problem could possibly be. It doesn't compile? What does the compiler tell you? Or does it compile but encounters an exception? What is the exception? Where? Or does it run but the output was not what you expected it to be? What did you expect it to be? Please take some time to add details to your question so that we can most effectively help you.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26221273
score: 0

http://stackoverflow.com/comment/41101182
type: QuestionComment
score: 0
has text: An array of boolean maybe? A method can only ever return one thing so if you want multiple booleans, return an array of them.
comment on: http://stackoverflow.com/q/26209159
type: Comment

http://stackoverflow.com/comment/41361057
has text: I'm new to this JDBC sorry. I'm still not quite sure what this means. I have added a dependency for connector/j in my pom.xml but that is about it
comment on: http://stackoverflow.com/a/26350315
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26337042
has comment: http://stackoverflow.com/comment/41337198
has comment: http://stackoverflow.com/comment/41337100
has body: Mr. Chaotic again. You have not even posted the right error message. For your pointcut the error message should be: This advice must return void. And that is exactly what must be changed. Do you ever read error messages? @Before("call(* myhobby(..)) &amp;&amp; args(name)") public void callFrom(String name) { System.out.println("value is: " + name); } No need for any getArgs() overhead.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26334380
has comment: http://stackoverflow.com/comment/41337315

http://stackoverflow.com/comment/41104976
comment on: http://stackoverflow.com/q/26211107
type: Comment
type: QuestionComment
has text: use `SpannableString[Builder]` and call `setSpan()` with `URLSpan` object, alsp you can use `Linkify.addLinks(Spannable text, ...)`
score: 1

http://stackoverflow.com/comment/41293802
comment on: http://stackoverflow.com/q/26313439
score: 0
type: Comment
type: QuestionComment
has text: Will you update ur question with DB schema ?

http://stackoverflow.com/q/26241949
answer count: 1
has body: i'm working with Json in Android and this is the json that I recived: [ { "0": "5", "1": "CorpoSA", "2": "CorpoSA", "3": "http://162.243.229.85/images/CORPO%20SA%20logo.jpg", "id": "5", "title": "CorpoSA", "description": "CorpoSA", "img_url": "http://162.243.229.85/images/CORPO%20SA%20logo.jpg" }, { "0": "6", "1": "CorpoSA2", "2": "CorpoSA2", "3": "http://162.243.229.85/images/home.jpg", "id": "6", "title": "CorpoSA2", "description": "CorpoSA2", "img_url": "http://162.243.229.85/images/home.jpg" } ] I have it in a String named result, but i dont know how to extract the id, title, description and url and for save at database. When i use: JSONObject json = new JSONObject(result); and then json.getJSONObject("id"); this does not worki, plx someone help me
has answer: http://stackoverflow.com/a/26242205
has title: Working with Json in Android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41163497
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/26242205
tagged with: android

http://stackoverflow.com/comment/90359667
comment on: http://stackoverflow.com/a/51669658
has text: It depends on the situation(every bean classes are under `test` package, so it does not matter) As far as I know, scanning too much package effects on application startup time. - I could not find the link, but if I am wrong, feel free to reply
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26194803
tagged with: doubly-linked-list
has body: I have been trying to utilize my previous made singly linked list to create a doubly linked list. So, in the Node class I added a previous node reference and updated the add and insert methods in the List class to accommodate going back and forth within the DoublyLinked list class. add puts the new node after the current node and insert puts the new node before the current node in the List class; this is because I want to add and insert my values in ascending order within the DoublyLinked list class. [This may sound confusing but I will post the code below] When I test my add method [in the DoublyLinked class] I get a null pointer exception. As I said I have been working on this for a few days, so in that time I have taken in consideration these previous questions: How do I change a singly-linked list to a doubly-linked list? Singly linked list to doubly linked list Null pointer when using doubly linked list List.java public class List&lt;T&gt; implements ListInterface&lt;T&gt; { protected class Node { private T value = null; private Node prev = null; private Node next = null; public T getValue( ) { return value; } public Node getPrev( ) { return prev; } public Node getNext( ) { return next; } public void setValue( T newValue ) { value = newValue; } public void setPrev( Node prevNode ) { prev = prevNode; } public void setNext( Node nextNode ) { next = nextNode; } } protected Node head = null; protected Node cur = null; protected int size = 0; // add after cur @Override public void add( T value ) { Node temp = new Node( ); temp.setValue( value ); size++ ; if (isEmpty( )) { head = temp; cur = temp; } else { temp.setNext(cur.getNext()); temp.setPrev(cur); cur.setNext(temp); cur = temp; } } // insert before cur @Override public void insert( T value ) { Node temp = new Node( ); temp.setValue( value ); size++ ; if (isEmpty( )) { head = temp; cur = temp; } else if (head == cur) { head = temp; head.setNext( cur ); cur.setPrev(head); cur = head; } else { Node prev = head; wh…
upvote count: 1
type: AnsweredQuestion
tagged with: list
tagged with: linked-list
score: 1
tagged with: java
tagged with: nodes
type: Question
has title: Creating a Doubly Linked List from extending from a Singly Linked List - getting Null Pointer
linked to: http://stackoverflow.com/q/18771808
has answer: http://stackoverflow.com/a/26194828
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/21224445
favorite count: 0
linked to: http://stackoverflow.com/q/4208579
accepted answer: http://stackoverflow.com/a/26194828

http://stackoverflow.com/q/26312576
has answer: http://stackoverflow.com/a/26312895
type: Question
has comment: http://stackoverflow.com/comment/41291892
has comment: http://stackoverflow.com/comment/41292495
tagged with: string
has body: Lets say I have 3 strings String string1 = "THE SUM OF TWO" String string2 = "HOT SUMMER" String string3 = "SUM IN SUMMER" Now, I search for strings which have "SUM" and not "SUMMER". String patt = ".*?SUM.*?" String notpatt = ".*?SUMMER.*?" Pattern regex = Pattern.complie(patt) Pattern nonregex = Pattern.complie(notpatt) looping through each string here if(regex.matcher(string1).matches()){ if(nonregex.matcher(string1).matches()){ System.out.println(false); } else{ System.out.println(true); } } Now, I need to get true for string3, where it has 'SUM' in it. But, as it also have 'SUMMER' it's giving me false. Is there any library that I can use? or Is there any other way to get my expected result? Thanks, Prithvi.
score: 0
tagged with: regex
has title: Java regex string matching (like and not like)
has comment: http://stackoverflow.com/comment/41291776
answer count: 4
has answer: http://stackoverflow.com/a/26312755
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26312730
tagged with: java
has answer: http://stackoverflow.com/a/26312757

http://stackoverflow.com/q/26257182
downvote count: 0
tagged with: generics
has answer: http://stackoverflow.com/a/26257317
favorite count: 0
has answer: http://stackoverflow.com/a/26257218
has title: Java Generics error: Cannot convert from E to E?
has body: public class PriorityQueue&lt;E&gt; { private E[] array; private int size; private int front; private int back; private int numOfElements = 0; private static int EMPTY = 0; public &lt;E&gt; int insert(E input) { if (numOfElements + 1 &lt;= size) { array[back] = input; back++; numOfElements++; } return 0; } For some reason, I'm getting a compilation error that says that I can't convert my input file, which is of type E, into type E. Why is this? Is it because It's not technically the same type E?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41189833
type: Question
accepted answer: http://stackoverflow.com/a/26257218
answer count: 2
possible better answer: http://stackoverflow.com/a/26257317

http://stackoverflow.com/q/26263318
has comment: http://stackoverflow.com/comment/41204151
upvote count: 1
has comment: http://stackoverflow.com/comment/41203699
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41204748
score: 1
has comment: http://stackoverflow.com/comment/41203943
tagged with: java
has answer: http://stackoverflow.com/a/26264480
has comment: http://stackoverflow.com/comment/41205425
has title: running java class from jar in coldfusion - NoClassDefFoundError
type: Question
has comment: http://stackoverflow.com/comment/41204671
has answer: http://stackoverflow.com/a/26266168
answer count: 2
has comment: http://stackoverflow.com/comment/41207130
tagged with: coldfusion-11
possible better answer: http://stackoverflow.com/a/26264480
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26266168
tagged with: coldfusion
has body: I am completely stuck on this. I don't understand cold fusion enough and cant find an answer to this to know whats going wrong. Here is the portion of my coldfusion script that is the problem, using generic names for things here function run() { var obj = createObject("java", "com.company.Run"); var variable1= "string1"; var variable2= "string2"; var variable3= "string3"; obj.init(); var success = obj.runThis(variable1, variable2, variable3); <-- failing here return success; } <cfset success = run()> SUCCESS? #success# The java code that this accessed is in a jar, which is compiled and works for simple methods inside that class. for example, i can do this, using the java code below the coldfusion script and it works without a single problem: function run() { var obj = createObject("java", "com.company.Run"); var variable= "string"; obj.init(); var success = obj.print(variable); <-- failing here return success; } <cfset success = run()> SUCCESS? #success# public static String print(String input) { return input; } What I am trying to get running is my first cold fusion script above with this sort of idea, inside this class it is running "runThis" which constructs an object from another class and then runs a method from that object which returns a string. These are both in the same jar so should all be accessible and run fine when I run just junit tests against the exact same code. the issue here is pulling it into coldfusion and running it there: public class Run { public Run() { } public String runThis(String variable1, String variable1, String variable3) throws Exception { try { MyObject object= new MyObject (variable1, variable2, variable3); return object.execute(); } catch (Exception e) { return "error"; } } } the error I am receiving: "Error","http-bio-8500-exec-7","10/08/14","10:47:13",,"javax/ws/rs/WebApplicationException The specific sequence of files included or processed is: C:\ColdFusion11\cfusion\wwwroot\company\response.cfm, line: 77 " java.lang.NoClassDe…

http://stackoverflow.com/comment/41250602
type: Comment
comment on: http://stackoverflow.com/q/26289394
type: QuestionComment
score: 0
has text: @Leo, not on windows its on linux machine.

http://stackoverflow.com/q/26324708
has comment: http://stackoverflow.com/comment/41314657
has title: Can source code files with different encoding coexist in (the same) Java (project in Eclipse)?
tagged with: java
has body: I know Java uses UTF-16 internally and expects .properties files to be in ISO-8859-1 by default. I'm currently working on a project that was written in Eclipse, whose default encoding on our systems is cp-1252. I'm thinking utf-8 would be a much more sensible option, going forward. However, given the scale of the project (it's split up into modules and uses libraries from all over the place), I can't just batch-convert all source code files in one go. Will Java have a problem with some files in a project being in one encoding and some in another? (Clearly, having entire libraries written in encodings that are different from one another doesn't seem to be a problem - probably because they are all UTF-16 once compiled, anyway.) Would Eclipse be able to handle that (i.e. different encodings per file) correctly?
tagged with: cp1252
linked to: http://stackoverflow.com/q/9699071
has comment: http://stackoverflow.com/comment/41314952
tagged with: eclipse
has answer: http://stackoverflow.com/a/26327908
type: Question
tagged with: encoding
has comment: http://stackoverflow.com/comment/41314792
score: 0
answer count: 1
tagged with: utf-8
type: UnansweredQuestion

http-redirect
tags question: http://stackoverflow.com/q/26343567
type: Tag
tags question: http://stackoverflow.com/q/26345969
tags question: http://stackoverflow.com/q/26238887
tags question: http://stackoverflow.com/q/26304247
tag name: http-redirect
tags question: http://stackoverflow.com/q/26305917

http://stackoverflow.com/comment/41324479
type: AnswerComment
comment on: http://stackoverflow.com/a/26330208
has text: Did you copypaste the code from my answer or did you make all the changes I have made? Because it works for me.
type: Comment
score: 0

http://stackoverflow.com/a/26343627
type: Answer
has comment: http://stackoverflow.com/comment/41541314
has body: The project I had used it in doesn't seem to exist any longer here. It was just a temporary test project. We decided not to use Proguard eventually. However, I used the proguard-maven-plugin and created my POM according to its Usage section in conjunction with the ProGuard manual.
answers question: http://stackoverflow.com/q/26322432
score: 0

http://stackoverflow.com/q/26333492
upvote count: 1
answer count: 1
favorite count: 0
has body: I am working on an application where I have to consolidate data from clients into a central DB. The problem is that how can I monitor any data changes (save, update, delete) on clients in real time. I there any way out for that? I am using Hibernate for data fetching from clients in batches. Checking every row of data and comparing it cell-wise with central DB is not practical. There are about 25 tables that I have to work on. Appreciate any help or hint. Regards
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26333608
type: Question
score: -1
has title: Monitoring changes in db2 on client side and updating DB on server accordingly
has answer: http://stackoverflow.com/a/26333608
downvote count: 2

http://stackoverflow.com/comment/41320884
has text: Makes a lot of sense, I was really confused on how to say not equals with a String. Thanks a lot!
type: AnswerComment
comment on: http://stackoverflow.com/a/26320040
score: 0
type: Comment

http://stackoverflow.com/q/26264784
score: 4
has answer: http://stackoverflow.com/a/26265633
favorite count: 0
tagged with: netbeans
has title: NetBeans - How to show all Swing components in a JFrame?
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41204524
has body: I'm making a Swing GUI with NetBeans, using the built-in form maker, which works quite well. However, if I accidentally put the wrong panel on a form, I have no way to delete it, or select it again. Likewise, if I want a button to open a new window, say, a file chooser, I don't know how to add that file chooser to the form, but not have it appear until the button is pressed. Does anyone have any experience with the NetBeans Swing form builder? This seems like a common thing to have to do, but I don't see how to do it. Am I missing something?
accepted answer: http://stackoverflow.com/a/26265633
tagged with: java
type: Question
upvote count: 4
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41204482

http://stackoverflow.com/comment/41350947
score: 0
comment on: http://stackoverflow.com/q/26344640
type: Comment
type: QuestionComment
has text: The class is available in my project.. I have built it before just fine.. Leistungsabfall answer fixed it but I think it will show up again like it did yestarday

http://stackoverflow.com/q/26195726
score: 2
has title: Java methods that get to wait somehow and that throw InterruptedException
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/26195806
has comment: http://stackoverflow.com/comment/41077264
has comment: http://stackoverflow.com/comment/41077157
type: Question
has comment: http://stackoverflow.com/comment/41077313
has comment: http://stackoverflow.com/comment/41076633
has body: I'm looking for a list of methods that throw an InterruptedException. So far, I've got sleep() &amp; join() of Thread and wait() of Object. Are there any others anywhere in Java that throw an InterruptedException or this is it? Note: I'm not asking anything else about Java interrupts. just looking to get the comprehensive list. //===================================== EDIT: rephrasing the Q for a bit more: "the methods that throw an InterruptedException in Java are those invoking wait(), join() and sleep() of Object and Thread. These 3 methods are the "roots" of Java interrupts." is this statement true?
has comment: http://stackoverflow.com/comment/41076623
tagged with: interrupt
has answer: http://stackoverflow.com/a/26195765
has comment: http://stackoverflow.com/comment/41077225
answer count: 3
has answer: http://stackoverflow.com/a/26195806
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41076862
has answer: http://stackoverflow.com/a/26195870
accepted answer: http://stackoverflow.com/a/26195870
type: AnsweredQuestion

http://stackoverflow.com/q/26227344
upvote count: 23
tagged with: startup
type: Question
has comment: http://stackoverflow.com/comment/41136643
tagged with: ubuntu
has answer: http://stackoverflow.com/a/33082436
has comment: http://stackoverflow.com/comment/53822507
tagged with: security
score: 20
answer count: 2
linked to: http://stackoverflow.com/q/17118705
has comment: http://stackoverflow.com/comment/41144540
has answer: http://stackoverflow.com/a/33054444
tagged with: tomcat
favorite count: 0
has title: Oracle Java 8 x64 for Linux and RandomSource
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/53820197
has comment: http://stackoverflow.com/comment/53931440
has body: I really thought that after about 200 or more tomcat installs on various platforms, I am ready for any kind of challenge but this one is tricky. I created a vanilla Ubunutu 14_04 image and installed Java 8 TGZ from oracle on that system. Furthermore I added a tomcat 8 to the game. Then I started the vanilla server install. Soon after hanging on deploying the default apps shipped with tomcat, I wondered whats happening there and did some threaddumps. This one was the lousy thread who prevented tomcat from starting: "localhost-startStop-1" #15 daemon prio=5 os_prio=0 tid=0x00007f37c8004800 nid=0x4d6 runnable [0x00007f37b38b3000] java.lang.Thread.State: RUNNABLE at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:246) at sun.security.provider.SeedGenerator$URLSeedGenerator.getSeedBytes(SeedGenerator.java:539) at sun.security.provider.SeedGenerator.generateSeed(SeedGenerator.java:144) at sun.security.provider.SecureRandom$SeederHolder.&lt;clinit&gt;(SecureRandom.java:192) at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:210) - locked &lt;0x00000000f06e6ce8&gt; (a sun.security.provider.SecureRandom) at java.security.SecureRandom.nextBytes(SecureRandom.java:457) - locked &lt;0x00000000f06e71c0&gt; (a java.security.SecureRandom) at java.security.SecureRandom.next(SecureRandom.java:480) at java.util.Random.nextInt(Random.java:329) at org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom(SessionIdGeneratorBase.java:234) After more google &amp; friends i discovered that the SeedGenerator shipped with the JDK is the source of my problem. Interestingly sometimes the SeedGenerator came back after several minutes and sometimes it just hung (running out of entropy? ... checked via cat /proc/sys/kernel/random/entropy_avail) . After more research I found out that a config variable in $JAVA_HOME$/lib/security/java.security called securerandom.source defines what the source for Random is. In my ca…
has comment: http://stackoverflow.com/comment/53931506
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/41362445
type: Comment
type: QuestionComment
has text: Well the `Date` and `Time` values are of concern
comment on: http://stackoverflow.com/q/26350595
score: 0

http://stackoverflow.com/q/26312083
has title: Subclass cant have parent exception of superclass
has body: I read that Subclass method cant have parent exception of superclass method. In exception hierarchy, ArithmeticException is derived from RuntimeException right? so the folowing code should give compile error. But its not giving..Can any one tell me why? class Cafe { void f() throws ArithmeticException{ throw new ArithmeticException(); } } class Coffee extends Cafe { void f() throws RuntimeException{ System.out.println("hi"); } public static void main(String[] args)throws ArithmeticException{ Cafe c=new Cafe(); c.f(); } }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26312138
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26312138
type: Question
accepted answer: http://stackoverflow.com/a/26312137
downvote count: 0
tagged with: overriding
answer count: 2
tagged with: exception
favorite count: 0
has answer: http://stackoverflow.com/a/26312137
upvote count: 1

http://stackoverflow.com/q/26308476
has answer: http://stackoverflow.com/a/26331380
has comment: http://stackoverflow.com/comment/41326244
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41286409
type: Question
has comment: http://stackoverflow.com/comment/41326205
tagged with: java
possible better answer: http://stackoverflow.com/a/26331422
has answer: http://stackoverflow.com/a/26331422
score: 0
has body: I am making a program for a class. The Idea is to display an image and up/down the contrast. Here is the example. I am able to make the image come up and a grey bar comes up above the image like in the example, but my buttons are not there. I am not sure how to properly do that through FlowLayout, or if I need to use another Layout. I'm new to GUI's, so any help would be appreciated! This is how mine looks. What am I doing wrong? import javax.imageio.ImageIO; import javax.swing.*; import java.util.*; import java.io.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.applet.Applet; /** * This class extends JPanel and can load an image to its * original size. * * @author Dahai Guo * */ class ImagePanel extends JPanel{ private BufferedImage image; public ImagePanel(BufferedImage image){ this.image=image; } /** * Draws the image. */ public void paintComponent(Graphics g){ super.paintComponent(g); g.drawImage(image,0,0,image.getWidth(),image.getHeight(),this); } } /** * Object of this class can load an image and enable the user * to increase and decrease the contrast of the image. * * Note this class can only deal with the contrast of gray levels * * @author Dahai Guo * */ public class HistgramEqualizerApp extends JFrame { int count=0; private FlowLayout myLayout; private BorderLayout borderLayout; private ImagePanel imagePanel; private JButton increaseContrastButton; private JButton decreaseContrastButton; private BufferedImage image; /** * Cummulative density function */ private int [] cdf=new int[256]; /** * The current largest gray level. */ private int imageMaxGrayLevel=0; /** * The current smallest gray level. */ private int imageMinGrayLevel=300; /** * The smallest nonzero cell in the CDF of gray level * of the image. */ private int minCdfValue; /** * The largest gray level when the image is first loaded. */ private int originalImageMaxGray; /** * The smallest gray level when the image is first loaded. */ private int originalImageMi…
answer count: 2
tagged with: layout
tagged with: user-interface
has comment: http://stackoverflow.com/comment/41326487
tagged with: button
has comment: http://stackoverflow.com/comment/41326295
accepted answer: http://stackoverflow.com/a/26331380
has title: Buttons will not show up in FlowLayout

http://stackoverflow.com/q/26249545
has comment: http://stackoverflow.com/comment/41176813
favorite count: 0
has body: Requirements: I need to accept a string as an argument prints out the first link it find returns an integer that is the index of the link End or -1 if no links are found. An if statement if it does not find "href" in the string it will return the integer, An if statement to return the -1 before the substring method will keep from getting an index out of bounds error. The display need to return all the http sites in the string. I believe i am very close, here is my code: public class LinkList { public static void main(String[] args) { String htmlCode = (a long string with all my url links) int linkStart = 0; int endLink = 0; while (true) { linkStart = hrefSearch(htmlCode); if(linkStart == -1) break; htmlCode = htmlCode.substring(linkStart); } } public static int hrefSearch (String inStr) { String find = " href="; String closingBracket = "&gt;"; int index = inStr.indexOf(find); if (index != -1){ int closing = inStr.indexOf(closingBracket, index); if (closing != -1){ System.out.println(inStr.substring (index, closing + 1)); } } return index; }} How can i get my program to stop looping and display all the urls in my string?
has answer: http://stackoverflow.com/a/26249665
score: -3
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26249665
has title: URL parsing program does not stop looping
has comment: http://stackoverflow.com/comment/41176810
downvote count: 4
has comment: http://stackoverflow.com/comment/41176835
answer count: 1
has comment: http://stackoverflow.com/comment/41176786

http://stackoverflow.com/comment/41155555
score: 1
comment on: http://stackoverflow.com/q/26238275
type: Comment
type: QuestionComment
has text: @learner, check the very first error -- that's your problem. Here's a hint: line 12 of ThreadDemo.java.

http://stackoverflow.com/a/26255763
upvote count: 1
score: 1
has body: You can do that by placing annotation Entity(dynamicInsert=true, dynamicUpdate=true) for each class for which you don't want query to be generated on startup. This is lengthy coding part. But will be helpful if you want that. Reference: Hibernate Recipe book. But this has performance issues at runtime here: Why does Hibernate set dynamic insert=false by default Here is another link: @DynamicInsert @DynamicUpdate does not work?
answers question: http://stackoverflow.com/q/26255313
downvote count: 0
has comment: http://stackoverflow.com/comment/41188029
type: Answer

http://stackoverflow.com/a/26244222
type: Answer
answers question: http://stackoverflow.com/q/26243294
has body: The types used should be the product of a deep thought about various of things, including (but not limited to) int over long (32bit vs 64bit), char over byte (user friendliness vs performance) , complex data structures over simple ones (Performance), backwards compatibility (JRE version), platforms the program's gonna run on (Windows? Unix? Mac OS?), readability of the code (Sometimes writing "byte x = 0xFF; char ch = (char)x; is worse than char ch = 'a' and the list goes on... of course some of the stuff I mentioned fit into more than one category. This usually comes with experience. The more you code, the more platforms you want to support, the faster you want your program to respond etc... You should always have a plan regarding your program: What platforms will I support? Is the task more important than performance? ... ... I'm not saying you should carefully consider every type you choose, I'm saying you should always make the effort to tick all the V's and be satisfied about it, accomplishing everything you wanted.
score: 0

http://stackoverflow.com/comment/41359066
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26349099
type: AnswerComment
has text: this answer has been flagged as low quality answer, please provide some explanation.

http://stackoverflow.com/a/26214609
type: Answer
upvote count: 1
has body: Consider You have a form as below: &lt;form action="/test/dbOperation" method="POST"&gt; &lt;input type="text" id="title" name="title"&gt; &lt;input type="text" id="description" name="description"&gt; &lt;input type="text" id="likes" name="likes"&gt; &lt;input type="text" id="url" name="url"&gt; &lt;input type="text" id="by" name="by"&gt; &lt;button type="submit" value="Submit"&gt; &lt;/form&gt; Now in Spring you can use annotation to make a class as Controller where you need to handle the request @Controller @RequestMapping("/test") public class formCntrl { @RequestMapping(value = "/dbOperation", method = RequestMethod.POST) public @ResponseBody String (HttpServletResponse resp, @RequestParam("title") String title, @RequestParam("description") String description, @RequestParam("likes") int likes, @RequestParam("url") String url, @RequestParam("by") String by) { try{ // To connect to mongodb server MongoClient mongoClient = new MongoClient( "localhost" , 27017 ); // Now connect to your databases DB db = mongoClient.getDB( "cms" ); System.out.println("Connect to database successfully"); boolean auth = db.authenticate(myUserName, myPassword); System.out.println("Authentication: "+auth); DBCollection school = db.getCollection("school"); System.out.println("Collection mycol selected successfully"); BasicDBObject doc = new BasicDBObject("title", title). append("description", description). append("likes", likes). append("url", url). append("by", by); school.insert(doc); System.out.println("Document inserted successfully"); }catch(Exception e){ System.err.println( e.getClass().getName() + ": " + e.getMessage() ); } } } Generally its not a good deal to mix up the database logic in controller. Use Spring MVC where in you can have DAO layer which provides separation of database logic with business logic. Hope it helps.
score: 1
accepted answer of: http://stackoverflow.com/q/26211965
answers question: http://stackoverflow.com/q/26211965
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41112621
downvote count: 0

http://stackoverflow.com/q/26245050
tagged with: jodatime
answer count: 2
linked to: http://stackoverflow.com/q/38922754
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/68777384
has answer: http://stackoverflow.com/a/68777384
score: 1
has body: Given a UTC offset, i.e. -5, can I determine the USA time zone using Joda Time? One of Pacific, Mountain, Central, Easter is sufficient. I can't use Java 8.
tagged with: timezone
has answer: http://stackoverflow.com/a/26245143
upvote count: 1
has title: Convert UTC offset to USA time zone with Joda Time
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26245143
tagged with: java
type: Question

http://stackoverflow.com/a/29799658
answers question: http://stackoverflow.com/q/26341563
upvote count: 2
score: 2
has body: I faced the same issue which is now resolved for me. If you are using maven, you can configure the default jvm args or other test options that need to be passed to the runs by adding similar properties like this to your pom.xml. You might want to note that this is kind of a master setting for all you junit runs. org.apache.maven.plugins maven-surefire-plugin 2.8.1 -Xms500m -Xmx1g true true In my case, project had this configuration set to use -Xms10g -Xmx10g. Replacing this with lower values like -Xms500m -Xmx1g fixed the issue. You might already have a similar configuration so you may want to override it locally, else adding this configuration should help override the default values passed by Intellij.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41307411
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26320808
has text: @Daron _"in place of the URL"_ is the wrong term. The URL is the entire string you normally see in your browser's address bar. It's "in place of the _host name_" you put the IP.
score: 0

http://stackoverflow.com/comment/41263590
type: QuestionComment
comment on: http://stackoverflow.com/q/26297243
score: 1
has text: What have you tried? This http://docs.oracle.com/javase/6/docs/api/java/lang/String.html is a good starting point. And, remember, String is immutable.
type: Comment

http://stackoverflow.com/a/26304918
score: 1
has body: you can use numberChoice = input.nextInt(); instead of choice = input.nextLine(); and then convert the string into integer
answers question: http://stackoverflow.com/q/26304845
upvote count: 1
has comment: http://stackoverflow.com/comment/41278216
type: Answer
downvote count: 0

http://stackoverflow.com/a/26273484
has body: My advice is this: public class MyUI extends UI { @Override protected void init(VaadinRequest request) { VerticalLayout layout = new VerticalLayout(); FieldGroup fieldGroup = new BeanFieldGroup&lt;Person&gt;(Person.class); fieldGroup.setItemDataSource(new BeanItem&lt;Person&gt;(new Person(1L, "John", "Doe"))); for (Object propertyId : fieldGroup.getUnboundPropertyIds()) { Field&lt;?&gt; field = fieldGroup.buildAndBind(propertyId); if ("id".equals(propertyId)) { field.setReadOnly(true); } layout.addComponent(field); } setContent(layout); } } You should use getUnboundPropertyIds(), because you haven't bound any propertyId to field before the iteration.
has comment: http://stackoverflow.com/comment/41221213
upvote count: 1
has comment: http://stackoverflow.com/comment/41222096
has comment: http://stackoverflow.com/comment/41221620
answers question: http://stackoverflow.com/q/26272009
score: 1
has comment: http://stackoverflow.com/comment/41223137
has comment: http://stackoverflow.com/comment/41223924
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41221968
accepted answer of: http://stackoverflow.com/q/26272009
type: Answer

http://stackoverflow.com/q/26337836
linked to: http://stackoverflow.com/q/20597223
possible better answer: http://stackoverflow.com/a/26337939
has answer: http://stackoverflow.com/a/26338405
score: 8
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/41338466
has comment: http://stackoverflow.com/comment/41338410
upvote count: 8
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/26338405
has title: How to format the current date with Suffix to Superscript?
favorite count: 0
answer count: 2
has body: I am using the SimpleDateFormatter public static final DateFormat DATE_FORMAT_FULL_FULL_SPACES = new SimpleDateFormat("dd MMMM yyyy", Locale.getDefault()); and Current Date is passed at that time, It should display as 1st JULY 2014 where st should be superscript. How can I go further ?
has comment: http://stackoverflow.com/comment/41338374
has answer: http://stackoverflow.com/a/26337939
tagged with: java
has comment: http://stackoverflow.com/comment/41338436

http://stackoverflow.com/comment/56616560
type: AnswerComment
type: Comment
score: 1
has text: @phact I am wondering if logged batch still would be better idea if I want to insert ~10000 rows of the same partition key but with different clustering key. so all rows should end up in same node. there should be no additional pressure on whole cluster as single coordinator will do the job. I just don't feel like issuing 10000 async request would be better. thanks
comment on: http://stackoverflow.com/a/26765794

http://stackoverflow.com/a/26290710
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26290440
answers question: http://stackoverflow.com/q/26290440
score: 0
has body: Check the location where you assign the instance of your adapter to the pager. The exception your getting means that the fragment hasn't loaded to the view yet, which is likely given that you're calling your assignment: averageFragment = (AverageFragment) getSupportFragmentManager().findFragmentByTag(AverageFragment.tag); from the onCreate() method. Try moving this assignment to the onResume(), which should ensure that your fragment has been loaded into the view and is accessible through the supportFragmentManager. Also make sure this assignment is occurring after you set the pager's adapter within the lifecycle of your activity.

http://stackoverflow.com/q/26250499
has title: Applet doesn't run and asks for main method
type: Question
tagged with: java
has body: I am a novice in java programming.This is my applet code for SimpleApplet.java: import java.awt.*; import java.applet.*; /* &lt;applet code="SimpleApplet" width=200 height=60&gt; &lt;/applet&gt; */ public class SimpleApplet extends Applet { public void paint(Graphics g) { g.drawString("A simple Applet",20,20); } } I first compiled it in command prompt by javac SimpleApplet.java and then used java SimpleApplet. It throws up error that main class is not found in class SimpleApplet,please define main method. Where am I wrong here ?
accepted answer: http://stackoverflow.com/a/26273873
linked to: http://stackoverflow.com/q/7454656
answer count: 1
downvote count: 0
tagged with: applet
favorite count: 0
has answer: http://stackoverflow.com/a/26273873
type: AnsweredQuestion
score: 2
upvote count: 2

http://stackoverflow.com/comment/41240571
comment on: http://stackoverflow.com/q/26283633
score: 0
type: Comment
type: QuestionComment
has text: Yeah I know that's an option but if it's possible to do in CSS I'd prefer that as to keep the Java code relatively concise. That's kind of a last resort.

http://stackoverflow.com/comment/41253826
comment on: http://stackoverflow.com/q/26273993
type: Comment
type: QuestionComment
has text: So here you need to use JPQL. http://stackoverflow.com/questions/3730625/jpa-join-in-jpql?rq=1 refer this answer.
score: 0

http://stackoverflow.com/comment/41261978
comment on: http://stackoverflow.com/q/26296235
score: 0
type: Comment
has text: Perhaps you are missing a layer between your servlet layer and the DAO layer which does the business logic (checking old password and setting new one)?
type: QuestionComment

http://stackoverflow.com/comment/41339109
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26313303
type: AnswerComment
has text: Yes, its a valid path but in java if the path has backslash it should be something like "C:\\Users\\..." but instead it is like "C:\Users\..."

http://stackoverflow.com/q/26329262
type: AnsweredQuestion
has body: how do I stop this method from executing? multSocket.receive(multPacket); I'm trying to connect two or more machines (or applications on the same machine) via UDP Multicast with Java. The thing is I'm not working with client-server but more like a distributed object, so there isn't really a distinction between clients and servers. Ideally the first application opened would start sending multicast messages every x seconds, and when the other one gets started would call a method for receiving the message or packet. But since each application can be client or server it's tricky to know which one to put to send and the other to receive. My current idea for fixing this is to make each application send the multicast packet for 10 seconds, if no one responds then listen to multicast packets for 10 seconds, if it doesn't receive anything start sending again and keep the cycle. When one of them finally receives the message, send a confirmation to the sender and both of them can stop listening and sending. But my problem is the receiving method. It stays listening for incoming multicast packets and I don't know how to stop or pause it. This is how I init the socket just in case MulticastSocket multSocket = new MulticastSocket(5001); multSocket.joinGroup(230.0.0.1); private byte[] multBuf = new byte[256]; DatagramPacket multPacket = new DatagramPacket(multBuf, multBuf.length); Thanks for hearing me out. -------------------------------------------------------------- EDIT -------------------------------------------------------------- -------------------------------------------------------------- EDIT -------------------------------------------------------------- @EJP Thanks for your answer! This is how I implemented the setSoTimeout on the receive multicast method: public void receiveMulticast() throws IOException{ multAddress = InetAddress.getByName("230.0.0.1"); multSocket = new MulticastSocket(multPort); multSocket.joinGroup(multAddress); multBuf = new byte[256]; multPacket =…
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26329658
accepted answer: http://stackoverflow.com/a/26329658
tagged with: udp
has title: Java MulticastSocket. How to stop/pause the "receive" method
answer count: 1
downvote count: 0
favorite count: 0
tagged with: multicast
tagged with: sockets
upvote count: 1

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

http://stackoverflow.com/comment/119294770
type: Comment
comment on: http://stackoverflow.com/a/26319364
type: AnswerComment
has text: I'm getting this error in a more complicated scenario involving multi-threading, and I don't seem to be doing mocking-inside-mocking. Rather, I'm suspecting a thread safety issue inside Mockito. Anyone had this?
score: 0

http://stackoverflow.com/comment/41219727
score: 0
type: AnswerComment
type: Comment
has text: So rename your image in editor_background_color,even if it's not autoexplicative! and your could put the image in the color folder, so you don't have to rename everything,even if this is not good programming. th best solution is to modify the code i suppose.. i understood what you asked, but in this case i don't see much solutions..
comment on: http://stackoverflow.com/a/26264606

http://stackoverflow.com/q/26302502
accepted answer: http://stackoverflow.com/a/26302703
tagged with: multithreading
tagged with: android
has comment: http://stackoverflow.com/comment/41273947
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26303357
tagged with: java
has answer: http://stackoverflow.com/a/26303357
type: Question
has answer: http://stackoverflow.com/a/26302703
has body: I'm looking for a way to stop/kill a Thread, i saw that Thread.stop() is deprecated. So i started searching for another solution and saw multiple posts suggesting this: thread.interrupt(); thread = null; But that just won't stop my Thread, my Thread looks like this: public static Thread loadingSpinnerTimer (final Context context, final ImageView imageView){ final Handler mHandler = new Handler(); thread = new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub while (!isPaused) { try { Thread.sleep(100); mHandler.post(new Runnable() { @Override public void run() { // TODO Auto-generated method stub // Write your code here to update the UI. Log.e("ThreadMessage","HasRun"); if (ticker == 12){ ticker = 0; } Bitmap myBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.spinner_160x160); Bitmap img = Bitmap.createBitmap(myBitmap.getWidth(), myBitmap.getHeight(), Bitmap.Config.ARGB_8888); //ARGB_8888 transparrent? Canvas canvas = new Canvas(img); int offset = myBitmap.getWidth()*ticker; Rect srcrectangle = new Rect( 0, offset, myBitmap.getWidth(), myBitmap.getWidth()+offset); Rect dstrectangle = new Rect( 0, 0, myBitmap.getWidth(), myBitmap.getWidth()); canvas.drawBitmap(myBitmap,srcrectangle,dstrectangle,null); img.setHeight(myBitmap.getWidth()); imageView.setImageDrawable(new BitmapDrawable(context.getResources(), img)); ticker++; } }); } catch (Exception e) { // TODO: handle exception } } } }); thread.start(); return thread; } Anyone get a solution i can use to stop/kill my Thread? Any help is much appreciated.
has title: looking for a way to stop/kill a Thread
has answer: http://stackoverflow.com/a/26304548
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41273492
linked to: http://stackoverflow.com/q/20527893

http://stackoverflow.com/q/26334368
has comment: http://stackoverflow.com/comment/41332099
has comment: http://stackoverflow.com/comment/41332693
type: Question
score: -1
linked to: http://stackoverflow.com/q/14596599
has body: I want to register the service in windows and after register wants to start also. using following command in the code:: cmd.exe /C sc create "&lt;service name&gt;" binpath="D:\\abc\\xyz.exe -zglaxservice xyz" I execute above command through runtime.exec(). upon running the code it gives the help of sc command. Code :: Process proc = null; String[] cmdStr = new String[] { "cmd.exe","/C","sc", "create", "\""+servicename+"\"", "binpath= \"D:\\SCCode\\"+exeName+".exe -zglaxservice "+laxName+"\"" }; proc = Runtime.getRuntime().exec(cmdArr); Please help...
answer count: 2
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/57457129
has comment: http://stackoverflow.com/comment/41332171
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/73110607
tagged with: windows
upvote count: 0
has title: error while running sc create command through java
tagged with: java
has answer: http://stackoverflow.com/a/26334430

http://stackoverflow.com/q/26290647
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/29707037
type: Question
tagged with: inheritance
has title: Subclass With Changed Type in Java
tagged with: type-conversion
score: 0
tagged with: casting
tagged with: matrix
answer count: 1
has body: Is it possible in Java to create a subclass and do a sort of find and replace for a type? To change an instance variable to be a Integer instead of a Double? I am looking for a vector class that holds integers. I mean a real math vector, not a java.util.Vector. In org.apache.commons.math3 there are Vector2D and ArrayRealVector classes, but they both only take Double for their coordinates. I would love to be able to somehow subclass them to use Integers instead. I know I could subclass the abstract class they extend from, but that seems like a whole ton of code deduplication, judging by how long their implementations are (source of Vector2d and source of ArrayRealVector). I know I could also typecast my Integers to Doubles when constructing and getting values back, but again this seems a little messy.

http://stackoverflow.com/comment/41206541
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26265693
has text: Anytime. If this answer solved you problem, please accept it so this question can be considered answered.
type: AnswerComment

http://stackoverflow.com/comment/41174528
comment on: http://stackoverflow.com/q/26247602
has text: FYI, this question has been referenced on Code Review [Retro Rocket ASCII Art](http://codereview.stackexchange.com/q/65040/31503)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41083690
has text: @MattJones: the same coin, but the flip side.
score: 0
comment on: http://stackoverflow.com/q/26199587
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41094216
type: Comment
comment on: http://stackoverflow.com/q/26205255
score: 0
has text: Okay, Just as a note I do usually use packages but for practising and testing etc. I just use the default package. Anyway I've edited my code but its still not compiling as a runnable JAR file
type: QuestionComment

http://stackoverflow.com/comment/41334546
has text: class prova{ public static void main(String[] args){ System.out.println(3 % 0); } } raises exception to me!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26335040
score: 0

http://stackoverflow.com/q/26211122
tagged with: java
has body: I am trying to integrate the Activiti-BPM Framework into a Java EE Webapplication. The main goal at the Moment is, to inject an EJB as DelegateExpression into a Servicetask (to handle Database operations). I read that Activiti does not (yet) work with EJBs, so i annotated the class like this: @Named @LocalBean @Stateless @Dependent public class DatabaseWriter implements JavaDelegate {...} and try to inject it in multiple ways like this: activiti:delegateExpression="${DatabaseWriter}" activiti:delegateExpression="DatabaseWriter" activiti:delegateExpression="$DatabaseWriter" respectivley to check if it is just a Bug or something: activiti:expression="${DatabaseWriter.execute(execution)}" In any case i get exceptions like "could not resolve DatabaseWriter, no bean foudn that implements JavaDelegate with name DatabseWriter ..." I tested the Class itself - by not using cdi - JPA does nto work, but the class can be instantiated by Activiti and the execute method is executed - so the class code itself is ok. I also tried injecting the class in a JAX-RS EJB - both with CDI and @EJB - it works. The problem definetly lies with my way of trying to bring it into Activiti. I also made a Screenshot of the Problem (all code, xml, and a logmessage) for better understanding, if it helps: http://s29.postimg.org/tmiknudjb/problem.jpg Thanks for help or tipps! Regards, BillDoor
has title: Activiti - DelegateExpression not Resolving
type: AnsweredQuestion
tagged with: ejb
tagged with: cdi
has answer: http://stackoverflow.com/a/26214153
type: Question
score: 0
tagged with: activiti
accepted answer: http://stackoverflow.com/a/26214153
answer count: 1

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

http://stackoverflow.com/q/26240626
tagged with: java
has comment: http://stackoverflow.com/comment/41160520
type: Question
linked to: http://stackoverflow.com/q/23618567
has title: Detecting Keyboard Space click
score: 0
answer count: 1
tagged with: keycode
has body: I'm trying to detect a Space click on the Keyboard using KEYBOARD_SPACE and it doesn't seem to detect anything. My code is: @Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_SPACE: return true; case KeyEvent.KEYCODE_DEL: return true; default: return super.onKeyUp(keyCode, event); } } The second case KeyEvent.KEYCODE_DEL works perfectly, so I'm a little unsure what the problem is. Is there a better way of doing this? Thanks for any help in advance!
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26240705
tagged with: keyevent

http://stackoverflow.com/a/26335693
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26335610
has body: From your code it looks like it throws HttpException. so write: try { QueryExecution qe = query(string); } catch (HttpException ex) { System.out.println (ex.getMessage()); //Optional ex.printStackTrace(); //Optional } Another catch can be catch (Exception ex) {..} // that will catch any problem. BUT if you know the exact exception use the exact. At the catch i wrote the common error prints, but you can fill that as you find it suits your problem.
answers question: http://stackoverflow.com/q/26335610
has comment: http://stackoverflow.com/comment/41335355

http://stackoverflow.com/a/26327688
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26327613
has comment: http://stackoverflow.com/comment/41319728
score: 1
has body: Every instance of every class ISA Object, so you can always cast any reference type value to Object. Only a String object, however, ISA String.
upvote count: 1

http://stackoverflow.com/comment/41511589
type: Comment
score: 0
has text: The point of the other question already containing the answer is that you only create 1 ObjectOutputStream and ObjectInputStream per Socket Outputstream and Inputstream and re-use them. The method `ServerV2.sendMessage` creates a new ObjectOutputStream every time which is causing the error.
comment on: http://stackoverflow.com/q/26345092
type: QuestionComment

http://stackoverflow.com/q/26319488
tagged with: java
tagged with: queue
upvote count: 3
has body: My application connects to a specific hardware over a serial port. I send binary data commands while each command includes specific Opcode. I receive from the hardware the same Opcode or another in return. To do this, I have a queue of commands in thread, dedicated to send the data.Another thread dedicated to reading and handling all incoming replies and put it in another queue. Now, lets say I need to send a command with opcode 1 and then I want to wait for the hardware to reply me with opcode 1(there might be different data between sending and receiving) , however this is going to be a little tricky cause there might be some other messages being received by my application, commands with opcodes 2 or 3 and so on, and I need to handle them properly without waiting to command with opcode 1. If I wait too long to command with opcode 1 I need to be informed. Do I need to open a thread timer for each command, and after amount of time call back a listener? Is there a design pattern and implementation for this kind? I looked for some posts here and I don't think I can stop my search Look at this: c# wait for an echo on serial port, check it, and have a timout on the wait? Providing Asynchronous Serial Port Communication? Can anyone give me some advice? Thanks!
favorite count: 0
has title: Android send command to serial port and wait for specific response
type: UnansweredQuestion
tagged with: android
tagged with: serial-port
tagged with: asynchronous
score: 3
answer count: 0
downvote count: 0
linked to: http://stackoverflow.com/q/6916830
type: Question
linked to: http://stackoverflow.com/q/16007313

http://stackoverflow.com/comment/41310059
has text: Sort of. But it's worth mentioning, IMO.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26322629

http://stackoverflow.com/a/26257043
answers question: http://stackoverflow.com/q/26256909
has comment: http://stackoverflow.com/comment/41189923
has comment: http://stackoverflow.com/comment/41190354
has body: Every component has method getLocale. If you want to change language you should override it. This should work when you want to change language to Slovak: final DateTextField startDate = new DateTextField("startDate", "dd-MM-yyyy") { @Override public Locale getLocale() { return new Locale("sk", "SK"); } }; this just change language of your current component. If you want to change language to all component you should change locale of session: add(new Link&lt;Void&gt;("goSk") { private static final long serialVersionUID = 1L; @Override public void onClick() { getSession().setLocale(new Locale("sk", "SK")); } }); add(new Link&lt;Void&gt;("goEn") { private static final long serialVersionUID = 1L; @Override public void onClick() { getSession().setLocale(Locale.US); } }); More information are here: http://wicket.apache.org/guide/guide/i18n.html
type: Answer
has comment: http://stackoverflow.com/comment/41189747
downvote count: 0
has comment: http://stackoverflow.com/comment/41190135
score: 3
has comment: http://stackoverflow.com/comment/41191283
has comment: http://stackoverflow.com/comment/41189691
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26256909
has comment: http://stackoverflow.com/comment/41191749
has comment: http://stackoverflow.com/comment/41190672
type: AcceptedAnswer

http://stackoverflow.com/a/26256877
answers question: http://stackoverflow.com/q/26253670
has body: Certainly comboViewer.setSelection in your listener trigger a SelectionChange event that will be caught by your listener which trigger ... and so on
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26253670

http://stackoverflow.com/a/50585702
downvote count: 0
has body: try this.. i had the same issue, below implementation worked for me Reader reader = Files.newBufferedReader(Paths.get(&lt;yourfilewithpath&gt;), StandardCharsets.ISO_8859_1); then use Reader where ever you want. foreg: CsvToBean&lt;anyPojo&gt; csvToBean = null; try { Reader reader = Files.newBufferedReader(Paths.get(csvFilePath), StandardCharsets.ISO_8859_1); csvToBean = new CsvToBeanBuilder(reader) .withType(anyPojo.class) .withIgnoreLeadingWhiteSpace(true) .withSkipLines(1) .build(); } catch (IOException e) { e.printStackTrace(); }
upvote count: 8
has comment: http://stackoverflow.com/comment/132382156
type: Answer
score: 8
answers question: http://stackoverflow.com/q/26268132

http://stackoverflow.com/a/33011613
type: Answer
upvote count: 1
has body: I had a similar problem that was driving me nuts. Turns out that Infinitest doesn't like spaces in the path to the source files. I had a space in my workspace directory name. Removing the space solved the problem.
score: 1
answers question: http://stackoverflow.com/q/26274786
downvote count: 0

http://stackoverflow.com/comment/41109511
has text: @AlexeiBarnes Extending the classes may seem tempting, since it involves less code to write in the sub-classes (since the methods of the interface are already implemented by the super-classes), but I still think composition is the correct solution here, and not inheritance. What do you do when you get an instance of Block? Do you create an instance of "SubBlock" with a copy constructor that copies all the Block properties? Don't you still have to keep the original Block instance somewhere?
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26212452

http://stackoverflow.com/comment/41090183
comment on: http://stackoverflow.com/q/26203382
has text: It just make things worse. If i take that out of "do" loop, array only stores last input. Deleting first ones.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41153707
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26237335
type: Comment
has text: @Serhiy - How is that relevant to the question about using a nested class to implement `Comparator`?

http://stackoverflow.com/q/26308895
score: 0
has answer: http://stackoverflow.com/a/26308927
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41285493
has comment: http://stackoverflow.com/comment/41285428
has comment: http://stackoverflow.com/comment/41285508
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26309129
has title: Not sure what i'm doing wrong here (Boolean flag)
tagged with: java
has comment: http://stackoverflow.com/comment/41285485
type: Question
answer count: 2
has body: Here's a snippet of my code for an assignment. I can't seem to get the boolean flag to work properly. When i try to figure it out, either every name gets the discount or no name gets the discount. To clarify the name Mike or Diana should give a discount. String firstName; //user's first name boolean discount = false; //flag, true if user is eligible for discount int inches; //size of the pizza char crustType; //code for type of crust String crust; //name of crust double cost = 12.99; //cost of the pizza final double TAX_RATE = .08; //sales tax rate double tax; //amount of tax char choice; //user's choice String input; //user input String toppings = "Cheese "; //list of toppings int numberOfToppings = 0; //number of toppings //prompt user and get first name System.out.println("Welcome to Mike and Diane's Pizza"); System.out.print("Enter your first name: "); firstName = keyboard.nextLine(); if (firstName == "mike" || firstName == "diana" || firstName == "Mike" || firstName == "Diana" || firstName == "MIKE" || firstName == "DIANA") { discount = true; } if (discount = true) { cost -= 2.0; System.out.println ("You are eligible for a $2 discount.");
has comment: http://stackoverflow.com/comment/41285489

http://stackoverflow.com/a/26290727
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26290617
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/26290617
downvote count: 0
has body: As All Primitive Wrappers for digits extends Number and they implement Comparable you could do public static &lt;T extends Number &amp; Comparable&lt;T&gt;&gt; T max(T x, T y, T z) { return max(max(x, y), z); } public static &lt;T extends Number &amp; Comparable&lt;T&gt;&gt; T max(T x, T y) { if (x.compareTo(y) &gt; 0) { return x; } return y; } Also you could use Collections.max(Arrays.asList(x,y,z)) as all numbers are Comparable. But you will have performance overhead of for creation of a new list.
has comment: http://stackoverflow.com/comment/41253658

http://stackoverflow.com/q/26268638
has comment: http://stackoverflow.com/comment/41211984
has comment: http://stackoverflow.com/comment/41211836
has comment: http://stackoverflow.com/comment/41211855
has answer: http://stackoverflow.com/a/26268659
has body: I am trying to declare the main method as a string to print the output code to a text file. I tried something like: String textoutput1 = ((main)); and String textoutput1 = (main()) But it does not work. If you know a way to declare a main method as a string or any other Java data type please help.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41211878
has comment: http://stackoverflow.com/comment/41211958
linked to: http://stackoverflow.com/q/2885173
has comment: http://stackoverflow.com/comment/41211804
tagged with: java
duplicate of: http://stackoverflow.com/q/2885173
has title: Is it possible to declare a main method as a string in Java?
type: Question
has comment: http://stackoverflow.com/comment/41211837
has comment: http://stackoverflow.com/comment/41211903
score: 0
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/41104250
comment on: http://stackoverflow.com/a/26210319
type: Comment
has text: Ok, whatever you do, don't follow this advice. Tirath, please learn a tiny bit of programming before advising others.
score: 0
type: AnswerComment

http://stackoverflow.com/a/57587843
type: Answer
score: 1
upvote count: 2
answers question: http://stackoverflow.com/q/26308035
downvote count: 1
has body: I have written a complete article at Spring Boot JPA Multiple Data Sources Example. In this article, we will learn how to configure multiple data sources and connect to multiple databases in a typical Spring Boot web application. We will use Spring Boot 2.0.5, JPA, Hibernate 5, Thymeleaf and H2 database to build a simple Spring Boot multiple data sources web application.

http://stackoverflow.com/a/26297380
type: Answer
answers question: http://stackoverflow.com/q/26297274
has body: if you are using sping aop it will decrease your performance, besides if you use spring with aspectj it will perform better for more check here http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/aop.html
score: 0

http://stackoverflow.com/q/26217434
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26219490
has title: How to cover block catch by JUnit
tagged with: junit
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/26219490
has comment: http://stackoverflow.com/comment/41116449
type: AnsweredQuestion
score: 1
tagged with: java
has body: I want to cover the catch sections of this try block with JUnit. How do I do it? public class ClientCertSocketFactory implements SecureProtocolSocketFactory { private static final Logger LOGGER = LoggerFactory.getLogger(ClientCertSocketFactory.class); private SSLSocketFactory sslSocketFactory; public ClientCertSocketFactory() throws IOException{ String trustStoreFilePath = System.getProperty("javax.net.ssl.trustStore"); try { TrustManagerFactory trustManagerFactory = CertManagerFactory.loadTrustStore(trustStoreFilePath); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustManagerFactory.getTrustManagers(), null); this.sslSocketFactory = sslContext.getSocketFactory(); } catch (NoSuchAlgorithmException e) { LOGGER.error("No Provider supports a TrustManagerFactorySpi implementation for the TLS protocol. Error message: " + e); } catch (KeyManagementException e) { LOGGER.error("Error occurred when initializing SSLContext. Error message: " + e); } } }
type: Question
tagged with: try-catch

http://stackoverflow.com/a/26393921
answers question: http://stackoverflow.com/q/26328744
downvote count: 0
score: 1
has body: The question is not well stated, its hard to understand what your goal is. Tip: In the future, ask how to reach a goal, then state the path you attempted Lets assume you have a webapp called example-webapp.war It has a simple WEB-INF/web.xml with a servlet entry as such ... test com.company.foo.TestServlet test /test The example-webapp.war comes with its own com.company.foo.TestServlet (found in the webapp's WEB-INF/classes directory) Now, you have a embedded-jetty instance, you want to launch example-webapp.war, but you want to use an implementation of com.company.foo.TestServlet that exists outside of the example-webapp.war (with different functionality). You can accomplish this by first recognizing that the servlet spec has classloader isolation of a webapp from its server, and then configuring that classloader isolation layer to poke a small hole through this isolation. This hole needs to: Make the webapp classloader capable of seeing the server class Force the webapp to use the server class version over the webapp class version This is easy enough to accomplish in embedded-jetty. Lets start with making a custom version of com.company.foo.TestServlet and making it available in the classpath for the embedded-jetty server. Finally, configure your WebAppContext to configure the classloader isolation hole mentioned above. (Using the system classes and server classes configurations) package demo; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URI; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.webapp.WebAppContext; public class EmbedWithOverridenServlet { public static void main(String[] args) throws Exception { int port = 8080; Server server = new Server(port); String wardir = "path/to/example-webapp.war"; WebAppContext webapp = new WebAppContext(); webapp.setWar(wardir); webapp.setContextPath("/"); // don't hide server class…
has comment: http://stackoverflow.com/comment/41442410
has comment: http://stackoverflow.com/comment/41446240
has comment: http://stackoverflow.com/comment/41463284
upvote count: 1
has comment: http://stackoverflow.com/comment/41473973
type: Answer

http://stackoverflow.com/a/26340963
type: Answer
has body: The declaration of the method displayvacationDays is misplaced (within the declaration of the method setVacationScale) displayvacationDays should be non-static, as it works with the instance's variables. Corrected code: public class VacationScale { int[] vacationDays; int yearsOfService; public void setVacationScale () { vacationDays = new int[7]; vacationDays[0] = 10; vacationDays[1] = 15; vacationDays[2] = 15; vacationDays[3] = 15; vacationDays[4] = 20; vacationDays[5] = 20; vacationDays[6] = 25; } public void displayvacationDays () { if (yearsOfService &gt;= 0) { System.out.println("Vacation days " + vacationDays[yearsOfService]); } else { System.out.println("Invaild years of service"); } } }
answers question: http://stackoverflow.com/q/26340774
score: 0
has comment: http://stackoverflow.com/comment/41344607

http://stackoverflow.com/a/42446389
type: Answer
downvote count: 0
score: 7
has body: Do not use Thread.sleep as it will freeze your main thread, and not simulate setTimeout from JS. You need to create and start a new background thread to run your code without stoping the execution of the main thread. One example: new Thread() { @Override public void run() { try { this.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } // your code here } }.start();
answers question: http://stackoverflow.com/q/26311470
upvote count: 7

embedded-jetty
tags question: http://stackoverflow.com/q/26216792
type: Tag
tags question: http://stackoverflow.com/q/26229850
tags question: http://stackoverflow.com/q/26310652
tag name: embedded-jetty
tags question: http://stackoverflow.com/q/26328744
tags question: http://stackoverflow.com/q/26217143
tags question: http://stackoverflow.com/q/26320031

http://stackoverflow.com/q/26277282
possible better answer: http://stackoverflow.com/a/26277449
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26277449
downvote count: 0
score: 1
favorite count: 0
tagged with: arraylist
type: Question
has body: i have this arrayalist: ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactListad it contains: [{emailAddress=samir, lastName=samir, contactId=4, phoneNumber=6449494, firstName=samir, homeAddress=paris}, {emailAddress=, lastName=, contactId=6, phoneNumber=, firstName=Rashad, homeAddress=las vegas}, {emailAddress=, lastName=, contactId=9, phoneNumber=, firstName=joe, homeAddress=paris}] My question iy ifs how can i get the values and store them in another arraylist i want to specify to store only the values having a certain homeAddress equals paris for example. i hope my question is clear enough for example if i specify the homeAddress to be paris, i want the output to be an arraylist containing [{emailAddress=samir, lastName=samir, contactId=4, phoneNumber=6449494, firstName=samir, homeAddress=paris},{emailAddress=, lastName=, contactId=9, phoneNumber=, firstName=joe, homeAddress=paris}] so without the hasmap that has homeAddress equals las vegas Thank you
has answer: http://stackoverflow.com/a/26277395
has comment: http://stackoverflow.com/comment/41226832
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/26277395
tagged with: java
has title: retrieving certain values from ArrayList<HashMap<String, String>>

http://stackoverflow.com/q/26225532
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41138196
has answer: http://stackoverflow.com/a/26225738
tagged with: hadoop
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26228611
has answer: http://stackoverflow.com/a/26228611
has comment: http://stackoverflow.com/comment/41132438
has body: I am trying to write more than one value in the output of the job. To do that I am using a custom writable that implements the interface Writable. This custom writable, I called it, CompositeWritable implements the two methods for reading and writing. When I run the job, the output looks like this: key CompositeWritable@5fdf281b lean CompositeWritable@2153b010 likely CompositeWritable@2153b010 What am I missing? In the job specification, I set the output value class to be CompositeWritable. ANy other settings I have missed?
has comment: http://stackoverflow.com/comment/41132428
accepted answer: http://stackoverflow.com/a/26225738
has title: Hadoop custom writable
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41132366

http://stackoverflow.com/a/26265038
answers question: http://stackoverflow.com/q/26264985
has body: If I understand your question, you could rewrite test(String) to use String.split(String) with something like, public static void test(String str) { String[] words = str.split("\\s+"); for (String word : words) { System.out.println(word); } }
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/26324962
has comment: http://stackoverflow.com/comment/41314475
has comment: http://stackoverflow.com/comment/41314410
type: AcceptedAnswer
downvote count: 0
has body: there is no official support yet - there will be support with android L via the Task locking API The L Developer Preview introduces a new task locking API that lets you temporarily restrict users from leaving your app or being interrupted by notifications. This could be used, for example, if you are developing an education app to support high stakes assessment requirements on Android. Once your app activates this mode, users will not be able to see notifications, access other apps, or return to the Home screen, until your app exits the mode. https://developer.android.com/preview/api-overview.html EDIT: as you said you use L this got obsolete - but I leave it here as a hint for others said that - you are also able to get this kind of work without root today if you have to ( e.g. kiosk mode app on a certain hardware ). It is not simple - and no solution that works for all devices - but if you need it you can get it work with tricks like: - reacting on home-screen intent ( and setting it as default ) - when you go to background - bring your self foreground again - ..
has comment: http://stackoverflow.com/comment/41314474
accepted answer of: http://stackoverflow.com/q/26324810
type: Answer
answers question: http://stackoverflow.com/q/26324810
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41314462

http://stackoverflow.com/comment/41157508
comment on: http://stackoverflow.com/a/26229240
type: Comment
has text: yeah i did an no luck, ill edit my source code so you can see what it is now
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41251997
score: 0
comment on: http://stackoverflow.com/q/26290473
type: Comment
type: QuestionComment
has text: Use [-XX:+PrintAssembly](https://wikis.oracle.com/display/HotSpotInternals/PrintAssembly) and see for yourself what HotSpot can do.

http://stackoverflow.com/comment/41230046
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26278733
score: 0
has text: The icon is inside the jar file

http://stackoverflow.com/q/26246291
upvote count: 0
has answer: http://stackoverflow.com/a/26246350
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41171234
type: Question
tagged with: rectangles
tagged with: java
score: -1
answer count: 1
has comment: http://stackoverflow.com/comment/41171074
has body: I have an issue with simple 2d collision detection with a circle and a rectangle. All the checker does is see if the center of the circle overlaps with any point on the rectangle. Heres the checker: boolean overlaps(Circle circle) { for (double i = topLeft.x; i &lt; (topLeft.x + width); i++) { for (double j = topLeft.y; j &lt; (topLeft.y + height); j++) { if (circle.center.x == i &amp;&amp; circle.center.y == j) { return true; } } } return false; }` Very simple, and to the point. The error comes into play at the if statement, with my circle.center.x, and/or circle.center.y. Here is the code for my Circle class: public class Circle { Point center; double radius; /** * Constructor. * * @param center the center Point of the circle * @param radius the radius of the circle */ public Circle(Point center, double radius) { center = this.center; radius = this.radius; } /** * Get the current center point of the circle. * * @return the center point of the circle */ public Point getCenter() { return center; } /** * Set the center point of the circle. * * @param center the (new) center point of the circle */ public void setCenter(Point center) { this.center = center; } /** * Get the current radius. * * @return the current radius */ public double getRadius() { return radius; } /** * Set the radius. * * @param radius the (new) radius of the circle */ public void setRadius(double radius) { this.radius = radius; } }` Where am i going wrong? It certainly cannot be an issue with my Point class, as that would mean plenty of other things would've gone wrong by now. Thanks in advance.
downvote count: 1
tagged with: collision
favorite count: 0
has title: What is wrong with this simple circle/rectangle collision detection?
tagged with: geometry

heroku
tags question: http://stackoverflow.com/q/26275785
type: Tag
tag name: heroku
tags question: http://stackoverflow.com/q/26256831

http://stackoverflow.com/a/26284700
has body: Make the string you're referring to static: public class HelloWorld { static String name = "asad"; public static void main(String []args){ System.out.println("hello world" + name);//Display the string } } More on the difference between static and non-static fields/methods...
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26284650
upvote count: 1
score: 1

http://stackoverflow.com/comment/41265503
comment on: http://stackoverflow.com/a/26298195
score: 1
has text: @peeskillet Author of the `maven-jaxb2-plugin` here. Please see my answer, I guess there's a couple of features you might find useful. :)
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26209497
has comment: http://stackoverflow.com/comment/41199726
downvote count: 0
score: 17
type: Answer
answers question: http://stackoverflow.com/q/26209405
has comment: http://stackoverflow.com/comment/41122212
has body: Implicit casting is only available when you're guaranteed that a loss of data will not occur as a result of a conversion. So you could cast an integer to a double, or an integer to a long data type. Casting from a double to an integer however, runs the risk of you losing data. Console.WriteLine ((int)5.5); // Output &gt; 5 This is why Microsoft didn't write an implicit cast for this specific conversion. The .NET framework instead forces you to use an explicit cast to ensure that you're making an informed decision by explicitly casting from one type to another. The implicit keyword is used to declare an implicit user-defined type conversion operator. Use it to enable implicit conversions between a user-defined type and another type, if the conversion is guaranteed not to cause a loss of data. Source > MSDN
upvote count: 17

http://stackoverflow.com/comment/41367141
comment on: http://stackoverflow.com/a/26349761
type: AnswerComment
score: 0
type: Comment
has text: yep, actually I currently create the instance just on first use and destroy it on session expires, it was a simplification to say i'm creating it on session creation. thanks for your advice

http://stackoverflow.com/comment/41092468
score: 1
comment on: http://stackoverflow.com/q/26204391
has text: Java has printing APIs -- maybe they expose the default paper size?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26276330
type: Answer
upvote count: 11
has body: Yes, you can weave aspect code into third-party class files or JARs. There are two ways to achieve that: Binary weaving: Use the AspectJ compiler ajc in order to apply your aspects upon class files in an existing JAR. For that purpose, put the JAR on the compiler's inpath. After compilation you can re-package the newly woven class files into a new JAR which then you can deploy and use instead of the original one. Load-time weaving (LTW): Start the JVM with the AspectJ weaving agent via command line option -javaagent:pathto/aspectjweaver.jar in order to achieve aspect weaving during classloading. This way you sacrifice some start-up time, but do not need to create a modified JAR file. Everything happens dynamically. And now please read some AspectJ documentation.
score: 11
answers question: http://stackoverflow.com/q/26274584
accepted answer of: http://stackoverflow.com/q/26274584
has comment: http://stackoverflow.com/comment/41225946
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41227310

http://stackoverflow.com/q/26289354
type: Question
has answer: http://stackoverflow.com/a/26290090
tagged with: java
accepted answer: http://stackoverflow.com/a/26290090
score: 0
has comment: http://stackoverflow.com/comment/41249946
has comment: http://stackoverflow.com/comment/41250114
answer count: 1
has body: I am working with linkedlists at the moment in java. Our assignment was to create one from scratch, that sorts user input(Strings) into alphabetical order. I have been trying a lot of things, but none of the concepts I come up with seem to work. Any Advice/tips would be appreciated. package linkedlist; public class Linked { Node head; int listCount; public Linked(){ head = new Node(null); listCount = 0; } public void add(String data){ Node linkedTemp = new Node(data); Node linkedCurrent = head; while (linkedCurrent.getNext() != null) { linkedCurrent = linkedCurrent.getNext(); } linkedCurrent.setNext(linkedTemp); listCount++; } public void add2(String data){ Node linkedTemp = new Node(data); Node linkedCurrent = new Node(get(1)); if(listCount &gt;= 1){ while (linkedCurrent.getNext() != null){ if(linkedCurrent.getData().compareTo(linkedTemp.getData()) &lt;= 0){ linkedCurrent.setNext(linkedTemp); listCount++; break; } if(linkedCurrent.getData().compareTo(linkedTemp.getData()) &gt;= 0) linkedCurrent = linkedCurrent.getNext(); } } } public String toString() { Node linkedCurrent = head.getNext(); String output = ""; while (linkedCurrent != null) { output += "[" + linkedCurrent.getData().toString() + "]"; linkedCurrent = linkedCurrent.getNext(); } return output; } public String get(int index) { if (index &lt;= 0) return null; Node linkedCurrent = head.getNext(); for (int i = 1; i &lt; index; i++) { if (linkedCurrent.getNext() == null) return null; linkedCurrent = linkedCurrent.getNext(); } return linkedCurrent.getData(); } }
type: AnsweredQuestion
has title: Linked List manual Alphabetical sorting

http://stackoverflow.com/q/26269995
tagged with: arraylist
score: 0
has title: Checking whether a given input is present in a File
has comment: http://stackoverflow.com/comment/41214138
favorite count: 0
type: UnansweredQuestion
tagged with: file
upvote count: 1
has comment: http://stackoverflow.com/comment/41214178
downvote count: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26270078
has answer: http://stackoverflow.com/a/26270597
has body: I am doing a mini project on Inventory Management. I have an array list that has the contents. I update the arraylist from an admin login and update the list and i write them into a file. But when a User logs in and requests the item that was updated, I am not able to recieve it. Is there anyway or any specific condition that will help me check whether the input given by the user is available in the file. I just want to compare the user input and check whether it is present in the file

http://stackoverflow.com/comment/41075397
has text: Thanks a lot @JBNizet .. I am in a situation where I have to learn everything on the go :(
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26194917

http://stackoverflow.com/comment/41087516
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26201709
score: 0
has text: @BoristheSpider I am following this http://java.dzone.com/articles/getting-started-mocking-java Do you know of a better tutorial to learn mockito?

http://stackoverflow.com/q/26207611
tagged with: copy
tagged with: element
answer count: 3
has title: copy array without specified element java
has answer: http://stackoverflow.com/a/44825225
has answer: http://stackoverflow.com/a/71844190
has answer: http://stackoverflow.com/a/26207657
accepted answer: http://stackoverflow.com/a/26207657
favorite count: 0
has comment: http://stackoverflow.com/comment/41098306
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/44825225
type: Question
has body: i'm trying copy an array without a specified element. Let's say I have the following arrays: int[] array = {1,2,3,4,5,6,7,8,9}; int[] array2 = new int[array.length-1]; what I want is to copy array to array2 without the element containing the int "6" so it will contain "{1,2,3,4,5,7,8,9}" I only want to use for loops and this is what I have so far but it doesnt work int[] array= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int[] array2= new int[array.length - 1]; int remove = 6; for (int i = 0; i &lt; array2.length; i++) { if (array[i] != remove) { array2[i] = array[i]; } else { array2[i] = array[i + 1]; i++; } } for (int i = 0; i &lt; array2.length; i++) { System.out.println(array2[i]); } Thanks
score: 5
has comment: http://stackoverflow.com/comment/41098368
upvote count: 5
has comment: http://stackoverflow.com/comment/41098248
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/41329880
has text: @Ken Good that you spent an hour before posting it here. Your struggle will help u remember it for a long time and hope you will not repeat it ;-)
type: AnswerComment
comment on: http://stackoverflow.com/a/26333133
type: Comment
score: 0

http://stackoverflow.com/comment/41285419
comment on: http://stackoverflow.com/a/26308785
type: Comment
has text: then return mid+1 from the method. If I look at that string, the index of the 'e' is 4. If the assignment is to return the index plus 1, then add a one.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26322804
type: Question
tagged with: file-io
has comment: http://stackoverflow.com/comment/41310887
score: 0
has comment: http://stackoverflow.com/comment/41310558
answer count: 3
accepted answer: http://stackoverflow.com/a/26323388
possible better answer: http://stackoverflow.com/a/26322957
has answer: http://stackoverflow.com/a/26322957
has answer: http://stackoverflow.com/a/26323085
has title: creating 2 dimensional array from text file
tagged with: java
has comment: http://stackoverflow.com/comment/41310458
has body: I am trying to add values into a 2d array from a text file. I cannot figure out how to convert the input file to teacher's array format. The file contains a first line that goes into an array that represents vertices. That part works fine. Every line after the first line contains numbers for the adjacency matrix. These numbers are read in but for some reason the slots in the matrix are not being filled. I need to use those numbers to fill a double array that would be the same as using this statement: int[][] edges = { {0,1}, {0,2}, {1,0},{1,2}, {2,0},{2,1},{2,3},{2,4},{2,6}, {3,2},{3,4},{3,5}, {4,2},{4,3}, {5,3},{5,6}, {6,2},{6,5},{6,7}, {7,6} I have to read input from a txt file. The names represent the names of the nodes or vertices in my graph. The numbers represent the positions of the vertices in an adjacency matrix. For example the first line represents row o which maps to node john, and it means that john is connected by an edge to node 1 and 2 which are peter and mary. The numbers should map the same way as the array creation above. Here is what the file looks like : john;peter;mary;susan;george;debbie;tom;bill; 0 1 2 1 0 2 2 0 1 3 4 6 3 2 4 5 4 2 3 5 3 6 6 2 5 7 7 6 And here is my code : import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class TestSocialGraph { public static void main(String args[]){ String verts; int[][] edges; int[] intPasser; File input = new File("GraphInput.txt"); String[] names; try { Scanner reader = new Scanner(input); verts = reader.next(); names = verts.split(";"); edges = new int[names.length][names.length]; while (reader.hasNextLine()){ int b = 0; int count = 0; String passer = reader.nextLine(); // System.out.println(passer); String[] temp = passer.split(" "); intPasser = new int[temp.length]; for(int i = 1; i&lt; temp.length; i++){ System.out.println(temp[i]); intPasser[b] = Integer.parseInt(temp[i]); b++; } System.out.println(intPasser[0]); for(int i = 0; i&lt; intPasser.length; i++){ …
has comment: http://stackoverflow.com/comment/41310479
type: AnsweredQuestion
tagged with: arrays
has comment: http://stackoverflow.com/comment/41310503
has answer: http://stackoverflow.com/a/26323388

http://stackoverflow.com/q/26311208
possible better answer: http://stackoverflow.com/a/26311241
has answer: http://stackoverflow.com/a/26311822
has answer: http://stackoverflow.com/a/26311241
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: database
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26311822
tagged with: jpa
downvote count: 0
favorite count: 0
has body: I tried to do use saveorupdate method in hibernate and it resulted in com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'Mobiles' for key 'type_name' This is my code public ItemType addItemType(String typeName) { Session session = factory.openSession(); Transaction tx = null; ItemType itemType = null; try{ tx = session.beginTransaction(); itemType = new ItemType(); itemType.setTypeName(typeName); itemType.setDescription(""); itemType.setCreatedBy("shoppingcart"); itemType.setCreatedDate(new Date()); itemType.setUpdatedBy("shoppingcart"); itemType.setUpdatedDate(new Date()); session.saveOrUpdate(itemType); tx.commit(); }catch (HibernateException e) { if (tx!=null) tx.rollback(); e.printStackTrace(); }finally { session.close(); } return itemType; } and this is the ItemType class @Entity @Table(name = "item_types") public class ItemType implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "item_type_id") private String typeId; @Column(name = "type_name") private String typeName; @Column(name = "description") private String description; @Column(name = "created_date") private Date createdDate; @Column(name = "created_user") private String createdBy; @Column(name = "updated_date") private Date updatedDate; @Column(name = "updated_user") private String updatedBy; public String getTypeName() { return typeName; } public void setTypeName(String typeName) { this.typeName = typeName; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getTypeId() { return typeId; } public void setTypeId(String typeId) { this.typeId = typeId; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public String getCreatedBy() { return createdBy; } public void setCreatedBy(Stri…
upvote count: 6
has title: Duplicate entry error occurs on saveorupdate method
tagged with: orm
score: 6

http://stackoverflow.com/comment/41335231
type: Comment
has text: Yes, that is what's I'm confused about... I got spring-security-config in my pom.
comment on: http://stackoverflow.com/q/26335941
score: 0
type: QuestionComment

http://stackoverflow.com/q/26222698
type: Question
tagged with: dynamic-arrays
answer count: 2
has comment: http://stackoverflow.com/comment/41127069
has comment: http://stackoverflow.com/comment/41126839
has answer: http://stackoverflow.com/a/26222789
tagged with: arraylist
score: 0
upvote count: 1
favorite count: 0
tagged with: multidimensional-array
has title: Collapse 2D ArrayList
downvote count: 1
possible better answer: http://stackoverflow.com/a/26222789
has answer: http://stackoverflow.com/a/26222825
accepted answer: http://stackoverflow.com/a/26222825
type: AnsweredQuestion
tagged with: java
has body: I have an object which contains a dynamically allocated 2D ArrayList. It has a getter: ArrayList&lt;Integer&gt; getList() I'd like a function to collapse the 2D ArrayList into a 1D ArrayList. Does Java have such a thing or am I stuck doing this: public ArrayList&lt;Integer&gt; getList(){ ArrayList&lt;Integer&gt; result = new ArrayList&lt;Integer&gt;(); for(int i = 0; i &lt; list_.size(); i++){ for(int j = 0; j &lt; list_.get(i).size(); j++){ result.add(list_.get(i).get(j)); } } return result; }

http://stackoverflow.com/comment/41224728
has text: The person wouldn't really need getters and setters becauase he didn't declare his fields as private, but you could makes sense.
comment on: http://stackoverflow.com/a/26276053
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/26261980
has comment: http://stackoverflow.com/comment/41199032
score: 1
upvote count: 1
has body: You need to compare whether num - decVal is greater than or equal to 0. Because you have &gt;, you are missing the case then it's equal to 0 and you're missing a 1 bit. if (num - decVal &gt;= 0){ Also, you'll need to loop while decVal is not equal to 0, instead of 1, or else you'll miss the last bit on odd numbers. } while (decVal != 0); Output with changes: Binary value of 42 is: 00101010 Binary value of 43 is: 00101011
answers question: http://stackoverflow.com/q/26261818
downvote count: 0
type: Answer

android-videoview
tags question: http://stackoverflow.com/q/26274996
tag name: android-videoview
tags question: http://stackoverflow.com/q/26228185
type: Tag

http://stackoverflow.com/a/26303543
type: Answer
answers question: http://stackoverflow.com/q/26303346
score: 0
has body: I just realized my problem! I didn't register the ActionListener with the buttons. I am tired... :P Thanks for trying anyways.

http://stackoverflow.com/comment/41246245
has text: Try compiling them into .class files and add them to your CLASSPATH. I'd recommend packaging them as a JAR and adding that as you would any 3rd party JAR.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26287337
score: 0

http://stackoverflow.com/q/26235191
tagged with: jms
favorite count: 0
has title: JMS Message Listeners pool and timeout behavior (Failed to acquire a permit within...)
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: hornetq
type: Question
tagged with: jakarta-ee
has body: We have a JMS (hornetq) instance with many queues, for one we have a strict max pool with only one Listener instance (process cannot be run in parallel) &lt;strict-max-pool name="mdb-strict-single-instance-pool-md" max-pool-size="1" instance-acquisition-timeout="600" instance-acquisition-timeout-unit="MINUTES" /&gt; As far as I understand the instance-acquisition-timeout option define the time a process will wait on retrieving a consumer bean for an available one. The guy who configured the pool said me he put a so high value to avoid to loose the message in the queue in case of unique consumer being busy for a too long time. My questions are : Is the JMS message really removed from the queue when the consumer acquisition fails ((Failed to acquire a permit within...). If yes what does it become (moved to dead letter queue, just deleted, etc...) ? Is there a risk of thread contention with such a high timeout value (what happen if 50 message are posted while the consumer bean is still processing the current one) ?
downvote count: 0
tagged with: jboss7.x

http://stackoverflow.com/a/26237250
score: -1
has comment: http://stackoverflow.com/comment/41335558
downvote count: 1
has comment: http://stackoverflow.com/comment/41176015
has comment: http://stackoverflow.com/comment/41336400
type: Answer
has comment: http://stackoverflow.com/comment/41336705
has comment: http://stackoverflow.com/comment/41368388
upvote count: 0
has comment: http://stackoverflow.com/comment/41166286
has body: I have solved this problem. By using xPath. Example: java c# jworld c#world Andorid Windows great Nice If you want to select Java from the drop down, then you have to used public class TestingExample{ private WebDriver driver; private WebElement element; private List elements; @BeforeClass public void openBrowser(){ driver= new FirefoxDriver(); } @Test public void testMethod(){ driver.get("pass your website link"); Thread.sleep(3000); // milli sec element=driver. findElement(By.xpath("//div[@class='example']/table/tbody/tr[1]/td[1]/select")); Thread.sleep(3000); Select select = new Select(element); elements = select.getOptions(); // number of Options in that select tag for (WebElement myelement : elements) { // iterate the same System.out.println(myelement.getText()); Thread.sleep(2000); if (myelement.getText().equalsIgnoreCase("java")) { Thread.sleep(2000); myelement.click(); break; } } Thread.sleep(5000); } } Key things are 1.) "//div[@class='element'] should be the parent and can be changed to //*[@class 'element'] which means any tag which has class name as element." 2.) why tr[1] = because i want to choose an option from select tag which belongs to 1st row. If you want to choose Android then @Test public void testMethod(){ driver.get("pass your website link"); Thread.sleep(3000); // milli sec element=driver. findElement(By.xpath("//div[@class='example']/table/tbody/tr[2]/td[1]/select")); Select select = new Select(element); elements = select.getOptions(); // number of Options in that select tag for (WebElement myelement : elements) { // iterate the same System.out.println(myelement.getText()); Thread.sleep(2000); if (myelement.getText().equalsIgnoreCase("Andorid")) { Thread.sleep(2000); myelement.click(); break; } } Thread.sleep(5000); } Change tr[1] to tr[2] to choose android. 3.) why td[1] cause java or andorid are in td[1] for there respective tr. If you want to choose option as jworld then @Test public void testMethod(){ driver.get("pass your website link")…
has comment: http://stackoverflow.com/comment/41335852
answers question: http://stackoverflow.com/q/26235231

http://stackoverflow.com/q/26257385
tagged with: vaadin-charts
tagged with: java
type: Question
tagged with: add-on
tagged with: charts
tagged with: vaadin
has answer: http://stackoverflow.com/a/26257751
score: 0
answer count: 1
has body: Hope you are rocking at your end but i need a small help. I am working on vaadin portlet and i need to create a vaadin chart(sample). I downloaded required jars (vaadin-charts-vaadin6-1.1.7.jar and gson-2.2.1.jar) and created an application as give below: @SuppressWarnings("serial") public class UserloginchartApplication extends Application { public void init() { Window window = new Window(); setMainWindow(window); Chart chart = new Chart(ChartType.BAR); window.setModal(true); window.addComponent(chart); } } After compiling and deploying on tomcat server i am getting following error on UI Widgetset does not contain implementation for com.vaadin.addon.charts.Chart. Check its @ClientWidget mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions. Unrendered UIDL: -Unrendered UIDL -com.vaadin.addon.charts.Chart(NO CLIENT IMPLEMENTATION FOUND) id=PID3 height=400px width=100.0% confState={ "chart": { "type": "bar" }, "series": [], "exporting": { "enabled": false } } Can any one tell me steps to achieve/create vaadin chart in liferay. Thanks in Advance: -Vikash
has title: Vaadin 6.8 create chart with vaadin add-ons
type: UnansweredQuestion

http://stackoverflow.com/a/26361965
has body: InputStream is = socket.getInputStream(); HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl(); SessionInputBufferImpl buf = new SessionInputBufferImpl(metrics, 2048); buf.bind(is); DefaultHttpRequestParser reqParser = new DefaultHttpRequestParser(buf); HttpRequest req = reqParser.parse(); InputStream contentStream = null; if (req instanceof HttpEntityEnclosingRequest) { ContentLengthStrategy contentLengthStrategy = StrictContentLengthStrategy.INSTANCE; long len = contentLengthStrategy.determineLength(req); if (len == ContentLengthStrategy.CHUNKED) { contentStream = new ChunkedInputStream(buf); } else if (len == ContentLengthStrategy.IDENTITY) { contentStream = new IdentityInputStream(buf); } else { contentStream = new ContentLengthInputStream(buf, len); } } // Do something useful with the content stream (if non null) Message parsers in HttpCore parse message heads only. However, one can proceed reading from the session input buffer and read message body content until the end of message (depending on the delineator used)
answers question: http://stackoverflow.com/q/26259232
accepted answer of: http://stackoverflow.com/q/26259232
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/comment/41356337
has text: 1) You can edit your original text so that later readers understand it better. 2) No, PDFBox can't display without rendering it. The "PDFReader" command line application does just that. If you have already converted your PDF into images, I don't really see the problem. 3) Your solution sounds ok for me. (But thats just my opinion :-))
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26343631
type: QuestionComment

http://stackoverflow.com/comment/41174404
score: 1
comment on: http://stackoverflow.com/a/26248040
has text: @AndrewMarbl If you are allowed to use `ArrayList`s, use them instead of arrays. Otherwise, return `int` from `getInput` (the final value of `i` from the `while` loop).
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26447270
answers question: http://stackoverflow.com/q/26216142
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26216142
has body: Well! I,ve fixed the problem. I just created a new workspace and copied my project and config files to the workspace. So the problem was in a broken workspace. I guess some workspace config file was corrupted. Anyway thank redoc for the idea.
type: Answer

http://stackoverflow.com/q/26249410
favorite count: 0
possible better answer: http://stackoverflow.com/a/26249487
tagged with: android
answer count: 4
has body: I tried using DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); metrics.heightPixels; metrics.widthPixels; but because I use View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY the width is no right. It shows the size without the navigation bar. but I want to know all the screen size.. Thanks!
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26249504
has answer: http://stackoverflow.com/a/26249495
linked to: http://stackoverflow.com/q/7144814
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26249525
type: Question
has title: How can I get the width and Height of the screen -Android
downvote count: 0
has answer: http://stackoverflow.com/a/26249487
has answer: http://stackoverflow.com/a/26249525

http://stackoverflow.com/a/62585542
answers question: http://stackoverflow.com/q/26245139
has comment: http://stackoverflow.com/comment/115879942
has comment: http://stackoverflow.com/comment/120252785
has comment: http://stackoverflow.com/comment/122727431
downvote count: 2
type: Answer
score: 19
has body: Simpler than ever, forget about ViewTypes. It is not recommended to use multiple viewtypes inside one adapter. It will mess the code and break the single responsibility principle since now the adapter needs to handle logic to know which view to inflate. Now imagine working in large teams where each team has to work in one of those viewtypes features. It will be a mess to touch the same adapter by all the teams that work in the different viewtypes. This is solved using ConcatAdapter where you isolate the adapters. Code them one by one and then just merge them inside one view. From recyclerview:1.2.0-alpha04 you now can use ConcatAdapter. If you need a view with different viewTypes, you can just write the Adapters for each section and just use ConcatAdapter to merge all of them inside one recyclerview. ConcatAdapter This image shows three different viewtypes that one recyclerview has, header, content and footer. You only create one adapter for each section, and then just use ConcatAdapter to merge them inside one recyclerview: val firstAdapter: FirstAdapter = … val secondAdapter: SecondAdapter = … val thirdAdapter: ThirdAdapter = … val concatAdapter = ConcatAdapter(firstAdapter, secondAdapter, thirdAdapter) recyclerView.adapter = concatAdapter That's all you need to know. If you want to handle loading state, for example remove the last adapter after some loading happened, you can use LoadState. For more in depth information follow Florina Muntenescu post here https://medium.com/androiddevelopers/merge-adapters-sequentially-with-mergeadapter-294d2942127a
has comment: http://stackoverflow.com/comment/122758720
upvote count: 21

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

http://stackoverflow.com/q/26263379
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41202317
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/2680827
has body: I've developed an app. and when I tried to run it says "Conversion to Dalvik format failed with error 1" I've tried at some solutions given in Stackoverflow here. Ensuring there is no duplicate jars changing the proguard message and still its the same.. is there any other solution for this? and why does this error occurs ?
favorite count: 0
tagged with: dalvik
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41216410
has answer: http://stackoverflow.com/a/26263674
has title: How to solve the Conversion to Dalvik format failed with error
has answer: http://stackoverflow.com/a/26264737

http://stackoverflow.com/comment/41512782
type: Comment
has text: So what you are saying is that the ToUnicode map is 16-bit(The only ones I've seen) per key, but the literal string might not be?
comment on: http://stackoverflow.com/a/26372369
type: AnswerComment
score: 0

http://stackoverflow.com/q/26285483
tagged with: inputstream
has comment: http://stackoverflow.com/comment/41244122
has body: I'm making a client/server program for a computer science class. The idea is that we have a server program that takes a list of console commands, performs them, and returns a response via Input / Output streams. Because of the formatting of the commands, I have to check for whitespaces and digits and split the strings accordingly (which I've done). The problem appears to be in the retrieval of the command from the InputStream. Commands that should be accepted: put [string] [int] - this should store a string (key) and int (value) in the HashMap get [string] - this should return the int associated with this string keyset - return all keys values - return all values mappings - return all mappings bye - quit the client help - doesn't do anything yet, but will list all commands and their syntax The professor gave us much of the code for the server, but I think there may be errors in it because I keep getting exceptions on the Scanner. See server code below: package mapserver; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class MapServer { public static void main(String[] args) throws IOException { ServerSocket serverSocket = new ServerSocket(50000); while (true) { Socket activeSock = serverSocket.accept(); Thread th = new Thread(new MapServerThread(activeSock)); th.start(); } } } class MapServerThread implements Runnable { private Map&lt;String, Integer&gt; map = new HashMap&lt;&gt;(); private Socket sock; public MapServerThread(Socket s) { sock = s; List&lt;String&gt; strs = Arrays.asList("aaa a", "b", "a"); for (String str : strs) { map.put(str, str.length()); } } @Override public void run() { try { InputStream in = sock.getInputStream(); OutputStream out = so…
score: 2
has answer: http://stackoverflow.com/a/26285889
answer count: 1
has comment: http://stackoverflow.com/comment/41244637
has comment: http://stackoverflow.com/comment/41242533
favorite count: 0
has comment: http://stackoverflow.com/comment/41243699
has comment: http://stackoverflow.com/comment/41242848
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26285889
tagged with: java.util.scanner
upvote count: 3
has comment: http://stackoverflow.com/comment/41243002
downvote count: 1
type: Question
tagged with: java
has title: HashMap InputStream / Scanner Server Problems

http://stackoverflow.com/a/55631161
score: 5
answers question: http://stackoverflow.com/q/26313902
downvote count: 0
type: Answer
has body: i am using centos and getting same error when run mvn command with goal, install. After some googling i have found the solution to run following command. sudo yum install java-1.8.0-openjdk-devel
upvote count: 5

http://stackoverflow.com/comment/41263392
comment on: http://stackoverflow.com/a/26295890
type: AnswerComment
has text: But now its showing the exception at System.out.println(bi.toString()); ........hows it possible.....its shwing the output...still exception at that line....
type: Comment
score: 0

http://stackoverflow.com/comment/41351574
has text: Firstly, thanks for your reply! The `JOptionPane` won't be a part of the final program, it was just a placeholder that could block an immediate update to the button so the change could be better observed. Further I was hoping that I wouldn't have to encapsulate the main program within a JavaFX application as I wish to optionally turn the 'progress bar' on or off at the start of the program. Thus potentially not using JavaFX at all.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26344785

http://stackoverflow.com/comment/41359016
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26349046
has text: so what is your question?
score: 1

http://stackoverflow.com/comment/53822507
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26227344
has text: I'm not sure what you're really asking. Is it sane? Well, it's not insane, but it would be considerably better if they used /dev/urandom on linux. I don't get what more there is to say. Why's the bounty here?

http://stackoverflow.com/comment/41263930
comment on: http://stackoverflow.com/a/26297389
has text: Of course, I thought OP was mainly interested in an idea how to start with this, not in a millisecond optimized helper function. That said, I would also prefer a regex solution..
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26337862
score: 0
has body: You should have a service level class that wraps the whole processing : read from database (and keep the id) create the MimeMessage send the message update database That way you can update database only if you could successfully send the message (ok just to the SMTP server, but starting from that point it is another story ...) Edit: in the context of spring-batch, the service level is spring-batch itself In the context of spring-batch, the reader part is fine, and you should certainly use a MimeMessageItemWriter to send the message. But you must be able to follow the steps described above. IMHO a simple solution would be to extend the MimeMessage in a class : class MessageAndId extends MimeMessage { private int databaseId; // or whatever your id is private boolean sendError; public MessageAndId(MimeMessage source, int databaseId) { super(source); this.databaseId = databaseId; sendError = false; } } Your ItemProcessor should convert your input to a MessageAndId, and your writer should be a composite writer, first calling a MimeMessageItemWriter with a custom error handler that would set sendErrorto true in its handle method, next calling the ItemWriter that would update the database knowing the database id and status of each message.
has comment: http://stackoverflow.com/comment/41341896
type: Answer
answers question: http://stackoverflow.com/q/26337187

http://stackoverflow.com/q/26292038
tagged with: grid-layout
answer count: 0
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26270276
has comment: http://stackoverflow.com/comment/41255347
score: 3
favorite count: 0
type: Question
tagged with: swt
tagged with: gridlines
upvote count: 3
has comment: http://stackoverflow.com/comment/41261545
tagged with: java
linked to: http://stackoverflow.com/q/2444004
has comment: http://stackoverflow.com/comment/73962016
has comment: http://stackoverflow.com/comment/41257613
has body: I want to know how to make the Grid lines visible in SWT Grid Layout. I can arrange widgets in a grid layout. But now I want to make those grid lines visible. So then it would be just like a table. Is there any way to do that? Note-I don't want to use a table for this, because by using a table too it seems that making cell borders visible is impossible when widgets are included inside table cells-(How to set lines visible in SWT table, including widgets in cells?)
has title: How to make Grid lines visible in SWT Grid Layout?
has comment: http://stackoverflow.com/comment/41254480

http://stackoverflow.com/comment/41110086
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26213798
has text: @VikasVerma return type is not considering here. you can use `return` keyword inside the method return type as void. Just try.`public void tryThis(){ boolean status = true; try { if (status) { System.out.println(status); return; } else { // do the stuff } System.out.println(status); } finally { System.out.println("come to finally"); } }`

socket.io
tags question: http://stackoverflow.com/q/26313167
tags question: http://stackoverflow.com/q/26207380
type: Tag
tag name: socket.io
tags question: http://stackoverflow.com/q/26219032

http://stackoverflow.com/comment/41920262
type: Comment
has text: @CommonsWare Sorry, I have another question: 10 seconds of samples at SENSOR_DELAY_FASTEST or SENSOR_DELAY_GAME are a huge amount of data. If I choose the dimension of the circular buffer depending on the sensor delay, if it is equals to SENSOR_DELAY_FASTEST, I could have even 1000 samples per second, right? What should I use to save these samples on a file? Maybe an AsyncTask? Sorry I'm getting confused
type: QuestionComment
comment on: http://stackoverflow.com/q/26326455
score: 0

http://stackoverflow.com/comment/41255604
has text: Timer timer = new Timer(); // here i am getting error and i am not using any separate Timer class
comment on: http://stackoverflow.com/q/26292729
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26332392
has comment: http://stackoverflow.com/comment/41328509
has comment: http://stackoverflow.com/comment/41328875
tagged with: java
has comment: http://stackoverflow.com/comment/41328485
has comment: http://stackoverflow.com/comment/41328602
type: Question
has comment: http://stackoverflow.com/comment/41328453
has comment: http://stackoverflow.com/comment/41328469
has body: I am trying to solve this task: In this exercise you will write a program that estimates the value of π. Pretend that we are looking at a dartboard in the picture above. If the square is 2units wide and 2 units high, the radius of the circle within the square is 1 unit. Then the area of the circle is π*r2 = π*12 = π. The area of the square will be 2*2 = 4. The estimation of π will work by randomly “throwing darts” at the dartboard. We will assume that every dart will hit the board but the location of that strike will be random so some darts will land inside the circle and some will land outside the circle. The calculation of π is then the ratio of the number of darts that land inside the circle to the total number of darts, multiplied by 4. Note that as we increase the number of darts used in the simulation, the accuracy improves. Follow the steps to complete the program: Declare variables that represent x, y coordinates of a dart, the distance of the dart from the origin, the number of darts that land inside the circle, and the total number of darts. Read in the total number of darts (N) from the user and create an instance of the Random class. Create a loop that runs N times. Inside the loop, you will use the nextFloat() method of the Random class to create x, y coordinates randomly, and then compute the distance of the dart from the origin. Determine whether the dart lands inside or outside of the circle. Compute π using the estimation algorithm. Run the program with increasing numbers from 100 to 100,000,000 and observe the accuracy of π. Here is my program I wrote. It works to some extent, but results seems incorrect for input like 100000. Can anyone explain what's wrong with my code? import java.util.Scanner; import java.util.Random; public class calculatePI { public static void main(String[] args) { double x; double y; double distance; int i = 0; float inside = 0; float outside = 0; float totalDarts; Scanner scan = new Scanner(System.in); Random random = new …
has title: Why is my code giving incorrect results for big numbers?
has comment: http://stackoverflow.com/comment/41328564
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41328710
has answer: http://stackoverflow.com/a/26332701
accepted answer: http://stackoverflow.com/a/26332701
upvote count: 4
downvote count: 4
has comment: http://stackoverflow.com/comment/41328800
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41328585

http://stackoverflow.com/q/26205145
score: 0
has comment: http://stackoverflow.com/comment/41093456
answer count: 3
tagged with: nested
has comment: http://stackoverflow.com/comment/41093375
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26205170
has title: Returning a nested hashmap
tagged with: java
type: Question
has body: I have the two following HashMapswhere Student is an object I created and has the format Student(String, String) static HashMap&lt;String, Student&gt; hashMap = new HashMap&lt;&gt;(); static HashMap&lt;String, HashMap&lt;String, Student&gt;&gt; finalHashMap = new HashMap&lt;&gt;(); I created the following Students and added them to hashMap with the firstName as the Key Student st1 = new Student("julian", "rogers"); Student st2 = new Student("jason", "Smith"); hashMap.put("julian", st1); hashMap.put("jason", st2); Then I added hashMap to finalHashMap with the first letter of firstName as the key finalHashMap.put("j", hashMap); How can I return the hashmap with the key j? I tried creating a new hashmap and used get() but it did not work. I get a null pointer exception static HashMap&lt;String, Student&gt; hashMapTemp = new HashMap&lt;&gt;(); hashMapTemp.putAll(finalHashMap.get('j')); for (String key : hashMapTemp.keySet()) { System.out.println(key + " " + hashMapTemp.get(key)); } OUTPUT java.lang.NullPointerException at java.util.HashMap.putAll(Unknown Source) Note: I tried using put() and also got the same error.
tagged with: hashmap
has answer: http://stackoverflow.com/a/26205211
has answer: http://stackoverflow.com/a/26205208
has comment: http://stackoverflow.com/comment/41093422

http://stackoverflow.com/q/26310429
upvote count: 0
tagged with: string
favorite count: 0
has title: JAVA : how to repeat string in multiple lines
has answer: http://stackoverflow.com/a/26310489
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41288241
tagged with: java
has body: I'm looking for a simple way to repeat a same string in multiple lines. eg. String str = "ABC"; How to make the output looks like this by using For loop: ABCABCABC ABCABCABC ABCABCABC
has answer: http://stackoverflow.com/a/26310495
type: Question
score: -4
downvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/26310447

http://stackoverflow.com/comment/41238674
type: AnswerComment
comment on: http://stackoverflow.com/a/26282731
type: Comment
has text: @ajb Oops, I totally missed that. That's what happens when you copy and paste code from the question and fix only the things you expect to be wrong.
score: 0

http://stackoverflow.com/q/26336067
has answer: http://stackoverflow.com/a/26336111
accepted answer: http://stackoverflow.com/a/26336102
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/26336157
has answer: http://stackoverflow.com/a/26336102
favorite count: 0
has body: Suggest I have follow two values: 123456789 123456789111 Does String.replaceAll can do follow? 123456789 -&gt; XXXXXX789 123456789111 -&gt; XXXXXXXXX111 for mask last three numberic, but replace other characters to X? Please noted the count of X in sample. Thanks in advance.
answer count: 3
has title: Java how to using Regex mask numberic as I expected
possible better answer: http://stackoverflow.com/a/26336111
tagged with: regex

http://stackoverflow.com/q/26314283
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have entity named as Data class Data { String Name; int Age; // Constructor &amp; Getters &amp; Setters } When I use ObjectMapper Data objData = new Data("XYZ",3); ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.writeValueAsString(objData)); Output : {"name":"XYZ","age":3} it convert field name into lower case. How can I get output like {"Name":"XYZ","Age":3}
type: Question
score: 5
has comment: http://stackoverflow.com/comment/41294663
upvote count: 5
tagged with: jackson
has comment: http://stackoverflow.com/comment/41294684
has answer: http://stackoverflow.com/a/26314628
downvote count: 0
answer count: 1
has title: ObjectMapper writeValueAsString() method convert field name into lowercase
favorite count: 0
accepted answer: http://stackoverflow.com/a/26314628
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41294635

http://stackoverflow.com/a/26331271
downvote count: 0
has body: I would keep it simple and collect the headers in a list or set then create a new HashMap at each line by looping over the list instead of trying to recycle the same map.
upvote count: 3
answers question: http://stackoverflow.com/q/26331187
type: Answer
score: 3

http://stackoverflow.com/comment/41156548
score: 0
comment on: http://stackoverflow.com/a/26238429
type: Comment
has text: aah i see but in the getter we could return an immutable collection ;) :p
type: AnswerComment

http://stackoverflow.com/comment/41358498
has text: I will! How are booleans values handled? Thats not file or String what type is it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26323129
type: Comment

http://stackoverflow.com/comment/41082736
comment on: http://stackoverflow.com/q/26198921
has text: Unfortunately, I don't have enough reputations to upload a photo so i'll just write the project setting. Inside the project (Dynamic Web Project) there are the following items: * deployment descriptor, * JAX-WS web services, * java resources(/src/com.example.web/BeerSelect.java, libraries), * Javascript Resources, *Webcontent: Meta-INF/MANIFEST.MF and WEB-INF/lib/web.xml and form.html
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26232235
score: 2
accepted answer of: http://stackoverflow.com/q/26232087
downvote count: 0
answers question: http://stackoverflow.com/q/26232087
has body: While you can use tools like Java Native Access to interface easily with C code, there are limits. One is that you need to declare the structure of my_structure in Java (JNA doesn't parse C code, it parses Java code which describes C code and structures). This means you always have to keep the two in sync. Worse, different C compilers have different defaults when it comes to alignment of fields in a structure (and many even have options to change those defaults). So a change in the compiler and/or the compiler options can break this brittle link. That's why I suggest you write some C code which dumps the internal structure into a file which Java then can parse. To make things easier, you can use a library which produces JSON or maybe Google's protobuf. Or solve the problem the same way on both ends and export the static structure into a file which then both the C and the Java code parse at runtime.
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41200752
type: QuestionComment
type: Comment
has text: do you have any problem in that flow?
comment on: http://stackoverflow.com/q/26262710
score: 0

http://stackoverflow.com/comment/51590964
type: Comment
type: QuestionComment
has text: Upping this question. I'm currently looking into a solution for the same problem. Seems that Hibernate is silently ignoring SINGLE_TABLE annotation and looks for tables (in your case) named AC_GUITAR, EL_GUITAR, AC_DRUM or ELECTRIC_DRUM. Ever managed to arrive to a conclusion? (why it isn't possible is also a good help)
score: 0
comment on: http://stackoverflow.com/q/26205820

http://stackoverflow.com/a/26292766
answers question: http://stackoverflow.com/q/26292674
type: Answer
has body: Because some members are not serializable! You have other options, Write your own serialize methods. see here Create a class that includes only members that can be serializable and you really use as data, then instantiate and put it to bundle.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26292674

http://stackoverflow.com/q/26326291
tagged with: java
accepted answer: http://stackoverflow.com/a/26326331
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41316926
has answer: http://stackoverflow.com/a/26326313
has answer: http://stackoverflow.com/a/26326331
has body: I know that in Java an enum constant is implicitly static final variable. But the enum class can have an instance variable say size. So each enum constant will have a copy of 'size'. What is the equivalent Java code for this? I mean it "seems" the static enum constant is using a non-static instance variable which is not possible normally? enum Members{ A(1),B(2),C(3); // I have 3 enum constants here private int size; Members (int size) { //System.out.println("Initializing var with size = "+size); } } Equivalent code I know so far: public final class Member extends Enums&lt;Members&gt; { public static final Members A; // ... // What happened to size? How do A,B,C get a copy of size? } Edit : To restate my question- I am interested in behind the scene implementation by compiler. I already know how to use enums. I am looking for what the compiler does? (so for example, if I simply write A, the compiler translates it to "public static final Member A". I want to know how compiler gives a copy of size to each A,B,C.
upvote count: 3
possible better answer: http://stackoverflow.com/a/26326313
answer count: 2
has title: How does java support instance variables of java enum constants?
tagged with: enums

http://stackoverflow.com/comment/41172993
type: Comment
comment on: http://stackoverflow.com/a/26246751
type: AnswerComment
has text: @DrewDusang If it isn't visible, you may have to use javascriptExecutor to get the element, or the value from the element.
score: 0

http://stackoverflow.com/comment/41311716
score: 0
type: Comment
type: QuestionComment
has text: post your manifest file
comment on: http://stackoverflow.com/q/26323447

http://stackoverflow.com/q/26277538
has answer: http://stackoverflow.com/a/26277922
tagged with: java
type: UnansweredQuestion
has body: I am currently writing a Jenkins plugin, where I have a button that starts a build. In the Java code that is executed when the user clicks the button, there are some cleartool commands. First, it creates a view: Runtime.getRuntime().exec("cmd.exe /c cleartool mkview -tag " + viewTag + " " + viewPath); Then there is a call to a method that creates the config spec file and writes the correct content to it: createFile(); After that it updates the config spec: Runtime.getRuntime().exec("cmd.exe /c cleartool setcs -tag " + viewTag + " " + path"); And at the and of the method it starts the build: Hudson.getInstance().getQueue().schedule(project, 0, new CauseAction(new Cause.UserIdCause())); First, there was the problem that the config spec wasn't set correctly, it was always missing several lines. I inserted Thread.sleep(1000) in the code in order to wait for the createFile-method to finish writing the file. Now the config spec seems to be set correctly, so I assume that this issue is done. However, I now have another problem: When I go to the ClearCase Explorer, look at the properties of my view and select the tab 'Profile', I get the following error message: Can not determine if the view is associated. The config spec for the 'myViewTag' view has been modified outside of the ClearCase View Profile tools, and can no longer be interpreted by the tools. Would you like to attempt an automatic recovery of the config spec? Is there anything I can do to handle or avoid this error?
tagged with: jenkins-plugins
tagged with: clearcase
downvote count: 0
type: Question
score: 1
favorite count: 0
tagged with: jenkins
has title: ClearCase View Profile: Can not determine if the view is associated
upvote count: 1
answer count: 1

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

http://stackoverflow.com/q/26204306
has comment: http://stackoverflow.com/comment/41091834
has body: sorry for my english! I have a problem with BigDecimal. I have created a SQLiteDatabase. Now I want to search with Search View. private void showResults(String query) { Cursor cursor = mDbHelper.searchCustomer((query != null ? query.toString() : "@@@@.@@")); if (cursor == null) { // } else { // Specify the columns we want to display in the result String[] from = new String[] { ItemDbAdapter.KEY_1, ItemDbAdapter.KEY_2, ItemDbAdapter.KEY_3, ItemDbAdapter.KEY_4, ItemDbAdapter.KEY_5, ItemDbAdapter.KEY_6, ItemDbAdapter.KEY_7, ItemDbAdapter.KEY_8}; // Specify the Corresponding layout elements where we want the // columns to go int[] to = new int[] { R.id.result_1, R.id.result_2, R.id.result_3, R.id.result_4, R.id.result_5, R.id.result_6, R.id.result_7, R.id.result_8}; SimpleCursorAdapter customers = new SimpleCursorAdapter(this, R.layout.customresult, cursor, from, to); mListView.setAdapter(customers); mListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { np.setValue(100); //Numberpicker Cursor cursor = (Cursor) mListView.getItemAtPosition(position); String 1 = cursor.getString(cursor.getColumnIndexOrThrow("1")); String 2 = cursor.getString(cursor.getColumnIndexOrThrow("2")); String 3 = cursor.getString(cursor.getColumnIndexOrThrow("3")); String 4 = cursor.getString(cursor.getColumnIndexOrThrow("4")); String 5 = cursor.getString(cursor.getColumnIndexOrThrow("5")); String 6 = cursor.getString(cursor.getColumnIndexOrThrow("6")); String 7 = cursor.getString(cursor.getColumnIndexOrThrow("7")); String 8 = cursor.getString(cursor.getColumnIndexOrThrow("8")); RelativeLayout customerLayout = (RelativeLayout) findViewById(R.id.custominfoLayout); if (customerLayout == null) { // Inflate the Customer Information View RelativeLayout leftLayout = (RelativeLayout) findViewById(R.id.rightLayout); View customerInfo = getLayoutInflater().inflate( R.layout.custominfo, leftLayout, false); leftLay…
possible better answer: http://stackoverflow.com/a/26204889
has answer: http://stackoverflow.com/a/26204889
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26204559
tagged with: bigdecimal
tagged with: database
tagged with: searchview
accepted answer: http://stackoverflow.com/a/26204559
tagged with: android
has title: String to BigDecimal
favorite count: 0

http://stackoverflow.com/comment/41119447
has text: Use `Arrays#toString` or `Arrays#deepToString`.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26219008
type: Comment

http://stackoverflow.com/q/26219595
possible better answer: http://stackoverflow.com/a/26219650
upvote count: 2
tagged with: package
has answer: http://stackoverflow.com/a/26219618
accepted answer: http://stackoverflow.com/a/26219618
type: Question
type: AnsweredQuestion
tagged with: java
has title: Are two java files in a directory considered a "package?"
has answer: http://stackoverflow.com/a/26219650
answer count: 3
downvote count: 0
favorite count: 0
has body: I have a directory that contains the following : 1) A.java 2) B.java Is this all that is required in order to call my directory a java 'package'? What if I compile both of them resulting in a directory with two additional .class files? Can it be considered a package then or are there other requirements/actions to take?
has comment: http://stackoverflow.com/comment/41121009
has answer: http://stackoverflow.com/a/26219844
score: 2

http://stackoverflow.com/comment/41199300
type: QuestionComment
has text: Then any advanced logging framework would do - log4j, slf4j+logback, log4j v2, ... just name the loggers uniquely, replace Syste.out/err println() with logging call and configure your log appenders to drop it into separate files.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26261400

http://stackoverflow.com/q/26291912
score: 2
has comment: http://stackoverflow.com/comment/41622767
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
has body: I have installed Hadoop 2.3.0 in windows and able to execute MR jobs successfully. But when I trying to execute MR jobs in normal privilege (without admin privilege) means job get fails with following exception. Here I tried with Pig Script sample. 2014-10-15 12:02:32,822 WARN [main] org.apache.hadoop.security.UserGroupInformation: PriviledgedActionException as:kaveen (auth:SIMPLE) cause:java.io.IOException: Split class org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit not found 2014-10-15 12:02:32,823 WARN [main] org.apache.hadoop.mapred.YarnChild: Exception running child : java.io.IOException: Split class org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit not found at org.apache.hadoop.mapred.MapTask.getSplitDetails(MapTask.java:362) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:403) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:342) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:163) Caused by: java.lang.ClassNotFoundException: Class org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit not found at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1794) at org.apache.hadoop.mapred.MapTask.getSplitDetails(MapTask.java:360) ... 7 more 2014-10-15 12:02:32,827 INFO [main] org.apache.hadoop.mapred.Task: Runnning cleanup for the task 2014-10-15 12:02:32,827 WARN [main] org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter: Output Path is null in abortTask() Update: I was able to drill down the problem and found that the exception raised in the following line at method "MapTask.getSplitDetails(MapTask.java:363)". private &lt;T&gt; T getSplitDetails(Path file, long offset) throws IOException { …
tagged with: hadoop2
linked to: http://stackoverflow.com/q/26600916
has comment: http://stackoverflow.com/comment/41420635
upvote count: 2
has answer: http://stackoverflow.com/a/30457308
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41815871
has comment: http://stackoverflow.com/comment/41420712
type: UnansweredQuestion
tagged with: windows
has title: Running Hadoop MR jobs without Admin privilege on Windows

http://stackoverflow.com/q/26300095
tagged with: dspace
type: AnsweredQuestion
type: Question
has title: How to add input form (feedback) in DSpace with really long data?
tagged with: http://stackoverflow.com/tag/xml
score: 0
has answer: http://stackoverflow.com/a/26302717
answer count: 1
accepted answer: http://stackoverflow.com/a/26302717
tagged with: java
has body: My boss wanted to add a select form in feedback form where the user is required to select his/her country. I can achieve this by: Select country = form.addItem().addSelect("country "); userType.setLabel("Country"); userType.addOption("","Please select your country"); userType.addOption("ABW","Aruba"); userType.addOption("AFG","Afghanistan"); &lt;----- Rest of countries from A to Z ---&gt; userType.setOptionSelected(parameters.getParameter("country","")); TextArea countryOther = form.addItem().addTextArea("countryOther"); countryOther.setValue(parameters.getParameter("countryOther", "")); I want to avoid cluttering the code with a really long list of countries. Is there an alternative to this like placing the list of countries in a separate place and just pull this information? Thanks in advance.

http://stackoverflow.com/comment/42554312
type: QuestionComment
has text: I know that this is a little old now - I never did adequately solve this. I tried a default constructor and setter with no luck. It seems that the method org.springframework.data.mongodb.core.MongoTemplate#assertUpdateableIdIfNotSet makes a check to see if the type of the Id field is of type ObjectId, String or BigInteger. Since my AccountId is none of these the exception is thrown. I've ended up manually setting the AccountId object prior to persisting by calling new ObjectId().toHexString() and passing the result to construct an AccountId. Not ideal, but it seems to work.
comment on: http://stackoverflow.com/q/26288402
score: 1
type: Comment

http://stackoverflow.com/a/26326870
score: 3
has body: Java is an object-oriented language. If you want to modify the properties of an object, then it must exist, as you cannot modify something which does not even exist. However, you can define class-level properties using the static keyword. static properties are class-level, therefore you do not need to instantiate an object of the given class to modify a static member. For instance, if you have a class called Bird, then a Bird can have instance-level properties, such as color. You can only modify the color of a Bird if it exists and through that Bird. You can also have a static property, like numberOfBirds, which defines a property of the Bird class, not Bird objects. You modify it through your class: public class Bird{ public String color = null; public static int numberOfBirds = 0; //... } Modifying the properties: //... Bird myBird = new Bird(); //instantiating a bird myBird.color = "black"; //modifying the color of a given bird Bird.numberOfBirds++; //...
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26326541
answers question: http://stackoverflow.com/q/26326541
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/comment/41129571
has text: What's the `Scanner` for?
type: QuestionComment
comment on: http://stackoverflow.com/q/26224075
score: 0
type: Comment

http://stackoverflow.com/q/26345969
type: Question
tagged with: java
tagged with: servlets
score: 0
answer count: 1
tagged with: jsp
type: UnansweredQuestion
has body: I have a jsp that calls a servlet. This servlet does some tasks and then I want to return to the page I was just at and reload it. This would be simple if I knew the exact url it would be each time using the redirectUrl. However, I can't hard code a value in this as it is dynamically created. Is there a way to do this when the previous url is Not known to me?
has title: Reload a jsp page from servlet when form data is involved
tagged with: http-redirect
has answer: http://stackoverflow.com/a/26347904

http://stackoverflow.com/comment/41294843
score: 0
type: Comment
type: QuestionComment
has text: I think Eclipse is able to unpack the JAR-file and pack it into the exported one
comment on: http://stackoverflow.com/q/26314404

http://stackoverflow.com/q/26258166
has answer: http://stackoverflow.com/a/34510802
has comment: http://stackoverflow.com/comment/41191674
has comment: http://stackoverflow.com/comment/41295172
type: Question
has body: I have created a batch file that passes some arguments to run a jar file. I want that when I drag a jar file to it, then it should take that as an argument. But when I do it, it only runs the batch file and does not take the file as an argument. Please help me.
accepted answer: http://stackoverflow.com/a/34510802
score: 0
tagged with: batch-file
tagged with: windows
answer count: 1
has title: Get the name of file as parameter in a batch application
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41191732
tagged with: java

http://stackoverflow.com/a/41487000
score: 0
type: Answer
has body: You can use your thread's class loader to get your file as an InputStream like this: Thread.currentThread().getContextClassLoader().getResourceAsStream("test.jsp"); The method getResourceAsStream() works for any file in the classpath, whether it's in a directory or inside a JAR.
answers question: http://stackoverflow.com/q/26251193

http://stackoverflow.com/a/26236888
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26233557
upvote count: 2
has body: Indeed, the problem was on the syntax (that was right, but not working everywhere) Creating an object from a Map generates a special JSON syntax that doesn't work on APIs below 19. That's why my application crashed under 4.3. To have a right syntax from a Map, I used this subterfuge : parseFeedData(new JSONObject(new Gson().toJson(object));
accepted answer of: http://stackoverflow.com/q/26233557
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/59508821

http://stackoverflow.com/comment/41363259
type: Comment
type: QuestionComment
score: 0
has text: Maybe try using a debugger or printing some debug statements? The most obvious thing to expect is a null Candidate that causes an NPE to get swallowed...
comment on: http://stackoverflow.com/q/26351563

http://stackoverflow.com/q/26242347
has comment: http://stackoverflow.com/comment/41163861
tagged with: tree
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26242881
has comment: http://stackoverflow.com/comment/41163879
has comment: http://stackoverflow.com/comment/41163722
type: Question
accepted answer: http://stackoverflow.com/a/26242881
tagged with: algorithm
downvote count: 0
answer count: 1
has body: I'm trying to do method that removes node from Binary search tree and I know my programming logic is right but I can't compare my focus node to the node's parents left child. It has to be sometimes null and I should be able to compare it to object right? Here is my code: public void deleteNode(Node node) { if (node.getParent().left().root == node) { node.getParent().setLeft(null); } else { node.getParent().setRight(null); } } So the line that is causing problems is: node.getParent().left().root == node Because it gives Nullpointerexception. But I know that it should be null, that is the point of the code. I wouldn't want to use try catch with NullPointerException either because it is bad.
has title: Binary Search Tree can't compare node to null
favorite count: 0
tagged with: binary-search-tree
upvote count: 1
has comment: http://stackoverflow.com/comment/41163468

http://stackoverflow.com/a/26308980
answers question: http://stackoverflow.com/q/26308965
score: 0
type: Answer
has body: The variable itself doesn't exist in that context. It's a static member of another class. So you need a reference to that class: System.out.print(Prizes.prizes[1]);

http://stackoverflow.com/a/41937852
score: 0
has body: check code here. Api used is docx4j-ImportXHTML. Code is simple to follow. Just pass on your xhtml to api as in code and it will do the needful.
answers question: http://stackoverflow.com/q/26297668
type: Answer

http://stackoverflow.com/q/26304492
has comment: http://stackoverflow.com/comment/41278912
answer count: 1
has answer: http://stackoverflow.com/a/26307895
has comment: http://stackoverflow.com/comment/41278884
favorite count: 0
upvote count: 28
tagged with: decompiler
tagged with: java-8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26307895
tagged with: java
score: 24
type: Question
has comment: http://stackoverflow.com/comment/41278962
has title: Decompiler supporting Java 8?
has body: I see that most of the Java decompilers support till Java 7. Are there any decompilers which support Java 8 - especially Lambda expressions? I want to run such a decompiler in my ubuntu machine.
downvote count: 4
has comment: http://stackoverflow.com/comment/88749494

http://stackoverflow.com/comment/41133836
type: Comment
comment on: http://stackoverflow.com/a/26226386
score: 0
type: AnswerComment
has text: isn't it what indexOf() is doing?

http://stackoverflow.com/q/26234067
linked to: http://stackoverflow.com/q/18691317
has title: How To Select literals in QueryDSL
tagged with: java
tagged with: hibernate
tagged with: orm
type: Question
has comment: http://stackoverflow.com/comment/41828111
has body: Im currently working on a project that uses queryDSL and hibernate wherein it requires a select literal. Following the examples posted here i have: createQuery(). from(path()). where(specification().getPredicate()). list( ConstructorExpression.create(Foo.class, Expressions.constant(BigDecimal.ONE))); where Foo class has a constructor which accepts a BigDecimal. When running this in test, i get org.hibernate.QueryException: Parameters are only supported in SELECT clauses when used as part of a INSERT INTO DML statement at org.hibernate.hql.internal.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:146) changing this to: createQuery() .from(path()). where(specification().getPredicate()) .list( ConstructorExpression.create(Foo.class, NumberTemplate.create(BigDecimal.class, "1.0"))); produces a different stacktrace: java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysema.query.types.ConstructorExpression.newInstance(ConstructorExpression.java:133) at com.mysema.query.jpa.FactoryExpressionTransformer.transformTuple(FactoryExpressionTransformer.java:50) I tried changing the Foo class constructor to accept Integer and the query modified to use Integer as well for the sake of testing and it did produces the correct query: createQuery() .from(path()). where(specification().getPredicate()) .list(ConstructorExpression.create(LevelBoundary.class, NumberTemplate.create(Integer.class, "1"))); Is using NumberTemplate the correct way to select BigDecimal literals? The NumberTemplate docs specifies T extending Number and Comparable but fails on non Integer types. How do i properly select constants/literals in qu…
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/33768629
has comment: http://stackoverflow.com/comment/41817638
favorite count: 0
has comment: http://stackoverflow.com/comment/41827673
accepted answer: http://stackoverflow.com/a/33768629
tagged with: querydsl
score: 6
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41818158

http://stackoverflow.com/a/26342721
upvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26342580
downvote count: 0
answers question: http://stackoverflow.com/q/26342580
type: Answer
has body: Lars, your problem is this line: if(mapOfExampleObjects.containsKey(name)) Your mapOfExampleObjects will always contain the key 'Ian' every time you go through the loop. What you want is more like: if( name.equals(entry.getKey()) )
has comment: http://stackoverflow.com/comment/41347612
score: 4

google-tag-manager
tags question: http://stackoverflow.com/q/26341376
type: Tag
tag name: google-tag-manager

http://stackoverflow.com/comment/41303458
type: QuestionComment
comment on: http://stackoverflow.com/q/26318929
has text: *"aren't there better solutions..."* then using an API which is designed to perform animation for you and which is been optimised for the running platform? That sounds a bit weird, I think you need to justify that statement
score: 0
type: Comment

illegalstateexception
tags question: http://stackoverflow.com/q/26317685
tags question: http://stackoverflow.com/q/26238505
tag name: illegalstateexception
tags question: http://stackoverflow.com/q/26243551
tags question: http://stackoverflow.com/q/26352632
type: Tag

http://stackoverflow.com/q/26296896
type: UnansweredQuestion
tagged with: spring
downvote count: 0
has answer: http://stackoverflow.com/a/26297685
score: 1
tagged with: java
tagged with: spring-data
has answer: http://stackoverflow.com/a/37204457
type: Question
tagged with: spring-data-jpa
answer count: 2
upvote count: 1
favorite count: 0
has body: I am working on a projet using Spring Data JPA. I've managed to dynamicly create datasource with BeanFactoryPostProcessor and switch to the desired one when i log in using AbstractRoutingDataSource. Now what i want to do in runtime is to: Get the map of the dynamically datasources with BeanFactoryPostProcessor Create a new datasource Put the recently created datasource in the map along with the others springContext-jpa.xml <?xml version="1.0" encoding="UTF-8"?> DatasourceRegisteringBeanFactoryPostProcessor.java @Component class DatasourceRegisteringBeanFactoryPostProcessor implements BeanFactoryPostProcessor { public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { // this is my list of Datasources List<Database> dbs = new ArrayList<Database>(); /* * Hidden code, here i get my list of Datasources */ BeanDefinitionRegistry factory = (BeanDefinitionRegistry) beanFactory; BeanDefinitionBuilder datasourceDefinitionBuilder; for (Database db : dbs) { datasourceDefinitionBuilder = BeanDefinitionBuilder .childBeanDefinition("BasicdsCargestWeb") .addPropertyValue("url", db.getUrl()+db.getName()+"?autoReconnect=true"); factory.registerBeanDefinition("cargestnet"+db.getId()+"ds", datasourceDefinitionBuilder.getBeanDefinition()); } // Configure the dataSource bean properties MutablePropertyValues mpv = factory.getBeanDefinition("dsCargestWeb").getPropertyValues(); // Here you can set the default dataSource mpv.removePropertyValue("defaultTargetDataSource"); mpv.addPropertyValue("defaultTargetDataSource", new RuntimeBeanReference("cargestnet1ds")); // Set the targetDataSource properties map with the list of connections ManagedMap<String, RuntimeBeanReference> mm = (ManagedMap<String, RuntimeBeanReference>) mpv.getPropertyValue("targetDataSources").getValue(); System.out.println("list size "+mm.size()); mm.clear(); for (Database db : dbs) { mm.put(db.getId().toString(), new RuntimeBeanReference("cargestnet"+db.getId()+"ds")); } } } The problem is that th…
tagged with: postgresql
has title: Spring : How to manage datasources created with BeanFactoryPostProcessor, at runtime?

http://stackoverflow.com/comment/41176184
comment on: http://stackoverflow.com/q/26241109
type: QuestionComment
has text: @peeskillet : Thanks a lot.!! I changed the code. It looks ok now. But still I do not get output. It says no content(Error 204). Any idea?
type: Comment
score: 0

http://stackoverflow.com/comment/41249323
type: QuestionComment
has text: In short, yes it is possible, as long you're using a .NET compatible Java implementation. Have a look at the [Enterprise Architect AddIn Model Docs](http://www.sparxsystems.com/enterprise_architect_user_guide/10/automation_and_scripting/creatingaddins.html).
comment on: http://stackoverflow.com/q/26288883
type: Comment
score: 1

http://stackoverflow.com/q/26262834
upvote count: 1
tagged with: oracle11g
has title: Generating PDF containing SVG images using Apache FOP in an Oracle database
has body: I am trying to generate PDF documents inside an Oracle 11g database using Apache FOP. I have installed the classes from the following JAR files into my schema, using the loadjava tool: commons-logging-1.0.4.jar commons-io-1.3.1.jar avalon-framework-4.2.0.jar xml-apis-ext-1.3.04.jar xalan-2.7.0.jar serializer-2.7.0.jar xmlgraphics-commons-1.5.jar batik-all-1.7.jar fop.jar While inside the database, I can generate PDF documents without graphics. The same code outside the database (command-line) creates PDF documents with all the relevant graphics. The inline SVG graphics seem to simply be ignored while executing within the database. Outside the database they are rendered correctly by Batik. Have you successfully used Apache FOP to generate PDF documents containing SVG graphics, in an Oracle database? What suggestion(s) can you make? I have one graphic defined as &lt;fo:external-graphic content-width=".5in" content-height=".5in" src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgA..." /&gt;. This renders correctly outside the database, and causes a permission error while executing within the database: ORA-29532: Java call terminated by uncaught Java exception: javax.xml.transform.TransformerException: java.security.AccessControlException: the Permission (java.lang.RuntimePermission getClassLoader) has not been granted to ProtectionDomain (null &lt;no signer certificates&gt;) com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl$TransletClassLoader@98644313 &lt;no principals&gt; java.security.Permissions@b0558743 ( (java.lang.RuntimePermission modifyThreadGroup) (java.lang.RuntimePermission createSecurityManager) (java.lang.RuntimePermission modifyThread) (java.lang.RuntimePermission preferences) (java.lang.RuntimePermission exitVM) (java.util.PropertyPermission user.language write) (java.util.PropertyPermission * read) (oracle.aurora.security.JServerPermission LoadClassInPackage.*) ) Within the database, I know how to grant permissions to my schema; however I don't…
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26263308
favorite count: 0
tagged with: apache-fop
tagged with: oracle-database
tagged with: http://stackoverflow.com/tag/svg
type: UnansweredQuestion

http://stackoverflow.com/a/26318418
downvote count: 0
has comment: http://stackoverflow.com/comment/41302911
has comment: http://stackoverflow.com/comment/41302874
has comment: http://stackoverflow.com/comment/41302496
has comment: http://stackoverflow.com/comment/41302311
has comment: http://stackoverflow.com/comment/41302676
score: 1
has body: Make your class implement onClickListener, override the OnClickListener() method in the class.
has comment: http://stackoverflow.com/comment/41302732
has comment: http://stackoverflow.com/comment/41302369
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26318397

http://stackoverflow.com/comment/41323745
comment on: http://stackoverflow.com/a/26328684
has text: I re-edited my answer, providing a reproducible example that works for me. Let me know.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41245472
type: QuestionComment
has text: @David Wallace I saw it. This compares both of type T extends Number. So if the 1st one is Long the second should be only long which is no problem.
comment on: http://stackoverflow.com/q/26283239
score: 0
type: Comment

http://stackoverflow.com/a/26250676
has comment: http://stackoverflow.com/comment/41179008
has body: This scenario -where you do lots of things and want to abort and log if any of them fails - is what exception handling is designed for. For example: try { // Step 1 Map&lt;String, SomeObject&gt; objectsMap = someService.createObjectsMap(); if (objectsMap.isEmpty()) throw new SomethingWentWrongException("Failed to get object map from service"); // Step 2 AnotherObject anotherObject = anotherService.createAnotherObject(objectsMap); if(anotherObject == null) throw new SomethingWentWrongException("Failed to create another object"); // Step 3 that gets anotherObject as input and returns something else } catch(SomethingWentWrongException e) { // log and handle e.printStackTrace(); } Ideally, someService.createObjectsMap and anotherService.createAnotherObject would throw their own exceptions instead of making you check the return value. Then you would only need to write: try { Map&lt;String, SomeObject&gt; objectsMap = someService.createObjectsMap(); AnotherObject anotherObject = anotherService.createAnotherObject(objectsMap); // Step 3 that gets anotherObject as input and returns something else } catch(Exception e) { // log and handle e.printStackTrace(); } (although note that you should only catch Exception if you really want to catch all failures)
answers question: http://stackoverflow.com/q/26250321
has comment: http://stackoverflow.com/comment/41179043
score: 0
has comment: http://stackoverflow.com/comment/41180335
type: Answer

http://stackoverflow.com/comment/41306954
comment on: http://stackoverflow.com/a/26320884
has text: Missing semi-colons, if statement is syntactically incorrect, doesn't check for end of stream. This code would never compiler under a normal compiler.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/26328980
has comment: http://stackoverflow.com/comment/41322431
accepted answer of: http://stackoverflow.com/q/26328915
type: Answer
answers question: http://stackoverflow.com/q/26328915
has comment: http://stackoverflow.com/comment/41322810
has comment: http://stackoverflow.com/comment/41322760
has comment: http://stackoverflow.com/comment/41322227
has comment: http://stackoverflow.com/comment/41322768
has comment: http://stackoverflow.com/comment/41322372
score: 0
has comment: http://stackoverflow.com/comment/41322354
type: AcceptedAnswer
has body: You are missing the @Override annotations above the methods of the anonymous classes. Also you need you must implement both methods for interface to work. s1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { String val = s1.getSelectedItem().toString(); txt.setText(val); } @Override public void onNothingSelected(AdapterView&lt;?&gt; adapterView) { } }); s2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { String val = s2.getSelectedItem().toString(); txt.setText(val); } @Override public void onNothingSelected(AdapterView&lt;?&gt; adapterView) { } });
has comment: http://stackoverflow.com/comment/41322210
has comment: http://stackoverflow.com/comment/41322083

http://stackoverflow.com/a/26292146
score: 1
has body: You can use context or context.getContentResolver();
accepted answer of: http://stackoverflow.com/q/26292109
answers question: http://stackoverflow.com/q/26292109
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/26218640
tagged with: jetty
linked to: http://stackoverflow.com/q/10339451
tagged with: ubuntu-12.04
type: Question
has body: I install jetty 9 server in my Ubuntu server VCS. Structure of java rest project: /opt/jetty/webapps/backend / build conf lib libs logs src/com/example/package/backend resources CategoryResource.java BackendServer.java web WEB-INF web.xml BackendServer.java import com.sun.jersey.api.container.httpserver.HttpServerFactory; import com.sun.jersey.api.core.PackagesResourceConfig; import com.sun.net.httpserver.HttpServer; public class BackendServer { public static void main(String[] args) throws IOException { HttpServer server = HttpServerFactory.create("http://localhost:" + "8080" + "/" + "backend/rest", new PackagesResourceConfig("com.droidbrew.androcommerce.backend.resources")); DbManager.getInstance(); server.start(); System.out.println("Server running"); System.out.println("Hit return to stop..."); System.in.read(); System.out.println("Stopping server"); server.stop(0); System.out.println("Server stopped"); } } CategoryResource.java Path("/category") public class CategoryResource { @GET @Path("/get_all_categories") @Produces({MediaType.APPLICATION_JSON}) public String getAllCategories() throws SQLException { List<Category> categoryList = DbManager.getInstance().getBackendCategoryManager().getAllCategories(); Gson gson = new Gson(); return gson.toJson(categoryList); } } web.xml <?xml version="1.0" encoding="UTF-8"?> Jersey index.html Jersey REST Service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.droidbrew.androcommerce.backend.resources 1 Jersey REST Service /rest/* /opt/jetty/webapps/backend.xml <?xml version="1.0"?> org.mortbay.jetty.webapp.WebInfConfiguration org.mortbay.jetty.plus.webapp.EnvConfiguration org.mortbay.jetty.plus.webapp.Configuration org.mortbay.jetty.webapp.JettyWebXmlConfiguration org.mortbay.jetty.webapp.TagLibConfiguration / <SystemProperty name="jetty.home" default="."/>/webapps/backend jdbc/development user 1111 development localhost 5432 But after I start service jetty start and try conne…
has title: Start Jersey application with Jetty
tagged with: jersey
tagged with: java
has answer: http://stackoverflow.com/a/26219306
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/41101389
type: Comment
comment on: http://stackoverflow.com/a/26202008
score: 0
type: AnswerComment
has text: Hi Rüdiger Herrmann, I am adding another request on this same program. As your program works fine to open multiple browser one after the another. Could you please change your program little bit to open the second browser after previous browser is loaded completely plus the few second of delay. I tried to do it using Multi-threading, but its giving me error of "Exception in thread "Thread-0" org.eclipse.swt.SWTException: Invalid thread access". Please help! Please let me know if you want me to post as another question for this problem. I hope to hear from you soon!

http://stackoverflow.com/comment/41268364
comment on: http://stackoverflow.com/q/26297409
score: 0
type: QuestionComment
type: Comment
has text: What text? What do you mean by dark? Black? Not coloured?

http://stackoverflow.com/comment/41136124
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26227393
has text: @PM77-1 Yeah, It was just an experimental program that would open a new window when I clicked the button but thank you for pointing that out.
score: 0

http://stackoverflow.com/q/26223835
downvote count: 2
has comment: http://stackoverflow.com/comment/41129753
type: Question
has comment: http://stackoverflow.com/comment/41129503
tagged with: java
has comment: http://stackoverflow.com/comment/41129106
has comment: http://stackoverflow.com/comment/41129714
has comment: http://stackoverflow.com/comment/41129234
answer count: 3
has comment: http://stackoverflow.com/comment/41129141
upvote count: 0
score: -2
has body: My Problem. A string can only contain the numbers "0" and / or "1". it is possible to check the string with "match" to 1 and 0? if yes, how do I have to "match" write. if (eingabe.length() &lt;= 0 || eingabe.matches("[0-1]")) { System.err.println("Bitte geben Sie mindestens eine Ziffer von 0 bis 1 ein."); System.exit(1); } Thank you.
favorite count: 0
has comment: http://stackoverflow.com/comment/41130274
has answer: http://stackoverflow.com/a/26223933
has title: Java match Code for Number "0" and "1"
tagged with: regex
has comment: http://stackoverflow.com/comment/41129389
has answer: http://stackoverflow.com/a/26224218
has answer: http://stackoverflow.com/a/26223903
type: UnansweredQuestion

http://stackoverflow.com/a/26326109
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41318789
answers question: http://stackoverflow.com/q/26325781
has comment: http://stackoverflow.com/comment/41317247
has comment: http://stackoverflow.com/comment/41317013
has comment: http://stackoverflow.com/comment/41318759
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26325781
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41319065
has body: First, when we say - myaccount.name it means myaccount is an instance of MyAccount class and it has a member variable defined and which is name For example - class MyAccount { String name; public static void main (String...a) { //here am allowed to say myaccount.name MyAccount myaccount = new MyAccount(); } } Second, the statement System.out.println("My Account = " + myaccount.name " " + myaccount.address " " + myaccount.type " $" + myaccount.balance); is all wrong. Modify it to System.out.println("My Account = " + myaccount.name + " " + myaccount.address + " " + myaccount.type + " \\$" + myaccount.balance); Now, you should get another exception which should tell you non-static variable address cannot be referenced from a static context. It means if you want to access name in the context of main which is static - you need to change the declaration of name to static String name; Third, we can have only one public class in file. Change public class printcode to class printcode. Need not to consider this if both classes are in different files. Hope this helps. I copy pasted both the classes in one file.
has comment: http://stackoverflow.com/comment/41317154
type: Answer

http://stackoverflow.com/comment/41352714
comment on: http://stackoverflow.com/a/26331295
type: Comment
score: 0
type: AnswerComment
has text: I have since reopened the question, since I found out that Java 8 isn't supported by the IDE that I am to use.

http://stackoverflow.com/comment/41127353
has text: why sir? could it be the AbsoluteLayout?
type: QuestionComment
comment on: http://stackoverflow.com/q/26221812
score: 0
type: Comment

http://stackoverflow.com/comment/41331326
type: Comment
comment on: http://stackoverflow.com/a/26333441
score: 0
type: AnswerComment
has text: fresh means newly downloaded or previously never used eclipse editor,

http://stackoverflow.com/q/26342786
tagged with: parsing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41347404
tagged with: java
downvote count: 1
type: Question
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/41348156
has answer: http://stackoverflow.com/a/26342863
score: -1
has body: trying to extract title from website, when printing title i get a stream closed error. trying to extract between title tags such as . not familiar wit parsing please be thorough when explaining. thanks. import java.lang.*; import java.util.Scanner; import java.net.*; import java.io.*; public class Allrecipes{ public static void main(String[] args) throws Exception{ System.out.println("Colby Mehmen"); Scanner input = new Scanner(System.in); String str1 = ""; str1 = compare(); if (str1.contains("http://allrecipes.com")){ URL oracle = new URL(str1); BufferedReader in = new BufferedReader( new InputStreamReader(oracle.openStream())); String html; while ((html = in.readLine()) != null) in.close(); String page = html; int start = page.indexOf("&lt;title&gt;"); int end = page.indexOf("&lt;/title&gt;"); String title = page.substring(start+"&lt;title&gt;".length(),end); System.out.println(title); }//end program }
has comment: http://stackoverflow.com/comment/41348139
has comment: http://stackoverflow.com/comment/41348169
upvote count: 0
accepted answer: http://stackoverflow.com/a/26342863
has comment: http://stackoverflow.com/comment/41348240
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has title: HTML tag parsing extracting title and others
favorite count: 0

http://stackoverflow.com/comment/41178491
has text: Well, first of all, looking at the code you have, you have to populate your weatherArray with entries. Have you tried to call `weatherData.nextLine()` and see what it returns? (use `System.out.println()` for example)
comment on: http://stackoverflow.com/q/26250498
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26209191
answers question: http://stackoverflow.com/q/26209122
has body: There are several methods to do this, but you need to get the last word in the firstLine string, then compare it with the secondLine string. You can use the substring() method on your line, then use the lastIndexOf() method with the argument " " (i.e. whitespace). If you add one to this you will have the index of the first letter of the last word in your string.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26209122
score: 0
has comment: http://stackoverflow.com/comment/41101228
type: Answer

datepicker
tags question: http://stackoverflow.com/q/26341410
tags question: http://stackoverflow.com/q/26330348
tag name: datepicker
type: Tag
tags question: http://stackoverflow.com/q/26213398

http://stackoverflow.com/comment/41225665
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26275859
score: 1
has text: As I said, it was for inspiration. You could extend the `ProgressTask` interface and add a `getResult()` method. This method is invoked only when `getProgress()` reaches 1 (100%). For your use case, getResult() will return the PDF (byte array) and you can stop polling and redirect to the PDF.

http://stackoverflow.com/comment/41153612
type: QuestionComment
type: Comment
has text: Where is the question in your question?
score: 0
comment on: http://stackoverflow.com/q/26237322

http://stackoverflow.com/q/26287696
has title: How to use CDI / weld without javax.el and javax.servlet.jsp in classpath
has body: Is is possible to use weld (CDI) without java.el or javax.servlet.jsp present? Those 2 packages are awfully heavyweight for deployment, and are not terrible useful on some environments (such as Android). It seems that the org.jboss.weld.environment.servlet.WeldServletLifecycle.initialize() does some lookups for both of those. At least, is is possible to have the apis for el and jsp present, but without an implementation (ie, a null implementation)? Or stated another way, is el and jsp a requirement for CDI to exist? And yes, it is possible to have a non-CDI servlet environment without javax.el and javax.servlet.jsp present.
has comment: http://stackoverflow.com/comment/41247245
favorite count: 0
tagged with: cdi
type: UnansweredQuestion
tagged with: weld
score: 2
has comment: http://stackoverflow.com/comment/41247093
answer count: 0
downvote count: 0
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: jboss-weld
has comment: http://stackoverflow.com/comment/41247296
has comment: http://stackoverflow.com/comment/41247193
upvote count: 2

http://stackoverflow.com/comment/41436803
has text: That tutorial is from 2012, everything in that tutorial is an error now. Nothing from that site will work, its 2 years old and Facebook have new SDk with new coding, so no, it didnt solve any of my problem, it only took my time. Thank you.
type: AnswerComment
comment on: http://stackoverflow.com/a/26383254
type: Comment
score: 1

web-container
tag name: web-container
tags question: http://stackoverflow.com/q/26230646
type: Tag

http://stackoverflow.com/comment/41092863
score: 0
type: Comment
has text: I tried it, it doesn`t change anything. Is there another way when I use an own matrix system ? I`m calculating them on my own and using GLSL 400.
type: AnswerComment
comment on: http://stackoverflow.com/a/26204833

http://stackoverflow.com/q/26280406
possible better answer: http://stackoverflow.com/a/44548101
favorite count: 0
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/41234050
has answer: http://stackoverflow.com/a/44548101
type: AnsweredQuestion
tagged with: java
has title: how to specify class path for java agent
has answer: http://stackoverflow.com/a/27452709
has body: I am write a Java Agent to instrument a target Method of a target Class. I use the javassist library to do instrument. So the java agent (let named CnAgent.class) need its dependency : javassist library to run. The directory hierarchy is : . ├── META-INF │ └── MANIFEST.MF ├── com │ └── yet │ └── another │ └── test │ └── agent │ ├── CnAgent.class │ └── CnTransformer.class └── lib └── javassist-3.18.2-GA.jar and the MANIFEST.MF file content is : Manifest-Version: 1.0 Class-Path: lib/javassist-3.18.2-GA.jar . Agent-Class: com.yet.another.test.agent.CnAgent Created-By: 1.8.0_11 (Oracle Corporation) Can-Retransform-Classes: true I create jar ball by following command: jar cvfm CnAgent.jar META-INF/MENIFIEST.MF . lib when I load the Agent with Attach API of JVM. the error prints : error when transform : javassist/ClassPool java.lang.NoClassDefFoundError: javassist/ClassPool which means the javassist library cannot be found by agent code. So my question is : How to set Agent library's class path letting it find the dependencies? Why the Class-Path option in MANIFEST.MF not works , does it only for jar directly ran in command line ? Thanks your wisdom :)
accepted answer: http://stackoverflow.com/a/27452709
type: Question
answer count: 2
score: 5
tagged with: jvm-hotspot
tagged with: jvm
has comment: http://stackoverflow.com/comment/41233217

http://stackoverflow.com/q/26197745
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26198102
tagged with: towers-of-hanoi
has comment: http://stackoverflow.com/comment/41080234
type: UnansweredQuestion
tagged with: recursion
has answer: http://stackoverflow.com/a/26197954
has body: A simple recursive code for solving hanoi tower: public static void hanoi(char A, char B, char C, int n) { if(n&gt;0) { hanoi(A,C,B,n-1); System.ouit.println("moving from " + A + " to " + B); hanoi(C,B,A,n-1); } } Me and my fellow student were checking this code today and while we know how it works, we fail to understand the algorithm, meaning we would never think of a such solution. I do remember that a teacher once said, we don't care how it's solved, we just assume it is. He was referring to the part where a function calls itself. I do know that we are basicly solving hanoi towers in 2 steps. First moving all rings to C ( this is a code from teacher and in this case we want to move all rings to B not C ), then moving the biggest ring to B and then moving all remaining rings from C to B. I do understand that in the first call we are moving from A to C and in second from C to B. I wrote on a paper how the code executes and got correct prints, but still i do not understand. I understand but i dont understand, if you understand what i mean. ps: i checked many videos and links i found, none gave me any worthy answers as to how would you think of a such algorithm out of the blue. This is different then, for instance fibonaccis sequence, which is logical. But this ... edit: It is hard for me to even explain what i dont understand, i never had problems at programming before. I know how this code works, i can write the whole procedure on paper. I know how to solve hanoi tower. But if you were to give me an assignment to write an algorithm for hanoi towers, i would never think of this. I am looking at this code and i am saying, how the hell did this code give the correct printout ? I have a problem with this leap of faith, yet somehow this is how recursion works. Basicly for first 2 rings i have no trouble understanding that this algorithm works. But from then on, moving rings is different because you already have 2 rings sitting on a nail and you have to move them before …
tagged with: java
has title: Tower of Hanoi - simple algorithm
type: Question
has comment: http://stackoverflow.com/comment/105805604
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41080229

http://stackoverflow.com/comment/46247796
type: QuestionComment
has text: We are seeing "javax.servlet.ServletException: WELD-000341: Unable to load current conversations from the associated request, something went badly wrong when associate() was called" also. This is on GlassFish 4.1. We're tracking the bug here: https://github.com/IQSS/dataverse/issues/1516
type: Comment
comment on: http://stackoverflow.com/q/26251199
score: 0

http://stackoverflow.com/a/26339511
has body: That is just one difficulty that you have to solve for multiple inheritance in a language. Since there exist languages that do have multiple inhertance (e.g. Common Lisp, C++, Eiffel), it is obviously not insurmountable. Common Lisp defines the exact strategy for priorizing (ordering) the inheritance graph, so there is no ambiguity in the rare cases where it does matter in practice. C++ uses virtual inheritance (I have not yet put the effort in to understand what that means). Eiffel allows to specify exactly how you want to inherit, possibly renaming methods in the subclass. Java just skipped multiple inheritance. (I personally think that it is difficult not to be insulting to its designers while trying to rationalize this decision. Of course, it is hard to think about a thing when the language you think in does not support it.)
score: 7
upvote count: 7
downvote count: 0
answers question: http://stackoverflow.com/q/26339237
type: Answer

http://stackoverflow.com/a/30819194
answers question: http://stackoverflow.com/q/26197466
has body: The answer provided above is not efficient in terms of memory. It is using another array - transposedMatrix apart from array supplied as argument. This will lead to consume double memory. We can do this in-place as follows: public void transposeMatrix(int[][] a) { int temp; for(int i=0 ; i&lt;(a.length/2 + 1); i++) { for(int j=i ; j&lt;(a[0].length) ; j++) { temp = a[i][j]; a[i][j] = a[j][i]; a[j][i] = temp; } } displayMatrix(a); } public void displayMatrix(int[][] a){ for(int i=0 ; i&lt;a.length ; i++) { for(int j=0 ; j&lt;a[0].length ; j++) { System.out.print(a[i][j] + " "); } System.out.println(); } }
downvote count: 1
has comment: http://stackoverflow.com/comment/61214431
score: 3
upvote count: 4
type: Answer

http://stackoverflow.com/a/26316557
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26316277
has body: You can filter out all links that starts with # or are empty or contains only / during the select query e.g. document.select("a:not([href^=#])").select("a[href~=^/?[^/]+]"); This translates to select all a tags elements that are not starting with # and may start with / but in this case they cannot contain only / Here you can find a sample Groovy script I prepared for test - https://gist.github.com/wololock/719985e6c48f40f8935f Java code is almost the same, just remember about ; at the end of each line and change ' to ". This example shows how to extract all links without any further filtration.

http://stackoverflow.com/q/26208454
answer count: 4
favorite count: 0
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26209256
has answer: http://stackoverflow.com/a/36119414
has comment: http://stackoverflow.com/comment/41102952
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26210147
tagged with: java
tagged with: mapreduce
type: Question
upvote count: 2
tagged with: hadoop
has answer: http://stackoverflow.com/a/26210147
has title: Hadoop Word count: receive the total number of words that start with the letter "c"
has body: Heres the Hadoop word count java map and reduce source code: In the map function, I've gotten to where I can output all the word that starts with the letter "c" and also the total number of times that word appears, but what I'm trying to do is just output the total number of words starting with the letter "c" but I'm stuck a little on getting the total number.Any help would be greatly appreciated, Thank you. Example My Output of what I'm getting: could 2 can 3 cat 5 What I'm trying to get: c-total 10 public static class MapClass extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map(LongWritable key, Text value, OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter) throws IOException { String line = value.toString(); StringTokenizer itr = new StringTokenizer(line); while (itr.hasMoreTokens()) { word.set(itr.nextToken()); if(word.toString().startsWith("c"){ output.collect(word, one); } } } } public static class Reduce extends MapReduceBase implements Reducer&lt;Text, IntWritable, Text, IntWritable&gt; { public void reduce(Text key, Iterator&lt;IntWritable&gt; values, OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter) throws IOException { int sum = 0; while (values.hasNext()) { sum += values.next().get(); //gets the sum of the words and add them together } output.collect(key, new IntWritable(sum)); //outputs the word and the number } }
has answer: http://stackoverflow.com/a/69586651
has answer: http://stackoverflow.com/a/26209256

http://stackoverflow.com/comment/116290717
has text: Unfortunately the iconified property of the primary stage does not work anymore if the StageStyle is set to TRANSPARENT. So if you click the taskbar icon on windows you cannot react on this event on the primary stage and so the visibleStage stays maximized even if you want it to be minimized to the task bar.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26723082
type: Comment

http://stackoverflow.com/comment/41357620
comment on: http://stackoverflow.com/a/26347555
score: 0
type: AnswerComment
type: Comment
has text: @Tim: I need to load a java file so that the user could add a line to it, and then the app would load that java file as code into the app, instead of me actually writing it into the main class.

http://stackoverflow.com/comment/41364934
score: 0
has text: could you add another jar in classpath of META_INF/manifest.mf in first jar and check ?
type: QuestionComment
comment on: http://stackoverflow.com/q/26352483
type: Comment

http://stackoverflow.com/comment/41267334
comment on: http://stackoverflow.com/q/26298973
type: Comment
type: QuestionComment
has text: ok , i try run the code without timer , but after delete the timer code dosent work , how can i run code just one time
score: 0

http://stackoverflow.com/a/26271360
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26271282
has body: You didn't override the toString() method in the Discount class which is inherited by the Java class Object. This causes the output you listed.

c#
tags question: http://stackoverflow.com/q/26331853
tags question: http://stackoverflow.com/q/26307382
tags question: http://stackoverflow.com/q/26318952
tags question: http://stackoverflow.com/q/26201161
tag name: c#
tags question: http://stackoverflow.com/q/26206700
tags question: http://stackoverflow.com/q/26337960
tags question: http://stackoverflow.com/q/26195355
tags question: http://stackoverflow.com/q/26311927
tags question: http://stackoverflow.com/q/26209405
tags question: http://stackoverflow.com/q/26254485
type: Tag
tags question: http://stackoverflow.com/q/26239415
tags question: http://stackoverflow.com/q/26196764
tags question: http://stackoverflow.com/q/26201630
tags question: http://stackoverflow.com/q/26233912

http://stackoverflow.com/q/26313923
answer count: 3
tagged with: android
has title: Android Imagebutton fragment
has answer: http://stackoverflow.com/a/26313984
favorite count: 0
has answer: http://stackoverflow.com/a/26314043
has body: Hey guys so i'm trying to get my imagebutton to work within my fragment. The code works fine with a Activity but I cannot get it to work within the fragment. What do I need to change? Errors keep occurring within the configureImage method, Thanks guys. import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageButton; import android.widget.Toast; /** * A simple {@link Fragment} subclass. * */ public class FragmentA extends Fragment { public FragmentA() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_a); configureImageButton(); } private void configureImageButton() { // TODO Auto-generated method stub ImageButton btn = (ImageButton) findViewById(R.id.imageButton1); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(FragmentA.this, "You Clicked the button!", Toast.LENGTH_LONG).show(); } }); }
upvote count: 1
has answer: http://stackoverflow.com/a/26313989
type: AnsweredQuestion
tagged with: android-fragments
score: 1
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/26313984
possible better answer: http://stackoverflow.com/a/26313989

http://stackoverflow.com/comment/41275467
has text: You could start here: [collections tutorial](http://docs.oracle.com/javase/tutorial/collections/)
type: Comment
comment on: http://stackoverflow.com/q/26303456
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41126934
has text: Used (System.getProperty("user.dir")+"/images",file.getName()); that solved my problem. is there any problem in using so ?
score: 1
comment on: http://stackoverflow.com/q/26222686
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26224414
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26224613
has title: How to stop a java 8 lambda-runnable-thread
type: Question
accepted answer: http://stackoverflow.com/a/26224500
has comment: http://stackoverflow.com/comment/41130327
has body: I would like to stop this thread: Runnable run = () -&gt; { while(true)[...]; }; run.run(); But there is no run.stop() method. Please suggest either an other as short as possible method to start and stop a thread or a method to stop this running... thing.
answer count: 3
tagged with: runnable
downvote count: 0
has comment: http://stackoverflow.com/comment/41132155
favorite count: 0
has answer: http://stackoverflow.com/a/26224500
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/26224452
has answer: http://stackoverflow.com/a/26224452
type: AnsweredQuestion

http://stackoverflow.com/q/26252155
tagged with: spring
upvote count: 11
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has body: I have a CustomerController.java: package com.satisfeet.http; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.satisfeet.core.model.Address; import com.satisfeet.core.model.Customer; import com.satisfeet.core.service.CustomerService; @RestController @RequestMapping("/customers") public class CustomerController { @Autowired private CustomerService service; @RequestMapping(method = RequestMethod.GET) public Iterable&lt;Customer&gt; index() { return this.service.list(); } @RequestMapping(method = RequestMethod.POST) public Customer create(@RequestBody Customer customer) { this.service.create(customer); return customer; } @RequestMapping(method = RequestMethod.GET, value = "/{id}") public Customer show(@PathVariable Integer id) { return this.service.show(id); } @RequestMapping(method = RequestMethod.PUT, value = "/{id}") public void update(@PathVariable Integer id, @RequestBody Customer customer) { this.service.update(id, customer); } @RequestMapping(method = RequestMethod.DELETE, value = "/{id}") public void destroy(@PathVariable Integer id) { this.service.delete(id); } } and a ExceptionController.java: package com.satisfeet.http; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import com.satisfeet.core.exception.NotFoundException; @ControllerAdvice public class Except…
type: Question
has answer: http://stackoverflow.com/a/26252885
has title: How to add HTTP lifecycle middleware handler to spring?
linked to: http://stackoverflow.com/q/65136917
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/71675586
accepted answer: http://stackoverflow.com/a/26252885
favorite count: 0
has answer: http://stackoverflow.com/a/71675586
linked to: http://stackoverflow.com/q/3292464
score: 11

http://stackoverflow.com/q/26265542
accepted answer: http://stackoverflow.com/a/26265781
has title: Generate reports in netbeans with windows 8.1
score: 0
answer count: 1
tagged with: windows-8.1
tagged with: netbeans
tagged with: report
has comment: http://stackoverflow.com/comment/41215500
type: AnsweredQuestion
has body: I am trying to make a report using netbeans and my OS is Windows 8.1 ... I've tried the Japser reports but it's not updated for windows 8 and it switched to jaspersoft studio now.. And i've been googling and a lot says it only works in Eclipse. Is it true? And what other reports generator can I use? thank you
tagged with: java
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/26265781

http://stackoverflow.com/comment/41112263
has text: could you try DBCollection school = db.createCollection("college",null);
comment on: http://stackoverflow.com/q/26214587
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26288785
has comment: http://stackoverflow.com/comment/41249310
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26288603
has comment: http://stackoverflow.com/comment/41286779
has body: Number 2. Here's why: (Assuming addToSharedPrefs(...) is simply updating the reference in a map-ish data structure and not doing some further network calls or extensive computation, which wouldn't make sense, but just in case...) You're retrieving either way, which is expensive, but the first way also calls equals() on your data object, which can be costly, it's probably not a huge difference, but this way you're eliminating that.
type: Answer
answers question: http://stackoverflow.com/q/26288603
score: 0

http://stackoverflow.com/comment/41241075
type: QuestionComment
comment on: http://stackoverflow.com/q/26284705
type: Comment
has text: What are you trying to accomplish we may be able to help you improve your code's efficiency.
score: 0

http://stackoverflow.com/comment/41257378
has text: How is * treated in `@RequestMapping` ?
comment on: http://stackoverflow.com/q/26293749
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26232434
has comment: http://stackoverflow.com/comment/41144683
has body: public static void listCharacterCodes(char a, char b){ int j = (int) b; for(int i =(int) a; i&lt;j;i++){ System.out.println("'" + (char)i + "': " + i); } }
type: Answer
answers question: http://stackoverflow.com/q/26232340
score: 0

http://stackoverflow.com/comment/41169441
comment on: http://stackoverflow.com/a/26245293
type: AnswerComment
score: 0
type: Comment
has text: `Serializable` with a forced use of `ArrayList` is the easier option. `Parcelable` is Androids version of `Serializable` http://developer.android.com/reference/android/os/Parcelable.html it is optimised for mobile and large data sets. I would always recommend `Serializable` but if you have 1000's of items in your list and pass it around a lot, I would recommend you research `Parcelable` to consider as a performance gain

http://stackoverflow.com/comment/41331182
score: 1
has text: So what is your debugger telling you? no debugger? how about the print statements you add to view program flow and variable contents?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26333915

http://stackoverflow.com/a/26322957
has comment: http://stackoverflow.com/comment/41310888
type: Answer
has body: There are a lot of things to correct in your code. verts = reader.next(); should be verts = reader.nextLine();. in your question edges is a 20 x 2 matrix whereas in your code it is a 8 x 8 square matrix. The number of edges in your file does not seem to depend of the number of names in the first line, so why instantiating the array of edges like this ? variable b is useless, you can replace it with i in the loop variable count is never incremented (or at least the incremented value is never used) since it is reinitialized at each turn of the loop. That is the reason why you never fill certain lines. your two loops could be merged into a unic one, without using a temporary array
has comment: http://stackoverflow.com/comment/41310767
score: 0
has comment: http://stackoverflow.com/comment/41310870
has comment: http://stackoverflow.com/comment/41310817
answers question: http://stackoverflow.com/q/26322804
has comment: http://stackoverflow.com/comment/41310704
has comment: http://stackoverflow.com/comment/41310655

http://stackoverflow.com/comment/41334033
score: 0
comment on: http://stackoverflow.com/a/26335096
type: AnswerComment
has text: even after resizing the images, I am still getting the same error.
type: Comment

http://stackoverflow.com/comment/41143645
type: QuestionComment
comment on: http://stackoverflow.com/q/26231781
score: 0
has text: You had not define the main() inside of the class. When you run a java application, JVM is seeking main() to run the application.Define the main() and run the application. Also you had not define the body of the if.
type: Comment

http://stackoverflow.com/comment/41249530
comment on: http://stackoverflow.com/q/26288962
score: 0
type: Comment
type: QuestionComment
has text: @LuiggiMendoza good point. You can do it in a separate thread then.

http://stackoverflow.com/comment/41169760
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26245468
has text: Also http://stackoverflow.com/questions/23621668/java-closing-scanner-and-resource-leak

http://stackoverflow.com/a/26256937
upvote count: 3
downvote count: 0
has body: If I understand your question, you could call the method Date.after(Date) and something like Date TDate = format.parse(transDate); Date CDate = format.parse(computeDate); if (TDate.after(CDate)) { System.out.print("Date is very wrong"); return -1; }
answers question: http://stackoverflow.com/q/26256902
type: Answer
has comment: http://stackoverflow.com/comment/41189442
score: 3

http://stackoverflow.com/comment/41210828
comment on: http://stackoverflow.com/a/26267402
score: 1
type: Comment
has text: @PeterLawrey I am guessing that "*doesn't work*" means "*throws exception*" because `replaceAll` uses regex as argument and `"\\"` is incorrect regex in Java (it is like writing ``\`` as regex which is wrong because ``\`` needs something after it like `\s` or `\d` or ``\\``). Maybe you wanted to use `replace` instead of `replaceAll`?
type: AnswerComment

http://stackoverflow.com/a/26316039
score: 2
has body: onLocationChanged is a callback, meaning that it is event driven and does not run until the device detects a change of location. If you are taking location only from GPS, then it can take several minutes before you get a fix. If you are indoors without a clear view of the sky, then it may never run.
answers question: http://stackoverflow.com/q/26315829
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43103052
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26340508
has text: the browser was not even opening. so of course the element not found. try this System.out.println(driver.getPageSource()); to guide you @PhilPeace

http://stackoverflow.com/comment/41360538
comment on: http://stackoverflow.com/a/26349909
type: AnswerComment
has text: Nope: http://ideone.com/txBla1, Those Strings are interned.
score: 0
type: Comment

http://stackoverflow.com/q/26264523
tagged with: components
has comment: http://stackoverflow.com/comment/41209856
tagged with: java
has comment: http://stackoverflow.com/comment/41203889
has comment: http://stackoverflow.com/comment/41203941
tagged with: image
type: Question
accepted answer: http://stackoverflow.com/a/26264570
linked to: http://stackoverflow.com/q/26012093
tagged with: resize
score: 0
linked to: http://stackoverflow.com/q/24340271
answer count: 1
has answer: http://stackoverflow.com/a/26264570
has body: I have problem with image visibility after click the button. I have the main class with frame: package superworld; import java.awt.*; import javax.swing.*; public class SuperWorld { public static void main(String[] args) { JFrame frame= new JFrame(); frame.setSize(1050,650); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new SuperPanel()); frame.setVisible(true); // frame.setResizable(false); } } Then I have class with Panel with all components: package superworld; import javax.swing.*; import java.awt.*; import java.util.*; import java.awt.event.*; import javax.swing.Timer; public class SuperPanel extends JPanel implements ActionListener{ Timer mainTimer; public static final int HEIGHT = 550; public static final int WIDTH = 1050; int i; int w=-100; int h=-50; ArrayList&lt;SuperMiasto&gt; miasta = new ArrayList&lt;SuperMiasto&gt;(); private JButton heroButton; private JButton cywilButton; public SuperPanel() { mainTimer = new Timer(10,this); heroButton = new HeroButton(this); cywilButton = new CywilButton(this); setLayout(null); setPreferredSize(new Dimension(WIDTH, HEIGHT)); setBackground(Color.GREEN); for(i=0;i&lt;10;i++) { miasta.add( new SuperMiasto() ); miasta.get(i).x=w; miasta.get(i).y=h; miasta.get(i).imagelabel = new JLabel(miasta.get(i).image); miasta.get(i).imagelabel.setBounds(miasta.get(i).x,miasta.get(i).y,miasta.get(i).image.getIconWidth(),miasta.get(i).image.getIconHeight()); add(miasta.get(i).imagelabel); w=w+200; if (w &gt; WIDTH-200) { h=h+200; w=-100; } } } public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D) g; add(heroButton); add(cywilButton); } public void actionPerformed(ActionEvent e) { repaint(); } } And Class with button with add new object with image: package superworld; import java.awt.*; import javax.swing.*; import java.awt.event.*; class HeroButton extends JButton implements ActionListener { private JPanel buttonPanel; HeroButton(JPanel buttonPanel) { super("Dodaj hero"); this.buttonPanel = bu…
has comment: http://stackoverflow.com/comment/41204080
tagged with: swing
has title: Component won't display unless window is resized - Java
type: AnsweredQuestion

http://stackoverflow.com/q/26233776
tagged with: maven
has comment: http://stackoverflow.com/comment/41178563
tagged with: java
has comment: http://stackoverflow.com/comment/41162715
type: Question
score: 0
has body: I'm using maven resources to copy my main/src/resources to my target folder. The problem is that once I package the project into a Jar, every file in resources appear two times: target/MYPROJECT.jar!/main/resources target/MYPROJECT.jar!/ My pom.xml remains as: <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 xxxx xxxx 0.0.1-SNAPSHOT QuerySuggester <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> query-suggester src src **/*.java src/main/resources true **/* src/main/scripts true **/* maven-compiler-plugin 3.1 1.6 1.6 org.apache.maven.plugins maven-assembly-plugin 2.2.2 src/main/assembly/assembly.xml QuerySuggester org.codehaus.mojo exec-maven-plugin 1.2.1 java java xxxx org.apache.maven.plugins maven-resources-plugin 2.4 UTF-8 org.apache.maven.plugins maven-jar-plugin **/wn31 true xxx org.apache.maven.plugins maven-jar-plugin 2.3.1 true lib/ xxx .... I tried using by If avoid copying these file in the second place project won't work so I should delete it from the first place. Any idea? Edit 1: Showing the full pom.xml
tagged with: maven-plugin
has title: Maven:resource duplicates files
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41259991
comment on: http://stackoverflow.com/q/26295239
score: 2
type: Comment
type: QuestionComment
has text: Please include the code.

http://stackoverflow.com/comment/41331737
comment on: http://stackoverflow.com/q/26234136
has text: The EJBs are secured, so I need a solition where I can authenticate against the servers (which is working with my custom JDBC realm). But it works only with one server as long as the JVM is running, since properties are set to the JVM (System.setProperty(x,y)).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41246599
has text: And programming in a commercial environment means that the code isn't always going to be there for you to read. Sometimes you need to create it from scratch, and to create it from scratch you need to develop an understanding of the principles that make the code work. The only way to do that is with your own research. Hence, we encourage that research to help develop better programmers.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26287391
score: 2

http://stackoverflow.com/q/26239463
has title: Asterisk connection with Java
answer count: 1
has comment: http://stackoverflow.com/comment/41158766
tagged with: jain-sip
tagged with: asterisk
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: sip
has body: I'm trying to authenticate with the Asterisk server, but I am getting this error: Exception in thread "main" 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:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at net.sf.asterisk.io.impl.SocketConnectionFacadeImpl.&lt;init&gt; SocketConnectionFacadeImpl.java:52) at net.sf.asterisk.manager.DefaultManagerConnection.createSocket(DefaultManagerConnection.java:541) at net.sf.asterisk.manager.DefaultManagerConnection.connect(DefaultManagerConnection.java:530) at net.sf.asterisk.manager.DefaultManagerConnection.login(DefaultManagerConnection.java:418) at net.sf.asterisk.manager.DefaultManagerConnection.login(DefaultManagerConnection.java:377) at call.HelloManager.run(HelloManager.java:48) at call.HelloManager.main(HelloManager.java:66) Here is my code: public class HelloManager { private ManagerConnection managerConnection; public HelloManager() throws IOException { ManagerConnectionFactory factory = new ManagerConnectionFactory(); this.managerConnection = factory.getManagerConnection(host, port, user, password); } public void run() throws IOException, AuthenticationFailedException, TimeoutException { OriginateAction originateAction; ManagerResponse originateResponse; originateAction = new OriginateAction(); originateAction.setChannel(" SIP/2.0/UDP"); originateAction.setContext("default"); originateAction.setExten("101"); originateAction.setPriority(new Integer(1)); originateAction.setTimeout(new Integer(30000)); // conn…
has answer: http://stackoverflow.com/a/26243766
score: 0

http://stackoverflow.com/q/26334168
tagged with: java
has answer: http://stackoverflow.com/a/26334236
has comment: http://stackoverflow.com/comment/41331777
has answer: http://stackoverflow.com/a/26334195
type: Question
accepted answer: http://stackoverflow.com/a/26334195
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/26334197
has body: Every time I run my app it keeps crashing immediately and throwing a NullPointerException. I can't figure out where or why though. LogCat: 10-13 02:23:05.028: E/AndroidRuntime(1610): FATAL EXCEPTION: main 10-13 02:23:05.028: E/AndroidRuntime(1610): Process: com.association.icecreammafiatesting3, PID: 1610 10-13 02:23:05.028: E/AndroidRuntime(1610): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.association.icecreammafiatesting3/com.association.icecreammafiatesting3.MainActivity}: java.lang.NullPointerException 10-13 02:23:05.028: E/AndroidRuntime(1610): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110) 10-13 02:23:05.028: E/AndroidRuntime(1610): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 10-13 02:23:05.028: E/AndroidRuntime(1610): at android.app.ActivityThread.access$800(ActivityThread.java:135) 10-13 02:23:05.028: E/AndroidRuntime(1610): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 10-13 02:23:05.028: E/AndroidRuntime(1610): at android.os.Handler.dispatchMessage(Handler.java:102) 10-13 02:23:05.028: E/AndroidRuntime(1610): at android.os.Looper.loop(Looper.java:136) 10-13 02:23:05.028: E/AndroidRuntime(1610): at android.app.ActivityThread.main(ActivityThread.java:5001) 10-13 02:23:05.028: E/AndroidRuntime(1610): at java.lang.reflect.Method.invokeNative(Native Method) 10-13 02:23:05.028: E/AndroidRuntime(1610): at java.lang.reflect.Method.invoke(Method.java:515) 10-13 02:23:05.028: E/AndroidRuntime(1610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 10-13 02:23:05.028: E/AndroidRuntime(1610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 10-13 02:23:05.028: E/AndroidRuntime(1610): at dalvik.system.NativeStart.main(Native Method) 10-13 02:23:05.028: E/AndroidRuntime(1610): Caused by: java.lang.NullPointerException 10-13 02:23:05.028: E/AndroidRuntime(1610): at android.app.Activity.findViewById(Ac…
has answer: http://stackoverflow.com/a/26334185
has title: App keeps crashing and giving a nullPointerException
upvote count: 1
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/41334593
has answer: http://stackoverflow.com/a/26334345
answer count: 5
has comment: http://stackoverflow.com/comment/41331706
score: -3
possible better answer: http://stackoverflow.com/a/26334185
downvote count: 4
has comment: http://stackoverflow.com/comment/41331616
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41350639

http://stackoverflow.com/a/26330125
score: 1
has body: Don't use padding on your horizontal LinearLayout to center the views. Instead you can add views before and after that expand to fill the remaining space. &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /&gt; &lt;ImageButton android:id="@+id/buttonGreen" android:layout_width="wrap_content" android:layout_height="wrap_content" ... /&gt; &lt;ImageButton android:id="@+id/buttonRed" android:layout_width="wrap_content" android:layout_height="wrap_content" ... /&gt; &lt;ImageButton android:id="@+id/buttonBlue" android:layout_width="wrap_content" android:layout_height="wrap_content" ... /&gt; &lt;View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /&gt; &lt;/LinearLayout&gt;
answers question: http://stackoverflow.com/q/26329895
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26329895
type: Answer
upvote count: 1

http://stackoverflow.com/q/26289982
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41250902
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26290403
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41250890
downvote count: 1
type: Question
has body: class liste { int numara; String ad; String soyad; liste sonraki; } public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new FileReader("C:\\bagli.txt")); BufferedReader reader = null; String s; Scanner klavye = new Scanner(System.in); listeler mylist = new listeler(); while(br.ready()) { s=br.readLine(); String[] firstLine = s.split("#"); liste kayıt = new liste(); kayıt.numara = Integer.parseInt(firstLine[0].trim()); kayıt.ad = firstLine[1].trim(); kayıt.soyad = firstLine[2].trim(); mylist.ekle(kayıt); } I get the following error: Exception in thread "main" java.lang.NumberFormatException: For input string: "33" on the following line: kayıt.numara = Integer.parseInt(firstLine[0].trim()); I don't understand why I get this error.
score: 0
has title: Exception in thread "main" java.lang.NumberFormatException: For input string: "33"

http://stackoverflow.com/a/26336111
has body: .(?!.{0,2}$) Try this.Replace by X.Put flags m and g.See demo. http://regex101.com/r/sK8oK9/2
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26336067
downvote count: 0

http://stackoverflow.com/a/26232244
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41145160
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26232087
has body: The simplest and probably fastest: I converted this to JSON with some hardwired text replacing, and then interpreted the JSON with java. Java has very good json interpreting libs. Alternately, you could compile the struct to a C object (or shredlib, or dll), write a JNI (java native interface) for that, and then read the data and interpret that. It will be a lot of work. Alternatively, you could use a java lexical analysator for the job, for example this. Extension: (1) will be maybe impractical because of your C code uses macros. There is a mix between (1) and (2): you compile the struct with a little bit of helper code with prints the struct into stdout as JSON. Thank you for @UniversE for the idea!

http://stackoverflow.com/comment/41086191
type: Comment
type: QuestionComment
has text: could you explain more about the "pool"? You mean Java has all library of strings?
score: 0
comment on: http://stackoverflow.com/q/26201002

http://stackoverflow.com/comment/41341562
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26339547
has text: what happens when you have two words with the same mostrepeatedWord number?
score: 1

http://stackoverflow.com/q/26349852
has answer: http://stackoverflow.com/a/26350005
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/26349909
type: Question
upvote count: 2
tagged with: boolean
answer count: 3
linked to: http://stackoverflow.com/q/513832
has title: Using IF statement in simple java program to apply discount
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26349886
has body: I have been using a search tool to look for an answer but I am now stuck after being able to fix several of my previous problems. I was able to compare and make adjustments but now I don't understand what is wrong with my program. I am in my first year learning computer programming starting with Java. I have read many people saying to use equalsIgnoreCase but we have yet to learn it and this is how I was taught as of this moment. I also read a post saying if (discount) maybe better than if (discount == true) but I have never used an if statement without displaying the variable next to it yet. At first, it was giving the discount to every name I input, including those not in the 4 names designated to give the discount. Now it is not giving a discount to any of the 4 names (Mike, mike, Diane, diane). I feel like it is a very small error but I just can't seem to to figure it out. import java.util.Scanner; import java.text.DecimalFormat; public class PizzaOrder { public static void main (String [] args) { DecimalFormat formatter = new DecimalFormat("#0.00"); Scanner keyboard = new Scanner (System.in); String firstName; boolean discount = false; int inches; char crustType; String crust = "Hand-tossed"; double cost = 12.99; final double TAX_RATE = .08; double tax; char choice; String input; String toppings = "Cheese "; int numberOfToppings = 0; System.out.println("Welcome to Mike and Diane's Pizza"); System.out.print("Enter your first name: "); firstName = keyboard.nextLine(); if (firstName == "Mike" || firstName == "mike") { discount = true; } if (firstName =="Diane" || firstName == "diane") { discount = true; } System.out.println("Pizza Size (inches) Cost"); System.out.println(" 10 $10.99"); System.out.println(" 12 $12.99"); System.out.println(" 14 $14.99"); System.out.println(" 16 $16.99"); System.out.println("What size pizza would you like?"); System.out.print("10, 12, 14, or 16 (enter the number only): "); inches = keyboard.nextInt(); if (inches == 10) { cost = 10.99…
score: 2
downvote count: 0
tagged with: if-statement
tagged with: java

http://stackoverflow.com/a/26222704
score: 24
has body: You should use @Context HttpServletRequest request to inject request in your method, like this: public Response log(@Context HttpServletRequest req) throws JSONException Other useful objects that could be injected using @Context are (see JAX-RS spec for details): Application UriInfo, HttpHeaders SecurityContext, Providers, Request ServletConfig, ServletContext, HttpServletRequest and HttpServletResponse So in your case you could use also @Context HttpHeaders headers and then List&lt;String&gt; authHeaders = headers.getRequestHeader(HttpHeaders.AUTHORIZATION);
answers question: http://stackoverflow.com/q/26212844
type: AcceptedAnswer
upvote count: 24
accepted answer of: http://stackoverflow.com/q/26212844
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41224049
comment on: http://stackoverflow.com/q/26275543
score: 0
type: QuestionComment
type: Comment
has text: you can use YouTubePlayerFragment

http://stackoverflow.com/comment/51813635
score: 0
type: Comment
type: QuestionComment
has text: I also have the same question and found a solution for that case. Check my post.. [link for my post](http://stackoverflow.com/questions/31794431/friends-and-followers-in-spring-social/31949250#31949250)
comment on: http://stackoverflow.com/q/26299466

file
tags question: http://stackoverflow.com/q/26336301
type: Tag
tags question: http://stackoverflow.com/q/26204289
tags question: http://stackoverflow.com/q/26205165
tags question: http://stackoverflow.com/q/26333915
tags question: http://stackoverflow.com/q/26307289
tags question: http://stackoverflow.com/q/26328326
tags question: http://stackoverflow.com/q/26253732
tags question: http://stackoverflow.com/q/26305044
tags question: http://stackoverflow.com/q/26256448
tags question: http://stackoverflow.com/q/26197834
tags question: http://stackoverflow.com/q/26250938
tags question: http://stackoverflow.com/q/26249049
tags question: http://stackoverflow.com/q/26235809
tag name: file
tags question: http://stackoverflow.com/q/26334709
tags question: http://stackoverflow.com/q/26323583
tags question: http://stackoverflow.com/q/26280820
tags question: http://stackoverflow.com/q/26251424
tags question: http://stackoverflow.com/q/26351563
tags question: http://stackoverflow.com/q/26213409
tags question: http://stackoverflow.com/q/26272100
tags question: http://stackoverflow.com/q/26245061
tags question: http://stackoverflow.com/q/26269658
tags question: http://stackoverflow.com/q/26203207
tags question: http://stackoverflow.com/q/26239026
tags question: http://stackoverflow.com/q/26268355
tags question: http://stackoverflow.com/q/26235176
tags question: http://stackoverflow.com/q/26269995
tags question: http://stackoverflow.com/q/26213696
tags question: http://stackoverflow.com/q/26207982
tags question: http://stackoverflow.com/q/26252121
tags question: http://stackoverflow.com/q/26214916
tags question: http://stackoverflow.com/q/26250498
tags question: http://stackoverflow.com/q/26324250
tags question: http://stackoverflow.com/q/26282470
tags question: http://stackoverflow.com/q/26233417
tags question: http://stackoverflow.com/q/26266878
tags question: http://stackoverflow.com/q/26287909
tags question: http://stackoverflow.com/q/26208436
tags question: http://stackoverflow.com/q/26302476
tags question: http://stackoverflow.com/q/26279003
tags question: http://stackoverflow.com/q/26334556

http://stackoverflow.com/a/26238562
downvote count: 0
type: Answer
has body: In terms of efficiency, yeah, it is. You could do it like this... JButton b = new JButton(); b.setText("Hello everybody 1"); b.setIcon(b1); JButton c = new JButton(); c.setText("Hello everybody 2"); c.setIcon(c2); JButton d = new JButton(); d.setText("Hello everybody 3"); d.setIcon(d3); JButton e = new JButton(); e.setText("Hello everybody 4"); e.setIcon(e4); Or you could do JButton b = new JButton("Hello everybody 1", b1); JButton c = new JButton("Hello everybody 2", c2); JButton d = new JButton("Hello everybody 3", d3); JButton e = new JButton("Hello everybody 4", e4); Far more streamlined, yes? Not to mention that things like variables, of which most classes have several, can be given default values from the getgo, instead of having to give them passive values when you are not even going to use those variables anywhere in your program.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26238381

http://stackoverflow.com/comment/54042724
has text: Q: "Is it sane [for] Oracle to rely on /dev/random?" ... A: "Changing that behavior was troubling". It's not fully sane, in my opinion, but it is at least understandable that they (Sun, Oracle, whatever ... a big corp with lots of big corp customers) didn't want to change defaults in a way that could theoretically have security implications for people who had relied on those defaults in the past.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33054444
type: Comment

http://stackoverflow.com/comment/41086017
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26200783
has text: @SachinGodara Your methods are running, but some of them don't print any output to System.out. This line - `The total years of that person is 21613` will be clearer if you add spaces (see edited answer).

http://stackoverflow.com/a/26213220
answers question: http://stackoverflow.com/q/26213072
has body: You have to input a Character Datatype to TO_DATE Function Please refer the link here The TO_DATE function converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to a value of DATE datatype
score: 0
type: Answer

http://stackoverflow.com/comment/41183268
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26253448
has text: What exception you are getting..print it on console..

http://stackoverflow.com/comment/41177633
type: Comment
has text: If the array length is 10 then the loop goes from 0-9 (since 9 < 10) which is just fine. Your "off-by-one" error is wrong. If the loop used `<=` then you would be correct.
type: AnswerComment
comment on: http://stackoverflow.com/a/26248802
score: 0

http://stackoverflow.com/q/26268132
has answer: http://stackoverflow.com/a/78344773
has body: I'm creating a simple wordcount program in Java that reads through a directory's text-based files. However, I keep on getting the error: java.nio.charset.MalformedInputException: Input length = 1 from this line of code: BufferedReader reader = Files.newBufferedReader(file,Charset.forName("UTF-8")); I know I probably get this because I used a Charset that didn't include some of the characters in the text files, some of which included characters of other languages. But I want to include those characters. I later learned at the JavaDocs that the Charset is optional and only used for a more efficient reading of the files, so I changed the code to: BufferedReader reader = Files.newBufferedReader(file); But some files still throw the MalformedInputException. I don't know why. I was wondering if there is an all-inclusive Charset that will allow me to read text files with many different types of characters? Thanks.
has answer: http://stackoverflow.com/a/35558651
has answer: http://stackoverflow.com/a/57288585
has answer: http://stackoverflow.com/a/35237841
tagged with: java
possible better answer: http://stackoverflow.com/a/43446789
tagged with: character-encoding
accepted answer: http://stackoverflow.com/a/26268235
has answer: http://stackoverflow.com/a/43446789
has answer: http://stackoverflow.com/a/53006021
type: Question
has answer: http://stackoverflow.com/a/74786064
has answer: http://stackoverflow.com/a/42850842
has answer: http://stackoverflow.com/a/78622017
downvote count: 0
answer count: 13
has answer: http://stackoverflow.com/a/43619832
has answer: http://stackoverflow.com/a/50585702
score: 132
favorite count: 0
upvote count: 132
has answer: http://stackoverflow.com/a/44233948
has answer: http://stackoverflow.com/a/26268235
has title: All inclusive Charset to avoid "java.nio.charset.MalformedInputException: Input length = 1"?
type: AnsweredQuestion

http://stackoverflow.com/comment/41311034
comment on: http://stackoverflow.com/q/26323151
score: 1
type: Comment
type: QuestionComment
has text: Did you even google this question ?

http://stackoverflow.com/comment/41318708
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26327269
score: 0
has text: See if you enabled "Don't keep activities" in Settings > Developer options on your device or emulator.

http://stackoverflow.com/a/26257751
has comment: http://stackoverflow.com/comment/41193235
has comment: http://stackoverflow.com/comment/41193047
has comment: http://stackoverflow.com/comment/41191370
has comment: http://stackoverflow.com/comment/41198147
type: Answer
answers question: http://stackoverflow.com/q/26257385
has body: The problem is that the vaadin.addon.charts has some client side widget that are not included in default widge-set then you need to recompile your widget-set. If you are using maven like build toll you can do in this way: com.vaadin vaadin-maven-plugin ${vaadin.plugin.version} <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> -Xmx512M -Xss1024k ${basedir}/src/main/webapp/VAADIN/widgetsets ${basedir}/src/main/webapp/VAADIN/widgetsets true false true true http://localhost:8080/ <!-- com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> --> resources update-widgetset compile
score: 0

http://stackoverflow.com/comment/41169105
comment on: http://stackoverflow.com/a/26206342
has text: Don't hijack me :P I personally like the `select new` as it's more like what SQL is. You often don't want to select all but only a part of your entity but that should not be your primary concern (eg: optimizing versus what do I need to do with the data ?). I'd say use `select new` or equivalent to do what you want when you know you will really hurt the performance (I use `select new` for case where I have 260k rows returned by the query).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26217336
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26217229
has body: Add some input check if some input exist before Integer.valueOf(args[args.length-1]); And add some input information to execution.

http://stackoverflow.com/q/26260604
answer count: 1
tagged with: junit
has title: Unable to build EntityManagerFactory in JUnit test
tagged with: entitymanager
tagged with: maven
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26263122
score: 0
accepted answer: http://stackoverflow.com/a/26263122
has body: an application is giving me errors when trying to build it - it stops on a test, which just creates EntityManagerFactory. I also have a main method with some code which persists entities into database, but running it without tests works alright. Here's a test output Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.205 sec <<< FAILURE! test(sk.matejkvassay.musiclibrary.AlbumDaoImplTest) Time elapsed: 1.135 sec <<< ERROR! javax.persistence.PersistenceException: [PersistenceUnit: TestPU] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) at sk.matejkvassay.musiclibrary.AlbumDaoImplTest.test(AlbumDaoImplTest.java:37) 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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) …

http://stackoverflow.com/q/26329895
has body: My layout contains three buttons, one EditText field and one button. I want to place the three buttons in one row, but in the center (horizontal) of the screen. The EditText field should be below the buttons and below the EditText field, there should be one button. Here is my layout: <ImageButton android:id="@+id/buttonGreen" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginRight="4.0dip" android:background="@drawable/green_button" android:contentDescription="@string/green" /> <ImageButton android:id="@+id/buttonRed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginRight="4.0dip" android:background="@drawable/red_button" android:contentDescription="@string/red" /> <ImageButton android:id="@+id/buttonBlue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginRight="4.0dip" android:background="@drawable/blue_button" android:contentDescription="@string/blue" /> <requestFocus /> Now the problem is, that the three buttons are not in the center if the user changes from portrait to landscape mode. How is it possible to make this 'responsive', without creating a separate layout file for landscape mode? Any help would be greatly appreciated.
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: android-layout
possible better answer: http://stackoverflow.com/a/46826954
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26330125
accepted answer: http://stackoverflow.com/a/26330125
has title: Android LinearLayout place elements in the middle with landscape and portrait mode
tagged with: android
has answer: http://stackoverflow.com/a/46826954

http://stackoverflow.com/comment/41168744
has text: @Tim the jar file is a zip file, you can open it with your favorite zip tool and brows its content. You'll see the directory structure. Please try to compile with the option `-verbose` and post the output here.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26239192

http://stackoverflow.com/q/26333767
tagged with: java
type: Question
score: 0
tagged with: printing
has body: I have a print method below from a class: public void print(EditorPanePrinter epp) { try { PrinterJob pj=PrinterJob.getPrinterJob(); boolean ok = pj.printDialog(); if(ok) { pj.setPageable(epp); pj.print(); } } catch (PrinterException e1) { e1.printStackTrace(); } } EditorPanePrinter is a JEditorPane wrapped with a JPanel for print previews. See here for details. After clicking "OK" from the print dialog shown, the page is printed correctly from the printer. For more than 1 pages, especially with many pages to print, I want to show a dialog on which pages are printed: i.e. "Printing page 1 of 100" when the 1st page is printing, "Printing page 2 of 100" when the 2nd page is printing, and so on. I have searched everywhere and I found no solution. How to do this? If you need more info, please let me know.
has title: Java Printing: Determine the page that is printing
answer count: 1
accepted answer: http://stackoverflow.com/a/26333828
has answer: http://stackoverflow.com/a/26333828
type: AnsweredQuestion

http://stackoverflow.com/comment/41215101
type: QuestionComment
has text: `isLeapYear` is a **method** and not a variable.
comment on: http://stackoverflow.com/q/26270503
type: Comment
score: 0

http://stackoverflow.com/a/26314041
accepted answer of: http://stackoverflow.com/q/26296035
answers question: http://stackoverflow.com/q/26296035
has body: There are two Ehcache provided constructs that could help you: Refresh ahead Scheduled refresh Both require you to change the way you interact with your cache as they require a CacheLoader to be configured. Unfortunately, I can't find online documentation that shows example for the second option. It allows to refresh cache entries using Quartz to schedule it. It can also refresh only a subset of the keys, based on a key generator. Have a look at classes in package net.sf.ehcache.constructs.scheduledrefresh
has comment: http://stackoverflow.com/comment/41294591
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/q/26313481
upvote count: 5
has body: Whereas the Java grammar seems very precisely described in JLS specifications, there are some concrete cases which I fail to apply on given definitions. For example, taking the ClassInstanceCreationExpression rule in chapter 15.9 of JLS8, non-qualified new expressions should be of the form: new [TypeArguments] {Annotation} Identifier [TypeArgumentsOrDiamond] ( [ArgumentList] ) [ClassBody] Identifier being a standard Java identifier (basically Java letters / numbers, no dot). How does this definition would apply to valid expressions like static nested classes instanciation: new C1.C2(); or package-qualified classes instanciation: new java.lang.String("foo"); given that dots cannot be part of an Identifier? Note that there was a change on this definition from JLS7 to JLS8, where JLS7 was stating, for non-qualified new expressions: new [TypeArguments] TypeDeclSpecifier [TypeArgumentsOrDiamond]( [ArgumentList] ) [ClassBody] TypeDeclSpecifier being defined as: TypeDeclSpecifier: TypeName ClassOrInterfaceType . Identifier allowing non-qualified new expressions for static nested classes and package-qualified classes.
tagged with: grammar
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26321561
downvote count: 0
has title: Java grammar definition completeness
favorite count: 0
type: Question
score: 5
tagged with: jls
tagged with: java
has answer: http://stackoverflow.com/a/26321561
answer count: 1

http://stackoverflow.com/a/26254019
type: Answer
has body: I think problem because messageSource in Spring . So you should find the file messages_en.properties or messages.properties or some file like *.properties in your project. Path of .properties file can change in dispathcher-servlet.xml ( so check src/main/java/resource ) <context:property-placeholder location="classpath*:META-INF/spring/*.properties"/> or the bean with id="messageSource" similarly /WEB-INF/resources/messages After found the messages.properties (or something.properties base on config) , You should add a property to it menu_category__label=example label You could read more about Spring MVC Internationalization at Spring locale think it could help.
score: 0
answers question: http://stackoverflow.com/q/26250238

http://stackoverflow.com/comment/41317169
has text: Thanks again, I did try an advanced for loop but I set the type to 'links' directly, which didn't work, so I really appreciate seeing an alternative solution! Thanks, you've been super helpful!
type: Comment
comment on: http://stackoverflow.com/a/26326304
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41083345
has text: What will happen when the *next* if statement of `side == COMPUTER && oppMove.value < check || side == HUMAN && oppMove.value > check` is run then? (which also likely has a bug in it)
type: AnswerComment
comment on: http://stackoverflow.com/a/26199479
score: 0
type: Comment

http://stackoverflow.com/comment/41290879
comment on: http://stackoverflow.com/q/26311882
score: 0
type: Comment
type: QuestionComment
has text: @EJP Im trying same code in sample project it's work. but i'm integrate to main project it's not working. what's the reason?

http://stackoverflow.com/q/26203266
has body: I have json array contains links for images, I want to project the images from these links into imageView1, I have successfully got the links as string and view them on textView but how can i project the images from these links? this is my MainActivity code package learn2crack.listview; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; import learn2crack.listview.library.JSONParser; public class MainActivity extends Activity { ListView list; TextView ver; TextView name; TextView api; Button Btngetdata; ArrayList&lt;HashMap&lt;String, String&gt;&gt; oslist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); //URL to get JSON Array private static String url = "http://app-chef.com/JsonSC.php"; //JSON Node Names private static final String TAG_OS = "android"; //private static final String TAG_VER = "ver"; //private static final String TAG_NAME = "name"; //private static final String TAG_API = "api"; ////////////////////////////////////////////////////////////// private static final String TAG_id = "id"; private static final String TAG_CITY ="CITY"; private static final String TAG_CATEGORY ="CATEGORY"; private static final String TAG_NAME ="NAME"; private static final String TAG_IMAGELINK ="IMAGELINK"; private static final String TAG_DESCRIPTION ="DESCRIPTION"; //private static final String TAG_LINKS; // private static final String TAG_PHONES; ///private st…
tagged with: android
has title: call image from link as a string inside array
has comment: http://stackoverflow.com/comment/41092589
tagged with: android-imageview
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/41090072
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41090101
tagged with: eclipse
score: 0

http://stackoverflow.com/a/26274221
accepted answer of: http://stackoverflow.com/q/26273850
type: AcceptedAnswer
downvote count: 0
has body: This line while((input=scan.nextLine())!=null) tries to read separate lines from the file until input becomes null. But nextLine() will throw an exception if there are no more lines available. To avoid this, change your code to the following //String input=""; // this line is obsolete scan = new Scanner(file); scan.nextLine(); while(scan.hasNextLine()) { final String input = scan.nextLine(); // read the line after the check (to make sure there is a line available) String[] countryNames = input.split(","); //int a = Integer.parseInt(countryNames[1]); System.out.println(countryNames[0]); //System.out.println(a); }
type: Answer
score: 6
answers question: http://stackoverflow.com/q/26273850
upvote count: 6

http://stackoverflow.com/q/26233529
answer count: 3
has answer: http://stackoverflow.com/a/26233775
favorite count: 0
has answer: http://stackoverflow.com/a/26233608
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26233915
upvote count: 3
tagged with: java
has body: I am trying to convert current timestamp to DD MMM YYYY format. but i don't know why it is giving me an error unparsable. code: Timestamp ts = new Timestamp(new Date().getTime()); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); Date fechaNueva = format.parse(ts.toString()); System.out.println(format.format(fechaNueva)); working but I want to do SimpleDateFormat format = new SimpleDateFormat("dd MMM YYY, HH:mm"); gives me error of unparsable. java.text.ParseException: Unparseable date: "2014-10-07 15:38:29.876"
type: Question
score: -2
tagged with: simpledateformat
downvote count: 5
has title: Convert Current Timestamp to DD MMM YYYY format
tagged with: date

http://stackoverflow.com/q/26257253
tagged with: sftp
has comment: http://stackoverflow.com/comment/41190495
tagged with: jsch
has comment: http://stackoverflow.com/comment/41194298
favorite count: 0
upvote count: 2
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
has title: I am trying to post multiple file using SFTP connection but not able to post more than 2 files
downvote count: 1
has comment: http://stackoverflow.com/comment/41190116
type: Question
has body: I am trying to post multiple file using SFTP connection. I am using below code to connect SFTP server and post file on server. My program running properly but for only 2 file not more than that, third file on words its generates Authentication error "com.jcraft.jsch.JSchException: Auth fail". Could you please somebody guide me for that. public boolean putSftp(String input , String fileName) { JSch jsch = new JSch(); Session session = null; try { System.out.println("Input : "+input+": File Name :"+fileName+" :-----------Logon on to the Server---------- : "+ datetime); session = jsch.getSession(USER_NAME, FTP_HOSTNAME, 22); session.setConfig("StrictHostKeyChecking", "no"); session.setPassword(PASSWORD); session.connect(); Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp sftpChannel = (ChannelSftp) channel; sftpChannel.cd(TO_DIRECTORY); sftpChannel.put(input+fileName, fileName); System.out.println("File sucessfully posted on server....:"+datetime); sftpChannel.exit(); session.disconnect(); result = true; }catch (JSchException e) { System.out.println("Here JSCH...!!! : "); e.printStackTrace(); }catch (SftpException e) { System.out.println("Here SFTP...!!! :"); e.printStackTrace(); } catch (Exception e){ System.out.println("Here Exception...!!!"+e); }finally { System.out.println("In Side of SFTP Method....."+result); } return result; }

http://stackoverflow.com/q/26331179
favorite count: 0
has answer: http://stackoverflow.com/a/26331317
has title: Createbody during runtime/step? Libgdx box2d
tagged with: android
has body: I am developing an Android game using the libgdx box2d library in Eclipse. But I am stuck on a problem. I want to drop a static body whenever the the moving ball touches that static body (a polygon shape box), the method is called in the ContactListener.beginContact(). I tried to create a new body with the same properties but the body type changed to dynamicbody. But if I do this, I am getting NullPointerException every time the ball touches the static body. Also getting a NullPointerException when tried to setLinearVelocity(0) on a kinematicbody. How can I implement this?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26331317
tagged with: box2d
type: Question
tagged with: libgdx
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41326168

http://stackoverflow.com/comment/41268049
score: 0
type: AnswerComment
type: Comment
has text: Thanks for the explanation of these settings. I understand better why my EntityManager couldn't see any changes made to the database.
comment on: http://stackoverflow.com/a/26264342

http://stackoverflow.com/a/26199203
has body: If you just want to capture the constructor argument, you can use: public RobotDriver(Robot robot) { this.robot = robot; } If you want to create a copy of the argument inside the constructor, there are several possibilities. If your Robot implementations all have a default constructor, you can do this: public RobotDriver(Robot robot) { this.robot = robot.getClass().newInstance(); } Failing that, you might modify your Robot interface to include a copy function: public RobotDriver(Robot robot) { this.robot = robot.makeCopy(); } Or you might make Robot a Cloneable class and modify the Robot interface to make clone() public (it's protected by default): public RobotDriver(Robot robot) { this.robot = robot.clone(); } (This is basically another version of makeCopy().) Finally, applying Juned Ahsan's answer, you can define your RobotDriver constructor to take a factory as an argument or, for the default constructor, to have a settable static default factory: public class RobotDriver { // basic robots by default private static RobotFactory defaultFactory = new BasicRobotFactory(); private static RobotFactory factory = defaultFactory; public RobotDriver() { robot = factory.makeRobot(); } /** * Change the factory for new instances of RobotDriver */ public static void setFactory(RobotFactory factory) { this.factory = factory == null ? defaultFactory : factory; } }
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26198978
score: 1

http://stackoverflow.com/q/26335368
has comment: http://stackoverflow.com/comment/41433071
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/29715223
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41334049
answer count: 1
has comment: http://stackoverflow.com/comment/41334058
accepted answer: http://stackoverflow.com/a/29715223
has title: Parse Unfortunately Application has stopped working continuously on background
type: AnsweredQuestion
has body: My Android Application continuously shows the alert "Unfortunately Application has stopped working" when in background. The only error I get in logical is the one below and it is about Parse (parse.com) that I use to get some info from internet database. I cannot understand what is the problem. I'm lost from days with it even because the problem seems to be inside the parse library and not in my code Logcat output: 10-13 03:50:54.856: E/ParseCommandCache(2568): Failed to run command. 10-13 03:50:54.856: E/ParseCommandCache(2568): com.parse.ParseException: object not found for update 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.ParseCommand.onPostExecute(ParseCommand.java:399) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.ParseRequest$5.then(ParseRequest.java:314) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.ParseRequest$5.then(ParseRequest.java:311) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task$11.run(Task.java:481) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task$ImmediateExecutor.execute(Task.java:673) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task.completeAfterTask(Task.java:477) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task.continueWithTask(Task.java:353) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task.continueWithTask(Task.java:364) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task$9.then(Task.java:410) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task$9.then(Task.java:402) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task$11.run(Task.java:481) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task$ImmediateExecutor.execute(Task.java:673) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task.completeAfterTask(Task.java:477) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.parse.Task.access$400(Task.java:22) 10-13 03:50:54.856: E/ParseCommandCache(2568): at com.…
downvote count: 0
score: 1
tagged with: parsing
favorite count: 0

http://stackoverflow.com/a/26297927
has body: Have a look at ExecutorService. You can pool them, set timeouts, etc. As for sockets, memory, CPU: you should profile your app to make sure that you're using finite resources appropriately. This is true for all Java applications. You can't know the answer by guessing or asking here. Every situation is different. The only way to know is to get some data by profiling.
accepted answer of: http://stackoverflow.com/q/26297749
has comment: http://stackoverflow.com/comment/41293363
answers question: http://stackoverflow.com/q/26297749
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/41268407
has comment: http://stackoverflow.com/comment/41268589
type: Answer
has comment: http://stackoverflow.com/comment/41292054

http://stackoverflow.com/comment/41144408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26231023
has text: Output: {"name":null,"food":null,"quantity":null,"price":0,"status":"not-accepted"}
score: 0

http://stackoverflow.com/a/26250188
has comment: http://stackoverflow.com/comment/43734173
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26250065
answers question: http://stackoverflow.com/q/26250065
type: Answer
score: 3
upvote count: 3
has body: I faced this issue and the solution is We have to use 3.10 final poi jar. 3.9 having this problem. Please remove jars of previous version and add jars of 3.10 final version in which this bug is fixed. Jars requires are: poi-3.10-FINAL.jar poi-ooxml-3.10-FINAL.jar poi-ooxml-schemas-3.10-FINAL.jar Easily available in net: http://mvnrepository.com/artifact/org.apache.poi/poi/3.10-FINAL XWPFDocument document = new XWPFDocument(); CTP ctp = CTP.Factory.newInstance(); CTR ctr = ctp.addNewR(); CTRPr rpr = ctr.addNewRPr(); CTText textt = ctr.addNewT(); textt.setStringValue( " Page 1" ); XWPFParagraph codePara = new XWPFParagraph( ctp, document ); XWPFParagraph[] newparagraphs = new XWPFParagraph[1]; newparagraphs[0] = codePara; CTSectPr sectPr = document.getDocument().getBody().addNewSectPr(); XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy( document, sectPr ); headerFooterPolicy.createFooter( STHdrFtr.DEFAULT, newparagraphs ); The above code is working perfectly, please use 3.10 wars those I mentioned above.
has comment: http://stackoverflow.com/comment/43590835

http://stackoverflow.com/comment/41342033
type: Comment
type: QuestionComment
has text: Yes. Their examples are all overly-simplistic and include lots of XML config - both of which are not helping me at all solve this issue. I have bashed my head against a wall for over 2 weeks now trying to get this to work. The reader quits after only reading 50 or so records.
score: 0
comment on: http://stackoverflow.com/q/26339339

http://stackoverflow.com/q/26351243
has body: The Java Mission Control tool in the JDK provides statistics about object allocation in new TLAB and allocations outside TLAB. (It's under Memory/Allocations). What is the significance of these statistics, what is good for the performance of an application? Should I be worried if some objects are allocated outside TLAB and if yes, what can I do about it?
answer count: 1
downvote count: 0
upvote count: 50
tagged with: jmc
has comment: http://stackoverflow.com/comment/81391769
tagged with: jvm
favorite count: 0
tagged with: garbage-collection
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/26358623
tagged with: java
type: Question
has title: Allocations in new TLAB vs allocations outside TLAB
accepted answer: http://stackoverflow.com/a/26358623
score: 50

http://stackoverflow.com/q/26242890
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41166353
has answer: http://stackoverflow.com/a/26243838
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41165350
has body: I am having connection issues with my java program interacting with oracle 11g using ojdbc7.jar. I am using jdk 1.8 on windows 7 platform. I'm getting an error with the connection. I'm writing my whole program below: package mydao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class AdminDAO { Connection con; public void connectionMethod() { try { Class.forName("oracle.jdbc.driver.OracleDriver"); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:oracleEE", "system", "tiger"); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException sqle) { sqle.printStackTrace(); } } public void loginCheck(String uid, String pwd) { connectionMethod(); try { String sql = "SELECT * FROM ADMIN_LOGIN WHERE ADMINUID=? AND ADMINPWD=?"; PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, uid); ps.setString(2, pwd); ResultSet rs = ps.executeQuery(); while (rs.next()) { rs.getString(1); rs.getString(2); rs.getString(3); } } catch (SQLException sqle) { sqle.printStackTrace(); } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } } } public static void main(String[] args) { AdminDAO a = new AdminDAO(); a.loginCheck("avi", "avi3"); } } But I'm getting error like this: run: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673) at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:715) at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:385) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at mydao.AdminDAO.connectionMethod(Admi…
has comment: http://stackoverflow.com/comment/41165763
has comment: http://stackoverflow.com/comment/41167012
has title: Connection Issues with Java program using oracle 11g
has comment: http://stackoverflow.com/comment/41165839
has comment: http://stackoverflow.com/comment/41164733
tagged with: java
has comment: http://stackoverflow.com/comment/41166185
has comment: http://stackoverflow.com/comment/41164579
has comment: http://stackoverflow.com/comment/41165452
tagged with: oracle11g
has comment: http://stackoverflow.com/comment/41167304
has comment: http://stackoverflow.com/comment/41165514
type: Question
has comment: http://stackoverflow.com/comment/41166691
has comment: http://stackoverflow.com/comment/41165665
answer count: 2
has answer: http://stackoverflow.com/a/26246449
score: 0
has comment: http://stackoverflow.com/comment/41166396
has comment: http://stackoverflow.com/comment/41165426

http://stackoverflow.com/a/26344108
answers question: http://stackoverflow.com/q/26343634
score: 0
has comment: http://stackoverflow.com/comment/41360305
has body: I dont think that goes to an infinte loop. Its just taking time to check for prime numbers. One quick tip is changing the order of if condition will yeild faster result. Try with if (isPalindrome(x) &amp;&amp; isPrime(x)) rather than if(isPrime(x) &amp;&amp; isPalindrome(x)). Calculating prime takes more iteration than checking for a palindrome. Secondly the palindrome checking logic is wrong. x%reverse(x) == 0 wont give a palindrome always. Say for example 100. Reverse is 001. Then 100 % 001 == 0. Which is not a palindrome. Change that to x == reverse(x)
type: Answer

http://stackoverflow.com/a/32662139
downvote count: 0
score: 5
type: Answer
answers question: http://stackoverflow.com/q/26252591
upvote count: 5
has body: I am using Mac OS X 10.9.5. This is how I manage multiple JDK/JRE on my machine when I need one version to run application A and use another version for application B. I created the following script after getting some help online. #!bin/sh function setjdk() { if [ $# -ne 0 ]; then removeFromPath '/Library/Java/JavaVirtualMachines/' if [ -n "${JAVA_HOME+x}" ]; then removeFromPath $JAVA_HOME fi export JAVA_HOME=/Library/Java/JavaVirtualMachines/$1/Contents/Home export PATH=$JAVA_HOME/bin:$PATH fi } function removeFromPath() { export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;") } #setjdk jdk1.8.0_60.jdk setjdk jdk1.7.0_15.jdk I put the above script in .profile file. Just open terminal, type vi .profile, append the script with the above snippet and save it. Once your out type source .profile, this will run your profile script without you having to restart the terminal. Now type java -version it should show 1.7 as your current version. If you intend to change it to 1.8 then comment the line setjdk jdk1.7.0_15.jdk and uncomment the line setjdk jdk1.8.0_60.jdk. Save the script and run it again with source command. I use this mechanism to manage multiple versions of JDK/JRE when I have to compile 2 different Maven projects which need different java versions.

eclipse
tags question: http://stackoverflow.com/q/26324708
tags question: http://stackoverflow.com/q/26329639
tags question: http://stackoverflow.com/q/26283383
tags question: http://stackoverflow.com/q/26278815
tags question: http://stackoverflow.com/q/26308158
tags question: http://stackoverflow.com/q/26346405
tags question: http://stackoverflow.com/q/26287814
tags question: http://stackoverflow.com/q/26343227
tag name: eclipse
tags question: http://stackoverflow.com/q/26235880
tags question: http://stackoverflow.com/q/26315726
tags question: http://stackoverflow.com/q/26244709
tags question: http://stackoverflow.com/q/26337852
tags question: http://stackoverflow.com/q/26224975
tags question: http://stackoverflow.com/q/26353680
tags question: http://stackoverflow.com/q/26343979
tags question: http://stackoverflow.com/q/26291161
tags question: http://stackoverflow.com/q/26233155
tags question: http://stackoverflow.com/q/26298932
tags question: http://stackoverflow.com/q/26332090
tags question: http://stackoverflow.com/q/26197428
tags question: http://stackoverflow.com/q/26234709
tags question: http://stackoverflow.com/q/26206418
tags question: http://stackoverflow.com/q/26200446
tags question: http://stackoverflow.com/q/26207775
tags question: http://stackoverflow.com/q/26276488
tags question: http://stackoverflow.com/q/26200485
tags question: http://stackoverflow.com/q/26203175
tags question: http://stackoverflow.com/q/26327619
tags question: http://stackoverflow.com/q/26255181
tags question: http://stackoverflow.com/q/26287337
tags question: http://stackoverflow.com/q/26316124
tags question: http://stackoverflow.com/q/26214782
tags question: http://stackoverflow.com/q/26308880
tags question: http://stackoverflow.com/q/26200321
tags question: http://stackoverflow.com/q/26253582
tags question: http://stackoverflow.com/q/26212413
tags question: http://stackoverflow.com/q/26279248
tags question: http://stackoverflow.com/q/26337100
tags question: http://stackoverflow.com/q/26202622
tags question: http://stackoverflow.com/q/26197411
tags question: http://stackoverflow.com/q/26282832
tags question: http://stackoverflow.com/q/26264520
tags question: http://stackoverflow.com/q/26286055
tags question: http://stackoverflow.com/q/26351888
tags question: http://stackoverflow.com/q/26207370
tags question: http://stackoverflow.com/q/26305854
tags question: http://stackoverflow.com/q/26257530
tags question: http://stackoverflow.com/q/26313757
tags question: http://stackoverflow.com/q/26253448
tags question: http://stackoverflow.com/q/26352814
tags question: http://stackoverflow.com/q/26228488
tags question: http://stackoverflow.com/q/26232382
tags question: http://stackoverflow.com/q/26330792
tags question: http://stackoverflow.com/q/26229424
tags question: http://stackoverflow.com/q/26330126
tags question: http://stackoverflow.com/q/26277041
tags question: http://stackoverflow.com/q/26271282
tags question: http://stackoverflow.com/q/26216142
tags question: http://stackoverflow.com/q/26204289
tags question: http://stackoverflow.com/q/26203266
tags question: http://stackoverflow.com/q/26335688
tags question: http://stackoverflow.com/q/26335659
tags question: http://stackoverflow.com/q/26292021
tags question: http://stackoverflow.com/q/26250986
tags question: http://stackoverflow.com/q/26264098
tags question: http://stackoverflow.com/q/26276481
tags question: http://stackoverflow.com/q/26281285
tags question: http://stackoverflow.com/q/26278359
tags question: http://stackoverflow.com/q/26207198
tags question: http://stackoverflow.com/q/26339002
tags question: http://stackoverflow.com/q/26300192
tags question: http://stackoverflow.com/q/26295798
tags question: http://stackoverflow.com/q/26279024
tags question: http://stackoverflow.com/q/26226472
tags question: http://stackoverflow.com/q/26338403
tags question: http://stackoverflow.com/q/26305044
tags question: http://stackoverflow.com/q/26342934
tags question: http://stackoverflow.com/q/26349156
tags question: http://stackoverflow.com/q/26310869

http://stackoverflow.com/q/26338582
has body: I have created a plugin where i am in a need of finding the changes inside the method. I have used JavaCore.addElementChangedListener to listen to the changes happening in the java file. but i cant get the changes inside the method. I want to get the changes inside the method .I have gone through the How to capture changes inside methods in an Eclipse plugin but i am not able to get the subtrees and changes fileds . Actually am not able to get the actual concept . can you please help me to get the changes in the method?
type: Question
has comment: http://stackoverflow.com/comment/41364810
has answer: http://stackoverflow.com/a/26383526
score: 0
has comment: http://stackoverflow.com/comment/41340997
upvote count: 1
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41339896
has comment: http://stackoverflow.com/comment/41343295
has comment: http://stackoverflow.com/comment/41354865
tagged with: eclipse-plugin
linked to: http://stackoverflow.com/q/13761220
favorite count: 0
has title: how to identify the modification in a method inside a java file?
has comment: http://stackoverflow.com/comment/41359239
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41344625
tagged with: java
tagged with: eclipse-jdt
tagged with: eclipse-pde
accepted answer: http://stackoverflow.com/a/26383526

http://stackoverflow.com/a/26318508
answers question: http://stackoverflow.com/q/26318397
has body: Yes there is a way. In your layout file set clickable property of all the buttons and give same method name in all the buttons: &lt;Button android:id="@+id/buttonBlue" ... android:clickable="true" android:onClick="onClick"/&gt; ... &lt;Button android:id="@+id/buttonGreen" android:clickable="true" android:onClick="onClick"/&gt; In your activity create a method with name onClick like this: public void onClick(View v) { switch (v.getId()) { case R.id.buttonBlue: // Blue button code break; case R.id.buttonGreen: // Green button code break; case R.id.buttonRed: // Red button code break; default: } }
has comment: http://stackoverflow.com/comment/41302563
score: 0
has comment: http://stackoverflow.com/comment/41302630
has comment: http://stackoverflow.com/comment/41302629
type: Answer
has comment: http://stackoverflow.com/comment/41302534
has comment: http://stackoverflow.com/comment/41302599

http://stackoverflow.com/comment/41346380
comment on: http://stackoverflow.com/q/26339339
type: Comment
type: QuestionComment
has text: What you are describing is what Spring Batch does. Have you looked at the Spring Batch guide found here: http://spring.io/guides/gs/batch-processing/ ? It does exactly what you're asking for.
score: 1

http://stackoverflow.com/q/26252780
has answer: http://stackoverflow.com/a/26254841
has comment: http://stackoverflow.com/comment/41184874
tagged with: xslt
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41183758
tagged with: wso2
has body: I struggling with XSLT transformer mediator using XSLT mediator in wso2 esb 4.8.1. The xslt is : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:ns="http://ep.service.ims.com" xmlns:ax21="http://ep.service.ims.com/xsd" exclude-result-prefixes="ns fn"> <xsl:param name="amount"/> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates select="//ns:getResponse" /> </xsl:template> <xsl:template match="ns:getResponse" xmlns:ns="http://ep.service.ims.com"> <ep:credit xmlns:ep="http://ep.service.ims.com" xmlns:xsd="http://ep.service.ims.com/xsd"> <ep:info> <xsd:amount> <xsl:value-of select="$amount"/> </xsd:amount> <xsd:personInfo> <xsd:address> <xsl:value-of select="ns:return/ax21:address"/> </xsd:address> <xsd:id> <xsl:value-of select="ns:return/ax21:id"/> </xsd:id> <xsd:name> <xsl:value-of select="ns:return/ax21:name"/> </xsd:name> </xsd:personInfo> </ep:info> </ep:credit> </xsl:template> </xsl:stylesheet> and the request XML is : <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns:getResponse xmlns:ns="http://ep.service.ims.com"> <ns:return xsi:type="ax23:PersonInfo" xmlns:ax23="http://ep.service.ims.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ax23:address>IMS Heath, Omega C, India, bnag</ax23:address> <ax23:id>100</ax23:id> <ax23:name>WSO2</ax23:name> </ns:return> </ns:getResponse> </soapenv:Body> </soapenv:Envelope> I tried the XSLT transformation in eclipse and some online tool like (http://xslt.online-toolz.com/tools/xslt-transformation.php ) and it is working fine. However when I am trying the same in WSO2 ESB, I am facing following exception..... org.apache.synapse.mediators.transform.XSLTMediator} - Fatal error occurred in stylesheet parsing : net.sf.saxon.trans.XPathException: The supplied file does not appear to be a stylesheet Value {name ='null', key…
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26261921
type: Question
has title: Issue with XSLT Transformation using WSO2 ESB
answer count: 2
accepted answer: http://stackoverflow.com/a/26261921
possible better answer: http://stackoverflow.com/a/26254841
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/26261400
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41199300
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41198251
has title: Tomcat System.out redirection
has answer: http://stackoverflow.com/a/26261996
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41198074
tagged with: logging
type: Question
has body: We have got a legacy Java application, running on Tomcat. It logs its events in somewhat unconsistent way, sometimes even relying on System.out/err. These stdout/stderr records end up in catalina.log where they are mixed with "proper logged" events. We would like to separate the stdout/stderr log streams into separate files (and eventually get rid of them) but we don't know how to do it. The server runs default JULI configuration but we are open to any other option (such as SLF4J + Logback).
tagged with: java.util.logging

http://stackoverflow.com/q/26329197
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26329561
type: Question
has answer: http://stackoverflow.com/a/26329619
answer count: 2
possible better answer: http://stackoverflow.com/a/26329561
tagged with: cdi
has body: I'd like to implement a pattern for my business logic similar to the way WebSocket-annotated methods are handled. Given the value of a particular parameter of an incoming message, I'd like to invoke an annotated method in a managed bean that is looked up on the fly. For example, given the following setup: @Qualifier @Target( ElementType.METHOD ) @Retention( RetentionPolicy.RUNTIME ) public @interface Handler { } @ApplicationScoped public class MyHandler1 { @Handler public void someMethod() { } @Handler public void otherMethod() { } } Then I'd like to write a function to pick a method based on that parameter value. It should be as simple as given "someMethod" as a value and looking up my qualified managed beans with a method named "someMethod" and calling it. My problem is that selecting beans with Instance&lt;...> only works on type-level qualifiers and/or types. To actually find the methods I would need to iterate through all the methods. I'm a little worried about the cost of lookup and/or having to manage a cache or some sort.
has title: Can I use CDI to look for all qualifier-annotated methods in any beans?
accepted answer: http://stackoverflow.com/a/26329619
tagged with: reflection
score: 0
tagged with: annotations
tagged with: jakarta-ee

http://stackoverflow.com/a/26231825
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26231770
has body: use Print instead of Println System.out.print("your message");

http://stackoverflow.com/comment/112647970
type: Comment
has text: This is my 100/100 JavaScript solution
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/63703081

http://stackoverflow.com/comment/41297324
has text: @user3851486: Can I get the best answer too :P
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26315264
type: Comment

http://stackoverflow.com/q/26209842
accepted answer: http://stackoverflow.com/a/26209953
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: performance
tagged with: algorithm
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26209953
has body: I was going through some practice problems and having a hard time understanding how to analyze the running times of these for the loop functions given below. Could someone please go through it step by step for me through the entire thing? For each of the functions given below, I have to give the order of growth (as a function of N) of the running times of each of the following code fragments? int sum = 0; for(int n = N; n&gt;0; n/=2) for(int i =0; i &lt;n; i++) sum++; int sum = 0; for(int i = 1; i&lt;N; i*=2) for(int j =0; j &lt;i; j++) sum++; int sum = 0; for(int i = 1; i&lt;N; i*=2) for(int j =0; j &lt; N; j++) sum++;
favorite count: 0
has title: Analyzing Nested Loop Running Times?
tagged with: big-o
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/69114717

http://stackoverflow.com/comment/41230520
type: AnswerComment
comment on: http://stackoverflow.com/a/26264141
type: Comment
score: 0
has text: Thank you for the response. The problem with Spring Data JPA is that a dynamic proxy is generated (based on the SimpleJPARepostitory) which is beyond our control therefor you cannot add the annotation to the actual implementation (also, appying the ResourceNotFound annotation on the implementation class won't allow for any specialization on seperate Repositories). The @Transactional works out-of-the-box when applied to the Interface itself; didn't find out how that is achieved

http://stackoverflow.com/comment/41224006
comment on: http://stackoverflow.com/q/26275605
score: 3
has text: Show us the code you have tried.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26339587
has body: We have refactored some parts of our application, and after that, methods annotated with spring cachable stopped being cached although the class containing the cached method was not touched. After some debugging, we can see that after refactoring and adding some new Spring beans, the bean with the cachable method is now created in the same batch as the internalCacheAdvisor itself. The Advice can thus not be applied and the Spring cache aspect is never invoked. So the method result is not cached, @Cachable annotation does not work. What mechanism is deciding what beans that can be created simultaneously, and how can I debug and affect this mechanism? I have looked in the Spring method BeanFactoryAdvisorRetrievalHelper::findAdvisorBeans, and when running the old and worikng code, it looks like this: After refactoring it looks like this: Our annotated class couchbaseTranslationProvider is created at the same batch as internalCacheAdvisor, which is not possible. When trying to apply the advice proxy, I get a debug message "Skipping currently created advisor ...". (I think this should have been an error message!) Our POM-file enabling the cache looks like this: @Configuration @EnableWebMvc @ComponentScan({"[package]", "[package].connectors"}) @Import({EventsConfig.class, CmsConfig.class}) @EnableCaching public class ApiConfig { public static class Caches{ public static final String SPORTS = "sports"; [...] public static final String PIPEDTRANSLATIONS = "translations"; } @Value("${[package].document}") private String someUrl; @Bean public CouchbaseClient getCouchbaseClient() throws IOException { [code] } @Bean public CacheManager cacheManager() { SimpleCacheManager cacheManager = new SimpleCacheManager(); cacheManager.setCaches(Arrays.asList(new ConcurrentMapCache(Caches.SPORTS), [...], new ConcurrentMapCache(Caches.PIPEDTRANSLATIONS))); return cacheManager; } @Autowired private EventUpdateGate eventUpdateGate; @Bean @ConditionalOnProperty("AdapterGate.events.active") pub…
tagged with: java
has comment: http://stackoverflow.com/comment/41346315
tagged with: spring-cache
score: 0
has comment: http://stackoverflow.com/comment/41485300
has title: Cannot add Spring Cache advice to method - internalCacheAdvisor is created in same batch as cachable annotated bean
has comment: http://stackoverflow.com/comment/41423870
has comment: http://stackoverflow.com/comment/41541871
has comment: http://stackoverflow.com/comment/41372664
answer count: 0
type: UnansweredQuestion
tagged with: spring-annotations
tagged with: spring
type: Question

http://stackoverflow.com/comment/41198144
comment on: http://stackoverflow.com/q/26261302
type: QuestionComment
type: Comment
has text: @MxyL: No, you haven't - the only code you've included is the call to `String.replace`...
score: 1

http://stackoverflow.com/comment/57928687
comment on: http://stackoverflow.com/q/26318341
score: 0
has text: I put a finger exercise in micro benchmarking at [Ideone](http://ideone.com/hNERoh). Getting quite different results, especially compared to execution at Ideone - be sure to set number of iterations & such to reasonable sizes when running in your own environment. My conclusion: _with relatively large bottom dimension_ the differences between _single array&index arithmetic_ vs. _nested arrays_ are negligible.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41156610
score: 0
type: Comment
has text: @wrongAnswer Could, yes, but the fact that there are no setter, does not imply this :D.
comment on: http://stackoverflow.com/a/26238429
type: AnswerComment

http://stackoverflow.com/q/26242402
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: openjpa
has comment: http://stackoverflow.com/comment/41163857
type: Question
accepted answer: http://stackoverflow.com/a/26242751
linked to: http://stackoverflow.com/q/6110048
score: 0
has title: finding latest entry by JPA
has body: I find this thread very helpful, but it looks like implementation in the advices are not quite efficient because of the nature of JPA. I am looking for a solution to pickup latest entry of joining query with grouping, implemented by JPA, so it is not a simple job. My implementation is put "ORDER BY time DESC" in the end and pick up the first from return collection, instead of using MAX() function which have to introduce subquery as well, but I wonder is this a good alternative ? This is the complex query I made by the example from the other example: "SELECT oo FROM Order AS oo WHERE oo.id IN " + "(SELECT temp.id FROM " + "(SELECT t.order.id AS id, MAX(t.order.orderTime) AS ordTime FROM Transaction t " + "WHERE t.order.name= :name " + "GROUP BY t.order.name) AS temp" + ")"; This is the query which I think could be a good alternative but not sure: String query = "SELECT t.order FROM Transaction AS t " + " WHERE t.order.name= :name " + " ORDER BY t.order.orderTime DESC"; // and simply just pick up the 1st as the latest entry from result: Order order = em.createQueryquery , Order .class).getResultList().get(0);
tagged with: jpa
answer count: 1
linked to: http://stackoverflow.com/q/6296347
has answer: http://stackoverflow.com/a/26242751
has comment: http://stackoverflow.com/comment/41163646

http://stackoverflow.com/comment/41354575
score: 0
type: QuestionComment
has text: @ElliottFrisch I had done what you advised and just use a locale conversion code to transfer it back to dd-MM-yyyy. Cheers.
type: Comment
comment on: http://stackoverflow.com/q/26332033

http://stackoverflow.com/comment/41353351
comment on: http://stackoverflow.com/a/26330436
score: 0
type: AnswerComment
type: Comment
has text: then on top of that, you will end up having bad developers on any team you end up on. That's why most developers don't know how to write unit tests, or have never written a line of documentation in their life, or will post a comment on a message board before googling for an answer that they can get faster that way. Not everyone can be a genius, some people will do it wrong most of their career. That's why most software development is bug fixing rather than greenfield projects

http://stackoverflow.com/a/26210325
type: Answer
answers question: http://stackoverflow.com/q/26209931
has body: You must define the array from outside the if statement. You can follow both ways. int[] temp = null; if(i==1){ temp =new int[7] } int[] temp; if(i==1){ temp =new int[7] } first one must be null check before use it. second one gives compiler error to initialize. So you can add else clause and set empty array.
score: 0

http://stackoverflow.com/a/26250763
answers question: http://stackoverflow.com/q/26250401
type: AcceptedAnswer
score: 0
type: Answer
has body: Below is your modified code import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub try { File fXmlFile = new File("D://test3.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); NodeList nodeList0 = doc.getElementsByTagName("Service"); NodeList nodeList1 = doc.getElementsByTagName("File"); NodeList nodeList2 = doc.getElementsByTagName("name"); NodeList nodeList3 = doc.getElementsByTagName("grouped"); System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); for (int temp0 = 0; temp0 &lt; nodeList0.getLength(); temp0++) { Node node0 = nodeList0.item(temp0); System.out.println("\nElement type :" + node0.getNodeName()); Element Service = (Element) node0; System.out.println("----" + temp0 + "-------"); if (node0.getNodeType() == Node.ELEMENT_NODE) { System.out .println("Name : " + Service.getAttribute("name")); System.out.println("regrx : " + Service.getAttribute("regrx")); System.out.println("reverex" + Service.getAttribute("reverseExtention")); for (int temp = 0; temp &lt; nodeList1.getLength(); temp++) { Node node1 = nodeList1.item(temp); System.out.println("------file" + temp + "--------"); System.out.println("\nElement type :" + node1.getNodeName()); Element File = (Element) node1; // used for getting file level if (node1.getNodeType() == Node.ELEMENT_NODE) { System.out.println("rootProfile:" + File.getAttribute("rootProfile")); System.out.println("extension : " + File.getAttribute("extension")); System.out.println("seperator : " + File.getAttribute("seperator")); System.out.println("targetSeperator : " + File.getAttribute…
accepted answer of: http://stackoverflow.com/q/26250401

http://stackoverflow.com/comment/41364452
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26352247
type: Comment
has text: Which part? Forgive, but your answer doesn't quite read the way I think you intended it to

http://stackoverflow.com/comment/41285293
type: Comment
score: 0
type: AnswerComment
has text: That is a good idea, but not what I need. We use cloudcoder for the assingments and my code doesn't have to include main method, it's already implemented by a teacher.
comment on: http://stackoverflow.com/a/26308785

http://stackoverflow.com/q/26342520
type: Question
has comment: http://stackoverflow.com/comment/41347264
tagged with: android-location
score: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41347636
tagged with: java
has title: Create a radius when ever the user set's the location
has body: I want to create a radius of 10 meters using the GPS location. Below is the code to get the GPS location: public class GPSTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; // latitude double longitude; // longitude // The minimum distance to change Updates in meters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 1; // 10 meters // The minimum time between updates in milliseconds private static final long MIN_TIME_BW_UPDATES = 1000 * 1 * 1; // 1 second // Declaring a Location Manager protected LocationManager locationManager; public GPSTracker(Context context) { this.mContext = context; getLocation(); } public Location getLocation() { try { locationManager = (LocationManager) mContext .getSystemService(LOCATION_SERVICE); // getting GPS status isGPSEnabled = locationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled &amp;&amp; !isNetworkEnabled) { // no network provider is enabled } else { this.canGetLocation = true; if (isNetworkEnabled) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("Network", "Network"); if (locationManager != null) { location = locationManager .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } } // if GPS Enabled get lat/long using GPS Services if (isGPSEnabled) { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("GPS Enabled", "GPS Enabled"); if (locationManager !=…

http://stackoverflow.com/comment/41356974
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/26347566
has text: @CodeMed Sounds like the problem you reported is now fixed! Debugging the rest of it sounds like a new question, with rather different tags etc.

http://stackoverflow.com/comment/41163687
has text: Thanks for your help. How do I call it from my activity?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26242122
type: AnswerComment

http://stackoverflow.com/comment/41297146
type: Comment
has text: @Mureinik i say in topic thats as an string and return String
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26315568

http://stackoverflow.com/a/30756677
score: 16
accepted answer of: http://stackoverflow.com/q/26285000
has body: In addition to File &gt; Project Structure &gt; Project &gt; Project Language Level as other has mention, you should also check File &gt; Project Structure &gt; **Modules** &gt; Sources &gt; Project Language Level and set to 8
type: AcceptedAnswer
downvote count: 0
upvote count: 16
type: Answer
answers question: http://stackoverflow.com/q/26285000

http://stackoverflow.com/comment/41334280
has text: So what's the question?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26335509
type: QuestionComment

http://stackoverflow.com/a/26251015
answers question: http://stackoverflow.com/q/26250455
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: //instance variables private GoogleMap googleMap; private double longitude = 0.0; private double latitude = 0.0; private LocationManager locationManager = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // your layout try { initilizeMap(); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 1, this); googleMap.setMyLocationEnabled(true); googleMap.getUiSettings().setMyLocationButtonEnabled(true); } } catch (Exception e) { e.printStackTrace(); } } private void initilizeMap() { if (googleMap == null) { googleMap = ((MapFragment) getFragmentManager().findFragmentById( R.id.map)).getMap(); //provide your id // check if map is created successfully or not if (googleMap == null) { Toast.makeText(getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT) .show(); } } } @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub longitude = location.getLongitude(); latitude = location.getLatitude(); //System.out.println(latitude+ " "+longitude ); if(!isStopFocusEnabled){ CameraPosition cameraPosition = new CameraPosition.Builder().target( new LatLng(latitude, longitude)).zoom(12).build(); googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } } In Manifest below code must be there &lt;permission android:name="com.ani.map.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="com.ani.map.permission.MAPS_RECEIVE" /&gt; &lt;uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_GPS" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt; &lt;uses-permission android…
type: Answer
accepted answer of: http://stackoverflow.com/q/26250455

storage
tag name: storage
tags question: http://stackoverflow.com/q/26197678
type: Tag

http://stackoverflow.com/q/26276874
has body: I have used Google OAuth with java for Authentication.When I get logged in I will redirected to a page and I get URI like this http://www.demo.com/demo/PROJECTNAME/oauthRedirect?state=google;294822862&amp;code=4/aUEAqsMu7o074wsJymyAK9CMseWR.YlkPPRXJzt8Vcp7tdiljKKbHfgXpkQI but when I try to refresh page it gives me error com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { "error" : "invalid_grant", "error_description" : "Invalid code." } com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:103) com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:303) com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest.execute(GoogleAuthorizationCodeTokenRequest.java:175) com.mob.googleoauth.GoogleAuthHelper.getUserInfoJson(GoogleAuthHelper.java:108) com.mob.controller.UserController.user(UserController.java:55) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) org.springframework.web.servlet.DispatcherServlet.doDi…
has comment: http://stackoverflow.com/comment/41226197
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41226499
tagged with: oauth
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/28983484
has title: After Login from google OAuth refresh of page is not working
tagged with: google-oauth
answer count: 1
downvote count: 0

http://stackoverflow.com/a/36059691
has body: I am not an android app developer. But I encountered this same problem in Golang. The problem is not with the file, its with the folder. You have to set create permission for the folder _rels. In my case I was extracting a .docx file and I only needed the data file which was "word/document.xml" so I set permission for folder "word" and extracted that folder alone. If you too are looking for the data file of .xlsx then it is "xl/worksheets/sheet1.xml". In your case you have to give permission for both "xl" and "worksheets". Hoping this will help. NB: My android knowledge is very limited, but I think you have to write permission for accessing an external file or folder on the source code itself, not on manifest file.
type: Answer
answers question: http://stackoverflow.com/q/26200550
score: 0

http://stackoverflow.com/comment/41316603
comment on: http://stackoverflow.com/q/26326193
has text: for the record: before i was messing with dagger butterknife worked.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26244206
has comment: http://stackoverflow.com/comment/41167776
score: 3
has comment: http://stackoverflow.com/comment/41167346
upvote count: 3
has comment: http://stackoverflow.com/comment/41167564
has comment: http://stackoverflow.com/comment/41167203
accepted answer of: http://stackoverflow.com/q/26244041
answers question: http://stackoverflow.com/q/26244041
has comment: http://stackoverflow.com/comment/41168181
has body: You should use System.nanoTime(). (API Here) From the documentation: This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time. The value returned represents nanoseconds since some fixed but arbitrary origin time (perhaps in the future, so values may be negative). The same origin is used by all invocations of this method in an instance of a Java virtual machine; other virtual machine instances are likely to use a different origin. So the nanoTime() is fine for use to measure your execution time because the measurement will always be the same and it will use nanoseconds. Set the start time to the current nano time. start = System.nanoTime(); At the end of the loop set the end time to the current nano time end = System.nanoTime(); To find the difference, which is the time it took to execute, just subtract like you do. To make it easy, you can just change getUserTime() to return System.nano() Example: //get integers m and n from user before this. long start,end,time; int[][] a = new int[m][n]; int[][] b = new int[m][n]; int[][] c= new int[m][n]; start = getUserTime(); for(int i = 0;i &lt; m;i++) { for(int j = 0;j &lt; n;j++) { c[i][j] = a[i][j]+b[i][j]; } } end = getUserTime(); // You could use Math.abs() here to handle the situation where // the values could be negative time = end - start; /** Get user time in nanoseconds. */ public long getUserTime() { return System.nanoTime() }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41168156
downvote count: 0
has comment: http://stackoverflow.com/comment/41167443
has comment: http://stackoverflow.com/comment/41167412
has comment: http://stackoverflow.com/comment/41167987
has comment: http://stackoverflow.com/comment/41168238
type: Answer

http://stackoverflow.com/q/26215295
has answer: http://stackoverflow.com/a/26215461
has comment: http://stackoverflow.com/comment/41112473
downvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41118706
type: UnansweredQuestion
tagged with: jlist
has comment: http://stackoverflow.com/comment/41112350
has comment: http://stackoverflow.com/comment/41112397
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41112746
tagged with: swing
type: Question
score: -1
has body: How can I properly remove an element/item in a jlist? Because I always run into this error. I cannot find any solution from google. Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.Vector.elementData(Vector.java:734) at java.util.Vector.elementAt(Vector.java:477) at javax.swing.DefaultListModel.getElementAt(DefaultListModel.java:89) Model: DefaultListModel CartModel = new DefaultListModel(); Cart.setModel(CartModel); JList: private javax.swing.JList Cart; Nevermind the StringSearch method. My code: private void removeFromCartActionPerformed(java.awt.event.ActionEvent evt) { if(!CartModel.isEmpty()) { String selectedText = (String)CartModel.getElementAt(Cart.getSelectedIndex()); StringSearch(selectedText,2); CartModel.removeElementAt(Cart.getSelectedIndex()); } }
has title: How to remove an element from in a jlist?

http://stackoverflow.com/comment/41364537
type: QuestionComment
has text: you need to know the threads processing time also. If threads are not finishing in time, even a smaller load will fail after some time depending when all threads eat up all your cpu/memory.
comment on: http://stackoverflow.com/q/26352315
score: 0
type: Comment

http://stackoverflow.com/comment/41193476
score: 0
comment on: http://stackoverflow.com/a/26259067
type: Comment
type: AnswerComment
has text: You just made my day, @James_D ! Wish you a great day.

http://stackoverflow.com/a/26201975
has comment: http://stackoverflow.com/comment/41089417
has comment: http://stackoverflow.com/comment/41088881
has comment: http://stackoverflow.com/comment/41088672
has comment: http://stackoverflow.com/comment/41088351
upvote count: 1
has body: Like Boris the spider told you in comment declaring constants in interfaces is an anti pattern. However your problem comes from the fact that you are passing a String to any instance of your enum but you are not declaring a constructor for this public enum Levels { LOW("30 points"), MEDIUM("50 points") private final String pts; private Levels(String pts) { this.pts = pts; } public String getPoints() { return pts; } }; This should work.
type: Answer
answers question: http://stackoverflow.com/q/26201901
downvote count: 0
score: 1

http://stackoverflow.com/q/26288707
tagged with: java
has answer: http://stackoverflow.com/a/26288821
type: Question
score: 0
answer count: 2
has title: Counter won't work to end loop
has comment: http://stackoverflow.com/comment/41250971
possible better answer: http://stackoverflow.com/a/26288821
has comment: http://stackoverflow.com/comment/41248907
has comment: http://stackoverflow.com/comment/41248909
has body: I am working on an assignment and it is working well so far. But several aspects aren't working. For starters, my counters for int total and int counter won't work. Also my if statements don't seem to be working. I have been scratching my head for several days now. The assignment calls for a program to input the order number and will loop based on how many orders the customer has. It also calls for customer name, sign type(wood or plastic), the number of characters,and color of characters. Some more information: The base price for all signs is $20. If sign is wood, add $10. If it is plastic add $5. The first 5 letters/numbers are included in base price, and $2 for each additional character. Black or white characters are included in base price, there is an additional $8 for colored letters. If the total charge is more than $100 give 25% discount on total price. Here is my code right now: import java.util.Scanner; public class Carpenter { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int orderNumber; String custName; String signType; int numOfCharacters; String color; int i = 20; double total; int counter; System.out.println("Enter your order number"); orderNumber = sc.nextInt(); counter=orderNumber; counter--; sc.nextLine(); System.out.println("Enter customer name"); custName = sc.next(); do{ System.out.println("Enter the sign type (wood or plastic)"); signType = sc.next(); if(signType == "wood") { i+=10; } if(signType == "plastic") { i+=5; } System.out.println("Enter the number of characters"); numOfCharacters = sc.nextInt(); if(numOfCharacters &gt; 5) { i += 2*(numOfCharacters-5); } System.out.println("Enter the color of characters"); color = sc.next(); if(color != "white" || color != "black") { i += 8; } total= i; System.out.println("Total is: $" + total); if( total &gt; 100 ) { total = (total * 0.25); System.out.println("The total is " + total ); } } while(counter &lt;= orderNumber); } }
has answer: http://stackoverflow.com/a/26290040
accepted answer: http://stackoverflow.com/a/26290040
has comment: http://stackoverflow.com/comment/41248898
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41250265
has comment: http://stackoverflow.com/comment/41248929

http://stackoverflow.com/q/26324510
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41313607
upvote count: 1
has answer: http://stackoverflow.com/a/26324596
has body: am doing bookstore system. the user will have to chose whether to add, delete and so on. if he chose to add then he will write all the book attributes which later will be saved in the items array "items array is an array object" this is my code public class userChoices { Items[] items = new Items[200]; AddItem add = new AddItem(); Scanner s = new Scanner(System.in); public void add(){ boolean invalidInput; int q = -1; do { try { invalidInput = false; System.out.println("How many book(s) you want to add?"); q = s.nextInt(); for(int i = 0; i &lt; q; i++){ add.getCode(); add.getQuantity(); add.getCostPrice(); add.getDescription(); add.getDiscount(); add.getSellingPrice(); add.getStatus(); for(int r = 0; r &lt; items.length; r++){ if(items[r] != null){ items[r] = new Items(add.getCode(), add.getDescription(), add.getQuantity(), add.getCostPrice(), add.getSellingPrice(), add.getStatus(), add.getDiscount()); continue; } } } } catch (InputMismatchException e) { System.out.println("Please enter a valid integer."); s.next(); invalidInput = true; // This is what will get the program to loop back } } while (invalidInput); } this is my Items class public class Items { private int code, quantity; private String description; private double costPrice, sellingPrice; String status, discount; public Items(){ this.code = 1111; this.quantity = 1; this.description = "Action"; this.costPrice = 12.00; this.sellingPrice = 16.00; this.discount = "5%"; this.status = "Unvailable"; } public Items(int code, String description, int quantity, double costPrice, double sellingPrice, String status, String discount){ this.code = code; this.description = description; this.quantity = quantity; this.costPrice = costPrice; this.sellingPrice = sellingPrice; this.status = status; this.discount = discount; } public void setCode(int code){ this.code = code; } public void setQuantity(int quantity){ this.quantity = quantity; } public void setDescription(String description){ this.description = description; } pu…
score: 1
has comment: http://stackoverflow.com/comment/41313572
tagged with: java
has answer: http://stackoverflow.com/a/26324670
type: Question
answer count: 2
has title: how to add and print into and from an object array?
downvote count: 0

http://stackoverflow.com/q/26253458
has body: I have come across methods like if (_log.isInfoEnabled()) _log.info("Kicking the Supplier Info at " + importFrom + " with JobID " + jobId); where _ is present before a method name. What does that mean?
has comment: http://stackoverflow.com/comment/41183475
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41183318
upvote count: 1
tagged with: naming-conventions
has title: What is the meaning of underscore before a method name in Java?
has comment: http://stackoverflow.com/comment/41183479
has comment: http://stackoverflow.com/comment/41183315
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41183384
tagged with: methods
has comment: http://stackoverflow.com/comment/41183489
type: Question
has answer: http://stackoverflow.com/a/26253556
answer count: 1
downvote count: 0
favorite count: 0

collections
tags question: http://stackoverflow.com/q/26197389
tags question: http://stackoverflow.com/q/26258197
tags question: http://stackoverflow.com/q/26249709
tags question: http://stackoverflow.com/q/26271992
tags question: http://stackoverflow.com/q/26307613
tags question: http://stackoverflow.com/q/26296457
tags question: http://stackoverflow.com/q/26203660
tags question: http://stackoverflow.com/q/26291071
tags question: http://stackoverflow.com/q/26342645
tags question: http://stackoverflow.com/q/26195243
tags question: http://stackoverflow.com/q/26217105
tags question: http://stackoverflow.com/q/26302169
tags question: http://stackoverflow.com/q/26343140
type: Tag
tags question: http://stackoverflow.com/q/26321951
tags question: http://stackoverflow.com/q/26339547
tags question: http://stackoverflow.com/q/26194702
tags question: http://stackoverflow.com/q/26323777
tag name: collections
tags question: http://stackoverflow.com/q/26203803
tags question: http://stackoverflow.com/q/26311776
tags question: http://stackoverflow.com/q/26275643
tags question: http://stackoverflow.com/q/26242883
tags question: http://stackoverflow.com/q/26311369
tags question: http://stackoverflow.com/q/26318931

http://stackoverflow.com/q/26341376
type: Question
type: AnsweredQuestion
tagged with: google-analytics
tagged with: components
has title: How to add Html code snippet into every page using CQ5 service components
tagged with: google-tag-manager
score: 0
possible better answer: http://stackoverflow.com/a/26342741
has body: To get google tag manager data we need to add code provided by google into each and every page. I dont want to manually add the code to each and every page component in CQ,as numerous templates can be created and it becomes manual job. Instead i want to add the HTML code into my page on every page load. Can i achieve this using service component(java class). If not please, provide any alternative to achieve this.
has answer: http://stackoverflow.com/a/26360539
has answer: http://stackoverflow.com/a/26382042
accepted answer: http://stackoverflow.com/a/26382042
has answer: http://stackoverflow.com/a/26375611
tagged with: aem
answer count: 4
has answer: http://stackoverflow.com/a/26342741
tagged with: java

http://stackoverflow.com/a/26210315
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/41106346
has body: Take a look at your constructor of Foo` public Foo(int age, int weight) { fooAge = age; fooWeight = weight; } But these fooAge and fooWeight are final private final int fooAge = 23; private static final int fooWeight = 150; You can't alter final variables. final it self has the meaning what is final variable. Solution: you can use non final variables. Next issue.. System.out.println(Foo.FOONAME); //FOONAME non static you can't call by class //name non static variables solution: make FOONAME static. Next issue. switch(a) { case young: // cases must be constant. In here young is not a constant. Solution: make young final. final int young = 20; Next issue. List&lt;String&gt; names = new ArrayList&lt;&gt;(); // List not imported names.add(young); // adding int to String array? Solution: use proper imports. import java.util.List; and names.add(String.valueOf(young)); Next issue. public void setHeight(final double height) { fooHeight = height; height = null; // you can't use null for primitive double // and also height is final can't change it. Solution: you can not assign new value to height
has comment: http://stackoverflow.com/comment/41103706
downvote count: 0
has comment: http://stackoverflow.com/comment/41107049
has comment: http://stackoverflow.com/comment/41106605
answers question: http://stackoverflow.com/q/26210295
type: Answer

http://stackoverflow.com/q/26323813
tagged with: java
answer count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
has body: How can I configure netbeans for adding logger into my new java class by default while creating new ones? I can get my logger by default by typing code template : log But this gives me instant : Logger.getLogger(MyClass.class.getName()).log(Level.INFO, ""); and after some time my class becomes full of this Logger.getLogger(MyClass.class.getName()) which should be replaced by a simple LOG with a : private static final Logger LOG = Logger.getLogger(MyClass.class.getName()); at the top of the class which I get after right clicking class -> Insert code -> Logger Can I get this automatically added while creating new classes?
favorite count: 0
type: Question
upvote count: 2
has title: How can I configure netbeans for adding logger into new class by default
tagged with: netbeans

http://stackoverflow.com/comment/41263096
has text: Please post code of dialog's button, and logcat
comment on: http://stackoverflow.com/q/26296952
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26198875
downvote count: 0
has comment: http://stackoverflow.com/comment/41082245
favorite count: 0
has comment: http://stackoverflow.com/comment/41082373
has answer: http://stackoverflow.com/a/26198916
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/26198916
type: Question
possible better answer: http://stackoverflow.com/a/26198939
has title: Junit testing dependent methods
has body: I'm having trouble with Junit testing, and can find little info online. Firstly, I want to test 2 methods, 1.setTable(int r, int c, String s) 2.getTableString(). I managed to test the first one, but the second one requires that the table be already built (the table being a private static char[][] with a getter, and is built by the first method). How do I go about testing this second method? I thought of doing this: public void testGetTableString() { MyClass test = new MyClass(); test.setTable(5, 4, "string"); String toTest = test.getTableString(); assertEquals("expected result", toTest); } This however doesn't seem right since it's dependent on setTable working. I also thought of initializing test.setTable(5,4,"string") in the setUp() method, but that would mean that I'd have to change the parameters for setTable in the setUp() method each time and not be able to track my tests; plus it would setUp() for my first method too, which I don't want. Any help is greatly appreciated.
has answer: http://stackoverflow.com/a/26198939
has comment: http://stackoverflow.com/comment/41082822
answer count: 2
tagged with: junit

http://stackoverflow.com/a/26322582
score: 2
has body: Below code makes one and two point to same location i.e changing either will change both of them. yobj *one = new Myobj(); Myobj *two = one; If you want two to be a copy of one then, Myobj *one = new Myobj(); Myobj *two = new Myobj(); *two = *one;
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26322494

http://stackoverflow.com/comment/41203896
comment on: http://stackoverflow.com/a/26264263
score: 0
type: AnswerComment
type: Comment
has text: thanks, that's works. nice solution, but is there any mistakes in my code ?

http://stackoverflow.com/comment/41305470
type: AnswerComment
comment on: http://stackoverflow.com/a/26320101
score: 0
type: Comment
has text: Yes, its still the case with classSum, sum is just a temp variable for storing the current student grades

http://stackoverflow.com/a/26205852
score: 2
upvote count: 2
has body: Here's what your code should look like: public List&lt;String&gt; findAllNames(Integer telephoneNumber, String job, Integer birthDate) { return myRepo.fetchByCriteria(telephoneNumber, job, birthDate); } And in the repository, you should dynamicall compose a query based on the values of the criteria. JPA has a Criteria API designed specifically for this kind of use case. If using SQL, here's what the code could look like: public List&lt;String&gt; fetchByCriteria(Integer telephoneNumber, String job, Integer birthDate) { String sql = "select name from user u where 1 = 1"; List&lt;Object&gt; parameters = new ArrayList&lt;&gt;(); if (telephoneNumber != null) { sql += " and u.phone = ?"; parameters.add(telephoneNumber); } if (job != null) { sql += " and u.job = ?"; parameters.add(job); } if (birthDate != null) { sql += " and u.birthDate = ?"; parameters.add(birthDate); } ... } Of course, there are also APIs allowing to compose such SQL queries dynamically (JOOQ comes to mind).
answers question: http://stackoverflow.com/q/26205188
downvote count: 0
type: Answer

http://stackoverflow.com/a/26343855
has comment: http://stackoverflow.com/comment/41349975
has body: If you implement the GenericCommandListener like this: public interface GenericCommandListener&lt;T&gt; { public &lt;U extends GenericCommand&lt;T&gt;&gt; void onValueAvailable(U theCmd); } Then you should be able to add listeners to your GenericCommand class like this: public abstract class GenericCommand&lt;T&gt; implements Future&lt;T&gt; { private final List&lt;GenericCommandListener&lt;T&gt;&gt; list = new ArrayList&lt;&gt;(); public &lt;U extends GenericCommandListener&lt;T&gt;&gt; void addListener(U listener) { list.add(listener); } Does that help?
score: 0
has comment: http://stackoverflow.com/comment/41370440
has comment: http://stackoverflow.com/comment/41350191
has comment: http://stackoverflow.com/comment/41349612
has comment: http://stackoverflow.com/comment/41349729
type: Answer
answers question: http://stackoverflow.com/q/26343445

http://stackoverflow.com/comment/41343426
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26340597
has text: This is a link-only answer. You should give some more details if you don't want your answer to be flagged as low-quality.
type: AnswerComment

http://stackoverflow.com/comment/41327908
type: QuestionComment
comment on: http://stackoverflow.com/q/26332041
score: 0
has text: Make sure that you call `connection.setRequestMethod("GET");` before `connection.setDoInput(true);` and `connection.setDoOutput(true);`. Otherwise, you're telling HttpURLConnection to do a GET after the connection has been established.
type: Comment

http://stackoverflow.com/comment/41202429
type: Comment
has text: @M.Deinum I put them on both, but [the reference documentation example](http://docs.spring.io/spring-security/site/docs/3.2.5.RELEASE/reference/htmlsingle/#jc-method) has them on the interface. Will include my `WebConfig`
score: 0
comment on: http://stackoverflow.com/q/26263715
type: QuestionComment

http://stackoverflow.com/comment/41212107
has text: Hi @PetrMensik theres another issue, it says that class not found on dom4j but i have it already on my library. Can you help me with this?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26249032
score: 0

http://stackoverflow.com/q/26322985
has title: Id must be assignable to Serializable With LAZY @ManyToOne
has comment: http://stackoverflow.com/comment/41310745
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/27647672
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27312833
tagged with: spring-data-rest
has answer: http://stackoverflow.com/a/26326915
favorite count: 0
has body: When I have entities having following - @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "question", nullable = false, referencedColumnName="id") I get below error. The error goes away however after making only @ManyToOne associations as EAGER, leaving bidirectional @OneToMany as LAZY. How to make this work with LAZY @ManyToOne with Spring DATA REST java.lang.IllegalArgumentException: Id must be assignable to Serializable! Object of class [null] must be an instance of interface java.io.Serializable at org.springframework.util.Assert.isInstanceOf(Assert.java:339) at org.springframework.data.rest.webmvc.support.RepositoryEntityLinks.linkToSingleResource(RepositoryEntityLinks.java:160) at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.getSelfLinkFor(PersistentEntityResourceAssembler.java:203) at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.wrap(PersistentEntityResourceAssembler.java:107) at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:84) at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController$1.apply(RepositoryPropertyReferenceController.java:141) at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController$1.apply(RepositoryPropertyReferenceController.java:110) at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.doWithReferencedProperty(RepositoryPropertyReferenceController.java:464) at org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController.followPropertyReference(RepositoryPropertyReferenceController.java:148) 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 org.springframework.web.method.support.InvocableHandlerMethod.…
possible better answer: http://stackoverflow.com/a/26326915
tagged with: annotations
upvote count: 1
accepted answer: http://stackoverflow.com/a/27312833
tagged with: spring

http://stackoverflow.com/comment/41305062
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26316675
has text: *"can't find anything online that I understand"* Why should we try explaining again, then? It is likely you will not understand us. Link to the things you found and explain what you don't understand.

http://stackoverflow.com/comment/41232378
has text: You should generally not create Activities using a constructor but using intents as suggested. Because SampleClass is not a validly registered Activity that went through an adequate lifecycle, it is clear why the callback method of your MainActivity is triggered instead. If you want the callback of SampleClass to be triggered, you have to create it using an intent!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26280117
score: 1

http://stackoverflow.com/comment/41140315
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26229156
has text: would it be a problem if you start count of i from 2 rather than having a separate if condition above the loop?
type: AnswerComment

http://stackoverflow.com/comment/41297834
type: QuestionComment
has text: This is different from what I have downloaded. I found some listeners but I cannot find any listener for S-Pen's button.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26304114

http://stackoverflow.com/comment/41372546
score: 0
has text: i have used the required sqlite driver here is the link of it https://bitbucket.org/xerial/sqlite-jdbc, may be its support different version of the driver i have downloaded latest
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26324849

http://stackoverflow.com/q/26264763
upvote count: 2
has answer: http://stackoverflow.com/a/26265204
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/26265204
favorite count: 0
tagged with: spring
has title: How do you load or even autowire a .json file from the classpath using annotations in java?
type: AnsweredQuestion
has body: How do you load or even autowire a .json file from the classpath using spring annotations in java? //Something like this in my controller in STS: @value("file:/resources/json/myJsonfile.json") Resource jsonTemplateFile;
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: classpath
type: Question
tagged with: resources
has comment: http://stackoverflow.com/comment/41206534

http://stackoverflow.com/a/26325466
downvote count: 0
has body: ControlsFX dialogs will be integrated in JavaFX 8u40 but with heavily changed API. Old dialogs API is deprecated as of 8.20.7 but it is not yet removed. New dialogs API which will be part of the JavaFX 8u40 is currently in openjfx-dialogs.jar and can be downloaded from its own repository or will be downloaded automatically as dependency from maven repository. This is partially cause of the incompatibilities in the newest ControlsFX version. More information about this can be found at ControlsFX forum in this post. Unfortunately, in addition, some classes changed API (like Action) and if you are using them, your code must be ported to new API when upgrading from 8.0.6_20 to 8.20.7 version. CommandLink class specifically, as I can see, changed name to CommandLinksDialog.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26324898
upvote count: 1

http://stackoverflow.com/q/26219266
has answer: http://stackoverflow.com/a/26220865
has title: What Java "cross-platform" really mean?
has comment: http://stackoverflow.com/comment/41120008
has comment: http://stackoverflow.com/comment/41119965
has comment: http://stackoverflow.com/comment/41120161
favorite count: 0
has body: Im confused what "cross-platform" really means. We can develop a Java application that can run on windows and on Linux or Mac too. But can we develop an app that will run on Android smartphone and on Windows PC too if both of them can have Java Virtual Machine installed?
has comment: http://stackoverflow.com/comment/41120382
tagged with: linux
accepted answer: http://stackoverflow.com/a/26220865
tagged with: android
tagged with: windows
has comment: http://stackoverflow.com/comment/41120063
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41120093
score: -3
has comment: http://stackoverflow.com/comment/41120142
has comment: http://stackoverflow.com/comment/41120262
upvote count: 1
has comment: http://stackoverflow.com/comment/41120178
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41120345
tagged with: cross-platform
has comment: http://stackoverflow.com/comment/41120034
has comment: http://stackoverflow.com/comment/41120445
downvote count: 4
has comment: http://stackoverflow.com/comment/41120416
answer count: 1

http://stackoverflow.com/q/26246568
favorite count: 0
has comment: http://stackoverflow.com/comment/41171566
has body: I had (apparenty an incorrect?) impression that Java substring(srcArray, startIndex, endIndex) method did not allocate new memory but instead re-used the existing underlying char[] array. This approach would seem to be possible due to the immutability of String's. However when actually looking at the JDK source we find the following: public String substring(int beginIndex, int endIndex) { return ((beginIndex == 0) &amp;&amp; (endIndex == value.length)) ? this : new String(value, beginIndex, subLen); } public String(char value[], int offset, int count) { this.value = Arrays.copyOfRange(value, offset, offset+count); } Notice the copyOfRange() which copies/duplicates the content. The motivation for this was working with very large arrays representing the backing store of matrices for linear algebra. There is NO way we are going to accept copying them. I would like however to have a custom representation of portions of the backing array for convenience in programming. It would however only be reasonable if no data copy were to be performed. The tie-in with String is that I looked into how the String handles no-data-copy and found that they (in later java versions apparently..) do actually perform the copy. So, is there actually any way to achieve the zero-copy?
has comment: http://stackoverflow.com/comment/41171899
has answer: http://stackoverflow.com/a/51082136
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26246580
upvote count: 14
has comment: http://stackoverflow.com/comment/41171751
possible better answer: http://stackoverflow.com/a/51082136
score: 13
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41171794
tagged with: java
has comment: http://stackoverflow.com/comment/41172027
accepted answer: http://stackoverflow.com/a/26246580
has answer: http://stackoverflow.com/a/26247335
answer count: 3
has title: Is it possible to create a new String from a subset of another String without any data copy?
tagged with: string

http://stackoverflow.com/q/26346781
answer count: 3
accepted answer: http://stackoverflow.com/a/26347746
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26347198
has answer: http://stackoverflow.com/a/26347198
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26478560
tagged with: java
has answer: http://stackoverflow.com/a/26347746
type: Question
tagged with: nashorn
has title: Java 8 Nashorn - capturing engine.eval("print('hello world')) into String object?
score: 4
has body: Is there a way to capture the result of print('hello world') inside Nashorn and place it in a String object. I have tried this: ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos, true); System.setOut(ps); String result = (String)engine.eval("print('hello world')"); if (result != null) { System.out.println(result); } else { System.out.println(baos.toString()); } When engine evaluates this javascript it just prints to stdout so I figured I just redirect stdout to my own OutputStream and then convert it to String, but it doesn't work. Any thoughts?
upvote count: 4

http://stackoverflow.com/q/26352310
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26354595
type: Question
accepted answer: http://stackoverflow.com/a/26354595
answer count: 1
tagged with: jsp
tagged with: rest
type: AnsweredQuestion
tagged with: netbeans
has title: Java Netbeans Restfull service gives me "infinite JSON"
has body: I have just started using Restfull web services that Netbeans provide. I have created two Entities. First is Player and second is VehicleDetail. The both have ManyToMany relationships: Player: @ManyToMany(mappedBy = "players", fetch = FetchType.LAZY) private List&lt;VehicleDetail&gt; vehicleDetails; VehicleDetail @ManyToMany(fetch = FetchType.LAZY) private List&lt;Player&gt; players; I have created JSP pages where you can create new Players and VehicleDetails. I have added Restfull web services for my entities. They will provide me information about entities as JSONs. When I add new Players and VehicleDetails through my JSP pages then I test Restfull service by GET HTTP method, it shows me right JSON. Then I have added VehicleDetail to my Players list and Player to VehicleDetails list and updated both of them: Player player = db.getPlayer(playerId); VehicleDetail detail = db.getVehicleDetail(detailId); player.getVehicleDetails().add(detail); detail.getPlayers().add(player); db.updateObject(player); db.updateObject(detail); Code for db.updateObject(Object o) is: @Override public void updateObject(Object o) { em.merge(o); em.flush(); } Now, when I try to see my Player. I create HTTP GET method to see Player as JSON. It shows me "INFINITE" JSON. It shows me that it got VehicleDetail that got this Player that got this VehicleDetail that got this Player and so on. And it gives me exception; java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonMappingException$Reference Question: What I need to do? FETCHTYPE.LAZY does not work.
score: 0

http://stackoverflow.com/a/26332017
downvote count: 1
answers question: http://stackoverflow.com/q/26331232
has body: Id be using the JavascriptExecutor. JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("&lt;JavaScript.click;");
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/a/26337019
accepted answer of: http://stackoverflow.com/q/26336963
has comment: http://stackoverflow.com/comment/41337352
upvote count: 3
answers question: http://stackoverflow.com/q/26336963
type: AcceptedAnswer
type: Answer
has body: db.connect returns a new Connection object, you should store that in a variable, and call executeQuery on it. This, what you posted, should not even compile. And you also should not call a static method as an object method. Make it non-static, or call it statically.
score: 3
has comment: http://stackoverflow.com/comment/41337159
downvote count: 0

http://stackoverflow.com/a/26351174
type: Answer
has body: This should do it for you. Pagefragment pageFragment = PageFragment.newInstance(value1, value2);
answers question: http://stackoverflow.com/q/26350779
score: 0

http://stackoverflow.com/comment/97632561
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26245463
has text: This works fine adding multiple viewTypes but the problem is with the binding data. How can i fix the random changing data?? I've got 3 viewTypes already defined.
score: 0

http://stackoverflow.com/q/26253157
has comment: http://stackoverflow.com/comment/41184028
type: UnansweredQuestion
has title: Malicious code vulnerability - Field should be package protected. How to fix this sonar issue?
tagged with: logging
score: 2
upvote count: 2
tagged with: java
type: Question
tagged with: sonarqube
has comment: http://stackoverflow.com/comment/41182957
has body: In my class I have logger like private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(Myclass.class); While running sonar qube I am getting error like: Malicious code vulnerability - Field should be package protected- A mutable static field could be changed by malicious code or by accident. The field could be made package protected to avoid this vulnerability. How to fix this?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26295958
favorite count: 0

http://stackoverflow.com/q/26267378
score: 0
linked to: http://stackoverflow.com/q/10913201
has body: I'm doing bar chart with JFreeChart, and my category is completely overlapped. I've seen already JFreechart: Displaying X axis with values after specific units, but I can't do this with mine somehow. I have DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int l = 1; l&lt;256; l++) { dataset.setValue(CountRed[l],"Red",Integer.toString(l)); dataset.setValue(CountBlue[l], "Blue", Integer.toString(l)); dataset.setValue(CountGreen[l], "Green", Integer.toString(l)); } JFreeChart chart = ChartFactory.createStackedBarChart("RGB", "pixels", "Num", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p=chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLACK); CategoryAxis xAxis = p.getDomainAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); xAxis.setTickLabelFont(new Font("Times New Roman", Font.PLAIN, 7)); ImgDiag1 = chart.createBufferedImage(700,250); diag1 = new ImageIcon(ImgDiag1); jLabel4.setIcon(diag1); where CountRed, CountBlue and CountGreen are arrays of int. So there are numbers 0-255, and I'd like to show for example every 30 of them in category. Hope you can help me. https://i.sstatic.net/wB7Xf.jpg Update: With a stacked bar chart it looks like this:
has comment: http://stackoverflow.com/comment/41265276
tagged with: bar-chart
linked to: http://stackoverflow.com/q/10753961
has title: jfreechart category label overlapped
has comment: http://stackoverflow.com/comment/41269955
has comment: http://stackoverflow.com/comment/41265514
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41213128
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/41268598
type: Question
has comment: http://stackoverflow.com/comment/41222476
has comment: http://stackoverflow.com/comment/41224369

http://stackoverflow.com/a/36195423
score: 1
has body: Best answer by Dennis' Tech Crib Sheets: Just add the --interactive=false property to the asadmin command.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26289412
downvote count: 0

http://stackoverflow.com/a/26257672
score: 0
type: Answer
has body: Try this code and compare the execution time with your fisher yates method. This is probably the "next" method which is slow function fisherYates(array) { for (var i = array.length - 1; i &gt; 0; i--) { var index = Math.floor(Math.random() * i); //swap var tmp = array[index]; array[index] = array[i]; array[i] = tmp; }
answers question: http://stackoverflow.com/q/26257237

http://stackoverflow.com/q/26336875
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26338938
has answer: http://stackoverflow.com/a/26336954
has body: I have timestamp value in a column of my table.I need to keep all the data of the last week and delete rest data in the table(which is not belong to last 7 days).How can I do it? The query that I tried is given below. DELETE * FROM EmailMainTable WHERE DATE_FORMAT(timestamp, '%Y-%m-%d %H:%i:%s') &gt; DATE_SUB(DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s'), INTERVAL 8 DAY); NOTE: My Filed Name is timestamp and i converted it to bigint My table's structure:
upvote count: 3
has title: MySQL delete data from a table
possible better answer: http://stackoverflow.com/a/26338938
tagged with: timestamp
tagged with: bigint
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/26336954

http://stackoverflow.com/q/26300755
tagged with: jakarta-mail
has body: I am using Javamail api and gmail smtp server to send mail in java without giving password. I have using the below code. here i am using javax.mail jar file Properties props= new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", 587); props.put("mail.transport.protocal", "smtps"); //Put below to false, if no https is needed props.put("mail.smtp.STARTTLS.enable", "false"); props.put("mail.smtp.auth", "false"); Session session = Session.getInstance(props); I am getting the below error Must issue a STARTTLS command first. b4sm3005855pdh.2 - gsmtp Is there any wrong in implementing the code? is it posssible to implement without password ? pls any one help me on this
tagged with: email
has comment: http://stackoverflow.com/comment/41291249
possible better answer: http://stackoverflow.com/a/26300848
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26312130
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26312130
has answer: http://stackoverflow.com/a/26300848
has comment: http://stackoverflow.com/comment/41270454
has title: Send Email Without authentication in java using gmail smtp server and javamail
score: 0

http://stackoverflow.com/comment/42638543
score: 0
type: AnswerComment
type: Comment
has text: @Joehot200 Oh, right, you're using java. `M_PI` is a C/C++ macro definition of π. Will update.
comment on: http://stackoverflow.com/a/27056412

http://stackoverflow.com/a/26220810
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26220344
has body: Does the following work? It skips the number of occurrences. for(int m = 0; m &lt; Bag.length; m++){ int occurrence = 0; for(int n = 0 ; n &lt; Bag.length ; n++){ if(Bag[m] == Bag[n]){ occurrence++; } } if(occurrence &gt; 1){ System.out.println(Bag[m] + " occurs " + occurrence + " times"); m+=occurrence-1; } else{ System.out.println(Bag[m] + " occurs " + occurrence + " time"); }
downvote count: 0

http://stackoverflow.com/comment/41182349
score: 0
has text: Trust me I known Spring (having written 2 books about it). The default config for the `MBeanExporter` exposes attributes, however your bean doesn't have any attributes only static methods. Your methods should be non static to be exposed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26252554

http://stackoverflow.com/comment/41341805
comment on: http://stackoverflow.com/q/26339601
type: Comment
type: QuestionComment
has text: OK, so what do you actually want to happen? Do you want the player to continue in the same direction when another key is pressed?
score: 2

http://stackoverflow.com/q/26344811
answer count: 1
downvote count: 0
favorite count: 0
has body: I got class A which, after button is clicked: if (source == buttonA){ new classB(this); } moreover, class A has function named function(int a); In class B I've got public class classB extends JFrame implements ChangeListener { public classB(A a) { public void stateChanged(ChangeEvent e){ JSlider source = (JSlider)e.getSource(); tmp = source.getValue(); a.function(tmp); } } } But a cannot be resolved. How can I achieve that in other way?
tagged with: listener
has title: Call function in stateChanged()
has answer: http://stackoverflow.com/a/26344879
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26344879

http://stackoverflow.com/q/26244312
upvote count: 1
has comment: http://stackoverflow.com/comment/41167572
downvote count: 1
has comment: http://stackoverflow.com/comment/41167945
has title: How to call the constructor of an activity's parent class
has comment: http://stackoverflow.com/comment/41167966
has answer: http://stackoverflow.com/a/26245369
tagged with: java
has body: This question is an off-shoot of a difficult problem that I am working on. One of the suggestion is to call the constructor of the parent activity. Does anyone know how I might do that? I mean, I have an activity called DogActivity and then I have ParentActivity such that DogActivity extends ParentActivity. Normally I use onCreate to communicate with parent activities as in super.onCreate(savedInstanceState) for instance. So I am at a loss of how I would call the constructor of a parent activity. Especially where I need to pass data through the constructor. How do I know android would call the same instance of the parent when it needs to deal with callbacks and lifecycle methods? Please see the original question for reference if you need to.
type: Question
has comment: http://stackoverflow.com/comment/41167902
answer count: 1
linked to: http://stackoverflow.com/q/3302177
score: 0
has comment: http://stackoverflow.com/comment/41168081
tagged with: android
linked to: http://stackoverflow.com/q/26243010
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/41167846
type: UnansweredQuestion

http://stackoverflow.com/q/26285520
has answer: http://stackoverflow.com/a/26285651
type: Question
has comment: http://stackoverflow.com/comment/73641380
possible better answer: http://stackoverflow.com/a/26285731
tagged with: enums
has title: Implementing Singleton with an Enum (in Java)
score: 231
has answer: http://stackoverflow.com/a/50951454
answer count: 6
downvote count: 1
has comment: http://stackoverflow.com/comment/41242744
favorite count: 0
has body: I have read that it is possible to implement Singleton in Java using an Enum such as: public enum MySingleton { INSTANCE; } But, how does the above work? Specifically, an Object has to be instantiated. Here, how is MySingleton being instantiated? Who is doing new MySingleton()?
has answer: http://stackoverflow.com/a/26292956
has comment: http://stackoverflow.com/comment/88285263
tagged with: singleton
has answer: http://stackoverflow.com/a/26285669
tagged with: design-patterns
upvote count: 232
has comment: http://stackoverflow.com/comment/41242869
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26285731
tagged with: java
has answer: http://stackoverflow.com/a/26285591
accepted answer: http://stackoverflow.com/a/26285591

http://stackoverflow.com/a/59611072
downvote count: 0
has body: public static String numberOfOccurence(String data) { String result = ""; while (!data.isEmpty()) { result += String.valueOf(data.charAt(0))+ StringUtils.countOccurrencesOf(data, String.valueOf(data.charAt(0))); data = data.replaceAll(String.valueOf(data.charAt(0)), ""); } return result; } input: aabacbd output: a3b2c1d1
type: Answer
answers question: http://stackoverflow.com/q/26199635
upvote count: 1
score: 1

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/26216059
tags question: http://stackoverflow.com/q/26310823
tags question: http://stackoverflow.com/q/26262806
type: Tag
tags question: http://stackoverflow.com/q/26347217
tags question: http://stackoverflow.com/q/26315407

http://stackoverflow.com/q/26240736
has comment: http://stackoverflow.com/comment/41160502
type: AnsweredQuestion
has title: Implementing Database Listener
has comment: http://stackoverflow.com/comment/41160864
tagged with: java
tagged with: database
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41160284
accepted answer: http://stackoverflow.com/a/26247963
answer count: 1
tagged with: postgresql
has body: I'm developing a Java desktop application with Swing as GUI. The app contains services that query from database every seconds to make the interface synced from database. We all know that with this approach, performance is the enemy. What I want to achieve is that every changes made from database, altered thru psql (Postgres command-line) for example, my app should be notified to update the UI. In this way, performance may be optimized. Thanks!
tagged with: listener
has comment: http://stackoverflow.com/comment/41160255
has answer: http://stackoverflow.com/a/26247963
tagged with: swing

http://stackoverflow.com/comment/41175286
comment on: http://stackoverflow.com/q/26241483
type: QuestionComment
has text: Hi Roberts,<?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> <AppenderRef ref="Console" /> <AppenderRef ref="CONSOLE"/> <AppenderRef ref="CONSOLE"/> <AppenderRef ref="CONSOLE"/> <AppenderRef ref="CONSOLE"/>
score: 0
type: Comment

http://stackoverflow.com/a/26232272
type: Answer
upvote count: 1
has body: Its because you are catching the exception and going for next loop. Exception is Super Class to IOException. Go through below documentation. http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html Your exception catching logic needs to be refactored.
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/26232156

http://stackoverflow.com/comment/41317168
score: 0
comment on: http://stackoverflow.com/a/26319685
type: AnswerComment
type: Comment
has text: Vince, thanks for the nice answer. A minor follow-up questions: Is this a definitive answer in the sense that the above is required by the java specification / public interface / documentation, or is this "just" the way it happens to be done in the current version of swing -- one reasonable implementation -- but could change in a new release?

http://stackoverflow.com/comment/41089821
has text: Can you post your complete code so that we can debug your code. You can remove the picture to make your post smaller
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26202702
type: QuestionComment

http://stackoverflow.com/q/26240286
has answer: http://stackoverflow.com/a/36850732
score: 8
downvote count: 0
has answer: http://stackoverflow.com/a/26241104
accepted answer: http://stackoverflow.com/a/26241104
type: AnsweredQuestion
tagged with: realm
tagged with: java
possible better answer: http://stackoverflow.com/a/36850732
upvote count: 8
type: Question
has title: Use pre-populated databases with Realm
answer count: 2
has body: How could we convert SQLite database to a Realm database? Is there any way to use pre-populated databases with Realm on Android?
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/41193745
type: QuestionComment
has text: Maybe, leak is in JVM perm gen, which isn't counted as part of heap. What about perm gen size as reported by JVM?
comment on: http://stackoverflow.com/q/26259099
score: 0
type: Comment

http://stackoverflow.com/a/26329914
has comment: http://stackoverflow.com/comment/41324016
has body: You can do it like this: public class Team { private String name, sport; private int numOfWins, numOfLosses; public Team(String name, String Sport) { this.name = name; this.sport = Sport; numOfWins = 0; numOfLosses = 0; } public int addAnotherWin() { return numOfWins++; } public int addAnotherLoss() { return numOfLosses++; } public int getNumWins() { return numOfWins; } public int getNumLosses() { return numOfLosses; } public void resetWinsAndLosses() { numOfWins = numOfWins * 0; numOfLosses = numOfLosses * 0; } public Double getPercentOfGamesWon() { double z = numOfWins / (numOfWins + numOfLosses); return new Double(z); } @Override public boolean equals(Object o) { if ( o instanceof Team) { Team other = (Team)o; return this.getPercentOfGamesWon().equals(other.getPercentOfGamesWon()); } return false; } public static void main(String[] args) { Team teamOne = new Team("Falcons", "Football"); teamOne.addAnotherWin(); teamOne.addAnotherWin(); Team teamTwo = new Team("Broncos", "Football"); teamTwo.addAnotherWin(); teamTwo.addAnotherWin(); if( teamOne.equals(teamTwo) ) { System.out.println("Two wins, they are equal"); } teamOne.addAnotherLoss(); if ( ! teamOne.equals(teamTwo) ) { System.out.println("Two wins, but one loss, they are not equal"); } } } I added a main so you you could see it in action. Another, possibly more useful solution might be to implement Comparable, which would let you see if a team is less than, equal to, or greater than another team.
answers question: http://stackoverflow.com/q/26329647
score: 0
has comment: http://stackoverflow.com/comment/41323911
type: Answer

http://stackoverflow.com/a/26274238
has comment: http://stackoverflow.com/comment/41228733
score: 0
has body: I have solved this problem with below pattern, (?i)([^#]*?us[^#]*)(?=#) Thank you so much Anubhava, VKS and Thomas for you reply. Regards, Ashish Mishra
type: Answer
answers question: http://stackoverflow.com/q/26272652

http://stackoverflow.com/comment/41354548
comment on: http://stackoverflow.com/a/26345210
score: 0
type: AnswerComment
has text: So, apparently this isn't working as well as I thought... it still gives me an error if I try to run `./gradlew clean build` - that is, even if `uploadArchives` isn't being run, it checks for the properties.
type: Comment

http://stackoverflow.com/comment/41366821
comment on: http://stackoverflow.com/q/26353571
score: 0
type: QuestionComment
type: Comment
has text: List is already prepared and i need to get the duplicate objects as well. If two objects is having same identifier, the first one is accepted and the second one is the rejected one.

http://stackoverflow.com/comment/41332415
comment on: http://stackoverflow.com/q/26334421
has text: The exception gets thrown at the first iteration or after some iterations? It could also be a problem in the `// Some logic` part.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26263041
has comment: http://stackoverflow.com/comment/41201201
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41201333
type: Answer
has comment: http://stackoverflow.com/comment/41201460
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41201279
accepted answer of: http://stackoverflow.com/q/26262857
has body: Best working solution is to do the following in your GradeResult class private static String name, name2, name3; private static int a, mark; This will work..! The output: Please Input Your Name :Mohammad Please Input Your ID Number :10001 Please Input Your Mark :85 Your Name :Mohammad Your ID Number :10001 Your Mark :85 Your Grade Is A You Are PASS
has comment: http://stackoverflow.com/comment/41201169
has comment: http://stackoverflow.com/comment/41201043
answers question: http://stackoverflow.com/q/26262857
upvote count: 2

http://stackoverflow.com/comment/41311537
type: Comment
has text: BufferedImage would give you access to the image data directly. A pong image also has the capacity to support alpha based colors, perhaps you should edit the image to remove the background color yourself
type: QuestionComment
comment on: http://stackoverflow.com/q/26322863
score: 0

http://stackoverflow.com/a/26201022
has comment: http://stackoverflow.com/comment/41086109
has body: indexOf returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null In your case the index of element "1" is 1, thats why you will get 1. BUT if you will pass int maxLabel = 1; notice that maxLabel is declared as type int then you will get -1 because Collection of strings doesn't contains an object of type Integer. Basically indexOf method take as parameter o of type Object. Whenever you pass a different Object type (e.g. you declared your List of type String and you are checking for different types like Integer,Double,int,long, etc.), you can expect to get -1
accepted answer of: http://stackoverflow.com/q/26200987
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26200987
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/41109252
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26212323
has text: @Zibadian No, I know this is a possible case. but that's not what I want. When I specify the port to one jvm, it gets locked to that jvm, whereas when I try to get jolokia started for another JVM it gives bind Exception. That is why I want to keep the port dynamic.

swing
tags question: http://stackoverflow.com/q/26281504
tags question: http://stackoverflow.com/q/26311771
tags question: http://stackoverflow.com/q/26300395
tags question: http://stackoverflow.com/q/26252551
tags question: http://stackoverflow.com/q/26205628
tags question: http://stackoverflow.com/q/26200851
tags question: http://stackoverflow.com/q/26323931
tags question: http://stackoverflow.com/q/26256848
tags question: http://stackoverflow.com/q/26321454
tags question: http://stackoverflow.com/q/26215086
tags question: http://stackoverflow.com/q/26333093
tags question: http://stackoverflow.com/q/26351203
tags question: http://stackoverflow.com/q/26226910
tags question: http://stackoverflow.com/q/26241615
tags question: http://stackoverflow.com/q/26332072
tags question: http://stackoverflow.com/q/26214949
tags question: http://stackoverflow.com/q/26343209
tags question: http://stackoverflow.com/q/26337125
tags question: http://stackoverflow.com/q/26201125
tags question: http://stackoverflow.com/q/26226986
tags question: http://stackoverflow.com/q/26316675
tags question: http://stackoverflow.com/q/26322286
tags question: http://stackoverflow.com/q/26208179
tags question: http://stackoverflow.com/q/26283199
tags question: http://stackoverflow.com/q/26194648
tags question: http://stackoverflow.com/q/26269922
tags question: http://stackoverflow.com/q/26208502
tags question: http://stackoverflow.com/q/26315398
tags question: http://stackoverflow.com/q/26321367
tags question: http://stackoverflow.com/q/26246308
tags question: http://stackoverflow.com/q/26336204
tags question: http://stackoverflow.com/q/26276918
tags question: http://stackoverflow.com/q/26226136
tags question: http://stackoverflow.com/q/26227679
tags question: http://stackoverflow.com/q/26327930
tags question: http://stackoverflow.com/q/26228270
tags question: http://stackoverflow.com/q/26328070
tags question: http://stackoverflow.com/q/26250939
tags question: http://stackoverflow.com/q/26337801
tags question: http://stackoverflow.com/q/26216039
tags question: http://stackoverflow.com/q/26336894
tags question: http://stackoverflow.com/q/26278733
tags question: http://stackoverflow.com/q/26303006
tags question: http://stackoverflow.com/q/26199634
tags question: http://stackoverflow.com/q/26278975
tags question: http://stackoverflow.com/q/26211088
tags question: http://stackoverflow.com/q/26215295
tags question: http://stackoverflow.com/q/26247499
tags question: http://stackoverflow.com/q/26270382
tags question: http://stackoverflow.com/q/26330550
tags question: http://stackoverflow.com/q/26238982
tags question: http://stackoverflow.com/q/26268559
tags question: http://stackoverflow.com/q/26344172
tags question: http://stackoverflow.com/q/26317014
tags question: http://stackoverflow.com/q/26197510
tags question: http://stackoverflow.com/q/26227804
tags question: http://stackoverflow.com/q/26338425
tags question: http://stackoverflow.com/q/26238561
tags question: http://stackoverflow.com/q/26346466
tags question: http://stackoverflow.com/q/26340990
tags question: http://stackoverflow.com/q/26305222
tags question: http://stackoverflow.com/q/26208472
tags question: http://stackoverflow.com/q/26207479
tags question: http://stackoverflow.com/q/26326806
tags question: http://stackoverflow.com/q/26243091
tags question: http://stackoverflow.com/q/26306042
tags question: http://stackoverflow.com/q/26265002
type: Tag
tags question: http://stackoverflow.com/q/26220372
tags question: http://stackoverflow.com/q/26278453
tags question: http://stackoverflow.com/q/26255336
tags question: http://stackoverflow.com/q/26199534
tags question: http://stackoverflow.com/q/26249089
tags question: http://stackoverflow.com/q/26350595
tags question: http://stackoverflow.com/q/26227393
tags question: http://stackoverflow.com/q/26340442
tags question: http://stackoverflow.com/q/26290581
tags question: http://stackoverflow.com/q/26321821
tags question: http://stackoverflow.com/q/26322503
tags question: http://stackoverflow.com/q/26218630

http://stackoverflow.com/comment/41338728
has text: Well, it fits right there where you have to understand how many unsorted elements you have. You have either O(1) or O(logN) such elements.
comment on: http://stackoverflow.com/q/26337906
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26204720
has comment: http://stackoverflow.com/comment/41092606
downvote count: 0
score: 1
upvote count: 1
has body: The error is here: &lt;target name="compile" depends="retrieve" Either declare target with the name 'retrieve' or remove the dependency.
answers question: http://stackoverflow.com/q/26204538
type: Answer

http://stackoverflow.com/comment/41332675
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26334249
has text: Yes this would also achieve the same.

http://stackoverflow.com/a/26350305
has body: You'll need to update your classpath to point to the mysql jar file. The JVM can't find a suitable mysql driver.
score: 0
upvote count: 1
answers question: http://stackoverflow.com/q/26350269
downvote count: 1
has comment: http://stackoverflow.com/comment/41361034
type: Answer
has comment: http://stackoverflow.com/comment/41361018

http://stackoverflow.com/comment/41089196
score: 0
type: Comment
type: QuestionComment
has text: it also does not make sense to compare passed node in entire list for check of genuine node, when user uses one of these 5 methods. Because this is a costly operation
comment on: http://stackoverflow.com/q/26202756

http://stackoverflow.com/comment/41366764
type: Comment
type: QuestionComment
has text: Since (at least Java 1.4), the `Graphics` context has been guaranteed to be an instance of `Graphics2D`
comment on: http://stackoverflow.com/q/26353521
score: 0

http://stackoverflow.com/q/26200476
has body: I want to delete null values from a table of sql. in normal way we have such this syntax: String query = "delete from users where arg1 = ?"; PreparedStatement preparedStmt = conn.prepareStatement(query); preparedStmt.setInt(1, 3); What is syntax when our query is like this: DELETE FROM users WHERE arg1 IS NULL AND Rel IS NULL AND Arg2 IS NULL; I tried above mentioned syntax with null values but it didn't work. thanks.
upvote count: 1
tagged with: sql
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26200500
accepted answer: http://stackoverflow.com/a/26200500
tagged with: jdbc
has title: syntax for deleting null values in sqlyog
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
type: Question

http://stackoverflow.com/comment/59255474
has text: @Nico Why would you avoid a generic solution that was [contributed by 100 people since April 2012](https://github.com/caskroom/homebrew-cask/graphs/contributors) & tested by 10s of thousands? it has 2,315 Closed vs 64 Opened issues... just look at the repo, numbers speak for themselves, it's a pretty damn good tool
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/29195815
score: 0

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/26209693
tags question: http://stackoverflow.com/q/26343631
tags question: http://stackoverflow.com/q/26344415
tags question: http://stackoverflow.com/q/26335506
tags question: http://stackoverflow.com/q/26256546
tags question: http://stackoverflow.com/q/26210096
tags question: http://stackoverflow.com/q/26295553
type: Tag
tags question: http://stackoverflow.com/q/26238771
tags question: http://stackoverflow.com/q/26324078

http://stackoverflow.com/comment/41303888
type: QuestionComment
comment on: http://stackoverflow.com/q/26319130
has text: @Boann And what that implies is that some collection implementations will NOT be using `AbstractCollection` because they will provide their own implementation of all the methods defined in the `Collection` interface. For example, Guava's `ForwardingList`
score: 2
type: Comment

jackson
tags question: http://stackoverflow.com/q/26353016
tags question: http://stackoverflow.com/q/26350995
tags question: http://stackoverflow.com/q/26234018
tags question: http://stackoverflow.com/q/26344756
tags question: http://stackoverflow.com/q/26250755
tags question: http://stackoverflow.com/q/26241056
tags question: http://stackoverflow.com/q/26342060
tags question: http://stackoverflow.com/q/26289189
tags question: http://stackoverflow.com/q/26327576
tags question: http://stackoverflow.com/q/26217654
type: Tag
tags question: http://stackoverflow.com/q/26223261
tags question: http://stackoverflow.com/q/26251486
tags question: http://stackoverflow.com/q/26308157
tags question: http://stackoverflow.com/q/26303405
tags question: http://stackoverflow.com/q/26313687
tags question: http://stackoverflow.com/q/26309641
tags question: http://stackoverflow.com/q/26352325
tags question: http://stackoverflow.com/q/26314283
tags question: http://stackoverflow.com/q/26213957
tag name: jackson
tags question: http://stackoverflow.com/q/26201183
tags question: http://stackoverflow.com/q/26302613
tags question: http://stackoverflow.com/q/26280235
tags question: http://stackoverflow.com/q/26271383
tags question: http://stackoverflow.com/q/26318368
tags question: http://stackoverflow.com/q/26301062
tags question: http://stackoverflow.com/q/26205512
tags question: http://stackoverflow.com/q/26286227
tags question: http://stackoverflow.com/q/26312521

http://stackoverflow.com/q/26200987
tagged with: list
has comment: http://stackoverflow.com/comment/41086010
has comment: http://stackoverflow.com/comment/41086030
has comment: http://stackoverflow.com/comment/41086100
downvote count: 2
has comment: http://stackoverflow.com/comment/41085997
has answer: http://stackoverflow.com/a/26201022
upvote count: 1
has title: Why indexOf doesn't work as expected?
type: Question
has comment: http://stackoverflow.com/comment/41086019
tagged with: java
has body: I have labels which is a list of String and is equal to [0,1]. However the following line returns -1 while I expect it to return 1. Any idea what could be wrong or missing? definition: maxLabel is an integer initially set to -1. public List labels; where the unexpected result happens, while maxLabel is equal to 1: int maxLabelIndex=labels.indexOf(maxLabel);
score: -1
accepted answer: http://stackoverflow.com/a/26201022
has comment: http://stackoverflow.com/comment/41086020
answer count: 1
has comment: http://stackoverflow.com/comment/41086086
has comment: http://stackoverflow.com/comment/41086075
favorite count: 0
has comment: http://stackoverflow.com/comment/41085995
has comment: http://stackoverflow.com/comment/41085993
type: AnsweredQuestion

http://stackoverflow.com/a/26297166
has body: After inserting first node i.e root, left and right node will be null. Next time while inserting left or right child node you are not checking that condition. private Node insert(Comparable&lt;Node&gt; node,Node root1) { if(root1==null) {//insert as first element ie root this.root=new Node(((Node)node).getData(),null,null); } else if(node.compareTo(root1) &lt;0) { if(root1.getLeftChild()==null) root1.setLeftChild(node); else root1.setLeftChild(insert(node,root1.getLeftChild())); } else if(node.compareTo(root1) &gt;0) { if(root1.getRightChild()==null) root1.setRightChild(node); else root1.setRightChild(insert(node,root1.getRightChild())); } return root1; }
has comment: http://stackoverflow.com/comment/41263896
has comment: http://stackoverflow.com/comment/41263533
downvote count: 0
has comment: http://stackoverflow.com/comment/41265666
answers question: http://stackoverflow.com/q/26297045
type: Answer
upvote count: 1
score: 1

encoding
tags question: http://stackoverflow.com/q/26220254
type: Tag
tags question: http://stackoverflow.com/q/26351052
tag name: encoding
tags question: http://stackoverflow.com/q/26337960
tags question: http://stackoverflow.com/q/26324708
tags question: http://stackoverflow.com/q/26290513

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/26208726

http://stackoverflow.com/q/26292631
downvote count: 0
favorite count: 0
tagged with: arraylist
answer count: 5
has comment: http://stackoverflow.com/comment/41255370
has comment: http://stackoverflow.com/comment/41255386
has answer: http://stackoverflow.com/a/26292676
has body: Example is I want to search code A25 and A29 then it will print it? I cant seems find the syntax for searching long words in arraylist. ArrayList&lt;String&gt; arrList = new ArrayList&lt;String&gt;(); arrList.add("A25 CS 212 Data Structures 3"); arrList.add("A26 IT 312 Data Base Management System 2 3"); arrList.add("A27 IT 312 Data Base Management System 2 3"); arrList.add("A28 IT 212 Data Base Management System 2 3"); arrList.add("A29 CS 313 Digital Design 3"); arrList.add("A30 IT 212 Discrete Structures 3"); arrList.add("A25 IT 212 Discrete Structures 3"); arrList.add("984 Engl 3 Speech and oral Communication 3"); arrList.add("582 Theo 3 Christ and Sacraments 3"); arrList.add("470 Stata1 Probablility and Statistics 3"); arrList.add("999 Dota 2 Dota Guide 3"); System.out.println("Enter code to search"); int code = scan.next(); //Desired output Enter code to search: A29 A30 A29 CS 313 Digital Design 3 A30 IT 212 Discrete Structures 3 //
has comment: http://stackoverflow.com/comment/41255529
upvote count: 2
has answer: http://stackoverflow.com/a/26292787
type: UnansweredQuestion
has title: How to search an element in arraylist?
has answer: http://stackoverflow.com/a/26292806
has answer: http://stackoverflow.com/a/26292683
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/26292657
has comment: http://stackoverflow.com/comment/41255422
tagged with: search
type: Question
has comment: http://stackoverflow.com/comment/41255325

http://stackoverflow.com/q/26292262
favorite count: 0
has answer: http://stackoverflow.com/a/26292307
accepted answer: http://stackoverflow.com/a/26292279
has answer: http://stackoverflow.com/a/26292303
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: java
downvote count: 3
upvote count: 1
tagged with: unreachable-code
type: Question
has title: Unreachable Statement with this boolean
score: -2
possible better answer: http://stackoverflow.com/a/26292281
has answer: http://stackoverflow.com/a/26292403
answer count: 6
has answer: http://stackoverflow.com/a/26292279
has body: I'm getting an unreachable statement error with this boolean declaration. I know unreachable usually means meaningless, but I need the isValid statement for my while loop to work. Why am I getting this error and how can I fix it? Here is my code. I'm getting the error on boolean isValid; Thank you in advance, for any input you might have. public static double calculateMonthlyPayment(double loanAmount, double monthlyInterestRate, int months) { double monthlyPayment = loanAmount * monthlyInterestRate/ (1 - 1/Math.pow(1 + monthlyInterestRate, months)); return monthlyPayment; boolean isValid; isValid = false; //while loop to continue when input is invalid while (isValid ==false) { System.out.print("Continue? y/n: "); String entry; entry = sc.next(); if (!entry.equalsIgnoreCase("y") &amp;&amp; !entry.equalsIgnoreCase("n")) { System.out.println("Error! Entry must be 'y' or 'n'. Try again.\n"); } else { isValid = true; } // end if sc.nextLine(); } // end while double entry = 0; return entry; }
has answer: http://stackoverflow.com/a/26292336
has answer: http://stackoverflow.com/a/26292281

http://stackoverflow.com/a/32236006
downvote count: 1
has comment: http://stackoverflow.com/comment/94660969
has comment: http://stackoverflow.com/comment/122423269
upvote count: 10
type: Answer
answers question: http://stackoverflow.com/q/26297491
has comment: http://stackoverflow.com/comment/91549746
has comment: http://stackoverflow.com/comment/75283546
has comment: http://stackoverflow.com/comment/56820722
score: 9
has body: ImageIO is not thread safe (or at least one of it's plugins is not), in at least one of my environments. I am in the process of debugging an issue where png and jpg files don't get loaded correctly (sometimes solid gray, sometimes inverted colors, sometimes random colors, etc) when ImageIO.read() is invoked from multiple threads. I also occasionally get ConcurrentModificationExceptions like: java.util.ConcurrentModificationException at java.util.Vector$Itr.checkForComodification(Vector.java:1184) at java.util.Vector$Itr.next(Vector.java:1137) at sun.java2d.cmm.ProfileDeferralMgr.activateProfiles(ProfileDeferralMgr.java:93) at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:777) at com.sun.imageio.plugins.jpeg.JPEGImageReader.setImageData(JPEGImageReader.java:657) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:609) at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:347) at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:481) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:602) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1059) at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1039) at javax.imageio.ImageIO.read(ImageIO.java:1448) at javax.imageio.ImageIO.read(ImageIO.java:1308) at com.foo.bar.MyTestLoadThread.loadImage(MyTestLoadThread.java:241) ... at java.lang.Thread.run(Thread.java:745) I am not able to replicate this behavior in all environments so it may be JVM specific. But here are the details of the env. where I see it fail: OS : Ubuntu 14.04 java -version : java version "1.8.0_33" Java(TM) SE Runtime Environment (build 1.8.0_33-b05) Java HotSpot(TM) Client VM (build 25.33-b05, mixed mode)

http://stackoverflow.com/comment/41328843
score: 0
has text: Thanks Elliott for the suggestion but what I need is generate a random string of 300 bytes? Is this possible?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26332476

http://stackoverflow.com/comment/41265760
type: Comment
type: QuestionComment
has text: you are right . but how to avoid 2 time .
comment on: http://stackoverflow.com/q/26296195
score: 0

http://stackoverflow.com/comment/41170710
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26245817
has text: Alot of exceptions....
score: 0

http://stackoverflow.com/comment/115380417
score: 0
type: AnswerComment
type: Comment
has text: @vteraz I can't get this to work on the overridden `findById` of JpaRepository using a NamedEntityGraph declared on the Entity. What's the difference to the example above? Declaring a new method `findWithAttributesAll` will respect the NamedEntityGraph.
comment on: http://stackoverflow.com/a/57005745

http://stackoverflow.com/comment/41193125
comment on: http://stackoverflow.com/a/26258711
has text: ow, maybe i don't understand the output expected. What is the right one?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41262462
score: 0
type: AnswerComment
type: Comment
has text: @OrelEraki Yeah sorry my English is not that good :( I meant to honor your above comment, i have stared at the statement like half a minute to see the unbalanced quotes but have overseen the 'table' word there. (Thats also why i upvotet your answer;))
comment on: http://stackoverflow.com/a/26274689

http://stackoverflow.com/comment/41322310
has text: @cal It won't be required by the specification seeing how it's a library and not an actual *language* specification (like for loops, if statements, ect). As for changing in a new release, it's possible, but I doubt any huge changes will be made since JavaFX was intended to replace Swing. Although I have seen minor adjustments, the main structure has stayed the same, and as trashgod mentioned, these are things you shouldn't be worried about; you should be worried about whether the API will change, not the implementation
comment on: http://stackoverflow.com/a/26319685
type: Comment
score: 1
type: AnswerComment

graph
tags question: http://stackoverflow.com/q/26331861
tags question: http://stackoverflow.com/q/26308354
tag name: graph
tags question: http://stackoverflow.com/q/26317665
tags question: http://stackoverflow.com/q/26240478
tags question: http://stackoverflow.com/q/26304174
tags question: http://stackoverflow.com/q/26200013
type: Tag

http://stackoverflow.com/comment/41090390
type: AnswerComment
comment on: http://stackoverflow.com/a/26203442
type: Comment
has text: Yes, it works correctly now. Thank you a lot for responding fast.
score: 0

http://stackoverflow.com/comment/41264838
type: Comment
has text: Thx @Natix, that was! Please, write your comment as Answer and I select it as answer.
type: QuestionComment
comment on: http://stackoverflow.com/q/26297524
score: 0

http://stackoverflow.com/q/26323521
favorite count: 0
has title: Java Interface Declaration
tagged with: netbeans
upvote count: 0
type: UnansweredQuestion
type: Question
tagged with: java
score: -1
has body: Hello I would like to know to start with this assignment I do not need a complete help but this is the first step and there is a lot more to code, my question is how to declare this inside the mothods which are shown below I mean if you could give an example about this that would be great, to start of working on it, how to count the numbers without me knowing the values or when I test them it takes the value that is tested (I use netbeans if that helps) public interface StatisticalOutcomes { public int count(); public double sum(); public double mean(); } • count: The count method returns an integer value which is the number of elements in the set. • sum: The sum method returns a double value which is the sum of the elements in the set. • mean: The mean method returns a double value which is the mean (a.k.a. the average) of the elements in the set. The mean is defined to be the sum divided by the count. Thank you.
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26324096
has comment: http://stackoverflow.com/comment/41311739

http://stackoverflow.com/q/26208370
has answer: http://stackoverflow.com/a/28189259
has title: JSP send data to Java class
tagged with: jsp
tagged with: http://stackoverflow.com/tag/html
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41099591
has comment: http://stackoverflow.com/comment/41099641
score: 0
has body: I'm looking to send information after each link click to my java class to help increment a counter and to change an object which is held in my bean (myGame) which holds an array of 'cases'. I understand that I can increment a counter using JS, but i'd like to keep all game logic within the bean if possible. I have considered using forms and changing the anchor to a submit button, however, I'd like to keep that the player can no longer click the link after it the case is eliminated. The printCase(int) function works by finding the corresponding case in the array, checking the value of a boolean (is the case is eliminated from the game [deal or no deal]) and then prints the amount of money held in the case if eliminated; the case number if it is not. I have about a dozen cases. <jsp:useBean id="myGame" scope="session" class="dealOrNoDeal.GameLogic"/> <%= myGame.printCase(0) %> I've also considered changing my bean to a servlet. Does that work? Can you have a bean in a servlet? Thanks all. Update: I've made printCase now print the tag that it's within now, as well. Prints as a submit button if the case is not opened, prints as a if it is (I need it to use the class). Attempted putting the s in there as well, but it somehow messes up the formatting. I'm now looking to get the name of the one button that was clicked, any ideas?
tagged with: java
type: Question

http://stackoverflow.com/comment/41184970
comment on: http://stackoverflow.com/q/26247222
type: Comment
type: QuestionComment
score: 0
has text: @sln java will do this conversion correctly

http://stackoverflow.com/comment/41171023
type: Comment
comment on: http://stackoverflow.com/a/26246300
type: AnswerComment
has text: Ok, I did that, thank you. But when I generated a number of 33, it said that sickness was false, and in the output, isItSick was set to "No" and 0 died, when it should have been "Yes" and "# died"
score: 0

http://stackoverflow.com/q/26215947
has title: Create an array based on a range of values given by the user
accepted answer: http://stackoverflow.com/a/26216220
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
tagged with: arrays
tagged with: sorting
score: 0
has body: What I'm trying to do is create an array based on values given by the user. The user has to give the length of the array plus the max and min values. I've managed to get the program to the point where it does output the correct amount of values (the correct length), but it just keeps outputting the exact same number (which is the max and min added). Based on research I did I tried converting them to a string so that wouldn't happen, but it still isn't working correctly. I've tried a couple of different methods including: Integer.toString, String.valueOf, and creating a whole new string. Any help would be greatly appreciated. Here's the code so far: public static void main(String[] args) { //Create a Scanner object Scanner input = new Scanner(System.in); //Ask the user to enter the length of the array System.out.println("Please enter the length of the array:"); int arraylength = input.nextInt(); //Ask the user to enter a max value System.out.println("Please enter the max value:"); int max = input.nextInt(); //Ask the user to input the minimum value System.out.println("Please enter the min value:"); int min = input.nextInt(); //Initialize the array based on the user's input double [] userArray = new double[arraylength]; /** *The program comes up with random numbers based on the length *entered by the user. The numbers are limited to being between *the minimum and maximum value. */ for (int i = min; i &lt; userArray.length; i++) { userArray[i] = Math.random() * max; } //This code is supposed to sort the array and print out all of the numbers in order, //with minimum in the beginning and max in the end. for (int i = 0; i &lt; userArray.length; i++) { selectionSort(userArray); Integer.toString(min); Integer.toString(max); System.out.println(min + userArray[i] + max); } //This code uses the method average to find the average average(userArray); //Close Scanner input.close(); } public static double average(double[] data) { double sum = 0; for (int i = 0; i &lt; data.length…
has answer: http://stackoverflow.com/a/26216220
tagged with: input

http://stackoverflow.com/comment/41244741
type: Comment
type: QuestionComment
has text: Look at the second paragraph of the accepted answer: http://stackoverflow.com/questions/9919148/is-it-really-necessary-to-create-sqlite-tables-every-time-when-app-starts
score: 0
comment on: http://stackoverflow.com/q/26286550

http://stackoverflow.com/comment/41320236
score: 0
type: AnswerComment
has text: Yes, it looks like the singleconnection parameter is good for you: once the one connection to one database will be closed, the memory will be immediately recovered (with memory=true) because no data cache is needed to speed the time to establish the following connections . If memory=false instead, reference files will be deleted at the connection closing(I know you'll be glad of this).
type: Comment
comment on: http://stackoverflow.com/a/26307981

http://stackoverflow.com/a/26256786
has body: I think it could be better for you if you resolved this task by your own but it's your choice. All explanations in comments. public static int countTriangle(List&lt;Integer&gt; list) { if (list.size() == 0) { // if list is empty return 0 return 0; } else if (list.size() == 1) { // if list contains only single element return this element return list.get(0); } else if (list.size() == 2) { // if list contains two elements, return them connected // for example we have list of 5 and 1 // we multiple 5 with 10 (50) and then add 1 to it, // so the output of 5 and 1 will be 51 return list.get(0) * 10 + list.get(1); } // create new list for the next triangle's line List&lt;Integer&gt; newList = new ArrayList&lt;Integer&gt;(); // iterate over every element of existing list for (int i = 0; i &lt; list.size() - 1; i++) { // a = current element + next element (last iteration will be with last but one element) int a = list.get(i) + list.get(i+1); // if a has two digits or more if (a &gt;= 10) { // translate it to String String s = String.valueOf(a); // take every char of a String, translate it to number and add to new list // for example if a = 157 then three new elements will be added to new list (1, 5, 7) for (int j = 0; j &lt; s.length(); j++) { newList.add(Integer.valueOf(String.valueOf(s.charAt(j)))); } // if a has single digit } else { // add this to new list newList.add(a); } } // call this function with new list (next line) return countTriangle(newList); }
upvote count: 2
answers question: http://stackoverflow.com/q/26256373
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41204557
score: 0
has text: @Yoztastic The connections probably got shot down by their finalizer when they were garbage collected, hiding that problem.
comment on: http://stackoverflow.com/q/26263211
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26265727
type: Question
has comment: http://stackoverflow.com/comment/41246080
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26309533
tagged with: saml
tagged with: java
has comment: http://stackoverflow.com/comment/41274898
has comment: http://stackoverflow.com/comment/41275517
accepted answer: http://stackoverflow.com/a/28462006
has comment: http://stackoverflow.com/comment/41275797
linked to: http://stackoverflow.com/q/26007505
has comment: http://stackoverflow.com/comment/41212464
answer count: 2
tagged with: assertion
downvote count: 0
has comment: http://stackoverflow.com/comment/41253118
favorite count: 0
has comment: http://stackoverflow.com/comment/41286396
has comment: http://stackoverflow.com/comment/41275293
has body: We are receiving a standard SAML 2.0 assertion from an Identify Provider, and I am unable to validate it using the only example ColdFusion 9 example code that exists on the internet. The code below can be found on the internet as an example of how to validate SAML with ColdFusion. See this page: http://blog.tagworldwide.com/?p=19 The SAML XML is being sent to us as a form post. We've got a page set up to detect the incoming assertion. The relevant code is below: xmlResponse = getHttpRequestData().content.Trim(); docElement = XmlParse(variables.xmlResponse); Init = CreateObject("Java", "org.apache.xml.security.Init").Init().init(); SignatureConstants = CreateObject("Java", "org.apache.xml.security.utils.Constants"); SignatureSpecNS = SignatureConstants.SignatureSpecNS; xmlSignatureClass = CreateObject("Java", "org.apache.xml.security.signature.XMLSignature"); xmlSignature = xmlSignatureClass.init(docElement.getElementsByTagNameNS(SignatureSpecNS,"Signature").item(0),""); keyInfo = xmlSignature.getKeyInfo(); X509CertificateResolverCN = "org.apache.xml.security.keys.keyresolver.implementations.X509CertificateResolver"; keyResolver = CreateObject("Java", X509CertificateResolverCN).init(); keyInfo.registerInternalKeyResolver(keyResolver); x509cert = keyInfo.getX509Certificate(); isValid = xmlSignature.checkSignatureValue(x509cert); ColdFusion 9 doesn't have built in libraries to handle x509 validation, so two Java libraries were imported into our ColdFusion installation. These came from the Apache Santuario project. They are: serializer-2.7.1.jar xmlsec-1.5.3.jar The code runs just fine, but it always outputs "NO", the signature is not valid. I am certain that the assertion should valid properly. I admit that I am just cargo coding here as I am not familiar enough with Java to truly understand what is going on here. I've tried everything I can think of. Can anyone offer any tips or ideas on what to check or what to modify to continue troubleshooting? == UPDATE 1 - Added …
tagged with: coldfusion
has comment: http://stackoverflow.com/comment/41246989
score: 2
has answer: http://stackoverflow.com/a/28462006
has title: Unable to validate SAML assertion with ColdFusion
has comment: http://stackoverflow.com/comment/41275218
upvote count: 2
has answer: http://stackoverflow.com/a/26309533
has comment: http://stackoverflow.com/comment/41251550
tagged with: x509

http://stackoverflow.com/q/26201186
has comment: http://stackoverflow.com/comment/41086481
has comment: http://stackoverflow.com/comment/41086529
type: Question
has comment: http://stackoverflow.com/comment/41086430
answer count: 1
has title: Launch two Java programs from the same code
upvote count: 1
has answer: http://stackoverflow.com/a/26201448
has comment: http://stackoverflow.com/comment/41086356
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has body: I have a Java program which is divided into client and server code. However, for standalone users, I want both the server software and client software to be launch with the click of one button. I have had success embedding the http server with the server software. What I need now is a way to launch the two programs (as two instances) from a single place which can send information to the programs that it has spawned. How can I achieve this? P.S. I have used JavaFX for the client program so it is better if I have a way of launching JavaFX programs as well.
score: 1
tagged with: java

http://stackoverflow.com/a/26278538
answers question: http://stackoverflow.com/q/26278268
upvote count: 2
has comment: http://stackoverflow.com/comment/41229157
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41230069
has body: The code to transform text to XML depends on XSLT version 2.0 and an XSLT 2.0 processor like Saxon 9. The JAXP API you are trying to use is solely useful with an XSLT 1.0 approach of having an XML input document as the primary source to the XSLT code. Thus if you want to use that API then you need to make sure you pass a dummy input XML to the transformer, while the URI of the plain text file should be passed in as a parameter. I would however suggest to use the Saxon S9 API to simply start the stylesheet with a named template main, also passing in the plain text URI as a parameter.
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26278268

http://stackoverflow.com/comment/41369308
score: 0
type: AnswerComment
type: Comment
has text: maybe Glass only allows reading of images from DCIM? So I wonder if simply changing the file extension to .jpg would work around your hurdle?
comment on: http://stackoverflow.com/a/26334754

http://stackoverflow.com/a/26249531
accepted answer of: http://stackoverflow.com/q/26247986
has comment: http://stackoverflow.com/comment/41254728
has comment: http://stackoverflow.com/comment/41214593
has comment: http://stackoverflow.com/comment/41244739
answers question: http://stackoverflow.com/q/26247986
has body: You will need to copy the sinch libraries to your project, please see the sinch client for android documentation download the sinch android sdk zip , copy the contents of libs folder into the libs under your project root. clean and rebuild the project. Before testing the apk, open the apk as a zip and make sure .so files are in lib\*\ folder; if you are having trouble getting eclipse to properly package the app, please consider using sinch's documentation and use android studio as they suggest
has comment: http://stackoverflow.com/comment/41214989
downvote count: 0
has comment: http://stackoverflow.com/comment/41177655
has comment: http://stackoverflow.com/comment/41179493
has comment: http://stackoverflow.com/comment/41177484
has comment: http://stackoverflow.com/comment/41181676
has comment: http://stackoverflow.com/comment/41216677
has comment: http://stackoverflow.com/comment/41241390
has comment: http://stackoverflow.com/comment/41178786
has comment: http://stackoverflow.com/comment/41178737
has comment: http://stackoverflow.com/comment/41177430
has comment: http://stackoverflow.com/comment/41215260
has comment: http://stackoverflow.com/comment/41243695
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41179388
score: 4
has comment: http://stackoverflow.com/comment/41181208
has comment: http://stackoverflow.com/comment/41215222
type: Answer
has comment: http://stackoverflow.com/comment/41179329
has comment: http://stackoverflow.com/comment/41241151
upvote count: 4
has comment: http://stackoverflow.com/comment/41177622
has comment: http://stackoverflow.com/comment/41180992

http://stackoverflow.com/q/26288052
has comment: http://stackoverflow.com/comment/41249943
has comment: http://stackoverflow.com/comment/41248484
has answer: http://stackoverflow.com/a/43116462
tagged with: idle-timer
type: Question
has body: I need to know to detect when the android device has been idle for a certain period of time when my app is currently in the background (and if it is idle, bring my app to the front). The only two ways I could think of to do this are: Somehow detect user interaction outside of the app, and if there hasn't been any input for X number of minutes, bring my app to the front. or: When the device goes into sleep mode, bring my app to the front. I can't figure out how to either of these, but 2 seems like the most feasible option to me. What would be the code for this?
downvote count: 0
has comment: http://stackoverflow.com/comment/41247863
has comment: http://stackoverflow.com/comment/41248327
upvote count: 1
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/41250042
favorite count: 0
linked to: http://stackoverflow.com/q/6582018
type: UnansweredQuestion
has title: Android Service: Detect when device is idle for X minutes
linked to: http://stackoverflow.com/q/4075180
has comment: http://stackoverflow.com/comment/41249467
score: 1
tagged with: java

http://stackoverflow.com/q/26327957
score: 389
tagged with: option-type
type: Question
upvote count: 392
linked to: http://stackoverflow.com/q/31670785
has comment: http://stackoverflow.com/comment/41337761
has answer: http://stackoverflow.com/a/76625598
linked to: http://stackoverflow.com/q/31922866
accepted answer: http://stackoverflow.com/a/26328555
has answer: http://stackoverflow.com/a/26328314
has answer: http://stackoverflow.com/a/26328100
answer count: 7
possible better answer: http://stackoverflow.com/a/26328314
has answer: http://stackoverflow.com/a/45403766
favorite count: 0
tagged with: nullable
has answer: http://stackoverflow.com/a/71158515
linked to: http://stackoverflow.com/q/4963300
has comment: http://stackoverflow.com/comment/77396922
has body: Optional type introduced in Java 8 is a new thing for many developers. Is a getter method returning Optional&lt;Foo&gt; type in place of the classic Foo a good practice? Assume that the value can be null.
has answer: http://stackoverflow.com/a/51335001
tagged with: java-8
has title: Should Java 8 getters return optional type?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26328555
linked to: http://stackoverflow.com/q/25693309
tagged with: java
downvote count: 3

http://stackoverflow.com/q/26322863
tagged with: image
has comment: http://stackoverflow.com/comment/41310480
answer count: 0
has body: I have an image and am wondering how i remove the unnecessary background color in the image. private Image img; public Player() { try { ImageIcon i = new ImageIcon("imgs/player.png"); this.img = i.getImage(); } catch (Exception e) { System.out.println("Exception: " + e); } } public void draw(Graphics g) { g.drawImage(img, 0, 0, null); } would it be better to use a bufferedImage or ImageIcon?
tagged with: imageicon
type: Question
has comment: http://stackoverflow.com/comment/41311537
tagged with: css
score: 0
linked to: http://stackoverflow.com/q/14097386
has title: Java: rendering background color transparent Image()
tagged with: graphics
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/26270589
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26271747
type: UnansweredQuestion
tagged with: singleton
tagged with: android
has body: I was just having this small conversation with a buddy and he's insisting that the singleton used for Dagger is better than making one through old-school-static-private-variables way. Not that I'm sure he's wrong, I just want to clear up why is it better. What is the difference between these two implementation methods (DI vs normal static)?
has comment: http://stackoverflow.com/comment/41215226
score: -1
tagged with: java
linked to: http://stackoverflow.com/q/427902
downvote count: 1
type: Question
tagged with: dagger
has title: What is the difference between the implementation of singleton on Dependency Injection frameworks (like Dagger) than the normal static singleton?
upvote count: 0

http://stackoverflow.com/comment/41232945
type: Comment
comment on: http://stackoverflow.com/q/26280509
score: 0
type: QuestionComment
has text: opencsv library. Also, just use a `List` instead of a fixed-size array so it can grow on demand. Convert to an array later if you really must.

http://stackoverflow.com/q/26208557
has body: Currently im working on a Space Invaders project and the programming language is based off Java but not completely. It doesn't have all the commands like Java so its just like simple language. So to program this, i code in simple code. Such as using if statements and for loop. So the problem i am stuck on is how to make the player's bullet kill the enemyAI I can't get the enemy to destroy itself. I've tried many methods but i cant seem to make it work. So here was my first method : Making four single arrays int[] enemyPosX int[] enemyPosY int[] enemyDirX int[] enemyDirY And from that i make a nested loop which generates a grid, width of 10 and height of 3. And once i have done that i made it move from from left to right and once its reached to the end of the width of the game, the direction changes and moves down by one. int width = 10; int height = 3; int numEnemy = width * height; int[] enemyPosX new int[numEnemy]; int[] enemyPosY new int[numEnemy]; int[] enemyDirX new int[numEnemy]; int[] enemyDirY new int[numEnemy]; void main() { for(int x = 0; x &lt; width; x = x + 1) { for(int y = 0; y &lt; height; y = y + 1) { enemyPosX[x] = x * height * 5; enemyPosY[y] = y * height * 15; enemyDirX[x] = 5; enemyDirY[y] = 5; } } } After doing this i generated information for the bullet. When the player fires it. By the dimensions of the game area is 800 by 800. for(int i = 0; i &lt; firedBullets; i = i + 1) { setColor(0, 0, 0); fillRect(bulletPosX[i], bulletPosY[i], 6, 30); bulletPosY[i] = bulletPosY[i] - 5; if(bulletPosY[i] &lt; -50) { for(int j = i + 1; j &lt; firedBullets; j = j + 1) { bulletPosX[j - 1] = bulletPosX[j]; bulletPosY[j - 1] = bulletPosY[j]; bulletDirX[j - 1] = bulletDirX[j]; bulletDirY[j - 1] = bulletDirY[j]; } firedBullets = firedBullets - 1; } } void onKeyPressed (int code) { if(code == 37) { playerPosX = playerPosX - 15; } if(code == 39) { playerPosX = playerPosX + 15; } if(code == 32) { if(firedBullets &lt; maxBullets) { bulletPosX[firedBullets] = playerPo…
has comment: http://stackoverflow.com/comment/41100555
answer count: 0
has comment: http://stackoverflow.com/comment/41100440
type: UnansweredQuestion
tagged with: shift
type: Question
has comment: http://stackoverflow.com/comment/41099988
tagged with: java
has comment: http://stackoverflow.com/comment/41100083
tagged with: arrays
has title: Space Invaders Killing the Enemy
score: 0
tagged with: multidimensional-array

http://stackoverflow.com/a/26195261
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26195233
has body: Every part of the command line, after the class name, is a separate argument. So the code should be String[] args = {"-loadClassifier", "ner-model.ser.gz", "-testFile", "jane-austen-emma-ch2.tsv"};
accepted answer of: http://stackoverflow.com/q/26195233
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26283436
tagged with: parameters
tagged with: object
tagged with: java
type: Question
answer count: 1
tagged with: class
score: 0
has body: Information from file: Shape, radius/height/width, color, filled CIRCLE, 1, blue, true RECTANGLE, 1, 2, blue, true RECTANGLE, 10, 2, red, true CIRCLE, 2, green RECTANGLE CIRCLE Program: Once it reaches the 4th line where it is missing the parameter true/false, the program doesn't assign it the default values from the other classes. How do I assign the default parameters to that newly created object when there are no parameters specified in the file? Default values are: color = white, filled = false, radius = 1, height = 1, width = 1. import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class Driver { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File( "C:/Users/Charles/Desktop/GeometricObjectsData.txt")); ArrayList&lt;GeometricObject&gt; list = new ArrayList&lt;GeometricObject&gt;(); while (input.hasNextLine()) { String line = input.nextLine(); String[] tokens = line.split(", "); if (tokens[0].equals("CIRCLE")) { Circle c = new Circle(); float radius = Float.parseFloat(tokens[1]); c.setRadius(radius); String color = String.valueOf(tokens[2]); c.setColor(color); Boolean filled = Boolean.valueOf(tokens[3]); c.setFilled(filled); c.getArea(); list.add(c); System.out.println(c.toString()); } else if (tokens[0].equals("RECTANGLE")) { Rectangle r = new Rectangle(); float height = Integer.parseInt(tokens[1]); r.setHeight(height); float width = Integer.parseInt(tokens[2]); r.setWidth(width); String color = String.valueOf(tokens[3]); r.setColor(color); Boolean filled = Boolean.valueOf(tokens[4]); r.setFilled(filled); r.getArea(); list.add(r); System.out.println(r.toString()); } } } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26283779
has title: How to assign default parameters to an object created from a file that does not have those parameters?

http://stackoverflow.com/a/26237090
accepted answer of: http://stackoverflow.com/q/26228775
has body: You can use numbers and String in JSON. But for your case, the outer type should be array and not object: [ { "input":[""], "output":["shut up","i dont care","stop talking"] }, { "input":["hi","hello","howdy","hey"], "output":["hi","hello","hey"] }, { "input":["how are you", "how r u", "how r you", "how are u"], "output":["good","doing well"] } ] That said, JSON isn't a good format to search. It's meant as a simple way to exchange data between programs. You want a "database" instead. So your approach to read the texts into an "in-memory database" (or data structure) works well unless you have really many texts. When that happens, you should try a simple database like H2. It even supports fulltext search.
score: 0
has comment: http://stackoverflow.com/comment/41153306
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26228775
type: Answer

http://stackoverflow.com/q/26288603
has title: is it better to overwrite data in memory or to read first for checking
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26288785
has comment: http://stackoverflow.com/comment/41249316
accepted answer: http://stackoverflow.com/a/26288785
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: memory-management
downvote count: 0
score: 1
tagged with: sharedpreferences
type: Question
tagged with: java
has body: My question is particularly for android. I am using shared preferences to save some data locally on the device. Each time I make a call to server, the response may be new or it may be the same stuff I already persisted. Without changing the question as asked, what is a better design? one: check if the data is not there and then add it? if(!getFromSharedPrefs(dataKey).equals(newData)){ addToSharedPrefs(dataKey, newData); } Or two: simply add the new data each time as overwriting is not more expensive than reading? addToSharedPrefs(dataKey, newData); Please include explanation as to why it's better to check first or as to why the two approaches are equivalent. I am assuming the answer is platform or device agnostic, so if you know objective-c or java or whatever, it should not matter (?)

http://stackoverflow.com/q/26280873
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/26281163
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26281628
has comment: http://stackoverflow.com/comment/41234208
has answer: http://stackoverflow.com/a/26281176
has title: Java Generics & Inheritance: Unable to add to List
score: 1
linked to: http://stackoverflow.com/q/2723397
tagged with: java
linked to: http://stackoverflow.com/q/11119804
upvote count: 1
has comment: http://stackoverflow.com/comment/41233609
type: Question
has comment: http://stackoverflow.com/comment/41233931
has comment: http://stackoverflow.com/comment/41233537
tagged with: inheritance
has body: Suppose I have a List definition as follows. private List&lt;? extends GeneralBudgetYearBean&gt; budgetYearBeans; // + Getters/setters... Why am I unable to generally refer to this List as follows outside this class: GeneralBudgetYearBean gbyb; getBudgetYearBeans().add(bgyb); The error is: The method add(capture#6-of ? extends GeneralBudgetYearBean) in the type List&lt;capture#6-of ? extends GeneralBudgetYearBean&gt; is not applicable for the arguments (GeneralBudgetYearBean) This doesn't make sense. Is it because "? extends T" is not the same as "T", and "T" can't be substituted here? I need to be able to generally manipulate this class without specifics. At some point, there will be an ArrayList of "SUBGeneralBudgetYearBeans" constructed in extending classes, which is why I need to use the "? extends GeneralBudgetYearBean" notation.
answer count: 3

http://stackoverflow.com/q/26330348
favorite count: 0
tagged with: datepicker
score: 6
type: AnsweredQuestion
tagged with: java
tagged with: javafx
type: Question
accepted answer: http://stackoverflow.com/a/26339847
has body: I have the simple code for date picker which disables all the dates which are before the chosen one, but I need to be able to disable other dates as well (like for example:17.10.2014 until 19.10.2014). How could I change it in a way that specific dates are also disabled? public class DatePickerSample extends Application { private Stage stage; private DatePicker checkInDatePicker; private DatePicker checkOutDatePicker; public static void main(String[] args) { Locale.setDefault(Locale.US); launch(args); } @Override public void start(Stage stage) { this.stage = stage; stage.setTitle("DatePickerSample "); initUI(); stage.show(); } private void initUI() { VBox vbox = new VBox(20); vbox.setStyle("-fx-padding: 10;"); Scene scene = new Scene(vbox, 400, 400); stage.setScene(scene); checkInDatePicker = new DatePicker(); checkOutDatePicker = new DatePicker(); checkInDatePicker.setValue(LocalDate.now()); final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker datePicker) { return new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); if (item.isBefore( checkInDatePicker.getValue().plusDays(1)) ) { setDisable(true); setStyle("-fx-background-color: #ffc0cb;"); } long p = ChronoUnit.DAYS.between( checkInDatePicker.getValue(), item ); setTooltip(new Tooltip( "You're about to stay for " + p + " days") ); } }; } }; checkOutDatePicker.setDayCellFactory(dayCellFactory); checkOutDatePicker.setValue(checkInDatePicker.getValue().plusDays(1)); GridPane gridPane = new GridPane(); gridPane.setHgap(10); gridPane.setVgap(10); Label checkInlabel = new Label("Check-In Date:"); gridPane.add(checkInlabel, 0, 0); GridPane.setHalignment(checkInlabel, HPos.LEFT); gridPane.add(checkInDatePicker, 0, 1); Label checkOutlabel = new Label("Check-Out Date:"); gridPane.add(checkOutlabel, 0, 2); GridPane.setHalignment(checkOutlabel, HPos.LEFT); gridPane.add(checkOutDa…
upvote count: 6
has answer: http://stackoverflow.com/a/26339847
answer count: 1
downvote count: 0
has title: DatePicker: how to customize

http://stackoverflow.com/q/26311358
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/26312233
tagged with: algorithm
has title: Ford Fulkerson algorithm Java
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41291124
has comment: http://stackoverflow.com/comment/41290159
favorite count: 0
has answer: http://stackoverflow.com/a/26312233
type: Question
tagged with: ford-fulkerson
has body: I need help implement an efficient algorithm for the following scheduling problem. There are n patients coming to the hospital for health examination tomorrow, but there are only 2 doctors available (Doctor A and Doctor B). Each health exam takes 1 time slot for a doctor. If possible, I need to allocate those n patients to n time slots using only 1 doctor. If 1 doctor is not possible, I can assign maximum 2 doctors since only 2 doctors are available. If 2 doctors are still not enough. Simply output impossible I'm taking patients' availability as input. For example, there are 5 patients, patient 1 is only available for time slot 1,2,5, patient 2 is available for time slot 3, 4, patient 3 is available for time slot 1......and so on. P1: 1 2 5 P2: 3 4 P3: 1 P4: 2 P5: 3 5 In this case, I just need 1 doctor to do the job. output P1: Time slot 5 - Doc A P2: Time slot 4 - Doc A P3: Time slot 1 - Doc A P4: Time slot 2 - Doc A P5: Time slot 3 - Doc A If I get input like: P1: 1 2 5 P2: 3 4 P3: 2 P4: 2 P5: 3 5 Then I'll need to assign both doctors since P3 and P4 have conflicts in availability. output: P1: Time slot 5 - Doc A P2: Time slot 4 - Doc A P3: Time slot 2 - Doc A P4: Time slot 2 - Doc B P5: Time slot 3 - Doc A What's the most efficient algorithm for problem like this? How can I implement Ford Fulkerson algorithm for this? What I have done so far. I was trying to store each patient's available time slots into separate arrays. Sort the arrays by length. Assign the patient with the least available time slots first. Once a patient is assigned, delete this time slot in the rest arrays and sort the arrays by length again. Repeat this process until all patients are assigned.
upvote count: 3
tagged with: java

http://stackoverflow.com/q/26200701
tagged with: date
duplicate of: http://stackoverflow.com/q/218384
score: 0
tagged with: mongodb
answer count: 1
has body: I have tried the following code, it displayed the date values for the first two times of the run, but later started throwing a nullpointerexception, any idea why this is happening? DBCursor c=test.find(); while(c.hasNext()) { DBObject dbc=c.next(); Date n=(Date)dbc.get("time"); System.out.println(n); Calendar cal = new GregorianCalendar(); cal.setTime(n); System.out.println(cal.get(Calendar.DAY_OF_MONTH)); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26202459
has title: NullPointerException in a collection of MongoDB for dates
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: java

http://stackoverflow.com/q/26199525
answer count: 1
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/26779135
tagged with: android
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/26779135
has title: Null pointer exception when using multiple fragment that uses a custom seek bar
score: 2
has comment: http://stackoverflow.com/comment/41091750
type: AnsweredQuestion
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/41083467
tagged with: java
tagged with: android-custom-view
type: Question
upvote count: 2
has body: I have a custom Seek bar that that i made following a tutorial on the net. Here is the code for the CustomSeekBar class. public class CustomSeekBar extends SeekBar { private ArrayList&lt;ProgressItem&gt; mProgressItemsList; public CustomSeekBar(Context context) { super(context); } public CustomSeekBar(Context context, AttributeSet attrs) { super(context, attrs); } public CustomSeekBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void initData(ArrayList&lt;ProgressItem&gt; progressItemsList) { this.mProgressItemsList = progressItemsList; } @Override protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } protected void onDraw(Canvas canvas) { if (mProgressItemsList.size() &gt; 0) { int progressBarWidth = getWidth(); int progressBarHeight = getHeight(); int thumboffset = getThumbOffset(); int lastProgressX = 0; int progressItemWidth, progressItemRight; for (int i = 0; i &lt; mProgressItemsList.size(); i++) { ProgressItem progressItem = mProgressItemsList.get(i); Paint progressPaint = new Paint(); progressPaint.setColor(getResources().getColor( progressItem.color)); progressItemWidth = (int) (progressItem.progressItemPercentage * progressBarWidth / 100); progressItemRight = lastProgressX + progressItemWidth; // for last item give right to progress item to the width if (i == mProgressItemsList.size() - 1 &amp;&amp; progressItemRight != progressBarWidth) { progressItemRight = progressBarWidth; } Rect progressRect = new Rect(); progressRect.set(lastProgressX, thumboffset / 2, progressItemRight, progressBarHeight - thumboffset / 2); canvas.drawRect(progressRect, progressPaint); lastProgressX = progressItemRight; } super.onDraw(canvas); } } } I have used this custom widget in a fragment. This fragment has multiple instance of this custom widget. The fragment is used in multiple activities. There is an activity where the fragment works fine b…

http://stackoverflow.com/comment/41075221
comment on: http://stackoverflow.com/q/26194887
type: QuestionComment
has text: Where does your layout file exist? It should be in the `layout` folder
score: 0
type: Comment

http://stackoverflow.com/q/26217091
type: Question
tagged with: java
has body: I have a editable JComboBox, with focus on this combobox, when I press Enter key, the behavior differs between Java 8 compared to older versions. This code works as expected in Java 7 and below, but not in Java 8 (tested in Oracle JVM in Mac): package org.wiztools.comboboxdefaultbutton; import java.awt.BorderLayout; import java.awt.Container; 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.JOptionPane; import javax.swing.SwingUtilities; /** * * @author subhash */ public class MyFrame extends JFrame { private static MyFrame me; public MyFrame() { Container c = getContentPane(); c.setLayout(new BorderLayout()); // Press Enter key with focus on this component: JComboBox jcb = new JComboBox(new String[]{"Option: One", "Option: Two"}); jcb.setEditable(true); c.add(jcb, BorderLayout.CENTER); JButton jb = new JButton("Ok"); jb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(me, "Button pressed!"); } }); SwingUtilities.getRootPane(c).setDefaultButton(jb); c.add(jb, BorderLayout.EAST); pack(); setVisible(true); } public static void main(String[] arg) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { me = new MyFrame(); } }); } } How do I make this code work in Java 8 and below uniformly?
upvote count: 4
answer count: 2
downvote count: 0
score: 4
favorite count: 0
tagged with: jcombobox
has title: Editable JComboBox in Java 8 does not forward Enter key to default button
has answer: http://stackoverflow.com/a/53715348
type: UnansweredQuestion
tagged with: swing
tagged with: java-8
has answer: http://stackoverflow.com/a/26218574

http://stackoverflow.com/comment/41331475
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26295798
score: 0
has text: It can lead to conflict when using 2 versions of the same library, because some classes can be loaded from one jar and some from another. You should avoid such situation.

http://stackoverflow.com/comment/41157817
type: QuestionComment
has text: How big is your XML file? From what I see, it tries to allocate a buffer to read your XML file and it runs out of memory.
comment on: http://stackoverflow.com/q/26239445
score: 0
type: Comment

http://stackoverflow.com/comment/41188731
has text: That's http servlet basics. Every request goes into its own thread
comment on: http://stackoverflow.com/a/26247104
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41293611
type: Comment
has text: Surely you mean 0.7, not 7.0?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26313099

http://stackoverflow.com/comment/41164359
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26242122
score: 1
has text: In the class where you made the call, you must have a reference to a Context, Activity or Application for instance.

http://stackoverflow.com/comment/41150107
comment on: http://stackoverflow.com/q/26232087
type: QuestionComment
type: Comment
score: 1
has text: Errr, is that valid C code? Where is the actual struct type definition?

http://stackoverflow.com/comment/41409253
has text: Can you provide more information? Like the Terracotta version and where you want to have the running status - inside the application or more generally.
score: 0
comment on: http://stackoverflow.com/q/26296139
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26273252
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26273854
possible better answer: http://stackoverflow.com/a/26274819
has answer: http://stackoverflow.com/a/26274819
tagged with: selenium-webdriver
type: AnsweredQuestion
has title: how to collect a particular row id's in an table - webdriver using java collections
downvote count: 0
score: 1
tagged with: java
tagged with: selenium
accepted answer: http://stackoverflow.com/a/26273860
type: Question
has body: Html code &lt;table id="tblRenewalsStatus" class="bor-bot" width="100%" cellspacing="0" cellpadding="0" border="0"&gt; &lt;tbody&gt; &lt;tr id="trVerifyPayment"&gt; &lt;tr id="trAssignAgent"&gt; &lt;tr id="trAssigned"&gt; &lt;tr id="trPayAgent" style="display: none;"&gt; &lt;tr id="trPaymentVerificationPending" style="display: none;"&gt; &lt;tr id="trInProgress" style="display: none;"&gt; &lt;tr id="trPayAgentCommission"&gt; &lt;tr id="trPaymentVerificationPendingCommission"&gt; &lt;tr id="trCompleted"&gt; &lt;tr id="trCancelled"&gt; &lt;/tbody&gt; &lt;/table&gt; I want to collect all the tr id's which don't have an style Attribute value in it, Expected output, "trVerifyPayment","trAssignAgent","trAssigned",trPayAgentCommission","trPaymentVerificationPendingCommission","trCompleted","trCancelled"
linked to: http://stackoverflow.com/q/18770486
has answer: http://stackoverflow.com/a/26273860
has comment: http://stackoverflow.com/comment/41220312
answer count: 3

http://stackoverflow.com/comment/41313275
type: Comment
has text: Operating systems provide direct non blocking asynchronous IO facilities, I would hope that the JVM is using those. See Windows/Solaris IO completion ports, and I am sure linux/bsd has something similar.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26285775

http://stackoverflow.com/a/67530919
upvote count: 2
type: Answer
has body: Although the answer might be too late, but just for future reference. I faced exactly the same problem and for the reasons already mentioned I kept getting the same error. I managed to work around the problem by sending just an empty body: conn.setDoOutput(true); try (OutputStream os = conn.getOutputStream()) { byte[] input = "".getBytes("utf-8"); os.write(input, 0, input.length); } That fixed the issue for me. Manually setting the Content-Length header does not help as already mentioned.
answers question: http://stackoverflow.com/q/26247555
score: 2
downvote count: 0

http://stackoverflow.com/comment/41267197
score: 0
type: Comment
has text: tried lz4 unfortunately our implementation of hadoop uses lzo or gzip and I am stuck with using one of the 2 algorithms.
type: QuestionComment
comment on: http://stackoverflow.com/q/26256664

http://stackoverflow.com/comment/41296340
comment on: http://stackoverflow.com/q/26315022
score: 0
type: Comment
type: QuestionComment
has text: @Henry details like what? you mean like boundary issues?

http://stackoverflow.com/comment/41292322
score: 0
has text: Good point, I think my specific example does fall under that category.
type: Comment
comment on: http://stackoverflow.com/a/26310218
type: AnswerComment

http://stackoverflow.com/comment/41161779
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26237028
has text: So can't you startActivityfor result with result STATUS_ON_ICC_SENT and then just override onactivity result?
score: 0

http://stackoverflow.com/a/26276741
score: 1
answers question: http://stackoverflow.com/q/26276688
has body: So every sentence is separated by a comma. Then you just have to split: public class HelloWorld{ public static void main(String []args){ String myContent ="here is the sentence 1 . here is the sentence 2 . hereisthesomesentence3.here is the sentence 4. "; String[] parts = myContent.split("\\."); System.out.println("Amount of parts = " + parts.length); System.out.println("Sentence 3 = " + parts[2].trim()); // trim() removes leading and trailing whitespaces } }
has comment: http://stackoverflow.com/comment/41226089
has comment: http://stackoverflow.com/comment/41227119
has comment: http://stackoverflow.com/comment/41227835
has comment: http://stackoverflow.com/comment/41226208
has comment: http://stackoverflow.com/comment/41225918
downvote count: 0
has comment: http://stackoverflow.com/comment/41226155
has comment: http://stackoverflow.com/comment/41226102
type: Answer
has comment: http://stackoverflow.com/comment/41227305
upvote count: 1
has comment: http://stackoverflow.com/comment/41226316
has comment: http://stackoverflow.com/comment/41225943
has comment: http://stackoverflow.com/comment/41228122

http://stackoverflow.com/a/26347990
has comment: http://stackoverflow.com/comment/41357958
has comment: http://stackoverflow.com/comment/41357459
type: Answer
has comment: http://stackoverflow.com/comment/41357064
accepted answer of: http://stackoverflow.com/q/26347801
answers question: http://stackoverflow.com/q/26347801
upvote count: 2
has body: On the basis of what we know, I don't think you're missing anything. It looks like a bug in Netbeans. Since (float) binds to points and not to the result of the division, the cast alters the semantics of the program and can't be reasonably described as "unnecessary". An MCVE would help confirm this (and would be useful when filing a bug report).
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26232767
has comment: http://stackoverflow.com/comment/41147050
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41159333
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41308546
has title: CometD doesnt start Jetty server in Java Multithreading
type: Question
has body: I`m using CometD-3.0.2 in Java multi-threading application following this tutorial. Everything works fine when I create a service channel. I have created an object of my Socket Connection class, that also starts 10 Java Threads, in the CometD initialise class public class Initializer extends GenericServlet { private MainConnect connect; @Override public void init() throws ServletException { connect = new MainConnect(); // Retrieve the CometD service instantiated by AnnotationCometdServlet StockPriceService service = (StockPriceService)getServletContext().getAttribute(StockPriceService.class.getName()); // Register the service as a listener of the emitter connect.getListeners().add(service); System.out.println("Service Added!"); //Initiate the Threads connect.InitiateConnection(); } My Socket class gets initiated and java threads are running as well. However, the jetty server never get started here. My Service class @Service public class StockPriceService implements StockPriceEmitter.Listener { @Inject private BayeuxServer bayeuxServer; @Session private LocalSession sender; public void onUpdates(List&lt;StockPriceEmitter.Update&gt; updates) { for (StockPriceEmitter.Update update : updates) { // Create the channel name using the stock symbol String channelName = "/stock/" + update.getSymbol().toLowerCase(Locale.ENGLISH); // Initialize the channel, making it persistent and lazy bayeuxServer.createIfAbsent(channelName, new ConfigurableServerChannel.Initializer() { public void configureChannel(ConfigurableServerChannel channel) { channel.setPersistent(true); channel.setLazy(true); } }); // Convert the Update business object to a CometD-friendly format Map&lt;String, Object&gt; data = new HashMap&lt;String, Object&gt;(4); data.put("symbol", update.getSymbol()); data.put("oldValue", update.getOldValue()); data.put("newValue", update.getNewValue()); // Publish to all subscribers ServerChannel channel = bayeuxServer.getChannel(channelName); channel.publish(sender, data, null…
tagged with: cometd
score: 0
has comment: http://stackoverflow.com/comment/41146336
has comment: http://stackoverflow.com/comment/41146421

http://stackoverflow.com/q/26202641
tagged with: swing
tagged with: bufferedimage
linked to: http://stackoverflow.com/q/15961412
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41090356
answer count: 1
has title: why BufferedImage does not show full image in JLabel?
type: UnansweredQuestion
has body: I am getting files from JFileChooser and showing them by reading with BufferedImage and putting in JLabels but there is a problem that my images are not completely shown in JLabels. Here is my code public class ImagePreview { JPanel PicHolder= new JPanel(); public ImagePreview() { JButton GetImages = new JButton("Browse Images"); GetImages.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { CreatePreviews(); }; }); PicHolder.add(GetImages); JFrame MainFrame = new JFrame("Image Preview"); MainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); MainFrame.getContentPane().add(PicHolder); MainFrame.pack(); MainFrame.setVisible(true); } public void CreatePreviews() { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(true); File[] selectedCarImages = chooser.getSelectedFiles(); for(int a=0; a&lt;selectedImages.length; a++) { try { BufferedImage myPicture = ImageIO.read(new File(selectedImages[a].getAbsolutePath())); JLabel picLabel = new JLabel(new ImageIcon(myPicture)); PicHolder.add(picLabel); } } } public static void main(String[] args) { java.awt.EventQueue.invokeLater(() -&gt; { new ImagePreview(); }); } } When I run this code, it shows user selected images but they are kind of automatically croped and not showing completely in JLabels. What's wrong here? Why JLabels do not show full images?
score: 0
has answer: http://stackoverflow.com/a/26203037
has comment: http://stackoverflow.com/comment/41090293

http://stackoverflow.com/a/26202444
answers question: http://stackoverflow.com/q/26201990
has comment: http://stackoverflow.com/comment/41089398
has comment: http://stackoverflow.com/comment/41089590
has comment: http://stackoverflow.com/comment/41089340
score: 1
has comment: http://stackoverflow.com/comment/41089274
has comment: http://stackoverflow.com/comment/41089047
upvote count: 1
has comment: http://stackoverflow.com/comment/41089528
has body: Your calculatePrefSuffArray("ABC ABCDAB ABCDABCDABDE") will return this [0 0 0 0 1 2 3 0 1 2 0 1 2 3 0 1 2 3 0 1 2 0 0] instead of this [-1 0 0 0 1 2 3 0 1 2 0 1 2 3 0 1 2 3 0 1 2 0 0 ] Correct your code by replacing following tab[0] = 0; int t = tab[0]; with this tab[0] = -1; tab[1] = 0; int t = tab[1]; pass created int[] table returned from your calculatePrefSuffArray(String pattern) function. It will return true if word is found in string text. private boolean search(String string, String word, int[] table) { int m = 0, i = 0; while ((m + i) &lt; string.length()) { if (word.charAt(i) == string.charAt(m + i)) { if (i == word.length() - 1) { return true; } i++; } else { if (table[i] &gt; -1) { m = m + i - table[i]; i = table[i]; } else { i = 0; m++; } } } return false; } Let me know if you have any problem in understanding the code.
downvote count: 0
has comment: http://stackoverflow.com/comment/41089095
type: Answer

http://stackoverflow.com/comment/41356233
has text: Do you see in my original posting above that `is = getClass().getClassLoader().getResourceAsStream("persistence.properties");` also throws the same error?
type: Comment
comment on: http://stackoverflow.com/a/26347601
type: AnswerComment
score: 0

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/26306042
type: Tag

http://stackoverflow.com/comment/57107310
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/34659473
has text: If you print out the id before and after adding it to the eventModel, the value is different.
score: 0

http://stackoverflow.com/a/26298291
answers question: http://stackoverflow.com/q/26298234
has body: Try this int count = 0; for(int i=0;i&lt;=n;i++) { if(i%2==0) { ++count; } } System.out.println("Number of Even Numbers In This List = "+count);
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41265835
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41265959
has comment: http://stackoverflow.com/comment/41265789
accepted answer of: http://stackoverflow.com/q/26298234
has comment: http://stackoverflow.com/comment/41265960

http://stackoverflow.com/comment/41163620
type: QuestionComment
has text: You can iterate array in the same for loop you have already defined, have a variable for lowest time, and update it as times are < the current lowest time.
score: 1
comment on: http://stackoverflow.com/q/26242425
type: Comment

http://stackoverflow.com/a/57074529
answers question: http://stackoverflow.com/q/26235957
upvote count: 0
type: Answer
score: -1
has body: Here should be your answer. It is a batch script: start "" chrome "https://google.com; Timeout /t 3 /nobreak &gt;nul 2&gt;&amp;1 taskkill /IM chrome.exe /F start "" chrome "https://yahoo.com" Timeout /t 3 /nobreak &gt;nul 2&gt;&amp;1 taskkill /IM chrome.exe /F start "" chrome "https://bing.com" Timeout /t 3 /nobreak &gt;nul 2&gt;&amp;1 taskkill /IM chrome.exe /F
downvote count: 1

http://stackoverflow.com/q/26326806
has comment: http://stackoverflow.com/comment/41317928
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
tagged with: java
tagged with: mouseevent
type: Question
has title: Overridden mouseClicked(MouseEvent e) does not change JFrame’s component JLable?
has body: I implemented a JFrame that contains some JLable's. I would like to change their appearance once they are clicked. The appended code should do so. In fact: It does not. Taking the same code and putting it into the run of an inner Thread-class does the job. The inner Thread-instance inverts the clicked JLable twice. Can anybody give me a hint why the mouseClicked-method seems not to be able to affect the clicked JLable's appearance? @Override public void mouseClicked(MouseEvent e) { if (clickable) { for (Position p : positions.keySet()) { JLabel lable = positions.get(p); if (lable == e.getComponent()) { pickedPosition = p; LOGGER.info(pickedPosition + " pressed"); synchronized (lable) { // store old colors Color obg = lable.getBackground(); Color ofg = lable.getForeground(); // invert them Color nbg = new Color(255 - obg.getRed(), 255 - obg.getGreen(), 255 - obg.getBlue()); Color nfg = new Color(255 - ofg.getRed(), 255 - ofg.getGreen(), 255 - ofg.getBlue()); // set them lable.setOpaque(true); lable.setForeground(nfg); lable.setBackground(nbg); // wait a while try { lable.wait(WAIT_WHILE_INVERTING_MS); } catch (InterruptedException i) { LOGGER.warn(i.getMessage()); } // switch back to initial lable.setBackground(obg); lable.setForeground(ofg); } e.consume(); } } } }
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26326960

http://stackoverflow.com/comment/41437786
has text: Is it normal that i can't divide the number that the check method return?
type: Comment
comment on: http://stackoverflow.com/a/26332400
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41314354
has text: @JonHanna But in C you *don't* need to do the ugly indexing arithmetic explicitly, that's exactly the point of OP's question. Almost all languages of the era supported higher-ranked arrays first-class. Performance was a much bigger deal then, after all.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26319371

http://stackoverflow.com/comment/41310097
has text: Thanks so much. But why I should use Object o as parameter instead of Pair o?
comment on: http://stackoverflow.com/a/26322540
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26266195
answer count: 2
possible better answer: http://stackoverflow.com/a/26266301
accepted answer: http://stackoverflow.com/a/26266286
downvote count: 0
has answer: http://stackoverflow.com/a/26266301
favorite count: 0
has title: Java - Round number up so number of digits increments
has comment: http://stackoverflow.com/comment/41207184
has comment: http://stackoverflow.com/comment/41207262
has comment: http://stackoverflow.com/comment/41207463
type: AnsweredQuestion
tagged with: performance
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26266286
has body: What is the most efficient way (in Java) to round a number n up to the nearest power of ten which contains one more digit than the original number? e.g. 3 -> 10 432 -> 1,000 241,345 -> 1,000,000 Is there a way to get it in a single O(1) line? A simple way I can see is to use a for loop and increment the power of ten until n / (10 ^ i) &lt; 1, but then that isn't O(1) and is O(log n) instead. (well I'm taking a guess it's log n as it involves a power!)
type: Question
tagged with: rounding
has comment: http://stackoverflow.com/comment/41207439

http://stackoverflow.com/q/26323390
has comment: http://stackoverflow.com/comment/41313002
has comment: http://stackoverflow.com/comment/41311706
has comment: http://stackoverflow.com/comment/41312741
has comment: http://stackoverflow.com/comment/41313066
has comment: http://stackoverflow.com/comment/41311510
has comment: http://stackoverflow.com/comment/41311534
has comment: http://stackoverflow.com/comment/41311644
tagged with: date
has comment: http://stackoverflow.com/comment/41311556
answer count: 2
has comment: http://stackoverflow.com/comment/41311843
tagged with: user-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/41311674
score: 7
has answer: http://stackoverflow.com/a/26324394
favorite count: 0
linked to: http://stackoverflow.com/q/8589485
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41311575
has answer: http://stackoverflow.com/a/26324199
tagged with: swing
has comment: http://stackoverflow.com/comment/41311688
has comment: http://stackoverflow.com/comment/41313053
has comment: http://stackoverflow.com/comment/41311622
has comment: http://stackoverflow.com/comment/41312314
has comment: http://stackoverflow.com/comment/41312773
has comment: http://stackoverflow.com/comment/64501936
tagged with: java
has title: Date Picker GUI component for Java Swing
upvote count: 7
has body: I am sure this question has been asked before, but I could not find the answer. I am seeking for a Date Picker GUI component which I can drag and drop from Netbeans IDE. I found the below. http://toedter.com/software/ - This is not free for commercial use. http://plugins.netbeans.org/plugin/658/jdatechooser-1-2 - This has issues, the dates are invisible. So anyone know whether there is a free for commercial use Date Picker component for Java, which we can drag and drop from Netbeans?
has comment: http://stackoverflow.com/comment/41311634
has comment: http://stackoverflow.com/comment/41311567
type: Question

http://stackoverflow.com/q/26233227
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/41146041
has comment: http://stackoverflow.com/comment/41146449
has comment: http://stackoverflow.com/comment/41146542
score: 0
has comment: http://stackoverflow.com/comment/41146801
has title: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
has comment: http://stackoverflow.com/comment/41145976
tagged with: android
has comment: http://stackoverflow.com/comment/41146281
has body: I’ve added a fragment to my main layout. But when i lunch it the app crash and the error log show this: android.view.InflateException: Binary XML file line #16: Error inflating class fragment. I think i have do all things right but I don't where is the error :/. My Main Layout : <ListView android:id="@+id/homeList" android:layout_width="fill_parent" android:layout_height="wrap_content" android:dividerHeight="1dp" android:choiceMode="singleChoice" android:listSelector="@drawable/list_row_selector" /> <fragment android:layout_width="fill_parent" android:layout_height="wrap_content" android:name="com.example.user.unchained.FooterHome" android:id="@+id/homeFooter" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" tools:layout="@layout/footer_home" /> My Fragment : <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="What's New ?" android:textSize="16dip" android:layout_marginTop="12dip" android:layout_marginLeft="10dip" android:drawableLeft="@drawable/status" android:id="@+id/watsN" android:textColor="@color/connexion_button" android:layout_gravity="left|top" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text=" | " android:textSize="25dip" android:layout_marginTop="6dip" android:layout_marginLeft="145dip" android:textColor="@color/connexion_button" android:layout_gravity="left|top" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="Check In" android:textSize="16dip" android:layout_marginTop="12dip" android:layout_marginLeft="165dip" android:drawableLeft="@drawable/checkin" android:id="@+id/checkIn" android:textColor="@color/connexion_button" android:layout_gravity="left|top" /> <TextView andr…
has comment: http://stackoverflow.com/comment/41146157
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41146742
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41147129
has comment: http://stackoverflow.com/comment/41146615
type: Question
tagged with: android-layout

http://stackoverflow.com/a/26344582
type: Answer
has body: You should use a monitor for this task. It allows you to wait for a specific time on a monitor (note that it has a wait with a timeout overload), the trick is that while you are waiting on a monitor- the wait can be interrupted in two cases- either the time elapses or somebody calls notify on the monitor object. A basic usage example: final Object mon = new Object(); // This thread waits on a monitor for 1000msec, unless the other guy wakes him up first... new Thread(new Runnable() { @Override public void run() { try { System.out.println("Sleep 1000"); synchronized (mon) { mon.wait(1000); } } catch (InterruptedException e) { } } }).start(); // this thread will flip a coin and wake up the waiting thread if it hits tails new Thread(new Runnable() { @Override public void run() { if (new Random().nextBoolean()) { System.out.println("Wake early!"); synchronized (mon) { mon.notify(); } } } }).start(); Have a look at this answer for a more elaboration.
score: 0
answers question: http://stackoverflow.com/q/26344149

http://stackoverflow.com/comment/41350502
type: QuestionComment
comment on: http://stackoverflow.com/q/26336029
has text: Thanks @BijuKunjummen, still it doesn't link with .js file, I can't figure it out, where I am going wrong. Thanks for your directions -
score: 0
type: Comment

http://stackoverflow.com/comment/41315061
type: AnswerComment
has text: @user2485710: On some IDEs (for example, Visual Studio), you need to enable the RTTI option in the project settings, but that indeed has nothing to do with the C++ language standard.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26325334

http://stackoverflow.com/q/26321500
has answer: http://stackoverflow.com/a/26321551
has answer: http://stackoverflow.com/a/26321544
tagged with: binary-search-tree
type: UnansweredQuestion
has title: Return the height of a binary search tree
tagged with: java
type: Question
answer count: 2
score: 0
has body: I have two classes, BSTSet and BSTNode, which both have a height() method that returns the height. I'm getting a stackoverflow error and unsure as to what is causing it. BSTSet public class BSTSet &lt;E extends Comparable&lt;E&gt;&gt; extends AbstractSet &lt;E&gt; { // the root of the supporting binary search tree private BSTNode&lt;E&gt; root; // number of elements in the set private int count = 0; public boolean isEmpty() { return count == 0; } public int size() { return count; } public int height() { if(root == null) return -1; else return root.height(); } } BSTNode public class BSTNode &lt;E extends Comparable&lt;E&gt;&gt; { private E value; private BSTNode&lt;E&gt; left; public BSTNode&lt;E&gt; right; public BSTNode(E value) { this.value = value; } public E getValue() { return value; } public BSTNode&lt;E&gt; getLeft() { return left; } public BSTNode&lt;E&gt; getRight() { return right; } public int height() { if(left == null &amp;&amp; right == null) return 0; if(left != null &amp;&amp; right == null) {UI.println("left");return left.height()+ 1; } else if(right != null &amp;&amp; left == null){UI.println("right");return right.height()+ 1;} else{UI.println("both"); return Math.max(right.height(), left.height()) + 1;} } } If you would like anymore code or need anymore information please feel free to ask.

http://stackoverflow.com/comment/41102129
score: 0
comment on: http://stackoverflow.com/a/26199239
type: Comment
has text: @LesterMurillo, as I stated in my answer. A maximize will only generate a single paint request. And if you use my suggestion for for setting the dynamic layout then resizing the frame will also only generate one paint request when the mouse is released. This should not affect your game unless your painting code is changing the state of your game which is should not do. The only other suggestion I have is to take a look at [Full Screen Exclusive Mode API](http://docs.oracle.com/javase/tutorial/extra/fullscreen/index.html).
type: AnswerComment

http://stackoverflow.com/q/26216142
has comment: http://stackoverflow.com/comment/41116951
tagged with: eclipse-plugin
favorite count: 0
upvote count: 2
has title: NumberFormatException on eclipse start
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26447270
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/26216343
accepted answer: http://stackoverflow.com/a/26447270
has answer: http://stackoverflow.com/a/26216343
downvote count: 0
has body: I'm a novice at Java and eclipse IDE. I'm trying to create a plugin to my installed eclipse 4.4.0 by the official IBM article. I've added plug-in description to the plugin.xml: &lt;extension point="org.eclipse.debug.core.launchConfigurationTypes"&gt; &lt;launchConfigurationType name="MyConfiguration" delegate="com.myplugin.first.launching.MyLaunchConfiguration" modes="run, debug" id="com.myplugin.first.launching.myConfiguration"&gt; &lt;/launchConfigurationType&gt; &lt;/extension&gt; and I've created empty configuration delegate with required dependencies. Unfortunately I cannot launch a new eclipse application with my plugin because every time I get the following error: java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at org.eclipse.osgi.storagemanager.StorageManager.updateTable(StorageManager.java:511) at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:708) at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:1747) at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:1764) at org.eclipse.osgi.storage.Storage.(Storage.java:124) at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:84) at org.eclipse.osgi.internal.framework.EquinoxContainer.(EquinoxContainer.java:75) at org.eclipse.osgi.launch.Equinox.(Equinox.java:31) at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:297) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:232) 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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648) at org.eclipse.equinox.launcher.Main.basicRun(Main.java…
answer count: 3
score: 2
has answer: http://stackoverflow.com/a/77666701

http://stackoverflow.com/comment/76445909
has text: As of Jun 23 2017, I run `brew cask search java7` but got No Cask found for "java7".
comment on: http://stackoverflow.com/a/29195815
score: 20
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26276529
downvote count: 1
has comment: http://stackoverflow.com/comment/41225520
score: -1
answers question: http://stackoverflow.com/q/26276457
upvote count: 0
type: Answer
has body: You're only incrementing rounds, in a roundabout way, when the loop runs. The loop runs while i &lt;= 0 - i starts equal to money, which equals 200, so the loop never runs and the rounds value is not incremented. You're also not changing i in the loop - I suspect you'd rather want while i &gt;= 0 and decrement i in the loop? for (int i = money; i &gt;= 0; rounds++) { money = money-costTogether; i--; }

http://stackoverflow.com/comment/41085831
type: AnswerComment
type: Comment
has text: Ok i used your suggestion and my constructor is running but my other methods are not?
comment on: http://stackoverflow.com/a/26200791
score: 0

http://stackoverflow.com/a/26335649
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: (xmlResponce \\ "temperature" \\ "@value").text.toInt
accepted answer of: http://stackoverflow.com/q/26335351
answers question: http://stackoverflow.com/q/26335351

http://stackoverflow.com/comment/41174713
comment on: http://stackoverflow.com/a/26247340
score: 0
type: AnswerComment
type: Comment
has text: Thanks, that's definitely helpful. It accomplishes trimming a wav file using basically the same approach that I am. I may have solved the major issue in my code, but I'm not sure why. See my edits in the original post.

http://stackoverflow.com/q/26256466
type: Question
answer count: 2
tagged with: arrays
duplicate of: http://stackoverflow.com/q/153724
has answer: http://stackoverflow.com/a/26256638
has answer: http://stackoverflow.com/a/26256524
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41188536
favorite count: 0
linked to: http://stackoverflow.com/q/153724
type: UnansweredQuestion
tagged with: double
has body: I cannot find any pattern rounding off doubles in an array. I am trying to make a program that will input a double like grades,money etc., and round it off in a whole number.
tagged with: java
has title: I would like to know how to round off numbers in an array
has comment: http://stackoverflow.com/comment/41188538

http://stackoverflow.com/comment/41310915
score: 0
type: AnswerComment
type: Comment
has text: I do not know what JSON is. The data is supposed to be read in from a file in that format. The edges creation you see up top was provided by my teacher. It was supposed to be used to test until I figure out how to read the input from the the file.
comment on: http://stackoverflow.com/a/26323085

http://stackoverflow.com/q/26214597
has title: Can`t run spark app because of java.lang.NoClassDefFoundError: org/postgresql/Driver
score: 2
favorite count: 0
tagged with: postgresql
linked to: http://stackoverflow.com/q/24916852
type: Question
tagged with: apache-spark
has comment: http://stackoverflow.com/comment/41113580
has comment: http://stackoverflow.com/comment/41113489
has body: I can`t run mt Spark app because java.lang.NoClassDefFoundError: org/postgresql/Driver I did same like How can I connect to a postgreSQL database into Apache Spark using scala? but when I try to start my app I get this Exception. Exception in thread "main" java.lang.NoClassDefFoundError: org/postgresql/Driver at SparkRecommendationMatrix.&lt;init&gt;(SparkRecommendationMatrix.scala:31) at Main$.main(Main.scala:26) at Main.main(Main.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:292) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:55) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala) Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 10 more My bild.sbt file: name := "untitled12" version := "1.0" scalaVersion := "2.10.4" libraryDependencies ++= Seq( "org.postgresql" % "postgresql" % "9.2-1003-jdbc4", "org.apache.spark" % "spark-mllib_2.10" % "1.0.0" ) resolvers += "Akka Repository" at "http://repo.akka.io/releases/" and my java code val classes = Seq( getClass, // To get the jar with our own code. classOf[org.postgresql.Driver] // To get the connector. ) val jars = classes.map(_.getProtectionDomain().getCodeSource().getLocation().getPath()) // set up environment val conf = new SparkConf().setAppName(name).setJars(jars) //.setMaster("spark://192.168.10.122:7077") val sc…
has answer: http://stackoverflow.com/a/48814681
linked to: http://stackoverflow.com/q/34413
upvote count: 3
has comment: http://stackoverflow.com/comment/47163322
downvote count: 1
answer count: 1
tagged with: java
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/34413

http://stackoverflow.com/a/26230763
has comment: http://stackoverflow.com/comment/41141968
has comment: http://stackoverflow.com/comment/41142685
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41142040
downvote count: 0
has comment: http://stackoverflow.com/comment/41142343
accepted answer of: http://stackoverflow.com/q/26230719
has body: Your producer and consumer are each synchronizing, waiting and notifying their own monitor. You need to give them a shared monitor to use for synchronization etc. For example: Object monitor = new Object(); product pro = new product(); producer produce = new producer(monitor, pro); consumer consume = new consumer(monitor, pro); Change both the producer and consumer constructors to accept another parameter (of type Object) and save it in a field, then change synchronized(this) to synchronized(monitor), wait() to monitor.wait() and notify() to monitor.notify() and all will be well. (You could just use product to synchronize on, but personally I prefer to use an object which is only used for synchronization, or an object of a thread-centric class designed specifically for this.) Also, note that your code feels very un-Java-like due to your class names, which should be Product, Producer and Consumer to follow normal Java naming conventions.
type: Answer
answers question: http://stackoverflow.com/q/26230719
score: 2
has comment: http://stackoverflow.com/comment/41142416
upvote count: 2
has comment: http://stackoverflow.com/comment/41143997

http://stackoverflow.com/comment/41137953
comment on: http://stackoverflow.com/q/26201964
score: 0
has text: 1 - you must make replace the name (from long name to shorter one) in ALL occurence in the WSDL 2 - in case the WSDL import XSD, the same change must be done in also in the XSD. (this means downloading the XSD edit it in local + change the path in the WSDL)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26253651
has comment: http://stackoverflow.com/comment/41183720
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41183991
has title: Disabled conditions in Jsp not working as expected?
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41184065
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41183893
has body: I have to disable one input text field based on some condtions. Below is the code. &lt;h:inputText maxlength="14" id="adjusAuthAmt" value="#{Budget.fundCodeVO.adjustedAuthorizedAmount}" disabled="#{!Budget.enableBudgetAmt || Budget.controlRequired || Budget.fundCodeVoidProtect}" onchange="javascript:isFormChanged()" onblur="this.value=validateAmountCurrency(this.value,this.id,11);javascript:selectOne=true;javascript:fileSavedFlag=false;" /&gt; Here, Budget.enableBudgetAmt is false now. But it still showing in editable mode. Requirement is If the boolean variable enableBudgetAmt is false then i have to disable this input field. Please tell me what is the simple thing that i missed here... Thanks in Advance...
tagged with: jsp

http://stackoverflow.com/a/26280685
type: Answer
has comment: http://stackoverflow.com/comment/41233285
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26280571
has comment: http://stackoverflow.com/comment/41233658
downvote count: 0
has body: I think faces is an empty array. So faces[i] is null. Try something like this first: for(int i = 0; i &lt; 6; i++) { faces[i] = new Geometry(); }

j2objc
tags question: http://stackoverflow.com/q/26334981
tag name: j2objc
type: Tag

http://stackoverflow.com/a/26239416
type: Answer
has comment: http://stackoverflow.com/comment/41157709
answers question: http://stackoverflow.com/q/26239168
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26239168
has body: Wouldn't the first 'particlesRemaining' be the max value? then you could do: //in class variables int maxValue=0; //method counting progress public static double countProgress(int particlesRemaining) { //???how to set maxValue??? if(maxValue&lt;particlesRemaining) { maxValue=particlesRemaining;} double temp = 100 / maxValue * (maxValue - particlesRemaining); return temp; } } Don't forget if you use it several times you need reset maxValue before use
has comment: http://stackoverflow.com/comment/41158061
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26239337
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26239448
has body: I am new to this automated build stuff... why is there a 'debug' version for Android Gradle? I dont see the need for it because we can simply create a project, and run it in debug mode(step through the code...etc)... they why even have a debug mode version ? also.. if i understand it correctly.. this whole gradle thing is so that... we can compile the project 2-3 times a day just to make sure it can compile.. because people are adding code to it... is that correct ? I tried to look through some documentation but it was really difficult to understand.
tagged with: android
type: UnansweredQuestion
score: -3
upvote count: 1
has title: new to gradle - why is there a dubug mode and release mode
tagged with: java
tagged with: gradle
type: Question
downvote count: 4

http://stackoverflow.com/comment/41125278
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26221104
has text: I know it is case sensitive, before executing any statement, I am executing toUpperCase(), all the database is on upper case

http://stackoverflow.com/a/26294014
has body: No, its a compile time error. Incorrect number of arguments for type List; it cannot be parameterized with arguments &lt;>
downvote count: 0
answers question: http://stackoverflow.com/q/26293874
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/26267117
has body: I have a program which asks the user to input a value between 1 and 6. However, if they don't ask between that range, I would like the program to ask the user to input again. I have other code within the method, so I can't just point to the method. System.out.print("Now enter a number between 1 and 6 "); dieNumber = keyboard.nextInt(); if (dieNumber == 1){ drawOne(pane); } else if (dieNumber == 2){ drawTwo(pane); } else if (dieNumber == 3){ drawThree(pane);} else if (dieNumber == 4){ drawFour(pane); } else if (dieNumber == 5){ drawFive(pane); } else if (dieNumber == 6){ drawSix(pane); }
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/41208998
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/41209199
answer count: 3
has answer: http://stackoverflow.com/a/26267428
has comment: http://stackoverflow.com/comment/41209257
tagged with: while-loop
has title: Pointing to specific line in program with if statement? Java
has answer: http://stackoverflow.com/a/26267308
has answer: http://stackoverflow.com/a/26267301
has comment: http://stackoverflow.com/comment/41209187
score: 0
type: UnansweredQuestion

http://stackoverflow.com/a/31987263
score: 2
has body: I'm combining the insight I gained from these two questions: How does ServiceLocator find @Service and @Contact automatically in HK2? jersey + grizzly + hk2: Dependency injection, but not into resource Firstly, use the HK2 Metadata Generator (or the Inhabitant Generator) in your build chain (as you do already). This will scan your source and create META-INF/hk2-locator/default. Secondly, create a new ServiceLocator, populated with the services from the metadata: ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator(); Now pass it to Grizzly. Quoting @peeskillet: Jersey has it's own ServiceLocator, and it's not easy to try a obtain a reference to it. We could give Jersey our ServiceLocator, but Jersey ultimately still creates it's own locator and will populate it with our locator. ResourceConfig config = new MyApplicationConfig(); HttpServer server = GrizzlyHttpServerFactory.createHttpServer( URI.create(BASE_URI), config, serviceLocator );
answers question: http://stackoverflow.com/q/26230642
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/41237051
type: Comment
comment on: http://stackoverflow.com/a/26281624
type: AnswerComment
has text: You were right; that was the line that I let and which made the wrong constructor
score: 0

http://stackoverflow.com/a/26218385
score: 0
answers question: http://stackoverflow.com/q/26218090
type: Answer
has body: Not sure anymore, but try this: WritableCell cell = sheet2.getWritableCell(i, j); NumberFormat twodecs = new NumberFormat("#.##"); WritableCellFormat cellFormat = new WritableCellFormat(twodecs); cell.setFormat(cellFormat);
has comment: http://stackoverflow.com/comment/41333672

http://stackoverflow.com/a/41584087
downvote count: 0
score: 1
type: Answer
has body: BlockFrame (on GitHub) is another layout framework for PDFBox, filling a different space to PDFBox-Layout. PDFBox-Layout seems oriented to text, but BlockFrame is designed for complex data structures. It's also designed with extensibility in mind. I needed something to print crosswords I'd generated, and wound up coding a framework. If there's interest, I'll extend and maintain it. It should be possible to use BlockFrame to draw small, complex sections of larger PDF documents, as well as generate an entire PDF. Feedback would be appreciated.
upvote count: 1
answers question: http://stackoverflow.com/q/26238771
has comment: http://stackoverflow.com/comment/70378444

http://stackoverflow.com/q/26263678
tagged with: fileinputstream
tagged with: bufferedreader
tagged with: readfile
favorite count: 0
has comment: http://stackoverflow.com/comment/41202523
type: UnansweredQuestion
score: -1
tagged with: java.util.scanner
has title: Reading Text File in java while preserving white spaces using scanner class
tagged with: java
downvote count: 2
has body: I want to read this text file and store the data in a 2D Array. Each white space should be replaced with a 0, resulting in a final matrix of 0s and 1s. The problem that is occurring is that Scanner ignored all the white spaces and put only the 1s in the matrix. This is text/input file. 1111 111111 111 111 1 111111 11 111 11 1111 111 111 111 1 1 11111 111 1 11 11 11111 1111 111 11111111 1111 11111 111 1 11 11111 111 111 1111 111 1111 111 1111 11111 111111 111 11 11 11111 111 1111 11 11111 1111 11111 1111 11 11 1111 111 111 1 111 11 1111 111111 1111 111 1111 1111 111 1111 1111 11 1111 1111 1111 111111 11111 111 11111 1111 1111 Scanner fileScanner = new Scanner(new File("D:\Assignment.txt")); int [][] inputMatrix= new int[200][200]; int i=0,j=0; while (fileScanner.hasNextLine()) { String line = fileScanner.nextLine(); Scanner lineScanner = new Scanner(line); while (lineScanner.hasNext()) { int token = Integer.parseInt(lineScanner.next()); inputMatrix[i][j]=token; // do whatever needs to be done with token j++; } lineScanner.close(); i++; j=0; // you're at the end of the line here. Do what you have to do. } fileScanner.close();
upvote count: 1
linked to: http://stackoverflow.com/q/12994342
has comment: http://stackoverflow.com/comment/41203142
type: Question
has comment: http://stackoverflow.com/comment/41202159
has answer: http://stackoverflow.com/a/26263834
has comment: http://stackoverflow.com/comment/41202240
has comment: http://stackoverflow.com/comment/41202343
answer count: 2
has answer: http://stackoverflow.com/a/26263787

http://stackoverflow.com/q/26293855
type: UnansweredQuestion
has title: Writing two arrays to a text file
downvote count: 1
has body: Two final arrays have to be written to a .txt file, so that you get the first object in one array and the first object in the second array written one after another. Trying to write to text files confuses me enough as it is, but having to write two arrays one after another... So if array 1 had "A, B, C" and the second had "1, 2, 3", the final output would be - A 1 - B 2 - C 3 I feel like it would have something to do with making a File and the System.out command, but I'm not sure how to do it...
type: Question
tagged with: java
score: -1
answer count: 3
linked to: http://stackoverflow.com/q/2885173
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/26293947
has answer: http://stackoverflow.com/a/26293912
has answer: http://stackoverflow.com/a/26293925
has comment: http://stackoverflow.com/comment/41257592
upvote count: 0
has comment: http://stackoverflow.com/comment/41257533

http://stackoverflow.com/q/26268902
tagged with: listview
type: Question
answer count: 1
score: 0
tagged with: android-listview
has body: my question is how can i do something when the user touches a row on the ListView My app loads a json file and parses it using the Volley Library then everything is loaded nicely on a custom list row But when I hit a row it does nothing Really annoying thing ... Im using a custom view and it has been impossible to assign the OnListItemClick Here is my code //all necessary libraries here public class InicioPasajero extends Activity { private static final String TAG = InicioPasajero.class.getSimpleName(); // Movies json url private static final String url = "URL_RETURNING_JSON"; private ProgressDialog pDialog; private List&lt;Movie&gt; movieList = new ArrayList&lt;Movie&gt;(); private ListView listView; private CustomListAdapter adapter; ImageButton b_ajustes; ImageButton b_filtros; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_inicio_pasajero); b_ajustes= (ImageButton) findViewById(R.id.Bajustes); b_filtros= (ImageButton) findViewById(R.id.Bfiltros); b_ajustes.setOnClickListener(new View.OnClickListener(){ public void onClick(View view){ Intent a=new Intent(InicioPasajero.this, MiPerfil.class); startActivity(a); } }); listView = (ListView) findViewById(R.id.list); adapter = new CustomListAdapter(this, movieList); listView.setAdapter(adapter); pDialog = new ProgressDialog(this); // Showing progress dialog before making http request pDialog.setMessage("Cargando..."); pDialog.show(); // changing action bar color // Creating volley request obj JsonArrayRequest movieReq = new JsonArrayRequest(url, new Response.Listener&lt;JSONArray&gt;() { @Override public void onResponse(JSONArray response) { Log.d(TAG, response.toString()); hidePDialog(); // Parsing json for (int i = 0; i &lt; response.length(); i++) { try { JSONObject obj = response.getJSONObject(i); Movie movie = new Movie(); movie.setTitle(obj.getString("n")); movie.setThumbnailUrl(obj.getString("i")); movie.setRating(obj.getString(…
tagged with: android
has answer: http://stackoverflow.com/a/26269011
accepted answer: http://stackoverflow.com/a/26269011
has title: Row selection ListView Android
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26236732
score: 0
has comment: http://stackoverflow.com/comment/41154030
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41173441
type: Answer
has comment: http://stackoverflow.com/comment/41155760
accepted answer of: http://stackoverflow.com/q/26236386
has comment: http://stackoverflow.com/comment/41153102
has comment: http://stackoverflow.com/comment/41153331
has body: It tries to find 'env' property in properties file now. You have missed to use systemPropertiesModeName method on PropertyPlaceholderConfigurer which will make your @Value("#{ systemProperties['env'] }") valid. //edit: dont use @Autowired on static fields. //edit 2: This is what im using: @Configuration public class PropertiesConfig { @Bean public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return PropertyLoadHelper.getPropertySourcesPlaceholderConfigurer(); } public static class PropertyLoadHelper { public static PropertySourcesPlaceholderConfigurer getPropertySourcesPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer properties = new PropertySourcesPlaceholderConfigurer(); properties.setLocations(new ClassPathResource[]{ new ClassPathResource("config/app." + System.getenv("ENV") + "properties"), new ClassPathResource("config/local.app." + System.getenv("ENV") + "properties"), new ClassPathResource("config/application.properties") }); properties.setBeanName("app"); properties.setLocalOverride(true); properties.setIgnoreResourceNotFound(true); return properties; } public static Properties loadProperties(String propertiesPath) { PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(); propertiesFactoryBean.setLocation(new ClassPathResource(propertiesPath)); Properties properties = null; try { propertiesFactoryBean.afterPropertiesSet(); properties = propertiesFactoryBean.getObject(); } catch (IOException e) { e.printStackTrace(); } return properties; } } } differences: PropertySourcesPlaceholderConfigurer used, System.getenv used instead Autowired Environment. Maybe Environment cant be used before setting PropertyPlaceHolder bean?
answers question: http://stackoverflow.com/q/26236386

http://stackoverflow.com/q/26204289
accepted answer: http://stackoverflow.com/a/26220475
possible better answer: http://stackoverflow.com/a/26204364
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26204364
tagged with: java
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/26204789
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/26220475
answer count: 3
tagged with: url
has title: Why I'm getting different results using url and absolute file name?
tagged with: getresource
has body: I am new in Java and facing a problem aceessing a file. I have a package named "FileOperation" uses a "boom.txt" file(Location: "FileOperation/files/boom.txt"). What I wanted to do was to access the file from a class "MyTextPanel" (Location: "FileOperation/MyTextPanel.java"). I have created 2 methods for this purpose. One is by getClass.getResource(path) and other is by giving the absolute location of the file. Second method works, first doesn't. Someone please explain, what's the problem with the first method. Here is the class MyTextPanel: package FileOperaton; import java.awt.BorderLayout; import java.io.FileReader; import java.net.URL; import javax.swing.JPanel; import javax.swing.JTextArea; public class MyTextPanel extends JPanel { JTextArea textArea; MyTextPanel() { setLayout(new BorderLayout()); textArea=new JTextArea(); add(textArea,BorderLayout.CENTER); String fileName; fileName=getFileName1(); //fileName=getFileName2(); System.out.println("File Name = "+fileName); if(fileName!=null) { try { FileReader fr=new FileReader(fileName); System.out.println("Access Successful"); } catch (Exception e) { e.printStackTrace(); } } } private String getFileName1() { URL url=getClass().getResource("/files/boom.txt"); System.out.println("by getFileName1()"); if(url!=null) return url.getFile(); return null; } private String getFileName2() { String absolutePath="E:\\Project Eclipse\\Workspace\\FileOperation\\src\\FileOperaton\\files\\boom.txt"; System.out.println("by getFileName2()"); return absolutePath; } } And here are the outputs: by getFileName1() File Name =/E:/Project%20Eclipse/Workspace/FileOperation/bin/FileOperaton/files/boom.txt java.io.FileNotFoundException: E:\Project%20Eclipse\Workspace\FileOperation\bin\FileOperaton\files\boom.txt (The system cannot find the path specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileInputStream.&lt;init&gt;(Unknown Source) at java.io.FileReader.&lt;init…

multithreading
tags question: http://stackoverflow.com/q/26347408
tags question: http://stackoverflow.com/q/26341261
tags question: http://stackoverflow.com/q/26198751
tags question: http://stackoverflow.com/q/26279672
tags question: http://stackoverflow.com/q/26246395
tags question: http://stackoverflow.com/q/26336154
tags question: http://stackoverflow.com/q/26340616
type: Tag
tags question: http://stackoverflow.com/q/26328078
tags question: http://stackoverflow.com/q/26226819
tags question: http://stackoverflow.com/q/26295525
tags question: http://stackoverflow.com/q/26343997
tags question: http://stackoverflow.com/q/26289879
tags question: http://stackoverflow.com/q/26281343
tags question: http://stackoverflow.com/q/26322518
tags question: http://stackoverflow.com/q/26343362
tags question: http://stackoverflow.com/q/26316209
tags question: http://stackoverflow.com/q/26270960
tags question: http://stackoverflow.com/q/26231385
tags question: http://stackoverflow.com/q/26336159
tags question: http://stackoverflow.com/q/26249400
tags question: http://stackoverflow.com/q/26198788
tags question: http://stackoverflow.com/q/26196037
tags question: http://stackoverflow.com/q/26326346
tags question: http://stackoverflow.com/q/26311103
tags question: http://stackoverflow.com/q/26236815
tags question: http://stackoverflow.com/q/26324136
tags question: http://stackoverflow.com/q/26204152
tags question: http://stackoverflow.com/q/26201449
tags question: http://stackoverflow.com/q/26237121
tags question: http://stackoverflow.com/q/26206520
tags question: http://stackoverflow.com/q/26195563
tags question: http://stackoverflow.com/q/26237662
tags question: http://stackoverflow.com/q/26258716
tags question: http://stackoverflow.com/q/26337684
tags question: http://stackoverflow.com/q/26309895
tags question: http://stackoverflow.com/q/26252794
tags question: http://stackoverflow.com/q/26296035
tags question: http://stackoverflow.com/q/26244755
tags question: http://stackoverflow.com/q/26202774
tags question: http://stackoverflow.com/q/26297109
tags question: http://stackoverflow.com/q/26346918
tags question: http://stackoverflow.com/q/26230719
tags question: http://stackoverflow.com/q/26324407
tags question: http://stackoverflow.com/q/26230524
tags question: http://stackoverflow.com/q/26277751
tags question: http://stackoverflow.com/q/26352707
tags question: http://stackoverflow.com/q/26311424
tags question: http://stackoverflow.com/q/26198654
tags question: http://stackoverflow.com/q/26198519
tags question: http://stackoverflow.com/q/26277572
tags question: http://stackoverflow.com/q/26229387
tags question: http://stackoverflow.com/q/26313655
tags question: http://stackoverflow.com/q/26268083
tags question: http://stackoverflow.com/q/26255221
tags question: http://stackoverflow.com/q/26221220
tags question: http://stackoverflow.com/q/26265002
tags question: http://stackoverflow.com/q/26215371
tags question: http://stackoverflow.com/q/26326455
tags question: http://stackoverflow.com/q/26238275
tags question: http://stackoverflow.com/q/26218722
tags question: http://stackoverflow.com/q/26268632
tags question: http://stackoverflow.com/q/26203375
tags question: http://stackoverflow.com/q/26299415
tags question: http://stackoverflow.com/q/26208640
tags question: http://stackoverflow.com/q/26269209
tags question: http://stackoverflow.com/q/26206487
tags question: http://stackoverflow.com/q/26344617
tags question: http://stackoverflow.com/q/26244720
tags question: http://stackoverflow.com/q/26250392
tags question: http://stackoverflow.com/q/26325865
tags question: http://stackoverflow.com/q/26196453
tags question: http://stackoverflow.com/q/26302502
tags question: http://stackoverflow.com/q/26298932
tags question: http://stackoverflow.com/q/26261731
tags question: http://stackoverflow.com/q/26260233
tags question: http://stackoverflow.com/q/26345903
tags question: http://stackoverflow.com/q/26232733
tags question: http://stackoverflow.com/q/26337742
tags question: http://stackoverflow.com/q/26345092

http://stackoverflow.com/q/26268048
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Object.bindProperties() Method of Nashorn
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: nashorn
tagged with: javascript
has body: I have two questions about the Object.bindProperties() method in Nashorn: Is there a comprehensive documentation for this method, except at https://wiki.openjdk.java.net/display/Nashorn/Nashorn+extensions#Nashornextensions-loadWithNewGlobal ? Is it a bug as shown below? The following code does not bind the x, y, and z properties of obj2 to obj because obj already has properties with the same names. Is it documented somewhere? var obj = {x:10, y:20, z:30}; var obj2 = {x:100, y:200, z:300}; // bind properties of 'obj2' to 'obj' Object.bindProperties(obj, obj2); print(obj.x, obj.y, obj.z); print(obj2.x, obj2.y, obj2.z); --------------------------------- 10 20 30 100 200 300 -------------------------------- Now, let us add a new property to obj2. The new property is bound to obj, but obj reads the new property's value as null: var obj = {x:10, y:20, z:30}; var obj2 = {x:100, y:200, z:300}; // Add a new property to obj2 obj2.u = 600; // bind properties of 'obj2' to 'obj' Object.bindProperties(obj, obj2); print(obj.x, obj.y, obj.z, obj.u); // obj.u is null. Why? print(obj2.x, obj2.y, obj2.z, obj2.u); --------------------------------- 10 20 30 null 100 200 300 600 -------------------------------- And, here is another variant of the code that works. This time, I started the target object as empty. Now, adding the new property to the source works fine. var obj = {}; var obj2 = {x:100, y:200, z:300}; // Add a new property to obj2 obj2.u = 600; // bind properties of 'obj2' to 'obj' Object.bindProperties(obj, obj2); print(obj.x, obj.y, obj.z, obj.u); // obj.u is correct.It is 600 print(obj2.x, obj2.y, obj2.z, obj2.u); ---------------------------- 100 200 300 600 100 200 300 600 ---------------------------- I am using JDK version 1.8.0_20. Thanks Kishori
has answer: http://stackoverflow.com/a/30041857

http://stackoverflow.com/a/26215443
has comment: http://stackoverflow.com/comment/41113064
answers question: http://stackoverflow.com/q/26215365
type: Answer
has comment: http://stackoverflow.com/comment/41113160
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/41113360
has body: Go through the following code public class OddNumberLoop { public static void main(String[] args) { String st1 = "Helly there bla bla"; String st2 = st1.substring(0, st1.length() - 2); System.out.println(st2); } } Good Luck !!!
score: 0

http://stackoverflow.com/q/26299842
has answer: http://stackoverflow.com/a/26300032
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41268658
has answer: http://stackoverflow.com/a/26300226
has title: Can't find files with eclipse
tagged with: java
linked to: http://stackoverflow.com/q/19871955
has answer: http://stackoverflow.com/a/26300028
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26300224
tagged with: fileinputstream
has comment: http://stackoverflow.com/comment/41270963
has comment: http://stackoverflow.com/comment/41268769
linked to: http://stackoverflow.com/q/22470841
score: 0
tagged with: file-io
has body: Okay so I scoured this site and a few others looking for the answer to this problem and tried all of the suggestions. Nothing is working and it keeps throwing the File not found exception. File inFile = new File("PhoneRecords.txt"); String path = inFile.getAbsolutePath(); try { System.setIn(new FileInputStream(path)); } catch (FileNotFoundException e) { e.printStackTrace(); } Scanner sc = new Scanner(System.in); After this it tries to use the Scanner in a method below. public static PhoneCall readNextPhoneCall(Scanner sc){ return new PhoneCall (sc.nextDouble(), sc.nextInt()); } The text file is in the same directory that I am working in and I double made sure that I name it correctly in my code. Please Help.
has comment: http://stackoverflow.com/comment/41268718
answer count: 4

http://stackoverflow.com/comment/41326941
type: Comment
comment on: http://stackoverflow.com/a/26322772
has text: Yes, that is my problem, so do you think is a problem about server? or about the ignored ciphers? or about Java config? thank you for your help.
score: 0
type: AnswerComment

windows
tags question: http://stackoverflow.com/q/26219438
tags question: http://stackoverflow.com/q/26287666
tags question: http://stackoverflow.com/q/26219266
tags question: http://stackoverflow.com/q/26257251
tags question: http://stackoverflow.com/q/26290456
tags question: http://stackoverflow.com/q/26335119
tags question: http://stackoverflow.com/q/26291912
tags question: http://stackoverflow.com/q/26290805
tags question: http://stackoverflow.com/q/26303283
tags question: http://stackoverflow.com/q/26320137
tags question: http://stackoverflow.com/q/26295166
tags question: http://stackoverflow.com/q/26312987
tags question: http://stackoverflow.com/q/26252605
tags question: http://stackoverflow.com/q/26263860
type: Tag
tags question: http://stackoverflow.com/q/26353077
tags question: http://stackoverflow.com/q/26308158
tags question: http://stackoverflow.com/q/26342438
tags question: http://stackoverflow.com/q/26213799
tags question: http://stackoverflow.com/q/26258166
tags question: http://stackoverflow.com/q/26251660
tags question: http://stackoverflow.com/q/26313672
tag name: windows
tags question: http://stackoverflow.com/q/26333803
tags question: http://stackoverflow.com/q/26334368

http://stackoverflow.com/comment/41183906
score: 0
type: Comment
has text: apparently it does....I found the error in my code. I haven't used a matching function like matches() or find(). Thanks a lot :)
comment on: http://stackoverflow.com/a/26253701
type: AnswerComment

http://stackoverflow.com/comment/41318139
comment on: http://stackoverflow.com/a/26324912
has text: The splitByLength is not nessessary, I removed it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41320864
type: QuestionComment
comment on: http://stackoverflow.com/q/26320455
score: 1
has text: @GoranMilovanovic [`com.google.common.collect.ArrayListMultimap`](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/ArrayListMultimap.html): _"When iterating through the collections supplied by this class, the ordering of values for a given key agrees with the order in which the values were added. "._
type: Comment

http://stackoverflow.com/a/26264806
type: Answer
has body: Here is a simple solution in pseudo-code (which happens to be valid Python): def count_unique(arr): arr.sort() count = 1 for i in range(1, len(arr)): if arr[i] != arr[i - 1]: count += 1 return count print count_unique([1,2,3]) print count_unique([1,2,1]) print count_unique([9,8,8,8]) It simply iterates over the sorted array and counts transitions between groups of equal elements. It does not work for the empty array (returns 1 instead of 0). I'll leave fixing that as an exercise for the reader.
answers question: http://stackoverflow.com/q/26264584
score: 0

ejbca
tags question: http://stackoverflow.com/q/26339757
type: Tag
tag name: ejbca

http://stackoverflow.com/comment/41111783
type: Comment
has text: I get this error: `Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285) at java.awt.EventQueue.isDispatchThreadImpl(EventQueue.java:1035) at java.awt.EventQueue.isDispatchThread(EventQueue.java:1030) at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361) at tryout.controlPanel.updateGUI(controlPanel.java:305) at tryout.controlPanel.updateGUI(controlPanel.java:306) at tryout.controlPanel.updateGUI(controlPanel.java:306)` Line 306 is `updateGUI(text);`
comment on: http://stackoverflow.com/a/26214784
score: 0
type: AnswerComment

http://stackoverflow.com/q/26290633
has comment: http://stackoverflow.com/comment/41252089
tagged with: apache
tagged with: spring-tool-suite
has title: My Pivotal tc Server not Start
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26487954
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27641202
downvote count: 0
score: 1
tagged with: java
type: Question
has body: Until a few days ago, my STS worked perfectly, but of a sudden, the Pivotal server does not start, throws me the following error message when you run an application: SEVERE: Class loader creation threw exception java.io.IOException: The filename, directory name, or volume label syntax is incorrect at java.io.WinNTFileSystem.canonicalize0 (Native Method) at java.io.Win32FileSystem.canonicalize (Win32FileSystem.java: 414) at java.io.File.getCanonicalPath (File.java: 618) at java.io.File.getCanonicalFile (File.java: 643) at org.apache.catalina.startup.ClassLoaderFactory.createClassLoader (ClassLoaderFactory.java: 170) at org.apache.catalina.startup.Bootstrap.createClassLoader (Bootstrap.java: 149) at org.apache.catalina.startup.Bootstrap.initClassLoaders (Bootstrap.java: 90) at org.apache.catalina.startup.Bootstrap.init (Bootstrap.java: 226) at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java: 425) They could help me with this problem? From already, thank you very much for your attention and time. Gustavo Echenique
has comment: http://stackoverflow.com/comment/41350854

http://stackoverflow.com/q/26252000
tagged with: james
answer count: 4
has answer: http://stackoverflow.com/a/29424088
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26295064
has answer: http://stackoverflow.com/a/26271948
has answer: http://stackoverflow.com/a/26881957
type: Question
has title: create user accounts in apache james with java api
has body: I need add new users in Apache James mail server using Java API, but in the whole internet there is not any example of how to use it. Only this http://james.apache.org/server/2.3.1/adding_users.html with Java mail API you can send mail to Apache James mailbox read messages, but only that. String user = "user"; // Newly created user on JAMES String password = "user"; // user password String fromAddress = "user@localhost"; // newlycreateduser@localhost String toAddress = "usver@gmail.com"; // Create a mail session Properties properties = new Properties(); properties.put("mail.smtp.host", "localhost"); properties.put("mail.smtp.port", "25"); properties.put("mail.smtp.username", user); properties.put("mail.smtp.password", password); Session session = Session.getDefaultInstance(properties, null); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress(fromAddress)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toAddress)); message.setSubject("Email from our JAMES Server"); message.setText("Hello world again and again"); Transport.send(message); System.out.println("Email sent successfully"); } catch (MessagingException e) { e.printStackTrace(); } Anybody know or used James Java API? Any examples?
tagged with: jakarta-mail
score: 0

http://stackoverflow.com/comment/41225545
comment on: http://stackoverflow.com/a/26276494
has text: This is what his code says. Anyway using a for loop does not seem too appropriated for his case.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41217941
comment on: http://stackoverflow.com/q/26272012
type: Comment
type: QuestionComment
has text: Keep it simple and just create a new instance when you need it. I doubt that this will cause any performance problems.
score: 1

http://stackoverflow.com/a/26277129
has comment: http://stackoverflow.com/comment/41226999
upvote count: 1
answers question: http://stackoverflow.com/q/26277049
downvote count: 0
type: Answer
has body: Yes. Within the JSNI for myFIRSTJsniMethod(), use the normal JSNI syntax for calling a Java method. For example, if these two methods are in the class com.mycompany.Test, you could call mySECONDJsniMethod() like so: public native JavaScriptObject myFIRSTJsniMethod(String name) /*-{ var secondVar = this.@com.mycompany.Test::mySECONDJsniMethod(Ljava/lang/String;)(name); //.. return firstVar; }-*/; See the GWT documentation on Accessing Java Methods and Fields from JavaScript for more information. EDIT: Here is a complete compilable example: package com.mycompany.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.JavaScriptObject; public class SO26277049 implements EntryPoint { @Override public void onModuleLoad() { final JavaScriptObject firstVar = myFIRSTJsniMethod("hello world!"); } public native JavaScriptObject mySECONDJsniMethod(String name) /*-{ var secondVar = { name: name }; return secondVar; }-*/; public native JavaScriptObject myFIRSTJsniMethod(String name) /*-{ var secondVar = this.@com.mycompany.client.SO26277049::mySECONDJsniMethod(Ljava/lang/String;)(name); $wnd.alert(secondVar.name); var firstVar = secondVar; return firstVar; }-*/; }
has comment: http://stackoverflow.com/comment/41227340
score: 1

http://stackoverflow.com/a/26254219
has comment: http://stackoverflow.com/comment/41219980
answers question: http://stackoverflow.com/q/26251585
has comment: http://stackoverflow.com/comment/41233392
type: Answer
has body: How about: ^[a-zA-Z~][a-zA-Z*]{1,4}[a-zA-Z]*$ Explanation: ^ : start of string [a-zA-Z~] : First char can be letter or ~ [a-zA-Z*]{1,4} : char 2 to 5 can be letter or * [a-zA-Z]* : rest of string only letter $ : end of string.
accepted answer of: http://stackoverflow.com/q/26251585
has comment: http://stackoverflow.com/comment/41186606
downvote count: 0
has comment: http://stackoverflow.com/comment/41186489
score: 1
has comment: http://stackoverflow.com/comment/41229872
has comment: http://stackoverflow.com/comment/41186277
has comment: http://stackoverflow.com/comment/41220062
has comment: http://stackoverflow.com/comment/41186226
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26264659
upvote count: 1
type: Question
tagged with: ant
tagged with: eclipse
downvote count: 0
favorite count: 0
has title: how to exclude library project in secondary dex android
type: UnansweredQuestion
tagged with: android
answer count: 0
has body: I am facing 65k method limit exceed, for this i am using secondary dex mechanism, I was created multiple library project , When i tried to create build via ant, it is include all library project and make dex of all library project as well, I am using this to create apk, it is works fine and create apk, but some of library project is not working , So is that any way to exclude some library project or any way to exclude jar file in library project
score: 1
tagged with: java

http://stackoverflow.com/a/26322310
has comment: http://stackoverflow.com/comment/41324130
has comment: http://stackoverflow.com/comment/41323375
has comment: http://stackoverflow.com/comment/41324296
has comment: http://stackoverflow.com/comment/41324869
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41321449
accepted answer of: http://stackoverflow.com/q/26319105
has comment: http://stackoverflow.com/comment/41321427
answers question: http://stackoverflow.com/q/26319105
type: Answer
has comment: http://stackoverflow.com/comment/41323995
has comment: http://stackoverflow.com/comment/41322134
upvote count: 1
has body: There are a couple of problems with your code. First: You have said that without the break statement your while loop never breaks. This is because the condition will always be true. You never change the condition in the loop always forcing it to be true. Second: You have "cash =- (-1);" There is an extra - sign in there. Lastly (More of a side note): You have the loop in your object. This will make it difficult to call any of your methods and make clear code. Try Moving the while loop outside your object and make the object's methods only perform ONE task. EDIT: Here is sample code of what you should do. It was done in ~ 10 minutes and should be modified to what you want. It is an example on how you should set up the class and do the loop. The main method: import java.util.Scanner; /** * * @author Tyler Weaver */ public class Test { public static void main(String[] args) { String play = "yes"; int cash; Scanner scan = new Scanner(System.in); do { System.out.printf("Enter cash amount: "); cash = scan.nextInt(); } while (cash &lt; 1); DiceGame game = new DiceGame(cash); while (play.equalsIgnoreCase("yes") &amp;&amp; cash &gt; 0) { int dice1 = game.roll(); int dice2 = game.roll(); game.calcCash(dice1 + dice2); cash = game.getCash(); System.out.printf("Your new cash amount is $%,.2f%n", (float) cash); System.out.printf("Do you want to play again? "); play = scan.next(); } } } This is an example of what the class should look like minus other necessary methods: import java.util.Random; /** * * @author Tyler Weaver */ public class DiceGame { private int cash; private Random gen; public DiceGame(final int cash) { this.cash = cash; gen = new Random(); } public int roll() { return gen.nextInt(6) + 1; } public void calcCash(final int sum) { cash += (sum == 7) ? 4 : -1; } public int getCash() { return cash; } } This is not the answer. This is example code from your problem. You will have to figure out how to implement exactly what you need. Note how the class only performs one …
has comment: http://stackoverflow.com/comment/41323446
has comment: http://stackoverflow.com/comment/41315919
score: 1

http://stackoverflow.com/q/26310885
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41289161
has answer: http://stackoverflow.com/a/26311792
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41289174
upvote count: 0
tagged with: java
has title: Listview when item click it will go to another listview
type: Question
has comment: http://stackoverflow.com/comment/41289150
has answer: http://stackoverflow.com/a/26311039
has comment: http://stackoverflow.com/comment/41288999
score: -1
tagged with: listview
has comment: http://stackoverflow.com/comment/41289210
answer count: 2
has body: So here my problem i'm setting the onitemclicklistener on listview1 and making it that if an item already exist on the order list, then the quantity will increment, but my problem is my program keep crashing Here's my code MainActivity.java public class MainActivity extends Activity { Database helper; ListView lv,lv2; ArrayAdapter&lt;PostItemList&gt; adapter; ArrayAdapter&lt;PostInventory&gt; adapterInventory; ArrayAdapter&lt;PostOrder&gt; adapterOrder; ArrayList&lt;PostItemList&gt; list; ArrayList&lt;PostInventory&gt; listInventory; ArrayList&lt;PostOrder&gt; listorder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); helper = new Database(MainActivity.this); lv = (ListView)findViewById(R.id.itemList); lv2 = (ListView)findViewById(R.id.orderList); list = helper.getAllData(); adapter = new PostAdapterItemList(MainActivity.this,list); lv.setAdapter(adapter); listorder = new ArrayList&lt;PostOrder&gt;(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1,final int pos, long arg3) { // TODO Auto-generated method stub PostItemList getData = list.get(pos); String parseData = getData.toStringOrder(); String name[] = parseData.split(","); int itemQuantity = Integer.parseInt(name[1]); double itemPrice = Double.parseDouble(name[2]); if (itemQuantity == 0){ String output = name[0] + " is out of stock."; Toast.makeText(getBaseContext(), output, Toast.LENGTH_LONG).show(); } else { itemQuantity = itemQuantity - 1; String newQuantity = String.valueOf(itemQuantity); helper.updateQuantity(name[0], newQuantity); list.clear(); list = helper.getAllData(); adapter = new PostAdapterItemList(MainActivity.this, list); lv.setAdapter(adapter); int checker = 0; if (listorder.isEmpty()){ listorder.add(new PostOrder(name[0], "1", name[2])); adapterOrder = new PostAdapterOrder(MainActivity.this,listorder); lv2.setAdapter(adapterOrder…
tagged with: android-listview

http://stackoverflow.com/comment/41384771
score: 1
has text: IMHO you are using _java_ generics for what they are not designed. This would work fine in C++, but java generics _are not_ the same. _Generics are Harmful_, and this is one example. Surely there are other *software engineering* solutions for your needs, instead of the *programming art* you are pasting. When things are so much complex as the answers shown here, probably something is wrong.
type: QuestionComment
comment on: http://stackoverflow.com/q/26304527
type: Comment

http://stackoverflow.com/comment/41168637
comment on: http://stackoverflow.com/a/26244607
type: AnswerComment
score: 0
has text: Thank you, I like your way thinking about the problem. Can you help with the math or organizing the loop part. I just cant get my head around it. Would be mutch easier to understand if I actualy see some example and from that "aha moment" I can figure out some abstract way to do it next time.
type: Comment

http://stackoverflow.com/comment/41331991
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26333441
type: Comment
has text: Can you confirm your Android support Repository & Android support Library revision : You can find the revision in the Android sdk manager Extras , just below all downloaded apis.

http://stackoverflow.com/q/26226819
favorite count: 0
has comment: http://stackoverflow.com/comment/41137905
type: UnansweredQuestion
tagged with: multithreading
tagged with: garbage-collection
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/6202939
tagged with: java
has body: I basically trying to load 6 large file (500MB per file on average) using buffered reader. In one run, I loaded the files one by one; In the other run, I loaded the files in parallel. There appeared to be a significant difference in term of time consumed by the two runs: Sequential Run: 14.634s Parallel Run: 120.317s NOTE that this difference shows up clearly on the 1st time reading these files into the JVM. In subsequent reads, duration shortens significantly, which I assume is due to caching. Therefore, I recreate these files (e.g. delete them under the current dir and copy them from somewhere to the current dir again) before I ran two independent Eclipse instances (I also tried ran them as two runnable jars from cmd line, same result). Sub-question: Is there a way to eliminate this caching effect to stop it affecting my experiment before I do the run? e.g. In windows, I deleted all the Java temp files through Control Panel -> Java -> Settings -> Delete Files ... as well as doing something like this to clear windows cache My Main Question is: What caused such vast difference? I have already tried the following: I notice that as in the GC details printed out, the Sequential run of the program has a high usage of Eden space but low usage of OldGen (and had more Full GCs), while the opposite is true to the Parallel run. Therefore I tried to adjust the -XX:NewRatio to a lower number but it didn't help. Then I increased both the min and max heap size via -Xms and -Xms to 2g, which didn't help either. If this is due to contention for I/O, is there some tool that I can use to confirm this? I currently use VirtualVM which I can do Sampling and Profiling of the CPU time for classes. But I wonder if there is some other tool to check this in a clearer way. Following are the simplified code public class BufferedReaderConcurentPerfTest { // Parallel or Serial public static boolean isParallel = true; public static boolean isToPrintInfo = true; public static String ORIGINAL_LOG_…
type: Question
has comment: http://stackoverflow.com/comment/41137894
answer count: 1
has answer: http://stackoverflow.com/a/26229248
score: 0
has comment: http://stackoverflow.com/comment/41139065
tagged with: file-io
linked to: http://stackoverflow.com/q/10647683
has title: JAVA I/O: Unexpected Performance Difference between Sequentially and Concurrently Reading Files using BufferedReader
has comment: http://stackoverflow.com/comment/41169800

http://stackoverflow.com/comment/41329264
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26332754
type: AnswerComment
has text: i am stil getting these two error even after the coorection you said to make-: myprogramme.java:12: error: cannot find symbol PrintWritter out=res.getWritter(); ^ symbol: class PrintWritter location: class myprogramme myprogramme.java:12: error: cannot find symbol PrintWritter out=res.getWritter(); ^ symbol: method getWritter() location: variable res of type HttpServletResponse 2 errors

http://stackoverflow.com/a/26209775
type: Answer
has body: Replace the below for (int y = 0; y &lt; pos.length; y++) with this statement for (int y = 0; y &lt; pos[x].length; y++) output X0 Y0 X1 Y1 X2 Y2
score: 0
answers question: http://stackoverflow.com/q/26209730

http://stackoverflow.com/comment/41338945
type: Comment
has text: If you're running your program on a Windows plattform, the correct path separator is the back slash. Is it a problem for you? Realise that the value returned by _file.getAbsolutePath()_ *is* a valid path.
comment on: http://stackoverflow.com/a/26313303
type: AnswerComment
score: 0

http://stackoverflow.com/q/26203064
has answer: http://stackoverflow.com/a/26203112
tagged with: text-files
type: Question
tagged with: java
score: 0
answer count: 1
has title: How to replace string in textfile using java?
has body: Here's my code, my problem is all about replacing string in textfile if the record is match with my input. just try to run my program, my OS is Ubuntu. package atm_bankmanagement; import java.util.Scanner; import java.io.*; public class ATM_BankManagement { // create a main menu public static void MainMenu() { System.out.println("[1] Admin"); System.out.println("[2] User"); System.out.println("[3] Exit"); Scanner a = new Scanner(System.in); int mainChoice=a.nextInt(); switch(mainChoice) { case 1: AdminPanel(); break; case 2: UserPanel(); break; case 3: break; } } // END OF MainMenu method // create a method for admin panel public static void AdminPanel() { System.out.print("Enter password: "); Scanner sc = new Scanner(System.in); int pass = sc.nextInt(); if ((pass==132748)) { System.out.println("---ADMIN PANEL---"); System.out.println("[1] Add Bank Account"); System.out.println("[2] Add Deposit"); System.out.println("[3] Exit"); Scanner b = new Scanner(System.in); int adminPanelChoice=b.nextInt(); switch(adminPanelChoice) { case 1: APaddbankaccount(); break; case 2: APadddeposit(); break; case 3: MainMenu(); break; } } else { System.out.println("Invalid password!"); MainMenu(); } } // END OF AdminPanel method // create a method for admin panel add bank account public static void APaddbankaccount() { System.out.println("---ADMIN PANEL---"); System.out.println("--Add Bank Account--"); System.out.print("Enter Account Name: "); Scanner c = new Scanner(System.in); String accname = c.nextLine(); System.out.print("Enter Account Number: "); Scanner d = new Scanner(System.in); int accnum = d.nextInt(); System.out.print("Enter Amount: "); Scanner f = new Scanner(System.in); int amount=f.nextInt(); try { File fi = new File("/home/kean/insert.txt") ; BufferedWriter w = new BufferedWriter(new FileWriter(fi,true)); w.write(accnum+";"+accname+";"+amount); w.newLine(); System.out.println("[1] Save Entry"); System.out.println("[2] Exit"); Scanner g = new Scanner(System.in); int addb…
type: UnansweredQuestion

http://stackoverflow.com/comment/41229993
type: AnswerComment
has text: It missed a static modifier in the top attribute, coding by memory, no compiler at hand... furthermore it's a homework assignment, should leave something for the student no?
type: Comment
comment on: http://stackoverflow.com/a/26248450
score: 0

http://stackoverflow.com/a/30177915
score: 0
has body: I had the same issue, and ran into the same dead end you encountered in your update 2. The only way around this that I could think of, is to create a UDF that doesn't take the literal "second", and delegates to datediff. CREATE FUNCTION [dbo].[datediff_seconds] ( @from datetime, @to datetime ) RETURNS int AS BEGIN RETURN datediff(second, @from, @to) END GO It's a kludge, but works.
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/48461973
answers question: http://stackoverflow.com/q/26280772
has comment: http://stackoverflow.com/comment/48461839

http://stackoverflow.com/comment/41330550
has text: avro-1.7.5.jar was prebuilt: 86794265 784 -rw-r--r-- 1 davidlaxer staff 400680 Jun 29 04:30 ./lib/avro-1.7.5.jar Does it need to be recompiled? If yes, where do I run 'ant -Dhadoopversion=23' to create a new avro.jar?
comment on: http://stackoverflow.com/q/26309124
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/33450042
answers question: http://stackoverflow.com/q/26341344
score: 0
has comment: http://stackoverflow.com/comment/57994094
type: Answer
has body: I faced the same problem. I updated jenkins. I downgraded jenkins. I changed maven and jdk version. Like described here I played around with the dependency versions. For me nothing worked. Jenkins build failed, but on the same machine in the console the build worked. My solution was to play around with the jenkins job type. When I have changed the job from freestyle to a maven job, the build worked. So I have splitted up my freestyle job into a maven and a freestyle job. For me this was ok as I was tired of analysing the problem.

http://stackoverflow.com/comment/41211411
comment on: http://stackoverflow.com/q/26268300
has text: I'm sure I didn't remove the arraylist because I don't have a compilation error
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26230642
has title: Jersey Hk2 injecting @Service annotated classes
has answer: http://stackoverflow.com/a/26240119
has answer: http://stackoverflow.com/a/31987263
has answer: http://stackoverflow.com/a/41460751
has comment: http://stackoverflow.com/comment/68935339
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/39003933
upvote count: 7
type: Question
linked to: http://stackoverflow.com/q/31943129
has comment: http://stackoverflow.com/comment/51701417
tagged with: jersey
has answer: http://stackoverflow.com/a/27941593
linked to: http://stackoverflow.com/q/21744297
has body: For the life of me I cannot get Jersey with hk2 to automatically discover @Service annotated classes and inject them. I have tried to follow every advice on stack overflow, jersey and hk2 documentation and still no luck. I am trying to inject a simple echo service into a Jersey resource. The skeleton is generated from the simple webapp maven archetype for Jersey, which I tried to extend. This is what I have so far: pom.xml sandbox org.glassfish.hk2 hk2-inhabitant-generator 2.3.0 true generate-inhabitants ... org.glassfish.jersey jersey-bom ${jersey.version} pom import org.glassfish.jersey.containers jersey-container-servlet-core org.glassfish.hk2 hk2 2.3.0 web.xml Jersey Web Application org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages my.package.jerseytest javax.ws.rs.Application my.package.jerseytest.application.Application 1 my.package.jerseytest.application.Application public class Application extends ResourceConfig { public Application() { ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator(); } } my.package.jerseytest.service.EchoService @Service public class EchoService { public String generateResponse(String echo) { return echo; } } my.package.jerseytest.resource.MyResource @Path("myresource") public class MyResource { @Inject EchoService echoService; @GET @Produces(MediaType.TEXT_PLAIN) public String getIt() { return echoService.generateResponse("Got it!"); } } I have checked that the inhibitant-generator does in fact run and produce its output, yet when running the Tomcat server GETting http://localhost:8080/sandbox/webapi/myresource I get SEVERE: Servlet.service() for servlet [Jersey Web Application] in context with path [/sandbox] threw exception [A MultiException has 3 exceptions. They are: 1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=EchoService,parent=MyResource,qualifiers={},position=-1,optional=fa…
downvote count: 0
has comment: http://stackoverflow.com/comment/51700062
has answer: http://stackoverflow.com/a/26240217
favorite count: 0
tagged with: service
linked to: http://stackoverflow.com/q/23402814
answer count: 5
type: UnansweredQuestion
tagged with: hk2
tagged with: inject
has comment: http://stackoverflow.com/comment/43318198

http://stackoverflow.com/comment/41351601
has text: @code578841441 So if the current time is 3pm do you want to execute your task?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26344855
type: QuestionComment

http://stackoverflow.com/q/26244173
tagged with: deadlock
upvote count: 4
tagged with: log4j
type: UnansweredQuestion
tagged with: log4j2
type: Question
has answer: http://stackoverflow.com/a/26260009
tagged with: java
has body: A simple Spring-based war application, with a typical log4j2.xml. When JBoss is shut down normally, it hangs with a thread deadlock inside log4j2 so the shutdown procedure never finishes and the process has to be killed. JBoss is EAP 6.3 (AS 7.4.0), JDK is 1.8.0_20. Anything that can be done? Log4j2.xml <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d{DEFAULT} %-5p [%t] %c - %m%n"/> <TimeBasedTriggeringPolicy /> <DefaultRolloverStrategy max="5000"/> <AppenderRef ref="file"/> Thread dump below. Found one Java-level deadlock: ============================= "ServerService Thread Pool -- 110": waiting to lock monitor 0x000000001f884068 (object 0x00000000c412bff0, a org.apache.log4j.ConsoleAppender), which is held by "MSC service thread 1-10" "MSC service thread 1-10": waiting to lock monitor 0x000000001d75ee88 (object 0x00000000c06805a0, a java.io.PrintStream), which is held by "log4j-shutdown" "log4j-shutdown": waiting to lock monitor 0x000000001f884068 (object 0x00000000c412bff0, a org.apache.log4j.ConsoleAppender), which is held by "MSC service thread 1-10" Java stack information for the threads listed above: =================================================== "ServerService Thread Pool -- 110": at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:231) - waiting to lock <0x00000000c412bff0> (a org.apache.log4j.ConsoleAppender) at org.apache.log4j.JBossAppenderHandler.doPublish(JBossAppenderHandler.java:42) at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:79) at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:296) at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:304) at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:304) at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:304) at org.jboss.logmanager.Logger.logRaw(Logger.java:721) at org.jboss.logmanager.Logger.log(Logger.java:672) at org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:50) at org.jboss.logging.Logger.logf(…
tagged with: jboss
has title: Deadlock in log4j2 (with JBoss)
downvote count: 0
answer count: 1
score: 4
favorite count: 0

http://stackoverflow.com/a/28249183
answers question: http://stackoverflow.com/q/26197411
score: 0
type: Answer
has body: I am using adt-bundle-windows-x86-20140321, problem occured since updating java. But now problem already fixed after re-Extracting adt-bundle-windows-x86-20140321.

http://stackoverflow.com/comment/41098248
type: QuestionComment
has text: What are `tab` and `tab2`? And "but it doesnt work" is not a good replacement for an error message.
comment on: http://stackoverflow.com/q/26207611
score: 0
type: Comment

http://stackoverflow.com/comment/41194195
has text: Simple question: why?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26259433

http://stackoverflow.com/comment/67632449
has text: Note that to run HSQLDB in server mode (which allows connections from external clients), you don't need to start it in a separate process. You can embed it in your application by instantiating an `org.hsqldb.server.Server` object.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26305357
type: Comment

http://stackoverflow.com/a/26309558
type: Answer
has body: I have discovered the solution to my problem. In my DisplayTasks method, I was just pulling the string for the task and putting it in the t object and I was not pulling the ID from the table. I couldn't pass the ID to the other servlet because it was and empty variable..
score: 0
answers question: http://stackoverflow.com/q/26308113

http://stackoverflow.com/a/26310256
has body: Other than a (minor?) performance hit ... In fact, if the list is shared between threads, the performance hit of using a simple synchronized list (versus something more appropriate) could be a large performance hit, depending on what you are doing. The synchronized operations could become a concurrency bottleneck, reducing the application to the performance of a single core. Simple "black and white" rules are not sufficient when designing a multi-threaded application ... or a reusable library that needs to be thread-safe and also performant in multi-threaded applications. That is, what penalty do I incur for using a synchronizedList? How bad is it? For my current application, it's not an issue. If it is a cheap addition, why not? The synchronized list class uses primitive object locking (mutexes). If the lock is uncontended, this is cheap; maybe 5 or 10 instructions each time you acquire and release the lock. However, the ovehead may depends on whether there was previous contention on the lock. (Some locking schemes cause an object lock to be "inflated" the first time that contention occurs ...) If the lock is contended, then it is more expensive because this will typically involve the blocked thread being de-scheduled and rescheduled ... and context switch overheads. There is another JVM-level implementation approach involving "spin locking", but that entails the blocked thread testing the lock object in a tight loop. If the lock is held for a long time (e.g. in list.contains ... for a long list.) then that typically increases the probablility of contention.
has comment: http://stackoverflow.com/comment/41289265
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41289423
score: 2
has comment: http://stackoverflow.com/comment/41288942
answers question: http://stackoverflow.com/q/26310150
upvote count: 2
has comment: http://stackoverflow.com/comment/41287984
has comment: http://stackoverflow.com/comment/41288038
has comment: http://stackoverflow.com/comment/41288017
accepted answer of: http://stackoverflow.com/q/26310150
has comment: http://stackoverflow.com/comment/41288020

http://stackoverflow.com/q/26326533
has body: Got a strange issue with Observers disappearing from an Observable object's observer list. Here's a little background of my project. I have a @Stateless Timer Session Bean that every 10 seconds broadcasts the current time and date on the server to all the observers that are observing it. @Stateless public class TimeBroadcastService extends Observable implements TimeBroadcastServiceLocal { @Schedule(hour = "*", minute = "*", second = "*/10") @Override public void broadcast() { setChanged(); notifyObservers(new Date()); } @Override public void addNewObserver(Observer o) { this.addObserver(o); } } This is deployed to GlassFish (4.1) and the only thing to every subscribe to this is a POJO which I called EventProxy. EventProxy is an Observer of the above mentioned TimeBroadcastService and at the same time is also an Observable for other clients (mostly Swing applications). Here is the code for EventProxy: public class EventProxy extends Observable implements Observer, Serializable { @Override public void update(Observable o, Object arg) { System.out.println("[EventProxy] received update from TimeBroadcastService bean =&gt; " + arg.toString()); System.out.println("[EventProxy] notifying " + countObservers() + " listeners"); setChanged(); notifyObservers(arg.toString()); } @Override public void addObserver(Observer o) { super.addObserver(o); System.out.println("[EventProxy] adding new observer (" + countObservers() + ")"); } } When the TimeBroadcastService sends out an update with the new time, EventProxy.update() receives it and I can see it write the debug message along with the actual date send from the bean. However this message is never broadcast from EventProxy to any of its observers because countObservers() returns 0 indicating that there are no observers subscribed to EventProxy. The weird thing is that I actually have 3 observers subscribing to EventProxy; I can see it via the debug messages: [EventProxy] adding new observer (1) [EventProxy] adding new observer (…
type: Question
tagged with: jakarta-ee
score: 0
has comment: http://stackoverflow.com/comment/41317244
answer count: 0
has comment: http://stackoverflow.com/comment/41324007
type: UnansweredQuestion
tagged with: java
has title: Observers Added then Disappearing

http://stackoverflow.com/q/26246767
has answer: http://stackoverflow.com/a/26247102
score: 0
tagged with: java
type: Question
tagged with: guice
tagged with: assisted-inject
answer count: 1
has title: Guice: Assisted injections and providers
has body: Suppose I have a class as follows: public class ComplicatedImpl implements Complicated { @Inject public ComplicatedImpl(Integer normal, @Assisted String assisted); public void addListener(Listener listener); } Now, I have a ComplicatedFactory like so: public interface ComplicatedFactory { public Complicated build(String assisted); } Is it possible to, when using FactoryModuleBuilder, bind a ComplicatedFactory such that, when build() is invoked, we do the equivalent of ComplicatedImpl impl = new ComplicatedImpl(normal, assisted); impl.addListener(listener); return impl; as opposed to the normal case of returning a new ComplicatedImpl directly? I had throughout of trying to bind ComplicatedImpl to some form of Provider, but it seems that I'd be going around in circles with that...
type: UnansweredQuestion

http://stackoverflow.com/a/26254292
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26253929
has body: This can be done with the Java API: ObjectOutputStream and ObjectInputStream. Your class needs to implement the java.io.Serializable interface to be written to a stream/created from a stream. Example: public class WriteMe implements java.io.Serializable { private static final long serialVersionUID = 1234567890L; // Should be generated private int myInt = 164; private Date myDate = new Date(); private transient int money = 1648; // Will be ignored } In your main class: public class HelloStackoverflow { public static void main(String[] args) { ObjectOutputStream os = new ObjectOutputStream(System.out); // Print to standard output os.writeObject(new WriteMe()); } } You can do the same with ObjectInputStream and .readObject(). If you want to store your object as a String, you should encode it using Base64, because the output will be Java-Bytecode!

http://stackoverflow.com/comment/41262166
type: Comment
has text: Is this the only option? I'm happy to limit the batch size to something smaller, but I don't chose the target machine, so I have no idea if the arbitrary number I assign will cause an out of memory exception. Is there any way I can calculate what I've got to work with? I don't know if this makes a different, but it's single threaded at the point of this call.
comment on: http://stackoverflow.com/a/26282823
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41176276
type: QuestionComment
has text: for a 3 level string for example I got a length of 4 instead of 6
type: Comment
comment on: http://stackoverflow.com/q/26249122
score: 0

http://stackoverflow.com/q/26336912
tagged with: arrays
has comment: http://stackoverflow.com/comment/41337614
has title: Array out of bounds error with quick sorting
answer count: 3
possible better answer: http://stackoverflow.com/a/26337464
has answer: http://stackoverflow.com/a/26337464
has comment: http://stackoverflow.com/comment/41336742
has answer: http://stackoverflow.com/a/26337028
tagged with: quicksort
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41337177
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26337028
type: Question
has comment: http://stackoverflow.com/comment/41336845
has comment: http://stackoverflow.com/comment/41336874
has body: I'm not sure why, but this keeps giving me an array out of bounds error when I compile it. Assuming the array is initialized correctly to have 10 index positions and I pass to the method 0 and numbers.length - 1, what am I doing wrong? public void sort(int low, int high) { int temp1 = low; int temp2 = high; int pivot = numbers[low + (high - low)/2]; while(temp1 &lt;= temp2) { while(numbers[temp1] &lt; pivot) { temp1++; } while(numbers[temp2] &gt; pivot) { temp2--; } if(temp1 &lt;= temp2) { swap(temp1, temp2); temp1++; temp2--; } } if(low &lt; temp1) { sort(low, temp2); } if(temp2 &lt; high) { sort(temp2, high); } } public void swap(int temp1, int temp2) { int temp = numbers[temp1]; numbers[temp1] = numbers[temp2]; numbers[temp2] = temp; }
has answer: http://stackoverflow.com/a/26337591

http://stackoverflow.com/comment/41245866
score: 0
has text: O, I see the problem... You need another flag a level higher up
comment on: http://stackoverflow.com/a/26285972
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26266386
has comment: http://stackoverflow.com/comment/41249887
type: Question
has comment: http://stackoverflow.com/comment/41216692
has comment: http://stackoverflow.com/comment/41207866
score: -1
has answer: http://stackoverflow.com/a/26267920
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/41208803
tagged with: generics
favorite count: 0
has title: Accessing List from outside, missing generic type
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41207932
has body: EDIT: It's an Eclipse Problem(?). Eclipse shows an error but compiles it, seems to have something to do with Java 8 and Type Casting. I've a class that has a List&lt;E&gt; field. If I access it inside of the class I get List&lt;E&gt;. But if I access the List from outside, I only get List without generic types. And if I access it's elements I only get an Object, instead of an E But in my Code I need explicit the E, so how can I change/fix that, so that the List is returned without removing the generics and without explicit casting? Class with List: public class ListClass { private List&lt;String&gt; list; public ListClass(){ list = new ArrayList&lt;&gt;(); } public List&lt;String&gt; getList(){ return list; } } Containg class: public class ContainingClass { private ListClass lc; public ContainingClass(){ lc = new ListClass(); } public ListClass getListClass(){ return lc; } } Now the problem: ContainingClass cc = new ContainingClass(); String str = cc.getListClass().getList().get(0); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: "Type mismatch: cannot convert from Object to String" But why?
has comment: http://stackoverflow.com/comment/41296681
has answer: http://stackoverflow.com/a/26271281
tagged with: java
has comment: http://stackoverflow.com/comment/41207650
has comment: http://stackoverflow.com/comment/41208371
downvote count: 1

http://stackoverflow.com/comment/128917621
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/65475279
has text: Wouldn't it be easier to just use `Objects.equals` here? `boolean equals = Objects.equals(objectA.getNullableInteger(), objectB.getNullableInteger())`;

http://stackoverflow.com/a/26282544
has comment: http://stackoverflow.com/comment/41468945
has comment: http://stackoverflow.com/comment/41404364
has comment: http://stackoverflow.com/comment/41238317
score: 4
has comment: http://stackoverflow.com/comment/41238275
upvote count: 4
has comment: http://stackoverflow.com/comment/41464792
has comment: http://stackoverflow.com/comment/41363175
has comment: http://stackoverflow.com/comment/41239021
type: AcceptedAnswer
downvote count: 0
has body: What you are trying to do is not a simple afternoon project. This book explains the process: There is A LOT of code between JPEG compressed data and pixel values. http://www.amazon.com/Compressed-Image-File-Formats-JPEG/dp/0201604434/ref=pd_bxgy_b_img_y First of all, you have to deal with two separate but related compression methods: Sequential and progressive. As you read the bit data, you have to Huffman decode Run length decode Inverse Quantization List item Inverse Discrete Cosine Transform Up sample YCbCr to RGB convert That's in the simple case of sequential. You are not going to get all of those steps explained on this forum. I also recommend http://www.amazon.com/dp/1558514341/ref=rdr_ext_tmb
has comment: http://stackoverflow.com/comment/41423833
has comment: http://stackoverflow.com/comment/41463542
has comment: http://stackoverflow.com/comment/41465200
has comment: http://stackoverflow.com/comment/41443420
has comment: http://stackoverflow.com/comment/41468654
has comment: http://stackoverflow.com/comment/41363731
has comment: http://stackoverflow.com/comment/41443380
type: Answer
has comment: http://stackoverflow.com/comment/41363143
has comment: http://stackoverflow.com/comment/41435976
has comment: http://stackoverflow.com/comment/41384846
accepted answer of: http://stackoverflow.com/q/26281695
has comment: http://stackoverflow.com/comment/41361800
has comment: http://stackoverflow.com/comment/41239560
has comment: http://stackoverflow.com/comment/41239206
answers question: http://stackoverflow.com/q/26281695
has comment: http://stackoverflow.com/comment/41392487
has comment: http://stackoverflow.com/comment/41238803

http://stackoverflow.com/q/26337169
has title: Issue whilst comparing instances with HashMaps in Java
accepted answer: http://stackoverflow.com/a/26337215
has comment: http://stackoverflow.com/comment/41337234
type: AnsweredQuestion
has body: I am trying to get a value from a HashMap via a custom class I have created. The custom class: public class Coordinates { private int x; private int y; public Coordinates(int x, int y) { this.x = x; this.y = y; } public int getX() { return this.x; } public int getY() { return this.y; } public boolean isSame(Coordinates coords) { if (coords.getX() == this.x &amp;&amp; coords.getY() == this.y) { return true; } return false; } public String getAsString() { return "("+this.x+", "+this.y+")"; } public Coordinates getCoords() { return this; } } I Have a HashMap called coordsJCB and when I try to get the JCButton (a custom swing button) it says it cannot find it. private static HashMap&lt;Coordinates, JCButton&gt; coordsJCB = new HashMap&lt;Coordinates, JCButton&gt;(); coordsJCB.get(coords); I did a little debugging and noticed that System.out.println(new Coordinates(2, 3).equals(new Coordinates(2, 3))); printed false, even though they are the same. I googled it and got many answers about overriding the .equals function. However this will not help me as I don't want to compare 2 instances of 'Coordinates', I need to get a value from the HashMap by passing it an instance of Coordinates. Any help much appreciated as I have absolutely no idea what to do. :/
tagged with: instance
tagged with: java
type: Question
answer count: 2
tagged with: hashmap
has answer: http://stackoverflow.com/a/26337215
possible better answer: http://stackoverflow.com/a/26337265
has answer: http://stackoverflow.com/a/26337265
score: 0

http://stackoverflow.com/q/26331565
has body: Why doesn't the default array construction work in this setting? These are the errors I get: "]" expected, ";" expected, illegal start of type, identifier expected (each of them 8 times) import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; class ButtonHandler implements ActionListener { ColoredWordsExperiment coloredWords; public ButtonHandler(ColoredWordsExperiment coloredWords) { this.coloredWords = coloredWords; } String colorWords[] = new String[8]; colorWords[0] = "blue"; colorWords[1] = "red"; colorWords[2] = "purple"; colorWords[3] = "yellow"; colorWords[4] = "green"; colorWords[5] = "pink"; colorWords[6] = "orange"; colorWords[7] = "grey"; @Override public void actionPerformed(ActionEvent e){ //If button "Matching" is clicked if (e.getActionCommand().equals("Matching")) { coloredWords.label1.setText(colorWordGenerator(colorWords)); } } public String colorWordGenerator(String colorWords[]) { Random generator = new Random(); int i = generator.nextInt(7); return colorWords[i]; } } However, if I put the array in a new, clean, class like this, it does work. public class { public static void main(String[] arg) { String colorWords[] = new String[8]; colorWords[0] = "blue"; colorWords[1] = "red"; colorWords[2] = "purple"; colorWords[3] = "yellow"; colorWords[4] = "green"; colorWords[5] = "pink"; colorWords[6] = "orange"; colorWords[7] = "grey"; } }
has title: Why doesn't the default array construction work in this setting?
score: 0
accepted answer: http://stackoverflow.com/a/26331594
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26331594
answer count: 1
tagged with: arrays

http://stackoverflow.com/comment/41076751
has text: Nobody deserves rep for answering this one.
score: 0
comment on: http://stackoverflow.com/q/26195769
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41137236
comment on: http://stackoverflow.com/q/26228095
score: 0
type: Comment
type: QuestionComment
has text: Please post the entire exception with stack trace.

http://stackoverflow.com/comment/41173845
has text: http://stackoverflow.com/a/8213220/2864740 , http://stackoverflow.com/a/442570/2864740
comment on: http://stackoverflow.com/q/26247839
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26299557
type: AcceptedAnswer
score: 8
accepted answer of: http://stackoverflow.com/q/26256546
upvote count: 8
has body: Is it possible to use pdfbox to include other pdf pages as embedded objects within a page It should be possible. The PDF format allows the use of so called form xobjects to serve as such embedded objects. I don't see an explicit implementation for that, though, but the procedure is similar enough to what PageExtractor or PDFMergerUtility do. A proof of concept derived from PageExtractor using the current SNAPSHOT of the PDFBox 2.0.0 development version: PDDocument source = PDDocument.loadNonSeq(SOURCE, null); List&lt;PDPage&gt; pages = source.getDocumentCatalog().getAllPages(); PDDocument target = new PDDocument(); PDPage page = new PDPage(); PDRectangle cropBox = page.findCropBox(); page.setResources(new PDResources()); target.addPage(page); PDFormXObject xobject = importAsXObject(target, pages.get(0)); page.getResources().addXObject(xobject, "X"); PDPageContentStream content = new PDPageContentStream(target, page); AffineTransform transform = new AffineTransform(0, 0.5, -0.5, 0, cropBox.getWidth(), 0); content.drawXObject(xobject, transform); transform = new AffineTransform(0.5, 0.5, -0.5, 0.5, 0.5 * cropBox.getWidth(), 0.2 * cropBox.getHeight()); content.drawXObject(xobject, transform); content.close(); target.save(TARGET); target.close(); source.close(); This code imports the first page of a source document to a target document as XObject and puts it twice onto a page there with different scaling and rotation transformations, e.g. for this source it creates this The helper method importAsXObject actually doing the import is defined like this: PDFormXObject importAsXObject(PDDocument target, PDPage page) throws IOException { final PDStream src = page.getContents(); if (src != null) { final PDFormXObject xobject = new PDFormXObject(target); OutputStream os = xobject.getPDStream().createOutputStream(); InputStream is = src.createInputStream(); try { IOUtils.copy(is, os); } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } xobject.setResources(page.fin…
type: Answer
has comment: http://stackoverflow.com/comment/41271652
downvote count: 0
has comment: http://stackoverflow.com/comment/41271487
has comment: http://stackoverflow.com/comment/41335368
answers question: http://stackoverflow.com/q/26256546

http://stackoverflow.com/a/26292553
upvote count: 1
has comment: http://stackoverflow.com/comment/41256681
has comment: http://stackoverflow.com/comment/41256386
has comment: http://stackoverflow.com/comment/41256305
type: Answer
answers question: http://stackoverflow.com/q/26292434
has comment: http://stackoverflow.com/comment/41256771
has comment: http://stackoverflow.com/comment/41256089
downvote count: 0
has body: You need to use the select tag attribute selected: Addition Subtraction Multiplication Division Note: make sure you are redirecting to the jsp using RequestDispatcher.forward(request, response) ${} is Expression Language(EL) provided in jsp. In EL, ${param.state} is equivalent to request.getParameter("state") eq is logical operator in EL, you can even use == for the same. To use with request attributes, you may try: Addition
has comment: http://stackoverflow.com/comment/41256405
score: 1
has comment: http://stackoverflow.com/comment/41256153
has comment: http://stackoverflow.com/comment/41256514
has comment: http://stackoverflow.com/comment/41255845

http://stackoverflow.com/a/26219868
upvote count: 1
answers question: http://stackoverflow.com/q/26218366
has body: compilation as 1.5 means java code structure / class file design to be at level 1.5 - not to be confused with jdk code itself If jdk 1.7 ships a rt.jar file with System.java code with some methods, javac compiler has no way to know what it was as of 1.6, 1.5, 1.4 level (unless you have classes.zip and specify the boot classpath) see javac source and target options http://www.javaworld.com/article/2077388/core-java/what-version-is-your-java-code.html To make life easy use the right jdk for the right job
has comment: http://stackoverflow.com/comment/41157720
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26218366
score: 1

http://stackoverflow.com/a/26266184
has body: int[] unDupe = {}; is an array of 0 elements. Trying to access unDupe[i] where i = 0->dupeSplit.length will cause an out of bounds exception to be thrown. Ask yourself how can you access an index in an array if no space has been allocated to it yet? i.e. unDupe[0] -> ERROR because the size of unDupe is 0. No elements exist! You may want to add this: int[] unDupe = new int[dupeSplit.length]; after this line String[] dupeSplit = dupe.split(" ");
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26266034
score: 1
upvote count: 1

http://stackoverflow.com/comment/41344896
score: 0
type: Comment
type: QuestionComment
has text: Instead of `"images/success.jpg"` use `"/images/success.jpg"`
comment on: http://stackoverflow.com/q/26340990

http://stackoverflow.com/a/26255303
has body: Your synchronized method is effectively: private void callMe() { synchronized(this) { System.out.println("Started"); for (int i = 1; i &lt;= 5; i++) { System.out.println(name+" = "+i); } } } Now you've created two different instances, so this will be different for each thread... so they're not synchronizing against each other. If you want to see two threads working with the same monitor, you could rewrite your code like this: public final class DemoRunnable implements Runnable { @Override public synchronized void run() { System.out.println("Started"); for (int i = 1; i &lt;= 5; i++) { System.out.println(Thread.currentThread().getName() + " = " + i); } } public static void main(String[] args) { Runnable runnable = new DemoRunnable(); Thread a = new Thread(runnable, "A"); Thread b = new Thread(runnable, "B"); a.start(); b.start(); } } Then you'll get output like this: Started A = 1 A = 2 A = 3 A = 4 A = 5 Started B = 1 B = 2 B = 3 B = 4 B = 5 (Although it could be the other way round, of course.) We still have two threads, but they're calling a synchronized method on the same object (a DemoRunnable in this case) so one will have to wait for the other to complete. A few points: Implementing Runnable is generally preferred over extending Thread; it's more flexible Synchronizing on a Thread object has its own issues, as the Thread class does it itself; try to avoid it Personally I don't like synchronizing on this anyway - I would usually have a private final variable of type Object to represent a monitor that only my code knows about... that way I can easily see all the code that could synchronize on it, which makes it easier to reason about
upvote count: 13
has comment: http://stackoverflow.com/comment/41187590
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41187551
type: Answer
answers question: http://stackoverflow.com/q/26255221
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26255221
score: 13

http://stackoverflow.com/q/26242602
has body: I was looking into uploading a CSV to blobstore on this site, and only found solutions for python code, but I need it for a java application. Here is where I am right now: Step 1 : I upload CSV to BlobStore the code is @SuppressWarnings("serial") public class ServletBulkUpAgent extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); Map&lt;String, BlobKey&gt; blobs = blobstoreService.getUploadedBlobs(req); BlobKey blobKey = blobs.get("data"); if (blobKey == null) { resp.sendRedirect("/"); } else { resp.sendRedirect("/upload-success?blob-key=" + blobKey.getKeyString()); } } } Step 2 : just read the CSV file using openCSV.jar file and print the value. The code for this is (this below cod transfer from above code after successfull upload). @SuppressWarnings("serial") public class SuccessfulUploadServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { System.out.println("Enter Successful Upload"); String blobKey = req.getParameter("blob-key"); BlobstoreInputStream is = new BlobstoreInputStream(new BlobKey(blobKey)); CSVReader csvReader = new CSVReader(new InputStreamReader(is)); List&lt;String[]&gt; rows = csvReader.readAll(); System.out.println(rows); } } But its throws the following error: Problem accessing /_ah/upload/ag1oaWxmZWRlc2tkZW1vciILEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YgICAgICAkAgM. Reason: Java heap space Since I'm looking for a java solution, pointing me back to a Python workaround won't really do the trick here.
type: Question
score: 0
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/41177467
has title: Google app engine Java - import CSV to datastore
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41165845
tagged with: java

http://stackoverflow.com/a/26260213
downvote count: 0
answers question: http://stackoverflow.com/q/26259870
type: Answer
has body: Definitely take a look at Spring Boot. Relatively new project. Its aim is to remove initial configuration phase and spin up Spring apps quickly. You can think about it as convention over configuration wrapper on top of Spring Framework. It's also considered as good fit for micro-services architecture. It has embedded servlet container (Jetty/Tomcat), so you don't need to configure it. It also has various different bulk dependencies for different technology combinations/stacks. So you can pick good fit for your needs.
score: 3
upvote count: 3

http://stackoverflow.com/comment/41096981
type: Comment
comment on: http://stackoverflow.com/a/26202349
type: AnswerComment
score: 0
has text: maq, you could use arguments in the batch script. But msrd0 is right, and I completely agree with him, albeit no Runtime.exec call is cross platform when things like cmd.exe are involved. The proper solution is to use Java's Process functionality or as I posted as a new answer, the built in compiler

http://stackoverflow.com/a/26245114
type: Answer
answers question: http://stackoverflow.com/q/26244938
score: 0
has body: You could do something like that int i=0; boolean isSSN =true; while(i&lt;11 &amp;&amp; !isSSN){ Character ch = str.charAt(i); i++; if(Character.isDigit(ch) &amp;&amp; (i==0 || i==1 || i==2 || i==4 || i==5 || i==7 || i==8 || i==9 || i==10)) { continue; } else if (ch == '-' &amp;&amp; (i==3 || i==6)) { continue; } isSSN=false; }

http://stackoverflow.com/a/26287307
upvote count: 0
score: -1
has body: Is there a reason you need to parse the actual string? If so, then what you do is, create a StringBuffer or StringBuilder, and wherever you put System.out.print in your code, append the buffer - including the spaces, which are what will help you differentiate between 1 4 and 14. Then you can convert that to a String. Then you can parse the String by splitting it by the spaces. Then iterate through the resulting String array. If there is no reason for you to use the actual full string, you can instead use a List object and just add to it in the same places in the code. In this case, you don't need the spaces. Then you'll be able to simply iterate through the list. You'll still be able to print you output - by printing the elements in the list.
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/26287034

http://stackoverflow.com/a/26282682
downvote count: 0
type: Answer
has body: You can have a Player array and run cantMove() on each player individually to check whether they are surrounded based on their current coordinates (Using getX() and getY()). Right now you're manually calling your methods on each and every player, which could be compressed into one general case. Player[] players; //Players added to array here public boolean someMethod() { for (Player p : players) if (!p.cantMove()) return false; return true; } Also: Assuming you have your world represented in some kind of array, since you can retrieve an object using coordinates, you could try checking instead whether the object at a certain location is null, instead of checking what it could be.
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/26282554
answers question: http://stackoverflow.com/q/26282554
type: AcceptedAnswer

http://stackoverflow.com/a/26294838
score: 12
has comment: http://stackoverflow.com/comment/41262577
answers question: http://stackoverflow.com/q/26258158
type: Answer
has comment: http://stackoverflow.com/comment/41264303
upvote count: 13
has comment: http://stackoverflow.com/comment/41263244
has comment: http://stackoverflow.com/comment/90128063
downvote count: 1
has comment: http://stackoverflow.com/comment/41263503
has comment: http://stackoverflow.com/comment/41265787
has comment: http://stackoverflow.com/comment/41265556
has body: If you want to intercept the repository call on the repository level, you don't actually need to introduce a custom annotation for that. You should be able to get this working with a plain type match: @Pointcut("execution(public !void org.springframework.data.repository.Repository+.*(..))") This will intercept the execution of all non-void methods of all Spring beans that extend the Spring Data Repository interface. A slightly related example can be found in the Spring Data examples repository.

http://stackoverflow.com/q/26221151
downvote count: 0
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/26227319
tagged with: rest
answer count: 3
has title: How to consume REST in Spring/Java with JSON unnamed values?
favorite count: 0
has comment: http://stackoverflow.com/comment/41136387
type: Question
tagged with: resttemplate
has comment: http://stackoverflow.com/comment/41129355
has comment: http://stackoverflow.com/comment/41136017
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/26693266
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41129302
has answer: http://stackoverflow.com/a/26221385
has comment: http://stackoverflow.com/comment/41123893
has body: I am new to JSON and REST. I am using Spring's RestTemplate to consume JSON. I was able to do it with this JSON response with this API call: http://data.fcc.gov/api/block/find?latitude=39.9936&amp;longitude=-105.0892&amp;showall=false&amp;format=json JSON Response: {"Block":{"FIPS":"080130608005010"},"County": {"FIPS":"08013","name":"Boulder"},"State": {"FIPS":"08","code":"CO","name":"Colorado"},"status":"OK","executionTime":"8"} However, when I take this FIPS code from this request and try to use it to request information from the census with this call: http://api.census.gov/data/2012/acs5?get=B19001_002E&amp;for=tract:060800&amp;in=state:08+county:013&amp;key= This is the JSON Response I get: [["B19001_002E","state","county","tract"], ["225","08","013","060800"]] As you can see all of the 'variables' are unnamed and in arrays. I am not sure how to consume this using Spring's RestTemplate using a POJO. This is the Java code I have (where URL is the string of the API Call): RestTemplate restTemplate = new RestTemplate(); CensusData cd = restTemplate.getForObject(URL, CensusData.class); System.out.println("data: " + cd.getData()); Here is my POJO (CensusData): @JsonIgnoreProperties(ignoreUnknown = true) public class CensusData { @JsonProperty private List&lt;List&lt;String&gt;&gt; data; public String getData() { String str = ""; for(List&lt;String&gt; list : data) { for(String s : list) { str += s; str += " "; } } return str; } } The problem is that I don't know what to name "data" in my CensusData object, since the values are unnamed in the JSON response. So I get this exception thrown: Exception in thread "main" org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of template.main.CensusData out of START_ARRAY token

http://stackoverflow.com/comment/41372993
type: Comment
comment on: http://stackoverflow.com/a/26349407
type: AnswerComment
has text: You are welcome. If you are not developing for Android you do not need to install the ADT, the commandline tool endpoint.sh generate Java classes which you can use in any Java application, so you can use these files in your normal Eclipse
score: 0

http://stackoverflow.com/comment/41101757
score: 0
comment on: http://stackoverflow.com/a/26209290
type: Comment
has text: I tried to implement what you said but it still does not work, I do not think I am fully grasping this. Now it says in the statement Date now = new Date(); cannot find symbol
type: AnswerComment

http://stackoverflow.com/comment/41309792
comment on: http://stackoverflow.com/a/26254400
has text: Maybe a misunderstanding... the distinction I had in mind was the separate category of "Live Thread" in YourKit. The comment on stacks was unrelated to that (OP mentioned those two). These two aren't distinguished by YourKit, and I presume it would be quite difficult to distinguish them.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26239473
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/26238131
answers question: http://stackoverflow.com/q/26238131
has body: I tested your example with jaxrs Client api: Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://localhost:8080/web/rest/report"); Report m = new Report(); m.setId((long) 12); m.setReportContent("asdf"); Entity&lt;Report&gt; report = Entity.json(m); Response r = myResource.request(MediaType.APPLICATION_JSON).post(report); System.out.println(r.getHeaderString("Location")); end it gives me propery value in Response location header.
has comment: http://stackoverflow.com/comment/41158193
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26313439
has comment: http://stackoverflow.com/comment/41293802
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/41293642
tagged with: filtering
has comment: http://stackoverflow.com/comment/41293574
tagged with: criteria
has comment: http://stackoverflow.com/comment/41293769
tagged with: database
has comment: http://stackoverflow.com/comment/41293919
score: 0
has comment: http://stackoverflow.com/comment/41347206
has body: I have following class: @Entity @Table(name = "terminal") public class Terminal { @Column(name = "map_lat") private Double mapLat; @Column(name = "map_lng") private Double mapLng; //get and set methods } Respectively in database I have corresponded table. I want to write dao method which will return all terminals which will locate within passed radius and center. I know that I can load all objects and filter their in java code but I want to load only necessary objects. Is it possible? I have method which check that point inside cicrcle or not. my current dao method: @Override public List&lt;Terminal&gt; findInsideCircleActive(double centerLatitude, double centerLongitude, double radius) { List&lt;Terminal&gt; allTerminals = findAllActive() ; List&lt;Terminal&gt; filteredTerminals = new ArrayList&lt;&gt;(); for(Terminal terminal: allTerminals){ if(distFrom(terminal.getMapLat(),terminal.getMapLng(),centerLatitude,centerLongitude) &lt;= radius ){ filteredTerminals.add(terminal); } } return filteredTerminals; } dist method realization: private static float distFrom(double lat1, double lng1, double lat2, double lng2) { double earthRadius = 6371; //kilometers double dLat = Math.toRadians(lat2-lat1); double dLng = Math.toRadians(lng2-lng1); double a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * Math.sin(dLng/2) * Math.sin(dLng/2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); float dist = (float) (earthRadius * c); return dist; } database shema:
has answer: http://stackoverflow.com/a/26316791
answer count: 1
has comment: http://stackoverflow.com/comment/41321743
has comment: http://stackoverflow.com/comment/41293709
has title: How to load only necessary data from database using Hibernate?
has comment: http://stackoverflow.com/comment/41293532
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41293558

http-post
tags question: http://stackoverflow.com/q/26247555
tags question: http://stackoverflow.com/q/26223470
type: Tag
tag name: http-post
tags question: http://stackoverflow.com/q/26259764

http://stackoverflow.com/comment/41512988
type: Comment
type: QuestionComment
has text: I haven't found a solution yet. I'll try @CompileStatic thanks!!
comment on: http://stackoverflow.com/q/26237277
score: 0

http://stackoverflow.com/q/26332786
tagged with: dice
has body: The Question: Write a program that rolls two dice and adds their sum 36,000,000 times and prints how many times each sum was calculated. So obviously I need to get a rand for 6 numbers twice and add them - in a loop for 36 million times, and then get a frequency counter for however many times each sum was found (which ranges from 2 to 12). Now given the fact that I'm not very experienced in Java, I ran into a couple of problems. This is the code that I've got so far: package twodice; import java.util.Random; public class TwoDice { public static void main(String[] args) { int sum; Random randomNumbers = new Random(); int[] frequency = new int[13]; for (int roll = 2; roll &lt;= 36000000; roll++) { ++frequency[(1 + randomNumbers.nextInt(6)) + (1 + randomNumbers.nextInt(6))]; } System.out.printf("%s%10s\n", "Face", "Frequency"); for(int face = 1; face &lt; frequency.length; face++) { System.out.printf("%4d%10d\n", face, frequency[face]); } } } Output: run: Face Frequency 1 6001537 2 6003025 3 5997753 4 5997647 5 6000769 6 5999269 7 0 8 0 9 0 10 0 BUILD SUCCESSFUL (total time: 0 seconds) The problems are that: 1. The sums that are displaying are not 2-12, they're 1-10 (The right number of sums, just not the right sums... 2. The frequencies are only being found for 1-6, not 1-6 + 1-6. Thanks for all of your help! EDIT: Solved by Oscar Lopez! Thanks so much man!
possible better answer: http://stackoverflow.com/a/26333207
favorite count: 0
has answer: http://stackoverflow.com/a/26333207
upvote count: 4
score: 2
type: AnsweredQuestion
has title: Adding Two Dice 36 Million Times
accepted answer: http://stackoverflow.com/a/26332808
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26332808
downvote count: 2

http://stackoverflow.com/comment/41086341
type: Comment
comment on: http://stackoverflow.com/a/26200764
type: AnswerComment
has text: You want just part of the image rotated around x,y? Also I'm pretty sure you meant `int[] pixels` and not `int[] pixels[]` correct me if I'm wrong
score: 0

http://stackoverflow.com/a/26280958
answers question: http://stackoverflow.com/q/26280894
has body: You can't do that because ArrayList does not implement Queue. You could use a LinkedList instead: Queue&lt;Integer&gt; q = new LinkedList&lt;&gt;();
has comment: http://stackoverflow.com/comment/41233824
has comment: http://stackoverflow.com/comment/41233683
upvote count: 4
has comment: http://stackoverflow.com/comment/41233853
has comment: http://stackoverflow.com/comment/41233763
has comment: http://stackoverflow.com/comment/41233941
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/41233801
type: Answer

http://stackoverflow.com/comment/41098086
has text: json or Rest is passive. So you must reread the file in a short interval. The you can parse the file with an son api like https://code.google.com/p/json-simple/
comment on: http://stackoverflow.com/q/26207533
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26234816
score: 4
type: Answer
answers question: http://stackoverflow.com/q/26234792
upvote count: 4
has body: Array is an Object. Do not directly append the array. Just iterate on array and append each element of array to your String builder. for(String str : arr) { builder.append(str); }
downvote count: 0

http://stackoverflow.com/q/26250549
has comment: http://stackoverflow.com/comment/41178952
has answer: http://stackoverflow.com/a/26250739
has body: This is my code for calling onactivity result. I am using a dialog which prompts to pick image from gallery or from camera. The same code is working in activity but is not working in fragments. I have tried all the previous answers on stackoverflow. Please help AlertDialog.Builder builder = new AlertDialog.Builder( getActivity()); builder.setTitle("Choose Image Source"); builder.setItems(new CharSequence[] { "Pick from Gallery", "Take from Camera" }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: Intent intent = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("outputX", 250); intent.putExtra("outputY", 250); try { intent.putExtra("return-data", true); startActivityForResult( Intent.createChooser( intent, "Complete action using"), PICK_FROM_GALLERY); } catch (ActivityNotFoundException e) { } break; case 1: Intent takePictureIntent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent .resolveActivity(getActivity() .getPackageManager()) != null) { startActivityForResult( takePictureIntent, PICK_FROM_CAMERA); } break; default: break; } } }); builder.show(); public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub try { if (requestCode == PICK_FROM_GALLERY) { System.out.print("ho ja please"); Bundle extras2 = data.getExtras(); if (extras2 != null) { bitmap = extras2.getParcelable("data"); Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); dp.setImageBitmap(output); } } if (requestCode == PICK_FROM_CAMERA) { Bundle extras = data.getExtras(); Bitmap bitmap1 = (Bitmap) extras.get("data"); bitmap = Bitmap.createScaledBitmap(bitmap1, 250, 250, true); Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),…
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/41178594
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41179436
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41178680
downvote count: 0
has answer: http://stackoverflow.com/a/26250683
has title: Android onactivityresult() not being called in fragment
tagged with: onactivityresult
score: 3
has comment: http://stackoverflow.com/comment/41179468
has comment: http://stackoverflow.com/comment/41179267
favorite count: 0
has comment: http://stackoverflow.com/comment/41178699
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41179510

http://stackoverflow.com/q/26305386
tagged with: logic
has answer: http://stackoverflow.com/a/26305877
answer count: 5
has answer: http://stackoverflow.com/a/26305813
has comment: http://stackoverflow.com/comment/41356460
has comment: http://stackoverflow.com/comment/41279334
type: UnansweredQuestion
tagged with: probability
downvote count: 1
has comment: http://stackoverflow.com/comment/41279142
type: Question
score: 3
has body: I'm a new programmer currently in the process of learning Java. I've got a game here based on the game Let's make a deal &amp; the monty hall problem (https://www.youtube.com/watch?v=mhlc7peGlGg) and I've been having issues with the logic for this code. Everything seems to be working right except that I can't seem to get the user_door to switch to the other door and determine if they are a winner correctly. If anybody can help me understand what I'm doing wrong here I would love to take this opportunity to learn, thanks! import java.util.Random; import java.util.Scanner; public class GameShow { public static void main(String[] args) { Scanner scan = new Scanner (System.in); Random generator = new Random(); // Initialize Variables int user_door, open_door, other_door, prize_door; // Generate random value 1-3 prize_door = generator.nextInt(3)+1; open_door = prize_door; while(open_door == prize_door){ open_door = generator.nextInt(3)+1; } other_door = open_door; while (other_door == open_door || other_door == prize_door){ other_door = generator.nextInt(3)+1; } // Begin Game System.out.println("*** Welcome to the game show! ***"); System.out.println("Select the door (1, 2, or 3): "); user_door = scan.nextInt(); // User Validation if (user_door &gt; 3 || user_door &lt; 0) { System.out.println("Please select door 1, 2, or 3"); user_door = scan.nextInt(); } else if(user_door == 1 || user_door == 2 || user_door == 3) { //Continue Game System.out.println("\nIn a moment, I will show you where the prize is located,"); System.out.println("but first I will show you what is behind one of the other doors"); //Continue Dialogue System.out.println("\nBehind door number " + open_door + " are goats!"); System.out.println("You selected door number " + user_door); System.out.println("\nWould you like to switch your door(y/n)? "); //User Input Yes or No char userReply = scan.next().charAt(0); //If statement with nested while statements for user input if (userReply == 'y'){ user_door = ot…
has comment: http://stackoverflow.com/comment/41279308
tagged with: java
has comment: http://stackoverflow.com/comment/41279403
has answer: http://stackoverflow.com/a/26306392
has answer: http://stackoverflow.com/a/26306054
upvote count: 4
has comment: http://stackoverflow.com/comment/41356562
has answer: http://stackoverflow.com/a/39959533
favorite count: 0
has title: Monty Hall Game
has comment: http://stackoverflow.com/comment/41279296

http://stackoverflow.com/q/26309156
score: 0
has comment: http://stackoverflow.com/comment/41286608
has answer: http://stackoverflow.com/a/26309468
type: UnansweredQuestion
has title: How to make a java reflection program output look better?
tagged with: reflection
tagged with: java
type: Question
answer count: 1
has body: I've created a java reflection program similar to javap. Everything works fine but i was wondering if there was a better way to display the output. What i mean by that is I like to take out the java.lang.String whatever in the arguements of each method. Here is my method. ex. public static void compareTo(String s) public static void displayMethods(String s) throws ClassNotFoundException { Class&lt;?&gt; c1 = Class.forName(s); Method [] con = c1.getDeclaredMethods(); for(Method c: con) println(c); } Here is my output public boolean java.lang.String.equals(java.lang.Object) public java.lang.String java.lang.String.toString() public int java.lang.String.hashCode() public int java.lang.String.compareTo(java.lang.Object) public int java.lang.String.compareTo(java.lang.String) public int java.lang.String.indexOf(java.lang.String,int) static int java.lang.String.indexOf(char[],int,int,java.lang.String,int) static int java.lang.String.indexOf(char[],int,int,char[],int,int,int)

http://stackoverflow.com/comment/41303067
type: Comment
has text: @chrylis Okay, I changed it
comment on: http://stackoverflow.com/a/26315649
type: AnswerComment
score: 0

http://stackoverflow.com/q/26296628
has title: How to check the file string path is valid in java
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41269888
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41268082
has comment: http://stackoverflow.com/comment/41264208
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/468789
downvote count: 1
has comment: http://stackoverflow.com/comment/41264542
type: Question
has comment: http://stackoverflow.com/comment/41262564
has answer: http://stackoverflow.com/a/27339481
has body: I am beginner at java and I want to check if the string path that the user provide for the file is valid or not, e.g if the path exists, if contains is not null and the file is not empty and etc. How can I do that? private static final String FILE_PATH = "com.var.file.path"; String file_path = System.getProperty(FILE_PATH, DEFAULT_FILE_PATH);

http://stackoverflow.com/q/26352777
has body: I use netbeans 6.9 ,struts 1.3.10 lib files placed in /web-inf/ folder. resource not available 404 http error is diplayed. did not create any directory to place seprately the action , servlet files. al1 files are in default package. I am novice in j2ee pls help me solving my issue.. Advance thanks.. index.jsp: Hello World! Main page mainpage.java: out.println(" "); out.println(" "); out.println(" Servlet mainpage "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); strapp.java: public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String c=(String)request.getParameter("user"); if(c==null) { return mapping.findForward("error"); } return mapping.findForward("success"); } } success.java: protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { out.println(" "); out.println(" "); out.println(" Servlet success "); out.println(" "); out.println(" "); out.println(" Servlet success at "); out.println(" Success page "); out.println(" "); out.println(" "); } finally { out.close(); } } error.java: out.println(" "); out.println(" "); out.println(" Servlet error "); out.println(" "); out.println(" "); out.println(" Servlet error at "); out.println(" Error page "); out.println(" "); out.println(" "); struts-config.xml: <forward name="success" path="/success.java"/> <forward name="error" path="/error.java"/> web.xml: <?xml version="1.0" encoding="UTF-8" ?> action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml debug 2 detail 2 1 action *.do
answer count: 1
tagged with: struts
score: 0
has answer: http://stackoverflow.com/a/26353382
has title: Struts app resource not available http 404 error using action servlet
type: UnansweredQuestion
tagged with: java
tagged with: servlets
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/41351272
comment on: http://stackoverflow.com/a/26344796
type: AnswerComment
has text: Maybe best solution is to remove static from host variable and assign value to host in onCreate method. Ignore this as finall member variables need initializing before constructor has cmpleted
score: 0
type: Comment

http://stackoverflow.com/a/26212070
has comment: http://stackoverflow.com/comment/41106799
has comment: http://stackoverflow.com/comment/41106863
has body: If you only want to obtain the western most, then there is no reason to sort the list. Coord mostWest = Coord.newAtMaximumEast(); for(Coord coord : listOfCoordinates) if(coord.isFurtherWest(mostWest)) mostWest = coord; A less readable version might be: Coord mostWest = null; for(Coord coord : listOfCoordinates) if(mostWest == null || coord.getLong() &lt; mostWest.getLong()) mostWest = coord; This is O(n) complexity, all sorting algorithms are more complex, with the most efficient still being O(n log n).
answers question: http://stackoverflow.com/q/26211934
has comment: http://stackoverflow.com/comment/41106775
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41113180
has comment: http://stackoverflow.com/comment/41107191
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41113263
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26211934

http://stackoverflow.com/comment/41098849
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26207966
score: 0
has text: Unfortunately I can't use any Collections interfaces. I've written my own iterator class and I'm forced to use that.

http://stackoverflow.com/comment/43938800
has text: @EJP this is the Android extension of the Java key store library which supports aliases. It is used primarily for Android app signing
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26326679
score: 0

http://stackoverflow.com/comment/65147779
type: AnswerComment
score: 0
has text: this did not work for me on ubuntu - however I was running intellij idea fine with X11 forwarding, but when I started my own app in the intellij IDE, then I got following error: Graphics Device initialization failed for : es2, sw Error initializing QuantumRenderer: no suitable pipeline found java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
type: Comment
comment on: http://stackoverflow.com/a/26224404

http://stackoverflow.com/a/26227266
answers question: http://stackoverflow.com/q/26227095
downvote count: 1
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/41169239
type: Answer
has body: I think the best way to do this is to write the length of string name before name. If name is null, just write 0 as its length, and do not write name. When reading, if length is read and its value is zero, do not read name and just set name to null.

http://stackoverflow.com/q/26314059
tagged with: highlight
upvote count: 0
has answer: http://stackoverflow.com/a/26316033
tagged with: swing
has comment: http://stackoverflow.com/comment/41294255
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/41294373
has comment: http://stackoverflow.com/comment/41294818
downvote count: 2
answer count: 1
has body: How I can highlights(Highlighter) in swing(JTextPane) not only text(with rows) when I select two and more rows. I need to highlight selection like in Intellij IDEA. SwingUtilities.invokeLater(new Runnable() { JTextPane textPane = new JTextPane(); JScrollPane textPaneWithScroll = new JScrollPane(textPane); this.getContentPane().add(textPaneWithScroll); this.setVisible(true); }); Screenshot
favorite count: 0
has comment: http://stackoverflow.com/comment/41294762
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41294815
has title: Hightlighting selected text with rows in Java(Swing)

http://stackoverflow.com/q/26245139
possible better answer: http://stackoverflow.com/a/29394173
score: 1063
has comment: http://stackoverflow.com/comment/138472536
has answer: http://stackoverflow.com/a/62585542
has answer: http://stackoverflow.com/a/65593579
linked to: http://stackoverflow.com/q/28581712
has comment: http://stackoverflow.com/comment/107769289
has comment: http://stackoverflow.com/comment/68521662
has answer: http://stackoverflow.com/a/29394173
has answer: http://stackoverflow.com/a/58744127
has comment: http://stackoverflow.com/comment/140270742
has answer: http://stackoverflow.com/a/26245463
has answer: http://stackoverflow.com/a/63215167
has answer: http://stackoverflow.com/a/41428280
has comment: http://stackoverflow.com/comment/111281013
linked to: http://stackoverflow.com/q/34431734
tagged with: user-interface
has answer: http://stackoverflow.com/a/29579718
has title: How to create RecyclerView with multiple view types
has comment: http://stackoverflow.com/comment/138895735
has answer: http://stackoverflow.com/a/55534303
has comment: http://stackoverflow.com/comment/138895605
upvote count: 1066
answer count: 23
has answer: http://stackoverflow.com/a/41691949
favorite count: 0
has answer: http://stackoverflow.com/a/53896666
has comment: http://stackoverflow.com/comment/116325317
has answer: http://stackoverflow.com/a/58234559
has answer: http://stackoverflow.com/a/34464367
has answer: http://stackoverflow.com/a/49629324
tagged with: android
linked to: http://stackoverflow.com/q/25914003
accepted answer: http://stackoverflow.com/a/26245463
has answer: http://stackoverflow.com/a/65845732
has answer: http://stackoverflow.com/a/38787146
has comment: http://stackoverflow.com/comment/83963691
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/39971350
has answer: http://stackoverflow.com/a/29697571
has comment: http://stackoverflow.com/comment/70788734
tagged with: java
has answer: http://stackoverflow.com/a/51153083
has comment: http://stackoverflow.com/comment/46908934
has answer: http://stackoverflow.com/a/62554520
downvote count: 3
has answer: http://stackoverflow.com/a/65492004
has comment: http://stackoverflow.com/comment/137007821
linked to: http://stackoverflow.com/q/33894351
has answer: http://stackoverflow.com/a/56004879
linked to: http://stackoverflow.com/q/31319225
tagged with: android-recyclerview
has comment: http://stackoverflow.com/comment/67535888
type: Question
has body: From Create dynamic lists with RecyclerView: When we create a RecyclerView.Adapter we have to specify ViewHolder that will bind with the adapter. public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt; { private String[] mDataset; public MyAdapter(String[] myDataset) { mDataset = myDataset; } public static class ViewHolder extends RecyclerView.ViewHolder { public TextView mTextView; public ViewHolder(TextView v) { super(v); mTextView = v; } } @Override public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.some_layout, parent, false); //findViewById... ViewHolder vh = new ViewHolder(v); return vh; } @Override public void onBindViewHolder(ViewHolder holder, int position) { holder.mTextView.setText(mDataset[position]); } @Override public int getItemCount() { return mDataset.length; } } Is it possible to create RecyclerView with multiple view types?
has answer: http://stackoverflow.com/a/58249001
has answer: http://stackoverflow.com/a/27893098
has comment: http://stackoverflow.com/comment/138870517

http://stackoverflow.com/comment/41240924
type: Comment
type: QuestionComment
has text: You need to understand static vs non-static first - http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
comment on: http://stackoverflow.com/q/26284650
score: 0

widget
tags question: http://stackoverflow.com/q/26270276
type: Tag
tag name: widget

http://stackoverflow.com/q/26242639
has comment: http://stackoverflow.com/comment/41164606
favorite count: 0
has answer: http://stackoverflow.com/a/26243248
has comment: http://stackoverflow.com/comment/41164821
linked to: http://stackoverflow.com/q/40480
upvote count: 1
accepted answer: http://stackoverflow.com/a/26243248
has comment: http://stackoverflow.com/comment/41164729
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/41163975
tagged with: java
has comment: http://stackoverflow.com/comment/41164904
has comment: http://stackoverflow.com/comment/41163981
type: Question
has title: Instantiating a new object in Java resets all data in other instances of that object
has comment: http://stackoverflow.com/comment/41164757
has comment: http://stackoverflow.com/comment/41164068
downvote count: 0
has comment: http://stackoverflow.com/comment/41164137
has body: I'm currently working with code that has multiple instances of a particular class. Each instance runs through certain tasks, and collects data that is sent to a display layer for display. The problem that is occurring is that when a new instance of the class is created, it resets all other instances of that class that currently exist. Here's an example that will hopefully illustrate my point Foo instanceFooOne = fooService.performActions(data); Foo instanceFooTwo = fooService.performActions(data); class FooService { public void performActions(Object data) { Foo foo = new Foo(); return foo; } } To me, this should have two separate instances of the Foo object, but instead has only the latest version of Foo for all instance of the Foo object created. Is there any way to not have this happen?
answer count: 1

http://stackoverflow.com/comment/41275729
has text: Yes you are right. What i mean is that the duration of the animation is normally 500ms but the scale is immediat, am i missing an attribut or miss-using one ?
type: Comment
comment on: http://stackoverflow.com/a/26303598
score: 0
type: AnswerComment

http://stackoverflow.com/a/26316747
answers question: http://stackoverflow.com/q/26314769
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41303581
type: Answer
score: 2
has body: Of course it is. I suggest that you use annotations on all elements you have @Column for the strings and int elements however for the comments just look at the code down there: Article Class: @Entity @Table(name = "article") public class Article{ private String author; private String body; private int commentCount; @OneToMany(mappedBy = "article") @LazyCollection(LazyCollectionOption.TRUE) private List&lt;EntryComment&gt; comments; Comments Class: @Entity @Table(name = "comments") public class Comment{ @ManyToOne(fetch = FetchType.LAZY) private Article article; private String author; private String body; private int voteCount;
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26314769
has comment: http://stackoverflow.com/comment/41302925
has comment: http://stackoverflow.com/comment/41300943
has comment: http://stackoverflow.com/comment/41303050

http://stackoverflow.com/q/26272718
tagged with: jsp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41219279
has body: I'm trying to create a login system with Sring mvc. I followed this example; it works. But, if I go to the login page after being already logged in, I get this error: HTTP Status 403 - Access is denied -------------------------------------------------------------------------------- type Status report message Access is denied description Access to the specified resource has been forbidden. -------------------------------------------------------------------------------- Apache Tomcat/7.0.42 I wonder if there is a specific "command" of Spring that allow me to be redirected to a specific page if I'm already logged in and I try to go to the login page. I dont' add code here, because I think it's easier to you to see it on the link above.
type: Question
linked to: http://stackoverflow.com/q/12597519
tagged with: spring
tagged with: spring-mvc
duplicate of: http://stackoverflow.com/q/12597519
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41219144
has title: HTTP Status 403 if I go to the login page after being already logged in (Spring security login)
answer count: 0

http://stackoverflow.com/comment/41359458
score: 0
type: AnswerComment
has text: i said when i manually wrote ?id=1 am getting the Id as 1 in the customer id field. but when i run the project and click on addQuery in the url it is stopping at http://localhost:6001/CustomerPortal/customer/addQuery.htm
type: Comment
comment on: http://stackoverflow.com/a/26348496

http://stackoverflow.com/a/26272826
has comment: http://stackoverflow.com/comment/41221425
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26272652
has body: You can use this regex for search: #([^#]*?Label[^#]*)(?=#) Replace Label with your search keyword. RegEx Demo Java Pattern: Pattern p = Pattern.compile( &quot;#([^#]*?&quot; + Pattern.quote(keyword) + &quot;[^#]*)(?=#)&quot; );

http://stackoverflow.com/comment/41285883
score: 2
type: Comment
type: QuestionComment
has text: have you included an activity tag for com.quincy.androidbletest.AndroidBLETest
comment on: http://stackoverflow.com/q/26309075

http://stackoverflow.com/q/26240401
has comment: http://stackoverflow.com/comment/41159482
has body: I'm at very early stages of learning java. I currently have one file which has 900 lines of code, which is not good. I would like to separate my Java file into separate java files which I could "link" together in some way. I used to work a lot with CSS, and there it was insanely easy to pull some stylesheets in with the @import. Would there be a way to "copy" all variables from a file to a different one, the @import way? If I had my array "p" defined in the separate file, could I just @import this file into my main file in a way where I could just try to print p and it would do it? Thanks a lot in advance!
has title: How can I pull variables from one java file to another?
answer count: 4
has answer: http://stackoverflow.com/a/26240929
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26240743
downvote count: 0
has answer: http://stackoverflow.com/a/26240743
has comment: http://stackoverflow.com/comment/41159990
type: Question
has comment: http://stackoverflow.com/comment/41159555
has answer: http://stackoverflow.com/a/26240454
accepted answer: http://stackoverflow.com/a/26240454
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/215497
upvote count: 1
has answer: http://stackoverflow.com/a/26240886
has comment: http://stackoverflow.com/comment/41159558
favorite count: 0
has comment: http://stackoverflow.com/comment/41159584

http://stackoverflow.com/comment/41211552
score: 1
comment on: http://stackoverflow.com/a/26267683
type: AnswerComment
has text: Thank you so much! I would upvote but I don't have enough reputation!
type: Comment

http://stackoverflow.com/comment/41084469
comment on: http://stackoverflow.com/q/26200055
score: 3
type: Comment
type: QuestionComment
has text: Does your code compile? You have messed up variable names names/songNames

generics
tags question: http://stackoverflow.com/q/26196524
tags question: http://stackoverflow.com/q/26323478
tags question: http://stackoverflow.com/q/26203634
tags question: http://stackoverflow.com/q/26263048
tags question: http://stackoverflow.com/q/26303692
tags question: http://stackoverflow.com/q/26260792
tags question: http://stackoverflow.com/q/26304527
tags question: http://stackoverflow.com/q/26323492
tags question: http://stackoverflow.com/q/26330655
tags question: http://stackoverflow.com/q/26315916
tags question: http://stackoverflow.com/q/26293874
tags question: http://stackoverflow.com/q/26229918
tags question: http://stackoverflow.com/q/26338775
tags question: http://stackoverflow.com/q/26346036
tags question: http://stackoverflow.com/q/26343445
tags question: http://stackoverflow.com/q/26285171
tags question: http://stackoverflow.com/q/26247715
tags question: http://stackoverflow.com/q/26320455
tags question: http://stackoverflow.com/q/26315527
tags question: http://stackoverflow.com/q/26323777
tags question: http://stackoverflow.com/q/26217654
tags question: http://stackoverflow.com/q/26269844
type: Tag
tags question: http://stackoverflow.com/q/26289147
tags question: http://stackoverflow.com/q/26266386
tags question: http://stackoverflow.com/q/26314732
tags question: http://stackoverflow.com/q/26234112
tags question: http://stackoverflow.com/q/26200301
tags question: http://stackoverflow.com/q/26196444
tags question: http://stackoverflow.com/q/26303467
tags question: http://stackoverflow.com/q/26269055
tags question: http://stackoverflow.com/q/26288373
tags question: http://stackoverflow.com/q/26348459
tags question: http://stackoverflow.com/q/26206632
tags question: http://stackoverflow.com/q/26238857
tags question: http://stackoverflow.com/q/26290617
tags question: http://stackoverflow.com/q/26258197
tags question: http://stackoverflow.com/q/26301974
tags question: http://stackoverflow.com/q/26250673
tags question: http://stackoverflow.com/q/26269716
tags question: http://stackoverflow.com/q/26205465
tags question: http://stackoverflow.com/q/26222214
tags question: http://stackoverflow.com/q/26234063
tags question: http://stackoverflow.com/q/26314668
tags question: http://stackoverflow.com/q/26257182
tags question: http://stackoverflow.com/q/26348488
tags question: http://stackoverflow.com/q/26306303
tags question: http://stackoverflow.com/q/26200733
tags question: http://stackoverflow.com/q/26275665
tags question: http://stackoverflow.com/q/26327613
tags question: http://stackoverflow.com/q/26301505
tags question: http://stackoverflow.com/q/26336683
tags question: http://stackoverflow.com/q/26242320
tags question: http://stackoverflow.com/q/26197748
tags question: http://stackoverflow.com/q/26200144
tags question: http://stackoverflow.com/q/26306147
tags question: http://stackoverflow.com/q/26197034
tags question: http://stackoverflow.com/q/26267527
tags question: http://stackoverflow.com/q/26223787
tag name: generics
tags question: http://stackoverflow.com/q/26280873
tags question: http://stackoverflow.com/q/26324269
tags question: http://stackoverflow.com/q/26202769
tags question: http://stackoverflow.com/q/26276758
tags question: http://stackoverflow.com/q/26343027
tags question: http://stackoverflow.com/q/26199738

http://stackoverflow.com/q/26314553
linked to: http://stackoverflow.com/q/336067
has comment: http://stackoverflow.com/comment/41299181
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I have alot of .jpg images with some duplicates (of the same size) that only differ slightly in their jpg comrpession level. I need to make a function that somehow returns the same md5 hash of all similar images based on their colors or color/shape/.. signature and ignore the compression level. I thought about calculating the color average of each 4 pixels, and write it as 1 pixel into a grid, then use the result to get an md5 signature of the whole image? I was wondering if there is a better way of doing this, maybe a library or an algorithme that does just this?
answer count: 0
linked to: http://stackoverflow.com/q/10154622
score: 1
tagged with: java
tagged with: image-processing
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41303805
tagged with: algorithm
has title: how to get md5 hash of an image, without being affected by jpeg compression

http://stackoverflow.com/q/26312475
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41291753
tagged with: java
possible better answer: http://stackoverflow.com/a/26312625
has comment: http://stackoverflow.com/comment/41291692
has comment: http://stackoverflow.com/comment/41291624
type: Question
has title: java programming exercise debug program
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/41291629
has comment: http://stackoverflow.com/comment/41291617
has comment: http://stackoverflow.com/comment/41291662
has comment: http://stackoverflow.com/comment/41291608
has comment: http://stackoverflow.com/comment/41291711
has comment: http://stackoverflow.com/comment/41291678
has comment: http://stackoverflow.com/comment/41291668
has answer: http://stackoverflow.com/a/26312625
has body: I want to say thank you for reviewing my post and any contributions to my problem i am having. I am fairly new to java so i was wondering if you guys could please help me debug this program. import java.util.Scanner; public class DebugExercise { public static void main(String[] args) { Scanner input = new Scanner(System.in); String area, inStr; int pages; System.out.println("Please enter your city"); area = input.nextLine(); System.out.println("Please enter page number " + area + "'s phone book"); pages = input.nextInt(); PhoneBook phoneBook = new PhoneBook(area, pages); phoneBook.display(); } } class PhoneBook extends Book { private String area; private String size; PhoneBook(int pages, String city) { super(); area = city; if (pages &gt; 300) { size = "big"; } else { size = "small"; } } public display() { System.out.println( area + pages + size); } } class Book { protected int pages; public Book(int pages) { pages = pages; } public int getPages() { return pages; } }
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/41291764
has comment: http://stackoverflow.com/comment/41291784
has answer: http://stackoverflow.com/a/26312557
accepted answer: http://stackoverflow.com/a/26312557

http://stackoverflow.com/comment/41357883
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26348459
has text: It sounds like you're already aware that generics undergo type erasure when compiled. If so, what is your question?

http://stackoverflow.com/a/26348649
type: Answer
answers question: http://stackoverflow.com/q/26348488
score: 7
upvote count: 7
has body: The main problem here is that generic &lt;E&gt; in Node hides the E from LinkedList&lt;E extends Comparable&lt;E&gt;&gt;. This warning should appear here: private class Node&lt;E extends Comparable&lt;E&gt;&gt; { ^ here you should get a warning with the message The type parameter E is hiding the type E } Since Node is an inner class, it has direct access to the generic E declared in LinkedList. This means, you can easily declare Node class without the generic type: private class Node { E data; Node next; //rest of code... } Then you can easily use Node node variables inside your class. Note that if you declare Node as a static class, then the generic would be necessary and then you should not declare raw variables. This would be: private static Node&lt;E extends Comparable&lt;E&gt;&gt; { E data; Node&lt;E&gt; next; //rest of code... } private Node&lt;E&gt; head; Where the E used in static class Node is different from the E generic declared in LinkedList.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26348488

http://stackoverflow.com/q/26208379
has title: jcloud openstack-neutron : Exception in thread "main" com.google.inject.ConfigurationException:
accepted answer: http://stackoverflow.com/a/27334008
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27334008
tagged with: jclouds
has body: I am trying to use Jcloud openstack neutron API and I am hitting this exception when trying to run, I tried building the neutronApi as below. Took this as an example https://gist.github.com/everett-toews/8701756 Iterable&lt;Module&gt; modules = ImmutableSet.&lt;Module&gt;of(); String provider = "openstack-neutron"; String identity = "admin:admin"; // tenantName:userName String credential = "devstack"; Properties prop = new Properties(); prop.setProperty("jclouds.relax-hostname", "true"); prop.setProperty("jclouds.trust-all-certs", "true"); neutronApi = ContextBuilder.newBuilder(provider) .endpoint("https://&lt;devstack IP&gt;:5000/v2.0") .credentials(identity, credential) .modules(modules).overrides(prop) .buildApi(NeutronApi.class); and I am getting the below exception [java] Exception in thread "main" com.google.inject.ConfigurationException: Guice configuration errors: [java] 1) No implementation for org.jclouds.openstack.neutron.v2_0.NeutronApi was bound. [java] while locating org.jclouds.openstack.neutron.v2_0.NeutronApi [java] 1 error [java] at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1004) [java] at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009) [java] at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:655) [java] at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:647) [java] at openstack.NovaOpenstack.&lt;init&gt;(Unknown Source) [java] at bootstrap.OpenstackBootstrap.main(Unknown Source) Jcloud jar ver - 1.8, guava - 3.0, guice - 1.7 Please let me know what am I doing wrong or how to resolve this. Thanks in advance.
tagged with: openstack
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: guice
tagged with: openstack-neutron

http://stackoverflow.com/q/26338982
type: AnsweredQuestion
has title: logger.info is throwing null pointer exception when whole maven project is run under junit test
has comment: http://stackoverflow.com/comment/41340970
has comment: http://stackoverflow.com/comment/41340316
accepted answer: http://stackoverflow.com/a/26464565
has comment: http://stackoverflow.com/comment/41343010
tagged with: java
has body: Here is the example code class Temp { public static int someMethod() { Logger logger = LoggerFactory.getLogger(Temp.class); logger.info("Some information");//NullPointerException return 0; } } class ClassToTest { public int methodToTest() { Temp tempInstance = new Temp(); int i = temp.someMethod(); return i; } } class TestAClass { ClassToTest classToTestInstance; @Before public void setUp() { classToTestInstance = new ClassToTest(); } @Test public void testMethodToTest() { int i = classToTest.methodToTest(); } } This is a sceneario. This test case may pass. But in actual code when I run the individual test cases or run the whole test class, Test case passes but when I run the maven project under junit test It fails with NullPointerException. I can not post actual code because it is a proprietary code. Please guide me if someone has faced this type of issue. Stack trace which I am getting when I run my actual code: java.lang.NullPointerException at org.slf4j.impl.Log4jLoggerAdapter.info(Log4jLoggerAdapter.java:304) at Temp at ClassToTest at TestAClass 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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:142) at mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:71) at mockit.integration.junit4.internal.MockFrameworkMethod.invokeExplosively(MockFrameworkMethod.java:40) at org.junit.runners.model.FrameworkMethod.invo…
has comment: http://stackoverflow.com/comment/41374400
type: Question
has comment: http://stackoverflow.com/comment/41370161
score: 5
has comment: http://stackoverflow.com/comment/41340337
upvote count: 5
has comment: http://stackoverflow.com/comment/41367930
has comment: http://stackoverflow.com/comment/41341080
has answer: http://stackoverflow.com/a/70245740
has comment: http://stackoverflow.com/comment/41340364
has comment: http://stackoverflow.com/comment/41382420
has comment: http://stackoverflow.com/comment/41341296
tagged with: slf4j
has comment: http://stackoverflow.com/comment/41382444
tagged with: junit
has comment: http://stackoverflow.com/comment/41368591
downvote count: 0
has answer: http://stackoverflow.com/a/26464565
has comment: http://stackoverflow.com/comment/41375975
has comment: http://stackoverflow.com/comment/41343108
answer count: 4
has answer: http://stackoverflow.com/a/71240855
favorite count: 0
possible better answer: http://stackoverflow.com/a/53089900
has answer: http://stackoverflow.com/a/53089900
tagged with: maven
has comment: http://stackoverflow.com/comment/41340532
has comment: http://stackoverflow.com/comment/41341333
has comment: http://stackoverflow.com/comment/41374809
tagged with: logging
has comment: http://stackoverflow.com/comment/41370042

http://stackoverflow.com/q/26245488
tagged with: scope
upvote count: 4
type: AnsweredQuestion
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/26246155
favorite count: 0
has body: How do I determine the appropriate CDI scope for a JPA repository like below? @Transactional public class CategoryRep extends EntityRepository&lt;Integer, Category&gt; { private static final long serialVersionUID = 856370976984333182L; public List&lt;Category&gt; getAllCategories() { // TODO } public List&lt;Post&gt; getAllPostsOfCategory(Integer categoryId) { // TODO } @Transactional(value = TxType.REQUIRES_NEW, rollbackOn = RuntimeException.class) public void createCategory(final String name, final String description) throws DaoJpaException { // TODO } } I can think of only two CDI scopes: @SessionScope: For me this seems to be the most appropriate scope, since a single instance is dedicated to an active session. @Dependent: Reasonable too, since such an instance will be fit into the lifecycle of the object where it will be injected. All other CDI-scopes aren't appropriate in my opinion: @ApplicationScoped: Since an application scoped repository will be created just once a time, a call like: entityManager.clear() will cause that all instances of all current sessions will be detached as well. Additionally this single repository have to handle all incoming requests. Possibly this scope is appropriate for read only repository? @RequestScope: I think that there is no need for a new repository instance for each incoming request. @ConversionScoped: Conversions are normally enforced at the GUI layer. If I want the repository to die after the end of a conversion, I can define it as @Dependent. So, are there any best practices known to this issue?
tagged with: cdi
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26253254
score: 4
has title: Which CDI scope should be preferred for a JPA repository
tagged with: java
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/26253254
has answer: http://stackoverflow.com/a/26246155

http://stackoverflow.com/a/26262208
has body: Hyperjaxb3 is the way to go. It is a JAXB plugin that you include in the build process. When you run your xsd file through xjc, you will not only get xml-related annotations on the generated classes, you will also get JPA annotations. Without writing hardly any code, you will be able to take an XML document, persist it to a database, query the document from the database and get XML text back out. The generated code can be customized either in the xsd file or in an associated binding file (just like with vanilla xjc). We also utilize hbm2ddl on the produced classes to configure hibernate. We have been actively using this on several schemas for the past couple of years. As you edit your XML schema/bindings (and thus your DB schema), you will have to manually write a SQL migration script to upgrade any existing databases. It seems like most DBMS have a schema comparison tool that can be leveraged here. We automatically compare the freshly created schema to the migrated (from a baseline) schema on every build.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26261495
downvote count: 1
score: 2
answers question: http://stackoverflow.com/q/26261495
has comment: http://stackoverflow.com/comment/41246969
has comment: http://stackoverflow.com/comment/41213412
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41206171
type: Answer

http://stackoverflow.com/a/26250425
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26250392
accepted answer of: http://stackoverflow.com/q/26250392
type: AcceptedAnswer
downvote count: 0
has body: You should either use Callable to retrieve the result of the execution(together with Future) or you should wait for the thread to finish to retrieve assigned authtoken. In your case what happening is: while your thread starts, you method already returns, returning still unassigned value of authtoken.

http://stackoverflow.com/q/26292434
has title: How to set list box value on jsp from servlet
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26292553
has body: Here. i have created list box on my jsp file and i got the selected value in my servlet by using getParameter. now i want to set the value of listbox in the same jsp file which i have previously selected when i reload the same jsp file from servlet. jsp file Operation: Addition Subtraction Multiplication Division servlet file operation=req.getParameter("state"); n3=Integer.parseInt(operation);
tagged with: java
tagged with: servlets
answer count: 1
tagged with: jsp
score: 0

http://stackoverflow.com/comment/41292406
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26312961
score: 1
has text: What do you mean lazy? As that usually implies late evaluation.

http://stackoverflow.com/a/26215908
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/26215809
score: -1
has body: I've never used Spring boot but it clearly says it needs a transaction manager. Depending on how you're accessing your DB you need something like: @Bean public PlatformTransactionManager transactionManager() throws Exception { JpaTransactionManager txManager = new JpaTransactionManager(); txManager.setEntityManagerFactory(entityManagerFactory); return txManager; }
downvote count: 1

http://stackoverflow.com/a/26293210
has comment: http://stackoverflow.com/comment/41265628
type: Answer
upvote count: 4
downvote count: 0
has body: You're saying that you have a controller, but you're not respecting the principle of MVC. The principle of MVC is the following one: requests are sent to controllers; controllers prepare a model and dispatch to a view; the view generates HTML code by getting data out of the model. So, you should never have a link pointing to index.jsp, because index.jsp is a view. All your links should point to a controller: &lt;a href="pizzas"&gt;...&lt;/a&gt; A servlet (the controller) should then be mapped to the path pizzas. This servlet will do what your listPizzas() method already doesn except it should dispatch to an appropriate view (not to the same index.jsp page again and again): RequestDispatcher rd = request.getRequestDispatcher("/pizzas.jsp"); rd.forward(request, response); Using a single index.jsp page for the whole application is not a good idea. The page will quickly become huge and unmaintainable. You should have a separate JSP for each view. You can use a template engine (sitemesh, tiles, etc.) or simply includes to avoid duplicating the common elements (the menu, footer, etc.) on every view.
score: 4
answers question: http://stackoverflow.com/q/26289398
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26289398

http://stackoverflow.com/a/26299638
type: Answer
answers question: http://stackoverflow.com/q/26299026
has comment: http://stackoverflow.com/comment/41270198
score: 0
has body: HotSpot sizes its heap according to the total physical RAM on a machine. When you change host machines, you implicitly change the heap limits. It would seem that, on your remote machine, you have less RAM, therefore you hit the limit. However, the real advice would be not to load the entire file into memory; instead read the file in chunks and write them directly to the network socket. Then you won't face this issue no matter what the file size. The same reasoning applies to the server side as well: do not read the whole file from the socket into RAM, but dump it directly into a file.

http://stackoverflow.com/q/26294656
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/41276729
tagged with: client-server
answer count: 3
has comment: http://stackoverflow.com/comment/41291551
upvote count: 1
favorite count: 0
has body: While developing for mobile platform which is the right place to do formatting for numbers and dates? Number and date formatting seems to be easier in Java than Javascript. Is it better to send date as standard format from server and format at client or send nicely formated date from server? Also, if multiple date formats are supposed to be displayed at few places, is it ok for server to send couple of date strings, each formated in one pattern?
has comment: http://stackoverflow.com/comment/41276272
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41299561
has answer: http://stackoverflow.com/a/26295662
downvote count: 0
has answer: http://stackoverflow.com/a/26294932
has answer: http://stackoverflow.com/a/26294881
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41277165
has title: What is the right place to do formating- client or server
tagged with: formatting

http://stackoverflow.com/comment/41213664
type: QuestionComment
comment on: http://stackoverflow.com/q/26269576
score: 0
has text: What exactly is the problem here?
type: Comment

http://stackoverflow.com/comment/41299326
type: Comment
has text: What if the string already contains '*' ? Then the unwanted characters are modified.
score: 3
comment on: http://stackoverflow.com/a/26316727
type: AnswerComment

http://stackoverflow.com/q/26301505
tagged with: jaxb
upvote count: 1
type: Question
has body: I have a method public Response xyz ( JAXBElement&lt;T&gt; request ) { ...... } two different places it is getting called with different JAXBElement. One with xyz(JAXBElement&lt;a&gt;) and other with xyz(JAXBElement&lt;B&gt;) How can I make my method intake generic so that it works with both the methods?
answer count: 1
downvote count: 0
has title: how to take a generic JAXBElement as an input
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/26301770
type: UnansweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/41100653
score: 4
comment on: http://stackoverflow.com/a/26208878
has text: @Abbath Because once `System.in` is closed, you'll need to restart your program to get it open again. If you `close()` immediately before `exit()` it's fine, but if you extract this into a method it can cause you all kinds of grief as your program *mysteriously* stops accepting input.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26203247
tagged with: xml-parsing
has answer: http://stackoverflow.com/a/26207620
answer count: 1
tagged with: deserialization
has title: Deserializing XML @Element and @ElementList with same name from different XML datasets
accepted answer: http://stackoverflow.com/a/26207620
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: I want to deserialize different sets of XML serialized data into one class (not at the same time) using SimpleXML. All of the datasets have a root class of &lt;body/&gt;, but different subclasses. Some have one element of &lt;prediction&gt;, other multiple elements of &lt;prediction&gt;. Same for &lt;route&gt;. This is the code I currently use, but it gives me an error of type PersistenceException ("Duplicate annotation"). What would be the simplest way to solve this? Any help would be appreciated. @Root(name = "body", strict = false) class NextBusAPIResult { @Attribute(name = "copyright") public String Copyright; @Element(name = "predictions", required = false, type = Predictions.class) public Predictions Predictions; @ElementList(name = "predictions", required = false, inline = true) public List&lt;Predictions&gt; PredictionsForMultiStops; @Element(name = "route", required = false, type = RouteInfo.class) public RouteInfo RouteInfo; @ElementList(name = "route", required = false, inline = true) public List&lt;RouteSchedule&gt; RouteSchedules; }
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/26243294
has answer: http://stackoverflow.com/a/26243371
has comment: http://stackoverflow.com/comment/41165363
favorite count: 0
has body: I am not new in java but when I write program I always use int Type of my variables. I want to know when I need to use int data, when byte, when long and so on... Can U explain me this with examples please.
tagged with: primitive-types
possible better answer: http://stackoverflow.com/a/26243371
has comment: http://stackoverflow.com/comment/41165625
has answer: http://stackoverflow.com/a/26243361
upvote count: 1
has comment: http://stackoverflow.com/comment/41165429
accepted answer: http://stackoverflow.com/a/26243361
tagged with: java
answer count: 3
has title: Data types usage in java
has answer: http://stackoverflow.com/a/26244222
has comment: http://stackoverflow.com/comment/41165486
downvote count: 5
tagged with: variables
score: -4
has comment: http://stackoverflow.com/comment/41165450
type: Question
type: AnsweredQuestion
tagged with: types

http://stackoverflow.com/comment/41188495
type: QuestionComment
has text: The number of permutations is **15625** (5^6), **not 7776** (6^5).
score: 0
comment on: http://stackoverflow.com/q/26256374
type: Comment

http://stackoverflow.com/q/26261252
type: AnsweredQuestion
tagged with: super
score: 1
tagged with: java
upvote count: 1
has body: In the below code, why is the super still referring to the subclass variable, and not the super class variable? class Feline { public String type = "f "; public Feline() { System.out.print("feline "); } } public class Cougar extends Feline { public Cougar() { System.out.print("cougar "); } public static void main(String[] args) { new Cougar().go(); } void go() { type = "c "; System.out.print(this.type + super.type); } }
type: Question
linked to: http://stackoverflow.com/q/7794621
possible better answer: http://stackoverflow.com/a/26334635
accepted answer: http://stackoverflow.com/a/26262123
has answer: http://stackoverflow.com/a/26334635
has comment: http://stackoverflow.com/comment/41199469
has title: Why does super not refer to the variable in super class?
has answer: http://stackoverflow.com/a/26334756
linked to: http://stackoverflow.com/q/3351666
downvote count: 0
has answer: http://stackoverflow.com/a/26334741
favorite count: 0
has comment: http://stackoverflow.com/comment/41329639
has answer: http://stackoverflow.com/a/26262123
answer count: 4
has comment: http://stackoverflow.com/comment/41329402

http://stackoverflow.com/comment/41253126
type: AnswerComment
type: Comment
has text: You are my hero. Godspeed...
score: 0
comment on: http://stackoverflow.com/a/26290040

http://stackoverflow.com/comment/41255319
type: AnswerComment
type: Comment
has text: Ask new question with adding table viewer code. I am not able to understand properly.
comment on: http://stackoverflow.com/a/26271536
score: 0

http://stackoverflow.com/q/26283082
has comment: http://stackoverflow.com/comment/41259547
has answer: http://stackoverflow.com/a/26296837
accepted answer: http://stackoverflow.com/a/26296837
tagged with: android
has comment: http://stackoverflow.com/comment/41238028
has title: Android/Flurry: Unable to instantiate activity component?
type: AnsweredQuestion
tagged with: mixpanel
has comment: http://stackoverflow.com/comment/41259472
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am attempting to integrate Mixpanel into a simple application using the instructions here. However I am getting an error that is causing my App to crash. I have no syntax errors in my code (see below). Android Activity: package com.example.testmixpanel; import org.json.JSONException; import org.json.JSONObject; import com.mixpanel.android.mpmetrics.MixpanelAPI; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends Activity { public static final String MIXPANEL_TOKEN = "xxx"; //intentionally not shown // Initialize the library with your // Mixpanel project token, MIXPANEL_TOKEN, and a reference // to your application context. MixpanelAPI mixpanel = MixpanelAPI.getInstance(this, MIXPANEL_TOKEN); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); JSONObject props = new JSONObject(); mixpanel.track("Plan Selected", props); } @Override protected void onDestroy() { mixpanel.flush(); super.onDestroy(); } } However, when I try to run the application I get this error: 0-09 16:36:31.575: E/AndroidRuntime(13192): FATAL EXCEPTION: main 10-09 16:36:31.575: E/AndroidRuntime(13192): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.testmixpanel/com.example.testmixpanel.MainActivity}: java.lang.NullPointerException What could be the cause of this issue? Full stack trace (for reference): 10-09 16:36:31.575: E/AndroidRuntime(13192): FATAL EXCEPTION: main 10-09 16:36:31.575: E/AndroidRuntime(13192): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.testmixpanel/com.example.testmixpanel.MainActivity}: java.lang.NullPointerException 10-09 16:36:31.575: E/AndroidRuntime(13192): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219) 10-09 16:36:31.575: E/AndroidRuntime(13192): at android.app.ActivityThread.handleLaunchA…
type: Question
tagged with: runtimeexception
score: 0
answer count: 1

http://stackoverflow.com/comment/41256287
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26292380
has text: Yes, but you're dividing an int by an int, so it outputs an int. It's a language quirk, and like I said, an easy trap.
score: 0

http://stackoverflow.com/a/26246932
accepted answer of: http://stackoverflow.com/q/26246875
answers question: http://stackoverflow.com/q/26246875
upvote count: 3
has comment: http://stackoverflow.com/comment/41172123
score: 3
has body: The Java Virtual Machine dynamically loads, links and initializes classes and interfaces. - Oracle documentation.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41172179
type: Answer

google-calendar-api
tags question: http://stackoverflow.com/q/26353355
tags question: http://stackoverflow.com/q/26300181
type: Tag
tag name: google-calendar-api

http://stackoverflow.com/a/26311531
downvote count: 0
type: Answer
score: 9
upvote count: 9
has body: You can simply use Thread.sleep() for this purpose. But if you are working in a multithreaded environment with a user interface, you would want to perform this in the separate thread to avoid the sleep to block the user interface. try{ Thread.sleep(60000); // Then do something meaningful... }catch(InterruptedException e){ e.printStackTrace(); }
answers question: http://stackoverflow.com/q/26311470

http://stackoverflow.com/q/26309320
has answer: http://stackoverflow.com/a/26309464
accepted answer: http://stackoverflow.com/a/26309464
has body: I am making an app that will download a string from a website and display it. I tried many examples online and I've literally been searching for days for this, but I can't find a single solution. From what I have read, I know I have to get the content of the url from another thread, but no tutorial showed me how to do this. I have a textview on the layout and that will be where the html content will have to show up. Can anybody show me an example of how this is done?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41286399
tagged with: java
type: Question
has title: Android download string from webpage
has comment: http://stackoverflow.com/comment/41286308
has comment: http://stackoverflow.com/comment/41286437
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41286338
linked to: http://stackoverflow.com/q/11590899
has comment: http://stackoverflow.com/comment/41286278
tagged with: android
linked to: http://stackoverflow.com/q/2376471

http://stackoverflow.com/a/48814681
answers question: http://stackoverflow.com/q/26214597
upvote count: 2
downvote count: 1
has body: I ran into a similar problem. Solved it by passing postgresql.jar as a parameter of spark-submit: spark-submit --class &lt;&lt;class&gt;&gt; --jars /full_path_to/postgressql.jar My_File.jar
type: Answer
score: 1

http://stackoverflow.com/q/26248252
has answer: http://stackoverflow.com/a/26248378
has comment: http://stackoverflow.com/comment/41174959
has comment: http://stackoverflow.com/comment/41175368
has answer: http://stackoverflow.com/a/26248563
tagged with: recursion
type: AnsweredQuestion
score: -2
tagged with: java
accepted answer: http://stackoverflow.com/a/26248516
has comment: http://stackoverflow.com/comment/41174768
has comment: http://stackoverflow.com/comment/41175401
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26248716
possible better answer: http://stackoverflow.com/a/26248378
has comment: http://stackoverflow.com/comment/41174761
has answer: http://stackoverflow.com/a/26248516
has answer: http://stackoverflow.com/a/26248450
favorite count: 0
has title: Given a N number counto from 1 to n and n to 1 recursive method java
answer count: 5
has body: For a programming assigment: Create a recursive method in java that for example for n = 5 returns 1 .2 ..3 ...4 ....5 ...4 ..3 .2 1 (let the point be spaces or tabs)this has been quite a headache im just started this course so im in beginner level and so far i have this public String Esc(int n){ if (n &lt;= 1) return ""+n; else return n + "\n" + Esc(n - 1) + "\n" + n; } that returns 5 4 3 2 1 2 3 4 5 so im not even close and im still missing the spaces problem thanks for helping
downvote count: 4

http://stackoverflow.com/comment/41089611
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26202956
has text: @MarkoTopolnik and the reordering ?

http://stackoverflow.com/q/26306671
favorite count: 0
has title: How to Call a GWT method whenever an Async RPC is Made
type: AnsweredQuestion
upvote count: 2
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/26307067
type: Question
tagged with: gwt
has body: I have a website that utilizes GWT that is secured using Spring with a timeout of... let's say an hour. As part of the process, I am trying to implement a client-side session timeout warning 5 minutes before the session expires. I have the Javascript written out for it, which utilizes cookies. The timer works for initially setting the timer, and has a method for resetting the timer that can be used in GWT through native methods. function resetSessionTimeout() { //update the cookie for the expected timeout var date = new Date(); var timeoutTime = 55 * 60 * 1000; date.setTime(date.getTime() + timeoutTime); createCookie('timeout', date.getTime(), 1); } Whenever an RPC is made to the server, the server-based session timeout is refreshed, so the initial timer is no longer accurate after using any sort of async call. The function above would update the client side with the correct timeout time. The option that definitely works would be to call a native void that calls $wnd.resetSessionTimeout() from every single method I have with an Async call. However, this is a lot of methods, and is poor scalability and smells of poor implementation. Is there a way for me to set up the client portion to observe whenever an RPC has been made and received and then put the native void in there within the MVP level rather than at each method, i.e. are there RPC Observers or Listeners?
accepted answer: http://stackoverflow.com/a/26307067
tagged with: javascript
score: 0
answer count: 1

http://stackoverflow.com/comment/41320044
has text: @Pshemo Loooool, I don't have a clue, that was what the OP put in, I just worked around it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26327917
type: Comment

dialog
tags question: http://stackoverflow.com/q/26300395
tag name: dialog
tags question: http://stackoverflow.com/q/26204433
type: Tag

http://stackoverflow.com/comment/84386161
score: 0
type: AnswerComment
has text: net.minecraft.server.MinecraftServer is a valid class in the file. (Its used to launch the server from the JVM)
type: Comment
comment on: http://stackoverflow.com/a/47090867

http://stackoverflow.com/comment/41259947
type: AnswerComment
comment on: http://stackoverflow.com/a/26294623
type: Comment
has text: Still not working... Whatever you mentioned is not a problem I guess
score: 0

http://stackoverflow.com/q/26245061
accepted answer: http://stackoverflow.com/a/26245103
type: Question
has comment: http://stackoverflow.com/comment/41169093
score: -1
has comment: http://stackoverflow.com/comment/41168906
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41169139
has title: Read bytes from file Java
has comment: http://stackoverflow.com/comment/41169226
answer count: 1
favorite count: 0
has body: I'm trying to parse my file which keeps all data in binary form. How to read N bytes from file with offset M? And then I need to convert it to String using new String(myByteArray, "UTF-8");. Thanks! Here's some code: File file = new File("my_file.txt"); byte [] myByteArray = new byte [file.lenght]; UPD 1: The answers I see are not appropriative. My file keeps strings in byte form, for example: when I put string "str" in my file it actually prints smth like [B@6e0b... in my file. Thus I need to get from this byte-code my string "str" again. UPD 2: As it's found out the problem appears when I use toString(): PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(System.getProperty("db.file")), true), "UTF-8"))); Iterator it = storage.entrySet().iterator();//storage is a map&lt;String, String&gt; while (it.hasNext()){ Map.Entry pairs = (Map.Entry)it.next(); String K = new String(pairs.getKey().toString()); String V = new String(pairs.getValue().toString); writer.println(K.length() + " " + K.getBytes() + " " + V.length() + " " + V.getBytes());//this is just the format I need to have in file it.remove(); } May be there're some different ways to perform that?
linked to: http://stackoverflow.com/q/858980
has comment: http://stackoverflow.com/comment/41168915
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41170086
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/26245103

http://stackoverflow.com/comment/41092715
comment on: http://stackoverflow.com/q/26204624
has text: It looks like some of your XML is missing. Please post the rest of your layout file
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41264775
score: 0
comment on: http://stackoverflow.com/q/26294212
has text: are there any other applications deployed in the same tomcat container? If so remove them out for now and deploy only this application.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26347801
has comment: http://stackoverflow.com/comment/41360131
has comment: http://stackoverflow.com/comment/41356592
has comment: http://stackoverflow.com/comment/41356937
has comment: http://stackoverflow.com/comment/41357779
has comment: http://stackoverflow.com/comment/41356780
has comment: http://stackoverflow.com/comment/41356741
has comment: http://stackoverflow.com/comment/41356525
has comment: http://stackoverflow.com/comment/41357877
type: AnsweredQuestion
score: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/26347990
has comment: http://stackoverflow.com/comment/41358027
favorite count: 0
has comment: http://stackoverflow.com/comment/41356665
type: Question
possible better answer: http://stackoverflow.com/a/26347841
answer count: 2
has comment: http://stackoverflow.com/comment/41357194
has answer: http://stackoverflow.com/a/26347841
has comment: http://stackoverflow.com/comment/41356671
tagged with: netbeans
upvote count: 3
has comment: http://stackoverflow.com/comment/41356672
tagged with: java
has comment: http://stackoverflow.com/comment/41356714
has body: Netbeans * 7.4 * tells me "Unnecessary cast to float" for this line: int points; // EDIT ********************* String word; appendOutput(word + (points &gt; 0 ? "\t" + round((float)points/word.length(),2) : "")); But if I remove (float), the output is truncated (as it should be under the circumstances) to the greatest integer less than points/word.length. So what's up with Netbeans? If I want correct output to hundredths, I have to ignore its suggestion to remove (float). Or am I doing something wrong/untasteful or just missing something? * EDIT * Heh... forgot I wrote my own round method: public static double round(float x, int n){ return Math.floor((0 + Math.pow(10, n)*x + 0.5)) / Math.pow(10, n); } * MCVE * public class JavaApplication66 { public static void main(String[] args) { int points = 23; // EDIT ********************* String word = "FOO"; System.out.println(word + (points &gt; 0 ? "\t" + round((float)points/word.length(),2) : "")); } public static double round(float x, int n){ return Math.floor((0 + Math.pow(10, n)*x + 0.5)) / Math.pow(10, n); } } ** edit ** just added (float) to MCVE... augh...
has comment: http://stackoverflow.com/comment/41357644
has comment: http://stackoverflow.com/comment/41356782
has comment: http://stackoverflow.com/comment/41356515
has answer: http://stackoverflow.com/a/26347990
has comment: http://stackoverflow.com/comment/41356523
tagged with: casting
has title: "Unnecessary cast to float" seems necessary. What am I missing?

http://stackoverflow.com/a/26235161
answers question: http://stackoverflow.com/q/26235136
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: When you re-factor your Class name later, the hardcoded name won't change and the getSimpleName() always gives you the current Class name. You always need to remember the places to change if you hard code the class name while updating the Class name. Not only Class name, avoid hard coding AMAP. Otherwise it really increase the cost of maintenance.

http://stackoverflow.com/a/26260541
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26260101
has body: What is the wire format for your PUT request. If it is JSON then the server will simply try and re-create your server side object from the JSON data. And so long as the signatures match the object will be unmarshalling without an error. To get the sort of behavior you are looking for you need to use XML and JAXB. In this case the XML sent across will have enough info to ensure the correct class is created when unmarshalling.

http://stackoverflow.com/comment/41218160
type: Comment
type: QuestionComment
has text: @BoldijarPaul he adds `player.getWidth() / 2` and `player.getHeight() / 2`.
comment on: http://stackoverflow.com/q/26269141
score: 0

http://stackoverflow.com/comment/41313900
type: QuestionComment
has text: You can use any code formatting/indentation you want in your own code, but when asking other people for help, take the time to format the code reasonably. I've done so for you this time (and added two missing `}` from the end -- if they're not in your real code, use the "edit" link to remove them, but of course then you'll have a compilation error).
score: 1
type: Comment
comment on: http://stackoverflow.com/q/26324656

http://stackoverflow.com/comment/41129077
has text: I'm not quite sure what you're asking. Could you maybe edit your question to provide some sample keyboard input and some desired console output?
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26223823

http://stackoverflow.com/q/26323398
has comment: http://stackoverflow.com/comment/41311468
possible better answer: http://stackoverflow.com/a/26323482
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41311523
has title: When you extend an abstract class which implements an interface does it make the class a type of interface and abstract?
tagged with: java
has comment: http://stackoverflow.com/comment/41311549
has body: I'm currently preparing for my scjp exam. I know that IS-A means extends an HAS-A means to have an instance of another object. But what if you extend an abstract class which implements another interface, does it make the class a type of interface and abstract as well? interface Animal{ void eat(); void sleep(); } abstract class Duck implements Animal{ public void eat(){} public void sleep(){} } class Animals extends Duck{ //dosomething... } class Animals IS-A(N) Animal and IS-A Duck or class Animals IS-A(N) Animal or class Animals IS-A Duck
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26323420
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/41311491
has comment: http://stackoverflow.com/comment/41311900
favorite count: 0
has answer: http://stackoverflow.com/a/26323482
downvote count: 2
has answer: http://stackoverflow.com/a/26323420

http://stackoverflow.com/a/26205596
type: Answer
has body: you are trying to convert null to integer String Matrix = null; Integer.parseInt(Matrix); // here is exception if you want input from user then do like this: int matrix=new Scanner(System.in).nextInt(); printMatrix(matrix); // print matrix
answers question: http://stackoverflow.com/q/26205559
score: 0

http://stackoverflow.com/q/26319579
tagged with: arrays
has answer: http://stackoverflow.com/a/26319746
has answer: http://stackoverflow.com/a/26319677
upvote count: 1
has answer: http://stackoverflow.com/a/26319661
answer count: 4
tagged with: integer
favorite count: 0
has comment: http://stackoverflow.com/comment/41304505
type: UnansweredQuestion
has title: How to split an Integer into an Array using Java?
downvote count: 0
has answer: http://stackoverflow.com/a/26319729
score: 1
tagged with: java
type: Question
has body: I apologise if this has already been asked before, but I was unable to find a conclusive answer after some extensive searching, so I thought I would ask here. I am a beginner to Java (to coding, in general) and was tasked with writing a program that takes a user-inputted 3 digit number, and adds those three digits. Note: I cannot use loops for this task, and the three digits must all be inputted at once. String myInput; myInput = JOptionPane.showInputDialog(null,"Hello, and welcome to the ThreeDigit program. " + "\nPlease input a three digit number below. \nThreeDigit will add those three numbers and display their sum."); int threedigitinput; threedigitinput = Integer.parseInt(myInput);

http://stackoverflow.com/comment/51723045
type: AnswerComment
score: 1
has text: Please fix this illegible mess.
type: Comment
comment on: http://stackoverflow.com/a/31904374

http://stackoverflow.com/q/26215086
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/26215276
has title: Java swing component to show image grid
tagged with: java
has comment: http://stackoverflow.com/comment/41112276
tagged with: jcomponent
has body: Its been a while since i built a desktop JAVA application.. after lots of documentation and doing implementation tests, i still have not found an image grid solution. Either Java lacks such a ready-to-use component (?!) or you tell me to brush up my google-fu. :) I have a very simple technical premises: a JDialog that allows the user to pick an image. Input is a Map&lt;Integer, String&gt; list that holds filenames. Output is the Integer key the user chose. GUI also is simple: user chooses 1 image using mouse or keyboard, and dialog closes. All images are 80x80px and loaded from filename, not a resource. I tried several approaches so far this morning: Search for components/widgets that show scrollable imagegrid that can flow to the left. (no dice) Search for components/widgets that show scrollable imagegrid (no dice) Search for any components/widgets/gui-libs (no dice .. do these even exist?!) Try and implement myJList.setModel(), but i cant get it to just take my Map&lt;> and show thumbnails. (overcomplicates!) Try and implement myJPanel.setlayout(new FlowLayout(..)) with several myJPanel.add(new JButton(..)) which just creates a bunch of JButton on a JPanel, which each need a event handler. I wonder how scrolling and keyboard input is going to work out, and how i'm supposed to keep/reference my Map&lt;&gt; key values. (overcomplicates?) In lieu of your answer, i am now working on the latter, which should work but i cant believe everyone needs to reinvent the same GUI wheel here. How to have the user select an image from my Map&lt;Integer, String&gt;? Are there JAVA libraries/widgets/components that i should look to avoid this? I hope this isn't being modded down, i have no working implementation with error to show you guys.. this question is about how/where to find the components or what approaches would be better. Its 2014 and i cant believe that JAVA still requires me to build my own "GUI component" just to see some images.. not even Delphi or Mono does that.
type: Question
tagged with: netbeans-8
score: 0
answer count: 2
tagged with: user-interface
has answer: http://stackoverflow.com/a/26215296

http://stackoverflow.com/a/26315951
answers question: http://stackoverflow.com/q/26312063
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: The most basic installation of derby into your application is pretty effortless. It's really just a matter of put the library/jar on the class path. Netbeans already comes with this library, so you don't have to download it. If for any reason, it doesn't, you can download it from here. After you unzip it, just add the derby.jar (and others if necessary) to the classpath. Basically from Netbeans, from your project, right click on the [Library] and select [Add Library]. Then just select the [Java DB] library If you downloaded the library, then instead of [Add Library], select [Add Jar] and search for the jar where you downloaded it to. These are the jars that come with the Netbeans library Then you can use the database in your application. The embedded version runs on the same JVM as your application, so you may want to take care of starting and shutting down the database yourself. Here's a sample application that starts-createsdb-inserts-selects-shutsdown. import java.sql.*; public class DerbyProject { public static void main(String[] args) throws Exception { /* ------- Start DB ----------- */ final String driver = "org.apache.derby.jdbc.EmbeddedDriver"; Class.forName(driver).newInstance(); final String protocol = "jdbc:derby:"; final String dbName = "derbyDB"; Connection connection = DriverManager.getConnection( protocol + dbName + ";create=true"); System.out.println("===== Started/Connected DB ====="); /* * Drop table for testing. If we don't drop, running the * same program will fail, if we start our application over * as the new table has been persisted */ final String dropSql = "drop table users"; Statement statement = connection.createStatement(); try { statement.execute(dropSql); System.out.println("===== Dropped Table 'users' ====="); } catch (SQLException e) { if (!e.getSQLState().equals("42Y55")) { throw e; } } /* ----- Creeate 'users' table ----- */ final String createSql = "create table users ( id int, name varchar(32) )"; statement.execute(createSql); Sy…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26312063

http://stackoverflow.com/a/26329964
has body: Your problem is the following: if (otherItem.myItemName.equals(this.myItemName) &amp;&amp; otherItem.myItemPrice.equals(this.myItemPrice)) { if (otherItem.myItemBulkQuantity != 0 &amp;&amp; !otherItem.myItemBulkPrice.equals(BigDecimal.ZERO)) { result = otherItem.myItemBulkPrice.equals(this.myItemBulkPrice) &amp;&amp; otherItem.myItemBulkQuantity == this.myItemBulkQuantity; } } if the two parameters are equal, but the other two not, your result will not be set, and you initialized it with false, so it will return false! You have to implement an else to the second if, and set something like result = otherItem.myItemName.equals(this.myItemName) &amp;&amp; otherItem.myItemPrice.equals(this.myItemPrice) or directly result = true, because you checked it in the first if!
type: Answer
answers question: http://stackoverflow.com/q/26329661
has comment: http://stackoverflow.com/comment/41323917
accepted answer of: http://stackoverflow.com/q/26329661
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/26353732
answers question: http://stackoverflow.com/q/26353574
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: Hope it works: public void gettingFee() { List&lt;String&gt; allIds = new ArrayList&lt;String&gt;(); WebElement tdElement = driver.findElement(By.xpath("//*[@id='tblRenewalAgent']/tbody/tr/td")); List&lt;WebElement&gt; allDivElements = tdElement.findElements(By.tagName("div")); for(int i = 0; i&lt;allDivElements.size(); i++){ try{ String id = allDivElements.get(i).getAttribute("id"); allIds.add(id ); } catch(Exception e) {} } }

http://stackoverflow.com/comment/41152392
type: Comment
type: QuestionComment
has text: Use this: **int java.lang.Integer.parseInt(String s) throws NumberFormatException**
score: 0
comment on: http://stackoverflow.com/q/26236738

http://stackoverflow.com/comment/41121202
type: AnswerComment
type: Comment
has text: @Eran Yes, however isn't that also true of the method you described?
comment on: http://stackoverflow.com/a/26212452
score: 0

http://stackoverflow.com/q/26250242
tagged with: spring
upvote count: 6
has answer: http://stackoverflow.com/a/32694580
type: UnansweredQuestion
tagged with: enums
tagged with: message
tagged with: java
score: 6
type: Question
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/17167144
tagged with: jsp
has comment: http://stackoverflow.com/comment/41177974
favorite count: 0
has body: I have an enum where values are presented in utf8 format. Because of this i have some encoding problems in my jsp view. Is there a way to get values from my messages.properties file. What if i have following lines in my properties file: shop.first=Первый shop.second=Второй shop.third=Третий How can i inject them in enum? public enum ShopType { FIRST("Первый"), SECOND("Второй"), THIRD("Третий"); private String label; ShopType(String label) { this.label = label; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } }
has title: Spring get enum values from properties file

http://stackoverflow.com/comment/41202240
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26263678
has text: Duplicate: http://stackoverflow.com/questions/12994342/how-to-read-whitespace-with-scanner-next
score: 0

validation
tags question: http://stackoverflow.com/q/26337002
tags question: http://stackoverflow.com/q/26216112
tags question: http://stackoverflow.com/q/26259176
tags question: http://stackoverflow.com/q/26340941
tags question: http://stackoverflow.com/q/26212934
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/26320139
tags question: http://stackoverflow.com/q/26329911
tags question: http://stackoverflow.com/q/26351967
tags question: http://stackoverflow.com/q/26226910
tags question: http://stackoverflow.com/q/26353169
tags question: http://stackoverflow.com/q/26215388
tags question: http://stackoverflow.com/q/26351278
tags question: http://stackoverflow.com/q/26304783
tags question: http://stackoverflow.com/q/26331985
tags question: http://stackoverflow.com/q/26310033
tags question: http://stackoverflow.com/q/26205076
tags question: http://stackoverflow.com/q/26238149
tags question: http://stackoverflow.com/q/26264880
tags question: http://stackoverflow.com/q/26256143

http://stackoverflow.com/q/26352712
has answer: http://stackoverflow.com/a/26359758
tagged with: cassandra
type: UnansweredQuestion
has title: Cassandra type error
upvote count: 9
tagged with: java
has body: Row row = DataSession._getSession().execute("select count (*) from sivri_service.bronzelist").one(); int expected = row.getVarint("count").intValue(); I am attempting to get the count from a table, but I cannot seem to get past this exception: com.datastax.driver.core.exceptions.InvalidTypeException: Column count is of type bigint
score: 9
type: Question
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/41274357
score: 0
comment on: http://stackoverflow.com/a/26284602
type: Comment
has text: **Three** Either the beans annotated with `@Transactional` have no idea if they are working in a Testing or Production environment **Four**: Spring handles the resource management of the datasource, open, close connection, so the risk to have leaks **does not** exists. **Five**: Read the Spring Reference documentation about Transactions.
type: AnswerComment

http://stackoverflow.com/comment/41091118
comment on: http://stackoverflow.com/a/26203350
score: 0
type: Comment
has text: @TedHopp that doesn't work. System.out is an object of type PrintStream; its methods are not static.
type: AnswerComment

http://stackoverflow.com/q/26211480
tagged with: keystore
upvote count: 3
tagged with: java
has body: I'm trying to extract a private key from a java keystore and then feed it to Ganymed SSH in order to establish a connection with public key authentication. It is however refusing to connect. I can successfully connect through Cygwin (ssh -i) with files generated by the following program, but the program itself is unable to get past authentication on the same machine. What am I doing wrong? I don't get an exception, Connection.authenticateWithPublicKey(String, char[], String) simply returns false, so this should not be a formatting problem. It does not matter if I leave the private key unencrypted, the result is the same. Also, I was able to connect with a program similar to this with files generated by putty-gen and ssh-keygen. You will need the following to compile (bouncycastle and ganymed): bcprov bcpkix ganymed-ssh2 Generate the keystore with: keytool -genkeypair -keystore keystore.jks -alias myalias -storepass password -keypass password -keyalg RSA -dname CN=myalias,O=example.com -storetype JKS -validity 365 -v Code (expects host and port as args and the above keystore in working directory): import ch.ethz.ssh2.Connection; import java.io.ByteArrayOutputStream; import java.io.CharArrayWriter; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.security.GeneralSecurityException; import java.security.Key; import java.security.KeyStore; import java.security.PublicKey; import java.security.SecureRandom; import java.security.cert.Certificate; import java.security.interfaces.DSAParams; import java.security.interfaces.DSAPublicKey; import java.security.interfaces.RSAPublicKey; import javax.xml.bind.DatatypeConverter; import org.bouncycastle.openssl.PEMEncryptor; import org.bouncycastle.openssl.jcajce.JcaPEMWriter; import org.bouncycastle.open…
answer count: 1
tagged with: private-key
has title: Use JKS keystore for public key authentication with Ganymed SSH
type: UnansweredQuestion
tagged with: public-key
score: 3
downvote count: 0
tagged with: ssh
has answer: http://stackoverflow.com/a/26218046
favorite count: 0
type: Question

http://stackoverflow.com/comment/41118323
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26216238
type: Comment
has text: Sorry for wasting your time.I put the xml file under WEB-INF/classes and now it works. I already tried it without solving the problem, probably it was a problem of eclipse. I cleaned my project, restarted eclipse and now it works. Thank you :)

dll
tags question: http://stackoverflow.com/q/26220214
tags question: http://stackoverflow.com/q/26263860
type: Tag
tag name: dll

http://stackoverflow.com/a/26278417
has body: You can't feed plain text to an XSL transformer. It only accepts well-formed XML as input. So the code in the linked question starts the transformer with no input and then inside of XSLT, it loads the text with &lt;xsl:variable name="csv" select="unparsed-text($pathToCSV, $encoding)" /&gt;
answers question: http://stackoverflow.com/q/26278268
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41229094
downvote count: 0

hashmap
tags question: http://stackoverflow.com/q/26316177
tags question: http://stackoverflow.com/q/26309685
tags question: http://stackoverflow.com/q/26342580
tags question: http://stackoverflow.com/q/26205145
tags question: http://stackoverflow.com/q/26292155
tags question: http://stackoverflow.com/q/26296911
tags question: http://stackoverflow.com/q/26228272
tags question: http://stackoverflow.com/q/26232691
tags question: http://stackoverflow.com/q/26325544
tags question: http://stackoverflow.com/q/26259718
tags question: http://stackoverflow.com/q/26288307
tags question: http://stackoverflow.com/q/26323943
tags question: http://stackoverflow.com/q/26230707
tags question: http://stackoverflow.com/q/26204209
tags question: http://stackoverflow.com/q/26211684
type: Tag
tags question: http://stackoverflow.com/q/26341310
tags question: http://stackoverflow.com/q/26230225
tags question: http://stackoverflow.com/q/26312961
tags question: http://stackoverflow.com/q/26310476
tags question: http://stackoverflow.com/q/26274431
tags question: http://stackoverflow.com/q/26195035
tags question: http://stackoverflow.com/q/26337169
tags question: http://stackoverflow.com/q/26310816
tags question: http://stackoverflow.com/q/26212101
tags question: http://stackoverflow.com/q/26203803
tags question: http://stackoverflow.com/q/26241955
tags question: http://stackoverflow.com/q/26331861
tags question: http://stackoverflow.com/q/26311776
tags question: http://stackoverflow.com/q/26318370
tags question: http://stackoverflow.com/q/26260595
tags question: http://stackoverflow.com/q/26291655
tags question: http://stackoverflow.com/q/26243740
tags question: http://stackoverflow.com/q/26331187
tags question: http://stackoverflow.com/q/26206476
tag name: hashmap
tags question: http://stackoverflow.com/q/26288122

http://stackoverflow.com/a/26218101
score: 0
has body: alter the vm options file in the intellij install directory. Alternatively fix the problem that causes out of memory errors.
answers question: http://stackoverflow.com/q/26218065
type: Answer
has comment: http://stackoverflow.com/comment/41120145

http://stackoverflow.com/q/26226031
has body: I'm relativley new to relational databases and I have some problems concerning the creation of queries. First I want to explain the situation shortly. I have several entity classes. All of them extend AbstractEntity or EntityProperty. So entities can have properties and properties have owning entities, so there is a bidirectional relation. Now let's say ConcreteEntity extends AbstractEntity and I want to create queries like this: Get all entities of type ConcreteEntity which has at least on property with a name contained in the given list propertyNames. Until now I have the following working criteria query: CriteriaQuery&lt;AbstractEntity&gt; cq = cb.createQuery(AbstractEntity.class); Root&lt;EntityProperty&gt; property = cq.from(EntityProperty.class); Join&lt;EntityProperty, AbstractEntity&gt; entity = property.join(EntityProperty_.owningEntities); cq.where(property.get(EntityProperty_.name).in((Object[]) propertyNames)); cq.select(entity); But now I want only those entities of type ConcreteEntity. How could I achieve this? In JPQL I wrote "SELECT entity FROM EntityProperty property JOIN property.owningEntities entity" and here I also have no idea how to write it in the way that only a specific type is returned... Thanks for answers in advance! EDIT: moved the second question to criteria query: indistinct result lists and removed distinct in the code (that didn't work)
has comment: http://stackoverflow.com/comment/41133283
has title: Criteria API: filter by class type
downvote count: 0
type: UnansweredQuestion
score: 6
tagged with: jpql
tagged with: sql
favorite count: 0
tagged with: jpa-2.0
has answer: http://stackoverflow.com/a/26237854
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41133415
tagged with: criteria-api
upvote count: 6
has answer: http://stackoverflow.com/a/40010525
tagged with: java
linked to: http://stackoverflow.com/q/26237579

gmail
type: Tag
tags question: http://stackoverflow.com/q/26224923
tag name: gmail

http://stackoverflow.com/q/26303569
downvote count: 1
has comment: http://stackoverflow.com/comment/41275593
answer count: 4
linked to: http://stackoverflow.com/q/9560600
favorite count: 0
has comment: http://stackoverflow.com/comment/41275504
tagged with: inner-classes
possible better answer: http://stackoverflow.com/a/26303606
has comment: http://stackoverflow.com/comment/41275585
has answer: http://stackoverflow.com/a/26303606
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26303709
accepted answer: http://stackoverflow.com/a/26303709
tagged with: java
has answer: http://stackoverflow.com/a/26303707
has answer: http://stackoverflow.com/a/26303972
type: Question
has body: This is my main class: import java.util.ArrayList; public class MainClass { public static void main(String[] args){ ArrayList&lt;SecondClass.InnerClass&gt; list=new ArrayList&lt;SecondClass.InnerClass&gt;(); list.add(new SecondClass.InnerClass()); //error here (read below) } } Here is the second class: public class SecondClass { public class InnerClass{ } } At MainClass, at list.add, I get this error: No enclosing instance of type SecondClass is accessible. Must qualify the allocation with an enclosing instance of type SecondClass (e.g. x.new A() where x is an instance of SecondClass). I need to have InnerClass non-static because InnerClass needs to make a static reference to a non-static method. How can I add elements in the ArrayList?
has title: How can I fill an Arraylist with inner classes?
score: 0
has comment: http://stackoverflow.com/comment/59242514
upvote count: 1

http://stackoverflow.com/comment/41317089
score: 0
type: AnswerComment
type: Comment
has text: I already got it and it's similar with this, but thanks anyway :)
comment on: http://stackoverflow.com/a/26326057

http://stackoverflow.com/q/26242425
upvote count: 0
has comment: http://stackoverflow.com/comment/41163543
type: UnansweredQuestion
downvote count: 3
has answer: http://stackoverflow.com/a/26242558
has comment: http://stackoverflow.com/comment/41163726
has body: class marathon { public static void main (String[] arguments) { String[] names = {"Elena", "Thomas", "Hamilton", "Suzie", "Phil", "Matt", "Alex", "Emma", "John", "James", "Jane", "Emily", "Daniel", "Neda", "Aaron", "Kate" }; int[] times = {341, 273, 278, 329, 445, 402, 388, 275, 243, 334, 412, 393, 299, 343, 317, 265}; for (int i = 0; i &lt; names.length; i++) { System.out.println(names[i] + ": " + times[i]); } } }
has comment: http://stackoverflow.com/comment/41163620
has answer: http://stackoverflow.com/a/26242543
has comment: http://stackoverflow.com/comment/41163670
has answer: http://stackoverflow.com/a/26242604
tagged with: java
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/41163596
has comment: http://stackoverflow.com/comment/41163719
has comment: http://stackoverflow.com/comment/41163720
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/41163750
has title: How can i print the fastest time

http://stackoverflow.com/q/26254375
upvote count: 3
has body: I was tasked with creating an Annotation for Custom Validation. This was due to some problems with handling database constraint violations nicely. What I did in response to this was relatively simple. I created a class-level CustomConstraint specifically for the one domain-class that required it. What I got as my current result is the following: @UniqueLocation Annotation: @Target({ TYPE, ANNOTATION_TYPE }) @Retention(RUNTIME) @Constraint(validatedBy = UniqueLocationValidator.class) @Documented public @interface UniqueLocation { String message() default "must be unique!"; Class&lt;?&gt;[] groups() default {}; Class&lt;? extends Payload&gt;[] payload() default {}; } This is not spectacular, in fact it's copied almost verbatim from the hibernate documentation. I proceeded to create my UniqueLocationValidator and ran into a problem with using the persistence context in there. I wanted to run a defensive select, and thusly tried to Inject my application wide @Produces @PersistenceContext EntityManager. Therefor I included JBoss Seam to use it's InjectingConstraintValidatorFactory configuring my validation.xml as follows: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"&gt; &lt;constraint-validator-factory&gt; org.jboss.seam.validation.InjectingConstraintValidatorFactory &lt;/constraint-validator-factory&gt; &lt;/validation-config&gt; After running into some issues with Creating Constraint Violations this is how my Validator actually looks: @ManagedBean public class UniqueLocationValidator implements ConstraintValidator&lt;UniqueLocation, Location&gt; { // must not return a result for name-equality on the same Id private final String QUERY_STRING = "SELECT * FROM Location WHERE locationName = :value AND id &lt;&gt; :id"; @Inject En…
type: Question
linked to: http://stackoverflow.com/q/25997520
score: 3
tagged with: seam
tagged with: java
tagged with: hibernate
has title: Custom Validation Annotation introduces ConcurrentModificationException
linked to: http://stackoverflow.com/q/9482731
linked to: http://stackoverflow.com/q/25737951
tagged with: jpa
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26299879
favorite count: 0
tagged with: concurrentmodification
has answer: http://stackoverflow.com/a/26299879
type: AnsweredQuestion

http://stackoverflow.com/comment/41103692
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26210407
score: 0
has text: Where is the file stored (in relationship to the source)? `jrxml` needs to be compiled before it can be filled

http://stackoverflow.com/a/26336817
accepted answer of: http://stackoverflow.com/q/26327487
type: Answer
answers question: http://stackoverflow.com/q/26327487
has comment: http://stackoverflow.com/comment/42474090
upvote count: 3
score: 3
has body: Well, this is going to be a long answer ... You could use a custom JsonDeserializer to deserialize the variable part of the json string based on the ruleid. public class MessageAdapter implements JsonDeserializer&lt;Message&gt; { private Map&lt;String, Class&lt;? extends Result&gt;&gt; ruleToResultClassMap; public MessageAdapter() { this.ruleToResultClassMap = new HashMap&lt;String, Class&lt;? extends Result&gt;&gt;(); ruleToResultClassMap.put("73B5EEB4", DurationResults.class); ruleToResultClassMap.put("35B5EEB4", ErrorResults.class); } @java.lang.Override public Message deserialize(JsonElement json, java.lang.reflect.Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject messageObject = json.getAsJsonObject(); JsonArray bodyArray = messageObject.getAsJsonArray("body"); List&lt;Result&gt; results = new ArrayList&lt;Result&gt;(); for (JsonElement bodyElement : bodyArray) { JsonObject resultObject = bodyElement.getAsJsonObject(); JsonObject ruleObject = resultObject.getAsJsonObject("rule"); String ruleId = ruleObject.getAsJsonPrimitive("ruleid").getAsString(); Class&lt;? extends Result&gt; resultClass = ruleToResultClassMap.get(ruleId); if (resultClass != null) { Result result = context.deserialize(resultObject, resultClass); results.add(result); } else { throw new IllegalArgumentException("Illegal ruleId: " + ruleId); } } return new Message(results, context.&lt;Header&gt;deserialize(messageObject.getAsJsonObject("header"), Header.class)); } } You need to register the custom deserializer with GsonBuilder: GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(Message.class, new MessageAdapter()); Gson gson = gsonBuilder.create(); String jsonString = null; // your json string Message message = gson.fromJson(jsonString, Message.class); Here Message is the root POJO of the json string, you probably have your own. For full reference, I include all classes here: public class Message { private List&lt;? extends Result…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42481489

http://stackoverflow.com/a/26413979
type: Answer
has body: What would you do if you want to compare two instances of the same class using the "Account (name=" format.
downvote count: 2
score: -2
upvote count: 0
answers question: http://stackoverflow.com/q/26335340

http://stackoverflow.com/q/26274132
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41221515
favorite count: 0
has body: I have created a web project in eclipse and in order to run the project in Tomcat server i had exported the file in .war format. I have kept a separate computer to run the project, so i could use it from different computers as it has a static IP. My current error is: HTTP Status 500 - Error instantiating servlet class com.complexible.common.csv.DisplayRecord I am adding my web.xml file. Please provide me the possible solutions. <?xml version="1.0" encoding="UTF-8" ?> - Museumnew - index.html index.htm index.jsp default.html default.htm default.jsp /axis2-web/index.jsp - <description /> DisplayRecord DisplayRecord com.complexible.common.csv.DisplayRecord - DisplayRecord /DisplayRecord - Apache-Axis Servlet AxisServlet org.apache.axis.transport.http.AxisServlet - AxisServlet /servlet/AxisServlet - AxisServlet *.jws - AxisServlet /services/* - Axis Admin Servlet AdminServlet org.apache.axis.transport.http.AdminServlet 100 - AdminServlet /servlet/AdminServlet - Apache-Axis Admin Servlet Web Admin AxisAdminServlet org.apache.axis2.transport.http.AxisAdminServlet 100 - AxisAdminServlet /axis2-admin/* Here is a servlet code. package com.complexible.common.csv; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONException; import org.json.simple.parser.ParseException; /** * Servlet implementation class DisplayRecord */ public class DisplayRecord extends HttpServlet { private static final long serialVersionUID = 1L; /** * @throws IOException * @throws ParseException * @throws JSONException * @see HttpServlet#HttpServlet() */ public DisplayRecord() throws IOException, JSONException, ParseException { super(); String getrec=GetRecord.getrec("http://phdprototype.tk/collectionimage/4D0BFF17-5810-4644-A550-D35EE090D4A8.png","3","0"); System.out.println(getrec); // TODO Auto-generated const…
has title: HTTP Status 500 - Error instantiating servlet class
has comment: http://stackoverflow.com/comment/41221587
duplicate of: http://stackoverflow.com/q/11731377
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26290761
type: Question
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41235567
has comment: http://stackoverflow.com/comment/41221348
tagged with: eclipse
tagged with: servlets
linked to: http://stackoverflow.com/q/11731377
answer count: 2
tagged with: jena
score: -2
has answer: http://stackoverflow.com/a/28084498

http://stackoverflow.com/comment/41307542
comment on: http://stackoverflow.com/q/26321088
score: 0
has text: You are using I twice messing up your loop sequence
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41123802
has text: Try the updated gist. It's been a while since I've done Java.
score: 0
comment on: http://stackoverflow.com/q/26220161
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41325640
type: Comment
comment on: http://stackoverflow.com/q/26330852
score: 0
type: QuestionComment
has text: Why do you start both loops with `2`?

http://stackoverflow.com/a/28790842
has body: Please find working example from here: https://github.com/sunrise-projects/sphinx4/tree/glass package com.sunriseprojects.freetts.demo; import java.beans.PropertyVetoException; import java.util.Locale; import javax.speech.AudioException; import javax.speech.Central; import javax.speech.EngineException; import javax.speech.EngineStateError; import javax.speech.synthesis.Synthesizer; import javax.speech.synthesis.SynthesizerModeDesc; import javax.speech.synthesis.Voice; public class SpeechUtils { SynthesizerModeDesc desc; Synthesizer synthesizer; Voice voice; public void init(String voiceName) throws EngineException, AudioException, EngineStateError, PropertyVetoException { if (desc == null) { //default // System.setProperty("freetts.voices", // "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory"); //have to be setup System.setProperty("freetts.voices", "de.dfki.lt.freetts.en.us.MbrolaVoiceDirectory"); desc = new SynthesizerModeDesc(Locale.US); Central.registerEngineCentral("com.sun.speech.freetts.jsapi.FreeTTSEngineCentral"); synthesizer = Central.createSynthesizer(desc); synthesizer.allocate(); synthesizer.resume(); SynthesizerModeDesc smd = (SynthesizerModeDesc) synthesizer .getEngineModeDesc(); Voice[] voices = smd.getVoices(); Voice voice = null; for (int i = 0; i &lt; voices.length; i++) { if (voices[i].getName().equals(voiceName)) { voice = voices[i]; break; } } synthesizer.getSynthesizerProperties().setVoice(voice); } } public void terminate() throws EngineException, EngineStateError { synthesizer.deallocate(); } public void doSpeak(String speakText) throws EngineException, AudioException, IllegalArgumentException, InterruptedException { synthesizer.speakPlainText(speakText, null); synthesizer.waitEngineState(Synthesizer.QUEUE_EMPTY); } public static void main(String[] args) throws Exception { System.setProperty("mbrola.base", "C:\\lnx1\\home\\ggon\\git-projects\\mbrola"); SpeechUtils su = new SpeechUtils(); //have to be setup on your env su.init("mb…
downvote count: 0
answers question: http://stackoverflow.com/q/26236562
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/26263440
upvote count: 4
has comment: http://stackoverflow.com/comment/41204053
answers question: http://stackoverflow.com/q/26263376
has comment: http://stackoverflow.com/comment/41204441
downvote count: 0
has body: ArrayDeque is a solid class implementation of the stack concept. This class has implemented stack in the most efficient way. Please look at the class implementation for the details of various methods. http://www.docjar.com/html/api/java/util/ArrayDeque.java.html More specifically, look at public E pollFirst(){...} and public void addFirst(E e)
has comment: http://stackoverflow.com/comment/41204262
has comment: http://stackoverflow.com/comment/41204129
score: 4
has comment: http://stackoverflow.com/comment/41204511
type: Answer

http://stackoverflow.com/comment/41187291
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26251359
has text: This is example of Java 8 usage. `line` here is a separate line from file as `String`.

http://stackoverflow.com/q/26275985
has comment: http://stackoverflow.com/comment/41224581
has comment: http://stackoverflow.com/comment/41224593
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/26276083
tagged with: split
has title: RegEx Pattern Matcher with multiple space word
upvote count: 0
answer count: 1
tagged with: string
has body: I want to split a String into two sub-strings as follows: String value = "Verify Payment 2"; With the two parts expected to be: String one = Verify Payment String two = 2 I'm using the split function (split by space) but it gives a result with 3 Strings: String[] output = eachElement.getText().split("\\s");
accepted answer: http://stackoverflow.com/a/26276083
favorite count: 0
score: -3
tagged with: regex
type: AnsweredQuestion

http://stackoverflow.com/q/26258482
score: 2
tagged with: internet-explorer
answer count: 0
has title: javascript check if java enabled in IE WITHOUT running jar
has comment: http://stackoverflow.com/comment/41221945
tagged with: java
type: Question
downvote count: 0
tagged with: javascript
has body: I wanna detect if java is enabled in a browser without running any jars.I did this in Chrome and Firefox with the navigator.plugins and it's working great, but in IE its returning always true.Any ideas?Thanx in advance.
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: browser-detection
linked to: http://stackoverflow.com/q/121203
has comment: http://stackoverflow.com/comment/41194281

http://stackoverflow.com/a/47352233
has body: This can be achieved by keeping transaction at thread level. However u would require a shared object between all those threads. This shared object will keep a track of status of all this threads and notify them if either fails. If failure notification is recieved by this threads they themselves can throw an exception and their transaction will be rollbacked. Example code Code in individual threads @Transactional(rollbackFor = Exception.class) public void saveData(Product product, ProductStatusObject productStatusObject) throws Exception { productDao.persist(product); if(product.getId() == 5) { productStatusObject.updateCounter(false); } else { productStatusObject.updateCounter(true); } if(!productStatusObject.getStatus()) { throw new Exception(); } } Code in shared class private final int totalThreads; private int executedThreads = 0; private Boolean finalStatus = true; public ProductStatusObject(int totalThreads) { this.totalThreads = totalThreads; } public synchronized void updateCounter(Boolean threadStatus) throws InterruptedException { executedThreads ++; if(!threadStatus) { this.finalStatus = false; } if(totalThreads == executedThreads) { notifyAll(); } else { wait(); } } public synchronized Boolean getStatus() { return finalStatus; } Here the failure condition is if any of thread is saving data with id 5 all threads will rollback their code. Else all will succeed
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26277572
score: 1

http://stackoverflow.com/q/26334421
type: UnansweredQuestion
has body: I'm using this code to read all folders in proc filesystem for (Path processPath : Files.newDirectoryStream(FileSystems.getDefault().getPath("/proc"), "[0-9]*")) { // Some logic } After some time I get this error java.nio.file.FileSystemException: /proc: Too many open files Looks like this loop is opening files without closing them. Is there any way to close the file after each cycle run?
has comment: http://stackoverflow.com/comment/41332465
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/26334802
tagged with: try-with-resources
type: Question
has answer: http://stackoverflow.com/a/38281258
downvote count: 0
has comment: http://stackoverflow.com/comment/41332415
answer count: 3
tagged with: java-7
favorite count: 0
tagged with: nio2
has title: java.nio.file.FileSystemException: /proc: Too many open files
has answer: http://stackoverflow.com/a/26334821
upvote count: 2

http://stackoverflow.com/comment/41293080
type: Comment
has text: Thanks that Worked,and btw do the API docs not provide information about a class's instance fields ,why?
type: AnswerComment
comment on: http://stackoverflow.com/a/26313170
score: 0

http://stackoverflow.com/comment/41291038
comment on: http://stackoverflow.com/a/26311816
type: Comment
has text: Difficult to guess from here as I created a sample groovy script and loaded/parsed it without any error.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26207622
type: UnansweredQuestion
tagged with: emoticons
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/41105673
type: Question
has body: I'm trying to make a chat app in android, I wanna add emotions in my app.. I used unicode in android 4.4.2 and it worked fine.. But when I try to use it in android 2.3.7 it doesn't work.. So how can i use emoticons in android 2.3.7 and in android 2.3.7 there is emoticons panel in Messaging (Insert Smiley) does that use unicode ? And if it uses it how can I get characters unicode ? I googled for it but found nothing. I want it to be like this in my code : array.add(new Emoticon(unicode, ":D")): // Emoticon class is a custom class with constructor (String unicode, String Shortcut) Thanks :)
has answer: http://stackoverflow.com/a/27424906
score: 0
has title: About Emoticons in android 2.3.7
answer count: 1
tagged with: unicode

http://stackoverflow.com/q/26218647
score: 0
answer count: 1
has title: Building Jenkins with NetBeans errors
tagged with: netbeans
tagged with: jenkins
has answer: http://stackoverflow.com/a/32631188
type: UnansweredQuestion
tagged with: java
has body: I try to build Jenkins project with netBeans but have the same problem all the time.... Multiples tests fails during the building of project. I put descriptions of some fails. Running hudson.cli.ConnectionMockTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.138 sec - in hudson.cli.ConnectionMockTest Running hudson.cli.ConnectionTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.14 sec - in hudson.cli.ConnectionTest Running hudson.cli.PrivateKeyProviderTest Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.655 sec &lt;&lt;&lt; FAILURE! - in hudson.cli.PrivateKeyProviderTest initializationError(hudson.cli.PrivateKeyProviderTest) Time elapsed: 0.015 sec &lt;&lt;&lt; ERROR! java.lang.IllegalStateException: Failed to transform class with name hudson.cli.CLI. Reason: java.io.IOException: invalid constant type: 15 at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:207) at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:145) at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:65) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:340) at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114) at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125) at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:439) at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:420) at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) at su…
type: Question

http://stackoverflow.com/q/26348334
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
upvote count: 0
has body: I have a Spring MVC project running locally on tomcat right now. What I need to do to be able to run it on my linux server? How can I deploy it? Before I used firezilla(running usual jars) to connect to server using ssh. Please help me by writing easy steps on how to run web application on server, thank you.
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/26351065
downvote count: 3
has title: Spring project deploy on real server
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26351065
score: -3

http://stackoverflow.com/comment/46049205
comment on: http://stackoverflow.com/a/26278438
has text: Sorry for not seeing this! I think I missed it as i added my own answer at exactly the same time.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41177404
type: Comment
type: QuestionComment
has text: radio button is in unchecked state when you go to previous question?
score: 0
comment on: http://stackoverflow.com/q/26249714

http://stackoverflow.com/q/26293709
has answer: http://stackoverflow.com/a/26293906
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41257379
favorite count: 0
has title: runtime error (NZEC) in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41257699
has comment: http://stackoverflow.com/comment/41257362
has body: I wrote a Java code to generate prime numbers between two integers. I get a runtime error (NZEC) in SPOJ. How can I fix this? import java.util.Scanner; public class prime { public static void main(String[] args) { Scanner x = new Scanner(System.in); Scanner y = new Scanner(System.in); int m = x.nextInt(); int n = y.nextInt(); if (m &gt;= 1 &amp;&amp; n &lt;= 1000000000 &amp;&amp; n - m &lt;= 100000) { for (int current = m; current &lt;= n; current++) { int sqr_root = (int) Math.sqrt(current); boolean is_prime = true; for (int i = 2; i &lt;= sqr_root; i++) { if (current % i == 0) { is_prime = false; // Current is not prime. } } if (is_prime) { System.out.println(current); } } } return; } }
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41257237
type: Question
has comment: http://stackoverflow.com/comment/41257322
has comment: http://stackoverflow.com/comment/41257308
has comment: http://stackoverflow.com/comment/41257759
has comment: http://stackoverflow.com/comment/41260770
score: -1

http://stackoverflow.com/comment/41366578
comment on: http://stackoverflow.com/q/26352981
has text: @MadProgrammer: Just checked, it works with JGoodies. Please provide your comment as an answer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/39022417
score: 4
answers question: http://stackoverflow.com/q/26265224
upvote count: 4
downvote count: 0
type: Answer
has body: We debated for a while between using async and batches. We tried out both to compare. We got better throughput using "unlogged batches" compared to individual "async" requests. We dont know why, but based on Ryan's blog, I am guessing it has got to do with the write size. We probably are doing too many smaller writes and so batching them probably gave us better performance as it does reduce network traffic. I have to mention that we are not even doing "unlogged batches" in the recommended way. The recommended way is to do a batch with a single-partition key. Basically, batch all the records which belong to the same partition key. But, we were just batching some records which probably belong to different partitions. Someone did some benchmarking to compare async and "unlogged batches" and we found that quite useful. Here is the link.

http://stackoverflow.com/a/26338427
type: Answer
has body: You need to init all views in create when Activity was already created. For example try this: public class MyActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EditText cocktail_1 = (EditText) findViewById(R.id.editText1); } }
score: 0
answers question: http://stackoverflow.com/q/26337716

http://stackoverflow.com/q/26308640
downvote count: 0
answer count: 1
tagged with: jersey-2.0
score: 1
favorite count: 0
has title: JerseyTest doesn't recognize @WebFilter
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26315062
upvote count: 1
has body: I try to create a JerseyTest on a Jersey REST Servlet with jersey-test-framework-provider-grizzly2. The test requests correct content from the servlet in grizzly. But when starting up the servlet productive there is an HTTPBasicAuth. The Auth is done with a @WebFilter("/*") org.apache.shiro.web.servlet.ShiroFilter. During JerseyTest there is no Auth requested. So my conclusion is that the @WebFilter annotation is not recognized. Does JerseyTest only test resources in the Application? How to get the WebFilters recognized? Thanks.
tagged with: junit4
tagged with: java
type: Question
tagged with: jersey
tagged with: servlets

http://stackoverflow.com/q/26275673
has title: facelets.viewhandler Error Rendering View NotSerializableException: eu.jakubiak.jpa.translator.Translator$TranslatorProxyMethodInterceptor
tagged with: jboss
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26408383
tagged with: language-translation
has body: I'm working on fixing a bug with a previously existing application using: Java 6 JBoss 4.2.3 GA JBoss Seam 2.2.0 GA JSF2 The application leverages this library for translation http://code.google.com/p/jpa-translator/ http://code.google.com/p/support/wiki/WikiSyntax#Introduction Are you familiar with this error when trying to post a property of an entity bean to a JSF view? ERROR [facelets.viewhandler] (http-...) Error Rendering View[/public/answer.xhtml] java.io.NotSerializableException: eu.jakubiak.jpa.translator.Translator$TranslatorProxyMethodInterceptor I my code had this &lt;c:forEach var="_d" items="#{indicatorValuesDimension}"&gt; &lt;s:div styleClass="answer-dimension"&gt;#{_d.key.name}&lt;/s:div&gt; Where the indicatorValuesDimension is a java.util.Map, the key is an @Translatable entity bean and name is an @Translate String property. But if I do this instead it runs just fine... &lt;c:forEach var="_d" items="#{indicatorValuesDimension}"&gt; #{_d.key.name} So the same expression runs fine outside any JSF tag but throws NotSerializableException when used inside a JSF tag. Has anyone come across this before? Any pointers?
type: AnsweredQuestion
tagged with: jsf
tagged with: seam
tagged with: java
has answer: http://stackoverflow.com/a/26408383
type: Question

http://stackoverflow.com/comment/41374809
comment on: http://stackoverflow.com/q/26338982
has text: `import org.slf4j.Logger; import org.slf4j.LoggerFactory;`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26342434
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/26341152
type: Answer
has comment: http://stackoverflow.com/comment/41988098
has body: This blog post explains it all: http://fxexperience.com/2014/09/announcing-controlsfx-8-20-7/ This release has been brewing since 8.0.6 was released on May 29th – so basically four months. This is not typical for us (we normally have much quicker releases), but Eugene and I were both distracted on a major undertaking – elevating the ControlsFX dialogs API and implementation into the next release of JavaFX itself (it’ll be appearing in JavaFX 8u40, although the API is vastly different than what you see in ControlsFX 8.0.6). The end result is that we iterated through a bunch of API design work (see RT-12643) and none of that benefited ControlsFX, but it took up all our time. Once JavaFX 8u40 dialogs were API complete (which was only mid-August), we developed a plan for how to proceed with ControlsFX dialogs. In essence we didn’t feel that it was wise to maintain a dialogs API in ControlsFX that was so divergent than what will ship in JavaFX 8u40. Therefore, the plan that we developed was to deprecate the old ControlsFX API, fork the JavaFX dialogs API into a new project called openjfx-dialogs, and to recreate the additional features that ControlsFX includes (but are lacking in JavaFX itself) using the new API (this includes dialogs like progress, font chooser, command link, login, etc).
upvote count: 16
has comment: http://stackoverflow.com/comment/42395687
score: 15
has comment: http://stackoverflow.com/comment/49991431
accepted answer of: http://stackoverflow.com/q/26341152

http://stackoverflow.com/comment/41315932
has text: Sorry, I'm not going to read that wall of code. Step into it in a debugger and see where the behavior fails to match your assumptions. Learning to program means learning how to debug.
comment on: http://stackoverflow.com/q/26325012
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41279296
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26305386
has text: Are you using Eclipse?

http://stackoverflow.com/a/26211199
type: Answer
upvote count: 1
downvote count: 0
has body: The problem is that Double.parseDouble attempts to parse the entire String, while you are trying to read the String as a set of tokens. This calls for the implementation of an expression parser. Your code already looks a bit like a parser, but needs a way to tokenize the String. You could take a look at explanations such as this tutorial. One extra remark: please terminate your case code blocks with a break-statement. If your code were to match a +, it would perform the operations in all of the casess. So, writing 1 + 2 would still yield the result of 1 / 2 and perform the action for an =, because that case does have a break statement. For more information see Oracle info on the switch statement.
answers question: http://stackoverflow.com/q/26211000
score: 1

http://stackoverflow.com/a/26309180
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41286481
has comment: http://stackoverflow.com/comment/41288023
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26308781
answers question: http://stackoverflow.com/q/26308781
type: Answer
has comment: http://stackoverflow.com/comment/41287226
has comment: http://stackoverflow.com/comment/41287718
has body: So to handle your edit text problem, you can use this &lt;EditText ... android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" /&gt; Now the above characters are the only one that can be entered into the EditText. Also you can change the keyboard type in the android:inputType. Additionally you wanted to limit the number of entries in a ListView. In the BaseAdapter method of your code, change this: @Override public int getCount() { return 25; } UPDATE: Well what you can do is create a custom ArrayAdapter and modify the getCount method there. As getCount() is in a different class altogether, you just want to alter the maximum 25 there and then set the list view to that adapter. You may want to take a look here for more uses of ArrayAdapters.

http://stackoverflow.com/a/26335310
score: 3
answers question: http://stackoverflow.com/q/26334733
upvote count: 3
has body: By default properties and public fields will be mapped to elements. What you want to do is use @XmlValue to map the field to the element's value. @XmlRootElement(name = "Say") @XmlAccessorType(XmlAccessType.FIELD) static class Say { @XmlAttribute private String voice = "alice"; @XmlValue private String string = "Thanks for trying our documentation. Enjoy!"; public String getString() { return string; } public void setString(String string) { this.string = string; } } Note the use of @XmlAccessorType(XmlAccessType.FIELD). This is so the default behavior doesn't "doubly" attempt to map the property defined by the getter and setter. Alternatively, you could place the annotations on the getter, and leave out the the @XmlAccessorType Result: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Thanks for trying our documentation. Enjoy! public class ResponseTest { public static void main(String[] args) throws Exception { JAXBContext context = JAXBContext.newInstance(Response.class); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); Response response = new Response(); marshaller.marshal(response, System.out); } } UPDATE but can i know why the 'S' in Say is not capitalised even though @XmlRootElement(name = "Say") is specified? You need to specify the name with @XmlElement(name = "Say") on the property. If you don't the default naming will kick in. @XmlElement(name = "Say") public Say getSay() { return say; } The XmlRootElement(name = "Say") is only for if the element is used as the root element. For instance this: Response.Say response = new Response.Say(); marshaller.marshal(response, System.out); Would give you this output <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Thanks for trying our documentation. Enjoy!
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41335588
type: Answer
accepted answer of: http://stackoverflow.com/q/26334733

http://stackoverflow.com/q/26298670
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27832494
answer count: 2
has body: Is there any way to make the changes made in vm file to reflect automatically without restarting the server everytime. I am in development phase right now and i have quite a few changes to be done. I am new to velocity template and hence it will be highly helpful If someone could suggest a way for the same. I tried using the following properties but it doesn't work.I am using tomcat server. &lt;bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"&gt; &lt;property name="velocityProperties"&gt; &lt;value&gt; resource.loader=class class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader velocimacro.library.autoreload=true class.resource.loader.cache=false velocimacro.permissions.allow.inline.to.replace.global=true &lt;/value&gt; &lt;/property&gt; &lt;/bean&gt;
downvote count: 0
tagged with: tomcat
favorite count: 0
tagged with: velocity
type: UnansweredQuestion
has title: changes in velocity template to reflect without server restart
tagged with: spring
has answer: http://stackoverflow.com/a/26300139
score: 1
upvote count: 1

http://stackoverflow.com/comment/41114518
has text: How would I create a method that can place the correct parameters in the call from the request though? i.e. `String m = request.getParameter("method"); java.lang.reflect.Method method = obj.getClass().getMethod(m, request.getParameter("??"));`
comment on: http://stackoverflow.com/a/26215649
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26269658
type: UnansweredQuestion
has title: Writing to the SDCard
tagged with: android
has comment: http://stackoverflow.com/comment/41228692
has comment: http://stackoverflow.com/comment/41228442
tagged with: java
tagged with: filewriter
tagged with: file
has comment: http://stackoverflow.com/comment/41213609
has comment: http://stackoverflow.com/comment/41213853
type: Question
has comment: http://stackoverflow.com/comment/41231035
linked to: http://stackoverflow.com/q/23531833
has comment: http://stackoverflow.com/comment/41232071
has body: I have been trying for quite some time to figure out how to write to the SDCard on my Samsung Galaxy. I have tried many methods and It still doesn't seem to work. I have traced through this code and it seems to execute (whether or not an SDCard is inserted in the phone). Problem is I can NEVER find the file it supposedly wrote. Can anyone out there help? if (isExternalStorageWritable()) { try { File myFile = new File("/sdcard/WorkoutData.txt"); myFile.createNewFile(); FileOutputStream fOut = new FileOutputStream(myFile); OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut); for (WorkoutData iterator: workouts) { myOutWriter.append(iterator.toString()); Log.d(TAG, iterator.toString()); } myOutWriter.close(); fOut.close(); Toast.makeText(getBaseContext(), "Done writing SD 'WorkoutData.txt'", Toast.LENGTH_LONG).show(); } catch (Exception e) { Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } }
has answer: http://stackoverflow.com/a/26269975
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41230957
has answer: http://stackoverflow.com/a/26270608
tagged with: android-sdcard
has comment: http://stackoverflow.com/comment/41228502
has comment: http://stackoverflow.com/comment/41215299

http://stackoverflow.com/a/26261766
answers question: http://stackoverflow.com/q/26261569
score: 0
type: Answer
has body: use XmlPullParser for parsing XML in your android application. It is very easy to use and pretty fast. I use XmlPullParser in all my applications. Follow this tutorial it has nice example on how to use XmlPullParser. http://www.vogella.com/tutorials/AndroidXML/article.html
has comment: http://stackoverflow.com/comment/41198574

http://stackoverflow.com/comment/41244739
type: Comment
has text: inside your apk, under the `lib` folder do you see the `armeabi` and other folders? And inside these, the .so files ?
comment on: http://stackoverflow.com/a/26249531
score: 0
type: AnswerComment

http://stackoverflow.com/a/26235643
answers question: http://stackoverflow.com/q/26235585
has body: Just replace digit with x and then compare String str1 = "this is the time xxxx when i get up"; String str2 = "this is the time 0830 when i get up"; if (str2.replaceAll("\\d", "x").equals(str1)) { System.out.println("both are the equal strings"); } As per your lasted update Simply iterate all the character of first string if it's not x then compare it otherwise skip it. public static boolean doesMatch(String str1, String str2) { if (str1.length() == str2.length()) { for (int i = 0; i &lt; str1.length(); i++) { char ch = str1.charAt(i); // check the character if not x then compare if (ch != 'x' &amp;&amp; ch != str2.charAt(i)) { return false; } } } return true; }
score: 1
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41096795
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26206741
has text: Looks like most likely issue is the class is not findable by the class loader. my best guess is the classpath does not include the jar with the needed class or the directory that is the base directory for the class.

http://stackoverflow.com/a/26271936
answers question: http://stackoverflow.com/q/26257635
has body: You can generate the HTML report using StringBuffer. String filePath = "File path where you want to keep your report"; String reportFileName = "myReport.htm"; JUnitCore junit = new JUnitCore(); junit.addListener(new MyJunitListener()); Result result = junit.run(AllEJBJunitTests.class); StringBuffer myContent = getResultContent(result, size);//Size represents number of AllEJBJunitTests class, suppose if you have 5 EJB classes then size is 5. writeReportFile(filePath + "/" + reportFileName, myContent); // This method will give you the HTML content. private StringBuffer getResultContent(Result result, int numberOfTestFiles) { int numberOfTest = result.getRunCount(); int numberOfTestFail = result.getFailureCount(); int numberOfTestIgnore = result.getIgnoreCount(); int numberOfTestSuccess = numberOfTest - numberOfTestFail - numberOfTestIgnore; int successPercent = (numberOfTest != 0) ? numberOfTestSuccess * 100 / numberOfTest : 0; double time = result.getRunTime(); StringBuffer myContent = new StringBuffer(" Junitee Test Report Result Test Files Tests Success "); if ((numberOfTestFail > 0) || (numberOfTestIgnore > 0)) { myContent.append(" Failure Ignore "); } myContent.append(" Test Time (seconds) <tr"); if ((numberOfTestFail > 0) || (numberOfTestIgnore > 0)) { myContent.append(" style=\"color:red\" "); } myContent.append("> "); myContent.append(numberOfTestFiles); myContent.append(" "); myContent.append(numberOfTest); myContent.append(" "); myContent.append(successPercent); myContent.append("% "); if ((numberOfTestFail > 0) || (numberOfTestIgnore > 0)) { myContent.append(numberOfTestFail); myContent.append(" "); myContent.append(numberOfTestIgnore); myContent.append(" "); } myContent.append(Double.valueOf(time / 1000.0D)); myContent.append(" "); return myContent; } // This will generate the report in the particular directory which you have mentioned. private void writeReportFile(String fileName,StringBuffer reportContent){ FileWriter myFileWriter = null; try { myFileWri…
score: 4
accepted answer of: http://stackoverflow.com/q/26257635
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41113863
type: Comment
has text: Almost but not entirely the same as the answer of Uwe I guess, but I was already typing.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26216118

http://stackoverflow.com/comment/41138879
type: Comment
comment on: http://stackoverflow.com/a/26228556
score: 0
type: AnswerComment
has text: @MadProgrammer can i make little bit example for him? because once just before few months i was also at same position so i feel that let me just give him reference :) as u helped me all time :)

http://stackoverflow.com/a/26235460
has body: Method DateTime::getMillis returns milliseconds independent of zone. This value is a constant. Once created DateTime instance will return the same millis in any time zone. final DateTime now = DateTime.now(); now.withZone(texas).getMillis() == now.withZone(madrid).getMillis(); // true DateTime::isAfter and DateTime::isBefore methods compares millis returned by DateTime::getMillis method. So this value is also zone independent. But printing DateTime with DateTimeFormatter is zone dependent. It will print different hours/minutes in in different time zones. So, if you want compare dates zone independently, then your result is correct. Example: - Precondition: DateTimeZone usZone = DateTimeZone.forID("US/Eastern"); DateTimeZone spZone = DateTimeZone.forID("Europe/Madrid"); DateTimeZone.setDefault(usZone); Your code works in next way: DateTime serverDate = new DateTime(2014, 10, 6, 6, 12); // US zone DateTime dateInMadrid = serverDate.withZone(spZone); // zone is Madrid, but .getMillis() will return the same value DateTime startDate = new DateTime(2014, 10, 6, 8, 0); // US zone // startDate = startDate.withZone(spZone) - this will not change the result DateTime endDate = new DateTime(2014, 10, 6, 21, 0); // US zone // endDate = endDate.withZone(spZone) - this will also not change the result System.out.println(dateInMadrid .isAfter(startDate) &amp;&amp; dateInMadrid .isBefore(endDate)); // false - it is correct. because all dates were created in US zone Correct way: you should create start and end dates in Madrid zone DateTime serverDate = new DateTime(2014, 10, 6, 6, 12); DateTime startDateMadrid = new DateTime(2014, 10, 6, 8, 0, spZone); // Madrid zone is used in constructor! DateTime endDateMadrid = new DateTime(2014, 10, 6, 21, 0, spZone); // Madrid zone is used in constructor! System.out.println(serverDate.isAfter(startDateMadrid) &amp;&amp; serverDate.isBefore(endDateMadrid)); // true
has comment: http://stackoverflow.com/comment/41186247
downvote count: 0
has comment: http://stackoverflow.com/comment/41153992
accepted answer of: http://stackoverflow.com/q/26214388
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41182231
has comment: http://stackoverflow.com/comment/41164453
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26214388
has comment: http://stackoverflow.com/comment/41185732

http://stackoverflow.com/q/26231781
type: Question
linked to: http://stackoverflow.com/q/12222153
has comment: http://stackoverflow.com/comment/41143602
has answer: http://stackoverflow.com/a/26231975
accepted answer: http://stackoverflow.com/a/26231975
score: 0
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/41143616
downvote count: 1
possible better answer: http://stackoverflow.com/a/26231972
has comment: http://stackoverflow.com/comment/41145052
has comment: http://stackoverflow.com/comment/41144149
favorite count: 0
has answer: http://stackoverflow.com/a/26231974
has comment: http://stackoverflow.com/comment/41144029
linked to: http://stackoverflow.com/q/18139756
has comment: http://stackoverflow.com/comment/41143576
has comment: http://stackoverflow.com/comment/41143637
has comment: http://stackoverflow.com/comment/41143645
type: AnsweredQuestion
has title: No main type error in java
tagged with: java
has comment: http://stackoverflow.com/comment/41143820
has answer: http://stackoverflow.com/a/26231972
has body: This is the source code: package feetToInches2; public class Feet2Inches { private double feetToInches_(double feet) { return 12* feet; } private int max(int val1 int val2) { if (val1 &gt; val2) { } else { return (val2); } return 0; } } When I try to run it, it says "Selection does not contain main type". I have asked my professor and he says sometimes eclipse does that and all I need to do is restart my computer. Is that true?

http://stackoverflow.com/q/26334860
has answer: http://stackoverflow.com/a/26395196
has body: I am using Tanuki Software Wrapper for building a java application as Windows Service . I follow the example Simple HelloWorldServer Java Class and it works fine . I have made configure in wrapper.conf file wrapper.ntservice.starttype = AUTO_START for automatically starting the service on windows system starting . But i want that my service would be automatically started on every two hours , how can i do it , if any one has idea please help me . Thanks a lot in advance .
has answer: http://stackoverflow.com/a/26338093
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26336152
has answer: http://stackoverflow.com/a/26336152
has comment: http://stackoverflow.com/comment/41334422
accepted answer: http://stackoverflow.com/a/26338093
tagged with: batch-file
answer count: 3
downvote count: 0
score: 1
has title: How to start Tanuki Software Wrapper automatically on interval of 2 hours
favorite count: 0

http://stackoverflow.com/comment/41173423
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26247579
score: 0
has text: I'm sorry, Qix, I'll post there next time.

soa
type: Tag
tags question: http://stackoverflow.com/q/26279341
tag name: soa
tags question: http://stackoverflow.com/q/26311480

http://stackoverflow.com/a/26205445
score: 0
type: Answer
has body: Not entirely sure what the question you're trying to ask is but - to try and help - does it help that each time a[i] is called, it takes the value of i (also the iteration number) at each instance and uses that to find the relevant array index - which is then used for the rest of the computation.
has comment: http://stackoverflow.com/comment/41094185
answers question: http://stackoverflow.com/q/26205399

http://stackoverflow.com/q/26249181
tagged with: variables
has title: Variables wont increase, calling non static methods from static method
type: Question
tagged with: non-static
score: 1
favorite count: 0
tagged with: static
has answer: http://stackoverflow.com/a/26249245
upvote count: 1
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41176302
has body: I am creating a vending machine simulation for a school project and I've been having trouble getting past these first couple barriers. One of the requirements for the project is to have 5 global variables, which i am assuming means variables defined outside any method but within the class. At first, I wasn't able to call upon any of them until I learned about "Static" and "Objects" and I got around that problem by creating instance methods which call upon these variables, and creating an object of these instance methods in my main static method. But the problem is, I need these variables to increment and they won't change from 0!! I'm trying to let the user "insert coins" into the machine but nothing happens when I try it. Anyway, here is the code, it's not anywhere near finished but a little help and clarification on what I'm doing wrong would be much appreciated. Thank you! package project3; import java.util.Scanner; public class Project3 { double nickels = 0.00; double quarters = 0.00; double dimes = 0.00; double dollars = 0.00; double credits = nickels + quarters + dimes + dollars; public static void main(String[] args) { Project3 menu = new Project3(); menu.menu(); } public void menu () { int counter = 0; Scanner input = new Scanner(System.in); while (counter &gt;=0 &amp;&amp; counter &lt;=4){ System.out.print("Credit: "+credits +"\n0. Insert Money \n1. Twix: 50¢ \n2. Marathon Bar: $1.00 \n3. Snickers: 75¢ \n4. Return Change \nSelection: "); counter = input.nextInt(); switch (counter) { case 0: getMoney(); break; case 1: break; case 2: break; case 3: break; case 4: break; } } } public void getMoney(){ int counter = 0; Scanner input = new Scanner(System.in); while (counter &gt;=0 &amp;&amp; counter &lt;=4){ System.out.print("Credit : " +credits+"\n1. Insert Nickel \n2. Insert Dime \n3. Insert Quarter \n4. Insert Dollar \n5. Return to menu \nSelection: "); counter = input.nextInt(); switch (counter) { case 1: nickels += .05; break; case 2: dimes += .10; break; ca…
accepted answer: http://stackoverflow.com/a/26249245
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/26325524
tagged with: resources
type: Question
linked to: http://stackoverflow.com/q/3743932
upvote count: 1
has answer: http://stackoverflow.com/a/26325525
accepted answer: http://stackoverflow.com/a/26325525
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/1483063
linked to: http://stackoverflow.com/q/2129876
has title: Match for root url and serving of static resources
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: My problem is how to configure a Spring MVC application to allow at the same time application should serve static resources (css, js, images ...) the root url (http://my.host.org/webb_app/) should be served by a Spring controller I've already read How to handle static content in Spring MVC?, Using Spring, mapping to root in web.xml, static resources aren&#39;t found and Tomcat serving static resources on Spring MVC app. All give working solutions, and until recently, I used any them as a cooking recipe until the application works more or less acceptably. All that without references nor a clear understanding of the why and how it finally worked. So the question is : what at the different ways of configuring a Spring MVC application for this requirement, what are their drawbacks and what is the rationale behind them.

http://stackoverflow.com/a/26233514
type: Answer
answers question: http://stackoverflow.com/q/26233251
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41160341
has body: Is it absolutely necessary to resolve this through constructors? It seems like regex is the perfect key. Below is one, **not elegant &amp; quickly baked **, solution. Enjoy. public class Success { static int f = 4; //declare a static variable that may suffer modifications below public static void main(String[] args) { String input = JOptionPane.showInputDialog("Insert, please, 4 digits!"); // the input may be any character int one= input.replaceAll("[^1]", "").length(); //using regex and the length() method, we count for how many times the digit 1 is repeated in our String: input. The result is stored in int one int two= input.replaceAll("[^2]", "").length(); // the same here, for digit 2 int three= input.replaceAll("[^3]", "").length(); // the same, for digit 3 int four= input.replaceAll("[^4]", "").length(); // the same, for digit 4 int five= input.replaceAll("[^5]", "").length(); // the same, for digit 5 int six= input.replaceAll("[^6]", "").length(); // the same, for digit 6 int seven= input.replaceAll("[^7]", "").length(); // the same, for digit 7 int eight= input.replaceAll("[^8]", "").length(); // the same, for digit 8 int nine= input.replaceAll("[^9]", "").length(); // the same, for digit 9 int zero= input.replaceAll("[^0]", "").length(); // the same, for digit 0 if(one == 2){ // if the stored result in int one, from the operation above is 2, then we have a pair in the inputted String f = f-2; // thus, we remove 2 from f (f was declared above as static, 4). The point is if f, by the end of those if statements will be equal to 0, then our String has 2 pairs of digits } if(one == 3){ // if the stored result in int one, from the operation above is 3, then we have a pair in the inputted String f = f-2; // thus, we remove 2 from f } if(one == 4){ // if the stored result in int one, from the operation above is 4, then we have two pairs in the inputted String f=f-4; } if(two == 2){ f = f-2; } if(two == 4){ f=f-4; } if(two == 3){ f = f-2; } if(three == 2){ f = f-2; …
has comment: http://stackoverflow.com/comment/41160269
has comment: http://stackoverflow.com/comment/41162216
upvote count: 2
has comment: http://stackoverflow.com/comment/41163561

http://stackoverflow.com/a/26238301
has comment: http://stackoverflow.com/comment/41155975
type: Answer
has comment: http://stackoverflow.com/comment/41155998
has comment: http://stackoverflow.com/comment/41156816
upvote count: 3
has body: try StringBuilder like this: or you can use StringBuffer but for single threaded context StringBuilder is always better option since it is not synchronized so it will be faster. public static void main(String[] args) { StringBuilder sb=new StringBuilder("7017642012"); sb.insert((sb.length()-4), '/'); System.out.println(sb); } output : 701764/2012 As an array of StringBuilder public static void main(String[] args) { StringBuilder []sb=new StringBuilder[5]; for(int i=0;i&lt;5;i++){ sb[i]=new StringBuilder("98345834"+i); sb[i].insert((sb[i].length()-4), '/'); System.out.println(sb[i]); } } output : 98345/8340 98345/8341 98345/8342 98345/8343 98345/8344
has comment: http://stackoverflow.com/comment/41156741
score: 3
has comment: http://stackoverflow.com/comment/41155640
has comment: http://stackoverflow.com/comment/41156412
has comment: http://stackoverflow.com/comment/41156618
accepted answer of: http://stackoverflow.com/q/26238201
answers question: http://stackoverflow.com/q/26238201
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26298902
has comment: http://stackoverflow.com/comment/41267860
has comment: http://stackoverflow.com/comment/41268208
has comment: http://stackoverflow.com/comment/41268272
answers question: http://stackoverflow.com/q/26298679
has comment: http://stackoverflow.com/comment/41266682
has comment: http://stackoverflow.com/comment/41267981
score: 0
has comment: http://stackoverflow.com/comment/41267025
has comment: http://stackoverflow.com/comment/41266876
has comment: http://stackoverflow.com/comment/41266713
has body: Because in this loop: for (int i = 0; i &lt; jarray.length(); i++) { JSONObject object = jarray.getJSONObject(i); actorsList.add(object.getString("image")); Log.d("image: ", object.getString("image")); try { period = Integer.parseInt(object.getString("period").toString()); Log.d("period: ", object.getString("period")); } catch (NumberFormatException nfe) { // TODO: handle exception System.out.print("could not parse:" + nfe); } } when it finishs your period is equal to last json that you parsed. public class MainActivity extends Activity { ArrayList&lt;String&gt; actorsList; ViewFlipper viewFlipper; Handler mHandler ; Timer timer; List&lt;Integer&gt; periodsList; Runnable mUpdateResults; int delay = 500; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); periodsList=new ArrayList&lt;Integer&gt;(); viewFlipper = (ViewFlipper) findViewById(R.id.flipper); actorsList = new ArrayList&lt;String&gt;(); // execute AsyncTask new JSONAsyncTask().execute("http://localhost/images.txt"); // handler to set duration and to upate animation mHandler = new Handler(); // Create runnable for posting mUpdateResults = new Runnable() { public void run() { viewFlipper.showNext(); // showNext() method } }; timer = new Timer(); } // AsyncTask to get data from server class JSONAsyncTask extends AsyncTask&lt;String, Void, Boolean&gt; { int period; @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected Boolean doInBackground(String... urls) { try { //------------------&gt;&gt; HttpGet httppost = new HttpGet(urls[0]); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httppost); // StatusLine stat = response.getStatusLine(); int status = response.getStatusLine().getStatusCode(); if (status == 200) { HttpEntity entity = response.getEntity(); String data = EntityUtils.toString(entity); JSONObject jsono = new JSONObject(data); JSONArray jarra…
type: Answer

http://stackoverflow.com/comment/41109147
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26213466
has text: @SaiAvinash yes we can break. But what happen if there are duplicate elements? and needs to find them too?
type: Comment

http://stackoverflow.com/q/26337002
tagged with: string
favorite count: 0
tagged with: byte
has title: javax.validation: Constraint to validate a string length in bytes
has comment: http://stackoverflow.com/comment/41337334
score: 11
has answer: http://stackoverflow.com/a/26337486
accepted answer: http://stackoverflow.com/a/26337486
has comment: http://stackoverflow.com/comment/41368614
has comment: http://stackoverflow.com/comment/41337428
type: AnsweredQuestion
tagged with: constraints
has comment: http://stackoverflow.com/comment/41337444
downvote count: 0
tagged with: java
type: Question
upvote count: 11
has comment: http://stackoverflow.com/comment/41337273
tagged with: validation
has body: I'm using javax.validation to validate some bean fields' values. This is what I use normally: public class Market { @NotNull @Size(max=4) private String marketCode; @Digits(integer=4, fraction=0) private Integer stalls; // getters/setters } This will make sure that every Market instance has a market code with a maximum length of 4 characters and a number of stall with a maximum of 4 integer digits and 0 decimal digits. Now, I use this bean to load/store data from/to DB. In the DB I have table Markets defined like this: CREATE TABLE MARKETS ( MARKET_CODE VARCHAR2(4 BYTE) NOT NULL, STALLS NUMBER(4,0) ) As you can see, I have MARKET_CODE which can be at most 4 bytes long. The @Size annotation will check if the string is at most 4 characters long, which is wrong. So, the question is: is there an annotation like @Size that will check for the string bytes instead of the characters?
answer count: 1
has comment: http://stackoverflow.com/comment/41337573

http://stackoverflow.com/q/26220785
upvote count: 1
tagged with: spring
tagged with: properties
has comment: http://stackoverflow.com/comment/41146763
accepted answer: http://stackoverflow.com/a/26228194
has comment: http://stackoverflow.com/comment/41146702
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has title: Spring 3.2 Properties file reading dynamic property names (not auto injection)
has answer: http://stackoverflow.com/a/26228194
has body: I am using Spring 3.2 and have added a property file which I have been able to use for injecting values into java class variables. * classpath:mysetof.properties * *@Value("#{$server{default.myproperty}}") private double defaultMyProperty* However I have some properties which I need to access dynamically. How can I access these properties? I have used the env variable */** Spring var - used for accessing properties. */ @Autowired private Environment env;* but I get null values returned when I try to do the following : propertyValue = env.getProperty("default.myproperty"); What is the best approach for accessing property values directly and not auto injecting them. These properties may or may not be present and there could be a huge number of them so therefore I do not wish to use autoinjection as this would involve setting up a huge list of variables. Thanks in advance.
favorite count: 0
has comment: http://stackoverflow.com/comment/41125055

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/26350330
tags question: http://stackoverflow.com/q/26350500

http://stackoverflow.com/a/26620503
accepted answer of: http://stackoverflow.com/q/26267922
answers question: http://stackoverflow.com/q/26267922
type: Answer
score: 0
type: AcceptedAnswer
has body: Adding an InstanceLifecycleListener to the PersistenceManager is working nicely so far. The only gotcha was not to omit the Classes[] parameter to addInstanceLifecycleListener. Instead if you want to listen to all changes, pass null explicitly.

http://stackoverflow.com/comment/41414923
comment on: http://stackoverflow.com/q/26195252
score: 1
type: Comment
type: QuestionComment
has text: You should think to a runtime compilation using com.sun.tools.javac.Main.compile()

http://stackoverflow.com/comment/41308764
comment on: http://stackoverflow.com/q/26321741
score: 0
type: QuestionComment
type: Comment
has text: UI politeness hint: Using exclamation marks in messages is like shouting at your user. Even more when using two of them. Even more than more in combination with all uppercase. It might be a personal opinon but I don't like to be shouted at by unintelligent machines, a.k.a. computers (too).

http://stackoverflow.com/q/26267113
tagged with: aes
score: 4
has comment: http://stackoverflow.com/comment/41211333
has answer: http://stackoverflow.com/a/26267878
tagged with: encryption
has comment: http://stackoverflow.com/comment/41251456
has title: Why do I need two keys for this AES encryption?
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41288473
upvote count: 4
accepted answer: http://stackoverflow.com/a/26267878
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41251475
has body: I'm trying to implement AES encryption for some text and I was looking for a solution that eventually comes down to one password for encryption and decryption. I've got a working solution that I found on this site: Simple Java AES encrypt/decrypt example import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; public class Encryptor { public static String encrypt(String key1, String key2, String value) { try { IvParameterSpec iv = new IvParameterSpec(key2.getBytes("UTF-8")); SecretKeySpec skeySpec = new SecretKeySpec(key1.getBytes("UTF-8"), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); byte[] encrypted = cipher.doFinal(value.getBytes()); System.out.println("encrypted string:" + Base64.encodeBase64String(encrypted)); return Base64.encodeBase64String(encrypted); } catch (Exception ex) { ex.printStackTrace(); } return null; } public static String decrypt(String key1, String key2, String encrypted) { try { IvParameterSpec iv = new IvParameterSpec(key2.getBytes("UTF-8")); SecretKeySpec skeySpec = new SecretKeySpec(key1.getBytes("UTF-8"), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); byte[] original = cipher.doFinal(Base64.decodeBase64(encrypted)); return new String(original); } catch (Exception ex) { ex.printStackTrace(); } return null; } public static void main(String[] args) { String key1 = "Bar12345Bar12345"; // 128 bit key String key2 = "ThisIsASecretKet"; System.out.println(decrypt(key1, key2, encrypt(key1, key2, "Hello World"))); } } This algorithm is using key1 and key2 and don't understand why they need the two of them. What is the purpose of each key, and would it be safe to leave key1 as it is for all times and just replace key2 with a personal password? Thanks
type: Question
linked to: http://stackoverflow.com/q/4171204
linked to: http://stackoverflow.com/q/15554296
has comment: http://stackoverflow.com/comment/41287412

sensors
type: Tag
tag name: sensors
tags question: http://stackoverflow.com/q/26326455

http://stackoverflow.com/comment/135247077
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26342730
has text: there's a setsid command, so it can be implemented with pure bash script.

http://stackoverflow.com/comment/41110413
score: 0
comment on: http://stackoverflow.com/a/26214207
type: Comment
has text: Pardon me, i havent done C++ for a while, but i suspect `Node n1 = (Node){name, 31337};` is not valid C++?
type: AnswerComment

http://stackoverflow.com/comment/41133858
has text: @Raedwald - intersection: what is in common in [a, b, c] and [b, c, d, e]. This case would be b and c.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26222864

http://stackoverflow.com/comment/41152300
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26236667
has text: Infinite loop when you are at the end of the input.

http://stackoverflow.com/q/26347467
answer count: 3
has answer: http://stackoverflow.com/a/26348084
possible better answer: http://stackoverflow.com/a/26348010
has answer: http://stackoverflow.com/a/26347911
type: AnsweredQuestion
downvote count: 0
has title: Servlet Inheritance and Global Object Creation and Access
type: Question
score: 1
tagged with: java
has body: I am going to have to setup the framework for this question first. I am creating a dynamic servlet environment that uses a globally accessible, volatile, thread-safe, in-memory data cache that stores and provides access to itself for each servlet in the environment. Something like this: public class CoreServlet extends HttpServlet { protected globalCache; public void init(ServletConfig config){ globalCache = new InMemoryCache(); } doGet... doPost... } This servlet is then extended by a number of other servlets that do subsidiary tasks on the globalCache (changing values, etc). public class subServletA extends CoreServlet { doGet... doPost... } and public class subServletB extends CoreServlet { doGet... doPost... } and so on... I have found, by experimenting, that doing this causes the entirety of the CoreServlet code to be re-executed (including all global variable instantiations and the init method) for each time that I extended the CoreServlet such that I ended up with six copies of the globalCache (which is a severely memory intensive object) being instantiated. I fixed this part by assigning a flag in the ServletContext that was triggered after the first run through the init method, such that it would skip all of the other instantiations, and just leave me with one globalCache, but I have run into issues with Java seemingly changing cache values arbitrarily. So, the technical question: Why does Java repeat the entirety of the parent servlets code? And the more design-side question: Is there a better way to implement a sub-millisecond-second latency, globally-(within my application)-accessible cache? I had considered using like a memcached sort of solution, but I still would like to have the cache in RAM for performance purposes. Any thoughts, ideas, or best practice pointers welcome.
has answer: http://stackoverflow.com/a/26348010
tagged with: global-variables
tagged with: servlets
upvote count: 1
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/26347911
favorite count: 0

http://stackoverflow.com/a/26252885
upvote count: 24
has body: i think what you are looking for is spring Interceptor . please check this tutorial which is describing how to use interceptors . and check spring documentation Intercepting requests with a HandlerInterceptor . finally check this answer here Hope that helps .
type: AcceptedAnswer
score: 23
has comment: http://stackoverflow.com/comment/129355595
type: Answer
accepted answer of: http://stackoverflow.com/q/26252155
answers question: http://stackoverflow.com/q/26252155
downvote count: 1

try-catch
tags question: http://stackoverflow.com/q/26335610
tags question: http://stackoverflow.com/q/26227602
tags question: http://stackoverflow.com/q/26217434
type: Tag
tags question: http://stackoverflow.com/q/26226940
tags question: http://stackoverflow.com/q/26222003
tags question: http://stackoverflow.com/q/26270375
tag name: try-catch
tags question: http://stackoverflow.com/q/26313893

http://stackoverflow.com/comment/59546282
type: AnswerComment
comment on: http://stackoverflow.com/a/35237841
type: Comment
score: 1
has text: This is somewhat off-topic, as the OP was talking about reading, rather than writing. I had a similar issue due to BufferedWriter.write(int) - which treats that int as a character and writes it directly to the stream. The workaround is to manually convert it to string and then write.

http://stackoverflow.com/comment/41333534
has text: +1 for giving the hints to the op
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/26335139
type: Comment

http://stackoverflow.com/comment/41239068
has text: You could spawn a `Thread` to do the file creation and use `.join()` on it right before resetting the key. That way you will make sure the reset is not triggered before file operation is completed.
type: QuestionComment
comment on: http://stackoverflow.com/q/26283605
score: 0
type: Comment

http://stackoverflow.com/comment/41274194
type: Comment
type: QuestionComment
score: 1
has text: Tomcat is a servlet container!
comment on: http://stackoverflow.com/q/26302705

http://stackoverflow.com/comment/41345340
comment on: http://stackoverflow.com/q/26306839
type: QuestionComment
type: Comment
has text: I edit my post to add my new services class with @Autowired and add my applicationContext.xml. Im getting Null value, please help
score: 0

http://stackoverflow.com/q/26289493
accepted answer: http://stackoverflow.com/a/26295897
type: Question
has comment: http://stackoverflow.com/comment/41261133
has title: Maven ignores scm tag
tagged with: version-control
has body: I'm trying to execute mvn release:prepare command, but I get the message scm connection or developerconnection must be specified. I do have section in the pom.xml: <?xml version="1.0" encoding="UTF-8"?> org.sonatype.oss oss-parent 7 ... scm:git:https://github.com/repository-name scm:git:https://github.com/repository-name https://github.com/repository-name Maven version is 3.2.3. What's wrong?
has comment: http://stackoverflow.com/comment/41261217
has comment: http://stackoverflow.com/comment/41256435
answer count: 1
downvote count: 0
favorite count: 0
tagged with: maven
upvote count: 1
tagged with: git
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26295897
score: 1
tagged with: java

http://stackoverflow.com/comment/41196177
comment on: http://stackoverflow.com/q/26260190
type: Comment
type: QuestionComment
has text: You could check the length of your date. Or splitting the string and check the length of the year. Or after parsing the date, checking the year.
score: 0

http://stackoverflow.com/q/26274827
has answer: http://stackoverflow.com/a/26275366
accepted answer: http://stackoverflow.com/a/26275366
upvote count: 1
answer count: 1
tagged with: documentlistener
favorite count: 0
has body: I am making a ui in which there are two jtextfields. I want is when user inputs in the first jtextfield it should mirror in the second jtextfield with an increment of 1 and if the user inputs in the second JtextField it should mirror in the first jtextfield with a decrement of 1.But i am getting errors like IllegalStateException:Attempt to mutate in notification. Sample Code: public class Sh extends JFrame { public Sh() { super("SH"); JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.NORTH); final JTextField field = new JTextField(10); panel.add(field); final JTextField field1 = new JTextField(10); panel.add(field1); DocumentListener docListener = new DocumentListener(){ @Override public void changedUpdate(DocumentEvent e) { updateLabel(e); } @Override public void insertUpdate(DocumentEvent e) { updateLabel(e); } @Override public void removeUpdate(DocumentEvent e) { updateLabel(e); } private void updateLabel(DocumentEvent e) { String text = field.getText(); String text1 = field1.getText(); if (!text.isEmpty()) { int p = Integer.parseInt(text); int i = (p + 1); String s = String.valueOf(i); field1.setText(s); } else if (!text1.isEmpty()) { int p = Integer.parseInt(text1); int i = (p - 1); String s = String.valueOf(i); field.setText(s); } } }; field.getDocument().addDocumentListener(docListener); field1.getDocument().addDocumentListener(docListener); DocumentFilter docFilter = new DocumentFilter(){ @Override public void insertString(FilterBypass fb, int off, String str, AttributeSet attr) throws BadLocationException { fb.insertString(off, str.replaceAll("\\D++", ""), attr); // remove non-digits } @Override public void replace(FilterBypass fb, int off, int len, String str, AttributeSet attr) throws BadLocationException { fb.replace(off, len, str.replaceAll("\\D++", ""), attr); // remove non-digits } }; ((AbstractDocument) field.getDocument()).setDocumentFilter(docFilter); ((AbstractDocument) field1.getDocument()).setDocumentFilter(docFilter); } publ…
tagged with: swing
type: AnsweredQuestion
tagged with: documentfilter
downvote count: 0
has title: how to update JTextField from another JtextField
score: 1
tagged with: java
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/41222997

http://stackoverflow.com/comment/41083147
has text: Also, I am a bit confused why you think that .949763 is the correct angle for angle A? A more efficient way to do this might be to find all 3 sides by using the distance formula and implementing the SSS Triangle formula to solve for the 3 angles. http://www.mathsisfun.com/algebra/trig-solving-sss-triangles.html
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26199249
type: AnswerComment

http://stackoverflow.com/q/26290617
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/26290727
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41252053
type: Question
type: AnsweredQuestion
has body: I need to implement a method that compute the maximum number when three numbers are provided using Generics. I know how to do this using Comparable class but I need to use only numbers. This is the code. public static &lt;T extends Math&gt; T compareThreeValue(T x, T y, T z){ T max=Math.max(Math.max(x, y), z); return max; } I added this code to get idea of what I am trying.
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41252070
has title: How to find the maximum number using Generics?
accepted answer: http://stackoverflow.com/a/26290727

http://stackoverflow.com/q/26334564
answer count: 5
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26334897
has comment: http://stackoverflow.com/comment/41332883
accepted answer: http://stackoverflow.com/a/26334897
type: Question
has comment: http://stackoverflow.com/comment/41332483
has answer: http://stackoverflow.com/a/26334655
has answer: http://stackoverflow.com/a/26334603
score: 1
tagged with: java
has body: I am trying to read input from a text file(read only numbers in arraylist). My text file looks like this containing numbers(146,7,-1,-2,3).It looks like this actually: HEADER 1467-1-23 Now,when I put HEADER string in the file,my code would not read the first number which is 146 in my case and starts with the second number "7".However,when the string HEADER is not there,146 is also read which is obviously what I want.My code is this: String pathToWrite="C:\\Users\\User\\Desktop\\Hello.txt"; FileReader fr=new FileReader(pathToWrite); BufferedReader bufferedReader=new BufferedReader(fr); String aLine=null; int numberOfLine=0; List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; list2 = new ArrayList&lt;Integer&gt;(); while((aLine=bufferedReader.readLine()) != null ) { if(numberOfLine &gt; 1) //since header lies in first line,I want to skip that line { list.add(Integer.parseInt(aLine)); } numberOfLine++; } Want suggestions about how I can change the code to read the first number too? Thanks in advance
has comment: http://stackoverflow.com/comment/41332541
has answer: http://stackoverflow.com/a/26334723
has title: Parse Text file in Java
has answer: http://stackoverflow.com/a/26334656
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26334655

http://stackoverflow.com/q/26321385
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41309406
downvote count: 3
has comment: http://stackoverflow.com/comment/41308044
type: Question
has answer: http://stackoverflow.com/a/26321690
accepted answer: http://stackoverflow.com/a/26321690
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41308187
favorite count: 0
tagged with: android-asynctask
linked to: http://stackoverflow.com/q/23653778
has body: I got all my code set up and completed. I tried running my app to make sure it functions as it should and I get a Unfortunately your app has stopped. I tried looking at other examples of this problem but couldn't find out what actually is wrong with my app. I checked my LogCat and still couldn't figure it out. If I could get a hand on what I should look at I would appreciate it. 10-11 22:13:01.521: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg 10-11 22:13:01.540: W/AudioService(286): onLoadSoundEffects(), Error -1 while loading samples 10-11 22:13:01.551: I/ActivityManager(286): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=net.androidbootcamp.zipcarrentalapp/.MainActivity} from pid 414 10-11 22:13:01.611: W/WindowManager(286): Screenshot failure taking screenshot for (266x425) to layer 21010 10-11 22:13:01.691: W/dalvikvm(859): PR_CAPBSET_DROP 0 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled. 10-11 22:13:01.771: D/dalvikvm(859): Not late-enabling CheckJNI (already on) 10-11 22:13:01.781: I/ActivityManager(286): Start proc net.androidbootcamp.zipcarrentalapp for activity net.androidbootcamp.zipcarrentalapp/.MainActivity: pid=859 uid=10046 gids={50046, 1028} 10-11 22:13:03.620: D/AndroidRuntime(859): Shutting down VM 10-11 22:13:03.650: W/dalvikvm(859): threadid=1: thread exiting with uncaught exception (group=0x41465700) 10-11 22:13:03.770: E/AndroidRuntime(859): FATAL EXCEPTION: main 10-11 22:13:03.770: E/AndroidRuntime(859): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{net.androidbootcamp.zipcarrentalapp/net.androidbootcamp.zipcarrentalapp.MainActivity}: java.lang.NullPointerException 10-11 22:13:03.770: E/AndroidRuntime(859): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137) 10-11 22:13:03.770: E/AndroidRuntime(859): at android.app.ActivityThread.hand…
has comment: http://stackoverflow.com/comment/41308081
tagged with: android
score: -3
has title: Null pointer exception on my code

http://stackoverflow.com/q/26328487
possible better answer: http://stackoverflow.com/a/26329334
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26329334
has comment: http://stackoverflow.com/comment/41347298
has comment: http://stackoverflow.com/comment/41321333
answer count: 3
has title: Images on google chrome not loading
has comment: http://stackoverflow.com/comment/41342051
has answer: http://stackoverflow.com/a/37377813
has body: I am new to java, I fetched images data from path and stored in byte array. While loading images on Google Chrome it gives exception: ClientAbortException: java.net.SocketException: Software caused connection abort: socket write error Here is my code: byte[] data = getImageData(path,imageName); response.setHeader("Cache-Control", "no-store"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", -1); response.setHeader("Content-Disposition", "attachment,fileName=\"" + data); response.setContentLength(data.length); response.setContentType("application/octet-stream"); responseOutputStream = response.getOutputStream(); responseOutputStream.write(data, 0, data == null ? 0: data.length); responseOutputStream.flush();
has comment: http://stackoverflow.com/comment/41447935
accepted answer: http://stackoverflow.com/a/37377813
has answer: http://stackoverflow.com/a/26399578
has comment: http://stackoverflow.com/comment/41342157
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41347774
tagged with: google-chrome

http://stackoverflow.com/q/26292969
tagged with: android
has comment: http://stackoverflow.com/comment/42006686
tagged with: firebase
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26643388
tagged with: java
upvote count: 10
downvote count: 1
type: Question
score: 9
has comment: http://stackoverflow.com/comment/41931791
accepted answer: http://stackoverflow.com/a/26643388
has comment: http://stackoverflow.com/comment/62193100
has title: Can I store image files in firebase using Java API
answer count: 1
favorite count: 0
has body: Is there any way to store image files in firebase using Java api?

http://stackoverflow.com/comment/41229105
has text: I updated the Q with the interface code
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26278359

http://stackoverflow.com/comment/49538894
has text: It's a 64-bit number than when converted to a hex string becomes 16 characters long.
comment on: http://stackoverflow.com/a/26244588
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/q/26210338
answer count: 1
score: 1
favorite count: 0
tagged with: apache-poi
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26909421
has comment: http://stackoverflow.com/comment/41103614
tagged with: java
upvote count: 1
type: Question
tagged with: xwpf
downvote count: 0
has title: I want to delete a particular line in the docx if it has a particular word using poi xwpf
has body: I want to delete a particular line in the docx if it has a particular word, say "killer". How i can write a program using poi xwpf? If i replace it with empty data, the line will be still there. Actually I am able to find the particular text in the docx file so that i can match and decide whether to delete that particular line using the below code: for (XWPFParagraph xwpfParagraph : xwpfParagraphs) { List&lt;XWPFRun&gt; xwpfRuns = xwpfParagraph.getRuns(); for (XWPFRun xwpfRun : xwpfRuns) { String xwpfRunText = xwpfRun.getText(xwpfRun .getTextPosition()); System.out.println(xwpfRunText); for (Map.Entry&lt;String, String&gt; entry : replcementMap .entrySet()) { if (xwpfRunText != null &amp;&amp; xwpfRunText.contains(entry.getKey())) { xwpfRunText = xwpfRunText.replaceAll( entry.getKey() , entry.getValue()); } } xwpfRun.setText(xwpfRunText, 0); } }

http://stackoverflow.com/q/26281614
has comment: http://stackoverflow.com/comment/41236957
favorite count: 0
accepted answer: http://stackoverflow.com/a/26287683
has title: libgdx using percentage for images
has answer: http://stackoverflow.com/a/26287683
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41236806
score: 1
tagged with: java
upvote count: 1
has body: I'm making a game sort of like flappy bird, but it works on landscape mode, to make it fair so that people with bigger screens don't have an advantage I change my images to screen % for example the bird will be 10% of screen height, so it will be the same in all screens, the question is, is this a good idea or is there any other way?
type: Question
tagged with: libgdx
tagged with: screen-size
tagged with: screen-resolution
downvote count: 0
answer count: 1

http://stackoverflow.com/a/26218950
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26218909
upvote count: 1
has body: getTitle() returns nothing (void) and you're trying to add this to a String. Use this: public String getTitle() { return year + title + detail; }
downvote count: 0

http://stackoverflow.com/q/26232527
has body: how to restart a timer in every button click? here given a sample code for timer setting new CountDownTimer(3000, 1000) { public void onTick(long millisUntilFinished) { //getSelectedAlphabet.setText(selectedIndex.getText()); } public void onFinish() { //mTextField.setText("done!"); getSelectedAlphabet.setVisibility(View.INVISIBLE); Log.d("Counter", "Finished...."); } }.start();
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26234894
has title: restart or refresh a timer when button is clicked in android
linked to: http://stackoverflow.com/q/11221829
answer count: 3
duplicate of: http://stackoverflow.com/q/11221829
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26232579
has answer: http://stackoverflow.com/a/26232771

http://stackoverflow.com/comment/41233941
comment on: http://stackoverflow.com/a/26280958
score: 0
has text: Actually I am reading from a .txt file and ArrayList is to make an Adjacency list.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41269567
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26288760
type: AnswerComment
has text: That actually pointed me out in the right direction , although its not open source or free ... I now at least know what im looking for , I think i'll end up using JUNG http://jung.sourceforge.net/

http://stackoverflow.com/comment/41381982
has text: Glad to hear, happy coding :-)
score: 0
comment on: http://stackoverflow.com/a/26336290
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26305835
answers question: http://stackoverflow.com/q/26305101
has body: try this : ActivityA.java public class ActivityA extends Activity{ StringBuilder msg=new StringBuilder(); private EditText et1; private TextView tv1; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test); et1=(EditText)findViewById(R.id.et1); tv1=(TextView)findViewById(R.id.tv1); } public void adding(View view){ msg.append(" "+et1.getText().toString()); tv1.setText(msg); et1.setText(""); } public void sendMessage(View view){ Intent intent=new Intent(this,Next.class); intent.putExtra("message", msg.toString()); startActivity(intent); } } Next.java public class Next extends Activity{ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.next); TextView tv = (TextView)findViewById(R.id.textView1); tv.setText(getIntent().getStringExtra("message")); } } test.xml <TextView android:id="@+id/tv1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="" android:textSize="12sp" /> <EditText android:id="@+id/et1" android:layout_width="200dip" android:layout_height="wrap_content" android:text="" /> next.xml <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="msg" android:textSize="25sp" />
score: 0
type: Answer

http://stackoverflow.com/a/41911482
type: Answer
answers question: http://stackoverflow.com/q/26203179
score: 0
has comment: http://stackoverflow.com/comment/71004571
has comment: http://stackoverflow.com/comment/71008051
has body: public int countCode(String str) { int count = 0; for(int i = 0; i &lt; str.length()-3; i++) if(str.substring(i, i+2).equals("co") &amp;&amp; str.charAt(i+3) == 'e') count++; return count; }

http://stackoverflow.com/comment/41080234
comment on: http://stackoverflow.com/q/26197745
type: Comment
type: QuestionComment
score: 2
has text: See [*Algorithms + Data Structures = Programs*](http://en.wikipedia.org/wiki/Algorithms_%2B_Data_Structures_%3D_Programs), Chapter 3, and [*Tower of Hanoi*](http://en.wikipedia.org/wiki/Tower_of_Hanoi).

http://stackoverflow.com/q/26306287
tagged with: double
tagged with: return
type: UnansweredQuestion
upvote count: 1
tagged with: methods
has answer: http://stackoverflow.com/a/26306586
has title: Format for calling a method
tagged with: java
type: Question
answer count: 2
tagged with: arrays
downvote count: 0
has body: I have very limited experience with Java, and I am having trouble implementing a bunch of classes I got from another source. I am trying to use the calculateMutualInformation() from the following Java package: https://github.com/Craigacp/JavaMI The associated java doc describes the method as follows: public static double calculateMutualInformation(double[] firstVector, double[] secondVector) If you want to see the doc file, it is available here: http://www.cs.man.ac.uk/~pococka4/JavaMI/index.html I'm trying to pass two arrays into this function, using the following code in DoubleTrouble.java: package JavaMI; public class DoubleTrouble { public static double calculateMutualInformation() { double[] firstVector = {0, 1, 2, 0, 1, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 1, 0}; double[] secondVector = {1, 2, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 0, 2}; //return ?? } } The above data is just a place holder, however, I seem not to understand how to call this method. I get a missing return error, and any type of return statement I try to put in gives an error (mostly that I am missing a ".class"). I have also tried to put variables as parameters for the method, but that tends to give more errors. Is there something wrong with the method, or the man (me)? I've also tried calling other methods from the package, like MutualInformation(), again to no avail. Also, I should mention that I compiled all the java files in the JavaMI package; not sure if that was necessary.
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26306338

http://stackoverflow.com/comment/41324731
has text: Thank you very much, I think I know where where is wrong in my code!
type: AnswerComment
comment on: http://stackoverflow.com/a/26319226
score: 0
type: Comment

http://stackoverflow.com/comment/41398399
comment on: http://stackoverflow.com/a/26349679
type: Comment
has text: Yes but why? You should let the system choose it randomly. Otherwise RMI isn't going to work, frankly, it really isn't designed to use a fixed client-side port. All the connection pooling assumes otherwise. If you have outbound client-side port rules in your firewall, get rid of them: they don't accomplish anything useful.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41205881
comment on: http://stackoverflow.com/q/26264520
score: 0
type: QuestionComment
type: Comment
has text: @VictorSorokin Yeah, I have a facade in application. It's simple core java based application, but the facade itself have over 200 methods.GUI will call one of these methods, but I don't know whcih and that's I want to know. WITHOUT putting breakpoint in every 200 methods.

http://stackoverflow.com/a/26319985
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26319646
has comment: http://stackoverflow.com/comment/41307568
has comment: http://stackoverflow.com/comment/41305318
has comment: http://stackoverflow.com/comment/41307253
has comment: http://stackoverflow.com/comment/41307388
has comment: http://stackoverflow.com/comment/41307234
upvote count: 2
has comment: http://stackoverflow.com/comment/41307319
type: Answer
accepted answer of: http://stackoverflow.com/q/26319646
score: 2
has comment: http://stackoverflow.com/comment/41316682
has comment: http://stackoverflow.com/comment/41307961
has comment: http://stackoverflow.com/comment/41307360
has body: "Assuming" you only want to capture the area behind the active frame (and as you say, without the frame), then something like.. import java.awt.AWTException; import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.Robot; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.image.BufferedImage; import java.lang.reflect.InvocationTargetException; import java.util.concurrent.ExecutionException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class PrintScreen01 { public static void main(String[] args) { new PrintScreen01(); } private Timer timer; public PrintScreen01() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } catch (UnsupportedLookAndFeelException ex) { } final PrintPane printPane = new PrintPane(); final JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(printPane); frame.pack(); frame.setLocationRelativeTo(null); frame.addComponentListener(new ComponentAdapter() { @Override public void componentMoved(ComponentEvent e) { timer.restart(); } @Override public void componentResized(ComponentEvent e) { timer.restart(); } }); timer = new Timer(250, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (frame.isVisible()) { takeSnap…

http://stackoverflow.com/a/26313253
upvote count: 1
has body: Because it's a URL, not a filename. The question itself is odd. What do you care what the path of the URL is?
downvote count: 0
has comment: http://stackoverflow.com/comment/41293104
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26313178

http://stackoverflow.com/a/26195748
downvote count: 0
has body: The code you have written above is an example of Multilevel inheritance not Multiple Inheritance. Multiple Inheritance is like : class A extends B,C { //this code is not valid in JAVA } And, if you want to use interfaces for implementing a structure like multiple inheritance, then you could use: interface test_interface1{ /*all the methods declared here in this interface should be the part ** of the class which is implementing this current interface */ } Similarly : interface test_interface2{ } So, create a class TestClass like : class TestClass implements test_interface1,test_interface2 { //now you have to use each and every method(s) declared in both the interfaces // i.e. test_interface1 &amp; test_interface2 } You could also use a syntax like: class TestClass extends AnyClass implements test_interface1,test_interface2 { /* but do keep in mind - use extends keyword before implements ** and now you know you cannot use more than 1 class names with extends keyword ** in java. */
answers question: http://stackoverflow.com/q/26195553
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/26197956
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26197945
answers question: http://stackoverflow.com/q/26197945
score: 0
has body: The parameter of areaCalc() should be of type double, but it is int. When you pass a double, it must be converted to an int, but that will cause a loss of precision and the language requires you to make an explicit cast if you attempt that. If you code your method like this: public static double areaCalc(double n1) { ... } You'll have no problem (and it will make more sense too).

http://stackoverflow.com/comment/41270817
type: Comment
has text: "You should do something" which does not work in practice is not an accurate statement in a programming language certification guide, if you ask me.
comment on: http://stackoverflow.com/a/26300888
score: 1
type: AnswerComment

http://stackoverflow.com/comment/46665541
has text: When I click on Fix Project Setup it shows No proposals have been found window...
type: Comment
comment on: http://stackoverflow.com/a/27088759
score: 1
type: AnswerComment

http://stackoverflow.com/comment/117222759
comment on: http://stackoverflow.com/a/51669230
type: AnswerComment
has text: On RHEL 7.5 I installed java-1.8.0-openjdk, but this does not include the JAVAC compiler, so based on your information I additionally installed java-1.8.0-openjdk-devel.x86_64 and now I have the JAVAC compiler. If it is a JRE it should be labeled as such. This is utter nonsense. java-1.8.0-openjdk is not a JDK. Should be called java-1.8.0-openjdk-jre
score: 0
type: Comment

http://stackoverflow.com/comment/41292689
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26308035
has text: First of all you are doing way too much configuration that Spring Boot can do for you. Check out http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-two-datasources

http://stackoverflow.com/comment/41348048
type: Comment
comment on: http://stackoverflow.com/q/26343027
score: 1
type: QuestionComment
has text: I really hope that variable naming in `delete(E string)` is some weird artifact from refactoring process

http://stackoverflow.com/q/26201407
has answer: http://stackoverflow.com/a/26201870
has body: I created 2 classes: Quadrangle and Point, Quadrangle uses 4 Points to create one instance. In Points, I have a Scanner to get inputPoint, so that I can use these Points to build up a Quadrangle The more detail implementation is provided in the source code below. The problem is, When I make the Scanner local inside the inputPoint, it requires close right at the end of the method. If I close it, the inputPoint in the inputQuadrangle method cannot be use continuously to create 4 needed Points. I just think that with each inputPoint called, the scanner was create again and again, and it should work. So, what's wrong here? Error in the code block below. If I don't close it, a weak point exsits in the Point class, but inputPoint in the inputQuadrangle method can be use continuously to create 4 needed Points. But when I make the Scanner static like a field, it doesn't require close, and coming along with that, I can use inputPoint in the inputQuadrangle method without any error or weak point. So, what did I miss? Please point it out. Point class with local scanner package OOPBaiTap; import java.util.Scanner; public class Point { // Thuoc tinh private String name; private double x; private double y; // Phuong thuc khoi tao mac dinh public Point() { this("A", 0, 0); } // Phuong thuc khoi tao nhan hai so thuc lam tham so public Point(double x, double y) { this.x = x; this.y = y; } // Phuong thuc khoi tao nhan mot chuoi va hai so thuc lam tham so public Point(String name, double x, double y) { this.name = name; this.x = x; this.y = y; } // Phuong thuc khoi toa nhan mot doi tuong cua lop Poin lam tham so public Point(Point point) { this.name = point.getName(); this.x = point.getX(); this.y = point.getY(); } // Cac phuong thuc get, set public String getName() { return name; } public void setName(String name) { this.name = name; } 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 =…
answer count: 1
tagged with: inheritance
score: 0
accepted answer: http://stackoverflow.com/a/26201870
tagged with: java.util.scanner
has title: Please explain this circumstance: Scanner in inheritance
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41087410

http://stackoverflow.com/comment/41230957
comment on: http://stackoverflow.com/q/26269658
score: 0
has text: Kishore. Logcat: `10-09 09:17:17.837: D/AbsListView(30598): unregisterIRListener() is called 10-09 09:17:27.576: D/Total Fitness(30598): Workout [Location=Test, Number of Sets=3, Bodypart=Test, exercise= Test] 10-09 09:17:27.606: D/AbsListView(30598): unregisterIRListener() is called 10-09 09:17:27.616: E/ViewRootImpl(30598): sendUserActionEvent() mView == null`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41099460
has text: It appears you lack a very fundamental understanding on the constructs you are using. There's semicolons where there shouldn't be, and your `case` keywords need to be lowercased.
comment on: http://stackoverflow.com/q/26208296
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/26280832
has answer: http://stackoverflow.com/a/26367936
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41259843
has comment: http://stackoverflow.com/comment/41409043
type: Question
has body: We are developing a website using Tomcat 7 JDBC PostgreSQL 9.2 We've had some connection leaks and think we corrected them (the database no longer stops responding), but the behaviour of the connection pool still seems leaky, as we have a number of idle connections greater than the maxIdle set in context.xml. I'd like to be sure the problem is fixed. For testing purposes, I'm using the following context.xml : &lt;Resource auth="Container" name="jdbc/postgres" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" type="javax.sql.DataSource" username="admin" password="..." driverClassName="org.postgresql.Driver" url="jdbc:postgresql://127.0.0.1:5432/..." initialSize="1" maxActive="50" minIdle="0" maxIdle="3" maxWait="-1" minEvictableIdleTimeMillis="1000" timeBetweenEvictionRunsMillis="1000" /&gt; If I understand correctly, we should have 1 idle connection on startup and from 0 to 3 depending on the load, right ? What is happening is : 1 connection on startup, up to 3 idle connections if the load is low, and more than 3 idle connections after a high load. Then these connections are not closed immediatly, and we don't know when/if they will be closed (sometime some of them are closed). So the question is : is this behaviour normal, or not ? Thanks for your help EDIT : added factory attribute, didn't change the problem EDIT 2 : using removeAbandoned &amp; removeAbandonedTimeout make the idle connexions being closed every removeAbandonedTimeout. So we probably still have some connection leaks. Here are some pieces of code we are using to connect to the database and execute requests : PostgreSQLConnectionProvider, just a static class to provide a connection : public class PostgreSQLConnectionProvider { public static Connection getConnection() throws NamingException, SQLException { String dsString = "java:/comp/env/jdbc/postgres"; Context context = new InitialContext(); DataSource ds = (DataSource) context.lookup(dsString); Connection connection = ds.getConnection(); retu…
has comment: http://stackoverflow.com/comment/41260925
tagged with: java
has comment: http://stackoverflow.com/comment/41238813
has comment: http://stackoverflow.com/comment/41399993
has comment: http://stackoverflow.com/comment/41476999
downvote count: 0
answer count: 1
score: 1
tagged with: tomcat
favorite count: 0
has title: Tomcat connection pool & idle connections
tagged with: postgresql
has comment: http://stackoverflow.com/comment/41243905
has comment: http://stackoverflow.com/comment/41243472
tagged with: connection-pooling

http://stackoverflow.com/a/26332466
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26332421
has comment: http://stackoverflow.com/comment/41328587
type: Answer
has body: Hi frank you need appCompatfor Theme.AppCompat.Light please do following steps File->Import (android-sdk\extras\android\support\v7). Choose "appcompat" Project-> properties->Android. In the section library "Add" and choose "appCompat"
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/41736534
accepted answer of: http://stackoverflow.com/q/26332421

http://stackoverflow.com/a/26197532
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41079855
has comment: http://stackoverflow.com/comment/41079888
upvote count: 3
has body: Use List&lt;Object&gt;, there you will be able to store anything.
downvote count: 1
answers question: http://stackoverflow.com/q/26197505
has comment: http://stackoverflow.com/comment/41079815

http://stackoverflow.com/comment/41248907
has text: Please learn how to debug your code (or understand what debugging is). This is one good tutorial: http://www.vogella.com/tutorials/EclipseDebugging/article.html or this if you don't use eclipse: http://www.javaworld.com/article/2077445/testing-debugging/debug-with-jdb.html
type: Comment
comment on: http://stackoverflow.com/q/26288707
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41361396
type: AnswerComment
score: 0
has text: That may work - but it doesn't really "feel" like the correct solution. Doesn't really have any "tie" whatsoever to `@Configuration` classes. There has to be some way within Spring to tie into `@Configuration` classes to add your own custom annotations or processing - just like Spring has support for custom XML namespaces - its built right into the framework.
type: Comment
comment on: http://stackoverflow.com/a/26348413

http://stackoverflow.com/q/26330519
tagged with: maven
tagged with: spring
tagged with: spring-boot
score: 1
tagged with: java
type: Question
has body: I am implementing a microservice with Spring Boot and it is really nice that it builds a "fat jar" with all the required dependencies packaged. But, it is packaging dependencies I don't even use, for example: I am using a Cassandra database, but it still packages MongoDB depencies among 100+ others because of the spring-starter dependency , resulting in a 24 MB jar file! Am I doing something wrong here? Is it possible to tell Maven to exclude all the dependencies that are not actually used? EDIT: I was wrong, it is only including the necessary dependencies, disregard this question. Here is the pom.xml org.springframework.boot spring-boot-starter-parent 1.1.8.RELEASE <relativePath /> org.springframework.boot spring-boot-starter org.springframework.data spring-data-cassandra 1.1.0.RELEASE org.springframework.boot spring-boot-starter-test test UPDATE: Here is the dependency:tree [INFO] com.test.project:dataloader:jar:0.0.1 [INFO] +- org.springframework.boot:spring-boot-starter:jar:1.1.8.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot:jar:1.1.8.RELEASE:compile [INFO] | | \- org.springframework:spring-context:jar:4.0.7.RELEASE:compile [INFO] | | \- org.springframework:spring-aop:jar:4.0.7.RELEASE:compile [INFO] | | \- aopalliance:aopalliance:jar:1.0:compile [INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.1.8.RELEASE:compile [INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:1.1.8.RELEASE:compile [INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile [INFO] | | +- org.slf4j:log4j-over-slf4j:jar:1.7.7:compile [INFO] | | \- ch.qos.logback:logback-classic:jar:1.1.2:compile [INFO] | | \- ch.qos.logback:logback-core:jar:1.1.2:compile [INFO] | +- org.springframework:spring-core:jar:4.0.7.RELEASE:compile [INFO] | \- org.yaml:snakeyaml:jar:1.13:compile [INFO] +- org.springframework.data:spring-data-cassandra:jar:1.1.0.RELEASE:compile [INFO] | +- org.springframework.data:spring-cql:jar:1.0.4.RELEASE:compile [INFO] | | +- org.…
downvote count: 0
has comment: http://stackoverflow.com/comment/41338970
has comment: http://stackoverflow.com/comment/41352645
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41325227
favorite count: 0
has answer: http://stackoverflow.com/a/26333147
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41486404
has title: How to stop Spring Boot from building a "fat jar" with dependencies that are not used

http://stackoverflow.com/a/70855898
answers question: http://stackoverflow.com/q/26318569
score: 0
has body: I am so exited with detailed answer of @Luke Woodward that want to share a workaround. As @Luke Woodward explained, we can not have two calls like when(mainModel.getList()); // ... when(model.getName()).thenReturn(...); Than can occurs in call chain. But in case you will use construction: doReturn(mockToken("token3")).when(mock).getAccessToken(); when OAuth2AccessToken mockToken(String tokenVal){ OAuth2AccessToken token = Mockito.mock(OAuth2AccessToken.class); doReturn( 60 ).when(token).getExpiresIn(); doReturn(tokenVal).when(token).getValue(); return token; } all will works as expected.
type: Answer

http://stackoverflow.com/q/26280809
score: -3
has comment: http://stackoverflow.com/comment/41233512
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41233806
has comment: http://stackoverflow.com/comment/41233439
has comment: http://stackoverflow.com/comment/41233678
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26281008
type: Question
upvote count: 0
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/41233636
has body: How do you print the index of an array in Java? I'm really stuck with this I feel like it should be something like an if statement like if (i == 5050) { System.out.println("Index is: " +i); } I'd really appreciate any help even if it's just a good place to start searching for the answer. Thanks public class summation { public static void main(String[] args) { long[] a = new long[101]; long sum; int i, numbers; numbers = 100; // initialise the array a using the loop counter for (i = 1; i &lt;= numbers; i++) { a[i] = (long) i; } sum = 0; for (i = 1; i &lt;= numbers; i++) { // do summation sum = sum + a[i]; } System.out.println("sum of numbers between 1 and " + numbers + " is " + sum); } }
accepted answer: http://stackoverflow.com/a/26281008
has title: Printing the Index of an array in Java
favorite count: 0
has comment: http://stackoverflow.com/comment/41233462

http://stackoverflow.com/a/26501530
answers question: http://stackoverflow.com/q/26276099
type: Answer
has body: Yes, after so many assumptions, I got the solution. Actually the app server and db server network issue. The problem was coming when the network gets down just after the callableStatement.execute(). Sometime it was throwing "socket error" otherwise it was getting stuck even after completion of procedure.
score: 0

http://stackoverflow.com/comment/41253775
has text: Ok, so I added this in - thanks for that. However, now I am getting a different output. When I search for "ALGO" I get A, A, L, A, O, A, L, G, O, A, L, G, O. Why aren't I just getting A, L, G, O?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26291597
type: AnswerComment

http://stackoverflow.com/a/26212341
answers question: http://stackoverflow.com/q/26212317
upvote count: 4
has comment: http://stackoverflow.com/comment/41107463
downvote count: 0
has comment: http://stackoverflow.com/comment/41107190
has body: An array must have a fixed size. If you don't know the size in advance, use an ArrayList instead. After you finish adding the values to the ArrayList, you can create an array (whose size is based on the number of elements in the ArrayList) and copy the data to it.
has comment: http://stackoverflow.com/comment/41107229
score: 4
has comment: http://stackoverflow.com/comment/41107309
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26212317
type: Answer

spring
tags question: http://stackoverflow.com/q/26288936
tags question: http://stackoverflow.com/q/26258408
tags question: http://stackoverflow.com/q/26250242
tags question: http://stackoverflow.com/q/26326231
tags question: http://stackoverflow.com/q/26332768
tags question: http://stackoverflow.com/q/26299170
tags question: http://stackoverflow.com/q/26296195
tags question: http://stackoverflow.com/q/26316966
tags question: http://stackoverflow.com/q/26311568
tags question: http://stackoverflow.com/q/26305363
tags question: http://stackoverflow.com/q/26350461
tags question: http://stackoverflow.com/q/26258461
tags question: http://stackoverflow.com/q/26236039
tags question: http://stackoverflow.com/q/26296035
tags question: http://stackoverflow.com/q/26343666
tags question: http://stackoverflow.com/q/26225999
tags question: http://stackoverflow.com/q/26285609
tags question: http://stackoverflow.com/q/26259870
tags question: http://stackoverflow.com/q/26331959
tags question: http://stackoverflow.com/q/26250238
tags question: http://stackoverflow.com/q/26216427
tags question: http://stackoverflow.com/q/26245351
tags question: http://stackoverflow.com/q/26302753
tags question: http://stackoverflow.com/q/26337240
tags question: http://stackoverflow.com/q/26211220
tags question: http://stackoverflow.com/q/26344299
tags question: http://stackoverflow.com/q/26296313
tags question: http://stackoverflow.com/q/26330297
tags question: http://stackoverflow.com/q/26276874
tags question: http://stackoverflow.com/q/26256948
tags question: http://stackoverflow.com/q/26336392
tags question: http://stackoverflow.com/q/26326654
tags question: http://stackoverflow.com/q/26281863
tags question: http://stackoverflow.com/q/26282348
tags question: http://stackoverflow.com/q/26229058
tags question: http://stackoverflow.com/q/26335941
tags question: http://stackoverflow.com/q/26230992
tags question: http://stackoverflow.com/q/26256933
tags question: http://stackoverflow.com/q/26319412
tags question: http://stackoverflow.com/q/26345455
tags question: http://stackoverflow.com/q/26282385
tags question: http://stackoverflow.com/q/26303704
tags question: http://stackoverflow.com/q/26257967
tags question: http://stackoverflow.com/q/26271383
tags question: http://stackoverflow.com/q/26336440
tags question: http://stackoverflow.com/q/26350507
tags question: http://stackoverflow.com/q/26317262
tags question: http://stackoverflow.com/q/26252554
type: Tag
tags question: http://stackoverflow.com/q/26276048
tags question: http://stackoverflow.com/q/26226217
tags question: http://stackoverflow.com/q/26296896
tags question: http://stackoverflow.com/q/26300266
tags question: http://stackoverflow.com/q/26216181
tags question: http://stackoverflow.com/q/26347868
tags question: http://stackoverflow.com/q/26237984
tags question: http://stackoverflow.com/q/26325202
tags question: http://stackoverflow.com/q/26309207
tags question: http://stackoverflow.com/q/26258158
tags question: http://stackoverflow.com/q/26231165
tags question: http://stackoverflow.com/q/26255313
tags question: http://stackoverflow.com/q/26202446
tags question: http://stackoverflow.com/q/26295682
tags question: http://stackoverflow.com/q/26276009
tags question: http://stackoverflow.com/q/26244219
tags question: http://stackoverflow.com/q/26202567
tags question: http://stackoverflow.com/q/26309791
tags question: http://stackoverflow.com/q/26260078
tags question: http://stackoverflow.com/q/26259474
tags question: http://stackoverflow.com/q/26269092
tags question: http://stackoverflow.com/q/26339587
tags question: http://stackoverflow.com/q/26312272
tags question: http://stackoverflow.com/q/26306420
tags question: http://stackoverflow.com/q/26260659
tags question: http://stackoverflow.com/q/26315767
tags question: http://stackoverflow.com/q/26291245
tags question: http://stackoverflow.com/q/26294212
tags question: http://stackoverflow.com/q/26290513
tags question: http://stackoverflow.com/q/26283993
tags question: http://stackoverflow.com/q/26212631

http://stackoverflow.com/comment/41260390
has text: @Mubin ok I have add all the versions. thank you very much
score: 0
comment on: http://stackoverflow.com/q/26294212
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26305363
possible better answer: http://stackoverflow.com/a/26305705
score: 120
tagged with: java
type: Question
has title: Spring 4 vs Jersey for REST web services
has body: We are planning to make a new application with spring 4.0.6 version. We use controller that can return "XML" or "JSON". In the previous project we have successfully implemented Jersey with Spring for REST support using JAX-RS API, but after reading a few articles and suggestions from seniors they said spring is providing pretty good REST support. Some of the points that really confused me if I use Spring REST support without using JAX-RS and Jersey are: How marshaling and unmarshaling done in Spring MVC ? Is it necessary for marshaling or unmarshaling need to use jax-rs. If marshaling and unmarshaling are automatically handled by spring then how does it know about xmlRootElements. I am still confused if Spring proving very good support of REST then why do people still go with Jersey for REST? Really looking to know more in details. If I said anything wrong please ignore it. Explanation with example is really helpful.
accepted answer: http://stackoverflow.com/a/26317525
answer count: 2
upvote count: 120
downvote count: 0
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/26305705
tagged with: web-services
tagged with: spring
has answer: http://stackoverflow.com/a/26317525
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/a/26296557
has body: Add a method toString to your LinkedList class public String toString() { Node&lt;T&gt; curr = head; StringBuilder sb = new StringBuilder(); sb.append("LinkedList ["); while (curr != null) { sb.append(curr.data); if (curr.nextNode != null) { sb.append(", "); } curr = curr.nextNode; } sb.append("]"); return sb.toString(); } Then call it in your main method : System.out.println(list.toString());
type: Answer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/41262543
has comment: http://stackoverflow.com/comment/41262664
upvote count: 6
answers question: http://stackoverflow.com/q/26296320

sql
tags question: http://stackoverflow.com/q/26299776
tags question: http://stackoverflow.com/q/26274382
tags question: http://stackoverflow.com/q/26327065
tags question: http://stackoverflow.com/q/26288642
tags question: http://stackoverflow.com/q/26236028
tags question: http://stackoverflow.com/q/26336520
tags question: http://stackoverflow.com/q/26337068
tags question: http://stackoverflow.com/q/26332033
tags question: http://stackoverflow.com/q/26231817
tags question: http://stackoverflow.com/q/26225915
tags question: http://stackoverflow.com/q/26261324
tags question: http://stackoverflow.com/q/26229014
tags question: http://stackoverflow.com/q/26302917
tags question: http://stackoverflow.com/q/26322751
tags question: http://stackoverflow.com/q/26272084
tags question: http://stackoverflow.com/q/26203990
tags question: http://stackoverflow.com/q/26240424
tags question: http://stackoverflow.com/q/26227752
tag name: sql
tags question: http://stackoverflow.com/q/26339155
tags question: http://stackoverflow.com/q/26305468
type: Tag
tags question: http://stackoverflow.com/q/26352609
tags question: http://stackoverflow.com/q/26249169
tags question: http://stackoverflow.com/q/26237930
tags question: http://stackoverflow.com/q/26226031
tags question: http://stackoverflow.com/q/26324603
tags question: http://stackoverflow.com/q/26213024
tags question: http://stackoverflow.com/q/26317535
tags question: http://stackoverflow.com/q/26200178
tags question: http://stackoverflow.com/q/26200851
tags question: http://stackoverflow.com/q/26341309
tags question: http://stackoverflow.com/q/26312238
tags question: http://stackoverflow.com/q/26207948
tags question: http://stackoverflow.com/q/26284330
tags question: http://stackoverflow.com/q/26285896
tags question: http://stackoverflow.com/q/26245626
tags question: http://stackoverflow.com/q/26291085
tags question: http://stackoverflow.com/q/26290623
tags question: http://stackoverflow.com/q/26284945
tags question: http://stackoverflow.com/q/26273546
tags question: http://stackoverflow.com/q/26325325
tags question: http://stackoverflow.com/q/26296127
tags question: http://stackoverflow.com/q/26213533
tags question: http://stackoverflow.com/q/26228812
tags question: http://stackoverflow.com/q/26270609
tags question: http://stackoverflow.com/q/26350595
tags question: http://stackoverflow.com/q/26260216
tags question: http://stackoverflow.com/q/26236459
tags question: http://stackoverflow.com/q/26200476
tags question: http://stackoverflow.com/q/26307760
tags question: http://stackoverflow.com/q/26210080
tags question: http://stackoverflow.com/q/26237579
tags question: http://stackoverflow.com/q/26331524
tags question: http://stackoverflow.com/q/26217177

http://stackoverflow.com/q/26245626
type: Question
has body: We're using DatabaseChangeListener in our code with certain queries, but for one instance we want the listener to be able to be triggered on the returned value of a query. Specifically, we have a query that returns the number of seconds until a certain action needs to be performed, so we want a listener to be triggered when the number of seconds returned is 0. Is this possible with DatabaseChangeListener? I tried plugging the query directly in to stmt.executeQuery( QUERY_STRING ); but that simply resulted in ORA-29983: Unsupported query for Continuous Query Notification, which seems pretty vague. Below is the query if it helps. select (case when ns.daycode is null then sysdate when greatest(jts.todate(n.transdate) + ns.delay, sysdate, trunc(sysdate)+ns.starttime) &lt; trunc(sysdate)+ns.endtime then greatest(jts.todate(n.transdate) + ns.delay, sysdate, trunc(sysdate)+ns.starttime) else trunc(sysdate)+1 end - sysdate) * 86400 as deliverytime from notices n left join noticeschedule ns on (n.noticetype = ns.noticetype and n.noticedeliverytype = ns.noticedeliverytype and n.instbit = ns.instbit and to_char(sysdate, 'D') = ns.daycode) where n.noticetype in ('RR', 'RC') and n.instbit = 965 and n.processed = 'N';
tagged with: sql
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Can DatabaseChangeListener be applied to specific query values?
answer count: 0
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/41100497
type: Comment
has text: thanks for the update! that's actually helped! (except the attitude) :\
comment on: http://stackoverflow.com/a/26208193
score: 0
type: AnswerComment

http://stackoverflow.com/a/26195565
score: 2
answers question: http://stackoverflow.com/q/26195553
has comment: http://stackoverflow.com/comment/41076299
has body: This is not multi-inheritance. Each class has exactly one direct super class. If your example was considered multi-inheritance, you wouldn't be able to use the extends keyword at all, since each class already extends by default the Object class. Multi-inheritence would be class C extends A,B {} And that's illegal in Java.
upvote count: 2
has comment: http://stackoverflow.com/comment/41076353
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26195553
has comment: http://stackoverflow.com/comment/41076332

http://stackoverflow.com/q/26288402
tagged with: spring-data
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/41248391
score: 4
has comment: http://stackoverflow.com/comment/67329496
upvote count: 4
has comment: http://stackoverflow.com/comment/42554312
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring-data-mongodb
has body: Background One idea I recently picked up from learning about Domain Driven Design (DDD) is that it can be nice to wrap data types, such as Strings and primitives, with domain objects that have meaningful names. For example, if I have a com.example.Account domain object that I am going to store in MongoDB, it might have an id field that is of type java.lang.String. Instead, it might be nice to have the id field be of type com.example.AccountId since this reads fairly well and helps as a kind of self documentation of the code. It also could be a compile time defence against someone accidentally passing another kind of id that also happens to be a String... I have run into some trouble trying to achieve this using Spring Data MongoDB Example Using A String I started with an Account object that just has a single field called "id" of type java.lang.String. My Spring Data Repository definition was as follows: public interface AccountRepository extends PagingAndSortingRepository<Account, String> {} This works fine and I can save instances of accounts which will be given automatically generated MongoDB identifiers, such as: 5436fd21300415af8c9201e0. Using A Custom Type First I define an object as follows: public class AccountId implements Serializable { private final String id; public AccountId(String id) { this.id = id; } public String getId() { return id; } } Then I change the type of the id field in account to be AccountId and finally change the repository definition to be: public interface AccountRepository extends PagingAndSortingRepository<Account, AccountId> {} When I try to save an instance of Account I get an exception: org.springframework.dao.InvalidDataAccessApiUsageException: Cannot autogenerate id of type com.example.AccountId for entity of type com.example.Account! at org.springframework.data.mongodb.core.MongoTemplate.assertUpdateableIdIfNotSet(MongoTemplate.java:1149) at org.springframework.data.mongodb.core.MongoTemplate.doSave(MongoTemplate.java:878) at or…
has comment: http://stackoverflow.com/comment/67336069
has comment: http://stackoverflow.com/comment/67318577
answer count: 0
has title: Using a domain object as a MongoDB document ID with Spring Data
tagged with: java

http://stackoverflow.com/q/26239777
has comment: http://stackoverflow.com/comment/41158732
has comment: http://stackoverflow.com/comment/41158690
has comment: http://stackoverflow.com/comment/41158541
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has body: I'm trying to convert a String to a char array so that I can search char by char in it: char[] arr = new char[str.length()]; for (i = 0; i &lt; str.length(); i++) { arr[i] = str.charAt(i); } do { // Something } while (arr[i] != " "); but last line gives this error in Eclipse: Incompatible operand types Char and String Even when I use method toCharArray, the error remains. Can anybody explain to me why?
has comment: http://stackoverflow.com/comment/41158682
score: -2
has comment: http://stackoverflow.com/comment/41158663
has title: Error converting String to Char array
has comment: http://stackoverflow.com/comment/41158842
answer count: 2
downvote count: 2
tagged with: char
tagged with: arrays
possible better answer: http://stackoverflow.com/a/26240210
has answer: http://stackoverflow.com/a/26239825
accepted answer: http://stackoverflow.com/a/26239825
tagged with: string
has answer: http://stackoverflow.com/a/26240210
has comment: http://stackoverflow.com/comment/41158649
favorite count: 0

http://stackoverflow.com/q/26195252
has answer: http://stackoverflow.com/a/26385517
score: 8
has comment: http://stackoverflow.com/comment/41076037
has comment: http://stackoverflow.com/comment/41417055
linked to: http://stackoverflow.com/q/187550
has comment: http://stackoverflow.com/comment/41075958
tagged with: maven
has comment: http://stackoverflow.com/comment/48041866
downvote count: 1
tagged with: java-8
has answer: http://stackoverflow.com/a/26200724
has body: I have a library project in Java. I want to implement, test, and probably release several versions of the project, intented to be used with different Java versions: 6, 7, 8. The simpliest way is just to copy-paste project and support several source trees, but I want to avoid this because It's tedious and error-prone. Another possible way is to factor "base" project, and several Java version specific projects depending. Versions differs very slightly, but I don't what to reflect this technical development issue in class hierarchy. So I'm looking for a kind of precompilers and/or standard Maven options and/or Maven plugins which could help to support several Java version-specific versions of the library from a single source tree, and transparently for the lib users.
type: Question
answer count: 8
upvote count: 9
has answer: http://stackoverflow.com/a/26457456
has comment: http://stackoverflow.com/comment/41079438
tagged with: java
has answer: http://stackoverflow.com/a/26296476
has comment: http://stackoverflow.com/comment/41102319
has comment: http://stackoverflow.com/comment/41079408
has comment: http://stackoverflow.com/comment/41079389
tagged with: conditional-compilation
has comment: http://stackoverflow.com/comment/48047405
has answer: http://stackoverflow.com/a/26385740
favorite count: 0
has answer: http://stackoverflow.com/a/26417173
has comment: http://stackoverflow.com/comment/41414923
has answer: http://stackoverflow.com/a/26396907
has answer: http://stackoverflow.com/a/26299030
has comment: http://stackoverflow.com/comment/41103743
type: UnansweredQuestion
has title: How to support different versions of main (and test) source sets for different Java versions (6, 7, 8)
has comment: http://stackoverflow.com/comment/48056195

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/26327957

http://stackoverflow.com/comment/41336412
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26288567
has text: OK, so if you're only writing, catch `IOException` and take it as a signal that the connection is hosed. The only `IOException` that doesn't mean that is `SocketTimeoutException`.
score: 0

http://stackoverflow.com/comment/41116701
score: 0
comment on: http://stackoverflow.com/q/26214246
has text: Unfortunately the window ancestor `pack()` solution did not work in the actual application. It is a NetBeans platform application and `getWindowAncestor(popupMenu)` returns the application frame `JFrame[NbMainWindow...]` instead of `Popup$HeavyWeightWindow[...]` as in the test app and calling `pack()` on it resizes the whole app window and not the popup menu. So please share another possible solution if you have one. :-)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26331111
has answer: http://stackoverflow.com/a/26342894
linked to: http://stackoverflow.com/q/6253444
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: Having trouble with the umano android slidinguppanel 2 views as sliding child
upvote count: 2
accepted answer: http://stackoverflow.com/a/26342894
type: AnsweredQuestion
score: 2
tagged with: java
linked to: http://stackoverflow.com/q/13257990
has comment: http://stackoverflow.com/comment/41327371
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41327288
has body: I am using this library from umanoAndroidSlidingUpPanel and it works fine theres just a problem I cant fix. the main child is a mapview (static main view) that is working fine and the second child (the slidinguppanel) is a responsive html file in a webview and an imageview. the problem is that when I swipe up to slide the panel i cant scroll the html file inside the webview. the library states that I can make a single view draggable so that I can scroll the other but i really dont know how to do it help would be really appreciated. heres my xml file <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" sothree:panelHeight="50dp" sothree:shadowHeight="4dp"> <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.MapFragment"/> <WebView android:layout_width="match_parent" android:id="@+id/desc" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:paddingBottom="7dp"/> </com.sothree.slidinguppanel.SlidingUpPanelLayout>
tagged with: android
answer count: 1
tagged with: slidingdrawer

http://stackoverflow.com/q/26281322
score: 58
tagged with: java
tagged with: maven
has comment: http://stackoverflow.com/comment/41264242
type: Question
has answer: http://stackoverflow.com/a/49688089
has answer: http://stackoverflow.com/a/66697636
upvote count: 58
answer count: 13
tagged with: eclipse
has comment: http://stackoverflow.com/comment/63269995
has answer: http://stackoverflow.com/a/67482339
has body: I am building my project using Maven. My maven version is apache-maven-3.0.4. I am using Eclipse Luna. When I try to build my project I get the following error [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources (default-resources) on project OrionCommunity: Mark invalid -> [Help 1]. Following is the stack trace when I run mvn clean install -X: [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:53.295s [INFO] Finished at: Thu Oct 09 20:00:26 IST 2014 [INFO] Final Memory: 9M/25M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources (default-resources) on project OrionCommunity: Mark invalid -&gt; [Hel p 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources (default-resources) on project OrionCommunity: Mark invalid at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.Mave…
has answer: http://stackoverflow.com/a/74277863
has comment: http://stackoverflow.com/comment/41262818
has comment: http://stackoverflow.com/comment/41235241
has title: Maven:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources
has answer: http://stackoverflow.com/a/50148772
favorite count: 0
has answer: http://stackoverflow.com/a/60286649
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/42413663
has answer: http://stackoverflow.com/a/26307644
has answer: http://stackoverflow.com/a/61818700
tagged with: maven-plugin
has answer: http://stackoverflow.com/a/28864641
has answer: http://stackoverflow.com/a/42160004
has comment: http://stackoverflow.com/comment/41263450
downvote count: 0
has comment: http://stackoverflow.com/comment/41235866
has answer: http://stackoverflow.com/a/37404239
has answer: http://stackoverflow.com/a/52271489

http://stackoverflow.com/q/26255425
has answer: http://stackoverflow.com/a/26255507
linked to: http://stackoverflow.com/q/17357758
tagged with: java
has answer: http://stackoverflow.com/a/26255517
tagged with: selenium
tagged with: google-chrome
type: Question
has answer: http://stackoverflow.com/a/26255518
possible better answer: http://stackoverflow.com/a/26255517
has title: Syntax error on token "else", delete this token
has comment: http://stackoverflow.com/comment/41186644
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/26255651
accepted answer: http://stackoverflow.com/a/26255651
has comment: http://stackoverflow.com/comment/41216842
has body: Im getting Syntax error can someone please tell me whats wrong. Console text: Exception in thread "main" java.lang.Error: Unresolved compilation problem: Syntax error on token "else", delete this token at gg.main(gg.java:23) Code: import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; public class gg { public static void main(String[] args) { String browser = "Chrome"; WebDriver driver = null; if(browser.equals("Mozilla")) driver = new FirefoxDriver(); else if(browser.equals("Chrome")) System.setProperty("webdriver.chrome.driver", "F:\\chromedriver_win32\\chromedriver.exe"); driver = new ChromeDriver(); else if(browser.equals("IE")) System.setProperty("webdriver.IE.driver", "C:\\Users\\Ryuk~\\Downloads\\IEDriverServer_x64_2.43.0\\IEDriverServer.exe"); driver = new InternetExplorerDriver(); driver.get("https://gmail.com"); System.out.println(driver.getTitle()); } }
answer count: 4
downvote count: 6
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41186738

http://stackoverflow.com/comment/41314248
type: QuestionComment
comment on: http://stackoverflow.com/q/26323583
has text: possible duplicate of [SuperCSV append rather than overwrite?](http://stackoverflow.com/questions/15729977/supercsv-append-rather-than-overwrite)
score: 1
type: Comment

hibernate
tags question: http://stackoverflow.com/q/26220876
tags question: http://stackoverflow.com/q/26220254
tags question: http://stackoverflow.com/q/26200324
tags question: http://stackoverflow.com/q/26326955
tags question: http://stackoverflow.com/q/26252398
tags question: http://stackoverflow.com/q/26334244
tags question: http://stackoverflow.com/q/26240432
tags question: http://stackoverflow.com/q/26261495
tags question: http://stackoverflow.com/q/26273097
tags question: http://stackoverflow.com/q/26316238
tags question: http://stackoverflow.com/q/26295075
tags question: http://stackoverflow.com/q/26312238
tags question: http://stackoverflow.com/q/26261324
tags question: http://stackoverflow.com/q/26231947
tags question: http://stackoverflow.com/q/26267272
tags question: http://stackoverflow.com/q/26206261
tags question: http://stackoverflow.com/q/26206142
tags question: http://stackoverflow.com/q/26228829
tags question: http://stackoverflow.com/q/26203990
tags question: http://stackoverflow.com/q/26240424
tags question: http://stackoverflow.com/q/26221624
tags question: http://stackoverflow.com/q/26333492
tags question: http://stackoverflow.com/q/26351469
tags question: http://stackoverflow.com/q/26329977
tags question: http://stackoverflow.com/q/26246368
tags question: http://stackoverflow.com/q/26272767
tags question: http://stackoverflow.com/q/26342915
tags question: http://stackoverflow.com/q/26300982
tags question: http://stackoverflow.com/q/26321951
tags question: http://stackoverflow.com/q/26234900
tags question: http://stackoverflow.com/q/26261906
tags question: http://stackoverflow.com/q/26239083
tags question: http://stackoverflow.com/q/26271980
tags question: http://stackoverflow.com/q/26319332
tags question: http://stackoverflow.com/q/26218165
tags question: http://stackoverflow.com/q/26232064
tags question: http://stackoverflow.com/q/26250795
tags question: http://stackoverflow.com/q/26219627
tags question: http://stackoverflow.com/q/26281958
tags question: http://stackoverflow.com/q/26242492
tags question: http://stackoverflow.com/q/26317535
tags question: http://stackoverflow.com/q/26265564
tag name: hibernate
tags question: http://stackoverflow.com/q/26258417
tags question: http://stackoverflow.com/q/26218052
tags question: http://stackoverflow.com/q/26259963
tags question: http://stackoverflow.com/q/26290626
tags question: http://stackoverflow.com/q/26240967
tags question: http://stackoverflow.com/q/26347613
tags question: http://stackoverflow.com/q/26234067
tags question: http://stackoverflow.com/q/26195962
tags question: http://stackoverflow.com/q/26309641
tags question: http://stackoverflow.com/q/26200579
tags question: http://stackoverflow.com/q/26212598
tags question: http://stackoverflow.com/q/26264414
tags question: http://stackoverflow.com/q/26305168
tags question: http://stackoverflow.com/q/26233995
tags question: http://stackoverflow.com/q/26216222
tags question: http://stackoverflow.com/q/26288936
tags question: http://stackoverflow.com/q/26303219
tags question: http://stackoverflow.com/q/26258408
tags question: http://stackoverflow.com/q/26212289
tags question: http://stackoverflow.com/q/26291085
tags question: http://stackoverflow.com/q/26252545
tags question: http://stackoverflow.com/q/26253870
tags question: http://stackoverflow.com/q/26337684
tags question: http://stackoverflow.com/q/26230099
tags question: http://stackoverflow.com/q/26280303
tags question: http://stackoverflow.com/q/26283306
tags question: http://stackoverflow.com/q/26234436
tags question: http://stackoverflow.com/q/26290623
tags question: http://stackoverflow.com/q/26202566
tags question: http://stackoverflow.com/q/26225999
tags question: http://stackoverflow.com/q/26247133
tags question: http://stackoverflow.com/q/26236729
tags question: http://stackoverflow.com/q/26344299
tags question: http://stackoverflow.com/q/26325050
tags question: http://stackoverflow.com/q/26281995
tags question: http://stackoverflow.com/q/26282012
tags question: http://stackoverflow.com/q/26313439

http://stackoverflow.com/q/26226456
has title: += vs =+ in Java
has answer: http://stackoverflow.com/a/26226481
favorite count: 0
tagged with: operators
tagged with: programming-languages
type: AnsweredQuestion
downvote count: 0
has body: I am familiar with the += operator in java, that if executed like: i += 2; is the same as: i = i + 2; But what exactly is =+? It compiles fine in Java, but as far as I can tell it only assigns the result right-hand-side expression to the left-hand-side variable. i.e. i =+ 2 is the same as: i = 2 Anyone know what exactly is going on here? Apologies if this has been asked, the SEO for any question regarding operators is always wonky... Thanks!
tagged with: java
has comment: http://stackoverflow.com/comment/41133988
score: 6
type: Question
has comment: http://stackoverflow.com/comment/41133966
upvote count: 6
has answer: http://stackoverflow.com/a/26226480
accepted answer: http://stackoverflow.com/a/26226480
possible better answer: http://stackoverflow.com/a/26226481
answer count: 2

http://stackoverflow.com/comment/41286735
type: Comment
score: 0
type: AnswerComment
has text: I'm getting Git for Windows, gonna upload it soon
comment on: http://stackoverflow.com/a/26271261

http://stackoverflow.com/comment/120374674
type: Comment
has text: OK I get that point. If this is about not physically running out of memory, you want the PhantomReference guarantee that an object was freed. Thanks
score: 0
comment on: http://stackoverflow.com/a/33161963
type: AnswerComment

http://stackoverflow.com/comment/41271570
comment on: http://stackoverflow.com/a/26259914
type: Comment
has text: You can manually put entry() at the beginning and exit() at the end of each method but these methods were designed so that a bytecode manipulation tool could insert them automatically. If you want to log a message you are probably better off using the trace(), debug(), info(), warn() and error() methods. (Location will work for these methods also.)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41100705
comment on: http://stackoverflow.com/a/26206761
has text: This just worked for me (though I didn't try to get SceneBuilder to understand it). It didn't need reflection at all. Let me know if it seems you are doing anything complicated and I'll post my solution.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41126114
comment on: http://stackoverflow.com/q/26222180
score: 0
type: Comment
type: QuestionComment
has text: Java isn't _required_ to have a garbage collector at all, and different implementations do this in different ways. All you're _guaranteed_ is that an object won't be released until you drop all strong references to it.

http://stackoverflow.com/q/26223801
tagged with: hdfs
favorite count: 0
has comment: http://stackoverflow.com/comment/41155951
has title: Optimization of Pig Script
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41130610
has comment: http://stackoverflow.com/comment/41129951
has comment: http://stackoverflow.com/comment/41165196
tagged with: apache-pig
answer count: 0
tagged with: java
has body: I have written a ‘Pig Script’ which is processing Sequence files given as input. It is working fine but there is one problem mentioned below. I have repetitive statements in my pig script, as shown below: Filtered_Data _1= FILTER BagName BY ($0 matches 'RegEx-1'); Filtered_Data_2 = FILTER BagName BY ($0 matches 'RegEx-2'); Filtered_Data_3 = FILTER BagName BY ($0 matches 'RegEx-3'); So on… Question : So is there any way by which I can have above statement written once and then loop through all possible “RegEx” and substitute in Pig script. For Example: Filtered_Data _X = FILTER BagName BY ($0 matches 'RegEx'); ( have this statement once ) ( loop through all possible RegEx and substitute value in the statement ) Right now I am calling Pig script from a shell script, so any way from shell script will be also be welcome or even Java wrapper... Thanks in advance. Happy Pigging!!!!
has comment: http://stackoverflow.com/comment/41130352
upvote count: 1
downvote count: 1
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/41130271
has comment: http://stackoverflow.com/comment/41161679
score: 0
tagged with: shell

deserialization
type: Tag
tags question: http://stackoverflow.com/q/26302613
tag name: deserialization
tags question: http://stackoverflow.com/q/26263967
tags question: http://stackoverflow.com/q/26291404
tags question: http://stackoverflow.com/q/26203634
tags question: http://stackoverflow.com/q/26260423
tags question: http://stackoverflow.com/q/26203247

http://stackoverflow.com/comment/41137910
has text: No, primitive types are "special" in Java and don't have an `equals` method (or any other method for that matter)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26228445
score: 0

http://stackoverflow.com/q/26349046
has title: add object to arrayList in the constructor
tagged with: constructor
has answer: http://stackoverflow.com/a/26349089
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41359016
type: Question
has answer: http://stackoverflow.com/a/26349099
answer count: 2
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/41359020
has body: Part of a separate class file for "Bericht"-objects (dutch for messages, contains a string and two dates) : private ArrayList&lt;Bericht&gt; lijst = new ArrayList&lt;&gt;(); // //constructor for a new object: public Bericht(String bericht, Date startDag, Date eindDag) { this.bericht = bericht; this.startDag = startDag; this.eindDag = eindDag; // System.out.println(""+lijst.size())// prints always a "0" lijst.add(this); // System.out.println(""+lijst.size())//is always one } Somewhere in my main method i create new objects from this class: Bericht message = new Bericht(berichtVak.getText(), calendar1.getDate(), calendar2.getDate()); message.printBerichten(berichtTextArea); //this method prints the String from each Bericht- object in the textarea the method "printberichten" iterates the ArrayList and prints all messages public void printBerichten(JTextArea jta) { StringBuffer bfr = new StringBuffer(); for (Bericht msg : lijst) { bfr.append(msg.getBericht()); //this getter method returns the string } jta.setText(bfr.toString()); } getBericht getter method: public String getBericht() { return bericht; } So if i make a new object, all my previous objects should be displayed in the textArea, but it seems that i only create one instance of my class. Before and After the command "lijst.add(this)" i added a System.out.println to check the size from the Arraylist and one returns always a 0 and the other a "1".

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/26259261
tags question: http://stackoverflow.com/q/26325201
tags question: http://stackoverflow.com/q/26231137
tags question: http://stackoverflow.com/q/26257622
tags question: http://stackoverflow.com/q/26339303
tags question: http://stackoverflow.com/q/26232916
tags question: http://stackoverflow.com/q/26291404
tags question: http://stackoverflow.com/q/26254864
tags question: http://stackoverflow.com/q/26281165
tags question: http://stackoverflow.com/q/26228271
tags question: http://stackoverflow.com/q/26287571
type: Tag
tags question: http://stackoverflow.com/q/26266117
tags question: http://stackoverflow.com/q/26237095
tags question: http://stackoverflow.com/q/26335000
tags question: http://stackoverflow.com/q/26233346
tags question: http://stackoverflow.com/q/26329895
tags question: http://stackoverflow.com/q/26298935
tags question: http://stackoverflow.com/q/26339005
tags question: http://stackoverflow.com/q/26325257
tags question: http://stackoverflow.com/q/26281121
tags question: http://stackoverflow.com/q/26279617
tags question: http://stackoverflow.com/q/26325193
tags question: http://stackoverflow.com/q/26252125
tags question: http://stackoverflow.com/q/26236419
tags question: http://stackoverflow.com/q/26252780
tags question: http://stackoverflow.com/q/26226534
tags question: http://stackoverflow.com/q/26315437
tags question: http://stackoverflow.com/q/26212631
tags question: http://stackoverflow.com/q/26205257
tags question: http://stackoverflow.com/q/26307935
tags question: http://stackoverflow.com/q/26255771
tags question: http://stackoverflow.com/q/26263506
tags question: http://stackoverflow.com/q/26207755
tags question: http://stackoverflow.com/q/26297427
tags question: http://stackoverflow.com/q/26218328
tags question: http://stackoverflow.com/q/26344919
tags question: http://stackoverflow.com/q/26250401
tags question: http://stackoverflow.com/q/26330302
tags question: http://stackoverflow.com/q/26334292
tags question: http://stackoverflow.com/q/26310595
tags question: http://stackoverflow.com/q/26325403
tags question: http://stackoverflow.com/q/26278268
tags question: http://stackoverflow.com/q/26335351
tags question: http://stackoverflow.com/q/26214706
tags question: http://stackoverflow.com/q/26243335
tags question: http://stackoverflow.com/q/26272078
tags question: http://stackoverflow.com/q/26338989
tags question: http://stackoverflow.com/q/26261569
tags question: http://stackoverflow.com/q/26258203
tags question: http://stackoverflow.com/q/26337606
tags question: http://stackoverflow.com/q/26276150
tags question: http://stackoverflow.com/q/26301062
tags question: http://stackoverflow.com/q/26309586
tags question: http://stackoverflow.com/q/26320961
tags question: http://stackoverflow.com/q/26250450
tags question: http://stackoverflow.com/q/26330692
tags question: http://stackoverflow.com/q/26233227
tags question: http://stackoverflow.com/q/26274996
tags question: http://stackoverflow.com/q/26252200
tags question: http://stackoverflow.com/q/26291161
tags question: http://stackoverflow.com/q/26254143
tags question: http://stackoverflow.com/q/26226444
tags question: http://stackoverflow.com/q/26326096
tags question: http://stackoverflow.com/q/26245341
tag name: xml
tags question: http://stackoverflow.com/q/26203247
tags question: http://stackoverflow.com/q/26244760
tags question: http://stackoverflow.com/q/26246306
tags question: http://stackoverflow.com/q/26292528
tags question: http://stackoverflow.com/q/26261495
tags question: http://stackoverflow.com/q/26250443
tags question: http://stackoverflow.com/q/26276412
tags question: http://stackoverflow.com/q/26339842
tags question: http://stackoverflow.com/q/26222027
tags question: http://stackoverflow.com/q/26308635
tags question: http://stackoverflow.com/q/26343089
tags question: http://stackoverflow.com/q/26206037
tags question: http://stackoverflow.com/q/26224417
tags question: http://stackoverflow.com/q/26331111

http://stackoverflow.com/q/26279561
has body: I have below code, testresultlists is a list transferred to JSP, and id is named as row. The problem is I can't get each row's resultTypeId during select iterator. In this <s:if test="%{#result.resultTypeId == #row.resultTypeId"> I tried many ways, can't find a working way to show #row.resultTypeId result, but it has a value showing in another area. Could anyone help me? <display:table name="testresultlists" class="mobile" id="row" style="width:100%;" cellpadding="0" cellspacing="0" pagesize="50" requestURI="testExecutionAction.action" sort="external"> <display:caption> No. Test Case Name Result Log Bug Id Comments </display:caption> <display:column title="Row Number" class="fixTitle1"> <c:out value="${row_rowNum}"></c:out> </display:column> <display:column property="testCaseName" /> <display:column title="Row Number" class="fixTitle1"> <s:iterator value="#resulttypelist" id="result"> <s:if test="%{#result.resultTypeId == #row.resultTypeId"> ${result.resultTypeName} </s:if> <s:else> 233${result.resultTypeName} </s:else> </s:iterator> </display:column> <display:column property="resultTypeId" />
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/26281111
has title: JSP Struts parameter isn't showing
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: ognl
accepted answer: http://stackoverflow.com/a/26281111
tagged with: displaytag
tagged with: struts2
score: 0

http://stackoverflow.com/comment/41333818
score: 0
type: Comment
type: QuestionComment
has text: If you can download the HTML file, Why don't you read that HTML text for internal links. Those Internal links that you find, you can download.
comment on: http://stackoverflow.com/q/26334771

http://stackoverflow.com/q/26296185
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26398483
tagged with: java
has title: Cobertura code coverage report in Jenkins seem to give the same statistics no matter of the extension of the tests
type: Question
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has body: Problem My code coverage report created from my scripts and Cobertura seem to give me the same coverage no matter of how many tests that are run. Jenkins' Cobertura plug-in always show me the same graph, should I run all or none of the tests. Problem description I am a beginner to Jenkins, Cobertura and the whole of code coverage in large. I have a simple Java project (see Code: Program below) that runs a few simple tests in TestNG (see Code: Test below). A few scripts are handling the compilation and testing (see Code: Scripts below), scripts that are given to Jenkins in it's Build: Execute Shell in the following order: clean.sh compile.sh test-coverage.sh (test.sh) Now, in test-coverage.sh, Cobertura instruments the program's source code (the Code: Program part), creates a coverage.xml that should (and seemingly does) contain the coverage for my code after the tests are run. However, if I should remove a test (or all, it does not matter) and run it again, the coverage.xml seem to give me the same statistics as if I ran it with all tests intact. What am I doing wrong? Have I missunderstood the concept? Should I also instrument my test classes? Code: Program The program is an automated, simple version of the FizzBuzz math game, where each player takes turns to count up, replacing each number that is evenly denomainated by a said denominator by another word (ex. "Fizz" but in this example "Cowabunga"). main.java public class main { public static void main(String[] args){ StartGame game = new StartGame(); game.start(); } } StartGame.java public class StartGame { public static void start() { GameRules gr = new GameRules(3,5); gr.startGame(); } } GameRules.java public class GameRules { private int currentNumber; private int currentPlayer; private int playUntilThisNumber; private int dividerToSkip; private List<Player> playerlist; public GameRules(int numberOfPlayers, int divider){ playerlist = new ArrayList<Player>(); currentNumber=1; currentPlayer=3; playUntilThisNumbe…
accepted answer: http://stackoverflow.com/a/26398483
has comment: http://stackoverflow.com/comment/41265812
tagged with: testng
tagged with: cobertura
tagged with: jenkins
tagged with: code-coverage
upvote count: 2
has comment: http://stackoverflow.com/comment/41263469

http://stackoverflow.com/q/26251068
tagged with: aspectj
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26252409
type: AnsweredQuestion
has title: After() in aspectj
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26254497
accepted answer: http://stackoverflow.com/a/26252409
has answer: http://stackoverflow.com/a/26254497
has body: I am new to aspectj and I had a function which gets the integer variable and adds 100 to it as follows public static void add(int no) { no=no+100; } My aspect is as follows pointcut printMessage(int m) : execution(* add(..)) &amp;&amp; args(m); after(int m) returning: printMessage(m) { System.out.println(m); } I am calling the function with the value 10. But when I run the code, it returns the result as 10. can any one tell me why it is not returning 110. correct me if I am wrong
tagged with: aop

http://stackoverflow.com/comment/41255484
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26292150
has text: where is the error?can you send me your code to this mail prasanna@ceylonlinux.lk

http://stackoverflow.com/q/26330070
has body: Write a program called PositiveNegative that reads an unspecified number of integers, determines how many positive and negative values have been entered, and computes the sum and average of the input values (not counting zeros). The reading of input ends when the user enters 0 (zero). Display the number of positive and negative inputs, the sum and the average. The average should be computed as a floating-point number. Design the program such that it asks the user if they want to continue with new inputs after each set of entries, ending the program only when they do not respond to the question with "yes". Here is a sample run: Input a list of integers (end with 0): 1 2 -1 3 0 # of positive inputs: 3 # of negative inputs: 1 The total: 5.0 The average: 1.25 Would you like to continue with new inputs? yes Input a list of integers (end with 0): 0 No numbers were entered except 0 Would you like to continue with new inputs? no and here is my code： import java.util.*; public class PositiveNegative { public static void main(String[] args){ Scanner input = new Scanner(System.in); String answer; int countpositive = 0; int countnegative = 0; int total = 0; int num = 0; System.out.print("Input a list of integers (end with 0): "); do{ String list = input.nextLine(); for(int i = 0; ; i=i+2 ){ num = Integer.parseInt(list.substring(i,i+1)); if( num == 0) break; else if ( num &gt; 0) countpositive++; else if ( num &lt; 0) countnegative--; total = total + num; } double average = total/(countpositive + countnegative); System.out.println("# of positive inputs: "+countpositive); System.out.println("# of negative inputs: "+countnegative); System.out.println("The total: "+total); System.out.println("The average"+average); System.out.println("\n "); System.out.print("Would you like to continue with new inputs? "); answer = input.next(); }while(answer.equalsIgnoreCase("Yes")); } } I can compile file, but when i run it, i can't get result like sample run.
has title: check a list how many is positive number
upvote count: 0
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/26330096
favorite count: 0
has comment: http://stackoverflow.com/comment/41324271
type: UnansweredQuestion
downvote count: 3
score: -3
tagged with: loops
has comment: http://stackoverflow.com/comment/41324161
type: Question
has comment: http://stackoverflow.com/comment/41324138
tagged with: java

apache-commons
tags question: http://stackoverflow.com/q/26275484
tag name: apache-commons
type: Tag
tags question: http://stackoverflow.com/q/26246395

http://stackoverflow.com/a/26340130
has body: Yes, but it doesnt fix my problem. my problem was that, that if i am using the overlaps function, it looks unreal. Because(look at http://img24.cz/images/08705660216361901876.png ), you can see that the top of the image is clean, there is not my fish, my fish is only in the middle of image, so it looks bad, if the player is under or over the fish, it gives me a score(because it is overlapping(because of that non-ultimate image)). The contain function was better, because it looked reallistic. So i wanted a help, how do i can make it better.
score: 0
answers question: http://stackoverflow.com/q/26329746
type: Answer

http://stackoverflow.com/comment/41570681
type: AnswerComment
score: 1
type: Comment
has text: This shows why it's important to post code which reproduce the problem. ;-) Anyway, glad to hear that your problem could be solved.
comment on: http://stackoverflow.com/a/26464565

scope
tags question: http://stackoverflow.com/q/26330246
tags question: http://stackoverflow.com/q/26245488
tag name: scope
type: Tag
tags question: http://stackoverflow.com/q/26200301

http://stackoverflow.com/q/26280347
downvote count: 0
has comment: http://stackoverflow.com/comment/41233146
accepted answer: http://stackoverflow.com/a/26280818
tagged with: android
has title: Android user permission error (android.permission.ACCESS_WIFI_STATE)
has body: I have an error : Caused by: java.lang.SecurityException: WifiService: Neither user 10132 nor current process has android.permission.ACCESS_WIFI_STATE. I try do get wifi name (ssid). I use this code: WifiManager wifiManager = (WifiManager) getSystemService (Context.WIFI_SERVICE); System.out.println(wifiManager.getConnectionInfo ().getSSID ()); In my manifest file i added this permission: &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; What i do wrong? This and this doesn't work for me Thanks My full logcat: 10-09 16:08:23.705 31988-31988/com.example.android.navigationdrawerexample E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.navigationdrawerexample/com.example.android.navigationdrawerexample.MainActivity}: java.lang.SecurityException: WifiService: Neither user 10132 nor current process has android.permission.ACCESS_WIFI_STATE. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309) at android.app.ActivityThread.access$700(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5319) 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:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.SecurityException: WifiService: Neither user 10132 nor current process has android.permission.ACCESS_WIFI_STATE. at android.os.Parcel.readException(Parcel.java:1425) at android.os.Parcel.readException(Pa…
answer count: 4
possible better answer: http://stackoverflow.com/a/39062443
favorite count: 0
has answer: http://stackoverflow.com/a/39062443
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26280818
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/3531940
has answer: http://stackoverflow.com/a/42106900
linked to: http://stackoverflow.com/q/8240561
type: Question
has answer: http://stackoverflow.com/a/26280494

http://stackoverflow.com/a/26339329
accepted answer of: http://stackoverflow.com/q/26335806
upvote count: 1
answers question: http://stackoverflow.com/q/26335806
score: 1
has body: As far as I am aware, there is no mechanism to set a default resource bundle. You can always create a utility method to do this if you need: public class MyUtils { private static final ResourceBundle bundle = ... ; public static FXMLLoader getLoader(URL location) { return new FXMLLoader(location, bundle); } }
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26373765
downvote count: 0
has comment: http://stackoverflow.com/comment/41404336
has comment: http://stackoverflow.com/comment/41403982
has body: Here is solution found by myself: import org.json.JSONArray; import org.json.JSONObject; public class CreateNVD3JSONDataJava { public static void main(String[] args) { JSONObject jo = new JSONObject(); jo.put("values", new JSONArray(new Long[][]{{1025409600000L,23L},{1028088000000L,19L},{1030766400000L,21L},{1033358400000L,22L}})); jo.put("key", "North America"); JSONArray ja = new JSONArray(); ja.put(jo); ja.put(jo); ja.put(jo); System.out.println(ja); } }
has comment: http://stackoverflow.com/comment/41404267
score: 1
answers question: http://stackoverflow.com/q/26310454
upvote count: 1
has comment: http://stackoverflow.com/comment/41404213
type: Answer

http://stackoverflow.com/a/26321551
has comment: http://stackoverflow.com/comment/41309012
has body: The problem is that your recursive height() method is calling height() on this. That is not how the algorithm ought to work, and it is the obvious cause of the infinite recursion loop that gives you the stack overflow. @xgeorgekx's approach should give the right answer, but I'm not convinced that it is optimal. If the tree is balanced, then the heights of the left and right subtrees are related ... and you may not need to traverse both sides. If you can avoid that, then the height method can be implemented as O(logN) not O(N). I suspect that your original approach is trying to be O(logN) ...
type: Answer
answers question: http://stackoverflow.com/q/26321500
has comment: http://stackoverflow.com/comment/41309770
upvote count: 1
has comment: http://stackoverflow.com/comment/41309811
score: 1
has comment: http://stackoverflow.com/comment/41308307
downvote count: 0

http://stackoverflow.com/comment/41110062
comment on: http://stackoverflow.com/q/26213916
type: Comment
type: QuestionComment
has text: 01/05/2014 - 31/05/2014 == May/2014
score: 0

http://stackoverflow.com/comment/41254791
score: 2
comment on: http://stackoverflow.com/q/26292199
type: Comment
type: QuestionComment
has text: Something that is declared as an object is a singleton: there is only one of it. You can declare a class of that form.

http://stackoverflow.com/comment/41240390
type: QuestionComment
score: 0
has text: adding relevant code to the post in a couple of minutes. thanks
comment on: http://stackoverflow.com/q/26284075
type: Comment

http://stackoverflow.com/a/26325374
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41315198
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26325325
accepted answer of: http://stackoverflow.com/q/26325325
has comment: http://stackoverflow.com/comment/41315585
has comment: http://stackoverflow.com/comment/41315524
has comment: http://stackoverflow.com/comment/41315641
has comment: http://stackoverflow.com/comment/41315636
has body: References TB_EMPLOYEE on which field? You must specify it. ALTER TABLE TB_ATTENDANCE ADD CONSTRAINT FK_TB_EMPLOYEE_EMP_ID FOREIGN KEY (EMP_ID) REFERENCES TB_EMPLOYEE(EMP_ID);
has comment: http://stackoverflow.com/comment/41315648
has comment: http://stackoverflow.com/comment/41315319

http://stackoverflow.com/a/26313288
accepted answer of: http://stackoverflow.com/q/26307760
downvote count: 0
answers question: http://stackoverflow.com/q/26307760
has comment: http://stackoverflow.com/comment/118243232
score: 99
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43856979
has body: with rewriteBatchedStatements=true the JDBC will pack as many queries as possible into a single network packet, lowering this way the network overhead. Am I right? Yes. The following code String myConnectionString = "jdbc:mysql://localhost:3307/mydb?" + "useUnicode=true&amp;characterEncoding=UTF-8"; try (Connection con = DriverManager.getConnection(myConnectionString, "root", "whatever")) { try (PreparedStatement ps = con.prepareStatement("INSERT INTO jdbc (`name`) VALUES (?)")) { for (int i = 1; i &lt;= 5; i++) { ps.setString(1, String.format( "Line %d: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", i)); ps.addBatch(); } ps.executeBatch(); } } will send individual INSERT statements even though I have created a Batch INSERT INTO jdbc (`name`) VALUES ('Line 1: Lorem ipsum ...') INSERT INTO jdbc (`name`) VALUES ('Line 2: Lorem ipsum ...') However, if I change the connection string to include rewriteBatchedStatements=true String myConnectionString = "jdbc:mysql://localhost:3307/mydb?" + "useUnicode=true&amp;characterEncoding=UTF-8" + "&amp;rewriteBatchedStatements=true"; then JDBC will send one or more multi-row INSERT statements INSERT INTO jdbc (`name`) VALUES ('Line 1: Lorem ipsum ...'),('Line 2: Lorem ipsum ...') does JDBC knows the value assigned to max_allowed_packet and therefore make the packet smaller than the defined value for max_allowed_packet ... ? Yes. If you enable the MySQL general log and check it you will see that MySQL Connector/J inspects a bunch of variables when it connects, one of which is max_allowed_packet. You can also set a small max_allowed_packet value and verify that JDBC splits a batch into several multi-row INSERT statements if a single such statement for the whole batch would exceed max_allowed_packet.
upvote count: 99
has comment: http://stackoverflow.com/comment/138474189
type: Answer
has comment: http://stackoverflow.com/comment/93492206
has comment: http://stackoverflow.com/comment/61392040

http://stackoverflow.com/a/26349637
type: Answer
has comment: http://stackoverflow.com/comment/41360436
has comment: http://stackoverflow.com/comment/41362259
has comment: http://stackoverflow.com/comment/41359999
score: 0
answers question: http://stackoverflow.com/q/26349581
has body: Try do your casting like this: (oracle.jdbc.driver.OracleConnection) ((WLConnection)dataSource.getConnection()).getVendorConnection()

http://stackoverflow.com/a/26324689
score: 7
has body: isBeforeFirst() returns true if the next call to next() will put the cursor on the first row of the ResultSet. In other words, any successful query that has data, once executed, will produce a ResultSet with isBeforeFirst() returning true. Just remove that block from your code, and have the rs.next() loop deal with potentially empty ResultSets: try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:lineappDB.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); stmt = c.createStatement(); String query = String.format("SELECT * FROM VIDEOS"); result = new Object[6]; ResultSet rs = stmt.executeQuery(query); while (rs.next()) { result[0] = rs.getInt(1); result[1] = rs.getString(2); result[2] = rs.getString(3); result[3] = rs.getString(4); result[4] = rs.getString(5); result[5] = rs.getInt(6); } } /* catch and finally snipped for clarity of the answer */
accepted answer of: http://stackoverflow.com/q/26324603
upvote count: 7
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26324603
has comment: http://stackoverflow.com/comment/41314039
type: Answer
has comment: http://stackoverflow.com/comment/41314008
has comment: http://stackoverflow.com/comment/93542697
downvote count: 0

http://stackoverflow.com/q/26243952
accepted answer: http://stackoverflow.com/a/27180675
linked to: http://stackoverflow.com/q/26638786
tagged with: algorithm
has title: Implementing Bentley–Ottmann Algorithm with an AVL tree
has comment: http://stackoverflow.com/comment/41167030
tagged with: avl-tree
has body: I'm having a problem implementing this method in java. I'm specifically implementing the algorithm FINDINTERSECTIONS in Computational Geometry 3rd Edition using an AVL BST tree for the status. The description from the book is shown below: The problem I'm having is implementing step 5 in HANDLEEVENTPOINT. When the event point is an intersection, the status is no longer totally ordered there, because for intersection lines, they cross at their intersection point and need to be swapped in the status. Since the BST I'm using is an AVLTree, the delete method fails because the rebalancing method requires proper ordering of the elements (i.e. the delete method assumes the tree is properly ordered, and performs rotations with respect to the order in order to maintain log(n) height). Also, the status I'm using stores the data in the nodes instead of the leaves as shown in the figure. If I understand correctly, the book says that either kind of tree can be used.
has comment: http://stackoverflow.com/comment/41167320
has answer: http://stackoverflow.com/a/27653459
has comment: http://stackoverflow.com/comment/41166850
has answer: http://stackoverflow.com/a/27180675
score: 0
has comment: http://stackoverflow.com/comment/41169035
answer count: 2
has comment: http://stackoverflow.com/comment/41169462
has comment: http://stackoverflow.com/comment/41884786
possible better answer: http://stackoverflow.com/a/27653459
has comment: http://stackoverflow.com/comment/41167470
type: AnsweredQuestion
tagged with: java
tagged with: computational-geometry
type: Question

http://stackoverflow.com/comment/41156361
type: Comment
has text: why are you now comparing your objects not the id strings? Do you have Overriden the equals?
comment on: http://stackoverflow.com/q/26238045
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41158118
score: 2
comment on: http://stackoverflow.com/q/26239657
has text: The `substring` method is overloaded so that you can call it like this. http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#substring-int-
type: Comment
type: QuestionComment

compiler-errors
tags question: http://stackoverflow.com/q/26208814
tag name: compiler-errors
tags question: http://stackoverflow.com/q/26330792
tags question: http://stackoverflow.com/q/26210295
tags question: http://stackoverflow.com/q/26205808
tags question: http://stackoverflow.com/q/26344218
tags question: http://stackoverflow.com/q/26246078
tags question: http://stackoverflow.com/q/26269055
type: Tag
tags question: http://stackoverflow.com/q/26320431
tags question: http://stackoverflow.com/q/26261085
tags question: http://stackoverflow.com/q/26242943
tags question: http://stackoverflow.com/q/26265193
tags question: http://stackoverflow.com/q/26313902
tags question: http://stackoverflow.com/q/26325118
tags question: http://stackoverflow.com/q/26265195

http://stackoverflow.com/comment/41318709
type: Comment
type: QuestionComment
has text: You are missing "+" after (c_name)
comment on: http://stackoverflow.com/q/26327320
score: 0

http://stackoverflow.com/a/26368114
upvote count: 1
has comment: http://stackoverflow.com/comment/41405379
has comment: http://stackoverflow.com/comment/41409663
score: 1
has body: Your feed url does not point to GData content. https://www.google.com/calendar/b/0/embed?showTitle=0&amp;height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=regreform%40aba.com&amp;color=%23182C57&amp;src=7vccf8rlid30a0v4m1004atiqg%40group.calendar.google.com&amp;color=%23125A12&amp;src=3rpabc5qjf34l49ho337qh9m04%40group.calendar.google.com&amp;color=%23691426&amp;ctz=America%2FNew_York is an html web page rather than an xml feed. In any case, GData is deprecated and should not be used (will be shut down in November this year). Try taking a look into reading this calendar through API v3 (https://developers.google.com/google-apps/calendar).
answers question: http://stackoverflow.com/q/26353355
downvote count: 0
type: Answer

http://stackoverflow.com/q/26220002
has answer: http://stackoverflow.com/a/46473810
tagged with: java
answer count: 3
tagged with: base64
has title: Base64 Ascii encoding in Java
type: UnansweredQuestion
has body: I need to transfer data between Java and C application. Binary data encoded using org.apache.commons.codec.binary.Base64Base64.encodeBase64(binaryData) is not getting properly decoded in "C" application. I think I need to encode using the "ASCII" pattern. So how to do Base64 ASCII encoding of binary data in Java ?
tagged with: ascii
has answer: http://stackoverflow.com/a/26221358
type: Question
has answer: http://stackoverflow.com/a/26927523
score: 0

http://stackoverflow.com/comment/139470975
type: Comment
has text: @MenoHochschild It‘s an explanation why the 1900 question is irrelevant, which is also a kind of answer.
comment on: http://stackoverflow.com/a/26255851
score: 0
type: AnswerComment

http://stackoverflow.com/a/26314481
has comment: http://stackoverflow.com/comment/41295015
score: 0
has body: You need to use FatJar plugin in Eclipse to pack all your libraries into one jar file, as your dependencies are present in a seperate jar file.
answers question: http://stackoverflow.com/q/26314404
type: Answer

http://stackoverflow.com/a/26257299
upvote count: 2
has body: As user2504380 already pointed out: If this was possible you could silently "upcast" any Main to any subclass of Main. However, you probably do not need this type parameter at all (at least, I can not imagine a case where it could make sense). If your class looks like this: class Main { Main getIt() { return this; } } then you can create a subclass of Main, and, thanks to the covariance in Java, override the method to return the corresponding subtype of Main class SubMain { // Overriding with a more specific return type: @Override SubMain getIt() { return this; } } This means that the return type of the method is determined by the type of the reference that you are calling the method on: Main main = new Main(); SubMain subMain = new SubMain(); Main m0 = main.getIt(); Main m1 = subMain.getIt(); // This does not work //SubMain s0 = main.getIt(); // But this works: The instance IS a SubMain, and returns a SubMain: SubMain s1 = subMain.getIt(); In the more complex scenarios that involve self-referential generic types, you might employ the getThis trick.
answers question: http://stackoverflow.com/q/26256891
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41190113
type: Answer

http://stackoverflow.com/q/26310046
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41289326
favorite count: 0
tagged with: datetime
linked to: http://stackoverflow.com/q/16986888
has answer: http://stackoverflow.com/a/26311139
has body: I am working on a CodeEval problem called Working Experience. I am given input in the form of "Month Year-Month Year" as ranges of time that someone has worked. The goal is to calculate the total time worked, however overlaps do not count, such that if the range Jan 2014-Dec 2014 appeared twice, the total time worked would still only be 12 months (1 year). Due to the input constraints, The dates are in range [Jan 1990, Dec 2020]. The end date > begin date. I believe I can force myself to an answer, but it doesn't exactly satisfy me for obvious reasons. Set of input would look like: Aug 2013-Mar 2014; Apr 2013-Aug 2013; Jun 2014-Aug 2015; Apr 2003-Nov 2004; Apr 2014-Jan 2015 Extremely forced solution: Make a boolean array that represents the months from Jan 1990 to Dec 2020. Easy to handle overlaps, just trigger flag changes if a range contains a specific month. Sum up the number of "trues" or something at the end. I am trying to implement my solution in Java, it seems that quite a few people have done this problem in Python however I am unfamiliar with it, so I not even too clear on their algorithmic approach in their solution. I have not worked with Date, Time, Calendars and whatnot much in Java. So I am unsure if any of these would be of any help to me. I think I am having the most issue dealing with overlaps and how to overcome them.
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41289198
score: 2
linked to: http://stackoverflow.com/q/20806032
has answer: http://stackoverflow.com/a/26310228
has title: Calculating total time when given ranges of time that may overlap
tagged with: java
tagged with: date
type: Question

http://stackoverflow.com/q/26267037
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26267125
tagged with: reflection
type: Question
has body: I am wondering how I can access a private field of a private inner class using reflection for my JUnit tests. Here is an example of what I need: public class A { private Map&lt;Integer, InnerClass&gt; objectMap = new TreeMap&lt;Integer, InnerClass&gt;.descendingMap(); private class InnerClass { private int fieldOne private int fieldTwo } } In this example, I want to access the values of fieldOne and fieldTwo that are in the instance of A. I have tried the following: A instanceA = new A(); Field privateObjectMapField = A.class.getDeclaredField("objectMap"); privateObjectMapField.setAccessible(true); NavigableMap&lt;Integer, Class&lt;?&gt;&gt; fieldValue = (NavigableMap&lt;Integer, Class&lt;?&gt;&gt;) privateObjectMapField.get(instanceA); // 5 is a key in the map so this should set declaredClass to an instance of InnerClass Class&lt;?&gt; declaredClass = fieldValue.get(5).getClass(); Field fieldOne = declaredClass.getDeclaredField("fieldOne"); fieldOne.setAccessible(true); Assert.assertEquals(100, fieldOne.getInt(declaredClass)); In this case it crashses at: Class&lt;?&gt; declaredClass = fieldValue.get(5).getClass(); with the error: java.lang.ClassCastException: com.test.A$InnerClass cannot be cast to java.lang.Class Does anyone know what is wrong here? I hope this example is clear. Thanks
tagged with: java
has title: accessing private inner class field using reflection
has answer: http://stackoverflow.com/a/26267186

http://stackoverflow.com/a/26223638
score: 0
answers question: http://stackoverflow.com/q/26222918
has body: The first problem I see is with the following line: avg = sum / 4; Don't use a constant value (in this case 4) unless it is the ONLY possibility. Instead use a variable and set its value equal to the difference between your starting and ending values: int dif = ending - starting + 1; // add one because we want to include end ending value avg = sum / dif; Also, the average only needs to be calculated once at the end and therefore doesn't belong inside your loop. After making these adjustments you'll end up with something like this... int start = starting; // we don't want to alter the value of 'starting' in our loop while ( start &lt;= ending) { System.out.println(start); sum = sum + start; start++; } int dif = ending - starting + 1; avg = (double)sum / dif; System.out.println("Sum of the numbers between " + starting + " and " + ending + " is " + sum); System.out.println("The average of the numbers between " + starting + " and " + ending + " is " + avg);
type: Answer

http://stackoverflow.com/q/26351567
upvote count: 5
has body: I just started an intro class to Java at WGU. I have quite a bit of background with Visual Basic using Visual Studio. My class suggested using NetBeans as the IDE for the assignments. I was so used to designing GUI's with Visual Basic's easy drag and drop interface and am wondering if there is anything like it to use with designing Java GUI's. Maybe NetBeans does it, but I haven't been able to see how. If anyone could point me to a good visual like IDE for java or maybe a guide for Netbeans, I'd much appreciate it. This is only an intro to programming course, and really I'm understanding the syntax and basics in Java but the GUI creation is way different than VB ..or so it seems now.
has comment: http://stackoverflow.com/comment/116569498
score: 4
accepted answer: http://stackoverflow.com/a/26351615
has comment: http://stackoverflow.com/comment/41363329
answer count: 1
has comment: http://stackoverflow.com/comment/41363371
favorite count: 0
has comment: http://stackoverflow.com/comment/41363426
has comment: http://stackoverflow.com/comment/41363226
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41363366
downvote count: 1
has title: Is there a Visual Studio - style GUI creator for Java?
type: Question
has answer: http://stackoverflow.com/a/26351615

http://stackoverflow.com/a/69900246
type: Answer
answers question: http://stackoverflow.com/q/26253926
has body: Is necesary install rpm-build package yum install rpm-build
has comment: http://stackoverflow.com/comment/123577085
score: 0

http://stackoverflow.com/q/26213882
tagged with: java
accepted answer: http://stackoverflow.com/a/26214035
downvote count: 0
has answer: http://stackoverflow.com/a/26213947
has body: I want to match every file name which ends with .js and is stored in a directory called lib. Therefore I created the following regular expression: (lib/)(.*?).js$. I tested the expression (lib/)(.*?).js$ in a Regex Tester and matched this filename: src/main/lib/abc/DocumentHandler.js. To use my expression in Java, I escaped it to: (lib/)(.*?)\\.js$. Nevertheless, Java tells me that my expression does not match. Here is my code: String regEx = "(lib/)(.*?).js$"; String escapedRegEx = "(lib/)(.*?)\\.js$"; Pattern pattern = Pattern.compile(escapedRegEx); Matcher matcher = pattern.matcher("src/main/lib/abc/DocumentHandler.js"); System.out.println("Matches: " + matcher.matches()); // false :-( Did I forgot to escape something?
answer count: 3
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/26214035
has answer: http://stackoverflow.com/a/26213986
has comment: http://stackoverflow.com/comment/41109767
upvote count: 1
possible better answer: http://stackoverflow.com/a/26213986
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41109759
has title: Match Strings which begin with X and end with Y?
score: 1

http://stackoverflow.com/q/26293708
type: AnsweredQuestion
score: 1
has title: is rollback possible in hibernate if one transaction fails among multiple transaction to different tables?
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26293781
type: Question
accepted answer: http://stackoverflow.com/a/26293781
downvote count: 0
answer count: 1
favorite count: 0
has body: I have one method : // methods private void transform(TransformList transformList) { TableA tA = transformList.getTableA(); TableB tB = transformList.getTableB(); TableC tC = transformList.getTableC(); daoObj.saveA(tA); daoObj.saveB(tB); daoObj.saveC(tC); } Now, //saveA mehtod public void saveA(TableA tA) { Session session = Context.getHibernateSession(); try { if(session != null) { Transaction tx = session.beginTransaction(); tx.begin(); session.merge(tA); tx.commit(); } }catch (Exception e) { tx.rollback(); throw new SomeException(e.getMessage()); } finally{ if (session != null) { session.clear(); } } } Similarly, //saveB mehtod public void saveB(TableB tB) { Session session = Context.getHibernateSession(); try { if(session != null) { Transaction tx = session.beginTransaction(); tx.begin(); session.merge(tB); tx.commit(); } }catch (Exception e) { tx.rollback(); throw new SomeException(e.getMessage()); } finally{ if (session != null) { session.clear(); } } } And, //saveC mehtod public void saveC(TableC tC) { Session session = Context.getHibernateSession(); try { if(session != null) { Transaction tx = session.beginTransaction(); tx.begin(); session.merge(tC); tx.commit(); } }catch (Exception e) { tx.rollback(); throw new SomeException(e.getMessage()); } finally{ if (session != null) { session.clear(); } } } Now while calling 'transform' method, if saveA and saveB method are success and then some exception occurs in saveC method, is it possible to rollback TableA and TableB records (which are committed already) along with TableC records?
upvote count: 1

http://stackoverflow.com/comment/41321939
has text: maybe you can help... I added the following line to @PropertySource("classpath:/app-config.properties") To Application.java and added app-config.properties to src/resources but I am getting this error Caused by: java.io.FileNotFoundException: class path resource [app-config.properties] cannot be opened because it does not exist
comment on: http://stackoverflow.com/a/26320911
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26347091
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26347119
tagged with: java
type: Question
has body: I'm having issue trying to copy an array and I've looked but can't figure out how to get rid of my outofboundsexception. Help would be appreciated. import java.util.Arrays; public class project { public static void main(String[] args) { int [] array = {1, 8, 9, 6, 7, 3, 4, 5, 10, 2}; int [] sortedArray = {array.length}; System.arraycopy(array, 0, sortedArray, 0, array.length); Arrays.sort(sortedArray); System.out.println("Before the sort: " + Arrays.toString(array) ); System.out.println("After the sort: " + Arrays.toString(sortedArray) ); } }
answer count: 1
score: -1
has title: How to fix ArrayIndexOutOfBoundsException
downvote count: 1
favorite count: 0
upvote count: 0

http://stackoverflow.com/a/26220205
score: 11
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26219788
type: Answer
accepted answer of: http://stackoverflow.com/q/26219788
upvote count: 11
has body: Optional dependencies aren't considered for transitive dependency resolution, and have to be added explicitly if necessary. (It's the same in Maven.)
has comment: http://stackoverflow.com/comment/41121972
downvote count: 0
has comment: http://stackoverflow.com/comment/41121989

http://stackoverflow.com/a/26281303
answers question: http://stackoverflow.com/q/26281220
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Because you are using nextInt() this method only grabs the next int it doesn't consume the \n character so the next time you do nextLine() it finishes consuming that line then moves to the next line.

http://stackoverflow.com/comment/41287768
score: 0
type: AnswerComment
has text: Its typo while doing copy & paste now removed
comment on: http://stackoverflow.com/a/26310116
type: Comment

http://stackoverflow.com/comment/41111088
type: Comment
type: QuestionComment
has text: Simple question, yet nobody seems to bother even to comment what's wrong with it. I hope that this is not a hate on Java.
comment on: http://stackoverflow.com/q/26214546
score: 0

http://stackoverflow.com/a/26218335
has comment: http://stackoverflow.com/comment/41118781
has comment: http://stackoverflow.com/comment/41119345
has comment: http://stackoverflow.com/comment/41118296
has body: int diff = x2 - x1; should be inside the constructor or inside the method draw() (depending on what you want to do with it). Remember: By default int variables are initialized to 0. Before you call the constructor: x1=0; x2=0; diff=x1-x2 =0-0 =0 When you call the constructor you give different values to x1 and x2 but you don't calculate the diff on the newly updated values. After you call the constructor: x1=10; x2=20; diff=0; // you don't recalculate it, it's not in the constructor or in the draw method.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26218301
has comment: http://stackoverflow.com/comment/41118240
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41118724
has comment: http://stackoverflow.com/comment/41118552
accepted answer of: http://stackoverflow.com/q/26218301
score: 1

http://stackoverflow.com/a/26291117
has body: If ordering of the elements doesn't matter, I would go for HashSets, and do it as follows: Set&lt;String&gt; a = new HashSet&lt;&gt;(); Set&lt;String&gt; b = new HashSet&lt;&gt;(); // ... b.removeAll(a): So in essence, you're removing from set b all the elements that are in set a, leaving the asymmetric set difference. Note that the removeAll method does modify set b, so if that's not what you want, you would need to make a copy first. To find out whether HashSet or TreeSet is more efficient for this type of operation, I ran the below code with both types, and used Guava's Stopwatch to measure execution time. @Test public void perf() { Set&lt;String&gt; setA = new HashSet&lt;&gt;(); Set&lt;String&gt; setB = new HashSet&lt;&gt;(); for (int i=0; i &lt; 900000; i++) { String uuidA = UUID.randomUUID().toString(); String uuidB = UUID.randomUUID().toString(); setA.add(uuidA); setB.add(uuidB); } Stopwatch stopwatch = Stopwatch.createStarted(); setB.removeAll(setA); System.out.println(stopwatch.elapsed(TimeUnit.MILLISECONDS)); } On my modest development machine, using Oracle JDK 7, the TreeSet variant is about 4 times slower (~450ms) than the HashSet variant (~105ms).
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41252959
type: Answer
answers question: http://stackoverflow.com/q/26291071

http://stackoverflow.com/q/26287892
tagged with: exception
tagged with: mallet
accepted answer: http://stackoverflow.com/a/26288190
linked to: http://stackoverflow.com/q/19621653
has comment: http://stackoverflow.com/comment/41247540
type: AnsweredQuestion
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/2533227
linked to: http://stackoverflow.com/q/702415
has comment: http://stackoverflow.com/comment/41247763
has comment: http://stackoverflow.com/comment/41247603
has comment: http://stackoverflow.com/comment/41247437
type: Question
score: 3
linked to: http://stackoverflow.com/q/6546193
has answer: http://stackoverflow.com/a/26288190
linked to: http://stackoverflow.com/q/23492683
has comment: http://stackoverflow.com/comment/41247497
has comment: http://stackoverflow.com/comment/41247409
downvote count: 0
answer count: 1
has title: How to catch exception from external jar in Java
has body: I'm try to run LDA algorithm using mallet library. When I try to run LDA with a set of parameters it's OK but with another set I have this error: 09-Oct-2014 23:50:24.354 INFO [http-nio-8084-exec-127] cc.mallet.topics.ParallelTopicModel.estimate <50> LL/token: -8.73265 09-Oct-2014 23:50:24.657 INFO [http-nio-8084-exec-127] null.null [beta: 0.00795] 09-Oct-2014 23:50:24.657 INFO [http-nio-8084-exec-127] null.null <60> LL/token: -8.6299 09-Oct-2014 23:50:24.957 INFO [http-nio-8084-exec-127] cc.mallet.topics.ParallelTopicModel.estimate <70> LL/token: -8.61982 09-Oct-2014 23:50:25.019 INFO [http-nio-8084-exec-127] null.null [beta: 0.00583] 09-Oct-2014 23:50:25.263 INFO [http-nio-8084-exec-127] cc.mallet.topics.ParallelTopicModel.estimate <80> LL/token: -8.89656 09-Oct-2014 23:50:25.402 INFO [http-nio-8084-exec-127] null.null [beta: 0.00484] java.lang.ArrayIndexOutOfBoundsException: -1 at cc.mallet.topics.WorkerRunnable.sampleTopicsForOneDoc(WorkerRunnable.java:489) at cc.mallet.topics.WorkerRunnable.run(WorkerRunnable.java:275) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) java.lang.ArrayIndexOutOfBoundsException: -1 at cc.mallet.topics.WorkerRunnable.sampleTopicsForOneDoc(WorkerRunnable.java:489) at cc.mallet.topics.WorkerRunnable.run(WorkerRunnable.java:275) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) My code look like: try{ //call some function from library } catch(Exception e){ Syste…
favorite count: 0
has comment: http://stackoverflow.com/comment/41249631
has comment: http://stackoverflow.com/comment/41247927

http://stackoverflow.com/a/26263538
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26243536
answers question: http://stackoverflow.com/q/26243536
score: 0
has body: I found a good example of what I was looking for. Compliments of "Cave of Programming" source: https://www.youtube.com/watch?v=TBAKKulJTJ4 Here's the code. public interface Animal { public void speak(); } public class Dog implements Animal { @Override public void speak() { System.out.println("Woof!"); } } public class Cat implements Animal { @Override public void speak() { System.out.println("Meow!"); } } public abstract class AnimalFactory { public static final int CAT = 0; public static final int DOG = 1; public static Animal createAnimal(int type){ switch(type){ case CAT: return new Cat(); case DOG: return new Dog(); } return null; } } public class App { public static void main(String[] args) { Animal animal = AnimalFactory.createAnimal(AnimalFactory.CAT); animal.speak(); } }

http://stackoverflow.com/comment/41313591
type: Comment
type: QuestionComment
has text: I am somewhat interested in Genetic Programming, thanks, but that is a separate topic. In this question I try to focus on just the facilities for self-modification in Java. Evolution of computer programs is another usage scenario for self-modification.
comment on: http://stackoverflow.com/q/26324421
score: 0

http://stackoverflow.com/comment/41127375
type: Comment
type: QuestionComment
has text: Why are you using a for-loop instead of `input.hasNext()`?
score: 2
comment on: http://stackoverflow.com/q/26222842

http://stackoverflow.com/a/26286936
type: Answer
has body: You are calling "initcomponent" first and then initializing "otherPerson" class member. Do it like this: public ChatWindow(int id) { userID = id; otherPerson = userID.toString(); initComponents(); this.setVisible(true); }
score: 0
answers question: http://stackoverflow.com/q/26286698

http://stackoverflow.com/a/26202577
score: 1
has comment: http://stackoverflow.com/comment/41088956
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41094047
has body: You could call the main method of classA .i.e. ClassA.main(somestrArray) and it should do the initialization. But if you don't want to do that then you could create your junit test in the same package as the original class and you would be able to access the protected variables .i.e. ClassA.field1 =1; etc. Btw it does not have to be in the same project, just the package names should be the same. If thats not OK, then you would need to refactor your ClassA to allow for this scenario .i.e. have a method that does the init etc.
accepted answer of: http://stackoverflow.com/q/26201432
upvote count: 1
answers question: http://stackoverflow.com/q/26201432

http://stackoverflow.com/comment/41161971
has text: a static method can return the same as not static methods. you can quickly test yourself, instead of creating a account and posting a question here...
score: 0
comment on: http://stackoverflow.com/q/26241596
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41223253
type: AnswerComment
score: 0
has text: Ah, `i` was incremented after the value was written, but before the values was printed. Moved `i++` further down. Now it works.
type: Comment
comment on: http://stackoverflow.com/a/26273461

http://stackoverflow.com/q/26209122
tagged with: string
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26209191
possible better answer: http://stackoverflow.com/a/26209507
has body: I need to read lines of text from a file that i have prompted from the user. My java program is supposed to read the first line of this file and check to see if the last word of that line appears anywhere in the second line. without using repetition, arrays, or class construction I have come up with this so far: Scanner keyboard = new Scanner(System.in); System.out.println("Enter filename: "); File userFile = new File(keyboard.nextLine()); keyboard.close(); Scanner input = new Scanner(userFile); String firstLine = input.nextLine(); String secondLine = input.nextLine(); After here I have tried a lot of String methods but nothing is giving me back a satisfying result. I know I will need to finish my program with an if and else statement about whether or not the second line contains the last word in the first line. **Having trouble finding a way to compare substrings (words within a line of text) that I do not actually know the location of or what the chars are. This is due to the fact that all the input is user generated. Is there even a way to compare substrings while retaining the actual chars and not converting to ints?? **UPDATE I AM ECSTATIC this is how I have solved this frustrating problem: Scanner keyboard = new Scanner(System.in); System.out.println("Enter filename: "); File userFile = new File(keyboard.nextLine()); keyboard.close(); Scanner input = new Scanner(userFile); String firstLine = input.nextLine(); String secondLine = input.nextLine(); int lastWordIndex; lastWordIndex = ((firstLine.lastIndexOf(" ")) + 1); String lastWord = firstLine.substring(lastWordIndex); if (secondLine.contains(lastWord)) System.out.println("It is true the word " + lastWord + " appears in the text: " + secondLine); else System.out.println("The word: " + lastWord + " does not appear in the text: " + secondLine);
has answer: http://stackoverflow.com/a/26209507
has comment: http://stackoverflow.com/comment/41101149
score: -1
tagged with: java
downvote count: 1
accepted answer: http://stackoverflow.com/a/26209191
has comment: http://stackoverflow.com/comment/41101317
has comment: http://stackoverflow.com/comment/41101665
has comment: http://stackoverflow.com/comment/41101170
has title: Comparing lines of text based on words inside the lines Java
has comment: http://stackoverflow.com/comment/41101221
answer count: 2
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41101394

http://stackoverflow.com/comment/41363994
has text: Oh, for some reason it prints 1100100 now... I have no idea how that happened.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26351275
type: Comment

http://stackoverflow.com/comment/41134094
comment on: http://stackoverflow.com/a/26226468
score: 0
type: Comment
has text: Interviewer did not give any context, I should had probably asked... but your answer makes perfect sense. Thanks.
type: AnswerComment

http://stackoverflow.com/q/26236729
has comment: http://stackoverflow.com/comment/41152756
has comment: http://stackoverflow.com/comment/41153327
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41153953
has comment: http://stackoverflow.com/comment/41154968
answer count: 0
has body: I have an RoutingDataSource that use 2 databases. I want to make some of my quartz jobs to use one DB and other jobs the other DB. I use XML configurations in SPring4 with Hibnernate4. My quartz beans <entry key="batchProcessorName" value="emailJobProxy" /> Then After I bean a crontrigger, so no need to be shown here. Hibernate Interceptor: Routing DataSource: <entry key="READ" value-ref="secondaryDataSource"/> <entry key="READWRITE" value-ref="primaryDataSource"/> Possible?
type: UnansweredQuestion
has title: RoutingDataSource with quartz job
upvote count: 1
has comment: http://stackoverflow.com/comment/41158112
has comment: http://stackoverflow.com/comment/41157381
score: 1
tagged with: java
tagged with: hibernate
tagged with: quartz-scheduler
type: Question
has comment: http://stackoverflow.com/comment/97834883
has comment: http://stackoverflow.com/comment/41153785

http://stackoverflow.com/a/26321274
accepted answer of: http://stackoverflow.com/q/26320821
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26320821
has body: I dont know if it is the best solution, but i figured it out (hobbs the line thing helped a lot, thank you). I found that this works: public static void main(String[] args) throws FileNotFoundException { Scanner s = new Scanner(new FileReader("C:/Users/Sean/workspace/Imbored/bin/113809of.fic")); while(true) { words.clear(); String letters = enterLetters(); words.addAll(Words(letters)); while(s.hasNextLine()) { String line = s.nextLine(); String finalword = checkWords(line, words); if (finalword != null) finalwordset.add(finalword); } s.reset(); System.out.println(finalwordset); System.out.println(); System.out.println("_________________________________________________________________________"); } } A few things: The checkWords method checks if the current word from the file is in the generated list of "words" The enterletters method takes user inputted letters and returns them in a string The Words method returns a set of strings of all of the possible combinations of the characters in the given string, with each character used up to as many times as it appears in the string and no repeated "words" in the returned set. finalwordset and words are arraylists of strings defined as instance variables(i would put them in the main method but I'm lazy and it doesn't matter for this case) I am very sure there is a better/more efficient way to do this, but this at least works. Finally: I decided to answer rather than delete because I didn't see this answered anywhere else, so if it is feel free to delete the question or link to the other answer or whatever, at this point it is to help other people.

http://stackoverflow.com/q/26317425
tagged with: restfb
type: Question
has answer: http://stackoverflow.com/a/27593260
answer count: 2
downvote count: 0
tagged with: facebook-graph-api
favorite count: 0
has body: I've recently started working on manual login flow of facebook. And followed this blog to get the access token and using restfb to access user information. Below is the code snippet as mentioned - Fetching Single Objects: FacebookClient facebookClient = new DefaultFacebookClient(ACCESS_TOKEN, APP_SECRET); User user = facebookClient.fetchObject("me", User.class); I'm successfully able to get the user's name, first name and last name but it returns null for email (user.getEmail();). My facebook app has default permissions as: Anyone help me how can I access the user email? UPDATE I've been trying the graph-api explorer to see what I'm getting for email and it says Field is empty or disallowed by the access token. What do I'm supposed to do to fix this?
possible better answer: http://stackoverflow.com/a/27593260
tagged with: facebook
has answer: http://stackoverflow.com/a/26319220
accepted answer: http://stackoverflow.com/a/26319220
score: 2
has title: getting null for user email - restfb
type: AnsweredQuestion
upvote count: 2
tagged with: java

casting
tags question: http://stackoverflow.com/q/26242674
tags question: http://stackoverflow.com/q/26258751
tags question: http://stackoverflow.com/q/26335959
tags question: http://stackoverflow.com/q/26247049
tag name: casting
type: Tag
tags question: http://stackoverflow.com/q/26263048
tags question: http://stackoverflow.com/q/26238637
tags question: http://stackoverflow.com/q/26277373
tags question: http://stackoverflow.com/q/26248948
tags question: http://stackoverflow.com/q/26254464
tags question: http://stackoverflow.com/q/26209405
tags question: http://stackoverflow.com/q/26347801
tags question: http://stackoverflow.com/q/26290647
tags question: http://stackoverflow.com/q/26344218

http://stackoverflow.com/q/26258999
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41202378
tagged with: jersey
has answer: http://stackoverflow.com/a/26264017
has title: How to exclude unwanted packages like mail and ws from from javaee-api-7?
has comment: http://stackoverflow.com/comment/41193254
answer count: 1
tagged with: persistence
favorite count: 0
has body: I have a project that requires only persistence module or persistence package of javaee api 7.jar. I want to exclude all those packages and mange this via my pom.xml as it a maven based project ? How can I achieve that ? What will my pom.xml look like ?
upvote count: 2
type: UnansweredQuestion
tagged with: tomcat7
score: 1

http://stackoverflow.com/q/26198016
has title: Unable to start activity ComponentInfo: Binary XML file line #6: Error inflating class fragment
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: android-fragments
score: 1
tagged with: java
type: Question
tagged with: google-maps
has answer: http://stackoverflow.com/a/26210532
has body: Trying to get into a new activity that has Google Maps integrated to it, I get an error from the title. The said activity class: package com.ict.edu.rs.imenik; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import android.app.AlertDialog; import android.content.DialogInterface; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; public class MapViewActivity extends FragmentActivity implements OnMapLongClickListener { private GoogleMap googleMap; private String lat, lng; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_view); if (googleMap == null) { googleMap = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); if (googleMap == null) { Toast.makeText(getApplicationContext(), "Mapa nije kreirana!", Toast.LENGTH_SHORT).show(); } } googleMap.getUiSettings().setMyLocationButtonEnabled(true); googleMap.setMyLocationEnabled(true); googleMap.setOnMapLongClickListener(this); } @Override public void onMapLongClick(final LatLng arg0) { AlertDialog.Builder builder = new AlertDialog.Builder( MapViewActivity.this); builder.setCancelable(true); builder.setTitle("Alert"); builder.setMessage("Sacuvaj lokaciju?"); builder.setInverseBackgroundForced(true); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { lat = "" + arg0.latitude; lng = "" + arg0.longitude; dialog.dismiss(); Intent returnIntent = new Intent(); returnIntent.putExtra("lat", lat); returnIntent.putExtra("lng", lng); setResult(RESULT_OK, returnIntent); finish(); } }); builder.setNegativeButton("No", new DialogInterface.OnClickListe…
has comment: http://stackoverflow.com/comment/41080872
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26226136
has comment: http://stackoverflow.com/comment/41133995
has title: JAVA - Help drawing on an extending canvas
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26226164
tagged with: extends
tagged with: swing
type: AnsweredQuestion
has body: So, i have a class called MainClass in which extends Canvas. I am trying to let's say draw a filled rectangle on the Canvas without Overriding the paint method. Is there a way to do that or i must override the paint method and put all i want to draw there? import java.awt.Canvas; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JFrame; public class MainClass extends Canvas { MainClass() { JFrame MainWindow = new JFrame("Main Window"); MainWindow.setVisible(true); MainWindow.setSize(500, 500); MainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); MainWindow.add(this); } public void paint(Graphics g) { super.paint(g); } public static void main(String[] args) { MainClass temp = new MainClass(); Graphics g = (Graphics2D)temp.getGraphics(); g.setColor(Color.red); g.fillRect(0, 0, 400, 400); temp.repaint(); } } The idea is that i have this class and i can get the graphic object of the canvas and draw on it directly and repaint. Or maybe i was thinking of passing shapes and objects into a method that will do the painting at certain position for me.
tagged with: paint
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41133411
has answer: http://stackoverflow.com/a/26226164
tagged with: canvas
downvote count: 0

http://stackoverflow.com/q/26227786
score: 1
has answer: http://stackoverflow.com/a/28324289
favorite count: 0
type: Question
tagged with: javafx
upvote count: 1
answer count: 1
has title: Loading URLs in javafx webview is crashing the JVM
tagged with: jvm-crash
has comment: http://stackoverflow.com/comment/43476863
tagged with: java
type: UnansweredQuestion
has body: I am loading some urls into javafx webview. I am doing a crawling operation here , using javafx webview and it's engine. However JVM is crashing frequently. I am unable to make out anything from the below crash log. Pls help. # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000076fe3290, pid=6164, tid=9896 # # JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode windows-amd64 ) # Problematic frame: # C [ntdll.dll+0x53290] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x000000000c74f800): JavaThread "JavaFX Application Thread" [_thread_in_native, id=9896, stack(0x000000000d4b0000,0x000000000d530000)] siginfo: ExceptionCode=0xc0000005, reading address 0x00000fd4c3c998c8 Registers: RAX=0x0000000000000000, RBX=0x00000fd4c3c998c0, RCX=0x000000ffffffffff, RDX=0x00000000179e0dd0 RSP=0x000000000d52c1c0, RBP=0x0000000000000000, RSI=0x0000000002290000, RDI=0x00000000179e0de0 R8 =0x00000000179e0de0, R9 =0x0000000000000000, R10=0x00000000000003e9, R11=0x0000000019054670 R12=0x000000000d52e150, R13=0x000000000d52c7a0, R14=0x000000000d52defc, R15=0x00000000198e8a24 RIP=0x0000000076fe3290, EFLAGS=0x0000000000010206 Top of Stack: (sp=0x000000000d52c1c0) 0x000000000d52c1c0: 000000000d52c780 000000000d52e150 0x000000000d52c1d0: 00000000000000a0 0000000000000000 0x000000000d52c1e0: 000000000d52c3a0 0000000073288d17 0x000000000d52c1f0: 0000000000000002 00000000000000a0 0x000000000d52c200: 00000000198e8a24 000000000d52defc 0x000000000d52c210: 000000000d52c7a0 000000000d52e150 0x00000…
downvote count: 0

http://stackoverflow.com/a/57186794
has body: You can use Jackson, the key is using ObjectMapper.readerForUpdating() and annotate the field with @JsonMerge (or all the missing fields in next objects will overwrite the old one): Maven: com.fasterxml.jackson.core jackson-databind 2.9.9 com.fasterxml.jackson.dataformat jackson-dataformat-yaml 2.9.9 Code: public class TestJackson { public static void main(String[] args) throws IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); MyConfig myConfig = new MyConfig(); ObjectReader objectReader = mapper.readerForUpdating(myConfig); objectReader.readValue(new File("misc/a.yaml")); objectReader.readValue(new File("misc/b.yaml")); System.out.println(myConfig); } @Data public static class MyConfig { @JsonMerge private Pool pool; } @Data public static class Pool { private Integer idleConnectionTestPeriodSeconds; private Integer idleMaxAgeInMinutes; private Integer partitionCount; private Integer acquireIncrement; private String username; private String password; } }
score: 11
has comment: http://stackoverflow.com/comment/100889677
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 11
accepted answer of: http://stackoverflow.com/q/26345179
answers question: http://stackoverflow.com/q/26345179

http://stackoverflow.com/comment/41106542
has text: i want to a row from databse tble but it is no working .after running the program console window shows messege "could not load JDBC driver"
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26210543

http://stackoverflow.com/comment/41263469
has text: What version of java an Cobertura are you using?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26296185
score: 0

http://stackoverflow.com/q/26324160
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26324311
accepted answer: http://stackoverflow.com/a/26324311
answer count: 1
has body: I am struggling with inserting a blob, using MySQL. I notice ORMLite creates the corresponding column with DataType BLOB, while I require a LONGBLOB, since I get an exception thrown telling me Data too long for column I annotate the column: @DatabaseField(dataType = DataType.BYTE_ARRAY) What options are left, besides running a rawQuery when creating the table?
tagged with: ormlite
has title: OrmLite DataType.BYTE_ARRAY Data too long for column
type: AnsweredQuestion

http://stackoverflow.com/q/26334397
tagged with: java
linked to: http://stackoverflow.com/q/19871955
has answer: http://stackoverflow.com/a/26334444
has answer: http://stackoverflow.com/a/26334849
has answer: http://stackoverflow.com/a/26334442
favorite count: 0
possible better answer: http://stackoverflow.com/a/26334409
has comment: http://stackoverflow.com/comment/41332705
accepted answer: http://stackoverflow.com/a/26334463
has comment: http://stackoverflow.com/comment/41332419
score: 0
has answer: http://stackoverflow.com/a/26334409
tagged with: file-io
answer count: 5
has comment: http://stackoverflow.com/comment/41332077
has body: This is a simple program to read from a text file, but somehow I am getting the following error when i run it Exception in thread "main" java.lang.NullPointerException Program: package testenglish; import java.util.*; import java.io.*; public class TestEnglish { public static void main(String[] args) { Scanner myscanner= null; try { myscanner = new Scanner(new File("file.txt")); } catch (FileNotFoundException e) { } while (myscanner.hasNextLine()) { } myscanner.close(); } } I don't understand why I am getting a NullPointerException when myscanner has already been initialized. EDIT: How come I am not reading the text file? It is placed in the same folder as the source code.
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41332063
has answer: http://stackoverflow.com/a/26334463
has title: NullPointerException during File IO

http://stackoverflow.com/a/26334366
score: 3
answers question: http://stackoverflow.com/q/26334189
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26334189
upvote count: 3
type: Answer
downvote count: 0
has body: You can use Caused by: or WARNING: as your delimiters Code: String value ="Caused by:null pointer exception Caused by" + ": BeanCreationException.. WARNING: its just a warning.."; String[] sp = value.split("Caused by:|WARNING:"); Stream.of(sp).forEach(s -&gt; System.out.println(s)); Output: null pointer exception BeanCreationException.. its just a warning.. Note: some part of code is in Java 8

http://stackoverflow.com/comment/41352562
type: Comment
comment on: http://stackoverflow.com/a/26330436
type: AnswerComment
has text: No, it IS my fault if the local culture says it is. The trick is changing the culture. I have to convince the entire team it's bad because they all do it, I'm sure.
score: 0

http://stackoverflow.com/comment/41339287
comment on: http://stackoverflow.com/q/26337906
score: 0
has text: @MarkoTopolnik That seems to be the most logical solution, I guess the context confused me and I didn't know if I was missing something. Thank you!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26205641
tagged with: dictionary
type: UnansweredQuestion
has body: My idea is to generate keys and values inside of a map, but I'm unsure as to what type of map I should use. This would be my very first time ever using a map, and I've heard that HashMaps aren't too good for keeping a set of values to that specific key. So, here's what I want to accomplish. I want a map with they key "X,Y", where x and y are between 1 and 8, with the values being an arrayList of "X-1,Y-2","X-1,Y+2","X+1,Y-2","X+1,Y+2", etc. I've never done maps, so I suppose I lack a general concept of mapping, so I would like to know if this would actually be possible, and if so, could someone give me an example to base my code off of. It's for a project that's due very soon that I waited until now to start, even though I had two weeks to do it, so I'm hoping for a quick answer. Thanks in advance. Example of what I want: Key -> "5,5" : Values -> ["4,7", "4,3", "6,7", "6, 3", "7,4", "7,6", "3,4", "3,6"] On a side note, my goal is to have each value actually resemble a key in the map, so it will be easy to use one of the values to use another key with the same name. I.E "4,7" leads to Key -> "4,7" which if impossible with mapping I can simulate outside of it with code.
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26205661
score: 0
has title: Generating values and keys to fill a map, and which type of map should I use

http://stackoverflow.com/comment/41086169
has text: Do you import `android.app.Fragment` or `android.support.v4.app.Fragment`?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26200529
type: QuestionComment

http://stackoverflow.com/a/26303095
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26212104
has body: You can implement an ExceptionMapper for every application exception you need. @Provider public class MyApplicationExceptionMapper implements ExceptionMapper&lt;MyApplicationException&gt; { // ... } For more information see https://jersey.java.net/nonav/documentation/latest/user-guide.html#d0e5206

http://stackoverflow.com/comment/41126561
type: AnswerComment
comment on: http://stackoverflow.com/a/26222120
has text: yes it is annoying. And I think eclipse remembers your configuration for that main class. So if you want to later rerun that main method *without* visualVM, you have to go back and change the configuration again back to JDT.
score: 0
type: Comment

http://stackoverflow.com/q/26240424
has body: I have an existing Project working fine, but now I have to implement a Backup System that is executed exery day and dumps the Database to a File. I want to solve this using a ScheduledTask, but this means that there is another Thread using Hibernate. My Question: How exactly can I make Hibernate Thread safe? I have the following code-(snippets): In applicationContext.xml validate org.hibernate.dialect.SQLServer2008Dialect <tx:annotation-driven transaction-manager="txManager" /> So I can get the EntityManager by @PersistenceContext protected EntityManager entityManager; But if i understood it correctly, every Thread needs its own EntityManager from the EntityManagerFactory. How can I create a new EntityManager in an other class? I have no persistence.xml. Do I have to create it?
tagged with: sql
score: 3
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41180620
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41163872
tagged with: spring
has answer: http://stackoverflow.com/a/26240981
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question
tagged with: thread-safety
has title: Spring and Hibernate: Multiple connections, thread safe

http://stackoverflow.com/comment/41186671
comment on: http://stackoverflow.com/q/26255313
has text: It's not a bug, it's a feature. So you can be sure not to be unpleasantly suprised, when a query cannot be generated on runtime; and it saves time **after** the server has come up...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26204891
answers question: http://stackoverflow.com/q/26204684
upvote count: 1
type: AcceptedAnswer
has body: You can evaluate the XPath on a Document to get the NodeList of the articles and than write the NodeList as xml. public class Main { public static void main(String[] args) throws Exception { File xmlDocument = new File("e://journal_last.xml"); FileInputStream xmlInputStream = new FileInputStream(xmlDocument); Document doc = parseDocument(new InputSource(xmlInputStream)); NodeList articleList = evaluateXPath(doc, "/journal/articleset", NodeList.class); String xmlString = writeXmlString(articleList); System.out.println(xmlString); } private static Document parseDocument(InputSource inputSource) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = documentBuilderFactory .newDocumentBuilder(); Document doc = docBuilder.parse(inputSource); return doc; } @SuppressWarnings("unchecked") private static &lt;T&gt; T evaluateXPath(Document doc, String xpath, Class&lt;T&gt; resultType) throws XPathExpressionException { QName returnType = resolveReturnType(resultType); XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); XPathExpression xpathExpression = xPath.compile(xpath); Object resultObject = xpathExpression.evaluate(doc, returnType); return (T) resultObject; } private static QName resolveReturnType(Class&lt;?&gt; clazz) { if (NodeList.class.equals(clazz)) { return XPathConstants.NODESET; } else { throw new UnsupportedOperationException("Not implemented yet"); } } private static String writeXmlString(NodeList nodeList) throws TransformerConfigurationException, TransformerFactoryConfigurationError, TransformerException { StreamResult streamResult = new StreamResult(new StringWriter()); TransformerFactory transformerFactory = TransformerFactory .newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); for (int i = 0; i &lt; nodeList.getLength(…
has comment: http://stackoverflow.com/comment/41093590
type: Answer
accepted answer of: http://stackoverflow.com/q/26204684
downvote count: 0
score: 1

http://stackoverflow.com/a/26263784
accepted answer of: http://stackoverflow.com/q/26262825
has body: It looks like you've pasted everything from the terminal running Emacs into the Xcode editor, including the status bar Emacs prints at the bottom (which is not part of your code). Delete everything from -uuu to the end of the file. In the future, save the file in Emacs (e.g. on a flash drive or online storage) and open it up in Xcode (or whatever editor you choose), rather than copying and pasting. That will cut down on errors like this; and besides, you might have a program longer than one screen some day. I should add, in case you're interested, that Emacs works fine on Macs too. There's actually a version of it included in OS X, although it's pretty old; for the current version, there are a few options to choose from, of which the most popular seem to be Emacs For OS X and Aquamacs. The main difference is that Aquamacs acts a little more like a Mac app in its handling of keyboard shortcuts and things like that; but the standard one also includes nice Command key shortcuts for a lot of things.
answers question: http://stackoverflow.com/q/26262825
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/26229977
has comment: http://stackoverflow.com/comment/41140979
tagged with: oop
tagged with: java
has title: I don't understand why my line is going at an angle
upvote count: 1
has answer: http://stackoverflow.com/a/26231189
downvote count: 1
type: Question
has body: I am in this AP class in highschool and we are using the program JAVA or OOP, I don't even know what it is. In the class we don't have a teacher so we basically have to self teach our self from a packet. I am learning how to draw a face and i am kind off struggling. Well first off, the prompt here- http://mrlanda.com/ecs/unit%205/Happy%20Face.htm Look at the picture below to see how it looks like. MY QUESTION-- Well here is what i got so far and it is stressing me out so much, I DON'T KNOW WHY BUT MY LINE KEEPS GOING IN AN ANGLE. Why does it go in an angle when I am not telling it too.. I am also having a problem with the nose i can't seem to find the spot i want to put it at it keeps going into an angle for some reason. My code so far import apcslib.*; public class DrawSquare { public static void main(String[] args) { DrawingTool marker; SketchPad poster; poster= new SketchPad(600,600); marker= new DrawingTool(poster); //left side of box marker.up(); marker.move(0,0); marker.down(); marker.turnRight(180); marker.forward(200); //mouth marker.up(); marker.move(40,60); marker.down(); marker.turnRight(90); marker.forward(100); //nose marker.up(); marker.move(100,100); marker.down(); marker.turnRight(90); marker.forward(100); } }
score: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41141448

http://stackoverflow.com/q/26234792
has answer: http://stackoverflow.com/a/44676832
answer count: 3
has body: Now I am developing a simple project on Java.In that I include String Builder to append and print strings on console.When I am trying to append string array into string Builder,it prints object instead of array of strings on console.any one please tell whether my try is right or wrong.
tagged with: arrays
downvote count: 0
tagged with: string
favorite count: 0
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/26234953
has title: can we add String array into StringBuffer or StringBuilder in java?
has comment: http://stackoverflow.com/comment/41148823
type: Question
possible better answer: http://stackoverflow.com/a/26234816
type: AnsweredQuestion
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/26234816
tagged with: java
tagged with: stringbuffer
has comment: http://stackoverflow.com/comment/41148770
accepted answer: http://stackoverflow.com/a/26234953

http://stackoverflow.com/comment/41297325
has text: Yep, that's the closest you're going to get on 9.0. Time to upgrade.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26304851

http://stackoverflow.com/comment/41210077
score: 0
has text: If it's not a `Map`, array or `Collection`, you should use `constructParametricType`
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26264459

http://stackoverflow.com/q/26321180
upvote count: 1
has comment: http://stackoverflow.com/comment/41307732
has comment: http://stackoverflow.com/comment/41308576
has comment: http://stackoverflow.com/comment/41322846
favorite count: 0
has comment: http://stackoverflow.com/comment/41307851
type: UnansweredQuestion
tagged with: encryption
answer count: 0
downvote count: 0
has body: I'm working on converting a Caesar shift code I found online to suit my needs, adding different functionality and whatnot. The only help I'd like to ask for is getting the code to work through the console directly from the user instead of opening up a file, via Scanner rather than InputStream. I tried modifying the code on my own but the only luck I have had so far is that it compiles and outputs: Usage: java Caesar (-d | -e) key but it doesn't let the user enter anything. I posted the original code below. Any suggestions or tips would be greatly appreciated. import java.io.*; public class ShiftCipher { private Reader in; // standard input stream for message private int key; // (en|de)cryption key // Caesar: constructor, opens standard input, passes key public ShiftCipher(int k) { // open file in = new InputStreamReader(System.in); key = k; } // (en|de)crypt: just feed in opposite parameters public void encrypt() { translate(key); } public void decrypt() { translate(-key); } // translate: input message, translate private void translate(int k) { char c; while ((byte) (c = getNextChar()) != -1) { if (Character.isLowerCase(c)) { c = rotate(c, k); } System.out.print(c); } } // getNextChar: fetches next char. public char getNextChar() { char ch = ' '; // = ’ ’ to keep compiler happy try { ch = (char) in.read(); } catch (IOException e) { System.out.println("Exception reading character"); } return ch; } // rotate: translate using rotation, version with table lookup public char rotate(char c, int key) { // c must be lowercase String s = "abcdefghijklmnopqrstuvwxyz"; int i = 0; while (i &lt; 26) { // extra +26 below because key might be negative if (c == s.charAt(i)) return s.charAt((i + key + 26) % 26); i++; } return c; } // main: check command, (en|de)crypt, feed in key value public static void main(String[] args) { if (args.length != 2) { System.out.println("Usage: java Caesar (-d | -e) key"); System.exit(1); } ShiftCipher cipher = new ShiftCipher(Integer.parseInt(args[1]…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41324335
type: Question
has comment: http://stackoverflow.com/comment/41324676
has title: Caesar cipher code modification

http://stackoverflow.com/comment/127782497
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26303467
score: 0
has text: Java documentation actually provides a very good general explanation: https://docs.oracle.com/javase/tutorial/extra/generics/subtype.html

http://stackoverflow.com/q/26210456
has comment: http://stackoverflow.com/comment/41104512
has comment: http://stackoverflow.com/comment/41104082
downvote count: 5
has comment: http://stackoverflow.com/comment/41103748
has body: import java.sql.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; class DeleteDemo extends Frame implements ActionListener { Label l1; Button b1; TextField t1; DeleteDemo() { setVisible(true); setSize(400,400); l1=new Label("Enter Id"); b1=new Button("Delete"); t1=new TextField(20); setLayout(new FlowLayout()); add(l1);add(t1); add(b1); b1.addActionListener(this); } public void actionPerformed(ActionEvent e) { if(e.getSource()==b1) { try { System.out.println("Data try to delete"); String id=t1.getText(); l1.setText("hi"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("Jdbc:Odbc:xyz","",""); Statement st=con.createStatement(); st.executeUpdate("delete from tblEmp where id ='"+id+"' "); System.out.println("Data has been deleted"); }catch(SQLException eb){} } } public static void main(String args[ ]) { DeleteDemo dtl=new DeleteDemo(); } }
answer count: 1
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has title: unreported exception ClassNotFoundException ;must be catch or thrown class.forName(sun.jdbc.odbc.JdbcOdbcDriver)
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/41103707
type: Question
has answer: http://stackoverflow.com/a/26210543

http://stackoverflow.com/comment/41328711
has text: just added it in an edit!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26331232
score: 0

http://stackoverflow.com/a/26222877
score: 1
upvote count: 1
type: AcceptedAnswer
has body: This fixed my problem: File target = new File(System.getProperty("user.dir")+"/images",file.getName());
type: Answer
answers question: http://stackoverflow.com/q/26222686
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26222686

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/26334771
tags question: http://stackoverflow.com/q/26255658
tags question: http://stackoverflow.com/q/26208370
tags question: http://stackoverflow.com/q/26243183
tags question: http://stackoverflow.com/q/26236045
tags question: http://stackoverflow.com/q/26205915
tags question: http://stackoverflow.com/q/26253651
tags question: http://stackoverflow.com/q/26353574
tags question: http://stackoverflow.com/q/26320650
tags question: http://stackoverflow.com/q/26240668
tags question: http://stackoverflow.com/q/26327964
tags question: http://stackoverflow.com/q/26222205
tags question: http://stackoverflow.com/q/26314220
type: Tag
tags question: http://stackoverflow.com/q/26345283
tags question: http://stackoverflow.com/q/26273223
tags question: http://stackoverflow.com/q/26267627
tags question: http://stackoverflow.com/q/26296798
tags question: http://stackoverflow.com/q/26307572
tags question: http://stackoverflow.com/q/26342786
tags question: http://stackoverflow.com/q/26237774
tags question: http://stackoverflow.com/q/26199340
tags question: http://stackoverflow.com/q/26344696
tags question: http://stackoverflow.com/q/26201830
tags question: http://stackoverflow.com/q/26279284
tags question: http://stackoverflow.com/q/26291881
tags question: http://stackoverflow.com/q/26303845
tags question: http://stackoverflow.com/q/26238427
tags question: http://stackoverflow.com/q/26327827
tags question: http://stackoverflow.com/q/26287568
tags question: http://stackoverflow.com/q/26274531
tags question: http://stackoverflow.com/q/26201387
tags question: http://stackoverflow.com/q/26260533
tags question: http://stackoverflow.com/q/26222948
tags question: http://stackoverflow.com/q/26348917
tags question: http://stackoverflow.com/q/26202052
tags question: http://stackoverflow.com/q/26307139
tags question: http://stackoverflow.com/q/26302134
tags question: http://stackoverflow.com/q/26336204
tag name: html
tags question: http://stackoverflow.com/q/26261024
tags question: http://stackoverflow.com/q/26332686
tags question: http://stackoverflow.com/q/26286432

http://stackoverflow.com/a/26294463
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: You can use Hibernate UserTypes. https://docs.jboss.org/hibernate/orm/3.6/javadocs/org/hibernate/usertype/UserType.html
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26294318
answers question: http://stackoverflow.com/q/26294318

http://stackoverflow.com/comment/41276925
comment on: http://stackoverflow.com/a/26303901
score: 0
type: AnswerComment
has text: sorry again , but how would i then add hidden field counter and execute the code after a certain number of submissions ?
type: Comment

http://stackoverflow.com/comment/41083529
comment on: http://stackoverflow.com/q/26199171
type: QuestionComment
has text: @Rajeev:No difference. The same errors.
score: 0
type: Comment

http://stackoverflow.com/q/26219032
favorite count: 0
tagged with: sockets
tagged with: port
tagged with: socketexception
accepted answer: http://stackoverflow.com/a/26219566
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41258433
upvote count: 1
tagged with: socket.io
type: Question
has title: How port can close when Im close the program
has body: I dont want to change port number , but I receive an exception "Exception in thread "main" java.net.BindException: Address already in use: JVM_Bind" ServerSocket server = new ServerSocket(1234, 180);
has answer: http://stackoverflow.com/a/26219566
has comment: http://stackoverflow.com/comment/41119700
answer count: 1
downvote count: 0

http://stackoverflow.com/a/26236313
downvote count: 0
has comment: http://stackoverflow.com/comment/41153583
answers question: http://stackoverflow.com/q/26236108
type: Answer
score: 1
has body: On popping of a non-empty stack top might become -1 (for "empty stack"). So private int top = -1; public boolean stackIsEmpty() { return top &lt; 0; // != -1 } Do the field initialisation in your constructor. Before that maxlength is not initialized, and 0. Furthermore you do not need maxlength as field. stack.length == maxlength. public Object[] stack; public ArrayStackImpl(int maxLength) { stack = new Object[maxLength]; (I used the more conventional notation Object[].)
upvote count: 1
has comment: http://stackoverflow.com/comment/41151999
accepted answer of: http://stackoverflow.com/q/26236108
has comment: http://stackoverflow.com/comment/41153792
type: AcceptedAnswer

http://stackoverflow.com/comment/41298745
type: QuestionComment
has text: I added xml file of Listview.
comment on: http://stackoverflow.com/q/26315922
score: 0
type: Comment

http://stackoverflow.com/q/26256558
has answer: http://stackoverflow.com/a/26257038
type: Question
has body: I'm using a library that calls the JNI_CreateJavaVM function inside the library code. However, I also need some JNI Wrappings and I need to call the same function JNI_CreateJavaVM to get the JNIEnv* to my application. But the second call is failing. is there any way to do this? The library does not support getting or setting the JNIEnv* created inside the library.
tagged with: java-native-interface
tagged with: http://stackoverflow.com/tag/c
accepted answer: http://stackoverflow.com/a/26257038
score: 3
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41189512
has title: Calling JNI_CreateJavaVM function twice
tagged with: c++
type: AnsweredQuestion
upvote count: 3
tagged with: java

pack
tags question: http://stackoverflow.com/q/26208723
type: Tag
tag name: pack
tags question: http://stackoverflow.com/q/26308211

http://stackoverflow.com/comment/41135809
type: AnswerComment
has text: I have been trying to use Mask Formatter for my jFormatterTextField. MaskFormatter mf=new MaskFormatter("????????????????????"); I want to limit my textfield to accept 20 characters (no numeric and no special). However if I am trying to enter less than 20 characters the text from text field is getting blank. And blank spaces are being inserted. It does accept only 20 characters. How should I modify my mask?
type: Comment
comment on: http://stackoverflow.com/a/26227205
score: 0

http://stackoverflow.com/comment/41354228
type: Comment
score: 0
has text: Yes, as I previously stated, I was debugging, however your criticism hardly solves my issue.
comment on: http://stackoverflow.com/q/26329901
type: QuestionComment

http://stackoverflow.com/q/26290831
has title: fix Intellij dependancies
type: Question
tagged with: jersey
tagged with: intellij-idea
has body: I have an application that tests a REST api using TestNG as a driver. We use Gradle as a build tool. When I run the test from the command line, the code compiles and runs just fine. When I try to run the code in Intellij (because, I occasionally like debugging code) I get the follow error: java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder; I know the problem is that for some reason IntelliJ has decided I need 1.17.1 of Jersey instead of 2.11. When I look at the project structure, there is no indication of 1.17.1 as far as I can tell.
has comment: http://stackoverflow.com/comment/41274308
has comment: http://stackoverflow.com/comment/41258539
tagged with: dependencies
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/41308811
comment on: http://stackoverflow.com/a/26321725
type: Comment
has text: @dramzy I agree, but I prefer to present the minimal solution to the problem at hand, since that's a clearer answer. Discussions of best practice distract from the questioner's current concern. (there are other sites, like dreamincode.net, for that)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41273476
type: QuestionComment
comment on: http://stackoverflow.com/q/26302471
score: 1
has text: Create public getters/setters?
type: Comment

http://stackoverflow.com/comment/41327239
type: QuestionComment
comment on: http://stackoverflow.com/q/26331724
has text: John Smith has you covered there. You're doing an O(n) linear run with a branch on `if (A[i] > 0)`. When that happens you enter a branch that will break your loop, while running through "the rest of your list". This code is O(n) worst case, best case, and average case.
score: 0
type: Comment

datasource
tags question: http://stackoverflow.com/q/26352391
type: Tag
tag name: datasource
tags question: http://stackoverflow.com/q/26335921

lambda
tags question: http://stackoverflow.com/q/26304858
tags question: http://stackoverflow.com/q/26285000
tags question: http://stackoverflow.com/q/26258787
tags question: http://stackoverflow.com/q/26340688
tags question: http://stackoverflow.com/q/26288818
tag name: lambda
tags question: http://stackoverflow.com/q/26205409
tags question: http://stackoverflow.com/q/26301918
tags question: http://stackoverflow.com/q/26258412
tags question: http://stackoverflow.com/q/26322502
type: Tag
tags question: http://stackoverflow.com/q/26273003
tags question: http://stackoverflow.com/q/26203943
tags question: http://stackoverflow.com/q/26257266
tags question: http://stackoverflow.com/q/26252672
tags question: http://stackoverflow.com/q/26299556

sitemap
type: Tag
tag name: sitemap
tags question: http://stackoverflow.com/q/26227881

maven
tags question: http://stackoverflow.com/q/26219788
tags question: http://stackoverflow.com/q/26305732
tags question: http://stackoverflow.com/q/26345371
tags question: http://stackoverflow.com/q/26233077
tags question: http://stackoverflow.com/q/26296579
tags question: http://stackoverflow.com/q/26293919
tags question: http://stackoverflow.com/q/26282450
tags question: http://stackoverflow.com/q/26228488
tags question: http://stackoverflow.com/q/26212744
type: Tag
tags question: http://stackoverflow.com/q/26216967
tags question: http://stackoverflow.com/q/26276481
tags question: http://stackoverflow.com/q/26278815
tags question: http://stackoverflow.com/q/26233776
tags question: http://stackoverflow.com/q/26218366
tags question: http://stackoverflow.com/q/26238771
tags question: http://stackoverflow.com/q/26289493
tags question: http://stackoverflow.com/q/26211047
tags question: http://stackoverflow.com/q/26225836
tags question: http://stackoverflow.com/q/26227047
tags question: http://stackoverflow.com/q/26330234
tags question: http://stackoverflow.com/q/26278856
tags question: http://stackoverflow.com/q/26296349
tags question: http://stackoverflow.com/q/26213254
tags question: http://stackoverflow.com/q/26198788
tags question: http://stackoverflow.com/q/26330519
tags question: http://stackoverflow.com/q/26349636
tags question: http://stackoverflow.com/q/26218052
tags question: http://stackoverflow.com/q/26264947
tags question: http://stackoverflow.com/q/26329188
tags question: http://stackoverflow.com/q/26318451
tags question: http://stackoverflow.com/q/26238505
tags question: http://stackoverflow.com/q/26282832
tags question: http://stackoverflow.com/q/26345505
tags question: http://stackoverflow.com/q/26241323
tags question: http://stackoverflow.com/q/26218400
tags question: http://stackoverflow.com/q/26346698
tags question: http://stackoverflow.com/q/26232946
tags question: http://stackoverflow.com/q/26281322
tags question: http://stackoverflow.com/q/26204255
tags question: http://stackoverflow.com/q/26344925
tags question: http://stackoverflow.com/q/26336676
tags question: http://stackoverflow.com/q/26212553
tags question: http://stackoverflow.com/q/26250238
tags question: http://stackoverflow.com/q/26211220
tags question: http://stackoverflow.com/q/26329901
tags question: http://stackoverflow.com/q/26317973
tags question: http://stackoverflow.com/q/26304148
tags question: http://stackoverflow.com/q/26326654
tags question: http://stackoverflow.com/q/26295306
tags question: http://stackoverflow.com/q/26197840
tags question: http://stackoverflow.com/q/26214492
tags question: http://stackoverflow.com/q/26353519
tags question: http://stackoverflow.com/q/26210109
tags question: http://stackoverflow.com/q/26274407
tags question: http://stackoverflow.com/q/26208726
tags question: http://stackoverflow.com/q/26315936
tags question: http://stackoverflow.com/q/26317072
tags question: http://stackoverflow.com/q/26202578
tags question: http://stackoverflow.com/q/26343509
tags question: http://stackoverflow.com/q/26349911
tags question: http://stackoverflow.com/q/26237564
tags question: http://stackoverflow.com/q/26249986
tags question: http://stackoverflow.com/q/26334512
tags question: http://stackoverflow.com/q/26339005
tags question: http://stackoverflow.com/q/26195252
tags question: http://stackoverflow.com/q/26313902
tags question: http://stackoverflow.com/q/26282499
tags question: http://stackoverflow.com/q/26326231
tags question: http://stackoverflow.com/q/26232622
tags question: http://stackoverflow.com/q/26258715
tags question: http://stackoverflow.com/q/26341346
tags question: http://stackoverflow.com/q/26280291
tags question: http://stackoverflow.com/q/26269427
tags question: http://stackoverflow.com/q/26224537
tags question: http://stackoverflow.com/q/26253926
tags question: http://stackoverflow.com/q/26286638
tags question: http://stackoverflow.com/q/26259870
tags question: http://stackoverflow.com/q/26298059
tags question: http://stackoverflow.com/q/26343418

http://stackoverflow.com/comment/41136536
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26227602
has text: @wrongAnswer - feel free to try it for yourself. Voicu is right. The question that you've linked isn't about local variables.
score: 0

http://stackoverflow.com/q/26300862
upvote count: 1
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26300978
has answer: http://stackoverflow.com/a/26300978
has comment: http://stackoverflow.com/comment/41270460
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41270368
has answer: http://stackoverflow.com/a/26301199
has title: How to show an error message in java in a friendly way
downvote count: 0
has comment: http://stackoverflow.com/comment/41270425
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41270613
accepted answer: http://stackoverflow.com/a/26301199
has body: I have a question as i am a beginner in java you may find it silly. I am writing a method to read a file and when it does not exist an error just show up. File f = new File(FILE_path); if (f.exists() &amp;&amp; f.canRead()) { try { //Do something } catch (IOException e) { e.printStackTrace(); LOGGER.error("Error message: " + e.getMessage()); } } else { LOGGER.error("File does not exist or it cannot be read."); } but other than the error that it shows the red error also shows up and then the program stops. Exception in thread "main" java.io.FileNotFoundException: /home/project/file_path (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146) Now my question is that is there anyway that the program does not freeze at this level and we show only the friendly message? or we cannot avoid that and this Exception error always show up even we use try and catch?

http://stackoverflow.com/a/26334360
has body: you can have a public class BaseActivity extends Activity and then public class SomeActivity extends BaseActivity you can have methods in your base activity for eg. you can have a show toast method protected void showToast(String message){ Toast.makeText(this, message, Toast.LENGTH_LONG).show(); } which can be called in every activity that extends base activity . so if youve already extended a listActivity you may need to rethink . Probably if you show me exactly what youre looking for i might be able to see what exactly are you looking for. And you dont need to extend it to list activity for a list you can see various tutorials. go to this List View Tutorial and you can find what you need
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26334225
has comment: http://stackoverflow.com/comment/41332102
answers question: http://stackoverflow.com/q/26334225
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41331986

http://stackoverflow.com/q/26217105
has comment: http://stackoverflow.com/comment/41116274
tagged with: java
downvote count: 3
has title: Iterate throught a collection and put all values into a list
type: Question
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/41115884
has comment: http://stackoverflow.com/comment/41116211
favorite count: 0
has comment: http://stackoverflow.com/comment/41115830
linked to: http://stackoverflow.com/q/163998
has answer: http://stackoverflow.com/a/26217751
type: UnansweredQuestion
has body: I have a collection [[140], [141,143], [11], [11,22]] what is the best way to take these numbers and store them into a array list with no duplicates? [140,141,143,11,22]
upvote count: 1
tagged with: collections
has comment: http://stackoverflow.com/comment/41115982

http://stackoverflow.com/q/26266878
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41209411
has title: Java How to write a string in file as bytes and get string back
tagged with: string
has comment: http://stackoverflow.com/comment/41209527
has comment: http://stackoverflow.com/comment/41209922
type: Question
has comment: http://stackoverflow.com/comment/41208704
tagged with: utf-8
has comment: http://stackoverflow.com/comment/41209296
has comment: http://stackoverflow.com/comment/41209714
has comment: http://stackoverflow.com/comment/41208752
has comment: http://stackoverflow.com/comment/41210001
score: 0
has body: I need to write a string in a file as bytes in UTF-8 and then get these bytes back from file and convert it back to string and as a consiquence get the same string. May be it sounds easy but there is a hidden problem such as incorrect symbols in file. I mean that after appending in file it must contain something like: 00000008 d0bad0bb d18ed187 00000010 etc... But it contains stuff like that: mystring ---a lot of space--- (and the symbol that doesn't display here) So, what have I already done? I've tried this way: Before code read this: I keep strings in HashMap &lt; String, String > that's why my code contains get(...) etc. try { FileOutputStream oStream = new FileOutputStream("filename.txt"); Set&lt;String&gt; keySet = storage.keySet(); ByteBuffer buffer = ByteBuffer.allocate(1024); for (String key : keySet) { byte[] keyInByte = key.getBytes("UTF-8"); byte[] valueInByte = storage.get(key).getBytes("UTF-8"); oStream.write(buffer.putInt(0, valueInByte.length).array()); oStream.write(keyInByte); oStream.write((buffer.putInt(0, valueInByte.length).array())); oStream.write(valueInByte); } } catch (Exception e) { System.err.println("permission denied"); } I have also tried use PrintWriter, FileWriter, etc... but it doesn't give what I need. For example, some of them need toString() method but after toString() I will lose the ability to work with bytes. ! Notice, that I've tried to change my notepad to UTF-8 encode, but it gives no result.
tagged with: file
has answer: http://stackoverflow.com/a/26267402
answer count: 1
has comment: http://stackoverflow.com/comment/41209230
has comment: http://stackoverflow.com/comment/41208903
accepted answer: http://stackoverflow.com/a/26267402
tagged with: java
has comment: http://stackoverflow.com/comment/41209496
has comment: http://stackoverflow.com/comment/41209489
has comment: http://stackoverflow.com/comment/41210026
has comment: http://stackoverflow.com/comment/41209746
has comment: http://stackoverflow.com/comment/41208972

http://stackoverflow.com/q/26327941
type: Question
has title: Sharing web application for different clients
has body: Our framework is Grails. Say domain.com contains an application and currently used by some client. If we want to allow another client with the same functionality but providing a separation for the data of two clients, so that they can't mix both, how to do this? And whenever we want to add n clients to this application, what is the best method to be followed, so that with less / no configuration we can share the common war file for these clients by separating the db. How the real time web development handle these type of situations? And, one more point is how to provide client1.domain.com works for client1 and client2.domain.com works for client2. How to make the war file (in Java / Grails) to work like this? Otherwise we have to programmatically control the clients with in the project for every feature to be allowed or unnecessarily maintain separate war file for each client, which will be a waste of resources.
tagged with: grails
has answer: http://stackoverflow.com/a/26332899
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41320016
has comment: http://stackoverflow.com/comment/41319967

http://stackoverflow.com/q/26334189
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26334298
linked to: http://stackoverflow.com/q/3481828
has title: How to split string by specific keywords?
has comment: http://stackoverflow.com/comment/41331631
answer count: 6
has answer: http://stackoverflow.com/a/26334293
has answer: http://stackoverflow.com/a/26334246
has comment: http://stackoverflow.com/comment/41331607
accepted answer: http://stackoverflow.com/a/26334366
has comment: http://stackoverflow.com/comment/41333208
has body: I have a String String value ="Caused by:null pointer exception Caused by : BeanCreationException.. WARNING: its just a warning.."; I would like to split String after keywords "Caused by:" and "WARNING:" so that I have output like null pointer exception BeanCreationException.. its just a warning.. Any help would be much appreciated.
downvote count: 0
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/26334232
has answer: http://stackoverflow.com/a/26334232
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26334338
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26334366

http://stackoverflow.com/comment/41339625
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26338348
has text: $8.367.889 i got for 8367889, i want whatever the amount it will return a dot before 3 digit like for this 8367889 output will be 8367.889

debugging
tags question: http://stackoverflow.com/q/26207806
tags question: http://stackoverflow.com/q/26264520
tags question: http://stackoverflow.com/q/26273803
tag name: debugging
tags question: http://stackoverflow.com/q/26266147
tags question: http://stackoverflow.com/q/26284456
tags question: http://stackoverflow.com/q/26265548
type: Tag
tags question: http://stackoverflow.com/q/26299706
tags question: http://stackoverflow.com/q/26310620
tags question: http://stackoverflow.com/q/26309498
tags question: http://stackoverflow.com/q/26343543
tags question: http://stackoverflow.com/q/26281285
tags question: http://stackoverflow.com/q/26240841
tags question: http://stackoverflow.com/q/26296587
tags question: http://stackoverflow.com/q/26279024

http://stackoverflow.com/comment/41114288
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26216294
has text: use `myAsynTask.cancel(true);`
type: QuestionComment

http://stackoverflow.com/a/26340235
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26322455
answers question: http://stackoverflow.com/q/26322455
type: Answer
upvote count: 1
has body: Your HttpURLConnection setup code looks correct to me. You could try setting the User-Agent to a standard browser one, perhaps the server is trying to be more intelligent than it ought to be. Failing that, run your traffic through a debugging proxy like Fiddler or Burp to see what's going on at the network level.

http://stackoverflow.com/comment/41234792
type: QuestionComment
has text: Yes is same OS , My Android Version is 4.3.1
comment on: http://stackoverflow.com/q/26281517
score: 0
type: Comment

http://stackoverflow.com/q/26258888
has body: I'm about a month into my BSc in Software, and we are working on this forest project where we have different type of trees (ashes and beeches) which grows in different pace. They are subclasses to the general class Tree. My problem is now I'm asked to add two trees of each kind of tree (ash and beech) to an ArrayList – their int age and double height should all be different. I simply can't put my head around how this should be set up so any advices/hints/solutions is greatly appreciated. Source for Tree public class Tree{ public int age; public double height; public void growOneYear() { age++; } public void show() { System.out.println("Træet er " +age+ " år gammelt og " +height+ " meter højt."); } } Source for Ash (almost identical to Beech) public class Ash extends Tree { public Ash() { age = 1; height = 1.0; } public void growOneYear() { super.growOneYear(); if(height &lt; 15){ height = height*1.20; } } public void show() { System.out.println("Ask: "); super.show(); } } Screenshot of the structure
has answer: http://stackoverflow.com/a/26259220
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26259220
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26260826
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/41193023
has answer: http://stackoverflow.com/a/26259968
downvote count: 0
favorite count: 0
tagged with: arraylist
has title: Add subclass objects to an ArrayList
tagged with: subclass
accepted answer: http://stackoverflow.com/a/26259968

http://stackoverflow.com/comment/41173375
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26247602
has text: Your issue is that you're thinking of creating the body in the same way that you thought about making the head and the tail. But there's a fundamental difference between the two. The head and tail (which you've gotten right) expand outwards. You can't use the same kind of algorithm or approach for the body, for obvious reasons. Try to think of something new instead of reusing what you've already come up with.

http://stackoverflow.com/comment/41240958
has text: Hi Scott, thanks for taking the time to look into this. Yeah, that was it, now I got an error to look into! :) Some class is not being loaded right. Thanks a bunch! :)
type: AnswerComment
comment on: http://stackoverflow.com/a/26284584
score: 0
type: Comment

http://stackoverflow.com/q/26240478
favorite count: 0
tagged with: cypher
type: AnsweredQuestion
has body: I am new to graph database. I am badly confused how to code for it. Either by Cypher Query Language or from java.And what is the use neoeclipse. If i have to code from java and then which packages to import? If Cypher then how to connect it with java?
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: graph
has title: How to code for graph database
upvote count: 1
answer count: 1
tagged with: neo4j
has answer: http://stackoverflow.com/a/26240555
accepted answer: http://stackoverflow.com/a/26240555

http://stackoverflow.com/comment/41236151
has text: Can you add the `-out` option like `java weblogic.Upgrade -type securityproviders [-out file]` ? It seems like your weblogic.home or mw.home is being set incorrectly and defaulting to the 10.3 install. The .out file will probably have some classpath info that helps debug
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26274244

http://stackoverflow.com/q/26283993
has body: I have a controller that serves as REST web service and one of my methods is expecting a model which in this model I have a member variable of type MyObjectId. public class MyModel { private MyObjectId objectId; public MyObjectId getMyObjectId() { return objectId; } public void setMyObjectId(final MyObjectId objectId) { this.objectId = objectId; } } I have a custom implementation of a Formatter (org.springframework.format) for MyObjectId and this is my parse method: @Override public MyObjectId parse(final String text, final Locale locale) throws ParseException { // If the string is invalid it will throw an IllegalArgumentException return MyObjectIdConvertor.convert(text); } In my spring-servlet.xml I registered my formatter: &lt;bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean"&gt; &lt;property name="formatters"&gt; &lt;set&gt; &lt;bean class="com.foo.MyObjectIdFormatter"/&gt; &lt;/set&gt; &lt;/property&gt; &lt;/bean&gt; Now my problem is that when an exception is thrown from the Formatter it is not being caught by any of the @ExceptionHandler methods. Therefore the response is being output in this format: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'filterModel' on field 'myObjectId': rejected value [foo123123]; codes [typeMismatch.filterModel.myObjectId,typeMismatch.myObjectId,typeMismatch.com.foo.MyObjectId,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [filterModel.myObjectId,myObjectId]; arguments []; default message [myObjectId]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'com.MyObjectId' for property 'myObjectId'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type com.MyObjectId for value 'foo123123'; nested exception is java.lang.NumberFormatException: For input string: "…
tagged with: spring-mvc
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: rest
has answer: http://stackoverflow.com/a/26284429
type: UnansweredQuestion
has title: @ExceptionHandler not catching exceptions being thrown from Spring Formatters
tagged with: spring

http://stackoverflow.com/a/26239530
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26239445
score: 3
has body: Yes it is. The heap is being over-allocated. The only way to solve other then increasing the heap space is to see what is using all the heap space and then trying to make sure objects can be collected that stay around longer then they are needed. If it is a file or something that can't be collected that is making you run out of heap space, you should re-engineer your program if the file sizes aren't constant and keep changing. If they are constant just increase the heap space above the file size.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26239445

http://stackoverflow.com/comment/41256390
has text: ah yes my mistake! i changed the variable gp to double as well and it is now printing the correct values, thank you for you help.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26292380
type: AnswerComment

http://stackoverflow.com/q/26328390
has title: Java Annotation Composition, re-using attributes
has body: I would like to do something like this: @QueryHints(@QueryHint(name = "org.hibernate.fetchSize", value = FetchSize.value())) @Target({ }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface FetchSize { String value(); } The part that doesn't work is value = FetchSize.value(). I would like to hand the value attribute from @FetchSize to the target annotation @QueryHint so that I can annotate like this: @FetchSize("1000") Is something like that possible somehow, and how would I make it work?
tagged with: java
tagged with: annotations
type: Question
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/26328473
tagged with: composition
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/13844161
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26328473

http://stackoverflow.com/comment/41199148
type: Comment
has text: You need to share code for getGain() & getLoss();
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26262002

http://stackoverflow.com/q/26283525
tagged with: gwt
tagged with: javascript
tagged with: google-maps-api-3
upvote count: 2
has title: GWT Google Maps: setCenter: not a LatLng or LatLngLiteral: in property lat: not a number
tagged with: google-maps
answer count: 1
has body: I'm using GWT (version 2.61) and gwt-maps (version 3.8.0) in an effort to display a Google Map via GWT. The basics seem to work, but now I'm trying to run the CitySimple example that comes with the gwt-maps zip. Here it is in straight JavaScript, but I'm trying to do it through GWT. However, when I run the sample, I get the following error upon startup: com.google.gwt.core.client.JavaScriptException: (InvalidValueError) @com.google.maps.gwt.client.Circle::create(Lcom/google/maps/gwt/client/CircleOptions;)([JavaScript object(17)]): setCenter: not a LatLng or LatLngLiteral: in property lat: not a number at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.maps.gwt.client.Circle$.create(Circle.java) at com.test.client.GwtTest.renderMap(GwtTest.java:80) The map shows up, but none of the city circles show up. It seems to believe that the lat value in my LatLng type is not a number, which is impossible in GWT, since Java will only take a double value. Here is the GWT code I'm running: package com.test.client; import java.util.HashMap; import com.google.gwt.ajaxloader.client.AjaxLoader; import com.google.gwt.ajaxloader.client.AjaxLoader.AjaxLoaderOptions; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.dom.client.Document; import com.google.maps.gwt.client.Circle; import com.google.maps.gwt.client.CircleOptions; import com.google.maps.gwt.client.GoogleMap; import com.google.maps.gwt.client.LatLng; import com.google.maps.gwt.client.MapOptions; import com.google.maps.gwt.client.MapTypeId; public class GwtTest implements EntryPoint { static class City { LatLng center; Long populatio…
favorite count: 0
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26299714
accepted answer: http://stackoverflow.com/a/26299714
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41351056
has comment: http://stackoverflow.com/comment/41267521
type: Question

http://stackoverflow.com/comment/41292687
type: AnswerComment
comment on: http://stackoverflow.com/a/26304807
score: 0
type: Comment
has text: Thanks Celeb for the answer!! You did'nt answer my question "How to run infinite loop shell script from a java program?". U r trying to say that we cannot run infinte loop shell from a Java program?

http://stackoverflow.com/comment/41317842
type: QuestionComment
comment on: http://stackoverflow.com/q/26305168
has text: @wypieprz, yes, the **@PostLoad** method is triggered by the findOne method. And the **@PostUpdate** is immediately triggered after the secretProperty is decrypted.
score: 0
type: Comment

http://stackoverflow.com/q/26337716
upvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41338315
tagged with: android
score: -1
has comment: http://stackoverflow.com/comment/41338133
has title: Create object in public class
has comment: http://stackoverflow.com/comment/41338130
answer count: 1
downvote count: 1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41338576
has body: I have such code. But it crushes when I execute it with error unable to instantiate activity ComponentInfo blah blah blah No errors before compile. Why I'm unable to create instance of class in that place? When I create it in method - it''s ok. Where I should create this objects? This class is the main class in my app. It appears after default "Blank activity" creation public class MyActivity extends Activity { EditText cocktail_1 = (EditText) findViewById(R.id.editText1); // why i cant do like that? Why I haven't got any errors? Where I should write this line? AlertDialog.Builder one_more_error; //but its ok @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } ... } My manifest <?xml version="1.0" encoding="utf-8"?> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> Please do not edit my code
has answer: http://stackoverflow.com/a/26338427

http://stackoverflow.com/comment/41312379
score: 0
comment on: http://stackoverflow.com/a/26323752
type: Comment
has text: Thanks and I have edited the question to avoid some language ambiguity. The question is: How to achieve the same functionality which is mentioned in Part 1 and 2 in Part 3 single line rather creating and assigning a object like `Singleton<Integer> integerVersion`
type: AnswerComment

http://stackoverflow.com/comment/41214191
type: AnswerComment
comment on: http://stackoverflow.com/a/26269623
has text: @NicLaQuatra Edited. Yes, that should have been `guess`.
score: 0
type: Comment

http://stackoverflow.com/q/26242791
type: UnansweredQuestion
tagged with: netty
has title: Java, Netty: Help Understanding ChannelPipelines and addLast
score: 2
downvote count: 0
answer count: 0
has body: I am working through some examples of using the Netty io server. I am working on understanding the pipeline construct, and how elements that are added to the pipeline effect each other, and how their order is important in the pipeline. So far I have created a child handler as follows in my main method serverBootstrap.childHandler(new ChannelInitializer&lt;SocketChannel&gt;() { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { ChannelPipeline pipeline = socketChannel.pipeline().addLast( ... ); } } I want to have a pipeline where one handler generates a long with System.currentTimeMillis() and another handler that encodes it as a string in the format provided by the Date classes toString method. To that end I started with this: ChannelPipeline pipeline = socketChannel.pipeline().addLast( new ChannelInboundHandlerAdapter() { @Override public void channelActive(final ChannelHandlerContext channelHandlerContext) { byte[] bytes = "Press return to get the time\n".getBytes(); channelHandlerContext.writeAndFlush( channelHandlerContext .alloc() .buffer(bytes.length) .writeBytes(bytes)); } @Override public void channelRead(final ChannelHandlerContext channelHandlerContext, Object object) { try { ChannelFuture channelFuture = channelHandlerContext.writeAndFlush( channelHandlerContext .alloc() .buffer() .writeLong(System.currentTimeMillis())); channelFuture.addListener(ChannelFutureListener.CLOSE); } finally { ReferenceCountUtil.release(object); } } @Override public void exceptionCaught(ChannelHandlerContext channelHandlerContext, Throwable throwable) { throwable.printStackTrace(); channelHandlerContext.close(); } } ); How do I modify this so that an encoder encodes the payload as a date string such as 2014-10-07T18:34:10.897-00:00? Is this the correct way to think about the pipeline, though a trivial example? In terms of understanding, looking at this example, it is unclear how the order of this pipeline is executed. For example, if I assume t…
tagged with: java
type: Question
upvote count: 2
favorite count: 0

http://stackoverflow.com/a/26254650
upvote count: 2
answers question: http://stackoverflow.com/q/26254437
type: Answer
score: 2
downvote count: 0
has body: I would go on 3. Multithreading relies on few basic concepts of mutex and semaphores, both in the POSIX standard, and I would recommend you learning them. The C concepts are really basic, the most difficult thing you have to learn will probably be pointers so nothing hard. Having coded multithread projects both in Java and in C I would recommend C (having an hard Java background it's difficult to say for me! ) to learn an important part of POSIX standard (used in Unix too), not to depend on extern libraries and virtual machines. If you want to do it in Java, I would exclude solution 2 and make a standalone Java project, it has appropriate libraries to support multithreading.

http://stackoverflow.com/comment/41332553
score: 0
type: Comment
type: QuestionComment
has text: you mean put it in "orm.xml" instead of annotations?
comment on: http://stackoverflow.com/q/26333044

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/26276874
tag name: google-oauth
tags question: http://stackoverflow.com/q/26347658

http://stackoverflow.com/q/26218559
tagged with: jasper-reports
has body: Is it possible to print multiple report in one batch? I currently print report with following code String report = "someReport.jasper"; Map&lt;String,Object&gt; hm = new HashMap&lt;&gt;(); hm.put("id", id); // some id to fetch data from database JasperPrint jprint; try{ jprint = (JasperPrint) JasperFillManager.fillReport(report, hm, MySQLConnection.getAppServerConnection()); JasperViewer.viewReport(jprint,false); } catch (JRException e) { e.printStackTrace(); } I would like to call same report multiple times with different parameter (id), and to display it in single JasperViewer before printing
type: Question
has title: Printing multiple reports with jaseprreportts
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26229976
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/a/26205264
downvote count: 0
answers question: http://stackoverflow.com/q/26204900
has body: According to this : http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile Java's new memory model does this by 1) prohibiting the compiler and runtime from allocating volatile variables in registers. 2) not allowing the compiler/optimizer to reorder field access from the code. Effectively, this is like acquiring a lock. 3) Forcing the compiler/runtime to flush a volatile variable to main memory from cache as soon as it is written. 4) Marking a cache as invalidated before a volatile field is read. From the article: "Volatile fields are special fields which are used for communicating state between threads. Each read of a volatile will see the last write to that volatile by any thread; in effect, they are designated by the programmer as fields for which it is never acceptable to see a "stale" value as a result of caching or reordering. The compiler and runtime are prohibited from allocating them in registers. They must also ensure that after they are written, they are flushed out of the cache to main memory, so they can immediately become visible to other threads. Similarly, before a volatile field is read, the cache must be invalidated so that the value in main memory, not the local processor cache, is the one seen. There are also additional restrictions on reordering accesses to volatile variables. " ... "Writing to a volatile field has the same memory effect as a monitor release, and reading from a volatile field has the same memory effect as a monitor acquire. In effect, because the new memory model places stricter constraints on reordering of volatile field accesses with other field accesses, volatile or not..."
upvote count: 3
has comment: http://stackoverflow.com/comment/41106842
type: Answer
score: 3

http://stackoverflow.com/q/26340990
has comment: http://stackoverflow.com/comment/41344896
has comment: http://stackoverflow.com/comment/41345095
score: 1
has comment: http://stackoverflow.com/comment/41344226
tagged with: java
possible better answer: http://stackoverflow.com/a/26341467
has answer: http://stackoverflow.com/a/26341881
has comment: http://stackoverflow.com/comment/41345213
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41345185
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/5621338
has title: Problems with images when compiled
downvote count: 0
tagged with: jar
linked to: http://stackoverflow.com/q/25635636
has body: I have been all over the internet trying to work out how to get an image icon displayed after compiling into a runnable jar. I discovered this problem way too late, I ran my program many times before in eclipse and every thing has worked, now 6 months later with project finished, I compiled my program with eclipse and no audio or images work. Reading on the net, it says about the location of images folder should be inside jar, but mine doesnt get put there? I have played around with the images folder moving it inside the source folder, but it didn't work. I have a feeling that it might be something to do with the path of the resource...ebut thats only guessing. I have built a simple program that has the same results... works when ran in eclipse, but not when compiled. Could somebody show me an example by modifying my code below. Thanks in advance. SOURCE CODE: package ImageIcon; import java.awt.BorderLayout; import java.awt.Color; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Gui { public static JLabel c; public Gui(){ JFrame f = new JFrame(); JPanel p = new JPanel(); p.setBounds(0, 0, 120, 200); p.setBackground(Color.black); p.setLayout(null); JPanel bg = new JPanel(new BorderLayout()); bg.setBounds(50, 50, 15, 15); bg.setBackground(Color.white); ImageIcon a = new ImageIcon("images/success.jpg"); c = new JLabel(a); f.setSize(100, 200); f.setLayout(null); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.add(p); p.add(bg); bg.add(c); } public static void main(String[] args) { new Gui(); } }
has comment: http://stackoverflow.com/comment/41345276
has comment: http://stackoverflow.com/comment/41344126
has comment: http://stackoverflow.com/comment/41345662
accepted answer: http://stackoverflow.com/a/26341881
has comment: http://stackoverflow.com/comment/41344706
has comment: http://stackoverflow.com/comment/41345130
has comment: http://stackoverflow.com/comment/41345365
has comment: http://stackoverflow.com/comment/41345342
favorite count: 0
linked to: http://stackoverflow.com/q/17874717
tagged with: embedded-resource
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26341467
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41344620

http://stackoverflow.com/comment/41314704
has text: Are you sure you want to print 4 elements at a time? Or can you print any permutation of the array? For example `1`, `1 2`, `1 2 3`, `1 2 3 4`. If the latter, you can do it recursively with `O(n)` time complexity
comment on: http://stackoverflow.com/q/26325071
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26230287
has body: i have a dynamically created tablelayout with dynamically created imageview per row. These imageviews are clickable and will show a "select photo intent" After selecting/capturing a photo, the image will be loaded in the imageview. My problem is that, the image always load at the latest imageview created even if i choose the first one. Code below: public class ImageGalleryDemoActivity extends Activity { private static int RESULT_LOAD_IMAGE = 1; private Uri outputFileUri; private ImageView imageView; private int size = 2; ImageView imageview_attachrequirement; TableLayout tablelayout_coverages; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tablelayout_coverages = (TableLayout) findViewById( R.id.tablelayout_coverages); Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture); imageView = (ImageView) findViewById(R.id.imgView); setCoverageTableLayout(); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { openImageIntent(); } }); } private void openImageIntent() { final File root = new File(Environment.getExternalStorageDirectory() + File.separator + "MyDir" + File.separator); root.mkdirs(); final String fname = "img_" + System.currentTimeMillis(); final File sdImageMainDirectory = new File(root, fname); outputFileUri = Uri.fromFile(sdImageMainDirectory); final List&lt;Intent&gt; cameraIntents = new ArrayList&lt;Intent&gt;(); final Intent captureIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); final PackageManager packageManager = getPackageManager(); final List&lt;ResolveInfo&gt; listCam = packageManager.queryIntentActivities( captureIntent, 0); for (ResolveInfo res : listCam) { final String packageName = res.activityInfo.packageName; final Intent intent = new Intent(captureIntent); intent.setComponent(new ComponentName(res.activityInfo.packageName,…
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: android-intent
type: Question
score: 1
tagged with: java
tagged with: image
downvote count: 0
has title: Load Image to dynamically created imageviews after a select photo intent

http://stackoverflow.com/a/26246527
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41188641
downvote count: 0
answers question: http://stackoverflow.com/q/26245351
has body: You have not posted your mappings but there seems to me to be a fundamental issue with way that Embeddables are keyed. This is the only obvious way I can see to map the association: @Entity @Table(name = "stores") public class Store { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @ElementCollection @CollectionTable(name = "store_names", joinColumns = @JoinColumn(name = "store_id")) @MapKeyColumn(name = "locale") private Map&lt;Locale, LocalizedName&gt; names; public Map&lt;Locale, LocalizedName&gt; getNames() { return names; } public String getName(Locale locale) { return names.get(locale).getName(); } } @Embeddable public class LocalizedName { @Column(name = "name") private String name; @SuppressWarnings("unused") private LocalizedName() { } public LocalizedName(String name) { this.name = name; } public String getName(){ return name; } } The following test passes: @Test public void testLoadStore() { Store store = repository.findOne(1l); Assert.assertNotNull(store); Assert.assertEquals("EN Name", store.getName(Locale.ENGLISH)); Assert.assertEquals("DE Name", store.getName(Locale.GERMAN)); } The issue with this is however that 'Locale' can never be a property of LocalisedName otherwise Hibernate complains of a duplicate column mapping. See the bug report: https://hibernate.atlassian.net/browse/HHH-5393 So while it is possible to write a query method: public interface StoreRepository extends JpaRepository { @Query(value = "from Store s join s.names n where n.name = ?1") Store findByName(String name); } for which the following test passes @Test public void testLoadByName() { Store store = repository.findByName("EN Name"); Assert.assertNotNull(store); Assert.assertEquals("EN Name", store.getName(Locale.ENGLISH)); Assert.assertEquals("DE Name", store.getName(Locale.GERMAN)); } as far as I can see this can never take Locale into account as it is not a property of LocalizedName.

http://stackoverflow.com/comment/41243605
comment on: http://stackoverflow.com/a/26285963
type: AnswerComment
score: 0
type: Comment
has text: @rpeck3 On what line are you getting this error? This method compiles perfectly for me.

http://stackoverflow.com/comment/41325490
type: Comment
comment on: http://stackoverflow.com/a/26330741
score: 0
type: AnswerComment
has text: Thanks, but when I try this, it says "Invalid escape sequence..."

http://stackoverflow.com/comment/41251671
type: AnswerComment
comment on: http://stackoverflow.com/a/26289939
score: 0
has text: Yep this was the problem. I'm taking the AP computer science course using the eIMACS online textbook. The "test cases" given all use System.out.println in the main method, which is why I had to use a String instead of a void. The strange thing is that eIMACS requested that a void be used in the method -- In other words, it was a problem with the textbook.
type: Comment

http://stackoverflow.com/comment/41244129
comment on: http://stackoverflow.com/q/26273546
score: 1
has text: I'm currently trying to solve a similar problem with multiple joined tables. I don't have a Java solution for you, but, there appear to be a number of non-java javascript solutions that might work in your "single" table situation. Take a look at the D3 Nest functionality on these pages: https://gist.github.com/phoebebright/3176159 and http://bl.ocks.org/phoebebright/raw/3176159/
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41210838
score: 0
type: Comment
type: QuestionComment
has text: Yes I've compiled what I have. I've also fixed the typo and added the proper comparision instead of assignment operator. I now get an error of "incomparable types: char and java.lang.String".
comment on: http://stackoverflow.com/q/26267953

http://stackoverflow.com/q/26235880
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/26237352
tagged with: eclipse-plugin
linked to: http://stackoverflow.com/q/8792260
has title: FileLocator's method toFileURL ignores empty folders
answer count: 1
has comment: http://stackoverflow.com/comment/41151754
favorite count: 0
has comment: http://stackoverflow.com/comment/41151816
upvote count: 1
linked to: http://stackoverflow.com/q/8465417
has answer: http://stackoverflow.com/a/26237352
type: AnsweredQuestion
tagged with: osgi-bundle
score: 1
tagged with: java
has body: With aid of this and this questions I managed to create the most of the desired file structure in a project by copying this from my plugin bundle. URL templatesURL = Activator.getDefault().getBundle().getEntry(TEMPLATES_PATH); File templatesFolder = new File(FileLocator.toFileURL(templatesURL).getPath()); copyFiles(templatesFolder, project, monitor); I have two folders TEMPLATES_PATH + "\test\java" with no files in them. I want these to be created as well, but they don't. Investigations led me to the folder where OSGi extracts the contents of the bundle: C:\eclipse\configuration\org.eclipse.osgi\&lt;number&gt;\0\.cp The folders aren't being extracted! I could either create an empty file "test\java\.touch" or create the folders manually with IFolder testFolder = project.getFolder(new Path("test")); testFolder.create(true, true monitor); testFolder.getFolder(new Path("java")).create(true, true monitor); I can get the desired structure using one of the both ways but I would like to know: is there a way to make FileLocator extract the folders?
tagged with: eclipse

http://stackoverflow.com/comment/44227613
has text: That will end up excluding all new `Configuration` classes, which you likely do not want.
comment on: http://stackoverflow.com/a/27912052
type: Comment
score: 1
type: AnswerComment

compare
tags question: http://stackoverflow.com/q/26310805
tags question: http://stackoverflow.com/q/26235542
tags question: http://stackoverflow.com/q/26345075
tag name: compare
tags question: http://stackoverflow.com/q/26329571
tags question: http://stackoverflow.com/q/26336978
type: Tag
tags question: http://stackoverflow.com/q/26322215
tags question: http://stackoverflow.com/q/26325251
tags question: http://stackoverflow.com/q/26232691

http://stackoverflow.com/comment/41140739
has text: What does this give in console? Check once: `System.out.println("second: "+sharedprefs.getString("SharedPrefsData",""));`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26230042

netbeans
tags question: http://stackoverflow.com/q/26272072
tags question: http://stackoverflow.com/q/26265542
tags question: http://stackoverflow.com/q/26328477
tags question: http://stackoverflow.com/q/26214916
tags question: http://stackoverflow.com/q/26221779
tags question: http://stackoverflow.com/q/26352981
tags question: http://stackoverflow.com/q/26197495
tags question: http://stackoverflow.com/q/26333045
tags question: http://stackoverflow.com/q/26323521
tags question: http://stackoverflow.com/q/26218647
tags question: http://stackoverflow.com/q/26347801
tags question: http://stackoverflow.com/q/26288864
tags question: http://stackoverflow.com/q/26291105
tags question: http://stackoverflow.com/q/26352310
tags question: http://stackoverflow.com/q/26198122
tags question: http://stackoverflow.com/q/26283733
tags question: http://stackoverflow.com/q/26323390
tags question: http://stackoverflow.com/q/26323813
tags question: http://stackoverflow.com/q/26343648
tags question: http://stackoverflow.com/q/26198518
tags question: http://stackoverflow.com/q/26317278
type: Tag
tags question: http://stackoverflow.com/q/26305468
tags question: http://stackoverflow.com/q/26325490
tags question: http://stackoverflow.com/q/26264784
tags question: http://stackoverflow.com/q/26263013
tags question: http://stackoverflow.com/q/26280293
tags question: http://stackoverflow.com/q/26337629
tags question: http://stackoverflow.com/q/26229140
tags question: http://stackoverflow.com/q/26351656
tags question: http://stackoverflow.com/q/26209844
tags question: http://stackoverflow.com/q/26239962
tags question: http://stackoverflow.com/q/26312063
tags question: http://stackoverflow.com/q/26329078
tags question: http://stackoverflow.com/q/26195014
tags question: http://stackoverflow.com/q/26218240
tags question: http://stackoverflow.com/q/26318136
tags question: http://stackoverflow.com/q/26234385
tags question: http://stackoverflow.com/q/26224406
tags question: http://stackoverflow.com/q/26350595
tag name: netbeans
tags question: http://stackoverflow.com/q/26351365
tags question: http://stackoverflow.com/q/26315387
tags question: http://stackoverflow.com/q/26221027
tags question: http://stackoverflow.com/q/26195865
tags question: http://stackoverflow.com/q/26245098
tags question: http://stackoverflow.com/q/26252379

http://stackoverflow.com/comment/41169449
has text: I also did experiements with a Runnable jar from cmd line, the result is quite consistent with the one from eclipse. I'm more and more inclining to agree that the I/O is the culprit as you pointed out. But I wonder why I can't find much reference about this 'obvious' I/O inefficiency in conconcurent process, at least not anything from recent time?
type: AnswerComment
comment on: http://stackoverflow.com/a/26229248
type: Comment
score: 1

android-actionbar
tags question: http://stackoverflow.com/q/26243010
type: Tag
tags question: http://stackoverflow.com/q/26350205
tags question: http://stackoverflow.com/q/26275543
tag name: android-actionbar

http://stackoverflow.com/comment/41098306
type: Comment
has text: my bad, tab is array and tab2 is array2
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26207611

ondraw
type: Tag
tags question: http://stackoverflow.com/q/26203460
tag name: ondraw

http://stackoverflow.com/comment/41159274
score: 0
type: Comment
type: QuestionComment
has text: @jgr208: what makes it portable is the runtime, not the compiler.
comment on: http://stackoverflow.com/q/26240241

http://stackoverflow.com/comment/41219385
type: QuestionComment
type: Comment
has text: This may help you http://radio-weblogs.com/0128037/stories/2003/08/11/topTenToysForJavaCodersIn905.html
comment on: http://stackoverflow.com/q/26272926
score: 0

http://stackoverflow.com/a/26228409
answers question: http://stackoverflow.com/q/26228395
has comment: http://stackoverflow.com/comment/41138070
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41137839
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41137845
has body: Your code not even compile. if(b==013) { String me="TM"; //scope of String variable me is inside if only } switch(me) // you can't use it here Next case if you use nextInt(), your input 013456789 will become 13456789. Also you should keep in mind that leading 0 will ignore if you use int to represent them. You should correct your code as follows to correct above mention mistakes. String number; int n = 3; Scanner input = new Scanner(System.in); System.out.print("Please enter your phone number: "); number = input.nextLine(); String b = number.substring(0, n); String me=null; if (b.equals("013")) { me = "TM"; } switch (me) { case "TM": System.out.println("Answer: The phone number is a TM number."); break; case "Celcom": System.out.println("Answer: The phone number is a Celcom number."); break; case "DiGi": System.out.println("Answer: The phone number is a DiGi number."); break; case "Maxis": System.out.println("Answer: The phone number is a Maxis number."); break; }
accepted answer of: http://stackoverflow.com/q/26228395

http://stackoverflow.com/a/26322042
has comment: http://stackoverflow.com/comment/41309197
has comment: http://stackoverflow.com/comment/41309267
answers question: http://stackoverflow.com/q/26321999
has body: If I read your question in a different manner, it seems that you're trying to take the instance of AbstractCat that you've created, and add it to your zoo list. Well...you can't do it in the manner you're attempting to from within the anonymous class. You might be able to, but I'd strongly discourage it. Instead, it'd be simpler for you to place the instance of the anonymous class that you hold into the list instead. AbstractCat cat = new AbstractCat() { // impl } zoo.add(cat);
accepted answer of: http://stackoverflow.com/q/26321999
downvote count: 0
has comment: http://stackoverflow.com/comment/41309411
score: 1
has comment: http://stackoverflow.com/comment/41309459
has comment: http://stackoverflow.com/comment/41309281
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41309167
type: Answer

http://stackoverflow.com/q/26206590
type: Question
tagged with: overloading
tagged with: java
downvote count: 0
possible better answer: http://stackoverflow.com/a/26206620
has answer: http://stackoverflow.com/a/26208108
has body: I am trying to understand why the following code is always calling the "out(Object)" method rather than the more specific "out(int|String)" methods. An explanation and a work around would be greatly appreciated. public static void main(String[] args) { Object[] objs = new Object[]{1, 2, 3, "test1", "test2", "test3", 1000L}; for (Object o : objs) { out(o.getClass().cast(o)); // I have also tried passing 'o' directly // rather than casting, but that still results // in the out(Object) method being called } } private static void out(int value) { System.out.println("integer: " + value); } private static void out(String value) { System.out.println("string : " + value); } private static void out(Object value) { System.out.println("object : " + value); }
has answer: http://stackoverflow.com/a/26206620
favorite count: 0
answer count: 4
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2127318
has answer: http://stackoverflow.com/a/26206766
has title: Why is this overloaded method being called instead of the more specific?
upvote count: 2
accepted answer: http://stackoverflow.com/a/26208108
has answer: http://stackoverflow.com/a/26206795

http://stackoverflow.com/comment/41096515
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26206190
type: QuestionComment
has text: Remember that "static" infers "single instance". By definition, if you want your variable "BASE" to have different values according to its context, it means that it's not static. Just declare it as a non-static variable, and you should achieve what you want.

http://stackoverflow.com/comment/41326998
type: AnswerComment
score: 0
type: Comment
has text: What errors do you see from the debug, can you post them?
comment on: http://stackoverflow.com/a/26322772

http://stackoverflow.com/a/26344661
has body: You can create a ScheduledExecutorService like Minh Nguyen suggested, but use the logic discribed in this answer, for your task to reschedule itself according to your changing requirements.
type: Answer
answers question: http://stackoverflow.com/q/26344149
score: 0

http://stackoverflow.com/a/26321561
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26313481
answers question: http://stackoverflow.com/q/26313481
type: Answer
has body: It seems to be a bug in the specification. Quoting from the bug report linked to above (third point in the description): The grammar doesn't define any production for the following expression: new java.security.Permissions() This is a side-effect of removing TypeDeclSpecifier in 4.3, as it interacted poorly with type annotations. The JSR 308 Public Review noted: "TypeDeclSpecifier is one of the more obscure nonterminals in the The Java Language Specification. It is used in only a handful of situations: the extends and implements clauses of a class declaration (8.1.4, 8.1.5), the extends clause of an interface declaration (9.1.3), and the syntax of a class instance creation expression (15.9). The reason for its use is to prohibit wildcard type arguments (though 9.1.3 actually fails to do so), but this can be achieved equally well without a dedicated non-terminal."
score: 5
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/41326037
type: Comment
has text: I'm confused about *"change the disposal method for the frame to `restoreToBackgroundColor`*". Isn't it just calling `super.paint`?
comment on: http://stackoverflow.com/a/26331052
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41199396
has text: That's fine but what I gave above is the correct syntax to use the `rawQuery` method. The entire premises is to avoid string concatenation of the where clause for the params. There is a reason behind the 2nd argument which you are sending as null.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26229496

http://stackoverflow.com/q/26303538
answer count: 1
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/26303743
score: 0
accepted answer: http://stackoverflow.com/a/26303743
has body: my javascript is getting a dice result from my Java Servlet. I am using a label in my html page to show the dice result, but I want to make a cheap effect that will display changing numbers on screen before the real result shows. because this is an ajax call that happens after pressing the "roll dice" button, then the real result is shown first, and the ones I choose randomly in the javascript page are shown after... (I tried that with setInterval() ). Can you help me find a good way to do that "effect"? Thank you! here's my js code: function onRollDiceClick() { ajaxGetDiceResult(gameName); } function ajaxGetDiceResult(gameName) { jQuery.ajax({ url: "rollDice?gameName=" + gameName, dataType: 'json', timeout: TIMEOUT_RATE, success: function(data) { var diceResult = data.diceResult; setIntervalXTimes(showRandomNumbers, 200, 20); $("#dice-result").text(diceResult); }, error: function(error) { } }); } function showRandomNumbers() { var randomNumber = Math.floor(Math.random() * (6) + 1); $("#dice-result").text(randomNumber); } function setIntervalXTimes(callback, delay, repetitions) { var x = 0; var intervalID = setInterval(function() { callback(); if (++x === repetitions) { clearInterval(intervalID); } }, delay); }
has title: dice effect - how to display fake results and the real one in the end (JavaScript)
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41275847
tagged with: servlets
type: Question
tagged with: dice

http://stackoverflow.com/a/30061799
type: Answer
has body: With the magic number being 2GB, the first thing that comes to mind is that somewhere there's an array being initiliazed to hold the whole data. Since in Java an array index must be of type int (Reference: http://docs.oracle.com/javase/specs/jls/se8/html/jls-10.html#jls-10.4), the maximum array length can be Integer.MAX_VALUE (2147483647). So assuming the data is loaded as a single byte array, we get 2147483647 bytes ~ 2GB as the maximum capacity. Thus, it is possible that by trying to allocate a larger array the application results in the aforementioned exception. The situation is typically handled by loading data in chunks and not storing everything in the single byte array. However, as far as I've gathered it isn't your code that does the actual physical reading from storage. Perhaps if you mention the use case for the application it would be easier to come up with a higher level solution
score: 0
answers question: http://stackoverflow.com/q/26235019

http://stackoverflow.com/q/26197029
has body: Got the following assignment for school: To check if a given number is divisible by 9 you can try taking the sum of all seperate numbers from that number. When we have the result of that sum we can easily check if it's divisible by 9. Write a program that checks if a number is divisible by 9 using this given method. Make sure that all sums in between get written down as in the following example. input 2656 19 10 1 no input -9999542 47 11 2 no input 91827 27 9 yes I could use modulo operator in the first place, but since I'm being told to do it like that I have no idea how to work this out. Does someone have any tips? EDIT: not allowed to use strings or arrays.
favorite count: 0
has comment: http://stackoverflow.com/comment/41078974
has comment: http://stackoverflow.com/comment/44892868
has answer: http://stackoverflow.com/a/26197305
has comment: http://stackoverflow.com/comment/41079012
has comment: http://stackoverflow.com/comment/41078969
has title: Check if number is divisible by 9 without a simple modulo
has answer: http://stackoverflow.com/a/26197710
possible better answer: http://stackoverflow.com/a/26197305
has comment: http://stackoverflow.com/comment/41078950
has comment: http://stackoverflow.com/comment/41079300
tagged with: division
upvote count: 1
has comment: http://stackoverflow.com/comment/41079074
type: AnsweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41078936
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26197710
score: -2

http://stackoverflow.com/comment/41255422
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26292631
has text: Consider using this `Map<String, ArrayList<String>>`
score: 0

http://stackoverflow.com/q/26314583
type: Question
has comment: http://stackoverflow.com/comment/41295926
score: 0
answer count: 2
tagged with: api
favorite count: 0
has comment: http://stackoverflow.com/comment/41295277
has answer: http://stackoverflow.com/a/26315561
has comment: http://stackoverflow.com/comment/41295174
has body: SOLVED and code amended. I'm trying to retrieve data from rotten tomato API using java, it's for a simple chat bot. My URI works when I paste it into my browser. But my code isn't returning the same results and i'm not sure what i'm doing wrong. The second problem is that my 'JsonReader' cannot be resolve to a type and I don't have the option of importing it. I've been using this guide! Code as follow: String url = http://api.rottentomatoes.com/api/public/v1.0/movies.json?q=queryText&amp;page_limit=10&amp;page=1&amp;apikey=[] try { urlObj = new URL(url); //The URI to be used. con = (HttpURLConnection) urlObj.openConnection(); //OPen a connection to the URI //int responseCode = con.getResponseCode(); //System.out.println("\nSending 'GET' request to URL : " + url); //System.out.println("Response Code : " + responseCode); scan = new Scanner(urlObj.openStream()); String strResultSet = ""; while (scan.hasNext()) { strResultSet+= scan.nextLine(); } //System.out.println("StrJson"+strResultSet); JSONObject JSONResultSet = new JSONObject(strResultSet); JSONArray results = JSONResultSet.getJSONArray("movies"); JSONObject firstResult = results.getJSONObject(0); movie.setTitle(firstResult.getString(KEY_TITLE)); movie.setId(firstResult.getString(KEY_ID)); con.disconnect(); scan.close();
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26317266
accepted answer: http://stackoverflow.com/a/26317266
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Unable to access API data and JSON parse error in java
possible better answer: http://stackoverflow.com/a/26315561

http://stackoverflow.com/comment/41311634
comment on: http://stackoverflow.com/q/26323390
has text: @MadProgrammer: Glad to see you here. Anything "free for commercial" stuff? ANDDD.."Go Nuts" means?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26210584
has comment: http://stackoverflow.com/comment/41104090
score: 3
has comment: http://stackoverflow.com/comment/41104097
has comment: http://stackoverflow.com/comment/41103955
answers question: http://stackoverflow.com/q/26210498
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26210498
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41104029
has comment: http://stackoverflow.com/comment/41104133
has comment: http://stackoverflow.com/comment/41103911
type: Answer
has comment: http://stackoverflow.com/comment/41104080
has body: When a thread enters this synchronized method, it acquires an implicit lock over the instance, the changes it performs to the state of the instance is visible to the other threads, waiting to enter the synchronized method. when a synchronized method exits, it automatically establishes a happens-before relationship with any subsequent invocation of a synchronized method for the same object. This guarantees that changes to the state of the object are visible to all threads. The last line in the docs mention it clearly. It doesn't matter if the state were volatile or non-volatile.
downvote count: 1

http://stackoverflow.com/a/26207702
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26207574
has body: Id use an ObjectInputStream with custom deserialization. So you'd write a class that has a List of ints and implements readObject such that when given an inputstream it reads the constant (and discards it), then the length, then n ints, then the checksum, and optionally validates it. This keeps all the code in one place, and allows you to just read fully formed objects from your data stream.

http://stackoverflow.com/q/26335339
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/30591040
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41334755
tagged with: selenium-webdriver
has title: How to Read & write Result of Test Case in same Excel sheet
has body: I have created a sample script for parameterization and I'm looking for something like my script that should read data from an excel sheet and should then update the result of each test case in the next column of the same excel sheet. I have generated one script but unfortunately it's not working. The excel sheet is getting generated at the path mentioned but when trying to open it it shows up as locked and if we check the overall properties of this excel sheet then it shows a size of 0 bytes. I'm new to selenium so I'm confused as to what I'm missing or doing wrong. Here is some sample code i have attached: package Pn1; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import jxl.Workbook; import jxl.read.biff.BiffException; import jxl.write.Label; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import org.apache.poi.hslf.model.Sheet; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class parameterization { public static void main(String[] args) throws BiffException, IOException, Exception { WebDriver driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS); //Workbook location Workbook wBook = Workbook.getWorkbook(new File("C:\\Users\\Documents\\TestData\\SampleData.xls")); File fExcel = new File ("C:\\Users\\Documents\\TestSmokeTestResult2.xls"); //get sheet jxl.Sheet Sheet = wBook.getSheet(0); //loop for(int i=1; i&lt;Sheet.getRows(); i++) { driver.get("Enter Test Env"); driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS); driver.findElement(By.xpath("//input[@id='UserName']")).sendKeys(Sheet.getCell(0, i).getContents()); WritableWorkbook writableBook = Workbook.createWorkbook(fExcel); writableBook.cre…
type: UnansweredQuestion

http://stackoverflow.com/q/26200885
favorite count: 0
has body: So at first I made my code inside main method, and I want to divide it into several void methods to make it neat. But here is my problem, some of the variable I declared inside main method, not as instance variable. How to solve this? public static void main(String[] args){ String[] allcars = args; String[] car1 = allCars[0].split("(?!^)"); String[] car2 = allCars[1].split("(?!^)"); String[] tire = {car1[0], car2[0]}; String[] color = {car1[1], car2[1]}; public static void myMethod(){ for (int i = 0; i &lt;= tire.length-2; i++){ for (int j = i+1; j &lt; tire.length; j++){ if ((tire[i]).equals(tire[j])){ value += 2; } } } } It gives me error tire cannot be resolved to a variable
type: UnansweredQuestion
upvote count: 1
has title: How to access array or variable inside main method from other method?
has comment: http://stackoverflow.com/comment/41085814
tagged with: java
tagged with: methods
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26200918
tagged with: program-entry-point
tagged with: variables
has comment: http://stackoverflow.com/comment/41085839
score: 0
has comment: http://stackoverflow.com/comment/41086189
answer count: 1

http://stackoverflow.com/comment/56049612
type: AnswerComment
comment on: http://stackoverflow.com/a/26361076
score: 0
has text: Sorry but I'm still confused by your answer. Do you use or not the @View annotation on your method ? If you do then does the name of the method matter ?
type: Comment

http://stackoverflow.com/comment/41356738
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26347873
score: 1
has text: I have not had any issues with increasing the Heap Size... I also haven't gone over 2048 with it though. However increasing PermGen I did have weird issues after going above 2048... I recommend PermGen to be only 1024, from my understanding it is only used during deployment and undeployment, after many redeployments without a server restart you will run out of PerGen memory... A restart of the server shouldn't be a problem since you shouldn't be regularly deploying to production.

http://stackoverflow.com/q/26296035
has body: I have a caching issue on a Spring multi-threaded web service with a database backend and EHCache-based caching. The service has many clients all requesting the same object again and again, with dozens of requests per seconds. There is only a couple of objects that are requested that frequently, with a large number of other objects being requested infrequently. The objects can change every couple of minutes, so the cache's TTL is set to a minute. Loading an object from the database is slow and takes at least several seconds. At first I used a naive implementation to get the object: Check whether the object is in the cache. If yes, return it from the cache. If not, load it from the database, put it in the cache and return it. This was working well when initially testing it locally. But performance testing on a faster server showed some pretty bad load spikes every time one of the more frequently requested objects expires in the cache. When this happens, for the next 10 seconds all requests for that object would result in database loads, until the first thread finished the database load and put the new object into the cache. The result was a short but very high load on the database, and a lot of users who need to wait for the request to finish. My current implementation improves the database load by tracking whether which object are currently being loaded: Check whether the object is cached. If yes, return it from the cache. If not, check whether the object is currently being loaded. If yes, wait for the other thread's load to complete, get the new object from the cache and return it. If no, put the object into the list of loading objects, put it into the cache when finished and return it. With this implementation, even when the object expires, there is only one database operation. And, because of the lower database load, it will also finish sooner. But it still means that all users who request the object during the object load need to wait. What I would really want i…
possible better answer: http://stackoverflow.com/a/26298573
has answer: http://stackoverflow.com/a/26298573
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26314041
tagged with: caching
has title: Refreshing Caches while under load with Spring/EHCache
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/26314041
favorite count: 0
tagged with: ehcache
type: Question
tagged with: multithreading
answer count: 2
tagged with: spring

http://stackoverflow.com/comment/41357364
has text: Your DAO should not be tied to the ServletRequest at all, this is a bad practice.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26348187

http://stackoverflow.com/comment/41314109
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26324025
has text: From where should I get those instead?
score: 0

http://stackoverflow.com/a/26245369
score: 0
type: Answer
has body: public class DogActivity extends ParentActivity { public DogActivity() { super("Something", new SomeObject()); // This is calling the super's constructor } } However on Android it is rare that you'd have an occasion where you need to call the parents constructor. So I have to say you are probably doing it wrong.
answers question: http://stackoverflow.com/q/26244312

http://stackoverflow.com/q/26208436
has comment: http://stackoverflow.com/comment/41099784
has comment: http://stackoverflow.com/comment/41099820
answer count: 1
has comment: http://stackoverflow.com/comment/41100736
favorite count: 0
has comment: http://stackoverflow.com/comment/41099772
has title: java student gpa files and arrays
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41099889
has comment: http://stackoverflow.com/comment/41099734
has comment: http://stackoverflow.com/comment/41099711
score: -5
has body: can someone help me with this codes. This is the file 57363 Joy Ryder D D C P H H C D 72992 Laura Norder H H H D D H H H 71258 Eileen Over C F C D C C C P I am trying to store the ID in array which is the 5 digits and convert the character to numbers and calculate the average gpa where H=7, D=6, C=6,P=4,F=0 and store this in second array. And then sort this two arrary to largest to smallest value and write these value in output text file. This is my code so far import java.io.File; import java.io.IOException; import java.util.Scanner; public class StudentGPA_17396934Demo { public static void main(String[] args) throws IOException { Scanner kb = new Scanner(System.in); String fileName; char grade[] = new char[8]; File myfile; int num = 0; do{ System.out.println("Enter the name of the file: "); fileName = kb.next(); myfile = new File(fileName); if (myfile.exists()) { Scanner infile = new Scanner(myfile); while (infile.hasNext()) { int ID = infile.nextInt(); String name = infile.next(); String surname = infile.next(); // it is converting the characters to numbers but not reading all characters also how do I get average of this numbers and store in appropriate array also how to store ID in array for (int i = 0; i &lt; grade.length; i++) { grade[i] = infile.next().charAt(0); if (grade[i] == 'H') num = 7; else if (grade[i] == 'D') num = 6; else if (grade[i] == 'C') num = 5; else if (grade[i] == 'P') num = 4; else if (grade[i] == 'F') num = 0; } System.out.println(ID + "\t" +name + "\t" +surname + "\t" + num); } } else{ System.out.println("file not found..."); } }while(!myfile.exists()); } } and my output is Enter the name of the file: grades 57363 Joy Ryder 6 72992 Laura Norder 7 71258 Eileen Over 4
tagged with: java
has comment: http://stackoverflow.com/comment/41099743
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/26208611
upvote count: 0
tagged with: arrays
downvote count: 5
has comment: http://stackoverflow.com/comment/41099814
has comment: http://stackoverflow.com/comment/41099863

http://stackoverflow.com/comment/41339663
score: 0
has text: It became complicated ;)
type: Comment
comment on: http://stackoverflow.com/a/26338348
type: AnswerComment

http://stackoverflow.com/comment/41312179
comment on: http://stackoverflow.com/q/26323771
type: Comment
type: QuestionComment
has text: Can a line contain several occurrences of `(` and `)` ?
score: 2

http://stackoverflow.com/comment/41476493
score: 2
comment on: http://stackoverflow.com/a/26407222
type: AnswerComment
type: Comment
has text: hey there, I resolved your task completely! check this demo: https://github.com/shamanland/longshadowtextview

http://stackoverflow.com/a/26313984
accepted answer of: http://stackoverflow.com/q/26313923
upvote count: 2
type: AcceptedAnswer
has body: Your fragment implementations is wrong. Do this way. public class FragmentA extends Fragment { private View v; public FragmentA() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { v = inflater.inflate(R.layout.fragment_a,container, false); configureImageButton(); return v; } private void configureImageButton() { // TODO Auto-generated method stub ImageButton btn = (ImageButton) v.findViewById(R.id.imageButton1); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getActivity(), "You Clicked the button!", Toast.LENGTH_LONG).show(); } }); } }
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26313923

http://stackoverflow.com/comment/41107935
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26211609
score: 0
has text: I have reproduced this on my system as well. It is a bug. Please log it here: https://javafx-jira.kenai.com. If you want me to log it for you just let me know.

http://stackoverflow.com/comment/41217504
score: 1
has text: Parent doesn't know about child. You have to downcast it to access child attributes but before downcast you should use `instanceof ` operator otherwise you can encounter `ClassCastException` at runtime.
comment on: http://stackoverflow.com/q/26271846
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26270200
tagged with: recursion
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26270428
type: Question
possible better answer: http://stackoverflow.com/a/26270374
downvote count: 0
has answer: http://stackoverflow.com/a/26270374
has title: Recursive Insert for Binary Tree
favorite count: 0
tagged with: binary-tree
answer count: 3
has body: I'm working on code for insertion into a binary search tree. It works for the first node I insert, making it the root, but after that it doesn't seem to insert any nodes. I'm sure it's a problem with setting left/right references, but I can't quite figure it out. Please help! //params: key of node to be inserted, parent node public void insert(int newKey, TreeNode parent){ //if the root of the tree is empty, insert at root if(this.getRoot() == null){ this.root = new TreeNode(newKey, null, null); } //if the node is null, insert at this node else if(parent == null) parent = new TreeNode(newKey, null, null); else{ //if the value is less than the value of the current node, call insert on the node's left child if(newKey &lt; parent.getKey()) { insert(newKey, parent.getLeft()); } //greater than value of current node, call insert on node's right child else if(newKey &gt; parent.getKey()){ insert(newKey, parent.getRight()); } //same as value of current node, increment iteration field by one else if(newKey == parent.getKey()) parent.incrementIterations(); } } My treenodes have key, left, right, and iteration fields, as well as getter/setter functions. Thank you in advance!
accepted answer: http://stackoverflow.com/a/26270428
score: 1
has comment: http://stackoverflow.com/comment/41214784
tagged with: reference
has comment: http://stackoverflow.com/comment/41214627
has answer: http://stackoverflow.com/a/67856199
upvote count: 1
tagged with: tree

http://stackoverflow.com/a/30262900
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26234338
answers question: http://stackoverflow.com/q/26234338
type: Answer
has body: May be you have solved the problem. but it amy be helpful to others so i am posting the answer. choose any rest client(jersey rest client) or normal http URL post. post the request to https://android.googleapis.com/gcm/send url set two variable to http header Authorization: key=YOUR_API_KEY Content-Type: application/json payload json should be as below. { "registration_ids" : ["APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx..."], "data" : { ///your data goes here }, } example { "data": { "score": "5x1", "time": "15:10" }, "registration_ids": ["4", "8", "15", "16", "23", "42"] } note - registration_ids are device registration ids. now post to the rest. for more information please check this. Sample code package com.ajs.ajstest.gcmpost; import java.io.IOException; import java.io.UnsupportedEncodingException; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; /** * * @author nirmal */ public class GCMPost { public static void main(String ar[]) throws UnsupportedEncodingException, IOException{ HttpClient httpclient = new DefaultHttpClient(); String json="{ \"data\": {" + " \"score\": \"5x1\"," + " \"time\": \"15:10\"" + " }," + " \"registration_ids\": [\"4\", \"8\", \"15\", \"16\", \"23\", \"42\"]" + "}"; HttpPost httpost = new HttpPost("https://android.googleapis.com/gcm/send"); httpost.setHeader("Content-Type", "application/json"); httpost.setHeader("Authorization","YOUR_API_KEY"); httpost.setEntity(new StringEntity(json)); HttpResponse response = httpclient.execute(httpost); } } maven dependancies org.apache.httpcomponents httpclient 4.3.6 jar
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/26319282
has answer: http://stackoverflow.com/a/26319331
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41304000
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26319344
has body: I know this is a silly example, but I do want to know how it works. In general, post-increment gives the old value and add 1 to the variable after. int a = 1; a = a++; System.out.println(a); At line3, it prints out "1". why does a remain the same? In my understanding, At line2, the right hand side assigns 1 to the variable a. post-increment "++" add 1 to a. Shouldn't it be 2 instead of 1?
answer count: 2
has comment: http://stackoverflow.com/comment/41304013
downvote count: 0
score: 1
favorite count: 0
has title: Behavior of post increment in java
linked to: http://stackoverflow.com/q/7911776
accepted answer: http://stackoverflow.com/a/26319344
has comment: http://stackoverflow.com/comment/41303972
possible better answer: http://stackoverflow.com/a/26319331
duplicate of: http://stackoverflow.com/q/7911776

http://stackoverflow.com/a/36396450
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26335815
type: Answer
has body: This will resolve your errors and the message appears in the console: System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");
downvote count: 0

http://stackoverflow.com/q/26214766
has answer: http://stackoverflow.com/a/26214927
score: 0
answer count: 4
has body: Often times, I find myself creating two objects like these: String pathString = "/foo/bar"; File path = new File(pathString); Though variable naming is a fairly subjective issue, what's the most common naming convention for File objects and their corresponding absolute file path stored in a String?
possible better answer: http://stackoverflow.com/a/26214873
has title: How to name File objects and their corresponding path strings in Java
has answer: http://stackoverflow.com/a/26214918
accepted answer: http://stackoverflow.com/a/26214918
type: AnsweredQuestion
tagged with: naming-conventions
tagged with: java
has answer: http://stackoverflow.com/a/26215019
type: Question
has answer: http://stackoverflow.com/a/26214873
has comment: http://stackoverflow.com/comment/41111434

http://stackoverflow.com/a/27433933
type: Answer
has body: Yes, it's possible. You can enable MySQL Connector/J in your Java App Engine application: https://cloud.google.com/appengine/docs/java/cloud-sql/#enable_connector_j Connect and communicate with your database. Check this document: https://cloud.google.com/appengine/docs/java/cloud-sql/
answers question: http://stackoverflow.com/q/26319640
score: 0

http://stackoverflow.com/comment/41304262
comment on: http://stackoverflow.com/q/26319408
has text: nope - ive included every place where i interact with the statsKeysPanel
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/100172603
has text: Check out [Launch4j](https://sourceforge.net/projects/launch4j/) or [JSL](https://sourceforge.net/projects/jslwin/) to see how they search the Windows Registry for an installed JVM
comment on: http://stackoverflow.com/q/26240717
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41183382
score: 0
comment on: http://stackoverflow.com/q/26252779
type: Comment
type: QuestionComment
has text: Looks as if you are mixing stream and optional apis. flatMap() in Optional is for unpacking nested optionals but your lambda is returning a list of Players, not an Optional<Player>.

http://stackoverflow.com/comment/41304123
has text: Depends on how you wrote the method. What do you return and to where?
score: 0
comment on: http://stackoverflow.com/q/26319061
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41361148
comment on: http://stackoverflow.com/a/26350334
type: AnswerComment
type: Comment
has text: This did not create the src directory. No change. :(
score: 0

http://stackoverflow.com/q/26301974
has comment: http://stackoverflow.com/comment/41272680
tagged with: generics
has answer: http://stackoverflow.com/a/26302129
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has body: So for my class I have to write my own linked list. Which I mostly understand, but the teacher wrote the mynode class public class MyNode&lt;E extends Comparable&lt;E&gt;&gt; { E element; MyNode&lt;E&gt; next; public MyNode(E item) { element = item; next = null; } } And we are meant to make a class to run with it and have it run this program public class TestLinkedList { public static void main(String[] args) { MyLinkedList&lt;String&gt; L = new MyLinkedList&lt;String&gt;(); L.add("Browns"); L.add("Ravens"); L.add("Steelers"); L.add("Bengals"); L.add("Chargers"); System.out.println(L); System.out.println(L.find("Ravens") ? "Found Ravens" : "Did not find Ravens"); System.out.println(L.find("Giants") ? "Found Giants" : "Did not find Giants"); L.insertElementBefore("Steelers", "Colts"); L.delete("Chargers"); System.out.println("Result after deleting Chargers: " + L); } } But I don't understand why node is extending comparable. I've found plenty of examples where node is just node E but none like this and I am just stumped on how to use this to write my linkedlist.
tagged with: linked-list
has comment: http://stackoverflow.com/comment/41272673
tagged with: java
tagged with: nodes
type: Question
has comment: http://stackoverflow.com/comment/41272708
answer count: 2
score: -1
has answer: http://stackoverflow.com/a/26302419
has title: Generic linked list
downvote count: 1

http://stackoverflow.com/q/26318929
answer count: 0
has comment: http://stackoverflow.com/comment/41303350
tagged with: java
has comment: http://stackoverflow.com/comment/41303632
has comment: http://stackoverflow.com/comment/41303549
type: Question
has comment: http://stackoverflow.com/comment/41303458
has comment: http://stackoverflow.com/comment/41303903
has comment: http://stackoverflow.com/comment/41303904
has comment: http://stackoverflow.com/comment/41303660
score: 0
has body: I have a custom view which is being invalidates and moved in his onDraw method, but I want to control the speed, the problem is that if I use Thread.sleep(), it stops the whole app.
has comment: http://stackoverflow.com/comment/41303610
has comment: http://stackoverflow.com/comment/41303399
has title: Set framerate of moving view
has comment: http://stackoverflow.com/comment/41303910
tagged with: view
has comment: http://stackoverflow.com/comment/41303643
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41303675
has comment: http://stackoverflow.com/comment/41303801

http://stackoverflow.com/comment/41232233
type: AnswerComment
type: Comment
has text: yes because you created as activity. And only activity who calls startActivityForResult will get call back. in your case its SampleClass.
comment on: http://stackoverflow.com/a/26280117
score: 0

http://stackoverflow.com/comment/41234734
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26281367
has text: Thanks Pablo that makes sense if you ignore the empty strings after the last space. That would explain the number. 16 instead of 21 ish.
score: 0

stax
tags question: http://stackoverflow.com/q/26222027
type: Tag
tags question: http://stackoverflow.com/q/26267034
tag name: stax

http://stackoverflow.com/q/26296195
has comment: http://stackoverflow.com/comment/41265760
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41268783
has comment: http://stackoverflow.com/comment/41264771
has body: i want to use spring scheduling in annotation . but its start with 2 thread by default . here the code : //@Scheduled(fixedDelay=20000, initialDelay=30000) @Scheduled(fixedRate=5000) public void updateEmployeeInventory(){ System.out.println("Started fixed rate job:::::::::::"+new Date()); } when run this its started with 2 thread : INFO: Initializing Spring root WebApplicationContext Started fixed rate job:::::::::::Fri Oct 10 16:56:28 IST 2014 Oct 10, 2014 4:56:29 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring FrameworkServlet 'dispatcher' Started fixed rate job:::::::::::Fri Oct 10 16:56:29 IST 2014 and in AppConfig.java file : @Bean public SMSPullerJob SMSPullerJob() { return new SMSPullerJob(); } how to set thread pool size in appconfig.java file i am working with only
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41268694
score: 0
has comment: http://stackoverflow.com/comment/41265888
has title: Spring Scheduling annotation
answer count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/26323151
answer count: 2
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/41311034
favorite count: 0
has comment: http://stackoverflow.com/comment/41311077
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41311325
has title: Combining strings java (stringtokenizer)
has body: I would like to combine a string of words for eg. aero-plane To do that , I would do a if else to check for the string "-" and if it is valid in the words it would then combine both aero and plane together to form aeroplane. I know how to do the check portion but I don't really know how to concatenate them together. I am using the java stringtokenizer api to do the following.
score: -4
has answer: http://stackoverflow.com/a/26323185
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26323235
tagged with: stringtokenizer

http://stackoverflow.com/comment/41205493
type: AnswerComment
type: Comment
has text: You can only answer the question that is asked. Which was why was she getting her initial error, which this answer does solve.
comment on: http://stackoverflow.com/a/26265035
score: 0

http://stackoverflow.com/q/26215929
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26219630
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26219630
score: 0
has title: How can I generate a coverage.xml for Jenkins without using Maven/Ant from the Linux command line?
answer count: 1
has body: Hello! Problem description I am fairly new to Linux, Jenkins and automated testing. I wonder how I can generate a coverage.xml from the Linux command line or the Jenkins environment after running my code (see below)? In Jenkins I want to show my code coverage by using Cobertura or Jacoco. I use shell scripts (bash) to clean (removing the .class files), compile and run the tests from Jenkins (or the command line). I have a very simple program in java that uses a set of very simple unit tests and one performance test (testNG). Extra I would like to find a way to generate this coverage.xml without the use of Maven or Ant if possible. As I do not know how to generate it even in my IDE I am gratefull for any explanatory answer in how to get a coverage.xml. If it is not possible, how could I write my pom.xml for Maven to get this to work? Code: Program The program is an automated, simple version of the FizzBuzz math game, where each player takes turns to count up, replacing each number that is evenly denomainated by a said denominator by another word (ex. "Fizz" but in this example "Cowabunga"). main.java public class main { public static void main(String[] args){ StartGame game = new StartGame(); game.start(); } } StartGame.java public class StartGame { public static void start() { GameRules gr = new GameRules(3,5); gr.startGame(); } } GameRules.java public class GameRules { private int currentNumber; private int currentPlayer; private int playUntilThisNumber; private int dividerToSkip; private List&lt;Player&gt; playerlist; public GameRules(int numberOfPlayers, int divider){ playerlist = new ArrayList&lt;Player&gt;(); currentNumber=1; currentPlayer=3; playUntilThisNumber = 100; dividerToSkip = divider; fillPlayerList(numberOfPlayers); } public int getCurrentNumber() { return currentNumber; } public void increaseCurrentNumber() { this.currentNumber++; } private void fillPlayerList(int numberOfPlayers){ for(int i = 0 ; i &lt; numberOfPlayers ; i++){ Player p = new Player(…
tagged with: http://stackoverflow.com/tag/xml
tagged with: linux
tagged with: jenkins
tagged with: code-coverage

http://stackoverflow.com/a/26350150
upvote count: 5
has comment: http://stackoverflow.com/comment/114278712
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26346698
type: Answer
accepted answer of: http://stackoverflow.com/q/26346698
has body: The reason that it is not formatted is that the formatting is in the HTML -- with &lt;p&gt; and &lt;ol&gt; tags etc. Calling .text() on a block element loses that formatting. Jsoup has an example HTML to Plain Text convertor which you can adapt to your needs -- by providing the div element as the focus. Alternatively, you could just select "div.col-section &gt; *", and iterate through each Element, and print out that text with a newline.

http://stackoverflow.com/q/26319984
tagged with: api
has title: with Rally api v2.0, i am unable to access list of workspaces when i query subscription object
downvote count: 0
answer count: 1
tagged with: toolkit
has body: here is the code i am using to query for 'subscription' and then return a reference of the workspace i want to access: public static String query_for_workspace(String ws, RallyRestApi r) throws IOException{ String Wspace_ref=null; //Read Subscription QueryRequest subscriptionRequest = new QueryRequest("Subscriptions"); subscriptionRequest.setFetch(new Fetch("Name", "Workspaces")); QueryResponse subscriptionQueryResponse = r.query(subscriptionRequest); String subName = subscriptionQueryResponse.getResults().get(0).getAsJsonObject().get("Name").toString(); System.out.println("Read Subscription: " + subName); // Grab Workspaces Collection JsonArray myWorkspaces = subscriptionQueryResponse.getResults().get(0).getAsJsonObject().get("Workspaces").getAsJsonArray(); // iterates through all workspaces and fetch 'ref' (string attribute) of the useful workspace for (int i=0; i&lt;myWorkspaces.size(); i++) { JsonObject workspaceObject = myWorkspaces.get(i).getAsJsonObject(); String workspaceRef = workspaceObject.get("_ref").getAsString(); GetRequest workspaceRequest = new GetRequest(workspaceRef); workspaceRequest.setFetch(new Fetch("Name")); GetResponse workspaceResponse = r.get(workspaceRequest); JsonObject workspaceObj = workspaceResponse.getObject(); String workspaceName = workspaceObj.get("Name").getAsString(); if(workspaceName.equals(ws)){ System.out.printf("Workspace found ==&gt; %s\n", workspaceName); Wspace_ref=workspaceRef; } } return Wspace_ref; } The error comes from this line: JsonArray myWorkspaces=subscriptionQueryResponse.getResults().get(0).getAsJsonObject().get("Workspaces").getAsJsonArray(); This code is working with 1.x API. How do I access the list of workspaces in 2.x? Thank you!
favorite count: 0
has answer: http://stackoverflow.com/a/26339970
tagged with: wsapi
tagged with: rally
upvote count: 1
accepted answer: http://stackoverflow.com/a/26339970
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/97640681
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26245463
has text: @GianmarcoFerruzzi Better ask this as a separate question

http://stackoverflow.com/a/26263453
has comment: http://stackoverflow.com/comment/41202129
score: 1
has body: Capital YYYY is the format for something called the "week year". You want the lowercase yyyy for the actual year. DateFormat formatter = new SimpleDateFormat("EEE, MMM dd, yyyy 'at' K:mm a"); With this change I output the parsed date and get: Sat Nov 02 17:10:00 PDT 2013 (I'm in the Pacific time zone.)
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26263404
answers question: http://stackoverflow.com/q/26263404
type: Answer
downvote count: 0

http://stackoverflow.com/q/26288864
answer count: 1
has comment: http://stackoverflow.com/comment/41249115
has body: I am trying to set it up so that when i run the program a dialog window pops up and ask me to input the number of the exercise i want to run. each exercise will be in their own function and the only function that will run will be the one that is entered by the user. package exercises; import java.util.Scanner; import javax.swing.JOptionPane; public class Exercises { public static void main(String[] args) { String JOptionPaneTest = JOptionPane.showInputDialog("Run Exercise (1 - ): "); } public static void One (String[] args) { // Exercise 1: Write a program that reads an integer between 100 and 999, and finds the reverse of that integer. System.out.println("Running Exercise 1"); Scanner reader = new Scanner(System.in); System.out.println("Enter Random Number between 100 and 999: "); int num = reader.nextInt(); int digitOne = num % 10; int digitTwo = (num / 10) % 10; int digitThree = (num / 100); System.out.println(digitOne + "" + digitTwo + "" + digitThree); } }
type: UnansweredQuestion
tagged with: input
has title: run a function from an input window in java
has answer: http://stackoverflow.com/a/26288970
tagged with: netbeans
tagged with: java
type: Question
score: 0
tagged with: function

http://stackoverflow.com/a/26327718
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26327642
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26327642
type: AcceptedAnswer
has body: You need some kind of APIs on the server side. First learn about RESTful APIs and build your server accordingly. Decide a PHP framework to do this with ease. Next design your desktop application in JAVA which has Ability to connect to your APIs ( Give Credentials use OAuth2 or something.) Store data locally and Sync it whenever Internet Connectivity is available ( Resolve conflicts when syncing ) This will need lots of research and efforts. Happy Coding!

http://stackoverflow.com/q/26305458
answer count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/26305675
favorite count: 0
has body: I like many features of Play Framework 2 (I'm using it with Java) but, as a fan of Dependency Injection, I love also Spring and particularly, its way to inject configuration into objects by just using the @Value annotation. Therefore, I would love to know how to inject into an instance variable the value of a property using Play's built-in property resolution mechanism. Something like this: @Component public class SpringBeanWithinAPlay2Application { @Value("${application.timeout:10}") private int timeout; } Any clue anyone? Many thanks in advance.
tagged with: spring
tagged with: properties
type: AnsweredQuestion
tagged with: playframework-2.0
downvote count: 0
score: 1
tagged with: java
has title: Spring Property Injection with Play2 Framework
type: Question
accepted answer: http://stackoverflow.com/a/26305675

http://stackoverflow.com/comment/41254788
score: 1
type: Comment
type: QuestionComment
has text: None of the responses uses fall-through technique though.
comment on: http://stackoverflow.com/q/26292266

http://stackoverflow.com/comment/41116938
has text: You can even next other types, i.e. if you created an Address class and had that as a field in the class above, as long as you annotate properly and keep default constructors it will all work fine.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26214620

http://stackoverflow.com/comment/41317769
type: Comment
comment on: http://stackoverflow.com/a/26326331
type: AnswerComment
has text: So what you are saying is that each enum constant A,B,C get a copy of size. So java takes my code and converts it to something like (create an instance var for A, for B and so on). That means compiler is doing some behind the scene thing. I was looking for that behind the scene thing .
score: 0

http://stackoverflow.com/a/26218926
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26218722
has body: As functions have no proper existence in java, you would better give the executorService the Runnable (or even better the Callable) object containing the code to execute, with the method returning you the corresponding Future. In fact, believe it or not, this very method exists in ExecutorService : &lt;T&gt; Future&lt;T&gt; submit(Callable&lt;T&gt; task) The Future#get() method will allow you to wait until the result is obtained.
answers question: http://stackoverflow.com/q/26218722
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26319016
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26318931
has body: I do not know C#. However, in Java, if you have a map and you wish to collect a single object of a given type which is retrieval by type you might do the following: Map byType = new HashMap&lt;Class&lt;A&gt;, A&gt;(); void insertObject(Object v) { byType.put(v.getClass(), v); } Object getObject(Class c) { return byType.get(c); } Of course, you can only store a single object of a given type (class). If you want to store more than one object of a given type, you might want to use a muitimap. There are a number of libraries which include such a collection such as org.apache.commons.collections, google's guava (com.google.common.collect), etc. HTH -steve
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26318931
type: AcceptedAnswer

http://stackoverflow.com/a/32251607
score: 5
upvote count: 5
has body: You need to set the Maven scope to test for both the spring-test and junit dependencies. For example: org.springframework spring-test test junit junit test
accepted answer of: http://stackoverflow.com/q/26225836
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26225836

http://stackoverflow.com/q/26204274
has answer: http://stackoverflow.com/a/26204295
has title: Java garbage collection when there is no referencing object
has comment: http://stackoverflow.com/comment/41091761
has comment: http://stackoverflow.com/comment/41091937
has body: For example with the following code, class Dog { Dog parent; Dog (Dog parent) { this.parent = parent; } Dog makeDog (Dog dog) { return new Dog(new Dog(new Dog(dog))); } } public class test { public static void main(String[] args) { Dog dog = new Dog(null); dog = dog.makeDog(dog); Dog anotherDog = new Dog(dog); /* * many lines of code */ if (anotherDog.parent.parent.parent.parent.parent == null) { System.out.println("null"); } } } Is this program guaranteed to print null? Most of my programs are in C, and this is the way I build linked lists, trees, graphs et cetera. But I am really not sure how the Java garbage collector will deal with such code, so in the real program, I chose to store the references elsewhere so the GC can know that the objects are indeed not garbage. Any helps are welcome.
accepted answer: http://stackoverflow.com/a/26204295
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41093868
tagged with: garbage-collection
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41091980
type: Question

http://stackoverflow.com/comment/61003512
score: 0
type: Comment
has text: this has helped so many times now! thanks for your answer @Mister Smith
type: AnswerComment
comment on: http://stackoverflow.com/a/26713987

http://stackoverflow.com/q/26352981
has title: JDateChooser is not displaying any dates
has comment: http://stackoverflow.com/comment/41366291
linked to: http://stackoverflow.com/q/26323390
tagged with: plugins
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/41366087
score: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/41366144
has comment: http://stackoverflow.com/comment/41366501
type: Question
has comment: http://stackoverflow.com/comment/41365705
has comment: http://stackoverflow.com/comment/41366578
has comment: http://stackoverflow.com/comment/41365678
has body: I am using the below library JDateChooser, which is a Date Picker GUI which we can put into Netbeans pallet. http://plugins.netbeans.org/plugin/658/jdatechooser-1-2 However this do not display any dates. Dates are empty. Below is the image. I do not have to post the code here, because I did nothing other than dragging and dropping the GUI element. Can someone please tell me why this is happening?
has answer: http://stackoverflow.com/a/26353538
has answer: http://stackoverflow.com/a/28245603
has comment: http://stackoverflow.com/comment/41366124
has comment: http://stackoverflow.com/comment/41366251
accepted answer: http://stackoverflow.com/a/26353538
possible better answer: http://stackoverflow.com/a/28245603
answer count: 2
has comment: http://stackoverflow.com/comment/41366206
has comment: http://stackoverflow.com/comment/41365854
tagged with: user-interface
has comment: http://stackoverflow.com/comment/41366373

http://stackoverflow.com/q/26277335
has title: Eclipse build path for Java, packages aren't correct
has answer: http://stackoverflow.com/a/26277962
type: Question
tagged with: java
has body: I have an Android library project I am trying to add to my build path that contains source (not a compiled jar). I figured out how to go to Build Path -> Configure Build Path -> Link Source, and then choose my library folder. This correctly adds the folder to my Android project. However, the linked library has a "package" line at the top of each source file, and Eclipse does NOT like this, saying "The declared package does not match the expected package". The suggested fixes all involve modifying (to have the expected package declaration) or moving (to the declared package location) the library source files, which I do not think I want to do. I have ZERO experience with packages OR Android libraries. Is there something obvious I'm missing? If at all possible I want to use the libraries as is, without modifying the source. Moving them doesn't seem all that useful, either (since then git might try to commit them, although I suppose I could put the whole directory in .gitignore). What is the CORRECT way to fix this problem?
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26277413
accepted answer: http://stackoverflow.com/a/26277413
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26277962

http://stackoverflow.com/a/26242604
has body: First, you have to look for smallest time and get the position on that time in the array. You can implement something like this: min = ∞ min_position = 0 counter = 0 for each element in array if element &lt; min then min = element min_position = counter end if counter = counter + 1 end for Now you have the smallest time and the position off the time in the array. Now you only have to check which value corresponds to that position in the other array names[min_position] Tell me if you need help! Bye
answers question: http://stackoverflow.com/q/26242425
score: 0
type: Answer

http://stackoverflow.com/q/26204391
accepted answer: http://stackoverflow.com/a/26205153
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41093092
tagged with: java
has comment: http://stackoverflow.com/comment/41092182
has body: Within Java, is there anything that I can use out of box to decide the default paper size based on locale? I am building a web application and need to generate a PDF document. Its size can be letter, legal, A4, etc., depending on the locale. From the web application, I can get the visitor's locale info such as country, etc.
type: Question
score: 5
tagged with: locale
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/41092034
has comment: http://stackoverflow.com/comment/41092468
has title: Anything for deciding default paper size based on locale?
answer count: 1
has comment: http://stackoverflow.com/comment/41092568
favorite count: 0
has comment: http://stackoverflow.com/comment/41091998
has comment: http://stackoverflow.com/comment/41093238
has answer: http://stackoverflow.com/a/26205153

http://stackoverflow.com/q/26322494
tagged with: variable-assignment
has comment: http://stackoverflow.com/comment/41309915
has answer: http://stackoverflow.com/a/26322582
tagged with: c++
score: 0
has body: In java if you do Myobj one = new Myobj(); Myobj two = one; Then one and two are pointing to the same object. In C++ if I did: Myobj one = new Myobj(); Myobj *two = &amp;one; Is this essentially the same as the java example? Wherein modifying either one or two will effect both objects?
possible better answer: http://stackoverflow.com/a/26322575
has answer: http://stackoverflow.com/a/26322575
has comment: http://stackoverflow.com/comment/41309839
has comment: http://stackoverflow.com/comment/41309880
tagged with: java
has answer: http://stackoverflow.com/a/26322550
has comment: http://stackoverflow.com/comment/41309853
answer count: 4
has comment: http://stackoverflow.com/comment/41309867
has answer: http://stackoverflow.com/a/26322581
type: AnsweredQuestion
has title: Assignments are by reference?
has comment: http://stackoverflow.com/comment/41309886
type: Question
accepted answer: http://stackoverflow.com/a/26322550

http://stackoverflow.com/comment/98052343
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26339938
type: Comment
has text: @robbie70 the configuration has a slight difference. In my question the path is `configuration/resources/directory` while in the answer is `configuration/resources/resource/directory`

http://stackoverflow.com/comment/110083674
comment on: http://stackoverflow.com/q/26277572
has text: Do you mean in the DZone blog? Yes!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26232166
has comment: http://stackoverflow.com/comment/41144534
answers question: http://stackoverflow.com/q/26231788
score: 4
has comment: http://stackoverflow.com/comment/102664234
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/93903604
type: Answer
upvote count: 4
has body: There are actually some differences in the usage of floating point values in Java. But not what you observed: 0.15+0.15 is not 0.3 in both languages (since 0.15 is not 0.15 either). In general the differences are not located in the compiler, but in the way the runtime computations are done. In C++ it is obviously all platform dependent. And with respect to the compiler options some floating point units of the processor are used and so on... In Java there are two modes that can be used for floating point computations. The first is the default mode, that allows the JVM (since 1.2) to make use of a higher precision during computations. So if you add two float values (32 bit) for example, the intermediate results may be stored with 60 bit precision - but this is highly platform depended! That can make some differences. To avoid that, you can use the strictfp keyword on classes, interfaces and non-abstract methods. Then all intermediate results are truncated to the precision of the type you use (32 bit for float and 64 bit for double). If there is a benefit behind the Java-way of doing things I would be glad to hear it. The default way has no benefits and is often criticised. The usage of the strictfp keyword might have some benefits regarding to portability.
accepted answer of: http://stackoverflow.com/q/26231788

http://stackoverflow.com/comment/41114645
has text: Look through the stacktrace of the exception to see where it is coming from
score: 4
comment on: http://stackoverflow.com/q/26216512
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41125524
type: QuestionComment
has text: `"1" == "1"` will always return false.
comment on: http://stackoverflow.com/q/26221990
score: 0
type: Comment

http://stackoverflow.com/q/26236039
tagged with: dbunit
type: AnsweredQuestion
tagged with: spring-boot
upvote count: 5
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26298663
has body: If I run dbunit with the following setup and request data via HTTP in an integration test, I didn't get any data because the database is empty. DBUnit writes data to the database, but it's empty when I request the data via HTTP. This is my setup: Spring Boot 1.1.7 with spring-boot-starter-web (exclude tomcat), spring-boot-starter-jetty, spring-boot-starter-data-jpa, spring-boot-starter-test, liquibase-core, dbunit 2.5.0, spring-test-dbunit 1.1.0 Main Application Class: @Configuration @ComponentScan @EnableAutoConfiguration @RestController @EnableTransactionManagement @EnableJpaRepositories Test configuration (application-test.yaml): logging.level.org.springframework: DEBUG logging.level.org.dbunit: DEBUG spring.jpa.properties.hibernate.hbm2ddl.auto: update spring.jpa.database: h2 spring.jpa.show-sql: true // setting these properties to access the database via h2 console spring.datasource.url: jdbc:h2:tcp://localhost/mem:my_db;DB_CLOSE_DELAY=-1;MVCC=true;DB_CLOSE_ON_EXIT=FALSE spring.datasource.username: sa spring.datasource.password: sa spring.datasource.driverClassName: org.h2.Driver spring.jpa.database-platform: org.hibernate.dialect.H2Dialect liquibase.change-log: classpath:/db/changelog/db-master.xml Integration test: @ActiveProfiles("test") @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = HDImageService.class) @TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, DbUnitTestExecutionListener.class }) @WebAppConfiguration @IntegrationTest("server.port:0") @DatabaseSetup("/database_seed.xml") @DatabaseTearDown(value = "/database_tear_down.xml", type = DatabaseOperation.DELETE_ALL) // test @Test public void get_works() throws Exception { // given String url = host + port + "/my-resource/1"; // when ResponseEntity&lt;String&gt; response = template.getForEntity(url, String.class); // then assertThat(response.getStatusCode(), is(HttpStatus.OK)); } I could post everything else here, like the entities, repository, con…
answer count: 1
downvote count: 0
has title: DBUnit and Spring Boot - Data may not be imported or existing when requesting in an integration test
favorite count: 0
score: 5
tagged with: spring
has answer: http://stackoverflow.com/a/26298663
tagged with: spring-data

http://stackoverflow.com/comment/41186746
comment on: http://stackoverflow.com/q/26255464
has text: Why 22? Why not 0? Do you want the index of the last occurrence?
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/26311678
has answer: http://stackoverflow.com/a/26335204
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 3
has title: How to create certificate pfx file in java?
tagged with: java
tagged with: certificate
has body: I need to create certificate pfx file with password in java. I search in google and can create certificate "cer" file in http://www.java2s.com/Tutorial/Java/0490__Security/CreatingaSelfSignedVersion3Certificate.htm I add code in main FileOutputStream fos = null; fos = new FileOutputStream("public.cer"); fos.write(cert.getEncoded()); fos.close(); this only work without password.
type: Question
tagged with: pfx
tagged with: security
upvote count: 3

http://stackoverflow.com/comment/41125819
has text: `portionIndex <= portionPhrase` doesn't make much sense when the type of `portionPhrase` is `String`... (The code would also be easier to read if you declared the variables at the point of their first use.)
comment on: http://stackoverflow.com/q/26222155
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26462901
downvote count: 0
answers question: http://stackoverflow.com/q/26258313
score: 1
type: Answer
has body: You are getting this because you have that line in the for loop. So the line will be executed for each iteration. To solve this, you have to first authenticate and then loop the results. Hope it helps! Keep on coding Ares.
upvote count: 1

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/26231046
tags question: http://stackoverflow.com/q/26303062
tags question: http://stackoverflow.com/q/26283138
tags question: http://stackoverflow.com/q/26290043
tags question: http://stackoverflow.com/q/26217283
tags question: http://stackoverflow.com/q/26239445
type: Tag
tags question: http://stackoverflow.com/q/26281171
tags question: http://stackoverflow.com/q/26347873
tags question: http://stackoverflow.com/q/26299026

http://stackoverflow.com/comment/41513278
comment on: http://stackoverflow.com/a/26288583
type: Comment
has text: @user3709877 Apply a [desired time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) such as "America/Los_Angeles" as seen in 2nd line calling `withZone` in last example above (recommended). Or learn about the [`withOffsetParsed`](http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormatter.html#withOffsetParsed()) method if you are sure you want to adjust away the offset (may be tempting, but probably not the best approach).
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41285428
score: 0
type: Comment
type: QuestionComment
has text: What is going wrong?
comment on: http://stackoverflow.com/q/26308895

http://stackoverflow.com/q/26292731
downvote count: 0
tagged with: java
has title: firebase android class-based updates not respecting case of the field names
type: Question
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/26298046
accepted answer: http://stackoverflow.com/a/26298046
has body: I have the following class declared (note the case choice): public class User{ private String DisplayName; private Boolean Proxy = false; @SuppressWarnings("unused") public User(){ } public User(String DisplayName, Boolean Proxy) { this.DisplayName = DisplayName; this.Proxy = Proxy; } public String getDisplayName() { return DisplayName; } public void setDisplayName(String DisplayName) { this.DisplayName = DisplayName; } public Boolean getProxy() { return Proxy; } } I then call: ref.child("People/123").setValue(userList); where userList is an instance of ArrayList&lt;User&gt; However the nodes created do not respect the capitalization as I would imagine it to do. They create displayName and proxy instead of the expected DisplayName and Proxy to match the declaration. Is this expected behavior? Is there a way to make it such that it does respect the field name?
favorite count: 0
tagged with: android
tagged with: firebase
score: 2
type: AnsweredQuestion

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/26324862
tags question: http://stackoverflow.com/q/26283966
tag name: osx-mavericks

http://stackoverflow.com/comment/41389204
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26307895
has text: I have raised an issue regarding this in BitBucket: https://bitbucket.org/mstrobel/procyon/issue/214/java-8-decompiled-class-is-not-matching Thanks @Mike Strobel for your answer.

http://stackoverflow.com/q/26210775
has comment: http://stackoverflow.com/comment/49181753
score: 0
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: jsoup
has body: Can anyone tell me how to parse the following response from the server using JSOUP Set-Cookie: PHPSESSID=osfveluimtjhkctqs34gsdafu5; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: boot[uid]=nwbh%2FtiM4p05%2BMPASufbYLa8tKwkDbZenBreisH2Vd0%3D; expires=Mon, 03-Nov-2014 11:48:03 GMT; path=/ Set-Cookie: PHPSESSID=sm44686g967qf4e21mogbjucf6; path=/ Set-Cookie: PHPSESSID=04h16usgeatii00gt85rdgbup1; path=/ Here im getting cookies "PHPSESSID" 3 times . when im trying to parse Connection.Response doc = Jsoup.connect("///")......execute(); System.out.println(doc.cookie("PHPSESSID")); System.out.println(doc.cookies()); either way i was not able to get all those cookies plz help me ...
has comment: http://stackoverflow.com/comment/49103100
has title: How to parse multiple cookies with same using Jsoup

http://stackoverflow.com/q/26283966
has comment: http://stackoverflow.com/comment/41239792
has comment: http://stackoverflow.com/comment/41239824
downvote count: 0
answer count: 1
favorite count: 0
tagged with: macos
has title: specified JRE installation does not exist (MacOSX)
linked to: http://stackoverflow.com/q/11170263
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41239762
has comment: http://stackoverflow.com/comment/41239595
has comment: http://stackoverflow.com/comment/41240832
has body: I'm aware of these nice answers to the previous SO question: specified JRE installation does not exist However, I can't see how to make use of any of the answers. I've installed the Java JDK, Maven, Ant, Android SDK bundled with Eclipse, and am using Mac OS X Mavericks 10.9.5. Is this as simple as setting the JAVA_HOME variable? If so, how do know what to set it to? I'm brand new to Java so sorry for the noob question. Tims-MacBook-Pro-retina:Github timrpeterson$ java -version java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode) Tims-MacBook-Pro-retina:Github timrpeterson$ javac -version javac 1.8.0_20
has comment: http://stackoverflow.com/comment/41240177
has comment: http://stackoverflow.com/comment/41239868
tagged with: osx-mavericks
tagged with: java
tagged with: adt
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41240553
type: Question
has comment: http://stackoverflow.com/comment/41240148
score: 2
has answer: http://stackoverflow.com/a/26284495

http://stackoverflow.com/q/26303673
has answer: http://stackoverflow.com/a/26304262
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jpa
tagged with: jpql
score: 0
has body: I was discussing with someone about comparisons in JPQL, I gave him this link, http://www.objectdb.com/java/jpa/query/jpql/comparison, I think that ObjectDB uses the normal JPQL and so it sufficed the question. But someone told me that it is ObjectDB's JPQL so it is not useful, to a degree. Is this true because it doesn't seem that way in the link.
has title: Is ObjectDB JPQL different from normal JPQL
answer count: 1
tagged with: objectdb
accepted answer: http://stackoverflow.com/a/26304262

http://stackoverflow.com/q/26198061
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26198087
has title: Preventing crashes if adding an item to a location that doesn't exists in a 2D array
tagged with: arrays
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26198082
answer count: 3
possible better answer: http://stackoverflow.com/a/26198082
has body: My code: public class MultiArr { private int row; private int col; private int MultiA[][]; public MultiArr(int row, int col) { this.row = row; this.col = col; MultiA = new int[row][col]; } public void setItem(int row, int col, int item) { if (row &gt; MultiA.length || col &gt; MultiA.length) { System.out.println("out of bound"); } else { MultiA[row][col] = item; } } public int getItem(int row, int col) { return MultiA[row][col]; } public int getLength() { return MultiA.length; } public static void main(String[] args) { MultiArr test = new MultiArr(1,2); test.setItem(1,0,1); //System.out.println(test.getItem(0,0)); //System.out.println(test.getLength()); } } So I create this class to create a 2d array of ints (for testing purposes) and it works for the most part but the problem I'm facing is when you try to add an item to a location which doesnt exists, for examples: Suppose you say: MultiArr test = new MultiArr(2,2); This creates: _01_ 0 |XX 1 |XX And now suppose you want to set the value 1 at postion (0, 1): test.setItem(0,1,1); This works, but however when you try to put in a position that doesnt exist it will crash, for example: test.setItem(3,2,1); Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at mazegame.MultiArr.setItem(MultiArr.java:19) at mazegame.MultiArr.main(MultiArr.java:33) To solve this what I did was well if you put in a number for row and its higher then the number of row you created or if you put in a number for column and its higher than the number you put when you created the array than it should crash, so for this I put and if-else to take care of that situation. But then theres a another problem and thats if you end up with like multiple rows and 1 column Example: MultiArr test = new MultiArr(1,2); _0 1 0 |X X test.setItem(1,0,1); This now crashed because that location doesnt exists and so it skips the if-else that I put to try to prevent the previous error. I have been stuck of this for a while now and I was wondering i…
has answer: http://stackoverflow.com/a/26198087
upvote count: 1
has answer: http://stackoverflow.com/a/26198090

http://stackoverflow.com/a/26257938
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26257866
type: Answer
has body: run java script code on client side to get current time var d = new Date(); while saving the booking entries , you can get the current time of user machine and save it in a variable. If booking is successful then save that time. steps: fetch booking details and current time of client save booking when booking is successful then save client time if server and client are on different locations
has comment: http://stackoverflow.com/comment/41216240
answers question: http://stackoverflow.com/q/26257866
has comment: http://stackoverflow.com/comment/41194188
has comment: http://stackoverflow.com/comment/41232164
upvote count: 1
downvote count: 1
score: 0

http://stackoverflow.com/comment/93542697
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26324689
type: AnswerComment
has text: Hey Mureinik, Yuval suppose to use if (!rs.isBeforeFirst()) to check whether the result set it empty or not. If it is not empty then he can proceed further and consume the result set.

http://stackoverflow.com/comment/41194930
has text: look at the java String methods. They have stripping and such
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26259882

http://stackoverflow.com/comment/41146041
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26233227
has text: i've update the question body :

jpa
tags question: http://stackoverflow.com/q/26231817
tags question: http://stackoverflow.com/q/26279045
tags question: http://stackoverflow.com/q/26291143
tags question: http://stackoverflow.com/q/26244510
tags question: http://stackoverflow.com/q/26205076
tags question: http://stackoverflow.com/q/26265950
tags question: http://stackoverflow.com/q/26254375
tags question: http://stackoverflow.com/q/26299835
tags question: http://stackoverflow.com/q/26327165
tags question: http://stackoverflow.com/q/26265539
tags question: http://stackoverflow.com/q/26283850
tags question: http://stackoverflow.com/q/26268464
tags question: http://stackoverflow.com/q/26336419
tags question: http://stackoverflow.com/q/26333044
tags question: http://stackoverflow.com/q/26308035
tags question: http://stackoverflow.com/q/26254630
tags question: http://stackoverflow.com/q/26318368
tags question: http://stackoverflow.com/q/26334994
tags question: http://stackoverflow.com/q/26252483
tags question: http://stackoverflow.com/q/26266384
tags question: http://stackoverflow.com/q/26218362
tags question: http://stackoverflow.com/q/26311208
tags question: http://stackoverflow.com/q/26296252
tags question: http://stackoverflow.com/q/26346275
tags question: http://stackoverflow.com/q/26268241
tags question: http://stackoverflow.com/q/26328187
tags question: http://stackoverflow.com/q/26346955
tags question: http://stackoverflow.com/q/26220876
tags question: http://stackoverflow.com/q/26200324
tags question: http://stackoverflow.com/q/26289256
tags question: http://stackoverflow.com/q/26283195
tags question: http://stackoverflow.com/q/26316238
tags question: http://stackoverflow.com/q/26237855
tags question: http://stackoverflow.com/q/26341084
tags question: http://stackoverflow.com/q/26312238
tags question: http://stackoverflow.com/q/26261324
tags question: http://stackoverflow.com/q/26231947
tags question: http://stackoverflow.com/q/26286135
tags question: http://stackoverflow.com/q/26206261
tags question: http://stackoverflow.com/q/26254142
tags question: http://stackoverflow.com/q/26340132
tags question: http://stackoverflow.com/q/26256280
tags question: http://stackoverflow.com/q/26246368
type: Tag
tags question: http://stackoverflow.com/q/26272767
tags question: http://stackoverflow.com/q/26300982
tags question: http://stackoverflow.com/q/26271980
tags question: http://stackoverflow.com/q/26273993
tags question: http://stackoverflow.com/q/26250994
tags question: http://stackoverflow.com/q/26280772
tags question: http://stackoverflow.com/q/26213429
tags question: http://stackoverflow.com/q/26335921
tags question: http://stackoverflow.com/q/26317535
tags question: http://stackoverflow.com/q/26258417
tags question: http://stackoverflow.com/q/26272009
tags question: http://stackoverflow.com/q/26252522
tags question: http://stackoverflow.com/q/26287242
tags question: http://stackoverflow.com/q/26277702
tags question: http://stackoverflow.com/q/26347613
tags question: http://stackoverflow.com/q/26195962
tags question: http://stackoverflow.com/q/26309641
tags question: http://stackoverflow.com/q/26302864
tags question: http://stackoverflow.com/q/26264414
tags question: http://stackoverflow.com/q/26305168
tags question: http://stackoverflow.com/q/26219099
tags question: http://stackoverflow.com/q/26288936
tags question: http://stackoverflow.com/q/26253229
tags question: http://stackoverflow.com/q/26283306
tag name: jpa
tags question: http://stackoverflow.com/q/26329901
tags question: http://stackoverflow.com/q/26281995
tags question: http://stackoverflow.com/q/26242402
tags question: http://stackoverflow.com/q/26261905
tags question: http://stackoverflow.com/q/26282814
tags question: http://stackoverflow.com/q/26245488
tags question: http://stackoverflow.com/q/26279029
tags question: http://stackoverflow.com/q/26317689
tags question: http://stackoverflow.com/q/26303673
tags question: http://stackoverflow.com/q/26312272
tags question: http://stackoverflow.com/q/26257628

http://stackoverflow.com/a/26346454
type: Answer
answers question: http://stackoverflow.com/q/26346366
has body: I would recommend getting the remainder when dividing by 10. Use (%) instead of (/). That will return 198 for 1980-1989, so then just multiply by 10.
score: 0

http://stackoverflow.com/comment/41305166
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26319688
has text: See edit to answer please.

http://stackoverflow.com/a/26208032
accepted answer of: http://stackoverflow.com/q/26207966
has body: Both of your methods toString() and iterator() are instance methods within the DropOutStackArray&lt;T&gt; class. So, you should change the following - Iterator&lt;T&gt; itr = this.cstack.iterator(); to Iterator&lt;T&gt; itr = this.iterator();
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26207966
upvote count: 2

http://stackoverflow.com/comment/41141402
score: 1
type: Comment
type: QuestionComment
has text: It is an [instance initialization block](http://stackoverflow.com/questions/3987428/what-is-an-initialization-block) ([more at Oracle](http://docs.oracle.com/javase/tutorial/java/javaOO/initial.html)).
comment on: http://stackoverflow.com/q/26230456

http://stackoverflow.com/comment/41221604
comment on: http://stackoverflow.com/q/26251423
score: 0
type: Comment
type: QuestionComment
has text: Thanks @MikelUrkia for the reply! Here is Quick Example: I want to get distinct strings out of a JavaRDD and give them unique number(autoIncrement). Suppose my JavaRDD contains strings as: "abc","abc","def","pqr","abc","abc","def","pqr" I want output as : 1,"abc" 2,"def" 3,"pqr" Could you please help? Thanks, ~Kedar

http://stackoverflow.com/q/26323447
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41313327
favorite count: 0
has answer: http://stackoverflow.com/a/26332563
has comment: http://stackoverflow.com/comment/41313294
tagged with: android
has body: I'm trying to code my a Barcode Scanner, using the ZXing Library. When I'm starting my App everything is OK. After pressing the Scan Button, I'm getting an Pop-Up: "BarCodeScanner has stopped." Logcat: 10-12 10:51:57.674: I/PersonaManager(13977): getPersonaService() name persona_policy 10-12 10:51:57.824: I/Adreno-EGL(13977): <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_KK_2.7_RB1.04.04.02.007.050_msm8960_refs/tags/AU_LINUX_ANDROID_KK_2.7_RB1.04.04.02.007.050__release_AU () 10-12 10:51:57.824: I/Adreno-EGL(13977): OpenGL ES Shader Compiler Version: 17.01.12.SPL 10-12 10:51:57.824: I/Adreno-EGL(13977): Build Date: 03/28/14 Fri 10-12 10:51:57.824: I/Adreno-EGL(13977): Local Branch: 10-12 10:51:57.824: I/Adreno-EGL(13977): Remote Branch: refs/tags/AU_LINUX_ANDROID_KK_2.7_RB1.04.04.02.007.050 10-12 10:51:57.824: I/Adreno-EGL(13977): Local Patches: NONE 10-12 10:51:57.824: I/Adreno-EGL(13977): Reconstruct Branch: NOTHING 10-12 10:51:57.864: D/OpenGLRenderer(13977): Enabling debug mode 0 10-12 10:52:01.308: D/AndroidRuntime(13977): Shutting down VM 10-12 10:52:01.318: W/dalvikvm(13977): threadid=1: thread exiting with uncaught exception (group=0x418e9da0) 10-12 10:52:01.318: E/AndroidRuntime(13977): FATAL EXCEPTION: main 10-12 10:52:01.318: E/AndroidRuntime(13977): Process: com.example, PID: 13977 10-12 10:52:01.318: E/AndroidRuntime(13977): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassNotFoundException: Didn't find class "com.google.zxing.client.android.CaptureActivity" on path: DexPathList[[zip file "/data/app/com.example-8.apk"],nativeLibraryDirectories=[/data/app-lib/com.example-8, /vendor/lib, /system/lib]] 10-12 10:52:01.318: E/AndroidRuntime(13977): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305) 10-12 10:52:01.318: E/AndroidRuntime(13977): at android.app.ActivityThread.handleLaunchActivity(ActivityThread…
has comment: http://stackoverflow.com/comment/41311716
upvote count: 1
tagged with: zxing
accepted answer: http://stackoverflow.com/a/26332563
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41313547
score: 1
has title: BarCodeScanner has stopped
tagged with: java
tagged with: adt
type: Question

http://stackoverflow.com/comment/41228138
comment on: http://stackoverflow.com/q/26262806
type: QuestionComment
has text: Can you give me an example? Do you mean to use a horizontalScrollView? Should I include the viewpager inside the parent layout above the buttons?
type: Comment
score: 0

http://stackoverflow.com/q/26300907
has answer: http://stackoverflow.com/a/26300971
type: AnsweredQuestion
has body: So, I'm currently developing an app for a service which has a json-based (unfortunately) read only API. Retrieving content is no problem at all, however the only way to post content is using a form on their site which location is a PHP script. The service is open source so I know which fields the form expects, but whatever I send, it always results in a BAD REQUEST. I captured the network traffic inside my browser and as far as I can see, the browser constructs a multipart form request, however when I copy the request and invoke it again using a REST client, a BAD REQUEST gets returned. Is there a way to construct a http request in Android that simulates a form post?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Simulate form post using http client in Android app?
tagged with: http
type: Question
accepted answer: http://stackoverflow.com/a/26300971
score: 0
answer count: 1
tagged with: rest
tagged with: android

http://stackoverflow.com/q/26304587
has comment: http://stackoverflow.com/comment/41359942
has answer: http://stackoverflow.com/a/26304880
answer count: 3
tagged with: arrays
has title: Alternate positive and negative numbers in an array
has body: Given an array of positive and negative numbers(no zeroes), I have to arrange them in such a way that the positive and negative numbers should be arranged consecutively. The number of positive and negative numbers may not be equal i.e. if there is no positive number(or negative) left, then all the remaining negative numbers(or positive) are appended to the end of the array. The order is important i.e.if input array is {2,-1,-3,-7,-8, 9, 5,-5,-7},then the output array should be {2,-1, 9,-3, 5,-7,-8,-5,-7}. The code is done in O(n) without using another array. Here is my solution in java, I test it again several case and it works. However, I'm not sure if this run in O(n) time. Basically, I count the number of positive and negative number first. then I have two index i = 0 and j =1. j is always 1 step ahead i. From there I keep checking if the number in i is positive and j is negative, if it isn't, i will iterate through the array until I find the next positive/negative for the correct position and move it to the correct position. Any suggestion is much appreciated. Thanks! //array of negative and positive, arrange them so that positive number follow by negative // if no pos or neg left, the rest append to the array. //should be O(n) no additional array public static void alter(int[] a) { int pos = 0; int neg = 0; int index = 0; while (c &lt; a.length) { if (a[index] &gt; 0) { pos++; } else neg++; index++; } int i = 0; int j = 1; int temp = 0; //run until no more positive number or negative number while (pos &gt; 0 &amp;&amp; neg &gt; 0) { // if (a[i] &gt; 0) { pos--; if (a[j] &lt; 0) { i += 2; j += 2; neg--; } else // a[j] &gt; 0 { while (a[j] &gt; 0) { j++; } //a[j] &lt; 0 neg--; //move that number to the appropriate place while (j &gt; i) { temp = a[j]; a[j] = a[j - 1]; a[j - 1] = temp; j--; } // end while i += 2; j += 2; } } else // a[i] &lt; 0 { while (a[i] &lt; 0) { i++; } //a[i] &gt; 0 //move that number to the appropriate place while (i &gt; (j - 1)) { temp = …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41278191
has answer: http://stackoverflow.com/a/48388224
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26305340
type: Question

http://stackoverflow.com/q/26327488
linked to: http://stackoverflow.com/q/7181534
has comment: http://stackoverflow.com/comment/41319288
has body: Can anyone refer me to a single, simple resource explaining how to in Java make an HTTP POST with JSON object as data? I want to be able to do this without using Apache HTTP Client. The following is what I've done so far. I am trying to figure out how to modify it with JSON. public class HTTPPostRequestWithSocket { public void sendRequest(){ try { String params = URLEncoder.encode("param1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8"); params += "&amp;" + URLEncoder.encode("param2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8"); String hostname = "nameofthewebsite.com"; int port = 80; InetAddress addr = InetAddress.getByName(hostname); Socket socket = new Socket(addr, port); String path = "/nameofapp"; // Send headers BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF8")); wr.write("POST "+path+" HTTP/1.0rn"); wr.write("Content-Length: "+params.length()+"rn"); wr.write("Content-Type: application/x-www-form-urlencodedrn"); wr.write("rn"); // Send parameters wr.write(params); wr.flush(); // Get response BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream())); String line; while ((line = rd.readLine()) != null) { System.out.println(line); } wr.close(); rd.close(); socket.close();//Should this be closed at this point? }catch (Exception e) {e.printStackTrace();} } }
has comment: http://stackoverflow.com/comment/41319060
has title: How to Make an HTTP POST with JSON object as data?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41319380
score: 0
has comment: http://stackoverflow.com/comment/41349403
has answer: http://stackoverflow.com/a/26327793
has comment: http://stackoverflow.com/comment/41319354
type: Question
has comment: http://stackoverflow.com/comment/41319237
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41319201
tagged with: post
answer count: 1

http://stackoverflow.com/q/26220316
favorite count: 0
has comment: http://stackoverflow.com/comment/41122206
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13744450
linked to: http://stackoverflow.com/q/2348416
downvote count: 1
has answer: http://stackoverflow.com/a/26220696
has comment: http://stackoverflow.com/comment/41122242
duplicate of: http://stackoverflow.com/q/2348416
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/41123002
upvote count: 0
tagged with: communication
tagged with: database
has title: Tracking database records consistently for change
has body: I have a very basic communication software that uses database to save messages entered by PC1 and PC2 uses the same database to read these messages and vice versa. My problem is, I need a technique so that I can keep checking the database for new messages. Or I need something that invokes a method to download the message when new record is inserted in the database. At the moment I use a timer which checks the DB every minute regardless of a new record being inserted. I'm looking for a more efficient way to perform the same task. Any suggestion is welcome. Thank you
answer count: 1

http://stackoverflow.com/a/26219607
has comment: http://stackoverflow.com/comment/41146301
type: Answer
has comment: http://stackoverflow.com/comment/41138979
has comment: http://stackoverflow.com/comment/41139975
downvote count: 0
score: 1
has body: I would follow this approach: attach a MouseMoveListener to the Tree determine which TreeItem the mouse pointer is over with Tree.getItem(Point). For a multi-column tree, getItem() will only return an item if the mouse position is within the first column. Either create the tree with the SWT.FULL_SELECTION style flag, or use a workaround like this to detmine the item: TreeItem item = tree.getItem(new Point(event.x, event.y)); int x = 0; while (item == null) { item = tree.getItem(new Point(x, event.y)); x += 5; } It might be necessary to add a further condition (e.g. x &lt; tree.getBounds().x) to prevent an endless loop, if no item can be found. once you have the TreeItem, you can obtain the element that it shows with TreeItem::getData. Be aware that this is an implementation detail of the TreeViewer - but I am not aware that there is another way to obtain the element for a given TreeItem.
upvote count: 1
answers question: http://stackoverflow.com/q/26217339

http://stackoverflow.com/q/26314978
has comment: http://stackoverflow.com/comment/41296075
upvote count: 2
has comment: http://stackoverflow.com/comment/41296197
answer count: 1
favorite count: 0
has body: In the image format have full of the text. (ie) the scanned document in the format of image file *.tiff. Optical character recognize method only the Normal format of alphabet. In this image format contains the text like running letter. so how to identify and convert the text in to text files?
type: UnansweredQuestion
tagged with: ocr
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41295946
type: Question
has title: How to idendify the Text in image files and also how to read that text?
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/26315029

http://stackoverflow.com/comment/94430178
type: Comment
type: AnswerComment
has text: The trouble is, it often doesn't improve the API, despite the best intentions of the developer. I have been collection examples of [bad usages of Optional](https://github.com/SwingGuy1024/Blog/blob/master/Bad%20Uses%20of%20Optional.md), all taken from production code, which you can check out.
score: 4
comment on: http://stackoverflow.com/a/26328314

http://stackoverflow.com/a/26215441
type: Answer
answers question: http://stackoverflow.com/q/26215075
has comment: http://stackoverflow.com/comment/41121708
score: 2
downvote count: 0
has body: I think this is a good language-lawyering case. The first statement says that Every CONSTANT_Class_info entry in the constant_pool table which represents a class or interface C that is not a package member must have exactly one corresponding entry in the classes array. However, it doesn't say that a top-level class is not allowed to have an entry in the classes array. Now why it would have an entry there, I don't know. Perhaps it is for future extensibility. But the spec allows it and it will be ignored by implementations because it's not really an inner/member class. So the statements are not technically contradictory.
has comment: http://stackoverflow.com/comment/41115568
has comment: http://stackoverflow.com/comment/41120541
upvote count: 2

http://stackoverflow.com/q/26313789
downvote count: 0
tagged with: mergesort
has comment: http://stackoverflow.com/comment/41294759
has title: MergeSort, Java Code not working?
favorite count: 0
has answer: http://stackoverflow.com/a/26314457
has body: The Merging function: static int[] merge(int v[], int start, int middle, int end){ int i = start, temp, j = middle, k = 0; int a[] = new int[end]; while(j &lt; end &amp;&amp; i &lt; middle){ if(v[i] &gt; v[j]){ a[k++] = v[j++]; } else{ a[k++] = v[i++]; } } for(temp = i; temp &lt; middle; temp++){ a[k++] = v[temp]; } for(temp = j; temp &lt; end; temp++){ a[k++] = v[temp]; } for(i = 0; i &lt; end; i++) v[i] = a[i]; return v; } The Splitting Function: static int[] split(int v[], int start, int end){ int array[] = new int[end-start+1]; for(int i = start, j = 0; i &lt;= end; i++, j++){ array[j] = v[i]; } return array; } The MergeSort Function: static int[] mergesort(int v[], int start, int end) { int middle = v.length/2, left, right; if(end-start &lt;= 1){ return v; } mergesort(split(v, start, middle), start, middle); mergesort(split(v, middle+1, end-1), middle+1, end-1); merge(v, start, middle, end); return v; } The Main function: public static void main(String[] args){ int v[] = {6,1,8,2,9,3}; int end = 6, i; v = mergesort(v, 0, end); for(i = 0; i &lt; end; i++){ System.out.print(v[i]+" "); } System.out.println(); } The output given is 2 6 1 8 9 3 and should be 1 2 3 6 8 9 I'm pretty sure it's here: mergesort(split(v, start, middle), start, middle); mergesort(split(v, middle+1, end-1), middle+1, end-1); merge(v, start, middle, end); these functions return an array but what can i assign it to ?
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26351347
has comment: http://stackoverflow.com/comment/41294778
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41293820
type: Question
answer count: 2

http://stackoverflow.com/q/26279841
tagged with: http://stackoverflow.com/tag/json
has title: Send Json object by Jquery load
score: 0
has answer: http://stackoverflow.com/a/26280143
answer count: 1
tagged with: jquery
has body: I´m trying to send an json object to my Spring MVC Controller using JQuery load. If I do with POST as is described here How to pass Json object from ajax to spring mvc controller? I can make it works. But If I try with load, since I cannot specify the content-type, my controller cannot serialize the object since the format is application-www. Any idea how to specify in a load the content type?. Regards.
has comment: http://stackoverflow.com/comment/41232436
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20245544
has comment: http://stackoverflow.com/comment/41231643
tagged with: spring
tagged with: java
type: Question

http://stackoverflow.com/comment/41141551
type: QuestionComment
comment on: http://stackoverflow.com/q/26216088
has text: Yes, copy pasted in the lib folder with eclipse :P
score: 0
type: Comment

http://stackoverflow.com/comment/93560699
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27223978
type: Comment
has text: perfect, this answer taught me a new thing, i can now handle exceptions

http://stackoverflow.com/a/26591188
answers question: http://stackoverflow.com/q/26205584
score: 0
type: Answer
has body: The main benefit for me in using ThreadPools comes from structuring the work in single, independent and usually short jobs and better abstraction of threads in a ThreadPools private Workers. Sometimes you may want more direct access to those, to find out if they are still running etc. But there are usually better, job-centric ways to do that. As for handling failures, you may want to submit your own ThreadFactory to create threads with a custom UncaughtExceptionHandler and in general, your Runnable jobs should provide good exception handling, too, in order to log more information about the specific job that failed. Make those jobs non-blocking, since you don't want to fill up your ThreadPool with blocked workers. Move blocking operations before the job is queued. Normally, shutdown and shutdownNow as provided by ExecutorServices, combined with proper interrupt handling in your jobs will allow for smooth job termination.

http://stackoverflow.com/q/26256374
has body: One part of my app has 6 different inputs, where each input has 5 different possible values. This works out to 15,625 permutations. I'd like to believe that I don't have to code out every single one, but I'm really unsure. I've started coding it as if I have to code out every single one, but it got me thinking that there must be a better way. So I've come here to see if any more experienced coders know of a better way to do this. Is there any other way? Other than having to code out every single permutation? Equation Explanation: There are 6 limbs (inputs). Each input depends on its percentage of leftover health. These dependencies (expressed as a percentage) are less than or equal to 0, greater than 0 and less than or equal to 25, greater than 25 and less than or equal to 50, greater than 50 and less than or equal to 75, and greater than 75. Each permutation will more often than not result in a different output. This output is displayed within the app for the user to use. [EDITS] This is not a damage calculation. These are penalties applied to player stats based upon how much damage they've taken. The expected results either don't affect their stats or reduce their stats. Occasionally, the number subtracted is the same for different variables. If you look at the code below, you'll see that the number is the same for head &gt; 0.0 &amp;&amp; head &lt;= 0.25 and chest &gt; 0.0 &amp;&amp; chest &lt;= 0.25, as well as chest &gt; 0.25 &amp;&amp; chest &lt;= 0.50 and leftarm &gt; 0.25 &amp;&amp; leftarm &lt;= 0.50 and rgitharm &gt; 0.25 &amp;&amp; rightarm &lt;= 0.50 [EDITS] I'll reply to the comments here: @Frank N. Stein: Oops. Thanks for the correction :) @aioobe: I've edited the equation explanation to hopefully clarify the expected outcomes. @ian: Those values cannot be worked out as they're percentages. I would never be able to work them out. @Marco13: It seems that way simply because I haven't finished coding every permutation out yet. On second thought, I don't t…
has comment: http://stackoverflow.com/comment/41190691
has comment: http://stackoverflow.com/comment/41188829
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26264475
has answer: http://stackoverflow.com/a/26256622
has comment: http://stackoverflow.com/comment/41188495
has comment: http://stackoverflow.com/comment/41188528
tagged with: permutation
favorite count: 0
upvote count: 3
type: UnansweredQuestion
has title: mathematical permutation code?
has comment: http://stackoverflow.com/comment/41190450
score: 3
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/41233149

http://stackoverflow.com/a/58610551
score: 0
answers question: http://stackoverflow.com/q/26229139
type: Answer
has body: you can solve this problem like this #set ($result = $number.format('#,##0.00', "10000.5")) $result The result will be 10,000.50

http://stackoverflow.com/a/26254162
has body: While this question has already been answered; it rather tickled-my-fancy when I saw it at school and after arriving home today I started my own implementation. Thought I would share it here as it may be useful to you. In case you are wondering, I appended everything to StringBuilder's as to avoid a potential error of the System.out printstream being used by other processes and mucking up the art. Hence just print everything at once. /** * Created by Thomas on 08/10/2014 at 4:53 PM. * * @author Thomas * @since X.X.X */ public class CharacterArt { /** * Makes a triangle with astrix's along the center, and slashes on the sides. * * @param height The height of the triangle, total width is determined off this. * @param middleWidth The width of the characters in the middle of the triangle. * @param sideBufferExtra How much buffering to put on each side of the triangle, this is used * (in the OP's example) for the extra spacing required to be flush with * the rest of the piece. * @return The triangle with the passed parameters. */ public static String makeACenteredTriangle(int height, int middleWidth, int sideBufferExtra) { StringBuilder builder = new StringBuilder(); for (int row = 1; row &lt;= height; row++) { //Left buffer for (int b = 1; b &lt;= height - row + sideBufferExtra; b++) builder.append(' '); //Left slashes for (int slash = 1; slash &lt;= row; slash++) builder.append('/'); //Middle column for (int mid = 1; mid &lt;= middleWidth; mid++) builder.append('*'); //Right slashes for (int slash = 1; slash &lt;= row; slash++) builder.append('\\'); //Right buffer for (int b = 1; b &lt;= height - row + sideBufferExtra; b++) builder.append(' '); builder.append('\n'); } return builder.toString(); } /** * Creates a strip of a diamond ascii art - piece. * * @param sideLength Length of each side of the diamonds. * @param numberDiamonds Number of diamonds to append to the line. * @param rowNumber Which row of the diamond to be generated. Starting at row index 1 and * going u…
upvote count: 2
answers question: http://stackoverflow.com/q/26247602
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/26201901
type: Question
has comment: http://stackoverflow.com/comment/41088266
has comment: http://stackoverflow.com/comment/41089403
has comment: http://stackoverflow.com/comment/41087799
downvote count: 0
has comment: http://stackoverflow.com/comment/41087753
has comment: http://stackoverflow.com/comment/41087786
has comment: http://stackoverflow.com/comment/41087766
has comment: http://stackoverflow.com/comment/41089028
favorite count: 0
has comment: http://stackoverflow.com/comment/41087854
answer count: 3
has comment: http://stackoverflow.com/comment/41087828
has answer: http://stackoverflow.com/a/26202001
has answer: http://stackoverflow.com/a/26201975
has answer: http://stackoverflow.com/a/26201973
type: UnansweredQuestion
upvote count: 1
has title: more enum in interface
has body: Check this example: public interface IConstants { public enum Levels { LOW("30 points"), MEDIUM("50 points") }; public enum Cars { PORSCHE("250 km/h"), FORD("180 km/h") } } I'd like to have an interface like this, because I want to access my enums this way: String level = IConstants.Levels.MEDIUM; String car = IConstants.Cars.PORSCHE; The compiler shows this message: constructor IConstants."enum name" is undefined. Solved this way : public class Constants { public static class Levels { public static String LOW = "30 points"; public static String MEDIUM = "50 points"; }; //... other classes } -useful for me in (my case) to have a "tree" in my constants, every constant starting by keyword Constants then subcategory and then value -> Constants.Levels.LOW. //critize it if it's very bad practise, i agree all comments -another maybe good thing that there will be all constants in one class
tagged with: enums
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41087629

http://stackoverflow.com/comment/41124084
comment on: http://stackoverflow.com/q/26221263
type: Comment
type: QuestionComment
has text: Define "it doesn't work". In any case, I didn't think even current JSP EL allowed unfettered access to arbitrary classes and their functionality, but I'm a version behind, too.
score: 1

http://stackoverflow.com/comment/41213892
comment on: http://stackoverflow.com/a/26269749
type: AnswerComment
score: 0
type: Comment
has text: Since I am a new member so I can't vote your answer but I sure give you a thumbs up! Thanks!

http://stackoverflow.com/a/49230267
type: Answer
answers question: http://stackoverflow.com/q/26332364
has body: for(float i=0; i&lt;10; i=i+0.2f){ System.out.println((int) i); } You can adapt the rest
score: 0

http://stackoverflow.com/comment/41411754
score: 0
has text: So you're using the Spring MVC framework. That complicates thing a bit as I am not that familliar with Spring. But I will still try to give you some working example. Although it may take a while.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26353436

http://stackoverflow.com/comment/41111213
has text: Which book you are referring ?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26214546
score: 0

http://stackoverflow.com/comment/41078854
type: QuestionComment
comment on: http://stackoverflow.com/q/26196992
has text: Where's the rest of your code? What you've posted here isn't remotely legal or complete.
score: 0
type: Comment

http://stackoverflow.com/comment/41207757
score: 0
comment on: http://stackoverflow.com/q/26215945
has text: In 0.7.1 there is a dll file coming in "bin" directory. But there isn't any bin folder and dll file in 2.6.0 even though it's written "bin+src+javadoc" in download page. I think without using a dll, the library doesn't work (at least for Windows).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41607127
type: Comment
type: QuestionComment
has text: I've already written my own parser now, but am still interested in improving my knowledge on the use of alternative parsers. As far as I can tell from the documentation, you can name a limited number of pre-approved parsers. If you try to substitute your own home-grown parser, or anything not on the approved list, it will throw an error.
comment on: http://stackoverflow.com/q/26222027
score: 0

http://stackoverflow.com/q/26283000
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26284185
has comment: http://stackoverflow.com/comment/41237968
type: Question
tagged with: object
upvote count: 5
downvote count: 4
has comment: http://stackoverflow.com/comment/41237789
answer count: 3
has comment: http://stackoverflow.com/comment/74378152
possible better answer: http://stackoverflow.com/a/26293005
has answer: http://stackoverflow.com/a/26293005
has comment: http://stackoverflow.com/comment/41237784
has body: I have a question related to OOP. what is the effect, if we make an object outside the method. Is that object becomes global? Here is some code.. class A(){ String b; public void c(){ //some code in here} } class C(){ A a = new A(); //is this ok and if it is ok what is this mean?? public void p(){ a.c(); //Is this possible?? } }
favorite count: 0
has answer: http://stackoverflow.com/a/26284185
has title: What will happen when we create an object outside the method?
has answer: http://stackoverflow.com/a/26283124
type: AnsweredQuestion
tagged with: oop

http://stackoverflow.com/q/26347480
upvote count: 0
has body: I need a regular expression that will match strings like : -2,-3,-10,-100 ... I know that the regular expression of number is \\d but how can i say the negation before it? Can anybody help me?
favorite count: 0
has comment: http://stackoverflow.com/comment/41356426
has comment: http://stackoverflow.com/comment/41356454
has comment: http://stackoverflow.com/comment/41357593
has answer: http://stackoverflow.com/a/26347500
tagged with: regex
has title: Regular expression of -digit
possible better answer: http://stackoverflow.com/a/26347486
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41356220
has answer: http://stackoverflow.com/a/26347709
accepted answer: http://stackoverflow.com/a/26347709
score: -3
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/41357374
tagged with: java
has comment: http://stackoverflow.com/comment/41356102
has answer: http://stackoverflow.com/a/26347486
answer count: 3

http://stackoverflow.com/comment/41192153
comment on: http://stackoverflow.com/a/26258341
type: Comment
type: AnswerComment
has text: Thanks Elliott, what if I've got other parts of the string to add to the output do I still use the `,` symbol? like `printf("The average score is %d\n", grade / 2 , " ..Good grade!" );`
score: 0

http://stackoverflow.com/q/26314631
accepted answer: http://stackoverflow.com/a/26314776
score: 0
has answer: http://stackoverflow.com/a/26314745
has answer: http://stackoverflow.com/a/26314767
has comment: http://stackoverflow.com/comment/41295234
has title: How to move from one Activity to another using a button?
tagged with: android-activity
tagged with: android
has comment: http://stackoverflow.com/comment/41295509
has body: I'm trying to move from one activity to another using a button (using the intent code mentioned below). The problem is, that I can't. MainActivity.java: package com.webding.gateway14; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.content.Intent; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(getApplicationContext(),GoogleDocsLogin.class); startActivity(i); setContentView(R.layout.activity_login); } }; ; Manifest.xml: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> GoogleDocsLogin.java (second activity): package com.webding.gateway14; import java.net.URL; import android.support.v7.app.ActionBarActivity; import android.text.TextUtils; import android.net.Uri; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.webkit.WebView; import android.content.Intent; public class GoogleDocsLogin extends ActionBarActivity { @Override protected void onCreate(Bundle …
tagged with: android-intent
possible better answer: http://stackoverflow.com/a/26314703
has answer: http://stackoverflow.com/a/26314703
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23572913
has answer: http://stackoverflow.com/a/26314774
tagged with: java
has comment: http://stackoverflow.com/comment/41295240
has answer: http://stackoverflow.com/a/26314718
type: Question
has answer: http://stackoverflow.com/a/26314776
answer count: 6
has comment: http://stackoverflow.com/comment/41295230
tagged with: move

http://stackoverflow.com/q/26306577
has comment: http://stackoverflow.com/comment/41281125
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/26306788
has body: See the following 2 classes, DTO and DTOWithOrdering: public class DTO { private final String key; private final long recordVersionNumber; public DTO(String key) { this.key = key; this.recordVersionNumber = 0; } public DTO(String key, long recordVersionNumber) { this.key = key; this.recordVersionNumber = recordVersionNumber; } public String getKey() { return key; } public long getRecordVersionNumber() { return recordVersionNumber; } @Override public String toString() { return "Key: " + this.key + " Record Version Number: " + this.recordVersionNumber; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DTO that = (DTO) o; return Objects.equal(this.key, that.key) &amp;&amp; Objects.equal(this.recordVersionNumber, that.recordVersionNumber); } @Override public int hashCode() { return Objects.hashCode(key, recordVersionNumber); } public class DTOWithOrdering extends DTO implements Comparable&lt;DTOWithOrdering&gt; { public DTOWithOrdering(String key, long recordVersionNumber) { super(key, recordVersionNumber); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DTOWithOrdering other = (DTOWithOrdering) o; if(this.getKey().equals(other.getKey())) { if(this.getRecordVersionNumber() == other.getRecordVersionNumber()) { return true; } else if(this.getRecordVersionNumber() &lt;= other.getRecordVersionNumber()) { return true; } else { return false; } } { return false; } } @Override public int compareTo(DTOWithOrdering other) { if(this.getKey().equals(other.getKey())) { if(this.getRecordVersionNumber() == other.getRecordVersionNumber()) { return 0; } else if(this.getRecordVersionNumber() &lt;= other.getRecordVersionNumber()) { return 0; } else { return -1; } } { return -1; } } } DTOWIthOrdering extends from DTO and overrides the equals and compareTo methods. The problem arises with the following code snippet when I cre…
type: AnsweredQuestion
score: 1
tagged with: java
has title: TreeSet Comparator performing inconsistently
has comment: http://stackoverflow.com/comment/41281736
has comment: http://stackoverflow.com/comment/41281146
type: Question
has comment: http://stackoverflow.com/comment/41281306
downvote count: 0
has comment: http://stackoverflow.com/comment/41281173
has answer: http://stackoverflow.com/a/26306788
answer count: 1

http://stackoverflow.com/q/26289814
favorite count: 0
tagged with: args
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41250662
has title: Passing String [] args values to another class
tagged with: java
downvote count: 1
tagged with: queue
type: Question
score: -1
has answer: http://stackoverflow.com/a/26289854
has body: I have a command line input as 0 1 2 and the main code can be seen below. public class AppleStoreRunner { public static void main(String [] args) { //maximum size of queue int qCapacity = Integer.parseInt(args[0]); //number of simulation hours int simHours = Integer.parseInt(args[1]); //average number of customers per hour int custPerHour = Integer.parseInt(args[2]); AppleStore myStore = new AppleStore(qCapacity, simHours, custPerHour); //Run simulation myStore.simulation(); myStore.displayAcceptedCustomers(); myStore.displayServedCustomers(); myStore.displayWaitingCustomers(); myStore.displayTurnAwayCustomers(); } } How can I call the inputed command line arguments in the following class so that I may use the inputs in a seperate extended class? The code below is the class I am trying to create variables for the 3 inputed numbers. public class AppleStore { int qCapacity; int simHours; int custPerHour; /** Constructor * @param qCapacity The initial capacity of the queue to be used. * @param simHours The number of hours that the simulation should run. * @param custPerHour expected number of customers to arrive per hour. */ public AppleStore(int qCapacity, int simHours, int custPerHour) { qCapacity = AppleStoreRunner.main(args); } /** * This methods performs a simulation of a store operation using a queue and prints the statistics. * For every minute, the simulator 1) checks if there are new customers arriving; 2) adds the new customer into the waiting line or else records the customer who chooses to leave; 3) continues to help the current customer if the current customer is not finished yet, or else get the next person in the waiting line. The simulator starts at minute 0, and repeats every minute until it finishes the requested simulation time. */ public void simulation( ) { System.out.println( "Average Waiting Time" + ); System.out.println( "Average Line Length" + ); /** * print the info of all accepted customers */ } public void displayAcceptedCustomers() { System…
upvote count: 0
answer count: 1
tagged with: variables
tagged with: string

http://stackoverflow.com/a/26205988
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26205915
has body: I'm not sure about your current xpath expression, but you can get rid of the spaces using normalize-space(.), example xpath: normalize-space(//button/text()) Result: Export All normalize-space(.) removes all leading and trailing spaces and replaces sequences of spaces with a single space. And for completeness, to get the text inside the button inside a div with a specific class="classname", following xpath: normalize-space(//div[@class='classname']/button/text()) Reference: https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/normalize-space
type: Answer
upvote count: 1

http://stackoverflow.com/comment/137303502
type: AnswerComment
has text: i keep getting No property findAll found for type MyEntity and i did add the EnableJpaRepositories annotation. Anyone have the same error?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30087275

http://stackoverflow.com/comment/41275486
comment on: http://stackoverflow.com/q/26302994
type: Comment
has text: I believe the Timer() class can do what I want, based on this blog post: http://android-er.blogspot.com/2013/12/example-of-using-timer-and-timertask-on.html I will continue with this and see if it works. If anyone has a better idea, or knows of an issue I will run into and can help, please let me know.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41289505
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26308859
has text: i mean full on the left, not depending in the JLabel text size like this, see how the "Editar Protocolo" Icon is not exact under the Distribuir protocolo?

http://stackoverflow.com/q/26280398
has title: Enterprise Architect Create UML Class Diagram from Code
type: Question
has comment: http://stackoverflow.com/comment/41233006
linked to: http://stackoverflow.com/q/6167266
upvote count: 3
score: 0
downvote count: 3
accepted answer: http://stackoverflow.com/a/26292966
answer count: 1
has body: I checked out these here: Generate UML Class Diagram from Java Project http://youtu.be/hT_Rs-fOttE http://youtu.be/dHrDIsPmtEU But the very first step in these tutorials, to right-click on class-view and selecting CodeEngineering-&gt;ImportSourceDirectory fails; Code Engineering opens a sub-context-menu containing only Suppress Namespace, without ImportSourceDirectory option. What am I doing wrong? Or is the option in my version of EA (10.0.1005) located somewhere else?
favorite count: 0
tagged with: class-diagram
has answer: http://stackoverflow.com/a/26292966
tagged with: enterprise-architect
type: AnsweredQuestion
tagged with: java
tagged with: uml

http://stackoverflow.com/a/26278390
answers question: http://stackoverflow.com/q/26278359
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26278359
has comment: http://stackoverflow.com/comment/41229406
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41229463
has body: It works in interfaces, but care should be taken so that the implementing classes fully qualify the names in the same way. Note that you can not choose which of the two classes when implement the interface. It's the interface that specifies which of the two classes is to be used when implementing the interface. The code you've posted in your answer is messed up. If the two first methods belong to a class implementing ITestController then that class must also include an implementation for public String method1(foo.request.Response response) { ... }

http://stackoverflow.com/a/26344778
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26344711
score: 2
downvote count: 0
has body: From the documentation: This method returns a new array with the same elements of the input array except the element on the specified position. The component type of the returned array is always the same as that of the input array. You probably want: listItems = ArrayUtils.remove(listItems, i);

http://stackoverflow.com/comment/41257342
score: 0
type: QuestionComment
type: Comment
has text: Ok. Then how do you request the list of emails now? What do you get in?
comment on: http://stackoverflow.com/q/26271473

http://stackoverflow.com/comment/41299787
score: 1
comment on: http://stackoverflow.com/a/26316727
type: AnswerComment
has text: @TheLostMind, I understand your concern, the reason for posting this answer was not to suggest it is better than the array answer already present, but merely to provide an alternative that uses the `replace` function that Jaguar mentioned.
type: Comment

http://stackoverflow.com/q/26210213
has comment: http://stackoverflow.com/comment/41110519
tagged with: java
type: Question
has body: I get all needed information for x86 programms (in C:\Program Files (x86)) without any problems with below statement. But for x64 empty result for activ window process name. Is it possible detect active window process name (.exe path) for x64 processor with jna? Eclipse Luna for x64 Windows 8 pro x64 JRE8 x64 jna 4.1.0 import static your.pack.name.EnumerateWindows.Kernel32.OpenProcess; import static your.pack.name.EnumerateWindows.Kernel32.PROCESS_QUERY_INFORMATION; import static your.pack.name.EnumerateWindows.Kernel32.PROCESS_VM_READ; import static your.pack.name.EnumerateWindows.Psapi.GetModuleBaseNameW; import static your.pack.name.EnumerateWindows.User32DLL.GetForegroundWindow; import static your.pack.name.EnumerateWindows.User32DLL.GetWindowTextW; import static your.pack.name.EnumerateWindows.User32DLL.GetWindowThreadProcessId; import java.lang.management.ManagementFactory; import com.sun.jna.Native; import com.sun.jna.Pointer; import com.sun.jna.platform.win32.WinDef.HWND; import com.sun.jna.ptr.PointerByReference; public class EnumerateWindows { private static final int MAX_TITLE_LENGTH = 1024; public static void main(String[] args) throws Exception { char[] buffer = new char[MAX_TITLE_LENGTH * 2]; GetWindowTextW(GetForegroundWindow(), buffer, MAX_TITLE_LENGTH); System.out.println("Active window title: " + Native.toString(buffer)); PointerByReference pointer = new PointerByReference(); GetWindowThreadProcessId(GetForegroundWindow(), pointer); Pointer process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pointer.getValue()); GetModuleBaseNameW(process, null, buffer, MAX_TITLE_LENGTH); System.out.println("Active window process: " + Native.toString(buffer)); System.out.println(ManagementFactory.getRuntimeMXBean().getName()); } static class Psapi { static { Native.register("psapi"); } public static native int GetModuleBaseNameW(Pointer hProcess, Pointer hmodule, char[] lpBaseName, int size); } static class Kernel32 { static { Native.register(…
answer count: 1
tagged with: jna
score: 0
has answer: http://stackoverflow.com/a/26213375
has title: jna Active window process name for x64
type: UnansweredQuestion
tagged with: 64-bit

http://stackoverflow.com/comment/41129218
has text: I've added examples.
score: 0
comment on: http://stackoverflow.com/q/26223723
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41332938
score: 0
comment on: http://stackoverflow.com/q/26334644
type: QuestionComment
type: Comment
has text: Oh yes you are right, I was doing this wrong in Service. Thanks

http://stackoverflow.com/comment/41162743
type: QuestionComment
comment on: http://stackoverflow.com/q/26242009
has text: In the project root.
score: 0
type: Comment

http://stackoverflow.com/comment/41208972
comment on: http://stackoverflow.com/q/26266878
type: Comment
has text: @PeterLawrey Could you write some code? May be there's a solution that I don't unserstand...
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41249178
comment on: http://stackoverflow.com/q/26288670
score: 0
has text: ok thanks :) unknowingly I answered to this (http://stackoverflow.com/questions/821536/java-iterator-over-an-empty-collection-of-a-parameterized-type) question in the name of a New Question! So this question can be tagged as a duplicate answer. not as a duplicate question. Just Kidding, no offense.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41203934
has text: The problem is that for some reason I cant use s1 as a parameter for my Command class method. i dont know why? i think it has something to do with instantiation ?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26263624
type: QuestionComment

http://stackoverflow.com/comment/41263713
type: AnswerComment
comment on: http://stackoverflow.com/a/26287924
score: 0
type: Comment
has text: Thank you wrongAnswer for an answer :) works fine now.

http://stackoverflow.com/comment/41234200
score: 1
comment on: http://stackoverflow.com/q/26281220
has text: you should not need to write that in twice. o.o
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26320867
upvote count: 2
has comment: http://stackoverflow.com/comment/41307309
answers question: http://stackoverflow.com/q/26320847
has comment: http://stackoverflow.com/comment/41306934
has comment: http://stackoverflow.com/comment/41307027
has comment: http://stackoverflow.com/comment/41307225
has comment: http://stackoverflow.com/comment/41306947
has comment: http://stackoverflow.com/comment/41306962
downvote count: 0
has body: //scanner is a Scanner int i; // declare it before the block try { i = scanner.nextInt(); } catch (InputMismatchException ime) { i = 10; } // i is some integer from the user, or 10
has comment: http://stackoverflow.com/comment/41307250
has comment: http://stackoverflow.com/comment/41306981
has comment: http://stackoverflow.com/comment/41306960
has comment: http://stackoverflow.com/comment/41307049
type: Answer
score: 2

http://stackoverflow.com/comment/41201998
comment on: http://stackoverflow.com/q/26263482
has text: @NathanMerrill No, there's a subtype relationship there.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41183141
has text: @user3797438 There were syntax errors in my proposed aspect ... post edited. And in my own test I get 110 (with the correct aspect)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26252409
type: AnswerComment

http://stackoverflow.com/comment/41264002
comment on: http://stackoverflow.com/a/26294392
has text: @Emanuelez, I have just downloaded the latest version of Realm for Android, imported the intro example to the Android Studio (v0.8.6) and run it. The app crashes on launch with "Could not find the generated proxy class" exception on the line `Person person = realm.createObject(Person.class);`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26224914
has comment: http://stackoverflow.com/comment/41135233
has comment: http://stackoverflow.com/comment/41132100
has body: I'm trying to write a program that reads in a web service and phrasses it using the JSONObject object. I'm using eclipse when I try to import the library org.json.simple.JSONObject; I get a error saying "org.jason cannot be resolved" code listing import java.net.URL; import org.json.simple.JSONObject; // Error message "the import "org.json cannot be resolved" import java.io.*; import javax.net.ssl.HttpsURLConnection; // This is where I get the error message public class cStart { cGraphData ReadData; public static void main (String[] args) { System.out.println("Welcome to the world of Java Programming."); String reply=""; cGraphData ReadData= new cGraphData(); try { String httpsURL = "https://bittrex.com/api/v1.1/public/getticker?market=BTC-LTC"; URL myurl = new URL(httpsURL); HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection(); InputStream ins = con.getInputStream(); InputStreamReader isr = new InputStreamReader(ins); BufferedReader in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { reply+=inputLine; } } catch (Exception e) { System.out.println("Exception in getting data from server"); } System.out.println(reply); JSONObject t; } }
tagged with: java
has comment: http://stackoverflow.com/comment/41135050
has comment: http://stackoverflow.com/comment/41131237
has answer: http://stackoverflow.com/a/49775166
has comment: http://stackoverflow.com/comment/41131679
score: 2
downvote count: 0
type: UnansweredQuestion
type: Question
has title: cannot import org.json.simple.JSONObject get error saying "org.jason cannot be resolved"
has answer: http://stackoverflow.com/a/68220821
favorite count: 0
upvote count: 2
answer count: 2

http://stackoverflow.com/a/26300133
type: Answer
has body: Have a look at: this question. To save you time, here is the accepted answer there: try { URL url = new URL("http://www.helpinghomelesscats.com/images/cat1.jpg"); InputStream in = url.openConnection().getInputStream(); BufferedInputStream bis = new BufferedInputStream(in,1024*8); ByteArrayOutputStream out = new ByteArrayOutputStream(); int len=0; byte[] buffer = new byte[1024]; while((len = bis.read(buffer)) != -1){ out.write(buffer, 0, len); } out.close(); bis.close(); byte[] data = out.toByteArray(); Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); imageView.setImageBitmap(bitmap); } catch (IOException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/41269914
score: 0
has comment: http://stackoverflow.com/comment/41269822
upvote count: 1
answers question: http://stackoverflow.com/q/26300056
downvote count: 1

http://stackoverflow.com/comment/41219505
type: QuestionComment
has text: Thanks @SanKrish. Apparently, I was using the left alt wen i should have been using right alt+enter. That helped, thanks a ton
score: 1
comment on: http://stackoverflow.com/q/26272926
type: Comment

http://stackoverflow.com/q/26308156
answer count: 3
tagged with: android
tagged with: cordova
accepted answer: http://stackoverflow.com/a/29435657
has title: Cordova is running the wrong Java version. How do I get Cordova to run a specific Java version?
linked to: http://stackoverflow.com/q/30874824
has body: [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release and error: strings in switch are not supported in -source 1.5 [javac] switch (xmlData[i][1]) { [javac] ^ [javac] (use -source 7 or higher to enable strings in switch) I am getting warnings and errors that I am running Java 1.5 when compiling an APK with Cordova for Android. I can't use strings in switch statements. (the compilation process errors) My system is 64-bit Windows 7. My Cordova version is 3.5. I am using git-scm. (http://git-scm.com/) I am running this command: cordova run android --release. My Java environment variable lists C:\Program Files\Java\jdk1.8.0_20 as the Java directory. My path enviroment variable sets the Java path as the first item in the list. Every Java patch and version is uninstalled except what I just re-installed from Oracle's site. I restarted my computer. java -version gives me java version "1.8.0_20". javac -version gives me javac 1.8.0_20. All my targets are =android-19, =debug, or =release. android:minSdkVersion is always set to "14", everywhere. android:targetSdkVersion is always set to "19", everywhere. How can I force Cordova to run Java 8?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26311572
tagged with: java
possible better answer: http://stackoverflow.com/a/26311572
type: Question
upvote count: 4
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/34204348
favorite count: 0
has answer: http://stackoverflow.com/a/29435657

http://stackoverflow.com/comment/41304222
type: Comment
type: QuestionComment
has text: It's hard to tell what you could be doing wrong without an [mcve](http://stackoverflow.com/help/mcve). Are you limiting the size of your statsKeysPanel JPanel in any way?
comment on: http://stackoverflow.com/q/26319408
score: 0

http://stackoverflow.com/q/26312842
has answer: http://stackoverflow.com/a/26313038
answer count: 4
type: UnansweredQuestion
has title: Difference of 2 Ways of Adding Elements to Java ArrayList Using Iterator
upvote count: 1
type: Question
has body: What is the difference between: for (ArrayList&lt;Integer&gt; a : result) temp.add(new ArrayList&lt;Integer&gt;(a)); and for (ArrayList&lt;Integer&gt; a : result) temp.add(a); ?
score: 1
tagged with: java
downvote count: 0
has answer: http://stackoverflow.com/a/26312920
favorite count: 0
has answer: http://stackoverflow.com/a/26312901
tagged with: arraylist
has answer: http://stackoverflow.com/a/26312866

http://stackoverflow.com/a/26292380
accepted answer of: http://stackoverflow.com/q/26292314
downvote count: 0
has comment: http://stackoverflow.com/comment/41256110
score: 1
answers question: http://stackoverflow.com/q/26292314
has body: Just a quick note to save you some grief later Shouldn't line = line.substring(line.length()-16, line.length()-1); be instead line = line.substring(line.length()-15, line.length()); to get all the grades? And then you'll need to put your if statements into a for loop, that loops over each value of the array (replace the letters[1] with letters[i])
has comment: http://stackoverflow.com/comment/41255334
has comment: http://stackoverflow.com/comment/41256287
has comment: http://stackoverflow.com/comment/41256196
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41256390
has comment: http://stackoverflow.com/comment/41255134
type: Answer
has comment: http://stackoverflow.com/comment/41255735
has comment: http://stackoverflow.com/comment/41256247
has comment: http://stackoverflow.com/comment/41255210

http://stackoverflow.com/comment/41273527
has text: What does bot.mouseMove(x, y) do? Do you have the code for this?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26302517
type: Comment

http://stackoverflow.com/q/26231954
accepted answer: http://stackoverflow.com/a/26233020
type: Question
tagged with: xstream
tagged with: xml-parsing
has title: XStream apostrophe Issue in converting Java Object to XML
answer count: 1
tagged with: apostrophe
has comment: http://stackoverflow.com/comment/41145483
downvote count: 0
has answer: http://stackoverflow.com/a/26233020
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/41144877
upvote count: 2
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41143992
tagged with: java
has body: I am using com.thoughtworks.xstream.XStream to Generate xml String. I parse Object to xstream.toXML method and I get the xml output according to the way I need. <question id="Name" answer="Micheal"/> <question id="Address" answer="Home"> friend's House </basequestion> XStream xstream = new XStream(); xstream.alias("myxml", MyXml.class); xstream.alias("test", Test.class); xstream.alias("question", Question.class); xstream.alias("details", Details.class); xstream.alias("detailanswer", String.class); xstream.addImplicitCollection(MyXml.class, "test"); xstream.addImplicitCollection(Test.class, "question"); xstream.addImplicitCollection(Question.class, "details"); xstream.addImplicitCollection(Details.class, "detailanswer"); xstream.useAttributeFor(Test.class, "type"); xstream.useAttributeFor(Test.class, "name"); xstream.useAttributeFor(Question.class, "id"); xstream.useAttributeFor(Question.class, "answer"); xstream.useAttributeFor(Details.class, "name"); return xstream.toXML(eform); Following is the Object structure. Inside MyXml there is List Test has List<Question>, String type, String name Question has List<Details>, String id, String answer. Details has List<String> detailAnswer, String name So the element in the question, Friend's house is added to the List detailAnswer in Details class. I get friend's House instead of friend's house. How can I resolve this. Is there special way to convert using XStream?
has comment: http://stackoverflow.com/comment/41144966

http://stackoverflow.com/q/26324147
has body: This question may be already asked before but for different issue. The following cURL command is work fine with shell command: curl -u MyuserName:MyPassword http://192.168.0.198:8067/startvideo?force=1&amp;tag=20141010-121420 I tried to implement it in Java/Android: private void startRecord() { HttpClient httpClient = new DefaultHttpClient(); // replace with your url HttpPost httpPost = new HttpPost("http://192.168.0.198:8067/startvideo?force=1&amp;tag=20141010-121420"); //Post Data List&lt;NameValuePair&gt; nameValuePair = new ArrayList&lt;NameValuePair&gt;(2); nameValuePair.add(new BasicNameValuePair("username", "MyuserName")); nameValuePair.add(new BasicNameValuePair("password", "MyPassword")); //Encoding POST data try { httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair)); } catch (UnsupportedEncodingException e) { // log exception e.printStackTrace(); } //making POST request. try { HttpResponse response = httpClient.execute(httpPost); // write response to log Log.d("Http Post Response:", response.toString()); } catch (ClientProtocolException e) { // Log exception e.printStackTrace(); } catch (IOException e) { // Log exception e.printStackTrace(); } } But the app crashed and got the following error: 10-12 12:15:41.245: E/AndroidRuntime(25877): FATAL EXCEPTION: main 10-12 12:15:41.245: E/AndroidRuntime(25877): java.lang.RuntimeException: Unable to create service ioio.examples.hello_service.TestService: android.os.NetworkOnMainThreadException 10-12 12:15:41.245: E/AndroidRuntime(25877): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2424) 10-12 12:15:41.245: E/AndroidRuntime(25877): at android.app.ActivityThread.access$1700(ActivityThread.java:140) 10-12 12:15:41.245: E/AndroidRuntime(25877): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319) 10-12 12:15:41.245: E/AndroidRuntime(25877): at android.os.Handler.dispatchMessage(Handler.java:99) 10-12 12:15:41.245: E/AndroidRuntime(25877): at android.os.Looper.loop(Loo…
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/6343166
tagged with: url
has comment: http://stackoverflow.com/comment/41314880
linked to: http://stackoverflow.com/q/6343166
score: 0
tagged with: android
tagged with: curl
has comment: http://stackoverflow.com/comment/41314848
answer count: 0
has title: How to translate curl -u uasername:password into Java Android?
type: UnansweredQuestion
tagged with: authentication
has comment: http://stackoverflow.com/comment/41315854

http://stackoverflow.com/a/26335867
has comment: http://stackoverflow.com/comment/42411292
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/41339807
has body: Here's the algorithm in my opinion: first find the shortest side of the bbox: min(|lat1-lat2|,|lon1-lon2|) convert its length in decimal degrees to kilometres (http://en.wikipedia.org/wiki/Decimal_degrees#Precision) you have the minimum radius
answers question: http://stackoverflow.com/q/26330088
score: -1
accepted answer of: http://stackoverflow.com/q/26330088

http://stackoverflow.com/comment/41357737
comment on: http://stackoverflow.com/a/26347845
has text: Is this serious answer ? I run on mac osx btw and this is rather for linux.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/26353382
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/41366733
answers question: http://stackoverflow.com/q/26352777
has body: struts-config.xml: <forward name="success" path="/success.java"/> <forward name="error" path="/error.java"/> what is the meaning of the success.java and error.java , you must specify the servlet in the web.xml, otherwise the structs cannot not find the correct destination. you can see the example of structs.

http://stackoverflow.com/comment/41378582
type: Comment
comment on: http://stackoverflow.com/a/26346394
score: 0
type: AnswerComment
has text: No problem glad I could help...do you mind marking this as correct if it helped you?

http://stackoverflow.com/comment/124636251
type: AnswerComment
has text: Do we need to mention any permission in manifest file for accessing android_id.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26244588

http://stackoverflow.com/comment/41223943
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26272953
has text: I would just try it. The Oracle documentaion says that it's not supported. But it also states that MySQL does not support rowid's (which is not true) http://docs.oracle.com/javase/tutorial/jdbc/basics/sqlrowid.html
score: 0

http://stackoverflow.com/comment/41308589
score: 0
comment on: http://stackoverflow.com/a/26291062
type: AnswerComment
has text: Hi duskwuff, I have tried the method 'getString(byte)', but not work exactly. First, It show me it need surround with try/catch, so I did. then It show me 'Operation not supported or unimplemented on this platform' message. Is it method not support Windows?
type: Comment

http://stackoverflow.com/a/76343995
score: 0
answers question: http://stackoverflow.com/q/26327251
type: Answer
has body: I was able to get shell output, running commands with phpseclib. It's a bit more tricky but allows you to execute commands under another user (and also in another server if needed). create user with rights to run your jar create public/private key pair to that user give read access to your webserver to user's private key (that's why you don't want to use your personal user account) install phpseclib: add something like "phpseclib/phpseclib": "~2.0" to your composer.json and make composer update or use some other way to make it available to your code use phpseclib\Crypt\RSA; use phpseclib\Net\SSH2; $key = new RSA(); $key->loadKey(file_get_contents('ssh_private_key_location')); $ssh = new SSH2('server address/ip'); if (!$ssh->login('username'), $key)) { echo 'Login Failed'; } else { echo $ssh->exec('java -jar /path/to/test.jar'); } If this code doesn't work out of the box, you can practice your investigation skills ;)

http://stackoverflow.com/comment/41085993
type: Comment
has text: Please post the content of `labels`. `indexOf` returns -1 if the list *does not* contain the element.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26200987

http://stackoverflow.com/q/26246821
has answer: http://stackoverflow.com/a/26246874
has title: Find modal number in array
tagged with: arrays
answer count: 6
has answer: http://stackoverflow.com/a/26246934
has answer: http://stackoverflow.com/a/26246910
score: 0
has comment: http://stackoverflow.com/comment/41171958
has answer: http://stackoverflow.com/a/26246856
tagged with: topmost
has answer: http://stackoverflow.com/a/26246880
type: UnansweredQuestion
type: Question
tagged with: java
has body: I have array like this: int[] array = { 2, 4, 6, 8, -3, 8, 2, 7, 2, 4 }; I want to know which number is showing the most time (in this case its 2 of course), how can i do that?
has answer: http://stackoverflow.com/a/26246885

http://stackoverflow.com/q/26286135
tagged with: spring
tagged with: playframework-2.0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am currently using Play Framework 2.10 + Spring and JPA. I didn't use Ebeans because in future versions of Play it will be deprecated, as stated here. I am trying to update an object that comes from my database, it is changed in a Play form, and comes back to be updated. The problem is that each time I save the object using its Spring Repository it creates a new entity. My controller code appears below. package controllers; import model.Doctor; import repositories.DoctorRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import play.data.Form; import play.mvc.Result; import views.html.doctores.blank; import views.html.doctores.show; @Controller public class Doctores { @Autowired public DoctorRepository doctorRepository; private static final Form&lt;Doctor&gt; doctorForm = Form.form(Doctor.class); public Result save() { Form&lt;Doctor&gt; boundForm = doctorForm.bindFromRequest(); if (boundForm.hasErrors()) { return play.mvc.Controller.badRequest(blank.render(boundForm)); } Doctor doctor = boundForm.get(); doctorRepository.save(doctor); return play.mvc.Controller.redirect(routes.Doctores.list()); } public Result show(Long id) { final Doctor doctor = doctorRepository.findOne(id); if (doctor == null) { return play.mvc.Controller.notFound(String.format("Doctor %s no existe.", id)); } Form&lt;Doctor&gt; filledForm = doctorForm.fill(doctor); return play.mvc.Controller.ok(show.render(filledForm)); } } I don't want to temporally store the object in the Play's cache or session, restore it, and manually find out what attributes changed. How can I update my object?
has answer: http://stackoverflow.com/a/30761441
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has title: How to update an object that comes from a Play Framework 2.0 form using Spring+JPA?

http://stackoverflow.com/comment/41356640
score: 0
type: Comment
has text: Stupid question, did you restart the program? ^^
type: QuestionComment
comment on: http://stackoverflow.com/q/26347882

http://stackoverflow.com/comment/41346352
comment on: http://stackoverflow.com/q/26341084
score: 0
has text: @NeilStockton but [the MySQL documentation](http://dev.mysql.com/doc/refman/5.5/en/create-table.html) says that a *TINYINT* can be *UNSIGNED*.. (Also see the following SO question: "[mysql Tinyint as unsigned](http://stackoverflow.com/questions/12812362/mysql-tinyint-as-unsigned)")
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41106526
score: 0
type: AnswerComment
type: Comment
has text: Sir i am new to java cant understand what you are saying can u please elaborate
comment on: http://stackoverflow.com/a/26211890

http://stackoverflow.com/comment/41178563
type: Comment
type: QuestionComment
score: 0
has text: OK, full pom.xml added
comment on: http://stackoverflow.com/q/26233776

http://stackoverflow.com/comment/41264924
score: 0
type: Comment
type: QuestionComment
has text: @Spork how are you giving the file path from console? What is your input?
comment on: http://stackoverflow.com/q/26295071

http://stackoverflow.com/a/26277692
score: 2
has comment: http://stackoverflow.com/comment/41227839
upvote count: 2
has comment: http://stackoverflow.com/comment/41227542
has comment: http://stackoverflow.com/comment/41227507
has comment: http://stackoverflow.com/comment/41227471
answers question: http://stackoverflow.com/q/26277436
has comment: http://stackoverflow.com/comment/41227603
downvote count: 0
has comment: http://stackoverflow.com/comment/41228350
has comment: http://stackoverflow.com/comment/41228201
has body: Set the 2nd and 3rd parameter as OracleTypes.ARRAY as below.. For Custom Types callableStatement.registerOutParameter(2, OracleTypes.ARRAY, "PREQUEST.TVARCHARARRAY"); callableStatement.registerOutParameter(3, OracleTypes.ARRAY, "PREQUEST.TVARCHARARRAY");
type: Answer

http://stackoverflow.com/q/26273546
has title: how to convert a tree table into json tree?
has comment: http://stackoverflow.com/comment/41244129
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41365525
has body: Database is Oracle, the table has 3 columns: id, parent_id , name, which contains data of the company's structure. id parent_id name 0 -1 CEO 1 0 CMO-marketing 2 0 COO - china 3 0 Mobile BU 4 0 COO - Intel 5 0 WW - Sales 6 1 Research &amp; Tech 7 1 Communications 8 1 Human Resources 9 2 PC BU 10 2 Sales ... SQL query: select * from org connect by prior id = parent_id start with id = '0'; this SQL query can get all data. I want to transform the output to a json tree. {"children": [{ "id":0, "leaf":false, "text":"CEO", "children":[ { "text":"CMO-marketing", "id":1, "leaf":false, "children":[ { "text":"Research &amp; Tech", "id":6, "leaf": true },{ "text":"Communications", "id":7, "leaf": true },{ "text":"Human Resources", "id":8, "leaf": true } ] },{ "text":"COO - china", "id":2, "leaf":false, "children":[ { "text":"PC BU", "id":9, "leaf": true },{ "text":"Sales", "id":10, "leaf": true } ] },{ "text":"Mobile BU", "id":3, "leaf":false },{ "text":"COO - Intel", "id":4, "leaf":false },{ "text":"WW - Sales", "id":5, "leaf":false } ] }] } I use java, and want to an algorithm to convert it.
tagged with: sql
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: tree
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/41253032
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/a/26290379
has comment: http://stackoverflow.com/comment/41251697
type: Answer
has body: Because you are calling it twice as result of first method calls has not been used so those are not needed. Name();//&lt;-------------(1) ID();//&lt;-------------(1) //You can remove these lines String IDen = ID();//&lt;-------------(2) String name = Name();//&lt;-------------(2) Note:You should follow the naming conventions as method name/variable name(except constant) should start with small case. Here Name(); is method call and it's upto you whether you use the returned value or not. Name();//First Call String name =Name();//Second Call
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41251733
answers question: http://stackoverflow.com/q/26290364

http://stackoverflow.com/q/26327642
has comment: http://stackoverflow.com/comment/41319294
has comment: http://stackoverflow.com/comment/41319343
has answer: http://stackoverflow.com/a/26327718
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/29835430
accepted answer: http://stackoverflow.com/a/26327718
type: Question
possible better answer: http://stackoverflow.com/a/26327712
has answer: http://stackoverflow.com/a/26327712
tagged with: database-connection
has title: How to connect a desktop java application and an online mysql database and execute query?
tagged with: java
answer count: 3
tagged with: mysql
upvote count: 1
has body: I am trying to create an desktop application for shop. I can create create desktop app and database individually but I dont know how to connect them and how to execute query from desktop. May be for executing query I should use php but I dont know how. My database have been created in hosting site using cpanel.
tagged with: database
type: AnsweredQuestion

http://stackoverflow.com/a/26971087
has body: Define the exception handler. You need to add the proper import in the begging of your class, like this: import java.security.NoSuchAlgorithmException; import javax.crypto.NoSuchPaddingException; import javax.crypto.Cipher; Look here how
answers question: http://stackoverflow.com/q/26278953
downvote count: 3
type: Answer
upvote count: 0
score: -3

http://stackoverflow.com/comment/100999456
has text: Did you manage to make it work? can you share the code? please
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26203663

http://stackoverflow.com/comment/41109679
comment on: http://stackoverflow.com/q/26213813
type: Comment
has text: Please show your complete Java code. But in general: max on a varchar column will use ascii sorting, so the value `2` will bigger than `10`. The root cause of your problem is that you chose the wrong data type in the database. Your value looks suspiciously like a date or timestamp. If that is the case, use a `date` or `timestamp` column and all comparisons will magically work as you expect them. If that is a plain number, use `integer`.
score: 2
type: QuestionComment

http://stackoverflow.com/a/26221367
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26221243
has body: Okay, well parse the second command line argument as an Int and add it to each value: private static void table(String[] args) { int numToAdd = Integer.parseInt(args[1]); int[][] table = new int[10][10]; for (int i = 0; i &lt; 10; i++) { for (int j = 0; j &lt; 10; j++) { System.out.printf("%6d", i * j + numToAdd); } System.out.println(); } } Not sure why you created a table double array, since you never use it. And the output: java Test -test 7 7 7 7 7 7 7 7 7 7 7 7 8 9 10 11 12 13 14 15 16 7 9 11 13 15 17 19 21 23 25 7 10 13 16 19 22 25 28 31 34 7 11 15 19 23 27 31 35 39 43 7 12 17 22 27 32 37 42 47 52 7 13 19 25 31 37 43 49 55 61 7 14 21 28 35 42 49 56 63 70 7 15 23 31 39 47 55 63 71 79 7 16 25 34 43 52 61 70 79 88 I would create a different method: public static boolean validateArgs(String[]args){ //all code to validate the args here. //print validation specific errors here } Then your main: public static void main(String[]args){ if(validateArgs(args)){ table(args); } }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26221243

http://stackoverflow.com/comment/41086667
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26201327
has text: honestly, i havent tried to put asynctask yet, i confused how. I'am new for android programming. Can you give me how do i implement the asyntask inside code above. pliss

http://stackoverflow.com/comment/41269268
type: QuestionComment
comment on: http://stackoverflow.com/q/26300192
has text: Do you see any error message when you tried to open?
score: 0
type: Comment

http://stackoverflow.com/a/26321166
has body: When I input the student's name with a first and last name the java code has an error and the program stops I'm guessing that the error you're getting is java.util.InputMismatchException. This happens becauseString studentname = s.next();only gets one token, and when you enter a name with two tokens likeJohn Doe, then second token remains in the input buffer and is parsed by the next callint n = s.nextInt();which of course won't work. Instead of usingString studentname = s.next();you want to read the entire line withString studentname = s.nextLine(); (the best option might be to use Integer.parseInt() for all the calls when you want to read numbers.) Also, when you read data usingnextInt()the newline character won't be consumed which means that when you go on to the next call it's still there and will be parsed instead of the name (in this case). Either read an empty line usings.nextLine()before you read the name, or useInteger.parseInt(s.nextLine())to read the data. You might also want to use exceptions to catch errors due to bad input gracefully. On a side note class names in Java should start with a capital letter as stated in the Code Conventions for the Java Programming Language See the documentation for Scanner.nextLine(). Also, as noted in another answer and what I missed is that you're using the same variableiin both the while loop that gets student names and the for loop that gets scores for each student. This won't work. You should use another variable likejin the second loop: for (int j = 0; j &lt; exams; j++) { int n = s.nextInt(); sum+=n; if (n &lt; 0) { System.out.println("Invalid exam scores, reenter: "); } } Ideally you'll want to use am object oriented approach and create student objects with associated test scores and read data into an collection (maybe an arrayList) of students, but maybe that's is a solution at a later stage in the course or exercise path you seem to be on.
has comment: http://stackoverflow.com/comment/41307579
score: 2
has comment: http://stackoverflow.com/comment/41307782
downvote count: 0
has comment: http://stackoverflow.com/comment/41307886
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26321088
has comment: http://stackoverflow.com/comment/41307643
has comment: http://stackoverflow.com/comment/41307726

http://stackoverflow.com/q/26325536
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26325721
tagged with: blender
has answer: http://stackoverflow.com/a/26327572
tagged with: java
linked to: http://stackoverflow.com/q/1099672
type: Question
downvote count: 4
tagged with: network-programming
accepted answer: http://stackoverflow.com/a/26325622
has title: What is better, TCP-IP or UDP?
has body: I wanna program my own renderfarming tool in Java for the Blender render engine.. But know i wanna know what is better for doing that: TCP-IP or UDP? Thanks
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/26325622
score: -3
upvote count: 1
possible better answer: http://stackoverflow.com/a/26325721

http://stackoverflow.com/comment/41238817
score: 0
type: Comment
type: QuestionComment
has text: YEAH I got it fixed thanks to the help here: http://stackoverflow.com/questions/9501681/ftp-doesnt-download-the-file-properly-in-java. After setting the filetype like this: client.setFileType(FTPClient.BINARY_FILE_TYPE) everything works now on windows.
comment on: http://stackoverflow.com/q/26267412

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/26324407
tags question: http://stackoverflow.com/q/26197277
tags question: http://stackoverflow.com/q/26277807
tags question: http://stackoverflow.com/q/26275401

http://stackoverflow.com/q/26352762
has comment: http://stackoverflow.com/comment/41365532
has comment: http://stackoverflow.com/comment/41365439
answer count: 2
linked to: http://stackoverflow.com/q/3894119
has comment: http://stackoverflow.com/comment/41365296
has comment: http://stackoverflow.com/comment/41365250
has comment: http://stackoverflow.com/comment/41365260
favorite count: 0
has answer: http://stackoverflow.com/a/26352896
has answer: http://stackoverflow.com/a/26353051
score: 6
possible better answer: http://stackoverflow.com/a/26352896
type: AnsweredQuestion
has body: Consider this code: int num = 0; switch(num) { case 1: boolean bool = false; break; case 2: String one; String two; String three; //..simulating lots of vars break; default: bool = true; System.out.println(bool); break; } Since we were allowed to reference a variable declared in another case, this means that even though case 1 wasn't chosen, boolean bool was still declared. Since default is the last option, and java works from left to right (top to bottom), I'm assuming that the variables in case 2 (and any other cases) will also be declared. This make me think that the more code you have in the cases declared before the case chosen, the longer it'll take to actually access that case compared to if the chosen case was declared first. Is there a specific reason switch statements work this way? And wouldn't it be best to use if-else rather than switch statements if there are a lot of cases? (talking processing time, nano-seconds)
has comment: http://stackoverflow.com/comment/41365462
tagged with: java
linked to: http://stackoverflow.com/q/10810768
upvote count: 7
downvote count: 1
tagged with: switch-statement
accepted answer: http://stackoverflow.com/a/26353051
type: Question
has comment: http://stackoverflow.com/comment/41365375
has comment: http://stackoverflow.com/comment/41365246
duplicate of: http://stackoverflow.com/q/10810768
has comment: http://stackoverflow.com/comment/41365393
has comment: http://stackoverflow.com/comment/41365325
tagged with: micro-optimization
has comment: http://stackoverflow.com/comment/41365369
has title: Why don't cases in switch statements have their own scope?

http://stackoverflow.com/comment/41082483
type: AnswerComment
has text: @Boann: They'd then have to change their code to read from where they saved it on disk. And they'd have to worry about whether the saved copy was current. That may be a perfectly reasonable approach, but it didn't seem to be the question they were asking.
type: Comment
comment on: http://stackoverflow.com/a/26198991
score: 0

http://stackoverflow.com/comment/41080982
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26198057
type: Comment
has text: You open the file in IntelliJ, make sure that IntelliJ can identify it as a Java file, then perform the "format code" option (CTRL + ALT + L or Command + Option + L). The key here is that IntelliJ needs to be aware that it is a source file. I doubt that this functionality is exposed in an accessible API, nor would it make sense to - IntelliJ has a peculiar setup when it comes to its code style interface.

http://stackoverflow.com/comment/41128910
has text: I am in the project folder path ..
comment on: http://stackoverflow.com/q/26223648
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26281025
answers question: http://stackoverflow.com/q/26280636
has comment: http://stackoverflow.com/comment/41234145
type: Answer
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/41235405
has body: If your session is not transacted you risk message loss in the event your JVM goes down unexpectedly. Here is the explanation of the various ack modes from AbstractMessageListenerContainer: The listener container offers the following message acknowledgment options: "sessionAcknowledgeMode" set to "AUTO_ACKNOWLEDGE" (default): Automatic message acknowledgment before listener execution; no redelivery in case of exception thrown. "sessionAcknowledgeMode" set to "CLIENT_ACKNOWLEDGE": Automatic message acknowledgment after successful listener execution; no redelivery in case of exception thrown. "sessionAcknowledgeMode" set to "DUPS_OK_ACKNOWLEDGE": Lazy message acknowledgment during or after listener execution; potential redelivery in case of exception thrown. "sessionTransacted" set to "true": Transactional acknowledgment after successful listener execution; guaranteed redelivery in case of exception thrown. The exact behavior might vary according to the concrete listener container and JMS provider used. Because messaging is typically based on assured delivery, using the method that would offer the best safegaurds against message loss is recommended. You'd have to decide for a particular use case if its worth it.
score: 5
accepted answer of: http://stackoverflow.com/q/26280636
type: AcceptedAnswer

http://stackoverflow.com/q/26198966
score: 0
has answer: http://stackoverflow.com/a/26199122
answer count: 1
accepted answer: http://stackoverflow.com/a/26199122
tagged with: android
type: AnsweredQuestion
type: Question
has body: I am brand new to Android, migrating from iOS. I am developing a fitness app (4.3+) that calculates the users location and tracks it. Everything is working great, except when the app goes into the background, I stop receiving location updates. I am currently using a BroadcastReceiver from my GPSManager class to the UserFitness class. In the GPSManager class, I get the LocationManager started and everything else including starting location updates. It then gets broadcasted to the UserFitness class every time a new location update is available and some calculation is done here, stored, and displayed to the user. I have researched that I need to implement a Service for the LocationManager to work in the background but I am not sure how to implement it for my current code. All my code is below. Can anyone tell me how to get location updates in the background based on my code and whether this is possible for about 4 hours at a time without the system destroying the process? And if the system does destroy it, what can be done to get the process back to it's previous state ASAP? Thank you! CODE GPSManager.java public class GPSManager{ private static final String TAG = "GPSManager"; public static final String ACTION_LOCATION = "com.fitnesstracker.ACTION_LOCATION"; private static GPSManager sGPSManager; private Context mAppContext; private LocationManager mLocationManager; private Location mLastLocation; private GPSManager (Context appContext,GpsStatus.Listener listen) { mAppContext = appContext; mLocationManager = (LocationManager) mAppContext.getSystemService(Context.LOCATION_SERVICE); mLocationManager.addGpsStatusListener(listen); } public static GPSManager get (Context c,GpsStatus.Listener listen) { if (sGPSManager == null) { //USE THE APPLICATION CONTEXT TO AVOID LEAKING ACTIVITIES sGPSManager = new GPSManager(c,listen); } return sGPSManager; } private PendingIntent getLocationPendingIntent (boolean shouldCreate) { Intent broadcast = new Intent(ACTION_LOCATION); int fla…
tagged with: java
has title: Receive GPS Location updates in background

http://stackoverflow.com/q/26335464
score: 0
has answer: http://stackoverflow.com/a/38685348
type: UnansweredQuestion
tagged with: google-app-engine
has body: I'm trying to deploy my app to Web App Engine. I have WAE module in web part of my project; there is a path specified in Modules/web/Google App Engine: /Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/ Although when I click on we in general (Modules/web/"Paths" tab), I see following settings: Output path: /Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/classes The problem is: When I click "Upload Web App Engine Application" following error appears: Bad configuration: Could not locate /Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml I don't get it why it tries to search in wrong directory, not the one specified in Modules. Please advise. Edit I noticed that in Modules/web/"Sources" tab whole folder named "target" is excluded. Maybe that's the problem?
has title: Uploading app to Web App Engine in IntelliJ
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27863374
tagged with: intellij-idea

http://stackoverflow.com/q/26283239
has comment: http://stackoverflow.com/comment/41238205
has title: Compare 2 Numbers in Java
has comment: http://stackoverflow.com/comment/41238327
downvote count: 6
possible better answer: http://stackoverflow.com/a/26283545
has comment: http://stackoverflow.com/comment/41239029
linked to: http://stackoverflow.com/q/2683202
has answer: http://stackoverflow.com/a/26283545
tagged with: java
has comment: http://stackoverflow.com/comment/41238229
has body: I know there're already a lot of questions like this. But what if I need to compare 2 Numbers and I don't know what types they are. Which means one of them could be Float and another one be Long. Are there some libs in JavaCore or Apache that can solve this issue (unfortunalety NumberUtils lacks this method)? I've been looking for a few hours but haven't succeeded. Or I should reinvent the wheel with something like this. I just don't believe that such high-level language like Java doesn't have tools to compare 2 numbers.
type: Question
has answer: http://stackoverflow.com/a/26283382
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41238182
has comment: http://stackoverflow.com/comment/41245472
has comment: http://stackoverflow.com/comment/41238124
has comment: http://stackoverflow.com/comment/41238217
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/41238285
score: -6
accepted answer: http://stackoverflow.com/a/26283382
linked to: http://stackoverflow.com/q/3214448
favorite count: 0
has comment: http://stackoverflow.com/comment/41238626
has comment: http://stackoverflow.com/comment/41238186

http://stackoverflow.com/comment/41223977
type: QuestionComment
comment on: http://stackoverflow.com/q/26244778
has text: @EsbenSkovPedersen but then how would I know they overlapped?
score: 0
type: Comment

http://stackoverflow.com/a/26331758
has comment: http://stackoverflow.com/comment/41327533
type: Answer
has body: It is O(N) in time. For example, A[K] &gt; 0, then you have already have K steps. Then you run another N-K steps and return. So totally you have O(N). Let us say, all A[i] &lt; 0, this will make the inner loop away. So it is O(N) in this case. Now let us say, A[0] &gt; 0, this will make the out loop only repeat once and the inner loop will run from 1 to N - 1, so totally you have 1 + (N-1 - 1 + 1) = N. Now let us say, A[1] &gt; 0, this will make the out loop only repeat twice and the inner loop will run from 2 to N - 1, so totally you have 2 + (N-1 - 2 + 1) = N. ... Now let us say, A[k] &gt; 0, this will make the out loop only repeat k + 1 times and the inner loop will run from k + 1 to N - 1, so totally you have k + 1 + (N-1 - k -1 + 1) = N. Now let us say, A[N-1] &gt; 0, this will make the out loop only repeat N and the inner loop will never run, so totally you have N times.
upvote count: 3
has comment: http://stackoverflow.com/comment/41327681
downvote count: 0
answers question: http://stackoverflow.com/q/26331724
has comment: http://stackoverflow.com/comment/41327242
score: 3

http://stackoverflow.com/a/50951454
downvote count: 0
type: Answer
has body: As has, to some extent, been mentioned before, an enum is a Java class with the special condition that its definition must start with at least one "enum constant". Apart from that, and that enums can't be extended or used to extend other classes, an enum is a class like any class, and you use it by adding methods below the constant definitions: public enum MySingleton { INSTANCE; public void doSomething() { ... } public synchronized String getSomething() { return something; } private String something; } You access the singleton's methods along these lines: MySingleton.INSTANCE.doSomething(); String something = MySingleton.INSTANCE.getSomething(); The use of an enum, instead of a class, is, as has been mentioned in other answers, mostly about a thread-safe instantiation of the singleton and a guarantee that it will always only be one copy. And, perhaps, most importantly, that this behavior is guaranteed by the JVM itself and the Java specification. Here's a section from the Java specification on how multiple instances of an enum instance is prevented: An enum type has no instances other than those defined by its enum constants. It is a compile-time error to attempt to explicitly instantiate an enum type. The final clone method in Enum ensures that enum constants can never be cloned, and the special treatment by the serialization mechanism ensures that duplicate instances are never created as a result of deserialization. Reflective instantiation of enum types is prohibited. Together, these four things ensure that no instances of an enum type exist beyond those defined by the enum constants. Worth noting is that after the instantiation any thread-safety concerns must be handled like in any other class with the synchronized keyword etc.
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/26285520

http://stackoverflow.com/comment/41328277
type: Comment
score: 1
type: AnswerComment
has text: Java String, char and Character use Unicode/UTF-16 so instead of ASCII say UTF-16 code-unit value.
comment on: http://stackoverflow.com/a/26332043

http://stackoverflow.com/comment/41245611
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26287034
has text: override tostring maybe?
score: 0

http://stackoverflow.com/comment/41100979
has text: If you are using spring mvc then you need to put information at your method level e.g. @RequestMapping(value="/new", method = RequestMethod.POST)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26202147
type: Comment

http://stackoverflow.com/a/26266455
upvote count: 1
has comment: http://stackoverflow.com/comment/41209118
has comment: http://stackoverflow.com/comment/41209275
type: AcceptedAnswer
downvote count: 0
has body: You should be doing listView = (ListView) rootView.findViewById(R.id.list); because Fragment doesn't have findViewById method. http://developer.android.com/reference/android/app/Fragment.html
has comment: http://stackoverflow.com/comment/41209172
type: Answer
accepted answer of: http://stackoverflow.com/q/26266382
score: 1
has comment: http://stackoverflow.com/comment/41209005
answers question: http://stackoverflow.com/q/26266382
has comment: http://stackoverflow.com/comment/41208950

http://stackoverflow.com/a/26214684
has body: Are you sure that objects are using more memory? I would say that you are using more space with the virtual function table but not with each object.
type: Answer
answers question: http://stackoverflow.com/q/26214546
has comment: http://stackoverflow.com/comment/41111329
score: 0

http://stackoverflow.com/q/26302003
has title: Android Java exception even after string null or empty check
has answer: http://stackoverflow.com/a/37429176
tagged with: string
has comment: http://stackoverflow.com/comment/41272642
favorite count: 0
has comment: http://stackoverflow.com/comment/41273370
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41272881
accepted answer: http://stackoverflow.com/a/26302064
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26302128
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26302064
tagged with: java
has comment: http://stackoverflow.com/comment/41272852
has comment: http://stackoverflow.com/comment/41274588
has body: I really don't understand why java.lang.NumberFormatException: Invalid long: "null" happens here. The problem snippet is like followings. try { userid = ((JSONObject) msg.obj).getString("userid"); if (userid.equals("") || userid.isEmpty() || null==userid) { onClickLogout(); return; } else { client.setUserid(Long.parseLong(userid)); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); onClickLogout(); return; } the line client.setUserid(Long.parseLong(userid)); gets following exception java.lang.NumberFormatException: Invalid long: "null" at java.lang.Long.invalidLong(Long.java:125) at java.lang.Long.parse(Long.java:362) at java.lang.Long.parseLong(Long.java:353) at java.lang.Long.parseLong(Long.java:319) at client.setUserid(Long.parseLong(userid)); The point is that the null exception occurs even after null and empty check of the userid in the code. What's wrong with me here? please check it out experts!
answer count: 3
tagged with: null
has answer: http://stackoverflow.com/a/26302128

http://stackoverflow.com/comment/93934516
comment on: http://stackoverflow.com/a/26313517
score: 0
has text: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/184450/discussion-between-ridhuvarshan-and-boris-the-spider).
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41301325
has text: a call to glGetActiveUniformBlockiv(iprogram, blockindex, GL3.GL_UNIFORM_BLOCK_DATA_SIZE, blockB); which returned 48 in the first position of IntBuffer blockB. Dividing 48 by 4 would give me 12 floats - two extra. Do I really need to use glGetActiveUniformBlockiv if I already know what data is going into the block?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26317407
type: AnswerComment

in-app-purchase
tags question: http://stackoverflow.com/q/26325179
type: Tag
tag name: in-app-purchase
tags question: http://stackoverflow.com/q/26260138

http://stackoverflow.com/q/26308699
has comment: http://stackoverflow.com/comment/41286450
has comment: http://stackoverflow.com/comment/41286767
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41285179
has comment: http://stackoverflow.com/comment/41285510
has comment: http://stackoverflow.com/comment/41285484
has comment: http://stackoverflow.com/comment/41285309
has comment: http://stackoverflow.com/comment/41286355
type: Question
has comment: http://stackoverflow.com/comment/41285103
has answer: http://stackoverflow.com/a/26308748
tagged with: search
has comment: http://stackoverflow.com/comment/41285113
has comment: http://stackoverflow.com/comment/41285253
tagged with: char
answer count: 2
has answer: http://stackoverflow.com/a/26308785
tagged with: string
has body: I am trying to do my assignment. I think that I am really close to solving it, but I can't do it.. I've been trying to do it for last several hours. What I am trying to do: I have a string and a char. I am trying to implement the binary search to look for a char, but it doesn't return the value that I want. Well it is correct, but I want this code to return 5 instead of 4. This is my code, can You help me to solve it? There is no sort method, because I didn't want the code in here to be super long, but please assume that sorting method sorts correctly. If you'd like to see the sorting method then I am able to upload it for you. I would appreciate any kind of help, because I've spent way to much time for it.. :/. public static void main(String[] args) { String s = "abcdefg"; char c = 'e'; System.out.println(findRecursiveD(s, c)); } public static int binarySearch(char[] a, char c, int start, int end) { int mid = (start + end) / 2; if(a[mid] == c) return mid; else if (a[mid] &lt; c) return binarySearch(a, c, mid+1, end); else return binarySearch(a, c, start, mid); } public static int findRecursiveD(String s, char c) { int start = 0; String S = s + c; char[] b = S.toCharArray(); int end = b.length; sort(b, 0, end); String A = new String(b); System.out.println(A); return binarySearch(b, c, start, end); } }
tagged with: binary
has title: Binary Search for a char in a string - Java
type: UnansweredQuestion

http://stackoverflow.com/a/65173942
type: Answer
upvote count: 4
has body: first, you need to set src and resource folders for IntelliJ. see the icon near the java(blue) and resources(yellow 4 lines) folder. right-click on java folder and select sources root and right-click on java folder and select resource root after that create the same package in the java folder and resource folder. for example: packages -> org.example ├─ src ├─ main ├─ java | └─ com | └─ example | └─ A.class | └─ resources └─ com └─ example └─ fxml └─ AFXML.fxml in A.class you can use this. Java FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/AFXML.fxml")); Parent root = loader.load(); Kotlin val loader = FXMLLoader(javaClass.getResource("fxml/AFXML.fxml")) val root = loader.load<Parent>() or val loader = FXMLLoader(A::class.java.getResource("fxml/AFXML.fxml")) val root = loader.load<Parent>()
score: 4
answers question: http://stackoverflow.com/q/26328040
downvote count: 0

http://stackoverflow.com/comment/41363061
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26350334
has text: Another modification. This should create the src directory in the jar itself with all the java files in it.

http://stackoverflow.com/comment/41311170
type: Comment
type: QuestionComment
has text: This is somewhat unclear. First, you say "*all the grade value from X1 to X3 should also be calculated*". But then ("However,...") it seems that you want to stop after some rule executes. - Anyway, this cannot be resolved without some code showing what you have (then we see what happens) and a (somewhat clearer) description of what really should happen in the rules.
score: 0
comment on: http://stackoverflow.com/q/26322576

http://stackoverflow.com/comment/41082379
comment on: http://stackoverflow.com/q/26198965
score: 0
type: Comment
type: QuestionComment
has text: _What is the advantage of creating interface object?_ You can't create an interface object. You can define a reference variable whose type is an interface.

http://stackoverflow.com/q/26258313
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26462901
score: 2
upvote count: 3
tagged with: java
tagged with: pkcs#11
tagged with: itext
downvote count: 1
type: Question
has title: Sign multiple PDFs without calling login for each file
has body: When I will sign multiple PDF's I have one problem. My code is: public void signPDF(X509Certificate cert, List&lt;File&gt; fInl, List&lt;File&gt; fOutl, PrivateKey key) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, InvalidParameterSpecException, DocumentException, InvalidKeyException, SignatureException, KeyStoreException, CertificateException, UnrecoverableKeyException { Certificate[] cc = new Certificate []{cert}; int i=0; for(i=0;i&lt;fInl.size();i++){ PdfReader reader = new PdfReader(fInl.get(i).getAbsolutePath()); FileOutputStream outputFile = new FileOutputStream(fOutl.get(i).getAbsolutePath()); PdfStamper stamper = PdfStamper.createSignature(reader, outputFile, '\0'); PdfSignatureAppearance sap = stamper.getSignatureAppearance(); sap.setVisibleSignature(new Rectangle(100, 100, 200, 200), 1, null); Calendar cal = Calendar.getInstance(); PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED); dic.setDate(new PdfDate(cal)); dic.setName(PdfPKCS7.getSubjectFields((X509Certificate)cc[0]).getField("CN")); sap.setCryptoDictionary(dic); sap.setLayer2Text("Digitally signed by "+ dic.get(PdfName.NAME) +"\n\nDate: " + cal.getTime().toString()); HashMap&lt;PdfName,Object&gt; exc = new HashMap&lt;PdfName,Object&gt;(); exc.put(PdfName.CONTENTS, new Integer(0x2502)); sap.preClose(exc); PdfPKCS7 pk7 = new PdfPKCS7(key, cc, null, "SHA1", null, false); MessageDigest messageDigest = MessageDigest.getInstance("SHA1"); byte buf[] = new byte[8192]; int n; InputStream inp = sap.getRangeStream(); while ((n = inp.read(buf)) &gt; 0) { messageDigest.update(buf, 0, n); } byte hash[] = messageDigest.digest(); byte sh[] = pk7.getAuthenticatedAttributeBytes(hash, cal); pk7.update(sh, 0, sh.length); PdfDictionary dic2 = new PdfDictionary(); byte sg[] = pk7.getEncodedPKCS7(hash, cal); byte out[] = new byte[0x2500 / 2]; System.arraycopy(sg, 0, out, 0, sg.length); dic2.put(PdfName.CONTENTS, new PdfString(out).setHexWriting(true)); sap.cl…
has comment: http://stackoverflow.com/comment/41538203
has comment: http://stackoverflow.com/comment/41532387
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
favorite count: 0

http://stackoverflow.com/a/32447471
downvote count: 0
answers question: http://stackoverflow.com/q/26269592
has body: I know this question was asked long back, but I just worked on one java program to have permutation of integers with repetitions allowed. I am putting my code here, in case if someone needs it. This program can generate permutations for specified length. i.e. For integers 1,2 and lengthOfSinglePermutation = 2, output should be 11 21 12 22 For integers 1,2 and lengthOfSinglePermutation = 3, output should be 111 211 121 221 112 212 122 222 Hope this helps. public class PermutationsWithRepetitions { public static void main(String[] args) { int[] input = { 1, 2 }; int lengthOfSinglePermutation = 3; // we need to check number of unique values in array Set&lt;Integer&gt; arrValues = new HashSet&lt;Integer&gt;(); for (int i : input) { arrValues.add(i); } int noOfUniqueValues = arrValues.size(); int[] indexes = new int[lengthOfSinglePermutation]; int totalPermutations = (int) Math.pow(noOfUniqueValues, lengthOfSinglePermutation); for (int i = 0; i &lt; totalPermutations; i++) { for (int j = 0; j &lt; lengthOfSinglePermutation; j++) { System.out.print(input[indexes[j]]); } System.out.println(); for (int j = 0; j &lt; lengthOfSinglePermutation; j++) { if (indexes[j] &gt;= noOfUniqueValues - 1) { indexes[j] = 0; } else { indexes[j]++; break; } } } } }
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/41081990
type: AnswerComment
has text: 1. How do I use the scanner to break lines into components of what I need?
type: Comment
comment on: http://stackoverflow.com/a/26198711
score: 0

http://stackoverflow.com/comment/41338158
score: 0
type: Comment
has text: Since `EditorPanePrinter` isn't part of the base libraries it's difficult to provide more suggestions, but it, itself, must implement `Printable`...
type: AnswerComment
comment on: http://stackoverflow.com/a/26333828

http://stackoverflow.com/comment/41152523
has text: @Makoto it seems clear to me that Imran was referring to the docs with his comment.
score: 1
comment on: http://stackoverflow.com/q/26236738
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26235583
has comment: http://stackoverflow.com/comment/41150746
linked to: http://stackoverflow.com/q/2197051
has comment: http://stackoverflow.com/comment/41150429
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41150729
has body: Hi I am new to aspectj and after several hours of browsing around the internet I came to know something about aspectj. And also I had one doubt is this similar to immediate window in visual studio as in the aspectj in which we doing manually checking joint points...In immediate window if we type any variable it returns its value in current method. Likewise, in aspectj we are declaring manually that after calling specified function and returing variable values inside that method using system.out.println(). Is that right? if it is wrong...correct me
tagged with: java
has title: Aspectj concept in eclipse
has comment: http://stackoverflow.com/comment/41150285
type: Question
tagged with: aspectj
has comment: http://stackoverflow.com/comment/41150541
score: 0
has comment: http://stackoverflow.com/comment/41150618
answer count: 1
has answer: http://stackoverflow.com/a/26235964
has comment: http://stackoverflow.com/comment/41150700
accepted answer: http://stackoverflow.com/a/26235964

http://stackoverflow.com/comment/41084984
has text: Is the bitmap a square? And also, which direction do you plan on rotating it? Isn't there more information that we should have like the dimensions or the direction to flip it?
comment on: http://stackoverflow.com/q/26200371
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41845458
has text: You were likely experiencing circular bean references which are not handled very well when BeanPostProcessors using (method security). If you have a sample that reproduces the issue, I'd encourage you to report a bug at https://jira.spring.io/browse/SEC/ Are you using Boot, if so it is possibly related to https://jira.spring.io/browse/SEC-2661
score: 3
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26615970

http://stackoverflow.com/a/26202933
accepted answer of: http://stackoverflow.com/q/26202769
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41089799
has body: ? means "unknown type". Since the type is unknown, the compiler can't guarantee that the type is Map&lt;String, String&gt;. So it refuses to let you add anything in the queue, since it could compromise its type-safety. Your variable should be declared as Queue&lt;Map&lt;String, String&gt;&gt; q = new LinkedList&lt;Map&lt;String, String&gt;&gt;(); or simply, if you're on Java 7 or later Queue&lt;Map&lt;String, String&gt;&gt; q = new LinkedList&lt;&gt;();
upvote count: 1
answers question: http://stackoverflow.com/q/26202769
downvote count: 1

http://stackoverflow.com/a/26334314
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26334292
has comment: http://stackoverflow.com/comment/41452364
has comment: http://stackoverflow.com/comment/41332859
downvote count: 0
has body: Because of your android:minSdkVersion="8". So, you should change this &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.map.MapFragment"/&gt; to &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.map.SupportMapFragment"/&gt; and also change public class MainActivity extends Activity to public class MainActivity extends FragmentActivity Update: Also you should add Google play service version as &lt;meta-data&gt; tag under &lt;application&gt; tag in your manifest.xml. &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt;

http://stackoverflow.com/a/26218508
has body: As others have said: Either use BigDecimal or -- the better solution in most cases -- do your calculations in pennies rather than dollars. That gets rid of most of the round-off issues immediately!
answers question: http://stackoverflow.com/q/26218291
score: 0
has comment: http://stackoverflow.com/comment/41118797
has comment: http://stackoverflow.com/comment/41118571
has comment: http://stackoverflow.com/comment/41118541
type: Answer
has comment: http://stackoverflow.com/comment/41118923

http://stackoverflow.com/comment/41268672
type: Comment
type: QuestionComment
has text: @giannisapi Can't think of anything else that can cause this problem.
score: 0
comment on: http://stackoverflow.com/q/26294212

http://stackoverflow.com/a/26371628
has body: I changed the code but the result is same :( package com.example.fibonacci; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends ActionBarActivity { Button btn1; TextView tv1; EditText edt1; String msj= "d"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn1 = (Button) findViewById(R.id.btn1); tv1 = (TextView) findViewById(R.id.tv1); edt1 = (EditText) findViewById(R.id.edt1); btn1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { double n = Double.valueOf(edt1.getText().toString()); double a = (1 / (Math.sqrt(5))); double b = ((1+(Math.sqrt(5)))/2); double c = ((1-(Math.sqrt(5)))/2); double i = a * ((Math.pow(b,n)) - (Math.pow(c,n))); String k = String.valueOf(i); msj = edt1.getText().toString(); tv1.setText( k ); } }); } @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); } }
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26349156
upvote count: 0
has comment: http://stackoverflow.com/comment/41414961
score: -1

http://stackoverflow.com/comment/41214155
type: QuestionComment
type: Comment
has text: Your professor will be disappoint with this
comment on: http://stackoverflow.com/q/26270005
score: 0

http://stackoverflow.com/q/26204042
has answer: http://stackoverflow.com/a/26205294
has comment: http://stackoverflow.com/comment/41092366
has comment: http://stackoverflow.com/comment/41093615
has comment: http://stackoverflow.com/comment/41093739
favorite count: 0
score: -1
type: Question
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41093577
has body: i am using a method i found on the internet that was in cpp and i changed it a bit for java. it seems to work only half the time. is it a bug with java? because it will return true or false depending on where you are inside the triangle. can anybody help me fix it or find a better way to test for a point inside a triangle? heres the method. sorry if its hard to understand the question public static float area(float x1, float y1, float x2, float y2, float x3, float y3) { return (float) Math.abs((x1*(y2-y3) + x2*(y3-y1)+ x3*(y1-y2))/2.0); } /* A function to check whether point P(x, y) lies inside the triangle formed by A(x1, y1), B(x2, y2) and C(x3, y3) */ public static boolean isInside(float x1, float y1, float x2, float y2, float x3, float y3, float x, float y) { /* Calculate area of triangle ABC */ float A = area (x1, y1, x2, y2, x3, y3); /* Calculate area of triangle PBC */ float A1 = area (x, y, x2, y2, x3, y3); /* Calculate area of triangle PAC */ float A2 = area (x1, y1, x, y, x3, y3); /* Calculate area of triangle PAB */ float A3 = area (x1, y1, x2, y2, x, y); /* Check if sum of A1, A2 and A3 is same as A */ return (A == A1 + A2 + A3); }
tagged with: opengl
has comment: http://stackoverflow.com/comment/41093258
tagged with: math
tagged with: java
tagged with: lwjgl
has title: Getting odd results with a method for getting point inside triangle
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41091772
has comment: http://stackoverflow.com/comment/41093177

http://stackoverflow.com/comment/41312409
type: Comment
has text: @Dici yes i think i can't guarantee .but my program is just for simple class .accuracy not want to be 100
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26323771

http://stackoverflow.com/q/26219171
type: AnsweredQuestion
tagged with: java
has body: I want to allow alpha numeric values and only a few special characters in my string. regex [a-zA-Z0-9[@#%&amp;\\s]] When I tried with Matcher.find(), it's saying true, even if I used other special characters in the string. Ex : welcome123^456. It should get false (not-matched). When I used String.matches(), it's saying false, even for the correct pattern. Ex: welcomeAA123@. Its supposed to get true. But I am getting false. Following are the only 5 special chars I wish to allow along with Alpha+numeric. @ # $ % &amp; For Ex: welcome123# - should get true welcome123$ - should get true welcome123_ - should get false (because underscore is not allowed.) welcome$@ - should get true 1234$@ - should get true
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26219413
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41119847
score: -2
tagged with: regex
possible better answer: http://stackoverflow.com/a/26219252
has comment: http://stackoverflow.com/comment/41119846
has answer: http://stackoverflow.com/a/26219252
has title: Java regex pattern not working as mentioned
downvote count: 2
has answer: http://stackoverflow.com/a/26219413
has comment: http://stackoverflow.com/comment/41119824

http://stackoverflow.com/comment/41332604
score: 0
has text: `list.get(2)[0]` and `list.get(3)[0]` 0 stands for array index
comment on: http://stackoverflow.com/a/26333979
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41326297
comment on: http://stackoverflow.com/a/26329714
has text: @user2988501 I'm not sure I follow what you mean. The code I gave will process the *whole* of `al4`. Are you wanting to add a new list to `al4` and then just process that last bit? You might need to give an example if I've misunderstood what you're trying to do.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41363371
comment on: http://stackoverflow.com/q/26351567
type: Comment
type: QuestionComment
score: 0
has text: I appreciate the advice... so is VB the same way? Every instructional tool I had at my school made you use the drag/drop stuff. I guess that's what put me on this bad path.. I just assumed it was 'the way'.

http://stackoverflow.com/comment/41229025
type: QuestionComment
comment on: http://stackoverflow.com/q/26278277
score: 0
has text: @SimoneGianni i did not get it can you please elaborate on your answer, as its a HTTPS website only and i cant login using http.
type: Comment

keystore
tags question: http://stackoverflow.com/q/26272808
tags question: http://stackoverflow.com/q/26239474
tags question: http://stackoverflow.com/q/26262102
tag name: keystore
tags question: http://stackoverflow.com/q/26278053
tags question: http://stackoverflow.com/q/26211480
tags question: http://stackoverflow.com/q/26279314
type: Tag

http://stackoverflow.com/a/26276616
upvote count: 1
score: -2
has comment: http://stackoverflow.com/comment/41225818
has comment: http://stackoverflow.com/comment/41226332
has comment: http://stackoverflow.com/comment/41226699
has comment: http://stackoverflow.com/comment/41225738
type: Answer
answers question: http://stackoverflow.com/q/26275665
has body: Main concept of Java generics: if ChildClass extends ParentClass it DOES NOT mean YourApi&lt;ChildClass> extends YourApi&lt;ParentClass>. E.g.: NumberTransform&lt;String, ? extends Number&gt; intTransform = new IntegerTransform&lt;String, Integer&gt;(); // work with Integer numbers only NumberTransform&lt;String, ? extends Number&gt; longTransform = new LongTransform&lt;String, Long&gt;(); // work with Long numbers only longTransform.toA((Integer) 1); // you are trying to make this and got compilation error. To help compiler replace your t initialization: Transform&lt;? extends BaseA, B&gt; t = (Transform&lt;? extends BaseA, B&gt;) _map.get(b.getClass());
has comment: http://stackoverflow.com/comment/41226663
downvote count: 3

http://stackoverflow.com/a/26254119
score: 0
type: Answer
has body: Your client is accepting results of media type "application/json", but your REST webservice returns "text/plain". Check this post to see a possible solution: MessageBodyReader not found for media type=application/octet-stream
answers question: http://stackoverflow.com/q/26252526

http://stackoverflow.com/comment/41363408
score: 1
has text: `if(deckSize == 0)` can't throw an NPE so you'll have to check the line number again for us. (It could if `deckSize` was a null Integer being unboxed but it's not. `deckSize` is int.)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26351644

http://stackoverflow.com/comment/41181571
comment on: http://stackoverflow.com/q/26252334
has text: Why don't you read up on regex's?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26222686
has comment: http://stackoverflow.com/comment/41126924
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26223569
tagged with: java
has body: I'm using a filechooser to select an image file. When the open button is clicked i want to copy the image to my project folder.The code isn't showing any errors but nothing happens. nothing is copied. if (returnVal == JFileChooser.APPROVE_OPTION) { File file = jFileChooser1.getSelectedFile(); File target = new File("/"+file.getName()); try { Files.copy(file.toPath(),target.toPath(),REPLACE_EXISTING); } catch (IOException ex) { Logger.getLogger(detail1.class.getName()).log(Level.SEVERE, null, ex); } } I used ',' instead of '+' in File target = new File("/"+file.getName()); but no luck, Whats the problem here ?
upvote count: 1
downvote count: 1
tagged with: jfilechooser
type: Question
has comment: http://stackoverflow.com/comment/41126934
has title: Copying file selected from jfilechooser
answer count: 2
has answer: http://stackoverflow.com/a/26222877
has comment: http://stackoverflow.com/comment/41127044
score: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26222877
has answer: http://stackoverflow.com/a/26223569

http://stackoverflow.com/comment/41112206
type: QuestionComment
has text: @UwePlonus It's just an exercise. And I'm not frightened by difficulty.
comment on: http://stackoverflow.com/q/26214041
score: 0
type: Comment

http://stackoverflow.com/comment/41239180
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26283221
has text: I cant because these methods are protected... protected abstract DesktopPeer createDesktopPeer(Desktop target) throws HeadlessException; so DefaultToolkit don't have any of these
score: 0

http://stackoverflow.com/a/29144265
upvote count: 2
has body: You can go one level up, so the IFoo.bar() is available in ISubFoo with IFoo.super.bar(). interface IFoo { default void bar() {} } interface ISubFoo extends IFoo { // is IFoo.bar available anywhere in here? // Yes it is default void bar { IFoo.super.bar() } } class MyClass implements ISubFoo { // is IFoo.bar available anywhere in here too? // Not it is not public static void main(String[] args) { MyClass mc = new MyClass(); mc.bar(); // calls ISubFoo.bar } }
answers question: http://stackoverflow.com/q/26260145
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/26221273
upvote count: 1
type: Question
tagged with: amazon-s3
score: 1
tagged with: java
has title: How do I copy contents of a bucket which is of the form bucketName/folder1/folder2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41124200
has answer: http://stackoverflow.com/a/26221718
has body: I want to copy folder2 contents and not the whole contents of bucketName. I am using the following code but no success. I actually see no output. If I just copy the contents of the bucket and not the sub folders, I see the entire contents in the destination bucket. How do I just copy the contents of the subfolder2 under the bucket. System.out.println("Listing objects and copying objects"); if (!prefix.endsWith(delimiter)) { prefix += delimiter; } ListObjectsRequest listObjectsRequest = new ListObjectsRequest() .withBucketName(bucketName) .withPrefix(prefix) .withDelimiter(delimiter); ObjectListing objectListing; objectListing = s3Client.listObjects(listObjectsRequest); for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) { s3Client.copyObject(bucketName, objectSummary.getKey(), bucketName2, "output/" + objectSummary.getKey()); System.out.println(" - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")"); listObjectsRequest.setMarker(objectListing.getNextMarker());
favorite count: 0
accepted answer: http://stackoverflow.com/a/26221718
type: AnsweredQuestion

http://stackoverflow.com/comment/41294063
has text: @Zavior I've attached a link to the question, that details it. But I am not sure what is the solution that is prescribed there.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26313902
score: 0

http://stackoverflow.com/a/26338164
upvote count: 3
has body: This may help you, DecimalFormat myFormatter = new DecimalFormat("$###,###.###"); String output = myFormatter.format(amount); System.out.println(output);
downvote count: 0
answers question: http://stackoverflow.com/q/26338025
type: Answer
score: 3

http://stackoverflow.com/a/26259984
answers question: http://stackoverflow.com/q/26259957
has comment: http://stackoverflow.com/comment/41195072
score: 4
has comment: http://stackoverflow.com/comment/41195747
has comment: http://stackoverflow.com/comment/41195047
has comment: http://stackoverflow.com/comment/41195425
type: Answer
has body: Don't provide setters (mutators), make immutable attributes private, only provide value assignment via constructor. You can always declare your immutable attributes final. So you can only assign them values once and can't change them later.
has comment: http://stackoverflow.com/comment/41195561
downvote count: 1
upvote count: 5

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/26295558

http://stackoverflow.com/a/26204346
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: Of course, second after I post this, I found an answer. The dependencies don't get bundled for execution. If they are not bundled, the jars of dependencies have to be in the same folder (?). Anyway, this helped me: How can I create an executable JAR with dependencies using Maven?
answers question: http://stackoverflow.com/q/26204255

http://stackoverflow.com/comment/41364817
comment on: http://stackoverflow.com/a/26352430
has text: @Sara, I've updated my answer. Also, you can use `java -version` to determine what JVM release is installed.
score: 0
type: AnswerComment
type: Comment

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/26263093
tags question: http://stackoverflow.com/q/26320031

http://stackoverflow.com/q/26350362
answer count: 1
tagged with: user-interface
tagged with: jlabel
type: UnansweredQuestion
has title: Java GUI actionPerformed() Issue
tagged with: java
has comment: http://stackoverflow.com/comment/41361382
type: Question
has body: So I've been making this GUI temperature converter for my college class and I'm almost done but I can't figure out why I can't get the button btnCalc to display the results from the different checkboxes. It'll display something if I do if(ae.getSource()==btnCalc) JOptionPane.showMessageDialog(this,"Button"); Anyway I would really appreciate any help if figuring this out. I just want the program to display the results after hitting the calculate button. package TempConverter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; /** * * @author 00220682 */ public class TempConvertGUI extends javax.swing.JFrame implements ActionListener{ public TempConvertGUI() { initComponents(); btnCalc.addActionListener(this); degrees.addActionListener(this); CtoF.addActionListener(this); FtoC.addActionListener(this); } /** * 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() { buttonGroup1 = new javax.swing.ButtonGroup(); jLabel1 = new javax.swing.JLabel(); degrees = new javax.swing.JTextField(); btnCalc = new javax.swing.JButton(); lblResults = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); CtoF = new javax.swing.JCheckBox(); FtoC = new javax.swing.JCheckBox(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Temperate Converter"); jLabel1.setText("Enter The Degrees:"); degrees.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { degreesActionPerformed(evt); } }); btnCalc.setText("Calculate"); btnCalc.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnCalcMouseClicked(evt); } }); btnCalc.addActionList…
score: 0
has answer: http://stackoverflow.com/a/26350421

http://stackoverflow.com/q/26273494
has answer: http://stackoverflow.com/a/26273874
has body: I develop app for android. I need send text and link via intent to twitter, but text and link are too long. In web version links will always be shortened, but on app not. Is possible send this message?
tagged with: android
tagged with: android-intent
answer count: 1
tagged with: java
score: 0
tagged with: twitter
accepted answer: http://stackoverflow.com/a/26273874
linked to: http://stackoverflow.com/q/5765747
has comment: http://stackoverflow.com/comment/41220726
type: AnsweredQuestion
has title: My text and url uploaded via intent are too long for twitter
tagged with: share
type: Question

http://stackoverflow.com/a/26483048
type: Answer
score: 2
downvote count: 0
has body: Here is a code sample in Java that demonstrates how to add a graphical signature using CoSign Signature SOAP API: public static void AddGraphicalImage(String username, String domain, String password, byte[] imageBuffer, String imageName) throws Exception { try { SignRequest request = new SignRequest(); RequestBaseType.OptionalInputs optInputs = new RequestBaseType.OptionalInputs(); // Set signature type optInputs.setSignatureType("http://arx.com/SAPIWS/DSS/1.0/set-graphic-image"); // Set user credentials ClaimedIdentity claimedIdentity = new ClaimedIdentity(); NameIdentifierType nameIdentifier = new NameIdentifierType(); nameIdentifier.setValue(username); nameIdentifier.setNameQualifier(domain); CoSignAuthDataType coSignAuthData = new CoSignAuthDataType(); coSignAuthData.setLogonPassword(password); claimedIdentity.setName(nameIdentifier); claimedIdentity.setSupportingInfo(coSignAuthData); optInputs.setClaimedIdentity(claimedIdentity); // Set graphical image data GraphicImageType graphicImage = new GraphicImageType(); graphicImage.setGraphicImage(imageBuffer); graphicImage.setDataFormat(Long.valueOf(6)); //JPG graphicImage.setGraphicImageName(imageName); optInputs.setGraphicImageToSet(graphicImage); request.setOptionalInputs(optInputs); // Initiate service client DSS client = new DSS(new URL("https://prime.cosigntrial.com:8080/sapiws/dss.asmx")); // Send the request DssSignResult response = client.getDSSSoap().dssSign(request); // Check result String errmsg = "" + response.getResult().getResultMajor(); if (errmsg.compareTo("urn:oasis:names:tc:dss:1.0:resultmajor:Success") == 0) { System.out.println("Graphical image was added successfully!"); return; } else { throw new Exception(response.getResult().getResultMessage().toString()); } } catch (Exception e) { System.out.println("Error: " + e.getMessage()); e.printStackTrace(); } }
upvote count: 2
answers question: http://stackoverflow.com/q/26292915

http://stackoverflow.com/comment/41340084
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26338721
has text: I added more info. I expect to be redirected to index.php and currently I get redirected to login.php. Note I send the request to a file called "login2.php"
score: 0

http://stackoverflow.com/comment/41489927
has text: Having both `Api#forEach(org.mylib.Consumer)` and `Api#forEach(j.u.f.Consumer)` is not viable, because each time the user writes `api.forEach(System.out::println)`, he will get a compilation error. He should write `api.forEach((j.u.f.Consumer) System.out::println)` that is ugly.
comment on: http://stackoverflow.com/a/26417173
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41203499
has text: super exist hidden even you don't call
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26264302

http://stackoverflow.com/comment/41184317
comment on: http://stackoverflow.com/q/26253678
type: Comment
type: QuestionComment
score: 0
has text: That not a clear description.

oop
tags question: http://stackoverflow.com/q/26214973
tags question: http://stackoverflow.com/q/26210467
tags question: http://stackoverflow.com/q/26349006
tags question: http://stackoverflow.com/q/26263464
tags question: http://stackoverflow.com/q/26271282
tag name: oop
tags question: http://stackoverflow.com/q/26344913
tags question: http://stackoverflow.com/q/26311344
tags question: http://stackoverflow.com/q/26229977
tags question: http://stackoverflow.com/q/26283000
tags question: http://stackoverflow.com/q/26241106
tags question: http://stackoverflow.com/q/26277165
tags question: http://stackoverflow.com/q/26238077
tags question: http://stackoverflow.com/q/26264432
tags question: http://stackoverflow.com/q/26268506
tags question: http://stackoverflow.com/q/26241411
tags question: http://stackoverflow.com/q/26198978
tags question: http://stackoverflow.com/q/26212415
tags question: http://stackoverflow.com/q/26240540
tags question: http://stackoverflow.com/q/26198213
tags question: http://stackoverflow.com/q/26277986
tags question: http://stackoverflow.com/q/26223078
tags question: http://stackoverflow.com/q/26323586
type: Tag
tags question: http://stackoverflow.com/q/26318870
tags question: http://stackoverflow.com/q/26321396

http://stackoverflow.com/q/26245884
has body: This is a question relating more to coding standards than anything else. The problem that I am having is that I am struggling to use my prepared statements as a class/constructor (I am from an informix background btw java is still new to me). Usually when I code I like to keep scripting out of the main block as much as possible and then call in functions as I need them like in the example I will show. I am also exaggerating the structure with lots of forward slashes. public class Script { ///////////////////////////////////////////////////////////////// start main public static void main(String[] args) { System.out.println("Script Is Starting"); // basic message classCONN conn = new classCONN(); // connect class Connection cnct = null; // connect variable // try { // try connect conn.func_driverCheck(); // cnct = conn.func_dbConnect(); // } catch(SQLException log) { // System.out.println(log); // } // *i would like to call the prepare* *statements function once for the* *rest of the script* classSQL sql = new classSQL(); // prepare statements sql.func_prep(cnct); // users_sel.setString(1, "zoh"); // insert with prepared users_sel.setString(2, "my"); // statements users_sel.setString(3, "goodness"); // row = users_sel.executeQuery(); // } ///////////////////////////////////////////////////////////////// end main ///////////////////////////////////////////////////////////////// start classes class classCONN { public void func_driverCheck() {*code to check driver*} public Connection func_dbConnect() {*code to connect to db*} } class classSQL { *I would like to prepare my statements here* public void f_prep(Connection cnct) { lv_sql = "INSERT INTO users " + "VALUES(?, ?, ?)"; PreparedStatement users_ins = cnct.prepareStatement(lv_sql); } } ///////////////////////////////////////////////////////////////// end classes } so my question being is there a way to get code like this to work so that the statements are prepared and then I can executeUpdate them from inside differ…
has comment: http://stackoverflow.com/comment/41458234
tagged with: prepared-statement
tagged with: java
tagged with: class
has comment: http://stackoverflow.com/comment/41457820
accepted answer: http://stackoverflow.com/a/26404193
has comment: http://stackoverflow.com/comment/41458167
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26246433
has answer: http://stackoverflow.com/a/26246433
tagged with: structure
has title: Java setting up prepared statements
has comment: http://stackoverflow.com/comment/41458051
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26404193

http://stackoverflow.com/q/26227877
has comment: http://stackoverflow.com/comment/41136839
has comment: http://stackoverflow.com/comment/41137218
has comment: http://stackoverflow.com/comment/89852244
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: stack
tagged with: java
has comment: http://stackoverflow.com/comment/41136881
has comment: http://stackoverflow.com/comment/41137351
has title: N Queens program using stack and backtracking
answer count: 1
has body: I'm trying write a program (for homework) that has a nxn board and I need the algorithm to find all the possible solutions to having n number of queens in a position in which none of the queens can capture each other. So the code I have now looks like this. import java.util.Stack; public class NQueens { public static int solve(int n) { Stack&lt;Integer&gt; s = new Stack&lt;Integer&gt;(); int current = 0; int numSolutions = 0; while(!(current&gt;n)){ if(s.size() == n){ break; } if(current == n){ if((s.peek()==n) &amp;&amp; (s.size() == 1)){ break; } if(s.peek() == n){ s.pop(); current = s.pop()+1; } else{ current = s.pop()+1; } } else if(validPositionChecker(s, current)){ s.push(current); current = 0; } else{ current++; } } if(s.size()==n){ printSolution(s); numSolutions++ } return numSolutions; } public static boolean validPositionChecker(Stack&lt;Integer&gt; s, int currentPosition) { for (int i = 0; i &lt; s.size(); i++) { if (s.get(i) == currentPosition){ return false; } if ((s.get(i) - currentPosition) == (s.size() - i)){ return false; } if ((currentPosition - s.get(i)) == (s.size() - i)){ return false; } } return true; } //this method prints out a solution from the current stack private static void printSolution(Stack&lt;Integer&gt; s) { for (int i = 0; i &lt; s.size(); i ++) { for (int j = 0; j &lt; s.size(); j ++) { if (j == s.get(i)) System.out.print("Q "); else System.out.print("* "); } System.out.println(); } System.out.println(); }//printSolution() public static void main(String[] args) { int n = 8; // pass in parameter n from command line if (args.length == 1) { n = Integer.parseInt(args[0].trim()); if (n &lt; 1) { System.out.println("Incorrect parameter"); System.exit(-1); }//if }//if int number = solve(n); System.out.println("There are " + number + " solutions to the " + n + "-queens problem."); }//main() } So to explain this code. This code works. But it only prints out one of the solutions. In the default nxn board of 8x8 it should have 92 unique solu…
downvote count: 0
has comment: http://stackoverflow.com/comment/41137192
favorite count: 0
tagged with: backtracking
has answer: http://stackoverflow.com/a/51441181

http://stackoverflow.com/comment/41138954
type: Comment
comment on: http://stackoverflow.com/a/26225200
has text: I would recommend you to let the started process read from `System.in` and wait for a line containing `"exit"` and upon receiving the exit command terminate.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26264016
tagged with: java
tagged with: web-services
type: Question
has body: I am having a strange problem with the ParseImageView. I have a ParseImageView defined in my layout: &lt;com.parse.ParseImageView android:id="@+id/view1_imageview" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; and I am calling the method: imageView = (ParseImageView) rootView.findViewById(R.id.view1_imageview); to initialize the imageView. But when I call: pff = (ParseFile) object.get("favimg"); Log.d("ParseFile",pff.toString()); imageView.setParseFile(pff); the image view is not set. I have confirmed that the ParseFile pff is set. Any pointers are appreciated. Thanks!
has title: ParseImageView on Android not displaying image
tagged with: imageview
has answer: http://stackoverflow.com/a/26450514
score: 0
answer count: 1
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/41168480
type: QuestionComment
has text: yes or you can use `final static Charset UTF8 = Charset.forName("UTF-8")` or StandardCharsets.UTF_8 in Java 7.
score: 0
comment on: http://stackoverflow.com/q/26243654
type: Comment

http://stackoverflow.com/q/26265761
type: Question
has comment: http://stackoverflow.com/comment/41209542
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26577848
has body: Assume I have classes ClassX in production code (src/main/java) and ClassXTest in test code (src/test/java). In some test methods I want to tamper what one of the methods of ClassX returns, so I override ClassX and its method. I do not want to use any mocking frameworks or this class to be anonymous. Is there any naming how such classes should be named?
has comment: http://stackoverflow.com/comment/41231090
tagged with: junit
has title: Naming convention for classes in test code
favorite count: 0
has comment: http://stackoverflow.com/comment/41216041
possible better answer: http://stackoverflow.com/a/26293453
has comment: http://stackoverflow.com/comment/41219707
has answer: http://stackoverflow.com/a/26293453
accepted answer: http://stackoverflow.com/a/26577848
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41215492
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/26353494
score: 1
accepted answer of: http://stackoverflow.com/q/26352686
has comment: http://stackoverflow.com/comment/41402400
type: AcceptedAnswer
downvote count: 0
has body: Is multipart required? In case you only need to send one file with the POST request, you can simply write its binary data to the output stream of the connection. (I have no experience with PHP but I assume that PHP will be able to read the request body). The other fields could be transferred as query parameters or HTTP headers. Also I recommend to route the HTTP traffic through a logging proxy like Fiddler2 to see what actually is in the HTTP request body (and compare it with a working test example).
answers question: http://stackoverflow.com/q/26352686
type: Answer
upvote count: 1

playback
tags question: http://stackoverflow.com/q/26203663
tag name: playback
type: Tag

asp.net
tags question: http://stackoverflow.com/q/26294404
tags question: http://stackoverflow.com/q/26275070
type: Tag
tag name: asp.net

http://stackoverflow.com/a/26344518
score: 1
answers question: http://stackoverflow.com/q/26344111
accepted answer of: http://stackoverflow.com/q/26344111
has body: What you're asking is (almost) impossible, and breaks the MVC principle. With the MVC principle, here's what you do: the controller gets data from backend services and stores them in request attributes if there is a problem, the controller can display a custom error page, or can throw an exception which will cause an error 500 to be sent to the browser if there is no problem, the controller dispatches to a view which only has to generate HTML from the data stored in the request. No risk of an error here (except for bugs). If a JSP tag gets data from an unreliable backend service, it's doing it while the view gets rendered and sents HTML to the browser. The HTTP response status (200) has already been sent at this time, and an exception thrown by the JSP tag will only make the page rendering fail. It's too late to display a good-looking error page or to send a 500 error. The only way around it is to have a filter wrapped around the whole thing, buffering the response in memory, and finally sending the HTML is it rendered successfully. I would really not do that, though. Instead, I would stick to MVC: have the controller prepare the data for the view, and define tags which take data as attributes instead of getting the data from the backend. If the backend is reliable, but you're only concerned about incorrect usage of the tags (i.e. bugs), the throw an exception with a clear error message and log it, and the developers should be able to figure what the problem is.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41285566
score: 0
comment on: http://stackoverflow.com/a/26308757
type: AnswerComment
has text: Not exactly according to the doc "Waits if necessary for the computation to complete, and then retrieves its result." But i agree that's not the best idea, it was just for the sake of the asked issue.
type: Comment

http://stackoverflow.com/a/26322550
score: 1
upvote count: 1
has body: These make one and two basically the same thing: Myobj *one = new Myobj(); Myobj *two = one; //one and two are the same thing, pointer's to a Myobj Myobj one; Myobj *two = &amp;one; //one is an object that will be deallocated at end of current scope //two is a pointer to one In C++ new Myobj() creates a Myobj on the heap and returns a pointer to it. Myobj *one; //Creates a variable that should point to a Myobj instance Myobj two = new Myobj(); //Doesn't really work *two = &amp;one; //Get where two point's at and assign the location of one to it Update: Myobj one = new Myobj(); //This doesn't quite work, assigning pointer to class Myobj *two = &amp;one; //This works, you make a pointer to point to one To fix your first statement, you could use: Myobj one = Myobj(); //Myobj one(); //This requires the constructor to take arguments, thanks juanchopanza! Myobj one{}; //Requires C++11, courtesy juanchopanza Myobj one; All do the same thing Generally, the following should make a copy: Myobj one; //or any variant Myobj two = one; Or if you prefer to use pointers: Myobj *one = new Myobj(); Myobj *two = new Myobj(); *two = *one;
accepted answer of: http://stackoverflow.com/q/26322494
has comment: http://stackoverflow.com/comment/41309925
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41311226
has comment: http://stackoverflow.com/comment/41311432
type: Answer
answers question: http://stackoverflow.com/q/26322494
has comment: http://stackoverflow.com/comment/41309997

http://stackoverflow.com/q/26313672
type: Question
has answer: http://stackoverflow.com/a/26313802
score: 0
tagged with: windows
has comment: http://stackoverflow.com/comment/41293728
answer count: 1
tagged with: macos
has comment: http://stackoverflow.com/comment/41293776
tagged with: text-files
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41293639
has title: Problems saving a text file with a folder
has comment: http://stackoverflow.com/comment/41293804
has body: Just wondering if you could point me in the right direction. My code below is where I stand at the moment, problem I have is that it will save data.txt to location, but only when I dont add a folder eg. "/data.txt" works, but "/folder/data.txt" doesnt work. Logic tells me that my code doesnt create a folder, but instead tells the computer to save data.txt into a folder called folder. My first question, how is my code modified to achieve this? Second and most important, I have been looking over the net and Stack Overflow and have been given plenty of examples from user.home, user.dir and more, they all work, but again without the folder in the way as described in part 1. My main goal is to hide (not literally) a save file in a folder, eg. C:/Program Files/SysAuth/data.txt. This is a simple attempt to not allow users to modify scores, primitive security is all that is required. My main problem is that I would like the filepath to be compatible with both windows and mac. I can't test anything for compatibility as I do not have access to a Mac. Hope you can help. public statiic void save(){ String str = "Congratulations"; file = System.getPropery("user.home"); fileName = (file + "/folder/data.txt"); try { FileWriter fw = new FileWriter(fileName); BufferedWriter bw = new BufferedWriter(fw); bw.write(str); bw.close(); } catch(FileNotFoundException e){ e.printStackTrace(); } catch(IOException e){ e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/41293636
tagged with: java
tagged with: save

http://stackoverflow.com/comment/41160284
has text: Your requirements are very vague. Do you want to catch any changes, including those caused by external things like psql or are changes done through some central server application?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26240736
type: Comment

http://stackoverflow.com/comment/41257095
score: 0
has text: @Davio : tHANKS TO YOU TOO.. :-)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26293423

http://stackoverflow.com/comment/41176477
type: Comment
type: QuestionComment
score: 2
has text: ajb is right, sort of... I was relying on the Eclipse debug to show me what the function was returning, and it kept bypassing the "return w" line and executing the "return null" line, but afterwards, the code did in fact return w. Thanks everyone, sorry for the false alarm. *shakes fist at Eclipse*
comment on: http://stackoverflow.com/q/26249062

http://stackoverflow.com/comment/41355178
comment on: http://stackoverflow.com/q/26333044
has text: No still use annotations but without those 2 particular annotations
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26215201
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26215059
score: 1
upvote count: 1
has body: Everyone gives correct solution and beworker also give nice reason. I add up one reason. Java always pass everything by value. So in your code when you pass currentIndex it pass by value so any changes to currentIndex in dosomething() method not reflected outside of block. For more explanation . I refer you to see Eng.Fouad answer he very well explained this concept .

http://stackoverflow.com/comment/41161531
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26229240
has text: you did it in an `if` block. i am talking about a `while` loop
type: AnswerComment

http://stackoverflow.com/q/26287801
has answer: http://stackoverflow.com/a/26287899
has title: ConcurrentModificationException when trying to update map key and value
type: Question
has answer: http://stackoverflow.com/a/26287900
possible better answer: http://stackoverflow.com/a/26287899
score: 0
answer count: 3
tagged with: regex
has body: I'm trying to write a program (without additional libraries) which would take as input a text file and make a map of words which are present in the text with the exact number of the occurences. The problem is that I'm stuck in the moment when I try to populate the HashMap with the words and the number of occurences. Below you can find the fragment of code which I'm using: public class App { public static void main(String[] args) { // TODO Auto-generated method stub File file = new File("text.txt"); StringBuilder sb = new StringBuilder(); try(BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)))) { String content = br.readLine(); while(content!=null){ sb.append(content); sb.append(System.lineSeparator()); content =br.readLine(); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String text = sb.toString(); String[] wordArray = text.split("\\s|\\.\\s|\\,\\s|\\r\\n"); System.out.println(wordArray.length); LinkedHashMap&lt;String,Integer&gt; wordMap = new LinkedHashMap&lt;&gt;(); wordMap.put(wordArray[0], 1); for(int i=1; i&lt;wordArray.length;i++){ for(String key : wordMap.keySet()){ if(key.equals(wordArray[i])){ wordMap.put(key, wordMap.get(key)+1); } else{ wordMap.put(wordArray[i], 1); } } } for(String key : wordMap.keySet()){ System.out.println(key + " : "+ wordMap.get(key)); } } } I was trying to use Iterators the make to modifications to the HashMap but I ended up with the same exception. One additional thing is that I also face a problem with splitting the text. In the wordArray there are present empty values. These empty values are present after the last word in the line so I suppose these are the \r\n white signs. Unfortunately adding \r\n to regex in split method did not make any difference. Could you help also with these problem? Thank you in advance! P.S. This is my first question on stackoverflo…
accepted answer: http://stackoverflow.com/a/26287900
has answer: http://stackoverflow.com/a/26287924
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41320730
score: 0
comment on: http://stackoverflow.com/q/26328070
type: Comment
type: QuestionComment
has text: In which case, I would most definitely not use a JOptionPane, being that it is meant to be for quick, easy, and PREFORMATTED tools that most developers can pick up and use, it will not be very flexible. While it is technically possible, I would definitely recommend just doing it in a JFrame. Can you post the code behind this? I'll be able to help you out more that way

http://stackoverflow.com/comment/41105542
type: Comment
has text: Ok I did the changes you gave and added this toast while ((line = rd.readLine()) != null) { result = line.trim(); Log.w("SENCIDE RSULT",result ); } Confirm that it prints the right results.So now is the passing issue I guess rite
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26210893

http://stackoverflow.com/comment/41336301
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26336175
type: Comment
has text: first i'll need your call to this method, to know how you manage your returned array (float[])

http://stackoverflow.com/comment/41231518
comment on: http://stackoverflow.com/q/26279713
score: 0
type: Comment
type: QuestionComment
has text: Reason is your int within if will be visible within that if block only. If you want basePrice to be visible to your whole main method, then declare it out where you declared all your weight and price data.

http://stackoverflow.com/a/26202602
has comment: http://stackoverflow.com/comment/62930694
score: 48
type: Answer
upvote count: 48
has body: Yes the concept of callbacks also very much exists in Java. In Java you define a callback like this: public interface TaskListener { public void onFinished(String result); } One would often nest these kind of listener definitions inside the AsyncTask like this: public class ExampleTask extends AsyncTask&lt;Void, Void, String&gt; { public interface TaskListener { public void onFinished(String result); } ... } And a complete implementation of the callback in the AsyncTask would look like this: public class ExampleTask extends AsyncTask&lt;Void, Void, String&gt; { public interface TaskListener { public void onFinished(String result); } // This is the reference to the associated listener private final TaskListener taskListener; public ExampleTask(TaskListener listener) { // The listener reference is passed in through the constructor this.taskListener = listener; } @Override protected String doInBackground(Void... params) { return doSomething(); } @Override protected void onPostExecute(String result) { super.onPostExecute(result); // In onPostExecute we check if the listener is valid if(this.taskListener != null) { // And if it is we call the callback function on it. this.taskListener.onFinished(result); } } } onPostExecute() is called as soon as the background task finishes. You can use the whole thing like this: ExampleTask task = new ExampleTask(new ExampleTask.TaskListener() { @Override public void onFinished(String result) { // Do Something after the task has finished } }); task.execute(); Or you can define the TaskListener completely separately like this: ExampleTask.TaskListener listener = new ExampleTask.TaskListener() { @Override public void onFinished(String result) { // Do Something after the task has finished } }; ExampleTask task = new ExampleTask(listener); task.execute(); Or you can subclass TaskListener like this: public class ExampleTaskListener implements TaskListener { @Override public void onFinished(String result) { } } And then use it like this: Exa…
has comment: http://stackoverflow.com/comment/62930963
has comment: http://stackoverflow.com/comment/62931172
has comment: http://stackoverflow.com/comment/62930804
answers question: http://stackoverflow.com/q/26202568
has comment: http://stackoverflow.com/comment/62932137
has comment: http://stackoverflow.com/comment/62931873
accepted answer of: http://stackoverflow.com/q/26202568
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/62931260
downvote count: 0
has comment: http://stackoverflow.com/comment/62932178

http://stackoverflow.com/q/26214693
has comment: http://stackoverflow.com/comment/41111366
tagged with: java
has answer: http://stackoverflow.com/a/26214784
upvote count: 1
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/41111276
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41111362
has body: I have two classes, one of them is my thread in which I read outputs from a device through TCP/IP: public static controlPanel cp = new controlPanel(); void startListenForTCP (final String ipaddress){ Thread TCPListenerThread; TCPListenerThread = new Thread(new Runnable() { @Override public void run() { Boolean run = true; String serverMessage = null; InetAddress serverAddr = null; BufferedWriter out = null; try (Socket clientSocket = new Socket(ipaddress, 7420)) { cp.updateGUI("Connection initiated... waiting for outputs!"+"\n"); char[] buffer = new char[2]; int charsRead = 0; out = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); while ((charsRead = in.read(buffer)) != -1) { String message = new String(buffer).substring(0, charsRead); switch (message) { case "o,": cp.updateGUI("Čekanje da loptica prođe RFID čitač!"); break; case "y,": cp.updateGUI("Hardverski problem!"); break; case "Y,": cp.updateGUI("Loptica nije izažla, hardverski problem!"); break; case "I,": cp.updateGUI("Uređaj u stanju mirovanja!!"); break; default: String m = message; m = m.replaceAll("[^\\d.]", ""); try{ int i = Integer.parseInt(m); System.out.println("Is int: "+i); int izasao=Integer.parseInt(m); if (redni&gt;34){ redni=0; } if (izasao&gt;0 &amp;&amp; izasao&lt;49){ redni =redni+1; m=m; ur.updateResults(redni, m); bs.testAuto(m, redni); System.out.println(m+ "\n"); } } catch(NumberFormatException e){ } break; } }} catch(UnknownHostException e) { System.out.println("Unknown host..."+"\n"); } catch(IOException e) { System.out.println("IO Error..."+"\n"); } } }); TCPListenerThread.start(); } The other one is swing form in which i want to set jLabel text from the class above: Public class controlPanel extends javax.swing.JFrame { public static gameControler gc = new gameControler(); public controlPanel() { initComponents(); } public void updateGUI(final String text) { if (!…
downvote count: 0
score: 1
favorite count: 0
tagged with: event-dispatch-thread
type: Question
tagged with: sockets
has title: Update Swing GUI from other thread

http://stackoverflow.com/comment/41288954
comment on: http://stackoverflow.com/q/26310866
score: 0
type: Comment
type: QuestionComment
has text: Note: I used this method before and it worked well

http://stackoverflow.com/a/26333979
has comment: http://stackoverflow.com/comment/41349561
type: Answer
has comment: http://stackoverflow.com/comment/41332473
has comment: http://stackoverflow.com/comment/41349487
has body: You can have ArrayList&lt;String[]&gt; to store arrays and add those array to list and use get method to retrieve the array or you can use Map&lt;key,value&gt; to manage the key value based structure for retrieval of array. FOR EXAMPLE String str[]=new String[10]; str[0]="abc"; //and other values List&lt;String[]&gt; list=new ArrayList&lt;String[]&gt;(); list.add(str); //OR Map&lt;Long,String[]&gt; map=new HashMap&lt;Long,String[]&gt;(); map.put(myLong[0],str);
has comment: http://stackoverflow.com/comment/41332556
has comment: http://stackoverflow.com/comment/41331271
has comment: http://stackoverflow.com/comment/41332436
score: 0
answers question: http://stackoverflow.com/q/26333970
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26333970
has comment: http://stackoverflow.com/comment/41332604

http://stackoverflow.com/comment/41267249
type: Comment
has text: @vikingsteve Thanks for the question. See my *EDIT 2* how that could be handled.
score: 0
comment on: http://stackoverflow.com/a/26298614
type: AnswerComment

http://stackoverflow.com/a/26335176
answers question: http://stackoverflow.com/q/26325303
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26325303
has body: Found it! In the AndroidManifest.xml there is a ReplaceMe tag in: <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="ReplaceMe" /> There in strings.xml there is a string resource: ReplaceMe Should replace the ReplaceMe :) with the app ID from the google play console. Good luck!

http://stackoverflow.com/comment/41179765
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26238938
has text: Thanks @Baz for adding the above question, and for help, it works :)
score: 0

http://stackoverflow.com/q/26230336
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26231155
type: Question
tagged with: sentence
has comment: http://stackoverflow.com/comment/41141152
tagged with: string
favorite count: 0
has title: Build a sentence from tokens / words in a String-Array java
answer count: 3
accepted answer: http://stackoverflow.com/a/26231155
has body: How do I joint the words in list&lt;String&gt; in order to back to it's real form as sentences String sentence = "i get money. i love it. i want to buy. something. "; String[] arrSent = sentence.split("\\. "); for(int i=0; i&lt;arrSent.length; i++) { String[] words = arrSent[i].split("\\ "); for(int j=0; j&lt;words.length; j++ { listWord.add(words[j]); } } and the output is : i get money i love it i want to buy something i just trying to rebuild it to the real form (as sentence) update!!! i have tried like you suggest guys. but i found a new difficult way. i have removed one word "love" from list and i add to new list "listWord2" . when i rebuild it to real form as sentence, the . in new sentence is disappear this is the code : String [] arrays2 = listKata2.toArray(new String[listWord2.size()]); sentence = Arrays.deepToString(arrays2).replaceAll(",", ""); System.out.println("result : : "+sentence); and the ouput is : [i get money i it i want to buy something] the . is missing should i split the listWord2 by space again ?, please suggest me
possible better answer: http://stackoverflow.com/a/26230388
has comment: http://stackoverflow.com/comment/41141220
has answer: http://stackoverflow.com/a/26230388
has answer: http://stackoverflow.com/a/26230427
score: 2
has comment: http://stackoverflow.com/comment/41141249
upvote count: 3

http://stackoverflow.com/a/26229934
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41146503
answers question: http://stackoverflow.com/q/26228829
downvote count: 0
has comment: http://stackoverflow.com/comment/41145582
has body: Spring security ACLs does exactly what you want. It is not really the easiest part, but it is really powerful. Once it is configured, you simply add security at method level (usually in a service layer, that is between the UI and the database) by simply adding annotations. My advice would be : first setup spring security without acl, but with a database store read the doc for the ACLs part add the relevant tables to your databases and initialize them by hand read again the doc and test You can also find a tutorial at http://krams915.blogspot.fr/2011/01/spring-security-3-full-acl-tutorial.html, but I never used it.

http://stackoverflow.com/comment/114235493
has text: I am using spring 4 and java 8 ...still getting this issue
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26259788

http://stackoverflow.com/q/26226531
type: Question
downvote count: 4
has comment: http://stackoverflow.com/comment/41136016
has comment: http://stackoverflow.com/comment/130406611
has body: I'm learning recursion I found some cool stuff like this link that implements recursion in order to do a Persian carpet. I want to implement this code in Java float a = 1.0; int left = 0; int right = 340; int top = 0; int bot = 340; int r,g,b; color firstColor; color backC; //color backC = color(35,95,28); void setup() { //size(700, 700); size(341, 341); r = floor(random(1,255)); g = floor(random(1,255)); b = floor(random(1,255)); firstColor = color(g); backC = color(r,g,b); background(backC); stroke(firstColor); line(left,top,right,top); line(left,bot,right,bot); line(left,top,left,bot); line(right,top,right,bot); a = random(1,6); chooseColor(left, right, top, bot, a); } void draw() {} void chooseColor(int left, int right, int top, int bot, float a) { int midcol, midrow; color col; if (left &lt; (right-1)) { col = floor((get(left,top) + get(right,top) + get(left,bot) + get(right,bot))/a); midcol = (left + right) / 2; midrow = (top + bot) / 2; stroke(col); line(left+1, midrow, right-1, midrow); line(midcol, top+1, midcol, bot-1); chooseColor(left, midcol, top, midrow, a); chooseColor(midcol, right, top, midrow, a); chooseColor(left, midcol, midrow, bot, a); chooseColor(midcol, right, midrow, bot, a); } } void keyPressed() { setup(); } I'm using a JFrame for my window and a JPanel for the drawing but the code is really different from java, can someone give me an advice of where to start? I know the code uses colors, but I'm trying to make the rug only in black, so afterwards I can implement some color.
favorite count: 0
has title: Persian rug recursion
type: UnansweredQuestion
tagged with: swing
upvote count: 6
tagged with: recursion
score: 2
answer count: 0
tagged with: java

http://stackoverflow.com/q/26335119
type: Question
has body: I'm using tomcat security manager for my application. In my application, i have placed my running tomcat in path: usr/local/tomcat-7/webapps/myapplication And when i run my application i will logged all the actions in logger. That logger file is placed in another path path:usr/local/tomcat-6/logs/mylogs.log (*this is not running server, just a folder named tomcat-6*) When i run my application with security manager, it will throw this exception: java.security.AccessControlException:access denied("java.io.FilePermission" "usr/local/tomcat6/logs/mylogs.log" "write" ). In My catalina.policy file i have gave this rule to grant permission to this file. But it doesn't works. grant codeBase "file:${catalina.home}/../tomcat-6/logs/-" { permission java.security.AllPermission; }; How can i resolve this problem?
answer count: 2
has answer: http://stackoverflow.com/a/26335196
downvote count: 0
tagged with: securitymanager
tagged with: tomcat
has answer: http://stackoverflow.com/a/26335155
favorite count: 0
tagged with: linux
type: UnansweredQuestion
tagged with: windows
has title: java.security.AccessControlException:access denied("java.io.FilePermission" "File path" "write" )
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/41363894
has text: You might like to do some research into "Run length encoding"...
comment on: http://stackoverflow.com/q/26351882
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/26336148
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26334524
answers question: http://stackoverflow.com/q/26334524
has body: Cloudera gives you debian packages and software for automatic installation and cluster management. That's it. There is nothing about search (and it's optimization) in Hadoop stack. So you may choose either vanilla or cloudera for you project. For search you can use Elasticsearch. It have integration with hadoop and uses Lucene internally

http://stackoverflow.com/comment/41115340
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26213639
type: AnswerComment
has text: I tried that , still its show error like " Could not create or Open the database" Please help .. Thanks in advance

http://stackoverflow.com/q/26314672
tagged with: spring
has title: Spring Source Toolsuite (STS) - Batch-Graph when using Java-Config
has body: this is my first Batch-Project where I want to avoid writing XML-Files and use for configurations Java-Config. So I have few Batch-Jobs and application works as expected. For documentation reasons or presentation I would like to use the possibility of Spring-IDE to show batch-graph what works very good when using spring-config in XML. But I am not available to find how I can use Batch-Graph when Batch-Job is configured in Java. I already scanned all spring-configuation within Eclipse, so in the Spring-View I can see my Java-Config-Class, but I don't know how to bring it into Batch-Graph. Thank you in advance.
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26343206
tagged with: sts-springsourcetoolsuite
tagged with: visualization
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring-batch

http://stackoverflow.com/q/26274751
has body: I have a setup where I have source file a/b/c.java under a directory srcA and a file with the same name a/b/c.java under a directory srcB. I want to exclude this file (or the full package a/b) from directory srcB and only use those from directory srcA, but srcB must be part of the source set because it contains other stuff. A quick example of how I have things configured at the moment (which does not work): sourceSets { main { java { srcDir 'srcA' srcDir 'srcB' exclude 'srcB/a/b/**' } } }
has title: Gradle: same source file in different projects
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26279036
tagged with: gradle
type: Question
tagged with: build
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/26279036
answer count: 1

pi
tags question: http://stackoverflow.com/q/26286746
tags question: http://stackoverflow.com/q/26285297
tag name: pi
type: Tag

ontology
tags question: http://stackoverflow.com/q/26234485
type: Tag
tag name: ontology
tags question: http://stackoverflow.com/q/26203981

http://stackoverflow.com/a/49572578
score: 1
answers question: http://stackoverflow.com/q/26291271
upvote count: 1
type: Answer
has body: As Ilya said by default the toPeriod method will only populate hour, minute, second and millisecond fields. But you can actually normalize that back using normalizedStandard so that String periodFormat(Duration d) { return PERIOD_FORMATTER.print(d.toPeriod().normalizedStandard()); } static final PeriodFormatter PERIOD_FORMATTER = new PeriodFormatterBuilder() .appendWeeks().appendSuffix("w") .appendSeparator("_") .printZeroRarelyLast() .appendDays().appendSuffix("d") .appendSeparator("_") .printZeroRarelyLast() .appendHours().appendSuffix("h") .appendSeparator("_") .printZeroRarelyLast() .appendMinutes().appendSuffix("m") .appendSeparator("_") .printZeroRarelyLast() .toFormatter(); Will pass @Test public void periodFormatTest { assertThat(periodFormat(Duration.standardMinutes(5))).isEqualTo("5m"); assertThat(periodFormat(Duration.standardMinutes(60))).isEqualTo("1h"); assertThat(periodFormat(Duration.standardDays(1))).isEqualTo("1d"); assertThat(periodFormat(Duration.standardDays(2))).isEqualTo("2d"); assertThat(periodFormat(Duration.standardHours(47))).isEqualTo("1d_23h"); }:
downvote count: 0

http://stackoverflow.com/q/26279570
tagged with: eclipse
upvote count: 1
answer count: 1
has body: I have just run into the Apache Ivy bug java.lang.ClassCastException: org.eclipse.osgi.internal.framework.EquinoxConfiguration$1 cannot be cast to java.lang.String (link) when performing Ant task ivy:config This morning I tried to install LibraryFolder ClasspathContainer plugin into my Eclipse (STS 3.6.1): installing it caused the above error every time I tried to perform ivy:retrieve. Even worse, I tried to install IvyDE plugin from Eclipse Marketplace and Eclipse started to crash at a multitude of errors, including JVM crash. Uninstalling both plugins didn't fix. I tried with a new workspace and a blank Eclipse installation, but I eventually had to install my previous Eclipse plugins. I spent the entire morning trying to fix the mess but I had to restore the previous uncommitted workspace and Eclipse installation, so now I get everything working except for the above error. Ivy worked fine until this morning. Every Ant task of mine runs in the same JRE as Eclipse (C:\Program Files\Java\jdk1.7.0_60\jre\bin\server\jvm.dll as per sts.ini) because I use a lot the eclipse.refreshLocal task. While I can workaround the problem by removing/commenting eclipse.refreshLocal task and run Ant-Ivy tasks in a standard JRE, I'm asking if there is a workaround to get rid of the error, perhaps by deleting a key file in the workspace's metadata. As I can read, an Ivy method is passed an object that, guessing from its name, is part of Eclipse configuration. While I'll be waiting for a bugfix, my question is how do I investigate more about the nature of this org.eclipse.osgi.internal.framework.EquinoxConfiguration$1 parameter?
favorite count: 0
has title: Getting rid of org.eclipse.osgi.internal.framework.EquinoxConfiguration$1 that cannot be casted to String
has comment: http://stackoverflow.com/comment/41580285
has answer: http://stackoverflow.com/a/26280148
accepted answer: http://stackoverflow.com/a/26280148
linked to: http://stackoverflow.com/q/26077296
type: AnsweredQuestion
downvote count: 0
type: Question
linked to: http://stackoverflow.com/q/26085045
tagged with: ivyde
score: 1
tagged with: ant
tagged with: java
tagged with: ivy

http://stackoverflow.com/q/26238077
tagged with: java
type: Question
tagged with: data-structures
tagged with: optimization
has body: I am having confusing over how to choose my data structure. Lets say i have following data Product,Price,Company,Total available.. which i get from db. Now i want to represent this in lets say excel or csv in same order as i get from db company wise. So i choose below data structure. Map&lt;String, TreeMap&lt;Integer, TreeMap&lt;String, String&gt;&gt;&gt; . First String represents Company Integer represents position of record in db so that i can display in same order. The TreeMap contains other values. Can I choose any better data structure for this requirement.
score: 0
accepted answer: http://stackoverflow.com/a/26238190
answer count: 3
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/26238242
has comment: http://stackoverflow.com/comment/41159401
has comment: http://stackoverflow.com/comment/41155194
has answer: http://stackoverflow.com/a/26238242
favorite count: 0
has answer: http://stackoverflow.com/a/26238190
type: AnsweredQuestion
tagged with: oop
has answer: http://stackoverflow.com/a/26260450
has title: Designing Data Structure / Java data structures

http://stackoverflow.com/comment/41266319
has text: in your logcat how many times image: is printed ?
type: Comment
comment on: http://stackoverflow.com/q/26298679
score: 0
type: QuestionComment

http://stackoverflow.com/comment/77780649
has text: @ArunPaul Both Elasticsearch and Kibana are written in Java already. Is it Java that you need or to write it yourself? In any case, their code are open sourced, so just take a look at it.
type: Comment
comment on: http://stackoverflow.com/a/26316794
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41082283
score: 0
comment on: http://stackoverflow.com/q/26195035
has text: @Neo if you look at my test code above you can see that creating 2 points a & b result in values that should work.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26266411
has answer: http://stackoverflow.com/a/42914473
has body: I've searched for a while now, and can't find an answer for what I want to do. I want to play a midi file, and display the notes on the screen as it plays. When a note stops playing, it should disappear off the screen. I can play a midi with a sequencer, but have no idea of how to get the notes its playing, or when it stops playing a note. I've looked into ControllerEventListeners and MetaEventListeners, but still don't know how to do this. Any help would be appreciated.
score: 2
has title: Java Midi - How to get notes from midi whilst it's playing
tagged with: java
type: Question
upvote count: 2
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26272775
favorite count: 0
has comment: http://stackoverflow.com/comment/41208103
tagged with: midi
tagged with: javax.sound.midi
type: UnansweredQuestion

http://stackoverflow.com/q/26295203
linked to: http://stackoverflow.com/q/1517924
has body: I would like kindly ask you, are there any differences between using Java code in internet browser on laptop and browser on android device ? When I use application on laptop, everything is ok, but on tablet application is not working (I can't drag and drop objects). I have tryed online diagram application http://www.diagramo.com/editor/editor.php, but is it not working with tablet browser (Google Chrome, Mozilla). Google Chrome should support HTML 5 and Java is enabled ? I found this application very useful for working on computer and tablet. Please where can be the complication in Java - in browser or in application ?
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: google-chrome
has comment: http://stackoverflow.com/comment/41335418
type: Question
tagged with: compatibility
has comment: http://stackoverflow.com/comment/41259972
has title: HTML 5 and Java, differences in code on android browsers vs. computer browsers
accepted answer: http://stackoverflow.com/a/26349601
tagged with: browser
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26349601

http://stackoverflow.com/comment/41274916
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26300711
has text: http://www.slideshare.net/mrdon/an-introduction-to-struts-2-and-restful-applications-presentation?next_slideshow=2 Few others.
score: 0

http://stackoverflow.com/q/26228571
tagged with: cobertura
has body: I did instrumentation of code and war file successfully deployed into the tomcat container. I am running my client tests on it.After successful run of the tests on it when I am shutting down my tomcat instance there is Cobertura.ser file in the bin directory of tomcat. Cobertura.ser file contains all the details of code-coverage file. Now,I wants to configure a maven task to generate Cobertura html report from .ser file. I read the help guide of Cobertura-maven-plugin but I couldn't get properly. (I am not running junit tests but I am performing selenium tests). org.codehaus.mojo cobertura-maven-plugin 2.5.2 instrument-code package instrument true generate-report prepare-package cobertura C:\Servers\apache-tomcat-8.0.11\bin\cobertura.ser html xml C:\Users\satyam\report This is my maven configuration of Cobertura-plugin but this way maven is not generating report from Cobertura.ser file located in tomcat bin directory.
type: AnsweredQuestion
tagged with: maven-cobertura-plugin
downvote count: 0
tagged with: code-coverage
score: 1
tagged with: java
has title: Cobertura-report generation with maven plugin
type: Question
has answer: http://stackoverflow.com/a/26228591
accepted answer: http://stackoverflow.com/a/26228591
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26302347
has comment: http://stackoverflow.com/comment/41273220
tagged with: android
accepted answer: http://stackoverflow.com/a/26302453
has body: I want to make a menu like this: The images and text will be loaded from internet. Which approach do you suggest me to use? Should i use a grid layout? Or an adapter? Do you know what this kind of layout is called? And do you have any examples of this? Thanks in advance.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41273201
tagged with: java
type: Question
tagged with: layout
has title: How to create a image button menu programmatically?
tagged with: image
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26302453

http://stackoverflow.com/q/26208723
has comment: http://stackoverflow.com/comment/41100322
has answer: http://stackoverflow.com/a/49551642
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41100688
has answer: http://stackoverflow.com/a/73222235
type: Question
tagged with: dimensions
score: 10
has title: Is there anyway to "pack" a JPanel?
has body: Is there any thing I can do to make my JPanel pack like a JFrame, or do something like that. I want to do this instead of giving it dimensions. Please comment if any addition info is needed. Thanks.
tagged with: jpanel
has comment: http://stackoverflow.com/comment/41100389
has comment: http://stackoverflow.com/comment/41100532
has comment: http://stackoverflow.com/comment/41100410
has answer: http://stackoverflow.com/a/26208740
has comment: http://stackoverflow.com/comment/41100621
answer count: 3
has comment: http://stackoverflow.com/comment/41100711
upvote count: 10
linked to: http://stackoverflow.com/q/6592468
favorite count: 0
tagged with: pack
has comment: http://stackoverflow.com/comment/41101418
has comment: http://stackoverflow.com/comment/41100443
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41100493

http://stackoverflow.com/comment/41302524
has text: Oh wait. I'm sorry. Here.. https://www.dropbox.com/s/nbud87n9losvavg/drag.PNG?dl=0
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26318474

http://stackoverflow.com/a/26222328
downvote count: 0
has comment: http://stackoverflow.com/comment/41194595
score: 1
has comment: http://stackoverflow.com/comment/41130022
has comment: http://stackoverflow.com/comment/41129015
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26221958
type: Answer
answers question: http://stackoverflow.com/q/26221958
has comment: http://stackoverflow.com/comment/41128955
has comment: http://stackoverflow.com/comment/41130441
has body: You need to modify build.gradle in the following way: sourceSets { generated main { compileClasspath += generated.output // adds the sourceSet to the compileClassPath runtimeClasspath += generated.output // adds the sourceSet to the runtimeClasspath } } project.run.classpath += sourceSets.generated.output //add the sourceSet to project class path Remember that adding new source set is something different from having compiled source set in the classpath. The line below the source sets is necessary for run task to work.
has comment: http://stackoverflow.com/comment/41129938

http://stackoverflow.com/q/26223518
downvote count: 0
has answer: http://stackoverflow.com/a/26223609
favorite count: 0
upvote count: 2
answer count: 5
tagged with: parameter-passing
score: 2
type: AnsweredQuestion
has body: I am trying to pass a Class to a method. The Class changes as the program runs, so I'd like to reuse the same method through out my program instead of calling the same functions throughout my resetWords() method. Here is where I am stuck: private void getWords(Class c) { singles = c.getSingleSyllables(); doubles = c.getDoubleSyllables(); triples = c.getTripleSyllables(); quadruples = c.getQuadrupleSyllables(); quintuples = c.getQuintupleSyllables(); } private void resetWords() { if (generated.equals("SOMETHING")) { Something c = new Something(); getWords(c); } else if (generated.equals("ANOTHER")) { Another c = new Another(); getWords(c); } }
has answer: http://stackoverflow.com/a/26223607
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26223740
has answer: http://stackoverflow.com/a/26223611
tagged with: class
possible better answer: http://stackoverflow.com/a/26223607
has title: Pass Class object to a method
has answer: http://stackoverflow.com/a/26223635
accepted answer: http://stackoverflow.com/a/26223635

http://stackoverflow.com/q/26267928
possible better answer: http://stackoverflow.com/a/26267954
score: 0
answer count: 2
has body: I am developing notepad project, would like know how do for save a file.txt, my problem is, I keep the file opening JFileChooser, after selected the local where save intend, but after if save again will open JFileChoose again. I want save. Not save as. JFileChooser fc = new JFileChooser(); int resp = fc.showSaveDialog(fc); if (resp == JFileChooser.APPROVE_OPTION) { PrintStream fileOut = null; try { File file = fc.getSelectedFile(); fileOut = new PrintStream(file); fileOut.print(txtArea.getText()); } catch (FileNotFoundException ex) { Logger.getLogger(frmNotePad.class.getName()).log(Level.SEVERE, null, ex); } finally { fileOut.close(); }
has title: How to save file.txt with JFileChooser?
has answer: http://stackoverflow.com/a/26267961
accepted answer: http://stackoverflow.com/a/26267961
type: AnsweredQuestion
tagged with: notepad
tagged with: java
tagged with: save
tagged with: jfilechooser
type: Question
has answer: http://stackoverflow.com/a/26267954

http://stackoverflow.com/q/26318047
answer count: 2
accepted answer: http://stackoverflow.com/a/26318072
type: AnsweredQuestion
tagged with: loops
possible better answer: http://stackoverflow.com/a/26318112
type: Question
has answer: http://stackoverflow.com/a/26318112
tagged with: java
has body: I'm totally stuck on this project, in which a user is supposed to enter number of students in a class, and number of exams taken. Then they enter each student's name, and then the exam scores for that student on a single line separated by blank spaces. The program calculates each student's average and the corresponding letter grade. This is what I have so far: public class proj2 { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("Welcome to Gradecalculator!"); System.out.println("Please enter the number of students:"); int students = s.nextInt(); System.out.println("Please enter the number of exams:"); int exams = s.nextInt(); int i = 0; int studentnumber = 1; int sum = 0; while (i &lt; students) { double average = sum/exams; System.out.println("Enter student " + studentnumber++ + "'s name :"); String studentname = s.next(); System.out.println("Enter exam scores :"); for (; i &lt; exams; i++) { int n = s.nextInt(); sum+=n; if (n &lt; 0) { System.out.println("Invalid exam scores, reenter: "); } } if (average &lt;= 100 &amp;&amp; average &gt;= 90) { System.out.println("Letter grade: A"); System.out.println(studentname + " gets 4 stars! ****"); } if (average &lt;= 89 &amp;&amp; average &gt;= 80) { System.out.println("Letter grade: B"); System.out.println(studentname + " gets 3 stars! ***"); } if (average &lt;= 79 &amp;&amp; average &gt;= 70) { System.out.println("Letter grade: C"); System.out.println(studentname + " gets 2 stars! **"); } if (average &lt;= 69 &amp;&amp; average &gt;= 60) { System.out.println("Letter grade: D"); System.out.println(studentname + " gets 1 star! *"); } if (average &lt;= 59) { System.out.println("Letter grade: F"); System.out.println(studentname + " gets 0 stars!"); } } } } This is the output I get as of now: Welcome to Gradecalculator! Please enter the number of students: 3 Please enter the number of exams: 3 Enter student 1's name : sam Enter exam scores : 80 80 80 Letter grade: F sam gets 0 s…
has answer: http://stackoverflow.com/a/26318072
has title: Grade calculator program
score: 0

http://stackoverflow.com/q/26265948
has body: Hi I just downloaded the Android Studio BETA 0.8.9 and create a new project, so without touching anything after the build the event log kepp displaying this error. RuntimeException: Unclosed ': Unclosed ' and here´s the trace Unclosed ': Unclosed ' java.lang.RuntimeException: Unclosed ' at javax.swing.text.html.CSSParser.readTill(CSSParser.java:674) at javax.swing.text.html.CSSParser.nextToken(CSSParser.java:478) at javax.swing.text.html.CSSParser.parseIdentifiers(CSSParser.java:374) at javax.swing.text.html.CSSParser.parseDeclaration(CSSParser.java:357) at javax.swing.text.html.CSSParser.parseDeclarationBlock(CSSParser.java:325) at javax.swing.text.html.CSSParser.parseRuleSet(CSSParser.java:272) at javax.swing.text.html.CSSParser.getNextStatement(CSSParser.java:178) at javax.swing.text.html.CSSParser.parse(CSSParser.java:153) at javax.swing.text.html.StyleSheet$CssParser.parse(StyleSheet.java:3187) at javax.swing.text.html.StyleSheet.addRule(StyleSheet.java:307) at javax.swing.text.html.HTMLDocument$HTMLReader.addCSSRules(HTMLDocument.java:3807) at javax.swing.text.html.HTMLDocument$HTMLReader$HeadAction.end(HTMLDocument.java:2944) at javax.swing.text.html.HTMLDocument$HTMLReader.handleEndTag(HTMLDocument.java:2682) at javax.swing.text.html.parser.DocumentParser.handleEndTag(DocumentParser.java:240) at javax.swing.text.html.parser.Parser.parse(Parser.java:2263) at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:122) at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:101) at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:262) at javax.swing.JEditorPane.setText(JEditorPane.java:1415) at com.intellij.ide.IdeTooltipManager.initPane(IdeTooltipManager.java:585) at com.intellij.codeInsight.hint.LineTooltipRenderer.show(LineTooltipRenderer.java:84) at com.intellij.codeInsight.hint.TooltipController.showTooltip(TooltipController.java:139) at com.intellij.codeInsight.hint.TooltipController.showTooltipByMouseMove(Tool…
tagged with: android-studio
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47576154
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41208035
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/25253393
has title: Android studio error RuntimeException: Unclosed ': Unclosed '

http://stackoverflow.com/comment/41109690
has text: @Vikas Verma the answer is correct why did you downvote it? You could have answered if you wanted...
type: AnswerComment
comment on: http://stackoverflow.com/a/26213849
type: Comment
score: 2

http://stackoverflow.com/q/26213216
has comment: http://stackoverflow.com/comment/41109695
tagged with: runtime
answer count: 1
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/41110619
has answer: http://stackoverflow.com/a/26214638
accepted answer: http://stackoverflow.com/a/26214638
has title: Dynamically extend Spring REST interface at runtime
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has body: I want to build an application with REST interface using Spring. The interface must be extendable at runtime: The application extends the Interface dynamically depending on unknown configuration. This configuration may change with time. For example I have a Rest interface at http://domain.com/rest. The interface has a REST item at */rest/item which supports POST to create a new REST method. Calling POST on this REST item leads to an extension of the interface regarding to parameters given in POST request (e.g item name, properties, allowed operations (GET POST) and the code which is called by those operations). This may lead us to a new REST item at */rest/newItem. Since I only found Spring examples using a static XML config I'm wondering... Is this possible with spring? Any example to quickstart this approach?
has comment: http://stackoverflow.com/comment/41109666
type: Question

http://stackoverflow.com/q/26332686
tagged with: servlets
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41329038
score: 0
has body: I am a complete new t servlet can someone plz tell me what is wrong with my code;i am trying to name input from user in a textbox and then display welcome :"text entered by user in textbox" here is my code import java.io.*; import javax.servlet.*; import javax.servlet.http.*; // Extend HttpServlet class public class myprogramme extends HttpServlet { public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { res.setContentType("text/html"); PrintWritter out=res.getWritter(); String name=req.getParameter("txtname"); out.println("&lt;b&gt;&lt; font size=8 color="red"&gt;" +"welcome:"+ &lt;/font&gt; "&lt;/b&gt;"+name); } } name of the textbox is txtname which i am storing in name variable
tagged with: http://stackoverflow.com/tag/html
has title: html form handling inside servlet
has comment: http://stackoverflow.com/comment/41329025
has comment: http://stackoverflow.com/comment/41329136
has answer: http://stackoverflow.com/a/26336093
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26332754

http://stackoverflow.com/q/26319471
answer count: 1
has answer: http://stackoverflow.com/a/26328702
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/26328702
has title: Akka Design Principals
tagged with: scala
tagged with: actor
downvote count: 1
type: AnsweredQuestion
has body: Whilst working on a fairly large Akka application, I have come across a very simple structure when working with normal methods and non-Akka classes but which are actually quite difficult to nail when working with Akka which is why I have come here to ask what you recommend to be the best way to solve this issue. So the issue is this, I have one parent actor, let's call him "Connector", Connector has behavior describing what it should do when it receives a ConnectCommand instance. First, it submits a form using an HttpClient, then it goes to a couple of URLs to check for some session parameters and eventually sends the Sender (Referred to as the "Consumer") a connection message containing everything it needs to use the API. Now, I'm a big fan of telling, not so much of pull / ask so implementing this is, in my opinion, a hard task to do. Let's go over it. All the responses returned by the HttpClientActor are a Response instance, so what first came to mind is having multiple behaviors defined in my actor and incrementally, after a certain step of the connection process has been completed, change behavior to the next step. private final PartialFunction&lt;Object, BoxedUnit&gt; inital = ReceiveBuilder .match(ConnectCommand.class, c -&gt; this.startConnection()) .matchAny(this::unhandled) .build(); private final PartialFunction&lt;Object, BoxedUnit&gt; stage1 = ReceiveBuilder .match(Response.class, this::stage1) .matchAny(this::unhandled) .build(); private final PartialFunction&lt;Object, BoxedUnit&gt; stage2 = ReceiveBuilder .match(Response.class, this::stage2) .matchAny(this::unhandled) .build(); private final PartialFunction&lt;Object, BoxedUnit&gt; stage3 = ReceiveBuilder .match(Response.class, this::stage3) .matchAny(this::unhandled) .build(); private final PartialFunction&lt;Object, BoxedUnit&gt; stage4 = ReceiveBuilder .match(Response.class, this::stage4) .matchAny(this::unhandled) .build(); private final PartialFunction&lt;Object, BoxedUnit&gt; stage5 = ReceiveBu…
upvote count: 5
tagged with: java
type: Question
tagged with: akka

http://stackoverflow.com/q/26215223
possible better answer: http://stackoverflow.com/a/26216347
downvote count: 0
has answer: http://stackoverflow.com/a/26216347
favorite count: 0
has title: Using a MultiValueMap from Apache Commons Collections
tagged with: apache-commons-collection
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26216844
accepted answer: http://stackoverflow.com/a/26216654
tagged with: java
has body: Given below an example of org.apache.commons.collections.map.MultiValueMap (from commons-collections-3.2.1) Map&lt;String, Object&gt; multiValueMap = MultiValueMap.decorate(new HashMap&lt;String, Object&gt;()); multiValueMap.put("orderId", 1L); for(Map.Entry&lt;String, Object&gt; entry : multiValueMap.entrySet()) { List&lt;Object&gt; value = (List&lt;Object&gt;) entry.getValue(); System.out.println(entry.getKey()+" : "+value.get(0)); } This works fine as it appears. It displays a key and the value associated with the key. If the declaration is changed as follows, Map&lt;String, Object&gt; multiValueMap = MultiValueMap.decorate(new HashMap&lt;String, Object&gt;(){{ put("orderId", 1L); }}); then it throws an exception - java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.List at the first line in the only foreach loop given. In this case, the given MultiValueMap is not really a MultiValueMap. It is rather a usual HashMap. How does changing the declaration in this way make a difference?
type: Question
score: 4
upvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/26216654

http://stackoverflow.com/comment/41169462
has text: @DavidEisenstat, Yea, that's a good point. I've been using `Math.abs(x-y) < EPSILON` for equality tests but that's also been giving me separate issues. I was going to ask another question about how to go about this in a question in the future after I fix this deletion issue first.
score: 0
comment on: http://stackoverflow.com/q/26243952
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26318470
score: -1
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/26318687
has comment: http://stackoverflow.com/comment/41302402
has body: I'm writing a program that allow me to look through java files on my computer and see if all of the braces match up, so there are as many { as } and no } before a matching {. It lets me select a file, and then after I do it says that I No such element exception and that no line was found. The other half of the time it just runs forever, making me think I set an infinite loop somehow. Any tips with the scanner or while loop would be appreciated. public class BraceChecker { public static void main(String[] args) { final JFileChooser fc = new JFileChooser(); int response = fc.showOpenDialog(null); boolean end = true; if (response == JFileChooser.APPROVE_OPTION) { File f = fc.getSelectedFile(); Scanner scan1 = new Scanner(f.toString()); String line; ArrayListStack Stack1 = new ArrayListStack(); while ((line = scan1.nextLine()) != null &amp;&amp; end) { for (int i = 0; i &lt; line.length(); i++) { if (line.charAt(i) == '{') { Stack1.push('{'); } if (line.charAt(i) == '}') { if (Stack1.isEmpty()) { System.out.println("Braces Are Unbalanced"); end = false; i = line.length(); } else { Stack1.pop(); } } } } if (end == true &amp;&amp; Stack1.isEmpty()) { System.out.println("Braces are Balanced"); } } }
favorite count: 0
tagged with: java.util.scanner
has title: Whats wrong with how I'm using the scanner?
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/26318537
has comment: http://stackoverflow.com/comment/41302420
tagged with: java

http://stackoverflow.com/comment/131235951
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/71254595
has text: Furthermore, there must not be a `/` at the beginning of `fileName`.

http://stackoverflow.com/q/26269653
has body: Given two different classes which refer a common class(Test.java) in their definitions, How many times ClassLoader#loadClass(Test) gets called? ClassA { Test t = new Test(); } ClassB { Test t = new Test(); } I want to understand if a classloader has already loaded class(Test), and in another class(ClassB) same class is referred, does the jvm call ClassLoader#loadClass(Test) again or not? if not, how does it check if class is already loaded by same classloader?
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41213599
has title: Given two different classes which refer a common class(Test.java) in their definition, How many times ClassLoader#loadClass(Test) gets called?
has comment: http://stackoverflow.com/comment/41213597
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41213739
answer count: 0
tagged with: classloader

http://stackoverflow.com/q/26239168
has comment: http://stackoverflow.com/comment/41157543
has answer: http://stackoverflow.com/a/26239401
favorite count: 0
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41157608
accepted answer: http://stackoverflow.com/a/26239416
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/26239420
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26239420
has title: How to programme progress when max value is not known before a method is called?
type: Question
has body: On the remote server, there is a 5-digit numbers of particles. As they are being downloaded, the progress has to be updated. The number of particles is not known before the 3rd party downloader starts. So my methods look like this //Method calling progress counter @Override public void onUpdated(Object fetcher, int particlesRemaining) { //particlesRemaining is int like 10240 int progress = (int) countProgress(particlesRemaining); setProgress(progress); } //method counting progress public static double countProgress(int particlesRemaining) { //???how to set maxValue??? double temp = 100 / maxValue * (maxValue - particlesRemaining); return temp; } A parameter particlesRemaining is not known before I first time call countProgress. The first-time value is always the Max value and all subsequent values are smaller than the first one. So how shall I set maxValue once when I don't know it's value before countProgress has been called for the first time? After setting is first time as the max value, I have to lock it from changing.
has answer: http://stackoverflow.com/a/26239416

http://stackoverflow.com/comment/41277829
type: QuestionComment
has text: @Pshemo is that what is causing the problem? Because this is just copy and pasted from the text book....
comment on: http://stackoverflow.com/q/26304819
score: 0
type: Comment

http://stackoverflow.com/comment/41105564
type: Comment
type: QuestionComment
has text: @ṁᾶƔƏňツ ok i'm editing
comment on: http://stackoverflow.com/q/26211420
score: 0

byte
tags question: http://stackoverflow.com/q/26337002
tags question: http://stackoverflow.com/q/26242674
tag name: byte
tags question: http://stackoverflow.com/q/26201630
tags question: http://stackoverflow.com/q/26332355
tags question: http://stackoverflow.com/q/26202243
tags question: http://stackoverflow.com/q/26318952
tags question: http://stackoverflow.com/q/26274770
tags question: http://stackoverflow.com/q/26262367
type: Tag

http://stackoverflow.com/comment/41104821
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26210438
has text: I seem to understand how the values change, but for some reason I'm unable to run a test The test class:
type: AnswerComment

http://stackoverflow.com/comment/41155838
has text: Stateless objects are objects without instance fields. An immutable field (set in constructor) gives an object with one state, not a stateless one.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26238429
type: Comment

http://stackoverflow.com/q/26317982
has answer: http://stackoverflow.com/a/26318069
score: -2
has comment: http://stackoverflow.com/comment/41301716
favorite count: 0
type: UnansweredQuestion
tagged with: java
downvote count: 3
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41301676
has body: I have to write a program for class, to learn classes, fields, methods, and enumerations. I am for the most part lost, the class felt rushed through learning these things, and was only given a couple of examples in class, unrelated, no homework. I believe I have the constructors in, and maybe have the String toString bit right. The full directions and my code so far are below. If at all possible, I would rather not just be given the complete answer, I want to try to work through it and learn from it. My specific questions for now are: How do I incorporate the addTopping bit below into the code? Where does it go, and what parts need changed? I have prices for everything, where do I put those in? Some start of starting point would be greatly appreciated. Oh, and I use public for everything because while private was mentioned in class, was never really told if there was a specific protocol of which to use when. Directions for it are: For your next assignment, you are to create a class to represent pizzas, and then write a main program to exercise your class. A pizza has the following properties: A size: small, medium, or large. A number of toppings (from 0 to 3) from the following list: pepperoni, sausage, meatball,green peppers, onion, black olives, and mushrooms. A price. You will need a field for the size of the pizza and a field for each possible topping (so four additional fields). The price should not be stored in a field, but rather, calculated, using the values of the other fields. The pizza class will need an additional field to store the number of toppings on the pizza. Your pizza class should have the following methods: void addTopping(Topping topping) // Adds a topping. This is an error if the pizza already has four toppings. int getPrice() // calculates and returns the price of the pizza and toppings. String toString() // Returns a string describing the pizza. In addition, the class should have constructors to make a zero-topping pizza, a one-topping pizza…
answer count: 2
has answer: http://stackoverflow.com/a/26318095
has comment: http://stackoverflow.com/comment/41301652
has comment: http://stackoverflow.com/comment/41301926
has title: Trouble with Java Enumerations, Methods, and Classes

http://stackoverflow.com/comment/41118868
type: AnswerComment
comment on: http://stackoverflow.com/a/26218342
type: Comment
has text: i thought java compiler will follow sequence execution, just the way i have arranged my codes? that is, it will initialize x1 and x2 before doing substraction
score: 0

http://stackoverflow.com/q/26328601
tagged with: abstract-class
has answer: http://stackoverflow.com/a/26329435
has title: Java Class extends Abstract class but must have static method
type: AnsweredQuestion
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41321404
type: Question
tagged with: interface
has comment: http://stackoverflow.com/comment/41321385
answer count: 1
tagged with: factory
has comment: http://stackoverflow.com/comment/41321708
accepted answer: http://stackoverflow.com/a/26329435
has comment: http://stackoverflow.com/comment/41321361
tagged with: java
has comment: http://stackoverflow.com/comment/41321445
has body: I'm just playing around creating a program. I have an Abstract Class Foo (implements OtherThing), and a Class Bar that extends Foo. I plan on having several other classes that extend Foo and want to make sure they all have Static method. public abstract class Foo implements OtherThing {//....} public class Bar extends Foo{ public static Map&lt;Enum, List&lt;AnotherEnum&gt; getSomeThingMap(){ create someThingMap; someThingMap.put(Enum, List&lt;AnotherEnum&gt;); return someThingMap; } } I need any class that extends Foo to have this method in order for my Factory that creates the class to work. I can manually add the static method to each class that needs it. Each Bar class will create a slightly different Map. I tried adding the static method to both the Interface class OtherThing and the Abstract class Foo. Any way to do this or am I stuck adding this method to each class that I need to. I know it's not really hard just would prefer to force this method to be there.
has comment: http://stackoverflow.com/comment/41321432
upvote count: 1
has comment: http://stackoverflow.com/comment/41321513
downvote count: 0
has comment: http://stackoverflow.com/comment/41321488
tagged with: static-methods

http://stackoverflow.com/comment/41245483
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26285775
type: Comment
has text: So the I/O operation is still blocking for the library thread right?

http://stackoverflow.com/q/26273131
has body: I would like to have smooth terrain collision in my game engine, when i say smooth I mean the player's height isn't determined by one vertex. I belive barycentric coordinates are the way to go. And I've spent a good 7 hours researching this, but none of the code I've seen actually works and it doesn't explain it in plain-english either. This is all I have so far. :( public float getHeightAt(float xPos, float zPos) { Vector3f one = new Vector3f((float)xPos, ((float)new Color(heightMap.getRGB((int)xPos, (int)zPos)).getRed())/255f*exaggeration*scale, (float)zPos); Vector3f two = new Vector3f((float)xPos+1, ((float)new Color(heightMap.getRGB((int)xPos+1, (int)zPos)).getRed())/255f*exaggeration*scale, (float)zPos); Vector3f three = new Vector3f((float)xPos, ((float)new Color(heightMap.getRGB((int)xPos, (int)zPos+1)).getRed())/255f*exaggeration*scale, (float)zPos+1); float height = mid(one, two, three, new Vector3f(xPos, 0f, zPos)); System.out.println(height); return height + 0.25f; } private float mid(Vector3f a, Vector3f b, Vector3f c, Vector3f p) { Vector3f AB = a.mul(b); Vector3f BC = b.mul(c); Vector3f norm = AB.cross(BC); float n0 = norm.getX(); float n1 = norm.getY(); float n2 = norm.getZ(); return (n0*a.getX() + n1*a.getY() + n2*a.getZ() - n0*p.getX() - n2*p.getZ()) / n1; } It works but it isn't smooth and I don't even know ifit is barycentric. Here is an example of what I want: https://www.youtube.com/watch?v=ngJ6ISfXG3I
tagged with: opengl
score: 1
tagged with: java
tagged with: smoothing
type: Question
answer count: 2
has title: Smooth Terrain Collision - 3D
downvote count: 0
has answer: http://stackoverflow.com/a/26281038
upvote count: 1
tagged with: terrain
has comment: http://stackoverflow.com/comment/41232774
favorite count: 0
has answer: http://stackoverflow.com/a/26286804
accepted answer: http://stackoverflow.com/a/26286804
possible better answer: http://stackoverflow.com/a/26281038
tagged with: collision
type: AnsweredQuestion

http://stackoverflow.com/q/26341310
type: Question
has answer: http://stackoverflow.com/a/26342197
accepted answer: http://stackoverflow.com/a/26342197
tagged with: hashmap
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26341371
has answer: http://stackoverflow.com/a/26341371
has title: Accessing json string in java and creating hashmap Android
has comment: http://stackoverflow.com/comment/41345653
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41344894
tagged with: java
has body: I have a JSON string and I am trying to retrieve information from it. Json String looks like this. JSON STRING : { "information": { "device": { "id": 0 }, "user": { "id": 0 }, "data": [ { "datum": { "id": "00GF001", "history_id": "9992BH", "name": "abc", "marks": 57, "class": "B", "type": "Student" } }, { "datum": { "id": "72BA9585", "history_id": "78NAH2", "name": "ndnmanet", "marks": 70, "class": "B", "type": "Student" } }, { "datum": { "id": "69AHH85", "history_id": "NN00E3006", "name": "kit", "department": "EF003", "class": "A", "type": "Employee" } }, { "datum": { "id": "09HL543", "history_id": "34QWFTA", "name": "jeff", "department": "BH004", "class": "A1", "type": "Employee_HR" } } ] } } I am trying to access data JSONArray and respective Datum from it. I differentiated each datum as per type such as student, employee etc and push information in hashmap. I successfully did it in javascript but in Java I am struggle abit. When I am trying to access JSONArray it throws exception try { JSONObject data = new JSONObject(dataInfo); // Log.d(TAG, "CHECK"+data.toString()); JSONObject info = data.optJSONObject("information"); if(info.getJSONArray("data").getString(0).equals("Student") &gt; 0) //exception here Log.d(TAG, "Data"+ data.getJSONArray("data").length()); //exception here too for(int m = 0; m &lt; data.length(); m++){ // for(int s = 0; s &lt; data[m].ge) } } catch (JSONException j){ j.printStackTrace(); } Any pointers to create hashmap respective type I have. Appreciated

http://stackoverflow.com/comment/41161503
type: QuestionComment
has text: why do you want to know this? its perfectly OK to write null String, try to call writeString(null) and it will work, btw its here: http://androidxref.com/4.4_r1/xref/frameworks/base/core/jni/android_os_Parcel.cpp#641
score: 1
comment on: http://stackoverflow.com/q/26227095
type: Comment

http://stackoverflow.com/comment/41190824
comment on: http://stackoverflow.com/q/26257776
score: 3
has text: what `this` represents in JSP? are you using **Scriplet**?
type: QuestionComment
type: Comment

nullpointerexception
tags question: http://stackoverflow.com/q/26240631
tags question: http://stackoverflow.com/q/26315574
tags question: http://stackoverflow.com/q/26196037
tags question: http://stackoverflow.com/q/26264947
tags question: http://stackoverflow.com/q/26290904
tags question: http://stackoverflow.com/q/26208149
tags question: http://stackoverflow.com/q/26313217
tags question: http://stackoverflow.com/q/26287557
tags question: http://stackoverflow.com/q/26272032
tags question: http://stackoverflow.com/q/26251424
tags question: http://stackoverflow.com/q/26277165
tags question: http://stackoverflow.com/q/26258751
tags question: http://stackoverflow.com/q/26198206
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/26199525
tags question: http://stackoverflow.com/q/26323737
tags question: http://stackoverflow.com/q/26205993
tags question: http://stackoverflow.com/q/26218918
tags question: http://stackoverflow.com/q/26235426
tags question: http://stackoverflow.com/q/26346305
tags question: http://stackoverflow.com/q/26260690
tags question: http://stackoverflow.com/q/26242489
tags question: http://stackoverflow.com/q/26301711
tags question: http://stackoverflow.com/q/26211083
tags question: http://stackoverflow.com/q/26269490
tags question: http://stackoverflow.com/q/26305979
tags question: http://stackoverflow.com/q/26251703
tags question: http://stackoverflow.com/q/26206076
tags question: http://stackoverflow.com/q/26294834
tags question: http://stackoverflow.com/q/26340398
tags question: http://stackoverflow.com/q/26196008
tags question: http://stackoverflow.com/q/26216512
tags question: http://stackoverflow.com/q/26318608
tags question: http://stackoverflow.com/q/26207806
tags question: http://stackoverflow.com/q/26255689
tags question: http://stackoverflow.com/q/26286868
tags question: http://stackoverflow.com/q/26351644
tags question: http://stackoverflow.com/q/26324656
tags question: http://stackoverflow.com/q/26248670
tags question: http://stackoverflow.com/q/26318048
tags question: http://stackoverflow.com/q/26211744
tags question: http://stackoverflow.com/q/26285770

http://stackoverflow.com/comment/41437295
type: QuestionComment
has text: I attempted debugging, and got nowhere fast. No amount of google-fu helped me solve the message I was getting. Shortly thereafter, the debugger decided to completely ignore my breakpoints. It just immediately skips to the end. I'm about to pull my hair out over this. I just can't figure out why it doesn't want to move on past entering X.
comment on: http://stackoverflow.com/q/26349502
score: 0
type: Comment

http://stackoverflow.com/q/26267274
score: 3
upvote count: 3
tagged with: java
type: Question
has body: I am writing Java application on Azure cloud services one of my application components is non-web background processing,supposed to be a "worker role" in azure terminology, I am using azure plugin to eclipse. It seems like there is no way to deploy java application which is not a web application! cause for every deployment I must specify a web server to the package. Is there a way to define a worker role (java main application) to be deployed to azure cloud services?
tagged with: azure
downvote count: 0
has title: Java non-web deployment to Azure
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: azure-worker-roles

http://stackoverflow.com/q/26329746
tagged with: touch
score: 0
answer count: 2
tagged with: contains
has answer: http://stackoverflow.com/a/26332650
has answer: http://stackoverflow.com/a/26340130
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26340130
has comment: http://stackoverflow.com/comment/41347948
accepted answer: http://stackoverflow.com/a/26332650
type: Question
has title: LibGDX if 2 objects touches, do something
tagged with: object
has comment: http://stackoverflow.com/comment/41346060
tagged with: libgdx
has body: i have been testing to create a function which would do something, if two objects touch(if one contains or it is just touching the another one). I found this: public boolean inBounds(float cx, float cy, int size) { Rectangle rec1 = new Rectangle(x, y, this.size, this.size); Rectangle rec2 = new Rectangle(cx, cy, size, size); if(rec1.contains(rec2)) return true; return false; } } So, this is a touch function in my Entity class. So, in my update function which i am calling in render function, i have: if (e instanceof Worm &amp;&amp; player1.inBounds(e.x, e.y, e.size)) { entities.remove(i); //remove object from the scene i--; player1.incScore(); //increase score } This works perfectly, but only if my charracter is biger than that object, i need it everytime, no only if charracter is biger than object. So what to do now? i Found a function that i can use like if (rec1.overlaps(rec2)) return true; but now, it works, yes.. but the texture of my object is not so ultimate(this is the object: http://img24.cz/images/08705660216361901876.png ), so it looks bad. if the object is near the player, it activates my function, i want to have it only if the object is in the player, so i can create better texture, which is really hard for me, or i can ... I dont know what i can to do, so, help me please. :D

http://stackoverflow.com/comment/41312029
has text: This syntax is not valid. Look at your `if{} return n; else {}`
comment on: http://stackoverflow.com/q/26323683
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26304415
score: 0
has title: How to generate a customized DAO using hibernate tools
type: UnansweredQuestion
tagged with: reverse-engineering
tagged with: hibernate-tools
has body: I would like to generate a customized DAO which extends ClassA and implements SampleInterface. The SampleInterface has a method which should be implemented while generating this DAO. And also the naming convention of the DAO's I generate should have DAO at the end in the class name but not "Home", as the hibernate tools generate the DAO Classes with Home at the end by default. My table Names are Employee, Address, Salary and I have my entity generated and they are in com.mycompany.model package. Currently I have Address, Employee, Salary Entities with all the annotations and mapping in it. I want to generate AddressDAO, EmployeeDAO and SalaryDAO using below reverse engineering strategy. Below is my Reverse Engineering Strategy class public class DAOReverseEngineeringStrategy extends DelegatingReverseEngineeringStrategy { public DAOReverseEngineeringStrategy(ReverseEngineeringStrategy delegate) { super(delegate); // TODO Auto-generated constructor stub } @Override public Map tableToMetaAttributes(final TableIdentifier tableIdentifier) { Map<String, MetaAttribute> metaAttributes = super .tableToMetaAttributes(tableIdentifier); if (metaAttributes == null) { metaAttributes = new HashMap<String, MetaAttribute>(); } MetaAttribute attributeExtends = new MetaAttribute("extends"); attributeExtends.addValue("ClassA"); metaAttributes.put("extends", attributeExtends); MetaAttribute attributeImpl = new MetaAttribute("implements"); attributeImpl.addValue("SampleInterface"); metaAttributes.put("implements", attributeImpl); MetaAttribute attributeImport = new MetaAttribute("extra-import"); attributeImport.addValue("com.mycompany.ClassA"); attributeImport.addValue("com.mycompany.SampleInterface"); attributeImport.addValue("com.mycompany.model.*"); metaAttributes.put("extra-import", attributeImport); return metaAttributes; } }
has answer: http://stackoverflow.com/a/50638560
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/33148585
type: Question
answer count: 2
tagged with: dao

http://stackoverflow.com/comment/41258317
comment on: http://stackoverflow.com/q/26273868
score: 0
has text: @SanKrish If a duplicate question describes the same issue, but in different words, that can actually be a good thing (if someone is searching while debugging their issue and happens to use this different wording, that's someone who found what they needed and might not necessarily have before). It's the "search key phrase from question and immediately get several solutions as top hits" type questions that really shouldn't get upvotes.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26211532
has body: //Json Handler public class ServiceHandler { static String response = null; public final static int GET = 1; public final static int POST = 2; public ServiceHandler() { } /** * Making service call * @url - url to make request * @method - http request method * */ public String makeServiceCall(String url, int method) { return this.makeServiceCall(url, method, null); } /** * Making service call * @url - url to make request * @method - http request method * @params - http request params * */ public String makeServiceCall(String url, int method, List&lt;NameValuePair&gt; params) { try { // http client DefaultHttpClient httpClient = new DefaultHttpClient(); HttpEntity httpEntity = null; HttpResponse httpResponse = null; // Checking http request method type if (method == POST) { HttpPost httpPost = new HttpPost(url); // adding post params if (params != null) { httpPost.setEntity(new UrlEncodedFormEntity(params)); } httpResponse = httpClient.execute(httpPost); } else if (method == GET) { // appending params to url if (params != null) { String paramString = URLEncodedUtils .format(params, "utf-8"); url += "?" + paramString; } HttpGet httpGet = new HttpGet(url); httpResponse = httpClient.execute(httpGet); } System.out.println("Status in url =====" + httpResponse.getStatusLine().getStatusCode()); httpEntity = httpResponse.getEntity(); response = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return response; } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26211420

http://stackoverflow.com/comment/41103338
score: 0
type: Comment
type: AnswerComment
has text: In the debugger I really stepped first in the `catch (Exception e) { session.getTransaction().rollback(); throw e; } ` block and then in the second ` catch (ConstraintViolationException e)` block. So all of the code I mentioned is reachable. The problem is the scope of each transaction and why it's all mixed
comment on: http://stackoverflow.com/a/26210187

http://stackoverflow.com/comment/43721695
type: Comment
comment on: http://stackoverflow.com/a/27629884
type: AnswerComment
has text: @nhahtdh many thanks! Your're right, your solution are more succinct for decimal digits. If possible, please update my answers using your solution!
score: 0

http://stackoverflow.com/q/26270529
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: resources
type: Question
has title: Referring linked resource from eclipse rcp
has answer: http://stackoverflow.com/a/26272750
tagged with: rcp
has body: I have created a linked resource inside a plugin where the resource is sitting in some other folder. Some how i want to use this link resource in my plugin .But when i tried to get bundle and file url in below mentioned way it is returning me null as only link is there in the plugin and actual resource is sitting some where else. Bundle bundle = Platform.getBundle("xxxx"); Path path = new Path("resource"); URL url = FileLocator.find(bundle, path, null); URL fileUrl = FileLocator.toFileURL(url); Any clue on this will be helpful.
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/41313354
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26324185
has text: Code that depends on the success of code in a try block should be in the same try block. The real problem here is the connect failure, not the failure to read. You just printed it and continued as though it hadn't hapoened. Don't write code like this.

http://stackoverflow.com/q/26287345
has title: com.sun.script.java.JavaCompiler calls a nonexistent method
favorite count: 0
has body: Trying to use quartz 1.8.3 to execute Java code as a script. I'm using the BSF language jars packaged from an Apache BSF 3.1 build. The JVM version is 1.6.0_29. When it tries to evaluate the script I get: java.lang.NoSuchMethodError: javax.tools.JavaCompiler.getTask(Ljava/io/Writer;Ljavax/tools/JavaFileManager;Ljavax/tools/DiagnosticListener;Lnet/sourceforge/retroweaver/runtime/java/lang/Iterable;Lnet/sourceforge/retroweaver/runtime/java/lang/Iterable;Lnet/sourceforge/retroweaver/runtime/java/lang/Iterable;)Ljavax/tools/JavaCompiler$CompilationTask; at com.sun.script.java.JavaCompiler.compile(JavaCompiler.java:105) at com.sun.script.java.JavaScriptEngine.parse(JavaScriptEngine.java:114) at com.sun.script.java.JavaScriptEngine.eval(JavaScriptEngine.java:81) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247) at foo.quartzutils.ScriptJob.evalScript(ScriptJob.java:106) at foo.quartzutils.ScriptJob.execute(ScriptJob.java:54) at org.quartz.core.JobRunShell.run(JobRunShell.java:216) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) I'm at a loss to determine what could possibly be missing. UPDATE: To make this even more difficult to track down, this is intermittent. If I schedule the job to run once an hour it might fail three times with that exception, work two, then fail again after that.
has answer: http://stackoverflow.com/a/26335975
linked to: http://stackoverflow.com/q/1563909
has comment: http://stackoverflow.com/comment/41247113
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41246235
tagged with: scripting
tagged with: quartz-scheduler
type: Question
tagged with: java
score: 0
upvote count: 1
downvote count: 1
answer count: 1

http://stackoverflow.com/q/26278853
type: Question
has title: Java sockets - send any clients input to all other clients using threads
has comment: http://stackoverflow.com/comment/41231729
score: 0
has answer: http://stackoverflow.com/a/26279289
answer count: 1
has comment: http://stackoverflow.com/comment/41235370
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has body: The processes of the program go like so: In the server: -Open new window with GUI -Start a serversocket on port 1500 -Await a client to connect -Accept the client -Wait to recieve their username -Send their client number -Start a new Thread for the client -Store playernames, positions and the threads In the Thread: while loop: -Wait to Receive Object from client, where the Object is a Vector3f (float,float,float) -Set the ArrayList of Vector3f, where the index is clientnumber, to equal the Object recieved from the client -Send the client the arraylist In the Client: -Join server at specified ip -Send username -Recieve clientnumber while loop: -Send Vector3f -recieve arraylist of Vector3f But... I thought this would work. I thought that the clients would connect properly, and each client would recieve the arraylist of each of the other players positions (Vector3f). It seems to work for the first 4 clients that connect, until: java.util.ConcurrentModificationException Not sure how to fix this... Here is all the code: Client: package main; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; import java.util.ArrayList; public class Client { private Socket socket = null; private ObjectInputStream inStream = null; private ObjectOutputStream outStream = null; String name = "bob"; int port; String ip; Vector3f v3f = new Vector3f(0, 0, 0); int clientnumber = 0; int numberofclients = 0; ArrayList&lt;Vector3f&gt; positions = new ArrayList&lt;Vector3f&gt;(); public Client(int port, String ip, String name) { this.port = port; this.ip = ip; this.name = name; startClient(); } public void startClient() { try { socket = new Socket(ip, port); System.out.println("Connected"); outStream = new ObjectOutputStream(socket.getOutputStream());//send name outStream.writeObject(name); inStream = new ObjectInputStream(socket.getInputStream());//recieve client number clientnumber = (int) inStream.readObject(); while (true) { v3f = new Vector3f(Math.random…
has comment: http://stackoverflow.com/comment/41230492
tagged with: java

http://stackoverflow.com/a/26352744
has comment: http://stackoverflow.com/comment/41365428
accepted answer of: http://stackoverflow.com/q/26352610
has comment: http://stackoverflow.com/comment/41365734
has comment: http://stackoverflow.com/comment/41365423
has body: How about this: /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z,-?\d{2,3}\.\d{7},-?\d{2,3}\.\d{7},-?\d{1,2}\.\d/ For example, \d{4} means "4 digits", and -* means "0 or more dashes", so should match either postive or negative numbers. You could also be more generic by using groups of possible characters like this: /[0-9-]{10}[0-9TZ:]{10},[0-9-.,]{26,28}/ I.e., any digit or dash for 10 characters, than digits or the letters T or Z or colon for 10 more characters, then a comma, and digits, dash, period, or comma for 26-28 characters. That is not as strict as the regex above, but may be sufficient depending on your requirements. The above works for javascript and perl, and here is the R version (double escapes): s &lt;- "2014-08-06T21:02:16Z,-33.7939310,151.0553090,-0.8" grep("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z,-?\\d{2,3}\\.\\d{7},-?\\d{2,3}\\.\\d{7},-?\\d{1,2}\\.\\d", s)
answers question: http://stackoverflow.com/q/26352610
has comment: http://stackoverflow.com/comment/41365382
has comment: http://stackoverflow.com/comment/41365459
has comment: http://stackoverflow.com/comment/41365545
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/26273258
type: Answer
score: 1
upvote count: 1
has body: Are you looking to automatically translate the messages or use pre-prepared translations based on language settings? For the second option there is built in support within Java. Look at MessageFormat: http://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html And Resource Bundles: http://docs.oracle.com/javase/tutorial/i18n/resbundle/concept.html There is a Trail about i18n here: http://docs.oracle.com/javase/tutorial/i18n/ I can't recommend automatic translation for something like this as it is still not completely reliable. For something like a bill you really need to get it right.
answers question: http://stackoverflow.com/q/26273222
downvote count: 0

http://stackoverflow.com/q/26291247
score: 1
has answer: http://stackoverflow.com/a/26291323
tagged with: loops
upvote count: 1
type: Question
tagged with: case
has comment: http://stackoverflow.com/comment/41253250
has title: Running a different method each time through a loop
tagged with: java
tagged with: switch-statement
answer count: 3
has comment: http://stackoverflow.com/comment/41253563
has answer: http://stackoverflow.com/a/26291481
downvote count: 0
has body: My goal is to cut down on code by running this code through a loop each_score = ones(dice_values); total_score += each_score; end_scores += String.valueOf(each_score) + " "; followed by each_score = twos(dice_values); total_score += each_score; end_scores += String.valueOf(each_score) + " "; The only difference being the method in line one. I don't know of a way to do anything like this through something like a for loop and would rather not copy paste that code 13 times. (I'm also hoping for something more efficient than a switch case if that were possible) private static int ones(int[] dice_values) { int ones = 0; for(int i = 0; i &lt; 5; i++) if(dice_values[i] == 1) ones++; return ones; } private static int fours(int[] dice_values) { int fours = 0; for(int i = 0; i &lt; 5; i++) if(dice_values[i] == 4) fours++; return (fours * 4); } private static int five_of_kind(int[] dice_values) { int five_kind = 0; int[] five_of = new int[5]; for(int i = 0; i &lt; 5; i++) five_of[dice_values[i] - 1]++; if(Arrays.asList(five_of).contains(5)) five_kind = 50; return five_kind; } This is a sample of the methods. I'm solving a simple problem called Yahtzee. Given a set of 13 rolls of 5 dice, find the total score of all the rolls and the total of each type of point scored (the points being "one's: how many ones" or "five of a kind" as examples).
has answer: http://stackoverflow.com/a/26291307
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26291481
possible better answer: http://stackoverflow.com/a/26291323

http://stackoverflow.com/a/26310194
has comment: http://stackoverflow.com/comment/41287916
has comment: http://stackoverflow.com/comment/41288117
score: 1
answers question: http://stackoverflow.com/q/26310150
has body: When you don't need the synchronization, or when you aren't deluding yourself that a synchronized list is thread-safe even when iterating, which it isn't.
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41287955
type: Answer

http://stackoverflow.com/comment/41259870
type: Comment
has text: I was talking about the server. Thank you for explanation.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26247247

http://stackoverflow.com/a/26197981
has comment: http://stackoverflow.com/comment/96097879
upvote count: 0
has comment: http://stackoverflow.com/comment/65053417
has body: If you want to test both conditions together, do a || b. If you want to test each condition individually, do if(a) { if (b) { } }. For example: if (a) { if (b) { // Both true. } else { // Only a. } } else { if (b) { // Only b. } else { // Neither true. } }
downvote count: 3
has comment: http://stackoverflow.com/comment/41080715
answers question: http://stackoverflow.com/q/26197966
score: -3
type: Answer

rpc
tags question: http://stackoverflow.com/q/26197081
tag name: rpc
type: Tag

http://stackoverflow.com/q/26205031
type: Question
has title: Slingshot in box2d and libgdx
upvote count: 0
tagged with: libgdx
has body: How can I achieve something like this? https://www.youtube.com/watch?v=qnpkd3Ucg7s I know it should be done with a MouseJoint. The only problem is that I don't know how to "pin" the MouseJoint to the starting point. Everthing else I will manage to solve.
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -3
tagged with: drag
tagged with: java
has answer: http://stackoverflow.com/a/26206586
downvote count: 3
tagged with: box2d

http://stackoverflow.com/comment/41267770
type: QuestionComment
has text: So is the jar faster, or not? You title and your content says otherwise
score: 0
comment on: http://stackoverflow.com/q/26298932
type: Comment

http://stackoverflow.com/q/26290043
has title: Optimizing java heap usage by String using StringBuffer , StringBuilder , String.intern()
has comment: http://stackoverflow.com/comment/41253390
has comment: http://stackoverflow.com/comment/41276254
has comment: http://stackoverflow.com/comment/41252395
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41253575
has comment: http://stackoverflow.com/comment/41258410
has comment: http://stackoverflow.com/comment/41253608
linked to: http://stackoverflow.com/q/11768615
tagged with: java
has comment: http://stackoverflow.com/comment/41275642
has comment: http://stackoverflow.com/comment/41252510
has comment: http://stackoverflow.com/comment/41275362
type: Question
has comment: http://stackoverflow.com/comment/41251307
accepted answer: http://stackoverflow.com/a/26296967
has comment: http://stackoverflow.com/comment/41288413
has body: I am monitoring the performance and CPU of a large java application , using VisualVM. When I look at its memory profile I see maximum heap (about 50%) is being used up by char arrays. Following is a screenshot of the memory profile: In the memory profile at any given time i see roughly about 9000 char[] objects. The application accepts a large file as input. The file roughly has about 80 lines each line consisting of 15-20 delimited config options. The application parses the file and stores these lines in a ArrayList of Strings. It then parses these string to get the individual config options for each server. The application also frequently logs each event to the console. Java implementation of Strings uses char[] internally along with a reference to array and 3 integer. From different posts on the internet it seems like StringBuffer , StringBuilder , String.intern() are more memory efficient data types. How do they compare to java.lang.String ? Has anybody benchmarked them ? If the application uses multithreading (which it does)are they a safe alternative ?
tagged with: optimization
has answer: http://stackoverflow.com/a/26296967
score: 0
linked to: http://stackoverflow.com/q/1532461
has comment: http://stackoverflow.com/comment/41251042
upvote count: 1
answer count: 1
downvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/41251740
favorite count: 0
tagged with: visualvm
tagged with: heap-memory

sys-refcursor
tags question: http://stackoverflow.com/q/26351192
tag name: sys-refcursor
type: Tag

http://stackoverflow.com/comment/41309770
score: 0
type: AnswerComment
has text: I have managed to get the code working somewhat but the problem I come across is when the is both a left and right node... check my edit for BSTNode
type: Comment
comment on: http://stackoverflow.com/a/26321551

http://stackoverflow.com/comment/41097734
comment on: http://stackoverflow.com/a/26203037
score: 1
type: AnswerComment
type: Comment
has text: @MadProgrammer: Worse, `GridLayout` makes them all the size of the _largest_; scaling is a different problem; I agree about `WrapLayout`; `I've used `JList` with a custom render in this context, too.

http://stackoverflow.com/comment/79939293
comment on: http://stackoverflow.com/a/26297218
type: Comment
has text: Try not to use shadow variables. It confuses code readers.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41303241
has text: @HovercraftFullOfEels I have added the code in my question. Please have a look.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26318121

http://stackoverflow.com/q/26276797
tagged with: worklight-runtime
tagged with: ibm-mobilefirst
tagged with: java
type: Question
has body: Environment details: 1.OS Linux 2.Worklight 6.2 in clustered environment 3.WAS ND 8.5.5 4.DB2 10.5 Deployed Sample war file. Deploying a sample-common.wlapp file which is of size 3mb gives "java heap space". If a file (.wlapp) of size less then 2 MB deploying successfully. I tried setting the JVM heap sizes to about 2048mb on the servers. Still no luck. `Transaction 2 type: UPLOAD_APPLICATION status: FAILURE dateCreated : 2014-10-09T10:43:28.943Z dateUpdated: 2014-10-09T10:44:07.932Z server: WebSphere:ihsCell01/wl2Node01/worklight2 description: appVersionsDeployed: 1 : applicationName: AppDelegate environment: android version: 1.0 filename: AppDelegate-android-1.0.wlapp errors: 1 : mbeanName: WebSphere:cell=ihsCell01,name=Dubai,node=wl1Node01,process=worklight1,type=ProjectManagement_RAK date: 2014-10-09T10:44:03.766Z phase: PREPARE code: FAILURE exception: OutOfMemoryError details: Java heap space 2 : mbeanName: WebSphere:cell=ihsCell01,name=Dubai,node=wl2Node01,process=worklight2,type=ProjectManagement_RAK date: 2014-10-09T10:44:07.803Z phase: PREPARE code: FAILURE exception: OutOfMemoryError details: Java heap space ` Server Logs [10/9/14 4:10:18:872 PDT] 0000010c BaseTransacti E RuntimeMBeanCallable.call() exception java.lang.OutOfMemoryError: Java heap space at com.ibm.ws.management.connector.soap.SOAPConnectorClient.handleAdminFault(SOAPConnectorClient.java:948) at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplateOnce(SOAPConnectorClient.java:916) at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:682) at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:672) at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:658) at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:480) at com.sun.proxy.$Proxy85.invoke(Unknown Source) at com.ibm.ws.management.AdminClientImpl.invoke…
score: 0
has title: Worklight 6.2 wlapp deployment gives error java heap space
has answer: http://stackoverflow.com/a/26280946
answer count: 1
tagged with: worklight-server
type: UnansweredQuestion

http://stackoverflow.com/comment/41334084
has text: @JohnathanMarkSmith what if you posted another question with the relevant details such as the log and stack trace?
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26320911

http://stackoverflow.com/a/26248040
answers question: http://stackoverflow.com/q/26247971
has comment: http://stackoverflow.com/comment/41174191
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26247971
has comment: http://stackoverflow.com/comment/41174252
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41174167
has comment: http://stackoverflow.com/comment/41174695
has body: You need to read into both arrays in the same loop, like this: int i = 0; while(scan.hasNext()) { countryNames[i] = scan.nextLine(); if (scan.hasNext()) populationNum[i] = scan.nextInt(); if (scan.hasNext()) scan.nextLine(); // Go to the next line i++; } The two for loops inside the while are incorrect (not to mention that the second for loop is not even part of the while, because you omitted curly braces). Demo.
has comment: http://stackoverflow.com/comment/41174278
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/41184105
has comment: http://stackoverflow.com/comment/41174368
has comment: http://stackoverflow.com/comment/41174404

http://stackoverflow.com/comment/107039742
type: AnswerComment
has text: unless I'm mistaken, the alias commands shouldn't have backticks (`) around them but instead single quotes ('). Otherwise the alias just gets set to the output of the export command (blank) rather than the export command itself
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26252993

http://stackoverflow.com/q/26303519
has comment: http://stackoverflow.com/comment/41275453
has answer: http://stackoverflow.com/a/26303784
score: 0
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/26303784
tagged with: arraylist
type: AnsweredQuestion
has body: I already asked a similar question here and one user suggested to subclass ArrayAdapter, but I have issues with that. Here is my problem: I use a HashMap&lt;String, String&gt; and a SimpleAdapter object to display user data in my ListView, but now I want to replace the HashMap&lt;String, String&gt; with an ArrayList&lt;User&gt;(); containing real user objects. Here is the old code: HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put(TAG_USERNAME, c.getString(TAG_USERNAME)); map.put(TAG_FIRSTNAME, c.getString(TAG_FIRSTNAME)); map.put(TAG_LASTNAME, c.getString(TAG_LASTNAME)); map.put(TAG_ADDRESS, c.getString(TAG_ADDRESS)); usersList.add(map); [...] ListAdapter adapter = new SimpleAdapter(this, usersList, R.layout.single_user, new String[] { TAG_USERNAME, TAG_FIRSTNAME, TAG_LASTNAME, TAG_ADDRESS }, new int[] { R.id.textViewUsername, R.id.textViewFirstName, R.id.textViewLastName, R.id.textViewAddress }); Now, as suggested, I tried to subclass ArrayAdapter, but I have no plan how the getView(int, View, ViewGroup) should look like, to achieve my objective. Here is my current code: public class UserArrayAdapter extends ArrayAdapter&lt;User&gt; { private Context mcon; private List&lt;User&gt; userList; public UserArrayAdapter(Context context, int resource, List&lt;User&gt; userList) { super(context, resource); mcon = context; this.userList = userList; } @Override public View getView(int position, View convertView, ViewGroup parent) { for (User usr : userList) { findViewById(R.id.textViewUsername).setText(usr.getFirstName()); } return super.getView(position, convertView, parent); } } Here is the User class: public class User { private String username, firstName, lastName, address; public User(String username, String firstName, String lastName, String address) { setUsername(username); setFirstName(firstName); setLastName(lastName); setAddress(address); } public String getUsername() { return username; } public void setUsername(String username) { if…
linked to: http://stackoverflow.com/q/26284948
possible better answer: http://stackoverflow.com/a/26303619
has title: Subclass ArrayAdapter in android to display ArrayList
has answer: http://stackoverflow.com/a/26303619
type: Question
tagged with: android

http://stackoverflow.com/q/26335471
accepted answer: http://stackoverflow.com/a/26335717
has title: Building reverse engineered project
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41349756
has body: I learn development for android, I would like to see how certain application is built, I also would like to adjust its UI controls positions for sole use. So, I decompiled the application and try to build it with Eclipse bundle. I got an apk file built, but when I start it it produces the exception "java.lang.RuntimeException: Unable to get provider iching.android.contentprovider.DivinationProvider" But I see the file src/iching/android/contentprovider/DivinationProvider.java which contains missing class definition: package iching.android.contentprovider; import android.content.ContentProvider; import android.content.ContentValues; import android.content.Context; import android.content.UriMatcher; import android.database.Cursor; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import iching.android.persistence.IChingSQLiteDBHelper; public class DivinationProvider extends ContentProvider { How can I get compiled apk which can't find a class, used in it? Why does not it find the class declared in properly placed source file? UPDATE: I found java compiler was disabled, so bin/classes remain empty on build finish UPDATE2: Yep there was a lot of errors when I enabled javac.
tagged with: java
tagged with: eclipse
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26335717
tagged with: android
has comment: http://stackoverflow.com/comment/41334301

actionlistener
tags question: http://stackoverflow.com/q/26283199
tags question: http://stackoverflow.com/q/26228270
tags question: http://stackoverflow.com/q/26310880
tags question: http://stackoverflow.com/q/26327429
tags question: http://stackoverflow.com/q/26267230
tags question: http://stackoverflow.com/q/26290581
tags question: http://stackoverflow.com/q/26293405
tags question: http://stackoverflow.com/q/26287428
tags question: http://stackoverflow.com/q/26212581
tags question: http://stackoverflow.com/q/26306042
tags question: http://stackoverflow.com/q/26319688
tags question: http://stackoverflow.com/q/26319537
tags question: http://stackoverflow.com/q/26305161
type: Tag
tag name: actionlistener
tags question: http://stackoverflow.com/q/26327998
tags question: http://stackoverflow.com/q/26323931

http://stackoverflow.com/a/26277528
answers question: http://stackoverflow.com/q/26277305
type: Answer
has comment: http://stackoverflow.com/comment/41379406
downvote count: 0
score: 1
upvote count: 1
has body: For me it could be done this way. First of all you create very generic vehicle class which basically has amount of wheels and name and maybe something else. Then you extend it many times to create motored vehicles, vehicles without motors then cars, trucks and so on. In addition you could have interfaces towable and many other interfaces that describe some special abilities. This way you could check it for compatibility by checking if a vehicle implements required interface. Hope it helps. Good luck.

http://stackoverflow.com/q/26224289
score: -2
has answer: http://stackoverflow.com/a/26224420
has comment: http://stackoverflow.com/comment/41130121
answer count: 2
has comment: http://stackoverflow.com/comment/41130075
favorite count: 0
has comment: http://stackoverflow.com/comment/41130447
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26224351
has body: I think this code is thread-safe, but if I place the synchronized after the if, it's not thread-safe isn't it ? I have just a doubt : public class decrementIfSup0 { private static int cpt = 5; public void decrement() { synchronized(cpt) { if(cpt &gt; 0) cpt--; } } } }
has title: Thread-safety with int - easy
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41142022
upvote count: 1
has comment: http://stackoverflow.com/comment/41130786
type: Question

http://stackoverflow.com/q/26323171
accepted answer: http://stackoverflow.com/a/26323392
score: 0
tagged with: java
answer count: 1
tagged with: post
has body: I have an android application and I need to enable the user to login. I have the login button and when the button is pressed by the user I call to an asyncTask to post the user data to the rest service. I'm able to call the method but when I debug the server side I see that the parameters are null, even though it sends as json object to the server. Android Client Code: class LoginByEmail extends AsyncTask&lt;String,Void,String&gt; { @Override protected String doInBackground(String... strings) { String url = strings[0]; String respStr = ""; String userEmail = strings[1]; String userPassword = strings[2]; HttpResponse response; JSONObject data = new JSONObject(); try{ HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); post.setHeader("Accept","application/json"); post.setHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF8"); data.put("email",userEmail); data.put("password",userPassword); StringEntity se = new StringEntity(data.toString()); post.setEntity(se); response = client.execute(post); respStr = EntityUtils.toString(response.getEntity()); }catch (Exception e){ respStr = e.getMessage().toString(); } return respStr; } } Server Side Code @Path("/emailLogin") @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) public String emailLogin(@FormParam("email") String email, @FormParam("password") String password) { String user = sm.loginByEmail(email,password); return user; } I'm using glassfish as my webhost and deploy to it my rest webservice, the emailLogin function is from the rest webservice. I don't understand why the email and password parameters are transferred as null. Note: the userEmail and userPassword variables are not null, they gets their value properly Any Idea? Edit: variables values:
has title: Android post to rest webservice - with localhost glassfish
tagged with: glassfish
tagged with: rest
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26323392
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/41311341

http://stackoverflow.com/comment/52437006
has text: the doc says that the method you are using has no mean of returning you any information regarding, for example, the number of affected rows. Why do you use `execSQL`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26243677

http://stackoverflow.com/a/26313794
upvote count: 2
answers question: http://stackoverflow.com/q/26312985
has body: Java uses IEEE 754 format to encode double values. So that means that each number is an approximation as accurate as possible. 0.7 is bestly approximated by 0.699999999999999999999999 Check this out: http://www.binaryconvert.com/result_double.html?decimal=048046055 To fix your problem, can you try multiplying by 10.0 and treat your values accordingly?
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/41090079
type: QuestionComment
has text: Write a method `print`. Have it call `System.out.println`. Done. You can magically fix this with `import static` but it's not recommended.
score: 0
comment on: http://stackoverflow.com/q/26203319
type: Comment

http://stackoverflow.com/a/26407222
has comment: http://stackoverflow.com/comment/41468770
has comment: http://stackoverflow.com/comment/41467499
has comment: http://stackoverflow.com/comment/62684563
score: 12
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41476493
upvote count: 12
type: Answer
has comment: http://stackoverflow.com/comment/58225352
has comment: http://stackoverflow.com/comment/41464770
has body: Try to play with raster images: Detect bounds of text using Paint.getTextBounds() method Create transparent Bitmap with such metrics (W + H) x H (you may use Bitmap.Config.ALPHA_8 to optimize memory usage) Draw text on this Bitmap at 0x0 position Copy first row of Bitmap into new one with original width, but with height of 1px Iterate over the Y-axis of Bitmap (from top to bottom) and draw single-line Bitmap with the corresponding offset by X-axis (you will overdraw some transparent pixels) Now you have the top-part of your shadow Draw the bottom part using same technique, but choosing last row of this Bitmap This algorithm may be optimized if you detect, that all pixels in last row have the same color (full shadow). UPDATE 1 I achieved such result using this quick solution: MainActivity.java import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle state) { super.onCreate(state); LongShadowTextView longShadow = new LongShadowTextView(this); longShadow.setText("Hello World"); setContentView(longShadow); } } LongShadowTextView.java import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; import android.view.View; public class LongShadowTextView extends View { private Bitmap mBitmap; private String mText; public LongShadowTextView(Context context) { super(context); } public void setText(String text) { Paint paint = new Paint(); // TODO provide setters for these values paint.setColor(Color.BLACK); paint.setTextSize(142); Rect rect = new Rect(); paint.getTextBounds(text, 0, text.length(), rect); Bitmap bitmap = Bitmap.createBitmap(rect.width() + rect.height(), rect.height(), Bitmap.Config.ALPHA_8); Canvas canvas = new Canvas(bitmap); canvas.drawText(text, 0, rect.height(), paint); Rect src = new Rect(); RectF dst = new RectF(); i…
has comment: http://stackoverflow.com/comment/41464968
downvote count: 0
has comment: http://stackoverflow.com/comment/58209979
has comment: http://stackoverflow.com/comment/62684116
accepted answer of: http://stackoverflow.com/q/26326096
has comment: http://stackoverflow.com/comment/41476520
answers question: http://stackoverflow.com/q/26326096

http://stackoverflow.com/comment/41203410
type: Comment
score: 0
has text: @tieTYT oh, sorry. it's a static import from Double class
type: QuestionComment
comment on: http://stackoverflow.com/q/26264188

http://stackoverflow.com/comment/41223475
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26274816
has text: @PeterHorvath yup, thats why i said "I think it is better" :)

http://stackoverflow.com/q/26233010
answer count: 2
type: UnansweredQuestion
tagged with: android
tagged with: c++
tagged with: java
has body: i Have a rectangle drawn by opencv+java+android. now i need to crop and display in my imagviwe how to crop it. submat methord is allow only int values. but rect.tl().x values are in double. casting is not a good solution. it make errors. Core.rectangle(ImageMatin, rect.tl(), rect.br(), new Scalar(255, 0, 0),1); // works Mat cropped = ImageMatin.submat(rect.tl().x, rect.height, rect.tl().x, rect.width); //error
has answer: http://stackoverflow.com/a/33254133
type: Question
has answer: http://stackoverflow.com/a/26234044
tagged with: opencv
has title: How to crop image in opencv with android
has comment: http://stackoverflow.com/comment/41146537
score: 0

http://stackoverflow.com/q/26286501
tagged with: parse-platform
has answer: http://stackoverflow.com/a/30318850
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
tagged with: android-layout
has title: ExceptionInInitializerError - service and library
has body: I have unexpectedly encountered the ExceptionInIntiialize Error while trying to run my application. I believe the error is prompted when users click on the quick chat button. 10-09 18:27:08.450: E/AndroidRuntime(999): FATAL EXCEPTION: main 10-09 18:27:08.450: E/AndroidRuntime(999): java.lang.ExceptionInInitializerError 10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.internal.client.ServiceFactory.createUserAgent(ServiceFactory.java:44) 10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.internal.client.DefaultSinchClient.&lt;init&gt;(DefaultSinchClient.java:157) 10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.internal.client.InternalSinchClientFactory.createSinchClient(InternalSinchClientFactory.java:14) 10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.DefaultSinchClientBuilder.build(DefaultSinchClientBuilder.java:95) 10-09 18:27:08.450: E/AndroidRuntime(999): at com.dooba.beta.MessageService.startSinchClient(MessageService.java:56) 10-09 18:27:08.450: E/AndroidRuntime(999): at com.dooba.beta.MessageService.onStartCommand(MessageService.java:40) 10-09 18:27:08.450: E/AndroidRuntime(999): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2490) 10-09 18:27:08.450: E/AndroidRuntime(999): at android.app.ActivityThread.access$1900(ActivityThread.java:130) 10-09 18:27:08.450: E/AndroidRuntime(999): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292) 10-09 18:27:08.450: E/AndroidRuntime(999): at android.os.Handler.dispatchMessage(Handler.java:99) 10-09 18:27:08.450: E/AndroidRuntime(999): at android.os.Looper.loop(Looper.java:137) 10-09 18:27:08.450: E/AndroidRuntime(999): at android.app.ActivityThread.main(ActivityThread.java:4745) 10-09 18:27:08.450: E/AndroidRuntime(999): at java.lang.reflect.Method.invokeNative(Native Method) 10-09 18:27:08.450: E/AndroidRuntime(999): at java.lang.reflect.Method.invoke(Method.java:511) 10-09 18:27:08.450: E/AndroidRuntime(99…
score: 0
answer count: 1
tagged with: android-activity

http://stackoverflow.com/q/26334052
has title: What code should i write to get JSR bytecode in my .class?
answer count: 0
has comment: http://stackoverflow.com/comment/41331647
tagged with: java
type: Question
tagged with: bytecode
score: 0
tagged with: javac
linked to: http://stackoverflow.com/q/21150154
has comment: http://stackoverflow.com/comment/41331447
type: UnansweredQuestion
has body: I need to get JSR (of course with corresponding RET) bytecodes in destination .class file. But i can't imagine what Java code should i write to get it? P.S. i work with Java 1.6
duplicate of: http://stackoverflow.com/q/21150154
tagged with: low-level

http://stackoverflow.com/comment/41350011
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26344218
score: 0
has text: What do you think `int(..)` does and why do you think so?

http://stackoverflow.com/a/26257099
accepted answer of: http://stackoverflow.com/q/26256848
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26256848
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41190229
has comment: http://stackoverflow.com/comment/41190408
has body: You must update the column model on changing header value JTable table = new JTable(modGen); //... modGen.setYear(boxYears.getSelectedIndex()+1); for (int i = 0; i &lt; modGen.getColumnCount(); i++) { String name = modGen.getColumnName(i); int viewIdx = table.convertColumnIndexToView(i); if (viewIdx &gt;= 0) { table.getColumnModel().getColumn(viewIdx).setHeaderValue(name); } }
upvote count: 1

http://stackoverflow.com/a/26253665
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26245019
has body: When using on-heap tier in Ehcache, keys and values are by reference. So any modification to the object will be reflected in the cache.
answers question: http://stackoverflow.com/q/26245019
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41199387
comment on: http://stackoverflow.com/q/26262137
score: 0
has text: @JigarJoshi thanks Jigar, but I am looking for a more "elegant" solution ;-)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/53331492
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26324603
has body: Use if (!rs.isBeforeFirst()) instead of if (rs.isBeforeFirst()). your problem would be solved.

http://stackoverflow.com/comment/69492379
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26302175
has text: I have had this on code on java6 and java7 and didn't see the results that you are seeing. I read about it that it still exists may be you are doing something wrong can you create http://stackoverflow.com/help/mcve and post a new question and send me the link. I can take a look @ it.
score: 0

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/26247323

http://stackoverflow.com/comment/41170183
type: Comment
has text: possible duplicate of [Installing Tomcat 7 as Service on Windows Server 2008](http://stackoverflow.com/questions/5920051/installing-tomcat-7-as-service-on-windows-server-2008)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26245817

http://stackoverflow.com/comment/41128661
comment on: http://stackoverflow.com/a/26196801
type: Comment
has text: @dyoo Thanks for the research. I couldn't find any similar disclaimer on the Java side, and the model actually appears to persist to the datastore without issue (disclaimer: I have not run the app in production). It would be nice if Google included a similar note for cloud endpoints.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26324559
has body: I am designing a generic system that should have capability to fetch relevant records from database for given input. fetch set of rules applicable on given input. filter records based on rules. I envision my system to keep rule execution in itself and not delegate it to a rule engine like Drools, hence - I need inputs on available libraries - that will allow me to STORE/ADD/UPDATE/MANAGE_CONFLICTS and finally FETCH_RELEVANT rules. Questions : Available libraries to create a rule base and allow fast search on them ? _________________ ___________ __________________________ | | fast | | | | | Workflow System |--------| Rule Base |--------| User interface for rules | |_________________| search |___________| |__________________________| Use Case : Imagine a graph with node as cities and edges as connections. Two nodes can be linked via several edges (train, air, road etc) each having its own cost and time constraints. Input is source node and destination node. Rules may be like : Pay octroi charges while in city X, Prefer air route between X and Y only when road and train route is not available etc. PS : My workflow will fetch data from a tree graph for input (source-destination pair). It will then apply set of rules applicable on each node, each edge on the path joining source destination. PS : I went through open problems in CS like multicommodity demand flow problem on trees/graphs which are NP hard and have similar definitions, but my system is trying to solve the problem even it is sub optimal solution.
tagged with: rule
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/37514790
has comment: http://stackoverflow.com/comment/41328764
has title: Rule Base for Java enabled workflow system
has comment: http://stackoverflow.com/comment/41317542
tagged with: java
type: Question
score: 0
tagged with: drools
answer count: 1
tagged with: workflow

http://stackoverflow.com/a/26271681
score: 0
has comment: http://stackoverflow.com/comment/41217622
has comment: http://stackoverflow.com/comment/41222951
answers question: http://stackoverflow.com/q/26271376
has body: Create a static variable that can be accessed by all your Threads like: public class MainClass { public static void main(String[] args) { Thread t1 = new Thread(new Runnable() { public void run() { Constants.intValue[0][0] = new Integer(10); } }); Thread t2 = new Thread(new Runnable() { public void run() { Constants.intValue[0][1] = new Integer(20); } }); Thread t3 = new Thread(new Runnable() { public void run() { for (Integer[] valueArr : Constants.intValue) { for (Integer intValue : valueArr) { System.err.println(intValue); } } } }); t1.start(); t2.start(); t3.start(); } } interface Constants { Integer[][] intValue = new Integer[2][2]; } The only case will be next thread will override previous set value if it is using the same array position.
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41218013

http://stackoverflow.com/a/26258988
has comment: http://stackoverflow.com/comment/41193153
upvote count: 1
type: AcceptedAnswer
has body: The actual properties were in the doc I linked to http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html There was a typo in suggestion from Markus - it's spring.data.mongodb.* I'm still not sure how I can change the db name created though - the default appears to be "test" - maybe this is a default in mongodb?
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26257967
answers question: http://stackoverflow.com/q/26257967

http://stackoverflow.com/comment/41113580
type: QuestionComment
type: Comment
has text: Maybe this is caused by the fact that the current 9.2 driver has the build number `1004` not `1003`?
score: 0
comment on: http://stackoverflow.com/q/26214597

http://stackoverflow.com/comment/41219394
type: AnswerComment
type: Comment
has text: thanks for help, but how we will get key in this statement optionKeys.indexOf(o1.key), I am getting error for "o1.key"
comment on: http://stackoverflow.com/a/26272143
score: 0

http://stackoverflow.com/q/26199515
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41083692
type: Question
has answer: http://stackoverflow.com/a/37486000
has answer: http://stackoverflow.com/a/32558387
has title: Callback/closure with JNR taking a pointer argument
score: 5
upvote count: 5
tagged with: jnr
tagged with: http://stackoverflow.com/tag/c
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41083470
has body: I'm using JNR and trying to pass a callback function with the following C-equivalent signature: int fn(void const*, void const**, void**) into some C function. I have declared the callback nested in the JNR library interface on the Java side as: public static interface Fn { @Delegate public int call(Pointer a, Pointer[] b, Pointer[] c); } with another function in the JNR library interface public int doSomething(Fn fn); to serve as a wrapper around doSomething in C code accepting int(*)(void const*, void const**, void**). But whenever I create a callback: new Fn() { int call() { ... } }; And pass it off to the doSomething method of my JNR library interface I get the runtime error: java.lang.ExceptionInInitializerError Caused by: java.lang.IllegalArgumentException: unsupported closure parameter type class [Ljnr.ffi.Pointer; at jnr.ffi.provider.jffi.NativeClosureProxy.newProxyFactory(NativeClosureProxy.java:109) at jnr.ffi.provider.jffi.NativeClosureFactory.newClosureFactory(NativeClosureFactory.java:84) at jnr.ffi.provider.jffi.NativeClosureManager.initClosureFactory(NativeClosureManager.java:71) at jnr.ffi.provider.jffi.NativeClosureManager.getClosureFactory(NativeClosureManager.java:49) at jnr.ffi.provider.jffi.NativeClosureManager.newClosureSite(NativeClosureManager.java:81) at jnr.ffi.provider.jffi.InvokerTypeMapper.getToNativeConverter(InvokerTypeMapper.java:68) at jnr.ffi.provider.jffi.InvokerTypeMapper.getToNativeType(InvokerTypeMapper.java:143) at jnr.ffi.mapper.CachingTypeMapper.lookupAndCacheToNativeType(CachingTypeMapper.java:71) at jnr.ffi.mapper.CachingTypeMapper.getToNativeType(CachingTypeMapper.java:43) at jnr.ffi.mapper.CompositeTypeMapper.getToNativeType(CompositeTypeMapper.java:34) at jnr.ffi.provider.jffi.InvokerUtil.getParameterTypes(InvokerUtil.java:185) at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:125) at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:59) at jnr.ffi.provider.jffi.…

design-patterns
tags question: http://stackoverflow.com/q/26334521
tags question: http://stackoverflow.com/q/26226955
tags question: http://stackoverflow.com/q/26243831
tags question: http://stackoverflow.com/q/26301220
tags question: http://stackoverflow.com/q/26257761
tags question: http://stackoverflow.com/q/26256249
tags question: http://stackoverflow.com/q/26218249
tag name: design-patterns
tags question: http://stackoverflow.com/q/26318870
tags question: http://stackoverflow.com/q/26245341
tags question: http://stackoverflow.com/q/26277986
tags question: http://stackoverflow.com/q/26285520
tags question: http://stackoverflow.com/q/26252919
type: Tag
tags question: http://stackoverflow.com/q/26285258
tags question: http://stackoverflow.com/q/26349006
tags question: http://stackoverflow.com/q/26256604
tags question: http://stackoverflow.com/q/26331153
tags question: http://stackoverflow.com/q/26290891
tags question: http://stackoverflow.com/q/26250321
tags question: http://stackoverflow.com/q/26205188

http://stackoverflow.com/comment/41133386
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26226142
has text: I've added it for you in this case, but its perfectly acceptable (and preferable) to simply put the code directly in the question. Saves us from having to go to another page.

http://stackoverflow.com/comment/41297213
score: 0
type: AnswerComment
has text: Since the web application CURRENTLY is not attached to a server but instead being run on a virtual machine is it possible to make an http request that, for demonstration/testing purposes, can connect from a Java to a Rails application that is on the same computer? The idea is that hopefully I could test and demonstrate with both the on my own computer then eventually use the same http request or a modification of it to connect to a server (when I eventually deploy the web-based application to the server).
type: Comment
comment on: http://stackoverflow.com/a/26304256

http://stackoverflow.com/a/26397860
accepted answer of: http://stackoverflow.com/q/26298059
answers question: http://stackoverflow.com/q/26298059
score: 0
type: AcceptedAnswer
type: Answer
has body: Finally, I have figured it out. The problem was with mysql db. I was using default configurations in my project's pom.xml and by default it uses mysql dbms. It has connected with db and created all tables in mysql, but hasn't started the project. but, when i have changed db profile to postgresql, it has worked like a charm. I haven't understand why, but the appfuse maven project has some conflicts with mysql dbms.

http://stackoverflow.com/a/26324311
accepted answer of: http://stackoverflow.com/q/26324160
answers question: http://stackoverflow.com/q/26324160
has body: Oh ok, I got this. I have to add the following: @DatabaseField(dataType = DataType.BYTE_ARRAY, columnDefinition = "LONGBLOB")
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41277586
comment on: http://stackoverflow.com/q/26304174
type: Comment
type: QuestionComment
has text: So you do want us to write your code. That isn't going to happen. You need to show what you have tried (to display in a graph) and where you are stuck. SO is not a place where you can get your assignment code written for you
score: 0

http://stackoverflow.com/comment/41301890
has text: Aha. That makes sense. Ok, I declared the variable outside of the loop now and my new output when I enter three 80 scores is this: Letter grade: F john gets 0 stars! Letter grade: F john gets 0 stars! Letter grade: B john gets 3 stars! *** - So clearly my loop is screwed up. But at least now it's calculating the sum correctly.
type: Comment
comment on: http://stackoverflow.com/a/26318072
score: 0
type: AnswerComment

http://stackoverflow.com/q/26240540
score: 2
possible better answer: http://stackoverflow.com/a/26240648
has title: Use property from child in super class
has answer: http://stackoverflow.com/a/26240729
type: AnsweredQuestion
tagged with: oop
tagged with: java
has comment: http://stackoverflow.com/comment/41159813
has comment: http://stackoverflow.com/comment/41162447
type: Question
upvote count: 2
answer count: 2
has body: In my child class I got something like: protected String[] columns = {"column1", "column2"}; While in my parent class I have a method that will store those in a HashMap. public HashMap&lt;Integer, String&gt; getColumns() { HashMap&lt;Integer, String&gt; columnsMap = new HashMap&lt;&gt;(); for (int i = 0; i &lt; this.columns.length; i++) { columnsMap.put(i + 1, this.columns[i]); } return columnsMap; } But as it seems, I cant simply use the String[] columns property on my sub class. How would I be able to do this?
has answer: http://stackoverflow.com/a/26240648
tagged with: arrays
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26240729

http://stackoverflow.com/comment/41308353
type: Comment
has text: @dramzy you're gonna regret it once you start deploying applications. Absolute layout (null layout, as you'd call it) may render different results on different platforms. It's best allow LayoutManagers to configure the layout
type: QuestionComment
comment on: http://stackoverflow.com/q/26321367
score: 0

http://stackoverflow.com/comment/41323467
comment on: http://stackoverflow.com/q/26329661
type: QuestionComment
type: Comment
has text: This sounds like a great opportunity to familiarize yourself with a debugger. With that you can step through the runtime behavior of the code and examine the logic as it executes and what the runtime values of the variables are. That's going to be your first step in determining why this is failing, which is a necessary step before correcting that failure.
score: 0

http://stackoverflow.com/q/26346164
has comment: http://stackoverflow.com/comment/41353652
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41376148
tagged with: initialization
has body: Suppose I have a class called NodeList with two fields, called value (type Object) and index (type int). NodeList implements an interface called Copiable, with a single method called copyNotSyncronized(). I want the NodeList version of copyNotSincronyzed() to recognize if this.value implements Copiable and, if that happens: Use copyNotSincronyzed() on this.value and... ...build a new NodeList object that have this.value.copyNotSincronyzed() as field value. I tried to write the code and drown in red underlining. After that I know two things: my Eclipse really hate me and I still have to undestand how to use generics in Java. What mistakes did I do? public class NodeList implements Copiable { int index; Object value; public NodeList(Object value, int index){ [...] } NodeList copyNotSincronyzed(){ NodeList copied; if( onArray.findPositionsOfElement(this.value.getClass().getInterfaces() , this.getClass().getInterfaces()[0])[0] !=-1 ) // aka if this.value implements the same interface of this class (aka Copiable) { // Following line features three errors: // Incorrect number of arguments for type Class&lt;T&gt;; it cannot be parameterized with arguments &lt;T, Copiable&gt; // T cannot be resolved to a type // Syntax error on token "implements", , expected Class&lt;T implements Copiable&gt; copiedObject = this.value; copiedObject=copiedObject.copyNotSincronyzed(); copied = new NodeList( copiedObject , this.index ); } else copied = new NodeList(this.value, this.index); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26346384
has answer: http://stackoverflow.com/a/26346282
tagged with: java
type: Question
has title: Initializing generics in Java
has answer: http://stackoverflow.com/a/26346363

http://stackoverflow.com/a/26245694
has comment: http://stackoverflow.com/comment/41169998
downvote count: 0
answers question: http://stackoverflow.com/q/26245341
type: Answer
upvote count: 1
score: 1
has body: The XML allows you to alter your configuration without recompiling your program, sacrificing type safety for flexibility. Some Java organizations also see an added advantage in letting non programmers such as field technicians or customers to modify the configuration setup. Another possible advantage is creating user oriented custom customization tools (Pun?) which can allow GUI creation/modification of the XML files based on user choices. Personally I don't like the world of XML based programming. It is too prone to run time errors, and difficult to debug using standard debuggers.

http://stackoverflow.com/q/26347871
type: Question
downvote count: 0
answer count: 1
has body: I am trying to work out why this script wont work. I am trying to create a script that will let me generate a random number and when the program is finished i can choose whether to re run it or not. BUt everytime i compile it i get an 'not a statement' error. Even if i delete String continue it still gives me this error. import java.util.*; public class Loopers { public static void main(String[] args) { String continue = "yes"; Scanner getInput = new Scanner(System.in); while ( continue.equals("yes") ) { Random r = new Random(); int numOfRandoms; System.out.println("Enter a number"); numOfRandoms = getInput.nextInt(); int[] randomNum = new int[100]; for (int x = 1; x &lt; numOfRandoms; x++) { randomNum[x] = r.nextInt(100); System.out.println(randomNum[x]); } System.out.println(); System.out.println("Do you wish to run the program again? Yes or No."); getInput.nextLine(); continue = getInput.nextLine(); } } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/26347889
upvote count: 2
has answer: http://stackoverflow.com/a/26347889
score: 2
type: AnsweredQuestion
tagged with: java
has title: Getting a 'not a statement' error with script

http://stackoverflow.com/comment/41302879
comment on: http://stackoverflow.com/q/26318712
type: Comment
type: QuestionComment
has text: Is this code working?
score: 0

android-intent
tags question: http://stackoverflow.com/q/26313125
tags question: http://stackoverflow.com/q/26245020
tags question: http://stackoverflow.com/q/26246839
tags question: http://stackoverflow.com/q/26296952
tags question: http://stackoverflow.com/q/26291161
tags question: http://stackoverflow.com/q/26242489
tags question: http://stackoverflow.com/q/26314631
tags question: http://stackoverflow.com/q/26350261
tags question: http://stackoverflow.com/q/26305101
tags question: http://stackoverflow.com/q/26304170
type: Tag
tag name: android-intent
tags question: http://stackoverflow.com/q/26201327
tags question: http://stackoverflow.com/q/26253510
tags question: http://stackoverflow.com/q/26273494
tags question: http://stackoverflow.com/q/26258741
tags question: http://stackoverflow.com/q/26237669
tags question: http://stackoverflow.com/q/26348835
tags question: http://stackoverflow.com/q/26230287

http://stackoverflow.com/comment/41115052
type: QuestionComment
has text: You should post the code at least of AddressTable.java.
score: 0
comment on: http://stackoverflow.com/q/26216512
type: Comment

geotools
tags question: http://stackoverflow.com/q/26289147
type: Tag
tag name: geotools

http://stackoverflow.com/comment/41181807
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26251779
has text: If you want to read about the relation to Scala's existential types, Odersky explains it [on this page](http://www.artima.com/scalazine/articles/scalas_type_system.html).

http://stackoverflow.com/q/26207527
tagged with: apache-camel
has answer: http://stackoverflow.com/a/26207798
has body: I found this approach from Camel's website which shows how to use @Produce annotation to create an pseudo-method call for sending message to JMS queue: public interface MyListener { String sayHello(String name); } public class MyBean { @Produce(uri = "activemq:foo") protected MyListener producer; public void doSomething() { // lets send a message String response = producer.sayHello("James"); } } However, in my scenario, I need the ability to set different JMS queue for different environment. Therefore the JMS queue in: @Produce(uri = "activemq:foo") needs to come from a property file rather than hardcoded. How can I achieve this? Is there any other ways I can use to achieve without using annotation? Thank you very much.
type: Question
upvote count: 2
answer count: 2
has title: Using property parameter in Camel annotation
favorite count: 0
downvote count: 0
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26211972
tagged with: java

http://stackoverflow.com/comment/41237020
score: 0
type: Comment
type: QuestionComment
has text: yes, people write Android apps that use GAE as a backend for example.
comment on: http://stackoverflow.com/q/26282518

http://stackoverflow.com/comment/41197464
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26260831
type: QuestionComment
has text: This might be it. I noticed something else: Trying to do the thread dump in jVisualVM only works from command line. Otherwise the tab for "Threads" doesn't even appear nor does it allow me to do a GC dump in the "Monitor" tab. I'll report back right away.

http://stackoverflow.com/comment/41236162
has text: Why are you trying to create an RPM on a windows platform use the appropriate platform for this (Linux!).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26278968

http://stackoverflow.com/comment/41189906
type: QuestionComment
comment on: http://stackoverflow.com/q/26257237
score: 0
has text: Forgot to mention, next(int size) gives me a random number between 0 to size exclusive.
type: Comment

hibernate-validator
tags question: http://stackoverflow.com/q/26256143
type: Tag
tag name: hibernate-validator

http://stackoverflow.com/comment/41182653
has text: Didn't know something like this exists. It doesn't refresh while open in Explorer, but this is enough. Thank you.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26252869

http://stackoverflow.com/a/32003561
answers question: http://stackoverflow.com/q/26228432
type: Answer
has body: I'm going to add another Java Solution 100/100, I added my own Stack class. https://codility.com/demo/results/demoX7Z9X3-HSB/ Here's the code: import java.util.ArrayList; import java.util.List; public class StoneWall { public int solution(int[] H) { int len = H.length; Stack&lt;Integer&gt; stack = new Stack&lt;&gt;(len); int blockCounter = 0; for (int i = 0; i &lt; len; ++i) { int element = H[i]; if (stack.isEmpty()) { stack.push(element); ++blockCounter; } else { while (!stack.isEmpty() &amp;&amp; stack.peek() &gt; element) { stack.pop(); } if (!stack.isEmpty() &amp;&amp; stack.peek() == element) { continue; } else { stack.push(element); ++blockCounter; } } } return blockCounter; } public static class Stack&lt;T&gt; { public List&lt;T&gt; stack; public Stack(int capacity) { stack = new ArrayList&lt;&gt;(capacity); } public void push(T item) { stack.add(item); } public T pop() { T item = peek(); stack.remove(stack.size() - 1); return item; } public T peek() { int position = stack.size(); T item = stack.get(position - 1); return item; } public boolean isEmpty() { return stack.isEmpty(); } } } Any feedback will be appreciated.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/61051983
upvote count: 2
has comment: http://stackoverflow.com/comment/61051971

http://stackoverflow.com/a/26300085
accepted answer of: http://stackoverflow.com/q/26254143
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26254143
has body: Solved from myself, the problem was that validation.xml must be placed into META-INF/validation.xml folder of the "ejb module", into my JEE6 application I had that file into WEB-INF folder of the "web module" (strangely the JEE6 application works good...), now my JEE7 application correctly load validation.xml configuration and works using the message interpolator, very good !

nexus
tags question: http://stackoverflow.com/q/26212744
type: Tag
tags question: http://stackoverflow.com/q/26251911
tag name: nexus
tags question: http://stackoverflow.com/q/26226925

http://stackoverflow.com/comment/41294921
has text: You can also look into this : http://stackoverflow.com/questions/7218506/eclipse-package-multiple-projects-into-one-jar
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26314404

http://stackoverflow.com/q/26276147
tagged with: import
type: Question
type: AnsweredQuestion
has body: I just imported source folders and required libraries from another PC on which I had been working. The project contains JAVA and Python code in separate packages. Now there seems to be some problem with running the Java parts. Error: Could not find or load main class Drivers.DependencyFinder I have tried Cleaning and Building the project. It didn't create any classes in the bin folder. When I copied class files from the older PC, it gives some version error. I'd like to make a fresh build, removing all the things I had earlier other than the source code. Clicking Build All or Build doesn't produce anything. What's going wrong?
has answer: http://stackoverflow.com/a/26279127
tagged with: eclipse
has title: How to build imported project on Eclipse?
answer count: 1
has comment: http://stackoverflow.com/comment/41225086
accepted answer: http://stackoverflow.com/a/26279127
tagged with: build
score: 0
tagged with: java

worklight-security
tags question: http://stackoverflow.com/q/26218410
tag name: worklight-security
type: Tag

http://stackoverflow.com/q/26232340
has comment: http://stackoverflow.com/comment/41144483
type: Question
has comment: http://stackoverflow.com/comment/41144538
has answer: http://stackoverflow.com/a/26232431
has comment: http://stackoverflow.com/comment/41144659
has comment: http://stackoverflow.com/comment/41144756
has comment: http://stackoverflow.com/comment/41144757
has title: Print a range of characters as a list
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26232434
answer count: 3
has comment: http://stackoverflow.com/comment/41144572
has comment: http://stackoverflow.com/comment/41144570
has comment: http://stackoverflow.com/comment/41144463
has comment: http://stackoverflow.com/comment/41144396
has answer: http://stackoverflow.com/a/26232608
has comment: http://stackoverflow.com/comment/41144645
has comment: http://stackoverflow.com/comment/41144656
type: UnansweredQuestion
has body: So my method is supposed to take to character parameters as the first and last characters in a range and print every letter and its numerical encoding in the range. For example e and j as parameters would print out e f g h i j (except with the nnumerical encoding) The code I used doesnt compile. What am I doing wrong public void listCharacterCodes(char a, char b){ int j = (int) b; for(int i =(int) a, i&lt;j,i++){ println("'" + a + "': " + i); } }

http://stackoverflow.com/comment/41130073
type: QuestionComment
has text: MySQL driver is not made to create any `JDBC-ODBC bridge` connection. You should first check which type of driver you want to use. As @LukeWoodward specified, DSN works with ACCESS and Sql Server.
comment on: http://stackoverflow.com/q/26223909
score: 0
type: Comment

http://stackoverflow.com/comment/41226454
score: 0
type: Comment
type: QuestionComment
has text: A `DataSource` is a heavy object (I known it is an interface with multiple implemenations but still). If you have 150 services and each would construct a new instance that would be killing your database. You would want to be able to reuse a single instance. Next to that for testing you might want to use a in-memory one and in reallife you might want to retrieve something from JNDI. If you would hardcode the latter in your code testing would become a lot harder.
comment on: http://stackoverflow.com/q/26276048

http://stackoverflow.com/comment/41143344
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26231263
type: QuestionComment
has text: If i get a emoji character from a web i can see correctly.

http://stackoverflow.com/a/30591040
downvote count: 0
type: Answer
upvote count: 1
has body: Add two statements before closing of driver writableBook.write(); writableBook.close();
answers question: http://stackoverflow.com/q/26335339
score: 1

http://stackoverflow.com/q/26233948
has title: How do I return a cookie from a jax-rs / rest-easy enabled method that returns a pojo
upvote count: 1
answer count: 1
downvote count: 0
tagged with: jax-rs
favorite count: 0
tagged with: resteasy
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26234290
score: 1
accepted answer: http://stackoverflow.com/a/26234290
tagged with: java
type: Question
has body: I have to make a change to a javax-rs web app written by someone else. I am used to doing things the long winded way, and the javax-rs is new to me.The function currently looks like this: @POST @Path("mypath1/mypath2") @Consumes("application/json") @Produces("application/json") public A myMethod(B myB, @Context final HttpServletResponse response) { A myA = new A(); ... return myA; } A is just a pojo, but I guess it is getting converted to JSON at some point in the process. One thing I should add is that rest-easy framework is involved. I guess that is what's doing the pojo to JSON conversion. I need to check for a cookie and take a certain action if it is found. I also want to return a cookie if the request did not have one. Reading of the cookie seems easy enough - just add this to the method signature: @CookieParam("mycookiekey") String mycookieValue My confusion is that the examples I see on the web show methods returning a Response, but this one returns a pojo - so how do I get the cookie into the response? I thought I could just do response.addCookie(...) [where response is the HttpServletResponse passed to the method] as I would do in my normal long-winded way, but I also see on the web that the way to return a cookie in javax-rs is a little different, so I thought I should maybe be doing something like this: NewCookie newCookie = new NewCookie("mycookiekey", "mycookieValue"); ResponseBuilder builder = Response.ok(myA, MediaType.APPLICATION_JSON); Response r = builder.cookie(newCookie).build(); return r; but that is returning a Response, and whatever invokes the method is clearly expecting an object of type A to be returned. So I guess my question is, can I still return an object of type A from the method and yet have the cookie returned to the client? Thanks, Paul

http://stackoverflow.com/q/26196453
has body: I am working on a text document parsing application. The design of the document is as shown in the figure Here is how the parsing is being done: Document contains an ArrayList of pages . Each page has a Map&lt;float, List&lt;Character&gt;&gt; the float value contains the yaxis value of a character location and hence a key and Character contains other informations. Parsing is done character by character via third party library. Please add comments if more information is required. Now while parsing I have created two ExecutorService thread pools, one for pages and one for populating map. I initially create a Document and pass each page to the page parser as a runnable to ExecutorService. Which in turn passes an empty map to text parser. Text parser checks if the map has a key value if yes it adds the character to the list or a new list what ever is necessary. Problem here is that this task can be done concurrently for all pages to speed up execution. But I am unable to do with this data structure as all threads stuck in between if parsed normally and if done in a synchronized fashion using Collections.synchronizedMap , takes a lot of time. Also, I am maintaining two different lists of Future objects to check if the threads finished. Kindly provide valuable suggestions for improvements and concurrent execution to speed up the execution.
has comment: http://stackoverflow.com/comment/41078263
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41078146
tagged with: java
has title: Unable to figure out the correct data structure and correct approach in this scenario of parsing text
tagged with: executor
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41078206
answer count: 1
has answer: http://stackoverflow.com/a/26196997
accepted answer: http://stackoverflow.com/a/26196997
tagged with: architecture
tagged with: parsing
has comment: http://stackoverflow.com/comment/41078384
tagged with: multithreading

http://stackoverflow.com/q/26314817
type: Question
has answer: http://stackoverflow.com/a/26315549
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26315549
has body: I am new to spring MVC and facing some error. I have two controllers as below 1) LoginController.java @Controller @RequestMapping("/log") public class LoginController { @Autowired private LoginService service; @RequestMapping(value="login.spring",method=RequestMethod.GET) public ModelAndView prepareLoginForm() { System.out.println("In get"); return new ModelAndView("Login", "login", new Login()); } @RequestMapping(value="login.spring",method=RequestMethod.POST) public ModelAndView processLogin(@ModelAttribute("login") Login login,BindingResult result) { int i=service.validateLogin(login); if(i==0){ return new ModelAndView("redirect:login.spring"); } ModelAndView view=new ModelAndView("redirect:Customer/Searchform.spring"); return view; } } 2) CustomerController.java @Controller @RequestMapping("/Customer") public class CustomerController { @Autowired private CustomerService customerService; @RequestMapping(value="Searchform.spring",method=RequestMethod.GET) public ModelAndView prepareCustomer() { System.out.println("In customer controller"); CustomerSearchForm customerSearchForm=new CustomerSearchForm(); return new ModelAndView("CustomerSearch","customerSearchForm",customerSearchForm); } @RequestMapping(value="Search.spring",method=RequestMethod.POST) public ModelAndView searchCustomer(@ModelAttribute("customer") CustomerSearchForm customerSearchForm,BindingResult result) { int i=customerService.serachCustomer(customerSearchForm); if(i==1) return new ModelAndView("Holdings"); return new ModelAndView("redirect:Customer"); } } So after successful login I am trying to redirect to CustomerController but in browser url i can see that request url is http://localhost:8080/Online_Fund_Trading/log/Customer/Searchform.spring. As log gets added before Customer/Searchform.spring I am getting 404-The requested resource is not available error. What changes are required to have request url as http://localhost:8080/Online_Fund_Trading/Customer/Searchform.spring.
tagged with: spring-mvc
tagged with: model-view-controller
type: AnsweredQuestion
score: 1
tagged with: java
has title: Unable to redirect from one controller to another controller-Spring MVC
upvote count: 1

http://stackoverflow.com/q/26305168
has comment: http://stackoverflow.com/comment/41284773
favorite count: 0
has comment: http://stackoverflow.com/comment/41354964
has title: Field Level Encryption with Spring Data JPA and JPA EntityListener
tagged with: spring
has answer: http://stackoverflow.com/a/61336569
has comment: http://stackoverflow.com/comment/41354157
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/41318673
upvote count: 7
type: Question
has body: I'm trying to encrypt a handful of fields on domain entities before insert/update and decrypt them upon select to display in the UI. I'm using Spring Data JPA repositories with Hibernate and an EntityListener which decrypts during @PostLoad lifecycle event and encrypts during @PrePersist and @PreUpdate. The problem I have is that once the record is loaded from the DB into the PersistenceContext, the listener decrypts the data which makes the EntityManager think the entity has been altered which in turn triggers an Update and hence @PreUpdate encryption again. Any advice on how to handle this? Spring 4.0.4.RELEASE Spring Data JPA 1.5.2.RELEASE Hibernate 4.2.14.Final Is there an easy way to return detached entities from the JPA Repository? Entity Class @Entity @Table(name="cases") @EntityListeners(EncryptionListener.class) public class MyCase implements Serializable, EncryptionEntity { private static final Logger logger = LoggerFactory.getLogger(MyCase.class); private static final long serialVersionUID = 1L; private String caseNumber; private byte[] secretProperty; private byte[] iv; @Id @Column(name="case_number") public String getCaseNumber() { return caseNumber; } public void setCaseNumber(String caseNumber) { this.caseNumber = caseNumber; } @Column(name="secret_property") public byte[] getSecretProperty() { return secretProperty; } public void setSecretProperty(byte[] secretProperty) { this.secretProperty = secretProperty; } @Column public byte[] getIv() { return iv; } public void setIv(byte[] iv) { this.iv = iv; } @Override @Transient public byte[] getInitializationVector() { return this.iv; } @Override public void setInitializationVector(byte[] iv) { this.setIv(iv); } } EncryptionEntity Interface public interface EncryptionEntity { public byte[] getInitializationVector(); public void setInitializationVector(byte[] iv); } Spring Data JPA Repository public interface MyCaseRepository extends JpaRepository&lt;MyCase, String&gt; { } MyCaseService Interface public int…
score: 7
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41317842
has comment: http://stackoverflow.com/comment/41387333
tagged with: jpa
downvote count: 0
answer count: 1

http://stackoverflow.com/q/26224749
has comment: http://stackoverflow.com/comment/41154771
has title: Save/Load a file in android for a game
has body: I have created a game in Android. I have written a class for input/ouput with prefer install location external. I want to make some basic questions. First of all the file I use is a .txt (I know that its not the best way to save your data but I use it for testing). The strange part is that when the the game is over it should automatically save the user highscores but it does not, so when I close the app and restart it the highscores have disappeared. I would also like to learn what the prefered file type for saving settings/highscores/coins etc (hopefully secured) is. Lastly I debug the game using a Nexus 5 whitch does not have external storage (it should be stored locally though). This is my code, thanks in advance :). public class AndroidFileIO implements FileIO { Context context; AssetManager assets; String externalStoragePath; public AndroidFileIO(Context context) { this.context = context; this.assets = context.getAssets(); this.externalStoragePath = Environment.getExternalStorageDirectory() .getAbsolutePath() + File.separator; } public InputStream readAsset(String fileName) throws IOException { return assets.open(fileName); } public InputStream readFile(String fileName) throws IOException { return new FileInputStream(externalStoragePath + fileName); } public OutputStream writeFile(String fileName) throws IOException { return new FileOutputStream(externalStoragePath + fileName); } public SharedPreferences getPreferences() { return PreferenceManager.getDefaultSharedPreferences(context); } } my game class has this method public FileIO getFileIO() { return fileIO; } this is the way i load the file Settings.load(game.getFileIO()); and finaly my save/load methods of the settings class public static void load(FileIO files) { BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader( files.readFile("mrnom.txt"))); soundEnabled = Boolean.parseBoolean(in.readLine()); for (int i = 0; i &lt; 5; i++) { highscores[i] = Integer.parseInt(in.readLine()); } }…
has comment: http://stackoverflow.com/comment/41131281
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41131026
tagged with: java
has comment: http://stackoverflow.com/comment/41131495
tagged with: fileoutputstream
type: Question
tagged with: fileinputstream
has comment: http://stackoverflow.com/comment/41132120
answer count: 1
has comment: http://stackoverflow.com/comment/41131132
score: 0
has answer: http://stackoverflow.com/a/26225124
tagged with: android
has comment: http://stackoverflow.com/comment/41130927
accepted answer: http://stackoverflow.com/a/26225124

http://stackoverflow.com/comment/41135202
type: Comment
score: 11
comment on: http://stackoverflow.com/q/26227067
type: QuestionComment
has text: Mind sharing what the errors are?

http://stackoverflow.com/a/26198775
answers question: http://stackoverflow.com/q/26198670
score: 0
has body: How about this: String str = "57363 Joy Ryder D D C P H H C D"; String[] items = str.split(" ");
type: Answer

http://stackoverflow.com/q/26344292
type: Question
has body: How to automate creating objects in a loop? Why doesn't this code work? String strLbl[] = {"Model","Weight","Length","Age","Number of keys"}; JLabel lbl[] = new JLabel[5]; for (int i=0;i&lt;strLbl.length;i++){ JLabel lbl[i] = new JLabel(strLbl[i]); }
tagged with: java
has answer: http://stackoverflow.com/a/26344399
has answer: http://stackoverflow.com/a/26344307
score: 0
answer count: 2
tagged with: for-loop
has title: How to declare labels in loop?
tagged with: label
type: UnansweredQuestion

http://stackoverflow.com/comment/41247722
comment on: http://stackoverflow.com/q/26287428
score: 0
type: Comment
has text: Hmm its been a while since I've done gui programming, but didn't you forget to add ActionListener to your buttons?
type: QuestionComment

http://stackoverflow.com/comment/41129494
type: Comment
comment on: http://stackoverflow.com/q/26222469
has text: Can you clarify? If you want to see the desktop, you will need the window to be transparent, but perhaps that is not what you mean?
score: 0
type: QuestionComment

http://stackoverflow.com/q/26196809
has title: MediaPlayer in JavaFX
answer count: 1
has comment: http://stackoverflow.com/comment/41080674
has body: I am concerned with the fact that JavaFX has suffered some modifications since the day of this tutorial: http://www.youtube.com/watch?v=bWl98dhvf8Q . Please, give me some hints for what should I change in this code, or is this kind of code valid, at all? Thank you. Here's the code: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaView; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.scene.Group; public class BiPlayer extends Application { public static void main(String[] args){ launch(args); } @Override public void start(Stage primaryStage) throws Exception { Group videoPane = new Group(); Media media = new Media("C:\\Users\\Insanovation\\Downloads\\P.mp4"); MediaPlayer player = new MediaPlayer(media); MediaView view = new MediaView(player); videoPane.getChildren().add(view); Scene scene = new Scene (videoPane, 400, 400, Color.BLACK); primaryStage.setScene(scene); primaryStage.show(); player.play(); } } Here's the output: Exception in Application start method java.lang.reflect.InvocationTargetException 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.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:363) at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:303) 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.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) Caused by: java.lang…
accepted answer: http://stackoverflow.com/a/32212928
has comment: http://stackoverflow.com/comment/41091365
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/32212928
has comment: http://stackoverflow.com/comment/41090194
has comment: http://stackoverflow.com/comment/41090179
tagged with: media
tagged with: media-player
linked to: http://stackoverflow.com/q/17013177

http://stackoverflow.com/comment/41320654
score: 0
type: Comment
type: QuestionComment
has text: Ok, calling getWriter() seams to be a problem. I think about the situation, that there are several filters I take from given libs. They might all call getWriter() independent of each other. How does the spec mean to deal with that? Each filter should be able to be independent of others, but this seems not to be the case.
comment on: http://stackoverflow.com/q/26323847

http://stackoverflow.com/q/26250364
has body: I have a button that should set all text values in the activity to null. However, the OnClickListener doesn't seem to be functioning as I would have thought. Does the issue have to do with me setting the text to the Prefs key after the button? I've been at this bug for awhile and can't seem to figure it out on my own. Here's the code: package com.mikitz.rogsimple; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class DamageChest extends Activity { EditText chestdmg1, chestdmg2, chestdmg3, chestdmg4, chestdmg5, chestdmg6, chestdmg7, chestdmg8, chestdmg9, chestdmg10; Button heal; SharedPreferences pref; String getChestDMG1, getChestDMG2, getChestDMG3, getChestDMG4, getChestDMG5, getChestDMG6, getChestDMG7, getChestDMG8, getChestDMG9, getChestDMG10; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.damage_chest); pref = getSharedPreferences("Character1", Context.MODE_PRIVATE); heal = (Button) findViewById(R.id.fullheal); chestdmg1 = (EditText) findViewById(R.id.dmg1); chestdmg2 = (EditText) findViewById(R.id.dmg2); chestdmg3 = (EditText) findViewById(R.id.dmg3); chestdmg4 = (EditText) findViewById(R.id.dmg4); chestdmg5 = (EditText) findViewById(R.id.dmg5); chestdmg6 = (EditText) findViewById(R.id.dmg6); chestdmg7 = (EditText) findViewById(R.id.dmg7); chestdmg8 = (EditText) findViewById(R.id.dmg8); chestdmg9 = (EditText) findViewById(R.id.dmg9); chestdmg10 = (EditText) findViewById(R.id.dmg10); getChestDMG1 = pref.getString("chestdmg1", ""); getChestDMG2 = pref.getString("chestdmg2", ""); getChestDMG3 = pref.getString("chestdmg3", ""); getChestDMG4 = pref.getString("chestdmg4", ""); getChestDMG5 = pref.getString("chestdmg5", …
tagged with: android
has title: OnClickListener not functioning properly
type: AnsweredQuestion
tagged with: onclicklistener
tagged with: java
accepted answer: http://stackoverflow.com/a/26250660
has answer: http://stackoverflow.com/a/26250844
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41179143
possible better answer: http://stackoverflow.com/a/26250518
score: -1
has answer: http://stackoverflow.com/a/26250518
has comment: http://stackoverflow.com/comment/41178323
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/41178312
has comment: http://stackoverflow.com/comment/41178304
has answer: http://stackoverflow.com/a/26250660
favorite count: 0

http://stackoverflow.com/q/26222510
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26270120
tagged with: ecj
tagged with: java
has body: I have the following class: import java.util.HashSet; import java.util.List; public class OverloadTest&lt;T&gt; extends HashSet&lt;List&lt;T&gt;&gt; { private static final long serialVersionUID = 1L; public OverloadTest(OverloadTest&lt;? extends T&gt; other) {} public OverloadTest(HashSet&lt;? extends T&gt; source) {} private OverloadTest&lt;Object&gt; source; public void notAmbigious() { OverloadTest&lt;Object&gt; o1 = new OverloadTest&lt;Object&gt;(source); } public void ambigious() { OverloadTest&lt;Object&gt; o2 = new OverloadTest&lt;&gt;(source); } } This compiles fine under JDK 7's javac, as well as eclipse (with compliance set to 1.7 or 1.8). However, attempting to compile under JDK 8's javac, I get the following error: [ERROR] src/main/java/OverloadTest.java:[18,35] reference to OverloadTest is ambiguous [ERROR] both constructor &lt;T&gt;OverloadTest(OverloadTest&lt;? extends T&gt;) in OverloadTest and constructor &lt;T&gt;OverloadTest(java.util.HashSet&lt;? extends T&gt;) in OverloadTest match Note that this error applies only to the constructor invocation in the ambigous() method, not the one in the notAmbiguous() method. The only difference is that ambiguous() is relying on the diamond operator. My question is this: Is javac under JDK 8 properly flagging an ambiguous resolution, or was javac under JDK 7 failing to catch an ambiguity? Depending on the answer, I need to either file a JDK bug, or an ecj bug.
type: Question
has answer: http://stackoverflow.com/a/31082283
has comment: http://stackoverflow.com/comment/41136265
possible better answer: http://stackoverflow.com/a/31082283
score: 15
tagged with: eclipse
has title: Ambiguous overload in Java8 - is ECJ or javac right?
accepted answer: http://stackoverflow.com/a/26270120
upvote count: 15
has comment: http://stackoverflow.com/comment/41127364
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41127270
favorite count: 0
tagged with: javac
tagged with: jls
has comment: http://stackoverflow.com/comment/41127200

http://stackoverflow.com/comment/41138098
type: QuestionComment
has text: If you do not know what a `Constractor` is and what it's for, you need to go back to your books / class notes.
comment on: http://stackoverflow.com/q/26228495
score: 0
type: Comment

http://stackoverflow.com/a/26236578
score: 1
has comment: http://stackoverflow.com/comment/41153981
has comment: http://stackoverflow.com/comment/41152782
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41153518
accepted answer of: http://stackoverflow.com/q/26236213
has comment: http://stackoverflow.com/comment/41153601
answers question: http://stackoverflow.com/q/26236213
has comment: http://stackoverflow.com/comment/41153291
type: Answer
has body: You can simply place a folder resources to the folder with compiled classes and make ImageIcon like this. public ImageIcon Flag = new ImageIcon("resources/Flag.png");
upvote count: 1
has comment: http://stackoverflow.com/comment/41153478

http://stackoverflow.com/q/26350617
type: Question
has answer: http://stackoverflow.com/a/26350648
score: 0
answer count: 1
tagged with: callback
linked to: http://stackoverflow.com/q/8736378
type: AnsweredQuestion
tagged with: java
has title: Callbacks implementation in java
has body: I'm building a game in libgdx where I need to notify someclass about an explosion that occured. Now, I have access to that exact same moment when it occurs. How exactly do I notify my class that an explosion has happened? I read this: http://www.javaworld.com/article/2077462/learn-java/java-tip-10--implement-callback-routines-in-java.html But I didn't understand the concept of callbacks. I understand that it is a way to notify classes and objects that an event has happened but I'm not sure how to implement this. If you guys could clarify that for me I would really appreaciate it!
accepted answer: http://stackoverflow.com/a/26350648

http://stackoverflow.com/a/26219455
has comment: http://stackoverflow.com/comment/41121579
score: 0
has body: If I follow correctly, you have a parent view which is a RelativeLayout, and you need child 1 (a textview) centered, and child 2 (a linearlayout) aligned left? try: child 1 android:layout_centerInParent="true" or android:layout_centerHorizontal="true" child 2 android:layout_alignParentLeft="true" EDIT: you could encapsulate child 2 in another RelativeLayout parentlayout child1 <child2 android:layout_alignParentLeft="true">
answers question: http://stackoverflow.com/q/26219222
type: Answer

http://stackoverflow.com/a/27576823
type: AcceptedAnswer
has body: The problem is that in the transform method the compiler can't know that the type parameter B extends BaseB and the second type parameter in the Transform class (? extends BaseB) that was gotten from the map actually represent the same subclass of BaseB. Nothing stops you from storing an incompatible type in the map: _map.put(DerB.class, new AnotherDerAtoAnotherDerB()); // the types don't match You are the one who guarantees that the types in the map match, so you need to tell the compiler by casting it to the correct type: @SuppressWarnings("unchecked") public static &lt;B extends BaseB&gt; BaseA transform(B b) { Transform&lt;? extends BaseA, B&gt; t = (Transform&lt;? extends BaseA, B&gt;)_map.get(b.getClass()); return t.toA(b); }
accepted answer of: http://stackoverflow.com/q/26275665
type: Answer
answers question: http://stackoverflow.com/q/26275665
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/comment/41107006
has text: The above is general advice, I've updated the answer to indicate how to handle CBC mode.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/26206837

http://stackoverflow.com/comment/41220802
type: AnswerComment
has text: @user1711993 read `StateListDrawable` docs, dont use any setOnTouchListener, its not the way it should work
type: Comment
comment on: http://stackoverflow.com/a/26273654
score: 0

http://stackoverflow.com/comment/41087561
has text: Sometimes you use it for verifyZeroInteractions.. So you check a code is never executed.. Sometimes the opposite..
comment on: http://stackoverflow.com/q/26201709
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26345170
type: AcceptedAnswer
has body: While another commenter pointed out that this can be accomplished with a 3-deep nested for loop, there might be a more elegant solution, perhaps using a library like combinatoricslib. You could then do this: ICombinatoricsVector&lt;BigDecimal&gt; originalVector = Factory.createVector(new BigDecimal[] { new BigDecimal("0.0"), new BigDecimal("0.1"), new BigDecimal("0.2"), new BigDecimal("0.3"), new BigDecimal("0.4"), new BigDecimal("0.5"), new BigDecimal("0.6"), new BigDecimal("0.7"), new BigDecimal("0.8"), new BigDecimal("0.9") }); Generator&lt;BigDecimal&gt; gen = Factory.createPermutationWithRepetitionGenerator(originalVector, 3); for (ICombinatoricsVector&lt;BigDecimal&gt; perm : gen) { // values are in perm.getValue(0), perm.getValue(1), and perm.getValue(2) } Afterward, you could iterate through each permutation and check the sum with a for loop of depth 1. Note that I have replaced float/double with BigDecimal in order to address floating point precision/representation issues. Further note that I have used the String constructor of BigDecimal to avoid an insipid form of the same precision/representation issues.
type: Answer
answers question: http://stackoverflow.com/q/26345033
accepted answer of: http://stackoverflow.com/q/26345033
score: 0

http://stackoverflow.com/a/26247863
upvote count: 3
has comment: http://stackoverflow.com/comment/41173823
has body: Names have nothing to do with it. What is being locked is the object (not the variable, not the reference). If a thread has started executing a block which synchronizes on an object, any other thread that tries to synchronizes on the same object will block and wait until that original thread completes the execution of its block.
downvote count: 0
has comment: http://stackoverflow.com/comment/41173851
accepted answer of: http://stackoverflow.com/q/26247839
answers question: http://stackoverflow.com/q/26247839
score: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26333695
has comment: http://stackoverflow.com/comment/70413733
type: Answer
answers question: http://stackoverflow.com/q/26331524
has comment: http://stackoverflow.com/comment/76437650
score: 9
has comment: http://stackoverflow.com/comment/55164057
downvote count: 1
has body: You can use StringEscapeUtils from the Apache Commons Lang library. Using this you can escape characters from html, xml, sql, etc. Look for method escapeXXX for your purpose. For reference: When i need to escape Html string? note: escapeSql was removed in Apache Commons Lang 3 (see Migrating StringEscapeUtils.escapeSql from commons.lang which references https://commons.apache.org/proper/commons-lang/article3_0.html#StringEscapeUtils.escapeSql) Eg: String str = FileUtils.readFileToString(new File("input.txt")); String results = StringEscapeUtils.escapeHtml(str); System.out.println(results); Input: &lt;sometext&gt; Here is some "Text" that I'd like to be "escaped" for HTML &amp; here is some Swedish: Tack. Vars?god. &lt;/sometext&gt; Output: &amp;lt;sometext&amp;gt; Here is some &amp;quot;Text&amp;quot; that I'd like to be &amp;quot;escaped&amp;quot; for HTML &amp;amp; here is some Swedish: Tack. Vars&amp;aring;god. &amp;lt;/sometext&amp;gt;
upvote count: 10

http://stackoverflow.com/comment/41236108
has text: `<map:match pattern="feedback">` should work. Anything after the '?' does not have to be matched. If you say the "the handle and title is not passed" then there is another problem
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26227881

http://stackoverflow.com/comment/41150746
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/62592/discussion-between-leon-and-user3797438).
comment on: http://stackoverflow.com/q/26235583
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41307239
type: AnswerComment
has text: [digged up from the backyard of my brain] @Daron An UR[IL] doesn't necessarily need a registerd (e.g. DNS) host name. It can be an IP address as well, see [RFC 3986, 3.2.2. Host](https://tools.ietf.org/html/rfc3986#section-3.2.2). For instance [http://198.252.206.16/](http://198.252.206.16/).
type: Comment
comment on: http://stackoverflow.com/a/26320808
score: 0

apache-axis
tags question: http://stackoverflow.com/q/26245055
tag name: apache-axis
tags question: http://stackoverflow.com/q/26237403
type: Tag

ms-word
tags question: http://stackoverflow.com/q/26250065
tag name: ms-word
type: Tag
tags question: http://stackoverflow.com/q/26200618

http://stackoverflow.com/comment/41187123
has text: Hi thanks for your reply, question: do I also need a hadoop installation to start spark? for example the prebuild for hadoop 2.4: http://d3kbcqa49mib13.cloudfront.net/spark-1.1.0-bin-hadoop2.4.tgz
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26255439
type: Comment

http://stackoverflow.com/q/26211215
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41105341
tagged with: histogram
has comment: http://stackoverflow.com/comment/41105531
type: Question
has body: Is my code right? i want to get RGB histogram using JAI and Jfreechart. 1)create Histogram object from planarimage 2)histogram.getBins() to get RGB value 3)plot this values on barchart from jfreechart Hope u will help me! Thx :) PlanarImage.wrapRenderedImage(img); ParameterBlock pb = new ParameterBlock(); int[] bins = { 256 }; double[] low = { 0.0D }; double[] high = { 256.0D }; pb.addSource(img); pb.add(null); pb.add(1); pb.add(1); pb.add(bins); pb.add(low); pb.add(high); RenderedOp op = JAI.create("histogram", pb, null); Histogram histogram = (Histogram) op.getProperty("histogram"); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); int[][] data = histogram.getBins(); for (int i = 1; i&lt;data.length;i++){ dataset.setValue(data[0][i], "color", String.valueOf(data[1][i]) ); } JFreeChart chart = ChartFactory.createBarChart("test", "test", "test", dataset, PlotOrientation.VERTICAL, false, true, false); try { ChartUtilities.saveChartAsJPEG(new File("C:\\chart.jpg"), chart, 500, 300); } catch (IOException e) { System.err.println("Problem occurred creating chart."); }
has title: Java. Get RGB histogram
has comment: http://stackoverflow.com/comment/41106919
score: 0
tagged with: java
tagged with: jfreechart

http://stackoverflow.com/a/26297276
has body: There is basically no difference, however there is a subtle difference. The arithmetic assignment operators do an implicit cast. e.g. byte a = 1; int b = 2; a += b; // compiles a = a + b; // doesn't compile as a byte + int = int a = (byte) (a + b); // compiles as this is the same as += For more weird examples. int a = 5; a += 1.5f; // a == 6 char ch = '0'; // (char) 49 ch *= 1.1; // ch = '4'; long l = Integer.MAX_VALUE; l += 0.0f; // i = (long ) ((long ) l + 0.0f) // i == Integer.MAX_VALUE + 1L; WTF!? // l is no longer Integer.MAX_VALUE due to rounding error.
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/26297041
upvote count: 7
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26297041
type: Answer

http://stackoverflow.com/comment/41323161
comment on: http://stackoverflow.com/a/26328171
type: Comment
has text: I follow the same pattern exist in the Resources field
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41080759
has text: Thanks JB Nizet, that is a good document. But I need a way to do the same dynamic scaling of threads in Netty NIO. I just edited the question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26197277

http://stackoverflow.com/comment/41165225
score: 0
type: Comment
type: QuestionComment
has text: @PeterLawrey, would StringBuffer cause a noticeable lag while rendering html as opposed to StringBuilder? Because I am experiencing this like whoa
comment on: http://stackoverflow.com/q/26243183

http://stackoverflow.com/comment/107807933
type: AnswerComment
score: 0
type: Comment
has text: And how to create a certificate for server validity?
comment on: http://stackoverflow.com/a/26451105

http://stackoverflow.com/q/26275785
has comment: http://stackoverflow.com/comment/41271032
tagged with: node.js
tagged with: heroku
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/41232726
tagged with: java
type: Question
has body: To deploy Silex nodejs app to heroku, I need java 7 or newer to be available on heroku. This is because Silex front end is build with google closure compiler which requires java version > 7 I tried the technique described in Updating Existing Java Apps to Use Java 7 or Java 8 But it fails (there is still java 6), and I guess this is because it is a nodejs app :-/ So how can I update the java version on Heroku for a nodejs app?
has comment: http://stackoverflow.com/comment/41226928
downvote count: 0
has comment: http://stackoverflow.com/comment/41233163
favorite count: 0
has title: update the java version on Heroku for a nodejs app
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/26296150
linked to: http://stackoverflow.com/q/9431978
has comment: http://stackoverflow.com/comment/41261918
has comment: http://stackoverflow.com/comment/41261949
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41262609
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
has body: I have to click on an element to upload a CSV file with Selenium WebDriver in JUnit. The input looks like this: If I click on that input element an OS window opens where I have to choose my file to upload. My problem is that if I use Selenium for clicking the input like this: driver.findElement(By.xpath("//div[@id='wwctrl_DateiImportSchritt2Csv_upload0']/input")).click(); It does open the OS window, but freezes my whole test without any Exceptions. If I close the window manually, my test continues. On another place in my code, I have to download a file. It is very similar, except it's not an input element but an anchor element () and it works fine there. So how to click an input element which opens an OS window without freezing my test? Also tried submit(), but even the window does not open with that method. I'm using: Windows 7 Firefox 32.0.3 Selenium WebDriver 2.43.1 JUnit 4 Edit: The whole div element looks like this: CSV-Importdatei für Ranglisten auswählen Bitte wählen Sie eine für den Import bestimmte Datei aus. There is no submit button. The input is also not used for typing, you can only click on it to open a window.
has title: Selenium WebDriver click on input element to upload file freezes
type: Question
has answer: http://stackoverflow.com/a/26296616
downvote count: 0
tagged with: automated-tests
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26296616

http://stackoverflow.com/q/26221532
has comment: http://stackoverflow.com/comment/41125534
tagged with: java
has title: BufferedReader readLine() freeze while getting data from socket
type: Question
has comment: http://stackoverflow.com/comment/41125284
tagged with: bufferedreader
score: 0
has comment: http://stackoverflow.com/comment/41125692
has comment: http://stackoverflow.com/comment/41125908
has comment: http://stackoverflow.com/comment/41183681
has comment: http://stackoverflow.com/comment/41126196
answer count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: printwriter
has body: i have this code on server side BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); LinkedList &lt;String[]&gt; temp = new LinkedList&lt;String[]&gt;(); String cognome = ""; String nome = ""; while (!(cognome=reader.readLine())!=null){ System.out.println(cognome); nome = reader.readLine(); System.out.println(nome); temp.addLast(new String[]{cognome,nome}); System.out.println("ricevuto il docente "+cognome+" "+nome); } mutex.acquire(); for(;0&lt;temp.size();) docenti.add(temp.removeFirst()); mutex.release(); if (isRunning.tryAcquire()){ aggiungiDocenti(); isRunning.release(); } Now, the server hangs in the line "while((cognome=reader.readLine())!=null), i tried to use PrintWriter (by using println(mex) and by using print(mex+"\r\n")) and to use BufferedWriter (using write(mex) and newLine()) but the server ever hangs on the while line... What's wrong with it? HEre is my actual client code: Socket s = new Socket(ip,Integer.parseInt(port)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(s.getOutputStream())); while (model.effectivilyCount()&gt;0){ writer.write(model.getValueAt(0, 0)+"\r\n"); writer.write(model.getValueAt(0, 1)+"\r\n"); model.removeRow(0); } writer.close(); s.close();
has comment: http://stackoverflow.com/comment/41125161
tagged with: bufferedwriter
has comment: http://stackoverflow.com/comment/41125829

http://stackoverflow.com/a/26302311
type: Answer
has body: In addition, You write in C#, so if you generate simple ASP.NET page and see how a dynamic page is being generated. It's not JSP/Java but It have the same concept of dynamic pages.
answers question: http://stackoverflow.com/q/26302134
score: 0

http://stackoverflow.com/comment/41251483
type: AnswerComment
has text: Thanks. I figured that out a few minutes ago but I appreciate your help anyway.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26290212

http://stackoverflow.com/comment/41130003
comment on: http://stackoverflow.com/a/26224270
type: AnswerComment
score: 0
type: Comment
has text: I cannot use an array.

http://stackoverflow.com/comment/41264771
comment on: http://stackoverflow.com/q/26296195
type: Comment
score: 0
type: QuestionComment
has text: Make sure that your bean is only instantiated twice. If it is annotated with `@Component` and you are also scanning it will be instantiated twice and you will get 2 jobs. The same goes for if the configuration is loaded multiple times (once by the `ContextLoaderListener` and `DispatcherServlet`.).

http://stackoverflow.com/a/26312580
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
has body: Outside your Java program everything is a stream of bytes. In Java, streams are raw bytes. You can use streams directly to access the external data in its 'native' unmodified form. Java readers are wrappers around streams that convert between bytes and characters (16-bit entities) using some encoding convention (i.e. UTF-8, ISO-8850-1). System.out is a PrintStream, which is kind of a hybrid. It is fundamentally a byte stream, so write(65) writes the ASCII character A. However, PrintStream also happens to include some methods that use the system default encoding to convert Character and String values to bytes. So if your default encoding was UTF-8 you could write char uc = '÷'; // Unicode 0x00f7 System.out.print(uc); The output would be a 2-byte sequence 0xC3,0xB7 which is the UTF-8 encoding of the ÷ symbol.
type: Answer
accepted answer of: http://stackoverflow.com/q/26311978
answers question: http://stackoverflow.com/q/26311978

http://stackoverflow.com/a/26249348
upvote count: 3
answers question: http://stackoverflow.com/q/26249247
type: Answer
has comment: http://stackoverflow.com/comment/41176543
has comment: http://stackoverflow.com/comment/41176520
downvote count: 0
score: 3
has body: First you should put message to Model or ModelAndView, such as model.put("message","ok"); Then you can use $ to display message value in Jsp. toastr.success('${message}', 'Registered',{timeOut:2000});
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26249247

http://stackoverflow.com/q/26242320
tagged with: generics
type: AnsweredQuestion
has body: am using generics and need to create an instance of a generic class at runtime, so I am trying to use getConstructor(). Unfortunately, I receive a NoSuchMethodException despite having the correct signature, so I am at a loss as to what is wrong. I will appreciate your suggestions so I can get beyond this issue. :) I've provided the constructors for CustomerAssembler. I need to create an instance of this class, dynamically, due to generics being used. I've included the snippet of code that I am using. In it, I called getConstructors() to see whether the constructors exist and their signatures. Both constructors exist and I have used the proper signature, so I don't know why I keep getting this exception. Arggg... Hopefully, you will see what I am doing wrong. :) Thank you for your time and help, Mike // Here are the constructors for CustomerAssembler. public CustomerAssembler() { super(); } public CustomerAssembler( Class&lt;Customer&gt; entityClass, Class&lt;CustomerPreviewDTO&gt; entityPreviewDTOClass, Class&lt;CustomerDetailDTO&gt; entityDetailDTOClass, Class&lt;CustomerUpdateDTO&gt; entityUpdateDTOClass, EntityManager entityManager) { super(entityClass, entityPreviewDTOClass, entityDetailDTOClass, entityUpdateDTOClass, entityManager); } Here is the exception: NoSuchMethodException: java.lang.NoSuchMethodException: assemblers.CustomerAssembler.&lt;init&gt;(entities.Customer, dtos.CustomerPreviewDTO, dtos.CustomerDetailDTO, dtos.CustomerUpdateDTO, javax.persistence.EntityManager) Here is the code... try { Class&lt;CustomerAssembler&gt; customerAssemblerClass = CustomerAssembler.class; Constructor&lt;CustomerAssembler&gt;[] lst = (Constructor&lt;CustomerAssembler&gt;[]) this.customerAssemblerClass.getConstructors(); /* See what the signature is for the non-default constructor, so I can make sure that getConstructor() is configured properly. Here is what was reported in the debugger: [0] = {java.lang.reflect.Constructor@10796}"public assemblers.CustomerAssembler()" […
tagged with: reflection
has answer: http://stackoverflow.com/a/26242420
tagged with: java
type: Question
has title: Create instance of Generic class at runtime with getConstructor(): NoSuchMethodException()
tagged with: getconstructor
accepted answer: http://stackoverflow.com/a/26242420
score: 0
answer count: 1

http://stackoverflow.com/a/26324002
type: Answer
answers question: http://stackoverflow.com/q/26323492
accepted answer of: http://stackoverflow.com/q/26323492
type: AcceptedAnswer
score: 0
has body: Well, your declaration should be: LinkedList&lt;gamePiece&gt; gameBoard; And further down gameBoard = new LinkedLiest&lt;gamePiece&gt;; This is the way you tell a generic type what its actual base type is.

http://stackoverflow.com/comment/41227542
type: AnswerComment
has text: Do I have to keep it in quotes?
type: Comment
comment on: http://stackoverflow.com/a/26277692
score: 0

http://stackoverflow.com/a/26615970
accepted answer of: http://stackoverflow.com/q/26348877
type: Answer
answers question: http://stackoverflow.com/q/26348877
has comment: http://stackoverflow.com/comment/41847550
has comment: http://stackoverflow.com/comment/119495800
score: 15
upvote count: 15
type: AcceptedAnswer
downvote count: 0
has body: It took me two days, but I believe I've finally solved this. In my SecurityConfiguration class I had the following method: @Configuration @EnableWebMvcSecurity @EnableGlobalMethodSecurity(jsr250Enabled=true, prePostEnabled=true) public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(authenticationService); } } I replaced the configureGlobal method with a configure method: @Override public void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(authenticationService); } And now everything works fine. According to this answer the difference is that the using configureGlobal will allow the AuthenticationManager by global method security or another HttpSecurity (WebSecurityConfigurerAdapter). As you can see above, I am enabling both Web Mvc Security and global method security. According to my unit tests, both continue to work with this change, but there is some debate here at my office on whether this change is correct (ie, if it is configuring global method security correctly), or if there is another problem with this solution. We believe the root cause of the problem is some type of Spring bug, possibly a race condition. As unlikely as that seems, the problem only manifested itself when we added a empty class to the project, it didn't matter what the class's package or name was.
has comment: http://stackoverflow.com/comment/131382674
has comment: http://stackoverflow.com/comment/41845458

http://stackoverflow.com/a/26218359
answers question: http://stackoverflow.com/q/26218249
has body: Calling removeModifyListener before doing the setText and then calling addModifyListener afterwards is one of the usual ways to approach this. Keep the modify listener as a field in the dialog class so you can keep track of it: private ModifyListener modifyListener = new MyModifyListener(); ... text.removeModifyListener(modifyListener); text.setText(....); text.addModifyListener(modifyListener).
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41372386
type: QuestionComment
comment on: http://stackoverflow.com/q/26343636
has text: I don't know anything about your upstream software, so that's for you to figure out. Why did it take the server at port 9090 a proxy_connect_timeout of 600 seconds (10 minutes) to accept the connection. Especially with a localhost connection. Perhaps you are overloading the machine?
score: 0
type: Comment

http://stackoverflow.com/a/26245463
score: 1519
has comment: http://stackoverflow.com/comment/56700707
has comment: http://stackoverflow.com/comment/47949984
has comment: http://stackoverflow.com/comment/104202154
has comment: http://stackoverflow.com/comment/97632561
has comment: http://stackoverflow.com/comment/47946336
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/60899390
has comment: http://stackoverflow.com/comment/41176610
upvote count: 1521
has comment: http://stackoverflow.com/comment/74238067
has comment: http://stackoverflow.com/comment/63862019
has comment: http://stackoverflow.com/comment/41171350
has comment: http://stackoverflow.com/comment/74236015
has comment: http://stackoverflow.com/comment/71551465
has comment: http://stackoverflow.com/comment/104248388
has comment: http://stackoverflow.com/comment/57974798
has comment: http://stackoverflow.com/comment/63893742
type: Answer
answers question: http://stackoverflow.com/q/26245139
has comment: http://stackoverflow.com/comment/45630932
has comment: http://stackoverflow.com/comment/41179366
has comment: http://stackoverflow.com/comment/41171548
has body: Yes, it's possible. Just implement getItemViewType(), and take care of the viewType parameter in onCreateViewHolder(). So you do something like: public class MyAdapter extends RecyclerView.Adapter&lt;RecyclerView.ViewHolder&gt; { class ViewHolder0 extends RecyclerView.ViewHolder { ... public ViewHolder0(View itemView){ ... } } class ViewHolder2 extends RecyclerView.ViewHolder { ... public ViewHolder2(View itemView){ ... } @Override public int getItemViewType(int position) { // Just as an example, return 0 or 2 depending on position // Note that unlike in ListView adapters, types don't have to be contiguous return position % 2 * 2; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case 0: return new ViewHolder0(...); case 2: return new ViewHolder2(...); ... } } @Override public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { switch (holder.getItemViewType()) { case 0: ViewHolder0 viewHolder0 = (ViewHolder0)holder; ... break; case 2: ViewHolder2 viewHolder2 = (ViewHolder2)holder; ... break; } } }
has comment: http://stackoverflow.com/comment/78992197
has comment: http://stackoverflow.com/comment/67535905
has comment: http://stackoverflow.com/comment/43094675
has comment: http://stackoverflow.com/comment/121795256
accepted answer of: http://stackoverflow.com/q/26245139
downvote count: 2
has comment: http://stackoverflow.com/comment/81759373
has comment: http://stackoverflow.com/comment/56556019
has comment: http://stackoverflow.com/comment/97640681
has comment: http://stackoverflow.com/comment/41172139
has comment: http://stackoverflow.com/comment/41171494
has comment: http://stackoverflow.com/comment/60887649
has comment: http://stackoverflow.com/comment/45879096
has comment: http://stackoverflow.com/comment/74237726
has comment: http://stackoverflow.com/comment/45848332
has comment: http://stackoverflow.com/comment/103684414
has comment: http://stackoverflow.com/comment/63773415
has comment: http://stackoverflow.com/comment/46908916

http://stackoverflow.com/q/26339589
has body: I am trying to add prefix to the default namespace of the DOM object, I was unable to achieve that, I have created a new node with no default Namesapce in it printed it to make sure no default namespace exists. Added an new attribute with a namespace with a prefix. I was able to add the new attribute, but was not able to remove the default namespace. Can you tell me on how to achieve it. for (int j = 0; j &lt; ODMNode1.getAttributes().getLength(); j++) { System.out.println("Attribute: " + ODMNode1.getAttributes().item(j).getNodeName() + " = " + ODMNode1.getAttributes().item(j).getNodeValue()); if (ODMNode1.getAttributes().item(j).getNodeName().equals("xmlns") &amp;&amp; ODMNode1.getAttributes().item(j).getNodeValue().equals("http://www.com.org"))'{ System.out.println("Beforev Removed"+ ODMNode1.getAttributes().item(j).getNodeName()); Element element = (Element) ODMNode1; element.removeAttribute("xmlns"); System.out.println("Removed"+ element.getAttribute("xmlns")); System.out.println("After Removed"+ ODMNode1.getAttributes().item(j).getNodeName()); } }
has comment: http://stackoverflow.com/comment/41345835
type: Question
has title: Add prefix to the default namespace "xmlns"
tagged with: dom
has answer: http://stackoverflow.com/a/26339800
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/26334375
has body: I'm not sure if I really understand what you want to do, but it seems like you want to store the String[] db results in a Map using a String name. Below I give an example how to do that. You can easily put this in a loop if you understand the concept. Hopefully this makes sense. I tried to match what you might actually be using. String[] names = {"one", "two", "three", "four"}; String[] string_array = {"1.0", "2.1", "7.9"}; Map&lt;String,String[]&gt; storage = new HashMap&lt;String,String[]&gt;(); storage.put(names[0], string_array);
answers question: http://stackoverflow.com/q/26333970
type: Answer
score: 0

http://stackoverflow.com/q/26197277
tagged with: java
tagged with: multithreading
type: Question
linked to: http://stackoverflow.com/q/25818275
tagged with: nio
has comment: http://stackoverflow.com/comment/41080759
has answer: http://stackoverflow.com/a/26202209
has answer: http://stackoverflow.com/a/26368561
answer count: 2
has comment: http://stackoverflow.com/comment/41079347
upvote count: 1
downvote count: 0
favorite count: 0
has body: I want to to create an something like ExecutorService in which there will be single thread initially, and based on the work load given to the ExecutorService, the thread count has to be increased gradually upto certain count, say 50 for example. I could not find any way to do that. Is there anyway make this happen in NETTY NIO? Appreciate your help. Thanks.
type: UnansweredQuestion
tagged with: netty
tagged with: executorservice
has title: Adding threads to ExecutorService dynamically in Netty NIO
score: 1

http://stackoverflow.com/comment/41362920
comment on: http://stackoverflow.com/q/26351365
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [.jar error - could not find or load main class](http://stackoverflow.com/questions/21650851/jar-error-could-not-find-or-load-main-class)

http://stackoverflow.com/comment/41079572
score: 0
comment on: http://stackoverflow.com/q/26197428
type: Comment
type: QuestionComment
has text: @StephenHogarty That's for **compiling**. glad3dr asked you the command you use to **run**.

http://stackoverflow.com/q/26291271
tagged with: java
accepted answer: http://stackoverflow.com/a/26293614
tagged with: periodformatter
type: Question
tagged with: jodatime
linked to: http://stackoverflow.com/q/26277193
answer count: 2
has body: I am using a PeriodFormatter to return a string showing the time until an event. The code below keeps creating strings like 1146 hours 39 minutes instead of x days y hours z minutes. Any ideas? Thanks, Nathan PeriodFormatter formatter = new PeriodFormatterBuilder() .printZeroNever() .appendDays() .appendSuffix( "d " ) .appendHours() .appendSuffix( "h " ) .appendMinutes() .appendSuffix( "m " ) .toFormatter(); return formatter.print( duration.toPeriod() );
possible better answer: http://stackoverflow.com/a/49572578
has answer: http://stackoverflow.com/a/49572578
downvote count: 0
has answer: http://stackoverflow.com/a/26293614
score: 8
favorite count: 0
upvote count: 8
tagged with: datetime
has title: PeriodFormatter not showing days
type: AnsweredQuestion

http://stackoverflow.com/comment/42590914
score: 0
type: Comment
has text: Exceptions are called from very special to general. So if you catch the very general exception "Exception", so "SecondException" and "FirstException" are included in that exception case. So the exception blocks after will not be entered.
comment on: http://stackoverflow.com/a/26207491
type: AnswerComment

http://stackoverflow.com/comment/41225789
type: Comment
type: QuestionComment
has text: @LanceJava Just a Statistics class extends the JFrame class and its default constructor initializes and adds components to the form. Whether it is true logically, if you create a new constructor to initialize variables, working only with them (counters winnings, interest etc)?
comment on: http://stackoverflow.com/q/26274624
score: 0

http://stackoverflow.com/a/26242980
has body: The default equals implementation of Object uses the instance's reference address. Two Objects are equal ONLY if they reside at the same location in memory. If you don't override equals that is the implementation you get. Also, this behavior has nothing to do with hashCode is you are not calling hashCode. If you call equals directly there is not use of hashCode. hashCode is generally used in data structures just as HashMap.
answers question: http://stackoverflow.com/q/26242832
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26242832

http://stackoverflow.com/comment/41254127
has text: @Chopper - see [Handling Duplicate Questions](http://blog.stackoverflow.com/2009/04/handling-duplicate-questions/) and signposts. Also, you should make the question in the title the same as the question in your body. The duplicate was for the question in your title. If you did not intend to ask the question in the title, then you should probably change it.
comment on: http://stackoverflow.com/q/26291463
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26292156
answers question: http://stackoverflow.com/q/26292155
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26292155
type: AcceptedAnswer
has body: // Function called recursively private static Map getMap(JSONObject object, String json) throws Exception { Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); Object jsonObject = null; Iterator&lt;String&gt; keys = object.keys(); while (keys.hasNext()) { String key = keys.next(); Object value = object.get(key); if (value instanceof JSONObject) { map.put(key, getMap((JSONObject) value, json)); continue; } // If value is in the form of array if (value instanceof JSONArray) { JSONArray array = ((JSONArray) value); List list = new ArrayList(); for (int i = 0 ; i &lt; array.length() ; i++) { jsonObject = array.get(i); if (jsonObject instanceof JSONObject) { list.add(getMap((JSONObject) jsonObject, json)); } else { list.add(jsonObject); } } map.put(key, list); continue; } map.put(key, value); } return map; } // Calling Method public static Map&lt;String, Object&gt; convertJsonToMap(String json) { Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); JSONObject jsonObject = null; try { if (null != json) { jsonObject = new JSONObject(json); map = getMap(jsonObject, json); } } catch (Exception e) { throw new SystemException("Unable to read JSOn Object"); // TODO : Handle Exception } return map; }
downvote count: 0

http://stackoverflow.com/comment/41384104
type: AnswerComment
has text: Thanks man for exhaustive reply! Now is more clear for me and I understood some steps that I can't understand before...thanks! :)
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26332077

spring-mvc
tags question: http://stackoverflow.com/q/26326231
tags question: http://stackoverflow.com/q/26276658
tags question: http://stackoverflow.com/q/26296195
tags question: http://stackoverflow.com/q/26293749
tags question: http://stackoverflow.com/q/26305363
tags question: http://stackoverflow.com/q/26350461
tags question: http://stackoverflow.com/q/26343666
tags question: http://stackoverflow.com/q/26285609
tags question: http://stackoverflow.com/q/26250238
tags question: http://stackoverflow.com/q/26330297
tags question: http://stackoverflow.com/q/26347961
tags question: http://stackoverflow.com/q/26326654
tags question: http://stackoverflow.com/q/26229058
tags question: http://stackoverflow.com/q/26256933
tags question: http://stackoverflow.com/q/26332802
tags question: http://stackoverflow.com/q/26350507
tags question: http://stackoverflow.com/q/26317262
tags question: http://stackoverflow.com/q/26276027
tags question: http://stackoverflow.com/q/26272104
tags question: http://stackoverflow.com/q/26235445
tags question: http://stackoverflow.com/q/26347868
tags question: http://stackoverflow.com/q/26237984
tags question: http://stackoverflow.com/q/26337068
tags question: http://stackoverflow.com/q/26202446
tags question: http://stackoverflow.com/q/26295682
tags question: http://stackoverflow.com/q/26260078
tags question: http://stackoverflow.com/q/26306420
tags question: http://stackoverflow.com/q/26260659
tags question: http://stackoverflow.com/q/26315767
tags question: http://stackoverflow.com/q/26294212
tags question: http://stackoverflow.com/q/26283993
tags question: http://stackoverflow.com/q/26351907
tags question: http://stackoverflow.com/q/26213050
tags question: http://stackoverflow.com/q/26276603
tags question: http://stackoverflow.com/q/26308242
tags question: http://stackoverflow.com/q/26348827
tags question: http://stackoverflow.com/q/26202242
tags question: http://stackoverflow.com/q/26244760
tags question: http://stackoverflow.com/q/26209802
tags question: http://stackoverflow.com/q/26238391
tags question: http://stackoverflow.com/q/26325524
tag name: spring-mvc
tags question: http://stackoverflow.com/q/26277572
tags question: http://stackoverflow.com/q/26276179
tags question: http://stackoverflow.com/q/26215500
tags question: http://stackoverflow.com/q/26306839
tags question: http://stackoverflow.com/q/26220791
tags question: http://stackoverflow.com/q/26249437
tags question: http://stackoverflow.com/q/26256507
tags question: http://stackoverflow.com/q/26346853
tags question: http://stackoverflow.com/q/26280689
tags question: http://stackoverflow.com/q/26213216
type: Tag
tags question: http://stackoverflow.com/q/26313151
tags question: http://stackoverflow.com/q/26330148
tags question: http://stackoverflow.com/q/26223261
tags question: http://stackoverflow.com/q/26253643
tags question: http://stackoverflow.com/q/26209743
tags question: http://stackoverflow.com/q/26242303
tags question: http://stackoverflow.com/q/26211047
tags question: http://stackoverflow.com/q/26320381
tags question: http://stackoverflow.com/q/26348334
tags question: http://stackoverflow.com/q/26245341
tags question: http://stackoverflow.com/q/26272718
tags question: http://stackoverflow.com/q/26257642
tags question: http://stackoverflow.com/q/26253315
tags question: http://stackoverflow.com/q/26299343
tags question: http://stackoverflow.com/q/26240432
tags question: http://stackoverflow.com/q/26273097
tags question: http://stackoverflow.com/q/26316238
tags question: http://stackoverflow.com/q/26282747
tags question: http://stackoverflow.com/q/26252155
tags question: http://stackoverflow.com/q/26318637
tags question: http://stackoverflow.com/q/26206988
tags question: http://stackoverflow.com/q/26340941
tags question: http://stackoverflow.com/q/26290096
tags question: http://stackoverflow.com/q/26210993
tags question: http://stackoverflow.com/q/26291881
tags question: http://stackoverflow.com/q/26340132
tags question: http://stackoverflow.com/q/26209693

http://stackoverflow.com/comment/41290115
type: QuestionComment
score: 0
has text: Isn't stringBuilder = new StringBuilder(); in startElement "clearing" it?
comment on: http://stackoverflow.com/q/26310595
type: Comment

http://stackoverflow.com/a/26239632
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26238982
answers question: http://stackoverflow.com/q/26238982
type: AcceptedAnswer
downvote count: 0
score: 1
has body: In your Constructor you assign a mouse listener to all of your cells which you have in a multidimensional array of JLabel. However, then in your updateGeneration() you create another JLabel[][] array but don't assign your mouse listener to cells again. To fix you need to add a mouse listener to all the cells again in updateGeneration(). Or instead of creating a new JLabel[][] just update the state of the JLabel in the existing array.

http://stackoverflow.com/a/26310306
type: Answer
has body: To repeat something, use a loop, such as a while loop or a do-while loop if you're not sure how manny times you'll loop. To get user input, use a Scanner object -- which you've already imported. The do-while loop structure will be something like... do { // code to do inside of the loop } while (somethingIsTrue); You will need to use some sentinel variable to change in the loop and then test inside of the while boolean check. It could be a String, in which case you'd use the String equals(...) or equalsIgnoreCase(...) method in your while's boolean check. So consider prompting for input at the end of the do block of code using System.out.print(...), getting the input with your Scanner, and then testing that input in the while boolean test.
score: 0
answers question: http://stackoverflow.com/q/26310134

http://stackoverflow.com/comment/41219204
comment on: http://stackoverflow.com/q/26272808
score: 0
has text: What are "SE" and "ME"? I'm assuming these are types of keystore, but I've never heard of them before.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41173860
comment on: http://stackoverflow.com/q/26247819
score: 0
type: Comment
has text: It's a great example of the importance of the order of operations and if ... else if... statements
type: QuestionComment

http://stackoverflow.com/a/26320705
answers question: http://stackoverflow.com/q/26320622
has comment: http://stackoverflow.com/comment/41306811
upvote count: 1
downvote count: 1
has body: try this pattern ((?:[A-Z]\.)+[A-Z]?|[a-zA-Z']+) Demo
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26320622

http://stackoverflow.com/q/26296038
linked to: http://stackoverflow.com/q/14023886
has body: I want my image to change the image as long as i press and hold on to the button . And when i release my finer i want it to revert back to the original image , is there a way to do this ? bTen.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bTen.setBackgroundResource(R.drawable.press); s1+="E"; txtView.setText(s1); } }); i have used the above code ,but it does not revert back to original when i release my finger.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41261449
answer count: 2
has answer: http://stackoverflow.com/a/26296380
tagged with: button
score: 0
tagged with: android
favorite count: 0
has title: How to change the button upon click ,and revert back to normal upon release the button?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26296094
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/41349813
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26342919
score: 0
has text: Unfortunately I have no access to the webservice

http://stackoverflow.com/q/26289913
tagged with: void
upvote count: 0
has body: For the public void mailingLabel() method, I keep getting an error that tells me void isn't allowed. When I changed it to a String and modified the code to include return statement it worked fine. What is wrong? public class StreetAddress { private String myStreet; private String myCity; private String myState; private String myZIP; public StreetAddress(String street, String city, String state, String zip) { myStreet = street; myCity = city; myState = state; myZIP = zip; } public void mailingLabel() { System.out.println(getStreet()); String p = getCity() + ", " + getState() + " " + getZIP(); System.out.println(p); } public String getStreet() { return myStreet; } public String getCity() { return myCity; } public String getState() { return myState; } public String getZIP() { return myZIP; } public void setStreet(String street) { myStreet = street; } public void setCity(String city) { myCity = city; } public void setState(String state) { myState = state; } public void setZIP(String zip) { myZIP = zip; } }
tagged with: java
has answer: http://stackoverflow.com/a/26289939
type: Question
has title: "Void" type not allowed here -- I'm new with coding
score: -1
has comment: http://stackoverflow.com/comment/41250823
has comment: http://stackoverflow.com/comment/41250796
has comment: http://stackoverflow.com/comment/41250827
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26344218
has comment: http://stackoverflow.com/comment/41350073
tagged with: int
has comment: http://stackoverflow.com/comment/41369788
duplicate of: http://stackoverflow.com/q/53809878
tagged with: compiler-errors
linked to: http://stackoverflow.com/q/2143476
type: UnansweredQuestion
tagged with: double
has title: Error : "class expected"
has body: Well ,I find this a very petty concern , though I'm not able to get through it. I have been through so many questions here, but no one was of exact help. I am trying to type cast a double value to int in following way : int res=int(Math.pow(2,3)); and it throws a error: '.class' expected . Any help on this would be highly appreciated. Thanks
duplicate of: http://stackoverflow.com/q/2143476
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41350011
type: Question
has comment: http://stackoverflow.com/comment/41369760
tagged with: casting

http://stackoverflow.com/q/26307580
upvote count: 1
answer count: 1
favorite count: 0
has body: I am trying to run a web start application with GlassFish 4.1, JDK 1.7 update 51 locally and I encountered the "Application Blocked by Security Settings" message. Here is what I tried to make it work: 1. Added http://hostname.localdomain.com:8080 to the Exception Site List in Java control panel. Also tried http://hostname.localdomain.com:8080/___JWSappclient/ and http://hostname.localdomain.com:8080/clientName.jnlp 2. Exported the s1as key from Glassfish's keystore.jks and imported it in to JRE cacerts: $ keytool -exportcert -keystore keystore.jks -alias s1as -file server.csr $ keytool -importcert -keystore jre/lib/security/cacerts -alias s1as -file server.csr I could see the jars signed with the s1as key, but javaws still complains. The JNLP is generated by Glassfish automatically using the settings from our sun-application-client.xml Appreciate any help on how to get around this error. I realize this works fine if I use JRE7 update 21 on the client-side but I would like to try with Java 8 later on so cannot stick to Java 7. If it matters, I am using Ubuntu.
has title: Signed Java web start application with Glassfish 4.1 and Java7
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28490560
score: 1
tagged with: java
tagged with: glassfish
type: Question

http://stackoverflow.com/q/26322095
answer count: 1
has comment: http://stackoverflow.com/comment/41366201
favorite count: 0
has answer: http://stackoverflow.com/a/26364542
accepted answer: http://stackoverflow.com/a/26364542
has title: Facebook 'code' parameter as part of query string for OAuth authentication
tagged with: security
has comment: http://stackoverflow.com/comment/41332558
has comment: http://stackoverflow.com/comment/41330874
linked to: http://stackoverflow.com/q/323200
tagged with: facebook
tagged with: php
has comment: http://stackoverflow.com/comment/41322482
downvote count: 0
has body: Even though Authorization Code is short-lived comparing to Authorization token, isn't there a vulnerability in sending it in 'GET' as a query string? Isn't it similar to sending password using GET method? In other words, after authentication facebook redirects user's browser to mysite.com sending the authorization code as a query string. Isn't it un-encrypted? middle man who is listening to your packets can read it and use it to highjack your session (session at mysite.com)? Say, I blocked the redirect (after getting the 'code' from facebook) on my browser side (using some browser add-on/plug-in) I copied the complete redirect URL (www.mysite.com?code=AQCOtAV..blah) and trying it from a different browser. the request will go through and mysite.com will contact facebook with inbound Authorization Code along with secretKey and clientId and Authenticate and generate Authorization token (I haven't really tried this step : step 3) I know I am missing something here. Kindly help me out.
has comment: http://stackoverflow.com/comment/41363391
tagged with: oauth-2.0
has comment: http://stackoverflow.com/comment/41317374
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41332398
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41319273
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/41316029

http://stackoverflow.com/a/26271487
score: 0
type: AcceptedAnswer
has body: Process: com.example.aalok.chirp, PID: 1493 java.lang.NullPointerException at com.example.aalok.chirp.LoginActivity$2.onClick(LoginActivity.java:58) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) Which means that something is null at line 58. mUsername = (EditText) findViewById(R.id.usernameField); mPassword = (EditText) findViewById(R.id.passwordField); //Set up Login button mLoginButton = (Button) findViewById(R.id.loginButton); mLoginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String username = mUsername.getText().toString(); String password = mPassword.getText().toString(); //this is line 58 But according to your code, you initialize mPassword, so if it exists in the layout, it can't be null. Therefore, I suspect R.id.passwordField does not exist in R.layout.activity_login
type: Answer
accepted answer of: http://stackoverflow.com/q/26204328
answers question: http://stackoverflow.com/q/26204328

http://stackoverflow.com/q/26285858
has title: Returning type of triangle, does not recognize identifier
has comment: http://stackoverflow.com/comment/41243192
has body: I am trying to make a program that, when given three int values that represent triangle side lengths, will tell me what kind of triangle I have. Here is the code: public String printTriangleType(int a, int b, int c) { if (a == b &amp;&amp; b == c) return equilateral; else if (a == b &amp;&amp; b != c &amp;&amp; a != c) return isosceles; else if (a == c &amp;&amp; b != c &amp;&amp; b != a) return isosceles; else if (b == c &amp;&amp; c != b &amp;&amp; c != a) return isosceles; else return scalene; } The program that is checking my code is telling me that it does not recognize the identifiers equilateral, isosceles, and scalene. Why is that?
has answer: http://stackoverflow.com/a/26285963
accepted answer: http://stackoverflow.com/a/26285963
type: AnsweredQuestion
downvote count: 0
score: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41243437
has comment: http://stackoverflow.com/comment/41243311
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41243374
favorite count: 0

http://stackoverflow.com/comment/41288789
has text: I'd just do a Fisher-Yates shuffle with a decoding function to go from the 1D index to a 2D index. Might be better ways out there though.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26310775

http://stackoverflow.com/comment/41150591
type: QuestionComment
has text: could you please show us some input dates and the value that gets inserted?
comment on: http://stackoverflow.com/q/26235647
type: Comment
score: 1

http://stackoverflow.com/comment/41320344
type: QuestionComment
comment on: http://stackoverflow.com/q/26328078
has text: @edharned Apologies, i have updated the OP
score: 0
type: Comment

http://stackoverflow.com/q/26333006
has comment: http://stackoverflow.com/comment/41330003
has title: Java - Difficulty with using Pair for Map Key in EULER Coins
type: UnansweredQuestion
tagged with: maps
has comment: http://stackoverflow.com/comment/41330017
has answer: http://stackoverflow.com/a/26333525
tagged with: java
has body: I've been working on a Project Euler problem about coin combinations. I got the answer using recursion, but I wanted to try some dynamic programming so I built myself a Pair class and tried to use it as a key for a TreeMap. I was able to get it going but I kept getting the completely wrong solution. I'm not sure what is going on. My friend suggested that perhaps something was happening with the Map trying to match the Pair references rather than values, but I tried overriding the .equals and modifying the compareTo method and it still doesn't work. (According to the docs I think TreeMap keys use equals method to match... Here is my code. Hope someone can give it a quick browse and let me know why it doesn't work... if you uncomment the last return statement and get rid of all the map stuff you'll see my recursive only solution and that WORKS. import java.util.Map; import java.util.TreeMap; public class Coins3 { public static class Pair implements Comparable&lt;Pair&gt; { Integer i1; Integer i2; Pair(Integer i1, Integer i2) { this.i1 = i1; this.i2 = i2; } @Override public int compareTo(Pair arg0) { // TODO Auto-generated method stub if(this.equals(arg0)) return 0; return this.i1 - arg0.i1; } public boolean equals(Pair arg0) { if(this.i1.equals(arg0.i1) &amp;&amp; this.i2.equals(arg0.i2)) return true; return false; } } static int[] coins = {1, 2, 5, 10, 20, 50, 100, 200}; static Map&lt;Pair,Integer&gt; memo = new TreeMap&lt;Pair,Integer&gt;(); /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(nWays(coins.length,200)); } public static int nWays(int index, int target) { if(target == 0) return 1; if(target &lt; 0) return 0; if(index &lt;= 0 &amp;&amp; target &gt; 0) return 0; // use the coin or not int n1, n2; Pair p1 = new Pair(index, target-coins[index-1]); Pair p2 = new Pair(index-1, target); if(memo.containsKey(p1)) { n1 = memo.get(p1); } else { n1 = nWays(index,target-coins[index-1]); memo.put(p1, n1)…
type: Question
answer count: 1
tagged with: key
score: 0
tagged with: reference

http://stackoverflow.com/a/26300032
has body: Try to put your file here. ---&gt;bin ---&gt;src ---&gt;PhoneRecords.txt or specify the location of the file. For instance, String path = "C:\\MyFiles\\PhoneRecords.txt"; File inFile = new File(path);
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26299842

http://stackoverflow.com/a/26314022
type: Answer
answers question: http://stackoverflow.com/q/26313888
has body: your if condition should be like this if(revStr.equals(str)){ System.out.println("The string "+str+" is a Palindrome"); System.out.println(revStr); } Because in java == check the address of object not content for more details check below thread What is the difference between == vs equals() in Java?
score: 0

http://stackoverflow.com/comment/41311340
score: 0
comment on: http://stackoverflow.com/a/26323185
type: Comment
has text: `replaceAll` is the wrong method here, `replace` is the correct one. Using `replaceAll`, which takes **regex** input, shows a fundamental misunderstanding of the `String` API.
type: AnswerComment

http://stackoverflow.com/q/26288099
accepted answer: http://stackoverflow.com/a/26288201
tagged with: renderer
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jtable
score: 0
tagged with: jxtable
has body: im using JXTable and trying to color the row based on value, BUT the show empty(but the render is running because it show the syso in console) public class MyCellRenderer extends JLabel implements TableCellRenderer { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) { SimpleTableModel mymodel = (SimpleTableModel) jxtableListar.getModel(); ModelProtocolo actualModel= (ModelProtocolo ) mymodel.getProtocolo(rowIndex) ; if(actualModel.getValue() &gt; 0) { System.out.println("Yep the Render is working"); } return this; } } jxtableListar.setDefaultRenderer(Object.class, new MyCellRenderer ()); i did not found any usefull "tutorial" how to use the JXTable renderer, since they talk about something about Hightlight, but all the tutorials are "out of information" to learn is there any good way/tutorial to color a JXTable row base on a value of the cell?
answer count: 1
has answer: http://stackoverflow.com/a/26288201
has title: Color Cell based on value

http://stackoverflow.com/comment/41140854
type: AnswerComment
type: Comment
has text: Telling yourself to RTFM may not make the best thread, and code dumps aren't always that helpful to future readers. Consider completing your answer and adding details to what you have done.
score: 4
comment on: http://stackoverflow.com/a/26229946

http://stackoverflow.com/comment/41223182
has text: Whilst I find your question interesting and I would like to help you, I have to mention that it is not [SSCCE](http://meta.stackexchange.com/questions/22754/sscce-how-to-provide-examples-for-programming-questions). So I cannot copy and paste it to my IDE to try something out. I bet if you change that in some way, you will get an answer.
comment on: http://stackoverflow.com/q/26261212
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26224923
score: 0
tagged with: gmail-api
possible better answer: http://stackoverflow.com/a/28643906
tagged with: gmail
type: AnsweredQuestion
has body: I'm having a little trouble with the gmail Java API. Essentially, I just reused their example code and modified it to remove all the emails that fit the query. Easy enough, but no emails are being deleted. Any ideas? public static void main (String [] args) throws IOException { HttpTransport httpTransport = new NetHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); clientSecrets = GoogleClientSecrets.load(jsonFactory, new FileReader(CLIENT_SECRET_PATH)); // Allow user to authorize via url. GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( httpTransport, jsonFactory, clientSecrets, Arrays.asList(SCOPE)) .setAccessType("online") .setApprovalPrompt("auto").build(); String url = flow.newAuthorizationUrl().setRedirectUri(GoogleOAuthConstants.OOB_REDIRECT_URI) .build(); System.out.println("Please open the following URL in your browser then type" + " the authorization code:\n" + url); // Read code entered by user. BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String code = br.readLine(); // Generate Credential using retrieved code. GoogleTokenResponse response = flow.newTokenRequest(code) .setRedirectUri(GoogleOAuthConstants.OOB_REDIRECT_URI).execute(); GoogleCredential credential = new GoogleCredential() .setFromTokenResponse(response); // Create a new authorized Gmail API client Gmail service = new Gmail.Builder(httpTransport, jsonFactory, credential) .setApplicationName(APP_NAME).build(); // Retrieve a page of Threads; max of 100 by default. ListThreadsResponse threadsResponse = service.users().threads().list(USER).setQ("category:Promotions").execute(); List&lt;Thread&gt; threads = threadsResponse.getThreads(); // Delete each Thread. for (Thread thread : threads) { String ThreadID = thread.getId(); service.users().threads().delete(USER, ThreadID); } }
has answer: http://stackoverflow.com/a/26224943
accepted answer: http://stackoverflow.com/a/26224943
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/28643906
answer count: 2
tagged with: google-api-java-client
has title: gmail API delete not working

http://stackoverflow.com/a/26325334
has comment: http://stackoverflow.com/comment/41315043
has comment: http://stackoverflow.com/comment/41315405
has comment: http://stackoverflow.com/comment/41315141
has comment: http://stackoverflow.com/comment/68789196
has comment: http://stackoverflow.com/comment/41315059
has comment: http://stackoverflow.com/comment/41319859
type: Answer
score: 13
has comment: http://stackoverflow.com/comment/41315114
has comment: http://stackoverflow.com/comment/54207641
has comment: http://stackoverflow.com/comment/68788689
answers question: http://stackoverflow.com/q/26325314
has body: The same answer still applies, and has always been like this in C++: if (C * p = dynamic_cast&lt;C *&gt;(&amp;obj)) { // The type of obj is or is derived from C } else { // obj is not a C } This construction requires A to be polymorphic, i.e. to have virtual member functions. Also note that this behaviour is different from comparing typeid(obj) == typeid(C), since the latter tests for exact type identity, whereas the dynamic cast, as well as Java's instanceof, only test for the target type to be a base class of the type of the most-derived object.
has comment: http://stackoverflow.com/comment/41315071
downvote count: 0
has comment: http://stackoverflow.com/comment/41315036
has comment: http://stackoverflow.com/comment/41315061
has comment: http://stackoverflow.com/comment/41315068
upvote count: 13
has comment: http://stackoverflow.com/comment/41315116
has comment: http://stackoverflow.com/comment/41315074
has comment: http://stackoverflow.com/comment/68788828
has comment: http://stackoverflow.com/comment/41315067

http://stackoverflow.com/q/26242009
has comment: http://stackoverflow.com/comment/41207194
has answer: http://stackoverflow.com/a/26266630
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26242122
has body: I want to use a properties file to read out some config data in my android app. When I place the properties file within the class folder of the handler everything works fine, but I want to place the properties file in the project root. I already tried it with relative paths (../../../ etc.), but it didn't work. Is there an "easy" way to do this (/config.properties also didn't work)? Here is my code: private Properties prop; public PropertiesHandler() { this.prop = new Properties(); InputStream input = null; try { input = getClass().getResourceAsStream("config.properties"); //input = new FileInputStream("config.properties"); prop.load(input); } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } } Any help would be greatly appreciated. EDIT: Unfortunately I got this Exception when applying the suggested solution: 10-08 15:10:05.903: E/AndroidRuntime(967): FATAL EXCEPTION: main 10-08 15:10:05.903: E/AndroidRuntime(967): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.dev.app1234/com.dev.app1234.Register}: java.lang.NullPointerException 10-08 15:10:05.903: E/AndroidRuntime(967): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983) 10-08 15:10:05.903: E/AndroidRuntime(967): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 10-08 15:10:05.903: E/AndroidRuntime(967): at android.app.ActivityThread.access$600(ActivityThread.java:130) 10-08 15:10:05.903: E/AndroidRuntime(967): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 10-08 15:10:05.903: E/AndroidRuntime(967): at android.os.Handler.dispatchMessage(Handler.java:99) 10-08 15:10:05.903: E/AndroidRuntime(967): at android.os.Looper.loop(Looper.java:137) 10-08 15:10:05.903: E/AndroidRuntime(967): at android.app.ActivityThread.main(ActivityThread.java:4745) 10-08 15:10:05.903: E/AndroidRuntime(967): at java.lang.reflect.Me…
has title: NullPointerException when using properties file in android application
possible better answer: http://stackoverflow.com/a/26242122
has comment: http://stackoverflow.com/comment/41203890
has comment: http://stackoverflow.com/comment/41205082
has comment: http://stackoverflow.com/comment/41162722
tagged with: android
accepted answer: http://stackoverflow.com/a/26266630
tagged with: properties
has comment: http://stackoverflow.com/comment/41162743
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41206861
tagged with: java
type: Question

http://stackoverflow.com/comment/75011251
comment on: http://stackoverflow.com/a/26307895
has text: Java Decompiler Gui for Procyon: https://github.com/deathmarine/Luyten/releases
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41441723
comment on: http://stackoverflow.com/a/26345799
has text: The getActivity method returns the context. The solution I suggested is exactly the same as the one that worked.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26340444
answer count: 2
has comment: http://stackoverflow.com/comment/41366660
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/41354032
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27110790
has title: Google AppEngine BackendSevice Null Pointer exception
has body: We have Java based Google App Engine project. It works fine. But logs have NULL Pointer Exception in BackendService as follows 10.1.0.41 - - [13/Oct/2014:05:33:08 -0700] "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 500 89 - - ms=125 cpu_ms=15 cpm_usd=0.000010 app_engine_release=1.9.13 instance=00c61b117c84d9ef5a08d243b652ffc3c7589b E 2014-10-13 18:03:08.271 com.google.api.server.spi.SystemService invokeServiceMethod: invokeServiceMethod: cause={0} java.lang.NullPointerException at com.google.api.server.spi.BackendService.getApiConfigs(BackendService.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:45) at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:189) at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:137) at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:106) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.…
type: Question
has answer: http://stackoverflow.com/a/31141740
upvote count: 3

http://stackoverflow.com/comment/41355158
type: Comment
score: 0
type: QuestionComment
has text: Here is the answer for your question. http://stackoverflow.com/questions/849813/large-numbers-in-java
comment on: http://stackoverflow.com/q/26346992

http://stackoverflow.com/comment/41137614
has text: Is the vertical offset for the left-most cell, or the bottom-most cell?
comment on: http://stackoverflow.com/q/26227852
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41099826
type: AnswerComment
has text: I can't tell if it works or not because I don't know where to put my method of MainCharacter.move(0, CharacterN) etc.
comment on: http://stackoverflow.com/a/26208193
score: 0
type: Comment

http://stackoverflow.com/a/26213087
answers question: http://stackoverflow.com/q/26212711
has body: I would change the method crashed() to the following: private void crashed() { planeAnimation = explosionAnimation; explosionTime = TimeUtils.nanoTime(); gameover = true; System.out.println("timer started"); } Then in your method render() remove the lines if (TimeUtils.nanoTime() - explosionTime &gt; 7000000000f) { gameover=true; } and modify if (gameover){ motionTestGame.setScreen((new GameOverScreen(motionTestGame))); dispose(); } into if (gameover &amp;&amp; TimeUtils.nanoTime() - explosionTime &gt; 7000000000f){ motionTestGame.setScreen((new GameOverScreen(motionTestGame))); dispose(); } Also, you might want to add !gameover &amp;&amp; rockR.overlaps(player) to your if-statements to avoid calling crashed() multiple times and reseting the timer.
has comment: http://stackoverflow.com/comment/41108911
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41111214
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26212711

http://stackoverflow.com/comment/41133037
type: QuestionComment
has text: I am talking about using Spring JdbcTemplate.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26225915

http://stackoverflow.com/a/26332302
type: Answer
accepted answer of: http://stackoverflow.com/q/26331221
answers question: http://stackoverflow.com/q/26331221
has body: What you're trying to do is not possible. However, there are serious design decisions that you're making that render what you're trying to do somewhat irrelevant, since there are other methods you can use to accomplish what you want. First thing: your code, all variables, and anything you put in your source files that are supposed to be known at the time you compile are called "compile time" dependencies or references. These are things that the java compiler will require you to specify before anyone can even run the program. Variable names are included in this list of things (going further into detail would be attempting to teach basic Java, so I won't do that here...) Anything you need your code to do based on user input are called "runtime" dependencies or references. User input at the command line, files loaded from the file system, UI events, etc. are all examples of where you might construct your compiled code to handle these unknown-at-compile-time items (hence, runtime). If you need to identify your objects based on some user input, declare a method in your class for which you can use to assign the user input value and create your desired mapping. Use of a Map is another means you can associate objects with keys (key/value pairs) and accomplish what you're trying to do. Example: public class Picture { private String name; // other properties omitted for clarity public Picture() { this.name = "some default"; } // use getters/setters to access and assign object data, which can include // user-input obtained at runtime public String getName() { return this.name; } public void setName(String name) { this.name = name; } } and in your code, you can make use of this by doing something similar to what you have: if (token1.equalsIgnoreCase("start")){ System.out.println("john"); String token2 = in.next(); if(token2.equalsIgnoreCase("picture")){ System.out.println("doe"); char inputChar = in.next().charAt(0); // use a more descriptive name... Picture picture = new Pictu…
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41143178
type: Comment
has text: Yeah, qualified names in this case are obligatory and it actually works, but I stuck with related problem. It is resources loading like images, css and stuff like that. Now i am not sure that I want to achieve a good thing. It starts to be a little messy.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26227813

http://stackoverflow.com/q/26249062
has comment: http://stackoverflow.com/comment/41176465
answer count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/41176394
type: UnansweredQuestion
has body: this is my first posting here, but I have done quite a bit of research before writing. I'm attempting to compare Strings using String.equals(), and (with the right data) the comparison is evaluating to true. I even threw in a boolean to check it. However, instead of executing the contents of the If block, it exits the For loop and returns null: public WeatherInfo getWeather (Date date, ArrayList&lt;WeatherInfo&gt; weather) { SimpleDateFormat sdf = new SimpleDateFormat("MMM dd yyyy"); String eventDate = sdf.format(date); for (WeatherInfo w : weather) { Date wDate = new Date(w.getEpoch() * 1000); String weatherDate = sdf.format(wDate); if (weatherDate.equals(eventDate)) { return w; } } return null; } Anyone have any idea what could cause this to happen? PS. Here's a screenshot of the relevant variables at the time of True evaluation (test is the check boolean)
has comment: http://stackoverflow.com/comment/41176120
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41176418
has title: Java: True If statement in a For loop is causing the loop to break, but not executing the block
downvote count: 0
has comment: http://stackoverflow.com/comment/41176182
has comment: http://stackoverflow.com/comment/41175998
favorite count: 0
has comment: http://stackoverflow.com/comment/41176477
has comment: http://stackoverflow.com/comment/41176046
has comment: http://stackoverflow.com/comment/41176208
score: 3
tagged with: android

http://stackoverflow.com/q/26353680
has comment: http://stackoverflow.com/comment/41385859
upvote count: 1
has comment: http://stackoverflow.com/comment/41385818
tagged with: java
tagged with: eclipse
downvote count: 1
has comment: http://stackoverflow.com/comment/41480909
has comment: http://stackoverflow.com/comment/41384005
type: Question
has title: Why does my code run fine in Eclipse but throws an error from cmd?
score: 0
has body: This question was already asked, and the answer was to use JDK 1.7 instead of JDK 1.6 My problem is I am using JDK 1.7, but still get [Microsoft][ODBC Driver Manager] Invalid string or buffer length for line resultSet.getString("field_name"); When I compile using Eclipse everything works perfect, but when I compile from cmd, it throws this error. Here is what I do set path=%path%;C\Program Files\Java\jdk1.7.0_51\bin javac -cp ".;..jar;" MainClass.java java -cp ".;..jar;" MainClass
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41467454
favorite count: 0
answer count: 0
linked to: http://stackoverflow.com/q/23371457
type: UnansweredQuestion

http://stackoverflow.com/a/26353713
score: 0
has body: I made your home work for you: boolean noWhite = false; boolean oneUppercase = false; boolean oneDigit = false; Scanner scan = new Scanner(System.in); String pass = ""; while (!noWhite || !oneUppercase || !oneDigit || pass.length() &lt; 8) { System.out.print("new pass: "); pass = scan.next(); noWhite = !pass.contains(" "); oneUppercase = !pass.equals(pass.toLowerCase()); oneDigit = pass.matches(".*\\d.*"); } System.out.println("OK");
type: Answer
answers question: http://stackoverflow.com/q/26353169

http://stackoverflow.com/q/26282574
tagged with: jface
tagged with: checkbox
type: AnsweredQuestion
has body: Hi I am relatively new to SWT. I am using a CheckboxTableViewer. I have a listener on it: diagnosesTableViewer.getTable().addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { int nomenclatureSelectionIndex = diagnosesTableViewer .getTable().getSelectionIndex(); Nomenclature checkedNomenclature = (Nomenclature) diagnosesTableViewer .getElementAt(nomenclatureSelectionIndex); diagnosesTableViewer.setChecked(checkedNomenclature, !diagnosesTableViewer .getChecked(checkedNomenclature)); } When I click on the table row (anywhere but the checkbox), everything works as expected. But when I click on the checkbox specifically, I unchecks the checkbox of the previously selected row as well. I think it is because when I click on the checkbox, it does not change the focus to the new row and hence the listener is called on the old, previously selected row itlsef and the new row whose checkbox I am selecting, its listener is never being called. How can I solve this?
tagged with: swt
accepted answer: http://stackoverflow.com/a/26283070
type: Question
tagged with: java
score: 0
has title: CheckboxTableViewer does not change the focus of the table row when clicked on its checkbox
answer count: 1
has answer: http://stackoverflow.com/a/26283070

http://stackoverflow.com/a/26333441
upvote count: 1
has comment: http://stackoverflow.com/comment/41332202
accepted answer of: http://stackoverflow.com/q/26332090
has comment: http://stackoverflow.com/comment/41333036
has comment: http://stackoverflow.com/comment/41331818
has body: I was also stuck with the same issue few day ago, I resolved the same issue by updating sdk to latest version 23.0.4. and extras: Android support Repository to rev. 6 Android support Library to rev. 20 first of all open up your Android sdk Manager from eclipse and download all latest sdk updates and extra downloads. And then after downloading all updates , you have need to use a fresh Eclips editor because your existing eclipse will not let you successfully update from Android sdk tool 20 to 21.0.4 Then just use a fresh eclips editor and set up updated android sdk path in the fresh eclips (the same one you have used in your last eclipse editor , you can find it at Window>> Prefrences >> Android). Hopefully this will solve your problem.
has comment: http://stackoverflow.com/comment/41331883
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41331342
has comment: http://stackoverflow.com/comment/41331991
has comment: http://stackoverflow.com/comment/41331446
has comment: http://stackoverflow.com/comment/41331234
has comment: http://stackoverflow.com/comment/41331326
type: Answer
has comment: http://stackoverflow.com/comment/41332362
answers question: http://stackoverflow.com/q/26332090
score: 1

http://stackoverflow.com/comment/41440561
type: Comment
comment on: http://stackoverflow.com/a/26348413
has text: Actually the more I think of it the more I realize this won't work. Using a `BeanPostProcessor` would be too late in the lifecycle. The purpose of the config classes/bean definition parsers is to be able to dynamically create and add new beans into the application context. If you're in a bean and executing inside a bean post processor then it is too late to introduce new bean definitions into the context.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41239547
has text: @RajK +1 After you update the file, your program has to read it (possibly again)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26283725

http://stackoverflow.com/comment/41097915
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26207383
has text: In there for clarity I think :-)

http://stackoverflow.com/comment/41221362
has text: Did you check lua support in redis? Build a custom lua script to be executed against redis, then if something fails, you will get a lua exception (that you can also catch if wanted).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26272471

http://stackoverflow.com/comment/55957856
score: 0
type: Comment
type: AnswerComment
has text: So the question is: is this a known bug and is there a bug report? I couldn't find anything.
comment on: http://stackoverflow.com/a/33982812

http://stackoverflow.com/comment/41089197
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26202240
has text: @HotLicks, yeah, I agree and understand what you said, but I still need some firm evidence to convince myself. Could you please tell me how to check the bytecodes?

http://stackoverflow.com/q/26219788
has answer: http://stackoverflow.com/a/26220205
tagged with: maven
tagged with: dependency-management
has comment: http://stackoverflow.com/comment/41121802
type: AnsweredQuestion
upvote count: 9
tagged with: java
tagged with: apache-commons-compress
tagged with: gradle
has body: I have a project which has the apache-compress library as a compile time dependency. This library appears to use Maven and has a POM file with a dependency set up as "optional". Here is the relevant section of the POM file: org.tukaani xz 1.5 true Gradle does not seem to include this library in to my project, I'm guessing it is because of the "optional" attribute. Is there some way to tell Gradle to include this dependency without explicitly including the xz library myself? Here is my Gradle dependency declaration: compile group: 'org.apache.commons', name:'commons-compress', version:'1.8.1'
score: 9
type: Question
accepted answer: http://stackoverflow.com/a/26220205
downvote count: 0
answer count: 1
has title: Gradle Does Not Include Optional Dependency
favorite count: 0

http://stackoverflow.com/a/26253937
accepted answer of: http://stackoverflow.com/q/26253722
has body: dude u can use this private Location getLocation() { LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (manager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { return manager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } else if (manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { return manager.getLastKnownLocation(LocationManager.GPS_PROVIDER); } return null; } For using only network based location use this one &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt; For GPS based location, this one &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26253722

http://stackoverflow.com/comment/41295357
has text: I am not familiar with TreeSet. Can you give a snippet?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26314712
type: AnswerComment

http://stackoverflow.com/q/26210125
type: Question
tagged with: jakarta-ee
answer count: 2
has body: I need to develop a web application for the Intranet users. I don't want them to enter the login credentials each time they visit the site. It should be automatically loaded from the System Username and Password. I have successfully implemented functionality which prompt user name and password registered with active directory and validate against LDAP. I need some tips to login directly from intranet website without prompt username &amp; password. Here is my queries, please let me know your suggestion. Is it compulsory to set SPN? Do we need to create separate keytab file for each client? In my organization, there is around 800 people are working so should I need to add all client principal in keytab file &amp; copy to client machine to perform autologin. I have tried many API's like JESSO, Waffle, Spring Kerberos, SPNGO but failed to implement auto login.
has answer: http://stackoverflow.com/a/26493401
has answer: http://stackoverflow.com/a/26210277
has comment: http://stackoverflow.com/comment/41103213
upvote count: 2
downvote count: 1
favorite count: 0
has title: Single-Sign-On (SSO) in Java Platform using Active Directory
tagged with: single-sign-on
possible better answer: http://stackoverflow.com/a/26210277
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26493401

http://stackoverflow.com/comment/41248129
has text: @LuiggiMendoza Well, my intention with testing was just to tell if an implementation is faster or slower than using `HashSet`. That much it can tell.
comment on: http://stackoverflow.com/a/26288123
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26208166
accepted answer of: http://stackoverflow.com/q/26207931
answers question: http://stackoverflow.com/q/26207931
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41100472
has body: I think you forgot to add all your panels to your frame. Try add this to your codes: this.add(ACTSATpanel); this.add(APpanel); this.add(servicePanel); this.add(leadershipPanel); this.add(GPAPanel); this.add(buttonPanel);

http://stackoverflow.com/q/26237095
has body: For some reason whenver I try to compile my android studio project, It keeps saying my image "default" is invalid. It doesn't make any sense because in the XML file it has no issue displaying when you change the view to design mode for the view. After I compile, the Gradle throws an issue and all my "R." turn into Symbol not found. i.e. whever i did like R.id.textview, all my R's turn red and I can't change it back. My Errors: Error:error: invalid symbol: 'default' Error:Execution failed for task ':app:processDebugResources'. &gt; com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/Android Studio.app/sdk/build-tools/android-4.4W/aapt package -f --no-crunch -I /Applications/Android Studio.app/sdk/platforms/android-20/android.jar -M /Users/Anuraag/AndroidStudioProjects/Weather/app/build/intermediates/manifests/debug/AndroidManifest.xml -S /Users/Anuraag/AndroidStudioProjects/Weather/app/build/intermediates/res/debug -A /Users/Anuraag/AndroidStudioProjects/Weather/app/build/intermediates/assets/debug -m -J /Users/Anuraag/AndroidStudioProjects/Weather/app/build/generated/source/r/debug -F /Users/Anuraag/AndroidStudioProjects/Weather/app/build/intermediates/libs/app-debug.ap_ --debug-mode --custom-package com.anuraagy.weather -0 apk Error Code: 1 Output: res/drawable-hdpi-v4/default.png:0: error: invalid symbol: 'default' Main Activity package com.anuraagy.weather; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.me…
tagged with: android
accepted answer: http://stackoverflow.com/a/26237718
has title: My App wont compile and when it throws an error all my resource files are gone
type: AnsweredQuestion
score: 2
tagged with: android-fragments
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26237718
answer count: 1
downvote count: 0
tagged with: build.gradle
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/56619205
comment on: http://stackoverflow.com/a/26765794
score: 0
type: AnswerComment
has text: Token aware single partition batches may be faster than async writes under some circumstances
type: Comment

http://stackoverflow.com/comment/42933408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26340508
has text: @PhilPeace yes i did
score: 0

http://stackoverflow.com/q/26319013
answer count: 2
tagged with: android
has title: Is scringo still working?
score: 0
tagged with: java
tagged with: eclipse
tagged with: scringo
has body: anyone knows if scringo is officially down? I have read some comments about it. I am trying to use Scringo in my project and after merging manifests and adding the library, I get the error: 10-11 22:29:58.125: E/Scringo(12075): Error fetching 10-11 22:29:58.125: E/Scringo(12075): java.io.FileNotFoundException:https://srv1.scringo.com/ScringoServer2/api?command=getAppData&amp;clientType=2&amp;build=2.5.4&amp;appId=aFZeiXQFSH3pgscgbq878CU3xJfXCDTh&amp;changeNumber=0&amp;v=15 10-11 22:29:58.125: E/Scringo(12075): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:521) 10-11 22:29:58.125: E/Scringo(12075): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:258) 10-11 22:29:58.125: E/Scringo(12075): at com.scringo.utils.ScringoHttpFetcher.getResponseStr(ScringoHttpFetcher.java:132) 10-11 22:29:58.125: E/Scringo(12075): at com.scringo.utils.ScringoJsonFetcher.handleResponse(ScringoJsonFetcher.java:59) 10-11 22:29:58.125: E/Scringo(12075): at com.scringo.utils.ScringoJsonFetcher.run(ScringoJsonFetcher.java:40) in my project and in the sampleapp available in github, so, is it working? if it is, any suggestion to my problem? Thanks a lot!
has answer: http://stackoverflow.com/a/26319330
possible better answer: http://stackoverflow.com/a/26443695
tagged with: chat
has answer: http://stackoverflow.com/a/26443695
accepted answer: http://stackoverflow.com/a/26319330
type: AnsweredQuestion
type: Question

http://stackoverflow.com/q/26345283
has title: html extracting contents of a div class java
type: Question
has comment: http://stackoverflow.com/comment/41355330
score: 0
has comment: http://stackoverflow.com/comment/41352475
has comment: http://stackoverflow.com/comment/41352294
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41355299
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41352141
tagged with: java
has comment: http://stackoverflow.com/comment/41352043
has body: Ive searched everywhere and cant find a good answer. I'm trying to extract the contents of and print it out. is there a simple way to print out the contents of the class, not using jsoup? Directions Preheat oven to 275 degrees F (135 degrees C). Combine the margarine, salt, garlic salt, Worcestershire sauce and pumpkin seeds. Mix thoroughly and place in shallow baking dish. Bake for 1 hour, stirring occasionally. Kitchen-Friendly View

http://stackoverflow.com/comment/41199238
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26262089
has text: @JeroenVannevel not to mention, `E remove(int index)` returns the object that was removed...
type: Comment

http://stackoverflow.com/q/26205255
has comment: http://stackoverflow.com/comment/41093689
has title: creating runnable jar file programmatically, main class manifest issue
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41094355
has comment: http://stackoverflow.com/comment/41093916
has comment: http://stackoverflow.com/comment/41094058
type: UnansweredQuestion
has body: I am trying to create a runnable jar file however I believe I am having problems with the manifest. I have been informed by another post on this site that setting the "Attributes.Name.MAIN_CLASS" attribute of your manifest file to the value of your runnable class will create a runnable jar file upon which on start, the file will run the class value that you entered as your runnable file. Unfortunately I am having trouble with the syntax a little bit. Here is what I am trying at the moment: String f = "LicenseFiller"; String version = "1.0.0"; String author = "concretepage"; Manifest manifest = new Manifest(); Attributes global = manifest.getMainAttributes(); global.put(Attributes.Name.MANIFEST_VERSION, version); global.put(new Attributes.Name("Created-By"), author); global.put(Attributes.Name.MAIN_CLASS, f); There are no error messages however, when executed the program will produce a jar file but not a runnable jar file. When I create runnable jar file in eclipse and then run jar file, it works perfectly so there is nothing in the LicenseFiller.class that is causing the issue. Could someone please correct my syntax? Thankyou. UPDATE: When I decompiled and inspected my own compiled jar to the one eclipse makes. The manifest files both contain the same value for the main class however the eclipse made jar has many more files in the runnable jar file but I believe these are just excess classes because they are made from the same default package. Manifest of my jar: Manifest-Version: 1.0.0 Created-By: concretepage Main-Class: LicenseFiller Manifest of eclipse: Manifest-Version: 1.0 Class-Path: . Main-Class: LicenseFiller Name: org/jdom2/filter/ Specification-Title: JDOM Filter Classes Implementation-Title: org.jdom2.filter Implementation-Version: 2.0.5 Specification-Version: 2.0.0 Specification-Vendor: jdom.org Implementation-Vendor: jdom.org Name: org/jdom2/adapters/ Specification-Title: JDOM Adapter Classes Implementation-Title: org.jdom2.adapters Implementation-Vers…
has comment: http://stackoverflow.com/comment/41094216
answer count: 0
tagged with: jar
type: Question
has comment: http://stackoverflow.com/comment/41093702

http://stackoverflow.com/comment/41174998
comment on: http://stackoverflow.com/a/26243871
type: Comment
has text: This works as well as the accepted answer, but the other answer fit my case more (see the comment on accepted answer).
score: 0
type: AnswerComment

genericdao
tags question: http://stackoverflow.com/q/26288373
type: Tag
tag name: genericdao

http://stackoverflow.com/comment/41174963
score: 0
comment on: http://stackoverflow.com/a/26244394
has text: Hey thanks, this worked perfectly. @njzk2 answer worked as well but the JSON has different format (some with underscore, some with dashes). Thank you
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41349020
comment on: http://stackoverflow.com/q/26343634
type: Comment
has text: Your programming logic is poor---run the loop from `2 to sqrt(x)`!
score: 0
type: QuestionComment

http://stackoverflow.com/a/26220636
has comment: http://stackoverflow.com/comment/41133649
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26219052
answers question: http://stackoverflow.com/q/26219052
type: Answer
has comment: http://stackoverflow.com/comment/41125832
upvote count: 3
has comment: http://stackoverflow.com/comment/41155344
has body: Is there a chance that in your yo jhipster command, you chose in the question for database development, the option H2 memory ? This way, it's normal that you lost your data. May be you can change this option to use a real Database.
score: 3

http://stackoverflow.com/comment/41287275
type: AnswerComment
comment on: http://stackoverflow.com/a/26309716
has text: @Sabien No, *you* defined a package called `a3` to NetBeans and put this class inside it. If you don't want it in a package, just move it to the default package, and NetBeans will fix the source. But classes should be in packages.
type: Comment
score: 0

http://stackoverflow.com/a/26232961
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26231174
upvote count: 1
has comment: http://stackoverflow.com/comment/41146295
accepted answer of: http://stackoverflow.com/q/26231174
has body: You should use a PJC to accomplish this. There is a good site with examples from françois degrelle here and it also contains the code how to implement it. If you use PJC then you are in java on the client side. So at that moment you can do anything you can do in java. Also communicate with devices. You can also use jacob (JAva-COM Bridge), but I don't know this is suited for you. But if it is here is the main site about jacob with lots of explanation what you can do with it.
has comment: http://stackoverflow.com/comment/41156122
has comment: http://stackoverflow.com/comment/41146144
type: AcceptedAnswer

http://stackoverflow.com/a/26252341
downvote count: 0
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/26251346
score: 4
has body: The Fused Location Provider requires Google Play Services to be available on a device. Since the release on Play Services 4.0 , the minVersionSdk is set to 9, the equivalent of Android 2.3. In theory you can use the Fused Location Provider on Android 2.2 too, but you'll need to resort to the no-longer-updated Froyo version of the Google Play Services SDK. It's a year old now, so not ideal. Personally, I couldn't be bothered supporting Android 2.2 any longer, as it has an almost negligible number of users these days (~0.7%)

http://stackoverflow.com/comment/41082449
type: Comment
score: 1
type: AnswerComment
has text: Java does not have multiple inheritance, so making Shape an interface leaves the implementing class (Traiangle, Rectangle, etc.) free to extend another class, and still implement Shape. If Shape were a class, the implementing class would have to extend Shape, and could not extend any other class. The interface also produces looser coupling - other classes dealing with Shape implementations don't need to know what the specific class of the implementer is.
comment on: http://stackoverflow.com/a/26198981

http://stackoverflow.com/comment/41199460
has text: in OP's code, the function could possibly remove multiple items that are identical. I'm not sure if it is intentional, but if it is, your code does not work.
comment on: http://stackoverflow.com/a/26262166
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26335512
upvote count: 1
has comment: http://stackoverflow.com/comment/41340045
has comment: http://stackoverflow.com/comment/41334487
favorite count: 0
has body: I have developed a web application that contains a dashboard to display various reports and graphs based on user selections. The user is provided with checkboxes and radio buttons for operating on the reports as required. On selection of each checkbox and radio button, I am making an ajax call to display the report corresponding to the selections. The problem I am facing is when the user clicks on multiple checkboxes/radio button one by one in a series with a very small time gap (fraction of a second or a second), the requests are hit to the server in a series and the server responds to them in the same order. For example, if I have 2 radio buttons, one for pie chart and other for line graph, and the user clicks both of them in a series of small time gap, the server displays the pie chart first and within few milliseconds it is overwritten by the line graph. Is there a mechanism, which will enable me to override the latest request over all the earlier request? Notes: I do not want to hit the server continuously, at the same time, I do not want to provide a submit button (against the customer requirement). It would be great if I find a javascript/ajax mechanism that allows me to submit only the latest request to the server. I am using Java/J2EE Struts2 framework, javascript and ajax
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26335821
tagged with: request
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41334747
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/41336708
has answer: http://stackoverflow.com/a/26338986
tagged with: javascript
has title: Handling multiple requests from a same client in a series of small time frames
tagged with: ajax
answer count: 2
has comment: http://stackoverflow.com/comment/41336599

http://stackoverflow.com/a/26338251
type: Answer
has comment: http://stackoverflow.com/comment/41339105
has comment: http://stackoverflow.com/comment/41342376
downvote count: 2
answers question: http://stackoverflow.com/q/26338025
score: -2
has body: Use BigDecimal for formatting instead of Long: BigDecimal bd = BigDecimal.valueOf(amount, 3); NumberFormat formatter = NumberFormat.getCurrencyInstance(new Locale("en","US")); formatter.setMinimumFractionDigits(3); String moneyString = formatter.format(bd); System.out.println(moneyString);
upvote count: 0
has comment: http://stackoverflow.com/comment/41340035

http://stackoverflow.com/comment/41095021
has text: http://developer.android.com/reference/android/os/AsyncTask.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26202568

http://stackoverflow.com/comment/43694815
score: 1
type: Comment
has text: I like the effort you spend into this, but the straightforward solution to the lack of provision is to break this into two steps, which is more effective in this case than your Qtax trick, anyway.
comment on: http://stackoverflow.com/a/27626902
type: AnswerComment

http://stackoverflow.com/q/26351894
linked to: http://stackoverflow.com/q/18727033
has body: I follow the official tutorial, but the tutorial about action buttons confuses me -- Adding Action Buttons. I don't find any methods named openSettings or openSearch and the tutorial doesn't mention to define these two methods,so where are they?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41370007
has comment: http://stackoverflow.com/comment/41369924
has comment: http://stackoverflow.com/comment/41372819
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41372801
has comment: http://stackoverflow.com/comment/41373444
type: Question
has title: What does the "openSettings" or "openSearch" mean in Android official tutorial?
duplicate of: http://stackoverflow.com/q/18727033
has comment: http://stackoverflow.com/comment/41370240
has comment: http://stackoverflow.com/comment/41370203
has comment: http://stackoverflow.com/comment/41363855
has comment: http://stackoverflow.com/comment/41363846
score: 0
tagged with: android

http://stackoverflow.com/comment/41331777
score: 0
type: Comment
has text: possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it)
type: QuestionComment
comment on: http://stackoverflow.com/q/26334168

http://stackoverflow.com/q/26243723
has comment: http://stackoverflow.com/comment/41166301
linked to: http://stackoverflow.com/q/109383
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41166270
type: Question
linked to: http://stackoverflow.com/q/13515845
downvote count: 0
has answer: http://stackoverflow.com/a/26244048
has title: Hashmap sort java
answer count: 1
has body: I want to enter some text, to separate the letters and then make a hashmap with keys-> unique letters of text and values -> number of repeated letters.How to sort values of Hashmap by descending order. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; public class Menu { public static void main(String args[]){ String text = null; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter some text: "); try { text = br.readLine(); } catch (IOException e) { e.printStackTrace(); } HashMap&lt;Character, Integer&gt; map = new HashMap(); String UpperCase = text.toUpperCase(); for (int i = 0;i &lt; UpperCase.length(); i++){ Character currentChar = UpperCase.charAt(i); if(map.get(currentChar) == null){ map.put(currentChar, 1); } else { map.put(currentChar, map.get(currentChar) + 1); } } for (Character name: map.keySet()){ String key = name.toString(); String value = map.get(name).toString(); System.out.println(key + " " + value); } } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/26244048
upvote count: 1
duplicate of: http://stackoverflow.com/q/13515845
type: AnsweredQuestion

http://stackoverflow.com/q/26289147
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/26291120
has title: Generic type invocation using string class names
answer count: 3
tagged with: generics
linked to: http://stackoverflow.com/q/7342035
favorite count: 0
tagged with: shapefile
tagged with: repast-simphony
has body: Hope you can help me with this: I have ... a string list of class names called classNameList a generic class Geography&lt;T&gt; a static generic method &lt;T&gt; void read(Class&lt;T&gt; cl, Geography&lt;T&gt; geo) I want to loop through the string class name list and call the generic method for each of these classes. What I tried but obviously did not work: for (int i = 0; i &lt; classNameList.length; i++) { Class&lt;?&gt; myClass = Class.forName(classNameList[i].getName()); Geography&lt;myClass.newInstance()&gt; geo; read(myClass, geo); } Error: myClass.newInstance cannot be resolved to a type My code runs perfectly for a single call of the generic function: Geography&lt;ExampleClass&gt; ExampleGeo; read(ExampleClass.class, ExampleGeo); Any ideas how I could do this? UPDATE: Thanks for the helpful input, still it's hard for me to adopt it to my real code. So this is the non simplyfied problem: I do ready in shapefile-Data with a shapefileLoader, for each feature of the Shapefile a class (GuadAgent) is initialized with a predifined class (PlantWind). I have shapefiles in my input-directory with the names of the Classes their features do represent. I want Java to read in the shapefiles and create the respective agent class. (the agents are also placed in a context and a geography..) Used classes are: ShapefileLoader, Geography, the other classes can be find at the same website This part is in the main-method: Geography&lt;GuadAgent&gt; guadGeography = GeographyFactoryFinder.createGeographyFactory(null).createGeography("guadGeography", context, new GeographyParameters&lt;GuadAgent&gt;()); Context&lt;GuadAgent&gt; context = new DefaultContext&lt;GuadAgent&gt;(); FileFilter filter = new FileFilter() { @Override public boolean accept(File file) { return file.getName().endsWith(".shp"); // return .shp files } }; String shapefileDir = System.getProperty("user.dir")+"\\input\\shp\\"; File folder = new File(shapefileDir); File[] listOfFiles = folder.listFiles(filter); for (…
has comment: http://stackoverflow.com/comment/41249651
has answer: http://stackoverflow.com/a/26290986
accepted answer: http://stackoverflow.com/a/26290986
has answer: http://stackoverflow.com/a/26291120
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26289401
downvote count: 0
tagged with: java
tagged with: geotools

http://stackoverflow.com/a/26345933
has comment: http://stackoverflow.com/comment/41356038
type: Answer
downvote count: 0
score: 1
has body: For this Regex will be your friend. Here's some working code to play with: String[] matches = input[0].split(" "); for (int i=0; i &lt;3; i++){ for(String s: matches){ if(given[i].contains(s)) System.out.println(given[i]); break; } } }
accepted answer of: http://stackoverflow.com/q/26345075
answers question: http://stackoverflow.com/q/26345075
has comment: http://stackoverflow.com/comment/41354025
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26312587
accepted answer: http://stackoverflow.com/a/26312605
has body: I want to pass a method to a method as an argument and I want to develop a system as follows. How can I develop it in java? Pseudo code: class A { public void test(Method method, Method method2) { if(Condition) { method.run(); } else { method2.run(); } } } class B { A a = new A(); a.test(foo(),bar()); public void foo() { print "hello"; } public void bar() { } }
type: AnsweredQuestion
tagged with: java
type: Question
has title: Pass method to method as an argument in Java
has answer: http://stackoverflow.com/a/26312754
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/26312732
has answer: http://stackoverflow.com/a/26312605
has answer: http://stackoverflow.com/a/26312732

http://stackoverflow.com/q/26216984
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26217125
has body: I have a search function in a class that searches through an array by a String(Department of work) and a count. In the main the program will ask the user what category does he/she wants to search for. Example: library ; the program should give all the books that are in that specific department (there is a function that lets the user add books) The problem is that the program only returns one book and not the all the books that are associated within that Category.
tagged with: java
has answer: http://stackoverflow.com/a/26217122
type: Question
accepted answer: http://stackoverflow.com/a/26217122
tagged with: indexing
has answer: http://stackoverflow.com/a/26217135
tagged with: search
has answer: http://stackoverflow.com/a/26217125
score: 0
answer count: 3
tagged with: arrays
has title: How to return multiple values within a search function(array) in Java
has comment: http://stackoverflow.com/comment/41115699

http://stackoverflow.com/comment/41827673
score: 0
type: Comment
type: QuestionComment
has text: Hi Stephane, I can confirm that this indeed works for integer or Long type works but not for BigDecimal (sample on the 3rd block of code of the OP)
comment on: http://stackoverflow.com/q/26234067

http://stackoverflow.com/comment/41095976
type: AnswerComment
score: 0
type: Comment
has text: @AnAmuser If you're involving proxies, then we may have a different story. You may want to ask another question with those details.
comment on: http://stackoverflow.com/a/26205519

http://stackoverflow.com/q/26261408
tagged with: java-stream
has answer: http://stackoverflow.com/a/26261900
tagged with: java-8
has title: How to collect X type objects from a stream, that contain only some fields of the same X type object, without using an auxiliary collection
type: Question
tagged with: collectors
tagged with: java
has body: An example: This permits to extract one field Collection&lt;X&gt; base=...; List&lt;?&gt; c=base.stream().map(-&gt;i.getField()).distinct.collect(Collectors.toList())); This requires an auxiliary collection Collection&lt;X&gt; fromBase; //empty collection Collection&lt;X&gt; base=...; List&lt;?&gt; c=base.stream().forEach(i-&gt;{ X k=...; //create object X with some fields fromBase.add(k); }); There is a way to extract more fields, like with .map(), directly ? Basic example: List&lt;X&gt; lst; private void collectDistinctItems(){ lst = new ArrayList&lt;&gt;(); getSomeItems().stream().forEach(i-&gt;{ //Collection&lt;X&gt; X tmp=new X(); tmp.setField1(i.getField1()); //copy some fields tmp.setField2(i.getField2()); tmp.setField3(i.getField3()); ... if(!lst.contains(tmp)) lst.add(tmp); //add new X item to X type list }); }
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26261900
type: AnsweredQuestion

http://stackoverflow.com/comment/41151458
comment on: http://stackoverflow.com/q/26235848
score: 0
type: Comment
type: QuestionComment
has text: okay, lemme just bring out the main code

http://stackoverflow.com/q/26268447
has body: I am struggling in "How to pass a Linked list as a function parameter" in java. This method is supposed to take another linked list as a parameter, and add the contents of this linked list to the calling instance's linked list. Adding the elements should only be done if the element does not already exist. All elements to be added should be added at the end of the linked list.
has title: How to pass a Linked list as a function parameter in java
favorite count: 0
has answer: http://stackoverflow.com/a/26268547
type: UnansweredQuestion
score: -3
upvote count: 1
has comment: http://stackoverflow.com/comment/41211443
tagged with: java
type: Question
downvote count: 4
answer count: 1
has comment: http://stackoverflow.com/comment/41211507

http://stackoverflow.com/q/26318146
has comment: http://stackoverflow.com/comment/41301902
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41302017
tagged with: return
has comment: http://stackoverflow.com/comment/41303559
upvote count: 2
has body: When working with recursion I realized I'm not sure how the return statement works. Does it stop and return true when target.contains(key) returns true or does it fall out and return false, because of the line below? Does the previous iterations of the method get finished so that it instead return false? The program creates passwords and this method is called to check that the password contains one of the required fields, such as upper case letters, symbols or numbers. It's called with 4 separate sources and they are then used to tell the program to keep the password or to create a new one if it doesn't meet the required standards. I've done this program for fun to refresh my memory of Java, it's not a real program that anyone will ever use. private static boolean containsKeyword(String target, String source, int placement){ String key = String.valueOf(source.charAt(placement)); if(target.contains(key)) return true; if(placement==0) return false; containsKeyword(target, source, placement-1); return false; }
has answer: http://stackoverflow.com/a/26318187
tagged with: recursion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41303086
tagged with: java
has comment: http://stackoverflow.com/comment/41301870
downvote count: 3
score: -1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41301941
possible better answer: http://stackoverflow.com/a/26318199
accepted answer: http://stackoverflow.com/a/26318187
has title: How does a return statement work in recursion?
has answer: http://stackoverflow.com/a/26318199
favorite count: 0

http://stackoverflow.com/q/26347961
answer count: 1
has comment: http://stackoverflow.com/comment/41357163
has answer: http://stackoverflow.com/a/26348496
type: UnansweredQuestion
has body: I am getting a NumberFormatException in my code. Can anyone suggest me how to overcome this? I am trying to add query based on a customer id. Customer id is join column in query table. When I click the add query link, I have to get the particular id automatically. @InitBinder public void initBinder1(WebDataBinder binder) { binder.registerCustomEditor(Customer.class,"customer", new PropertyEditorSupport() { @Override public void setAsText(String customer) { setValue(new Customer(Integer.parseInt(customer))); } }); } @RequestMapping(value="/addQuery.htm", method=RequestMethod.GET) public ModelAndView reportForm1(ModelMap model,HttpServletRequest request) { int id=Integer.parseInt(request.getParameter("id")); System.out.println(id); Queries query = new Queries(); Customer customer = new Customer(id); query.setCustomer(customer); model.addAttribute("queries", query); ModelAndView mav = new ModelAndView("addQuery"); return mav; } Here's the error I'm getting: Oct 14, 2014 12:25:32 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with path [/CustomerPortal] threw exception [Request processing failed; nested exception is java.lang.NumberFormatException: null] with root cause java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at com.axiscapstone.customer.web.CustomerController.reportForm1(CustomerController.java:86) 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)
has title: How to fix NumberFormatException in my controller?
has comment: http://stackoverflow.com/comment/41356977
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41357305
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41358262
has comment: http://stackoverflow.com/comment/41357027
has comment: http://stackoverflow.com/comment/41357518
has comment: http://stackoverflow.com/comment/41357441
score: 0
has comment: http://stackoverflow.com/comment/41357156

timer
tag name: timer
tags question: http://stackoverflow.com/q/26348103
tags question: http://stackoverflow.com/q/26315923
tags question: http://stackoverflow.com/q/26311470
tags question: http://stackoverflow.com/q/26283103
type: Tag
tags question: http://stackoverflow.com/q/26313957
tags question: http://stackoverflow.com/q/26292729
tags question: http://stackoverflow.com/q/26327535
tags question: http://stackoverflow.com/q/26217897
tags question: http://stackoverflow.com/q/26196272
tags question: http://stackoverflow.com/q/26298973
tags question: http://stackoverflow.com/q/26349657
tags question: http://stackoverflow.com/q/26344428

http://stackoverflow.com/q/26345628
has body: I'm using the apache CFX wsdl2java tool to convert a wsdl into java classes. The general set-up works fine, but I'm having trouble with this command: -p [ wsdl-namespace= ] PackageName The documentation says: Specifies zero, or more, package names to use for the generated code. Optionally specifies the WSDL namespace to package name mapping. However, it only works for a single package for me. The first command below works, the second and the third one doesn't. Did I mess up some syntax? 1) -p namespace1=com.name.webservices http://url-to-my-wsdl.com 2) -p namespace1=com.name.webservices com.name.common http://url-to-my-wsdl.com 3) -p namespace1=com.name.webservices namespaceforcommonobjects=com.name.common http://url-to-my-wsdl.com In the second example, I'm trying to put everything from namespace1 into package webservices, and all the rest into package common. In the third example I'm trying to put everything from namespace1 into package webservices, and everything from namespaceforcommonbojects into package common. I keep getting an exception in my console saying: "Unexpacted argument" and then the url to my wsld, except in example 1, which works fine but does not hve the output I desire...).
score: 0
tagged with: apache
tagged with: wsdl
answer count: 1
has answer: http://stackoverflow.com/a/26380829
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26380829
tagged with: web-services
has title: Generating java classes from wsdl using namespaces and multiple packages
type: Question
tagged with: java

http://stackoverflow.com/a/57745716
downvote count: 0
has comment: http://stackoverflow.com/comment/129046423
type: Answer
answers question: http://stackoverflow.com/q/26328040
has body: TL; DR; Put your resources in resources folder. Use them with one slash before their names: getClass().getResource("/myfont.ttf"); Long Story; If you are using Intellij IDEA and you created a Maven project, you should put your resources in resources folder (as marked as resource root by intellij itself) and these resource go to the root of your compiled app. I mean, /resources/myfont.ttf will go to /myfont.ttf in the resulting build. So you should get it via /myfont.ttf and not myfont.ttf. Use it like this: getClass().getResource("/myfont.ttf"); No need to change anything else. Just this one helped me.
score: 27
upvote count: 27

http://stackoverflow.com/comment/41209479
score: 1
comment on: http://stackoverflow.com/q/26267391
type: Comment
type: QuestionComment
has text: Did you try clearing out your memcached server?

http://stackoverflow.com/comment/41214988
type: Comment
comment on: http://stackoverflow.com/q/26270005
has text: @getlost I think Kacey wanted to do a `.contains('.')`, but it wouldn't work anyways since his input is an `int` and not a `string`.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41232207
type: Comment
comment on: http://stackoverflow.com/q/26278968
type: QuestionComment
score: 0
has text: @guido: I couldn't chnage the packaging to "rpm" as it gave error saying wrong packaging.. whereas with attached-rpm I got, [INFO] Processing files: ORG-generic_mediations-1.0-1.noarch [WARNING] error: No file attributes configured [WARNING] No file attributes configured

http://stackoverflow.com/q/26348488
has answer: http://stackoverflow.com/a/26348649
downvote count: 0
has comment: http://stackoverflow.com/comment/41358342
favorite count: 0
accepted answer: http://stackoverflow.com/a/26348649
possible better answer: http://stackoverflow.com/a/26348528
linked to: http://stackoverflow.com/q/2770321
has answer: http://stackoverflow.com/a/26348528
tagged with: generics
has body: I'm trying to make a Generic class where E extends Comparable E but I get a warning in Eclipse that says: LinkedList.Node is a raw type. References to generic type LinkedList E .Node E should be parameterized Here is the code: public class LinkedList&lt;E extends Comparable&lt;E&gt;&gt; { // reference to the head node. private Node head; private int listCount; // LinkedList constructor public void add(E data) // post: appends the specified element to the end of this list. { Node temp = new Node(data); Node current = head; // starting at the head node, crawl to the end of the list while(current.getNext() != null) { current = current.getNext(); } // the last node's "next" reference set to our new node current.setNext(temp); listCount++;// increment the number of elements variable } private class Node&lt;E extends Comparable&lt;E&gt;&gt; { // reference to the next node in the chain, Node next; // data carried by this node. // could be of any type you need. E data; // Node constructor public Node(E _data) { next = null; data = _data; } // another Node constructor if we want to // specify the node to point to. public Node(E _data, Node _next) { next = _next; data = _data; } // these methods should be self-explanatory public E getData() { return data; } public void setData(E _data) { data = _data; } public Node getNext() { return next; } public void setNext(Node _next) { next = _next; } } }
upvote count: 3
has title: Java Generics E extends Comparable<E> leaves warning
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41357918
answer count: 2

http://stackoverflow.com/comment/41394415
has text: Not sure which resource class you have in mind, but both the filter and the servlet see the request (doFilter(), doGet(), doPost(), service(), etc.).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26348187

http://stackoverflow.com/comment/41105177
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26211098
has text: I encountered the same problem, when i try to launch eclipse from GUI but it works when i launch eclipse from terminal.

http://stackoverflow.com/comment/41222741
has text: @NeilLunn I understood the first part to be related to single documents since it uses `findOne()` to see if the _id is there, insert it just containing the `_id` if it's not and then `.findAndModify` it with content. `uspert` is the operation that does this in one step so easier. Question 2 only relates to insert so the setting an `_id` for each document part shoud be the solution. Specified that again
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26274204
type: Comment

http://stackoverflow.com/a/26287280
downvote count: 0
has comment: http://stackoverflow.com/comment/41246253
type: Answer
has body: In Java it's pretty easy. public static int numberOfMatchingOnes(String a, String b) { BigInteger aNumber = new BigInteger(a, 16); BigInteger bNumber = new BigInteger(b, 16); return aNumber.xor(bNumber).bitCount(); } In C++ you might use a bitset. What you're looking for is called Hamming weight. If you really want to do it without BigInteger: Take 4 chars of both strings, convert them into an int, xor them and count the one-bits. Repeat until the strings end. public static int numberOfMatchingOnes(String a, String b) { if (a.length() != b.length() || a.length() % 4 != 0) { throw new IllegalArgumentException("invalid strings"); } int totalCount = 0; for (int i = (a.length()-1)/4; i &gt;= 0; i--) { int aValue = Integer.valueOf(a.substring(i * 4, i * 4 + 4), 16); int bValue = Integer.valueOf(b.substring(i * 4, i * 4 + 4), 16); totalCount += Integer.bitCount(aValue ^ bValue); } return totalCount; } You can look at the Java Sourcecode to see how bitCount() works.
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/26286901

http://stackoverflow.com/comment/41228880
type: QuestionComment
type: Comment
has text: Error is displayed by Eclipse and says 'foo cannot be resolved to a type'. It does not understand the full definition of the classe name
score: 0
comment on: http://stackoverflow.com/q/26278359

http://stackoverflow.com/a/26297837
has comment: http://stackoverflow.com/comment/41388205
answers question: http://stackoverflow.com/q/26297551
has comment: http://stackoverflow.com/comment/41288149
has body: I use the exact Python code and Java code you post, it seems work fine, may be something wrong with your environment? you can diagnosis the problem with following steps(assume you run your program in a linux box like me): 1.just run the python server script ./server.py 2.use netcat to see if the server is good for connect nc -zv localhost 8888 if things goes well, you may see connect established as expected. if not working, use netcat to build a tcp server listen on port 8888 nc -l -p 8888 and connect to it with your java program. you can also use netstat to distinguish if server.py works fine sudo netstat -ntlp | grep :8888
has comment: http://stackoverflow.com/comment/41274041
score: 0
type: Answer

http://stackoverflow.com/q/26226217
type: Question
has body: I am learning java ee related technologies (and I am relatively newbie) and try to write simple web application with Spring and Thymeleaf as frontend, and i have some problems with modularization. I found that it is used to pack .html filesinto WEB-INF directory for security purposes, but, as far as i guess, it means I have to put there all of my views, have controllers in this projects. I want to avoid that by having many projects for example: web-app admin-module user-module core-module and each of them has its own, module specific controllers and views (htmls) and web-app combines them all into single, big project. In Thymelaf i found something like ClassLoaderTemplateResolver and got (maybe stupid idea) how to divide big project into many ones - put htmls into classpath resource directory. By this I can ask for any html view from any module project. Does this violates some security reasons? I would like to ask does anyone has similar problem and found proper solution how to elegantly divide html web-app project into many smaller 'context-specific' projects? Here is my current project structure. Blue arrow idicates which view is connected to which controller: http://prntscr.com/4tqt9m This is my first question asked here so I hope you will treat me with some understanding. Thank you in advance.
tagged with: thymeleaf
score: 3
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/71215679
has comment: http://stackoverflow.com/comment/41139117
favorite count: 0
has title: Spring and thymeleaf with html as resources
tagged with: spring
has answer: http://stackoverflow.com/a/26227813
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26227813

http://stackoverflow.com/comment/41367081
type: Comment
has text: Thanks for the reply.Cant we have two different methods for this?we need to implement two separate methods.Is there a way to do this?Also we have different response for both the methods.
comment on: http://stackoverflow.com/a/26353480
score: 0
type: AnswerComment

http://stackoverflow.com/q/26336204
type: Question
has body: I'm using a simple JTextPane inside a JScrollPane to show my application's manual (simple HTML with a few pictures and a bunch of links), and can't find a way to scale this thing to make the application DPI-aware. I tried CSS, but nothing, then I tried overriding the paint method but it becomes impossible to click on things because they remain in their original position. Is there some way to zoom it?
has comment: http://stackoverflow.com/comment/41335417
has comment: http://stackoverflow.com/comment/41335514
has title: Zoom HTML in JTextPane
has comment: http://stackoverflow.com/comment/41335587
tagged with: zooming
has comment: http://stackoverflow.com/comment/41335461
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41335643
has comment: http://stackoverflow.com/comment/41335694
answer count: 0
score: 0
tagged with: java
tagged with: jtextpane
tagged with: swing
has comment: http://stackoverflow.com/comment/41336474

http://stackoverflow.com/q/26287137
has answer: http://stackoverflow.com/a/26287251
answer count: 4
has comment: http://stackoverflow.com/comment/41245824
linked to: http://stackoverflow.com/q/2545103
score: 1
has answer: http://stackoverflow.com/a/26287178
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41245803
has body: OK so this is my first post here. (Be kind to me :)) I'm like two weeks old to java and wanted to create an app that can do the jobs of a total, average and average grader. My question here is. How can I return to a specific line of code after one operation has ended Eg: I want the code to runString menu1="Input the number of the operation you desire "; after the total or average has been found. Thanks in advance import java.util.Scanner; public class grader { public static void main (String args[]) { Scanner input=new Scanner(System.in); System.out.println ("Input your Chemistry marks"); float a= input.nextFloat(); System.out.println ("Input your Biology marks"); float b= input.nextFloat(); System.out.println ("Input your Physics marks"); float c= input.nextFloat(); String menu1="Input the number of the operation you desire "; String op1="1. Total "; String op2="2. Average "; String op3="3. Grade "; String op4="4. Exit "; System.out.println (menu1+op1+op2+op3+op4); Scanner menuselect=new Scanner(System.in); int option= input.nextInt(); float tot=(a+b+c); float avg=((a+b+c)/3); if (option==1) System.out.println ("Your total is "+tot); else if (option==2) System.out.println ("Your average is "+avg); else if (option==3) if (avg&lt;0.0) System.out.println ("Please input proper data"); else if (avg&lt;=49.9) System.out.println ("Fail"); else if (avg&lt;=69.9) System.out.println ("Pass"); else if (avg&lt;=100.0) System.out.println ("Excellent"); else System.out.println ("Please input proper data"); } }
has answer: http://stackoverflow.com/a/37529750
has answer: http://stackoverflow.com/a/26287692
downvote count: 0
favorite count: 0
has title: How to return to a specific line of code in java
linked to: http://stackoverflow.com/q/2430782
type: UnansweredQuestion
tagged with: repeat

http://stackoverflow.com/q/26286550
tagged with: testng
has comment: http://stackoverflow.com/comment/41244789
answer count: 0
has comment: http://stackoverflow.com/comment/41244741
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/6540906
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41249680
has comment: http://stackoverflow.com/comment/41245973
has title: Connect to sqlite3 in Android Device
linked to: http://stackoverflow.com/q/9919148
score: 0
has body: I'm working on an android automation project, and I need to connect to the database inside the Android device here is my connection method: public static Connection getConnection() { String device= 10.172.5.99:5555/sdcard/company/database/dbName.sqlite3; Connection conn; try { Class.forName("org.sqlite.JDBC"); String dbURL = "jdbc:sqlite" + ":"+ device; conn = DriverManager.getConnection(dbURL); return conn; } catch (Exception ex) { ex.printStackTrace(); conn = null; } return null; } And it's not connecting to the db in the devices, it's searching it in the workspace. I'm new to this so any pointer would be great on what I'm doing wrong.
tagged with: sqlite

http://stackoverflow.com/comment/41109731
comment on: http://stackoverflow.com/a/26213795
type: Comment
has text: Little trick : this code appears in a `toString()` method. What if I would like to return something in the `finally` block ? Would the return in the `if` be discarded ? In any case, it wouldn't look clear to the reader...
type: AnswerComment
score: 0

http://stackoverflow.com/q/26302517
favorite count: 0
has comment: http://stackoverflow.com/comment/41273527
tagged with: mouse
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26302775
has body: I want to program a bot for minecraft that automatically collects items. But I have a problem to move the mouse in the game. The movement acts strange... it is jumping around at the x and y coordination even if I only add 1 to the y coordinate. The movment acts like this in every 3D game not only in minecraft. For the movement I use the integreated robot class. Here is the snipped I use for the mouse movement: public static void main(String[] args) { try { Robot bot = new Robot(); Point mouseposition = MouseInfo.getPointerInfo().getLocation(); int x = mouseposition.x; int y = mouseposition.y; //used to switch to the game window bot.delay(5000); y += 1; bot.mouseMove(x, y); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } What I was expecting with this code was, that the course just move one pixel down. The cursor is moving fine if I am on the desktop! System: os: Windows 8.1 arch: amd64 javaversion: 1.7.0_67 ide: eclipse luna
upvote count: 2
has title: What is the right way to move the mouse in a game?
has answer: http://stackoverflow.com/a/26302775
answer count: 1
has comment: http://stackoverflow.com/comment/41273554

http://stackoverflow.com/comment/41190072
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26251999
score: 0
has text: Your title is misleading, if you download a file from a web server then it is not relevant for its use wherther the server is tomcat or whatsoever and what server it is aa web app or whatsoever. The server just sends the file to the client. Assuming it does it correctly. The file should do what it should. If it is an exe and it has a GUI then it should show it up, assuming the client's OS can run it. Does the program run on the same machine you download it on it word if copied there manually? How does your web app serve the file?

pdf-parsing
type: Tag
tags question: http://stackoverflow.com/q/26351052
tag name: pdf-parsing

http://stackoverflow.com/comment/41275593
score: 0
has text: What is "a static reference to a non-static method"?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26303569

http://stackoverflow.com/q/26228495
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26228822
tagged with: accessor
has answer: http://stackoverflow.com/a/26228556
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/41138098
has comment: http://stackoverflow.com/comment/41138068
type: Question
has comment: http://stackoverflow.com/comment/41138043
tagged with: mutators
downvote count: 5
has body: The following are the instructions and code for a Java program I have to complete. I am stuck and do not know how to continue. I'm trying to figure this out. I feel like I have no idea what I'm doing. All help, direction, and explanation would be very much appreciated. Write a class named Car that has the following fields: yearModel: The yearModel field is an int that holds the car’s year model. make: The make field references a String object that holds the make of the car. speed: The speed field is an int that holds the car’s current speed. In addition, the class should have the following constructor and other methods: Constructors: One constructor should accept the car's year model, make, and speed as arguments. These values should be assigned to the object's yearModel, make, and speed fields. Another constructor will have no arguments and will assign 0 as the car's year model and speed and an empty string ("") as the make. Accessors: Appropriate accessor methods should get the values stored in an object's yearModel, make, and speed fields. Mutators: Appropriate mutator methods should store values in an object's yearModel, make, and speed fields. accelerate: The accelerate method should add 5 to the speed field each time it is called. brake: The brake method should subtract 5 from the speed field each time it is called. Demonstrate the class in a program that asks the user to input data and then creates a Car object. It then calls the accelerate method five times. After each call to the accelerate method, get the current speed of the car and display it. Then call the brake method five times. After each call to the brake method, get the current speed of the car and display it. The output from running this program will appear similar to: Enter the car's year model: 1965 Enter the car's make: Mustang Enter the car's speed: 30 Current status of the car: Year model: 1965 Make: Mustang Speed: 30 Accelerating... Now the speed is 35 Accelerating... Now the speed is 40 Acc…
has answer: http://stackoverflow.com/a/26228672
has title: Constructor and no-argument constructor?
has comment: http://stackoverflow.com/comment/41138040
upvote count: 1
favorite count: 0
tagged with: constructor
accepted answer: http://stackoverflow.com/a/26228556
has answer: http://stackoverflow.com/a/26228984
possible better answer: http://stackoverflow.com/a/26228672

http://stackoverflow.com/comment/41364024
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26351275
type: Comment
has text: Well, at least you know it works now! (: Check this as the answer, too!

http://stackoverflow.com/a/26233608
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26233529
has body: You can't use ts.toString(), you always need to use the same formatter. Use just: Timestamp ts = new Timestamp(new Date().getTime()); SimpleDateFormat format = new SimpleDateFormat("dd MMM YYY, HH:mm"); System.out.println(format.format(ts));

http://stackoverflow.com/a/26292403
has body: After returning the method the line after return statement will not reachable compiler always assumes that return is the end point of execution of any type of block of code or method
answers question: http://stackoverflow.com/q/26292262
upvote count: 2
type: Answer
downvote count: 1
score: 1

http://stackoverflow.com/comment/41335020
comment on: http://stackoverflow.com/q/26329901
score: 0
type: Comment
type: QuestionComment
has text: why have you got JPA API 1.0.2 (javax.persistence persistence-api) and JPA API 2.1.0 (org.eclipse.persistence javax.persistence) in the CLASSPATH at the same time? Make your mind which version of JPA is being used

http://stackoverflow.com/comment/41200779
comment on: http://stackoverflow.com/q/26252703
score: 0
has text: Sorry for the late reply. @o11c its for security reasons.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41080778
type: Comment
type: QuestionComment
has text: definitely you can create. If you are using Netbeans then you should create new file -> `Standard Deployment Descriptor` found in `web` section. this way netbeans will do necessary work for you.
comment on: http://stackoverflow.com/q/26197889
score: 0

http://stackoverflow.com/q/26253670
type: AnsweredQuestion
has body: I am working on eclipse plugin. I create an extension point on eclipse plugin. I've added a dropdown list. So I implemented a listener to know when the value changed and execute my logic. Here the snippet of the extension point : <propertyTab label="My new Label" category="Core" afterTab="modeleditor.property.tab.AdvancedTab" id="com.test.plugin.tabs.MyNewTab"/> import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; import org.eclipse.uml2.uml.Enumeration; import org.eclipse.uml2.uml.NamedElement; public class MyNewTabSection extends SuperSection{ private ComboViewer comboViewer; private ISelectionChangedListener comboViewerSelectionListener; private Label myLabel; private final static List<String> myValues = new ArrayList<String>(Arrays.asList("FIRST","TWO","THREE")); public static class Filter extends AbstractFilter{ public Filter() { super(); } } @Override public void createControls(Composite parent,TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent,tabbedPropertySheetPage); addLabel(); addComboViewer(); @Override protected void addListeners() { comboViewer.addSelectionChangedListener(getComboViewerSelectionListener()); } @Override protected void removeListeners() { comboViewer.removeSelectionChange…
tagged with: java
tagged with: swt
type: Question
accepted answer: http://stackoverflow.com/a/26256877
has comment: http://stackoverflow.com/comment/41183764
has title: Eclipse SWT java.lang.StackOverflowError : why my listener executes many times?
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/26256877
answer count: 1
tagged with: swt-awt
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/41183940

http://stackoverflow.com/a/26316693
score: -1
has comment: http://stackoverflow.com/comment/41299215
upvote count: 0
has body: You have placed your code directly in the class. You need to put your code in a method.
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/26316675

http://stackoverflow.com/a/26244951
has comment: http://stackoverflow.com/comment/41168598
score: 0
type: AcceptedAnswer
has body: This code is using u to represent a set of integers. Each bit in u's binary representation tells you if the corresponding element is in the set. For example, to check if 3 is in the set, check if `u&amp;(1&lt;&lt;3) != 0' (that is, if bit number 3 is set). By iterating from 0 to upLasers - 1 it's essentially iterating through all possible sets of integers from 0 to laserNo. This code could have used BitSet instead, though the iteration would become much more complicated (you'd essentially end up emulating a binary increment). Performance and instructional value are possible other reasons why it was done this way.
type: Answer
accepted answer of: http://stackoverflow.com/q/26244877
answers question: http://stackoverflow.com/q/26244877

junit
tags question: http://stackoverflow.com/q/26273526
type: Tag
tags question: http://stackoverflow.com/q/26306902
tags question: http://stackoverflow.com/q/26261212
tags question: http://stackoverflow.com/q/26293423
tags question: http://stackoverflow.com/q/26276091
tags question: http://stackoverflow.com/q/26252672
tags question: http://stackoverflow.com/q/26262184
tags question: http://stackoverflow.com/q/26288291
tags question: http://stackoverflow.com/q/26298430
tags question: http://stackoverflow.com/q/26300945
tags question: http://stackoverflow.com/q/26345274
tags question: http://stackoverflow.com/q/26320127
tags question: http://stackoverflow.com/q/26253900
tags question: http://stackoverflow.com/q/26198875
tags question: http://stackoverflow.com/q/26284341
tags question: http://stackoverflow.com/q/26226472
tags question: http://stackoverflow.com/q/26246668
tag name: junit
tags question: http://stackoverflow.com/q/26341563
tags question: http://stackoverflow.com/q/26342874
tags question: http://stackoverflow.com/q/26257635
tags question: http://stackoverflow.com/q/26274786
tags question: http://stackoverflow.com/q/26221769
tags question: http://stackoverflow.com/q/26234742
tags question: http://stackoverflow.com/q/26208381
tags question: http://stackoverflow.com/q/26293749
tags question: http://stackoverflow.com/q/26332464
tags question: http://stackoverflow.com/q/26249435
tags question: http://stackoverflow.com/q/26217434
tags question: http://stackoverflow.com/q/26282385
tags question: http://stackoverflow.com/q/26340385
tags question: http://stackoverflow.com/q/26201432
tags question: http://stackoverflow.com/q/26244653
tags question: http://stackoverflow.com/q/26239192
tags question: http://stackoverflow.com/q/26201709
tags question: http://stackoverflow.com/q/26320540
tags question: http://stackoverflow.com/q/26266518
tags question: http://stackoverflow.com/q/26229954
tags question: http://stackoverflow.com/q/26236419
tags question: http://stackoverflow.com/q/26201389
tags question: http://stackoverflow.com/q/26216122
tags question: http://stackoverflow.com/q/26343967
tags question: http://stackoverflow.com/q/26208654
tags question: http://stackoverflow.com/q/26329883
tags question: http://stackoverflow.com/q/26265761
tags question: http://stackoverflow.com/q/26260604
tags question: http://stackoverflow.com/q/26338982

http://stackoverflow.com/a/26297281
answers question: http://stackoverflow.com/q/26297193
score: 0
has body: You can't connect mysql database with android. You can use webservices to call database. Some examples for webservices are SOAP and RESTFUL. You can use either one of the to call db. Refer the following example to call webservice: http://programmerguru.com/android-tutorial/android-restful-webservice-tutorial-how-to-call-restful-webservice-in-android-part-3/ You can use SQL Lite to make mini db in andorid. Google on SQL Lite to get more details.
type: Answer

http://stackoverflow.com/q/26297235
tagged with: java
score: -1
type: Question
has body: I am struggling with following error when I try to invoke fragment layout. Here is the code. MainActivity; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void showFragOne(View view){ FragmentManager FM = getFragmentManager(); FragmentTransaction FT = FM.beginTransaction(); FT.add(R.layout.frag_one, new FragOne()); FT.commit(); } } showFragOne is called when button click on ativity_main layout. frag_one is layout for FragOne Fragment Fragment Class; public class FragOne extends Fragment{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view = inflater.inflate(R.layout.frag_one, container, false); return view; } } Please help me in resolving this.
favorite count: 0
tagged with: android
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26297262
accepted answer: http://stackoverflow.com/a/26297262
upvote count: 0
has title: No view found for id ... for fragment (Android application)
type: AnsweredQuestion
tagged with: android-fragments

eclipse-plugin
tags question: http://stackoverflow.com/q/26253670
tags question: http://stackoverflow.com/q/26331823
tags question: http://stackoverflow.com/q/26338582
tags question: http://stackoverflow.com/q/26292933
type: Tag
tags question: http://stackoverflow.com/q/26341959
tags question: http://stackoverflow.com/q/26272705
tags question: http://stackoverflow.com/q/26222834
tags question: http://stackoverflow.com/q/26242371
tags question: http://stackoverflow.com/q/26331615
tags question: http://stackoverflow.com/q/26235880
tags question: http://stackoverflow.com/q/26259552
tags question: http://stackoverflow.com/q/26233155
tags question: http://stackoverflow.com/q/26235845
tags question: http://stackoverflow.com/q/26229174
tags question: http://stackoverflow.com/q/26216673
tags question: http://stackoverflow.com/q/26337852
tags question: http://stackoverflow.com/q/26340501
tags question: http://stackoverflow.com/q/26203175
tags question: http://stackoverflow.com/q/26279248
tags question: http://stackoverflow.com/q/26347934
tags question: http://stackoverflow.com/q/26216142
tags question: http://stackoverflow.com/q/26335659
tags question: http://stackoverflow.com/q/26292021
tags question: http://stackoverflow.com/q/26344710
tags question: http://stackoverflow.com/q/26213457
tags question: http://stackoverflow.com/q/26199822
tag name: eclipse-plugin

http://stackoverflow.com/comment/41140067
has text: You never instantiated the model value. It seems you want to return the Player object itself. But that is completely contradictory to polymorphism to do that kind of thing. Do you have a use case for what you are tyring to do?
comment on: http://stackoverflow.com/a/26223785
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41202309
type: QuestionComment
has text: Is it intentional that Command is an inner class?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26263624

http://stackoverflow.com/a/26204364
has comment: http://stackoverflow.com/comment/41093488
answers question: http://stackoverflow.com/q/26204289
has comment: http://stackoverflow.com/comment/41092993
has comment: http://stackoverflow.com/comment/41092654
has comment: http://stackoverflow.com/comment/41092752
score: 0
has body: Carefully read your output: First Method: E:\Project%20Eclipse\Workspace\FileOperation\bin\FileOperaton\files\boom.txt Second Method: E:\Project Eclipse\Workspace\FileOperation\src\FileOperaton\files\boom.txt One time you have the file in the src folder, one time in the bin folder. I would recommend to make a third folder res and store it there (E:\Project Eclipse\Workspace\FileOperation\res\boom.txt) and the load it like this: public static URL getFile (String filename) { return MyTextPanel.class.getClassLoader().getResource(filename); }
has comment: http://stackoverflow.com/comment/41095147
type: Answer

http://stackoverflow.com/a/26273994
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: This is generally frowned upon in Java for many reasons but if you really need to achieve complete removal your best bet is to use a static final boolean. public static final boolean Debug = false; public void test() { if ( Debug ) { // Debug stuff here - usually will not be included in the .class file if Debug is false. } } This usually (but it is not guaranteed anywhere as far as I know) completely removes the enclosed code. The alternative is to use some form of late-binding mechanism to dynamically load the debugging classes while leaving an empty stub for your release code.
accepted answer of: http://stackoverflow.com/q/26273803
answers question: http://stackoverflow.com/q/26273803

http://stackoverflow.com/q/26284154
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/41240101
accepted answer: http://stackoverflow.com/a/26284274
has comment: http://stackoverflow.com/comment/41240117
has comment: http://stackoverflow.com/comment/41240019
score: 0
has body: This is the operation i am trying to do. I get the error "bad operand types for binary operator "*". How do i pass this calcualtion? Can somone show me an example of how to do this? Note that day[i] has all its values already in it.
has answer: http://stackoverflow.com/a/26284274
has comment: http://stackoverflow.com/comment/41240139
has title: Java - How to perform operations on a value in an array?
has comment: http://stackoverflow.com/comment/41240034
has comment: http://stackoverflow.com/comment/41243349
has comment: http://stackoverflow.com/comment/41240122
has comment: http://stackoverflow.com/comment/41240024
has comment: http://stackoverflow.com/comment/41239964
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41239981
tagged with: java
has comment: http://stackoverflow.com/comment/41240109

http://stackoverflow.com/comment/41307360
comment on: http://stackoverflow.com/a/26319985
type: Comment
has text: Remember, what you are seeing on the screen is nothing more than a bitmap, the "layers" or virtualized only, so it's not possible to have `Robot` capture anything other than what's active on the screen, as the functionality is depended on the underlying OS anyway. Without known exactly what is you hope to achieve, it's hard to make a suggestion. What I have done in the past in captured the entire desktop and painted it to a very large, borderless, window and "faked" the selection from there
score: 0
type: AnswerComment

http://stackoverflow.com/q/26206050
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/26224206
type: Question
tagged with: gwt
tagged with: java
has body: I'm using Objectify 5.0.5, Objectify-GWT 1.2, GWT 2.6.1 and App Engine SDK 1.9.10. I'm trying to do some very basic stuff with GAE, GWT and Objectify. I've done some things in GAE before and now I thought I should see if I can speed up production a bit by using Objectify but I'm climbing hurdle after hurdle. I'm not sure if I'm doing something wrong or if there's a bug in the library. So here's my problem in general: I'm trying to use Ref.create(someEntity) on the client-side in GWT but it fails and prints: Invalid type signature for com.googlecode.objectify.impl.ref.DeadRef I've got the following entities/models: @Entity public class Persistable implements Serializable{ private static final long serialVersionUID = 7733004846243513450L; @Id Long id; public Persistable() {} public void setId(Long id) { this.id = id; } public Long getId() { return id; } public void persist() { //This is actually a "remote service" and the only thing it does is call: //ofy().save().entity(entity); PPServices.getBasicService().persist(this, new AsyncCallback&lt;Void&gt;() { @Override public void onFailure(Throwable caught) {} @Override public void onSuccess(Void result) {} }); } } @Subclass public class Event extends Persistable{ private static final long serialVersionUID = 1L; Ref&lt;PPUser&gt; host = null; public Event(){} public void setHost(PPUser participant) { host = Ref.create(participant); } } @Subclass public class PPUser extends Persistable{ private static final long serialVersionUID = 1L; public PPUser(){} } And I use them as following: public class EntryStuff implements EntryPoint{ public void onModuleLoad() { final Event event = new Event(); final PPUser user1 = new PPUser(); event.setHost(user1); event.persist(); } I can't see what's wrong. Even if I manually give user1 an ID it won't make any difference at all. Am I forced to set the host-field on the Server-side or what? In JDO I just create a new instance of PPUser and assign it and then persist/save the entity (in this…
answer count: 2
upvote count: 1
favorite count: 0
tagged with: objectify
tagged with: google-app-engine
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26224206
has title: Using Ref.create() on the client-side results in errors
has answer: http://stackoverflow.com/a/26208094
accepted answer: http://stackoverflow.com/a/26208094

http://stackoverflow.com/comment/41324442
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26330253
type: AnswerComment
has text: The difference is, `start()` is the method that the library provides for you to call when you want to start a new thread. `run()` is the method that _you_ provide for the library to call _in_ the new thread.

http://stackoverflow.com/a/26269856
answers question: http://stackoverflow.com/q/26269776
score: 3
upvote count: 3
downvote count: 0
has body: That is a very unfortunate and odd way of passing the arguments, but anyway, to make it work, you can do: @SuppressWarnings("unchecked") ArrayList&lt;Team&gt; team1 = (ArrayList&lt;Team&gt;)collections[0]; @SuppressWarnings("unchecked") ArrayList&lt;Team&gt; team2 = (ArrayList&lt;Team&gt;)collections[1]; Your existing code was taking each ArrayList, putting it into a one element array, wrapping that array as a list, creating an ArrayList from it, and trying to view the ArrayList&lt;ArrayList&lt;Team&gt;&gt; as an ArrayList&lt;Team&gt;. A few other things I see... you don't need to assign these to variables if you're only using them to add to the list: Team a = new Team("Boston"); ... teamList1.add(a); You can simply do: teamList1.add(new Team("Boston")); You don't need to create the listCollection array separately, because you can create it inline when passing the arguments: findCommonElements(new Object[] { teamList1, teamList2 }); In your Team class, this: String teamName = new String(); Should simply be: String teamName; In your compareTo method: public int compareTo(Team x) { if(this.teamName.equals(x.teamName)) { return 0; } else { return -1; } } That should be: public int compareTo(Team x) { return teamName.compareTo(x.teamName); } which is shorter, and honors the compareTo requirement that sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y.
type: Answer

http://stackoverflow.com/q/26352799
tagged with: java
has comment: http://stackoverflow.com/comment/41365354
type: Question
answer count: 2
score: -2
tagged with: javascript
tagged with: string
possible better answer: http://stackoverflow.com/a/26352895
downvote count: 2
has body: String MonthName = "" ; String DateName = "" ; String sign = "" ; String horoscope = "" ; Scanner scan = new Scanner(System.in); System.out.println("Please enter your month of birth as an integer: "); int month= scan.nextInt(); System.out.println(" "); System.out.println("Please enter your date of birth as an integer: "); int date = scan.nextInt(); System.out.println(" "); if (month == 1) { MonthName = "January"; } else if (month == 2) { MonthName = "February"; } else if (month == 3) { MonthName = "March"; } else if (month == 4) { MonthName = "April"; } else if (month == 5) { MonthName = "May" ; } else if (month == 6) { MonthName = "June" ; } else if (month == 7) { MonthName = "July" ; } else if (month == 8) { MonthName = "August" ; } else if (month == 9) { MonthName = "September" ; } else if (month == 10) { MonthName = "October" ; } else if (month == 11) { MonthName = "November" ; } else if (month == 12) { MonthName = "December" ; } if (date == 1) { DateName = "first"; } else if (date == 2) { DateName = "second" ; } else if (date == 3) { DateName = "third" ; } else if (date == 4) { DateName = "fourth" ; } else if (date == 5) { DateName = "fifth" ; } else if (date == 6) { DateName = "sixth" ; } else if (date == 7) { DateName = "seventh" ; } else if (date == 8) { DateName = "eighth" ; } else if (date == 9) { DateName = "nineth" ; } else if (date == 10) { DateName = "tenth"; } else if (date == 11) { DateName = "eleventh"; } else if (date == 12) { DateName = "twelfth"; } else if (date == 13) { DateName = "thirteenth"; } else if (date == 14) { DateName = "fourteenth"; } else if (date == 15) { DateName = "fifteenth" ; } else if (date == 16) { DateName = "sixteenth" ; } else if (date == 17) { DateName = "seventeenth" ; } else if (date == 18) { DateName = "eighteenth" ; } else if (date == 19) { DateName = "nineteenth"; } else if (date == 20) { DateName = "twentieth"; } else if (date == 21) { DateName = "twentyfirst"; } else if (date == 22) { DateName = "twentysecond"; } el…
favorite count: 0
has answer: http://stackoverflow.com/a/26352895
has title: For every single birth day, it types "Thirtyfirst" and says "DateName" is unused?
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/26352837
accepted answer: http://stackoverflow.com/a/26352837

http://stackoverflow.com/a/26331422
answers question: http://stackoverflow.com/q/26308476
has body: Here is my two cents. As I have said earlier: "You should use a border layout and add the buttons to a panel, and then add said panel to the main frame then add the image panel to the center." import java.awt.*; import java.io.IOException; import java.util.Arrays; import java.util.List; import javax.swing.*; @SuppressWarnings("serial") public class HistogramEqualizerApp extends JFrame { private ButtonPanel buttonPanel; private ImagePanel imagePanel; private JButton increaseContrastButton; private JButton decreaseContrastButton; private BufferedImage image; public HistgramEqualizerApp() { Container content = this.getContentPane(); content.setLayout(new BorderLayout()); // Buttons for contrast control increaseContrastButton = new JButton("&gt;&gt;"); decreaseContrastButton = new JButton("&lt;&lt;"); buttonPanel = new ButtonPanel( Arrays.asList(decreaseContrastButton, increaseContrastButton)); content.add(buttonPanel, BorderLayout.NORTH); image = randomImage(80, 120, 4); imagePanel = new ImagePanel(image); content.add(imagePanel, BorderLayout.CENTER); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(512, 400); this.setResizable(true); } public static void main(String args[]) throws IOException { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { HistgramEqualizerApp histApp = new HistgramEqualizerApp(); histApp.setVisible(true); } }); } static class ImagePanel extends JPanel { private BufferedImage image; public ImagePanel(BufferedImage image) { this.image = image; } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), this); } } static class ButtonPanel extends JPanel { private List&lt;JButton&gt; buttons; public ButtonPanel(List&lt;JButton&gt; buttons) { this.setLayout(new FlowLayout()); this.buttons = buttons; for (JButton button : buttons) { this.add(button); } } } public static BufferedImage randomImage(int rows, int cols, int pixelRatio) { …
score: 0
type: Answer

http://stackoverflow.com/comment/41112534
type: QuestionComment
score: 0
has text: You could try the below answer from Shastry's post
comment on: http://stackoverflow.com/q/26211965
type: Comment

http://stackoverflow.com/a/26209211
upvote count: 1
has comment: http://stackoverflow.com/comment/41101388
accepted answer of: http://stackoverflow.com/q/26208951
has comment: http://stackoverflow.com/comment/41101364
has comment: http://stackoverflow.com/comment/41101343
type: AcceptedAnswer
downvote count: 0
has body: Consider for example your setGreen method: public void setGreen(int value) { pixel = (pixel &amp; ~(0xFF00FF00)) &lt;&lt; 8; pixel = (value &lt;&lt; 8) | pixel; } Initially, your pixel is AARRGGBB. First, you are setting the GG part in the current value of pixel to 0 correctly (ignoring alpha for now). (pixel &amp; ~(0xFF00FF00)) == (AARRGGBB &amp; 0x00FF00FF) == 00RR00BB. However, next you shift that value 8 bits to the left, so you get RR00BB00. Next, you are (correctly) left-shifting the green value you got as a parameter. You'll get (000000GG &lt;&lt; 8) == 0000GG00. And finally, you are or'ing that with the value from before: (RR00BB00 | 0000GG00) == RR00XX00 where the Xes are some garbage that originate from or'ing together the old blue with the new green bits. Can you see what to fix? There is another issue in the setBlue method. (pixel &amp; ~(0xFFFFFF00)) == (AARRGGBB &amp; 000000FF) == 000000BB. Compare that with the (correct) mask for setGreen above. Finally, your methods seem to be supposed to handle invalid values (–1, 500, 1000) gracefully. So you should set all but the last 8 bits of your arguments to 0. I'm only suggesting that because your required output seems to ask for that. In a well-written Java program, it would b better to throw an exception if out-of-range values are passed, rather than silently ignoring the invalid bits. Alternatively, you could change your methods to accept a byte instead of an int. This would be the best solution since now it would be outright impossible to pass an invalid argument. Putting this together, here is how it could work. I have also polished the code a little so we can hopefully see more easily what is going on. The shifts by 0 bits are of course useless but I include them for optical reasons. public final class Pixel { private int value; public Pixel (int rgb) { this.value = value; } public int getRed() { return (this.value &gt;&gt; 16) &amp; 0xFF; } public int getGreen() { return (this.value &gt;&gt; 8) &amp;…
has comment: http://stackoverflow.com/comment/41101379
answers question: http://stackoverflow.com/q/26208951
has comment: http://stackoverflow.com/comment/41102029
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41101410

http://stackoverflow.com/comment/41129857
has text: But why can't I pass `ConcurrentLinkedQueue<Integer>.class`? `ConcurrentLinkedQueue<Integer>` dose implement `Queue<Integer>`, like Foo in your example.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26224091
type: Comment

http://stackoverflow.com/comment/41226065
type: Comment
type: QuestionComment
score: 0
has text: @biziclop you check that i is 12 at the end. To do that you need to add all your threads to an array before they are started and then join on all the threads to wait until they complete.
comment on: http://stackoverflow.com/q/26244778

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/26254259
type: Tag

http://stackoverflow.com/comment/41339329
type: AnswerComment
has text: Without the extra 0, I get $8.30.00
type: Comment
comment on: http://stackoverflow.com/a/26338348
score: 1

http://stackoverflow.com/comment/41205464
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26264134
type: QuestionComment
has text: I would ask if your class TimerClass is tested. Also, keep in mind that `editor.commit();` returns true if saved successfully and false otherwise, you might want to check that.

http://stackoverflow.com/comment/41194493
has text: 100,000 is NOT very large... it's rather normal. It's probably just that you're doing strange things with it. You'd better ask what you [really need](http://meta.stackexchange.com/q/66377/155925) as saying that Set is faster than List just makes no sense.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26253678

http://stackoverflow.com/comment/41171227
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26246308
score: 0
has text: For this specific scenario if you want to have a GUI you do not need to use scanner, just have a look at JOptionPane. http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html

http://stackoverflow.com/a/26246728
answers question: http://stackoverflow.com/q/26246711
upvote count: 6
has body: The next() method in the Scanner returns the next token, tokenized by a delimieter which is by default whitespace. A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace. The resulting tokens may then be converted into values of different types using the various next methods. So input is only "Hello". Use the nextLine() method to get the whole line instead. input = in.nextLine();
type: Answer
has comment: http://stackoverflow.com/comment/41171869
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/41171772

http://stackoverflow.com/comment/41373405
type: Comment
comment on: http://stackoverflow.com/a/26348618
has text: Check the stacktrace, the line number, and check when the models are created, set and gotten. Probably does not happen in right order. Alternatively you could make a tab separated file, with Excel extension .xls and call `Desktop.getDesktop().open(file)` Or even `print`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41416772
type: AnswerComment
comment on: http://stackoverflow.com/a/26375967
type: Comment
has text: The compiler infers the parameter type as being the same as specified in the reference type when provided with an empty set of brackets. I could of course try this without using a generic type, but I think you might be missing the essence of the question.
score: 1

http://stackoverflow.com/comment/41393029
comment on: http://stackoverflow.com/a/26224726
type: AnswerComment
score: 0
type: Comment
has text: Thank you so much, this has fixed the problem.

http://stackoverflow.com/a/26231220
type: Answer
accepted answer of: http://stackoverflow.com/q/26230811
upvote count: 4
score: 2
answers question: http://stackoverflow.com/q/26230811
has comment: http://stackoverflow.com/comment/81378891
has comment: http://stackoverflow.com/comment/41513380
downvote count: 2
has body: No it is not possible. See the Javadoc.
has comment: http://stackoverflow.com/comment/41142610
type: AcceptedAnswer

http://stackoverflow.com/comment/41347039
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26342470
type: Comment
has text: Thanks. I'm sure that will work. I tried this. But I really want to put individual and organization into searchBO, in the controller I have SearchBO type, Spring can just convert JSON to Java object automatically.

http://stackoverflow.com/comment/48169776
has text: Thank you @Theyouthis. I fixed the link in my answer
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26275593
type: Comment

http://stackoverflow.com/comment/41179030
comment on: http://stackoverflow.com/q/26250321
score: 0
type: QuestionComment
has text: I answered, then deleted after re-reading your question. Are you looking for a way to describe the steps, return objects and calls using common types?
type: Comment

http://stackoverflow.com/comment/41350909
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26344640
has text: What's your question? What is the context? What have you done, in what situation do you encounter this? Details, please.
score: 0

http://stackoverflow.com/a/26302775
score: 2
upvote count: 2
has body: You're capturing the mouse location before you switch to the game window, so when you add 1 to the y coordinate, you're actually adding 1 to where the mouse was before you moved it to switch to the game window. Put the delay before the Point mouseposition = MouseInfo.getPointerInfo().getLocation(); line instead.
has comment: http://stackoverflow.com/comment/41274072
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26302517
type: Answer
accepted answer of: http://stackoverflow.com/q/26302517

http://stackoverflow.com/comment/117997670
has text: @Jorn and finally this is supported in [a native way](https://stackoverflow.com/a/66751950/1059372)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/49730826

http://stackoverflow.com/comment/41330332
has text: Please add the code of your LoginServlet class. Is it in a package?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26333354
score: 1

http://stackoverflow.com/comment/41142540
type: Comment
type: QuestionComment
has text: Hi User html parser and get all text from html and count no of words. U can see jsoup parser
comment on: http://stackoverflow.com/q/26230707
score: 0

http://stackoverflow.com/comment/41199774
comment on: http://stackoverflow.com/q/26262247
type: QuestionComment
type: Comment
has text: @Zhuinden I have added the rest of my code.
score: 0

http://stackoverflow.com/comment/41180611
score: 2
has text: If you are sure this constructor is being called, you should verify that you are not nullifying `currentSelections` anywhere else in your class.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26251703

http://stackoverflow.com/comment/41208372
type: Comment
comment on: http://stackoverflow.com/a/26266646
has text: At least in openjdk 8 it is not http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/io/FileOutputStream.java#FileOutputStream
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41268182
comment on: http://stackoverflow.com/q/26299623
has text: @newbie2314 The comment from TheLostMind is actually a great answer to your question.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41301691
comment on: http://stackoverflow.com/q/26317665
type: Comment
type: QuestionComment
score: 0
has text: This kind of triangle? http://en.wikipedia.org/wiki/Triangle-free_graph

http://stackoverflow.com/q/26247428
downvote count: 0
has comment: http://stackoverflow.com/comment/41172990
has comment: http://stackoverflow.com/comment/41173284
has comment: http://stackoverflow.com/comment/41173059
has comment: http://stackoverflow.com/comment/41173787
has body: At my university, if we want to program on our personal computers we connect to the main computer lab using a program called "PuTTY". This would be fine, however, programming a graphics program requires permission to open a new window so our website states just to use Command Prompt to run the program and it should work. When I run it, I get the same error message as I do on PuTTY how do I fix this? Here is the error code Exception in thread "main" java.lang.NoClassDefFoundError: DrawingPanel$1 at DrawingPanel.&lt;init&gt;(DrawingPanel.java:300) at Mini2Driver.main(Mini2Driver.java:19) Caused by: java.lang.ClassNotFoundException: DrawingPanel$1 at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 2 more Thanks please let me know if you need anymore information
has comment: http://stackoverflow.com/comment/41176740
favorite count: 0
has title: running a java graphics program with command prompt
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41176718
has comment: http://stackoverflow.com/comment/41173025
tagged with: putty
has comment: http://stackoverflow.com/comment/41173047
tagged with: command-prompt
answer count: 0
has comment: http://stackoverflow.com/comment/41173134
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41173053
tagged with: graphics

http://stackoverflow.com/a/26320590
has comment: http://stackoverflow.com/comment/41306581
has body: You can subtract one from the input inside that for loop so that it stays in that loop and other inputs aren't wiped out (and also make sure that the sum doesn't add those negative inputs) int input = 0; for (; input &lt; exams; input++) { int n = s.nextInt(); if (n&gt;=0) sum+=n; else { input--; System.out.println("Invalid exam score entered, reenter: "); } }
answers question: http://stackoverflow.com/q/26320532
downvote count: 0
has comment: http://stackoverflow.com/comment/41404301
has comment: http://stackoverflow.com/comment/41306807
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41306730
upvote count: 1
has comment: http://stackoverflow.com/comment/41306712

http://stackoverflow.com/comment/41204546
has text: Sorry I wasn't clear that there were two different errors. You got the second one, any idea what's causing the first? I believe they both fall under the scope of porting standard ListView code to Tabbed ListView so I'm hoping to get both answers if I can.
comment on: http://stackoverflow.com/a/26264627
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26197035
accepted answer of: http://stackoverflow.com/q/26196992
score: 0
answers question: http://stackoverflow.com/q/26196992
type: AcceptedAnswer
has body: You can use Integer.parseInt or scanner.nextInt and then store it in the array like this import java.util.Arrays; import javax.swing.JOptionPane; public class Foo { static String [] product = {"Shirts", "Jeans", "Hats", "Pants", "Shoes"}; static int [] q = new int[5]; static int total; private static int quantity = 1; // Either input this value from the user or initialized it with your own value public static void main(String[] args) { for (int count = 0; count &lt; product.length; count++) { String input = JOptionPane.showInputDialog("How many " + product[count] + "would you like to purchase?"); q[count] = Integer.parseInt(input); } System.out.println(Arrays.toString(q)); System.out.println(calcTotal()); } public static double calcTotal() { for (int i = 0; i &lt; product.length; i++) { total += (getPrice(i) * quantity); } return total; } private static int getPrice(int i) { return q[i]; } }
type: Answer
has comment: http://stackoverflow.com/comment/41079458

http://stackoverflow.com/q/26325251
type: UnansweredQuestion
has body: Following is a Map element i need to create a xslt from this. { /output1/output1/output1/output13=/input12/bunny, /output1/output1/output1/output14=/input12/no, /output1/output1/output13/output12=/input12/ok, /output1/output1/output13/output16=/input12/honey } how should i compare the each element of key element with each element of the next key element? package mig; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.Map.Entry; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Attr; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class CreateXSLT { public static final String xmlFilePath = "D:/xmlfile.xml"; public void createXSLT(ArrayList<String> SourceValues,ArrayList<String> SourceTypes,ArrayList<String> TargetValues,ArrayList<String> TargetTypes,ArrayList<String> Transform) { try { Map<String, String> yourMap = new HashMap<String, String>(); for(int x=0;x<TargetValues.size();x++) { yourMap.put(TargetValues.get(x),SourceValues.get(x)); } Map<String, String> sortedMap = new TreeMap<String, String>(yourMap); System.out.println(sortedMap); Set<Entry<String, String>> entires =sortedMap.entrySet(); Set<String> keyset = sortedMap.keySet(); System.out.println(keyset); DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder(); Document document = documentBuilder.newDocument(); Element root = document.createElement("xsl:stylesheet"); document.appendChild(root); Element r…
has comment: http://stackoverflow.com/comment/41316394
has comment: http://stackoverflow.com/comment/41314956
tagged with: list
answer count: 0
tagged with: java
type: Question
score: 0
tagged with: compare
has title: Create XML from a / separated string
has comment: http://stackoverflow.com/comment/41315103

http://stackoverflow.com/a/45297218
type: Answer
has body: We have the same error but I resolve it by just adding my database name where my stored procedure is located: Query query = session.createSQLQuery("CALL db_Name.storeprocedureName(:parameter)");
score: 0
answers question: http://stackoverflow.com/q/26296127

http://stackoverflow.com/comment/41286687
type: QuestionComment
has text: Post the stack trace in your question. Always. This code will not block forever. I suspect you're getting a connection timeout. It happens after a minute or so. Maybe you weren't patient enough.
comment on: http://stackoverflow.com/q/26306856
score: 0
type: Comment

http://stackoverflow.com/q/26243183
has comment: http://stackoverflow.com/comment/41165283
has comment: http://stackoverflow.com/comment/41165225
accepted answer: http://stackoverflow.com/a/26244124
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26244124
type: Question
has comment: http://stackoverflow.com/comment/41165136
has title: StringBuffer -> HTML
has comment: http://stackoverflow.com/comment/41165177
upvote count: 1
has body: I'm working with a StringBuffer a previous developer built inside of a hibernate application and have found something interesting in some of the .append() methods sb.append("&lt;td style=\"padding-left:5px\"&gt;~BFE~").append(MyField).append("~AFT~&lt;/td&gt;"); This seems to only be added to each &lt;td&gt; that contain the primary key of any given table This is probably something simple and I'm missing it as there was no comments written, but what is going on here exactly? I assume something Before &amp; something After that's HTML related.
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/41165195
favorite count: 0
has comment: http://stackoverflow.com/comment/41165204
has comment: http://stackoverflow.com/comment/41165180
has comment: http://stackoverflow.com/comment/41165360

http://stackoverflow.com/comment/41315451
comment on: http://stackoverflow.com/q/26325544
score: 0
type: QuestionComment
type: Comment
has text: are you working with threads?

http://stackoverflow.com/a/26251457
type: Answer
has body: Use this code. viewer is the instance of your table viewer. Add this code at the end of the addSelectionListener method of button btnSave. TableItem[] items = viewer.getTable().getItems(); File fl = new File(dialog.getFilterPath() + File.separator + dialog.getFileName()); FileWriter flwr; int cls = viewer.getTable().getColumnCount(); try { flwr = new FileWriter(fl); for (int i = 0; i &lt; items.length; i++) { for (int j = 0; j &lt;= cls; j++) { flwr.write(items[i].getText(j) + "\t"); } flwr.write("\n"); } flwr.flush(); flwr.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/26250736
accepted answer of: http://stackoverflow.com/q/26250736
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/33763578
has body: A package has a fixed size (I guess). I stuck with a similar problem. It boils down that BufferedImage does not have a non-argument constructor and if one uses different methods to get around this problem like using no constructor at all when deserializing, it goes south. So basically what you want is serialize a buffered image. One thing you can do is provide your own serializer (it can be read on their github page) or extract an RGB version or store the byte / int content of the image or even write a PNG to memory and send the PNG/JPG instead (gives you compression).
type: Answer
answers question: http://stackoverflow.com/q/26207154
score: 0

http://stackoverflow.com/comment/41176208
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26249062
type: QuestionComment
has text: Perhaps you should post the version that prints `true`, in case your test was wrong. (It happens. I've added code to print out values and then gone crazy trying to figure out what went wrong, until I realized that the code to print the values was screwed up.)

http://stackoverflow.com/comment/41339121
type: AnswerComment
comment on: http://stackoverflow.com/a/26337982
score: 1
has text: No that is not correct. A working solution is only *part* of a useful and good answer. Code-Only answers are subject to downvoting (and eventually deletion) because they add no significant value to the site. For more information [check meta.](http://meta.stackoverflow.com/q/256359/1803692)
type: Comment

http://stackoverflow.com/q/26203382
possible better answer: http://stackoverflow.com/a/26203528
tagged with: addition
has answer: http://stackoverflow.com/a/26203528
has title: Can't add integer to an array without a 0 at first index
has answer: http://stackoverflow.com/a/26203442
accepted answer: http://stackoverflow.com/a/26203442
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/41090183
answer count: 2
tagged with: arrays
has body: I used an ArrayList at first. But then my course teacher told me that I can't use ArrayList in my program. He said that I can only use arrays. The problem is when I add an integer to array, it just puts zero on the first index. Here is the code : int[] Bag = new int[1]; boolean isit = true; do { int[] NewBag = new int[Bag.length + 1]; String name = scanner.next(); if (name.equals("A")){ int number = scanner.nextInt(); for (int i = 0; i &lt; Bag.length; i++) { NewBag[NewBag.length - 1] = number; NewBag[i] = Bag[i]; } Bag = NewBag; System.out.println(number + " added to Bag."); } } while (isit == true); Please help me guys. I can't make Minimum and Size operations without the correct Add operation.
favorite count: 0
linked to: http://stackoverflow.com/q/4612471
has comment: http://stackoverflow.com/comment/41090155

http://stackoverflow.com/comment/41249273
type: QuestionComment
comment on: http://stackoverflow.com/q/26288962
score: 0
has text: Thread.sleep(5000);Then set the text to "" and refresh the dialogue.
type: Comment

http://stackoverflow.com/a/26290205
answers question: http://stackoverflow.com/q/26290152
downvote count: 0
type: AcceptedAnswer
has body: You're getting the default toString() from array, you could change this return "Found at: " + new int[] {row,col}; to use Arrays.toString(int[]) with something like return "Found at: " + Arrays.toString(new int[] {row,col});
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26290152

http://stackoverflow.com/comment/41252924
comment on: http://stackoverflow.com/q/26291071
has text: If the bottleneck is the comparison itself (for example, your collection holds complex objects that are hard to compare): try to optimize the comparison using some simpler data representation (java quite does that already with the object hashcode(), but maybe you can improve it). As you can see, there are many assumptions for this question :-)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41139809
has text: Did you write a `!` in your `if` condition? Coz the function works fine for me.
comment on: http://stackoverflow.com/a/26229240
type: AnswerComment
score: 0
type: Comment

hazelcast
tags question: http://stackoverflow.com/q/26277807
type: Tag
tags question: http://stackoverflow.com/q/26218732
tag name: hazelcast
tags question: http://stackoverflow.com/q/26256381

http://stackoverflow.com/q/26295558
tagged with: java
tagged with: thread-safety
type: Question
upvote count: 4
downvote count: 0
tagged with: base64
has title: Is DatatypeConverter thread-safe?
score: 4
has answer: http://stackoverflow.com/a/26296179
has answer: http://stackoverflow.com/a/26295931
answer count: 3
favorite count: 0
tagged with: jaxp
has answer: http://stackoverflow.com/a/26297067
has body: In particular, is the method javax.xml.bind.DatatypeConverter.parseBase64Binary(String) thread-safe?
type: UnansweredQuestion

http://stackoverflow.com/tag/c
tags question: http://stackoverflow.com/q/26288659
tags question: http://stackoverflow.com/q/26254437
tags question: http://stackoverflow.com/q/26319804
tags question: http://stackoverflow.com/q/26214138
tag name: c
tags question: http://stackoverflow.com/q/26287883
type: Tag
tags question: http://stackoverflow.com/q/26327195
tags question: http://stackoverflow.com/q/26257823
tags question: http://stackoverflow.com/q/26285133
tags question: http://stackoverflow.com/q/26199515
tags question: http://stackoverflow.com/q/26256558
tags question: http://stackoverflow.com/q/26236349
tags question: http://stackoverflow.com/q/26201268
tags question: http://stackoverflow.com/q/26330425
tags question: http://stackoverflow.com/q/26258271
tags question: http://stackoverflow.com/q/26200481
tags question: http://stackoverflow.com/q/26275738
tags question: http://stackoverflow.com/q/26232087
tags question: http://stackoverflow.com/q/26311927
tags question: http://stackoverflow.com/q/26340422
tags question: http://stackoverflow.com/q/26315089

http://stackoverflow.com/comment/41295275
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26314378
has text: Ok, but i get the error:“To operate correctly, EPIC requires a Perl interpreter check your configuration setting window/prefrences/perlEpic”
type: AnswerComment

http://stackoverflow.com/comment/41321054
score: 0
has text: Works, but only for this example, what if there were \ or / ?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26328514

http://stackoverflow.com/comment/41150092
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26233845
has text: Thx for your answer! Isn`t there sth close to that? I really have to figure out how much memory a certain thread is using. I would appreciate your reply!
type: Comment

http://stackoverflow.com/q/26343140
score: 0
has answer: http://stackoverflow.com/a/26343455
answer count: 3
has comment: http://stackoverflow.com/comment/41348288
accepted answer: http://stackoverflow.com/a/26344135
tagged with: minim
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41348188
tagged with: list
tagged with: java
has body: I have this class class TimeSpentStats{ int manId; String sessionId; int userId; Long timeStamp; } I have a List and I want to get the minimum timestamp and maximum from the list for each (manId, sessionId, userId) So for example, I have: manId sessionId userId timeStamp 1 01F 5 1000 1 01F 5 1005 3 6Y 3 7 3 6Y 3 16 I need for (1 01F 5) -> min = 1000 , max = 1005 and for (3 6Y 3 ) - > min = 7 , max = 16 I need to add maybe 2 attributes in the same class? Any ideas if I can do this? Thank you
tagged with: collections
has comment: http://stackoverflow.com/comment/41348079
has comment: http://stackoverflow.com/comment/41348064
type: Question
has answer: http://stackoverflow.com/a/26344135
has comment: http://stackoverflow.com/comment/41348231
has title: Get minimum and maximum from a list of objects
has answer: http://stackoverflow.com/a/26343320
possible better answer: http://stackoverflow.com/a/26343455

http://stackoverflow.com/comment/41241541
comment on: http://stackoverflow.com/a/26284686
score: 0
type: Comment
has text: Look at this code and try it maybe what you want. It is better than what you are doing now I think. You will have one arraylist with all the actual data and the other arraylist will have the locations where the data > 0.
type: AnswerComment

http://stackoverflow.com/q/26260915
has body: I am having a little confusion about the PhantomReference in java. When I looked in online articles most of them mentioned that the PhantomReference object will return null after creation even if we invoke get() on the reference and also it mentioned the objects are phantomly reachable will be inserted into the ReferenceQueue when the PhantomReference is removed from the memory. I have tried the following code example but I have a confusion about the result. Equipment equipment = new Equipment(); ReferenceQueue queue = new ReferenceQueue(); PhantomReference pr = new PhantomReference(equipment, queue); System.out.println(pr.get()); System.out.println(queue.poll()); Above two statements prints null. If the pr.get() returns null does it mean the object referred by pr is garbage collected? If it is so, why the object is still haven't added to the priority queue? Can anybody help please me to clarify this. I apologies from you if my understanding is wrong regarding the PhantomReference and the ReferenceQueue. Please describe these two terms simply as well thanks a lot
upvote count: 1
type: AnsweredQuestion
tagged with: phantom-reference
has answer: http://stackoverflow.com/a/26261057
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has title: What is the relationship between the PhantomReference and ReferenceQueue?
favorite count: 0
accepted answer: http://stackoverflow.com/a/26261057

http://stackoverflow.com/comment/41228260
type: AnswerComment
score: 0
has text: I made folder named `lib` and put both zip files in it. Cleaned and build the project, but still getting same error..
type: Comment
comment on: http://stackoverflow.com/a/26278057

http://stackoverflow.com/comment/41127922
type: QuestionComment
comment on: http://stackoverflow.com/q/26222844
has text: @FoggyDay: Java lets you declare two different methods that have the same name but different argument lists. Why _not_ two different variables that have the same name and different storage class? At least one programming language that I can think of (ruby) lets you do that. It works in ruby because the syntax for referencing a class variable is different from the syntax for referencing a member variable.
score: 0
type: Comment

http://stackoverflow.com/q/26207380
has title: Emiting socket.io messages on Android
type: AnsweredQuestion
tagged with: socket.io
type: Question
has answer: http://stackoverflow.com/a/26251618
has body: I'm trying to develop an application with socket.io . There are 2 devices and when someone touch to screen of device 1 , I need to see a message on device 2. This is nodeJS server code (I'm using SocketIO v0.9.* because socket.io-java-client isn't supporting version > 1.0.0) var app = require('http').createServer() var io = require('socket.io').listen(1337); io.on('connection', function (socket) { socket.on('tiklama', function (data) { console.log(data); io.emit('tiklama', data); }); }); and my Java code (click here for whole code) : protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final RelativeLayout anapanel = (RelativeLayout) findViewById(R.id.anapanel); final TextView tw = (TextView) findViewById(R.id.textView1); final TextView tw2 = (TextView) findViewById(R.id.textView2); final TextView tw4 = (TextView) findViewById(R.id.textView4); try { socket = new SocketIO("http://SERVERIPADDRESS:1337"); socket.connect(new IOCallback() { @Override public void onMessage(JSONObject json, IOAcknowledge ack) { try { Log.d("x","Server said:" + json.toString(2)); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onMessage(String data, IOAcknowledge ack) { Log.d("x","Server said: " + data); } @Override public void onError(SocketIOException socketIOException) { Log.d("x","an Error occured"); socketIOException.printStackTrace(); } @Override public void onDisconnect() { Log.d("x","Connection terminated."); } @Override public void onConnect() { Log.d("x","Connection established"); } @Override public void on(String event, IOAcknowledge ack, Object... args) { Log.d("x","Server triggered event '" + event + "'"); if(event.contentEquals("tiklama")) { tw4.setText("Someone touched to device 1"); } } }); // This line is cached until the connection is establisched. } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } anapanel.setOnTouchListener(new…
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/26251618
score: 5
answer count: 1
downvote count: 0
tagged with: websocket
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41177527

http://stackoverflow.com/comment/41128891
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26223673
type: Comment
has text: @coderzz027 Not helping, if you don't know what modular arithmetic does ;)

http://stackoverflow.com/comment/41206263
type: Comment
comment on: http://stackoverflow.com/q/26265637
has text: It is running and printing it out much faster than the system clock is updating
score: 0
type: QuestionComment

http://stackoverflow.com/q/26201449
favorite count: 0
tagged with: synchronized
has answer: http://stackoverflow.com/a/26201772
accepted answer: http://stackoverflow.com/a/26201772
has body: After reading considerable stuff regarding threads on the net and with help from Herbert Schildt book, The Complete Refernce Java, I know that synchronized only prevents multiple threads from simultaneously executing the method in the same instance. I said... in the same instance. When one thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object block (suspend execution) until the first thread is done with the object. Notice ... in the same instance(object). Thirdly, from oracle docs, when a synchronized method exits, it automatically establishes a happens-before RELATIONSHIP with any subsequent invocation of a synchronized method for the same object. This guarantees that changes to the state of the object are visible to all threads. This also involves working on the same object with multiple threads. But when the situation comes to Multiple threads working on different instances of the same class, I am getting overall confused and not able to make out what's happening and how is it happening? Consider the example given in the Herbert Schildt book: Suspending and resuming a thread the modern way. class NewThread implements Runnable { String name; // name of thread Thread t; boolean suspendFlag; NewThread(String threadname) { name = threadname; t = new Thread(this, name); System.out.println("New thread: " + t); suspendFlag = false; t.start(); // Start the thread } // This is the entry point for thread. public void run() { try { for (int i = 15; i &gt; 0; i--) { System.out.println(name + ": " + i); Thread.sleep(2000); synchronized (this) { while (suspendFlag) { wait(); } } } } catch (InterruptedException e) { System.out.println(name + " interrupted."); } System.out.println(name + " exiting."); } void mysuspend() { suspendFlag = true; } synchronized void myresume() { suspendFlag = false; notify(); } } The main thread : class SuspendResume { public static void main(String args[]) { NewThread ob1 = ne…
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/18356795
upvote count: 2
tagged with: java
tagged with: multithreading
type: Question
has title: The modern way of suspending, resuming, and stopping threads and multiple threads on multiple instances?
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/2462104
has comment: http://stackoverflow.com/comment/41093963

http://stackoverflow.com/a/26555435
answers question: http://stackoverflow.com/q/26242100
has body: You probably would like to use a streaming parser like TagSoup instead, which implements SAX2 API. Since it does not build the DOM tree, it takes the same amount of memory regardless of source document size. If you haven't dealt with SAX before, here is a little tutorial. To simply clean the text (inserting dots instead of both opening and closing tags) you may use the following snippet: package com.example; import org.ccil.cowan.tagsoup.Parser; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; import java.io.IOException; import java.io.InputStream; public class MyHandler extends DefaultHandler { final static String SEPARATOR = "."; StringBuilder builder; @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { builder.append(SEPARATOR); } @Override public void endElement(String uri, String localName, String qName) throws SAXException { builder.append(SEPARATOR); } @Override public void characters(char[] ch, int start, int length) throws SAXException { builder.append(ch, start, length); } public String cleanHtml(InputStream inputStream) { builder = new StringBuilder(); Parser parser = new Parser(); parser.setContentHandler(this); try { parser.parse(new InputSource(inputStream)); } catch (IOException | SAXException e) { e.printStackTrace(); } return builder.toString(); } }
has comment: http://stackoverflow.com/comment/41768979
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41768058

http://stackoverflow.com/q/26324426
answer count: 2
has title: Modifying java code errors
score: 0
tagged with: exception
has answer: http://stackoverflow.com/a/26324440
has body: import javax.swing.*; public class Menu2 { protected String[] entreeChoice = {"Rosemary Chicken", "Beef Wellington", "Maine Lobster"}; private String menu = ""; private int choice; protected char initial[] = new char[entreeChoice.length]; public String displayMenu(){ for(int x = 0; x &lt; entreeChoice.length; ++x){ menu = menu + "\n" + (x+1) + "for" + entreeChoice[x]; initial[x] = entreeChoice[x].charAt(0); } throws menuException String input = JOptionPane.showInputDialog(null, "Type your selection, then press Enter." + menu); choice = Integer.parseInt(input); return (entreeChoice[choice - 1]); } } I'm having an error on the throws menuException. It says: illegal start of type. I'm almost done with the code, it's just that the codes need to be modified (photo attached), and when I do it, I get errors on where to put the code. photo of code
type: UnansweredQuestion
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26324447
tagged with: java

http://stackoverflow.com/comment/41336929
comment on: http://stackoverflow.com/q/26336879
has text: I don't really understand what you mean by *I need the listViewId variable to then Toast in the New Description Page.* Don't you basically just want to send it over in an `Intent Extra`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26313876
has answer: http://stackoverflow.com/a/26316432
tagged with: java
upvote count: 4
possible better answer: http://stackoverflow.com/a/26316432
has comment: http://stackoverflow.com/comment/41298397
type: AnsweredQuestion
tagged with: batch-processing
downvote count: 0
accepted answer: http://stackoverflow.com/a/26318180
favorite count: 0
tagged with: spring-batch
type: Question
tagged with: spring
score: 4
has body: I am trying to read client data from database and write processed data to a flat file. But I need to process whole result of the ItemReader before write data. For example, I am reading Client from database rows : public class Client { private String id; private String subscriptionCode; private Boolean activated; } But I want to count and write how many user are activated grouped by subscriptionCode : public class Subscription { private String subscriptionCode; private Integer activatedUserCount; } I don't know how to perform that using ItemReader/ItemProcessor/ItemWriter, can you help me ? BatchConfiguration : @CommonsLog @Configuration @EnableBatchProcessing @EnableAutoConfiguration public class BatchConfiguration { @Autowired private JobBuilderFactory jobBuilderFactory; @Autowired private StepBuilderFactory stepBuilderFactory; @Bean public Step step1() { return stepBuilderFactory.get("step1") .&lt;Client, Client&gt; chunk(1000) .reader(new ListItemReader&lt;Client&gt;(new ArrayList&lt;Client&gt;() { // Just for test { add(Client.builder().id("1").subscriptionCode("AA").activated(true).build()); add(Client.builder().id("2").subscriptionCode("BB").activated(true).build()); add(Client.builder().id("3").subscriptionCode("AA").activated(false).build()); add(Client.builder().id("4").subscriptionCode("AA").activated(true).build()); } })) .processor(new ItemProcessor&lt;Client, Client&gt;() { public Client process(Client item) throws Exception { log.info(item); return item; } }) .writer(new ItemWriter&lt;Client&gt;() { public void write(List&lt;? extends Client&gt; items) throws Exception { // Only here I can use List of Client // How can I process this list before to fill Subscription objects ? } }) .build(); } @Bean public Job job1(Step step1) throws Exception { return jobBuilderFactory.get("job1").incrementer(new RunIdIncrementer()).start(step1).build(); } } Main application: public class App { public static void main(String[] args) throws JobExecutionAlreadyRunningExc…
answer count: 2
has answer: http://stackoverflow.com/a/26318180
has title: Spring Batch how to process list of data before write in a Step
has comment: http://stackoverflow.com/comment/41298059

http://stackoverflow.com/a/26339108
answers question: http://stackoverflow.com/q/26338989
type: AcceptedAnswer
type: Answer
has body: XML is case sensitive, so if your schema specifies the root element to be called "abc" (as the error message suggests), it will not be able to parse "Abc". Have a look at this question. To achieve case insensitive parsing, have a look at this blog by Blaise Doughan, one of the people behind specification and implementation of JAXB.
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26338989
has comment: http://stackoverflow.com/comment/41340784
upvote count: 2

http://stackoverflow.com/comment/41102648
comment on: http://stackoverflow.com/a/26209843
type: Comment
type: AnswerComment
has text: I'm familiar with that. But, how would I go about implementing that into my if-else statement?
score: 0

http://stackoverflow.com/comment/80117080
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26277572
score: 0
has text: I think this will help for you. [Spring Transaction Management Over Multiple Threads](https://dzone.com/articles/spring-transaction-management-over-multiple-thread-1)

http://stackoverflow.com/a/26372086
has body: So essentially wha i have done is create a /succes_login that gets called and then renders fragment as per here: http://www.thymeleaf.org/whatsnew21.html#spfrag Hope that helps, let me know and i'll investigate further.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26281189

http://stackoverflow.com/q/26334837
has comment: http://stackoverflow.com/comment/41333064
tagged with: java
has title: How create border around visible image in ImageView
type: Question
answer count: 2
tagged with: imageview
has body: It is possible to create contour around or shadow under VISIBLE pixels in ImageView. In case this image in ImageView (outside from green figure is transparent): I need next pic with border: Please any code or references.
has comment: http://stackoverflow.com/comment/41334133
upvote count: 1
tagged with: android
has answer: http://stackoverflow.com/a/26334978
has answer: http://stackoverflow.com/a/26335010
has comment: http://stackoverflow.com/comment/41333089
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41333581
downvote count: 0
score: 1

http://stackoverflow.com/comment/41268714
has text: Yes because in this case the repository will call merge() instead of persist(). You have to understand to figure out what is happening in your transaction. Try to log org.springframework.transaction at the TRACE level
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26296274

http://stackoverflow.com/a/26291481
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26291247
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26291247
score: 1
has body: you can use reflection for this scenario, string[] methodNames = new string{}["ones","twos",....]; for(string method : methodNames) { Method method = this.getClass().getMethod(dice_values.getClass()); each_score = method.Invoke(this,dice_values); total_score += each_score; end_scores += String.valueOf(each_score) + " "; }
has comment: http://stackoverflow.com/comment/41253630
has comment: http://stackoverflow.com/comment/41253683
type: AcceptedAnswer

cachedrowset
type: Tag
tag name: cachedrowset
tags question: http://stackoverflow.com/q/26301918

http://stackoverflow.com/a/26310427
type: Answer
has body: I think this is the solution else { holder = (ViewHolder) convertView.getTag(); holder.tvMenuHeader.setText(row_pos.getItem_header()); } I also encountered this problem earlier and this one works for me.
has comment: http://stackoverflow.com/comment/41288447
answers question: http://stackoverflow.com/q/26309893
score: 0

http://stackoverflow.com/a/26285634
has comment: http://stackoverflow.com/comment/41242771
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26285305
has body: You can let the them implement Comparable, so like Woning implements Comparable&lt;Woning&gt;. This will let you implement the (required) method: @override public int compareTo(Woning other) { int result = Integer.compareto(maxPrijs, other.maxPrijs); if (result != 0) return result; result = Integer.compareto(someField, other.someField); if (result != 0) return result; // etc... return 0; } The subclass KoopWoning extends Woning implements Comparable&lt;KoopWoning&gt; can have a method like this: @override public int compareTo(KoopWoning other) { int result = Integer.compareto(energylevel, other.energylevel); if (result != 0) return result; return super.compareTo(other); } Then all you need to do is load all the Woning instances in a list and execute Collections.sort(list); Having subclasses inherit Comparable is optional, so HuurWoning will just sort like Woning.

http://stackoverflow.com/comment/41341885
has text: possible duplicate of [How to set thousands separator in Java?](http://stackoverflow.com/questions/5323502/how-to-set-thousands-separator-in-java)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26339819
type: QuestionComment

http://stackoverflow.com/comment/41204414
type: Comment
comment on: http://stackoverflow.com/a/26264025
type: AnswerComment
has text: Ah, didn't know `GeometricObject` was a class. I don't think I should really help from this point since I feel like I would be kinda doing your HW for you. Everything you need is actually on that sheet. Good luck!
score: 0

http://stackoverflow.com/comment/41079389
type: QuestionComment
comment on: http://stackoverflow.com/q/26195252
has text: i was not arguing if anyone would need or not. wanted you to give a sample in case it makes a reader think of some alternate solution. like in log4j2 i remeber reading they have some code that is based on newer versions of java but they commit that out via a constant. maybe the constant is set by a script during compile based on the target environment of compile. then java will ignore some code
score: 0
type: Comment

http://stackoverflow.com/q/26235445
has body: I got multiple different web context configurations in my Spring MVC application, defined via Servlet mappings in the web.xml (api-servlet.xml und web-servlet.xml) When I create a Integration Test using the @WebAppConfiguration annotation it seems to load all of my web context configurations which leads to the following error: Caused by: java.lang.IllegalStateException: Cannot map handler 'myService' to URL path [/refresh]: There is already handler of type [class com.troii.timr.api.APIController$$EnhancerBySpringCGLIB$$eaca0afa] mapped. This happens because the URL /refresh is normally configured in two different web context configurations with different URL prefixes. Is there a way to configure which web context config is used for my migration test?
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring-mvc
score: 2
answer count: 0
upvote count: 2
has title: Using @WebAppConfiguration with multiple web context configurations
type: Question
tagged with: java
tagged with: servlets

http://stackoverflow.com/comment/41201545
score: 0
type: Comment
type: QuestionComment
has text: after line 14 where main method closes
comment on: http://stackoverflow.com/q/26263054

http://stackoverflow.com/a/26301770
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26301505
has body: Please try: xyz(JAXBElement&lt;?&gt; myElement); Please see this tutorial on generics: So what is the supertype of all kinds of collections? It's written Collection&lt;?&gt; (pronounced "collection of unknown"), that is, a collection whose element type matches anything. It's called a wildcard type for obvious reasons. We can write: void printCollection(Collection&lt;?&gt; c) { for (Object e : c) { System.out.println(e); } } and now, we can call it with any type of collection.
upvote count: 2

http://stackoverflow.com/comment/41324682
type: Comment
has text: Presumably you didn't use the `getInt(Scanner s) throws EOFException` alternative I gave in my answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/26279296
score: 0

http://stackoverflow.com/q/26315568
has comment: http://stackoverflow.com/comment/41297146
has comment: http://stackoverflow.com/comment/41297205
upvote count: 0
answer count: 1
has title: Java sort ArrayList as an class structure
has answer: http://stackoverflow.com/a/26315636
favorite count: 0
has comment: http://stackoverflow.com/comment/41297076
has comment: http://stackoverflow.com/comment/41297286
has body: in this function my sort doesnot work correctly. my lastID is string private void addDataToList(String LastID, String SmsBody) { List&lt;ReceivedItemStructure&gt; receivedItemStructures = new ArrayList&lt;ReceivedItemStructure&gt;(); ReceivedItemStructure rS = new ReceivedItemStructure(); rS.setmLastID(LastID); rS.setmSmsBody(SmsBody); items.add(rS); Collections.sort(receivedItemStructures, new Comparator&lt;ReceivedItemStructure&gt;() { @Override public int compare(ReceivedItemStructure rs1, ReceivedItemStructure rs2) { if( rs1.getmLastID().equals(rs2.getmLastID()) ) return 1; return 0; } }); adapter.setRow(items); adapter.notifyDataSetChanged(); } ReceivedItemStructure class: public class ReceivedItemStructure { public String mLastID; public String mSmsBody; public ReceivedItemStructure(String vLastID, String vSmsBody) { mLastID = vLastID; mSmsBody = vSmsBody; } public ReceivedItemStructure() {} public String getmLastID() { return mLastID; } public void setmLastID(String LastID) { mLastID = LastID; } POST UPDATE catLog Result : 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30390335 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30390100 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30389996 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30374135 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30374099 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30374093 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30374084 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30374062 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30373780 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30373756 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30390748 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30390755 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30391045 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30391076 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30391095 10-11 14:27:51.860 4658-4658/ir.tsms E/LastID:﹕ 30395978 10-11 14:27:51.860 4658-4658/ir.tsms E/Las…
type: UnansweredQuestion
downvote count: 1
linked to: http://stackoverflow.com/q/1206073
type: Question
tagged with: java
score: -1

http://stackoverflow.com/q/26197505
score: 0
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/26197562
linked to: http://stackoverflow.com/q/19602601
has comment: http://stackoverflow.com/comment/41079862
has comment: http://stackoverflow.com/comment/41079807
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26197532
has body: i'm trying to make a list of different objects. I know that i can make a list of some object, example: ArrayList&lt;Matrices&gt; list = new ArrayList&lt;Matrices&gt;(); list.add( new Matrices(1,1,10) ); list.add( new Matrices(1,2,20) ); But i want to make a list that can do something like this: list.add (new Object1(a,b,c)); list.add (new Object2(e,f)); Obviously Object1 and Object2 are different. Please, give me a hand here.
has title: Make a list of different objects Java
upvote count: 1
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26197532
accepted answer: http://stackoverflow.com/a/26197562
tagged with: java

http://stackoverflow.com/comment/41359142
has text: You should be careful doing calculations on `.getTimeInMillis()`. Due to day light saving time/ summer time, and other anomalies, you can get incorrect result. Ideally, you would set the time in the `Calendar` object, and roll the date a day at a time while keeping track of the number of days that have passed.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26349008
type: AnswerComment

http://stackoverflow.com/comment/41184494
score: 0
type: QuestionComment
type: Comment
has text: Ok Thanks, but I don't understand when I can use this code. For example, you image that I run this Web Service after that I had a request from client. I want to see during the elaborate the RAM usage, Cpu ecc... if I write this code at the end, it keeps track of this information?
comment on: http://stackoverflow.com/q/26253839

http://stackoverflow.com/q/26311927
has answer: http://stackoverflow.com/a/26312887
has answer: http://stackoverflow.com/a/26313387
linked to: http://stackoverflow.com/q/4870188
linked to: http://stackoverflow.com/q/13796928
score: -1
has comment: http://stackoverflow.com/comment/41290662
upvote count: 2
has comment: http://stackoverflow.com/comment/41290717
has answer: http://stackoverflow.com/a/26312003
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/13796928
has answer: http://stackoverflow.com/a/26311955
downvote count: 3
has comment: http://stackoverflow.com/comment/41291346
has answer: http://stackoverflow.com/a/26312617
type: Question
has comment: http://stackoverflow.com/comment/41290681
tagged with: c#
has comment: http://stackoverflow.com/comment/41290772
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/41295737
has title: No duplicates in an array
has body: void RemoveDups(){ int f=0; for(int i=1;i&lt;nelems;i++){ if(arr[f]==arr[i]){ for(int k=i;k&lt;nelems;k++) { arr[k]=arr[k+1]; } nelems--; } if(i==(nelems+1)){ f++; i=f+1; //increment again } } } This is the logic i have written to remove duplicate elements from an array ,but this is not working at all ?what changes i should make to make it work? or you people have better logic for doing the same considering time complexity.and i don't want to use built-in methods to achieve this.
has answer: http://stackoverflow.com/a/26312498
tagged with: arrays
answer count: 7
has answer: http://stackoverflow.com/a/26311967
favorite count: 0

http://stackoverflow.com/q/26262857
score: 0
tagged with: implements
answer count: 3
upvote count: 1
downvote count: 1
tagged with: java
has title: Why my variables cannot receive a value (interface)
has comment: http://stackoverflow.com/comment/41200870
has answer: http://stackoverflow.com/a/26263041
has answer: http://stackoverflow.com/a/26262934
has answer: http://stackoverflow.com/a/26263094
type: AnsweredQuestion
tagged with: interface
possible better answer: http://stackoverflow.com/a/26262934
has comment: http://stackoverflow.com/comment/41200675
accepted answer: http://stackoverflow.com/a/26263041
favorite count: 0
has body: I having a problem to send a value on the variables. Why my variable cannot receive the value when I input a value? I've no idea to do... import java.io.*; public class StudentApp { public static void main (String [] args) throws IOException { student studentObject = new GradeResult(); studentObject.getName(); student studentObject2 = new GradeResult(); studentObject2.getIdNum(); student studentObject3 = new GradeResult(); studentObject3.getMark(); student studentObject4 = new GradeResult(); studentObject4.setName(); student studentObject5 = new GradeResult(); studentObject5.setIdNum(); student studentObject6 = new GradeResult(); studentObject6.setMark(); student studentObject7 = new GradeResult(); studentObject7.showGrade(); student studentObject8 = new GradeResult(); studentObject8.showResult(); } interface StudentInterface{ void getName() throws IOException; void getIdNum()throws IOException; void setName(); void setIdNum(); void getMark()throws IOException; void setMark(); } interface student extends StudentInterface{ void showResult(); void showGrade(); } class GradeResult implements student { String name ,name2 ,name3; int a ,mark; public void getName () throws IOException { InputStreamReader inStream = new InputStreamReader(System.in); BufferedReader stdin = new BufferedReader(inStream); System.out.print("Please Input Your Name :"); name = stdin.readLine(); } public void getIdNum()throws IOException { BufferedReader stdin=new BufferedReader (new InputStreamReader(System.in)); System.out.print("Please Input Your ID Number :"); name2 = stdin.readLine(); a = Integer.parseInt(name2); } public void setName() { System.out.print("Your Name :"+name); } public void setIdNum() { System.out.print("\nYour ID Number :"+name2); } public void getMark()throws IOException { BufferedReader stdin=new BufferedReader (new InputStreamReader(System.in)); System.out.print("Please Input Your Mark :"); name3 = stdin.readLine(); mark = Integer.parseInt(name3); } public void setMark() {…
type: Question

http://stackoverflow.com/a/26288878
has body: How is different the deserialization of this instance in compare to the other ones? Which version of of Jackson are you using? Jackson 2 enables pretty cool stuff for deserialization. First option, you can use the Jackson Builder, to customize @JsonDeserialize(builder = FooBarBuilder.class) public class FooBar { ... public static class FooBarBuilder() { public FooBar build(){...} } } Second option, if your actual FooBar is an subtype of a see Handling polymorphic types to resolve the actual instance of your class. Hope it helps!
answers question: http://stackoverflow.com/q/26271383
score: 0
type: Answer

list
type: Tag
tags question: http://stackoverflow.com/q/26297048
tags question: http://stackoverflow.com/q/26258902
tags question: http://stackoverflow.com/q/26312961
tags question: http://stackoverflow.com/q/26265456
tags question: http://stackoverflow.com/q/26195243
tags question: http://stackoverflow.com/q/26219118
tags question: http://stackoverflow.com/q/26289173
tags question: http://stackoverflow.com/q/26343140
tags question: http://stackoverflow.com/q/26262137
tags question: http://stackoverflow.com/q/26250673
tags question: http://stackoverflow.com/q/26321951
tag name: list
tags question: http://stackoverflow.com/q/26273006
tags question: http://stackoverflow.com/q/26194803
tags question: http://stackoverflow.com/q/26309893
tags question: http://stackoverflow.com/q/26234419
tags question: http://stackoverflow.com/q/26269575
tags question: http://stackoverflow.com/q/26318500
tags question: http://stackoverflow.com/q/26261892
tags question: http://stackoverflow.com/q/26311369
tags question: http://stackoverflow.com/q/26228973
tags question: http://stackoverflow.com/q/26325251
tags question: http://stackoverflow.com/q/26205409
tags question: http://stackoverflow.com/q/26207890
tags question: http://stackoverflow.com/q/26284445
tags question: http://stackoverflow.com/q/26271992
tags question: http://stackoverflow.com/q/26310150
tags question: http://stackoverflow.com/q/26200987
tags question: http://stackoverflow.com/q/26303692

http://stackoverflow.com/comment/41388751
comment on: http://stackoverflow.com/a/26343991
score: 0
has text: I have done this. Thank you for your response. The issue can be found at https://code.google.com/p/google-bigquery/issues/detail?id=167
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41253592
has text: Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
score: 0
comment on: http://stackoverflow.com/q/26291498
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26224698
answers question: http://stackoverflow.com/q/26224656
downvote count: 0
has comment: http://stackoverflow.com/comment/41130987
type: Answer
has comment: http://stackoverflow.com/comment/41130899
has comment: http://stackoverflow.com/comment/41131093
upvote count: 1
has body: Change private int credits; private double bill to int credits; double bill inside CalcFree() Because you can declare local variables in CalcFree() method and local variables cannot be private/public/protected, etc. but they can be final
score: 1
has comment: http://stackoverflow.com/comment/41131273

http://stackoverflow.com/q/26322455
downvote count: 0
has body: I'm currently developing an app, that should measure (fairly precisely) the size of webpages. The thing I'm struggling with now is that I need to know the sizes of particular files that are on the website. I have an array of URLs and I try to fetch their headers to get Content-Length, however some files return -1 since they are chunked. If they return -1 I try to download them to get their size. And here lies the problem - I found out that I always get uncompressed version of the file. Example file - http://www.google-analytics.com/analytics.js When I open it in Chrome, the headers says this: However, when I download it using HttpURLConnection, it has a size of 25421 bytes, and when I check the Content-Encoding header, its always null. connection = (HttpURLConnection)(new URL(url)).openConnection(); connection.setRequestProperty("Accept-Encoding", "gzip"); connection.connect(); int contentLength = connection.getContentLength(); if (contentLength == -1 &amp;&amp; connection != null) { InputStream input = connection.getInputStream(); byte[] buffer = new byte[4096]; int count = 0, len; while ((len = input.read(buffer)) &gt; 0) { count += len; } contentLength = count; } So the problem is, that I download a webpage with my application, and it says it has (let's say) 400kB. But when I download it using some kind of tool, like http://tools.pingdom.com/fpt/ , the size is much smaller, like 100kB, since most of the scripts are gzipped, that means the transfer is lower. I know 300kB is not that much, but when you are using a mobile transfer, every kB counts, and I want my app to be precise. Could you point me where I make mistake, or how could I solve this? Thank you
tagged with: android
has comment: http://stackoverflow.com/comment/41309912
favorite count: 0
has comment: http://stackoverflow.com/comment/41311106
has answer: http://stackoverflow.com/a/26340235
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41339537
upvote count: 1
has title: HtttpURLConnection never uses gzip
accepted answer: http://stackoverflow.com/a/26340235
tagged with: http
possible better answer: http://stackoverflow.com/a/26322622
type: Question
has answer: http://stackoverflow.com/a/26322622
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41311379
answer count: 2
has comment: http://stackoverflow.com/comment/41309766

http://stackoverflow.com/comment/41338575
has text: You say that the `NullPointerException` is thrown in the line `location = locationManager.getLastKnownLocation(...)`, right? Have you added the null check since or is that already part of the failing code? And have you tried debugging?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26337188

http://stackoverflow.com/q/26200324
has answer: http://stackoverflow.com/a/26200488
has answer: http://stackoverflow.com/a/38011644
has answer: http://stackoverflow.com/a/26212775
answer count: 4
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/58117415
type: Question
upvote count: 9
tagged with: transactions
tagged with: java
tagged with: hibernate
has body: I have an EntityManager object maintained by the Spring framework and I inject it in whatever DAO class I want using the @PersistenceContext annotation like this.. @PersistenceContext(unitName="entityManager") private EntityManager em; I use those DAO classes to save in the database something like this.. class MyClass { @Resource(name="myDao") private MyDao dao; @Resource(name="myAnotherDao") private MyAnotherDao anotherDao; public void save(String s1,String s2) { try { MyEntity m=new MyEntity(); m.setName(s1); // .. and so on .. XYZ x=new XYZ(); x.setDEF(s2); anotherDao.save(x); m.setXYZ(x); // .. some other stuff .. // dao.saveEntity(m); } catch(Exception e) { // I would like to rollback the transaction } } } Now, both the daos here use the same EntityManager injected through @PersistenceContext(unitName="entityManager"). Now, if an exception occurs after setXYZ(), then I would like to rollback even the saved XYZ entity. But, how do I get the EntityManager from that? If all the daos hold the same object, then can I just call the getTransaction().rollback() method of the EntityManager class? Does the getTransaction() return a new transaction or any transaction that is currently associated with EntityManager?
score: 9
tagged with: jpa
downvote count: 0
favorite count: 0
has title: How to rollback transaction in JPA?

http://stackoverflow.com/a/26309875
type: Answer
answers question: http://stackoverflow.com/q/26309685
score: 0
has body: Wrong data structure. You just need a Set of currently legal moves. I would also make the directions an Enum instead of a String, which makes the Set an EnumSet, and use a switch statement instead of the if chain.

http://stackoverflow.com/comment/41352947
comment on: http://stackoverflow.com/q/26345771
score: 0
type: Comment
type: QuestionComment
has text: You want a shuffle algorithm.

http://stackoverflow.com/comment/41152577
type: QuestionComment
has text: Can you give us more info about how you're running build agent
score: 1
comment on: http://stackoverflow.com/q/26236488
type: Comment

http://stackoverflow.com/q/26211696
tagged with: unix
favorite count: 0
type: AnsweredQuestion
score: 2
has title: Executing awk command in java
has body: i am trying to execute awk command in java for linux/unix os but the thing is when i execute the command it does not show any error it.But after execution there is no output and it takes fraction of second to execute i dont know the problem please help . the code is process p =new process(): yes = "awk '{print $1}' /root/Desktop/net/net.zone &gt;&gt; /root/Desktop/net/net.txt"; p = Runtime.getRuntime().exec(yes); Thank you for your help
upvote count: 2
has answer: http://stackoverflow.com/a/26211890
accepted answer: http://stackoverflow.com/a/26211890
tagged with: java
linked to: http://stackoverflow.com/q/7340452
linked to: http://stackoverflow.com/q/39414814
type: Question
answer count: 1
downvote count: 0
tagged with: awk

http://stackoverflow.com/q/26334733
type: AnsweredQuestion
upvote count: 3
has title: XMLRootElement converting a class to XML in jersey
type: Question
accepted answer: http://stackoverflow.com/a/26335310
score: 3
tagged with: java
tagged with: jaxb
tagged with: jersey
answer count: 1
downvote count: 0
tagged with: jax-rs
favorite count: 0
has body: I'm very good in converting a model class to JSON Array or Object. But i'm a noob when it comes to XML. I want my final output to be like this Thanks for trying our documentation. Enjoy! To achieve it i create a model class @XmlRootElement(name = "Response") public class Response { private Say say = new Say(); public Say getSay() { return say; } public void setSay(Say say) { this.say = say; } @XmlRootElement(name = "Say") static class Say { @XmlAttribute private String voice = "alice"; private String string = "Thanks for trying our documentation. Enjoy!"; public String getString() { return string; } public void setString(String string) { this.string = string; } } } Now after converting it to XML with jersey my output was Thanks for trying our documentation. Enjoy! I got a extra string tag. I'm not sure what attribute to set for the String so that it comes in the body.? Or is there any other way? Also for say. The 'S' is not capitalised. How can i make it a capital letter? Thanks in advance
tagged with: rest
has answer: http://stackoverflow.com/a/26335310

http://stackoverflow.com/comment/41135530
type: QuestionComment
has text: @ajb Yep, too bizarre for me.
comment on: http://stackoverflow.com/q/26227055
score: 0
type: Comment

http://stackoverflow.com/a/26271205
has body: When your app is the default SMS app, it is responsible for writing incoming messages to the Provider, as it is the only app with write access to it. The following is a very simple, minimal example, and assumes you have the following import: import android.provider.Telephony.*; And the example write method: private void insertSms(String number, String message) { ContentValues smsValues = new ContentValues(); smsValues.put(Sms.ADDRESS, number); smsValues.put(Sms.BODY, message); smsValues.put(Sms.DATE, System.currentTimeMillis()); context.getContentResolver().insert(Sms.Inbox.CONTENT_URI, smsValues); }
has comment: http://stackoverflow.com/comment/41220633
answers question: http://stackoverflow.com/q/26270881
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41219576
has comment: http://stackoverflow.com/comment/41217614
has comment: http://stackoverflow.com/comment/41218487
downvote count: 0
has comment: http://stackoverflow.com/comment/41218105
has comment: http://stackoverflow.com/comment/41220001
score: 1
has comment: http://stackoverflow.com/comment/41217787
has comment: http://stackoverflow.com/comment/41220389
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41220172
accepted answer of: http://stackoverflow.com/q/26270881
has comment: http://stackoverflow.com/comment/41219137

http://stackoverflow.com/a/26195141
has comment: http://stackoverflow.com/comment/41075592
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41082372
upvote count: 1
has comment: http://stackoverflow.com/comment/41082858
answers question: http://stackoverflow.com/q/26195035
type: Answer
has body: As noticed by rolfl, it is no use to try to use java equals method to compare Points with an acceptable error (see TL/DR section below if you are in doubt). So, you have to do it the hard way. Do not even imagine to use map.containsKey(e), but create an explicit method in HashList. I would begin by that interface : public interface DistEquality&lt;E&gt; { boolean distEquals(E compare); } Then declare Point to implement it : public class Point implements DistEquality&lt;Point&gt; { ... public static double defaultError = 10E-3; @Override public boolean distEquals(Point compare) { return equals(compare, defaultError); } } And modify HashList that way public class HashList&lt;E extends DistEquality&lt;E&gt;&gt; { ... public int distValue(E e) { for (Entry&lt;E, Integer&gt; entry: map.entrySet()) { if (e.distEquals(entry.getKey())) { return entry.getValue(); } } return -1; } public int add(E e) { //returns key int pos = distValue(e); if (pos != -1) { return pos; } else { map.put(e, count); data.add(count,e); return count++; } } ... } I have not tested anything, but I think the general idea should be Ok. TL/DR Below solution is plain wrong - (thanks to rolfl to noticing) The equals method in class Point requires exact equality of doubles. You should instead have a static double defaultError in Point class, initialized at an appropriate value and then do : public boolean equals(Object compare) { return ((compare instanceof Point) ? equals(compare, defaultError) : false); } But as noticed by rolfl, this is not enough, because javadoc for Object.hashCode() states If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. It would be very hard to imagine an intelligent hash compatible with the above equality method. Worse, once one point gets a hashCode value, any other point is at a finite number of defaultError and you can imagine a finished suite of Points that are all …
has comment: http://stackoverflow.com/comment/41075801
has comment: http://stackoverflow.com/comment/41086180
has comment: http://stackoverflow.com/comment/41091824

http://stackoverflow.com/a/26332278
score: 1
downvote count: 0
has body: I am not an expert with Hibernate but for what I know you probably have two problems : First I think you need to put the % in the setParameter() call, not directly in the named query. This also means you'll end up with two parameters. Second, I assume str() is not needed since location.address is probably already a string. Moreover, it looks like there is a missing parenthesis at the end of your str() call. So, I would try something like that : @NamedQuery(name = "event_findLike", query = "from Event where location.address like :addressLike " + "or :address like '%'+location.address+'%'") and Query query = session.getNamedQuery("event_findLike").setParameter("addressLike", "%"+address+"%").setParameter("address", address);
answers question: http://stackoverflow.com/q/26329976
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41250374
type: Comment
comment on: http://stackoverflow.com/a/26285256
score: 0
type: AnswerComment
has text: This was excellent and helped me and my friend who were struggling with For statements. You put it into java terms, while MirroredFate put it into english, i applaud you both

http://stackoverflow.com/comment/41166461
type: Comment
comment on: http://stackoverflow.com/a/26242112
has text: @Yogu My understanding is that when the field is non-final, you can work around the problem by setting it to `null` when you clean up before undeployment. If the field is `final`, however, this workaround is no longer available.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26267839
score: 0
tagged with: guice
answer count: 1
has body: I'm using Guice in a Restlet web server, and there's one pattern I can't figure out: how to inject objects that are specific to a certain user or a certain request. Say we have a request to list all the Widgets that belong to a project. The service that looks up Widgets requires a Project instance. There are many Projects in the system. My code currently looks something like this: public class WidgetResource extends ServerResource { //path: project/{project}/widgets private final WidgetService service; private final ProjectLookup projectLookup; @Inject public WidgetResource(WidgetService service, ProjectLookup projectLookup) { this.service = service; this.projectLookup = projectLookup; } @Get public WidgetCollection getWidgets() { String projectName = getAttribute("project"); //restlet lookup of path var Project project = projectLookup.get(projectName); WidgetCollection widgets = service.getWidgetsFor(project); return widgets; } } This works well enough, but it's clumsy, and I hope there's a better way. It would be great to inject the correct Project object directly. Is there a way to do this? So far I've explored AssistedInject, which gives a factory object very similar to my Lookup. I came close to an answer with custom annotations/injections, but dead-ended because the Restlet attributes map isn't populated until after injection. Have read the GitHub docs and the User's Guide. Can't spot anything. I'd like to end up with something like this: public class WidgetResource extends ServerResource { private final WidgetService service; @Inject public WidgetResource(WidgetService service) { this.service = service; } @Inject @Get public WidgetCollection getWidgets(@PathName("project") Project project) { WidgetCollection widgets = service.getWidgetsFor(project); return widgets; } with (of course) a @Provides method in the configuration that would look up the path variable and use the lookup. However, I can't figure out a way to hand a provider method the path name or the …
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26285884
has title: Can Guice inject something that requires a lookup function?
type: Question
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/41265520
tagged with: java

http://stackoverflow.com/comment/41244200
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26285214
has text: Actually, I tried that, but a URI is not the same thing as a File path. I have just as much idea of how to turn my URI into a file path as I do about turning it into an ID.
type: Comment

http://stackoverflow.com/a/26277990
upvote count: 1
type: Answer
downvote count: 1
has body: Base64 works on blocks of 3 bytes, and the = padding is there to bring the output size up to a multiple of 3. This padding is optional, and if is not there then you can simply add it manually by checking the array length before trying to decode using the Java code.
answers question: http://stackoverflow.com/q/26275738
score: 0

http://stackoverflow.com/comment/41294907
score: 0
has text: This question appears to be off-topic because it lacks any search effort
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26314313

http://stackoverflow.com/a/26402728
score: 1
accepted answer of: http://stackoverflow.com/q/26299170
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26299170
type: Answer
has body: To achieve exactly what you want, I think you'd need to implement a BeanPostProcessor and provide your custom wiring logic (where you read the .properties file) in postProcessBeforeInitialization. The bean name is available to that method, but there are multiple problems with this. The first is that argument names are not necessarily available at runtime, so indexes might be a better option. The second is that you already have an instantiated bean (so a default constructor would need to exists), and you'd instantiate another, throwing the first one away which is wasteful. To use the instance that already exists, you'd need to wire it by properties, not constructor, which violates encapsulation and is not what you asked. The third is that it's not at all obvious what is going on. So, all in all, you are probably better off avoiding this completely.
upvote count: 1

http://stackoverflow.com/q/26328187
has answer: http://stackoverflow.com/a/26329733
tagged with: hibernate-mapping
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
tagged with: performance
accepted answer: http://stackoverflow.com/a/26329733
has body: If I have the following mapped collection in a POJO using JPA/Hibernate Annotations: @OneToMany(mappedBy = "columnName", fetch = FetchType.LAZY) @OrderBy("aField") @MapKeyJoinColumn(name = "id_fk") @LazyCollection(value = LazyCollectionOption.EXTRA) private Set&lt;PojoClass&gt; collection = new HashSet&lt;&gt;(); Is it possible to limit the size of the loaded collection to a specific number n or to set the page size to lazy load the first n elements of the collection without loading all the items or any other items from other instances of the class (like with @BatchSize)? Notice that the question explicitly refers to POJO mappings, not making additional queries, using Criteria or any other way to programmatically limit the size in explicit queries. Possible solutions I've been looking at are finding an implementation of the SQL TOP statement within Hibernate, hopefully as an annotation or create a custom CollectionPersister to modify the generated query (although this would require having the TOP statement implemented within the supported dialects).
score: 42
possible better answer: http://stackoverflow.com/a/47838879
upvote count: 42
has answer: http://stackoverflow.com/a/47838879
answer count: 2
tagged with: jpa
downvote count: 0
has title: Is it possible to limit the size of a @OneToMany collection with Hibernate or JPA Annotations?
favorite count: 0

http://stackoverflow.com/a/26222905
answers question: http://stackoverflow.com/q/26222469
type: Answer
has comment: http://stackoverflow.com/comment/41128212
has comment: http://stackoverflow.com/comment/41127533
has comment: http://stackoverflow.com/comment/41127772
has comment: http://stackoverflow.com/comment/41158909
has body: If I understand you correctly as I don't get this mouse part of 'drawn rectangle mouse transparent' - your rectangle should be transparent? You have to change the opacity of a rectangle: rect.opacityProperty().set(0.5);
score: 0

http://stackoverflow.com/comment/41302008
has text: Have to wait until I have +15 rep before voting responses up or down
type: Comment
comment on: http://stackoverflow.com/a/26285256
score: 0
type: AnswerComment

http://stackoverflow.com/a/26268053
type: Answer
answers question: http://stackoverflow.com/q/26267926
upvote count: 1
score: 1
has body: In a linked list, head is the first element or node in the list. The head serves as an entry point to your list as you can reach any element (let's say the nth element) of the list by starting from head and accessing the next field of the node objects n times.
downvote count: 0

http://stackoverflow.com/q/26254893
has answer: http://stackoverflow.com/a/26256031
type: UnansweredQuestion
downvote count: 1
has title: List all the sAMAccountName from ldap using java
score: 2
has body: I want to get the list of all sAMAccountName from ldap, Below is the method which gives me the Ldap attributes of a user by using samAccountName public static void searchUserFromLdap(String samAccountName) throws Exception{ SearchResult searchResult = ldapConnection.search("CN=XX,DC=XX,DC=XX", SearchScope.SUB, "(sAMAccountName=" + samAccountName +")"); if(searchResult.getSearchEntries().size()&lt;=0){ System.out.println("No such user found in LDAP"); return; } System.out.println("Start :- LDAP attributes for given user\n"); for(SearchResultEntry searchResultEntry : searchResult.getSearchEntries()){ System.out.println(searchResultEntry.toLDIFString()); } System.out.println("\nEnd :- LDAP attributes for given user"); } This method accept the samAccountName and returns the ldap attributes for user I want to get the list of all samAccountName, I have searched for this but i didn't get anything relevent, Can anyone please tell how can i get the list of sAMAccountName.
upvote count: 3
tagged with: java
type: Question
answer count: 2
tagged with: active-directory
tagged with: ldap
has answer: http://stackoverflow.com/a/26257126
favorite count: 0

http://stackoverflow.com/q/26232064
has answer: http://stackoverflow.com/a/26232699
has title: What is the best approach for Java, Spring and Angularjs web-app?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41144986
favorite count: 0
tagged with: angularjs
type: UnansweredQuestion
tagged with: spring
tagged with: twitter-bootstrap-3
has body: I want to develop a web app using following technologies: Maven, Java, Hibernate, Spring ( core, mvc, security, data), Bootstrap 3, AngularJs. I am wondering what is the best approch between the both. My question is about how to organize the web part. I have many html page in my application ( homepage.html, login.html, usermanagement.html, profil.hml, project.html) : 1.I want to use a real single page application where. I have one main file with ng-view tag and use a routeProvider to switch to partials. For instance, i could write the following code myApp.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/', { templateUrl: 'partials/homepage.html', controller: 'HomeCtrl' }). when('/login/', { templateUrl: 'partials/login.html', controller: 'LoginCtrl' }). otherwise({ redirectTo: '/' }); }]); The second option i have is to make multiple single page application. I this case, each page will be rendered using spring mvc. In each page i will have a angularjs controller. For instance, the following Spring MVC controller renders the home page. @Controller @RequestMapping( "/" ) public class HomePageController{ @RequestMapping( method = RequestMethod.GET ) public String index() { return "homepage"; } } For the home page, i will have the config as : myhomePageApp.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/', { templateUrl: 'nothing to display', controller: 'HomeCtrl' }). when('/contact/', { // display contact info in a div on home page templateUrl: 'partials/contact.html', controller: 'LoginCtrl' }). otherwise({ redirectTo: '/' }); }]); So it's page will be a single page application. Thank you for reading and for your suggestions.
has comment: http://stackoverflow.com/comment/41144143
upvote count: 3
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41145014
type: Question
score: 3

http://stackoverflow.com/a/26281427
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/41234687
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41235023
has body: Using your own code, change to this: public int getMaxIndex() { if (nelems == 0) { return -1; } long lngMax = arr[0]; int index = 0; for (int j = 1; j &lt; nelems; j++) { if (lngMax &lt; arr[j]) { lngMax = arr[j]; index = j; } } return index; }
answers question: http://stackoverflow.com/q/26281352

http://stackoverflow.com/q/26306856
has answer: http://stackoverflow.com/a/26306884
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has title: Cannot connect Java socket server and client
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41349140
type: Question
has body: I am learning about socket programming with Java. Using Java 8, have this simple server: import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; public class Main { public static void main(String[] args) throws Exception { System.out.println("MY IP address is " + InetAddress.getLocalHost().getHostAddress()); ServerSocket server = new ServerSocket(4031); Socket socket = server.accept(); System.out.println("Yay somebody connected! " + socket); socket.close(); server.close(); } } All it does is show the host's address and then wait for a socket to connect. And have this client: import java.net.Socket; public class Main { public static void main(String[] args) throws Exception { System.out.println("Trying to connect..."); Socket s = new Socket("123.456.7.890", 4031); System.out.println("Cool"); s.close(); } } When I run the server and the client in my house (in two different computers), this works: I simply grab the IP address displayed by the server, supply it to the client, and the connection is established. Now I have this same server in my house, whereas I am running my client in the office. Under the same process, I supplied the IP address printed by the server to my client. However, the connection is never established: neither the server or the client generate a socket. Happens with both Java 7 and 8. Tried several different ports. No exceptions are thrown. Both programs just hang in there, waiting. I am using Mac OSX Mavericks 10.9.5 on both machines. The firewalls are turned off on both machines. They are indeed connected to the internet. In fact, I used Chrome Remote Desktop to control the server and check its status. This works fine when both machines are in the same house. But not when one is in the house and another somewhere else. And yes, this works for localhost too. The above points seem to suggest that the issue is with the IP address I used to connect to my server. Maybe InetAddress.getLocalHost().getHostAddress() is not suit…
tagged with: network-programming
tagged with: java
has comment: http://stackoverflow.com/comment/41286687
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/41217751
score: 0
type: AnswerComment
type: Comment
has text: object.getJSONObject("objectString");
comment on: http://stackoverflow.com/a/26255338

http://stackoverflow.com/comment/41163543
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26242425
type: QuestionComment
has text: Do formatting first.

http://stackoverflow.com/comment/41091919
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26204216
has text: It doesn't seem that the OP wants to have a `List<Object>`. I think what he has is okay, I would change it to `List<Properties>`, but that actually doesn't matter
score: 0

http://stackoverflow.com/q/26195355
has comment: http://stackoverflow.com/comment/41081495
favorite count: 0
has comment: http://stackoverflow.com/comment/41147680
has body: We want to use existing C# sources within our Java project. So far, this would not be a great problem since using e.g. Java Native Interface (JNI) is quite straight forward. The problem is that the software shall also run on non-windows OS. So, we can compile the C# sources with Mono in order to make them executable on e.g. Linux. But how about the integration within Java? JNI or any COM-based solutions for C# &lt;-> Java interoperability are OS-dependent and only work e.g. on Windows. One possible solution would be the implementation of webservices. Has anybody another idea of how to solve this problem? I would be very thankful for alternative suggestions! Thanks very much! Regards
has comment: http://stackoverflow.com/comment/41104649
has title: Platform-Independent Java <-> C# Interoperability
has comment: http://stackoverflow.com/comment/41105276
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26195904
tagged with: language-interoperability
upvote count: 1
has comment: http://stackoverflow.com/comment/41105157
has comment: http://stackoverflow.com/comment/41135034
type: Question
has answer: http://stackoverflow.com/a/26318727
tagged with: c#
tagged with: java
has comment: http://stackoverflow.com/comment/41076338
possible better answer: http://stackoverflow.com/a/26318727
has comment: http://stackoverflow.com/comment/41076001
accepted answer: http://stackoverflow.com/a/26195904
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41084968
score: 1

http://stackoverflow.com/comment/41784024
score: 0
type: Comment
type: QuestionComment
has text: @Nevaeh is this working or not still?
comment on: http://stackoverflow.com/q/26297312

http://stackoverflow.com/a/26354097
answers question: http://stackoverflow.com/q/26294212
accepted answer of: http://stackoverflow.com/q/26294212
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/70867640
downvote count: 0
has body: At the end the sollution was pretty simple. In the work directory of the tomcat server, there were other apps that conflicted with this specific application I was trying to deploy.
score: 1

http://stackoverflow.com/comment/41246832
has text: Could you provide an example of what you want to achieve?
comment on: http://stackoverflow.com/q/26242100
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26325257
has title: Ant build fails when layout changes?
has answer: http://stackoverflow.com/a/26325482
type: UnansweredQuestion
has body: I generate my Android projects with android create project, and it creates a default template for layout. I use ant to build (debug) my project, but what I noticed is that it gives an error "build failed" whenever I change my main.xml layout file? What could cause that? The error ANT gives is this one: Path/To/Project/build:xml The following error occured while executing this line: Path/To/Project/build.xml:698: null returned: 1 It only happens when I change the layout, has anyone encountered something similar? Thank you for response in advance.
type: Question
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41315194
score: 0
tagged with: java
answer count: 1
tagged with: ant

http://stackoverflow.com/q/26330143
answer count: 4
type: AnsweredQuestion
has title: Waiting for an Async task to complete
has answer: http://stackoverflow.com/a/26330201
has comment: http://stackoverflow.com/comment/41324200
tagged with: java
has comment: http://stackoverflow.com/comment/41324219
upvote count: 1
has comment: http://stackoverflow.com/comment/41324196
type: Question
accepted answer: http://stackoverflow.com/a/26330218
downvote count: 0
possible better answer: http://stackoverflow.com/a/26330203
score: 1
tagged with: asynchronous
has body: I have three classes, Class A (Extends Activity. This is the main Activity) Class B (Extends Async. This is used to login) Class C (Extends Activity. This is to be called once the Async task from Class B is complete) Within my main activity (A), I am executing Class B's login methods. After these login methods run I want to open up the 2nd activity which is Class C. I can't do this right now as while Class B runs Class C opens. I need it to wait for the Async task to complete. Does anyone know how to achieve this? I have already searched and from what i've gathered people haven't been trying to do it with the same class structure as me which changes things up a little. Thanks
favorite count: 0
has answer: http://stackoverflow.com/a/26330203
has answer: http://stackoverflow.com/a/26330197
tagged with: android
has answer: http://stackoverflow.com/a/26330218

http://stackoverflow.com/a/26765952
answers question: http://stackoverflow.com/q/26343967
type: Answer
score: 0
has body: Alternatively you can use rules. This approach has the advantage that you don't need to inherit a certain class. In one class you implement a rule which specifies the behavior to be executed before and afte the test case execution. public class MyRule implements MethodRule { public Statement apply(final Statement statement, final FrameworkMethod frameworkMethod, final Object o) { return new Statement() { @Override public void evaluate() throws Throwable { try { before(); statement.evaluate(); } finally { after(); } } }; } protected void before() { System.out.println("before"); } public void after() { System.out.println("after"); } } Then you can instantiate the rule in each test class where it should be used. No inheritance is needed. public class TestClass { @Rule public MyRule myRule = new MyRule(); @Test public void test() { } }

http://stackoverflow.com/comment/41164496
comment on: http://stackoverflow.com/q/26242832
has text: @PatriciaShanahan, Class Object, meaning PC has no defined superclass by me.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/80591866
has text: hi ron_g_1 ~~~has result????? i same question~~~~~
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26260778

http://stackoverflow.com/comment/41170258
comment on: http://stackoverflow.com/q/26245817
score: 0
type: Comment
type: QuestionComment
has text: Not quite what we're looking for but thanks. We already have installed Tomcat. Now we need to dump our own server files into Tomcat.

http://stackoverflow.com/q/26304845
accepted answer: http://stackoverflow.com/a/26305176
has answer: http://stackoverflow.com/a/26304918
answer count: 4
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/18711896
has answer: http://stackoverflow.com/a/26304956
has answer: http://stackoverflow.com/a/26304987
type: Question
has title: String to int conversion with input from Scanner
has comment: http://stackoverflow.com/comment/41278264
has answer: http://stackoverflow.com/a/26305176
score: 0
has comment: http://stackoverflow.com/comment/41278200
has body: I am trying to convert a string value taken from the keyboard into an int value. I have done it like this before but now I am getting an error which states NumberFormatException.forInputString Scanner input = new Scanner(System.in); String choice = ""; int numberChoice; System.out.println("Please select one of the following options"); choice = input.nextLine(); numberChoice = Integer.parseInt(choice); /*I am getting the error on this line*/ The input code is: Data[] temperatures = new Data[7]; for(int i = 0; i &lt; temperatures.length; i++) { System.out.println("Please enter the temperature for day " + (i+1)); temperatures[i] = new Data(input.nextDouble()); }
has comment: http://stackoverflow.com/comment/41277962
possible better answer: http://stackoverflow.com/a/26304918

http://stackoverflow.com/comment/41086075
score: 1
type: Comment
type: QuestionComment
has text: Can you show us maxLabel too - the only guess we can make (as mentioned in the answer below) is that maxLabel is numeric.
comment on: http://stackoverflow.com/q/26200987

http://stackoverflow.com/comment/41308233
type: Comment
has text: Hi Alvin, I don't have Eclipse, I'm working over console, and I have added these 2 lines and I have this error now: `Exception in thread "main" java.lang.ClassCastException: com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl cannot be cast to javax.net.ssl.HttpsURLConnection`
type: AnswerComment
comment on: http://stackoverflow.com/a/26321188
score: 0

http://stackoverflow.com/comment/41100138
has text: Hey Stephen, i read the page you linked, it helped me a lot. I'm getting a different error now.
comment on: http://stackoverflow.com/a/26208357
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26283832
tagged with: spock
has body: I test my application using Spock framework, the tests are written in Groovy. As a result of some method evaluation I have a list of objects. I want to test if this list is the same as the list I expect. I have coded the following: def expectedResults = [ ... ] //the list I expect to see def isEqual = true; when: def realResults = getRealResultsMethod() //get real results in a list here expectedResults.each {isEqual &amp;= realResults.contains(it)} then: isEqual 0 * errorHandler.handleError(_) //by the way assert that my errorHandler is never called This is one of my first experiences with Groovy, so may be I am missing something? PS What confuses me is 'equals' operator in Groovy and Spock. Given Java ArrayList or Java array, equals operator is simply identity operator: equals is ==. In Groovy as far as I understand default equals operator is really equals (form here: http://groovy.codehaus.org/Differences+from+Java). But what is 'equals' for Groovy List or Set? UPDATE To be more precise. I want to find out wether the two lists have the same objects, no extra objects for both list, the order doesn't matter. For example: list=[1,5,8] list1=[5,1,8] list2=[1,5,8,9] println(list == list1) //should be equal, if we use == not equal println(list == list2) //should not be equal, if we use == not equal
has answer: http://stackoverflow.com/a/26374117
score: 21
tagged with: java
has answer: http://stackoverflow.com/a/26299168
downvote count: 1
type: Question
upvote count: 22
has answer: http://stackoverflow.com/a/77017657
accepted answer: http://stackoverflow.com/a/26283903
has comment: http://stackoverflow.com/comment/41284629
tagged with: groovy
possible better answer: http://stackoverflow.com/a/26296347
has answer: http://stackoverflow.com/a/26296347
favorite count: 0
answer count: 5
has title: Assert two lists are equal in Spock framework
has answer: http://stackoverflow.com/a/26283903
type: AnsweredQuestion

http://stackoverflow.com/q/26217143
has comment: http://stackoverflow.com/comment/41116067
has answer: http://stackoverflow.com/a/26245237
score: 6
tagged with: jetty
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41117427
has comment: http://stackoverflow.com/comment/41116191
tagged with: java
accepted answer: http://stackoverflow.com/a/26218083
type: Question
has comment: http://stackoverflow.com/comment/41116962
has answer: http://stackoverflow.com/a/68357773
has comment: http://stackoverflow.com/comment/41115941
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/41117151
tagged with: embedded-jetty
has title: Embedded Jetty Server - NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
possible better answer: http://stackoverflow.com/a/36458935
has answer: http://stackoverflow.com/a/36458935
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/26218083
has body: I've have the following code to use an embedded Jetty server alongside a simple servlet and .jsp webpage. However, after compiling and running the code: javac -cp lib/servlet-api.jar:lib/jetty-all.jar com/test/MyServlet.java javac -cp lib/servlet-api.jar:lib/jetty-all.jar com/test/ServerMain.java java -cp .:lib/servlet-api.jar:lib/jetty-all.jar com/test/ServerMain I get an error: INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet And navigating to /index.jsp gives a 500 error. HTTP ERROR 500 Problem accessing /index.jsp. Reason: JSP support not configured I've read this post but I don't think the solution applies here because I'm running Jetty embedded rather than using the start.jar. How can I resolve this error so that the server will run and serve .jsp pages successfully? ServerMain.java package com.test; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.webapp.WebAppContext; public class ServerMain { public static void main(String[] args) throws InterruptedException { Server server = new Server(8080); WebAppContext webApp = new WebAppContext(); webApp.setDescriptor("web.xml"); webApp.setResourceBase(""); webApp.setParentLoaderPriority(true); server.setHandler(webApp); try { server.start(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } server.join(); } } MyServlet.java package com.test; import java.io.IOException; import java.util.Properties; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class MyServlet extends HttpServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); resp.getWriter().println("Hello, this is a testing servlet. \n\n"); Properties p = System.getProperties(); p.list(resp.getWriter()); } } web.xml <?xml version="1.0" encoding="utf-8"?> MyServlet com.test.MyServlet MyServlet …

http://stackoverflow.com/q/26313407
downvote count: 0
answer count: 1
tagged with: creation
tagged with: synchronization
favorite count: 0
has body: I am trying to find out time needed for thread creation and synchronization. I know that I should use ThreadMXBean, but I can't find simple example that demonstrate this using ThreadMXBean and Callable interface. package teststckofw; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; public class TestStckOfw { public static void main(String[] args) throws ExecutionException { int i = 0; int processed = 0; while (i &lt; 10) { Parallel parallel1 = new Parallel(); Parallel parallel2 = new Parallel(); ExecutorService exec1 = Executors.newCachedThreadPool(); List&lt;Callable&lt;Integer&gt;&gt; tasks1 = new ArrayList&lt;&gt;(); try { tasks1.add(parallel1); tasks1.add(parallel2); try { List&lt;Future&lt;Integer&gt;&gt; futures = exec1.invokeAll(tasks1); int flag = 0; for (Future&lt;Integer&gt; f : futures) { Integer res = f.get(); if (res != 0) { processed = res; } if (!f.isDone()) { flag = 1; } } } catch (InterruptedException e) { e.printStackTrace(); } } finally { exec1.shutdown(); } i++; } } /**************************************/ static class Parallel implements Callable&lt;Integer&gt; { @Override public Integer call() throws Exception { int a = 2 + 2; // do something... return a; } } } Edit: I need information for all threads during the long while loop with many iterations (much more than 10). Can I get summary information for all threads in all iterations by using thread dump?
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26313479
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: callable
has title: Time needed for thread creation and synchronisation
has answer: http://stackoverflow.com/a/26313479

http://stackoverflow.com/comment/41224900
has text: What happens if you run `rpm` from the Cygwin bash shell? That is exactly what the plugin is doing.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26275253

http://stackoverflow.com/a/33087603
upvote count: 7
type: Answer
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/54111747
answers question: http://stackoverflow.com/q/26342444
has body: Solved this exact issue in a Cordova project that used the facebook plugin. I was able to successfully build by commenting out this line from platforms\android\project.properties, as shown: # cordova.system.library.1=com.android.support:support-v4:+ And by commenting out this line from platforms\android\build.gradle, as shown: // compile "com.android.support:support-v4:+" Then doing the build. The problem started when I installed (katzer/cordova-plugin-local-notifications) which added these lines, but it created a conflict since the library it was adding to the build was already part of the facebook plugin build.

http://stackoverflow.com/a/26304443
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26297670
score: 3
has comment: http://stackoverflow.com/comment/41332496
downvote count: 0
has body: You'll have to do this on your own. Take a look at the logEndpoints method (which is what actually logs this information - with private methods). You should be able to adapt this method to handle the resources from your environment.jersey().getResourceConfig() after you configure your resources in your run method. Something like: final ImmutableList.Builder&lt;Class&lt;?&gt;&gt; builder = ImmutableList.builder(); for (Object o : environment.jersey().getResourceConfig().getSingletons()) { if (o.getClass().isAnnotationPresent(Path.class)) { builder.add(o.getClass()); } } for (Class&lt;?&gt; klass : environment.jersey().getResourceConfig().getClasses()) { if (klass.isAnnotationPresent(Path.class)) { builder.add(klass); } } final List&lt;String&gt; endpoints = Lists.newArrayList(); for (Class&lt;?&gt; klass : builder.build()) { AbstractResource resource = IntrospectionModeller.createResource(klass); endpoints.add(resource.getPath().getValue()); } Note that what's in master is slightly ahead of what's in Maven - the above example shows how to get the AbstractResource which will work with 0.7.1. You'll have to be sure to adapt your method as dropwizard evolves. This example also doesn't normalize the path but I you can easily add that based on logEndpoints.

http://stackoverflow.com/comment/44318609
score: 3
type: AnswerComment
type: Comment
has text: AppXray description http://docs.oracle.com/cd/E15315_09/help/oracle.eclipse.tools.webtier.doc/html/files/appXRayOverview.html
comment on: http://stackoverflow.com/a/27159436

http://stackoverflow.com/q/26226477
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26239439
type: Question
tagged with: apache-commons-beanutils
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26239439
answer count: 1
has title: Java Bean Utils to call all setters with non String types
has comment: http://stackoverflow.com/comment/41155077
has comment: http://stackoverflow.com/comment/41133968
has body: I am trying to call all setter method for my bean using a hashmap. The key is the property name and the value is the actual value i need to set by calling setters. Follwoing code works perfectly for string proerties but fails on non string properties like int,double etc. for(Map.Entry&lt;String, String&gt; entry : settings.entrySet()){ try{ key = entry.getKey(); PropertyUtils.setProperty(bean, key, entry.getValue()); } catch(Exception ex) { LOGGER.debug("failed...."+ex.getMessage()); } } The above code throws exception for non String fields like int / double etc failed....Cannot invoke setter on bean class - argument type mismatch - had objects of type "java.lang.String" but expected signature "int" failed....Cannot invoke setter on bean class - argument type mismatch - had objects of type "java.lang.String" but expected signature "double" The question is: How to avoid this excepition, how to call setter successfully without having this exception.
type: AnsweredQuestion

http://stackoverflow.com/comment/41170576
comment on: http://stackoverflow.com/a/26244607
score: 0
has text: No, you really don't need to use recursion at all. I don't think this is the simplest approach to the problem. See my comment where I describe how to do it. Maybe I should turn it into an answer.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41266087
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26298378
type: AnswerComment
has text: I only want you to up vote my answer if you think it is worthy.

http://stackoverflow.com/comment/41105389
has text: Did you recognized, that when you start eclipse that eclipse is searching a JRE at a complete other location: /opt/eclipse/jre/bin/java, did the path changed after you -vm changes?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26211181

http://stackoverflow.com/comment/41087178
type: Comment
has text: No no I mean protected static fields in class A. class A and class B are in the same package.
type: QuestionComment
comment on: http://stackoverflow.com/q/26201432
score: 0

http://stackoverflow.com/comment/41172682
has text: How do you know it's not working? Error? This isn't supposed to print anything.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26246780
type: Comment

http://stackoverflow.com/a/26274328
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/41972570
type: Answer
has body: I've created Appstart (https://github.com/omerio/appstart) a boilerplate maven based multi-module App Engine application that demonstrates the use of technologies like Guice, Jersey, Objectify, Cloud EndPoints and has 3 modules a fronend module, backend module and common module which includes all the common classes including the model, which should show you an example of how to manage common code. The folder contains the following modules/maven projects appstart-backend appstart-common appstart-ear appstart-frontend The backend module only contains code required for the backend, the frontend contains the frontend code and the common module contains common code. The projects are setup inside a parent folder 'appstart' with a parent maven POM. The common module is included in both the frontend and backend using a maven dependency: uk.co.inetria.appstart appstart-common 1.0-SNAPSHOT When you change the common code you can run mvn clean then install from the appstart-ear directory and it should update all dependent projects. I hope this helps
has comment: http://stackoverflow.com/comment/41705088
has comment: http://stackoverflow.com/comment/47337806
upvote count: 4
answers question: http://stackoverflow.com/q/26259418
has comment: http://stackoverflow.com/comment/47318205

http://stackoverflow.com/comment/41150075
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26234716
score: 0
has text: I forgot to mention that, I am trying to execute the code in my office system, which connects to internet through a proxy server. Is there any way to include the proxy server details, if at all this is needed?

http://stackoverflow.com/q/26340941
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26342348
tagged with: validation
score: 0
has title: Multiple Spring MVC validator for the same Controller
tagged with: spring
has answer: http://stackoverflow.com/a/43792933
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/43792933
has answer: http://stackoverflow.com/a/26342348
has body: I am having a Spring controller with a Validator defined as: @InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(new MyValidator(myService)); } And calling it: public ResponseEntity&lt;?&gt; executeSomething( @ApiParam(name = "monitorRequest", required = true, value = "") @Valid @RequestBody MonitorRequest monitorRequest, HttpServletRequest request, HttpServletResponse response) throws RESTException I need to add one more Validator for this controller that could be called from some specific methods of this controller. Is there any way to achieve this? EDIT: I am handling the Error by: @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseBody public ResponseEntity&lt;?&gt; processValidationError(MethodArgumentNotValidException ex) { BindingResult result = ex.getBindingResult(); List&lt;FieldError&gt; fieldErrors = result.getFieldErrors(); ValidationErrorObj obj = processFieldErrors(fieldErrors); ResponseEntity r = new ResponseEntity(obj, HttpStatus.BAD_REQUEST); return r; }

http://stackoverflow.com/comment/41167040
type: Comment
comment on: http://stackoverflow.com/a/26244117
score: 0
has text: Any live non-daemon thread should prevent the jvm from terminating, but stdout could be closed when main returns.
type: AnswerComment

http://stackoverflow.com/comment/41174830
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26248265
has text: I'm not sure what you are asking. If you are asking why Java chose to create an ArrayList<Integer> instead of an ArrayList<Number>, this is because the type of li is ArrayList<Integer>, and the language infers the type from the type of li. If the type of li were List<? extends Number>, then you'd be able to make the assignment.
score: 0

http://stackoverflow.com/comment/41290374
comment on: http://stackoverflow.com/q/26311730
type: QuestionComment
has text: `GroovyShell` look at here: http://groovy.codehaus.org/api/groovy/lang/GroovyShell.html
type: Comment
score: 0

http://stackoverflow.com/comment/45337106
type: Comment
comment on: http://stackoverflow.com/a/26328555
type: AnswerComment
score: 38
has text: By "general-purpose type", I meant building it into the language's type system, rather than providing a library class that approximates it. (Some languages have types for T? (T or null) and T! (non-nullable T)) Optional is just a class; we can't make implicit conversions between Foo and Optional<Foo> as we could have with language support.

http://stackoverflow.com/q/26336486
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26337599
downvote count: 0
has answer: http://stackoverflow.com/a/26336774
has answer: http://stackoverflow.com/a/26337449
favorite count: 0
has body: I was asked to write code for the below structure: 1 3 2 4 5 6 10 9 8 7 11 12 13 14 15 And I tried the below code, which works, yet I'm wondering if there is any better approach than this: public static void main(String[] args) { int no_of_rows=5; int c=0; for(int i=1;i&lt;=no_of_rows;i++){ for(int k=i;k&lt;no_of_rows;k++){ System.out.print(" "); } if(i%2!=0){ for(int j=0;j&lt;i;j++){ c++; System.out.print(c +" "); } } else{ int a[] = new int [i+1]; for(int j=0;j&lt;i;j++){ c++; a[j]=c; } for(int j=i-1;j&gt;=0;j--){ System.out.print(a[j]+" "); } } System.out.println(""); } } Is there any better implementation or am I doing it right?
answer count: 3
possible better answer: http://stackoverflow.com/a/26337449
has title: pyramid numbers in alternative reverse order
has comment: http://stackoverflow.com/comment/41335962
accepted answer: http://stackoverflow.com/a/26336774
upvote count: 1
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/41111030
type: Comment
has text: For your information my sample pojo may look like below :
type: QuestionComment
comment on: http://stackoverflow.com/q/26214508
score: 0

http://stackoverflow.com/q/26345939
type: UnansweredQuestion
tagged with: makefile
has body: I'm trying to compile java files with make. My Makefile produces the following output when I run make. make: *** No rule to make target `file1.class', needed by `classes'. Stop. What's causing this error? Here is my original Makefile JFLAGS = -g JC = javac .SUFFIXES: .java .class .java.class: $(JC) $(JFLAGS) $*.java CLASSES = \ file1.java \ file2.java \ file3.java \ file4.java \ main.java default: classes classes: $(CLASSES:.java=.class) clean: $(RM) *.class
linked to: http://stackoverflow.com/q/10050481
answer count: 0
has comment: http://stackoverflow.com/comment/41353667
tagged with: java
has title: Error from the java makefile
type: Question
has comment: http://stackoverflow.com/comment/41353295
has comment: http://stackoverflow.com/comment/41353348
score: 0
linked to: http://stackoverflow.com/q/9935635

http://stackoverflow.com/comment/41306764
has text: Yeah I guess I was asking about using spring aop with the xml config versus using spring aop with the aspectj annotations, using it with the aspectj annotations seems to allow us to apply our aspects to individual methods/joinpoints while using the xml config means we will apply it to a class or a group of methods included in the pointcut expression - spring with aspectj does seem to provide more flexibility in this regard?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26320639
type: Comment

http://stackoverflow.com/comment/41085749
has text: Yes i also use the public but again it showing same error . But if i remove my Constructor part then why my other methods are not running except BMI and BMI1.
type: Comment
comment on: http://stackoverflow.com/a/26200791
score: 0
type: AnswerComment

http://stackoverflow.com/q/26250498
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41179523
type: Question
has comment: http://stackoverflow.com/comment/41179150
linked to: http://stackoverflow.com/q/3481828
has title: How do I get java to store a text file in a 2D array and locate a specific point in said array?
has comment: http://stackoverflow.com/comment/41178973
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/41178841
score: 0
has body: I'm using Eclipse for this program and I'm trying to do is get the program to read the text file "ClimateDataA" and then find the date of the first time the temperature is under 80 degrees and I have to use for &amp; while loops. This is what the text file "ClimateDataA" contains: 14939 20140801 86 14939 20140802 90 14939 20140803 93 14939 20140804 87 14939 20140805 93 14939 20140806 83 14939 20140807 81 14939 20140808 83 14939 20140809 85 14939 20140810 85 14939 20140811 80 14939 20140812 81 14939 20140813 87 14939 20140814 89 14939 20140815 76 14939 20140816 87 14939 20140817 92 14939 20140818 91 14939 20140819 93 14939 20140820 96 14939 20140821 90 14939 20140822 93 14939 20140823 95 14939 20140824 91 14939 20140825 83 14939 20140826 81 14939 20140827 77 14939 20140828 82 14939 20140829 75 14939 20140830 87 14939 20140831 92 Column 1 is an ID number. Column 2 is the date. Column 3 is the temperature. This is my code so far: import java.util.Scanner; import java.io.*; public class ClimateSummary { public static void main (String [] args) throws FileNotFoundException { Scanner userInfo = new Scanner (new File("MyInfo.txt")); Scanner weatherData = new Scanner (new File("ClimateDataA.txt")); String userName = userInfo.nextLine(); String userBirthPlace = userInfo.nextLine(); int userBirthDay = userInfo.nextInt(); String userBirthMonth = userInfo.next(); int userBirthYear = userInfo.nextInt(); String dataLocation = userInfo.next(); int [][] myArray = new int[31][3]; for (int i = 0; i &lt; myArray.length; i++) { } System.out.println("Welcome " + userName + "! This is the Super Computing Weathernator 3000!"); System.out.println(); System.out.println("Name: " + userName); System.out.println("Date of birth: " + userBirthDay + " " + userBirthMonth + " " + userBirthYear ); System.out.println("Place of birth: " + userBirthPlace); System.out.println("Data collected at: " + dataLocation); System.out.println(); System.out.println("The first day under 80 degrees is "); userInfo.c…
has comment: http://stackoverflow.com/comment/41179010
has answer: http://stackoverflow.com/a/26250980
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41178904
tagged with: text
linked to: http://stackoverflow.com/q/7413830
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/41178491
has comment: http://stackoverflow.com/comment/41178505

http://stackoverflow.com/comment/41212782
comment on: http://stackoverflow.com/a/26268998
type: AnswerComment
score: 0
has text: @shanwu At compile time, _only_ if a type is used in the source code, its class will be looked up. The compiler will use it to verify any use of the type in the source code: method calls, field accesses, etc.
type: Comment

http://stackoverflow.com/comment/41167690
score: 0
type: QuestionComment
type: Comment
has text: Show your spring dependencies you have in your pom.xml
comment on: http://stackoverflow.com/q/26244219

http://stackoverflow.com/a/26318721
has comment: http://stackoverflow.com/comment/41303959
has comment: http://stackoverflow.com/comment/41303344
has comment: http://stackoverflow.com/comment/41302938
score: 0
has comment: http://stackoverflow.com/comment/41303012
answers question: http://stackoverflow.com/q/26318691
type: Answer
upvote count: 1
downvote count: 1
has body: Make two methods, one contains the real code, acception the version with the double-array and the other method, accepting the integer-version just calls this method but first converts the integer-array to a double array. public void doSomething(HashMap&lt;Integer, int[]&gt; arg0) { //convert int[] to double[] and fill this HashMap HashMap&lt;Integer, double[]&gt; converted; doSomething(converted); } public void doSomething(HashMap&lt;Integer, double[]&gt; arg0) { //your logic here }

http://stackoverflow.com/comment/41317116
has text: "How can I do to make that the two services share the same data?" -- you start by getting rid of one service. In your example, there is no reason why a single service cannot both write to a file and do calculations. Whether that single service does one or both things can be controlled by the UI. Services are not general-purpose Java classes. Only create separate services when there is a clear technical reason to do so, and usually that will be because they have dramatically different lifetimes. Also, per your question title, services are not threads.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26326455
score: 0

http://stackoverflow.com/a/26260922
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26259953
has body: HashMap would be a better approach to your implementation: Map&lt;String[], ArrayList&lt;Object[]&gt;&gt; unit = new HashMap&lt;String[], ArrayList&lt;Object[]&gt;&gt;(); String[] header1 = {"func", "name", "lrt"}; Object[] value11 ={"f1", "n1", 0.1}; Object[] value12 ={"f2", "n2", 0.2}; String[] header2 = {"name", "func", "lrt"}; Object[] value21 ={"n3", "f3", 0.1}; Object[] value22 ={"n4", "f4", 0.2}; ArrayList&lt;Object[]&gt; values = new ArrayList&lt;&gt;(); values.add(value11); values.add(value12); unit.put(header1, values); values.clear(); values.add(value21); values.add(value22); unit.put(header1, values); Try this and you will have a unit object holding all your values.

http://stackoverflow.com/comment/41395339
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26365328
has text: Using a font-centric library doesn't help my situation since ColumnText controls the flow of the text.
score: 0

http://stackoverflow.com/a/26260682
type: Answer
has body: If it's just those two paths and you'd want them handled with a single handler method, simply choose one of your methods and annotate it with @RequestMapping(value = {"/apple", "/test/apple"})
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26260659
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26260659

http://stackoverflow.com/comment/41090250
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26203375
has text: @Fev It's just a snippet of a Main class and a separated MyThread class.

http://stackoverflow.com/q/26243641
favorite count: 0
has comment: http://stackoverflow.com/comment/41166111
accepted answer: http://stackoverflow.com/a/26243698
has answer: http://stackoverflow.com/a/26243688
score: -3
has comment: http://stackoverflow.com/comment/41166118
has body: I used the following code in my Java project to sort strings by their length: SortedMap&lt;String, String&gt; values = new TreeMap&lt;String, String&gt;(new Comparator&lt;String&gt;() { public int compare(String s1, String s2) { return s2.length() - s1.length(); } }); Then, I added the following: values.put("a", "4"); values.put("bb", "45"); values.put("c", "6"); However, it returns only two values: {bb=45, a=6} I wondered why? Can anybody explain this to me or fix it? Thx.
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26243686
tagged with: arrays
has comment: http://stackoverflow.com/comment/41166620
has answer: http://stackoverflow.com/a/26243698
has answer: http://stackoverflow.com/a/26243686
tagged with: sorting
tagged with: comparator
downvote count: 4
has title: Comparator problems in Java
answer count: 3

http://stackoverflow.com/comment/41234574
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26281394
type: Comment
has text: what's the point of result type long? index `j` won't be larger than INT_MAX anyway.

http://stackoverflow.com/q/26302134
has answer: http://stackoverflow.com/a/26302311
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/26302201
type: AnsweredQuestion
has title: How to view the source of a JSP file client side
tagged with: java
has body: I have been writing c#, html, js, jquery for awhile and been using F12 in chrome and IE to look at the html code to help me with some dom manipulation. I am curious if there is a way to do something similar to that context to look at a jsp page and manipulate it with javascript. For example: viewsource on a jsp page and fill out a textbox on the jsp page with javascript. I hope the question is clear and the example makes sense. I am not working on anything with this so I don't have a real example. This is more of curiosity. I know javascript but I am not familiar with java at all.
type: Question
possible better answer: http://stackoverflow.com/a/26302250
has answer: http://stackoverflow.com/a/26302250
tagged with: javascript
score: 0
has answer: http://stackoverflow.com/a/26302201
answer count: 3

jpanel
tags question: http://stackoverflow.com/q/26314300
tags question: http://stackoverflow.com/q/26319866
tags question: http://stackoverflow.com/q/26330501
tags question: http://stackoverflow.com/q/26305763
tags question: http://stackoverflow.com/q/26220192
tags question: http://stackoverflow.com/q/26314705
tags question: http://stackoverflow.com/q/26321598
tags question: http://stackoverflow.com/q/26349232
type: Tag
tags question: http://stackoverflow.com/q/26228358
tags question: http://stackoverflow.com/q/26340137
tags question: http://stackoverflow.com/q/26194982
tags question: http://stackoverflow.com/q/26226895
tags question: http://stackoverflow.com/q/26315398
tags question: http://stackoverflow.com/q/26252614
tags question: http://stackoverflow.com/q/26328070
tags question: http://stackoverflow.com/q/26305139
tags question: http://stackoverflow.com/q/26210236
tags question: http://stackoverflow.com/q/26199634
tags question: http://stackoverflow.com/q/26208723
tags question: http://stackoverflow.com/q/26319408
tag name: jpanel
tags question: http://stackoverflow.com/q/26340442
tags question: http://stackoverflow.com/q/26263007
tags question: http://stackoverflow.com/q/26217613
tags question: http://stackoverflow.com/q/26316970
tags question: http://stackoverflow.com/q/26215882
tags question: http://stackoverflow.com/q/26199008
tags question: http://stackoverflow.com/q/26207479

http://stackoverflow.com/a/26277922
has comment: http://stackoverflow.com/comment/41232956
has comment: http://stackoverflow.com/comment/41368607
answers question: http://stackoverflow.com/q/26277538
has comment: http://stackoverflow.com/comment/41232256
type: Answer
has comment: http://stackoverflow.com/comment/41232878
has comment: http://stackoverflow.com/comment/41233155
score: 0
has comment: http://stackoverflow.com/comment/41368664
has body: If the setcs command is applied to a snapshot view, it triggers an update which can be lengthy. If the set config spec was aborted once and then resumed, it can lead to that error message. You need to launch manually from the ClearCase Explorer a full update of the view, then try again your script through Jenkins to see if the error persists. In your case though, you seem to create a dynamic view: try and delete that view, before launching your Jenkins job again (which will re-create it). As mention in this thread, make sure that the view storage path (the one ending in .vws) is correct.
has comment: http://stackoverflow.com/comment/41232470

http://stackoverflow.com/q/26322600
tagged with: rome
linked to: http://stackoverflow.com/q/16173292
tagged with: syndication-feed
has body: A few related questions: What's the version number for the latest version for Rome? Where can I download the JAR for the latest version? Where does maven get its JAR for Rome? finally, Rome is, objectively, numerically, the most frequently use Java API for parsing RSS feeds?
accepted answer: http://stackoverflow.com/a/26323206
score: 0
answer count: 1
has title: Getting and running Rome
has answer: http://stackoverflow.com/a/26323206
tagged with: maven
type: AnsweredQuestion
tagged with: rss
tagged with: java
type: Question

http://stackoverflow.com/comment/41371333
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26336255
score: 1
has text: could you elaborate on the last statement about respecting security policies or maybe post some link? Thanks.

http://stackoverflow.com/q/26333077
has title: How to read or write data from a MySQL cPannel Database in Java for an Android App
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26333213
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/41329790
tagged with: database
tagged with: cpanel
score: 0
has body: Any tutorials out there on how to send and received data to and from a MySQL database hosted on a server using cPannel? I'm trying to make an android app that connects to the internet, and it needs to read and write data to and from the hosted database. The database is a MySQL one and is hosted on godaddy. I've been on the internet all day today looking, so any help would be greatly appreciated.
accepted answer: http://stackoverflow.com/a/26333213
tagged with: android
answer count: 1

http://stackoverflow.com/q/26195769
has title: multiple executed statements in one condition? help please
answer count: 5
has comment: http://stackoverflow.com/comment/41076667
has answer: http://stackoverflow.com/a/26195788
has answer: http://stackoverflow.com/a/26195791
has answer: http://stackoverflow.com/a/26195787
type: AnsweredQuestion
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/41076751
has comment: http://stackoverflow.com/comment/41076709
type: Question
tagged with: if-statement
downvote count: 6
has answer: http://stackoverflow.com/a/26195800
possible better answer: http://stackoverflow.com/a/26195787
upvote count: 2
has body: For if and else conditions, is there a way to put more than one statement to be executed for each condition? Example: if ( loan &lt; 1000 ) f = (loan * 100 / 1000); **System.out.println( "The loan amount is $" + loan ); System.out.println( "The finance charge is $" + f ); System.out.println( "The total cost is $" + (loan + f) );** How can I format it so multiple conditions (bolded) is included in the condition?
has answer: http://stackoverflow.com/a/26195794
accepted answer: http://stackoverflow.com/a/26195794
favorite count: 0

http://stackoverflow.com/comment/41321146
has text: See my (updated) last paragraph. You need to pass the metadata from the reader to the writer (your gist passes `null` as meta data). The easiest is to use `reader.readAll(0, param)`. Obtaining a writer this way only ensures the writer will understand the meta data from the reader. As both can be reused, you need to pass the meta data each time.
type: Comment
comment on: http://stackoverflow.com/a/26324133
type: AnswerComment
score: 0

http://stackoverflow.com/a/26314411
type: Answer
score: 0
has body: You say the images are donwloaded, i assume that the images are coming from internet. Implement a custom cache for http download or download and store the images in one place before you use
answers question: http://stackoverflow.com/q/26314098

http://stackoverflow.com/q/26221027
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41123941
has title: Netbeans will not Deploy to Tomcat
upvote count: 3
has comment: http://stackoverflow.com/comment/41123871
has answer: http://stackoverflow.com/a/53645467
favorite count: 0
tagged with: netbeans
linked to: http://stackoverflow.com/q/21137287
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41123762
has comment: http://stackoverflow.com/comment/41123811
score: 3
downvote count: 0
tagged with: servlet-container
tagged with: java
has comment: http://stackoverflow.com/comment/41124235
type: Question
tagged with: jakarta-ee
answer count: 1
has body: I am struggling to get my Netbeans IDE to deploy my Java Web Project to a tomcat server (I normally use Eclipse). I have setup the tomcat server (7.0.55) within Netbeans (8.0.1) and can start and stop the server. Unfortunately, when I attempt to deploy any applications I receive this error: Starting Tomcat process... Waiting for Tomcat... Tomcat server started. In-place deployment at C:\Users\kevin.bowersox\Documents\NetBeansProjects\WebApplication1\build\web Deployment is in progress... deploy?config=file%3A%2FC%3A%2FUsers%2FKEVIN%7E1.BOW%2FAppData%2FLocal%2FTemp%2F1%2Fcontext882537679043940070.xml&amp;path=/WebApplication1 Connection timed out: connect C:\Users\kevin.bowersox\Documents\NetBeansProjects\WebApplication1\nbproject\build-impl.xml:1070: The module has not been deployed. See the server log for details. BUILD FAILED (total time: 6 minutes 0 seconds) I have checked all of the tomcat logs (catalina.out, localhost, etc), but they do not reveal what is causing this error. I can see that the server startup occurs in the logs, but the deployment fails. At the moment I am only deploying a very simple Java web application (basically what gets created initially). Can anyone point me in the right direction or tell me where to find more debugging output? I have googled this issue for the past few hours with no luck. Thanks.

http://stackoverflow.com/comment/41340798
score: 0
comment on: http://stackoverflow.com/q/26335957
type: QuestionComment
has text: Of course it **can** be done. But you are probably need to create a custom `ObjectFactory` for that.
type: Comment

http://stackoverflow.com/a/26210464
type: Answer
has comment: http://stackoverflow.com/comment/41103661
has body: Try this code - try { String reportSource = "resources/report1.jrxml"; Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, new JREmptyDataSource()); JasperViewer.viewReport(jasperPrint, false); } catch (Exception e) { System.out.println(e.getMessage()); }
has comment: http://stackoverflow.com/comment/41103691
has comment: http://stackoverflow.com/comment/41103930
answers question: http://stackoverflow.com/q/26210407
has comment: http://stackoverflow.com/comment/41104120
score: 0
has comment: http://stackoverflow.com/comment/41103843
has comment: http://stackoverflow.com/comment/41103757

http://stackoverflow.com/comment/41276960
comment on: http://stackoverflow.com/a/26304268
type: AnswerComment
has text: Thanks, I should've seen that, but according to my instructors instructions I need these 5 lines of code into my main, which is when i'm getting the errors.
score: 0
type: Comment

http://stackoverflow.com/comment/41122383
type: AnswerComment
comment on: http://stackoverflow.com/a/26201798
score: 0
type: Comment
has text: I have followed the steps that you suggested - I have a new java class that extends SPIPluginLifecycle and have also added the new config file in /src/main/resources/META-INF/services. However, I don't see this initialization class getting called at all. Heres the logs I do see on startup.

http://stackoverflow.com/a/26226913
has body: The % operator returns the remainder after dividing the first number by the second number. If the second number (in your example size) is zero, then you will get a divide by zero ArithmeticException. The key is to check if size is zero before performing this loop, and take the appropriate action.
score: 5
accepted answer of: http://stackoverflow.com/q/26226863
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/26226863
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26258408
upvote count: 2
type: UnansweredQuestion
has body: According to the Hibernate doc, the best way to do a bulk insert is that : Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); for ( int i=0; i&lt;100000; i++ ) { Customer customer = new Customer(.....); session.save(customer); if ( i % 20 == 0 ) { //20, same as the JDBC batch size //flush a batch of inserts and release memory: session.flush(); session.clear(); } } tx.commit(); session.close(); Actually, I'm using Hibernate with Spring (@Transactional), so I don't use Session and methods flush() and clear(). I have major problem with performance : 1 hour to insert 7400 rows... I think Spring is mismanaging the session and disconnects from the database between calling a method of the DAO class. How to check that ?
tagged with: spring
has title: Batch Insert/Update with Spring Hibernate
score: 2
tagged with: performance
has comment: http://stackoverflow.com/comment/41192407
answer count: 0
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/41192487
has comment: http://stackoverflow.com/comment/41192077
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26277373
has title: Java syntax - extra plus sign after cast is valid?
upvote count: 16
answer count: 3
has comment: http://stackoverflow.com/comment/41227160
has body: So I came across something that confused me when casting a byte to char, usually I would do this: for (byte b:"ABCDE".getBytes()) { System.out.println((char)b); } Which will print out A B C D E I accidentally left a + between the (char) and b and got the same result!? Like so: for (byte b:"ABCDE".getBytes()) { System.out.println((char) + b); } Why exactly is this happening? Am I essentially doing (char)(0x00 + b)? Because System.out.println((char) - b); yields a different result. Note: Using Java version 1.8.0_20
has answer: http://stackoverflow.com/a/26277448
favorite count: 0
has answer: http://stackoverflow.com/a/26277471
has answer: http://stackoverflow.com/a/26277454
accepted answer: http://stackoverflow.com/a/26277454
possible better answer: http://stackoverflow.com/a/26277448
type: AnsweredQuestion
tagged with: syntax
downvote count: 0
tagged with: java
score: 16
type: Question
tagged with: casting

http://stackoverflow.com/comment/41262453
type: Comment
type: QuestionComment
has text: Where are you using `onEditFieldValueCommit()`? Your accessor naming is wrong: `getFieldNameProperty()` should be `fieldNameProperty()`
score: 1
comment on: http://stackoverflow.com/q/26291999

http://stackoverflow.com/q/26352391
upvote count: 1
type: Question
tagged with: weblogic
tagged with: datasource
has body: I have deployed a sample webservice application to remote weblogic server (12C) which has a datasource that accesses a remote database server. The deployment was successful. The data source was tested OK from within the Weblogic Server. But when I am trying to test the webservice (which uses this datasource) I am getting the following error inside weblogic When I am testing the same webservice from standalone url (webservice test client - see image) I am getting the following error for the same method. The User name and passowrd for base authentication is correct. Though I am not very sure what/why the base authentication is required, since the data-source has it all. Please advise how to test a webservice that is acessing a remote database through a data source. Link to an example using remote weblogic server and remote database server will also be a great help. ! [In webservice test client]
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: web-services
tagged with: jdeveloper
answer count: 0
has title: WebService test from within Weblogic server (12c)
score: 1
tagged with: java

http://stackoverflow.com/q/26295123
has comment: http://stackoverflow.com/comment/41330658
upvote count: 2
has comment: http://stackoverflow.com/comment/41269145
has comment: http://stackoverflow.com/comment/41277622
has comment: http://stackoverflow.com/comment/41271722
linked to: http://stackoverflow.com/q/11248897
possible better answer: http://stackoverflow.com/a/26295220
has answer: http://stackoverflow.com/a/26295267
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41266150
tagged with: guava
linked to: http://stackoverflow.com/q/13429400
tagged with: java
has body: Can I rely on order while transforming ? public class DtoFunc implements Function&lt;Entity,DTO&gt;{ Entity previousEntity; @Override public DTO apply(Entity entity){ DTO dto = new DTO(); // do transforming previousEntity = entity; return dto; } } as you can see that I store state in my function, and I rely that when I invoke Lists.transform(entityList,new DtoFunc()) it will transform consequentially .Does it tranform in sequential order ?? Can I rely on it ? CORRECT ANSWER : Transformation order depends on access from transformed list because transformation is lazy. Function have to be stateless because Guava is not thread safe.
has comment: http://stackoverflow.com/comment/41377405
type: Question
duplicate of: http://stackoverflow.com/q/13429400
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/41348407
downvote count: 0
accepted answer: http://stackoverflow.com/a/26295267
has comment: http://stackoverflow.com/comment/41273655
has title: Does Guava Lists.transform guarantee order?
favorite count: 0
has answer: http://stackoverflow.com/a/26295220

http://stackoverflow.com/comment/41117323
score: 0
type: AnswerComment
has text: @foxxy http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#split-java.lang.String-
comment on: http://stackoverflow.com/a/26217246
type: Comment

http://stackoverflow.com/comment/41275517
type: Comment
type: QuestionComment
has text: @SentryGoingUp - Yep. Sorry I was trying not to disrupt your question :) but wanted to indicate you did have the public key in a .pem file (just in case it was not included in the assertion) Mainly I was curious too about the process .. and whether or not you actually *had to* import it into your keystore or could just extract it from the file they sent you.
comment on: http://stackoverflow.com/q/26265727
score: 0

http://stackoverflow.com/comment/41361380
type: AnswerComment
comment on: http://stackoverflow.com/a/26350315
type: Comment
has text: I thought that in JDBC 4.0, calling `Class.forName()` was no longer necessary. [Source](http://www.onjava.com/2006/08/02/jjdbc-4-enhancements-in-java-se-6.html)
score: 1

http://stackoverflow.com/a/26328945
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/41323088
has body: You're calling the methods statically. Static methods should be reserved for methods that take all the information they need in the method signature. You have also swapped your getter and setter methods. Try creating an object of type dog, and assigning the data to it: Scanner sc = new Scanner(System.in); Dog currentDog = new Dog(); String name = sc.next(); currentDog.setName(name); String breed = sc.next(); currentDog.setBreed(breed); String color = sc.next(); currentDog.setColor(color); double weight = sc.nextDouble(); currentDog.setWeight(weight); double height = sc.nextDouble(); currentDog.setHeight(height); double length = sc.nextDouble(); currentDog.setLength(length); Then to retrieve your data: String name = currentDog.getName(); String breed = currentDog.getBreed(); String color = currentDog.getColor(); double weight = currentDog.getWeight(); double height = currentDog.getHeight(); double length = currentDog.getLength(); For the methods... Understanding Class Members Another resource you should look into is Scanner API Documentation on how to use the scanner object.
answers question: http://stackoverflow.com/q/26328877
downvote count: 0

http://stackoverflow.com/a/26261328
answers question: http://stackoverflow.com/q/26256183
has comment: http://stackoverflow.com/comment/41243693
score: 0
has body: Ok, so you have 3 questions/problems. How to create a Webservice How to manage database connections Execute batch process All of this, in the same App. First of all, I should advice you to split into 2 app, one for consume (Web Services) and another for batch processing, including push notifications (IMHO). But lets go one step at a time. 1. Webservice: It's depends on the framework you choose. I usually made a choice between Spring-MVC or Jersey 2. How to manage database connections When you are querying a database, you usually don't want to open and close connections crazily. You want to use a connection pool. In a connection pool you'll ask for an open connection, will use it, and will free it when you are done. Normally, a connection pool is managed por the application server. If you want to manage the connections manually, you have to use a singleton to centralise acquiring and releasing. 3. Execute batch process You probably should use a singleton to manage batch process. This job manager will launch the job executions on other threads Don't know if that answers your question/concern.. please let me know.
has comment: http://stackoverflow.com/comment/41243720
type: Answer

http://stackoverflow.com/comment/41235875
comment on: http://stackoverflow.com/q/26282009
score: 0
type: Comment
type: QuestionComment
has text: The words in your text could be the keys for a HashMap containing key + count. e.g.: `HashMap<String, Integer>()`

http://stackoverflow.com/a/26242520
score: 2
has comment: http://stackoverflow.com/comment/41163878
has comment: http://stackoverflow.com/comment/41164675
answers question: http://stackoverflow.com/q/26242489
upvote count: 2
has body: super.onStop(); Dear lord no. Do not call the Activity lifecycle callback methods manually from other methods. Call finish() to end the Activity.
downvote count: 0
has comment: http://stackoverflow.com/comment/41163958
has comment: http://stackoverflow.com/comment/41164320
has comment: http://stackoverflow.com/comment/41164272
has comment: http://stackoverflow.com/comment/41164399
type: Answer

http://stackoverflow.com/comment/41135243
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26227076
has text: So...where are you getting this mystical value `s` from? What does it contain?

http://stackoverflow.com/comment/41323237
type: AnswerComment
score: 6
type: Comment
has text: it doesn't make any change!
comment on: http://stackoverflow.com/a/26328171

http://stackoverflow.com/comment/41078687
has text: @MadProgrammer: Which build tool/IDE uses a *sex* directory? Must be fun working at your workplace :)
type: QuestionComment
comment on: http://stackoverflow.com/q/26196706
score: 0
type: Comment

http://stackoverflow.com/comment/41123032
has text: Or try `while (--count > 0 ){}`. Is count a long? How come you don't need the L?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26220437
score: 0

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/26318474

http://stackoverflow.com/q/26262710
has body: I am new in Android and I'm trying to develop a simple application with two layouts the first one contains a Button and a ListView. By pressing the button I am going to the second layout using an explicit intent. The second layout contains a Button and an EditText. Passing a string inside the EditText field and pressing the button I am transferring the string with the explicit intent in the first layout and then I have to add it in an ArrayList and pass it to the ListView through the Array Adapter. My question is how to fix this application so it won't crush and if there is any other way to perform the flow. This is my first activity: import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import java.util.ArrayList; public class ListView extends Activity { ArrayList&lt;String&gt; list; ArrayAdapter&lt;String&gt; aa; Button button; android.widget.ListView view; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_view); //Getting the message from the FormView.class Intent intent = getIntent(); String message = intent.getStringExtra(FormView.EXTRA_MESSAGE); //Getting the button's id button = (Button) findViewById(R.id.second_button); //Passing the message to the ArrayList list = new ArrayList&lt;String&gt;(); list.add(message); //Passing the ArrayList in the ListView through the ArrayAdapter view = (android.widget.ListView) findViewById(R.id.list_view); aa = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, list); view.setAdapter(aa); } private void addItem(String item) { if (item.length() &gt; 0) { this.list.add(item); this.aa.notifyDataSetChanged(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu…
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41200752
has comment: http://stackoverflow.com/comment/41201335
type: Question
has title: Flow of an Android App with ArrayList, ArrayAdapter and ListView
has comment: http://stackoverflow.com/comment/41201307
tagged with: listview
tagged with: arraylist
tagged with: android-listview
has comment: http://stackoverflow.com/comment/41200483

http://stackoverflow.com/q/26197678
answer count: 1
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/26197756
tagged with: storage
has body: I'm trying to used sharedpreferences for when a user chooses a specific custom image they want in their storage for a part of a grid of images. I want the image they chose to show up even after they close the application and reopen it. The problem I'm having is that the sharedpreferences don't seem to be working. Nothing shows up as the background image for the grid item they've selected once they've closed the app or even just pressed the back button. Do I have to create a sharedpreferences file myself? I can't figure out how to get to it or create one if so using androidstudio. Here's my code for the class (Sorry if it's long and messy...I am new to coding and still testing things): public class editCreations extends Activity { public int mPosition = 0; protected static Sounds sound = new Sounds(); private static int RESULT_LOAD_IMAGE = 1; private MediaRecorder mRecorder; private MediaPlayer mPlayer; private String mOutputFile = Environment.getExternalStorageDirectory().getAbsolutePath(); private Drawable mImageFileName; private Button recordBtn; private Button stopBtn; private Button playBtn; private Button stopPlayBtn; private ImageButton imgBtn; private Drawable bg; private String mPicturePath; private ImageAdapter img = new ImageAdapter(this); View.OnClickListener playListener = new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(editCreations.this, "test", Toast.LENGTH_SHORT); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create); mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB); mRecorder.setOutputFile(mOutputFile); recordBtn = (Button)findViewById(R.id.create_record_button); recordBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) …
has answer: http://stackoverflow.com/a/26197756
type: AnsweredQuestion
tagged with: java
tagged with: sharedpreferences
has title: sharedpreferences not loading or saving
type: Question

http://stackoverflow.com/comment/41154375
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26234709
has text: Does it show the comment, when you do like the code snippet in the middle? and hover over onResume?
score: 0

http://stackoverflow.com/comment/41186489
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26254219
has text: I mean that Sri with the phrase "Asterisks are permitted in positions 2-5" wanted to say "Asterisks are permitted FROM position 2 TO position 5" not "In position 2 and 5"

http://stackoverflow.com/q/26341152
has answer: http://stackoverflow.com/a/32618003
has answer: http://stackoverflow.com/a/26342434
tagged with: javafx-8
has body: ControlsFX class Dialogs is marked as deprecated. What to use instead?
type: AnsweredQuestion
score: 21
favorite count: 0
type: Question
answer count: 2
has title: controlsfx Dialogs deprecated for what?
accepted answer: http://stackoverflow.com/a/26342434
tagged with: java
tagged with: javafx
upvote count: 21
possible better answer: http://stackoverflow.com/a/32618003
downvote count: 0
tagged with: controlsfx

http://stackoverflow.com/comment/41165052
comment on: http://stackoverflow.com/a/26227730
type: Comment
score: 1
type: AnswerComment
has text: @user3538292 Think of your data structure (your array) as a container that only fits a specific type of object, like an egg carton can only contain eggs, or a bowling ball bag can only contain bowling balls. A bowling ball does not belong in, nor would it fit, an egg carton. When you declare a data structure, you also tell the Java compiler what kind of things belong inside it (typical objects of a specific class or objects subclassed from that class). The more you code, the more you'll get used to this idea. Just remember: every thing has a specific place.

http://stackoverflow.com/comment/41192733
comment on: http://stackoverflow.com/q/26237774
score: 0
type: QuestionComment
has text: If I follow, this isn't something you can do with Selenium.
type: Comment

http://stackoverflow.com/q/26206741
has comment: http://stackoverflow.com/comment/41096610
accepted answer: http://stackoverflow.com/a/26211454
has comment: http://stackoverflow.com/comment/41097136
has comment: http://stackoverflow.com/comment/41096581
has comment: http://stackoverflow.com/comment/41105520
has comment: http://stackoverflow.com/comment/41096715
tagged with: package
has comment: http://stackoverflow.com/comment/41097216
has comment: http://stackoverflow.com/comment/41097033
has answer: http://stackoverflow.com/a/26211454
type: AnsweredQuestion
has body: Alright, consider the following example: inside of the src/ folder, i have the following packages : org/ com/ Class Foo is located in org.somepackage; Class Doo is located in com.apackage; Foo needs to access Doo using Class.forName(); if i try using Class.forName("com.apackage.Doo"); i get ClassNotFoundException as they are in different Packages. how can Foo acess Doo in this hiearchy? EDIT Here is some more background: the complete asked about info : this is my batch file, jar file, and the src file that has the file im trying to access. this is the class in the src file : this is my batch file : now when i try to access the file Doo, this is the error: Cheers.
has title: how to get a class with forName() in a different package?
has comment: http://stackoverflow.com/comment/41097497
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41097084
has comment: http://stackoverflow.com/comment/41097596
has comment: http://stackoverflow.com/comment/41098144
has comment: http://stackoverflow.com/comment/41096795
tagged with: class
has comment: http://stackoverflow.com/comment/41097173
score: 0
has comment: http://stackoverflow.com/comment/41097005
has comment: http://stackoverflow.com/comment/41096775
answer count: 1
has comment: http://stackoverflow.com/comment/41096914

http://stackoverflow.com/comment/41106775
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26212070
has text: what does newAtMaximumEast() do ? Is it just a constructor ?
score: 0

http://stackoverflow.com/q/26350269
tagged with: java
has body: I am getting a java.sql.SQLException: No suitable driver found. I am trying to connect to a remote database. I think I have all my credentials correct. Here is my code public static void main(String[] args) { String dbUrl = "jdbc:mysql:sshhost/db1"; try { Connection myConn = DriverManager.getConnection(dbUrl, "usr", ""); Statement myStat = myConn.createStatement(); ResultSet myRs = myStat.executeQuery("select * from students"); while (myRs.next()) { System.out.println(myRs.getString("last_name") + ", " + myRs.getString("first_name")); } } catch (Exception e) { e.printStackTrace(); } } The host is the same remote host that I ssh into. I log on to mysql as root and this requires no password so I left the last parameter "" The database I want to use while logged into root is called db1. I'm not sure if my parameters are valid.
has title: connecting to remote database with jdbc, verify credentials
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41361713
has comment: http://stackoverflow.com/comment/41362441
has answer: http://stackoverflow.com/a/26350315
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41362424
tagged with: jdbc
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/41360975
has answer: http://stackoverflow.com/a/26350305
has comment: http://stackoverflow.com/comment/41361516

http://stackoverflow.com/comment/41331017
type: QuestionComment
score: 0
has text: What is the line 106 in QuizMe Activity?
comment on: http://stackoverflow.com/q/26333819
type: Comment

http://stackoverflow.com/comment/41184194
has text: I use both Windows 8 and Ubuntu 14.04
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26253839
score: 0

http://stackoverflow.com/comment/41342327
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26339819
has text: ... for someone else maybe?
type: Comment

http://stackoverflow.com/q/26232946
tagged with: java
tagged with: logback
has answer: http://stackoverflow.com/a/26233192
downvote count: 0
answer count: 1
score: 1
favorite count: 0
tagged with: slf4j
type: UnansweredQuestion
tagged with: maven
upvote count: 1
has body: In my application, I'm using SLF4j as logging facade with multiple bindings present as slf4j-simple-1.6.2.jar logback-classic-1.0.4.jar Both of these are defined in pom.xml as ** ** org.slf4j slf4j-api 1.6.2 ** ** org.slf4j slf4j-simple 1.6.2 ** ** ch.qos.logback logback-core 1.0.4 ch.qos.logback logback-classic 1.0.4 A simple test program, which can be run natively import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TimePass { private Logger log = LoggerFactory.getLogger(getClass()); public static void main(String[] args) { new TimePass().run(); } private void run() { System.out.println(log); log.info("WE ARE RUNNING"); System.out.println("HIHIHIHI"); } } This project/webapp is deployed on 2 locations. But when I run it on both, the results are strikingly different. On 1 instance, output is SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/hemant/.m2/repository/org/slf4j/slf4j-simple/1.6.2/slf4j-simple-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/hemant/.m2/repository/ch/qos/logback/logback-classic/1.0.4/logback-classic-1.0.4.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 0 [main] INFO com.expertly.bin.TimePass - WE ARE RUNNING org.slf4j.impl.SimpleLogger(com.expertly.bin.TimePass) HIHIHIHI While on the other, its SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/hemant/.m2/repository/ch/qos/logback/logback-classic/1.0.4/logback-classic-1.0.4.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/hemant/.m2/repository/org/slf4j/slf4j-simple/1.6.2/slf4j-simple-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 14:58:18,760 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 14:58:18,7…
type: Question
has title: SLF4j resolve multiple bindings

http://stackoverflow.com/comment/41232960
comment on: http://stackoverflow.com/q/26280411
type: QuestionComment
has text: You calculator would be less exact than a PC or a mobile phone... so it's maybe rounding
score: 0
type: Comment

http://stackoverflow.com/comment/41240553
score: 0
comment on: http://stackoverflow.com/q/26283966
type: Comment
type: QuestionComment
has text: the simplest way I learned how...http://imgur.com/DCjGgIO

http://stackoverflow.com/q/26284945
answer count: 2
possible better answer: http://stackoverflow.com/a/26284967
score: 0
tagged with: sql
tagged with: jdbc
tagged with: insert
has answer: http://stackoverflow.com/a/26285042
accepted answer: http://stackoverflow.com/a/26285042
has body: I am trying to insert some data into my database with jdbc. I am using the correct table, db name, and parameters. Everything is checked. Code public static void main(String[] args) throws IOException/*, ClassNotFoundException, SQLException*/ { DataInputStream d = new DataInputStream(System.in); System.out.println("Enter employee ID : "); @SuppressWarnings("deprecation") int empid = Integer.parseInt(d.readLine()); System.out.println("Enter employee name : "); @SuppressWarnings("deprecation") String empname = d.readLine(); System.out.println("Enter employee ID : "); @SuppressWarnings("deprecation") double empsalary = Double.parseDouble(d.readLine()); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } Connection con; try { con = DriverManager.getConnection("jdbc:mysql://localhost:3306/testDB","root",""); PreparedStatement pst = con.prepareStatement("insert into `employee` values(?,?,?"); pst.setInt(1, empid); pst.setString(2, empname); pst.setDouble(3, empsalary); int rowcount = pst.executeUpdate(); System.out.println(rowcount + " row has been instered"); } catch (SQLException e) { e.printStackTrace(); } and here are the errors that it gives me when I try to run it: com.mysql.jdbc.exceptions.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 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) 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.executeUpdate(PreparedStatement.java:1604) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519) at com.mysql.jdbc.Pr…
has title: JDBC insert error
has answer: http://stackoverflow.com/a/26284967
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question

http://stackoverflow.com/comment/41382444
type: Comment
has text: Yes. I get same stacktrace.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26338982

http://stackoverflow.com/q/26289189
has answer: http://stackoverflow.com/a/26290810
tagged with: pojo
tagged with: jackson
score: 0
has title: Json to POJO parsing using jackson - @JsonPropertyOrder for below Json vary based on #students?
answer count: 1
accepted answer: http://stackoverflow.com/a/26290810
has body: This is my json input { "students_key": { "student_key_one": { "profile_root": "/profile/student_key_one/", "nickname": "sam1", "email": "sam1@gmail.com", "studentkey": "student_key_one" }, "student_key_two": { "profile_root": "/profile/student_key_two/", "nickname": "sam2", "email": "sam2@gmail.com", "studentkey": "student_key_two" }, "student_key_three": { "profile_root": "/profile/student_key_three/", "nickname": "sam3", "email": "sam3@gmail.com", "studentkey": "student_key_three" }, "student_key_four": { "profile_root": "/profile/student_key_four/", "nickname": "sam4", "email": "sam4@gmail.com", "studentkey": "student_key_four" }, "student_key_five": { "profile_root": "/profile/student_key_five/", "nickname": "sam5", "email": "sam5@gmail.com", "studentkey": "student_key_five" } } } As the number of students increases the properties will also increase (student_key_one, student_key_two, student_key_three, student_key_four, student_key_five, student_key_six.......) the property will dynamically increase or decrease based on #students. As this is not an array of objects, how can I create the POJO for StudentsKey? Can someone help me write the pojo for deserialisation using jackson?
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/comment/41309572
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26322290
type: Comment
has text: Ah I see what you're asking. So a DataPoint has either a sector code or an industry code, and are stored in two separate lists, one of DataPoints with sector values, and one of DataPoints with industry values. Those lists never merge together, so they are only sorting among sector values or industry values, not both. The formatIndustryData method I included at the bottom, for example, is sorting all of the DataPoints containing industry values from all of the files. There is another method that does this for all of the DataPoints with sector values.

http://stackoverflow.com/a/26265035
has comment: http://stackoverflow.com/comment/41205847
has comment: http://stackoverflow.com/comment/41211425
has comment: http://stackoverflow.com/comment/41205493
has comment: http://stackoverflow.com/comment/41204909
accepted answer of: http://stackoverflow.com/q/26265001
downvote count: 1
has comment: http://stackoverflow.com/comment/41204926
answers question: http://stackoverflow.com/q/26265001
has comment: http://stackoverflow.com/comment/41204950
has comment: http://stackoverflow.com/comment/41209900
has comment: http://stackoverflow.com/comment/41205092
upvote count: 1
has comment: http://stackoverflow.com/comment/41205423
type: AcceptedAnswer
has body: Change this line. if(yearPublished=0&amp;monthPublished=0){ return ("Published: "+"invalid number"); to if(yearPublished == 0 &amp;&amp; monthPublished == 0){ return ("Published: "+"invalid number"); I imagine you are now getting your second, unreachable return, error due to you having an else statement above this block of code, which is called when your conditions in your if-else if loops are false. The else portion will always execute if your conditions are false once it reaches it, thus making this block unreachable. Here is one easy way to return the string that you want. Simply declare a string to return, then keep adding to it and finally return it once you've evaluated all of your conditions. public String printDetails() { String returnString = ""; //declaring a string to build upon to return once finished all conditions. if(title !=null) { returnString += "Title: " + title + " "; } else if(title == null || title.length() &lt;= 3) { returnString += "Title: " + "invalid text "; } if(bookNumber &gt;= 10000 &amp;&amp; bookNumber &lt;= 20000) { returnString += "ISBN: " + bookNumber + " "; } else if(bookNumber == 0) { returnString += "ISBN: " + "invalid number "; } if(lastName == null || firstName == null) { returnString += "Author: " + "invalid text "; } else if(firstName != null || lastName != null) // changed to not= null. { returnString += "Author: " + firstName + " " + lastName + " "; } if(yearPublished == 0 &amp;&amp; monthPublished == 0) { returnString += "Published: " + "invalid number "; } else if(yearPublished != 0 &amp;&amp; monthPublished != 0) { returnString += "Published: " + monthName + " " + yearPublished; } return returnString; // now after the string has been built, we will return it. } Finally: Your setMonthName() method is perfect for a switch statement, The example given is actually exactly what you would want to do. You might also want to accept monthPublished as an argument instead of monthName.
has comment: http://stackoverflow.com/comment/41205477
score: 0
type: Answer

http://stackoverflow.com/a/26324004
upvote count: 2
has body: You are storing LandPlot as key and not as value. Tryhm.put(i, new LandPlot(x,y)); instead.
accepted answer of: http://stackoverflow.com/q/26323943
answers question: http://stackoverflow.com/q/26323943
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/41105692
score: 0
type: AnswerComment
type: Comment
has text: I also notice the response code is actually 200 not 202
comment on: http://stackoverflow.com/a/26210893

http://stackoverflow.com/comment/41276557
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26300361
type: AnswerComment
has text: Yes, most methods (like `read`, `write` etc) can be (and trust me, they are) used concurrently.

http://stackoverflow.com/q/26331187
accepted answer: http://stackoverflow.com/a/26331247
type: Question
score: 5
tagged with: hashmap
has title: Clear HashMap Values While Retaining Keys
possible better answer: http://stackoverflow.com/a/26331271
has answer: http://stackoverflow.com/a/26331247
has comment: http://stackoverflow.com/comment/41326194
has answer: http://stackoverflow.com/a/26331271
answer count: 3
has body: Is there a way to clear all of the values, while retaining the keys? My HashMap is &lt;String,String&gt;, so should I just loop through and replace each value with a null? Is there a better way to do it?
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/41326149
has answer: http://stackoverflow.com/a/26336769
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/41170106
score: 0
has text: @PeterLawrey I actually don't see how. Mind explaining?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26238226

http://stackoverflow.com/q/26244345
answer count: 1
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26247104
favorite count: 0
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26247104
upvote count: 1
type: Question
has title: How would I make a Java class thread safe for XPages
tagged with: xpages
has body: I was writing (re-writing from LS) a Java library of common functions, for example, a method to add a user to a group in the Domino directory. In LotusScript this was done in an agent/script library and concurrent agents were not turned on. So, I did not have to worry about save conflicts if two users invoked the method to add a user to the same group. In XPages they can run concurrently. So, I was wondering what is the best practice to restrict the method so it was thread-safe. I was initially thinking I was not going to use managed beans since I am not saving any information, just calling this method to add a user to a group. But, I can see that if the method was run concurrently to add a user to the same group there might be a save conflict. Any suggestions on how to best prevent this? Use an application scoped managed bean and set a flag when the method is running? Or should I just handle this by calling save(false, false) so my document save will fail and I have logic in my code to try again? Or, is there some other best practice to use?

http://stackoverflow.com/q/26271469
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41216938
tagged with: jdbc
score: 2
has comment: http://stackoverflow.com/comment/41217159
tagged with: java
has comment: http://stackoverflow.com/comment/41222632
has comment: http://stackoverflow.com/comment/41219298
type: Question
has body: I want to delete the current row displayed in jframe from the table contact I wrote the code try { conn = java.sql.DriverManager.getConnection(connectionURL, "usrnme", "pswd"); Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);//also tried with ResultSet.TYPE_SCROLL_SENSITIVE rs.deleteRow(); rs.next();//it may or may not include in code } catch(Exception e){System.out.println( "JDBC error: " + e );} sql query String sql="SELECT * FROM contact order by first_name, last_name"; rs=stmnt.executeQuery(sql); but it throws an exception while running JDBC error: java.sql.SQLException: 'deleteRow' not allowed because the ResultSet is not an updatable ResultSet. Help me!
has title: Delete row from table
has answer: http://stackoverflow.com/a/26273138
answer count: 3
has answer: http://stackoverflow.com/a/26276507
has comment: http://stackoverflow.com/comment/41222602
downvote count: 0
has answer: http://stackoverflow.com/a/26272953
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/41294463
comment on: http://stackoverflow.com/q/26311771
type: Comment
type: QuestionComment
score: 0
has text: Also consider [`TextLayout`](http://stackoverflow.com/search?tab=votes&q=user%3a230513%20textlayout).

jtextarea
tags question: http://stackoverflow.com/q/26252614
tags question: http://stackoverflow.com/q/26220988
type: Tag
tags question: http://stackoverflow.com/q/26270382
tags question: http://stackoverflow.com/q/26317014
tags question: http://stackoverflow.com/q/26312785
tags question: http://stackoverflow.com/q/26314559
tag name: jtextarea
tags question: http://stackoverflow.com/q/26346293
tags question: http://stackoverflow.com/q/26265684
tags question: http://stackoverflow.com/q/26352188

http://stackoverflow.com/comment/41262035
has text: Sorry for the messed up code. It seems to always get screwed up when I try to add code.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26296320

http://stackoverflow.com/q/26291409
has body: I'm writing a Java program to parse through a text file, line by line, containing lists of numbers. However, not all lines contain numbers. I was wondering how I could skip over those lines without numbers. The text file looks like this. 1 0 &gt; 1 6 2 6 3 6 1 1 &gt; 4 -1 1 2 &gt; 8 -1 1 3 &gt; 9 -1 1 4 &gt; 1 -1 5 -1 6 -1 1 5 &gt; 1 6 &gt; 7 -1 8 -1 1 7 &gt; 1 8 &gt; 7 -1 0 9 &gt; I have a for loop that goes through each line and processes the numbers to the left of the &gt; sign, however, whenever I reach lines with no numbers right of &gt;, I get a NullPointerException. Here is the code I'm having trouble with. It occurs when I try adding children to my tokens[i] state. File file = new File("data.txt"); Scanner scanner = new Scanner(file); HashMap&lt;String, Integer&gt; states = new HashMap&lt;String, Character&gt;(10); while(scanner.hasNextLine()) { String line = scanner.nextLine(); String[] tokens = line.split(" |&gt;"); for(int i = 3; i &lt; line.length(); i++) { if(tokens[i] == null | tokens[i + 1] == null | tokens[i] == "") break; if(i % 2 != 0) tokens[1].children.add(states.get(tokens[i])); } } State is a class I've created which contains an ArrayList called children in which I add different states to
tagged with: java
type: Question
score: 0
tagged with: file-io
has comment: http://stackoverflow.com/comment/41255001
has comment: http://stackoverflow.com/comment/41269380
has title: Check for Empty Input
has comment: http://stackoverflow.com/comment/41253409
has comment: http://stackoverflow.com/comment/41253450
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41253590

http://stackoverflow.com/q/26244430
tagged with: class
has comment: http://stackoverflow.com/comment/41167673
has comment: http://stackoverflow.com/comment/41169315
has body: I'm trying to display couple of images on the other image. It's important for me to have this pictures in two diffrent classes becous i need to connect this images with the other properties. I wrote a class which add and display one picture at a time. import java.awt.*; import javax.swing.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Obrazek { BufferedImage image; Obrazek(){ File imageFile = new File("tło.jpg"); try { image = ImageIO.read(imageFile); } catch (IOException e) { System.err.println("Blad odczytu obrazka"); e.printStackTrace(); } } JPanel pane = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(image, 0, 0, null); } }; } Let say i have two classes of that kind, each with diffrent image. Then I wrote my main class with main method which define frame and create image. import java.awt.*; import javax.swing.*; public class ButtonDemo{ public static void main(String[] args) { JFrame frame = buildFrame(); Obrazek obraz = new Obrazek(); frame.add(obraz.pane); } private static JFrame buildFrame() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setSize(200, 200); frame.setVisible(true); return frame; } } But when i add next frame.add(someobject.pane); it's delete previous one and displays only the last one. How to make them display together but from two separate classes.
has answer: http://stackoverflow.com/a/26248269
score: 0
has title: The two images, one on the other in Java
tagged with: swing
possible better answer: http://stackoverflow.com/a/26244524
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41170555
has answer: http://stackoverflow.com/a/26244524
linked to: http://stackoverflow.com/q/26131977
tagged with: java
accepted answer: http://stackoverflow.com/a/26248269
tagged with: image
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41176609

http://stackoverflow.com/a/26263739
upvote count: 1
has comment: http://stackoverflow.com/comment/41217358
answers question: http://stackoverflow.com/q/26251486
downvote count: 0
has comment: http://stackoverflow.com/comment/41240594
has body: Given the structure you use, you actually need one more level of classes to contain external type id. So something like this: public class ClassA { private ValueWrapper[] arrayObj1; } public class ValueWrapper { @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "type") @JsonSubTypes(value={ @JsonSubTypes.Type(value = T1.class, name = "t1") } public Value value; public String otherInfo; // or use getters/setters in addition; left as fields for brevity } public abstract class Value { ... } ) However, looking at your JSON more closely, this actually would only work if your values were POJOs. If assumption is that type is for all elements of the value array, there is no automated way to do that. You will unfortunately need to handle polymorphic types manually.
type: Answer
score: 1

http://stackoverflow.com/comment/41251666
type: QuestionComment
type: Comment
has text: Please show the actual test as well as a stacktrace.
score: 3
comment on: http://stackoverflow.com/q/26290371

http://stackoverflow.com/comment/41312221
comment on: http://stackoverflow.com/q/26323771
type: Comment
has text: @Dici i load .java file in to textarea .then read line by line so when i read a line which is constructor line i wanna find index of start and end of parameter list.line can contain anything valid in java.
score: 0
type: QuestionComment

http://stackoverflow.com/a/26326689
answers question: http://stackoverflow.com/q/26326541
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/41317839
score: 3
downvote count: 0
has body: It seems you got some concepts mixed up a little bit. In Java, objects are instances of classes. A class is the blueprint, the plan, the design, the model of something, an object is the actual thing. As a class is an abstract concept, you cannot modify its properties at runtime. It's the objects whose properties you can modify. Here's an example: Ball ball = new Ball(); Ball is a class, ball is an object. This object is an instance of the Ball class. If the Ball class defines some setters, like setColor, setSpeed, you can use those to modify properties of this ball object.

apache-commons-cli
tags question: http://stackoverflow.com/q/26256420
tag name: apache-commons-cli
type: Tag

http://stackoverflow.com/comment/41205502
has text: You made this function take O(N) stack space (arguably this was necessary, since OP demanded a recursive solution) and O(N^2) time (totally unnecessary, why are you copying the list over and over?). Plus it breaks for lists whose first element is `null`.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26253843
type: Comment

http://stackoverflow.com/q/26277041
accepted answer: http://stackoverflow.com/a/26627627
favorite count: 0
has body: I hava some problem with Class StackedAreaChart and setLowerBound. When I set autoRangingProperty to true, everything is OK http://i62.tinypic.com/2q0n3ht.png But when I turn off autoRanging and set some params I hava some bugs.. http://i62.tinypic.com/2hdcn6p.png import java.util.Random; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.StackedAreaChart; import javafx.scene.chart.XYChart; import javafx.scene.layout.BorderPane; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class TestStackedAreaChart extends Application { StackPane mainGraphStackPane = null; BorderPane pane; public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { // / Random generator = new Random(); XYChart.Series&lt;Number, Number&gt; series1 = new XYChart.Series&lt;&gt;(); // line XYChart.Series&lt;Number, Number&gt; series2 = new XYChart.Series&lt;&gt;(); // down XYChart.Series&lt;Number, Number&gt; series3 = new XYChart.Series&lt;&gt;(); // up for (int i = 1; i &lt; 50; i++) { Double value = generator.nextDouble() + 1; series1.getData().add(new XYChart.Data&lt;Number, Number&gt;(i, value)); Double Ymin = value - generator.nextDouble() * 0.2; series2.getData().add(new XYChart.Data&lt;Number, Number&gt;(i, Ymin)); Double Ymax = (value - Ymin) + generator.nextDouble() * 0.2; series3.getData().add(new XYChart.Data&lt;Number, Number&gt;(i, Ymax)); } // / final NumberAxis xAxisLC = new NumberAxis(); final NumberAxis yAxisLC = new NumberAxis(); /////////what's wrong yAxisLC.autoRangingProperty().set(false); yAxisLC.setMinorTickLength(yAxisLC.getTickLength()); yAxisLC.setMinorTickCount(0); yAxisLC.setUpperBound(2.5); yAxisLC.setLowerBound(1.0); //when I set 0.0 is OK yAxisLC.setTickUnit(0.2); /////// pane = new BorderPane(); mainGraphStackPane = new StackPane(); mainGraphStackPane.getChildren().add(pane); StackedAreaChart&lt;Numb…
has answer: http://stackoverflow.com/a/26652863
upvote count: 1
tagged with: css
possible better answer: http://stackoverflow.com/a/26652863
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/26627627
tagged with: eclipse
type: Question
has title: JavaFX - StackedAreaChart and method setLowerBound
answer count: 2
downvote count: 0
tagged with: stacked-area-chart

http://stackoverflow.com/comment/57106377
type: AnswerComment
has text: I'm using an early version of PF (3.5). I don't have much time to write a note. This solution did work for me however.
comment on: http://stackoverflow.com/a/34659473
type: Comment
score: 0

http://stackoverflow.com/q/26277099
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41228152
type: Question
has title: "access denied" when using ConcurrentSkipListSet in Java 8
has comment: http://stackoverflow.com/comment/41228390
has comment: http://stackoverflow.com/comment/41227987
tagged with: securityexception
has body: I am doing the following inside a sandboxed Applet with Java 8u20: Set&lt;Integer&gt; set = new ConcurrentSkipListSet&lt;Integer&gt;(); set.add((int) 1); And i get the following exception: network: Cacheeintrag nicht gefunden [URL: http://[0:0:0:0:0:0:0:1]:80/crossdomain.xml, Version: null] network: Verbindung von http://[0:0:0:0:0:0:0:1]:80/crossdomain.xml mit Proxy=DIRECT wird hergestellt network: Verbindung von http://[0:0:0:0:0:0:0:1]:80/ mit Proxy=DIRECT wird hergestellt java.lang.SecurityException: denied access outside a permitted URL subpath at sun.net.www.protocol.http.HttpURLConnection.checkURLFile(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at com.sun.deploy.net.CrossDomainXML.check(Unknown Source) at com.sun.deploy.net.CrossDomainXML.check(Unknown Source) at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source) at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source) at java.net.NetworkInterface$1checkedAddresses.&lt;init&gt;(Unknown Source) at java.net.NetworkInterface.getInetAddresses(Unknown Source) at java.net.NetworkInterface.getHardwareAddress(Unknown Source) at java.util.concurrent.ThreadLocalRandom.initialSeed(Unknown Source) at java.util.concurrent.ThreadLocalRandom.&lt;clinit&gt;(Unknown Source) at java.util.concurrent.ConcurrentSkipListMap.doPut(Unknown Source) at java.util.concurrent.ConcurrentSkipListMap.putIfAbsent(Unknown Source) at java.util.concurrent.ConcurrentSkipListSet.add(Unknown Source) at myCode... Caused by: java.security.AccessControlException: access denied ("java.net.SocketPermission" "[0:0:0:0:0:0:0:1]:80" "connect,resolve") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityMana…
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42881062
tagged with: accesscontrolexception

http://stackoverflow.com/comment/41188970
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26229059
type: AnswerComment
has text: thanks, was afraid that might be the case, but was hoping there was an easier way.

http://stackoverflow.com/a/26332118
has comment: http://stackoverflow.com/comment/41328031
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41328133
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26332103
has body: You can accomplish most of your game with Activities and function calls. Your game sounds very linear, which I would say is a good thing for a starting project. This would be your main code that checks when the button is pressed. final Button button = (Button) findViewById(R.id.button_id); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click. } }); If you are going to be passively increasing counters then you could use a handler. TextView textView; Handler handler = new Handler(); int count = 0; protected void onCreate(Bundle savedInstanceState) { handler.post(updateTextRunnable); } Runnable updateTextRunnable = new Runnable() { public void run() { count++; textView.setText("Updating variable: " + count); handler.postDelayed(this, TIME_DELAY); } };
has comment: http://stackoverflow.com/comment/41327988
answers question: http://stackoverflow.com/q/26332103
type: Answer

http://stackoverflow.com/a/47906849
has body: I gave up trying to use getClass().getResource("BookingForm.css")); Instead I create a File object, create a URL from that object and then pass it into getStyleSheets() or setLocation() File file = new File(System.getProperty("user.dir").toString() + "/src/main/resources/BookingForm.css"); scene.getStylesheets().add(folder.toURI().toURL().toExternalForm());
answers question: http://stackoverflow.com/q/26328040
type: Answer
upvote count: 0
downvote count: 2
score: -2

http://stackoverflow.com/q/26229969
tagged with: jquery
tagged with: ajax
type: UnansweredQuestion
tagged with: web-services
answer count: 0
tagged with: java
has title: java web service cannot capture post parameter from jquery post
has comment: http://stackoverflow.com/comment/41140493
type: Question
has comment: http://stackoverflow.com/comment/41140451
has comment: http://stackoverflow.com/comment/41141642
has body: Client: var data = "username=David"; $.post("/s/test", data, function(result) { alert(result); }); Server: @POST @Path("/test") @Produces(MediaType.TEXT_PLAIN) public String test(@FormParam("username") String username) { return "Your username is " + username; } The username is always null from the $FormParam. However, if post from form: Submit The value can be captured correct. Really don't know why. New findings: It happen to jquery 2.1, but 1.6 is ok. Newer findings: Use GF 3.1.2.2 will solve the issue as well, however, GF 4 has this issue.
score: 0

http://stackoverflow.com/q/26230719
has body: I just made one producer and one consumer thread. When list is empty consumer went to waiting state, then producer insert an item in list and calls notify() to invoke consumer thread but consumer is not invoking. It remains in waiting state. Code that I have tried is: package xs; import java.util.ArrayList; import java.util.Date; import java.util.List; public class TestMain { public static void main(String[] args) { product pro = new product(); producer produce = new producer(pro); consumer consume = new consumer(pro); Thread thr1 = new Thread(produce, "Producer"); Thread thr2 = new Thread(consume, "consumer"); thr1.start(); thr2.start(); } } class product{ List&lt;Date&gt; list; public product() { list = new ArrayList&lt;Date&gt;(); } public void produce(Date i){ list.add(i); } public Date consume(){ return list.remove(0); } } class producer implements Runnable{ product product; @Override public void run() { while(true){ synchronized (this) { while(product.list.size() == 2){ try { wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } product.produce(new Date()); System.out.println("Produced "+product.list.size()); notify(); } } } public producer(product product) { this.product = product; } } class consumer implements Runnable{ product product; @Override public void run() { // TODO Auto-generated method stub while(true){ synchronized (this) { notify(); while(product.list.size() == 0){ try { System.out.println("Going to wait..."+ product.list.size()); wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } System.out.println("consumed"+ product.consume()); } } } public consumer(product product) { this.product = product; } } Output it's giving: Going to wait...0 Produced 1 Produced 2 As you can see consumer is not coming in action after wait() call.
possible better answer: http://stackoverflow.com/a/26231237
has answer: http://stackoverflow.com/a/26231237
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26230763
type: Question
score: 0
tagged with: multithreading
answer count: 2
has title: Thread is not acquiring monitor after notify calls
tagged with: java
accepted answer: http://stackoverflow.com/a/26230763

http://stackoverflow.com/comment/41354623
has text: @user2864740 The problem is `handles.get(i)` is giving me back an Integer if it's under 2 billion or so, which results in an invalid cast if I use that code.
comment on: http://stackoverflow.com/q/26245020
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26253663
accepted answer: http://stackoverflow.com/a/26255297
has comment: http://stackoverflow.com/comment/41185218
type: Question
has body: I need help to generate a graph's link connection in json format which are index numbers. I can manage to generate the 1st part of nodes index numbers but can't do the 2nd part of links index numbers. Nodes index number should be plotted links index no. Anyone please help. Input file: Abdelaziz Bouteflika,Bush,1 Albert II of Belgium,Bush,1 Albert Wehrer,Bush,1 Berlusconi,Bush,1 Bernard-Montgomery,Bush,1 Bush,Fidel-Castro,1 Bernard-Montgomery,Albert Wehrer,5 Expected Output file: { "nodes":[ {"name":"Bush","Id":0}, {"name":"Abdelaziz Bouteflika","Id":1}, {"name":"Albert II of Belgium","Id":2}, {"name":"Albert Wehrer","Id":3}, {"name":"Berlusconi","Id":4}, {"name":"Bernard-Montgomery","Id":5}, {"name":"Fidel-Castro","Id":6} ], "links":[ {"source":1,"target":0}, {"source":2,"target":0}, {"source":3,"target":0}, {"source":4,"target":0}, {"source":5,"target":0}, {"source":6,"target":0}, {"source":5,"target":3} ] } My code: public class Link_Of_Index { List&lt;String&gt; linklist1 = new ArrayList&lt;String&gt;(); List&lt;String&gt; finalList = new ArrayList&lt;String&gt;(); public void getIndexNo() throws IOException{ BufferedReader reader = new BufferedReader(new FileReader("E:/Workspace/Entity_Graph_Creation/WebContent/Graph_nodes_1.csv")); FileWriter fw = new FileWriter(new File("E:/workspace/Entity_Graph_Creation/Input/links.json")); try{ String line = null; int index=0; while (( line = reader.readLine()) != null) { String[] splits = line.split(","); linklist1.add(splits[0]); linklist1.add(splits[1]); linklist1.add(splits[2]); } for (String s: linklist1) { if (!finalList.contains(s)) { finalList.add(s); JSONObject obj = new JSONObject(); obj.put("Id", index); obj.put("name", s); fw.write(obj.toString()+ ","+ "\n"); index ++; } fw.flush(); } } catch (IOException ex){ ex.printStackTrace(); } } public static void main(String[] args) throws IOException { Link_Of_Index inx = new Link_Of_Index(); inx.getIndexNo(); } }
score: 0
has title: How can I split a line and assign index number for a graph's links connection in java?
answer count: 1
has answer: http://stackoverflow.com/a/26255297
has comment: http://stackoverflow.com/comment/41200412
has comment: http://stackoverflow.com/comment/41199762
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/41260343
score: 1
comment on: http://stackoverflow.com/q/26295437
type: Comment
type: QuestionComment
has text: Do not implement it on your own. Use a libary.

http://stackoverflow.com/comment/41302649
has text: Also, as per the most common cause of this question, often you're looking in the wrong place for your file. Please search this site for similar questions to see how it is done as this is asked **often**.
comment on: http://stackoverflow.com/q/26318608
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41329106
comment on: http://stackoverflow.com/q/26332703
has text: Use userAnswer.equals(normalWords[wordNum]);
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/26320816
tagged with: java
upvote count: 1
tagged with: object-comparison
type: Question
tagged with: object
linked to: http://stackoverflow.com/q/27581
tagged with: comparison
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: High, I'm mostly familiar with C &amp; C++ but I've been trying my hand at java recently. My issue is that line if (parent.leftChild == temp) is never true. Although parent.leftChild.Key = temp.key (and the rest of the contents are the same), I'm under the impression that the issue is that parent.leftChild's ID in Eclipse's debugger = ...5792 while temp's ID is ...3632. I was hoping that someone could further explain. A workaround to my code can always be to change the if statement to if (parent.leftChild.key = temp.key), but shouldn't parent.left == temp be valid? class Node{ int key; char color; Node leftChild; Node rightChild; Node parent; //...constructors..// } private Node GetParent(Node node){ if(node != null) return node.parent; else return null; } private void RemoveNodeFromTree(Node myNode){ Node temp = new Node(myNode); //traverse if(temp.leftChild!= null){ temp = temp.leftChild; while(temp.rightChild!= null) temp = temp.rightChild; myNode.key = temp.key; } else if(temp.rightChild != null) myNode.key = temp.rightChild.key; Node parent = GetParent(temp); Node childL = temp.leftChild; Node childR = temp.rightChild; //have parent point to the proper new node. //parent points to left if it exists, then it tries right. //if both are null, point to right anyway if(parent !=null ){ //replace temp with it's left child if(childL!= null){ if (parent.leftChild == temp) parent.leftChild = childL; else parent.rightChild = childL; childL.parent = parent; childL.color = 'B'; if(childL.color == 'B' &amp;&amp; temp.color == 'B') DoubleBlackRestructure(childL, parent); } else //replace temp with it's right child { if (parent.leftChild == temp) parent.leftChild = childR; else parent.rightChild = childR; if(childR!= null) childR.parent = parent; if((childR == null || childR.color == 'B') &amp;&amp; temp.color == 'B') { if(childR != null) childR.color = 'B'; DoubleBlackRestructure(childR, parent); } else if (childR != null) childR.color = 'B'; } } else myNode = null; temp = n…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26320893
has title: Issue with Object Comparison in Java (Context is RB Tree)

http://stackoverflow.com/q/26335921
has answer: http://stackoverflow.com/a/26336001
tagged with: datasource
has comment: http://stackoverflow.com/comment/41334944
type: Question
has body: I am doing a project on Eclipse Kepler using JPA 2.1, EclipseLink 2.5, Struts 1.3 and deployed on Tomcat 7.0. I create a project named JPADataSource. Under these conditions, my project works fine. While, when I add DataSources (MySQL) to the project, it does not work anymore. When I try to run the code, I get this error: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306/playlist?autoReconnect=true' I set everything in my code. This is my context.xml (placed in /JPADataSource/WebContent/META-INF/): <?xml version="1.0" encoding="UTF-8"?> WEB-INF/web.xml This is my persistance.xml: <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider java:comp/env/jdbc/playlist model.Singer model.Song model.User model.UserPlaylist And, at last, this is what I inserted under <GlobalNamingResources> in my server.xml (placed in /Server/Tomcat v7.0 Server at localhost-config/): <Resource auth="Container" driverClass="com.mysql.jdbc.Driver" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/playlist" password="root" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/playlist?autoReconnect=true" username="root"/> What am I doing wrong? Or, what am I missing/misplacing? Any help is apreciated.
answer count: 1
tagged with: jpa
tagged with: tomcat
has title: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ''
score: 0
accepted answer: http://stackoverflow.com/a/26336001
has comment: http://stackoverflow.com/comment/41334912
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26219804
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/41121360
answer count: 0
upvote count: 3
type: UnansweredQuestion
has body: Is there a way to customize the formatting of the continuation indent but only for annotations? For example, IntelliJ (Android Studio) handles multi-line annotations like this: @Module( injects = { BaseApplication.class, MyApplication.class, TestMyApplication.class }, includes = { DomainModule.class } ) public class AppModule { //... } I'd like it to be like so (only 4 spaces for continuous indent... though only for annotations). @Module( injects = { BaseApplication.class, MyApplication.class, TestMyApplication.class }, includes = { DomainModule.class } ) public class AppModule { //... } Is this possible?
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41121201
type: Question
tagged with: intellij-idea
has title: Formatting multi-line annotations in IntelliJ

awt
tags question: http://stackoverflow.com/q/26278453
tags question: http://stackoverflow.com/q/26346466
tag name: awt
tags question: http://stackoverflow.com/q/26340442
tags question: http://stackoverflow.com/q/26267737
tags question: http://stackoverflow.com/q/26201144
tags question: http://stackoverflow.com/q/26199008
tags question: http://stackoverflow.com/q/26221557
tags question: http://stackoverflow.com/q/26334556
tags question: http://stackoverflow.com/q/26195780
type: Tag
tags question: http://stackoverflow.com/q/26237275
tags question: http://stackoverflow.com/q/26266284

http://stackoverflow.com/a/26330654
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41331416
upvote count: 2
answers question: http://stackoverflow.com/q/26330627
has body: Never obey the "play" rules when it comes to magic (or writing generators based on reductions, or reducers based on generation rules): you know the final ordering you want, so generate the start sequence by running the trick in reverse. Treat all cards as visible, put the last card on top of the "empty" deck, move it from the bottom to the top (this doesn't change the order for the last card of course) and then put the next card on top. Repeat until done. So, let's start with the final order you want to "end up with". Say, 1,2,3,4,5. Then: 1,2,3,4,5, put last visible on top of the deck → 1,2,3,4 + 5. Then move bottom to top, add last visible card: → 1,2,3 + 4,5. Then move bottom to top, add last visible card: → 1,2 + 3,(4,5 → 5,4) = 3,5,4. Then move bottom to top, add last visible card: → 1 + 2,(3,5,4 → 4,3,5) = 2,4,3,5. Then move bottom to top, add last visible card: → 1,(2,4,3,5 → 5,2,4,3) = 1,5,2,4,3. done. If we run this for 1,2,3,4,5,6,7,8,9,10 we get 1,6,2,10,3,7,4,9,5,8, in 10 steps. Also notice that this algorithm is O(n): For a sequence of 1000 cards we perform 1000 "move bottom to top, then add card on top" steps. Can we improve on this? Possibly, but that requires looking at longer sequences to see if we can find the pattern in the permutations this generates. We know it's extremely regular, so there probably are improvements to be made - for instance, with sequence 1,2,...,n-1,n we can immediately fully determine the "odd" cards in the deck: 1,2,...,n/2 (in the 1..5 sequence, the numbers are 1,x,2,x,3, and for 1..10 we see 1,x,2,x,3,x,4,x,5,x). If we can figure out how the rest of the numbers fall into place, we'll probably be able to find an O(1) algorithm for immediately generating the deck sequence to start with. Slightly beyond the scope of this answer, though.
has comment: http://stackoverflow.com/comment/41329830
type: Answer

http://stackoverflow.com/q/26203958
accepted answer: http://stackoverflow.com/a/26203983
has comment: http://stackoverflow.com/comment/41091264
has comment: http://stackoverflow.com/comment/41091521
has answer: http://stackoverflow.com/a/26203989
score: 0
has comment: http://stackoverflow.com/comment/41091254
has answer: http://stackoverflow.com/a/26203983
has comment: http://stackoverflow.com/comment/41091208
has comment: http://stackoverflow.com/comment/41091226
possible better answer: http://stackoverflow.com/a/26203989
type: AnsweredQuestion
has title: Testing Catch Statements of a NFE
tagged with: java
has comment: http://stackoverflow.com/comment/41091177
has comment: http://stackoverflow.com/comment/41091491
has comment: http://stackoverflow.com/comment/41091223
has body: Alright so I am an intro student in a programming class and I am trying to test a catch statement of a NFE. I don't know how to format the code properly, but here it is. import java.util.Scanner; public class Geo { public static void main(String[] args) { try { Scanner inp = new Scanner(System.in); System.out.print("Name?"); String name = inp.nextLine(); System.out.print("Number?"); double num = inp.nextDouble(); System.out.print("Integer?"); int num2 = inp.nextInt(); } catch(NumberFormatException e) { System.out.println("Usage error"); } System.out.println(name); System.out.println(num); System.out.println(num2); } } It keeps saying the variables, name, num, and num2 are undefined. What am I doing wrong here, because I was looking back at an old lab and that is exactly how I had done it before. Any hints? Now I fixed it so the code looks like this public static void main(String[] args) { try { Scanner inp = new Scanner(System.in); System.out.print("Name?"); String name = inp.nextLine(); System.out.print("Number?"); double num = inp.nextDouble(); System.out.print("Integer?"); int num2 = inp.nextInt(); System.out.println(name); System.out.println(num); System.out.println(num2); } catch(NumberFormatException e) { System.out.println("Usage error"); } } but the catch isnt running. How does that get fixed. Like I want it run the try completely, but if something is wrong it keeps running, then out of try, then catches the issue.
has comment: http://stackoverflow.com/comment/41091311
type: Question
answer count: 2
tagged with: syntax-error

http://stackoverflow.com/comment/41110501
score: 1
comment on: http://stackoverflow.com/a/26214207
has text: No, the current standard (C++11) has *brace initialisation*, which is what is being used here.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41424468
type: Comment
comment on: http://stackoverflow.com/a/26309505
score: 0
type: AnswerComment
has text: JNA will automatically initialize the field when it's reading the containing structure from native memory. In order to initialize it yourself, you simply need to create an instance of `MyStructure.ByReference` and initialize it, or initialize it from an existing structure or memory block using the pattern above.

http://stackoverflow.com/comment/41317323
has text: Thanks so much for answering! When I did 2 FPS, even though I have 12 frames total I only got a "video" of just the first frame though. So it was pretty much showing just that image for about 6 seconds. Did that happen to you or any of your students? If so, how did you work around it?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26324264
type: AnswerComment

http://stackoverflow.com/q/26294404
tagged with: iis
has title: Automatically authenticate AD user (who is already logged in on tomcat application) in IIS application
tagged with: java
type: Question
answer count: 2
tagged with: active-directory
tagged with: tomcat
tagged with: asp.net
has answer: http://stackoverflow.com/a/26294568
score: 0
has body: I have two applications. One is running on IIS and second is on Tomcat. Both the applications are authenticating users through active directory. Currently users have to provide their domain, username and password in both the application separately in order to use them. What I want is - if user logs in Tomcat application using AD details then we will show a button in the application which will open our IIS application in other tab of browser (already done) and in that IIS application this user don't need to login using AD details again (it should be logged in automatically). As he has already used same account to login in another application (Tomcat application). Is this possible? if yes, please tell me how can I achieve this.
has answer: http://stackoverflow.com/a/26299470
type: UnansweredQuestion

http://stackoverflow.com/q/26213460
tagged with: android
tagged with: android-sqlite
tagged with: java
type: Question
has body: I am new to android, I am trying to retrieve values from a sqlite database based on the listview values. I tried to retrieve values using string variable. I can do this if I directly substitute the value in the place of variable. Following this I post my codes kindly help me to sort out this. DBhelper.java public class DBHelper extends SQLiteOpenHelper{ public SQLiteDatabase DB; public String DBPath; public static String DBName = "VERIFY ME1.sqlite3"; public static final int version = '1'; public static Context currentContext; public static String tableName = "FORM2"; public DBHelper(Context context) { super(context, DBName, null, version); currentContext = context; DBPath = "/data/data/" + context.getPackageName() + "/databases"; createDatabase(); Oninsert(DB); } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub } private void createDatabase() { boolean dbExists = checkDbExists(); if (dbExists) { // do nothing } else { DB = currentContext.openOrCreateDatabase(DBName, 0, null); DB.execSQL("CREATE TABLE IF NOT EXISTS " +tableName +" (AppNo VARCHAR, AppName VARCHAR," + " Area VARCHAR, FHcode INT(3));"); }} private boolean checkDbExists() { SQLiteDatabase checkDB = null; try { String myPath = DBPath + DBName; checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); } catch (SQLiteException e) { // database does't exist yet. } if (checkDB != null) { checkDB.close(); } return checkDB != null ? true : false; } private void Oninsert(SQLiteDatabase dB2) { // TODO Auto-generated method stub DB = currentContext.openOrCreateDatabase(DBName, 0, null); DB.execSQL("INSERT INTO " + tableName + " Values ('M001','shumi','India',250);"); DB.execSQL("INSERT INTO " + tableName + " Values ('C002','sarah','India',251);"); DB.execSQL("INSERT INTO " + tableName + " Values ('D003','Lavya','USA',252);"); DB.ex…
answer count: 1
score: 0
has title: Database values retrieval error - regarding
has answer: http://stackoverflow.com/a/26213639
type: UnansweredQuestion

http://stackoverflow.com/a/26269623
has comment: http://stackoverflow.com/comment/41213662
has comment: http://stackoverflow.com/comment/41214191
has comment: http://stackoverflow.com/comment/41214092
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26269532
type: Answer
has body: You compare the guess to every character in the String and then display the message for every character. Instead, you should write a method that returns a count of characters that match the input (this also handles words that have repeats of letters). So, private static int countOf(String in, char ch) { int count = 0; for (char c : in.toCharArray()) { if (c == ch) { count++; } } return count; } Then you can call it like, guess = Keyboard.readChar(); int count = countOf(word, guess); if (count &gt; 0) { System.out.println("You have guessed a correct letter!"); correctGuess += count; } else { System.out.println("Sorry! That is an inncorrect guess! Please try again!"); } guessCount++; Edit To do it without a second method you could use, guess = Keyboard.readChar(); int count = 0; for (char c : in.toCharArray()) { if (c == guess) { count++; } } if (count &gt; 0) { System.out.println("You have guessed a correct letter!"); correctGuess += count; } else { System.out.println("Sorry! That is an inncorrect guess! Please try again!"); } guessCount++; And, since you haven't used the for-each - char[] chars = in.toCharArray(); for (int i = 0; i &lt; chars.length; i++) { if (chars[i] == guess) { count++; } }
accepted answer of: http://stackoverflow.com/q/26269532
upvote count: 3
has comment: http://stackoverflow.com/comment/41213650

http://stackoverflow.com/a/26310921
answers question: http://stackoverflow.com/q/26310668
score: 1
downvote count: 0
type: Answer
has body: Further to the @ElvenAshwin answer you should probably take three classes as private inner class.... good practice as you build bigger things you dont pollute public api. As an alternate and good exercise, think about doing it with lambdas in java 8. Its just a function you need not the class.
upvote count: 1

http://stackoverflow.com/q/26230707
has comment: http://stackoverflow.com/comment/41142064
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26231098
linked to: http://stackoverflow.com/q/240546
has answer: http://stackoverflow.com/a/26231147
type: UnansweredQuestion
has body: I want to count the number of words from my html page and using hashmap i want to print the words and the occurences of the word from the html page Java code public class CountWords { public void readFile() { Scanner scanner = null; try { scanner = new Scanner(new File("D:\\Test.html")); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Map&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); while (scanner.hasNext()) { String word = scanner.next(); if (map.containsKey(word)) { map.put(word, map.get(word) + 1); } else { map.put(word, 1); } } List&lt;Map.Entry&lt;String, Integer&gt;&gt; entries = new ArrayList(map.entrySet()); for (int i = 0; i &lt; map.size(); i++) { System.out.println(entries.get(entries.size() - i - 1).getKey() + " " + entries.get(entries.size() - i - 1).getValue()); } } } the output i m getting is the raw data with the html code also and i want to print only the text inside the page which i m seeing not the html code
tagged with: java
has comment: http://stackoverflow.com/comment/41142540
type: Question
tagged with: hashmap
has title: count the number of words using hashmap
has comment: http://stackoverflow.com/comment/41141923

http://stackoverflow.com/a/26296380
answers question: http://stackoverflow.com/q/26296038
score: 0
type: Answer
has body: Create a xml in your drawable folder with name of image.xml with this &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true" android:drawable="@drawable/login_selected" /&gt; &lt;!-- pressed --&gt; &lt;item android:state_focused="true" android:drawable="@drawable/login_mouse_over" /&gt; &lt;!-- focused --&gt; &lt;item android:drawable="@drawable/login" /&gt; &lt;!-- default --&gt; &lt;/selector&gt; Then use this image.xml in your layout xml as &lt;Button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="12dp" android:background="@drawable/image"/&gt;

http://stackoverflow.com/a/26311816
upvote count: 2
has comment: http://stackoverflow.com/comment/41290965
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41291324
has comment: http://stackoverflow.com/comment/41290948
has comment: http://stackoverflow.com/comment/41291016
has body: You can actually use: GroovyShell#parse(Reader) method: Script result = new GroovyShell().parse(new InputStreamReader(in));
has comment: http://stackoverflow.com/comment/41290571
type: Answer
has comment: http://stackoverflow.com/comment/41290545
downvote count: 0
has comment: http://stackoverflow.com/comment/41290484
has comment: http://stackoverflow.com/comment/41290913
has comment: http://stackoverflow.com/comment/41290468
has comment: http://stackoverflow.com/comment/41291296
score: 2
has comment: http://stackoverflow.com/comment/41291038
accepted answer of: http://stackoverflow.com/q/26311730
answers question: http://stackoverflow.com/q/26311730
has comment: http://stackoverflow.com/comment/41291056

http://stackoverflow.com/a/26318174
has comment: http://stackoverflow.com/comment/41412814
has body: You want to use that code (or similar) to override the default getCount method in ListAdapter: http://developer.android.com/reference/android/widget/ListAdapter.html You can check an example in: http://www.vogella.com/tutorials/AndroidListView/article.html#listview_listviewexample
has comment: http://stackoverflow.com/comment/41409782
has comment: http://stackoverflow.com/comment/41302942
upvote count: 3
has comment: http://stackoverflow.com/comment/41302194
has comment: http://stackoverflow.com/comment/41302282
answers question: http://stackoverflow.com/q/26318120
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/41301977
downvote count: 0
has comment: http://stackoverflow.com/comment/41302158

http://stackoverflow.com/a/26272461
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26259783
upvote count: 2
has body: The /error endpoint is not an Actuator Endpoint and it's not secured by default (lots of errors can happen when a user is not authenticated). You could maybe make it available to anonymous users, but my guess is not even that would prevent some nasty infinite loops, where there is a mistake in the security configuration. I'm sure there's another way to add the header without Spring Security?

http://stackoverflow.com/q/26312678
has title: The meaning of the acquire release fence abstract instruction realization of different platform
has answer: http://stackoverflow.com/a/26313206
accepted answer: http://stackoverflow.com/a/26313206
has body: See the following code: // sparc RMO ia64 x86 // --------------------------------------------------------------------- // fence membar #LoadStore | mf lock addl 0,(sp) // #StoreStore | // #LoadLoad | // #StoreLoad // // release membar #LoadStore | st.rel [sp]=r0 movl $0,&lt;dummy&gt; // #StoreStore // st %g0,[] // // acquire ld [%sp],%g0 ld.acq &lt;r&gt;=[sp] movl (sp),&lt;r&gt; // membar #LoadLoad | // #LoadStore // // release_store membar #LoadStore | st.rel &lt;store&gt; // #StoreStore // st // // store_fence st st lock xchg // fence mf // // load_acquire ld ld.acq &lt;load&gt; // membar #LoadLoad | // #LoadStore The code above is the realization of acquire/release/fence abstract instruction on different platform,I just want to know the x86 realization. Can you explain the instructions below for me? How 'movl $0,&lt;dummy&gt;' represent release? How 'movl (sp),&lt;r&gt;' represent acquire? How '&lt;store&gt;' represent release_store? How 'lock xchg' represent store_fence? How '&lt;load&gt;' represent load_acquire? The code is from jdk8/openjdk/hotspot/src/share/vm/runtime/OrderAddress.hpp the 'Memory Access Ordering Model' If you are busy,you can just tell me where can I find the instruction set information about different CPU architectures.
tagged with: instruction-set
tagged with: c++
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7214916
upvote count: 1
answer count: 1
tagged with: jvm
favorite count: 0

http://stackoverflow.com/q/26351568
has answer: http://stackoverflow.com/a/26351962
has body: Basically when a certain point at a grid is the Player icon it will execute a command. When I run this command I get java.lang.NullPointerException: null. if (arrButton[1][1].getIcon() == Player) { System.out.println("test complete"); }
answer count: 1
has comment: http://stackoverflow.com/comment/41363361
score: 0
has comment: http://stackoverflow.com/comment/41403370
has comment: http://stackoverflow.com/comment/41363267
has comment: http://stackoverflow.com/comment/41363322
has comment: http://stackoverflow.com/comment/41363311
type: UnansweredQuestion
tagged with: jbutton
has comment: http://stackoverflow.com/comment/41363431
tagged with: java
has comment: http://stackoverflow.com/comment/41363532
has comment: http://stackoverflow.com/comment/41363664
type: Question
has title: How to see what icon is at a location in a grid Java

http://stackoverflow.com/a/26307044
has body: One format interlaces the u and v data for a full scan line. the other writes the entire U and then the entire v data. These are after the entire Y image. yuv420 and yuv420p specifies which layout. yuv420 writes all the u then all the v data, yv420p interlaces the u and v data scan line by scan line. This image can be a little misleading because the data size is small enough to not show large blocks of u and v pixels. I believe yuv420p would interlace the U1U2U3 V1V2V3 U4U5U6 V4V5V6
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/46459662
has comment: http://stackoverflow.com/comment/41359812
accepted answer of: http://stackoverflow.com/q/26304859
answers question: http://stackoverflow.com/q/26304859
upvote count: 6

broadcastreceiver
tags question: http://stackoverflow.com/q/26246837
tag name: broadcastreceiver
type: Tag

ikvm
tags question: http://stackoverflow.com/q/26323071
type: Tag
tag name: ikvm

http://stackoverflow.com/q/26324656
tagged with: arrays
has title: Nullpointer exception java runtime
favorite count: 0
has comment: http://stackoverflow.com/comment/41313900
tagged with: nullpointerexception
type: UnansweredQuestion
has body: The program looks slightly advanced; it is not. Simple manipulation of array. The program compiles correctly, however, it encounters an exception run-time. Exception in thread "main" java.lang.NullPointerException at Ordliste.leggTilOrd(Tekstanalyse.java:85) at Tekstanalyse.main(Tekstanalyse.java:23) So there is something wrong with if(s.equalsIgnoreCase(ordArray[k])). I cannot see why. It even provides the correct output. import java.io.File; import java.util.Scanner; import java.io.FileNotFoundException; public class Tekstanalyse { public static void main(String[] args) throws FileNotFoundException { Ordliste ol = new Ordliste(); ol.lesBok("scarlet.text"); ol.leggTilOrd("A"); } } class Ordliste { private int i = 0; private String[] ordArray = new String[100000]; private int antForekomster; private int arrStorrelse = 0; public void lesBok(String filnavn) throws FileNotFoundException { File minFil = new File(filnavn); Scanner scan = new Scanner(minFil); while (scan.hasNextLine()) { ordArray[i] = scan.nextLine(); //System.out.println(ordArray[i]); i++; arrStorrelse++; } System.out.println("Array size: " + arrStorrelse + " Capacity: " + ordArray.length); } public void leggTilOrd(String s) { for (int k = 0; k &lt; ordArray.length; k++) { if (s.equalsIgnoreCase(ordArray[k])) { antForekomster++; System.out.println("Den har vi sett for!"); } else { s = ordArray[arrStorrelse]; } } } }
answer count: 4
has answer: http://stackoverflow.com/a/26324831
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/26324892
tagged with: java
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/26325188
has answer: http://stackoverflow.com/a/26324768
score: 0

http://stackoverflow.com/q/26222844
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26222904
has comment: http://stackoverflow.com/comment/41127133
has answer: http://stackoverflow.com/a/26222947
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/41127441
downvote count: 0
has title: May static and non static variables have the same name
tagged with: variables
has answer: http://stackoverflow.com/a/26222904
score: 4
has comment: http://stackoverflow.com/comment/112947627
has comment: http://stackoverflow.com/comment/41127922
possible better answer: http://stackoverflow.com/a/26222947
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/41129201
has comment: http://stackoverflow.com/comment/41127136
has body: I have a class in that I need two variables one is a static one another one is Non-static. What my problem is when we declaring two variables, can we declare them with same name? Why I ask this question is the static variables and non-static variables are stored in two different areas (static variables in Method area and non-static(instance) variables in heap area). So, what happens if I declare them with same name? If it is wrong, what is the reason?

http://stackoverflow.com/q/26338086
tagged with: struts2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41343681
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41345524
has comment: http://stackoverflow.com/comment/41340042
has comment: http://stackoverflow.com/comment/41340483
has body: Long back I have create an web applications in struts2 + Hibernate + MySql. The application is working fine but the problem i am facing is that, I am having a table where i used to save all reports of the users on daily bases. The reports are saved within the table as blob type. Initially the application was working fine, It has been long time the application is running quite good, recently it was been noted the table has too many files within the table and the application is talking too much time for bring the file from the database. Can anyone please tell me some solution for this issue. Do i need to use separate database for files - a suggestion
has comment: http://stackoverflow.com/comment/41340004
has comment: http://stackoverflow.com/comment/41340198
score: 1
tagged with: java
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/41339973
has comment: http://stackoverflow.com/comment/41340120
type: Question
tagged with: blob
has answer: http://stackoverflow.com/a/26338731
has title: File handling using struts2 + hibernate3 + MySql
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41340599
has comment: http://stackoverflow.com/comment/41340258

http://stackoverflow.com/comment/41305480
has text: Android has a built in class for this http://developer.android.com/reference/android/os/CountDownTimer.html
comment on: http://stackoverflow.com/q/26319616
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41146964
comment on: http://stackoverflow.com/q/26232991
has text: you can use `fullClasspath` to find dependency and retrieve `File`
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41104631
comment on: http://stackoverflow.com/a/26210893
score: 0
type: Comment
has text: I tried and saw this in my logcat 10-06 02:29:01.919: I/Choreographer(1956): Skipped 58 frames! The application may be doing too much work on its main thread. 10-06 02:29:02.279: I/Choreographer(1956): Skipped 84 frames! The application may be doing too much work on its main thread. The final result still pointing to the error function
type: AnswerComment

http://stackoverflow.com/a/50475531
score: 19
type: Answer
upvote count: 19
has body: It's called "identifier under caret" and "identifier under caret (write)". I suggest editing background color.
answers question: http://stackoverflow.com/q/26352197
has comment: http://stackoverflow.com/comment/116041378
downvote count: 0

http://stackoverflow.com/comment/41280330
type: Comment
has text: Try to avoid the mix of Generic and RAW type.
comment on: http://stackoverflow.com/q/26306147
score: 0
type: QuestionComment

http://stackoverflow.com/a/26228343
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26228239
has comment: http://stackoverflow.com/comment/41137701
type: Answer
has comment: http://stackoverflow.com/comment/41138125
score: 1
upvote count: 1
downvote count: 0
has body: The JIT and recent advances in Java garbage collection makes exact answers to this sort of question difficult. But there are some things the JVM has to support, due to requirements of the language specification. In particular, the JVM cannot garbage collect instance variables (e.g. an unused private field) even though it isn't touched by the bytecode, as a caller could still use reflection to inspect or access the element. In your example, we're talking about a local variable, which is not handled the same way. Local variables are allocated on the stack, rather than the heap, and the garbage collector would have no problem cleaning it up as soon as the method returns (if not even sooner, in fact). It does not need to wait until the Main class is unloaded. The Integer object one refers to would stay around longer than one itself, but as soon as it's unreferenced, the GC will clean it up at the first opportunity. I've no idea if this is true presently, but I would imagine it's possible for the compiler to even redesign code like this to entirely avoid Integer, and use int directly instead. The new call in this example likely explicitly prevents that here, but substituting Integer.valueOf() would avoid the explicit allocation request and potentially allow the compiler to avoid any object allocation at all. That said of course, in this simple example it's unlikely the GC or the JIT would have enough time to try to clean anything up. Obviously you're just offering a simple example for the sake of discussion, but it's worth mentioning that the program's duration can have a big impact on what gets GC'ed or JIT'ed, and when. It would be potentially possible to model/test some of this using WeakReference, if I have time I'll try to revisit this answer with some example code / analysis. You may also appreciate a similar question I asked last year: Can unused private variables be GCed before their holding instance?
accepted answer of: http://stackoverflow.com/q/26228239

http://stackoverflow.com/comment/41230335
type: AnswerComment
has text: I already used it in the way you need it and it worked nearly perfect.
type: Comment
comment on: http://stackoverflow.com/a/26279159
score: 1

http://stackoverflow.com/a/26280353
answers question: http://stackoverflow.com/q/26280216
score: 1
downvote count: 0
type: Answer
has body: Let's see how this looks with proper indentation: public class Ex2 { public static void main(String[] args) { double peso = 80; double altura = 1.88; double IMC = (peso / (altura * altura)); System.out.print("IMC:"); System.out.println(IMC); If (IMC &lt;= 15.0) { System.out.println ("Muito abaixo do peso ideal"); } If (IMC &lt;= 19.0) { System.out.println ("Abaixo do peso ideal"); } If (IMC &lt;= 25.0) { System.out.println ("Peso Normal"); } If (IMC &lt;= 30.0) { System.out.println ("Acima do peso ideal"); } If (IMC &lt;= 40.0) { System.out.println ("Obeso"); } If (IMC &lt;= 90.0) { System.out.println ("Muito Obeso"); } } } No problems here, other than the fact that the if control-structure in Java is written with a lowercase i.
upvote count: 1

http://stackoverflow.com/comment/41328460
score: 0
type: Comment
type: QuestionComment
has text: Another alternative is to use single-byte encoding.
comment on: http://stackoverflow.com/q/26332355

http://stackoverflow.com/comment/41357485
has text: First things first: what you need to do is develop a flexible protocol (or adopt an existing one).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26346918
score: 0

http://stackoverflow.com/comment/41318882
score: 0
type: Comment
type: QuestionComment
has text: can you share your pom file ?
comment on: http://stackoverflow.com/q/26327307

delimiter
tags question: http://stackoverflow.com/q/26259202
tag name: delimiter
type: Tag
tags question: http://stackoverflow.com/q/26222832

http://stackoverflow.com/comment/41325734
has text: thanks for the answer, makes sense but I would never have guessed that the statments are printed non-atomic, as the stacktrace is divided into 2 parts here, on the other hand I have no clue what exactly happens when printing
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26330928

http://stackoverflow.com/comment/119046576
comment on: http://stackoverflow.com/a/66050927
has text: @NarutoSempai Perfect, answer updated. I invite you to describe more details in workaround 2 if you consider them necessary. Thanks
score: 0
type: AnswerComment
type: Comment

jvm
tags question: http://stackoverflow.com/q/26325860
tags question: http://stackoverflow.com/q/26231046
type: Tag
tags question: http://stackoverflow.com/q/26225263
tags question: http://stackoverflow.com/q/26215075
tags question: http://stackoverflow.com/q/26285719
tags question: http://stackoverflow.com/q/26209968
tags question: http://stackoverflow.com/q/26280406
tags question: http://stackoverflow.com/q/26351243
tags question: http://stackoverflow.com/q/26211098
tags question: http://stackoverflow.com/q/26278975
tags question: http://stackoverflow.com/q/26342934
tags question: http://stackoverflow.com/q/26308157
tag name: jvm
tags question: http://stackoverflow.com/q/26236815
tags question: http://stackoverflow.com/q/26312678
tags question: http://stackoverflow.com/q/26347792
tags question: http://stackoverflow.com/q/26290473
tags question: http://stackoverflow.com/q/26275503
tags question: http://stackoverflow.com/q/26279513
tags question: http://stackoverflow.com/q/26229431
tags question: http://stackoverflow.com/q/26240717
tags question: http://stackoverflow.com/q/26245766
tags question: http://stackoverflow.com/q/26309203

http://stackoverflow.com/a/26271412
type: Answer
answers question: http://stackoverflow.com/q/26271282
has body: Whenever you pass a Object to System.out.println it executes its toString method, Default implementation of toString prints ClassName with its hashCode. you can override toString method. add below code snnipet to your Discount Class and it will run as per your expectation @Override public String toString() { return "Bill Amount After Discount is " + bill ; }
score: 0

http://stackoverflow.com/comment/73585492
comment on: http://stackoverflow.com/a/26286180
score: 0
type: Comment
has text: good answer; only critic is that MD5 and SHA aren't recommended as hashing functions, rather use Blowfish hashing (the bCryptPasswordEncoder), because it can be adapted as computing power gets cheaper (so cracking passwords gets easier). Details: https://codahale.com/how-to-safely-store-a-password/
type: AnswerComment

http://stackoverflow.com/q/26277370
type: Question
has comment: http://stackoverflow.com/comment/41227242
has answer: http://stackoverflow.com/a/26356121
has answer: http://stackoverflow.com/a/76251942
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41227084
has body: I was searching on google but not found any helpful article on this. I want to invoke webservice methods.I have wdsl and i have to invoke dynamically without creating any stubs as such.Any example will be more helpful.
linked to: http://stackoverflow.com/q/2491598
accepted answer: http://stackoverflow.com/a/26356121
favorite count: 0
possible better answer: http://stackoverflow.com/a/26277587
has title: How to invoke webservice without creating any clients for it?
has answer: http://stackoverflow.com/a/26277587
linked to: http://stackoverflow.com/q/15116183
answer count: 4
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/41228058
downvote count: 2
has answer: http://stackoverflow.com/a/26277942
tagged with: web-services

http://stackoverflow.com/q/26197117
accepted answer: http://stackoverflow.com/a/26197287
downvote count: 5
possible better answer: http://stackoverflow.com/a/26197285
has comment: http://stackoverflow.com/comment/41079112
has answer: http://stackoverflow.com/a/26197285
answer count: 2
has title: a method that recieves String input and divides it into 1,2 and 3 different sections
favorite count: 0
has comment: http://stackoverflow.com/comment/41079105
has answer: http://stackoverflow.com/a/26197287
type: AnsweredQuestion
tagged with: java
score: -4
upvote count: 1
has body: i need a more basic method! that will just split words into 1,2,3 consecutive compartments, my output for "water" should be in terms of array string! e.g INPUT of water should produce OUTPUT like {"w","a","t","e","r","wa","at","te","er","wat","ate","ter"} public void split(String word) { int x=(word.length())/2; int z=word.length(); String[] partition= new String[5]; for (int i=0; i&lt;x; i++){ String new1=Character.toString(word.charAt(i)); String new2 = Character.toString(word.charAt(i))+Character.toString(word.charAt(i+1)); String new3 = Character.toString(word.charAt(i))+Character.toString(word.charAt(i+1))+Character.toString(word.charAt(i+2)); String new4 = removeDuplicate(Character.toString(word.charAt(z-2))+ Character.toString(word.charAt(z-1))); String new5 = removeDuplicate(Character.toString(word.charAt(z-3))+ Character.toString(word.charAt(z-2))+ Character.toString(word.charAt(z-1))); char result = word.charAt(2); String[] partitions = {new1,new5,new3,new4,new2}; //partition=partitions; //Arrays.toString((removeDuplicates(partitions))) System.out.println(partitions); } //return partition; }
type: Question

http://stackoverflow.com/q/26203179
downvote count: 1
has body: Code is supposed to do this: Return the number of times that the string "code" appears anywhere in the given string, except we'll accept any letter for the 'd', so "cope" and "cooe" count. The problem: Ran across Exception:java.lang.StringIndexOutOfBoundsException: String index out of range: 11 (line number:10) public int countCode(String str){ int a = 0; // counter goes thru string int b = str.length()-1; int counter = 0; //counts code; if(str.length() &lt; 4) return 0; else{ while (a &lt;=b){ if(str.charAt(a) == 'c'){ if(str.charAt(a+1) == 'o'){ if(str.charAt(a+3) == 'e'){ counter++; a= a+3; } // checks e else a++; } // checks o else a++; } // checks c else a++; } return counter; } } Here's what I tried to evaluate to get said exception: countCode("xxcozeyycop") --> EXPECTED RESULT 1 countCode("cozcop") --> EXPECTED RESULT
type: Question
has answer: http://stackoverflow.com/a/26203825
score: -1
has comment: http://stackoverflow.com/comment/41089806
has answer: http://stackoverflow.com/a/41911482
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26203221
has title: Too many Exception out of bounds - JAVA
favorite count: 0
linked to: http://stackoverflow.com/q/2635082
type: UnansweredQuestion
tagged with: java

semaphore
type: Tag
tags question: http://stackoverflow.com/q/26330227
tags question: http://stackoverflow.com/q/26341261
tag name: semaphore
tags question: http://stackoverflow.com/q/26277658

http://stackoverflow.com/q/26328647
tagged with: java
linked to: http://stackoverflow.com/q/21130376
score: 0
answer count: 1
tagged with: url
has title: How to make a regex pattern for a link with paramater? Spring Security 3.2.x
tagged with: spring-security
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/26330583
has body: I'm trying to allow a link with parameter in Spring Security. The link in the browser looks like this: http://myapp.com/activateAccount/?token=2b7bneehdmra1b35 I read that antMatchers() don't work with such links. So instead I want to use regexMatchers(). My current code looks like this: .regexMatchers("\\A\\/activateAccount\\/\\?token=.*\\Z").permitAll() Does anyone how to build a valid pattern for this kind of link? Any kind of advice will be appreciated :)
type: Question

http://stackoverflow.com/q/26262367
has answer: http://stackoverflow.com/a/26263149
score: 0
has title: Receiving/sending datagram socket data
has comment: http://stackoverflow.com/comment/41199755
answer count: 1
tagged with: byte
tagged with: sockets
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41200238
type: Question
accepted answer: http://stackoverflow.com/a/26263149
tagged with: datagram
has body: so I'm doing a program in Java that sends and receives data with the help of DatagramSocket and DatagramPacket. The problem is that somewhere between when i'm sending the data/receiving it - the data turns up to be different in the program i'm sending it too, but only in certain cases like this: Sending: 378 Receiving: 3786 Sending: 374 Receiving: 3742 Sending: 360 Receiving: 3604 But works sometimes, in cases like: Sending: 376 Receiving: 376 Sending: 372 Receiving: 372 Sending: 344 Receiving: 344 I'm sending two coordinates, to first convert it to a string with: String message = Integer.toString(coord1) + " " + Integer.toString(coord2); Then converting the string to a byte array to be able to send it with a DatagramPacket: byte[] b = message.getBytes(Charset.forName("UTF-8")); DatagramPacket packet = new DatagramPacket(b, b.length, remoteHost, remotePort); try { datagramSocket.send(packet); } catch(Exception e) { e.printStackTrace(); } This is my thread that receives the data: private DatagramSocket dSocket; private DatagramPacket packet; private byte[] buffer; private PaintProgram prog; public ReceiverThread(int myPort, PaintProgram prog) { this.prog = prog; try { buffer = new byte[256]; dSocket = new DatagramSocket(myPort); packet = new DatagramPacket(buffer, buffer.length); } catch(Exception e) { e.printStackTrace(); } this.start(); } @Override public void run(){ do{ try { dSocket.receive(packet); String data = new String(buffer, "UTF-8"); prog.handlePacket(data); } catch(IOException e) { e.printStackTrace(); } } while(!this.currentThread().isInterrupted()); } And this is my method that "handles" the packet that's received: String[] xy = data.split(" "); Point point = new Point(Integer.parseInt(xy[0].trim()), Integer.parseInt(xy[1].trim())); Then i add the point created with the two coordinates to my program. I don't know where in this process it goes wrong. Would be cool with some new perspective! Thanks.
tagged with: java

http://stackoverflow.com/q/26326231
favorite count: 0
tagged with: jetty
tagged with: spring
has comment: http://stackoverflow.com/comment/41320343
downvote count: 0
tagged with: maven
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26326668
has body: I have a java webapp that works just fine, but today I tried to start using spring for dependency injection. The app should run on Jetty Server but i'm stuck on this problem. When I try to use any servlets that contain a spring dependency, I get this error: java.lang.IllegalStateException: No resource at valueService at org.eclipse.jetty.annotations.ResourceAnnotationHandler.handleMethod(ResourceAnnotationHandler.java:345) at org.eclipse.jetty.annotations.ResourceAnnotationHandler.doHandle(ResourceAnnotationHandler.java:66) at org.eclipse.jetty.annotations.AnnotationIntrospector$AbstractIntrospectableAnnotationHandler.handle(ResourceAnnotationHandler.java:345) valueService is the name of the first dependency in the HttpServlet annotated with spring like this: @Resource(name="valueService") protected ValueService valueService; which is defined in my application context as: &lt;bean id="valueService" class="com.nimbits.server.transaction.value.service.ValueServiceImpl" /&gt; So, jetty is open source, so when I look at the code in jetty server ResourceAnnotationHandler.java:345 it's doing this: else if (!Util.isEnvEntryType(paramType)) { //if this is an env-entry type resource and there is no value bound for it, it isn't //an error, it just means that perhaps the code will use a default value instead // JavaEE Spec. sec 5.4.1.3 throw new IllegalStateException("No resource at "+(mappedName==null?name:mappedName)); } so there is my error. Question: any jetty experts know why jetty is processing my spring annotation and throwing this exception. Is there a way to satisfy it? Or stop it? Thanks, really stuck. Ben
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26326668
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41320150
has title: jetty spring "No resource at X" ResourceAnnotationHandler

http://stackoverflow.com/comment/41303407
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26319021
score: 1
has text: Look at your constructors - they each have parameters, and they don't print anything. There's nothing that says you should print out the newly created instance. Basically, you need to read the instructions more carefully.

http://stackoverflow.com/q/26270290
type: AnsweredQuestion
has body: I have a different result between java and php method in doing AES128 with zero padding and no IV encryption. Here PHP code : &lt;?php $ptaDataString = "secretdata"; $ptaDataString = encryptData($ptaDataString); $ptaDataString = base64_encode($ptaDataString); function encryptData($input) { $ptaKey = 'secret'; $iv = "\0"; $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $ptaKey, $input, MCRYPT_MODE_CBC, $iv); return $encrypted; } echo $ptaDataString; ?&gt; And here is java code: public static String encrypt() throws Exception { try { String data = "secretdata"; String key = "secret0000000000"; String iv = "0000000000000000"; Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); int blockSize = cipher.getBlockSize(); byte[] dataBytes = data.getBytes(); int plaintextLength = dataBytes.length; if (plaintextLength % blockSize != 0) { plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize)); } byte[] plaintext = new byte[plaintextLength]; System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length); SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES"); IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes()); cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec); byte[] encrypted = cipher.doFinal(plaintext); return new sun.misc.BASE64Encoder().encode(encrypted); } catch (Exception e) { e.printStackTrace(); return null; } } php resulting : kjgE5p/3qrum6ghdjiVIoA== Java resulting : zLKhVMksRRr1VHQigmPQ2Q== Any help would be appreciated, Thanks
has title: Different AES128 with zero padding encryption result between php and java
tagged with: java
type: Question
answer count: 1
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/26271908
accepted answer: http://stackoverflow.com/a/26271908
upvote count: 4
tagged with: aes
favorite count: 0
has comment: http://stackoverflow.com/comment/70897201
tagged with: encryption
tagged with: php

http://stackoverflow.com/a/26299389
has body: You may want to take a look at this implementation of the Luhn algorithm in Java: public class luhn { /** Calculate the Luhn sum of the input number @param str number to check @return sum calcuted with Luhn algorithm **/ public static int luhnTest(String str){ int sum=0; boolean isEven=false; for (int i=str.length();i&gt;0;i--){ int k=Integer.parseInt(str.substring(i-1,i)); if(isEven){ k=k*2; if(k/10!=0) k=k/10+k%10; } isEven=!isEven; sum+=k; } return sum; } /** Return true if the input number is valid according to the Luhn formula @param str number to check **/ public static boolean isLuhnValid(String str){ if (luhnTest(str)%10==0) return true; return false; } /** Return the check digit that makes the input number valid according to the Luhn formula @param str number to check @return calculated check digit **/ public static int getCheckDigit(String str){ int k=luhnTest(str+"0"); int i=0; if(k%10!=0) i=10-k%10; return i; } /** Return the input number with check digit appended @param str number to make Luhn valid @return Luhn valid number **/ public static String getLuhnNumber(String str){ return str+getCheckDigit(str); } } Source: https://github.com/nicopi/Luhn-Algorithm
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26299298
answers question: http://stackoverflow.com/q/26299298
type: Answer

http://stackoverflow.com/a/26336146
has body: All you need is to check if there are methods that using same non-threadsafe resources (i.e. HashMap in the field, or something). If there are, add locks or get rid of these fields (make them local).
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26336052
type: Answer
answers question: http://stackoverflow.com/q/26336052

http://stackoverflow.com/comment/41180028
comment on: http://stackoverflow.com/a/26239430
score: 0
type: Comment
has text: Thank you for your answer. I don't want to create an uber jar, I just want this jar to be created and the dependency to be available at runtime. I tried adding the "runtime" and "provided" scope to the common dependency, but it doesn't actually do what I want. Any ideas on this?:)
type: AnswerComment

http://stackoverflow.com/comment/48975167
comment on: http://stackoverflow.com/a/26328555
type: AnswerComment
has text: I had no idea that using it as a return value for a property was not what y'all intended until I read this answer here on StackOverflow. In fact, I was lead to believe that it was exactly what y'all intended after reading this article on Oracle's website: http://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html Thank you for clarifying
type: Comment
score: 30

http://stackoverflow.com/comment/41165510
comment on: http://stackoverflow.com/q/26239474
type: Comment
has text: what is PasswordProtection suposed to be? it's not an android class.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41333295
score: 2
has text: You suppressed the exception. It should have some information there..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26334556

http://stackoverflow.com/comment/41262888
has text: ImageIcon.java line 288, what is there ?
comment on: http://stackoverflow.com/a/26295890
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41299217
type: Comment
type: QuestionComment
has text: Panther thanks for help! I used a placeholder image with the same size of imamges i load so it kinda looks better for now.
comment on: http://stackoverflow.com/q/26315922
score: 0

http://stackoverflow.com/a/26208094
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41146914
has comment: http://stackoverflow.com/comment/41124603
has comment: http://stackoverflow.com/comment/41165135
has comment: http://stackoverflow.com/comment/41136693
has comment: http://stackoverflow.com/comment/41129623
upvote count: 2
has comment: http://stackoverflow.com/comment/41106540
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26206050
type: Answer
has comment: http://stackoverflow.com/comment/41141495
answers question: http://stackoverflow.com/q/26206050
has body: UPDATE: Try with objectify-gwt-1.2.1; you still can't use Ref.create(POJO) client-side, but Ref&lt;?&gt;s should transit GWT-RPC correctly. The GWT emulation for datastore classes that Objectify provides is slowly decaying. Hi, I'm the principal author of Objectify. I used to work with GWT a lot, so I actively maintained the objectify-gwt code. However, it's now been multiple years since I last used GWT. In the mean time Objectify has changed, GWT has changed, and even the build systems have changed (objectify-gwt was split out into a separate jar because the old approach caused problems for Gradle users). Something is broken in the emulation for some types (notably Ref and Key) under some specific circumstances. I do not understand the inner workings of GWT serialization well enough to fix it. Objectify-gwt needs help from someone with a vested interest in making sure it works. Absent that, perhaps avoid trying to use Ref client-side?

http://stackoverflow.com/comment/41162278
comment on: http://stackoverflow.com/q/26241630
score: 0
type: Comment
type: QuestionComment
has text: What is this `while()`?

http://stackoverflow.com/comment/41097677
has text: @BoldijarPaul Wow already got my project going in Android Studio, downloaded it like 15 minutes ago. But I cannot seem to get my desktop project going. Is this really possible? Any good and new sources to set this up?
type: Comment
comment on: http://stackoverflow.com/q/26206715
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41252395
type: QuestionComment
has text: @JarrodRoberson How does the other question answer this one ? I dont understand.
score: 0
comment on: http://stackoverflow.com/q/26290043
type: Comment

http://stackoverflow.com/comment/41167927
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Assigning variables with dynamic names in Java](http://stackoverflow.com/questions/6729605/assigning-variables-with-dynamic-names-in-java)
comment on: http://stackoverflow.com/q/26242545

http://stackoverflow.com/q/26273499
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: logging
type: Question
has title: See the log of a jar in android (adb)
has body: i've a question: how can i see the log of a library, which is used as jar into my android app, in the logcat? Is is also possible to redirect it to a file stored into the sd of the android? To make it clear, the jar libary uses: import java.util.logging.Logger; where the logger is created as follow private static Logger logger = Logger.getLogger(StreamingEngine.class.getName()); and then the various level as logger.info(".."); if i check the logcat i don't see anything from that library. is it my fault (that i don't know how to query logcat) or what?
has answer: http://stackoverflow.com/a/26273960
score: 0
answer count: 1
tagged with: jar

http://stackoverflow.com/q/26195511
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26195973
type: Question
has comment: http://stackoverflow.com/comment/41076342
tagged with: libgdx
has comment: http://stackoverflow.com/comment/41077672
has comment: http://stackoverflow.com/comment/41076383
has answer: http://stackoverflow.com/a/26195973
has title: LibGDX project can't find assets folder
has comment: http://stackoverflow.com/comment/41076287
upvote count: 7
has body: I have suddenly run into an issue with my build environment and I can't figure out why. I can run my project just fine using gradlew desktop:run however, when I try to run the project from Eclipse using right-click run as desktop application (on the desktop project of course) it suddenly cannot find my pack.atlas file. There is no doubt the file exsts. I have refreshed my eclipse project multiple times and the project runs fine using gradle commandline. It was working fine yesterday. The only thing I can think of that made it mess up was I ran a Gradle command from within the IDE yesterday but I'm not sure how it could have got messed up like this. It is important for me to figure out this issue as I cannot use the Eclipse debugger with this error. Does anyone have any guess as to why Eclipse isn't seeing the assets folder?
answer count: 1
linked to: http://stackoverflow.com/q/22822767
has comment: http://stackoverflow.com/comment/41076416
favorite count: 0
has comment: http://stackoverflow.com/comment/41098403
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41076192
downvote count: 0
score: 7
tagged with: java

http://stackoverflow.com/q/26270609
score: 2
has comment: http://stackoverflow.com/comment/41215243
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26271404
has answer: http://stackoverflow.com/a/26270694
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26270704
has answer: http://stackoverflow.com/a/26270736
upvote count: 2
has answer: http://stackoverflow.com/a/26270967
has answer: http://stackoverflow.com/a/26271869
has comment: http://stackoverflow.com/comment/41215259
favorite count: 0
has body: I'm trying to convert a date (string) extracted from a csv file, convert it to sql timestamp and upload using prepared statement. What I have is: String test = "8/10/2014 16:59"; DateFormat fromFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm"); fromFormat.setLenient(false); DateFormat toFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSSSSS"); toFormat.setLenient(false); Date date2 = null; try { date2 = toFormat.parse(test); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } //java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf(date2); //java.sql.Timestamp sqlDate2 = new java.sql.Timestamp(timestamp); //sql_statement.setTimestamp(1, ts2); As you can see my code is messy as I'm trying to solve this problem. I'm always getting an error in eclipse: java.text.ParseException: Unparseable date: "8/10/2014 16:59" at java.text.DateFormat.parse(DateFormat.java:357) at com.syntronic.client.thread.ORCThreadTejasInv.uploadOracleDBOptical(ORCThreadTejasInv.java:555) at com.syntronic.client.thread.ORCThreadTejasInv.connectOracleDB(ORCThreadTejasInv.java:170) at com.syntronic.client.thread.ORCThreadTejasInv.retrieveOracleTejas(ORCThreadTejasInv.java:125) at com.syntronic.client.thread.ORCThreadTejasInv.run(ORCThreadTejasInv.java:84) at java.lang.Thread.run(Thread.java:745) I even try using: SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ); String yourformattedDate = sdf.format(test); and diff error shows up" Exception in thread "Thread-6" java.lang.IllegalArgumentException: Cannot format given Object as a Date at java.text.DateFormat.format(DateFormat.java:301) at java.text.Format.format(Format.java:157) at com.syntronic.client.thread.ORCThreadTejasInv.uploadOracleDBOptical(ORCThreadTejasInv.java:562) at com.syntronic.client.thread.ORCThreadTejasInv.connectOracleDB(ORCThreadTejasInv.java:170) at com.syntronic.client.thread.ORCThreadTejasInv.retrieveOracleTejas(ORCThreadTejasInv.java:125) at com.syntronic.client.th…
tagged with: sql
has title: Java convert date to sql timestamp
tagged with: datetime
has answer: http://stackoverflow.com/a/26270772
answer count: 7

http://stackoverflow.com/comment/41297629
has text: @dmahapatro: I'm not sure what this has to do with the build life cycle?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26315574
score: 0

http://stackoverflow.com/comment/41339387
type: QuestionComment
type: Comment
has text: is there a way to attach a file? here is a sample when convert bytes to hex string 20205B292980002801087496140929141102801176250364781600000257FF640000A2FC00000005640F1F0000005A3C43523E5D0D0A20205B292980002801087496140929141102801176250364781600000257FF640000A2FC00000005640F1F0000005A3C43523E2929B10006010874965C3C43
comment on: http://stackoverflow.com/q/26337927
score: 0

http://stackoverflow.com/a/26244595
has comment: http://stackoverflow.com/comment/76405037
has body: Identified a duplicate jar in the deployment which was causing a collision and not load the configuration at all. Set the dependency jar scope to 'provided' and the maven build now has only one version of the jar in the deployment EAR.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/75136073
downvote count: 0
answers question: http://stackoverflow.com/q/26243530
has comment: http://stackoverflow.com/comment/100999121
upvote count: 2

http://stackoverflow.com/a/26292124
upvote count: 1
has comment: http://stackoverflow.com/comment/41329489
score: 1
has comment: http://stackoverflow.com/comment/41254554
has comment: http://stackoverflow.com/comment/41365663
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26291881
answers question: http://stackoverflow.com/q/26291881
has comment: http://stackoverflow.com/comment/41255800
type: Answer
has comment: http://stackoverflow.com/comment/41325698
has comment: http://stackoverflow.com/comment/41255260
has body: Use this <c:out value="${studentList.name}"/> And regNo you can get as the request parameter in controller or Path parameter in your controller like <c:out value="${studentList.name}"/> And modify your controller's configuration accordingly.
has comment: http://stackoverflow.com/comment/41312068
has comment: http://stackoverflow.com/comment/41314318

http://stackoverflow.com/comment/41299498
type: QuestionComment
comment on: http://stackoverflow.com/q/26316602
has text: @JBNizet That's what I did. That exception appears on my question code after executeQuery.
score: 0
type: Comment

http://stackoverflow.com/comment/131240343
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/50638125
has text: It works like a charm for my annotation processor to work on eclipse (it was already working on maven)

http://stackoverflow.com/q/26294582
has comment: http://stackoverflow.com/comment/41258833
possible better answer: http://stackoverflow.com/a/26294618
has comment: http://stackoverflow.com/comment/41258848
has answer: http://stackoverflow.com/a/26294767
score: -1
has title: Creating a text file and making it appear on desktop
has comment: http://stackoverflow.com/comment/41259181
answer count: 3
linked to: http://stackoverflow.com/q/1080634
upvote count: 1
has comment: http://stackoverflow.com/comment/41259064
favorite count: 0
has answer: http://stackoverflow.com/a/26294618
has comment: http://stackoverflow.com/comment/41258831
has comment: http://stackoverflow.com/comment/41258926
has answer: http://stackoverflow.com/a/26294622
accepted answer: http://stackoverflow.com/a/26294622
has body: I have used this code to create an empty textfile but it only gets stored in the project folder. I want to know how to make the text file appear on desktop? public void newFileCreator(String filename){ File ob = new File(filename + ".txt"); boolean filecreated = false; try{ filecreated = ob.createNewFile(); } catch(IOException e){ System.out.println("Error" + e); } if(filecreated = true){ System.out.println("Created empty file" + ob.getPath()); } else{ System.out.println("Failed to create empty file" + ob.getPath()); } }
type: AnsweredQuestion
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41259131
type: Question

http://stackoverflow.com/a/26275519
upvote count: 4
answers question: http://stackoverflow.com/q/26275466
has body: Simply use addAll, and Collections.fill. Example list2.addAll(list1); list3 = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(list1.size()); Collections.fill(list3, list2); Note that list3 will be filled with the same instance of list2. This means that every change to list2 will be reflected in each element of list3. If this is not the behavior you're expecting, iterate over the length of list1 and add a new ArrayList&lt;Integer&gt;(list2).
downvote count: 0
type: Answer
score: 4

http://stackoverflow.com/comment/41339167
comment on: http://stackoverflow.com/q/26329559
has text: Screen width divided by ten and screen height divided by ten
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26200466
has comment: http://stackoverflow.com/comment/41085162
type: Answer
has body: It looks like you are calling drawBackground after drawing the enemy, which is most likely covering your enemy? Remember that when drawing things to the screen, the computer is going to draw them in the order you call them regardless of it being the background or some kind of object.
answers question: http://stackoverflow.com/q/26200446
score: 0
has comment: http://stackoverflow.com/comment/41085126
has comment: http://stackoverflow.com/comment/41102108
has comment: http://stackoverflow.com/comment/41199972
has comment: http://stackoverflow.com/comment/41099918
has comment: http://stackoverflow.com/comment/41170152

http://stackoverflow.com/q/26231817
has comment: http://stackoverflow.com/comment/41145053
answer count: 1
tagged with: jpa
downvote count: 0
has title: Order By Before Group By in JPA Spring Repository
has body: So my aim is for a specific book (with the given id), to get the published version for each language. If there is no version that is published then I need to retrieve the most recent, by the timestamp. I need to do a query whereby the order by is performed before group. I know in sql you can do (roughly) Select * From ( Select b from Book as b where b.author = ?1 ORDER BY (case when b.info.status=published then 1 else 2) asc, b.timestamp desc) GroupBy book.language However I dont know how to do a similar join thorugh a query in a jpa repository using hibernate. I know this doesnt work, as the order is lost due to the 'in' Select a From book a where a.id in ( Select b from Book as b where b.author=?1 ORDER BY (case when b.info.status=published then 1 else 2) asc, b.timestamp desc) GroupBy a.language As it goes through and checks in, this means the order is not kept. Is there anyway to do this query in jpa repository? I don't want to have to do a 'for each' and get the published/latest as this will be greatly inefficient The books is setup as book | author| info id Then info id has: infoid| language| timestamp | status|......... An example aim would be : Get j.k. rowlings published/latest in each language example setup of book would be book | author | info id 1 |Rowling |1 2 |Rowling |2 3 |Rowling |3 4 |Rowling |4 5 |Tolkein |5 info: id|lang|ts | status 1 |en |1 | published 2 |de |5 | unpublished 3 |de |3 | unpublished 4 |en |9 | unpublished 5 |en |4 | published Requesting it woudl return book 1 (as published and in english), and 2 (as in de, with the highest timestamp out of de)
tagged with: sql
favorite count: 0
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41143748
tagged with: spring
has comment: http://stackoverflow.com/comment/41145352
has answer: http://stackoverflow.com/a/26232186
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26232186
type: Question

http://stackoverflow.com/a/26292541
type: Answer
answers question: http://stackoverflow.com/q/26292109
score: 0
has body: just pass context from one class to another class use context.getContextResolver()

http://stackoverflow.com/a/26243207
has body: import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Shape; import java.awt.geom.Ellipse2D; import javax.swing.JButton; import javax.swing.JFrame; public class CreateRoundButton extends JButton { public CreateRoundButton(String label) { super(label); Dimension size = getPreferredSize(); size.width = size.height = Math.max(size.width,size.height); setPreferredSize(size); //added to remove a border of the text in jbutton setFocusPainted(false); setContentAreaFilled(false); } protected void paintComponent(Graphics g) { if (getModel().isArmed()) { g.setColor(Color.lightGray); } else { g.setColor(getBackground()); } g.fillOval(0, 0, getSize().width-1,getSize().height-1); super.paintComponent(g); } protected void paintBorder(Graphics g) { g.setColor(getForeground()); g.drawOval(0, 0, getSize().width-1, getSize().height-1); } Shape shape; public boolean contains(int x, int y) { if (shape == null || !shape.getBounds().equals(getBounds())) { shape = new Ellipse2D.Float(0, 0, getWidth(), getHeight()); } return shape.contains(x, y); } public static void main(String[] args) { JButton button = new CreateRoundButton("Click"); button.setBackground(Color.gray); JFrame frame = new JFrame(); frame.getContentPane().add(button); frame.getContentPane().setLayout(new FlowLayout()); frame.setSize(150, 150); frame.setVisible(true); } } Taken from here http://www.roseindia.net/tutorial/java/swing/createRoundButton.html
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41178911
downvote count: 0
answers question: http://stackoverflow.com/q/26243091

http://stackoverflow.com/comment/41275609
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26303467
has text: Okay, yes. But what would happen if you casted to `List<List<Test>>` instead? That has an `add` method. For the `Iterable` case, there's semantically no issue (because `Iterable`s are read-only), but for the general case, it allows you to violate the inner template's type, so Java won't allow you to do it.
type: Comment

http://stackoverflow.com/comment/41347421
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26329776
has text: I download JTAPI from link you provide in your request.This file contains source code not the compiled code that why i paste the contents of file in my project src folder.
type: AnswerComment

http://stackoverflow.com/a/33082436
score: 0
type: Answer
has body: what I understood is that /dev/random can run out of entropy (whatever this means) but perhaps it means at some point it cant generate any more random numbers). It can temporarily run out of entropy and block until it gathers enough to dispense more. The JVM only needs a little to seed a SecureRandom instance. How long it takes depends on how noisy your system is and how the kernel gathers entropy. Is it sane from Oracle to rely on /dev/random when there can be corner cases where the OS cant produce any more numbers? The lack of entropy can be problematic on embedded systems or in VMs on first boot which come with a very deterministic image, have few sources of entropy that can be harvested compared to real PCs and no RDRAND instruction or similar for the kernel to harvest for entropy pool initialization. Insufficient randomness can be catastrophic for key generation and other cryptographic algorithms, e.g. DSA is quite sensitive to the quality of your entropy source. So yes, it is quite sane to rather wait than having a compromised system. To quote from Mining Your Ps and Qs: Detection of Widespread Weak Keys in Network Devices by N.Heninger et al. To understand why these problem are occurring, we manually investigated hundreds of the vulnerable hosts, which were representative of the most commonly repeated keys as well as each of the private keys we obtained (Section 3.2 ). Nearly all served information identifying them as headless or embedded systems, including routers, server management cards, firewalls, and other network de- vices. Such devices typically generate keys automatically on first boot, and may have limited entropy sources com- pared to traditional PCs. Furthermore, when we examined clusters of hosts that shared a key or factor, in nearly all cases these appeared to be linked by a manufacturer or device model. These observations lead us to conclude that the problems are caused by specific defective implementations that generate keys without having col…
answers question: http://stackoverflow.com/q/26227344

http://stackoverflow.com/q/26273372
has body: currently I'm using File fTemp = com.google.common.io.Files.createTempDir(); to create a temporary path, then carry that path to another bunch of methods as parameter. I was wondering if there's a way to recover that temporary path, using a utils or something. So, my method is: private String environmentSetup() { File fTemp = Files.createTempDir(); fTemp.deleteOnExit(); return fTemp.getPath(); } Then I pass it as parameter to any other method could need that temp dir: public void someMethod(final String tempPath, ...) { //do something } I was curious about there's a way to recover that unique temp dir without passing its path as parameter every time. Something like this after creating that directory: public void someMethod(...){ //any function to get fTemp path from somewhere which isn't created fTemp itself //do something } It's mostly a matter of style, curious about there's a way to do something like this.
has comment: http://stackoverflow.com/comment/41221823
has comment: http://stackoverflow.com/comment/41264731
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41222408
has title: Access to a temp directory already created
has comment: http://stackoverflow.com/comment/41220146
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41222046
has comment: http://stackoverflow.com/comment/41221745
score: 0

nutiteq
tag name: nutiteq
tags question: http://stackoverflow.com/q/26294985
type: Tag

http://stackoverflow.com/comment/41306845
has text: What's a .FIC file? (Show us an example file, your parsing and search/matching code, what you expect that code to do and what it actually does.)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26320821
score: 1

http://stackoverflow.com/comment/41324541
comment on: http://stackoverflow.com/a/26330197
score: 0
type: AnswerComment
has text: The async task is part of your activity (or, as @CommonWare suggested - a fragment). An inner class is OK here.
type: Comment

http://stackoverflow.com/a/26344704
has body: If the class that you`re trying to import does exist, it is an eclipse failure. Project -&gt; Clean should fix it.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41350929
type: Answer
answers question: http://stackoverflow.com/q/26344640
has comment: http://stackoverflow.com/comment/41351029
accepted answer of: http://stackoverflow.com/q/26344640
score: 1
upvote count: 1

http://stackoverflow.com/a/26308345
has body: The central issue with your design, as I see it, is the use of the surrogate keys. It is not necessary to always create numeric single-column keys for tables. And even if you do so, this doesn't guarantees you'll be free of duplicates. This, in fact, forces system to keep more indexes on your tables, which is an extra job to be done. Some concepts: I use singular for table names, 'cos each tuple in the table represents one object of the relation; I use small letters for table and column names (identifiers) and big letters for the keywords. I don't like CamelCase in databases; I use &lt;table_name&gt;_id for PK columns. It's also possible due to singular table names; I use prefix + table name + details for all constraints and indexes I create. You don't have to follow them, but it'd be very nice to stick to a consistent naming patterns for your design. I would start off with property_type dictionary: CREATE TABLE property_type ( property_type varchar(20) NOT NULL, CONSTRAINT p_property_type PRIMARY KEY (property_type) ); It is a one-column table, that exists only to provide a domain of possible values for the properties types. I used varchar(20), textual column is pretty fine. A benefit of this — you don't have to join back to this table via numeric keys to get what property_type_id=123 means. Properties: CREATE TABLE property ( property_id integer NOT NULL, property_name varchar(50) NOT NULL, property_type varchar(20) NOT NULL, CONSTRAINT p_property PRIMARY KEY (property_id), CONSTRAINT u_property_name UNIQUE (property_name), CONSTRAINT f_property_type FOREIGN KEY (property_type) REFERENCES property_type ON UPDATE CASCADE ); I decided to go with a numeric PK here, for I suppose you might want to rename properties at some point. And should you change property_type, updates will be cascaded. Despite the fact there's a PK here already, UNIQUE constraint on names is a must here, otherwise you risk to end up in a situation where you have equally named properties with dif…
has comment: http://stackoverflow.com/comment/41304785
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41304898
accepted answer of: http://stackoverflow.com/q/26277702
answers question: http://stackoverflow.com/q/26277702
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/26315173
type: Question
tagged with: camera
score: 0
has comment: http://stackoverflow.com/comment/41296345
has body: this uses the lwjgl library. in this 3D engine, I created a camera, it moves around fine, but the rotation is really bad. First off, left and right move diagonally down left or right, and up and down make the object stretch. all of my rotation code to do with the camera: public Vector3f rotate(float angle, Vector3f axis) { float sinHalfAngle = (float)Math.sin(Math.toRadians(angle / 2)); float cosHalfAngle = (float)Math.cos(Math.toRadians(angle / 2)); float rX = axis.getX() * sinHalfAngle; float rY = axis.getY() * sinHalfAngle; float rZ = axis.getZ() * sinHalfAngle; float rW = cosHalfAngle; Quaternion rotation = new Quaternion(rX, rY, rZ, rW); Quaternion conjugate = rotation.conjugate(); Quaternion w = rotation.mul(this).mul(conjugate); x = w.getX(); y = w.getY(); z = w.getZ(); return this; } can't remember if this has to do with rotation, but it's for the camera public Matrix4f ititProjection(float fov, float width, float height, float zNear, float zFar) { float ar = width/height; float tanHalfFOV = (float)Math.tan(Math.toRadians(fov / 2)); float zRange = zNear - zFar; m[0][0] = 1.0f / (tanHalfFOV * ar); m[0][1] = 0; m[0][2] = 0; m[0][3] = 0; m[1][0] = 0; m[1][1] = 1.0f / tanHalfFOV; m[1][2] = 0; m[1][3] = 0; m[2][0] = 0; m[2][1] = 0; m[2][2] = (-zNear - zFar)/zRange; m[2][3] = 2 * zFar * zNear / zRange; m[3][0] = 0; m[3][1] = 0; m[3][2] = 1; m[3][3] = 0; return this; } public Matrix4f initCamera(Vector3f forward, Vector3f up) { Vector3f f = forward; f.normalize(); Vector3f r = up; r.normalize(); r = r.cross(f); Vector3f u = f.cross(r); m[0][0] = r.getX(); m[0][1] = r.getY(); m[0][2] = r.getZ(); m[0][3] = 0; m[1][0] = u.getX(); m[1][1] = u.getY(); m[1][2] = r.getZ(); m[1][3] = 0; m[2][0] = f.getX(); m[2][1] = f.getY(); m[2][2] = f.getZ(); m[2][3] = 0; m[3][0] = 0; m[3][1] = 0; m[3][2] = 0; m[3][3] = 1; return this; }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41297557
answer count: 0
tagged with: java
has title: Camera rotation bug

http://stackoverflow.com/comment/41324956
type: QuestionComment
comment on: http://stackoverflow.com/q/26330442
score: 0
type: Comment
has text: Well. It is totally unclear what is going on. Calling a function `compileShader` which does _not_ compile (or in any other way relate to) shaders is a bit misleading. Using `glGetShaderInfoLog` on a _program_ is certainly not going to work, though. You want `glGetProgramInfoLog()` there.

http://stackoverflow.com/a/26298222
has body: You are calling roll, but not doing anything with the value that it returns.
score: 0
answers question: http://stackoverflow.com/q/26298161
type: Answer

http://stackoverflow.com/comment/41389802
comment on: http://stackoverflow.com/a/26353144
score: 0
type: Comment
has text: Thank you for the suggestion. However, I don't thing it would an optimized strategy in general.
type: AnswerComment

http://stackoverflow.com/a/26267936
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26267841
has comment: http://stackoverflow.com/comment/41210551
downvote count: 0
has comment: http://stackoverflow.com/comment/41210575
type: Answer
has body: Implementing an interface is not inheritance. It's as simple as that. what if someone implements both your interfaces but supplies a different implementation than the default one? So no, this is not multiple inheritance, It's simply a way to write your code that depends on nobody actually implementing their own version of the default methods. Which means that it depends on people not actually using interfaces the way they're supposed to, because they are supposed to be able to implement their own methods instead of the defaults, but if they actually do that your "multiple inheritance" does not work as expected. So I'd actually consider this to be misuse of the language.

http://stackoverflow.com/a/26284126
answers question: http://stackoverflow.com/q/26241524
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26241524
type: Answer
score: 2
downvote count: 0
has body: I managed to solve the problem with ControlsFX notification for the notification window. code sample: Notifications.create() .title("Task Reminder") .text(eventDescription) .showWarning(); I'm able to create a small pop up window at the bottom right of the screen. However, to use the code, you need to add ControlFx to the project library. And make sure to put the code at where the UI Application is because Javafx only works in the UI tread. As for the date comparison, just use java Calendar.It has useful APIs in it.
upvote count: 2

http://stackoverflow.com/a/26260256
accepted answer of: http://stackoverflow.com/q/26259953
type: Answer
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/26259953
has body: I suggest to use reflection for that it is actually quite easy: unit u = new unit(); for(int i=0;i&lt;;header1.lenght;i++) { String h = header1[i]; String v = value11[i]; Field f = u.getClass().getDeclaredField(h); f.set(u, v); } Obviously you will need some more infrastructure to iterate your data tuples ... value11, value12, etc.

http://stackoverflow.com/comment/41347363
type: Comment
type: QuestionComment
has text: And now the question has changed
comment on: http://stackoverflow.com/q/26342645
score: 1

http://stackoverflow.com/q/26275165
tagged with: apache-poi
downvote count: 0
has answer: http://stackoverflow.com/a/26275750
type: UnansweredQuestion
tagged with: swing
type: Question
has body: I am trying to create a java application which would search for particular word in the selected doc, docx file and generates a report on it. That report will contain the page number and the line number of the searched word. Now that what I have achieved is I am able to read the doc and docx file by paragraph. But I didn't find any way to search for a particular word and to get the line &amp; page number where that word is present. I searched a lot but no luck till now. Hope someone knows the way to do this. Here is my code if(fc.getSelectedFile().getAbsolutePath().contains("docx")) { File file = fc.getSelectedFile(); FileInputStream fis = new FileInputStream(file.getAbsolutePath()); XWPFDocument document = new XWPFDocument(fis); List&lt;XWPFParagraph&gt; paragraphs = document.getParagraphs(); System.out.println("Total no of paragraph "+paragraphs.size()); for (XWPFParagraph para : paragraphs) { System.out.println(para.getText()); } fis.close(); } else { WordExtractor extractor = null; FileInputStream fis = new FileInputStream(fc.getSelectedFile()); HWPFDocument document = new HWPFDocument(fis); extractor = new WordExtractor(document); String[] fileData = extractor.getParagraphText(); for (int i = 0; i &lt; fileData.length; i++) { if (fileData[i] != null) System.out.println(fileData[i]); } extractor.close(); } I am using swing, apache poi 3.10.1.
tagged with: java
score: 4
has title: How to get the line number, page number of a particular word in a doc,docx file using apache poi?
answer count: 1
favorite count: 0
upvote count: 4

http://stackoverflow.com/comment/41100800
score: 0
type: Comment
type: QuestionComment
has text: Not duplicated !!!!!!!! Using math, not a formatter!
comment on: http://stackoverflow.com/q/26208940

http://stackoverflow.com/q/26309286
type: Question
has title: Websocket ClientEndpoint OnMessage-method not called when large String (length 20000) is sent
answer count: 1
downvote count: 0
tagged with: websocket
tagged with: string
favorite count: 0
type: UnansweredQuestion
tagged with: client
has body: 1) Using javax.websocket.ClientEndpoint and javax.websocket.OnMessage with JavaSE-1.8 2) Server (built with Annotations) sends String with length 20000: @ServerEndpoint("/websocket") public class MyEndpoint { @OnMessage public String onMessage(String message, Session session) { session.getBasicRemote().sendText( "eg String with length 20000 .... ... ..." ); } } 3) Client sends request and should receive String from server (example just receives): @ClientEndpoint public class Receiver { @OnMessage public void processMessage(String message, Session session) { System.out.println("Message received: " + message ); } } But: No Message is received by client. Shorter strings eg length 500 work. No exception is raised at server (if try-catch used). So - the sent string with Length 20000 disappears without any error ! A browser which sends the request to the server receives the string from the server and everything works, so problem has to be at client. Also the implementation org.java_websocket.client.WebSocketClient receives the String from the server. I also tried to set MaxTextMessageBufferSize with session.setMaxTextMessageBufferSize(25000); Where is the bug? Where do i have to report this bug to get a working client for larger strings? The implementation of javax.websocket is pretty nice with its session-IDs and i do not want to wrap org.java_websocket.client.WebSocketClient just because of this single bug in javax.websocket.ClientEndpoint ? Thanks.
has answer: http://stackoverflow.com/a/26320122
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/26391583
upvote count: 26
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26199750
accepted answer of: http://stackoverflow.com/q/26199750
score: 26
has body: I solved that issue, I was using JDK version 1.8 and JBOSS 7.1, The JBOSS server always stuck on "Starting Brontes".... I have tried changing the server startup time, and settings but nothing helped. I then unistalled JDK 1.8, and installed JDK 1.7, and this solves my issue. JBOSS 7.1 works with JDK 1.7.. :) And one thing more, JDK 1.8 can work with JBOSS WildFly 8...
type: AcceptedAnswer

http://stackoverflow.com/comment/41228501
has text: An anonymous class isn't really anonymous at the JVM level. It still has a unique `Class` instance associated with it. But in general, that won't help. What if you had `Result getResult(final int foo) { return cache.get(new Command<Result>() { invoke() { return foo + something(); } }); }`, where `foo` is a parameter?
score: 0
comment on: http://stackoverflow.com/q/26277986
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41353421
type: AnswerComment
has text: I was trying to write the code using if but it seemed a lot of works that's why i suggested while loop
comment on: http://stackoverflow.com/a/26245109
score: 0
type: Comment

http://stackoverflow.com/q/26229627
type: Question
has answer: http://stackoverflow.com/a/26229787
has body: Am facing problem while using @Temporal(TemporalType.DATE) recently we started migrating our project from struts2 to spring while we are using @Temporal(TemporalType.DATE) in struts2 for a java.util.Date field able to retrieve the Date field data as 10/7/14 but coming to springs the same Date field data is retrieving as Tue Oct 07 11:21:00 IST 2014 So,why spring is unable to convert the Tue Oct 07 11:21:00 IST 2014 to 10/7/14 which is a java.util.Date object internally. How we can achieve this conversion of Tue Oct 07 11:21:00 IST 2014 to 10/7/14 as a java.util.Date Object. Any help is greatly appreciated thanks.
tagged with: java.util.date
score: 0
answer count: 2
has title: Getting java.util.Date Object As (10/7/14 ) From Another java.util.Date Object (Tue Oct 07 11:21:00 IST 2014)
possible better answer: http://stackoverflow.com/a/26229672
has answer: http://stackoverflow.com/a/26229672
accepted answer: http://stackoverflow.com/a/26229787
tagged with: timestamp
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41361587
comment on: http://stackoverflow.com/a/26348966
type: AnswerComment
has text: @Rafael Java 8 has a new, inbuilt Time API based on JodaTime
score: 0
type: Comment

http://stackoverflow.com/q/26236045
score: 3
has body: I have a three.js scene: var scene = new THREE.Scene(); The scene contains many objects which are animated. My goal is to export the animation as a mpg4 video. My questions: How can I export a scene to get an mpg4 video? Should I do the export on the client side or on the server side? Edit: I need it to run on a website or on a Java based server. No browser extensions please.
tagged with: java
favorite count: 0
tagged with: webgl
has answer: http://stackoverflow.com/a/26236237
type: Question
tagged with: javascript
upvote count: 3
answer count: 3
has title: Three.js: How can I convert a Scene into an MPG4 Video?
tagged with: three.js
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/70153082
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76495357

http://stackoverflow.com/comment/41231651
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26278557
has text: yes, className = "insertItems" is unique. Now so far got a success on hover dropdown list is displayed. But still not able to click on first option. tried with WebElement modulesAndTopics = driver.findElement(By.xpath("//*[@title='Topics']")); modulesAndTopics.click(); throws an error javascript(0)

http://stackoverflow.com/a/26279874
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41233047
type: Answer
has comment: http://stackoverflow.com/comment/41232725
score: 2
answers question: http://stackoverflow.com/q/26279003
upvote count: 2
has comment: http://stackoverflow.com/comment/41232547
accepted answer of: http://stackoverflow.com/q/26279003
has comment: http://stackoverflow.com/comment/41233401
has comment: http://stackoverflow.com/comment/41232202
has comment: http://stackoverflow.com/comment/41232670
has comment: http://stackoverflow.com/comment/41233107
has body: Try out the Scanner class, it's great for this stuff Scanner in = new Scanner(new File("./myfile.txt")); while(in.hasNextLine()){ //read in a whole line String line = in.nextLine(); //sanity check so we don't try to substring an empty string from an empty line at the end of the file. if(line.length() == 0){ continue; } //15 chars from the end it 8 chars + 7 spaces //We go back 16 though since the string index starts at 0, not 1. line = line.subString(line.length()-16, line.length()-1); //Now split the string based on any white spaces in between the chars spaces String[] letters = line.split(" "); //Now do something with your letters array } Note that this assumes the formatting you posted is followed pretty strictly. The scanner can also read token by token if you wanted to set it up a little differently. Check out the Scanner documentation.
has comment: http://stackoverflow.com/comment/41232005

http://stackoverflow.com/a/26570700
accepted answer of: http://stackoverflow.com/q/26326167
answers question: http://stackoverflow.com/q/26326167
score: 0
type: AcceptedAnswer
has body: Thanks Calle, it also seems that playing around with portscans and many DNS lookups can trigger funny effects on the network infrastructure. After running a couple of those lookups inside a for loop with multiple treads I got a call asking what I was doing. :-( Cheers, Stephanie
type: Answer

http://stackoverflow.com/a/26214387
has body: Well , i solved it : - public class BasePage&lt;T extends BasePage&lt;T&gt;&gt; extends LoadableComponent&lt;T&gt;{ @Override public boolean isLoaded() { // Blank as all implemented algo comes under pages } @Override public boolean isLoad() { /// Will be Blank } } public class LoginPage extends BasePage { @Override public boolean isLoaded() { //Write logic } @Override public boolean isLoad() { /// Write Logic } }
upvote count: 2
answers question: http://stackoverflow.com/q/26210529
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/41282369
type: Comment
comment on: http://stackoverflow.com/a/26306299
score: 0
type: AnswerComment
has text: That setter would need to update the other two fields as well, since they're meant to be equivalent representations. I would avoid setters altogether and make the fields final, it's simple enough to create a new instance to represent a new temperature.

http://stackoverflow.com/a/26312676
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26312647
has comment: http://stackoverflow.com/comment/41310353
has body: So you want the InfoWindow as a popup window? If so, then the InfoWindow should be subclass of Stage and not Application.

http://stackoverflow.com/q/26256569
score: 0
has answer: http://stackoverflow.com/a/26256620
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has body: I have written a code to send email to users which is working properly. But with this I want to add a timer which automatically sends the email to the user by setting it at a particular time interval. So need help to get to know how can this be done..
duplicate of: http://stackoverflow.com/q/5814590
has answer: http://stackoverflow.com/a/26256766
tagged with: java
type: Question
answer count: 2
has title: how to call a function automatically with the use of timer?
linked to: http://stackoverflow.com/q/5814590
has comment: http://stackoverflow.com/comment/41188704
favorite count: 0

http://stackoverflow.com/comment/41101081
has text: Use https://cloud.google.com/storage/docs/gsutil. Then making all images public is a single command: `gsutil acl set public-read gs://bucket/*`
type: Comment
comment on: http://stackoverflow.com/a/26198081
type: AnswerComment
score: 0

http://stackoverflow.com/q/26216193
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26216323
tagged with: vaadin
type: Question
has body: I'm trying to load records from database table to Vaadin table. I'm getting all records from table process like this: public ResultSet selectRecordsFromDbUserTable() throws SQLException { Connection dbConnection = null; Statement statement = null; ResultSet rs = null; String selectTableSQL = "SELECT * from process"; try { dbConnection = getDBConnection(); statement = dbConnection.createStatement(); System.out.println(selectTableSQL); // execute select SQL stetement rs = statement.executeQuery(selectTableSQL); } catch (SQLException e) { System.out.println(e.getMessage()); } finally { if (statement != null) { statement.close(); } if (dbConnection != null) { dbConnection.close(); } } return rs; } And it is working well. In ResultSet rs I'm getting all rows which I need. How to load them into Vaadin Table?
answer count: 1
downvote count: 0
has title: Getting all records from database to Vaadin Table
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/26216323
favorite count: 0
upvote count: 1

http://stackoverflow.com/comment/41270594
type: QuestionComment
score: 1
has text: I think the book is wrong. This can't work.
comment on: http://stackoverflow.com/q/26300828
type: Comment

http://stackoverflow.com/comment/41319391
score: 0
type: AnswerComment
has text: Then your .jar isn't built like you think it is, if you are getting this from inside an IDE you probably aren't copying `resource/generic` into the classpath. This is a configuration issue on your part then.
comment on: http://stackoverflow.com/a/26327638
type: Comment

http://stackoverflow.com/comment/46908262
type: Comment
score: 1
has text: so how to make enable to reuse previous activities form same package?
type: AnswerComment
comment on: http://stackoverflow.com/a/26211006

http://stackoverflow.com/comment/41195752
type: Comment
type: QuestionComment
score: 0
has text: No postrequest is on the same thread as the async
comment on: http://stackoverflow.com/q/26260174

http://stackoverflow.com/a/26264480
answers question: http://stackoverflow.com/q/26263318
has comment: http://stackoverflow.com/comment/41577448
has comment: http://stackoverflow.com/comment/41204535
type: Answer
has comment: http://stackoverflow.com/comment/41204948
has comment: http://stackoverflow.com/comment/41582018
has comment: http://stackoverflow.com/comment/41205848
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/41205020
has comment: http://stackoverflow.com/comment/41204411
has comment: http://stackoverflow.com/comment/41246981
has comment: http://stackoverflow.com/comment/41204808
has comment: http://stackoverflow.com/comment/41204275
has comment: http://stackoverflow.com/comment/41581709
has comment: http://stackoverflow.com/comment/41204901
downvote count: 0
has comment: http://stackoverflow.com/comment/41204785
has comment: http://stackoverflow.com/comment/41204841
has body: The best way to do these sort of Java integrations is to start with instantiation. So first run your create code and dump the result... what do you see? &lt;cfset obj = createObject("java", "com.company.Run")/&gt; &lt;cfdump var="#obj#"/&gt; Next dump the init() function (which I do not see in your class but is perhaps part of the superclass): &lt;cfset obj = obj.init()/&gt; // assuming it returns an instance of Run &lt;cfdump var="#obj#"/&gt; What's the dump show you? You should definitely see runThis as a method to the class. Finally work through the runThis method. Keep in mind that the variables you pass must be Java String Types - that's probably your issue. If they aren't the right type then the args are calling a different method signature. Instead of a helpful message like, "I have a runThis but those are not the right arguments or types" Java simply throws "method not found" (because you can overlaod a method by passing in different args). If it is a problem with the string type try using JavaCast() in your method call as in: var variable1= Javacast("String","string1"); Setting the type in this way usually allows your data to be marshalled accross the threshold between Java and CF as the correct type. This post on Java and CF is somewhat dated but it has a few useful approaches in it. Hope this helps.

http://stackoverflow.com/q/26334331
tagged with: swt
tagged with: jface
has title: How to enable scrollbar for TreeViewer
tagged with: java
type: Question
has body: I need to construct a JFace dialog, which consists of a TreeViewer. This is how I have overriden the createDialogArea(Composite) method: @Override protected Control createDialogArea(Composite parent) { parentComposite = (Composite) super.createDialogArea(parent); parentComposite.setLayout(new FillLayout(SWT.HORIZONTAL)); sc = new ScrolledComposite (parentComposite, SWT.H_SCROLL | SWT.V_SCROLL); composite = new Composite (sc, SWT.NONE); composite.setLayout(new GridLayout(1,false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); TreeViewer viewer = new TreeViewer(composite); viewer.setContentProvider(new ExplorerContentProvider(rootFolderType, shell)); viewer.setLabelProvider(new ExplorerLabelProvider()); viewer.setInput(rootFolderComponent); sc.setContent(composite); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); return parentComposite; } With the above code, this is my Observation: I have 100 elements in the tree, so I have an outer scrollbar (since I used ScrolledComposite). Then if I expand each element I get another scrollbar for the TreeViewer. Can I achieve this with a single scrollbar?
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26334449

http://stackoverflow.com/a/26196064
downvote count: 0
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41077355
answers question: http://stackoverflow.com/q/26196037
has body: The reason why you're getting a null pointer exception is that you are never assigning a value to oth, and therefore it remains being null from when you declared it. This otherClass oth; ^ no value is being assigned Is basically the same as otherClass oth = null; Since it is always null, calling a method from the object throws the error.

http://stackoverflow.com/q/26318295
tagged with: logging
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/26320693
tagged with: log4j2
type: Question
has answer: http://stackoverflow.com/a/46989326
has title: write System.out to file with log4j2
tagged with: configuration
answer count: 2
downvote count: 0
has body: Is it possible to write the System.out (OutputStream) directly to a log file like in the "old" log4j? I only find solutions for log4j, not log4j2 thanks for any help!
score: 7
tagged with: log4j
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26291516
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: Something you can also try is to extract the jar and modify the MANIFEST.MF file to add the third party jars to Class-Path and zip the folder back and rename the extension to .jar. Also you can refer the below for other ways to modify the manifest. http://www.mkyong.com/java/how-to-add-your-manifest-into-a-jar-file/ http://docs.oracle.com/javase/tutorial/deployment/jar/update.html
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26291318
answers question: http://stackoverflow.com/q/26291318

http://stackoverflow.com/q/26210498
has comment: http://stackoverflow.com/comment/41103731
has comment: http://stackoverflow.com/comment/41103803
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: thread-safety
accepted answer: http://stackoverflow.com/a/26210584
has comment: http://stackoverflow.com/comment/41103921
type: Question
has title: Is synchronized access to non-volatile fields thread safe?
answer count: 2
tagged with: volatile
has comment: http://stackoverflow.com/comment/41103751
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26210826
has comment: http://stackoverflow.com/comment/41103774
has answer: http://stackoverflow.com/a/26210826
has comment: http://stackoverflow.com/comment/41103713
has answer: http://stackoverflow.com/a/26210584
has body: I am unable to find this particular scenario answered anywhere. If I call init() simultaneously from two threads, is one of the calls guaranteed to see that the time is not null anymore? Does time need to be volatile as well? Does it work like join() which is a synchronisation point? private Long time; synchronized void init() { if (time != null) { throw new IllegalStateException("Already initialised."); } this.time = System.currentTimeMillis(); }

http://stackoverflow.com/q/26324250
score: -3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26324912
has comment: http://stackoverflow.com/comment/41314445
tagged with: java
downvote count: 3
tagged with: file
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/26324912
has title: java code to split text file into chunks based on chunk size
has body: i need to split the given text file into equally sized chunks and store them into an array. The input is a set of many text files in same folder. Im using the following code for this: int inc = 0; File dir = new File("C:\\Folder"); File[] files = dir.listFiles(); for (File f : files) { if(f.isFile()) { BufferedReader inputStream = null; try { inputStream = new BufferedReader(new FileReader(f)); String line; while ((line = inputStream.readLine()) != null) { String c[] = splitByLength(line, chunksize); for (int i=0;i&lt;c.length;i++) { chunk[inc] = c[i]; inc++; } } } finally { if (inputStream != null) { inputStream.close(); } } } } public static String[] splitByLength(String s, int chunkSize) { int arraySize = (int) Math.ceil((double) s.length() / chunkSize); String[] returnArray = new String[arraySize]; int index = 0; for(int i=0; i&lt;s.length(); i=i+chunkSize) { if(s.length() - i &lt; chunkSize) { returnArray[index++] = s.substring(i); } else { returnArray[index++] = s.substring(i, i+chunkSize); } } return returnArray; } Here the chunk values are stored in the "chunk" array. But the problem here is since i have used the readLine() command to parse the text file, the result obtained is correct only if the chunk size is less than the number of characters in a line. Lets say every line has 10 characters and the number of lines in the file is 5. Then if i provide chunk size of any value greater than 10 it always split the file into 10 chunks with each line in each chunk. Example, consider a file with the following contents, abcdefghij abcdefghij abcdefghij abcdefghij abcdefghij if chunk size = 5 then, abcde | fghij | abcde | fghij | abcde | fghij | abcde | fghij | abcde | fghij | if chunk size = 10 then, abcdefghij | abcdefghij | abcdefghij | abcdefghij | abcdefghij | if chunk size > 10 then also my code only provides the same as before, abcdefghij | abcdefghij | abcdefghij | abcdefghij | abcdefghij | I tried using RandomAccessFile and FileChannel but i wasnt able to o…
answer count: 1
favorite count: 0
tagged with: chunks
tagged with: chunking

http://stackoverflow.com/comment/41158729
comment on: http://stackoverflow.com/a/26239226
has text: Of course it does exsist, I'm not that stupid =) I realized what the problem was and posted answer bellow. Thanks for help =)
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41329586
comment on: http://stackoverflow.com/a/26332842
type: Comment
has text: What do you mean "when add the letter and number"?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/55280781
type: Comment
comment on: http://stackoverflow.com/a/33756603
score: 5
type: AnswerComment
has text: I've the same issue with my code and is resolved by adding an empty constructor

http://stackoverflow.com/a/26327257
accepted answer of: http://stackoverflow.com/q/26327065
has body: Any application, that leaves the DB in a possibly inconcistent state on hard crash, is unfit for banking use. Applications, that leverage so called "Java Transactions" are part of this group. Any serious banking application will have all writing processes encapsulated into a server-side capsule (read: stored procedure) and not allow any write access to any table. Read access will be served by a mixture of stored procedures and views. Together with a crash-resistant RDBMS, this guarantees all-or-nothing handling of jobs.
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26327065
score: 2
downvote count: 0

http://stackoverflow.com/a/26318993
upvote count: 1
has body: If you know the possible types of the object you can use the instanceof operator.For example : SomeList&lt;A&gt; list; for(int i = 0; i &lt; list.size(); i++){ if( list.get(i) instanceof AClass){ ..... }else if(list.get(i) instanceof BClass){ ..... } }
type: Answer
answers question: http://stackoverflow.com/q/26318931
downvote count: 0
score: 1

http://stackoverflow.com/comment/41136524
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26227691
has text: Hi I made Java capital as you said and not making any difference and can you also suggest me alternative please. and one more question my above paths fine or do I have to specify them thanks a lot my friend so far....
type: AnswerComment

method-hiding
tag name: method-hiding
type: Tag
tags question: http://stackoverflow.com/q/26236683

http://stackoverflow.com/comment/41289663
type: Comment
has text: It should tell you which line within the constructor is breaking. Otherwise I'm not entire sure what the issue can be. Check to make sure you aren't doing something like `SomeClass s = new File(str)` where SomeClass is a class other than File.
type: AnswerComment
comment on: http://stackoverflow.com/a/26311188
score: 0

http://stackoverflow.com/comment/41295007
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26314378
has text: In Help->Install Software, go to the official site of the eclipse version you are using, and check for Perl bundles.If available, install them and rest of the work will be done by the eclipse implicitly.

http://stackoverflow.com/q/26262128
type: Question
score: -1
answer count: 2
tagged with: operating-system
has comment: http://stackoverflow.com/comment/41199500
upvote count: 0
has comment: http://stackoverflow.com/comment/41210448
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26262485
has body: This is how my manifest file look like &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.abc" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; when I right click on android project > properties > android I see target name as android 4.0 as minimum I want to make the apk file usable in android 2.3 platform features and API I am using: google maps v2, fused location provider I am fairly new to android, I did google before asking
tagged with: android
tagged with: apk
tagged with: platform
has answer: http://stackoverflow.com/a/26262481
tagged with: java
has comment: http://stackoverflow.com/comment/41210560
has title: android how to build the apk that works for android 2.3 as minimum os level
downvote count: 1

http://stackoverflow.com/q/26212415
type: AnsweredQuestion
has title: Forcing two similar classes to behave as if they were polymorphic in Java
tagged with: oop
has answer: http://stackoverflow.com/a/26212452
tagged with: inheritance
has answer: http://stackoverflow.com/a/26214002
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26214002
tagged with: polymorphism
favorite count: 0
has comment: http://stackoverflow.com/comment/41110459
accepted answer: http://stackoverflow.com/a/26212452
upvote count: 6
has body: Abstract: I would like to interact with two classes ('Item' and 'Block') that share many similar functions as if they were implemented from an interface with these functions, however they are not and I can not edit them. What are my options for dealing with this? Am I stuck writing super hacky code? Details: I am working on a minecraft mod in Java, part of working with minecraft is that I can not edit the base code of the game. There are two fundamental classes to the game; "Block" and "Item", both of these share a number of functions however the developers did not make them implement an interface (as I wish they had). To keep my code clean and avoid a lot of if statements switching between handling Blocks and Items I would like to keep both in a generic list, preferably casting to Block or Item as little as possible, and while attempting to maintain readability. My current solution fails to satisfy as a good one, it's hard to read and while it cleans up some code duplication I still have to cast return types. Update: Based on the answer left by Eran I have updated my solution to this problem and I now find this to be satisfactory: I created adapter (taking the adapter name as suggested in comments) classes that interfaced with an ItemOrBlockAdapter and extended Block and Item: public interface ItemOrBlockAdapter { public String myGetUnlocalizedName(); public ItemOrBlockAdapter mySetCreativeTab(CreativeTabs tab); } public class BlockAdapter extends Block implements ItemOrBlockAdapter { protected BlockAdapter(String uid, Material m) { super(m); GameRegistry.registerBlock(this, uid); } public String myGetUnlocalizedName() { return this.getUnlocalizedName(); } public ItemOrBlockAdapter mySetCreativeTab(CreativeTabs tab) { return (ItemOrBlockAdapter)this.setCreativeTab(tab); } } This is a lot better than the hacky solution I used before (looking through Block and Item methods to find the desired method every call)! However it is not without fault, I now have to write ev…
tagged with: java
score: 6
type: Question

http://stackoverflow.com/a/26352882
score: 0
answers question: http://stackoverflow.com/q/26352501
type: Answer
has body: MadProgrammer gave a really great explanation. I just put it together as a code. I tried to make minimum changes to your original code so that you understand better. import java.util.Scanner; public class BugerCheese { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int burger_price=40, sofdrink_price=20; int qty1=0, qty2=0; while(true){ System.out.println("Select item [1] burger [2] sofdrink"); int select=scan.nextInt(); switch(select){ case 1: System.out.println("Enter Quantity: "); qty1 += scan.nextInt(); break; case 2: System.out.println("Enter Quantity: "); qty2 += scan.nextInt(); break; default: System.out.println("Select [1] and [2] only"); } System.out.println("Enter 9 to add more items. Enter any other key to calculate total"); if(9!=scan.nextInt()){ break; } } if(qty1&gt;0){ int total=qty1*burger_price; System.out.println("Item: Burger"); System.out.println("Quanity: "+qty1); System.out.println("Total: "+total); } if(qty2&gt;0){ int total2=qty2*sofdrink_price; System.out.println("Item: Softdrink"); System.out.println("Quanity: "+qty2); System.out.println("Total: "+total2); } System.out.println("GrandTotal: "+(qty1*burger_price+qty2*sofdrink_price)); } }

http://stackoverflow.com/q/26245020
has answer: http://stackoverflow.com/a/26245293
has answer: http://stackoverflow.com/a/26245168
accepted answer: http://stackoverflow.com/a/26245168
score: 16
has comment: http://stackoverflow.com/comment/41169224
tagged with: android-intent
type: AnsweredQuestion
has title: Sane way to go from ArrayList<Long> through an Intent
tagged with: long-integer
tagged with: java
has body: I'm currently writing an app that pulls an array of longs from a server via json, and then passes that list from one activity into another. The basic skeleton looks like this: public void onResponse(Map result) { ArrayList handles= (ArrayList)result.get("fileHandles"); Intent intent = new Intent(FirstActivity.this, SecondActivity.class); intent.putExtra("handles", handles); } So the first problem becomes evident, the only methods for putExtra are putIntegerArrayListExtra, putStringArrayListExtra, putCharSequenceArrayListExtra, and putParcelableArrayListExtra. Thinking Long would probably be parcelable, I was wrong it doesn't work (even if I use ArrayList&lt;Long&gt;). Next I thought I'd just pass a long [], however I see no straight-forward conversion to go from ArrayList&lt;Long&gt; to long [] that intent.putExtra will accept. This was the solution I finally ended up with: ArrayList handles= (ArrayList)result.get("fileHandles"); long [] handleArray = new long[handles.size()]; for (int i = 0; i &lt; handles.size(); i++) { handleArray[i] = Long.parseLong(handles.get(i).toString()); } Obviously this seemed a little bit ridiculous to me, but every other conversion I tried seemed to complain for one reason or another. I've thought about re-thinking my serialization to have the problem taken care of before I get to this point, but I find it odd that passing ArrayList&lt;Long&gt; from activity to activity could be so difficult. Is there a more obvious solution I'm missing?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26245293
downvote count: 0
upvote count: 16
has comment: http://stackoverflow.com/comment/41354623
favorite count: 0
tagged with: arraylist
tagged with: android

http://stackoverflow.com/q/26245054
has comment: http://stackoverflow.com/comment/41168771
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41169168
has answer: http://stackoverflow.com/a/26245159
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41169716
tagged with: eclipse
type: Question
answer count: 2
downvote count: 0
has body: I'm currently working on a simple game in java, representative of the DOS game Gorillas.bas. I'm creating an arraylist to store the individual buildings do to collision checking and whatnot, but Eclipse is giving me an error no matter how I go about it. Here is what i've got for the arraylist. ArrayList&lt;Rectangle&gt; Buildings = new ArrayList&lt;Rectangle&gt;(); Point build1 = new Point(75,30); Rectangle building1 = new Rectangle(build1, BUILDING_WIDTH, 150); Buildings.add(Rectangle building1); The error is on the .add() method, it tells me that the method needs a body instead of a semicolon. What does this mean? Is eclipse not recognizing the .add()? EDIT: A bit of the code around it as requested; doesn't appear to have any syntax errors. public double bananaX = 85; public double bananaY = 292; public double bananaDX = 1; public double bananaDY = 1; public double power = 0; public double direction = 0; public double rise; public double run; Point start = new Point(0,0); Point finish = new Point(0,0);` ArrayList&lt;Rectangle&gt; buildings = new ArrayList&lt;Rectangle&gt;(); Point build1 = new Point(75,350); Point build2 = new Point(225, 250); Point build3 = new Point(325, 200); Point build4 = new Point(425, 200); Point build5 = new Point(525, 250); Point build6 = new Point(675, 350); Rectangle building1 = new Rectangle(build1, BUILDING_WIDTH, 150); buildings.add(building1); public void power(Point start, Point finish) { int power = 0; power = (int)start.distanceTo(finish); } public void direction(Point start, Point finish) { double direction = 0; rise = (finish.y - start.y)*-1; run = (finish.x - start.x)*-1; direction = rise/run; bananaDX = run/10; bananaDY = (rise/10); System.out.printf("rise = %f\nrun = %f\ndirection = %f\n\n ",rise, run, direction); }
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/26245159
has answer: http://stackoverflow.com/a/26245080
has comment: http://stackoverflow.com/comment/41169586
accepted answer: http://stackoverflow.com/a/26245080
favorite count: 0
has title: What is wrong with the .add in my ArrayList?

http://stackoverflow.com/comment/41199188
comment on: http://stackoverflow.com/a/26261665
score: 1
has text: I would suggest reading up on color theory. It is important to understand what you are doing, and not just copying and pasting other people's code. This is especially true when you are enrolled in a course to learn it (as the link above would indicate). Perhaps you can start your reading here: http://en.wikipedia.org/wiki/HSL_and_HSV
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26340596
answers question: http://stackoverflow.com/q/26340090
has comment: http://stackoverflow.com/comment/42511504
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26340090
has body: Changed MessageClass.CLASS0 to MessageClass.CLASS1 at GeneralDataCoding's constructor parameter and it's gone. Github comment makes it clear: class 0 means "Flash SMS" which is not stored on a phone. For further info refer to github's issue.

http://stackoverflow.com/a/26210783
has comment: http://stackoverflow.com/comment/41104499
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41106687
has comment: http://stackoverflow.com/comment/41104676
upvote count: 1
has comment: http://stackoverflow.com/comment/41106737
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41108122
answers question: http://stackoverflow.com/q/26210694
type: Answer
accepted answer of: http://stackoverflow.com/q/26210694
has comment: http://stackoverflow.com/comment/41108141
has comment: http://stackoverflow.com/comment/41104474
has body: Try this: public static void displayDirectoryContents(File dir, String rootDir) { File[] files = dir.listFiles(); for (File file : files) { if (file.isDirectory()) { displayDirectoryContents(file, rootDir); } else { System.out.println(file.getPath().replaceFirst(rootDir, "")); } } } public static void main(String[] args) throws IOException { String rootDir = &lt;rootDir&gt;; File currentDir = new File(rootDir); displayDirectoryContents(currentDir, rootDir); }

http://stackoverflow.com/q/26278453
has comment: http://stackoverflow.com/comment/41228984
has title: Java Graphics doesn't display anything
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26278585
tagged with: java
has comment: http://stackoverflow.com/comment/41228946
type: Question
has comment: http://stackoverflow.com/comment/41228991
has comment: http://stackoverflow.com/comment/41229234
answer count: 1
tagged with: awt
score: 0
has answer: http://stackoverflow.com/a/26278585
has body: so I'm trying to do a project in Eclipse and my Eclipse doesn't show anything. I mean, the code is fine but it just opens an window and it shows nothing in it, when it should show a line. FirstGraph.java import java.awt.Graphics; import javax.swing.JFrame; public class FirstGraph extends JFrame { private static final long serialVersionUID = 1L; public static void main(String[] args) { JFrame f = new JFrame(); f.setName("First Graph"); f.setSize(300, 300); f.setVisible(true); f.setBounds(30, 30, 300, 300); f.getContentPane().add(new MyCanvas()); f.setVisible(true); } public void Paint(Graphics g) { g.drawLine(50, 50, 250, 280); } } MyCanvas.java import java.awt.Graphics; import javax.swing.JComponent; public class MyCanvas extends JComponent{ private static final long serialVersionUID = -2508263540396372610L; public void Paint(Graphics g){ int[] x; x = new int[]{40, 125, 256, 290}; int[] y; y = new int[]{50, 115, 279, 295}; g.drawPolygon(x, y, x.length); } } What is the issue?
tagged with: jframe

http://stackoverflow.com/q/26301711
tagged with: java
upvote count: 1
has body: i have a program that uses javamail to retrieve messages from an exchange server using imap protocol then i process each messages that has been unseen. Recently i have come across with the problem of the program throwing a nullpointerexception i know that this is do to a unitialized object that is invoking a method, but in this case it does not make any sense to me. The stacktrace of the exception is as follows: java.lang.NullPointerException at com.sun.mail.imap.IMAPFolder.handleResponse(IMAPFolder.java:1905) at com.sun.mail.iap.Protocol.notifyResponseHandlers(Protocol.java:135 at com.sun.mail.imap.protocol.IMAPProtocol.fetchBodyStructure(IMAPProtocol.java:617) at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1027) at com.sun.mail.imap.IMAPMessage.getContentType(IMAPMessage.java:321) at javax.mail.internet.MimeBodyPart.isMimeType(MimeBodyPart.java:802) at javax.mail.internet.MimeMessage.isMimeType(MimeMessage.java:851) at ctt.mail.FileHandler.putFilesFromMail(FileHandler.java:75) at ctt.mail.FileHandler.main(FileHandler.java:37) aditionaly i've got the debug trace from the last processed message A607 FETCH 202 (FLAGS) * 202 FETCH (FLAGS (\Seen)) A607 OK FETCH completed. A608 FETCH 202 (ENVELOPE INTERNALDATE RFC822.SIZE) * 202 FETCH (ENVELOPE ("Mon, 14 Jul 2014 15:33:56 +0100" "=?iso-8859-1?Q?GPESE_-_ Pr=E9=5FAviso_de_Expedi=E7=E3o?=" (("SRS0+83ffd8147b51e356=4J=solicitador.net=gpese@solicitador.net" NIL "SRS0+83ffd8147b51e356=4J=solicitador.net=gpese" "solicitador.net")) NIL NIL (("=?iso-8859-1?Q?RECE=C7=C3O_FICHEIROS_CTT_WINREG?=" NIL "cttwinreg" "ctt.pt")) (("caraujo@caso.pt" NIL "caraujo" "caso.pt")) NIL NIL "&lt;1890939061.7011405348433043.JavaMail.gpese@solicitador.net&gt;") INTERNALDATE "14-Jul-2014 15:33:58 +0100" RFC822.SIZE 6462) A608 OK FETCH completed. A609 FETCH 202 (BODYSTRUCTURE) * 202 FETCH (BODYSTRUCTURE (("text" "plain" ("charset" "iso-8859-1") NIL NIL "quoted-printable" 0 0 NIL NIL NIL NIL)("text" "xml" ("name" "GPESE - GE_36951…
has comment: http://stackoverflow.com/comment/41273365
type: Question
has answer: http://stackoverflow.com/a/26312120
has title: NullPointerException when trying to print a mail message
tagged with: jakarta-mail
tagged with: nullpointerexception
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41272106
score: 1

http://stackoverflow.com/comment/91860473
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26203748
has text: See this function Exchange.getRequestReceiver().receiveFullBytes(cb, ecb) to read body asynchronously.
score: 1

http://stackoverflow.com/q/26302145
accepted answer: http://stackoverflow.com/a/26305784
tagged with: java
has title: play 2.4.x current application environment
type: Question
possible better answer: http://stackoverflow.com/a/26305491
score: 0
has comment: http://stackoverflow.com/comment/41273154
answer count: 2
tagged with: playframework
has comment: http://stackoverflow.com/comment/41275684
has body: Is there any function to return the current working environment of a Play framework application ? I tried the following but it doesn't seem to be working correctly; String environment = play.api.Play.Mode NOTE: I don't want to use isDev() isProd() stuff, I want to be able to create custom environments
has answer: http://stackoverflow.com/a/26305491
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26305784

http://stackoverflow.com/comment/41240487
type: Comment
has text: Can you show me a test case where this works? Thanks.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26264459

http://stackoverflow.com/a/26227205
score: 1
has comment: http://stackoverflow.com/comment/41165570
has body: I want to validate the length and characters that are being inserted in the field. Use a MaskFormatter with your JFormattedTextField. With the MaskFormatter you can: limit the number of characters provide a String of valid characters Read the API for more information and examples.
upvote count: 1
has comment: http://stackoverflow.com/comment/41137409
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26226910
type: Answer
answers question: http://stackoverflow.com/q/26226910
has comment: http://stackoverflow.com/comment/41135809
downvote count: 0

http://stackoverflow.com/a/26344785
has comment: http://stackoverflow.com/comment/41354112
upvote count: 7
has comment: http://stackoverflow.com/comment/41353861
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41351776
has body: The NullPointerException has nothing to do with threading (though you also have threading errors in your code). Application.launch() is a static method. It creates an instance of the Application subclass, initializes the Java FX system, starts the FX Application Thread, and invokes start(...) on the instance which it created, executing it on the FX Application Thread. So the instance of Test on which start(...) is invoked is a different instance to the one you created in your main(...) method. Hence the btn field in the instance you created in Test_Main.main() is never initialized. If you add a constructor which just does some simple logging: public Test() { Logger.getLogger("Test").log(Level.INFO, "Created Test instance"); } you will see that two instances are created. The API is simply not designed to be used this way. You should regard start(...) essentially as a replacement for the main method when you are using JavaFX. (Indeed, in Java 8, you can omit the main method entirely from your Application subclass and still launch the class from the command line.) If you want a class to be reusable, don't make it a subclass of Application; either make it a subclass of some container-type node, or (better in my opinion) give it a method that accesses such a node. There are threading issues in your code too, though these are not causing the null pointer exception. Nodes that are part of a scene graph can only be accessed from the JavaFX Application Thread. A similar rule exists in Swing: swing components can only be accessed from the AWT event handling thread, so you really should be calling JOptionPane.showMessageDialog(...) on that thread. In JavaFX, you can use Platform.runLater(...) to schedule a Runnable to run on the FX Application Thread. In Swing, you can use SwingUtilities.invokeLater(...) to schedule a Runnable to run on the AWT event dispatch thread. Mixing Swing and JavaFX is a pretty advanced topic, because you necessarily need to communicate between the two…
type: Answer
has comment: http://stackoverflow.com/comment/41352022
answers question: http://stackoverflow.com/q/26344172
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26344172
has comment: http://stackoverflow.com/comment/41352112
has comment: http://stackoverflow.com/comment/41351574
score: 7
has comment: http://stackoverflow.com/comment/41353916

http://stackoverflow.com/q/26267841
tagged with: default-method
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/41210588
has body: It seems that Java 8 allows full fledged inheritance with a simple framework as below, using Static and Default methods on interfaces. While its always possible to misuse and write stupid code, these new features make it quite easy to achieve multiple inheritance, even if the designers of the language meant to stay away from it. Is this a simple implementation of Multiple Inheritance using Interfaces as base classes, or a misuse of the language? Did Java designers go too far in allowing this? package PseudoMultipleInheritance; import java.util.HashMap; abstract class InstanceMap&lt;T,T2&gt; { HashMap&lt;Object,Object&gt; instances = new HashMap&lt;Object, Object&gt;(); abstract T2 createMembersInstance(); T2 getMembersInstance(T thisObject ) { if ( !instances.containsKey(thisObject) ) instances.put(thisObject,createMembersInstance()); return (T2) instances.get(thisObject); } } interface A { class Members { int x; // just an example of an inheritable member } InstanceMap&lt;A,A.Members&gt; instanceMap = new InstanceMap&lt;A, A.Members&gt;() { A.Members createMembersInstance() {return new A.Members(); }}; default A.Members thisA() { return instanceMap.getMembersInstance(this); } default int getX() { return thisA().x; // // just an example of an inheritable getter } default void setX(int x) { thisA().x = x; // just an example of an inheritable setter } } interface B { class Members { int y; // just an example of an inheritable member } InstanceMap&lt;B,B.Members&gt; instanceMap = new InstanceMap&lt;B, B.Members&gt;() { B.Members createMembersInstance() {return new B.Members();} }; default B.Members thisB() { return instanceMap.getMembersInstance(this); } default int getYLastDigit() { return thisB().y % 10; // just an example of an inheritable function } default void incrementY(int x) { thisB().y += x; // just an example of an inheritable function } } class C implements A, B { } public class Example04AlmostMultipleInheritance { public static void main(String[] args) { C…
has comment: http://stackoverflow.com/comment/41210419
upvote count: 0
tagged with: multiple-inheritance
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41210574
has title: Full Fledged Multiple Inheritance in Java 8
has answer: http://stackoverflow.com/a/26268023
has answer: http://stackoverflow.com/a/26268639
has comment: http://stackoverflow.com/comment/41210540
has comment: http://stackoverflow.com/comment/41210459
has answer: http://stackoverflow.com/a/26267936
type: UnansweredQuestion
downvote count: 1
type: Question

http://stackoverflow.com/q/26197443
tagged with: scene2d
tagged with: java
has comment: http://stackoverflow.com/comment/41167728
has body: I want to use TextButton for my custom made buttons but this requires me to (re)position the text or Label within that TextButton. I have tried some options but i am pretty stuck. //this seems straightforward but nothing changes. final TextButton b = new TextButton("LABEL", skin); b.getLabel().setPosition(100, -20); //Read somewhere about adding new children to buttons but no success either. final TextButton b = new TextButton("OLD LABEL", skin); b.clearChildren(); Label l = new Label("NEW LABEL", skin); l.setPosition(400, 600); b.add(l); b.layout(); // Does not help either. I am adding the Button straight into the Stage without a table for what it matters. Anyone has some ideas on this?
answer count: 2
has comment: http://stackoverflow.com/comment/41167860
has title: Position label within TextButton?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41336234
has answer: http://stackoverflow.com/a/29187066
score: 2
upvote count: 3
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26203060
tagged with: libgdx

http://stackoverflow.com/a/26318727
score: 1
answers question: http://stackoverflow.com/q/26195355
has body: So I did a lot of research on this topic and want to share my findings with you: One (from a technical point very attractive) option is to use commercial bridges between Java and .Net. For sure, the most popular products are JNBridge and Javonet. Both products seem to be quite easy-to-use, have good support and seem to be very sophisticated. Especially JNBridge already supports bridging between Java and Mono too, which allows the portation to also non-Windows OS, which is one of our main requirements as stated above. Javonet also wants to integrate Mono and is going to release this feature soon. However, both solutions are commercial and one needs to weigh their features against the respective costs. Nevertheless, from a pure technical point of view, they look great and also state to enable very fast communication between Java and .Net (faster than with web services). Another option is to connect Java and .NET via COM. Since COM is generelly defined platform-independently, this could work on multiple OS. There are lots of open source projects that could be used for such an implementation, such as EZJCOM, J-Interop, JACOB or JCOM. The main restriction (expecially for our project) is that Mono only supports COM-interoperability under Windows (yet). So, this is not really an option for us. But if you want to create Java-.NET interoperability on Windows only, this is a good way. The straighforward way of integrating Java and C# is to use Java Native Interface (JNI). You can also find manifold implementations that make JNI more easy to use, the most popular one is probably jni4net which seems to be a very active and frequently used project. But there are also others with specific pros and cons, such as Caffeine, Espresso or csjni. Finally, JNI is not 100% platform independet. It is applicable on different platforms, but you have to generate platform-specific code which makes it clearly less usable for our purposes. If you limit your application to Windows, jni4net seems …
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41362408
type: Comment
has text: The Jersey explanation from that link explains it well. A client for example could just specify the path that is at the class level, and then enter whichever method corresponds to the MIME type it is looking for.
comment on: http://stackoverflow.com/a/26290552
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41356114
comment on: http://stackoverflow.com/a/26347407
type: Comment
has text: @Noodly_Doodly: Your question may fact be an [XY Problem](http://mywiki.wooledge.org/XyProblem) where you ask "how do I fix this code problem" when the best solution is to use a different approach entirely. You're still not telling us the details of what your program does or what the other folks "code" should do.
score: 2
type: AnswerComment

http://stackoverflow.com/q/26217999
has answer: http://stackoverflow.com/a/26218155
has title: Is this algorithm possbile? Randomizes execution times within a fixed time period
tagged with: java
has comment: http://stackoverflow.com/comment/41118384
has body: I'm churning my brains trying to think of a simple way (algorithm) for the following scenario: I wish to run some tests for 24 hours. There are 3 kinds of test. Each test must be executed a certain percentage of the time. Each test must take a random length of time to complete. Now, if I exclude the last part - random time length - and FIX the length of time for each test then everything is fine. But with a random test time, how can I ensure that indeed the correct number will be executed in 24 hours? Seems to me like I need to know in advance the length of time for each test so that I can work out many tests in total I need! Any ideas?
has comment: http://stackoverflow.com/comment/41117911
type: Question
tagged with: testing
answer count: 2
has comment: http://stackoverflow.com/comment/41118350
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41118694
score: 0
has comment: http://stackoverflow.com/comment/41117753
has comment: http://stackoverflow.com/comment/41118372
has comment: http://stackoverflow.com/comment/41117713
has answer: http://stackoverflow.com/a/26218336
type: UnansweredQuestion

http://stackoverflow.com/a/26250973
score: 1
answers question: http://stackoverflow.com/q/26250868
has body: According to javadocs http://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html those methods are marked as default, so You dont have to provide implementation. More info about default interface methods :http://zeroturnaround.com/rebellabs/java-8-explained-default-methods/. You can use lamda expression to simply implement Comparator interface. This might help : http://www.dreamsyssoft.com/java-8-lambda-tutorial/comparator-tutorial.php
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/26206058
has comment: http://stackoverflow.com/comment/41096116
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41095615
has comment: http://stackoverflow.com/comment/41095328
has comment: http://stackoverflow.com/comment/41095481
has comment: http://stackoverflow.com/comment/41095985
has body: It's exactly what it says - it's a text node. The text within and around elements is represented as text nodes. And sometimes a text node contains just whitespace. This might be due to extra space at the end of a line or indentation, for example. It's good to remember that depending on the parser and platform some whitespace might be deemed "insignificant" and left out of the parsed tree.
accepted answer of: http://stackoverflow.com/q/26206037
has comment: http://stackoverflow.com/comment/41095409
upvote count: 2
answers question: http://stackoverflow.com/q/26206037
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41095531
type: Answer
has comment: http://stackoverflow.com/comment/41095705
has comment: http://stackoverflow.com/comment/41095348

http://stackoverflow.com/q/26265164
has comment: http://stackoverflow.com/comment/41205159
favorite count: 0
has comment: http://stackoverflow.com/comment/41205366
has body: I have always this question burning in me. Why do people assign objects of subclass to a superclass reference as below: What exactly are the benefits and reasons that makes people do so? public static void main(String[] args) { A obj1 = new C(); //Why do this ? C obj2 = new C(); //When we can simply do this ??? } class A {} class B extends A {} class C extends B {} I understands all the logic where a Class Dog is an Animal but Animals are not essentially Dogs. I've also bumped into this link: Why assign a subclass object to a superclass reference? which asked similar question as me (but was marked as duplicate with a non-relevant link: What does it mean to "program to an interface"?) In here: Why assign a subclass object to a superclass reference? Some vague answers were given as reason for doing so. Unfortunately no more detailed answers could be given before it was marked duplicated with an irrelevant link. Hopefully someone could look into this question and give a detailed reply on the reason of assigning objects of subclass to a superclass reference.
has comment: http://stackoverflow.com/comment/41205135
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23254070
has comment: http://stackoverflow.com/comment/41205535
linked to: http://stackoverflow.com/q/322715
has title: Purpose of assigning objects of subclass to a superclass reference?
has comment: http://stackoverflow.com/comment/41205233
score: 1
upvote count: 1
linked to: http://stackoverflow.com/q/383947
type: Question
tagged with: object
tagged with: java
tagged with: class
has comment: http://stackoverflow.com/comment/41209023
has answer: http://stackoverflow.com/a/26265262
answer count: 2
has answer: http://stackoverflow.com/a/26265242
downvote count: 0

http://stackoverflow.com/comment/41246497
score: 0
type: AnswerComment
has text: Thanks for your suggestion, would it be possible to assist me with that?
type: Comment
comment on: http://stackoverflow.com/a/26287386

http://stackoverflow.com/q/26229140
has answer: http://stackoverflow.com/a/66977970
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: filewriter
has comment: http://stackoverflow.com/comment/41139326
has answer: http://stackoverflow.com/a/26229291
type: Question
has answer: http://stackoverflow.com/a/26229246
score: 5
downvote count: 0
has title: Writing data to text file in table format
favorite count: 0
tagged with: file-io
answer count: 5
possible better answer: http://stackoverflow.com/a/32827615
has answer: http://stackoverflow.com/a/32827615
accepted answer: http://stackoverflow.com/a/26229246
has answer: http://stackoverflow.com/a/52507588
tagged with: netbeans
has body: So far I have this: File dir = new File("C:\\Users\\User\\Desktop\\dir\\dir1\\dir2); dir.mkdirs(); File file = new File(dir, "filename.txt"); FileWriter archivo = new FileWriter(file); archivo.write(String.format("%20s %20s", "column 1", "column 2 \r\n")); archivo.write(String.format("%20s %20s", "data 1", "data 2")); archivo.flush(); archivo.close(); However. the file output looks like this: Which I do not like at all. How can I make a better table format for the output of a text file? Would appreciate any assistance. Thanks in advance! EDIT: Fixed! Also, instead of looking like column 1 column 2 data 1 data 2 How can I make it to look like this: column 1 column 2 data 1 data 2 Would prefer it that way.

http://stackoverflow.com/a/26242751
type: Answer
score: 2
downvote count: 0
has body: Problem with your solution is that it will load ALL entries in a list for you to select one. As per this answer, you need to limit result to 1 by calling query.setMaxResults(1). Other than that, it is a perfectly fine solution. You can also use query.getSingleResult() to get single entity, but beware of NoResultException if there are no such records.
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26242402
accepted answer of: http://stackoverflow.com/q/26242402

http://stackoverflow.com/comment/41286086
type: Comment
has text: You should explain *what* you have changed and *why* it should solve the problem instead of posting a block of code
score: 1
comment on: http://stackoverflow.com/a/26309222
type: AnswerComment

http://stackoverflow.com/a/26267878
type: Answer
has comment: http://stackoverflow.com/comment/41210462
upvote count: 10
score: 10
accepted answer of: http://stackoverflow.com/q/26267113
answers question: http://stackoverflow.com/q/26267113
has body: 'key1' is your secret key. In this code, the byte array is obtained by calling String.getBytes() on a password. See this answer for why that isn't advisable, and some suggested alternatives. 'key2' is misnamed; it's actually an Initialization Vector (or 'IV' for short). This is a random sequence of bytes that prevents the same plaintext from always being transformed into the same ciphertext. A random IV should be generated for each encrypted message using SecureRandom.getBytes(). For AES the IV should be 16 bytes (128 bits). The IV is not a secret; it should be sent along with the ciphertext so the recipient can use it (along with the secret key) to decrypt the message. After encrypting, I would recommend prepending the IV bytes to the ciphertext bytes and then Base64-encoding the resulting byte array. As for how the code is structured, there's no need to pass the IV into the encrypt method; the encrypt method can generate the IV internally. Likewise, if the ciphertext is prefixed with the IV then you don't need to pass the IV to the decrypt method; instead the decrypt method can assume the first 16 bytes of the message are the IV. Generally speaking, encryption alone does not ensure the message hasn't been tampered with. If you want to detect when an attacker tampers with your encrypted messages, you can apply a Message Authentication Code like HMAC to the iv + cyphertext.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41299508
comment on: http://stackoverflow.com/q/26314918
score: 0
type: Comment
type: QuestionComment
has text: `socket.isConnected()` to see if it successfully connected. `socket.isClosed()` to see when it has been closed after already connecting

http://stackoverflow.com/q/26273850
accepted answer: http://stackoverflow.com/a/26274221
type: Question
score: 3
has comment: http://stackoverflow.com/comment/41226250
has comment: http://stackoverflow.com/comment/41221698
has answer: http://stackoverflow.com/a/26274053
has comment: http://stackoverflow.com/comment/41222571
downvote count: 0
has answer: http://stackoverflow.com/a/26274176
has title: having an error reading from a file in java
has body: need help fixing this error. I am trying to print out the array length of string countryNames. Exception in thread "main" java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Scanner.java:1516) at CSVReader.setUp(CSVReader.java:25) at CSVReader.&lt;init&gt;(CSVReader.java:16) at TestCSVReader.main(TestCSVReader.java:16) I am reading from a cvs file and i keep getting the error above. Below is my code: import java.io.*; import java.util.Scanner; public class CSVReader { //String countryNames; String[] countryNames; int yearLabels; int[] yearNum; double cellularDataTable; double[][] tables; Scanner scan; public CSVReader(String filename)// throws FileNotFoundException { setUp(filename); } private void setUp(String filename) //throws FileNotFoundException { File file = new File(filename); try{ String input=""; scan = new Scanner(file); scan.nextLine(); while((input=scan.nextLine())!=null) { String[] countryNames = input.split(","); //int a = Integer.parseInt(countryNames[1]); System.out.println(countryNames[0]); //System.out.println(a); } scan.close(); } catch(FileNotFoundException e) { System.out.println(e); } } public String[] getCountryNames() { return countryNames; } Below is my TestCSV class file: public class TestCSVReader { /** * Includes test examples for class CSVReader. */ public static void main(String[] args) { final String FILENAME = "data/cellular.csv"; // Directory path for Mac OS X //final String FILENAME = "data\cellular.csv"; // Directory path for Windows OS (i.e. Operating System) CSVReader parser = new CSVReader(FILENAME); String [] countryNames = parser.getCountryNames(); System.out.println(countryNames.length); } my csv file looks like this below: This is a summary as i did not want to print out the entire 252 countries. Basically i take in 252 countries and store it in a string array, the years and store them in an int array and stats of cellular data of each country in a 2d double array. I am new to programming and would…
has comment: http://stackoverflow.com/comment/41221907
favorite count: 0
has answer: http://stackoverflow.com/a/26274221
has comment: http://stackoverflow.com/comment/41220990
has comment: http://stackoverflow.com/comment/41221158
has comment: http://stackoverflow.com/comment/41222241
possible better answer: http://stackoverflow.com/a/26274774
answer count: 4
has answer: http://stackoverflow.com/a/26274774
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41224454
has comment: http://stackoverflow.com/comment/41224539
has comment: http://stackoverflow.com/comment/41241778

http://stackoverflow.com/comment/41312575
type: Comment
comment on: http://stackoverflow.com/a/26323965
has text: My question is actually this :- Object object = al.get(0); what would happen if i do object.toString() . Will the Object class method or String clas method toString() is called?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41149069
has text: font.canDisplay && registerFont both return true.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26234048

http://stackoverflow.com/comment/41186706
score: 2
comment on: http://stackoverflow.com/q/26255014
has text: I did this with jetty the other day using logback/slf4j. Dropping in the slfj bridging jars fro JUL, commons logging and log4j means you'll catch almost everything and can configure it from one logback config file.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41311556
has text: @Sniper I thought the accepted answer points to `JCalendar`, which is part of Swing ...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26323390
type: Comment

http://stackoverflow.com/comment/41112121
has text: This question makes no sense
comment on: http://stackoverflow.com/q/26215096
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26248692
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41175514
accepted answer: http://stackoverflow.com/a/26248794
possible better answer: http://stackoverflow.com/a/26248748
has answer: http://stackoverflow.com/a/26248748
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26248794
has comment: http://stackoverflow.com/comment/41175434
linked to: http://stackoverflow.com/q/18757805
has comment: http://stackoverflow.com/comment/41175462
has title: Using Comparable's compareTo to compare an object to the elements in an arraylist
type: AnsweredQuestion
tagged with: compareto
tagged with: java
has comment: http://stackoverflow.com/comment/41175381
tagged with: comparable
has body: I created an object Student using Comparable with getters/setters as well as a method that overrides compareTo. In a separate file an arraylist of objects is populated from a text file. Now I need to compare the values in the arraylist to another Student object. The file was used to create an arraylist as below: try { private static ArrayList&lt;Student&gt; array = new ArrayList&lt;Student&gt;(); File file = new File("students.txt"); Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String inline = scanner.nextLine(); String[] split = inline.split(":"); Student myStudent = new Student(); myStudent.setUsername(split[0]); myStudent.setPassword(split[1]); array.add(myStudent); } scanner.close(); } catch (FileNotFoundException e) { System.out.println("ERROR."); } The text file looks like this: John:password1 Jane:password2 Jack:password3 (One on each line, no blank lines in between.) And in a separate method a created Student object is compared to the elements in the arraylist: Student aStudent = new Student(); aStudent.setUsername("student"); aStudent.setPassword("password"); boolean found = false; for (int i = 0; i &lt; array.size(); i++) { if (array.get(i).compareTo(aStudent) == 0) { System.out.println(aStudent.equals(array.get(i))); found = true; break; } else { System.out.println("No such records found!"); found = false; break; } System.out.println(found); } The problem is that the object aStudent is not being compared with the objects in the arraylist. It does not print out anything (a -1, 0, or 1) for the call to compareTo, but it always shows that found is true, even though it should be false when there are no matches for aStudent in the file (which there aren't any matches to the username "student" or the password "password"). All together my code complies and works - it just works incorrectly. Sorry if this sounds confusing. In short, my question is how can I compare the objects of an arraylist to another object using the Comparable interfac…

c++
tags question: http://stackoverflow.com/q/26299730
tags question: http://stackoverflow.com/q/26233010
tags question: http://stackoverflow.com/q/26322494
tags question: http://stackoverflow.com/q/26306064
tags question: http://stackoverflow.com/q/26280316
tags question: http://stackoverflow.com/q/26312336
type: Tag
tags question: http://stackoverflow.com/q/26352020
tags question: http://stackoverflow.com/q/26312851
tags question: http://stackoverflow.com/q/26270425
tags question: http://stackoverflow.com/q/26300622
tags question: http://stackoverflow.com/q/26214546
tags question: http://stackoverflow.com/q/26312678
tags question: http://stackoverflow.com/q/26256558
tags question: http://stackoverflow.com/q/26340335
tags question: http://stackoverflow.com/q/26214138
tags question: http://stackoverflow.com/q/26240717
tags question: http://stackoverflow.com/q/26261466
tags question: http://stackoverflow.com/q/26214540
tags question: http://stackoverflow.com/q/26325314
tags question: http://stackoverflow.com/q/26290504
tags question: http://stackoverflow.com/q/26231788
tags question: http://stackoverflow.com/q/26286901
tags question: http://stackoverflow.com/q/26239773
tags question: http://stackoverflow.com/q/26212422
tags question: http://stackoverflow.com/q/26243831
tags question: http://stackoverflow.com/q/26282608
tags question: http://stackoverflow.com/q/26300179
tag name: c++

http://stackoverflow.com/comment/42823213
comment on: http://stackoverflow.com/a/26311579
type: AnswerComment
has text: How are you adding images to it then ?
score: 0
type: Comment

http://stackoverflow.com/comment/41301816
type: QuestionComment
comment on: http://stackoverflow.com/q/26318048
has text: Maybe a refresher on [How to use Arrays](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html) and [How to Use for Loops](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html) will help
score: 0
type: Comment

http://stackoverflow.com/q/26245935
tagged with: soap
tagged with: web-services
answer count: 1
has answer: http://stackoverflow.com/a/26246180
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41170623
linked to: http://stackoverflow.com/q/17046881
has title: (JAVA) SOAP WebService error object reference not set to an instance of an object
has comment: http://stackoverflow.com/comment/41170601
type: UnansweredQuestion
type: Question
tagged with: android
has body: i am trying to set up connection to SOAP WebService from Android app but every time i get wried error in my result : object reference not set to an instance of an object java It seems to be error from server --> SOAP Webservice call from Java gives "Object reference not set to an instance of an object" But when i try it throught web browser with POST request it works fine :) This service http://ws.cdyne.com/ip2geo/ip2geo.asmx?op=ResolveIP private static String NAMESPACE = "http://ws.cdyne.com/"; private static String URL = "http://ws.cdyne.com/ip2geo/ip2geo.asmx"; private static String SOAP_ACTION = "http://ws.cdyne.com/"; public static String invokeHelloWorldWS(String name, String webMethName) { String resTxt = null; SoapObject request = new SoapObject(NAMESPACE, webMethName); PropertyInfo sayHelloPI = new PropertyInfo(); // Set name sayHelloPI.setName("ipAddress"); // Set Value sayHelloPI.setValue("88.212.35.129"); // Set dataType sayHelloPI.setType(String.class); // Add the property to request object request.addProperty(sayHelloPI); // Create envelope SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; // Set output SOAP object envelope.setOutputSoapObject(request); // Create HTTP call object HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.debug = true; try{ // Invoke web service androidHttpTransport.call(SOAP_ACTION+webMethName, envelope); //webMethName = "ResolveIP" // Get the response Log.d("a", androidHttpTransport.responseDump); //SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); // Assign it to resTxt variable static variable //resTxt = response.toString(); }catch(Exception e){ //Print error e.printStackTrace(); } } I spend lot of time on google but i cant figure right answer why this happend // EDIT Finally i get it right ... idk why but when i send second parameter like this (i reuse old property) : sayHelloPI.setName("licenseKey"); sayHelloPI.…

http://stackoverflow.com/comment/41220499
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26273545
score: 1
has text: you may need `setOnItemClickListener` for an item click, inside that code you can change color of the item on selection

http://stackoverflow.com/q/26333503
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/26334342
linked to: http://stackoverflow.com/q/26154855
tagged with: java
has body: I made an app using Parse as backend. I am able to get the notification but when i tap on it, the app crashes. Here are the java and XML files. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <permission android:name="chipset.lugmnotifier.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="chipset.lugmnotifier.permission.C2D_MESSAGE" /> <meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/ic_notification" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".HomeActivity" /> <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.parse.push.intent.RECEIVE" /> <action android:name="com.parse.push.intent.DELETE" /> <action android:name="com.parse.push.intent.OPEN" /> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="chipset.lugmnotifier" /> ParseInitApplication.java import android.app.Application; import android.util.Log; import com.parse.Parse; import com.parse.ParseException; import com.parse.ParseInstallation; import com.parse.ParsePush; import com.par…
score: 2
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/35068016
favorite count: 0
has answer: http://stackoverflow.com/a/35068016
has title: Parse Push "No Activity Found" on opening Push Notification
type: Question
tagged with: push-notification
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/26334342
tagged with: parse-platform

http://stackoverflow.com/comment/41367174
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26329008
has text: @John I posted a link to convert a view into bitmap
score: 0

http://stackoverflow.com/a/74123790
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26258751
has body: You can use Objects.equals int foo = 1; Integer bar = null; Objects.equals(foo, bar);
downvote count: 0
type: Answer

jetty
tags question: http://stackoverflow.com/q/26264508
tags question: http://stackoverflow.com/q/26229850
tag name: jetty
tags question: http://stackoverflow.com/q/26285825
tags question: http://stackoverflow.com/q/26221569
tags question: http://stackoverflow.com/q/26303119
tags question: http://stackoverflow.com/q/26338527
tags question: http://stackoverflow.com/q/26310652
tags question: http://stackoverflow.com/q/26328744
tags question: http://stackoverflow.com/q/26217143
tags question: http://stackoverflow.com/q/26264984
tags question: http://stackoverflow.com/q/26218640
tags question: http://stackoverflow.com/q/26325607
tags question: http://stackoverflow.com/q/26326231
tags question: http://stackoverflow.com/q/26263093
tags question: http://stackoverflow.com/q/26347792
tags question: http://stackoverflow.com/q/26216792
tags question: http://stackoverflow.com/q/26244737
tags question: http://stackoverflow.com/q/26320031
tags question: http://stackoverflow.com/q/26347734
tags question: http://stackoverflow.com/q/26222480
type: Tag
tags question: http://stackoverflow.com/q/26241347
tags question: http://stackoverflow.com/q/26326436
tags question: http://stackoverflow.com/q/26305416

http://stackoverflow.com/comment/81576078
type: Comment
comment on: http://stackoverflow.com/q/26256393
has text: For for information about why catching an OutOfMemoryError is problematic, see https://stackoverflow.com/questions/8728866/no-throw-virtualmachineerror-guarantees
score: 0
type: QuestionComment

http://stackoverflow.com/a/26337985
answers question: http://stackoverflow.com/q/26337833
has body: see here is your solution. import java.util.Scanner; public class Testing { public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int number = Integer.MAX_VALUE; System.out.println("Enter number to check if prime or not "); while (number != 0) { number = scnr.nextInt(); System.out.printf("Does %d is prime? %s %s %s %n", number, isPrime(number), isPrimeOrNot(number), isPrimeNumber(number)); } } /* * Java method to check if an integer number is prime or not. * @return true if number is prime, else false */ public static boolean isPrime(int number) { int sqrt = (int) Math.sqrt(number) + 1; for (int i = 2; i &lt; sqrt; i++) { if (number % i == 0) { // number is perfectly divisible - no prime return false; } } return true; } /* * Second version of isPrimeNumber method, with improvement like not * checking for division by even number, if its not divisible by 2. */ public static boolean isPrimeNumber(int number) { if (number == 2 || number == 3) { return true; } if (number % 2 == 0) { return false; } int sqrt = (int) Math.sqrt(number) + 1; for (int i = 3; i &lt; sqrt; i += 2) { if (number % i == 0) { return false; } } return true; } /* * Third way to check if a number is prime or not. */ public static String isPrimeOrNot(int num) { if (num &lt; 0) { return "not valid"; } if (num == 0 || num == 1) { return "not prime"; } if (num == 2 || num == 3) { return "prime number"; } if ((num * num - 1) % 24 == 0) { return "prime"; } else { return "not prime"; } } }
downvote count: 2
type: Answer
upvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/41338502

http://stackoverflow.com/comment/41188873
has text: You can implement methods empty also
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26256663
type: Comment

http://stackoverflow.com/q/26353169
score: -4
type: Question
tagged with: passwords
has comment: http://stackoverflow.com/comment/41366139
answer count: 2
downvote count: 4
tagged with: while-loop
has answer: http://stackoverflow.com/a/26353208
tagged with: validation
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26353713
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41366050
has title: Using while loop to validate password in Java
has body: The prompt is to have a user input a password and the password must be at least 8 characters with no white spaces, must have one upper case letter, and must have one digit. It has to use a while loop. If the password conforms it should output "password ok" or otherwise say "try again" Anyone know what to do for this? All I can pretty much do is the scanner and user input
has comment: http://stackoverflow.com/comment/41366264
tagged with: java

http://stackoverflow.com/q/26339622
accepted answer: http://stackoverflow.com/a/26340840
has comment: http://stackoverflow.com/comment/41341559
has body: I am trying to inject a JmsTemplate object into a class using @Autowired, but it is giving a NullPointerException whenever I try to send messages. While in the application class I could instantiate jmsTemplate using the ApplicationContext ConfigurableApplicationContext context = SpringApplication.run(Application.class, args); JmsTemplate jmsTemplate = context.getBean(JmsTemplate.class); I could not do this in any other class, as I did not figure out how to get the context object. This is my application class: @EnableAutoConfiguration public class Application { private static final String maxFileSize = "512KB"; private static final String maxRequestSize = "512KB"; static String IncomingMailboxDestination = "Responses"; @Bean Receiver receiver() { return new Receiver(); } @Bean Producer producer() { return new Producer(); } @Bean MessageListenerAdapter adapter(Receiver receiver) { MessageListenerAdapter messageListener = new MessageListenerAdapter(receiver); messageListener.setDefaultListenerMethod("receiveMessage"); return messageListener; } @Bean SimpleMessageListenerContainer container(MessageListenerAdapter messageListener, ConnectionFactory connectionFactory) { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setMessageListener(messageListener); container.setConnectionFactory(connectionFactory); container.setDestinationName(IncomingMailboxDestination); return container; } @Bean MultipartConfigElement multipartConfigElement() { MultipartConfigFactory factory = new MultipartConfigFactory(); factory.setMaxFileSize(maxFileSize); factory.setMaxRequestSize(maxRequestSize); return factory.createMultipartConfig(); } public static void main(String[] args) { // Clean out any ActiveMQ data from a previous run FileSystemUtils.deleteRecursively(new File("activemq-data")); // Launch the application ConfigurableApplicationContext context = SpringApplication.run(Application.class, args); } } and this is the Producer class: @Component("pr…
tagged with: spring
tagged with: jmstemplate
type: AnsweredQuestion
has title: How to inject JmsTemplate object using annotations in a spring class?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26340840
answer count: 1
score: 0
tagged with: jms

http://stackoverflow.com/q/26208479
tagged with: java
downvote count: 2
has title: Performance benefit java.util.Date compareTo vs before/after?
type: Question
has comment: http://stackoverflow.com/comment/41100139
has answer: http://stackoverflow.com/a/26210919
tagged with: date
tagged with: comparison
upvote count: 4
answer count: 1
has body: The title is pretty self explanatory but I wanted to know if there is any performance benefit to using date1.compareTo(date2) &lt; 0 instead of date1.before(date2) or date2.after(date1) in Java 7?
favorite count: 0
accepted answer: http://stackoverflow.com/a/26210919
has comment: http://stackoverflow.com/comment/41099806
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/26233404
type: Answer
has body: Here is an ultra-simple example of callbacks at work: public class Timer { private final List&lt;Runnable&gt; callbacks = new ArrayList&lt;&gt;(); public void onTick(Runnable r) { synchronized (callbacks) { callbacks.add(r); } } public void start() { new Thread(() -&gt; { try { while (true) { synchronized (callbacks) { callbacks.forEach(Runnable::run); } Thread.sleep(TimeUnit.SECONDS.toMillis(3)); } } catch (InterruptedException e) {} }).start(); } public static void main(String[] args) { final Timer t = new Timer(); t.onTick(() -&gt; System.out.println("Ide vrijeme, prođe rok")); t.onTick(() -&gt; System.out.println("Eto vraga skok na skok")); t.start(); } } I hope it is simple enough to be self-explanatory.
answers question: http://stackoverflow.com/q/26233030
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41148763
has comment: http://stackoverflow.com/comment/41148491
accepted answer of: http://stackoverflow.com/q/26233030
score: 0
has comment: http://stackoverflow.com/comment/41148965

http://stackoverflow.com/q/26213050
has answer: http://stackoverflow.com/a/69096101
has answer: http://stackoverflow.com/a/61895963
score: 6
has answer: http://stackoverflow.com/a/26213414
has title: Spring Boot enable <async-supported> like in web.xml
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/61895963
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/26213414
tagged with: spring
upvote count: 6
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/46209538
tagged with: java
tagged with: spring-boot
has body: I have a problem with Spring Boot configuration. I got exception on some mobile devices which should use sockets: java.lang.IllegalArgumentException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding " true " to servlet and filter declarations in web.xml. Also you must use a Servlet 3.0+ container at org.springframework.util.Assert.isTrue(Assert.java:65) at org.springframework.http.server.ServletServerHttpAsyncRequestControl.<init>(ServletServerHttpAsyncRequestControl.java:59) at org.springframework.http.server.ServletServerHttpRequest.getAsyncRequestControl(ServletServerHttpRequest.java:202) at org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession.handleInitialRequest(AbstractHttpSockJsSession.java:202) 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:322) 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(DispatcherServlet.java:938) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doPost(Fr…

http://stackoverflow.com/comment/41220762
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26273645
has text: I dont think the object reference returned by `request.getParameter("something")` is being casted , `(ObjectA) request.getParameter("something") != null` is like writing `(ObjectA) true` or `(ObjectA) false`. It should be `if(request.getParameter("something")!=null) {ObjectA Obj1=(ObjectA)request.getParameter("something")}`

http://stackoverflow.com/comment/41213341
comment on: http://stackoverflow.com/q/26262017
score: 0
has text: my.cnf does not have bind-address. I think the issue is on jdbc driver. Do I have to do something special to say bugs@%
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41203844
comment on: http://stackoverflow.com/q/26264188
has text: First, print the `s` variable after replaceAll().
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26220667
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/26220714
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26220682
has answer: http://stackoverflow.com/a/26221737
type: UnansweredQuestion
has body: Im having trouble getting my switch working. I get an uncompilable source code Date.java:75. Also, when the program returns the results - I would like it to also return MONTH NAME DD, YYYY along with what I already have it doing MM/DD/YYYY. If you could point me in the right direction, I'd appreciate it. import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Scanner; public class Date { private GregorianCalendar date = null; private String[] months = new String[]{ "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december" }; public Date(int month, int day, int year) { date = new GregorianCalendar(year, month-1, day); } public Date(String month, int day, int year) { date = new GregorianCalendar(year, this.getMonth(month), day); } public Date(int dayOfYear, int year) { date = new GregorianCalendar(); date.set(Calendar.DAY_OF_YEAR, dayOfYear); date.set(Calendar.YEAR, year); } private int getMonth(String month) { for (int i=0; i&lt;months.length; ++i) if (month.toLowerCase().equals(months)) //equals(months)) return i; return 0; } public String toString() { return date.get(Calendar.MONTH)+1 + "-" + date.get(Calendar.DATE) + "-" + date.get(Calendar.YEAR); } public static void main(String[] args) { int mo; int dy; int yr; String moo; // Month name string boolean wrongInput = false; do { Scanner input = new Scanner( System.in ); // scanner to read input wrongInput = false; int menu = input.nextInt(); // menu selection System.out.printf( "Enter 1 for format: MM/DD/YYYY \n"); System.out.printf( "Enter 2 for format: Month DD,YYYY \n"); System.out.printf( "Enter 3 to exit \n"); System.out.printf( "Choice:"); switch(menu) { case '1' : // MM/DD/YYYY UI System.out.printf( "Enter Month (1-12): "); mo = input.nextInt(); System.out.printf( "Enter Day of Month: "); dy = input.nextInt(); System.out.printf( "Enter Year: "); yr = input.nextInt(); Date a = new Date(mo, dy, yr); //chew System.out.println…
has title: Java switch not working
tagged with: java
tagged with: loops

http://stackoverflow.com/q/26305329
has answer: http://stackoverflow.com/a/26312897
has comment: http://stackoverflow.com/comment/41278798
linked to: http://stackoverflow.com/q/14475556
has answer: http://stackoverflow.com/a/26305385
type: UnansweredQuestion
downvote count: 1
has body: I have an ArrayList&lt;ArrayList&lt;String&gt;&gt; that is a list of couple of values: John, 12.3 Marcus, 35.0 Sue, 11.4 How to sort the list by amount? If in this case there is a better way than using an ArrayList of an ArrayList, please tell me and tell me then how to sort it. Thank you.
has title: How to sort bidimensional ArrayList?
tagged with: java
score: -1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/41278807
has answer: http://stackoverflow.com/a/26305462
tagged with: string
tagged with: sorting
favorite count: 0
tagged with: arraylist
answer count: 3
tagged with: android

http://stackoverflow.com/comment/41156036
comment on: http://stackoverflow.com/a/26238466
has text: look at your import statements and you will see which "Thread" it is using
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41319974
score: 2
type: Comment
comment on: http://stackoverflow.com/q/26327964
type: QuestionComment
has text: You need an HTML parser.

http://stackoverflow.com/a/26420461
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26274460
type: Answer
has body: You try GET localhost:port/appPath/foobar/ and you get 405 (Method not allowed). The reason is that this resource (=foobar) exists, so an 404 (resource not found) is wrong. If you create a copy of getFooBar() -> getFooBar2() without path annoation you should get a 200. If you want you can create a container filter that thows an exception if path is not exactly found. This exception then can be mapped to an 404.

http://stackoverflow.com/a/26246475
score: 0
has body: this is more of a guess, but how about using a bit more parentheses in this expression: double monthlyPayment = loanAmt * interestRate/ (1 - 1/Math.pow(1 + interestRate, months)); to make sure it's calculated in the desired order
answers question: http://stackoverflow.com/q/26246410
type: Answer

http://stackoverflow.com/comment/63147855
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26493656
has text: This is not answering the key point of the question, which I think is "how to distinguish between 'delete' versus 'rename' events".
score: 0

http://stackoverflow.com/a/26313751
has body: First off, the WorkManager API is only available to JCA resource adapters. Thus I'll mostly address the ManagedExecutorService, but most of what I say is applicable to WorkManager as well. The difference between using ManagedExecutorService / WorkManager and creating your own threads is that the application server manages the underlying threads. This means the threads you use with this API, and more generally via the javax.enterprise.concurrent.* classes, whether implicitly in the case of asynchronous task submission with a ManagedExecutorService, or explicitly vith a ManagedThreadFactory, will have a guaranteed consistency with the services provided by the application server, in particular transactions management, security, resources management etc.
accepted answer of: http://stackoverflow.com/q/26300924
has comment: http://stackoverflow.com/comment/41444581
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26300924

http://stackoverflow.com/comment/41314338
has text: This line does not throw a NPE if `s` is not null.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26324892

http://stackoverflow.com/a/26285266
downvote count: 0
has comment: http://stackoverflow.com/comment/41242542
answers question: http://stackoverflow.com/q/26285183
type: Answer
has body: in your onResume of the parent activity from where you are firing the intent check if timer has finished or not. if yes then fire the intent from onResume() itself. In this was if the app was minimised and user enters the app again he will directly navigated to the fired intent activity .
upvote count: 1
has comment: http://stackoverflow.com/comment/41242368
score: 1

http://stackoverflow.com/comment/41108021
comment on: http://stackoverflow.com/q/26211648
has text: There are different versions of controls fx for each version of the JDK. Are you sure you are using the correct version?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41354777
type: QuestionComment
has text: For starter you have size defined as 7 so you will see 7 elements. as per duplicate you can use Sets as the will discard duplicates. SEE THIS QUESTION FOR MORE CLARITY http://stackoverflow.com/questions/26345771/pick-a-few-random-numbers-in-a-specific-range-without-duplicates
score: 1
comment on: http://stackoverflow.com/q/26346748
type: Comment

http://stackoverflow.com/a/26317311
has body: I'm going to assume your AdminDAO class is nested somewhere inside the package declared here &lt;context:component-scan base-package="in.kailash" /&gt; If that's the case, Spring will generate a new bean for the type AdminDAO since it is annotated with @Service. It will process this bean, but won't autowire the DataSource in it because you haven't asked it to. This AdminDAO bean is then injected into your @Controller, not the one from the application context. Instead, it seems you want to use the AdminDAO bean you've declared in your application context. You have 2 options: Remove the @Service annotation from the AdminDAO class so that Spring correctly uses the AdminDAO &lt;bean&gt; you've declared in the application context. Remove the &lt;bean&gt; declaration for AdminDAO and add @Autowired to the DataSource field or setter
score: 0
answers question: http://stackoverflow.com/q/26317262
type: Answer
has comment: http://stackoverflow.com/comment/41300531
has comment: http://stackoverflow.com/comment/41301198
has comment: http://stackoverflow.com/comment/41300576
has comment: http://stackoverflow.com/comment/41300988
has comment: http://stackoverflow.com/comment/41300690

http://stackoverflow.com/a/26225124
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26224749
accepted answer of: http://stackoverflow.com/q/26224749
score: 1
has body: Your issue is in the save method when you write the strings to the out reference. You are not saving a value per line, but are later reading a value per line in your load method. With the current code you save the following in your mrnom.txt file: true10203040 instead of true\n10\n20\n30\n40. To fix this, one way is to change: out.write(Boolean.toString(soundEnabled)); to out.write(Boolean.toString(soundEnabled) + "\n"); AND out.write(Integer.toString(highscores[i])); to out.write(Integer.toString(highscores[i]) + "\n");
upvote count: 1

http://stackoverflow.com/q/26271473
tagged with: android
has title: Get Mails in small amounts using java mail api
has comment: http://stackoverflow.com/comment/41219346
has comment: http://stackoverflow.com/comment/41218465
has comment: http://stackoverflow.com/comment/41253768
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41293027
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41257342
has comment: http://stackoverflow.com/comment/41328805
tagged with: listview
score: 0
tagged with: email
has comment: http://stackoverflow.com/comment/41224889
has body: I am working on a Mailing App in android and i fetch all mails from inbox as well as from folders, but the problem is that fetching is taking too much time to fetch all the mails. So, i want to fetch mails like this:- Fetch first 20 mails and show them in listview fetch next 20 mails and show all 40 mails in listview and so on.... Now, the problem is that how i can fetch latest 20 mails and then how to keep track of this that i fetch first 20 mails and now fetch next 20 mails from server? Also, content fetching and arranging at the same time is also making app to take more time to show mails. How i can decrease the listview filling time? I can also provide the code for this, if necessary.
has comment: http://stackoverflow.com/comment/41291802

http://stackoverflow.com/q/26324025
has comment: http://stackoverflow.com/comment/41312688
has comment: http://stackoverflow.com/comment/41340649
has title: Out of Memory on Samsung Galaxy devices
tagged with: java
type: Question
tagged with: crash
has answer: http://stackoverflow.com/a/26387809
has comment: http://stackoverflow.com/comment/41312876
has comment: http://stackoverflow.com/comment/41313134
tagged with: launch
has comment: http://stackoverflow.com/comment/41312863
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I've really tried my best, but I just can't find a fix for this Problem. I wrote a Soundboard for Android devices, where every sound as well as its button images is loaded dynamically. Here is the crucial paragraph in my code: private void loadButtonColors(){ int rescount = AppConfig.BUTTONBACKGROUNDSRES(getApplicationContext()).size(); SharedPreferences prefs = getSharedPreferences("buttoncolors", 0); String colors = null; colors = prefs.getString("colors", null); List&lt;String&gt; tempList = new ArrayList&lt;String&gt;(); if(colors != null){ tempList.addAll(Arrays.asList(TextUtils.split(colors, "~"))); } if(colors == null || tempList.size() != MainActivity.SOUNDBUTTONS.size()){ for(@SuppressWarnings("unused") SoundButton s : MainActivity.SOUNDBUTTONS){ int randomint = new Random().nextInt(rescount); Integer randominteger = Integer.valueOf(randomint); String randomstring = String.valueOf(randominteger); tempList.add(randomstring); } prefs.edit().putString("colors", TextUtils.join("~", tempList)).commit(); } MainActivity.BUTTONCOLORS = (ArrayList&lt;String&gt;) tempList; } Later the button's images will be displayed with the images out of the following Arrays where the error seems to arise. public static ArrayList&lt;Drawable&gt; BUTTONBACKGROUNDSRES(Context context){ ArrayList&lt;Drawable&gt; tempList = new ArrayList&lt;Drawable&gt;(); tempList.add(context.getResources().getDrawable(R.color.button_lblue)); tempList.add(context.getResources().getDrawable(R.color.button_lime)); tempList.add(context.getResources().getDrawable(R.color.button_orange)); tempList.add(context.getResources().getDrawable(R.color.button_pink)); tempList.add(context.getResources().getDrawable(R.color.button_red)); tempList.add(context.getResources().getDrawable(R.color.button_yellow)); return tempList; }; The resulting error looks like this: java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactor…
has comment: http://stackoverflow.com/comment/41314907
tagged with: bitmap
has comment: http://stackoverflow.com/comment/41314109

http://stackoverflow.com/comment/41617038
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63428/discussion-between-bestsss-and-marko-topolnik).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26324112

http://stackoverflow.com/q/26230456
has comment: http://stackoverflow.com/comment/41141430
has comment: http://stackoverflow.com/comment/41141387
has comment: http://stackoverflow.com/comment/41141478
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26230510
has body: Consider the below code, I forgot to define the method name, just the code within the block. public class Demo { { Apple ap; // Display price of Winesap. System.out.println("Winesap costs " + Apple.Winesap.getPrice() + " cents.\n"); // Display all apples and prices. System.out.println("All apple prices:"); for (Apple a : Apple.values()) System.out.println(a + " costs " + a.getPrice() + " cents."); } } is it because blocks{} in java defines a scope? A block {} defines the scope in Java. Each time you start a new block, you are creating a new scope. A scope determines what objects are visible to other parts of the program. It also determines the lifetime of these objects. Many other computer languages define 2 general category of scopes : global and local.
type: Question
has title: Why is this Java program showing no error?
has comment: http://stackoverflow.com/comment/41141512
has comment: http://stackoverflow.com/comment/41141422
has comment: http://stackoverflow.com/comment/41141402
has comment: http://stackoverflow.com/comment/41141401
upvote count: 1
has answer: http://stackoverflow.com/a/26230510
answer count: 1
has comment: http://stackoverflow.com/comment/41141443
downvote count: 0
has comment: http://stackoverflow.com/comment/41141420
linked to: http://stackoverflow.com/q/3987428
favorite count: 0
type: AnsweredQuestion

multiple-inheritance
tags question: http://stackoverflow.com/q/26339237
tags question: http://stackoverflow.com/q/26267841
type: Tag
tag name: multiple-inheritance

http://stackoverflow.com/a/26246130
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26246071
upvote count: 1
has body: How about: int count = 0; for (int i = 100; i &lt;= 200; i++) { boolean num = (i % 5 == 0 || i % 6 == 0) &amp;&amp; !(i % 5 == 0 &amp;&amp; i % 6 == 0); if (num == true) { count++; System.out.print(i + " is divisible "); if(count &gt;= 10) { System.out.println(); count -= 10; } } }

http://stackoverflow.com/comment/41243174
score: 0
has text: @JoopEggen What I want is to see if the string given to me in the URL corresponds with the enum value set to the object instance.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26282522

http://stackoverflow.com/a/26231313
accepted answer of: http://stackoverflow.com/q/26231089
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26231089
has body: No you don't need to define in database; but that foreign key column should be present in table. i.e. player_id should be present in player_account table.
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26273654
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41220802
has comment: http://stackoverflow.com/comment/41220600
has body: If you want to change it dynamically you will have to do it by code. For that you will have to use onTouchListener since you want to know when you touch and release on your view. final TextView textView =findViewById(R.id.item_title); textView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()){ case MotionEvent.ACTION_DOWN: textView.setTextColor(Color.RED); break; case MotionEvent.ACTION_UP:case MotionEvent.ACTION_CANCEL: textView.setTextColor(Color.BLACK); break; } return false; } }); The above code will change the text color of your textview when you press it. Change Color.RED to your desired color
has comment: http://stackoverflow.com/comment/41220672
answers question: http://stackoverflow.com/q/26273545
has comment: http://stackoverflow.com/comment/41220653
has comment: http://stackoverflow.com/comment/41220772
upvote count: 1
has comment: http://stackoverflow.com/comment/41220701
score: 0

http://stackoverflow.com/comment/41214107
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26263935
score: 0
has text: @greenapps the same app and the same device.

http://stackoverflow.com/q/26314209
possible better answer: http://stackoverflow.com/a/26314218
has body: I have this string variable: String a = "malam mingguan bareng geng motor kepominfo kemkominfo bem rema upi"; What I want to do is replace "malam mingguan" to "malam-mingguan". And the output will be like this: String a = "malam-mingguan bareng geng motor kepominfo kemkominfo bem rema upi"; How can I do that?
has answer: http://stackoverflow.com/a/26314218
upvote count: 0
has comment: http://stackoverflow.com/comment/41294484
has comment: http://stackoverflow.com/comment/41294477
answer count: 3
tagged with: string
has answer: http://stackoverflow.com/a/26314233
favorite count: 0
has title: How to replace specific words in string using java?
has comment: http://stackoverflow.com/comment/41294503
has answer: http://stackoverflow.com/a/26314228
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41294527
tagged with: java
downvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/26314228

http://stackoverflow.com/q/26229607
has comment: http://stackoverflow.com/comment/41140217
tagged with: arraylist
has answer: http://stackoverflow.com/a/26229878
has comment: http://stackoverflow.com/comment/41140278
answer count: 1
has body: I was trying to write a UiAutomator test for an application. Here I have a bunch of textviews inside relative layouts from which I want to extract text and store it in a ArrayList. So that I can compare that ArrayList to the expected result list. Any Suggestions on how to do it?
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26229878
has comment: http://stackoverflow.com/comment/41140188
tagged with: android
has title: How to extract text from Relative Layout and store it in an ArrayList
has comment: http://stackoverflow.com/comment/41139911
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: android-uiautomator
type: Question
tagged with: android-layout

http://stackoverflow.com/q/26294212
has comment: http://stackoverflow.com/comment/41260630
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41260390
type: Question
has comment: http://stackoverflow.com/comment/41261413
has comment: http://stackoverflow.com/comment/41262947
has title: Spring mvc jsp error
has comment: http://stackoverflow.com/comment/41333085
has comment: http://stackoverflow.com/comment/41264775
has comment: http://stackoverflow.com/comment/41260873
has comment: http://stackoverflow.com/comment/41264997
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/26354097
has comment: http://stackoverflow.com/comment/41259012
has comment: http://stackoverflow.com/comment/41259787
has comment: http://stackoverflow.com/comment/41268672
answer count: 1
has comment: http://stackoverflow.com/comment/41337519
has comment: http://stackoverflow.com/comment/41263064
favorite count: 0
has comment: http://stackoverflow.com/comment/41260230
has comment: http://stackoverflow.com/comment/41261532
has body: I have spring mvc application and I am getting a weird error when I try to access a page. Since I am no expert on jsp etc I have troubles finding the error. The exception is this one: java.lang.NoSuchMethodError: org.springframework.web.servlet.tags.MessageTag.setHtmlEscape(Ljava/lang/String;)V at org.apache.jsp.WEB_002dINF.views.login_jspx._jspx_meth_spring_005fmessage_005f0(login_jspx.java:123) at org.apache.jsp.WEB_002dINF.views.login_jspx._jspService(login_jspx.java:96) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954) at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678) at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103) at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96) at org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44) at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRe…
has comment: http://stackoverflow.com/comment/41258968
has comment: http://stackoverflow.com/comment/41259955
tagged with: spring
has comment: http://stackoverflow.com/comment/41333542
has answer: http://stackoverflow.com/a/26354097
has comment: http://stackoverflow.com/comment/41261635
tagged with: spring-mvc

http://stackoverflow.com/comment/41298596
comment on: http://stackoverflow.com/q/26314404
type: Comment
type: QuestionComment
has text: Do you use maven? Because with maven there's ways of repackaging your jar for delivery which is actually what you want.
score: 0

http://stackoverflow.com/q/26290152
favorite count: 0
tagged with: return
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/26290205
accepted answer: http://stackoverflow.com/a/26290205
tagged with: indexing
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41251177
has title: When I try to return the index values of an item in a multidimensional array, I do not get numbers. I get a weird set of characters. Why?
has body: I have this code below that is supposed to return the index values of an item in a multidimensional array. However, when I run it, it gives me back this instead: Found at: [I@7ea987ac public static String findWord(char[][]board, String word) { for (int row = 0; row &lt; board.length; row++) { for (int col = 0; col &lt; board[row].length; col++) { if (board[row][col] == word.charAt(0)) { return "Found at: " + new int[] {row,col}; } } } return "Not found."; } What is wrong with the code that it is not giving me back the correct index values?
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26290179
answer count: 2
has comment: http://stackoverflow.com/comment/41251183
possible better answer: http://stackoverflow.com/a/26290179

http://stackoverflow.com/q/26253870
tagged with: hibernate-criteria
downvote count: 1
has body: I have 2 entities whose extracts are like these: public class Visita { @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="pdv_uid") private PuntoDeVenta pdv; } public class PuntoDeVenta { private Integer idclient; private String zona; @ManyToOne @JoinColumn(name="pdv_categoria_uid", nullable=true) private PuntoDeVentaCategoria categoria; } public class PuntoDeVentaCategoria { private String descripcion; } I try to do restrictions with the differents fields and some of them work, some of them don't. With this root criteria: Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Visita.class).createAlias("pdv", "pdv"); I try to make restrictions with the differents fields of "PuntoDeVenta" and "PuntoDeVentaCategoria" (with and without the createAlias) and I get the exception "could not resolve property", for example: Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Visita.class).createAlias("pdv", "pdv").add(Restrictions.eq("pdv.categoria.descripcion", "example"));
type: Question
has comment: http://stackoverflow.com/comment/41184581
has title: Could not resolve property in Hibernate criteria
answer count: 1
has answer: http://stackoverflow.com/a/26253980
favorite count: 0
linked to: http://stackoverflow.com/q/26176915
upvote count: 2
has comment: http://stackoverflow.com/comment/41184077
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/41098659
comment on: http://stackoverflow.com/a/26207860
type: Comment
has text: @aerophage so what? The field of the object can be null without the object being null.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27744299
upvote count: 6
downvote count: 0
has body: You can use JobServer Api for Apache Spark
answers question: http://stackoverflow.com/q/26315118
score: 6
type: Answer

http://stackoverflow.com/comment/41164406
type: QuestionComment
comment on: http://stackoverflow.com/q/26242832
has text: What is the superclass of `PC`?
score: 0
type: Comment

http://stackoverflow.com/a/26218238
answers question: http://stackoverflow.com/q/26214540
score: 1
accepted answer of: http://stackoverflow.com/q/26214540
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: It's working now, the problem was the Android.mk file. Thanks Vorren for giving the solution ;) The working make file is: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) #OPENCV_CAMERA_MODULES:=off #OPENCV_INSTALL_MODULES:=off #OPENCV_LIB_TYPE:=SHARED include ../../sdk/native/jni/OpenCV.mk LOCAL_SRC_FILES := DetectionBasedTracker_jni.cpp LOCAL_C_INCLUDES += $(LOCAL_PATH) LOCAL_LDLIBS += -llog -ldl LOCAL_MODULE := detection_based_tracker include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES := Hello_jni.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_LDLIBS += -llog LOCAL_MODULE := hello include $(BUILD_SHARED_LIBRARY) there were two errors; syntax error LOCAL_SRC_FILE (missing the S), and i called 'my-dir' 2 times in the make file, which is prohibited (found this here: https://groups.google.com/forum/#!topic/android-ndk/Qmr_WQH-uKk)
type: Answer

http://stackoverflow.com/comment/41324869
type: AnswerComment
type: Comment
has text: Thank you so much for your time/help! Also thanks for not giving me the answer, but making me find it ^^. I got the output I wanted all thanks to you :).
comment on: http://stackoverflow.com/a/26322310
score: 0

instantiation
type: Tag
tags question: http://stackoverflow.com/q/26303456
tag name: instantiation

http://stackoverflow.com/q/26323911
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41313277
has title: ServerSocket constructor throws exception
has answer: http://stackoverflow.com/a/26324085
has comment: http://stackoverflow.com/comment/103295375
type: UnansweredQuestion
type: Question
has body: package server; import java.net.*; import java.io.*; public class TCPServer { public static void main(String[] args) throws IOException { ServerSocket serverSocket =null; Socket socket; boolean listening = true; try { serverSocket = new ServerSocket(4444); } catch (IOException e) { System.err.println("Cannot listen on port: 4444."); } while (listening){ socket = serverSocket.accept(); new TCPServerThread(socket).start(); } serverSocket.close(); } } this code gives this error Cannot listen on port: 4444. Exception in thread "main" java.lang.NullPointerException at server.TCPServer.main(TCPServer.java:20)
has comment: http://stackoverflow.com/comment/41312480
tagged with: java
has answer: http://stackoverflow.com/a/46532928
has comment: http://stackoverflow.com/comment/41312471

http://stackoverflow.com/q/26214973
has answer: http://stackoverflow.com/a/26215032
has body: Who can explain to me what does the following sentance mean in java? "In particular, you must use native integer data types to represent instruction and data words, rather than using dynamically allocated class-typed objects or strings. Likewise, you should not attempt to represent memory using a large array of words. Instead, consider a representation that allocates blocks of memory on demand (that is, on the first read or write to an address within a block)."
has title: use native integer data types to represent instruction and data words, rather than using dynamically allocated class-typed objects or strings
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41112736
favorite count: 0
accepted answer: http://stackoverflow.com/a/26216133
has comment: http://stackoverflow.com/comment/41111760
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41112197
tagged with: oop
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41111861
upvote count: 1
tagged with: cpu-architecture
type: Question
tagged with: performance
has answer: http://stackoverflow.com/a/26216133
possible better answer: http://stackoverflow.com/a/26215032

http://stackoverflow.com/comment/41140021
has text: The popup size must change after it is already visible, when the preferred size of one of its children changes.
comment on: http://stackoverflow.com/a/26219193
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26234217
has comment: http://stackoverflow.com/comment/41149196
has answer: http://stackoverflow.com/a/26374007
has body: I have a listener program that triggers a main program based on the below conditions If the database has new records If the time from last run is 10 minutes. This is done using ScheduledExecutorService of Java (https://stackoverflow.com/a/26043250/1930402 helped out). So, I am calling a perfectly working program from this Listener, located in another Project and another Folder. That is, I am calling project B from project A. To enable this, I added a dependency of Project B in Project A's POM.xml. There is an error in one of the classes of Project B, and it is NoSuchMethodError. I can see the method right there. From the answers of this post, https://stackoverflow.com/a/24902026/1930402, I understand that this particular class might not be there in my build path. I am not sure of this. Can anyone advise? Note: Project B runs without any issues when it is run independently. Java Doc tells: "Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed." How can the definition of my class change while running using a static instance? This is my stack: java.lang.NoSuchMethodError:a.b.c.StringUtils.formatDateToString(Ljava/lang/Object;)Ljava/lang/String; So, these are the key points: Maven Dependency, ScheduledExecutorService, Static Class.
has comment: http://stackoverflow.com/comment/41148347
has title: NoSuchMethod Error in Java-Solved: Multiple projects added in POM.xml as dependencies had same class name and same method. Renamed them
favorite count: 0
linked to: http://stackoverflow.com/q/6894595
upvote count: 2
has comment: http://stackoverflow.com/comment/41147817
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/41147757
score: -2
has comment: http://stackoverflow.com/comment/41147937
linked to: http://stackoverflow.com/q/26042526
has comment: http://stackoverflow.com/comment/41147685
has comment: http://stackoverflow.com/comment/41148364
tagged with: java
has comment: http://stackoverflow.com/comment/41148057
type: Question
has comment: http://stackoverflow.com/comment/41147792
has comment: http://stackoverflow.com/comment/41148316
answer count: 1
has comment: http://stackoverflow.com/comment/41148186
downvote count: 4

http://stackoverflow.com/q/26326695
type: UnansweredQuestion
has title: Questions:Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structure
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41326616
has answer: http://stackoverflow.com/a/26327152
tagged with: ascii
tagged with: int
score: 0
answer count: 2
has body: solution: public boolean isUniqueChars2(String str) { if (str.length() &gt; 256) return false; boolean[] char_set = new boolean[256]; for (int i = 0; i&lt; str.length(); i++) { int val = str.charAt(i); if (char_set[val]) { return false; } char_set[val] = true; } return true; } I have some questions: The codes is based on the premise that the given string is a ASCII string, what if it is a Unicode string? What's the difference between ASCII string and Unicode string? int val=str.charAt(i) I searched ASCII table, If the string is "@ABCD", what number will return?(which of the three"Dec, Hx, Oct" will be use?) The str.charAt(i) should return a character (e.g. A), why declaring the data type as int can directly convert the character to the accordingly ASCII table's number?
has answer: http://stackoverflow.com/a/26326775
tagged with: unicode
favorite count: 0
has comment: http://stackoverflow.com/comment/41326357

http://stackoverflow.com/a/26274053
has body: I think countryNames array is null. try to initialize it before adding data. debug your code and check countryNames... String[] countryNames = new String[...] if you don't know length of array, you had better use Arraylist. (when using Arraylist,you don't have to initialize first.)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26273850

http://stackoverflow.com/comment/41356525
has text: What is the type of `points`? What type does `round` take for its first argument?
score: 0
comment on: http://stackoverflow.com/q/26347801
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26262130
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26261932
type: Answer
has body: The reason why this works when you haven't explicitly created an instance of your Applet is because the JRE treats Applets a little differently. Applets are a special class that Java instantiates for you upon loading. From there, the object is owned by the JRE and is interfaced with by such. Once Java creates an instance of your applet, it then calls init() in lieu of a constructor (since constructors cannot conform to a prototypical contract). Likewise, when your applet is done or the page is unloaded, Java worries about shutting down your applet.
score: 2

http://stackoverflow.com/comment/41241509
type: AnswerComment
has text: i read that from mysql forum and without quotes i have the same problems
comment on: http://stackoverflow.com/a/26284967
type: Comment
score: 0

http://stackoverflow.com/a/26214784
type: Answer
has body: Your code only updates the GUI if current thread is not the EDT: if (!SwingUtilities.isEventDispatchThread()) { // you call SwingUtilities.invokeLater(); } The GUI update should also happen if the current thread happens to be the EDT. So you should change it to somehting like this: if (SwingUtilities.isEventDispatchThread()) jLabel5.setText(text); else SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jLabel5.setText(text); } }); Note that invokeLater() is not executed immediately but asynchronously some time later. If you need the update to happen before it returns, use SwingUtilities.invokeAndWait(). Also note that you may consider using the SwingWorker class to perform lengthy GUI-interaction tasks in a background thread. Making it utility method If you have to do this many times, it is profitable to make a utilitiy method for this: public void callFromEdt(Runnable task) { if (SwingUtilities.isEventDispatchThread()) task.run(); else SwingUtilities.invokeLater(task); // You might want to consider // using invokeAndWait() instead }
has comment: http://stackoverflow.com/comment/41113090
downvote count: 0
has comment: http://stackoverflow.com/comment/41112459
has comment: http://stackoverflow.com/comment/41111783
has comment: http://stackoverflow.com/comment/41112901
score: 3
answers question: http://stackoverflow.com/q/26214693
has comment: http://stackoverflow.com/comment/41112830
upvote count: 3

http://stackoverflow.com/q/26224656
has title: Illegal Start of expression/not yet confident in coding help welcome
has body: I am just starting my second class in computer science. We are working on our first project using java for this semester. The 1st method in the project calls for a static method, that can calculate the bill of a college student depending on credits. The main issue I am running across is an illegal start of expression with my private int and private double. We did 1 inclass example in which we privatized an int and double in a nonstatic method and it worked fine. Is there any difference in doing this static vs nonstatic, and if so what must I do to correct it? public class MyLibrary { public static double CalcFree (int c) throws creditException //integer c to represent total credits { private int credits; private double bill; if ( c &gt; 1 &amp;&amp; c &lt; 33) //providing valid range of options for total number of credits c = credits; else new creditException ("Invalid number of credits."); if ( c &gt; 12) { bill = credits * 110 + 50 + 20; return bill; } else { bill = credits * 110 + 50; return bill; } } }
tagged with: methods
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26224698
tagged with: java
has answer: http://stackoverflow.com/a/26225327
has comment: http://stackoverflow.com/comment/83538054
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/26224698
answer count: 3
accepted answer: http://stackoverflow.com/a/26224705
has answer: http://stackoverflow.com/a/26224705

http://stackoverflow.com/q/26258902
favorite count: 0
has comment: http://stackoverflow.com/comment/41192984
type: UnansweredQuestion
has title: Output the first letter of each string in an array list?
has answer: http://stackoverflow.com/a/26258998
answer count: 4
tagged with: list
score: -5
has answer: http://stackoverflow.com/a/26258952
tagged with: java
tagged with: output
type: Question
has answer: http://stackoverflow.com/a/26259047
has body: This is for my homework assignment so I don't want any code answers just an explanation on how best to proceed. I have set up a program that takes user input and adds them to an array list. I can output the list by using System.out.println(list); but I need to print only the first character of each word. How should I go about doing this? Cheers...
downvote count: 5
has answer: http://stackoverflow.com/a/26259194
tagged with: char
has comment: http://stackoverflow.com/comment/41193110
has comment: http://stackoverflow.com/comment/132690068
upvote count: 0
tagged with: arrays

http://stackoverflow.com/q/26336938
score: 0
answer count: 1
tagged with: neo4j
tagged with: structr
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41340771
upvote count: 1
downvote count: 1
has body: I am going to develop my application in neo4j ,i found structr which is something based on neo4j. What is structr? Is it something like spring or hibernate or something totally different,what kind of problems it can solve and is it stable enough to be used in production.
has title: structr is it right to use
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/28179642

http://stackoverflow.com/comment/41256759
score: 0
has text: Your code `replaceAll("\\?", "\n");` works for me..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26293423

http://stackoverflow.com/comment/41220239
comment on: http://stackoverflow.com/q/26273226
score: 0
type: QuestionComment
type: Comment
has text: @AlexisPigeon ohh i searched other class which is in java.security.Timestamp. My mistake

http://stackoverflow.com/q/26320106
has answer: http://stackoverflow.com/a/40174121
score: 41
upvote count: 41
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41306600
type: Question
has answer: http://stackoverflow.com/a/26320355
has body: In controller I create json array. If I return List&lt;JSONObject&gt; it is ok: @RequestMapping(value="", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) public @ResponseBody List&lt;JSONObject&gt; getAll() { List&lt;Entity&gt; entityList = entityManager.findAll(); List&lt;JSONObject&gt; entities = new ArrayList&lt;JSONObject&gt;(); for (Entity n : entityList) { JSONObject entity = new JSONObject(); entity.put("id", n.getId()); entity.put("address", n.getAddress()); entities.add(entity); } return entities; } but I need to return JSON array and HTTP status code: @RequestMapping(value="", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ResponseEntity&lt;List&lt;JSONObject&gt;&gt; getAll() { List&lt;Entity&gt; entityList = entityManager.findAll(); List&lt;JSONObject&gt; entities = new ArrayList&lt;JSONObject&gt;(); for (Entity n : entityList) { JSONObject Entity = new JSONObject(); entity.put("id", n.getId()); entity.put("address", n.getAddress()); entities.add(entity); } return new ResponseEntity&lt;JSONObject&gt;(entities, HttpStatus.OK); // XXX } Eclipse see error in XXX line: Multiple markers at this line - The constructor ResponseEntity&lt;JSONObject&gt;(List&lt;JSONObject&gt;, HttpStatus) is undefined - Type mismatch: cannot convert from ResponseEntity&lt;JSONObject&gt; to ResponseEntity&lt;List&lt;JSONObject&gt;&gt; - Type mismatch: cannot convert from ResponseEntity&lt;JSONObject&gt; to JSONObject How can I return json+http reply? There is my working code for returning one json object + http status code: @RequestMapping(value="/{address}", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ResponseEntity&lt;JSONObject&gt; getEntity(@PathVariable("address") int address) { Entity n = entityManager.findByAddress(address); JSONObject o = new JSONObject(); o.put("id", n.getId()); o.put("address", n.getAddress()); return new ResponseEntity&lt;JSONObject&gt;(o, HttpSt…
has comment: http://stackoverflow.com/comment/41308214
has comment: http://stackoverflow.com/comment/41306228
has title: Spring: return @ResponseBody "ResponseEntity<List<JSONObject>>"
linked to: http://stackoverflow.com/q/17526787
has answer: http://stackoverflow.com/a/60339512
has answer: http://stackoverflow.com/a/28303003
downvote count: 0
has answer: http://stackoverflow.com/a/61524440
favorite count: 0
tagged with: rest
answer count: 5
tagged with: http-status-codes
tagged with: spring
possible better answer: http://stackoverflow.com/a/28303003
accepted answer: http://stackoverflow.com/a/26320355
type: AnsweredQuestion

http://stackoverflow.com/a/26323923
score: -1
upvote count: 0
type: AcceptedAnswer
has body: I fix it, because i don't have an ListView created in the pager xml, SwipeTabFragment.java this line ListView lv = (ListView) view.findViewById(R.id.list_item); should be //swipe_tab.xml should add a ListView with id listView1 ListView lv = (ListView) view.findViewById(R.id.listView1); swipe_tab.xml <?xml version="1.0" encoding="utf-8"?>
type: Answer
answers question: http://stackoverflow.com/q/26322236
accepted answer of: http://stackoverflow.com/q/26322236
downvote count: 1

http://stackoverflow.com/comment/63916962
has text: I am also having issues when Color representation = Uncalibrated. Did you find a solution?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26295200

http://stackoverflow.com/comment/41131413
comment on: http://stackoverflow.com/a/26224592
has text: Thanks. When i tried accessing the shared list it makes me have to add cast to it. then i try running it but it gives me error. Im trying to add from the form to the array list. By the way, I'm going to probably do hash map since i didn't think about that.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41281707
comment on: http://stackoverflow.com/q/26306902
score: 0
has text: Are you testing on Firefox or the Android browser? I am just confused cause you added an android tag in this thread. If that is the case, you need the Android Driver. https://code.google.com/p/selenium/wiki/AndroidDriver now Selendroid http://selendroid.io/mobileWeb.html
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26299556
has body: I tried to make my first lambda example but I can't get this simple code to work. import java.util.ArrayList; import java.util.function.Predicate; public class Lambda { public static void main(String[] args) { final String[] names = {"Wim", "Kian", "Dirk", "Emmanuel", "Frank", "Michaël", "Anna", "Damien", "Alberto"}; final String[] filteredNames = getNamesWithCriteria(names, (String s) -&gt; s.startsWith("A")); } private String[] getNamesWithCriteria(final String[] names, Predicate&lt;String&gt; predicate) { final ArrayList&lt;String&gt; filteredNames = new ArrayList&lt;&gt;(); for(String name : names) { if(predicate.test(name)) { filteredNames.add(name); } } return (String[]) filteredNames.toArray(); } } These are the errors that I get: Lambda.java:8: error: ')' expected final String[] filteredNames = getNamesWithCriteria(names, (String s) -&gt; s.startsWith("A")); ^ Lambda.java:8: error: illegal start of expression final String[] filteredNames = getNamesWithCriteria(names, (String s) -&gt; s.startsWith("A")); ^ Lambda.java:8: error: ';' expected final String[] filteredNames = getNamesWithCriteria(names, (String s) -&gt; s.startsWith("A"));
upvote count: 1
tagged with: lambda
has answer: http://stackoverflow.com/a/26299735
tagged with: java-8
accepted answer: http://stackoverflow.com/a/26299735
possible better answer: http://stackoverflow.com/a/26299810
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41268226
answer count: 2
has answer: http://stackoverflow.com/a/26299810
score: 0
has comment: http://stackoverflow.com/comment/41268155
has title: First try at lambda
favorite count: 0
has comment: http://stackoverflow.com/comment/41268038

http://stackoverflow.com/comment/41323515
type: AnswerComment
has text: I'm not trying to inherit a static method with a body I'd like to inherit a static method with an empty body, like how an interface works but it's not possible. I think what I'm trying to do is not possible was hoping that maybe I was missing something or someone had a good idea on how to do it a different way.
type: Comment
comment on: http://stackoverflow.com/a/26329435
score: 0

http://stackoverflow.com/comment/41581709
has text: @leigh Am I blind? I don't see it there.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26264480

http://stackoverflow.com/q/26327680
type: UnansweredQuestion
tagged with: android
has body: I am creating an android app, and i get spammed by a certain error(not affecting the app functionality). I have like 300k + errors in 5 seconds. I cannot view other errors from my app because of this spam. Error is as following: 10-12 19:58:25.248 20268-20287/com.example.boacterapp.Pages E/ParseCommandCache﹕saveEventually thread had an error. java.lang.IllegalStateException: Tried to serialize a command referencing a new, &gt;unsaved object. at com.parse.ParseCommand.resolveLocalIds(ParseCommand.java:472) at com.parse.ParseCommand.onPreExecute(ParseCommand.java:371) at com.parse.ParseRequest$7.then(ParseRequest.java:299) at com.parse.ParseRequest$7.then(ParseRequest.java:296) at com.parse.Task$11.run(Task.java:481) at com.parse.Task$ImmediateExecutor.execute(Task.java:673) at com.parse.Task.completeAfterTask(Task.java:477) at com.parse.Task.continueWithTask(Task.java:353) at com.parse.Task.continueWithTask(Task.java:364) at com.parse.ParseRequest.executeAsync(ParseRequest.java:296) at com.parse.ParseRequest.executeAsync(ParseRequest.java:286) at com.parse.ParseCommandCache.maybeRunAllCommandsNow(ParseCommandCache.java:487) at com.parse.ParseCommandCache.runLoop(ParseCommandCache.java:611) at com.parse.ParseCommandCache.access$000(ParseCommandCache.java:26) at com.parse.ParseCommandCache$2.run(ParseCommandCache.java:146) Is there a way to apply a filter to exclude a certain error from the logcat? Thank you in advance.
has comment: http://stackoverflow.com/comment/41319651
tagged with: android-studio
tagged with: java
tagged with: error-handling
has answer: http://stackoverflow.com/a/26327931
linked to: http://stackoverflow.com/q/5511433
type: Question
has comment: http://stackoverflow.com/comment/41319440
score: 0
has comment: http://stackoverflow.com/comment/41319531
has title: How to exclude certain error from Android Studio logcat?
has comment: http://stackoverflow.com/comment/41319576
answer count: 1
tagged with: android-logcat

http://stackoverflow.com/q/26235542
has answer: http://stackoverflow.com/a/26235621
score: 0
answer count: 3
tagged with: compare
has answer: http://stackoverflow.com/a/26236430
tagged with: string
tagged with: parsing
accepted answer: http://stackoverflow.com/a/26236501
linked to: http://stackoverflow.com/q/4777622
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26236501
has body: In Java, I want to extract the differences from one comma-separated string when compared to another. e.g The string I want to extract the differences from: 1,hello,fire,dog,green The string I am comparing with : 1,hello,water,dog,yellow So the result of the function would give me a arraylist of [3,fire] and[5,green] as those items are different than the items in the second string, which are 'water' and 'yellow'. The numbers are the index positions of each item detected to be a difference. The other items match and are not considered.
has title: How to parse a string when compared to another string?
tagged with: java
possible better answer: http://stackoverflow.com/a/26236430
tagged with: match
type: Question
has comment: http://stackoverflow.com/comment/41150135
has comment: http://stackoverflow.com/comment/41150278

http://stackoverflow.com/comment/41247315
score: 0
type: QuestionComment
has text: I did not test Linux-Linux yet, as my Server needs at least JDK 8u40 to run due to using some javafx stuff and I didn't look into installing early release version on Linux yet. In the post you mentioned the author is talking about a few minutes and having data left to be read, but I flush my stream after every write and also waited for almost an hour. Will test Linux-Linux as soon as I get to it, but I also want to be able to have cross-platform connections!
type: Comment
comment on: http://stackoverflow.com/q/26286193

http://stackoverflow.com/comment/41122738
comment on: http://stackoverflow.com/a/26216044
type: Comment
has text: @shakabra You can always upvote one question and accept the other one. I guess you haven't upvoted yet as I already upvoted Uwe and it's still at 1...
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41307667
has text: The code will run the "same" if you get rid of the kb.close line. As for the student[i] that is just one possible way to store the name and grade. Maybe you can pass your values into variables and print them to screen? Dont know exactly what your trying to do and how much you have learned to help further.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26321176

http://stackoverflow.com/q/26302740
has title: rosjava (android_core) pub sub example nodes isolated
tagged with: ros
accepted answer: http://stackoverflow.com/a/26461414
score: 0
tagged with: android
answer count: 1
has body: I'm trying to connect the android pubsub tutorial of android_core with a master core in my server. Actually the example runs fine and I'm able to see the android subscriber getting the messages in the listener activity, which are sent from the talker node written in rosjava. And when I run an additional listener node, it seems to subscribe fine: rostopic info /chatter Type: std_msgs/String Publishers: * /rosjava_tutorial_pubsub/talker (http://10.0.2.15:45508/) Subscribers: * /listener_6323_1412952506377 (http://laptop:37300/) * /android_gingerbread/ros_text_view (http://10.0.2.15:47832/) The graph should look like this: |/listener_6323_1412952506377 |-------> | /rosjava_tutorial_pubsub/talker | |/android_gingerbread/ros_text_view |-> |---------------------------------| So, the problem is that even if it is subscribed, it won't see anything, the messages sent by the talker in the emulator arrive fine to the listener in the emulator, but not to the outside listener. Also I tried to send messages from the console, and they are received fine by the listener in the console, but the listener in the emulator won't see it. Also, I noticed that when I run rqt_graph, it stops working right after I launch the android APP. I'm using the ROS_MASTER_URI set to my IP, in both console and emulator, so there shouldn't be mismatches in the namespace. What could be happening here?, Namespace problem of the messages?, version incompatibility problem?. IDK. Regards
has answer: http://stackoverflow.com/a/26461414
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/41087368
comment on: http://stackoverflow.com/q/26201709
score: 0
type: Comment
type: QuestionComment
has text: The Class Under Test. You never mock the CUT, you mock its _dependencies_. You then stub these dependencies and verify that the CUT called the expected methods on the dependency. You are not testing very much as far as I can see.

http://stackoverflow.com/q/26336495
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: google-cardboard
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/46577167
tagged with: camera
linked to: http://stackoverflow.com/q/17223507
score: 10
has comment: http://stackoverflow.com/comment/41784183
upvote count: 10
has answer: http://stackoverflow.com/a/39658903
favorite count: 0
has title: How to show 2 camera preview side by side?[For cardboard apps]
has answer: http://stackoverflow.com/a/28661929
accepted answer: http://stackoverflow.com/a/28661929
tagged with: android
possible better answer: http://stackoverflow.com/a/39658903
has comment: http://stackoverflow.com/comment/44428393
has body: I am trying to build a Cardboard android application that shows 2 camera view side by side. [Just like the camera view works for VRCinema Android app.] So I studies the Cardboard code from GitHub, made some modification and so far I am able to use the imageView to replicate the same image side by side. and the Code so far looks like this. AndroidManifest.XML <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.NFC" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> <uses-feature android:name="android.hardware.camera.front" android:required="false" /> <uses-sdk android:minSdkVersion="14"/> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> common_ui.xml <?xml version="1.0" encoding="utf-8"?> <com.google.vrtoolkit.cardboard.CardboardView android:id="@+id/cardboard_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" /> <com.google.vrtoolkit.cardboard.samples.treasurehunt.CardboardOverlayView android:id="@+id/overlay" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_centerInParent="true" /> CardboardOverlayView.java package com.google.vrtoolkit.cardboard.samples.treasurehunt; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; import and…

http://stackoverflow.com/comment/41211978
has text: `static` is not your friend, you will end up with reference issues if your are not very, very careful...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26268559
score: 0

http://stackoverflow.com/q/26339242
tagged with: apache
answer count: 1
tagged with: websocket
has comment: http://stackoverflow.com/comment/41341698
favorite count: 0
has comment: http://stackoverflow.com/comment/41342007
downvote count: 0
has title: Error during WebSocket handshake: Unexpected response code: 404
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
has body: I trying a simple websocket application but its giving a error, WebSocket connection to 'ws://localhost:8080/WebSocketPrj02/chatroomServerEndpoint' failed: Error during WebSocket handshake: Unexpected response code: 404 I found to many discussions on the same topic but it didn't help me that's why I posting a new question. My files are, ChatroomServerEndpoint.java package com.za.tutorial.websocket; import java.io.IOException; import java.io.StringWriter; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import javax.json.Json; import javax.json.JsonObject; import javax.json.JsonWriter; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; @ServerEndpoint("chatroomServerEndpoint") public class ChatroomServerEndpoint { static Set<Session> chatroomUsers = Collections.synchronizedSet(new HashSet<Session>()); @OnOpen public void handleOpen(Session userSession){ chatroomUsers.add(userSession); } @OnMessage public void handleMessage(String message, Session userSession) throws IOException{ String userName = (String) userSession.getUserProperties().get("userNmae"); if(userName == null){ userSession.getUserProperties().put("userName", userName); userSession.getBasicRemote().sendText(buildJsonData("System"," you are connected as "+message)); } else { Iterator<Session> iterator = chatroomUsers.iterator(); while(iterator.hasNext()){ iterator.next().getBasicRemote().sendText(buildJsonData(userName, message)); } } } private String buildJsonData(String userName, String message) { JsonObject jsonObject = Json.createObjectBuilder().add("message", userName+": "+message).build(); StringWriter stringWriter = new StringWriter(); try(JsonWriter jsonWriter = Json.createWriter(stringWriter)){ jsonWriter.write(jsonObject); } return stringWriter.toString(); } } default.html Websocket2 I am using Spring Tool Suit, apache-tomcat-7.0.37. I went through a…
has answer: http://stackoverflow.com/a/26375028
upvote count: 1

http://stackoverflow.com/a/26260438
answers question: http://stackoverflow.com/q/26260136
accepted answer of: http://stackoverflow.com/q/26260136
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It is not entirely clear what you mean by "more directly", but I'm assuming that you want to avoid the concatenation step. One way would be as follows: make an initial pass using Matcher.find(int) to find the position of the "N - 5th" separator. (This requires an int[] with 5 elements that you use as a sort of queue for the offsets determined using find.) use String.substring to extract the strings before and after that separator use String.split to split the 2nd substring to separate the last 5 fields. If you kept the offsets and match lengths (from step #1) you could replace the split call in step #3 with a loop and substring calls. (The reason you can't in general split "backwards" is that regexes cannot be matched backwards. Or more precisely, if you did that you might end up splitting differently to when you did it "forwards". This makes it non-trivial to avoid doing 2 passes. Obviously in your specific case, the separator regex would be "one-or-more-whitespace" which would work in both directions ... if there was a capability to do that in the Matcher API.).
upvote count: 3

http://stackoverflow.com/a/34988102
answers question: http://stackoverflow.com/q/26289412
has body: I know this post is quite old, but I also struggled with a similar problem while I was trying to create a Docker container which installs a Glassfish 4.1.1 server and deploy an application afterwards. The Dockerfile script stops every time when the "Do you trust the above certificate" dialog appears. Maybe I could help someone with my following instructions. You have to establish trust for it. Load it in a trust store. after jww wrote these sentences I started looking for a suitable trust store. I found out that the local user which is running the asadmin command has a dedicated trust store under ~/.gfclient/truststore If you want to prevent displaying this dialog you have to add the glassfish certificates into your local glassfish trust store. I assume in the following instructions that you use domain1 and you are using the default certificate s1as: keytool -export -alias s1as -file /tmp/s1as.cert -keystore /path/to/glassfish/domains/domain1/config/keystore.jks keytool -import -alias s1as -file /tmp/s1as.cert -keystore ~/.gfclient/truststore The default password for the local glassfish trust store is changeit. Afterwards you shouldn't been asked again if you trust this glassfish connection.
upvote count: 3
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/q/26339866
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41342428
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41342148
type: Question
has body: Suppose i have a class named Invoked, to which i want to call using reflection from Invoker class. but i want to give input from array declared in Invoker class whenever it gets code for input from keyboard. class Invoked { public static void main(String ar[]) { java.util.Scanner s = new java.util.Scanner(); // here i want to give input stored in array except of console from Invoker class. System.out.println("input given from keyboard is : " + s.next()); } } class Invoker { public static void main(String ar[]) { // i want to pass array here for keyboard input values like Class&lt;?&gt; cl = loader.loadClass("Invoked"); Method m = cl.getDeclaredMethod("main", new Class[] {String[].class }); m.setAccessible(true); m.invoke(null, new Object[] {null }); } }
has answer: http://stackoverflow.com/a/26339988
answer count: 3
has comment: http://stackoverflow.com/comment/41342274
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26340205
has title: how to give input from array whenever it ask input from keyboard in java
favorite count: 0
has answer: http://stackoverflow.com/a/26353118
has comment: http://stackoverflow.com/comment/41342016

http://stackoverflow.com/q/26240841
has answer: http://stackoverflow.com/a/26304120
has answer: http://stackoverflow.com/a/26402018
answer count: 4
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26378916
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/26381044
has title: Returning debug information in HTTP response body - Java
downvote count: 0
score: 1
has body: I'm looking to return per request debug information in a JSON HTTP response body. This debug information would be collected throughout my application, including data such as DB queries and how long they took, external calls made, whether certain conditions were met, general messages showing application flow etc. I've looked into Java logging frameworks and the Play Framework, which I am using, has a built in logger that works great for logging information to files. But I can't seem to find any that handle request level logging i.e. store debug messages for this particular HTTP request to be returned with this request and then destroyed. I could of course create a Debug class, instantiate that and pass that around throughout my application for each request, but this doesn't seem like a nice way to handle this as I would need to be passing this into a lot of classes in my application. Are there any better ways/design patterns/libraries out there that can do what I'm looking for without having to pass a Debug object round my entire application?
favorite count: 0
possible better answer: http://stackoverflow.com/a/26304120
has comment: http://stackoverflow.com/comment/41177318
has answer: http://stackoverflow.com/a/26378916

http://stackoverflow.com/comment/41269508
comment on: http://stackoverflow.com/q/26300351
has text: you are just shifting the digits right with division and getting the right most digit with modulus
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41342164
comment on: http://stackoverflow.com/a/26339800
type: AnswerComment
has text: I have create a new node without default namespace and printed all the attributes to make sure there is no attribute with default namespace, i dont see any default namespace in the output any how when i constructed the DOM object i see the default namespace back any ide............. ???????????//
score: 0
type: Comment

http://stackoverflow.com/q/26296252
tagged with: spring-data-rest
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
score: 8
upvote count: 8
has answer: http://stackoverflow.com/a/26296790
tagged with: spring
type: AnsweredQuestion
has title: Can't get the JPA entity ID in the JSON output
accepted answer: http://stackoverflow.com/a/26296790
tagged with: java
type: Question
has body: We are trying a POC with Spring-Data-JPA and Spring-Data-Rest. The output looks as excepted, we have the values of our entity fields except for the id, the id field is set in an Abstract class. We are using a simple entity witch extends of AbstractPersistable (it's a spring-data-jpa class http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/domain/AbstractPersistable.html). Here the source code of this one: @MappedSuperclass public abstract class AbstractPersistable&lt;PK extends Serializable&gt; implements Persistable&lt;PK&gt; { private static final long serialVersionUID = -5554308939380869754L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ID") private PK id; /* * (non-Javadoc) * * @see org.springframework.data.domain.Persistable#getId() */ public PK getId() { return id; } /** * Sets the id of the entity. * * @param id the id to set */ protected void setId(final PK id) { this.id = id; } /* * (non-Javadoc) * * @see org.springframework.data.domain.Persistable#isNew() */ public boolean isNew() { return null == getId(); } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return String.format("Entity of type %s with id: %s", this.getClass().getName(), getId()); } /* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (null == obj) { return false; } if (this == obj) { return true; } if (!getClass().equals(obj.getClass())) { return false; } AbstractPersistable&lt;?&gt; that = (AbstractPersistable&lt;?&gt;) obj; return null == this.getId() ? false : this.getId().equals(that.getId()); } /* * (non-Javadoc) * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { int hashCode = 17; hashCode += null == getId() ? 0 : getId().hashCode() * 31; return hashCode; } } and our entity: @Entity @Table(name = "TEST_ENTITY") public class TestEntity extends AbstractPersistable&lt;Long&gt; { @Column(name = "T…
tagged with: spring-data-jpa

http://stackoverflow.com/comment/41320610
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26328217
has text: I have already asked him, he did not give me the answer rather he said it is always recommended to use 1L only. If that is the case then why it is required to generate serial version id. Why there is a method in ObjectStreamClass to generate serial version id. Please provide me some clue or answers.

http://stackoverflow.com/q/26254937
has title: How to make http calls from android
has comment: http://stackoverflow.com/comment/41185803
tagged with: java
has answer: http://stackoverflow.com/a/26255115
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41185802
has answer: http://stackoverflow.com/a/26255114
upvote count: 1
favorite count: 0
tagged with: android
has body: Hi I want to use this code in thread , How I can do this ?? this code use for read rss feed in android. public String getXmlFromUrl(String url) { String xml = null; try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // return XML return xml; }
downvote count: 5
type: UnansweredQuestion
score: -4

http://stackoverflow.com/a/37404239
answers question: http://stackoverflow.com/q/26281322
type: Answer
score: 8
downvote count: 0
upvote count: 8
has body: I had this issue too because I was filtering /src/main/resources and forgot I had added a keystore (*.jks) binary to this directory. Add a "resource" block with exclusions for binary files and your problem may be resolved. <build> somename src/test/resources false src/main/resources true *.jks *.png ...

http://stackoverflow.com/comment/41155740
comment on: http://stackoverflow.com/q/26238045
score: 0
has text: please see my answer and post your whole logcat output, are you sure you want to count the values that do not match?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26296347
has comment: http://stackoverflow.com/comment/97471824
downvote count: 1
has comment: http://stackoverflow.com/comment/66385718
has body: If You just need to check if both lists have same elements You may try: when: def expectedResults = [ ... ] def realResults = getRealResultsMethod() then: realResults.size() == expectedResults.size() realResults.containsAll(expectedResults) expectedResults.containsAll(realResults) But if You need to check if both lists are equal You just need (as in @tim_yates' response): when: def expectedResults = [ ... ] def realResults = getRealResultsMethod() then: realResults == expectedResults Remember that two lists are equal only if they have the same elements in the same order.
has comment: http://stackoverflow.com/comment/77387213
type: Answer
answers question: http://stackoverflow.com/q/26283832
score: 10
upvote count: 11

http://stackoverflow.com/comment/107987779
has text: And, if during this particular request you are executing N queries, N auto-commit transactions will be created, instead of a single one. More, if you are using JPA and Hibernate, each statement will have to acquire and release a DB connection after each statement. Again, very inefficient.
type: Comment
comment on: http://stackoverflow.com/a/26327536
score: 1
type: AnswerComment

http://stackoverflow.com/q/26280656
tagged with: sharepoint
score: 0
has title: Get all column names from sharepoint list java
has answer: http://stackoverflow.com/a/36052858
answer count: 3
type: UnansweredQuestion
has body: I'm reading a SharePoint list with java via a web service. I've seen a number of examples that will read the list based on column titles you provide as an input. Id like to know how to read all the items in a SharePoint list and get a list of all the column names (internal preferably). Thanks for your thoughts guys
has comment: http://stackoverflow.com/comment/41241623
has answer: http://stackoverflow.com/a/26408100
has answer: http://stackoverflow.com/a/27886741
type: Question
tagged with: java

http://stackoverflow.com/comment/41094828
comment on: http://stackoverflow.com/a/26205519
score: 0
type: AnswerComment
type: Comment
has text: @AnAmuser Then there's a difference between what you are trying and what you've shown. Edit your question and add _exactly_ what you are doing and the types involved.

http://stackoverflow.com/q/26336154
accepted answer: http://stackoverflow.com/a/26474610
type: Question
tagged with: playframework
tagged with: akka
answer count: 1
has body: I am using Akka/Play(Java) in an system where an Actor needs to write data to outstream and read from blocking input stream. In my current implementation I am using a java thread which does the actual writing/reading to/from streams, the thread in constructed by the actor passing it a self reference. When writing data the actor simply calls workerthread.write(...) and upon reading data from blocking input stream the thread calls actorRef.tell(message, null) My testing looks ok, but I would like to know if there are better approaches/patterns or any potential problem I would need to be mindful of. I know introducing a worker thread is not optimal, however since the integration is with an stateful system I see no other option
score: 0
has title: Akka Actors & extrernal Worker threads
has answer: http://stackoverflow.com/a/26474610
tagged with: multithreading
tagged with: actor
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26245305
tagged with: java
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/26245617
has title: Synchronised instance methods in java
downvote count: 0
score: 4
possible better answer: http://stackoverflow.com/a/26245617
has body: From some internet source Here is a synchronized instance method: public synchronized void add(int value){ this.count += value; } Notice the use of the synchronized keyword in the method declaration. This tells Java that the method is synchronized. A synchronized instance method in Java is synchronized on the instance (object) owning the method. Thus, each instance has its synchronized methods synchronized on a different object: the owning instance. Only one thread can execute inside a synchronized instance method. If more than one instance exist, then one thread at a time can execute inside a synchronized instance method per instance. One thread per instance. Here's my understanding. If I have a runnable object, that contains an instance of the class containing the above add method, then Case 1 : I have two threads, each having the same instance of class containing the add method, then only one will be able to execute the above add method at a time. Hence if one thread calls add then it CAN NOT be pre empted before it finishes the execution? Case 2 : If both my threads have two different instances of the class containing the add method, then it synchronisation does not really play any role in this case. The two of them will execute, as if synchronisation was not applied at all. Am I correct in my understanding?
has comment: http://stackoverflow.com/comment/41169254
favorite count: 0
tagged with: synchronization
tagged with: multithreading
has answer: http://stackoverflow.com/a/26245430
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26245430

http://stackoverflow.com/q/26328808
tagged with: algorithm
tagged with: java
type: UnansweredQuestion
tagged with: nodes
tagged with: queue
tagged with: shortest-path
has comment: http://stackoverflow.com/comment/41323466
answer count: 0
has body: Ultimately I honestly want this as a puzzle-solver, but I figure I can modify this for other purposes as well...I'm trying to find the shortest chain of words between a start word and end word, changing one letter at a time. I'm doing this with Linear Nodes and LinkedQueues. import java.util.*; public class Driver { static LinkedQueue&lt;LinearNode&lt;String&gt;&gt; open = new LinkedQueue&lt;LinearNode&lt;String&gt;&gt;(); public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a four letter start word: "); String start = input.next(); System.out.print("Enter a four letter end word: "); String end = input.next(); System.out.println(); input.close(); if (start.equals(end)) { System.out.println("The words are the same.\nThe chain length is 0."); } else { System.out.println(findChain(start, end)); } } public static String findChain(String start, String end) { boolean finalFound = false; Dictionary dict = new Dictionary("four.txt"); char[] alphabet = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; LinearNode&lt;String&gt; begin = new LinearNode&lt;String&gt;(start); ArrayList&lt;String&gt; used = new ArrayList&lt;String&gt;(); used.add(start); open.enqueue(begin); while((!open.isEmpty()) &amp;&amp; (!finalFound)) { LinearNode&lt;String&gt; currentNode = open.dequeue(); String currentWord = currentNode.getElement(); char[] charStr = currentWord.toCharArray(); for (int i = 0; i &lt; charStr.length; i++) { for (char ch : alphabet) { char[] charStr2 = charStr.clone(); charStr2[i] = ch; String newWord = new String(charStr2); if (dict.contains(newWord) &amp;&amp; (!used.contains(newWord))) { used.add(newWord); LinearNode&lt;String&gt; newNode = new LinearNode&lt;String&gt;(newWord, currentNode); open.enqueue(newNode); if (newWord.equals(end)) { finalFound = true; i = 4; break; } } } } } if (finalFound == true) { String str = ""; LinkedStack&lt;S…
type: Question
has title: Linear Nodes to optimize and solve problems in java
has comment: http://stackoverflow.com/comment/41321793
has comment: http://stackoverflow.com/comment/41327283
has comment: http://stackoverflow.com/comment/41321888
score: 0
has comment: http://stackoverflow.com/comment/41322145

cosign-api
tags question: http://stackoverflow.com/q/26292915
tag name: cosign-api
type: Tag

http://stackoverflow.com/q/26341999
type: UnansweredQuestion
tagged with: android
has title: Unknown argument: -release
score: 2
upvote count: 2
tagged with: java
type: Question
has body: I am facing an issue with Unable to execute dex: method ID not in [0, 0xffff]: 65536), so I found this post that can help me resolve this error. But as you will see in that post that it needed ant installation. So I started learning the docs for ANT and completed installation of ANT. But now I cannot fire ant -release command, although I was able to fire ant -debug. The complete log of ant -help and ant -version has been attached to this if it could help anyone. You can see in here that is doesn't have ant -release command: D:\xxxxxandroid\NilayNew\xxxxxx&gt;ant -help ant [options] [target [target2 [target3] ...]] Options: -help, -h print this message -projecthelp, -p print project help information -version print the version information and exit -diagnostics print information that might be helpful to diagnose or report problems. -quiet, -q be extra quiet -silent, -S print nothing but task outputs and build failures -verbose, -v be extra verbose -debug, -d print debugging information -emacs, -e produce logging information without adornments -lib &lt;path&gt; specifies a path to search for jars and classes -logfile &lt;file&gt; use given file for log -l &lt;file&gt; '' -logger &lt;classname&gt; the class which is to perform logging -listener &lt;classname&gt; add an instance of class as a project listener -noinput do not allow interactive input -buildfile &lt;file&gt; use given buildfile -file &lt;file&gt; '' -f &lt;file&gt; '' -D&lt;property&gt;=&lt;value&gt; use value for given property -keep-going, -k execute all targets that do not depend on failed target(s) -propertyfile &lt;name&gt; load all properties from file with -D properties taking precedence -inputhandler &lt;class&gt; the class which will handle input requests -find &lt;file&gt; (s)earch for buildfile towards the root of -s &lt;file&gt; the filesystem and use it -nice number A niceness value for the main thread: 1 (lowest) to 10 (highest); 5 is the default -nouserlib Run ant without using the jar files f…
tagged with: ant
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26379898

http://stackoverflow.com/q/26304174
type: Question
linked to: http://stackoverflow.com/q/13205251
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/41277586
linked to: http://stackoverflow.com/q/25039666
has comment: http://stackoverflow.com/comment/41277045
has comment: http://stackoverflow.com/comment/41276889
has comment: http://stackoverflow.com/comment/41277361
tagged with: java
tagged with: jfreechart
answer count: 1
tagged with: draw
tagged with: graph
type: UnansweredQuestion
tagged with: ubuntu
has body: I want to draw a chart by reading the /proc/net/dev file in ubuntu to show the received bytes and sent bytes in wlan,eth and lo. At the moment those details are shown in text format with live updating. So I want to show those live updates by a graph. At the momment I show these my text as shown below code. package throughput; import java.awt.*; import java.io.*; import java.util.*; import javax.swing.*; public class Throughput extends JPanel implements Runnable { private ArrayList&lt;String&gt; lines; public Throughput() { lines = new ArrayList&lt;String&gt;(); new Thread(this).start(); } @Override public void run() { try { while (true) { String sContents = readFile(); StringTokenizer tok = new StringTokenizer(sContents, "\n"); lines = new ArrayList&lt;String&gt;(); int x = 0; while (tok.hasMoreTokens()) { String line = tok.nextToken(); if (x++ &lt; 2) {//skip headers continue; } lines.add(line); } repaint(); Thread.sleep(500);//half a second } } catch (Exception exc) { exc.printStackTrace(); } } @Override public void paint(Graphics gr) { super.paint(gr); Graphics2D g = (Graphics2D) gr; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setFont(new Font(Font.DIALOG_INPUT, Font.PLAIN, 14)); g.drawString("Interface: receivedBytes/receivedPackets, sentBytes/sentPackets", 10, 20); for (int i = 0; i &lt; lines.size(); i++) { drawLine(g, lines.get(i), i); } } private static final String readFile() { try { File file = new File("/proc/net/dev"); StringBuilder sb = new StringBuilder(); byte[] bytes = new byte[1024]; int read = 0; InputStream in = new FileInputStream(file); while ((read = in.read(bytes)) != -1) { sb.append(new String(bytes, 0, read)); } in.close(); return sb.toString(); } catch (Exception exc) { exc.printStackTrace(); } return null; } private void drawLine(Graphics2D g, String line, int iLineIndex) { String[] words = line.split("\\s+"); String sInterface = words[words[0].length() &gt; 0 ? 0 : 1]; int index = sInterface.i…
upvote count: 0
has answer: http://stackoverflow.com/a/26308934
favorite count: 0
has title: How to draw a live chart by reading the /proc/net/dev file in Ubuntu
has comment: http://stackoverflow.com/comment/41277086

http://stackoverflow.com/q/26329105
has comment: http://stackoverflow.com/comment/41322682
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41322327
score: -3
has comment: http://stackoverflow.com/comment/41322555
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41322439
has comment: http://stackoverflow.com/comment/41322600
type: Question
has title: I need to print out the taxable income from the mthod that i called in the main method. however the loop in the method will only return one value
has comment: http://stackoverflow.com/comment/41323074
has comment: http://stackoverflow.com/comment/41322146
has comment: http://stackoverflow.com/comment/41322309
has answer: http://stackoverflow.com/a/26329437
upvote count: 0
answer count: 1
has body: Here is my code, the loop in the compute tax method will only return the first nmber which isnt even correct. how can i return the correct value. In each loop there must be a type of tax bracket choosen which you enter a number 1-4. this will also go to the method loop as well. public class TaxTable { public static void main(String[] args){ Scanner scan = new Scanner(System.in); System.out.println(" Enter in status\n (1 for single\n,2 for married joint, 3 for Married separate, 4 for Head of House: "); int status = scan.nextInt(); //if status to print out status name if (status == 1) System.out.println ("Taxable\t single\nIncome"); else if (status == 2) System.out.println ("Taxable\tMarried Jointly\nQualified Widow\nIncome"); else if (status == 3) System.out.println ("Taxable\tMarried separate\nIncome"); else if (status == 4) System.out.println ("Taxable\tHead of House\nIncome"); int taxableIncome = 50000; for (int i = 50000; i &lt;= 60000; i += 50) System.out.println (i + "\t" + Math.round(computeTax(status, taxableIncome))); } public static double computeTax (int status, double taxableIncome) { double tax=0; for (int k = 50000; k &lt;= 60000; k =+ 50) { if (status == 1) taxableIncome = 4675 + ((k-33950)*.25); else if(status == 2) taxableIncome = 16701 + (k-16701)*.15; else if(status == 3) taxableIncome = 4675 + (k-33951)*.25; else if(status == 4) taxableIncome = 6227.5 + (k-33549)*.25; return taxableIncome[k]; } } }
favorite count: 0

http://stackoverflow.com/comment/41342148
type: QuestionComment
has text: i want to make an online java compiler, so Invoked class will be given from user. i want to provide facility for keyboard input which user will give in a textbox before execution and will be stored in an array. now whenever it gets code for keyboard input, it provide input for that from array programatically. Please tell me alternate solution also if u have. Thanks.
comment on: http://stackoverflow.com/q/26339866
score: 0
type: Comment

http://stackoverflow.com/q/26321396
has answer: http://stackoverflow.com/a/26321446
tagged with: object
tagged with: oop
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41307967
has answer: http://stackoverflow.com/a/26321415
has answer: http://stackoverflow.com/a/26321423
has body: I have a created a class that creates an instance of an object public class EmployeeProfile { /////////INSTANCE VARIABLES///////// private static String fName; private static String lName; private static String email; private static String phone; ////////CONSTRUCTORS//////////// public EmployeeProfile() { } public EmployeeProfile(String firstName, String lastName, String emailAdd, String pNumber) { fName = firstName; lName = lastName; email = emailAdd; phone = pNumber; } } When I call the empty constructor and populate it myself with the methods I've created everything is fine. However when I call a new object with a new name using the second constructor and the parameters, they overwrite the data from the first object!! EmployeeProfile prof1 = new EmployeeProfile(); prof1.firstName("John"); prof1.lastName("Doe"); prof1.email("johndoe@yahoo.com"); prof1.phone("555-555-5555"); EmployeeProfile prof2 = new EmployeeProfile("Jane", "Doe", "janedoe@yahoo.com", "555-123-4567"); System.out.println(prof1.getProfile()); System.out.println(prof2.getProfile()); When I run this prof1 and prof2 both return the data from prof2. What am I doing wrong here?
has answer: http://stackoverflow.com/a/26338584
score: 0
has title: Different objects with the same data java
answer count: 4
has comment: http://stackoverflow.com/comment/41307942
type: UnansweredQuestion

http://stackoverflow.com/comment/41348231
type: QuestionComment
has text: Yes, only if these 3 are same
comment on: http://stackoverflow.com/q/26343140
score: 0
type: Comment

http://stackoverflow.com/q/26199139
has title: Java Math.random not random in while loop
accepted answer: http://stackoverflow.com/a/26199152
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/19162331
favorite count: 0
has body: I am running the following code to get random (x, y) coordinate pairs. However, I only get the same pair over and over again. int counter=0; while(counter&lt;20){ x3=(int)Math.random()*831+50; y3=(int)Math.random()*381+50; canvas.setColor(Color.white); canvas.drawString("*", x3, y3); counter++; } I am very new to Java, so please tell me a simple way I could fix this. Thank you!
tagged with: random
tagged with: while-loop
has answer: http://stackoverflow.com/a/26199152
duplicate of: http://stackoverflow.com/q/19162331

http://stackoverflow.com/comment/41370794
comment on: http://stackoverflow.com/a/26340287
has text: As I suspect this to be homework, I did not want to provide ready-to-use code. One has to use `remove(String)`.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26339339
has title: Spring Batch for processing large CSV file
has comment: http://stackoverflow.com/comment/41346380
tagged with: java
tagged with: inputstream
score: 0
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/41341642
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/41342246
answer count: 0
type: UnansweredQuestion
has body: I have a 5gb CSV file that I am trying to process with Spring Batch (read, process, write to db). What is the best way to go about this keeping in mind that I have requirements to not use any XML config, to NOT split the file into smaller files, and all records must be processed in order? Does Spring Batch have the ability to process and write data while it is being streamed from the source? Is there any way to tell Spring Batch to read X lines from the file, process, and write (commit) and then grab the next X lines from the file while keeping track of which lines it has already processed?
tagged with: spring
has comment: http://stackoverflow.com/comment/41342033
type: Question
has comment: http://stackoverflow.com/comment/41343120

http://stackoverflow.com/q/26216792
tagged with: jetty
type: AnsweredQuestion
tagged with: jndi
tagged with: java
type: Question
score: 2
has answer: http://stackoverflow.com/a/26223259
answer count: 1
downvote count: 0
tagged with: embedded-jetty
has body: I'm using Jetty 9.2 (embedded) with the standard MySQL connector API and I'm very confused by how this is supposed to be setup. Currently, I have this in my web.xml file: <webapp ... JDBC Data Source jdbc/DataSource javax.sql.DataSource Container </webapp> ...and this in my jetty-env.xml: jdbc/DataSource jdbc:mysql://localhost:3306/DBName user pass ...and this code to initialize: Context envCtx = (Context) new InitialContext().lookup("java:comp/env"); DataSource datasource = (DataSource) envCtx.lookup("jdbc/DataSource"); When I try to fire up the server, I get the error javax.naming.NameNotFoundException; remaining name 'jdbc/DataSource'. I've tried lots of different variations of the strings in the code initialization, like removing the lookup call on the InitialContext object, but I just keep getting variations of the same error with a different name value; Both of the xml files are located in my /WAR/WEB-INF directory. I've looked at loads of previous questions and tutorials, blogs etc. but I'm getting nowhere.
has comment: http://stackoverflow.com/comment/41119240
accepted answer: http://stackoverflow.com/a/26223259
has comment: http://stackoverflow.com/comment/41127324
has title: JNDI lookup failing with Jetty for JDBC connection pooling with MySQL?
tagged with: jdbc
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/26307760
favorite count: 0
tagged with: jdbc
type: AnsweredQuestion
score: 77
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26313288
has comment: http://stackoverflow.com/comment/93482454
tagged with: java
has comment: http://stackoverflow.com/comment/41283304
tagged with: mysql
has title: MySQL and JDBC with rewriteBatchedStatements=true
upvote count: 78
tagged with: sql
has body: I've been reading around, here, here and here about the advantages of using rewriteBatchedStatements=true If I understood it right, with rewriteBatchedStatements=true the JDBC will pack as many queries as possible into a single network packet, lowering this way the network overhead. Am I right? Then it comes into my attention that the value defined in the MySQL server for the max_allowed_packet may cause problems with the queries (queries not being executed on the server). So my second question is, does JDBC knows the value assigned to max_allowed_packet and therefore make the packet smaller than the defined value for max_allowed_packet or that is something that the developer has to take in consideration? If I understood something wrong, please let me know as well.
answer count: 1
accepted answer: http://stackoverflow.com/a/26313288

http://stackoverflow.com/comment/41198400
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26261569
has text: Could you give me a link or a brief explanation of how could I use the JSON here? I know what JSON is, since I worked with it. But it confused me now, as I don't know how could I display that XML on my App using JSON.

http://stackoverflow.com/q/26202271
type: Question
possible better answer: http://stackoverflow.com/a/26206932
has comment: http://stackoverflow.com/comment/41088262
has answer: http://stackoverflow.com/a/26248295
has answer: http://stackoverflow.com/a/26202349
accepted answer: http://stackoverflow.com/a/26248295
downvote count: 0
tagged with: cmd
linked to: http://stackoverflow.com/q/12173294
favorite count: 0
has body: I am creating a code editor for Java source files by using Java. When I click on the RUN menu, it perfectly opens cmd and run javac command, but the problem is that it immediately gets closed and I want something like pause. This is my code: Runtime rt = Runtime.getRuntime(); try { rt.exec("cmd.exe /c start java Maq"); } catch (IOException e1) { e1.printStackTrace(); } How to get rid of this problem?
has answer: http://stackoverflow.com/a/26206932
upvote count: 2
linked to: http://stackoverflow.com/q/15464111
has answer: http://stackoverflow.com/a/26202654
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41088574
score: 2
has title: cmd open and close immediately while opening java
tagged with: java

http://stackoverflow.com/comment/41223765
score: 0
type: AnswerComment
has text: @Dan, Also remove table from the query.
type: Comment
comment on: http://stackoverflow.com/a/26274756

http://stackoverflow.com/comment/41259787
type: QuestionComment
type: Comment
score: 1
has text: `MessageTag.setHtmlEscape(Ljava/lang/String;)` means `setHtmlEscape(String arg)`. spring-webmvc-4.x doesn't have that method, earlier versions of spring-mvc had that method and the method signature was changed to `setHtmlEscape(boolean arg)` in v4.x. Which means, you do have a transitive dependency to an older version of spring-mvc.
comment on: http://stackoverflow.com/q/26294212

http://stackoverflow.com/q/26204217
answer count: 1
has title: Application Not Installed, packages are different
accepted answer: http://stackoverflow.com/a/26204234
tagged with: android
tagged with: apk
type: AnsweredQuestion
tagged with: java
has body: I have created an app, that actualy another app, just changed a little bit by me. When I trying to install it system thinks, that this is the same app, and i get an error "Application Not Installed. An existing package by the same name with a conflicting signature is already installed" The package have a different names.
has answer: http://stackoverflow.com/a/26204234
type: Question
score: 0

http://stackoverflow.com/comment/41201871
type: Comment
comment on: http://stackoverflow.com/a/26263420
has text: if your app is associated to the pdf then you will implement something like this http://stackoverflow.com/questions/10299839/how-to-read-pdf-in-my-android-application
score: 0
type: AnswerComment

front-camera
tag name: front-camera
tags question: http://stackoverflow.com/q/26202403
type: Tag

http://stackoverflow.com/comment/41097887
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26207441
has text: you end multiple times but begin only once, also you are using the deprecated fixed function pipeline, instead your should use the shader and buffer based 3.0 functions

http://stackoverflow.com/comment/41321770
has text: A constructor for Circle would be named `Circle`. Since you didn't explicitly declare one, the compiler created one, with no arguments. That's what would be used for all the `super` calls above, since there is no "better" fit.
comment on: http://stackoverflow.com/q/26328856
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41081473
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26196864
type: Comment
has text: It is partially untested code, so may need some correction. You can see if the logs has any error output and add `console.log('text')` statements to see what happens. Additionally, if either of the two queries does not find any results, for whatever reason, no push notification is sent. So a additional debug step could be to remove `where : query` to send the notification to everyone, just to make sure that the code reaches that point at least.

http://stackoverflow.com/q/26216512
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/41114645
has comment: http://stackoverflow.com/comment/41115242
has comment: http://stackoverflow.com/comment/41115449
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: vaadin
has body: I am currently working on a small addresstable with vaadin, just to get to know vaadin a little. I have run into a problem, where I want to sort the entries of my table manually. The problem is, that I get a NullPointerException when i try to do this: item.getItemProperty(Columns.NAME).getValue() I have tried a few things here. I checked item and item isn't null, neither is item.getItemProperty(Columns.NAME) null. So when I try to make an if I still get a NullPointerException if(item.getItemProperty(Columns.NAME).getValue() == null){} The value is null and I understand that, but I want to give this value to an other item and I have no idea how to. SEVERE: Servlet.service() for servlet [com.example.addresstable.AddresstableUI$Servlet] in context with path [/Addresstable] threw exception [com.vaadin.server.ServiceException: java.lang.NullPointerException] with root cause java.lang.NullPointerException at com.vaadin.data.util.IndexedContainer$IndexedContainerProperty.getValue(IndexedContainer.java:898) at com.example.addresstable.AddressTable.addAddressToTable(AddressTable.java:114) at com.example.addresstable.AddresstableUI.init(AddresstableUI.java:26) at com.vaadin.ui.UI.doInit(UI.java:639) at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:222) at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:74) at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1402) at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:305) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.A…
has comment: http://stackoverflow.com/comment/41114639
has comment: http://stackoverflow.com/comment/41114695
type: Question
has comment: http://stackoverflow.com/comment/41114899
has comment: http://stackoverflow.com/comment/41114706
has comment: http://stackoverflow.com/comment/41114803
answer count: 1
has comment: http://stackoverflow.com/comment/41114832
has comment: http://stackoverflow.com/comment/41115410
has comment: http://stackoverflow.com/comment/41115052
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41114831
linked to: http://stackoverflow.com/q/26164040
upvote count: 1
has title: NullPointerException unstoppable
has answer: http://stackoverflow.com/a/26217248
accepted answer: http://stackoverflow.com/a/26217248

http://stackoverflow.com/comment/86076109
has text: `Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused: connect] at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.jav1a:136) at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:205) at javax.naming.InitialContext.lookup(InitialContext.java:417) at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1955)`
type: Comment
comment on: http://stackoverflow.com/a/29424088
score: 0
type: AnswerComment

http://stackoverflow.com/q/26238771
has body: I want to create a PDF using pdfbox (https://pdfbox.apache.org/cookbook/documentcreation.html). However, pdfbox does not seem to provide dynamic text layout mechanisms like those a text editor like OpenOffice provides (automatic text flow using predefined text formattings like block format, centered text, line breaks etc.). Is there any Java library that provides that functionality on top of pdfbox or separate from it? Or do you have any free code available?
tagged with: java
has answer: http://stackoverflow.com/a/36709805
accepted answer: http://stackoverflow.com/a/36709805
has title: pdfbox for pdf creation: how to do the text layout?
tagged with: pdfbox
possible better answer: http://stackoverflow.com/a/41584087
type: Question
has comment: http://stackoverflow.com/comment/41156631
has answer: http://stackoverflow.com/a/41584087
score: 0
answer count: 3
tagged with: pdf-generation
has comment: http://stackoverflow.com/comment/41160624
has comment: http://stackoverflow.com/comment/41190272
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26263414

http://stackoverflow.com/comment/41325698
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26292124
type: AnswerComment
has text: No. Even if I use c:out its working. But I would like to know does it add any advantage?

http://stackoverflow.com/q/26326193
has body: I have these in my applications modules build.gradle compile 'com.squareup.dagger:dagger:1.2.2' compile 'com.squareup.dagger:dagger-compiler:1.2.2' When I try to build i get the exception above ( https://i.sstatic.net/Bwmzo.png ) If i don't include the compiler i get: Module adapter for class ....AndroidModule could not be loaded. Please ensure that code generation was run for this module. Why am i getting this exception and how should resolve it? I am using Android Studio.
answer count: 1
favorite count: 0
upvote count: 3
tagged with: android
tagged with: butterknife
has comment: http://stackoverflow.com/comment/41316603
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26326712
score: 3
tagged with: java
has title: Multiple dex files define Lcom/squareup/javawriter/JavaWriter$Scope; while trying to compile with Dagger and dagger-compiler
tagged with: dagger
type: Question

http://stackoverflow.com/q/26213114
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26213942
has comment: http://stackoverflow.com/comment/41109034
tagged with: java
has answer: http://stackoverflow.com/a/26213939
type: Question
answer count: 2
has body: I'd like to print the version of the OSGi bundle. class Production { public Production() { System.out.println("Version:" + OSGI.getMyVersion()); } } Is that possible?
has comment: http://stackoverflow.com/comment/41109327
has comment: http://stackoverflow.com/comment/41108549
has comment: http://stackoverflow.com/comment/41109424
score: 0
tagged with: osgi
tagged with: version
has title: How do I get the version fo an OSGi component from within itself?

http://stackoverflow.com/comment/41144214
has text: Related, for the [display precision](http://stackoverflow.com/q/26092469/3747990)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26231788

http://stackoverflow.com/comment/41116428
type: Comment
has text: sqlfiddle is fun too
score: 1
comment on: http://stackoverflow.com/q/26217177
type: QuestionComment

http://stackoverflow.com/a/26207284
accepted answer of: http://stackoverflow.com/q/26207255
answers question: http://stackoverflow.com/q/26207255
type: Answer
upvote count: 1
downvote count: 1
score: 0
has body: Just make the last three parts as optional by adding it into a non-capturing group. ^/(pp|ppuu)(?:/dc)?(?:/(phxd|slcw|lvsr))?(?:/y[0-9]+)?$ DEMO (?:..) called non-capturing group. ? after the non-capturing group makes the corresponding group as optional.
type: AcceptedAnswer

http://stackoverflow.com/q/26225714
type: Question
upvote count: 2
tagged with: android-layout
linked to: http://stackoverflow.com/q/13379512
has comment: http://stackoverflow.com/comment/95218565
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/41133164
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/90655073
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41134077
tagged with: java
has title: NullPointerException - at android.widget.CalendarView.onScroll
has body: I unfortunately encountered a nullpoint exception error occurred while trying to load my application, and below is the log cat message. It essentially occurs when the user clicks on the btnCalendar or iCalendar. 10-06 20:08:05.155: E/AndroidRuntime(1501): FATAL EXCEPTION: main 10-06 20:08:05.155: E/AndroidRuntime(1501): java.lang.NullPointerException 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.CalendarView.onScroll(CalendarView.java:1214) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.CalendarView.access$900(CalendarView.java:76) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.CalendarView$2.onScroll(CalendarView.java:1075) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1340) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.ListView.layoutChildren(ListView.java:1762) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.AbsListView.onLayout(AbsListView.java:2012) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.view.View.layout(View.java:14289) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.view.ViewGroup.layout(ViewGroup.java:4562) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.view.View.layout(View.java:14289) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.view.ViewGroup.layout(ViewGroup.java:4562) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.view.View.layout(View.java:14289) 10-06 20:08:05.155: E/AndroidRuntime(1501): at android.view.ViewGroup.layout(ViewG…
has comment: http://stackoverflow.com/comment/41133837

http://stackoverflow.com/q/26346305
has comment: http://stackoverflow.com/comment/41354394
tagged with: pointers
has answer: http://stackoverflow.com/a/26346326
tagged with: nullpointerexception
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26346394
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41353909
downvote count: 0
score: 1
tagged with: java
has body: Please help me figure out the null pointer exception. I am not able to understand which variable or object is null.and hoe do i fix it ? package coll.org; import java.util.ArrayList; import java.util.Hashtable; import java.util.Scanner; public class SnakeAndladder1 { ArrayList&lt;String&gt; name1=new ArrayList&lt;String&gt;(); //an array to store players names public int throwdice() //to calculate the dice value { return (int)(Math.random()*6)+1; } public int ladder(int curscore) { Hashtable ld = new Hashtable(); ld.put(15,30); ld.put(45,71); ld.put(25,62); ld.put(81,91); ld.put(9,39); Object v=ld.get(curscore); return (int)v; } public int snake(int curscore) { Hashtable ld = new Hashtable(); ld.put(29,11); ld.put(81,48); ld.put(30,6); ld.put(92,71); ld.put(58,19); Object v=ld.get(curscore); return (int)v; } public boolean Game (String name1){ int score=0; String name; int v=0; name=name1.toString(); System.out.println("Click y to roll dice"); Scanner in2=new Scanner(System.in); String yes=in2.nextLine(); if(yes.equalsIgnoreCase("y")) { v=throwdice(); System.out.println("dice value:"+v); } score=score+v; if(score==100) { System.out.println("User:"+name+"got"+v+".Winner!!!"); return false; } if (score&gt;100) { score=score-v; System.out.println("Current score of"+name+"is"+score); return true; } int s1=ladder(score); if(s1==score) { score=snake(score); System.out.println("Current score of"+name+"is"+score); return true; } else { score=s1; System.out.println("Current score of"+name+"is"+score); return true; } } public static void main(String[] args) { // TODO Auto-generated method stub int l=0; boolean flag=true; System.out.println("Enter the number of players:"); Scanner in=new Scanner(System.in); int n=in.nextInt(); System.out.println("Enter Players names in order:"); ArrayList&lt;String&gt; name1=new ArrayList&lt;String&gt;(); //an array to store players names for (int i=0;i&lt;n;i++) { Scanner in1=new Scanner(System.in); String name2=in1.nextLine(); name1.add(name…
has answer: http://stackoverflow.com/a/26346346
type: Question
has title: Cant figure out the null pointer exception
tagged with: null

http://stackoverflow.com/a/26302658
has comment: http://stackoverflow.com/comment/41273880
type: Answer
answers question: http://stackoverflow.com/q/26302613
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41273810
has comment: http://stackoverflow.com/comment/41273867
has comment: http://stackoverflow.com/comment/41273937
has comment: http://stackoverflow.com/comment/41273836
upvote count: 2
has body: Get rid of @JsonRootName(value="games") That annotation identifies the annotated type as the target for the JSON object mapped to a JSON key named "games". In your case, that is a JSON array. An array cannot be deserialized into your GameJson class. As you stated in the comments, you also need to remove the configuration that enables @JsonRootName. mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
has comment: http://stackoverflow.com/comment/41273767
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26302613

http://stackoverflow.com/comment/133804121
comment on: http://stackoverflow.com/a/29251654
type: Comment
score: 0
has text: This link is expired / points to a shady URL
type: AnswerComment

http://stackoverflow.com/comment/41184250
has text: So how can we get actual width and height of image
type: AnswerComment
comment on: http://stackoverflow.com/a/26253856
score: 0
type: Comment

http://stackoverflow.com/comment/41092714
score: 0
has text: Render method is called from render thread that runs in a background.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26202716

http://stackoverflow.com/a/26298317
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41265629
type: Answer
accepted answer of: http://stackoverflow.com/q/26298161
score: 1
upvote count: 1
has body: Firstly, you do not actually println your roll result ever. So to get that basic output, you can change the last 3 lines of your main() method to the following: int firstRoll = firstDie.roll(); int secondRoll = secondDie.roll(); System.out.println("First die roll results:" + firstRoll); System.out.println("Second die roll results:" + secondRoll); This should at least get you to show the two dice rolls.
answers question: http://stackoverflow.com/q/26298161

http://stackoverflow.com/a/26404193
answers question: http://stackoverflow.com/q/26245884
type: Answer
has body: Ok I have come up with an answer to my own question and I would just like to post it here in case anyone can benefit from it or has anything to add to it because that's what this community is for. public class Prog { // static variables --------------------------------------------------- static Connection conn; static ResultSet row; // main --------------------------------------------------------------- public static void main(String[] args) { // connect to db --------------------------------------------------- try { DBConnect cl_conn = new DBConnect(); conn = cl_conn.f_connect(); } catch(Exception log) { System.out.println("FAIL") } // prepare statements ---------------------------------------------- SQLPrep prep = new SQLPrep(conn); // execute statement 01 -------------------------------------------- try { prep.users_sel.setInt(1, 2); // pass values to stmnt row = prep.users_sel.executeQuery(); // execute stmnt } catch(SQLException log) { System.out.println("FAIL"); } } } class DBConnect { ***code to connect to db*** } // all prepared stmnts in one place ---------------------------------------- class SQLPrep { static PreparedStatement users_sel = null; // select from users static PreparedStatement access_sel = null; // select from access try { sp_sql = "SELECT * FROM USERS WHERE u_id = ?"; users_sel = conn.prepareStatement(sp_sql); sp_sql = "SELECT * FROM ACCESS WHERE a_id = ?"; access_sel = conn.prepareStatement(sp_sql); } catch(SQLException log) { System.out.println("FAIL"); } } This may look strange to some people but I find this to be a very clean and tidy way of structuring code (keeping as much code out of the main as possible). Even the block where the statement is executed can be moved into a separate function and would only need to be passed 'prep.users_prep' to work.
accepted answer of: http://stackoverflow.com/q/26245884
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26333027
has answer: http://stackoverflow.com/a/26333120
has body: I am trying to store user input into ArrayList of ArrayList. ArrayList&lt;ArrayList&lt;Integer&gt;&gt; a = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); For example, storing it as [[1,2,3],[4,5],[6,1,8]] Below is my code, Scanner input = new Scanner(System.in); System.out.println("Enter a set of numbers:"); String line = input.nextLine(); String[] numbers = line.split(" +"); ArrayList&lt;ArrayList&lt;Integer&gt;&gt; a = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); ArrayList&lt;Integer&gt; a1 = new ArrayList&lt;Integer&gt;(); for(int i=0; i&lt;numbers.length; i++) { a1.add(new Integer(numbers[i])); } a.add(a1); But then when I types it in to terminal, it becomes [[1,2,3,4,5,6,1,8]]. Thank you in advance!
has comment: http://stackoverflow.com/comment/41329821
has comment: http://stackoverflow.com/comment/41329675
has comment: http://stackoverflow.com/comment/41329744
has comment: http://stackoverflow.com/comment/41329772
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26333225
has comment: http://stackoverflow.com/comment/41330004
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26333136
answer count: 5
has answer: http://stackoverflow.com/a/26333123
has answer: http://stackoverflow.com/a/26333136
has comment: http://stackoverflow.com/comment/41329699
has comment: http://stackoverflow.com/comment/41329775
type: Question
has title: Java ArrayList of ArrayList Scanner UserInput
accepted answer: http://stackoverflow.com/a/26333225
tagged with: java
has answer: http://stackoverflow.com/a/26333146
has comment: http://stackoverflow.com/comment/41329696

web-applications
tags question: http://stackoverflow.com/q/26331279
tags question: http://stackoverflow.com/q/26229058
tags question: http://stackoverflow.com/q/26260301
tag name: web-applications
tags question: http://stackoverflow.com/q/26339052
type: Tag
tags question: http://stackoverflow.com/q/26218631

http://stackoverflow.com/q/26205820
type: Question
has comment: http://stackoverflow.com/comment/51590964
tagged with: single-table-inheritance
has title: Hibernate inheritance table per class and single table mix
answer count: 2
has answer: http://stackoverflow.com/a/26250869
has body: I am developing online web shop, and I need help with Hibernate mapping. I have the following inheritance: BaseProduct / \ Guitar Drum / \ / \ AcGuitar ElGuitar AcDrum ElectricDrum What I want: 1)Common fields such as id, name, description will be in @MappedSuperclass BaseProduct. 2)Musical instrument types (Guitar, Drum) will have common fields for these types of instruments. 3)At the end, concrete classes AvGuitar, ElGuitar etc will have unique properties for this concrete instruments. The most problem is that I want that there will be two tables for two types of instruments: t_guitar and t_drum (InheritanceType.TABLE_PER_CLASS), and for concrete classes one table InheritanceType.SINGLE_TABLE, which means there will be one table for acoustic and electric guitar and one table for acoustic and electric drums with corresponding discriminant column. How can I achieve that? Thanks! Update 1 As I need to interact with the whole hierarchy as one general type and map products to another entities, I did the following: @MappedSuperclass public abstract class BaseProduct { //supercclass @Id @GeneratedValue(strategy = GenerationType.TABLE) private Long id; private String title; // etc } And medium class Product: @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class Product extends BaseProduct { } So, with this solutions any mixes unfortunately still don't work.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26230966
tagged with: table-per-subclass
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/92295272
type: Comment
comment on: http://stackoverflow.com/a/26328555
score: 0
type: AnswerComment
has text: @Brian Goetz I have since moderated my views, but I was probably overreacting to a lot of very bad use of Optional on my last project. I would now say that getters should return Optional only when the value might actually be null. The suggestion that it's intended "to help design better APIs" (from an Oracle page) has led to people putting Optional in their input parameters, and returning Optional where the value is never null. I've also seen how its misuse has led to bugs. Also, your functional-programming example was the only one I had found where Optional was clearly useful.

http://stackoverflow.com/comment/41222257
comment on: http://stackoverflow.com/q/26274624
score: 0
type: QuestionComment
has text: check this http://stackoverflow.com/questions/7220681/division-of-integers-in-java
type: Comment

http://stackoverflow.com/comment/41313455
type: Comment
comment on: http://stackoverflow.com/a/26324440
has text: @Dan Come to think of it, the latter won't work, since the code that follows the `throw new ...` will become unreachable. Edited answer.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26224351
upvote count: 1
has comment: http://stackoverflow.com/comment/41130218
has comment: http://stackoverflow.com/comment/41130309
type: Answer
has comment: http://stackoverflow.com/comment/41130261
has body: The cpt variable needs to be volatile to prevent threads from caching its value: private static volatile int cpt = 5; And you also need to synchronize the method: public synchronized void decrement() { if(cpt &gt; 0) cpt--; } }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26224289
has comment: http://stackoverflow.com/comment/41130304

http://stackoverflow.com/a/26451105
has comment: http://stackoverflow.com/comment/107807933
has body: In case someone stumbles on the same problem here is the solution using Apples common crypto layer (no openSSL). https://github.com/ateska/ios-csr No need for several weeks of coding just a simple include. SCCSR *sccsr = [[SCCSR alloc] init]; sccsr.commonName = @"some name"; sccsr.organizationName = @"some organisation"; // // aditional data you can set // sccsr.countryName = @""; // sccsr.organizationalUnitName = @""; // sccsr.subjectDER = nil; // // // NSData *certificateRequest = [sccsr build:pPublicKey privateKey:privateKey]; NSString *str = [certificateRequest base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; NSString *strCertificateRequest = @"-----BEGIN CERTIFICATE REQUEST-----\n"; strCertificateRequest = [strCertificateRequest stringByAppendingString:str]; strCertificateRequest = [strCertificateRequest stringByAppendingString:@"\n-----END CERTIFICATE REQUEST-----\n"]; SCCSR.h -> DOWNLOADED FROM PROVIDED LINK
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26287514
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/26287514

http://stackoverflow.com/comment/41134929
type: QuestionComment
comment on: http://stackoverflow.com/q/26226688
score: 0
has text: do you mean can you convert the contents of `byte[1000]` to an `int`?
type: Comment

http://stackoverflow.com/comment/41159850
has text: Could one of the answers to [this question](http://stackoverflow.com/questions/21006565/cant-use-classes-from-different-maven-modules) help?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26225836
type: QuestionComment

http://stackoverflow.com/comment/41267482
has text: have you debugged your java code?
comment on: http://stackoverflow.com/q/26299298
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/26206663
has comment: http://stackoverflow.com/comment/41206452
score: 2
downvote count: 0
has body: You have two methods public static &lt;T,R&gt; Function&lt;T,R&gt; unchecked(CheckedFunction&lt;T,R&gt; func) public static &lt;T&gt; ToLongFunction&lt;T&gt; unchecked(CheckedToLongFunction&lt;T&gt; func) Each have a parameter of a functional interface type. @FunctionalInterface public static interface CheckedFunction&lt;U, R&gt; { R apply(U value) throws Exception; } @FunctionalInterface public static interface CheckedToLongFunction&lt;T&gt; { long apply(T i) throws Exception; } The implicitly typed lambda expression a -&gt; a can be applied to either of those, given the proper context. However, that context does not seem to be checked when doing overload resolution. So although the a -&gt; a in bar(unchecked(a -&gt; a)); // Should be OK, but receive could not be converted to a CheckedToLongFunction instance (since a type argument of Long could not be inferred from that invocation context), the lambda is still applicable to the functional type. The compiler simply can't determine if it should convert the a -&gt; a to a CheckedToLongFunction or to a CheckedFunction. As both are applicable, the invocation is ambiguous. The invocation context (and return types) aren't checked to resolve the ambiguity. In this case, however, bar(unchecked((Object a) -&gt; a)); // OK we have an explicitly typed lambda expression. The lambda body resolves to an return value of type Object, which does not fit the requirements of CheckedToLongFunction#apply(..) method, ie. an expression of type Object cannot be implicitly converted to an expression of type long. Therefore, and since there's one other applicable method, that one is chosen.
has comment: http://stackoverflow.com/comment/41207676
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26203943

http://stackoverflow.com/q/26327827
score: 0
answer count: 2
has body: i am working on servlet when i trying the below code it produce NumberFormatException,i have initialize all the variable but when i click the button it assign null value in variable which cause the Exeption public class page1 extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); int q=0,mq=0,umq=0; String qno="0"; if(request.getParameter("Bt")!=null) { qno=request.getParameter("Bt"); q=Integer.parseInt(qno); } if(request.getParameter("markBt")!=null) { qno=request.getParameter("markBt"); q=Integer.parseInt(qno); mq=q; q++; } if(request.getParameter("unmarkBt")!=null) { qno=request.getParameter("unmarkBt"); q=Integer.parseInt(qno); umq=q; } if(request.getParameter("saveBt")!=null) { qno=request.getParameter("saveBt"); q=Integer.parseInt(qno); mq=q; q++; } qno=""+q; try { out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" qno="+q+" "); out.println(" qno="+mq+" "); out.println(" qno="+umq+" "); out.println(" qno="+qno+" "); out.println(" "); out.println(" "); } finally { } } } what to do to pass the value of variable can anyone help please,thanks in advance
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26502142
tagged with: servlets
has comment: http://stackoverflow.com/comment/41320321
type: Question
has title: how to pass value of a variable using hidden button in servlet
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26329610

datetime
tags question: http://stackoverflow.com/q/26348140
tags question: http://stackoverflow.com/q/26214388
tags question: http://stackoverflow.com/q/26252960
tags question: http://stackoverflow.com/q/26270609
tags question: http://stackoverflow.com/q/26260186
tags question: http://stackoverflow.com/q/26273226
tags question: http://stackoverflow.com/q/26284022
tags question: http://stackoverflow.com/q/26257866
tag name: datetime
tags question: http://stackoverflow.com/q/26334644
tags question: http://stackoverflow.com/q/26328598
type: Tag
tags question: http://stackoverflow.com/q/26291271
tags question: http://stackoverflow.com/q/26344915
tags question: http://stackoverflow.com/q/26352609
tags question: http://stackoverflow.com/q/26310046
tags question: http://stackoverflow.com/q/26256311
tags question: http://stackoverflow.com/q/26263404

http://stackoverflow.com/comment/41142912
comment on: http://stackoverflow.com/a/26230388
type: Comment
score: 0
type: AnswerComment
has text: i have removed one word "love" from list. and i want to rebuild it to real form without word "love" . i have tried but i miss "." in my new sentence

http://stackoverflow.com/comment/41204854
type: Comment
type: QuestionComment
has text: matching characters count is 1 not 3 .....in siti and ali only i is common ,simply we can tell matching character is "i".........am i right????
comment on: http://stackoverflow.com/q/26252334
score: 0

http://stackoverflow.com/a/26273634
has comment: http://stackoverflow.com/comment/41220854
has body: in request there is already an instance of ObjectA if it is not null. So no new instance will be creared.
has comment: http://stackoverflow.com/comment/41221957
has comment: http://stackoverflow.com/comment/41220780
has comment: http://stackoverflow.com/comment/41221031
accepted answer of: http://stackoverflow.com/q/26273567
has comment: http://stackoverflow.com/comment/41221369
answers question: http://stackoverflow.com/q/26273567
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26200764
has body: You could extend Point and then use the translate(dx,dy) method to do what you wish, for ex: public class MyPixel extends Point{ //Your implementation of 'pixel' here } public class Bitmap{ private Vector&lt;MyPixel&gt; pixels; //Implement constructors public void rotate(int theta){ for(MyPixel p : pixels){ int dx; //Calculate those using theta - they are the change of the x and y coordinates of int dy; //The point p you will translate. p.translate(dx,dy); } } public static void main(String[] args){ Bitmap bmp = new Bitmap(); bmp.rotate(30); }
type: Answer
answers question: http://stackoverflow.com/q/26200371
score: 0
has comment: http://stackoverflow.com/comment/41085902
has comment: http://stackoverflow.com/comment/41086434
has comment: http://stackoverflow.com/comment/41086341
has comment: http://stackoverflow.com/comment/41085730
has comment: http://stackoverflow.com/comment/41086406

http://stackoverflow.com/comment/41274977
type: Comment
has text: This is a lot of code for us to look through. @SotiriosDelimanolis suggestion of debugging the code is the best first step IMO
type: QuestionComment
comment on: http://stackoverflow.com/q/26303062
score: 0

http://stackoverflow.com/comment/41307588
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26321128
has text: This is the error message Exception in thread "main" java.lang.ClassCastException: lab7rain.RainFall cannot be cast to java.lang.Comparable at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:290) at java.util.ComparableTimSort.sort(ComparableTimSort.java:157) at java.util.ComparableTimSort.sort(ComparableTimSort.java:146) at java.util.Arrays.sort(Arrays.java:472) at lab7rain.Lab7rain.main(Lab7rain.java:46) Java Result: 1
score: 0

http://stackoverflow.com/q/26259268
accepted answer: http://stackoverflow.com/a/26259397
type: Question
tagged with: int
answer count: 2
downvote count: 0
has body: I need to convert a float to an int, as if the comma was removed. Example: 23.2343f -> 232343 private static int removeComma(float value) { for (int i = 0; ; i++) { if((value * (float)Math.pow(10, i)) % 1.0f == 0.0f) return (int)(value * Math.pow(10, i)); } } The problem is with rounding up of the number. For example if I pass 23000.2359f it becomes 23000236, because it rounded up the input to 23000.236.
favorite count: 0
has title: Java Float to "remove" comma
has comment: http://stackoverflow.com/comment/41195366
score: 2
possible better answer: http://stackoverflow.com/a/26259433
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26259433
has answer: http://stackoverflow.com/a/26259397
type: AnsweredQuestion

http://stackoverflow.com/q/26330724
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26330741
has comment: http://stackoverflow.com/comment/41325362
has answer: http://stackoverflow.com/a/26330741
type: Question
has title: Find substring between two strings
tagged with: java
has body: I have a string such as: file = "UserTemplate324.txt" I'd like to extract "324". How can I do this without any external libraries like Apache StringUtils?
answer count: 2
has answer: http://stackoverflow.com/a/26330845
accepted answer: http://stackoverflow.com/a/26330845
tagged with: string
score: 0
linked to: http://stackoverflow.com/q/2451650
has comment: http://stackoverflow.com/comment/41325349

http://stackoverflow.com/comment/47506639
type: Comment
comment on: http://stackoverflow.com/q/26267412
score: 0
type: QuestionComment
has text: possible duplicate of [ZipException: invalid distance too far back error when running app](http://stackoverflow.com/questions/16594307/zipexception-invalid-distance-too-far-back-error-when-running-app)

http://stackoverflow.com/q/26231165
has comment: http://stackoverflow.com/comment/41152575
upvote count: 1
type: Question
tagged with: performance
has answer: http://stackoverflow.com/a/26233308
has comment: http://stackoverflow.com/comment/41151125
has body: I have a spring-stand alone application which uses simple spring email code as below , the to and the message is constructed using the values iterated from map. I have already had some suggestions for the question here , but i am in need of some specific advise for this. below is my code for (Map.Entry&lt;String, List&lt;values&gt;&gt; entry : testMap .entrySet()) { String key = entry.getKey(); StringBuilder htmlBuilder = new StringBuilder(); List&lt;Model&gt; valueList = entry.getValue(); for (Model value : valueList) { htmlBuilder.append('List Values in the message'); } mail.sendMail( msgFrom,body); // call my sendMail function in another class } Code for sending mail : MimeMessage email = mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(email, true); helper.setFrom(new InternetAddress(from)); helper.setTo(new InternetAddress(to)); helper.setText(msg, true); helper.addInline("identifier1234", res); mailSender.send(email); It takes 3 to 4 seconds to send mail . I have large user list of around 400,000 each day to be sent Am i doing anything wrong or anyother approach to fasten this process. I am in need of experts advise Thanks for your time and help :)
answer count: 3
has title: Improve performance on sending bulk emails through spring-mail
tagged with: bulk
tagged with: email
downvote count: 0
linked to: http://stackoverflow.com/q/26037098
favorite count: 0
has comment: http://stackoverflow.com/comment/41152644
accepted answer: http://stackoverflow.com/a/26233308
possible better answer: http://stackoverflow.com/a/26231720
tagged with: spring
has answer: http://stackoverflow.com/a/26231265
has answer: http://stackoverflow.com/a/26231720
has comment: http://stackoverflow.com/comment/41152367
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/3905734

akka
type: Tag
tags question: http://stackoverflow.com/q/26336154
tags question: http://stackoverflow.com/q/26232382
tags question: http://stackoverflow.com/q/26319471
tags question: http://stackoverflow.com/q/26238816
tag name: akka
tags question: http://stackoverflow.com/q/26243347
tags question: http://stackoverflow.com/q/26232369
tags question: http://stackoverflow.com/q/26255802
tags question: http://stackoverflow.com/q/26234288

http://stackoverflow.com/comment/41181641
comment on: http://stackoverflow.com/a/26251702
type: AnswerComment
score: 0
type: Comment
has text: Can you explain me why you down vote my answer, does the corretted solution work?

http://stackoverflow.com/a/26194778
downvote count: 0
has comment: http://stackoverflow.com/comment/41077708
upvote count: 2
has body: hasNext() will return true the first time you call it (before ever calling next()), since the next element is the first element of the list, and your list has a single element. The first time you call itr.next(), it returns the first element of your list. cursor is the index of the next element to be returned by a call to next(): /** * Index of element to be returned by subsequent call to next. */ int cursor = 0; lastRet is the index of the last element that was returned (by the last call to next()): /** * Index of element returned by most recent call to next or * previous. Reset to -1 if this element is deleted by a call * to remove. */ int lastRet = -1;
has comment: http://stackoverflow.com/comment/41077611
answers question: http://stackoverflow.com/q/26194702
has comment: http://stackoverflow.com/comment/41091780
type: Answer
score: 2

http://stackoverflow.com/comment/41327603
type: QuestionComment
comment on: http://stackoverflow.com/q/26331823
has text: Have you install your usb driver's phone?
score: 0
type: Comment

http://stackoverflow.com/comment/41289543
comment on: http://stackoverflow.com/q/26311211
type: Comment
type: QuestionComment
has text: Refer to [this](http://stackoverflow.com/a/22387816/1777090) if helps.
score: 0

http://stackoverflow.com/comment/41091937
has text: what if I add `dog = null`?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26204274

http://stackoverflow.com/comment/41239504
comment on: http://stackoverflow.com/q/26279088
type: Comment
type: QuestionComment
has text: I am trying to achieve for the application for my employer. Through which we are reading the Jenkins directory location.
score: 0

http://stackoverflow.com/comment/62550359
comment on: http://stackoverflow.com/a/37529750
type: Comment
type: AnswerComment
has text: This solution is already posted by other answerers. Clarify what additional value ad your post is giving
score: 0

http://stackoverflow.com/a/26240558
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: For the Methods hasLuckyNumber(...) and hasSecondLuckyNumber(...) you have to return a boolean value, either true or false. Then inside main you have to change your implementation. public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Give me a number between 0 and 100 to win a prize. "); luckyNumber = sc.nextInt(); if(hasLuckyNumber(luckyNumber)) { System.out.println("Give me another number between 100 and 200."); secondLuckyNumber = sc.nextInt(); if(hasSecondLuckyNumber(secondLuckyNumber)) { System.out.println("We've got a winner!"); } else { System.out.println("Sad face"); } } else { System.out.println("Unfortunatly, no prize"); } } public static boolean hasSecondLuckyNumber(int secondLuckyNumber){ if (secondLuckyNumber &gt; 140 || secondLuckyNumber &lt; 175){ return false; } else{ return true; } } public static boolean hasLuckyNumber(int luckyNumber){ if (luckyNumber &gt; 20 &amp;&amp; luckyNumber &lt; 60) { return true; }else{ return false; } }
answers question: http://stackoverflow.com/q/26240250

http://stackoverflow.com/a/26312279
has comment: http://stackoverflow.com/comment/41291507
has body: The output is reasonable. Let's expand the two complicated lines into several separate statements. First snippet: // This... int val = (a = b)[3]; // Becomes... a = b; int val = a[3]; // 0 So printing a[val] will print a[0], which is now 2. The second snippet is more complicated. The tricksy bit is that "the array we're indexing into" is evaluated before the rest of the side-effects. So: // This... System.out.println(a[val = ((a = b)[3])]); // Becomes... int[] tmp = a; // So tmp is { 1, 2, 3, 4 } a = b; val = a[3]; // 0 System.out.println(tmp[val]); // 1 JLS section 15.10.4 goes into more detail about this. The important parts here are: At run time, evaluation of an array access expression behaves as follows: First, the array reference expression is evaluated. If this evaluation completes abruptly [...] evaluated. Otherwise, the index expression is evaluated. If this evaluation completes abruptly [...] Otherwise, if the value of the array reference expression is null [...] Otherwise, the value of the array reference expression indeed refers to an array. If the value of the index expression is less than zero [...] Otherwise, the result of the array access is the variable of type T, within the array, selected by the value of the index expression.
has comment: http://stackoverflow.com/comment/41291285
upvote count: 2
has comment: http://stackoverflow.com/comment/41291305
accepted answer of: http://stackoverflow.com/q/26312114
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41291362
answers question: http://stackoverflow.com/q/26312114
has comment: http://stackoverflow.com/comment/41291332
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41291290
has comment: http://stackoverflow.com/comment/41291262

http://stackoverflow.com/a/38685348
answers question: http://stackoverflow.com/q/26335464
score: 0
type: Answer
has body: One you can do that locate build folder in explorer and delete it. After that reopen android studio build it again and run it. Now every thing is fine.

http://stackoverflow.com/comment/41255593
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26287489
type: Comment
has text: When i created a game i used to choose the size with meters in my head. If i want to be able to see about 80m in x and 45m in y, i created a `camera` with a viewport of 80 and 45. Then i created the objects, again with meters in my head (a human f.e. had a size of 2 in y as it is about 2m tall). Is this the wrong way in your oppinion?

http://stackoverflow.com/q/26243900
type: AnsweredQuestion
has title: Why is SceneBuilder so particular about Custom Controls?
downvote count: 0
score: 1
tagged with: java
tagged with: scenebuilder
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/26247327
accepted answer: http://stackoverflow.com/a/26247327
has body: I was hoping someone would be able to explain to me exactly why SceneBuilder is so tempermental when it comes to importing custom controls. Take for example a relatively simple custom control (As only an example): public class HybridControl extends VBox{ final private Controller ctrlr; public CustomComboBox(){ this.ctrlr = this.Load(); } private Controller Load(){ final FXMLLoader loader = new FXMLLoader(); loader.setRoot(this); loader.setClassLoader(this.getClass().getClassLoader()); loader.setLocation(this.getClass().getResource("Hybrid.fxml")); try{ final Object root = loader.load(); assert root == this; } catch (IOException ex){ throw new IllegalStateException(ex); } final Controller ctrlr = loader.getController(); assert ctrlr != null; return ctrlr; } /*Custom Stuff Here*/ } And then you have the Controller class here: public class Controller implements Initializable{ /*FXML Variables Here*/ @Override public void initialize(URL location, ResourceBundle resources){ /*Initialization Stuff Here*/ } } This works just fine. The .jar compiles fine, SceneBuilder reads the .jar just fine, it imports the control just fine, which is great. The thing that irks me is that it requires two separate classes to accomplish, which is not THAT big of a deal except that I feel like this should be doable with just a single class. I have it as above now, but I've tried two other ways that both fail (SceneBuilder won't find and let me import the controls) and I was hoping someone would tell me why so I can get on with my life. In the second case I attempted a single class which extended a VBox and implemented Initializable: public class Hybrid extends VBox implements Initializable{ /*In this case the FXML file Controller would be set to this class.*/ /*FXML Variables Here*/ public Hybrid(){ this.Load(); } private void Load(){ final FXMLLoader loader = new FXMLLoader(); loader.setRoot(this); loader.setClassLoader(this.getClass().getClassLoader()); loader.setLocation(this.getClass().ge…
answer count: 1
tagged with: class
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/41324712
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26330335
has text: `test1.betyg(0, 0, 0, 0, 0, 0);` Change the `0`s to the numbers you want. Add this line after you create `test1`.
type: QuestionComment

http://stackoverflow.com/comment/41341008
score: 0
type: Comment
type: QuestionComment
has text: I need alphanumeric encrypted value only.
comment on: http://stackoverflow.com/q/26337960

http://stackoverflow.com/comment/41120382
has text: @Incredible because of aliens
comment on: http://stackoverflow.com/q/26219266
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26280810
type: Answer
has body: You are using a version of VLC that is incompatible with the version of vlcj that you are using. There are two methods in LibVLC to set media, one is for setting "local" file media, and the other is a "location" - essentially a URL: libvlc_media_new_location(instance, media); libvlc_media_new_path(instance, media); In earlier versions of VLC, it was possible to get away with just using one of these functions to set the media whether it was a local file based media or a URL. That one function, libvlc_media_new_path, would work for both types of media. That changed with a recent version of VLC (I do not recall specifically which version it was). At that time, because of this change in VLC, vlcj was changed to guess the type of media (file or URL) and call the appropriate LibVLC function. So, the solution is to use a compatible version of VLC/vlcj. The change in vlcj was version 2.2.0, but of course I would recommend you use the latest version of vlcj which at time of writing is 3.0.1.
accepted answer of: http://stackoverflow.com/q/26265865
answers question: http://stackoverflow.com/q/26265865
score: 0
type: AcceptedAnswer

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/26320431
type: Tag
tags question: http://stackoverflow.com/q/26325544

http://stackoverflow.com/comment/41413279
type: AnswerComment
has text: Then how do I find devices that are connected to the hot spot but don't show up in this?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26340671

http://stackoverflow.com/comment/41246007
has text: but num is same as double[] countryData
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26287003

http://stackoverflow.com/comment/41217598
has text: Thanks for the explanation, could be the reason why the issue only appears on the windows machine. Is there a way I can check that in an efficient way? I can also make available a demo file of the compressed files I try to decompress?
comment on: http://stackoverflow.com/q/26267412
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41249969
score: 1
comment on: http://stackoverflow.com/q/26289366
type: Comment
type: QuestionComment
has text: If you want to get character at some position from String then you can use its `charAt(index)` method. You can also get array of characters from your string with little help of `toCharArray()` method.

http://stackoverflow.com/comment/41131093
comment on: http://stackoverflow.com/a/26224698
score: 0
type: AnswerComment
has text: @TNT should I also change the code so that credit * 110 +50, and the other line = bill instead of having bill 1st?
type: Comment

http://stackoverflow.com/comment/41357127
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26348103
has text: "Something about calling setText from outside the thread that created it." is somewhat vague (and quite nearly useless) for someone of your experience level. You might consider posting a stack trace/log cat of the full error message.

http://stackoverflow.com/comment/41152737
has text: My main issue here is that "woot" could be "foo" or "bar", as unfortunately I have no control. This is for unit tests that are to be ran automatically, so the idea would be without having to go through and find all their static object names. For the vast majority, it's fine... but for some that keep static references (E.g, to System.in), this causes a big problem.
comment on: http://stackoverflow.com/a/26235213
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26297390
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/26244760
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: There currently is none. Feel free to open a ticket in the issue tracker.
answers question: http://stackoverflow.com/q/26244760

http://stackoverflow.com/a/26272364
has body: See https://netbeans.org/bugzilla/show_bug.cgi?id=233170 one comment recommends to use the bundled Maven version in NetBeans as a workaround.
answers question: http://stackoverflow.com/q/26272072
score: 0
type: Answer

http://stackoverflow.com/comment/41179865
score: 0
type: AnswerComment
has text: Thanks trashgod i learnt alot from that, by the way i am trying to change the hands(second, minute, hour) to images is tried but i didnt get it is there anyway you can point me to. thanks once again
type: Comment
comment on: http://stackoverflow.com/a/26213625

http://stackoverflow.com/q/26227911
has answer: http://stackoverflow.com/a/26479659
has title: JOscarLib - how to use?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26479659
type: Question
tagged with: icq
score: 0
answer count: 1
has body: How to use JOscarLib? I have to fix unworkable code with this lib, but I don't know, why I have some errors. I do this: connection = new OscarConnection(auth.getHost(), auth.getPort(), auth.getUsername(), auth.getPassword()); But get this: OscarLib.Core.JarClassLoader cacheClasses WARNING: Warning : No jar file found. Packet unmarshalling won't be possible. Please verify your classpath ... JOscarLib.Core.OscarPacketAnalyser handleService INFO: Received 1 - 3 ... JOscarLib.Core.OscarPacketAnalyser handleService INFO: Received 1 - 21 After this connection.isLogged == false with true username/password and host=login.icq.com and port=5190/443 By the way, does this library works today?

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/26324902
type: Tag
tags question: http://stackoverflow.com/q/26270200

http://stackoverflow.com/comment/41322862
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26329370
type: QuestionComment
has text: You only enter the `while` loop if `n > r`, so the `if (n < r)` condition will always be false. So you need to re-think your design, because even if you get rid of the compile error, it's still wrong.

http://stackoverflow.com/comment/41166395
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26243654
has text: BTW: using string.getBytes() is dangerous as it does not define what encoding to use. You better specify one (usually UTF-8) or use a Writer which can take a string directly (and specify the encoding in the writer).

http://stackoverflow.com/comment/41256022
score: 0
comment on: http://stackoverflow.com/q/26292825
type: Comment
type: QuestionComment
has text: in that case you can call your method in your `if` condition where they are initialized .

http://stackoverflow.com/comment/41338978
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26329559
has text: Just a variables that I defined that will scale the velocities according to screen size
score: 0

http://stackoverflow.com/a/26272338
accepted answer of: http://stackoverflow.com/q/26271846
upvote count: 2
type: Answer
has body: The parent class should contain only behavior that is common to all child classes. If what you are trying to implement in the parent class is indeed common behavior you might want to look in to the Template method pattern. If what you are implementing is different behavior over the child classes, do not try to shoehorn it into the parent class but implement it in the child classes. If these implementations share common parts, you could extract this to a common method either in the parent or a helper class.
score: 2
answers question: http://stackoverflow.com/q/26271846
type: AcceptedAnswer
downvote count: 0

jdbc
tags question: http://stackoverflow.com/q/26276099
tags question: http://stackoverflow.com/q/26242890
tags question: http://stackoverflow.com/q/26353680
tags question: http://stackoverflow.com/q/26337156
tags question: http://stackoverflow.com/q/26216792
tags question: http://stackoverflow.com/q/26295075
tags question: http://stackoverflow.com/q/26282857
tags question: http://stackoverflow.com/q/26343026
tags question: http://stackoverflow.com/q/26225720
tags question: http://stackoverflow.com/q/26257530
tags question: http://stackoverflow.com/q/26263186
tags question: http://stackoverflow.com/q/26300867
tags question: http://stackoverflow.com/q/26253448
tags question: http://stackoverflow.com/q/26256280
tags question: http://stackoverflow.com/q/26339155
type: Tag
tags question: http://stackoverflow.com/q/26289183
tags question: http://stackoverflow.com/q/26322025
tags question: http://stackoverflow.com/q/26350269
tags question: http://stackoverflow.com/q/26215809
tags question: http://stackoverflow.com/q/26324603
tags question: http://stackoverflow.com/q/26263211
tags question: http://stackoverflow.com/q/26198618
tags question: http://stackoverflow.com/q/26216684
tags question: http://stackoverflow.com/q/26270880
tags question: http://stackoverflow.com/q/26329155
tags question: http://stackoverflow.com/q/26307347
tags question: http://stackoverflow.com/q/26337300
tags question: http://stackoverflow.com/q/26225821
tags question: http://stackoverflow.com/q/26318780
tags question: http://stackoverflow.com/q/26299050
tags question: http://stackoverflow.com/q/26284945
tags question: http://stackoverflow.com/q/26259079
tags question: http://stackoverflow.com/q/26282738
tags question: http://stackoverflow.com/q/26249271
tags question: http://stackoverflow.com/q/26198654
tags question: http://stackoverflow.com/q/26269805
tags question: http://stackoverflow.com/q/26262017
tags question: http://stackoverflow.com/q/26348917
tags question: http://stackoverflow.com/q/26250141
tags question: http://stackoverflow.com/q/26280720
tags question: http://stackoverflow.com/q/26200476
tag name: jdbc
tags question: http://stackoverflow.com/q/26307760
tags question: http://stackoverflow.com/q/26310324
tags question: http://stackoverflow.com/q/26320123
tags question: http://stackoverflow.com/q/26230758
tags question: http://stackoverflow.com/q/26271469
tags question: http://stackoverflow.com/q/26253056
tags question: http://stackoverflow.com/q/26327816
tags question: http://stackoverflow.com/q/26195865
tags question: http://stackoverflow.com/q/26331524
tags question: http://stackoverflow.com/q/26259772
tags question: http://stackoverflow.com/q/26294006
tags question: http://stackoverflow.com/q/26327274
tags question: http://stackoverflow.com/q/26236028

http://stackoverflow.com/q/26198416
has title: Filter observableArrayList base on a ChoiceBox selection
tagged with: javafx-8
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26198529
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26198529
type: AnsweredQuestion
has body: I have a observableArrayList inflate with data from a DDBB. Each item of list has a Date property. I use a TableView to show observableArrayList data. datos = observableArrayList(); datos.addAll(new TablaDAO().obtenItems()); //Get all items without any filter (I show this by default) By default, users view all items, but I have a ChoiceBox where users can select a period (for example, last 30 days) and base on user's selection, the table only show rows which date is minor than 30 days. chFiltrar.getSelectionModel().selectedIndexProperty().addListener((ObservableValue&lt;? extends Number&gt; observable, Number oldValue, Number newValue) -&gt; { if (newValue.intValue() == 0) { //30 days //I need to show only items where date&lt;last 30 days } else if (newValue.intValue() == 2) { //All days //This option works well because I show all items } }); I find answers related to use FilteredList but most cases are to filter based on a keyword search no from a property.

http://stackoverflow.com/q/26211341
has answer: http://stackoverflow.com/a/27731169
upvote count: 2
type: UnansweredQuestion
has body: I want to get userAgent on Unity. platform is Android. But NoSuchMethodError why?? Im not good at english. sorry AndroidJavaClass unity = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); AndroidJavaObject context = unity.GetStatic&lt;AndroidJavaObject&gt;("currentActivity").Call&lt;AndroidJavaObject&gt;("getApplicationContext"); AndroidJavaObject webView = new AndroidJavaObject ("android/webkit/WebView", context); AndroidJavaObject webViewSetting = webView.Call&lt;AndroidJavaObject&gt; ("getSettings"); string userAgent = webViewSetting.Call&lt;string&gt;("getUserAgentString");
has comment: http://stackoverflow.com/comment/41105406
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41105491
has title: Unity AndroidJavaObject java.lang.NoSuchMethodError:
has comment: http://stackoverflow.com/comment/41105565
has comment: http://stackoverflow.com/comment/41105767
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41105595
tagged with: android
has comment: http://stackoverflow.com/comment/41105527
tagged with: unity-game-engine
score: 2

http://stackoverflow.com/comment/41277361
score: 0
comment on: http://stackoverflow.com/q/26304174
has text: Ya actually i have wrote the above code by my own. I want to convert it to display in a graph format. I really have no idea how to get it done. I read about jfreechart and stuff. But no idea about using it to draw a chart. If you are familiar with this please do help because i need this for my assignment due.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26300203
has body: Does exists any JAR which allow my JSF application: Connect with TFS url (like tfs.company.com.br\server); Pass destination directory and changeset as parameters; "Download" all sources from changeset in my destination directory; Important: we don't have any workItem, we just use TFS as repository. I've searched for it in Google, but I just have found jars for Jenkins which allows me to make a job for it. That's not exactly what I want.
has answer: http://stackoverflow.com/a/26335591
accepted answer: http://stackoverflow.com/a/26335591
linked to: http://stackoverflow.com/q/1827651
type: AnsweredQuestion
tagged with: tfs
has comment: http://stackoverflow.com/comment/41270438
type: Question
tagged with: changeset
tagged with: java
has title: Java - retrieve sources from changeset (Team Foundation Server 2010)
score: 0
has comment: http://stackoverflow.com/comment/41271519
answer count: 1

in-app-billing
tags question: http://stackoverflow.com/q/26319316
tag name: in-app-billing
type: Tag

http://stackoverflow.com/comment/41365717
has text: What you're doing seems good: capture the picture -> save it on disk. Now you need to display the image in an activity/fragment/dialog and ask the user if it's OK or not. If not -> delete the image from disk and come back to the MainActivity. PS: add a screenshot of the feature in Whatsapp, it will be clearer ;)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26352955
score: 0

http://stackoverflow.com/a/26310861
accepted answer of: http://stackoverflow.com/q/26291931
has comment: http://stackoverflow.com/comment/41364513
answers question: http://stackoverflow.com/q/26291931
upvote count: 2
has comment: http://stackoverflow.com/comment/41363149
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/41391907
has body: AbstractMessageTransformer already implements MuleContextAware, as you can see here: https://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transformer/AbstractMessageTransformer.html So you can remove support for it from your custom transformer and just use the muleContext protected field that comes from here: https://github.com/mulesoft/mule/blob/bfb3a17263d1e4b32ee10272cbf710a2bf41b16b/core/src/main/java/org/mule/transformer/AbstractTransformer.java#L58 EDIT: In fact, the correct way to do what you want to achieve is to Spring-inject blaze.services.address into HttpErrorResponseChecker from the Mule XML configuration, instead of looking it up programmatically like that.
type: Answer
has comment: http://stackoverflow.com/comment/41327165
score: 1
has comment: http://stackoverflow.com/comment/84505114

http://stackoverflow.com/q/26237484
tagged with: oracle-database
has answer: http://stackoverflow.com/a/26254837
possible better answer: http://stackoverflow.com/a/26279799
has answer: http://stackoverflow.com/a/26279799
has body: I installed the Oracle Linux 7 in to the VirtualBox. This is a standard installation, I did not configure anything. The virtual machine network is attached to Bridged Adapter. [root@localhost ~]# /etc/sysconfig/network-scripts/ifup ifcfg-enp0s3 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/0) [root@localhost ~]# ip addr 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:ad:4f:68 brd ff:ff:ff:ff:ff:ff inet 172.24.131.35/24 brd 172.24.131.255 scope global enp0s3 inet6 fe80::a00:27ff:fead:4f68/64 scope link valid_lft forever preferred_lft forever With winscp I copied the jboss-as-7 and the java to /usr/etc path. [root@localhost ~]# export JAVA_HOME="/usr/etc/jdk1.7.0_67" [root@localhost ~]# export PATH=$JAVA_HOME/bin:$PATH [root@localhost ~]# java -version -bash: /usr/etc/jdk1.7.0_67/bin/java: Permission denied [root@localhost ~]# chmod u+x /usr/etc/jdk1.7.0_67/bin/java [root@localhost ~]# java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) [root@localhost ~]# chmod u+x /usr/etc/jboss-as-7.1.1.Final/bin/standalone.sh [root@localhost ~]# /usr/etc/jboss-as-7.1.1.Final/bin/standalone.sh ... 08:46:30,919 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-2) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/MyExample' 08:46:32,269 INFO [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /MyExample 08:46:32,369 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "MyExample.war" After this, I tried to connect with my Host machine to the Guest server with this link http:// 172.24.131.35 : 8080/MyExample/ But it is not connect. What could be wrong? In the Linux or in the standalone.xml? Or my virtual machine installation in VirtualBox? The JBoss AS 7 is a standard install too. Here is the console l…
accepted answer: http://stackoverflow.com/a/26254837
has title: Connect to JBoss AS 7 on Oracle Linux 7 in VirtualBox
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: jboss
type: Question
tagged with: linux
answer count: 2

http://stackoverflow.com/a/26307895
score: 41
has comment: http://stackoverflow.com/comment/88918054
has comment: http://stackoverflow.com/comment/41311017
has comment: http://stackoverflow.com/comment/41348920
downvote count: 0
has comment: http://stackoverflow.com/comment/41389204
upvote count: 41
has comment: http://stackoverflow.com/comment/41310995
accepted answer of: http://stackoverflow.com/q/26304492
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/78375203
has body: Procyon and CFR both support Java 8 language features, including lambda expessions and method references.
has comment: http://stackoverflow.com/comment/59717805
answers question: http://stackoverflow.com/q/26304492
has comment: http://stackoverflow.com/comment/75011251
type: Answer

http://stackoverflow.com/q/26318474
tagged with: drag
type: Question
tagged with: mousemotionlistener
upvote count: 3
answer count: 3
has title: Moving a JFrame with custom title bar
has comment: http://stackoverflow.com/comment/41302524
has comment: http://stackoverflow.com/comment/41302505
has answer: http://stackoverflow.com/a/26320057
has comment: http://stackoverflow.com/comment/41302609
has comment: http://stackoverflow.com/comment/41302575
favorite count: 0
linked to: http://stackoverflow.com/q/24476496
has answer: http://stackoverflow.com/a/26320032
tagged with: jframe
has comment: http://stackoverflow.com/comment/41302432
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26318677
has comment: http://stackoverflow.com/comment/41302471
has comment: http://stackoverflow.com/comment/41307865
has body: How can I move a JFrame having a custom title bar? I remove the default title bar and I did my own design. This is how it looks like: I want to know how to drag a JFrame when the cursor is placed on the title bar only and not the whole frame. I've searched already and I have seen a lot of samples but I still don't get it. Do you guys have any simple code that I can understand? I haven't started the code yet since I don't know how to start it. All I know is that, it is about mouseDragged or MouseMotionListener.
score: 3
downvote count: 0
tagged with: java

http://stackoverflow.com/q/26229918
has body: While studying Item 23 of Effective Java 2nd Edition I decided to attempt instantiating an object with a constructor that has a raw collection with an argument list of mixed objects. I assumed the compiler would pick up that I was attempting to pass a raw type to the constructor. However, the compiler only provides an unchecked exception warning, "at the caller, not the callee." The class compiles fine, further supporting the statements by Josh Bloch not to use raw types in new code. The fact this compiles is a bit disturbing to me. Q? How can one ensure the type safety of a class prior to instantiating the object short of having to manually check for object validity in the constructor? The following only provided an unchecked assignment warning from "the caller... in main" How could one defensively program against this. public class RawType { private final Collection&lt;Example&gt; example; public RawType( Collection&lt;Example&gt; example ) { this.example = example; } public Collection&lt;Example&gt; getExample() { return example; } public static void main( String[] args ) { Collection unsafe = new ArrayList(); unsafe.add( new Example() ); unsafe.add( new Corruption() ); unsafe.add( new Example() ); RawType rawType = new RawType( unsafe ); // Corruption for(Object type : rawType.getExample()) { System.out.println(type.getClass().getName()); // Mixed Classes... } } static class Corruption {} static class Example{} }
has answer: http://stackoverflow.com/a/26230197
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26230197
downvote count: 0
score: 1
tagged with: java
tagged with: type-safety
has comment: http://stackoverflow.com/comment/41169681
has comment: http://stackoverflow.com/comment/41140645
type: Question
linked to: http://stackoverflow.com/q/25400690
possible better answer: http://stackoverflow.com/a/26230049
tagged with: raw-types
has comment: http://stackoverflow.com/comment/41169788
answer count: 2
has comment: http://stackoverflow.com/comment/43112107
upvote count: 1
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/26230049
has title: How To Ensure the Validity of Parameterized Types Prior to Object Instantiation
has comment: http://stackoverflow.com/comment/41170074

http://stackoverflow.com/comment/41148201
score: 0
has text: Just copy the SQLite file. That's it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26232515

http://stackoverflow.com/comment/41313274
comment on: http://stackoverflow.com/q/26322576
type: Comment
type: QuestionComment
has text: @laune Please see the edit. Thanks Kumar Shorav
score: 0

http://stackoverflow.com/a/26295428
score: 2
type: AcceptedAnswer
downvote count: 0
has body: When you call nodeBuffer.clear() you empty the list that you have just passed on to ways. You basically use the same nodeBuffer object over and over, and fill the ways list with a lot of references to the same object - which you empty each time. The way you should do it is create a new ArrayList object using new and assign it to nodeBuffer every time. You will then have separate objects, each containing the list of nodes parsed in the latest round.
accepted answer of: http://stackoverflow.com/q/26294985
type: Answer
answers question: http://stackoverflow.com/q/26294985
upvote count: 2

http://stackoverflow.com/comment/41336385
comment on: http://stackoverflow.com/a/26335155
type: AnswerComment
has text: i have given full access to the file. But no use. The error seems security manager prohibits the application to write into the external folder.
score: 0
type: Comment

http://stackoverflow.com/a/26479659
answers question: http://stackoverflow.com/q/26227911
has body: Finally I used icqlib library and it worked.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26227911

http://stackoverflow.com/comment/41171605
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26246516
type: AnswerComment
has text: Ah, your point about the percentage makes sense that completely slipped my mind. Also, those changes still go towards an incorrect value, I reformatted my method to refelct the change but the value is still incorrect. Hmm I think the best thing would be for me to go back to pen and paper and just make sure my equation is right.

http://stackoverflow.com/comment/41659105
score: 0
has text: well I already have android for maven eclipse 1.1.0 installed. And thats about the only plugin I can find on the eclipse market place for maven + android.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26315936

http://stackoverflow.com/comment/41140690
score: 0
type: AnswerComment
type: Comment
has text: the input size is huge. its part of the problem domain and not an artifact of my design. what i could do (which im trying to avoid), is bring in a full blown store, like rocksdb or mapdb etc.
comment on: http://stackoverflow.com/a/26220616

http://stackoverflow.com/comment/41321731
score: 0
comment on: http://stackoverflow.com/q/26328734
has text: @Henrik I posted my answer lemme know if it helps you :)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26259870
favorite count: 0
has comment: http://stackoverflow.com/comment/41195341
type: UnansweredQuestion
tagged with: maven
has title: independent prototyping with java
tagged with: spring
has comment: http://stackoverflow.com/comment/41195207
has answer: http://stackoverflow.com/a/26260213
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26260270
tagged with: java
has comment: http://stackoverflow.com/comment/41194943
has comment: http://stackoverflow.com/comment/41195272
type: Question
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/41195414
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/41194902
has body: I am new to java (well I played with it a few times), and I am wondering: => How to do fast independent prototypes ? something like one file projects. The last few years, I worked with python. Each time I had to develop some new functionality or algorithm, I would make a simple python module (i.e. file) just for it. I could then integrate all or part of it into my projects. So, how should I translate such "modular-development" workflow into a java context? Now I am working on some relatively complex java DB+web project using spring, maven and intelliJ. And I can't see how to easily develop and run independent code into this context. Edit: I think my question is unclear because I confused two things: fast developement and test of code snippets incremental development In my experience (with python, no web), I could pass from the first to the second seemlessly. For the sake of consistency with the title, the 1st has priority. However it is good only for exploration purpose. In practice, the 2nd is more important.
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41195090

http://stackoverflow.com/comment/41248929
comment on: http://stackoverflow.com/q/26288707
score: 1
has text: If you point out the specific behavior you are seeking which is not currently manifesting, that would be immensely helpful.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26274689
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41262462
accepted answer of: http://stackoverflow.com/q/26274382
answers question: http://stackoverflow.com/q/26274382
type: Answer
has comment: http://stackoverflow.com/comment/41233365
has comment: http://stackoverflow.com/comment/41233332
has comment: http://stackoverflow.com/comment/41233411
has comment: http://stackoverflow.com/comment/41238430
has body: Oh my god, thanks @Orel Eraki, of course beside the unbalanced single-quotes you will have to follow proper SQL Insert Syntax and hava a form of 'INSERT INTO ...', try it like this (see my change dirctly after "values(" as the one of Orel Eraki (no 'table' "keyword" after into): Sql_insert="insert into itemmanag(itemID,purchesPrice,sellPrice,quantity,vendor,unitM )values('"+txt_itemID.getText()+"','"+Item_Pprice.getText()+"','"+txt_itemSprice.getText()+"','"+txt_qunti.getText()+"','" +jcombo1+"','"+jcombo2+ "')";
has comment: http://stackoverflow.com/comment/41231987
score: 0

http://stackoverflow.com/comment/41235318
type: Comment
type: QuestionComment
has text: I have done my operation using Robot Class for same. Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_WINDOWS); robot.keyPress(KeyEvent.VK_UP); robot.keyRelease(KeyEvent.VK_WINDOWS); robot.keyRelease(KeyEvent.VK_UP);
comment on: http://stackoverflow.com/q/26281027
score: 0

http://stackoverflow.com/q/26259552
has body: I need to launch an external Java process. Arguments are formed elsewhere and are passed to me as a single string. I need to find a certain "-D" key and update its value before actually running a process. Example: java -Dosgi.framework.extensions="foo bar" "fdf -Dosgi.framework.extensions=bim bom" Should become: java -Dosgi.framework.extensions="bar" "fdf -Dosgi.framework.extensions=bim bom" How do I properly tokenize arguments? Obviously splitting by space is not an option. I'd like to use a plugin from Eclipse infrastructure, if possible.
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41194284
has answer: http://stackoverflow.com/a/27674923
answer count: 1
tagged with: eclipse-plugin
has title: Split command line to arguments

http://stackoverflow.com/comment/41451398
comment on: http://stackoverflow.com/q/26327956
score: 0
type: Comment
type: QuestionComment
has text: I would do something like `this = para;` but I know I can't. So I'm looking for others solutions. I've edited my post. Hope it's more understandable.

http://stackoverflow.com/comment/41225338
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26276048
has text: @M.Deinum if DI is not "if a class..." then what is the benefit of DI,why should i externalize the control?

http://stackoverflow.com/comment/41220146
has text: Keep the `fTemp` variable?
comment on: http://stackoverflow.com/q/26273372
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26320540
type: Question
has comment: http://stackoverflow.com/comment/41313929
has comment: http://stackoverflow.com/comment/41306321
has comment: http://stackoverflow.com/comment/41306314
has comment: http://stackoverflow.com/comment/41306265
tagged with: junit
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 3
answer count: 0
has body: I have long package names in JUnit and that makes it difficult to see what tests are being ran. Using Eclipse's "Abbreviate package names" doesn't work, unfortunately. Is there any way of hiding or, preferably, shortening them?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41309695
has title: How do I shorten (or hide) package names in JUnit?
tagged with: eclipse

http://stackoverflow.com/q/26255940
possible better answer: http://stackoverflow.com/a/26259094
tagged with: java-8
type: AnsweredQuestion
tagged with: java
has body: I can't figure out a good way to create a Stream from scratch. Suppose for instance (note, the code below is just an example for the sake of the discussion) that I have Matcher m = Pattern.compile(re).matcher(input); List&lt;String&gt; matches = new ArrayList&lt;&gt;(); while (m.find()) matches.add(m.group()); and want to leverage the stream API. I would like to do someting like List&lt;String&gt; matches = Stream.of(() -&gt; m.find(), () -&gt; m.group()) .collect(Collectors.toList()); Where () -&gt; m.find() is a function telling if there are more elements, and () -&gt; m.group() is a function to provide the next element. It's easy to create an Iterator for instance: class MatchIterator implements Iterator&lt;String&gt; { Matcher m; boolean hasNext; public MatchIterator(Matcher m) { this.m = m; hasNext = m.find(); } @Override public boolean hasNext() { return hasNext; } @Override public String next() { String next = m.group(); hasNext = m.find(); return next; } } But I can't figure out an easy way of creating a stream out of an iterator either. Edit: I realize I can create an Iterable that creates MatchIterators (and then use StreamSupport/Spliterator) but that requires me to be able to iterate over the source multiple times, so it's still not a universal solution.
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/26259094
favorite count: 0
score: 2
downvote count: 0
tagged with: java-stream
has title: Creating a stream from scratch or from an Iterator
has answer: http://stackoverflow.com/a/26279377
accepted answer: http://stackoverflow.com/a/26279377

http://stackoverflow.com/comment/41229178
has text: If you really want to know what it means, refer to the [JLS](http://docs.oracle.com/javase/specs/jls/se7/html/index.html) and work it out. It would be a good "exercise" in deciphering cryptic code.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26278452
type: QuestionComment

http://stackoverflow.com/a/26209664
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: The error is caused by this line: int MAX = (plaintext.length()-1/columns)+1; Order of operations will do the subtraction inside the brackets after 1/columns is evaluated. This causes the inner difference to become (in the case of 4 columns) plaintext.length() - 0.25, in effect making your MAX larger than the array size, causing your error.
accepted answer of: http://stackoverflow.com/q/26209631
has comment: http://stackoverflow.com/comment/41102227
answers question: http://stackoverflow.com/q/26209631
upvote count: 1

http://stackoverflow.com/a/26310160
upvote count: 1
score: 1
has body: Try annotating CompMenuItem with @JsonIgnore.. http://jackson.codehaus.org/1.0.0/javadoc/org/codehaus/jackson/annotate/JsonIgnore.html Ignore fields from Java object dynamically while sending as JSON from Spring MVC
answers question: http://stackoverflow.com/q/26309641
downvote count: 0
type: Answer

http://stackoverflow.com/a/26327678
has comment: http://stackoverflow.com/comment/41319867
has body: Currently you query the DB and create a new adapter for every simptom. Instead fetch the results for all symptoms at once and then create the adapter. String[] HerbalSuggesstionsArray = searchText.getText().toString().trim().split("\\s*,\\s*"); String query = "SELECT _id, name, symptoms2 FROM hsdisease WHERE symptoms2 LIKE ?" // Append as many WHERE clauses as necessary for(int x= 0; x&lt;HerbalSuggesstionsArray.length - 1; x++) { query += " OR symptoms2 LIKE ?"; } cursor = db.rawQuery(query, HerbalSuggesstionsArray); adapter = new SimpleCursorAdapter( this, R.layout.herbalsuggestion_list_item, cursor, new String[] {"name", "symptoms2"}, new int[] {R.id.hsname, R.id.hssymptoms} ); setListAdapter(adapter); searchText.getText().clear();
accepted answer of: http://stackoverflow.com/q/26327619
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41319745
answers question: http://stackoverflow.com/q/26327619
score: 0
has comment: http://stackoverflow.com/comment/41319376
type: Answer
has comment: http://stackoverflow.com/comment/41320055

http://stackoverflow.com/comment/41381636
comment on: http://stackoverflow.com/a/26351908
has text: Thanks Tung, the sample application doesn't explicitly include any validator's but it still works. See my comment to DaveSyer above...the problem is really that the NotNull annotation doesn't do anything.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26217689
has body: Run Your program like this, java -ea YourClass -ea means enable assertion and after running like this your assertions will be executed during runtime otherwise it just jump the assert statements. If you are using eclipse go to Run Configuration and write -ea in VM Arguments and Run. If you are trying to enable assertion programmatically you can try this, boolean enabled = false; ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true); assert enabled = true; System.out.println("Asserts " + (enabled ? "enabled" : "disabled"));
upvote count: 3
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41118246
answers question: http://stackoverflow.com/q/26217590
score: 3

http://stackoverflow.com/comment/41090356
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26202641
has text: There should probably be a `JScrollPane` somewhere in that mix.

spring-data-jpa
tags question: http://stackoverflow.com/q/26212289
tags question: http://stackoverflow.com/q/26295445
tags question: http://stackoverflow.com/q/26245351
tags question: http://stackoverflow.com/q/26296896
tags question: http://stackoverflow.com/q/26258158
tags question: http://stackoverflow.com/q/26255313
tags question: http://stackoverflow.com/q/26296252
tags question: http://stackoverflow.com/q/26291143
type: Tag
tag name: spring-data-jpa

http://stackoverflow.com/comment/41160104
type: Comment
has text: You forgot negation in your second example (OP wants to check if character *isn't* space).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26240210

http://stackoverflow.com/a/26220865
has comment: http://stackoverflow.com/comment/41127406
accepted answer of: http://stackoverflow.com/q/26219266
has body: Yes, you can write an application that runs on any machine that supports a JVM compatible with the one for which the program was written. Besides a compatible JVM, the app is liable to depend on certain libraries; all those must be able to be run on the available JVM, and be available to the app. For instance, I can write a 'desktop GUI' application, using the Swing package and a JVM anywhere from 1.4 and up. Let's say I use language features that are dependent on Java version 1.6. That application can run on any computer that has a JVM of 1.6 or greater and has the Swing libraries (and any other libraries I've used) available. Android uses a specialized UI system, which makes sense given its environment. I am unaware of any system outside of a development environment that allows you to run the Android UI stuff on other machines, but don't think it would be very hard to do. But I also don't know that there's much market for it; few enough desktops have touchscreens, which the Android UI has to support at a pretty basic level.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41127043
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26219266

http://stackoverflow.com/comment/58591526
type: AnswerComment
comment on: http://stackoverflow.com/a/26325566
type: Comment
score: 0
has text: I can't put ResourceBundle on the ContextMenu. Can you help me

http://stackoverflow.com/q/26261226
score: 0
has comment: http://stackoverflow.com/comment/41244901
has title: Java/Scala library to load font file and generate draw commands
tagged with: scala
type: UnansweredQuestion
answer count: 0
tagged with: fonts
tagged with: java
has comment: http://stackoverflow.com/comment/41244634
has comment: http://stackoverflow.com/comment/41245418
type: Question
has comment: http://stackoverflow.com/comment/41241369
has body: Is there a java or scala library which can load a font file (ttf, otf, etc) and provide enough information to actually draw the font, including things like kerning? It should also provide information about the font such as the weight, whether or not it is italic, whether it is serif or sans-serif, etc. Currently we are using cufon as an external process, which works most of the time, but has some problems.

http://stackoverflow.com/q/26218932
has comment: http://stackoverflow.com/comment/41147627
favorite count: 0
accepted answer: http://stackoverflow.com/a/26252501
tagged with: bouncycastle
has comment: http://stackoverflow.com/comment/41147779
has comment: http://stackoverflow.com/comment/41132335
linked to: http://stackoverflow.com/q/2957513
has comment: http://stackoverflow.com/comment/41163735
has title: BouncyCastle lightweight API equivalence for PBEWITHSHA256AND256BITAES-CBC-BC
has comment: http://stackoverflow.com/comment/41132748
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41180235
has comment: http://stackoverflow.com/comment/41146956
has comment: http://stackoverflow.com/comment/41119314
downvote count: 1
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26252501
has comment: http://stackoverflow.com/comment/41120075
has body: I am currently registering the BouncyCastleProvider to JCE and installing the Unlimited Strength Policy in my Java Runtime. Because this enforces me to ship the runtime along with the product, I'd like to switch to BouncyCastle's lightweight API. Unfortunately, the lightweight API comes along poorly documented, so I'm struggling on my way to setup an exact equivalence of the "PBEWITHSHA256AND256BITAES-CBC-BC" algorithm. After delving into BouncyCastle's source and searching SO I have written a small test util which doesn't return the expected contents: public class AESCipherTest { private static final String data = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, " + "sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, " + "sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet " + "clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem " + "ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor " + "invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et " + "accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata " + "sanctus est Lorem ipsum dolor sit amet."; private static final String password = "MySuperStrongPassword"; private static final byte[] salt = "MakeItSpicey".getBytes(); private static final String jce_algorithm = "PBEWITHSHA256AND256BITAES-CBC-BC"; public static void main(String[] args) throws Exception { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); File file = new File("D:\\test.dat"); file.createNewFile(); FileOutputStream fos = new FileOutputStream(file); OutputStream cos = encryptWithJCE(fos, password); cos.write(data.getBytes()); cos.flush(); cos.close(); FileInputStream fis = new FileInputStream(file); InputStream cis = decryptWithBCLWA(fis, password); byte[] readByteData = new byte[data.getBytes().length]; cis.read(readByteData); cis.clos…
has comment: http://stackoverflow.com/comment/41181817
answer count: 1
tagged with: cryptography

http://stackoverflow.com/q/26311076
has comment: http://stackoverflow.com/comment/41289349
has comment: http://stackoverflow.com/comment/41289941
has answer: http://stackoverflow.com/a/45900078
has comment: http://stackoverflow.com/comment/41289332
has answer: http://stackoverflow.com/a/26311257
score: 0
has body: One of the exercises in my Java textbook says "Consult the API documentation to find methods for: Computing the smallest rectangle that contains two given rectangles. • Returning a random floating-point number." I've looked at the Java API for class Rectangle, but I can't find one that computes the smaller rectangle. The closest methods I've found are union and bounds, but I don't think that's correct. I found min from the Java Math class and wrote a test program to see if it would work, but min cannot have arguments of rectangles. Here's the code I wrote: import java.awt.Rectangle; public class RectangleSize { public static void main(String[] args) { Rectangle a = new Rectangle(5, 5, 10, 10); Rectangle b = new Rectangle(5, 5, 20, 20); int min = Math.min(a, b); //In Eclipse, I get an error. System.out.println(min); } }
has title: Is there a method that computes a smaller rectangle out of two given rectangles?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26311534
answer count: 4
has comment: http://stackoverflow.com/comment/41289578
linked to: http://stackoverflow.com/q/12455392
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/26311159
type: Question

http://stackoverflow.com/a/26251485
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41182585
has comment: http://stackoverflow.com/comment/41181055
has body: Initialize the driver. For eg: If you are using firefox browser try WebDriver driver = new FirefoxDriver();
downvote count: 0
answers question: http://stackoverflow.com/q/26251362
has comment: http://stackoverflow.com/comment/41181499

http://stackoverflow.com/q/26231227
has answer: http://stackoverflow.com/a/58149940
has comment: http://stackoverflow.com/comment/41142691
tagged with: ip
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/74872433
has comment: http://stackoverflow.com/comment/41142664
has answer: http://stackoverflow.com/a/33806158
has answer: http://stackoverflow.com/a/26231336
answer count: 6
score: 4
has body: I need to change computer IP address using java... I have tried this one but this doesnot work... String str1="192.168.0.201"; String str2="255.255.255.0"; String[] command1 = { "netsh", "interface", "ip", "set", "address", "name=", "Local Area Connection" ,"source=static", "addr=",str1, "mask=", str2}; Process pp = java.lang.Runtime.getRuntime().exec(command1);
has comment: http://stackoverflow.com/comment/41319200
has comment: http://stackoverflow.com/comment/98343883
tagged with: lan
downvote count: 0
has comment: http://stackoverflow.com/comment/41142879
favorite count: 0
has answer: http://stackoverflow.com/a/33805470
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26231255
has title: Change Computer IP address using JAVA
has comment: http://stackoverflow.com/comment/41142639
tagged with: java
has comment: http://stackoverflow.com/comment/41142637

http://stackoverflow.com/a/26349252
accepted answer of: http://stackoverflow.com/q/26348895
has comment: http://stackoverflow.com/comment/41361028
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41359874
downvote count: 0
answers question: http://stackoverflow.com/q/26348895
has body: This is a method for calculating the number of days between two dates. It keeps rolling the day forward, while the start date is before the end date. It works regardless of differences in time due to daylight saving time. public static long days(Date startDate, Date endDate) { Calendar start = Calendar.getInstance(); start.setTime(startDate); Calendar end = Calendar.getInstance(); long daysBetween = 0; while(start.before(end)) { start.add(Calendar.DAY_OF_MONTH, 1); daysBetween++; } return daysBetween; }

http://stackoverflow.com/comment/41228581
score: 0
type: Comment
type: QuestionComment
has text: If the problem is resolved I would suggest that you either delete the question or provide an answer yourself.
comment on: http://stackoverflow.com/q/26249561

http://stackoverflow.com/q/26324736
has title: Java - Multiple components above the other (GUI)
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26324822
tagged with: layout-manager
score: 0
answer count: 1
has body: I want to make a JFrame with multiple components above the other - it should look like this: Everything centered GridLayout scrollable (if x is a huge number) What Layout should I use? How do I keep it as minimal as possible? Thanks in advance!
has answer: http://stackoverflow.com/a/26324822
tagged with: swing

http://stackoverflow.com/a/26317336
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26316111
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26316111
has body: You are setting the account object as a relation to the event, this is used when you want to use an externalId to resolve which account to use. In this case you have the Id, so can set the AccountId field directly, e.g. QueryResult queryResults = connection.query("SELECT Id FROM Account WHERE Name = 'TEST'"); Account account = (Account) queryResults.getRecords()[0]; Event event = new Event(); [Set required fields] event.setAccountId(account.getId()); Event[] records = new Event[1]; records[0] = event; SaveResult[] saveResults = connection.create(records);
type: Answer

http://stackoverflow.com/q/26205512
type: Question
has comment: http://stackoverflow.com/comment/41094927
has answer: http://stackoverflow.com/a/26205923
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 1
tagged with: jackson
has title: How can I unmarshal JSON with milliseconds as a property (preferably using Jackson?)
accepted answer: http://stackoverflow.com/a/26205923
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41094781
has comment: http://stackoverflow.com/comment/41094160
has body: I'm trying to convert the following JSON into an object, but I can't figure out how to get past the first property name, which is a timestamp in milliseconds. I've tried to use an ObjectMapper, but because the value is different each time, I have no idea how capture it. { "daily": { "1397952000000": 682, "1398038400000": 717, "1398124800000": 753, "1398211200000": 791 }, "average": { "1397952000000": 363, "1398038400000": 382, "1398124800000": 401, "1398211200000": 421 } } Is using an ObjectMapper the correct way to go, or is there an alternative? Thanks for the advice.

http://stackoverflow.com/comment/41264800
has text: Okay is this gonna connect to andriod app?
type: Comment
comment on: http://stackoverflow.com/a/26297847
type: AnswerComment
score: 0

http://stackoverflow.com/q/26260120
has answer: http://stackoverflow.com/a/34836054
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/34836054
tagged with: cryptography
accepted answer: http://stackoverflow.com/a/26261973
favorite count: 0
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/47532750
tagged with: javacard
tagged with: java
linked to: http://stackoverflow.com/q/23675804
has answer: http://stackoverflow.com/a/26261973
score: 2
tagged with: curve
has body: I have a smart card which supports JavaCard 2.2.2 and I would like to develop a signature with tickets on elliptic curve. To do that, I need to compute the sum of 2 points on an elliptic curve. I've read the JavaCard's API and I don't think it is possible, in fact there are things about elliptic curves but only for algorithms that are already developed (ECPrivateKey for ECDSA for example ...) But when you want to create an ECPrivateKey, you have to give the parameters which define the elliptic curve, so it is defined somewhere, right ? To put it in a nutshell, is it possible to develop a Java cardlet which makes computation (sum, product of points...) over an elliptic curve ? I am a little bit lost aboutthis so thank you very much for your help :)
has title: Point addition using Elliptic Curve calculations on Java Card
downvote count: 0

http://stackoverflow.com/comment/41165570
score: 0
type: AnswerComment
type: Comment
has text: We can set mask formatter to ("**********") so that we can accept less that 20 characters even, and setValidCharacters to alphabets. It has resolved my issue in very few lines of code.
comment on: http://stackoverflow.com/a/26227205

http://stackoverflow.com/comment/41315820
comment on: http://stackoverflow.com/a/26291062
score: 0
type: AnswerComment
type: Comment
has text: It is supported only on devices that use the LibUSB or LibUSB-Win32 driver.

http://stackoverflow.com/comment/41296069
score: 0
has text: http://en.wikipedia.org/wiki/Modulo_operation
comment on: http://stackoverflow.com/q/26315089
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26269922
accepted answer: http://stackoverflow.com/a/26270033
answer count: 1
has body: So I was trying to understand using a Gui in Java and did so by making a little guess the number game. It compiles correctly, however when I run the program it just shows the frame with "Congratulations you win!" at the top. My main question is why the dialog boxes aren't popping up at all and what I should do to fix that. On a related note, when I had the code as JOptionPane.showInputDialog(this,"Play again? Y/N") I got the error message "non-static variable this cannot be referenced from a static context." My secondary, and much less important question, is how to make the message be in the center of the box vertically as well as horizontally. import javax.swing.*; import java.awt.*; import java.util.Scanner; public class RandomNumberGame{ public static JLabel higherThan; public static JPanel tooHigh; public static JLabel lowerThan; public static JPanel tooLow; public static JPanel exactlyCorrect; public static JLabel correctAnswer; public static JFrame guiFrame; public static void main(String[] args){ RandomFun(); } public static void RandomFun() { Scanner input=new Scanner(System.in); guiFrame = new JFrame(); guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiFrame.setTitle("Fun Games!"); guiFrame.setSize(500,500); guiFrame.setLocationRelativeTo(null); guiFrame.setVisible(true); final JPanel tooHigh = new JPanel(); higherThan = new JLabel("Too High!"); final JPanel tooLow = new JPanel(); lowerThan = new JLabel("Too Low!"); final JPanel exactlyCorrect = new JPanel(); correctAnswer = new JLabel("Congratulations, you won!"); tooHigh.add(higherThan); tooLow.add(lowerThan); exactlyCorrect.add(correctAnswer); guiFrame.add(tooHigh, BorderLayout.CENTER); guiFrame.add(tooLow, BorderLayout.CENTER); guiFrame.add(exactlyCorrect, BorderLayout.CENTER); } public static void GuessNumber(){ String again; String lastGuess = "0"; boolean moreGame=true; int lastGuessInt = Integer.parseInt(lastGuess.toString()); int winner = (int) (Math.random()*999+1); while(moreGame){ last…
has comment: http://stackoverflow.com/comment/41214045
has comment: http://stackoverflow.com/comment/41214384
tagged with: java
tagged with: user-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/41214541
has comment: http://stackoverflow.com/comment/41214281
type: AnsweredQuestion
has title: How to make a Gui actually prompt for the dialog boxes?
tagged with: input
score: 1
favorite count: 0
tagged with: user-input
has answer: http://stackoverflow.com/a/26270033
type: Question
has comment: http://stackoverflow.com/comment/41214055
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/41090247
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26201730
has text: Thanks! I have already done as you said but I have always the same problem! Is it a problem caused by my code or ..?
score: 0

http://stackoverflow.com/q/26322146
has comment: http://stackoverflow.com/comment/41309304
has body: All, I have written a java code that needs to check an entered text by the user using the console, I want that the code tests the entered line to not exceed for example 20 letters, I wrote it as follow: String getName() { boolean badName = true; String Name = ""; Scanner console = new Scanner(System.in); while (badName ){ System.out.println("Please enter your first name "); Name = console.nextLine(); //^ I want to check this string length while the user enters the line // to prevent DOS attack when an attacker tries to enter very large line if (console.nextLine().length &gt; 20) { //^ I tried this but could not get the string value after this condition validated, // I dont want to store it in a variable to not cause DOS attack. System.out.println("please enter valid name!!!"); continue; } if (! Name.matches ("[a-zA-Z_]+")) { System.out.println("the name contains invalid character, please try again :"); continue; } if (Name.matches ("[a-zA-Z_]+")){ badName = false; } } return Name; } Not sure if I really need to check that to prevent DOS attack, or Java usually takes care of that? Thanks,
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41309758
tagged with: string
has comment: http://stackoverflow.com/comment/41309445
has comment: http://stackoverflow.com/comment/41309322
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26322457
has comment: http://stackoverflow.com/comment/41309337
tagged with: java
tagged with: securestring
type: Question
has comment: http://stackoverflow.com/comment/41309282
has answer: http://stackoverflow.com/a/26322188
tagged with: secure-coding
has title: Java console input validation to prevent DOS attack

http://stackoverflow.com/a/26259968
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41326418
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Considering you're already subclassing Tree with the extends Tree in the class declaration, at this point all you need to do in order to store all Trees and subclasses of Trees in a List of Trees is basically create the list, and add the trees to the list. public class Forest { private List&lt;Tree&gt; trees; public Forest() { trees = new ArrayList&lt;&gt;(); //diamond syntax Java 7, ArrayList&lt;Tree&gt;() on Java 6 } public void addTree(Tree tree) { trees.add(tree); } public void growTreesByOneYear() { for(Tree tree : trees) { tree.growOneYear(); } //you can do trees.stream().forEach(x -&gt; x.growOneYear()); on Java 8 } public void showTrees() { for(Tree tree : trees) { tree.show(); } } } public class MainClass { public static void main(String[] args) { Forest forest = new Forest(); Ash ashTree = new Ash(); Beech beechTree = new Beech(); forest.addTree(ashTree); forest.addTree(beechTree); forest.show(); forest.growTreesByOneYear(); forest.show(); } } I hope that helps! Oh, and for the trees - you could probably provide the age and height in a constructor parameter, and create them something like this: Ash ash = new Ash(5, 1.5); //age, height Which would use public class Ash extends Tree { public Ash(int age, double height) { this.age = age; this.height = height; } } Or to be honest, it's clearer like this: public class Tree { public Tree(int age, double height) { this.age = age; this.height = height; } } public class Ash extends Tree { public Ash(int age, double height) { super(age, height); } }
accepted answer of: http://stackoverflow.com/q/26258888
answers question: http://stackoverflow.com/q/26258888

http://stackoverflow.com/a/26202196
downvote count: 0
has comment: http://stackoverflow.com/comment/41090477
accepted answer of: http://stackoverflow.com/q/26201964
score: 1
has body: You need to save the wsdl on local. Edit it to make function names shorter. Mention that domino will concatenate the name and methods so you may have to shorten different "names". Save locally Recreate you consumer opening your edited version and it works. I reread the question and sorry you mentionned java, so please read Issues when importing WSDL files into Web Service Consumer.
answers question: http://stackoverflow.com/q/26201964
has comment: http://stackoverflow.com/comment/41104680
has comment: http://stackoverflow.com/comment/41104231
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41103982
has comment: http://stackoverflow.com/comment/41103933
type: Answer

http://stackoverflow.com/comment/41219003
type: QuestionComment
has text: Please post the stacktrace and any relevant code snippets. That will help us understand and diagnose the problem.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26272482

http://stackoverflow.com/comment/44517538
comment on: http://stackoverflow.com/a/27941593
score: 0
has text: Hi, thanks for the answer... we have moved on with the project and eventually gave up on hk2; instead we rely on spring bridge and spring for DI.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41358444
score: 5
has text: Why would you need this instead of simply using `compareTo`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26348679

http://stackoverflow.com/a/26338912
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26321610
has body: Modulo , an operation which checks if a number will have a remainder if its divided by another number yourNumber%5 == 0 where yourNumber is the lenght of your String. Take it from here.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41129141
score: 1
comment on: http://stackoverflow.com/q/26223835
has text: can you just do `eingabe.equals("0") || eingabe.equals("1")`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41125503
type: QuestionComment
comment on: http://stackoverflow.com/q/26221990
type: Comment
has text: You should make the first test as `response_content.equals("1")`. If not, what you do is to compare the String "1" with the boxed Integer value 1, which is false. In the second case, this is an example where you should not use == to test equality of Strings; always use `equals()` with another String.
score: 0

http://stackoverflow.com/q/26252024
has answer: http://stackoverflow.com/a/26252110
has title: Find the whole digits of a given number
has answer: http://stackoverflow.com/a/26252220
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26252056
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26252072
score: 2
accepted answer: http://stackoverflow.com/a/26252056
has body: int value = 456702; do { digit = value % 10; value = value / 10; System.out.println(digit); //I just want to get...2,0,7,6,5,4 } while (digit &gt; 0); I have tried it but it doesn't work well since when it gets digit 0 it exits from the loop. I just want to find and retrieve digits of a given number. E.g. 256387, I need the digits involved in this number independently, i.e. 7,8,3,6,5,2, and I have tried it. My code works well for a number that has no zeros. How can I know I reached the last digit (for example from left to right)?
favorite count: 0
has answer: http://stackoverflow.com/a/26252099
possible better answer: http://stackoverflow.com/a/26252110
answer count: 5

http://stackoverflow.com/q/26309438
tagged with: android
has answer: http://stackoverflow.com/a/28820830
has body: I have a working search implementation using the Search Widget like so inside of an activity that extends from Activity: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search_results, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); if(null!=searchManager) { searchView.setSearchableInfo( searchManager.getSearchableInfo(getComponentName())); } return true; } When changing the activity to extend ActionBarActivity, I get this null pointer: 10-10 15:51:49.044: E/AndroidRuntime(19406): java.lang.NullPointerException 10-10 15:51:49.044: E/AndroidRuntime(19406): at com.example.myapp.SearchResultsActivity.onCreateOptionsMenu(SearchResultsActivity.java:114) 10-10 15:51:49.044: E/AndroidRuntime(19406): at android.app.Activity.onCreatePanelMenu(Activity.java:2546) 10-10 15:51:49.044: E/AndroidRuntime(19406): at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:224) 10-10 15:51:49.044: E/AndroidRuntime(19406): at android.support.v7.app.ActionBarActivity.superOnCreatePanelMenu(ActionBarActivity.java:232) 10-10 15:51:49.044: E/AndroidRuntime(19406): at android.support.v7.app.ActionBarActivityDelegateICS.onCreatePanelMenu(ActionBarActivityDelegateICS.java:146) 10-10 15:51:49.044: E/AndroidRuntime(19406): at android.support.v7.app.ActionBarActivity.onCreatePanelMenu(ActionBarActivity.java:199) 10-10 15:51:49.044: E/AndroidRuntime(19406): at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.onCreatePanelMenu(ActionBarActivityDelegateICS.java:293) 10-10 15:51:49.044: E/AndroidRuntime(19406): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:436) I do have other ActionBarActivities that work perfectly (though not with a search widget) in my app and I did a project clean with no results. Why am I getting this null pointer in this …
possible better answer: http://stackoverflow.com/a/28820830
tagged with: java
type: Question
type: AnsweredQuestion
tagged with: android-actionbaractivity
score: 0
answer count: 2
has title: ActionBarActivity with SearchView
has answer: http://stackoverflow.com/a/26309608
accepted answer: http://stackoverflow.com/a/26309608

http://stackoverflow.com/a/26217050
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26216417
answers question: http://stackoverflow.com/q/26216417
type: Answer
has body: You need to locate the frame first. For example, by xpath relying on the title tag: WebElement frame = driver.findElement(By.xpath('//iframe[@title="Universal Line Template Configuration"]')); The use it as a target: driver.switchTo().frame(frame); See also: How to switch between frames in Selenium WebDriver using Java

http://stackoverflow.com/comment/41301786
score: 0
type: Comment
has text: Thanks, I made that change but still when I enter three 100's for the exam scores I get the message saying the letter grade is an F. I don't understand why it's not calculating the average properly.
comment on: http://stackoverflow.com/a/26318072
type: AnswerComment

http://stackoverflow.com/comment/41219246
has text: @Jared You are right, that is definitely a different question.
comment on: http://stackoverflow.com/q/26270689
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41313279
type: AnswerComment
type: Comment
has text: yeah the second approach looks doable
score: 0
comment on: http://stackoverflow.com/a/26324335

http://stackoverflow.com/comment/41264499
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26297638
has text: important part of setPreferredSize for (most of) JComponents is done automatically from LayoutManager, without SSCCE/MCVE, short, runnable, compilable thos question isn't answerable here
type: Comment

http://stackoverflow.com/comment/45294130
comment on: http://stackoverflow.com/a/28462006
score: 0
type: Comment
has text: I'm going to accept this as the answer because the only solution I was able to find was to use slightly older versions of the Santuario libraries. Using the latest libraries did not work... hence the solution above is probably the right answer.
type: AnswerComment

http://stackoverflow.com/comment/41115605
type: Comment
has text: Pardon me, but I did not understand what you are suggesting to check (instead of the error code).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26216911

http://stackoverflow.com/comment/41341161
comment on: http://stackoverflow.com/q/26337960
score: 1
has text: @VishveshPhadnis that *partly* explains why you are using base-36; it does *not* explain why you are going via 2 additional steps in the middle (each of which adds unnecessary padding); btw - it is also common to simply use base-64 with a slightly different url-safe alphabet (for example, `-` and `_` instead of `+` and `/`) and no padding (no trailing `=`)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41147888
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26234112
has text: No, you did not add the actual usage for `getResponseProcessor`, only for `newResponseProcessor()`.
score: 0

http://stackoverflow.com/q/26211657
favorite count: 0
tagged with: weak-references
tagged with: phantom-reference
downvote count: 0
type: UnansweredQuestion
score: 7
tagged with: java
tagged with: garbage-collection
type: Question
has title: Understanding Phantom reference vs weak reference with respect to Reference queue
has answer: http://stackoverflow.com/a/33161963
has body: As per the link https://weblogs.java.net/blog/enicholas/archive/2006/05/understanding_w.html, PhantomReferences are enqueued only when the object is physically removed from memory and WeakReferences are enqueued before finalization or garbage collection has actually happened. The difference is in exactly when the enqueuing happens. WeakReferences are enqueued as soon as the object to which they point becomes weakly reachable. This is before finalization or garbage collection has actually happened; in theory the object could even be "resurrected" by an unorthodox finalize() method, but the WeakReference would remain dead. PhantomReferences are enqueued only when the object is physically removed from memory, and the get() method always returns null specifically to prevent you from being able to "resurrect" an almost-dead object. whereas as per http://www.ibm.com/developerworks/library/j-refs/, PhantomReference is added to its ReferenceQueue before the heap object is freed and and WeakReferences are added to its ReferenceQueue after finalization or garbage collection. Unlike soft and weak references, the PhantomReference is added to its ReferenceQueue before the heap object is freed. (Remember, all PhantomReference objects must be created with an associated ReferenceQueue.) This allows for action to be taken before the heap object is reclaimed. When the heap object's finalize() method is run and its memory freed, the WeakReference object is added to its ReferenceQueue, if it exists. I am confused. Which one is correct? Basically i want to know the difference between weak and phantom reference with respect to Reference Queue?
upvote count: 7
answer count: 1
tagged with: soft-references

http://stackoverflow.com/comment/41264586
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26297619
has text: Do I have to provide an AuthenticationProvider if I have users stored in a database?
type: AnswerComment

http://stackoverflow.com/comment/43422824
type: Comment
has text: Thank you! I wish I could +100 this answer. Every time I use Jersey I spend an hour trying to get it to support JSON and it's always a different problem. I should learn my lesson.
score: 1
comment on: http://stackoverflow.com/a/26309381
type: AnswerComment

http://stackoverflow.com/comment/62605138
comment on: http://stackoverflow.com/a/26305705
score: 1
type: AnswerComment
type: Comment
has text: You can use [Google GSON](https://github.com/google/gson) library for marshaling and unmarshaling. It supports Java generics and custom objects.

http://stackoverflow.com/q/26216694
has comment: http://stackoverflow.com/comment/41114994
has comment: http://stackoverflow.com/comment/41115216
has comment: http://stackoverflow.com/comment/41115296
type: UnansweredQuestion
tagged with: java
has body: Is it possible to do such a thing? Say I wanted to add the values I gave values to in CountriesTest and add them to the ArrayList in Countries. Also how could I reference aCountries to print for option 2, seeing that I created it inside option 1 I can't access it anywhere else. Here is my interface public interface CountriesInterface { public String largestPop(); public String largestArea(); public String popDensity(); } Here is the Countries class import java.util.*; public class Countries implements CountriesInterface { private final List&lt;CountriesInterface&gt; theCountries = new ArrayList&lt;&gt;(); private String cName; private String finalPopName; private String finalAreaName; private String finalDensityName; private int cPop = 0; private int cArea = 0; private int popDensity = 0; private int popCounter = 0; private int areaCounter = 0; private int densityCounter = 0; public Countries(String cName, int cPop, int cArea, int popDensity) { this.cName = cName; this.cPop = cPop; this.cArea = cArea; this.popDensity = popDensity; } public String largestPop() { for(int i = 0; i &lt; theCountries.size(); i++) { if(cPop &gt; popCounter) { popCounter = cPop; finalPopName = cName; } } return finalPopName; } public String largestArea() { for(int i = 0; i &lt; theCountries.size(); i++) { if(cArea &gt; areaCounter) { areaCounter = cArea; finalAreaName = cName; } } return finalAreaName; } public String popDensity() { for(int i = 0; i &lt; theCountries.size(); i++) { if(popDensity &gt; densityCounter) { densityCounter = popDensity; finalDensityName = cName; } } return finalDensityName; } } Here is the CountriesTest class import java.util.*; public class CountriesTest { public static void main(String[] args) { int population = 0; int area = 0; int density = 0; Scanner myScanner = new Scanner(System.in); boolean done = false; do { System.out.println("1. Enter a country \n2. Print countries with the largest population, area, and population density \n3. Exit"); int choice = Inte…
has answer: http://stackoverflow.com/a/26216962
type: Question
has comment: http://stackoverflow.com/comment/41115146
score: 0
has title: Issue adding elements to an ArrayList from a different class
has comment: http://stackoverflow.com/comment/41115628
answer count: 1
has comment: http://stackoverflow.com/comment/41115128

http://stackoverflow.com/a/26348483
has body: You have not put many details so its rather hard to answer exactly what you need. First of all - you need to decide if old/good servlets are needed for you, or your functionality can start somewhere in controller with @RequestMapping annotation (if you use spring mvc). You may want to use session scoped beans to keep any state between REST calls, maybe with mix with ThreadLocal property - please take a look at http://java.dzone.com/articles/painless-introduction-javas-threadlocal-storage thread local explanation. If still confused -please share more details what exactly is this app going to maintain.
upvote count: 1
answers question: http://stackoverflow.com/q/26347408
score: 1
has comment: http://stackoverflow.com/comment/41358354
has comment: http://stackoverflow.com/comment/41367502
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26347408
type: Answer

http://stackoverflow.com/q/26338491
has answer: http://stackoverflow.com/a/26339145
type: UnansweredQuestion
tagged with: java
has title: Retrieving part of a string using a delimiter
has body: Okay So I am creating an application but I'm not sure how to get certain parts of the string. I have read In a file as such: *tp*|21394398437984|163600 *2*|AAA|1234567894561236|STOP|20140527|Success||Automated|DSPRN1234567 *2*|AAA|1234567894561237|STOP|20140527|Success||Automated|DPSRN1234568 *3*|2 I need to read the lines beginning with 2 so I done: s = new Scanner(new BufferedReader(new FileReader("example.dat"))); while (s.hasNext()) { String str1 = s.nextLine (); if(str1.startsWith("*2*")) { System.out.print(str1); } } So this will read the whole line I'm fine with that, Now my issue is I need to extract the 2nd line beginning with numbers the 4th with numbers the 5th with success and the 7th(DPSRN). I was thinking about using a String delimiter with | as the delimiter but I'm not sure where to go after this any help would be great.
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/26338896
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26338882
tagged with: string

http://stackoverflow.com/comment/41363538
score: 0
type: Comment
type: AnswerComment
has text: thanks for the feedback, im still a rookie at recursion!
comment on: http://stackoverflow.com/a/26351557

http://stackoverflow.com/comment/41257120
has text: I agree with @Jarrod - this is certainly a dupe of the question marked.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26293405
score: 1

http://stackoverflow.com/q/26253732
has comment: http://stackoverflow.com/comment/41183794
linked to: http://stackoverflow.com/q/1053467
type: Question
has comment: http://stackoverflow.com/comment/41184550
has comment: http://stackoverflow.com/comment/41184190
has answer: http://stackoverflow.com/a/26253850
tagged with: java
has comment: http://stackoverflow.com/comment/41183878
upvote count: 2
has comment: http://stackoverflow.com/comment/41184469
score: 0
downvote count: 2
answer count: 3
has title: How to save a text file in java after changing it?
has comment: http://stackoverflow.com/comment/41183939
favorite count: 0
has answer: http://stackoverflow.com/a/26253842
has comment: http://stackoverflow.com/comment/41184444
duplicate of: http://stackoverflow.com/q/1053467
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26253824
tagged with: text
has body: in my project, I am opening text files, and im doing some changes to the files, and I want to save the file after im chaning it, like Save As with a location browse. Can I do it somehow? Thanks for the help!
tagged with: save
tagged with: file

http://stackoverflow.com/q/26290520
tagged with: arguments
has title: How to fix the following error: "Error: Main method not found in class"
type: UnansweredQuestion
tagged with: parameters
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26290527
has comment: http://stackoverflow.com/comment/41251853
type: Question
has answer: http://stackoverflow.com/a/26290622
has body: I'm essentially new to Java and for fun I'm creating a Stock Market Simulator/Game. I know my code isn't "perfect" but remember I'm new and i have 1 error. "Error: Main method not found in class StockPackage.Dog, please define the main method as: public static void main(String[] args)" I've looked at all the argument and parameter tutorials I could find and searched StackOverflow's Questions and couldn't find a solution. If you can, can someone come up with a way to "Delete/Fix" the error, or just help me out as much as you can. Thanks in Advance! My Code: package StockPackage; import java.util.Scanner; public class Dog { public static void main(String[] args, int CurMoney, String[] inputStocks, int[] StockMoney) { Dog Run = new Dog(); Run.MainScript(); Run.OptionStartingMethod(inputStocks, CurMoney, StockMoney); } //============================================================================== // ||Objects|| void options(String[] inputStocks, int CurMoney, int[] StockMoney) { String optionEXIT, optionStartStock, optionBuyStock, optionSellStock; String optionCheat, optionInfo, optionCredits, optionClose, OptionInput; int i, j, k; Scanner optionInput = new Scanner(System.in); Dog FlixSibling = new Dog(); System.out.println("=============| Options | ============="); System.out.println(" optionEXIT " + " optionStartStock " + "optionBuyStock"); System.out.println(" optionSellStock " + " optionCheat " + " OptionInfo "); System.out.println(" optionCredits " + " optionClose " + " optionCheckCash"); System.out.println(); System.out.print("==| "); OptionInput = optionInput.nextLine(); if(OptionInput.equals("optionEXIT")) { FlixSibling.Close(); } else if(OptionInput.equals("optionStartStock")) { StartStock(inputStocks, StockMoney, CurMoney); } else if(OptionInput.equals("optionBuyStock")) { } else if(OptionInput.equals("optionSellStock")) { } else if(OptionInput.equals("optionCheat")) { } else if(OptionInput.equals("optionInfo")) { } else if(OptionInput.equals("optionCredits"…
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26290549
answer count: 3

http://stackoverflow.com/q/26335741
type: UnansweredQuestion
has body: I want to read properties file from WEB-INF folder and not from the classpath since I dont want to compile my application again if I make any modifications. My file is coming in build in the directory but when I am trying to acces its not showing anything. Please can anyone help me with this. I am using Spring framework. So if there is any method in Spring which will allow us that we are not required to compile our application again and again and the modifications are taken up by the applications on its own.
tagged with: spring
tagged with: web-inf
tagged with: java
has title: Read properties file from WEB-INF folder
type: Question
tagged with: properties-file
has answer: http://stackoverflow.com/a/26335869
tagged with: eclipse
has answer: http://stackoverflow.com/a/26335827
score: 0
answer count: 2

http://stackoverflow.com/q/26217837
type: Question
has comment: http://stackoverflow.com/comment/41117169
tagged with: arrays
downvote count: 0
has body: Does anyone know a better way to write the following statement: example.mySpecialMethod(new MySpecialClass[0].getClass()) I need the array type, but I dont know if there is a better solution. At the moment this example works for me, but perhaps someone knows a better way to do the same without the new keyword.
favorite count: 0
tagged with: class
accepted answer: http://stackoverflow.com/a/26217902
answer count: 1
has comment: http://stackoverflow.com/comment/41117126
has title: How to get the class associated to an array type?
score: 13
linked to: http://stackoverflow.com/q/4901128
upvote count: 13
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26217902
tagged with: java
tagged with: new-operator

http://stackoverflow.com/comment/41263375
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26274462
has text: Would serialize have better performance or space-friendly? As push and pop is not about making one backup copy.
type: AnswerComment

http://stackoverflow.com/comment/41229386
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26277702
has text: ok here are some sample data. Im sure that I have a bad design here.
type: Comment

http://stackoverflow.com/a/26209077
upvote count: 1
has body: If I understand your question, you could begin by creating a contains(Integer[], Integer) method. Iterate the array and return true if the array contains the value. private static boolean contains(Integer[] a, Integer v) { for (Integer t : a) { if (t.equals(v)) { return true; } } return false; } Then you can leverage that to iterate your arrays twice. Once to perform a count, and the second time to populate a newly created array with the count number of elements. Something like, public static Integer[] retainAll(Integer[] a, Integer[] b) { int count = 0; for (Integer val : a) { if (contains(b, val)) { count++; } } Integer[] out = new Integer[count]; count = 0; for (Integer val : a) { if (contains(b, val)) { out[count++] = val; } } return out; } Then to test it, public static void main(String[] args) { Integer[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 200, 5, 6, 5 }; Integer[] array2 = { 12, 2, 3, 2, 200, 5 }; System.out.println(Arrays.toString(retainAll(array, array2))); } Output is the requested [2, 3, 5, 200, 5, 5] Of course, you could also use Arrays.asList(T...) and retainAll() like public static Integer[] retainAll(Integer[] a, Integer[] b) { List&lt;Integer&gt; al = new ArrayList&lt;&gt;(Arrays.asList(a)); al.retainAll(Arrays.asList(b)); return al.toArray(new Integer[al.size()]); }
has comment: http://stackoverflow.com/comment/41104559
score: 1
has comment: http://stackoverflow.com/comment/41101152
accepted answer of: http://stackoverflow.com/q/26208953
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26208953
type: Answer
has comment: http://stackoverflow.com/comment/41101192

hql
tag name: hql
tags question: http://stackoverflow.com/q/26325050
tags question: http://stackoverflow.com/q/26228812
tags question: http://stackoverflow.com/q/26329976
tags question: http://stackoverflow.com/q/26203990
type: Tag
tags question: http://stackoverflow.com/q/26334244
tags question: http://stackoverflow.com/q/26347613
tags question: http://stackoverflow.com/q/26234900

http://stackoverflow.com/q/26318368
tagged with: jpa
answer count: 1
tagged with: jackson
upvote count: 1
has answer: http://stackoverflow.com/a/26318535
accepted answer: http://stackoverflow.com/a/26318535
favorite count: 0
type: AnsweredQuestion
has body: I have a class which lazy loads a collection. Now I have two different Queries, one that loads the data without the collection and another which loads the whole data. When executing the Query which doesn't load the collection I get the following error: JsonMappingException: failed to lazily initialize a collection of role: Player.goals I tried to fix that with using the @JsonInclude(JsonInclude.Include.NON_EMPTY) annotation but that didn't help. How do I produce two different JSON Results based on the same Class? Update: Updated the structure and added JSONView but the error didn't change. Model @Entity public class User implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") private Collection&lt;Team&gt; teams = new ArrayList&lt;Team&gt;(); } @Entity public class Team implements Serializable { ... @OneToMany(cascade = CascadeType.ALL, mappedBy = "team", targetEntity = Player.class, fetch = FetchType.EAGER) @JsonView(UserViews.User.class) private Collection&lt;Player&gt; players = new ArrayList&lt;Player&gt;(); ... } @Entity public class Player implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "player", targetEntity = Goal.class, fetch = FetchType.LAZY) @JsonView(UserViews.UserWithGoals.class) private Collection&lt;Goal&gt; goals= new ArrayList&lt;Goal&gt;(); ... } Queries @Query("SELECT u FROM User u WHERE u.id = :id") Team findById(@Param("id") Long id); Spring Controller @RequestMapping(headers = "Accept=application/json") @JsonView(UserViews.User.class) public @ResponseBody Team getTeam(Authentication authentication) { User user = userService.findById(1); return team; } With this configuration accessing the controller shouldn't load the Goalsof the Player class, but that's exactly the mentioned part in the JSONMappingException. Any idea what's wrong?
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Jackson JSON and lazy loaded collections
type: Question

http://stackoverflow.com/comment/41116533
type: AnswerComment
type: Comment
has text: but the result will show as indexes i.e numbers where the employees are located and not the employee information. So it should be something like Emplist[indexes that we have].ShowInfoToUser(); but how is it possible to combine that with what you did?
comment on: http://stackoverflow.com/a/26217122
score: 0

http://stackoverflow.com/q/26347378
has answer: http://stackoverflow.com/a/26347450
downvote count: 0
has answer: http://stackoverflow.com/a/31560320
has answer: http://stackoverflow.com/a/55931780
type: Question
has body: I want to post boolean,double data using volley library.I am not getting how to use it.Is there any other process.Thanks in advance. Here is my method.... @Override protected Map&lt;String, String&gt; getParams() { Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;(); params.put("name", "name"); params.put("email", "abc@abc.info"); params.put("pass", "password"); return params; }
type: AnsweredQuestion
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/50165295
accepted answer: http://stackoverflow.com/a/26347450
score: 5
upvote count: 5
tagged with: java
has title: How to post boolean or integer value using volley
answer count: 4
possible better answer: http://stackoverflow.com/a/31560320

http://stackoverflow.com/comment/41097944
type: Comment
comment on: http://stackoverflow.com/a/26207383
type: AnswerComment
score: 0
has text: Its unnecessary code that is confusing. Note that the OP is working on homework. Turning this in (not that we *should* be encouraging people to copy homework from SO) would have several points taken off for some unnecessary and ugly code. One should write as clean (and this isn't) code as possible when describing how to fix the problem so that the OP can learn how to write better code. Repeating mistakes doesn't help anyone.

http://stackoverflow.com/comment/114526058
score: 0
has text: Still struggling with a Weblogic 12.1 to 12.2 upgrade, this is exactly what I needed!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/31035861

http://stackoverflow.com/comment/41252515
comment on: http://stackoverflow.com/q/26290878
score: 0
type: Comment
type: QuestionComment
has text: What programming language? If it is Java then, `Switch` should be `switch` beginning with a small letter.

http://stackoverflow.com/comment/41121220
type: Comment
type: QuestionComment
has text: Did you add your imports?
comment on: http://stackoverflow.com/q/26219852
score: 0

http://stackoverflow.com/a/26236274
has body: You can try the Loop Batches operator and put Replace (Dictionary) in it, then do the append.
has comment: http://stackoverflow.com/comment/41152057
downvote count: 0
has comment: http://stackoverflow.com/comment/41152178
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26235304
answers question: http://stackoverflow.com/q/26235304
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/26281027
tagged with: sikuli
upvote count: 1
has body: I need to press WINDOW + UpArrow. At first attempt I have tried with sikuli by :- s1.type(Key.WIN + Key.UP); But it only press WINDOW and UpArrow buttons, but separately. By selenium I have try with Actions class but I have found there is no key available to press WINDOW button there.
favorite count: 0
has answer: http://stackoverflow.com/a/26287151
has comment: http://stackoverflow.com/comment/49213734
has title: How to press [WINDOW] + [UpArrow] keys together, using Sikuli or Selenium
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/49260946
has comment: http://stackoverflow.com/comment/41235318
score: 1
tagged with: java
tagged with: selenium
type: Question
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26287151

http://stackoverflow.com/comment/41108723
has text: The default value of a `boolean` in Java is `false`.
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/26213326

http://stackoverflow.com/comment/41153736
has text: Sure, but you may need to order Students by their name in some cases and by their cgpa in other cases, and when you need two or more different implementations of the compare method you can't implement it in the class that needs to be compared, right? But if I need two different implementation I can simply create two nested classes, say Student.StudentCGPA and Student.StudentName
type: AnswerComment
comment on: http://stackoverflow.com/a/26237335
score: 0
type: Comment

http://stackoverflow.com/a/26346653
answers question: http://stackoverflow.com/q/26346490
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41354678
type: Answer
has comment: http://stackoverflow.com/comment/41354737
score: 1
upvote count: 1
has body: onSaveInstanceState() is not for persistent storage. It is only there to save particular state about that instance of the Fragment (e.g. during configuration changes, or if your app is killed in the background and the Fragment should be recreated). If you're closing your app entirely (i.e. finishing the Activity) then your state will not be saved, as that instance is no longer needed. For persistent storage, you could look into either SharedPreferences or SQLite, depending on your needs.
accepted answer of: http://stackoverflow.com/q/26346490

http://stackoverflow.com/comment/41227535
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26258844
has text: Yeah, I agree the question was vaguely worded from the start and he edited it about a dozen times. The topic has become pretty muddled.

http://stackoverflow.com/comment/41158109
comment on: http://stackoverflow.com/a/26239353
score: 0
type: AnswerComment
has text: How shall I write the import in MyTest.java then
type: Comment

http://stackoverflow.com/q/26226755
has title: Deep Copy Constructor in Java
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/41134632
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41134775
type: Question
has answer: http://stackoverflow.com/a/26226868
has answer: http://stackoverflow.com/a/26226805
accepted answer: http://stackoverflow.com/a/26226805
has body: I need to create a deep copy constructor, but I'm not quite sure how with my given program. My program doesn't use any other fields other than an array of byte. My instructions for the constructor were simply:"Copy constructor; a deep copy should be performed." public class AdditionOnlyInt implements BigInt{ private byte[] d; public AdditionOnlyInt(AdditionOnlyInt a){ this.d = a.d; } }
has comment: http://stackoverflow.com/comment/41134977
has comment: http://stackoverflow.com/comment/41134611
tagged with: copy
has comment: http://stackoverflow.com/comment/41134564
has comment: http://stackoverflow.com/comment/41134584
answer count: 2
linked to: http://stackoverflow.com/q/6182565
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/26226868
tagged with: constructor

http://stackoverflow.com/a/26251320
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41182756
has body: If you have an ant script now there are no other manual steps than running this script in the future. Seems fine to me and this is what build tools are for. But instead of this you could implement some kind of staged property lookup. First check if the properties file was passed as a program argument. If that is not available or was not passed take the one from the classpath as you do.
accepted answer of: http://stackoverflow.com/q/26250986
has comment: http://stackoverflow.com/comment/41182474
answers question: http://stackoverflow.com/q/26250986
type: AcceptedAnswer
downvote count: 0

reverse-lookup
tags question: http://stackoverflow.com/q/26338237
tag name: reverse-lookup
type: Tag

http://stackoverflow.com/a/26244322
upvote count: 1
score: 1
has body: Since you don't actually show the code that supposedly calls setHealthyText() Here are some tips to make debugging your code easier for everyone. Always use {} even for one liners: There are too many chances to add a line of logic and forget that it will either always or never execute. public void setHealthyText() { if (vitamin == true) { isithealthy = "Yes"; } else if (vitamin == false) { isithealthy = "No"; } } the following is acceptable as well for very terse statements public void setHealthyText() { if (vitamin) { isithealthy = "Yes"; } else { isithealthy = "No"; } } Don't compare booleans directly to true/false it is a tautology and hard to reason about when there are lots of them combined: if (someBoolean == true) should be if(someBoolean) or if(!someBoolean) to test for false Learn to use the proper naming conventions: variables are lowerCamelCase ( isithealthy should be isHealthy ) methods that return boolean should be named isXXX or hasXXX or some other possessive. isSick() isHealthy() hasVitamin() Learn to use the ternary statement: public void setHealthyText() { this.isHealthy = vitamin ? "Yes" : "No"; // variable boolean true false } This a nightmare of confusing code that doesn't have to be: if (vitamin == true &amp;&amp; rNumber &lt;= 20) sickness = true; else if (vitamin == false &amp;&amp; rNumber &lt;= 25) sickness = true; else sickness = false; Corrected: this.sickness = vitamin &amp;&amp; rNumber &lt;= 20 || !vitamin &amp;&amp; rNumber &lt;= 25; Example: public static void main(final String[] args) { isSick(true, 26); isSick(true, 24); isSick(false, 24); isSick(false, 18); } private static void isSick(final boolean vitamin, final int hp) { System.out.println(vitamin &amp;&amp; hp &lt;= 20 || !vitamin &amp;&amp; hp &lt;= 25 ? "Sick" : "Not Sick"); } Outputs Not Sick Not Sick Sick Sick
answers question: http://stackoverflow.com/q/26243670
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41249717
comment on: http://stackoverflow.com/q/26289183
score: 0
type: Comment
type: QuestionComment
has text: The exception is not saying there is no "libros" table, but there is no libros database. It would help to show com.arquitecturajava.DataBaseHelper.seleccionarRegistros(DataBaseHelper.java:92).

http://stackoverflow.com/comment/41190090
score: 0
type: AnswerComment
has text: might have been mistaken about the inserting null then. :)
type: Comment
comment on: http://stackoverflow.com/a/26256708

http://stackoverflow.com/q/26314264
has body: I have a project which is developed in Perl, Is there any way to run it in Eclipse env? I use Win8 with Eclipse Standard/SDK Version: Kepler Service Release 2. My project contains these files in it:
score: 0
has title: how can I import existing perl project in java by Eclipse?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26314378
accepted answer: http://stackoverflow.com/a/26314378
tagged with: java
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/24650728
tagged with: perl
answer count: 1

http://stackoverflow.com/a/26242205
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26241949
accepted answer of: http://stackoverflow.com/q/26241949
has body: try this. try{ JSONArray jsonArray = new JSONArray(result); // looping through All jsonObject for (int i = 0; i &lt; jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); String id = jsonObject.getString("id"); String title = jsonObject.getString("title"); String description = jsonObject.getString("description"); String img_url = jsonObject.getString("img_url"); } } catch (JSONException e) { e.printStackTrace(); }
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/26248794
type: Answer
score: 1
has body: More context would be useful, but your for-loop looks wrong... for (int i = 0; i &lt; array.size(); i++) { if (array.get(i).compareTo(aStudent) == 0) { System.out.println(aStudent.equals(array.get(i))); found = true; break; // out of loop } else { System.out.println("No such records found!"); found = false; break; // break out loop } System.out.println(found); } The break statement is used to break out of the loop, meaning that you will only ever compare the first element in the list. The entire else branch isn't required (or at least I don't think it is ;)), for example... for (int i = 0; i &lt; array.size(); i++) { if (array.get(i).compareTo(aStudent) == 0) { System.out.println(aStudent.equals(array.get(i))); found = true; break; // out of loop } } System.out.println(found); Updated Based on you new compareTo code snippet, this... if ((this.Username.compareToIgnoreCase(object.Username) &lt; 0) || (this.Password.compareTo(object.Password) &lt; 0)) { result = -1; } else if ((this.Username.compareToIgnoreCase(object.Username) &lt; 0) &amp;&amp; (this.Password.compareTo(object.Password) &lt; 0)) { result = 0; } seems wrong to me...the else if should be more like else if ((this.Username.compareToIgnoreCase(object.Username) == 0) &amp;&amp; (this.Password.compareTo(object.Password) == 0)) if the contract for the Comparable interface is to be met, where 0 is equal... For example... import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class Test { private static ArrayList&lt;Student&gt; array = new ArrayList&lt;Student&gt;(); public static void main(String[] args) { array.add(new Student("John", "password1")); array.add(new Student("Jane", "password2")); array.add(new Student("Jack", "password3")); Student aStudent = new Student("Jack", "password3"); boolean found = false; for (int i = 0; i &lt; array.size(); i++) { if (array.get(i).compareTo(aStudent) == 0) { System.out.println(aStudent.equals(array.get(i…
has comment: http://stackoverflow.com/comment/41175796
accepted answer of: http://stackoverflow.com/q/26248692
answers question: http://stackoverflow.com/q/26248692
upvote count: 1
has comment: http://stackoverflow.com/comment/41175870
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/44093975
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27823893
has text: nice answer - thanks. I needed a solution that doesn't use alpha versions as that is my companies rules.
type: Comment

http://stackoverflow.com/comment/41262296
has text: Edit your first post with further informations if an issue persists
score: 0
comment on: http://stackoverflow.com/a/26295890
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41302080
comment on: http://stackoverflow.com/a/26267738
type: AnswerComment
has text: Ryan, change `new F.Function<WSResponse, Object>()` to `new F.Function<WSResponse, Result>()`(`Object' -> `Result`) and I will accept your answer. Was almost correct, just a simple type error.
score: 0
type: Comment

http://stackoverflow.com/comment/41338345
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26337833
has text: you are missing an "if" statement. *if* is prime {write to file}

http://stackoverflow.com/comment/41388205
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26297837
has text: no it still doesnt work. i thought if doing this before. but it failed
score: 0

http://stackoverflow.com/comment/41338211
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26301783
type: Comment
has text: Awesome. Did exactly what I wanted. Thanks Remko.

http://stackoverflow.com/a/26221480
answers question: http://stackoverflow.com/q/26203767
accepted answer of: http://stackoverflow.com/q/26203767
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Performing annotated instance lookups via .get() is not supported. I couldn't find a good reference post to cite. The closest is this one: Dagger 1.0 is definitely designed around having robust entry-point/injectable objects, rather than using ObjectGraph like a big annotated map. Basically, .get() was designed to be used for grabbing the root instance from your object graph under which all dependencies would be @Injected normally.

http://stackoverflow.com/comment/41115740
comment on: http://stackoverflow.com/a/26215649
score: 0
type: Comment
has text: I think there is not much use for the thing you are trying to build. You can never know in advance that the type, order, amount, ... of parameters is correct. From http everything is also a string. You don't know what to cast to. Maybe the method you need to call is a combination of that all. Suppose the method is createUser(User user) and the data you get is firstName, lastName. But first you should create a user with new User(firstName, lastName). How will you fix that? If I would fully understand what you want to create I would still see no need for it either.
type: AnswerComment

http://stackoverflow.com/a/26256608
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26220216
upvote count: 1
downvote count: 0
has body: You might want to look into using a StringBuilder in this case, for example: StringBuilder builder = new StringBuilder(); builder .append(fileTimeStamp) .append(x) .append(zCSV); String formatedString = builder.toString();

http://stackoverflow.com/comment/41267834
score: 0
has text: As pointed you are creating new Object again, Each object has its own memory area. if you want to pass object to other activity then pass using Bundle mechanism of android. follow this http://hmkcode.com/android-passing-java-object-another-activity/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26299388

http://stackoverflow.com/comment/41206221
score: 0
has text: @nmore okey it's pointing to where my src folder is located, so not to the actual folder where my files are and where the .txt file is located
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26264947

http://stackoverflow.com/q/26198655
tagged with: java
type: Question
has title: Unable to get message from client in client-server program in java
has body: I am writing a client-server program in java using TCP/IP. For the purpose, I wrote the following codes: serversock.java: import java.net.*; import java.io.*; public class serversock { public static void main(String[] args) throws IOException { ServerSocket sersock = null; try { sersock = new ServerSocket(10007); } catch (IOException e) { System.out.println("Can't listen to port 10007"); System.exit(1); } Socket clientSocket = null; System.out.println("Waiting for connection...."); try { clientSocket = sersock.accept(); } catch ( IOException ie) { System.out.println("Accept failed.."); System.exit(1); } System.out.println("Conncetion is established successfully.."); System.out.println("Waiting for input from client..."); PrintWriter output = new PrintWriter(clientSocket.getOutputStream()); BufferedReader input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); String inputLine = input.readLine(); while ( inputLine != null) { output.println(inputLine); System.out.println("Server: " + inputLine); inputLine = input.readLine(); } input.close(); clientSocket.close(); sersock.close(); } } clientsock.java: import java.util.*; import java.io.*; import java.net.*; public class clientsock { public static void main(String[] args) throws IOException { Socket sock = new Socket("localhost",10007); // Scanner scan = new Scanner(System.in); PrintWriter output = new PrintWriter(sock.getOutputStream(),true); BufferedReader input = new BufferedReader( new InputStreamReader(sock.getInputStream())); String line = null; BufferedReader stdInput = new BufferedReader( new InputStreamReader(System.in)); System.out.println("Enter data to send to server: "); line = stdInput.readLine(); while ( (line) != "bye") { output.println(line.getBytes()); line = stdInput.readLine(); System.out.println("Server sends: " + input.read()); } sock.close(); } } Now on running the programs I got the following output: server: shahjahan@shahjahan-AOD270:~/Documents/java$ java serversock Wa…
upvote count: 1
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26198780
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/41201201
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26263041
type: Comment
has text: @Ajk_P what exactly is a pretty bad practice?

http://stackoverflow.com/q/26234419
has answer: http://stackoverflow.com/a/26234744
has answer: http://stackoverflow.com/a/26234693
tagged with: arraylist
answer count: 2
downvote count: 0
has body: Probably some basic stuff I am missing here, but what is the best way to select objects matching some criteria from list? Say we have: class MyObject { int id; String type; // getters..setters } I use it: List&lt;MyObject&gt; myObjects = new ArrayList&lt;MyObject&gt;(); myObjects = getListOfObjects(); Now lets say that in the myObjects there are 10 items and 3 of them have type=="bla". At the moment I am just looping thru all the objects and within the loop decide if I want it or not, but is there a better way? I remember that in C# I used to have something like myObjects.Where(x =&gt; x.type.equals("bla")); PS, I am targeting Java 7 so no lambda for me yet.
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41148205
linked to: http://stackoverflow.com/q/10465704
has comment: http://stackoverflow.com/comment/41148037
tagged with: list
score: 1
tagged with: java
upvote count: 1
has title: Selecting specific object(s) from list with Java
type: Question
tagged with: object

http://stackoverflow.com/a/26273211
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/41220513
answers question: http://stackoverflow.com/q/26273097
downvote count: 2
has comment: http://stackoverflow.com/comment/41220528
type: Answer
has body: First the answer to your question: The property you already supplied should do what you were asking for. update The exception your are getting refers to a different problem. Hibernate can't connect to the database you specified. Pls check your connection string
has comment: http://stackoverflow.com/comment/41220648

http://stackoverflow.com/comment/41144966
has text: yes, but the problem is when this String is saved as an xml file, I get &apos; instead of ' which is unacceptable. I have changes the XML structure names but it is actually for a business application
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26231954
type: Comment

http://stackoverflow.com/comment/41266695
type: QuestionComment
comment on: http://stackoverflow.com/q/26298907
score: 6
has text: Hi, and welcome to StackOverflow. Have a read of [this](http://stackoverflow.com/help/how-to-ask), and once you have, edit the question so that there is a bit more information there and then we can begin to help you.
type: Comment

http://stackoverflow.com/comment/116837346
score: 1
comment on: http://stackoverflow.com/a/26246580
type: AnswerComment
has text: @neoedmund Unfortunately it's the other way around: the no-copy was _removed_ from the JDK. V unlikely it would then go the other direction.
type: Comment

http://stackoverflow.com/a/26261939
downvote count: 0
has body: $RespNode.toString() will be replaced at once. You have to use ${RespNode}.toString() to have it run via the eval. Otherwise see @WillP's answer (respNode.toString is evaluated at once and toString is no property) def respJson = [seatbid:] def respNode = 'respJson.seatbid[0].bid[0].price' def aValue = '666.0' Eval.me('respJson', respJson, "assert ${respNode}.toString() == '$aValue'")
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26261095

http://stackoverflow.com/comment/41146914
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26208094
type: Comment
has text: Ahh great work man, really appreciated! Will try it out in a few hours, thanks a lot!

http://stackoverflow.com/a/72806730
answers question: http://stackoverflow.com/q/26207252
type: Answer
has body: Can confirm, that I had this exact error for about a week-long, I added the dependency listed above and lombok, @Data. What this does is insert all getters, setters, empty constructor, and complete constructors. More-or-less, if you are working with a big JSON response it can cause a massive problem. Also, this ensures that the other classes that you built if objects are coming or dates are parsed correctly. LET THE COMPUTER DO THE WORK.
score: 0

http://stackoverflow.com/q/26316124
type: Question
has comment: http://stackoverflow.com/comment/41298185
has body: I need to open a project which I think it is written in linux or need linux env for building it. I use Win8 and I'mnot familiar with Linux env anymore. Iin it's README file, it is written s.th like this: HOW TO INSTALL &gt; tar xzvf DepOE-beta.tar.gz &gt; sh install-DepOE.sh Two NLP tools are installed: - DepPattern (dependency-based parser) - Tree-Tagger (PoS tagger) Pay attention: do not install the package in a directory whose name contain blank spaces! HOW TO USE depOE.sh &lt;tagger&gt; &lt;lang&gt; &lt;file&gt; [parser] tagger=freeling, treetagger language=gl, es, en, pt, fr file=path of the input file I opened it by Eclipse env which is integrated with Perl. but I couldnt open it. what should I do?? please help me:(
tagged with: perl
has title: Running a project with shell commands
has comment: http://stackoverflow.com/comment/41298274
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26316586
tagged with: nlp
tagged with: linux
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41298363

http://stackoverflow.com/a/26320117
answers question: http://stackoverflow.com/q/26309567
has body: It's located in the transitTime method that is located in the MainActivity : protected String transitTime(String endtime, String starttime) { SimpleDateFormat dt = new SimpleDateFormat("hh:mm"); Date startTime; Date endTime; long timdedifferencemillis = 0; try { startTime = dt.parse(starttime); endTime = dt.parse(endtime); timdedifferencemillis = endTime.getTime() - startTime.getTime(); // in // milliseconds } catch (ParseException e) { e.printStackTrace(); } int minutes = Math .abs((int) ((timdedifferencemillis / (1000 * 60)) % 60)); int hours = Math .abs((int) ((timdedifferencemillis / (1000 * 60 * 60)) % 24)); String hm = String.format("%02d h %02d min", hours, minutes); return hm; } You will have to tweak it yourself to return the 12hr format.
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41306735
downvote count: 0

http://stackoverflow.com/q/26211489
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42954891
tagged with: vaadin
accepted answer: http://stackoverflow.com/a/26213376
has body: I have a menubar in my vaadin application and want to add an item to open a pdf-file is a new tab of the browser. I found some solutions to open files with a button, but I have to use an MenuItem... MenuBar.Command commandHandler = new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { if (selectedItem.equals(menu_help)) { openHelp(); } } }; ... menu_help = menuBar .addItem("", WebImageList.getImage(ImageList.gc_helpIcon), commandHandler); ... private void openHelp() { // open pdf-file in new window } Thanks for help! SOLUTION: private void openHelp() { final String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath(); Resource pdf = new FileResource(new File(basepath + "/WEB-INF/datafiles/help.pdf")); setResource("help", pdf); ResourceReference rr = ResourceReference.create(pdf, this, "help"); Page.getCurrent().open(rr.getURL(), "blank_"); } Attention: This code works, but the the structure of code is not perfect ;-) Better is to store "basepath" and "pdf" as attribute...
linked to: http://stackoverflow.com/q/22354974
type: Question
answer count: 2
has title: Open pdf file from menubar using Vaadin
has answer: http://stackoverflow.com/a/26213376
score: 4
tagged with: menubar
has answer: http://stackoverflow.com/a/39415761
favorite count: 0
possible better answer: http://stackoverflow.com/a/39415761

http://stackoverflow.com/a/26313920
accepted answer of: http://stackoverflow.com/q/26313893
type: Answer
answers question: http://stackoverflow.com/q/26313893
has body: Yes that is correct. You have to use try since that is where the exception-throwing code is entered and where exceptions are caught (just using a catch block won't serve any purpose)
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/26332303
has body: I suggest you use Arrays.fill(Object[], Object) and Arrays.deepToString(Object[]). Something like, // 9x9 grid output String[][] board = new String[9][9]; for (String[] arr : board) { Arrays.fill(arr, "?"); } System.out.println(Arrays.deepToString(board));
type: Answer
answers question: http://stackoverflow.com/q/26332241
score: 0

http://stackoverflow.com/q/26244963
favorite count: 0
has body: I'm running my app on I7 with 4 cores. I have about 10 Threads which runs in the background. in addition to the 10 threads, I have an algorithm which I can rewrite it with parallelStream, but I'm not sure it will give me better performance.(The app is not deterministic, so It will not be accurate to compare the performance between the 2 ways (with or without parallel). if I have 4 cores, and I already have 10 threads, is it right to write the additional algorithm in parallel ?
tagged with: java-stream
upvote count: 3
type: UnansweredQuestion
tagged with: multithreading
tagged with: parallel-processing
score: 3
has comment: http://stackoverflow.com/comment/41168731
tagged with: java
type: Question
answer count: 1
downvote count: 0
has title: Streams in parallel & number of cores
has answer: http://stackoverflow.com/a/26246198

http://stackoverflow.com/a/26363181
has comment: http://stackoverflow.com/comment/41433026
answers question: http://stackoverflow.com/q/26347934
score: 0
has body: EditPart is selected by calling EditPart#setSelected(...). This method gets called from the SelectionManager, but best way to select something would be calling EditPartViewer#appendSelection(EditPart). EditPart#performRequest() in my experience is called for requests created programatically automatically in response for other requests. Implementation of the #perfromRequest(Request) is left to the api client. Given that there is #setSelected(...) available on the editpart not sure why one would call #performRequest(Request). Most of the requests are passed to an editpart to create a command for execution EditPart#getCommand(Request) If there is something particular you'd like to do with the selection look at the following: SelectionTool and TargetingTool #handleButtonDown() and #handleButtonDown() methods. The tool updates editpart under mouse and set the drag tracker for the tool based on the editpart under mouse Hence also see SelectEditPartTracker. Hope this helps.
type: Answer

http://stackoverflow.com/a/26260173
has comment: http://stackoverflow.com/comment/41195468
downvote count: 0
type: Answer
has body: 1) I suggest you to set -Xmx2100m and observe heap usage under load. JVM may take as much OS memory as it decide to be performant, until it reaches Xmx limit. In modern JVMs default Xmx is calculated upon total memory available in OS, so it may be large value. I think your app does not have memory leak, your JVM simply allocate a lot of memory, because it can. Observe your JVM thru jvisualvm. 2) Second suggestion - do you use any JNI code? Does your app call any native library (ie. dll under windows)?
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26259099

http://stackoverflow.com/comment/93934171
type: AnswerComment
score: 0
has text: What have you tried @Ridhuvarshan? Why didn't it work?
type: Comment
comment on: http://stackoverflow.com/a/26313517

http://stackoverflow.com/comment/41252896
has text: lol paxdiablo I was supposed to write 900K initially but opted for 900T since I thought 900K might be read as kilobytes :p
comment on: http://stackoverflow.com/q/26291071
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41818158
comment on: http://stackoverflow.com/q/26234067
has text: My full statement: QRolloutMeta qRolloutMeta = new QRolloutMeta(qRollout, NumberTemplate.create(Long.class, qBTS.count().toString()), NumberTemplate.create(Integer.class, btsNbPlanned.toString()), NumberTemplate.create(Integer.class, btsNbCompleted.toString()), NumberTemplate.create(Integer.class, btsPercentage.toString())); List<RolloutMeta> resultList = query.distinct().list(qRolloutMeta);
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26270091
has comment: http://stackoverflow.com/comment/41216022
type: Answer
answers question: http://stackoverflow.com/q/26270005
has comment: http://stackoverflow.com/comment/41215895
has body: Use below code: String quantity = keyboard.next(); // use keyboard.next() instead of keyboard.nextInt() // because it will throw Exception if value is other //than int boolean flag = quantity.matches("[0-9]+"); if (flag) { if (Integer.parseInt(quantity) &lt; 0 || Integer.parseInt(quantity) &gt; 150) { flag = false; } } if (!flag) { System.out.println(); System.out.println("\t Invalid item price."); System.out.println("\t Please run the program again"); System.out.println(); System.out.println("Thank you for using \"Temple\" store"); System.exit(0); }
score: 0
has comment: http://stackoverflow.com/comment/41215637
has comment: http://stackoverflow.com/comment/41215044
has comment: http://stackoverflow.com/comment/41215715

http://stackoverflow.com/comment/41211451
type: Comment
type: QuestionComment
score: 1
has text: I'd recommend using a `ByteArrayOutputStream` or `ByteBuffer` or similar. `ArrayList<Byte>` will have a large memory footprint from boxing every `byte` as a `Byte` object.
comment on: http://stackoverflow.com/q/26268355

http://stackoverflow.com/q/26284300
answer count: 2
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41240282
favorite count: 0
linked to: http://stackoverflow.com/q/12399205
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41240294
has body: I have a small issue with a Java program I am doing at the moment: public class PrimeNumbers { public static void computePrimeNumbers(boolean[] prime, int n) { for (int i = 2; i &lt; n; i++) { if (prime[i] == true) { for (int j = 2; j &lt; n; j++) { if ((j%i == 0) &amp;&amp; (j != i)) { prime[j] = false; //System.out.println(j + " = " + prime[j]); } } } } } public static void main(String[] args) { int n = 13; boolean[] prime = new boolean[n]; prime[0] = false; prime[1] = false; for (int i = 2; i &lt; n; i++) { prime[i] = true; } computePrimeNumbers(prime, n); for (int i = 0; i &lt; n; i++) { System.out.println(i + " = " + prime[i]); } } } The program should output "true" if the integer (i) is a prime, and false if otherwise. The commented out piece of code in the if-statement within the nested for loop gives me the correct boolean statements (i.e. it shows the integers which aren't prime numbers when running it), however the last for loop within main seems to just show the initial values given to the prime array - so I assume the results from the computePrimeNumbers are being overwritten somehow, somewhere. Thanks for any help in advance.
has comment: http://stackoverflow.com/comment/41240446
has comment: http://stackoverflow.com/comment/41240289
tagged with: primes
has answer: http://stackoverflow.com/a/26284376
has comment: http://stackoverflow.com/comment/41240384
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41240322
has answer: http://stackoverflow.com/a/26284411
has title: Outputting correct prime numbers in Java
duplicate of: http://stackoverflow.com/q/12399205
has comment: http://stackoverflow.com/comment/41240563
score: -1

http://stackoverflow.com/a/26288102
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26285495
has body: enum Note { C, C_, D, D_, E, F, F_, G, G_, A, A_, B; public Note above() { return ordinal() != values().length - 1 ? Note.values()[ordinal() + 1] : Note.values()[0]; } public Note below() { return ordinal() &gt; 0 ? Note.values()[ordinal() - 1] : Note.values()[Note.values().length - 1]; } } interface Scale { ListIterator&lt;Note&gt; joinAfter(Note note); } Scale ascending = new Scale() { List&lt;Note&gt; notes = asList(C, D, E, F_, G); @Override public ListIterator&lt;Note&gt; joinAfter(Note note) { return notes.listIterator(notes.contains(note)? notes.indexOf(note) : notes.indexOf(note.above())); } }; Scale descending = new Scale() { List&lt;Note&gt; notes = asList(A, C_, E, F, G, G_); @Override public ListIterator&lt;Note&gt; joinAfter(Note note) { return notes.listIterator(notes.contains(note)? notes.indexOf(note) : notes.indexOf(note.below())); } }; I'd recomend to add your own Iterator wrapper which will call previous for next in descendingScale (if you don't want for some reason reverse notes there) and more importantly allow you to infinitely loop through scales. If this is just a school asignment you better stick with the numbers and don't mess with the lists of strings untill you need to print things out. Btw array will be a better choice here.

http://stackoverflow.com/a/26280573
score: 0
has body: Try this for precise calculations. BigDecimal is more accurate than double. String quantityInString="700g"; int indexOfg=quantityInString.indexOf("g"); String onlyQuantityInString=quantityInString.substring(0, indexOfg); BigDecimal onlyQuantityInInt= new BigDecimal(onlyQuantityInString); BigDecimal perUnitCostOfThisItem= new BigDecimal("29.00"); BigDecimal returnFloat= new BigDecimal(onlyQuantityInString); returnFloat = returnFloat.divide(new BigDecimal("1000")); returnFloat = returnFloat.multiply(perUnitCostOfThisItem); System.out.println("returnFloat="+returnFloat); If you need precise calculations BigDecimal should be used rather than float and double. The output for this code is: returnFloat=20.300
type: Answer
answers question: http://stackoverflow.com/q/26280411

http://stackoverflow.com/a/26292876
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41256991
has comment: http://stackoverflow.com/comment/41256072
has comment: http://stackoverflow.com/comment/41256309
type: Answer
has comment: http://stackoverflow.com/comment/41255935
downvote count: 0
has comment: http://stackoverflow.com/comment/41256810
accepted answer of: http://stackoverflow.com/q/26292825
score: 1
has body: Initialize the variables in the method from which filterLocation is called. Seems like you are not initializing the variable there. EDIT: There is a condition in your code if(entries!=0){ which prevents the initialization. The compiler is pointing out the condition What if the entries = 0 ? That condition is not met. You should met that condition too for avoiding compilation error. See a dummy code below. public static void main(String[] args) { int a; if (args != null) { a = 10; } else { a = 11; } sampleMethod(a); } public static void sampleMethod(int a) { // TODO Auto-generated method stub } Remove the else condition, and see the compilation error. Hope you understand the problem. EDIT Or Call the method inside the condition itself. See dummy code. public static void main(String[] args) { int a; if (args != null) { a = 10; sampleMethod(a); } } public static void sampleMethod(int a) { // TODO Auto-generated method stub } EDIT Or the variable should be at class level. public class TestMethod { private int a; public static void main(String[] args) { TestMethod method = new TestMethod(); method.wrapperMethod(args); } public void wrapperMethod(String[] args) { if (args != null) { a = 10; } sampleMethod(a); } public static void sampleMethod(int a) { // TODO Auto-generated method stub } Quoting from java spec Each method parameter (§8.4.1) is initialized to the corresponding argument value provided by the invoker of the method (§15.12). A local variable (§14.4, §14.14) must be explicitly given a value before it is used, by either initialization (§14.4) or assignment (§15.26), in a way that can be verified using the rules for definite assignment (§16).
answers question: http://stackoverflow.com/q/26292825
has comment: http://stackoverflow.com/comment/41256138
has comment: http://stackoverflow.com/comment/41255806
upvote count: 1

http://stackoverflow.com/a/31244324
answers question: http://stackoverflow.com/q/26253525
has body: The problem is in where you create the socket. you should specify the contextRoot of your project var socket = new SockJS('{contextRoot}/hello');
score: 0
type: Answer

http://stackoverflow.com/q/26307545
linked to: http://stackoverflow.com/q/5908466
answer count: 1
has body: I have a javascript object: function getSearchBO() { var individual = ($('#individual').attr('checked') == 'checked') ? "true" : "false"; var organization = ($('#organization').attr('checked') == 'checked') ? "true" : "false" var enrollmentId = $('#enrollmentId').attr('value').trim(); var medicareId = $('#medicareId').attr('value').trim(); var npi = $('#npi').attr('value').trim(); var contractId = $('#contractId').attr('value').trim(); var firstName = $('#firstName').attr('value').trim(); var lastName = $('#lastName').attr('value').trim(); var ssn = $('#ssn').attr('value').trim(); var dob = $('#dob').attr('value').trim(); var licenseNumber = $('#licenseNumber').attr('value').trim(); var licenseState = $('#licenseState').attr('value').trim(); var specialtyType = $('#specialtyType').attr('value').trim(); var licenseExpirationDate = $('#licenseExpirationDate').attr('value') .trim(); var businessName = $('#businessName').attr('value').trim(); var ein = $('#ein').attr('value').trim(); var organizationType = $('#organizationType').attr('value').trim(); var ciy = $('#ciy').attr('value').trim(); var state = $('#state').attr('value').trim(); var zipCode = $('#zipCode').attr('value').trim(); var startDate = $('#startDate').attr('value').trim(); var endDate = $('#endDate').attr('value').trim(); var searchBO = { "individual" : individual, "organization" : organization, "enrollmentId" : enrollmentId, "medicareId" : medicareId, "npi" : npi, "contractId" : contractId, "firstName" : firstName, "lastName" : lastName, "ssn" : ssn, "dob" : dob, "licenseNumber" : licenseNumber, "licenseState" : licenseState, "specialtyType" : specialtyType, "licenseExpirationDate" : licenseExpirationDate, "businessName" : businessName, "ein" : ein, "organizationType" : organizationType, "ciy" : ciy, "state" : state, "zipCode" : zipCode, "startDate" : startDate, "endDate" : endDate } return searchBO; } SearchBO.java import java.io.Serializable; public class SearchBO implements Serializable { private Str…
tagged with: ajax
has title: JQuery datatable passing JSON to Spring controller, got error 400 Bad Request
has answer: http://stackoverflow.com/a/26342470
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
type: Question
tagged with: javascript
score: 0

http://stackoverflow.com/a/26329904
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26329647
has body: As @MarsAtomic commented, this is more suited for a Comparator, not equals. Even if the Giants and Dodgers finish with the same record, I don't think you want to consider them "equals". And you are likely to want to rank the teams by performance. public static Comparator&lt;Team&gt; BY_PCT = new Comparator&lt;Team&gt;() { public int compare(Team t1, Team t2) { double winPct1 = t1.getPercentOfGamesWon(); double winPct2 = t2.getPercentOfGamesWon(); return Double.compare( winPct1, winPct2); } }; You could also implement Comparable as in Vince's answer.
score: 1
upvote count: 1

http://stackoverflow.com/a/26292798
type: Answer
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26292736
has body: The parts of the regex are: (?&lt;!\\w) = "the preceding char is not a "word" char [tT] = either "t" or "T" \\w+ = "one or more "word" chars Over all, it means "a word that starts with T and is at least 2 chars long" Incidentally, this can be expressed more succinctly as: \b[tT]\\w+ \b meaning "word boundary"

http://stackoverflow.com/comment/41252700
type: AnswerComment
has text: That is not an issue, in my java program and in the script I can have a sleep command that can wait till the value in var is populated (it value in var does get populate at all)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26290923

http://stackoverflow.com/q/26243623
has answer: http://stackoverflow.com/a/26244394
type: Question
downvote count: 0
has title: Retrofit returning null object
favorite count: 0
answer count: 3
tagged with: retrofit
tagged with: android
accepted answer: http://stackoverflow.com/a/26244394
score: 2
has answer: http://stackoverflow.com/a/26243747
upvote count: 2
has body: I have a JSON object that looks like this { id:int, tags: [ "string", "string" ], images: { waveform_l:"url_to_image", waveform_m:"url_to_image", spectral_m:"url_to_image", spectral_l:"url_to_image" } } I'm trying to use retrofit to parse the JSON and create the interface. The problem that I have is that I get a null for the images urls. Everything else works, I am able to retrieve the id, the tags, but when I try to get the images they are all null. I have a sound pojo that looks like this: public class Sound { private Integer id; private List&lt;String&gt; tags = new ArrayList&lt;String&gt;(); private Images images; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Images getImages() { return images; } public void setImages(Images images) { this.images = images; } ... setters and getter for tags as well } and I have a Images pojo that looks like this: public class Images { private String waveformL; private String waveformM; private String spectralM; private String spectralL; public String getWaveformL() { return waveformL; } public void setWaveformL(String waveformL) { this.waveformL = waveformL; } public String getWaveformM() { return waveformM; } public void setWaveformM(String waveformM) { this.waveformM = waveformM; } public String getSpectralM() { return spectralM; } public void setSpectralM(String spectralM) { this.spectralM = spectralM; } public String getSpectralL() { return spectralL; } public void setSpectralL(String spectralL) { this.spectralL = spectralL; } } Whenever I try to call images.getWaveformM() it gives me a null pointer. Any ideas?
possible better answer: http://stackoverflow.com/a/26243871
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41166084
has answer: http://stackoverflow.com/a/26243871
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/41282896
type: QuestionComment
has text: JAVA_18 should be 5. Are you **sure** you're using that JDK?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26307477

http://stackoverflow.com/a/26203037
downvote count: 0
answers question: http://stackoverflow.com/q/26202641
has comment: http://stackoverflow.com/comment/41096901
score: 3
has comment: http://stackoverflow.com/comment/41098416
upvote count: 3
has comment: http://stackoverflow.com/comment/41097734
has body: You're adding all the components and images to a single panel having the default FlowLayout. Instead, use GridLayout for the picture labels and add the browse button to the frame's default BorderLayout, as shown below. As tested: import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; public class ImagePreview { JFrame mainFrame = new JFrame("Image Preview"); JPanel picHolder = new JPanel(new GridLayout(0, 1)); public ImagePreview() { JButton getImages = new JButton("Browse Images"); getImages.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { CreatePreviews(); } }); mainFrame.add(getImages, BorderLayout.NORTH); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.add(new JScrollPane(picHolder)); mainFrame.pack(); mainFrame.setLocationByPlatform(true); mainFrame.setVisible(true); } public void CreatePreviews() { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(true); chooser.showOpenDialog(mainFrame); File[] selectedImages = chooser.getSelectedFiles(); for (int a = 0; a &lt; selectedImages.length; a++) { try { BufferedImage myPicture = ImageIO.read(new File(selectedImages[a].getAbsolutePath())); JLabel picLabel = new JLabel(new ImageIcon(myPicture)); picHolder.add(picLabel); mainFrame.pack(); } catch (IOException ex) { ex.printStackTrace(); } } } public static void main(String[] args) { java.awt.EventQueue.invokeLater(() -&gt; { new ImagePreview(); }); } }
type: Answer
has comment: http://stackoverflow.com/comment/41097795

http://stackoverflow.com/comment/41293810
has text: On the other hand here ( https://news.ycombinator.com/item?id=3725723 ) you will find a couple of valid points towards bcrypt (or against pbkdf2 if you prefer).
comment on: http://stackoverflow.com/q/26311686
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41176648
type: Comment
comment on: http://stackoverflow.com/q/26249247
has text: instead of putting the message in the session, why don't you refactor your code, make a normal ajax request and return json string through the response ?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41304424
type: QuestionComment
has text: I tested it and I actually get the question to play again
comment on: http://stackoverflow.com/q/26319105
score: 0
type: Comment

http://stackoverflow.com/a/26246877
has body: if ((j+k &lt;= board[i].length) || (letters[k] != board[i][j+k])) { also needs to be reversed: if ((j - k &lt; 0) || (letters[k] != board[i][j-k])) {
answers question: http://stackoverflow.com/q/26246834
type: Answer
has comment: http://stackoverflow.com/comment/41238055
has comment: http://stackoverflow.com/comment/41238080
has comment: http://stackoverflow.com/comment/41208243
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26246834

http://stackoverflow.com/comment/41242307
has text: Updated, I've a new problem =(
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26284824
type: Comment

http://stackoverflow.com/q/26339842
has body: Getting this error "error: package jxl does not exist" while executing build.xml file using command prompt/hudson tool I am using Testng+ant to run my existing developed selenium webdriver scripts which are in hybrid+page factory framework I am able to generate the testngXSLT reports when i have a scripts in a single class i.e., in a functional driven framework. Below is my Build.xml file. <?xml version ="1.0" encoding="iso-8859-1"?> <property environment="env"/> <property name="ws.home" value="${basedir}"/> <property name="ws.jars" value="D:\jar-files"/> <property name="test.dest" value="${ws.home}/build"/> <property name="test.src" value="${ws.home}/src"/> <property name="ng.result" value="test-output"/> <pathconvert pathsep=":" property="test.classpath" refid="classpath_jars"/> <format property="start.time" pattern="MM/dd/yyyy hh:mm aa" /> <os family="windows" /> <taskdef name="testng" classpath="${test.classpath}" classname="org.testng.TestNGAntTask" /> <xmlfileset dir="test-output" includes="BulkinviteExecute.xml"/> <!-- <classfileset dir="${test.dest}" includes="example1/*.class"/> --> ant run will execute the test <zip destfile="${ws.home}/XSLT_Reports/output.zip" basedir="${ws.home}/XSLT_Reports/output"/> <include name="**/*.zip"/> Not able to find out the mistake ,help me in figuring out a solution...
tagged with: ant
accepted answer: http://stackoverflow.com/a/28363970
score: 0
answer count: 2
has title: Unable to run selenium web-driver scripts through build.xml using ANT
has answer: http://stackoverflow.com/a/28363970
possible better answer: http://stackoverflow.com/a/26340068
tagged with: http://stackoverflow.com/tag/xml
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26340068
tagged with: xslt
type: Question

http://stackoverflow.com/comment/41139913
score: 0
has text: You use a HikariDataSource like you would use any other DataSource: call `getConnection()` on the DataSource to get a connection, then use this connection, then call `connection.close()` when you're done with the connection. This is standard JDBC.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26223227

http://stackoverflow.com/q/26334186
tagged with: java
type: Question
tagged with: data-structures
has comment: http://stackoverflow.com/comment/41331652
has answer: http://stackoverflow.com/a/26334339
has comment: http://stackoverflow.com/comment/41332565
has comment: http://stackoverflow.com/comment/41332830
has title: Understanding linked lists (Java)
has answer: http://stackoverflow.com/a/26334865
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41331964
has comment: http://stackoverflow.com/comment/41331698
possible better answer: http://stackoverflow.com/a/26334339
has answer: http://stackoverflow.com/a/26334249
accepted answer: http://stackoverflow.com/a/26334249
has body: can someone please tell me if I am correct? I am studying for a midterm. x is a variable pointing to a linked-list node and not the last node on the list. t points to a new node that is not in the list. x.next = t; t.next = x.next; I believe when it comes time to update t.next, x.next is no longer the original node following x, but is instead t itself. So it create a cycle in the list t = x.next x = t; I believe this does nothing to the list. Thank you in advance!!
has comment: http://stackoverflow.com/comment/41331622
type: AnsweredQuestion
tagged with: linked-list
linked to: http://stackoverflow.com/q/24895790

http://stackoverflow.com/q/26317123
accepted answer: http://stackoverflow.com/a/26318744
tagged with: dbpedia
duplicate of: http://stackoverflow.com/q/15663510
tagged with: sparql
has body: So, im doing a simple query. I want all uri/property/object of a certain dbpedia uri, ex: http://dbpedia.org/resource/Roger_Federer. The problem is, it returns just the property of it, as we can see on the resultset. Class: public class SemanticCrawlerImpl implements SemanticCrawler { public void search(Model graph, String resourceURI) { graph.read(resourceURI); // Create a new query String queryString = "SELECT ?url ?property ?object" + "WHERE {" + " &lt;"+resourceURI+"&gt; ?property ?object ." + "}"; Query query = QueryFactory.create(queryString); System.out.println("----------------------"); System.out.println("Query Result Sheet"); System.out.println("----------------------"); // Execute the query and obtain results QueryExecution qe = QueryExecutionFactory.create(query, graph); com.hp.hpl.jena.query.ResultSet results = qe.execSelect(); // Output query results ResultSetFormatter.out(System.out, results, query); qe.close(); } } Resultset | url | property | objectWHERE | ================================================================================= | | &lt;http://dbpedia.org/property/medaltemplatesTitle&gt; | | | | &lt;http://dbpedia.org/ontology/thumbnail&gt; | | | | &lt;http://www.w3.org/2002/07/owl#sameAs&gt; | | | | &lt;http://www.w3.org/2002/07/owl#sameAs&gt; | | | | &lt;http://www.w3.org/2002/07/owl#sameAs&gt; | | | | &lt;http://www.w3.org/2002/07/owl#sameAs&gt; | | | | &lt;http://dbpedia.org/property/name&gt; | | | | &lt;http://dbpedia.org/property/daviscupresult&gt; | | | | &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; | | | | &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; | | | | &lt;http://dbpedia.org/property/hopmancupresult&gt; | | | | &lt;http://dbpedia.org/ontology/wikiPageExternalLink&gt; | | | | &lt;http://purl.org/dc/terms/subject&gt; | | | | &lt;http://www.w3.org/2002/07/owl#sameAs&gt; | | | | &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; | | | | &lt;http://purl.org/dc/terms/subject&gt; | | | | &lt;http://www.w3.or…
tagged with: http://stackoverflow.com/tag/rdf
linked to: http://stackoverflow.com/q/15663510
has answer: http://stackoverflow.com/a/26318744
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41329792
tagged with: java
has title: Sparql query does not return uri/object
type: Question
tagged with: endpoint
answer count: 1
score: 0

http://stackoverflow.com/q/26231284
has body: Is that possible to upload a file into 2 different folders in the same time ? The problem I'm having is i can only upload 1 file into 1 folder only. try{ private String uploadPathBig = "D:/dataBig/"; private String uploadPathSmall ="D:/dataSmall/"; private int maxFileSize = 1024 * 1024 *100000 ; MultipartParser parser = new MultipartParser(request,maxFileSize); Part _part = null; if ((_part = parser.readNextPart()) !=null){ if (_part.isFile()){ FilePart fPart =(FilePart) _part; fPart.writeTo(new java.io.File(uploadPathBig)); String name = fPart.getFileName(); System.out.println("name="+name); } } }catch (java.io.IOException ioe){ throw new java.io.IOException("IOException occureed in:"+ getClass().getName()); } } }
type: Question
has comment: http://stackoverflow.com/comment/41142721
tagged with: servlets
has answer: http://stackoverflow.com/a/26231921
answer count: 1
downvote count: 0
has title: Java Servlet upload one file to multiple folders
tagged with: file-upload
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/26231921
score: 2
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26253525
type: UnansweredQuestion
tagged with: spring
tagged with: java
has answer: http://stackoverflow.com/a/31244324
tagged with: spring-java-config
type: Question
tagged with: spring-websocket
has body: How to config spring-websocket with 'WebApplicationInitializer': WebAppInitializer.java public class WebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext)throws ServletException { AnnotationConfigWebApplicationContext SpringWebSocketContext = new AnnotationConfigWebApplicationContext(); SpringWebSocketContext.register(WebSocketConfig.class); } } WebSocketConfig.java @Configuration @EnableWebSocketMessageBroker @ComponentScan({ "service" }) public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic"); config.setApplicationDestinationPrefixes("/app"); } @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/hello").withSockJS(); } } GreetingController.java @Controller public class GreetingController { @MessageMapping("/hello") @SendTo("/topic/greetings") public Greeting greeting(HelloMessage message) throws Exception { Thread.sleep(3000); // simulated delay return new Greeting("Hello, " + message.getName() + "!"); } } index.html Hello WebSocket Seems your browser doesn't support Javascript! Websocket relies on Javascript being enabled. Please enable Javascript and reload this page! Connect Disconnect What is your name? Send when I run it,an error occurred in browser console. Opening Web Socket... stomp.js:145 GET http://127.0.0.1:8080/hello/info 404 (Not Found) sockjs.min.js:27 Whoops! Lost connection to undefined stomp.js:145
answer count: 1
has title: How to config spring-websocket with 'WebApplicationInitializer'
score: 0

http://stackoverflow.com/a/26299166
has body: You need to make a another Arralist. in this list you just add periods(like you did for actorsList) mainclass add ArrayList&lt;Integer&gt; periods; in onCreate() periods=new ArrayList&lt;Integer&gt;(); in doInBackground try { periods.add(Integer.parseInt(object.getString("period").toString())); Log.d("period: ", object.getString("period")); } catch (NumberFormatException nfe) { System.out.print("could not parse:" + nfe); }
answers question: http://stackoverflow.com/q/26298679
type: Answer
has comment: http://stackoverflow.com/comment/41267635
has comment: http://stackoverflow.com/comment/41267392
has comment: http://stackoverflow.com/comment/41267459
score: 0

http://stackoverflow.com/comment/41301305
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26271261
has text: I changed that and it's still not working :(, updated github check it out

http://stackoverflow.com/comment/41098658
comment on: http://stackoverflow.com/a/26207579
score: 0
type: AnswerComment
has text: So I have not tested anything with the JTextArea yet (although I will) but is there anyway to change other features like colour of the JTextArea, and also the ability to bold certain areas of text? If so I can probably make it identical to what I already have.
type: Comment

http://stackoverflow.com/comment/41318937
comment on: http://stackoverflow.com/q/26327430
has text: Oh yeah that was from when I was trying to use a char[] so it could be final.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41332363
comment on: http://stackoverflow.com/q/26334424
score: 0
type: Comment
type: QuestionComment
has text: You should only get the parameters of B.init. I think that you either have an overload of the method or you're not looking at the right class.

http://stackoverflow.com/comment/41169827
type: Comment
has text: I understand the role of properties files and xml as Configuration parameters which can be changed across domains. However, IoC configurations such as calling constructors, factory methods, etc are tightly coupled with the code and method/constructor signatures. An example is web.Config for IIS applications which is based on xml but is purely for configuration purpose not coding.
comment on: http://stackoverflow.com/a/26245609
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41319294
type: Comment
has text: can you show what you have done? what exactly is bothering you?
type: QuestionComment
comment on: http://stackoverflow.com/q/26327642
score: 0

string
tags question: http://stackoverflow.com/q/26270191
tags question: http://stackoverflow.com/q/26272931
tags question: http://stackoverflow.com/q/26266643
tags question: http://stackoverflow.com/q/26288122
tags question: http://stackoverflow.com/q/26260136
tags question: http://stackoverflow.com/q/26234792
tags question: http://stackoverflow.com/q/26297524
tags question: http://stackoverflow.com/q/26267896
tags question: http://stackoverflow.com/q/26198364
tags question: http://stackoverflow.com/q/26316674
tags question: http://stackoverflow.com/q/26226176
tags question: http://stackoverflow.com/q/26298822
tags question: http://stackoverflow.com/q/26341679
tags question: http://stackoverflow.com/q/26286698
tags question: http://stackoverflow.com/q/26269592
tags question: http://stackoverflow.com/q/26235542
tags question: http://stackoverflow.com/q/26230445
tags question: http://stackoverflow.com/q/26330070
tags question: http://stackoverflow.com/q/26310033
tags question: http://stackoverflow.com/q/26312646
tags question: http://stackoverflow.com/q/26239777
tags question: http://stackoverflow.com/q/26230336
tags question: http://stackoverflow.com/q/26255120
tags question: http://stackoverflow.com/q/26207255
tags question: http://stackoverflow.com/q/26351251
tags question: http://stackoverflow.com/q/26351882
tags question: http://stackoverflow.com/q/26309980
tags question: http://stackoverflow.com/q/26264985
tags question: http://stackoverflow.com/q/26198737
tags question: http://stackoverflow.com/q/26197495
tags question: http://stackoverflow.com/q/26221263
tags question: http://stackoverflow.com/q/26213813
tags question: http://stackoverflow.com/q/26306135
tags question: http://stackoverflow.com/q/26216745
tags question: http://stackoverflow.com/q/26266878
tags question: http://stackoverflow.com/q/26248813
tags question: http://stackoverflow.com/q/26337002
tags question: http://stackoverflow.com/q/26293423
tags question: http://stackoverflow.com/q/26308699
tags question: http://stackoverflow.com/q/26232863
tags question: http://stackoverflow.com/q/26267953
tags question: http://stackoverflow.com/q/26195219
tag name: string
tags question: http://stackoverflow.com/q/26350996
tags question: http://stackoverflow.com/q/26224180
tags question: http://stackoverflow.com/q/26238144
tags question: http://stackoverflow.com/q/26270266
tags question: http://stackoverflow.com/q/26320900
tags question: http://stackoverflow.com/q/26205265
tags question: http://stackoverflow.com/q/26330724
tags question: http://stackoverflow.com/q/26334189
tags question: http://stackoverflow.com/q/26222155
tags question: http://stackoverflow.com/q/26351815
tags question: http://stackoverflow.com/q/26316745
tags question: http://stackoverflow.com/q/26201630
tags question: http://stackoverflow.com/q/26305101
tags question: http://stackoverflow.com/q/26209122
tags question: http://stackoverflow.com/q/26252919
tags question: http://stackoverflow.com/q/26217112
tags question: http://stackoverflow.com/q/26201002
tags question: http://stackoverflow.com/q/26314209
tags question: http://stackoverflow.com/q/26289173
type: Tag
tags question: http://stackoverflow.com/q/26249122
tags question: http://stackoverflow.com/q/26289814
tags question: http://stackoverflow.com/q/26245388
tags question: http://stackoverflow.com/q/26318370
tags question: http://stackoverflow.com/q/26297243
tags question: http://stackoverflow.com/q/26288962
tags question: http://stackoverflow.com/q/26235585
tags question: http://stackoverflow.com/q/26335792
tags question: http://stackoverflow.com/q/26276688
tags question: http://stackoverflow.com/q/26312576
tags question: http://stackoverflow.com/q/26351456
tags question: http://stackoverflow.com/q/26197834
tags question: http://stackoverflow.com/q/26252334
tags question: http://stackoverflow.com/q/26290043
tags question: http://stackoverflow.com/q/26311771
tags question: http://stackoverflow.com/q/26279208
tags question: http://stackoverflow.com/q/26317464

http://stackoverflow.com/q/26249506
tagged with: spring-data
upvote count: 7
linked to: http://stackoverflow.com/q/31816468
accepted answer: http://stackoverflow.com/a/26420022
tagged with: java
tagged with: spring-data-rest
has answer: http://stackoverflow.com/a/26420022
type: AnsweredQuestion
downvote count: 0
score: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/41186888
has body: There are some Entities with composite Primary Keys and these entities when exposed are having incorrect Links having full qualified name of classes in URL inside _links Also clicking on links gives such errors - org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type com.core.connection.domains.UserFriendshipId I have XML configured Spring Repository with jpa:repositories enabled and Respository extending from JpaRepository Can I make Repository implement org.springframework.core.convert.converter.Converter to handle this. Currently getting links as below - _links: { userByFriendshipId: { href: "http://localhost:8080/api/userFriendships/com.core.connection.domains.UserFriendshipId@5b10/userByFriendId" } in xml config , I have jpa:repositories enabled and @RestResource enabled inside Repositories
type: Question
has answer: http://stackoverflow.com/a/32000692
tagged with: spring
possible better answer: http://stackoverflow.com/a/32000692
has title: How to expose @EmbeddedId converters in Spring Data REST
answer count: 2

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/26302568
tags question: http://stackoverflow.com/q/26322518
tags question: http://stackoverflow.com/q/26337508
tags question: http://stackoverflow.com/q/26202303
tags question: http://stackoverflow.com/q/26243347
tags question: http://stackoverflow.com/q/26324136
tags question: http://stackoverflow.com/q/26353571
tags question: http://stackoverflow.com/q/26265575
tags question: http://stackoverflow.com/q/26260831
tags question: http://stackoverflow.com/q/26300924
type: Tag
tags question: http://stackoverflow.com/q/26205584
tags question: http://stackoverflow.com/q/26205627
tags question: http://stackoverflow.com/q/26345992
tags question: http://stackoverflow.com/q/26231385
tags question: http://stackoverflow.com/q/26312862
tags question: http://stackoverflow.com/q/26206520
tags question: http://stackoverflow.com/q/26279672

http://stackoverflow.com/comment/41111460
type: QuestionComment
comment on: http://stackoverflow.com/q/26211609
score: 0
has text: There's no property because it is already observable (it's an `ObservableList`). It's not the reference to the list that ever changes, but the contents, so wrapping it in a property would be pretty redundant.
type: Comment

http://stackoverflow.com/q/26200125
has comment: http://stackoverflow.com/comment/41084719
has comment: http://stackoverflow.com/comment/41084576
has answer: http://stackoverflow.com/a/26200211
has title: java split string into array by a few charaters
has answer: http://stackoverflow.com/a/26200192
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has body: got a string that looks like this: "abc", "def", "ghi" I need to split string to array like this: abc def ghi I tried: String [] strArray = sb.toString().split(" ,\""); but it doesn't work.
score: 1
upvote count: 3
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/q/26308278
has title: PDF page to Image, Apportable BridgeKit
score: 0
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
tagged with: apportable
tagged with: android
has body: I modified some code from this post: Need help to convert a Pdf page into Bitmap in Android Java To try and get a page from the pdf, convert it to a byte[] and pass it back to a Xcode project to be displayed. I'm doing this using Apportables BridgeKit framework and it compiles without any errors. The problem is that the app crashes once loaded on to the device. ImageExtractor.java package com.pdflib; import android.graphics.Bitmap; import android.os.Environment; import android.util.Log; import com.sun.pdfview.PDFFile; import com.sun.pdfview.PDFPage; import net.sf.andpdf.nio.ByteBuffer; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.RandomAccessFile; public class ImageExtractor { //Globals: private int ViewSize = 0; //Load Images: private byte[] pdfLoadImages() { try { File file = new File(Environment.getExternalStorageDirectory().getPath() + "/backs.pdf"); RandomAccessFile f = new RandomAccessFile(file, "r"); byte[] data = new byte[(int)f.length()]; f.readFully(data); //create pdf document object from bytes ByteBuffer bb = ByteBuffer.NEW(data); PDFFile pdf = new PDFFile(bb); //Get the first page from the pdf doc PDFPage PDFpage = pdf.getPage(1, true); //create a scaling value according to the WebView Width final float scale = ViewSize / PDFpage.getWidth() * 0.95f; //convert the page into a bitmap with a scaling value Bitmap page = PDFpage.getImage((int)(PDFpage.getWidth() * scale), (int)(PDFpage.getHeight() * scale), null, true, true); //save the bitmap to a byte array ByteArrayOutputStream stream = new ByteArrayOutputStream(); page.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); stream.reset(); return byteArray; } catch (Exception e) { Log.d("error", e.toString()); } return null; } } MainScene.m #import "MainScene.h" #import "CreateTexture.h" @implementation MainScene - (void)didLoadFromCCB { CGSize size = CGSizeMake(100, 75); CreateTexture* sprite = [[CreateTexture alloc] initWithBackSize: size]…
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8814758
tagged with: java
accepted answer: http://stackoverflow.com/a/26346870
type: Question
has answer: http://stackoverflow.com/a/26346870
tagged with: image

http://stackoverflow.com/q/26251911
tagged with: repository
tagged with: nexus
type: UnansweredQuestion
tagged with: maven
tagged with: java
has title: Access Repository containing folders with jars
type: Question
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/26252568
score: 0
has body: I need some help with my project and would love to get it here. What i want to do: compare JAR files. More precisely i want to access the .class files and have a look on the parameters of methods. This part is done so far. My Problem: A big part of the JARs i want to compare lie on a Repo which is accessible through its url. Is there a way in which i can access the URL and iterate through the folders in that repo getting to the JAR files? I hope someone here can help me. Thank you very much Best Regards, Ronald Rempel P.S.: It is a Nexus Repo. So maybe there is a more direct way to get to the folders and JARs in that Repo. Maybe an API for a Nexus Repo?

http://stackoverflow.com/q/26287666
has body: I'm using Java 1.6.0_41 and I have a listener attached to when frames are about to close. System.exit(0) is successfully being called and the window for the application closes. However, in the Task Manager, javaw.exe is still running. Which thread is causing the block? Update It looks like the awt.windows is still running and thus the shutdown hooks aren't finishing. Calling dispose() on Windows 8 prior to calling System.exit allows my app to close and the jvm to exit. 2014-10-15 12:31:58 Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.14-b01 mixed mode): "RMI TCP Connection(2)-192.168.10.70" daemon prio=6 tid=0x00000000075a3000 nid=0x163c runnable [0x000000000a7df000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:237) - locked &lt;0x00000007ac9dc9c0&gt; (a java.io.BufferedInputStream) at java.io.FilterInputStream.read(FilterInputStream.java:66) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:517) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) Locked ownable synchronizers: - &lt;0x00000007ac778c70&gt; (a java.util.concurrent.locks.ReentrantLock$NonfairSync) "JMX server connection timeout 84" daemon prio=6 tid=0x00000000075a4800 nid=0xd74 in Object.wait() [0x000000000a6df000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on &lt;0x00000007ac848288&gt; (a [I) at com.sun.jmx.remote.internal.ServerCommunicatorAdmin$Timeout.run…
score: 0
tagged with: windows
has answer: http://stackoverflow.com/a/26305809
has comment: http://stackoverflow.com/comment/41246921
has comment: http://stackoverflow.com/comment/41246951
type: Question
type: AnsweredQuestion
has title: Why isn't javaw.exe exiting on Windows 8?
tagged with: java
accepted answer: http://stackoverflow.com/a/26305809
answer count: 1

http://stackoverflow.com/comment/41345181
score: 2
comment on: http://stackoverflow.com/q/26285488
has text: You can find out which configuration file is being used by adding `-Dlog4j.debug=true` to the jvm args.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41312674
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26323706
has text: @Rawrqqplz This has nothing to do with the return value of the method. While you are inside the loop, you can check if the number is too high, and print "your number is too high".
score: 0

http://stackoverflow.com/a/26305082
has body: Just put your file directly in your project folder same lvl as src folder not in it though and access like this: FileInputStream file = new FileInputStream("lito.properties"); Or if you want it in a subfolder just add folder to root project folder then put file in it. ex: MyProject->Data->lito.properties FileInputStream file = new FileInputStream("Data/lito.properties");
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26305044
type: Answer
has comment: http://stackoverflow.com/comment/41278403

http://stackoverflow.com/comment/41211594
comment on: http://stackoverflow.com/a/26268398
type: Comment
has text: Ah, I think I was trying to just check if each token is an integer, but you're looking for the case where two or more integers are *not* properly separated. I updated my answer, that should be more than enough to get you started.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41175995
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26249049
has text: Where is the location of your file? Can you please give the full path of your file? I think it must work fine.

http://stackoverflow.com/a/26230430
upvote count: 4
has body: Note that you should note that your logic flow must never rely on accessing the HashMap elements in some order, simply put because HashMaps are not ordered Collections and that is not what they are aimed to do. (You can read more about odered and sorter collections in this post). Back to the post, you already did half the job by loading the first element key: Object myKey = statusName.keySet().toArray()[0]; Just call map.get(key) to get the respective value: Object myValue = statusName.get(myKey);
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26230225
score: 4

http://stackoverflow.com/comment/41611575
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26425442
has text: maybe we both had problems :-)
score: 0

http://stackoverflow.com/comment/41314207
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26324078
has text: There is an older iText version (2?) that was released under LGPL not AGPL 3 if that matters.

http://stackoverflow.com/comment/41308076
type: QuestionComment
has text: But server is working, if I try the same URL on browser, it works OK.
comment on: http://stackoverflow.com/q/26321062
score: 0
type: Comment

http://stackoverflow.com/q/26252598
has answer: http://stackoverflow.com/a/26252750
tagged with: deployment
has title: 404 error when deploying through TomCat manager connected with IIS 8.5
tagged with: iis
tagged with: tomcat7
type: Question
tagged with: java
score: 0
answer count: 2
has body: We are having issues with our deployment. We need to deploy to a remote TomCat-container which is accessed through IIS 8.5 with the TomCat Connector from Apache. We followed the guide at the following resources when we installed the connector: https://confluence.atlassian.com/pages/viewpage.action?pageId=376210448#ConfiguringTomcat-ConnectorforIIS8.0(WindowsServer2012orWindows8)-Step1.InstallandConfiguretheAJPConnector File size is not too big for IIS 8.5 (the file size is 50mb) http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html Of what we can see, the .war file gets uploaded but when it should be deployed, we are returned a 404 page, telling us that the page doesnt exist and the application is not deployed. Things we have checked and double checked is the configuration for: File size limits in TomCat configuration (the file is not too big for TomCat) Security Access for the TomCat service user (NETWORK SERVICES), so that TomCat has access to the folders it needs for unpacking the .war etc. Alot of other things while we were grasping for some answer The logs of TomCat and IIS doesnt give a clue to why this issue exists, we can see that we accessed the manager and performed a PUT operation, nothing else... we have set the log level to FINE, still no clue. Logs of IIS does also not give any clues to what the issue is. We are thinking that the issue lies within IIS 8.5 and the connector but we cant find it. Thankful for anything that you might think could be a potential issue. Are there any other connectors for TomCat 7.0.55 / IIS 8.5 that might be better? Thanks / David
tagged with: tomcat
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/46333350

http://stackoverflow.com/comment/41294610
has text: This works, but it doesn't do exactly what OP is asking for even if the result is the same in this case. It is also overly complicated. A simple `replace()` is definitely the better choice here.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26314218
type: Comment

http://stackoverflow.com/comment/41411944
score: 1
has text: @AleksandrM Meh, I've seen it coming... :D
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26343306

http://stackoverflow.com/q/26213727
type: AnsweredQuestion
tagged with: annotations
type: Question
has answer: http://stackoverflow.com/a/55985483
tagged with: java
has answer: http://stackoverflow.com/a/26229059
accepted answer: http://stackoverflow.com/a/26229059
score: 0
answer count: 2
tagged with: static-code-analysis
has body: I need to be able to identify calls to methods with specific annotations in Intellij Idea 13, during compile time or by using static code analysis, like calls to @Deprecated methods are identified. I have looked into doing a structural search in idea, these are supported in static code analysis, and am able to identify method calls from there, but I can't find a way to limit these to calls to method with annotations. For example public class A { @Foo public void foo(){ // do something... } public void bar() { // do something else.... } } public class main { public static void main(String... args){ A a = new A(); a.foo(); // &lt;---- should be highlighted a.bar(); } }
tagged with: intellij-idea
has title: Intellij/ Java - identify calls to annotated methods
possible better answer: http://stackoverflow.com/a/55985483

http://stackoverflow.com/a/26303784
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26303519
type: AcceptedAnswer
downvote count: 0
has body: I'd suggest bypassing ArrayAdapter altogether as, since you're going to be doing custom work, you're going to be duplicating effort done by the adapter internally. Implementation is trivial anyway. Just subclass BaseAdapter: public class UserAdapter extends BaseAdapter { private final List&lt;User&gt; mUsers; private final LayoutInflater mInflater; public UserAdapter(Context ctx, Collection&lt;User&gt; users) { mUsers = new ArrayList&lt;User&gt;(); mInflater = LayoutInflater.from(ctx); if (users != null) { mUsers.addAll(users); } } @Override public int getCount() { // Just return the number of users in your data set return mUsers.size(); } @Override public long getItemId(int pos) { // Mostly irrelevant if you're not using Cursors return pos; } @Override public User getItem(int pos) { // Just return the item at the specified position return mUsers.get(pos); } @Override public View getView(int pos, View convertView, ViewGroup parent) { UserViewHolder uvh; if (convertView == null) { // Only inflate the layout if there's not already a recycled view convertView = mInflater.inflate(R.layout.single_user, parent, false); // Tag the view with a class holding the views found with // findViewById() to prevent lookups later uvh = new UserViewHolder(convertView); convertView.setTag(uvh); } else { // If the view is non-null, then you will have already // created the view holder and set it as a tag uvh = (UserViewHolder) convertView.getTag(); } // Now just get the user at the specified position and // set up the view as necessary User user = getItem(pos); uvh.usernameTxt.setText(user.getUsername()); return convertView; } public static class UserViewHolder { public final TextView usernameTxt; public UserViewHolder(View v) { usernameTxt = (TextView) v.findViewById(R.id.textViewUsername); } } }
type: Answer
accepted answer of: http://stackoverflow.com/q/26303519

http://stackoverflow.com/q/26289412
type: Question
downvote count: 0
tagged with: glassfish
tagged with: linux
answer count: 3
has answer: http://stackoverflow.com/a/26291606
has answer: http://stackoverflow.com/a/36195423
favorite count: 0
has body: In the below output I am being asked if I trust a certificate, which I was not asked about in Glassfish 4.0. If I answe yes, then it still fails which can be seen. I am starting it with asadmin start-domain and then change the admin password to x in this test. I change the passowrd with asadmin --user admin change-admin-password and asadmin enable-secure-admin. This is the error: Do you trust the above certificate [y|N] --&gt;y Authentication failed for user: admin (Usually, this means invalid user name and/or password) Command change-admin-password failed. Question Does anyone know why Glassfish 4.1 asks about this certificate and how I can make it work, as I can't login even though it ends with it was a success. Waiting for domain1 to start ....... Successfully started the domain : domain1 domain Location: /opt/glassfish4/glassfish/domains/domain1 Log File: /opt/glassfish4/glassfish/domains/domain1/logs/server.log Admin Port: 4848 Command start-domain executed successfully. =&gt; Modifying password of admin to preset in Glassfish spawn asadmin --user admin change-admin-password Enter the admin password&gt; Enter the new admin password&gt; Enter the new admin password again&gt; [ [ Version: V3 Subject: CN=localhost, OU=GlassFish, O=Oracle Corporation, L=Santa Clara, ST=California, C=US Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11 Key: Sun RSA public key, 2048 bits modulus: 19016962123073818913980587828837922486576420141613590721707437891327039833432551153803083906839156766507774007880420863368627703049499522525030078369904284618227297420407350669314980277911425446307700835083768858763078579295691981047129695516569551334653620772195238596206551972125661803284768176221481772121528672632308667324875827891801774801031021244005840124791813739105291627626830463412652100947239506418948577875286315103270404232934705194347849152036735770668664880970935638976368368387912487716546355239785885758256691359924727187516306879956018711242524702651771632411566014…
upvote count: 2
tagged with: glassfish-4
has answer: http://stackoverflow.com/a/34988102
score: 2
type: AnsweredQuestion
has title: Why this certificate error in Glassfish 4.1?
accepted answer: http://stackoverflow.com/a/26291606
tagged with: java
possible better answer: http://stackoverflow.com/a/34988102
tagged with: ssl

http://stackoverflow.com/comment/41103538
type: QuestionComment
score: 1
has text: Simply call `currentDateServiceObj.getCurrentDate()`
comment on: http://stackoverflow.com/q/26210390
type: Comment

http://stackoverflow.com/q/26253775
possible better answer: http://stackoverflow.com/a/29779206
has title: Development with Apache Spark
favorite count: 0
has answer: http://stackoverflow.com/a/29779206
score: 8
answer count: 4
has answer: http://stackoverflow.com/a/33026177
type: AnsweredQuestion
tagged with: java
has body: I am new with Spark and I wanted to ask some common guidelines about developing and testing my code for Apache Spark framework What is the most common setup to test my code locally? Is there any built VM to raise (ready box etc.)? Do I have to setup locally spark? Is there any test library to test my code? When going in cluster mode I notice that there are some ways to setup your cluster; production wise, what is the most common way to setup a cluster to run Spark? Three options here Standalone cluster setup With YARN With MESOS Thank you
has answer: http://stackoverflow.com/a/26255439
has comment: http://stackoverflow.com/comment/41555208
downvote count: 1
type: Question
upvote count: 9
accepted answer: http://stackoverflow.com/a/26255439
has answer: http://stackoverflow.com/a/33191906
tagged with: apache-spark

http://stackoverflow.com/comment/41109889
has text: Great! In that case, I'll write my comment as an answer.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26213908

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

http://stackoverflow.com/a/26294238
has body: Use method String.split() It returns an array of String, splitted by the character you specified.
answers question: http://stackoverflow.com/q/26294182
score: 0
type: Answer

http://stackoverflow.com/comment/41216340
type: Comment
has text: @LuiggiMendoza yes i know use static but as in second example there is no object of person is created and it is initialized as Person found; found=arr.find(searchKey);,but i am able to call displayperson method ,without creating object using new keyword
comment on: http://stackoverflow.com/q/26270950
score: 0
type: QuestionComment

http://stackoverflow.com/a/26328555
has comment: http://stackoverflow.com/comment/94997108
has comment: http://stackoverflow.com/comment/92266046
has comment: http://stackoverflow.com/comment/69237737
has comment: http://stackoverflow.com/comment/108540367
has comment: http://stackoverflow.com/comment/67820842
has comment: http://stackoverflow.com/comment/47574182
has comment: http://stackoverflow.com/comment/137772980
has comment: http://stackoverflow.com/comment/48975167
upvote count: 742
has comment: http://stackoverflow.com/comment/47440879
has comment: http://stackoverflow.com/comment/108079295
has comment: http://stackoverflow.com/comment/58004431
has comment: http://stackoverflow.com/comment/45337106
has comment: http://stackoverflow.com/comment/94689292
has comment: http://stackoverflow.com/comment/45329188
has comment: http://stackoverflow.com/comment/41354561
has body: Of course, people will do what they want. But we did have a clear intention when adding this feature, and it was not to be a general purpose Maybe type, as much as many people would have liked us to do so. Our intention was to provide a limited mechanism for library method return types where there needed to be a clear way to represent "no result", and using null for such was overwhelmingly likely to cause errors. For example, you probably should never use it for something that returns an array of results, or a list of results; instead return an empty array or list. You should almost never use it as a field of something or a method parameter. I think routinely using it as a return value for getters would definitely be over-use. There's nothing wrong with Optional that it should be avoided, it's just not what many people wish it were, and accordingly we were fairly concerned about the risk of zealous over-use. (Public service announcement: NEVER call Optional.get unless you can prove it will never be null; instead use one of the safe methods like orElse or ifPresent. In retrospect, we should have called get something like getOrElseThrowNoSuchElementException or something that made it far clearer that this was a highly dangerous method that undermined the whole purpose of Optional in the first place. Lesson learned. (UPDATE: Java 10 has Optional.orElseThrow(), which is semantically equivalent to get(), but whose name is more appropriate.))
has comment: http://stackoverflow.com/comment/113524018
has comment: http://stackoverflow.com/comment/85627713
accepted answer of: http://stackoverflow.com/q/26327957
has comment: http://stackoverflow.com/comment/94049369
has comment: http://stackoverflow.com/comment/102396745
has comment: http://stackoverflow.com/comment/64459644
downvote count: 10
has comment: http://stackoverflow.com/comment/92295272
has comment: http://stackoverflow.com/comment/113524007
answers question: http://stackoverflow.com/q/26327957
type: AcceptedAnswer
score: 732
has comment: http://stackoverflow.com/comment/111197198
has comment: http://stackoverflow.com/comment/92268377
has comment: http://stackoverflow.com/comment/53976808
has comment: http://stackoverflow.com/comment/125432625
has comment: http://stackoverflow.com/comment/108545391
has comment: http://stackoverflow.com/comment/120676263
has comment: http://stackoverflow.com/comment/137763678
has comment: http://stackoverflow.com/comment/89638980
has comment: http://stackoverflow.com/comment/92296783
has comment: http://stackoverflow.com/comment/64452263
type: Answer

sockets
tags question: http://stackoverflow.com/q/26314918
tags question: http://stackoverflow.com/q/26249339
tags question: http://stackoverflow.com/q/26346918
tags question: http://stackoverflow.com/q/26307382
tags question: http://stackoverflow.com/q/26318952
tags question: http://stackoverflow.com/q/26311424
tags question: http://stackoverflow.com/q/26344714
tags question: http://stackoverflow.com/q/26219032
tags question: http://stackoverflow.com/q/26299415
tags question: http://stackoverflow.com/q/26214693
tags question: http://stackoverflow.com/q/26227509
tags question: http://stackoverflow.com/q/26262367
tags question: http://stackoverflow.com/q/26240452
tags question: http://stackoverflow.com/q/26216981
tags question: http://stackoverflow.com/q/26204827
tags question: http://stackoverflow.com/q/26315658
tags question: http://stackoverflow.com/q/26221532
tags question: http://stackoverflow.com/q/26345092
tags question: http://stackoverflow.com/q/26271145
tags question: http://stackoverflow.com/q/26251122
tags question: http://stackoverflow.com/q/26200302
tags question: http://stackoverflow.com/q/26261896
type: Tag
tags question: http://stackoverflow.com/q/26299449
tags question: http://stackoverflow.com/q/26287508
tags question: http://stackoverflow.com/q/26278853
tags question: http://stackoverflow.com/q/26286193
tags question: http://stackoverflow.com/q/26226688
tags question: http://stackoverflow.com/q/26349076
tags question: http://stackoverflow.com/q/26196764
tags question: http://stackoverflow.com/q/26207329
tags question: http://stackoverflow.com/q/26290873
tags question: http://stackoverflow.com/q/26320156
tags question: http://stackoverflow.com/q/26329262
tags question: http://stackoverflow.com/q/26308941
tag name: sockets
tags question: http://stackoverflow.com/q/26199598
tags question: http://stackoverflow.com/q/26330172
tags question: http://stackoverflow.com/q/26297551
tags question: http://stackoverflow.com/q/26285861
tags question: http://stackoverflow.com/q/26320624
tags question: http://stackoverflow.com/q/26339060
tags question: http://stackoverflow.com/q/26306856

http://stackoverflow.com/comment/41151170
has text: @chiastic-security can you please explain why declaring the `count` variable local made the counting fast and that too with a huge difference. when I declared `count` as local variable it took only 15 seconds to count.
comment on: http://stackoverflow.com/a/26220713
score: 0
type: Comment
type: AnswerComment

operating-system
tags question: http://stackoverflow.com/q/26294650
tags question: http://stackoverflow.com/q/26317820
tags question: http://stackoverflow.com/q/26262128
tag name: operating-system
tags question: http://stackoverflow.com/q/26322518
type: Tag

http://stackoverflow.com/a/26195599
type: Answer
has comment: http://stackoverflow.com/comment/41077159
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/26195555
has comment: http://stackoverflow.com/comment/41077128
upvote count: 6
has comment: http://stackoverflow.com/comment/41078712
has body: These errors show a problem with your code, NOT the compiler. First of all, you should NEVER name a class String. This is the cause of most of your errors because Java sees your class named String and can't then use the standard library class with the same name. Second of all, word = String ReplaceAll(word,"World"); is plain wrong. Fix this and you will see your compiler errors disappear. In general, when a compiler gives errors, it means your code is broken. As you continue to learn programming, you should learn to question your own work first and figure out why it isn't working the way you expect. Blaming someone or something else is rarely the correct first reaction It is very rare that you will find a problem with a compiler when you are only starting to learn the language.

http://stackoverflow.com/comment/41084968
type: Comment
type: QuestionComment
has text: That's a great idea... we did not think about a CLR (although we do not have experience with it). So, the Java application will be the main application of the software, that realizes some kind of enterprise solution (contains the business logic, the database access, as well as the frontend-interface). The C# part contains mathematical algorithms (that are too extensive to be reimplemented in java) that are used by the main application; they will be called very often (in some use cases multiple times per second). For the main application, it is important for us to use mainstream technologies...
comment on: http://stackoverflow.com/q/26195355
score: 0

http://stackoverflow.com/comment/41294702
type: Comment
comment on: http://stackoverflow.com/a/26313802
type: AnswerComment
has text: Added some info that should help solve the second issue. I didn't add any code as the change would require removing the solution of the first question. In this case, the two questions are only loosely related and it's difficult to provide a proper solution to both with one answer.
score: 0

http://stackoverflow.com/comment/41177143
has text: Neither is _fine_. One will simply fail later.
score: 1
comment on: http://stackoverflow.com/q/26249709
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/46678453
comment on: http://stackoverflow.com/a/26250237
has text: @Pangea, I think the purpose of these calls it to print when the events happen, so you can see that it's working in parallel.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26324199
has comment: http://stackoverflow.com/comment/41313043
has body: You can use JDatePicker. Download from this link: http://sourceforge.net/projects/jdatepicker/ it's used like other Swing components: UtilDateModel model = new UtilDateModel(); JDatePanelImpl datePanel = new JDatePanelImpl(model); JDatePickerImpl datePicker = new JDatePickerImpl(datePanel); frame.add(datePicker);
has comment: http://stackoverflow.com/comment/44794572
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26323390
type: Answer

http://stackoverflow.com/a/26323185
has body: You can invoke the replace method on java strings to replace the target string (in your case a dash) with a blank string: String dash = "aero-plane"; String noDash = dash.replace("-", ""); System.out.println(noDash); prints aeroplane There is no reason to use StringTokenizer here unless you are getting these tokens from outside of the code that you control, which doesn't seem to be the case.
has comment: http://stackoverflow.com/comment/41311340
type: Answer
has comment: http://stackoverflow.com/comment/41311434
has comment: http://stackoverflow.com/comment/41311076
has comment: http://stackoverflow.com/comment/41311113
has comment: http://stackoverflow.com/comment/41311185
has comment: http://stackoverflow.com/comment/41311092
score: 0
answers question: http://stackoverflow.com/q/26323151
has comment: http://stackoverflow.com/comment/41311073

http://stackoverflow.com/comment/41339068
comment on: http://stackoverflow.com/a/26337222
type: Comment
has text: May the reason be that I am running it from pendrive?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41106176
score: 2
comment on: http://stackoverflow.com/q/26211744
has text: why do not you try it?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26270030
tagged with: hashtable
has title: How can I remove an object of type X from a hashtable given one unique attribute of X in Java?
has body: Let's say I have a class person public class Person { int personID = 123; String fname = John; String lname = Doe; } and I've created a hashtable . (using person as both a key and value). Now, assuming each person has a unique ID and assuming the hashtable is full of persons, I want, given a unique ID (int), to remove the person from the hashtable corresponding to that ID. The problem arises with what parameters to give the hashtable.remove() function since it takes an object of type Person and not an int. Note: assume the fact that the key and value are both of type Person is a design requirement and cannot be changed Edit: I have overriden the hashcode() and equals() method of the person class, they both rely on the personID now. But I still don't know what to pass the hashtable.remove() method since it takes type Person and I want to remove based on a user-given int (which is the personID)
answer count: 1
has comment: http://stackoverflow.com/comment/41214232
has answer: http://stackoverflow.com/a/26274296
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41214715
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41214217
type: Question

http://stackoverflow.com/q/26292021
answer count: 1
has title: Error in OK button selection listener in a SWT/JFace Dialog
has body: I am receiving the below exception while trying to access the field value from a text field within a SWT Dialog, from the selection listener of the 'OK' button. org.eclipse.swt.SWTException: Widget is disposed I can understand the error is because the Dialog is already disposed when I am trying to access it. But i haven't made any explicit call to dispose the shell. Is the Dialog disposed automatically on clicking the 'OK' button? Is there any way it can be overridden? Or Am i doing something wrong here? Appreciate any help or pointers. Relevant code snippet below: public class MyDialog extends Dialog { /** The file Name Text field. */ private Text fileNameText; /** The constructor. **/ protected MyDialog(Shell parentShell) { super(parentShell); } /** Create Dialog View. **/ protected Control createDialogArea(Composite parent) { Composite mainComposite = (Composite) super.createDialogArea(parent); fileNameText = new Text(mainComposite, SWT.BORDER); fileNameText.setText(""); fileNameText.setBounds(0, 20, 428, 20); return mainComposite; } /** Override method to set name and listener for 'OK' button. **/ protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); Button submitButton = getButton(IDialogConstants.OK_ID); submitButton.setText("Review"); setButtonLayoutData(submitButton); // Perform Selected CleanUp activity on Submit Click. submitButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { // do something. if (fileNameText.getText().isEmpty()) { return; } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); } }
tagged with: eclipse-plugin
accepted answer: http://stackoverflow.com/a/26294024
tagged with: jface
type: AnsweredQuestion
tagged with: java
tagged with: swt
has answer: http://stackoverflow.com/a/26294024
type: Question
tagged with: eclipse
score: 0

http://stackoverflow.com/q/26274456
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16924457
upvote count: 1
has comment: http://stackoverflow.com/comment/41222114
has answer: http://stackoverflow.com/a/26286743
score: 1
tagged with: java
tagged with: eclipse
type: Question
tagged with: fuzzy-logic
downvote count: 0
has body: I'm creating an android application using fuzzy logic. I have imported the jar library by adding it to the lib folder. However, the classes that refer to these libraries show an error "couldn't be resolved to a type". I tried the solution, classes from android project library not resolved in android project. But it didn't work for me and the clean-refresh-build method too wasn't useful. The code: import java.sql.Savepoint; import com.fuzzylite.*; import com.fuzzylite.defuzzifier.*; import com.fuzzylite.factory.*; import com.fuzzylite.hedge.*; import com.fuzzylite.imex.*; import com.fuzzylite.norm.*; import com.fuzzylite.norm.s.*; import com.fuzzylite.norm.t.*; import com.fuzzylite.rule.*; import com.fuzzylite.term.*; import com.fuzzylite.variable.*; import android.app.Activity; import android.os.Bundle; import android.widget.EditText; import android.widget.RatingBar; import android.widget.SeekBar; import android.widget.TextView; private void fuzzy(){ Engine engine = new Engine(); engine.setName("Mamdani-Tip-Calculator"); InputVariable inputVariable1 = new InputVariable(); inputVariable1.setEnabled(true); inputVariable1.setName("FoodQuality"); inputVariable1.setRange(1.000, 10.000); inputVariable1.addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000)); inputVariable1.addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000)); engine.addInputVariable(inputVariable1); InputVariable inputVariable2 = new InputVariable(); inputVariable2.setEnabled(true); inputVariable2.setName("Service"); inputVariable2.setRange(1.000, 10.000); inputVariable2.addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000)); inputVariable2.addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000)); engine.addInputVariable(inputVariable2); OutputVariable outputVariable = new OutputVariable(); outputVariable.setEnabled(true); outputVariable.setName("Tip"); outputVariable.setRange(0.000, 30.000); outputVariable.fuzzyOutput().setAccumulation(new AlgebraicSum()); outputVariable.setDefuzzifier(n…
has comment: http://stackoverflow.com/comment/41231670
has comment: http://stackoverflow.com/comment/41231868
has comment: http://stackoverflow.com/comment/41222055
tagged with: android
answer count: 1
has title: unresolved type error from classes imported from external jar file

http://stackoverflow.com/a/26238673
has comment: http://stackoverflow.com/comment/41156745
upvote count: 2
has comment: http://stackoverflow.com/comment/41156491
type: AcceptedAnswer
type: Answer
has body: There is no need to use Math.floor here. Math.floor is an operation on double, and it does nothing when you supply an int to it. Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. Special cases: If the argument value is already equal to a mathematical integer, then the result is the same as the argument. If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument. (Source) The integer division already has the same logical behavior of Math.floor, i.e. it truncates the remainder of the division operation. int/int always returns an int. For example, 100/3 would return 33, and 40/50 would return 0. Simply use this code : public static int getKilometers(int distanceInMeter) { return distanceInMeter / KILOMETER_IN_METERS; }
has comment: http://stackoverflow.com/comment/41156563
score: 2
accepted answer of: http://stackoverflow.com/q/26238637
downvote count: 0
has comment: http://stackoverflow.com/comment/41156622
answers question: http://stackoverflow.com/q/26238637

http://stackoverflow.com/comment/41290600
type: QuestionComment
has text: Did you set the font for the graphics before you drew the string? `g.setFont(f)`.
comment on: http://stackoverflow.com/q/26311771
score: 0
type: Comment

http://stackoverflow.com/a/26353189
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41367125
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26352858
has body: int [] vowelInt = new int [5]; for (int i = 0; i&lt;vowels.size(); i++) { String word =(String) vowels.get(i);//try like this char letter=word.charAt(0); //return method to a dynamic array. if(letter=='a') { vowelInt[0]++; } else if (letter == 'e') { vowelInt[1]++; } else if (letter == 'i') { vowelInt[2]++; } else if (letter == 'o') { vowelInt[3]++; } else if (letter == 'u') { vowelInt[4]++; }

http://stackoverflow.com/comment/68100814
type: AnswerComment
comment on: http://stackoverflow.com/a/34925756
has text: While this probably works, it's not a very elegant solution. The work of converting the Java objects to JSON can be done by Jersey (that's the whole point of using such a framework), so don't do it yourself.
type: Comment
score: 1

http://stackoverflow.com/q/26259232
upvote count: 1
tagged with: http
type: Question
tagged with: apache-httpcomponents
has title: HttpRequest returning null entity, cannot extract body on server
has answer: http://stackoverflow.com/a/26361965
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: AnsweredQuestion
has body: I'm trying to parse an HTTP request using the apache httpcore components and want to grab the body of the request. It looks like the default DefaultHttpRequestParser doesn't parse the body/entity from its input stream. Is there a class that will do this? Unfortunately I can't use the entire stack and need to pull the request straight from this input stream. My parsing code is below. Looking at some of the other answers it appears that the body of the request should be available as an entity. However, every time I try to get at the entity it is null. Debugging I see that the buffer has read but not used the body and that DefaultHttpRequestParser seems to just read the header. Is there a parse I should be using to parse the entire input? InputStream is = socket.getInputStream(); HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl(); SessionInputBufferImpl buf = new SessionInputBufferImpl(metrics, 2048); buf.bind(is); DefaultHttpRequestParser reqParser = new DefaultHttpRequestParser(buf); HttpRequest req = reqParser.parse(); if (req instanceof HttpEntityEnclosingRequest) { entity = ((HttpEntityEnclosingRequest)query).getEntity(); //... entity is always null If I read the input stream I end up with: POST / HTTP/1.1 User-Agent: curl/Q.XX.0 (linux-gnu) libcurl/Q.XX.0 OpenSSL/X.Y.Z zlib/A.B.C.D libidn/E.FF librtmp/G.H Host: localhost:8088 Accept: */* Content-Length: 333 Content-Type: multipart/form-data; boundary=----------------------------39203c7982df ------------------------------39203c7982df Content-Disposition: form-data; name="fileupload"; filename="grun.sh" Content-Type: application/octet-stream #!/bin/bash -x java -classpath lib/antlr-4.4-complete.jar:build/classes org.antlr.v4.runtime.misc.TestRig Typegroup "AHI" -tree ------------------------------39203c7982df-- [Update] Oleg has a good answer, but can I associate the body with the request or do I now need to pass two things around, the body and the stream? I'll be looking into I got the following to …
accepted answer: http://stackoverflow.com/a/26361965
tagged with: java

http://stackoverflow.com/q/26241488
favorite count: 0
upvote count: 3
tagged with: swing
tagged with: checkbox
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26241660
type: Question
accepted answer: http://stackoverflow.com/a/26241660
has title: Java Swing Group of checkbox multiple selection handler
answer count: 1
has body: I have a group of checkboxes (multiple selection) and I want to know which items are selected using ListSelectionListener Box box = new Box(BoxLayout.Y_AXIS); foodBox = new JCheckBox(""); proteinBox = new JCheckBox(""); noLabelBox = new JCheckBox(""); aggregateBox = new JCheckBox(""); box.add(getLegendSpecificBox("FOOD", new Color(0, 255, 127), 0)); box.add(foodBox); box.add(getLegendSpecificBox("PROTEIN", new Color(240, 230, 140), 0)); box.add(proteinBox); box.add(getLegendSpecificBox("NO LABEL", new Color(220, 220, 220), 0)); box.add(noLabelBox); box.add(getLegendSpecificBox("AGGREGATION", new Color(255, 140, 0), 0)); box.add(aggregateBox); I have a graph with nodes with labels of either food, protein or aggregate. What I want to achieve is when I check food checkbox, I grey out nodes with other label(protein, etc). But I want to allow multiple selection too, for example, when I check food checkbox and protein checkbox, it will grey out other labels(aggregate etc) but food and protein maintain their original color. I was using ItemListener and add it to every checkbox but it does not work because I can not detect with other checkboxes are also checked. Can you help me about it? would ListSelectionListener do the trick?

http://stackoverflow.com/comment/41311951
type: Comment
has text: Not sure what the difference between height and min depth are, but it might also apply to the two lines before this as well.
comment on: http://stackoverflow.com/a/26323608
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41171800
type: Comment
comment on: http://stackoverflow.com/a/26246712
has text: @Tim my guess is that JUnit uses it internally.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41213969
score: 0
has text: @PM77-1 Are there uses of bounded type parameters outside of Generics?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26269844

http://stackoverflow.com/q/26313059
tagged with: spring
has answer: http://stackoverflow.com/a/31947415
tagged with: spring-mvc
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26314595
tagged with: grails
score: 0
answer count: 2
has title: Getting LoggedIn User Info Outside Grails Application Context with Spring Security Core PlugIn
tagged with: spring-security
type: UnansweredQuestion
has body: I am working on Grails Application with Spring Security Core PlugIn. I want to access the currently loggedIn user info with Spring Security Core outside the grails application context/controller scope. Can anyone please tell me that how can we get the information regarding currently loggedIn user info outside controller. I want to access this information in resources/services directory of grails application. I tried this using: SecurityContextHolder.getContext().getAuthentication().principal.username; But I get Anonymous authentication with grails.anonymous.user I tried another way too for this using httpSession: HttpSession session = RequestContextHolder.currentRequestAttributes().getSession() session.properties.each { println it; } SpringSecurityUtils.getSecurityContext(session).authentication.principal But by this way too I couldn't get the Currently LoggedIn User Info. Because httpSession object didn't contain attribute 'SPRING_SECURITY_CONTEXT_KEY'. Anybody tell me that how may I access this information in my desired directories ? Thanks for your time

http://stackoverflow.com/a/26198991
has comment: http://stackoverflow.com/comment/41082538
upvote count: 3
has comment: http://stackoverflow.com/comment/41082483
downvote count: 0
has comment: http://stackoverflow.com/comment/41082463
has body: You're trying to read from a URI across the network, not a file on a local system. FileReader is the wrong tool. Create a URI object from that string, call openStream() against that to get the network connection to it, wrap an InputStreamReader around it, and then wrap the BufferedReader around that. See, for example, Oracle's example in their documentation
type: Answer
answers question: http://stackoverflow.com/q/26198647
score: 3
has comment: http://stackoverflow.com/comment/41082590

http://stackoverflow.com/comment/42408645
has text: If I go by your requirement, What I understand is you just need to open the flashlight: "Ideally,any solution wherein if we can operate the flashlight without using any cameras object would be the best." Correct me if I am wrong. This seems like what you are looking for: http://stackoverflow.com/questions/6068803/how-to-turn-on-camera-flash-light-programmatically-in-android
comment on: http://stackoverflow.com/q/26202403
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/77760486
answers question: http://stackoverflow.com/q/26313902
has body: I tried all above solutions. However I had to reboot the windows to make settings take effects
type: Answer
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/26332768
has comment: http://stackoverflow.com/comment/41329528
has comment: http://stackoverflow.com/comment/41330826
has comment: http://stackoverflow.com/comment/41329551
has comment: http://stackoverflow.com/comment/41353537
tagged with: spring
has comment: http://stackoverflow.com/comment/41330452
has comment: http://stackoverflow.com/comment/41329724
has comment: http://stackoverflow.com/comment/41331238
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41334465
downvote count: 2
has comment: http://stackoverflow.com/comment/41331434
accepted answer: http://stackoverflow.com/a/26345951
type: Question
has comment: http://stackoverflow.com/comment/41364742
tagged with: dependency-injection
tagged with: jsp
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/41334701
answer count: 1
has comment: http://stackoverflow.com/comment/41329646
has title: Spring Bean throws NullPointerException other than execute and validate method
has comment: http://stackoverflow.com/comment/41330749
has body: I am integrated Spring with Struts2. I use bean for creating session from session factory. My code is below. If I use bean in execute or validate my method works, other place it throws NullPointerException. Action Class: public class GetEmp extends ActionSupport { private spDao myDao; public String execute(){ User user=myDao.getDbsession().get(User.class); } } It works fine. If I use the same bean in other class that not extend ActionSupport throws NullPointerException. applicationContext.xml: <?xml version="1.0" encoding="windows-1252"?> <bean id="myDao" class="controller.spDAO" scope="request" /> <bean id="sendMail" class="controller.Emailfunction" scope="request"/> Java class: public class GetEmp { private spDao myDao; public String getEmpname(){ User user=myDao.getDbsession().get(User.class); } } throws NullPointerException. How to resolve this problem? web.xml: <?xml version="1.0" encoding="UTF-8"?> Matrimonial struts2 org.apache.struts2.dispatcher.FilterDispatcher org.springframework.web.context.request.RequestContextListener contextConfigLocation /WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListener struts2 /* 30 index.jsp 404 /404.jsp 500 /500.jsp 503 /503.jsp I managed this problem by passing my bean name with method. Is their any other solution? Any help will be greatly appreciated!!
favorite count: 0
has answer: http://stackoverflow.com/a/26345951
has comment: http://stackoverflow.com/comment/41330513
upvote count: 2

http://stackoverflow.com/comment/41283021
type: Comment
comment on: http://stackoverflow.com/a/26307510
score: 0
type: AnswerComment
has text: I added prst.setDate and prst.setTimestamp to my answer above brso05 try copying and pasting exactly what i have it should work.

http://stackoverflow.com/comment/41666331
score: 0
comment on: http://stackoverflow.com/a/26478219
type: Comment
has text: There are certain things I don't want Nashorn to have access to such as reflection so AllPermission is not an option.
type: AnswerComment

http://stackoverflow.com/comment/47846379
has text: @Ahaha what do you mean by extra space ?
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26306229
type: Comment

http://stackoverflow.com/q/26327956
tagged with: view
has answer: http://stackoverflow.com/a/26328017
has title: Set "this" in a class
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41319949
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/41319982
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41321345
has comment: http://stackoverflow.com/comment/41451398
has comment: http://stackoverflow.com/comment/41319978
has comment: http://stackoverflow.com/comment/41319981
score: 0
tagged with: android
answer count: 1
favorite count: 0
has body: EDITED POST I'm trying to do kind of MVC for android but lot of tutorials use the Activity as the View. I would use the Activity as the Controller. To do so, I have to create my own classes who extends the View class. The easy part is when the Controller is an Activity because I can do something like this : public class MyView extends View { public MyView(Activity activity) { activity.setContentView(R.layout.my_view); } } Now, the problem is when the Controller is a Fragment because I cannot use the setContentView() method. For fragments, you have to inflate the View in the onCreateView() method. Right now, I implement this method like this: public class MyFragment extends Fragment { private MyView myView; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { myView = MyView.load(container.getContext); return myView; } } And the MyView class look like this: public class MyView extends FrameLayout { static public MyView load(Context context) { return (MyView) inflate(context, R.layout.my_fragment, new MyView(context); } public MyView(Context context) { super(context); } } (It extends FrameLayout because the inflate() method use a ViewGroup as a parameter and FrameLayout extends ViewGroup and it's easy to use.) Now, my questions are: Do you have a better idea to set the content of a fragment ? It is possible to set the content of a fragment in the constructor of the MyView class without using the addView() method ? ORIGNIAL POST Instead of explaining my problem, here what I'd like to do : public class MyView extends View { public MyView(View v) { this = v; } } But, unfortunately, this is unauthorized because you can't set the "this" keyword. So, now, I'm doing something like that : public class MyView extends FrameLayout { public MyView(Context context, View v) { super(context); addView(v); } } And it works, but I don't really like this solution because you have to set the ID and everything that come from the view "v" to t…

http://stackoverflow.com/q/26329564
has title: Security config when using @PreAuthorize
has answer: http://stackoverflow.com/a/26335748
tagged with: spring-security
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/26335045
has body: My security config class (which inherits from WebSecurityConfigurerAdapter) has a method like the following. @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/restaurant/**").access("hasRole('ROLE_USER')") .and() .formLogin(); } However I'd rather use @PreAuthorize on my controllers instead. If I remove the method everything requires auth. What should my method look like so everything is available and access is only determined by PreAuthorize?
tagged with: spring
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26334868
tagged with: java
linked to: http://stackoverflow.com/q/26127755
accepted answer: http://stackoverflow.com/a/26335748
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/26335045

http://stackoverflow.com/comment/41339952
score: 0
has text: No I'm not missing a dependency. Please read question again.
type: Comment
comment on: http://stackoverflow.com/q/26338387
type: QuestionComment

http://stackoverflow.com/q/26237242
has comment: http://stackoverflow.com/comment/41154820
score: 4
linked to: http://stackoverflow.com/q/4108604
has answer: http://stackoverflow.com/a/26237849
accepted answer: http://stackoverflow.com/a/26237849
tagged with: ocpjp
tagged with: nested
has title: Comparator Interface implemented in a nested class
upvote count: 4
has answer: http://stackoverflow.com/a/26237335
favorite count: 0
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41153456
type: Question
possible better answer: http://stackoverflow.com/a/26237335
tagged with: comparator
answer count: 2
has body: I'm new on stackoverflow.com but I often used it to search for answers whenever I had a problem, but now I can't find any result searching for my problem so I'm asking here :) I'm studying for the OCPJP SE 7 certification, exam 1Z0-804, and I'm using a book (there is only one available afaik, Ganesh\Sharma's one) In the collections chapter, about the Comparator interface, the book provide this example of using both the Comparator and the Comparable interface to sort an array of Student elements, but the question is about the Comparator: import java.util.*; class Student implements Comparable&lt;Student&gt; { private String id, name; private Double cgpa; public String getName() { return name; } public String getId() { return id; } public Double getCgpa() { return cgpa; } public Student(String studentId, String studentName, double studentCGPA) { id=studentId; name=studentName; cgpa=studentCGPA; } public String toString() { return id+" "+name+" "+cgpa; } public int compareTo(Student that) { return this.id.compareTo(that.id); } } class StudentCGPA implements Comparator&lt;Student&gt; { public int compare(Student s1, Student s2) { return s1.getCgpa().compareTo(s2.getCgpa()); } } class MyMainClass { public static void main(String[] args) { Student[] students = { new Student("cs011", "Lennon", 3.1), new Student("cs021", "McCartney", 3.4), new Student("cs012", "Harrison", 2.7), new Student("cs022", "Starr", 3.7), }; Arrays.sort(students, new StudentCGPA()); System.out.println(Arrays.toString(students)); } } So it creates a new class only for using the Comparator interface with two Student objects, but I think this is very uncomfortable so I wonder: why can't I use a nested class (within Student)? Like this: import java.util.*; class Student implements Comparable&lt;Student&gt; { private String id, name; private Double cgpa; public String getName() { return name; } public String getId() { return id; } public Double getCgpa() { return cgpa; } public Student(String studentId, …
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/41265871
comment on: http://stackoverflow.com/q/26298494
has text: Read this: http://stackoverflow.com/questions/1031273/what-is-polymorphism-what-is-it-for-and-how-is-it-used
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26305253
tagged with: weblogic12c
answer count: 2
has title: WebLogic config wizard dies
downvote count: 0
has answer: http://stackoverflow.com/a/26434548
has body: I'm installing WebLogic 12.1.2 for development version on Ubuntu. I went through all of the steps to unpack and run the configuration script to set up the environment. When I go to execute MW_HOME/wlserver/common/bin/config.sh, the domain configuration wizard comes up for a few seconds, then dies. I added echo on to this script and another one called in oracle_common dev@dev-VirtualBox:/usr/local/wls12120/wlserver/common/bin$ ./config.sh + pwd + mypwd=/usr/local/wls12120/wlserver/common/bin + SCRIPTNAME=./config.sh + dirname /usr/local/wls12120/wlserver/common/bin/./config.sh + SCRIPTPATH=/usr/local/wls12120/wlserver/common/bin/. + cd /usr/local/wls12120/wlserver/common/bin/./../../.. + pwd + MW_HOME=/usr/local/wls12120 + export MW_HOME + /usr/local/wls12120/oracle_common/common/bin/config.sh + pwd + mypwd=/usr/local/wls12120/wlserver/common/bin + SCRIPTNAME=/usr/local/wls12120/oracle_common/common/bin/config.sh + dirname /usr/local/wls12120/oracle_common/common/bin/config.sh + SCRIPTPATH=/usr/local/wls12120/oracle_common/common/bin + cd /usr/local/wls12120/oracle_common/common/bin/../.. + pwd + ORACLE_HOME=/usr/local/wls12120/oracle_common + export ORACLE_HOME + cd /usr/local/wls12120/oracle_common/.. + pwd + MW_HOME=/usr/local/wls12120 + export MW_HOME + . /usr/local/wls12120/oracle_common/common/bin/setHomeDirs.sh + WL_HOME=/usr/local/wls12120/wlserver + export WL_HOME + COMMON_COMPONENTS_HOME=/usr/local/wls12120/oracle_common + [ -d /usr/local/wls12120/oracle_common ] + cd /usr/local/wls12120/oracle_common + pwd + COMMON_COMPONENTS_HOME=/usr/local/wls12120/oracle_common + export COMMON_COMPONENTS_HOME + [ -z /usr/local/java/jdk1.7.0_67 -o -z Oracle ] + export JAVA_HOME + uname -s + OS=Linux + umask 027 + . /usr/local/wls12120/oracle_common/common/bin/commEnv.sh + [ -z /usr/local/wls12120 -a -z /usr/local/wls12120/wlserver ] + [ ! -d /usr/local/wls12120 ] + [ ! -d /usr/local/wls12120/wlserver ] + BEA_HOME=/usr/local/wls12120 + COHERENCE_HOME=/usr/local/wls12120/c…
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26305388
tagged with: weblogic

http://stackoverflow.com/q/26274531
has comment: http://stackoverflow.com/comment/41230668
has comment: http://stackoverflow.com/comment/41222442
has title: is there any way to load data from excel in to text boxes of html web page and submit it dynamically?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41222027
tagged with: java
tagged with: excel
type: Question
has comment: http://stackoverflow.com/comment/41223174
has comment: http://stackoverflow.com/comment/41233184
tagged with: javascript
has comment: http://stackoverflow.com/comment/41223529
has comment: http://stackoverflow.com/comment/41260514
score: 0
has body: instead of entering several values in respective text box and submitting it... is there any way to automate the process such that it will automatically pick values from EXCEL sheet and enters in to respective text fields and clicks on submit Can we do this in java if yes kindly help me out with the best way.. suggest me if there is any other alternative solution..
has comment: http://stackoverflow.com/comment/41222353
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/26240717
score: 5
upvote count: 6
has answer: http://stackoverflow.com/a/56809149
tagged with: c++
downvote count: 1
has title: Check jdk/JRE is installed and get path for jvm.dll
tagged with: java
has comment: http://stackoverflow.com/comment/41160132
has answer: http://stackoverflow.com/a/26242772
has answer: http://stackoverflow.com/a/26240892
answer count: 4
has comment: http://stackoverflow.com/comment/100172603
has body: Prgrammatically, how to check if java is insalled and get path from jvm.dll ?
has answer: http://stackoverflow.com/a/26240810
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41163150
tagged with: jvm
favorite count: 0
type: Question

http://stackoverflow.com/comment/41367176
comment on: http://stackoverflow.com/q/26353521
score: 0
type: Comment
type: QuestionComment
has text: Thanks for suggestion. I will change super.paintComponents with super.paint but doubt this is solution. Woul be JPanel a solution and why?

http://stackoverflow.com/comment/41313929
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26320540
has text: @JBNizet That would still make the class names difficult to see because of the wall of text created by the package names.

http://stackoverflow.com/comment/41211072
type: AnswerComment
comment on: http://stackoverflow.com/a/26268015
type: Comment
has text: I got it to work, thank you everyone for your help. And sorry to everyone for seeming illiterate when it came to this, I only started to learn programming last month.
score: 0

http://stackoverflow.com/comment/41323995
type: Comment
score: 0
type: AnswerComment
has text: I edited my original question to have my new code. I changed the while to a do while – while(play.equalIgnoreCase("yes")&&cash<0) but the system does not store the value cash, and just repeatedly asks for a new value.
comment on: http://stackoverflow.com/a/26322310

http://stackoverflow.com/q/26274584
favorite count: 0
has body: I am new to aspectj and I have one doubt whether we can inject the code before the function that exists in the jar file using aspectj.
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26276330
tagged with: java
type: Question
tagged with: aspectj
has answer: http://stackoverflow.com/a/26276330
score: -2
tagged with: aop
downvote count: 4
has title: How can I weave aspect code into existing class files within JARs?
answer count: 1

http://stackoverflow.com/a/26229448
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26229387
has comment: http://stackoverflow.com/comment/41144798
upvote count: 1
has body: The issue is that every thread object has its own lock (and is able to lock it independently of what all the other threads are doing): private final ReentrantLock myLock = new ReentrantLock(); If you want the lock shared across the threads, make the above object static.
score: 1
answers question: http://stackoverflow.com/q/26229387
type: AcceptedAnswer

http://stackoverflow.com/q/26296911
accepted answer: http://stackoverflow.com/a/26296947
favorite count: 0
possible better answer: http://stackoverflow.com/a/26297304
answer count: 3
has answer: http://stackoverflow.com/a/26297304
has answer: http://stackoverflow.com/a/26296977
has answer: http://stackoverflow.com/a/26296947
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41263036
has title: Does Hashmap autosort?
upvote count: 9
tagged with: java
tagged with: date
score: 9
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/41264291
has comment: http://stackoverflow.com/comment/41263072
downvote count: 0
has body: This is my hashmap : HashMap&lt;Long, Day&gt; hashMapTest = new HashMap&lt;Long, Day&gt;(); and I insert Date.getTime() into this hashmap like : Date start = new Date(vonDatum.getTime()); for (int i = 0; i &lt; tagediff; i++) { Day day= new Day(start); this.mitarbeiterTagHashMap.put(start.getTime(), day); CalendarUtil.addDaysToDate(start, 1); } The strange thing is when I call the hashmap with, the order is completely an other and the keys doesnt fit to the insertion : for (Long name : hashMapTest.keySet()) { Window.alert(name + ": " + hashMapTest.get(name)); }

http://stackoverflow.com/comment/41265296
type: AnswerComment
score: 0
type: Comment
has text: Sorry about the use of "==" to compare strings, I am more of a Javascript or C# coder than a Java coder. I have edited the code sample to use `equals`.
comment on: http://stackoverflow.com/a/26297865

http://stackoverflow.com/a/27200462
has body: you can try this to retrieve files. URI[] files = DistributedCache.getCacheFiles(context.getConfiguration()); You can iterate through files.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26241628

http://stackoverflow.com/q/26346698
favorite count: 0
upvote count: 5
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26350150
accepted answer: http://stackoverflow.com/a/26350150
downvote count: 0
tagged with: java
has title: Parsing HTML into formatted plaintext using jsoup
type: Question
tagged with: jsoup
score: 5
answer count: 1
has body: I was working on a maven project that allows me to parse a html data from a website. I was able to parse it using this code below: public void parseData(){ String url = "http://stackoverflow.com/help/on-topic"; try { Document doc = Jsoup.connect(url).get(); Element essay = doc.select("div.col-section").first(); String essayText = essay.text(); jTextAreaAdem.setText(essayText); } catch (IOException ex) { Logger.getLogger(formAdem.class.getName()).log(Level.SEVERE, null, ex); } } So far I have no problems. I can parse the html data. I was using select method from jsoup and retrieving data using "div.col-section" which means I'm looking for div element with the class is col-section. I wanted to print the data in a textarea. The result that I have is a huge one paragraph even though the real data on the website is more than one paragraphs. So how to parse the data just like the one on the website?

http://stackoverflow.com/comment/41292200
comment on: http://stackoverflow.com/q/26278856
has text: This class is part of the appengine sdk jar, try cleaning the project and check you've correctly added the sdk dependency
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/41310479
type: QuestionComment
has text: Yes it is going into an array that represents the names of the nodes inside of the graph. But that first line is not being used in the double array
comment on: http://stackoverflow.com/q/26322804
score: 0
type: Comment

http://stackoverflow.com/a/26341100
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26341052
has body: Here you are checking the condition outside the loop it only checks for the last input.As you are accepting first value before the loop you should set that value as largest before the loop. (Pointed out by khelwood) So it should be like this, System.out.println("Enter the number: "); number = input.nextInt(); largest=number; while(counter &lt; 10){ System.out.println("Enter the number: "); number = input.nextInt(); if(number &gt; largest)//If largest is small, set current number as largest largest = number; counter++; }
upvote count: 2
has comment: http://stackoverflow.com/comment/41344583
type: Answer

http://stackoverflow.com/comment/41339131
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26337906
type: Comment
has text: @MarkoTopolnik That's why I'm confused, I was trying to design the sort based on whether I would have a small, roughly equal, or large amount of unsorted data relative to my sorted partition, but the way the question is written doesn't seem to provide any insight into that.

bubble-sort
tags question: http://stackoverflow.com/q/26199817
tag name: bubble-sort
type: Tag

http://stackoverflow.com/comment/41254521
type: Comment
has text: I changed the code as shown, but this is what caused my error in the beginning. Does this match what you've described ? Thanks again!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26291713

http://stackoverflow.com/a/26275501
answers question: http://stackoverflow.com/q/26275484
has comment: http://stackoverflow.com/comment/41236058
upvote count: 1
has comment: http://stackoverflow.com/comment/41223780
type: AcceptedAnswer
has body: I found some articles which use Apache commons, but in all of that, I can get only the image No . you can get other items also from the request . DiskFileUpload upload = new DiskFileUpload(); List&lt;FileItem&gt; items = upload.parseRequest(request); for (FileItem item : items) { if (item.isFormField()) { //get form fields here } else { //process file upload here }} Read the documentation here to understand more on this and also a nice thread here values of input text fields in a html multipart form Update: String cat = item.getFieldName("category") instead of request.getParameter("category"); Because you are parsing the request object . so you need to get it from FileItem object . similarly for other fields too.
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26275484
score: 1

http://stackoverflow.com/q/26304893
has body: I created a HSQL database with the following Spring configuration: &lt;jdbc:embedded-database id="dataSource" type="HSQL"&gt; &lt;jdbc:script location="resources/sql/schema.sql"/&gt; &lt;jdbc:script location="resources/sql/test-data.sql"/&gt; &lt;/jdbc:embedded-database&gt; Everything works fine (for once)! I'd like to connect the same instance of that database from another client (I'm using database support from IntelliJ Ultimate) to alter/monitor the state of some tables for development reasons. Is it possible? How? If not, are there any alternatives/workarounds?
tagged with: hsqldb
type: UnansweredQuestion
has title: Connect to in-memory HSQL database (launched by Spring) from another client
tagged with: spring
tagged with: spring-mvc
tagged with: java
type: Question
answer count: 1
tagged with: in-memory-database
score: 0
has answer: http://stackoverflow.com/a/26305357

http://stackoverflow.com/comment/41120238
has text: The player isn't something that can be installed on a machine, it resides on a web server. It's a tool for webmasters for video publishing.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26206404

http://stackoverflow.com/comment/41174562
type: Comment
has text: I'm not quite sure I understand what you mean, you want to access the hidden value on the server?
comment on: http://stackoverflow.com/a/26248038
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41231635
type: Comment
comment on: http://stackoverflow.com/a/26278095
has text: thanks for your helpful answers. your example works for me in a plain java project. however, i am implementing a webapp, which is deployed via tomcat. when i run the project after on tomcat, this code does not work, even though i exactly do as you suggest. i use an unbounded LinkedBlockingQueue, which is accessible as a singleton. the code looks like this: http://pastebin.com/tZvwASUz the output looks like this: http://pastebin.com/Zxz3bpsy between the 4th and 5th package there should be only 1000ms of sleep (line 12+13). However it takes 8sec (time diff between line 12 and 13). why the lag?
score: 0
type: AnswerComment

http://stackoverflow.com/a/27128696
score: 6
type: Answer
upvote count: 6
has body: You can change PaymentMessage paymentMessage parameter to String paymentMessage which should be the json string. Then there won't be any validation though nor you'll have the POJO directly.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26317224
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26317224
has comment: http://stackoverflow.com/comment/50777900

http://stackoverflow.com/comment/41332470
type: Comment
has text: Yes, before calling the method that requires an interpolator, you'll need to contruct an instance of spherical interpolator and pass it along.
type: AnswerComment
comment on: http://stackoverflow.com/a/26298814
score: 0

http://stackoverflow.com/comment/41169090
type: AnswerComment
has text: I've tried that Already, Eclipse tells me I have a Syntax error, "insert "... VariableDeclaratorId" to complete FormalParameterList", as well as another , "syntax error on token(s), misplaced construct(s)".
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26245080

http://stackoverflow.com/q/26352686
tagged with: java
answer count: 2
has title: HttpUrlConnection and file issue
has answer: http://stackoverflow.com/a/26353494
downvote count: 0
favorite count: 0
tagged with: multipart
possible better answer: http://stackoverflow.com/a/26373487
has answer: http://stackoverflow.com/a/26373487
tagged with: httpurlconnection
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26353494
upvote count: 1
has body: Sorry to bring this again. When I first started to develop my android app, I was using HttpClient. I realized that Google officially made this class deprecated for that latest version of Android; they encourage developer to use HttpUrlConnection instead. I recently faced a wall when I tried to upload a file(JPEG) to my PHP Server API hosted on GAE. I put a lot of effort into using Multipart to achieve that. I ended up using the following class. But it's still not working for some unknown reason. My PHP Server API successfully receives my POST data but can't receive my file. What`s wrong with my code? In case you're wondering, I can verify that it has nothing to do with my server by using isset($_FILES["profile_picture"]) to verify that I've received it. Here is my class: package net.XXXXX; import android.util.Log; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; import javax.net.ssl.HttpsURLConnection; public class MultipartUtility { private HttpURLConnection mConnection; private OutputStream outputStream; private PrintWriter mWriter; private final String boundary; private static final String LINE_FEED = "\r\n"; private final static String CHARSET = "UTF-8"; private final static String API_URL = "https://select-connection.appspot.com/"; public static final String LOG_TAG = "APIRequestHandler"; public static final int CONNECT_TIMEOUT = 15000; public static final int READ_TIMEOUT = 10000; /** * ... */ public MultipartUtility() throws IOException { // creates a unique boundary based on time stamp. boundary = "===" + System.currentTimeMillis() + "==="; URL url = new URL(API_URL); mConnection = (HttpsURLConnection)…
type: Question
score: 1

http://stackoverflow.com/comment/41244231
has text: You shouldn't be modify the state of the object your are monitoring as this could trigger and infinite loop ending in stake overflow...
comment on: http://stackoverflow.com/a/26253209
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/26206190
has title: protected integers in static classes
has answer: http://stackoverflow.com/a/26207861
has answer: http://stackoverflow.com/a/26206284
has comment: http://stackoverflow.com/comment/41095684
tagged with: java
upvote count: 1
tagged with: primitive
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41095667
tagged with: inheritance
has comment: http://stackoverflow.com/comment/41098379
tagged with: class
has comment: http://stackoverflow.com/comment/41096515
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41095540
favorite count: 0
has comment: http://stackoverflow.com/comment/41095616
tagged with: static
has comment: http://stackoverflow.com/comment/41118408
has body: Let's say I have a public abstract class Super{ protected static int BASE = 1; public int foo(){ //do some computation with BASE, e.g: return BASE + 1; } } and a couple static classes inheriting from it: public static abstract class Sub extends Super{ //this class should keep BASE at 1 } static class SubSub1 extends Sub{ //this class should change BASE to 0 static{ SubSub1.BASE = 0; } } static class SubSub2 extends Sub{ //this class should in effect have a BASE of 1 } And yes, this fails. The problem obviously is that since SubSub1 is a static class, if it is to change BASE, Super.BASE must be static. But if Super.BASE is static, then SubSub1.Base IS Super.BASE. How do I best achieve what I'm trying to do? (No, I can't make the classes non-static, and assume there are a lot of subclasses.) I'd appreciate the help.
type: UnansweredQuestion

http://stackoverflow.com/comment/137965803
comment on: http://stackoverflow.com/a/26252993
score: 0
type: AnswerComment
type: Comment
has text: On Mac (Sonoma): When these are loaded into zsh, this actually lets the java version running be specific to the terminal tab open. When you open a new tab, it will use the default, and you can then change the individual tab to run the java you are looking for.

http://stackoverflow.com/q/26270406
type: Question
has answer: http://stackoverflow.com/a/26270439
has comment: http://stackoverflow.com/comment/41214893
has comment: http://stackoverflow.com/comment/41215024
has body: Heres my code that takes a string and returns an array of the ascii values for each character in the array in order. Compile error is 'array required, but java.lang.String found' public class Q1E { int[] stringToCodes(String characters){ int characterLength= length(characters); int[] array=new int[characterLength]; for(int i=0;i&lt;characterLength;i++) { array[i] =(int) characters[i]; } } }
tagged with: bluej
score: 0
has answer: http://stackoverflow.com/a/26270543
has answer: http://stackoverflow.com/a/26273529
has title: Parsing a string and returning an array
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/26270462
tagged with: java

http://stackoverflow.com/a/26275148
has body: I can think of no rational explanation for an array created like that to have different lengths on different machines. If this is really happening, then it would be a flagrant violation of the Java Language Specification. IMO, the most likely explanation is that (for some reason) you are not executing the same code in the two environments. For example, there might be a classpath related issue which is causing the JVM to pick up different versions of the class (compiled from different versions of the source code) in the two environments. Or you might have copied the wrong JAR file. Or forgotten to copy a JAR file. Another possibility is that the code you have shown us is a fabrication; i.e. your actual code is different in some significant way.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41223507
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26274770
answers question: http://stackoverflow.com/q/26274770
type: AcceptedAnswer
score: 1

http://stackoverflow.com/q/26337852
has comment: http://stackoverflow.com/comment/41345882
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41347255
has title: How do I update Eclipse CVS Client feature in Eclipse Luna
tagged with: eclipse-plugin
tagged with: eclipse-rcp
has body: We require some bespoke changes to support our eclipse dev environment. We have modified the plugin: org.eclipse.team.cvs.ui ...and the feature: org.eclipse.cvs-feature ...that references this plugin with our version We then created an update site with this feature. This approach works with no problems when worked with the plugins/features in Helios. The same approach does not work in Luna. The error I get when I try and install the update site is: Your original request has been modified. "Eclipse CVS Client" is already installed, so an update will be performed instead. Cannot complete the install because of a conflicting dependency. Software being installed: Eclipse CVS Client 1.4.101.kirona (org.eclipse.cvs.feature.group 1.4.101.kirona) Software currently installed: Eclipse IDE for Eclipse Committers 4.4.1.20140925-1820 (epp.package.standard 4.4.1.20140925-1820) Only one of the following can be installed at once: CVS Team Provider UI 3.3.601.kirona (org.eclipse.team.cvs.ui 3.3.601.kirona) CVS Team Provider UI 3.3.600.v20130514-1224 (org.eclipse.team.cvs.ui 3.3.600.v20130514-1224) Cannot satisfy dependency: From: Eclipse IDE for Eclipse Committers 4.4.1.20140925-1820 (epp.package.standard 4.4.1.20140925-1820) To: org.eclipse.epp.package.standard.feature.feature.group [4.4.1.20140925-1820] Cannot satisfy dependency: From: Eclipse CVS Client 1.4.100.v20140925-0400 (org.eclipse.cvs.feature.group 1.4.100.v20140925-0400) To: org.eclipse.team.cvs.ui [3.3.600.v20130514-1224] Cannot satisfy dependency: From: Eclipse CVS Client 1.4.101.kirona (org.eclipse.cvs.feature.group 1.4.101.kirona) To: org.eclipse.team.cvs.ui [3.3.601.kirona] Cannot satisfy dependency: From: Eclipse CVS Client Resources 1.4.100.v20140925-0400 (org.eclipse.cvs.source.feature.group 1.4.100.v20140925-0400) To: org.eclipse.cvs.feature.group [1.4.100.v20140925-0400] Cannot satisfy dependency: From: EPP Eclipse IDE for Eclipse Committers Feature 4.4.1.20140925-1820 (org.eclipse.epp.package.standard.feature…
has comment: http://stackoverflow.com/comment/41339255
answer count: 0
tagged with: eclipse-luna
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/41289285
comment on: http://stackoverflow.com/q/26311020
score: 0
type: Comment
type: QuestionComment
has text: It's best if you show how you override the method. If the method `greet` existing in the base class `Greeting` you can override it in an anonymous class. But new methods cannot be invoked that way except from inside the anonymous class.

http://stackoverflow.com/q/26207441
type: Question
has comment: http://stackoverflow.com/comment/41098138
answer count: 1
tagged with: opengl
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26208286
has title: Wireframe sphere with latitude/longitude OpenGL
has comment: http://stackoverflow.com/comment/41097965
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41097887
has answer: http://stackoverflow.com/a/26208286
has body: I'm trying to create a wireframe sphere using openGL that has latitude and longitude lines. Currently I'm running into an issue that I think I'm simply overlooking and with a bit of help can quickly correct with creating the sphere. My code is the following inside of a class that creates displays: double rho = 1; gl.glBegin(GL2.GL_LINE_LOOP); for (int i = 0; i&lt; 360; i++){ theta = i/180 * Math.PI; for (int j = 0; j&lt; 360; j++){ double phi = j/180 * Math.PI; double x = rho * Math.sin(phi) * Math.cos(theta); double y = rho * Math.sin(phi) * Math.sin(theta); double z = rho * Math.sin(phi); gl.glVertex3d(x, y, z); } gl.glEnd(); } From this code I'm currently not getting anything to display. What am I missing?
has comment: http://stackoverflow.com/comment/41098119

http://stackoverflow.com/a/26508885
has body: I have found that in java Boolean.getBoolean("tc.active"); you can get boolean variable true/false that terracotta server is running or not.. Reference : http://terracotta.org/documentation/3.7.4/bigmemorymax/technical-faq Note that Boolean.getBoolean("tc.active"); has one problem. If you are getting always TRUE value after terracotta server is DOWN than use the following solution. Reference : http://forums.terracotta.org/forums/posts/list/7214.page Thats it.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26296139
type: Answer
accepted answer of: http://stackoverflow.com/q/26296139
score: 0

http://stackoverflow.com/comment/41345124
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26341410
has text: Hi. Welcome to SO. Dont post your entire project post only relevant portions of your code. Make sure you provide all information required to reciprocate your problem. Thanks.
score: 0

http://stackoverflow.com/comment/41265966
score: 0
type: QuestionComment
type: Comment
has text: `Polymorphism `and `dynamic binding`.
comment on: http://stackoverflow.com/q/26298494

http://stackoverflow.com/comment/41218640
type: Comment
comment on: http://stackoverflow.com/a/26272198
has text: I have to move the file it is working fine but it is copying the file from one location to another
score: 0
type: AnswerComment

http://stackoverflow.com/q/26237662
linked to: http://stackoverflow.com/q/18635616
has comment: http://stackoverflow.com/comment/41154396
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26239703
upvote count: 5
tagged with: java
has body: public class MyStack2 { private int[] values = new int[10]; private int index = 0; public synchronized void push(int x) { if (index &lt;= 9) { values[index] = x; Thread.yield(); index++; } } public synchronized int pop() { if (index &gt; 0) { index--; return values[index]; } else { return -1; } } public synchronized String toString() { String reply = ""; for (int i = 0; i &lt; values.length; i++) { reply += values[i] + " "; } return reply; } } public class Pusher extends Thread { private MyStack2 stack; public Pusher(MyStack2 stack) { this.stack = stack; } public void run() { for (int i = 1; i &lt;= 5; i++) { stack.push(i); } } } public class Test { public static void main(String args[]) { MyStack2 stack = new MyStack2(); Pusher one = new Pusher(stack); Pusher two = new Pusher(stack); one.start(); two.start(); try { one.join(); two.join(); } catch (InterruptedException e) { } System.out.println(stack.toString()); } } Since the methods of MyStack2 class are synchronised, I was expecting the output as 1 2 3 4 5 1 2 3 4 5. But the output is indeterminate. Often it gives : 1 1 2 2 3 3 4 4 5 5 As per my understanding, when thread one is started it acquires a lock on the push method. Inside push() thread one yields for sometime. But does it release the lock when yield() is called? Now when thread two is started, would thread two acquire a lock before thread one completes execution? Can someone explain when does thread one release the lock on stack object?
type: Question
accepted answer: http://stackoverflow.com/a/26238027
has answer: http://stackoverflow.com/a/26238192
score: 5
downvote count: 0
favorite count: 0
has title: Thread synchronization- When does a thread release the lock on an object
answer count: 3
has answer: http://stackoverflow.com/a/26238027
has answer: http://stackoverflow.com/a/26239703
tagged with: multithreading
tagged with: thread-synchronization

http://stackoverflow.com/comment/41173939
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26247846
has text: `ArrayList` should be the easier choice if you need to store some of the input before you know the final size.
score: 0

http://stackoverflow.com/a/26310106
type: Answer
accepted answer of: http://stackoverflow.com/q/26309895
score: 2
upvote count: 2
has body: I don't think there is any useful notion of "too little" or "too much" cleanup. Certainly there is no general way to decide that you have done too little or too much. Specifically ... Can I define my thread's interrupt-handling behavior to be: 'when interrupted, finish everything you're doing as normal before propagating the interrupt', or is this stretching the definition of 'cleanup' a little too much? There's no definite answer to this. If it makes sense (e.g. this behaviour is required), then it would be correct to do that. Whether you call it "cleanup" or not is irrelevant. On the other hand, one of the common use-cases of Java interrupts is to signal to some part of the application to stop what ever it is doing because, for example: the server is shutting down, or the requested action is taking too long, or the client that made the request has "gone away", and there is no other reason to complete the request. In such cases, "finish everything as normal" may be the wrong strategy, especially if that is going to be expensive. (Or it may be the right strategy; for example, if there is no reliable way to back out of the sequence of actions that need to be done atomically.) In short ... we can't tell you whether this is the right thing to do. In other words, I get that it's important to properly handle and propagate interrupts; my question is, how important is it to handle interrupts in a timely manner, and what counts as 'timely'? Again. These are questions that only make sense (and can only be answered) in the context of your application. It depends ... But I don't think that this (cleanup) is restricted to interrupts. Consider the example in the article: public class PlayerMatcher { private PlayerSource players; public PlayerMatcher(PlayerSource players) { this.players = players; } public void matchPlayers() throws InterruptedException { Player playerOne, playerTwo; try { while (true) { playerOne = playerTwo = null; // Wait for two players to arrive and start a …
answers question: http://stackoverflow.com/q/26309895
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41292258

http://stackoverflow.com/comment/41149212
score: 1
comment on: http://stackoverflow.com/q/26235026
has text: Can't you use `context.getResources().getString(R.string.wrongpass)`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26223909
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41130325
has body: I am trying to connect to one of my MySql Databases through a System DSN I set up. The DSN is set up correctly with my SSL certs, username, password, port, and the databases populate the DSN database drop down and the "Test" connection passes. I can't seem to get a connection in Java. I have spent 2 days looking through some examples on Stack but they all refer to an Access database and using JDBC-ODBC bridge which is no longer available in Java 8. I tried using UCanAccess with Jackcess but I have gotten no where. The code below is what I have been tinkering with the last few hours. I normally connect to MySql databases with PHP and receive result in JSON or directly with JDBC driver but for this project neither are really an option. Any ideas. I appreciate the help. //String username = "&lt;username&gt;"; //String password = "&lt;password&gt;"; //String database = "&lt;database_name&gt;"; try { Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); //Connect to cllients MySql Database Connection conn = DriverManager.getConnection("jdbc:ucanaccess:" + database); //Call VerifyLabel(&lt;MAC&gt;,&lt;MODEL&gt;); Call provided client CallableStatement cStmt = conn.prepareCall("{CALL verify(?, ?)}"); //MAC cStmt.setString(1, "mac address"); //model cStmt.setString(2, "model"); cStmt.execute(); //Getting results from "Status" column ResultSet rs1 = cStmt.getResultSet(); //Iterate results and print. while (rs1.next()) { System.out.println(rs1.getString("Status")); } //Close connection conn rs1.close(); } catch (SQLException ex) { Logger.getLogger(CambiumStoredTest.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(CambiumStoredTest.class.getName()).log(Level.SEVERE, null, ex); } Using MySql Driver: Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql:"+ database); also tried: Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localh…
tagged with: mysql
upvote count: 1
tagged with: dsn
type: Question
has answer: http://stackoverflow.com/a/26224710
has comment: http://stackoverflow.com/comment/41130073
has answer: http://stackoverflow.com/a/26241448
has title: Java MySql Connection Through DSN
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41130812
has comment: http://stackoverflow.com/comment/41130790
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41129757

http://stackoverflow.com/q/26266126
has title: Oracle OPAM REST API checkout method returns an http 409 code
type: Question
score: 0
answer count: 1
tagged with: oracle-opam
tagged with: rest
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26268270
has body: I am trying to use OPAM REST API I've wrote several java methods that are working correctly (although some details took me some time to figure out), but now I am stuck in this one https://host:port/opam/account/accountUID/checkout which returns me a 409. Any clues? I am following the same approach as described in this post (in the end of it there's an example on how to write a java HTTP request) It seems to be related to the user at OPAM that I use to authenticate in the client, which seems not to be authorized to checkout the password. If it's the case, what permission shout I grant to this OPAM user in order to do so?
tagged with: java

http://stackoverflow.com/comment/41111797
type: AnswerComment
has text: I am not the downvoter, but your answer is misleading. You don't _have_ to write an XML Schema for this, annotated classes would suffice. Also, "link-only" answers are generally discouraged.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26212887

http://stackoverflow.com/a/26203994
accepted answer of: http://stackoverflow.com/q/26203952
has comment: http://stackoverflow.com/comment/41091364
answers question: http://stackoverflow.com/q/26203952
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41091400
score: 0
type: Answer
has body: You don't want to compare your strings with == but with .equals. if(un.equals(username) &amp;&amp; pass.equals(password)) Apar from that, this is very slow for a big userbase. Instead you could query for username and password in the database and just check if you get back a result or not.
has comment: http://stackoverflow.com/comment/41091306

http://stackoverflow.com/comment/41302224
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26318341
type: Comment
has text: You could also do index math instead of having nested arrays. That's not necessarily better though, YMMV.

http://stackoverflow.com/q/26288373
has answer: http://stackoverflow.com/a/32165579
tagged with: genericdao
tagged with: java
has title: Spring MVC: Generic DAO and Service classes
upvote count: 10
downvote count: 1
type: Question
has body: I am writting web in Spring MVC. I wrote all DAOs using Generic DAO. Now I would like to rewrite my Service classes. How can I write "Generic Service"? There are my DAOs: /* ################################# DAO ################################ */ package net.example.com.dao; import java.util.List; public interface GenericDao&lt;T&gt; { public T findById(int id); public List&lt;T&gt; findAll(); public void update(T entity); public void save(T entity); public void delete(T entity); } /* ------------------------------------------------------ */ package net.example.com.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; @Scope("prototype") public abstract class GenericHibernateDaoImpl&lt;T extends Serializable&gt; implements GenericDao&lt;T&gt; { private Class&lt;T&gt; clazz; @Autowired private SessionFactory sessionFactory; public final void setClazz(Class&lt;T&gt; clazzToSet) { this.clazz = clazzToSet; } @SuppressWarnings("unchecked") public T findById(int id) { return (T) getCurrentSession().get(clazz, id); } @SuppressWarnings("unchecked") public List&lt;T&gt; findAll() { return getCurrentSession().createQuery("FROM " + clazz.getName()).list(); } public void update(T entity) { getCurrentSession().update(entity); } public void save(T entity) { getCurrentSession().save(entity); } public void delete(T entity) { getCurrentSession().delete(entity); } protected final Session getCurrentSession(){ return sessionFactory.getCurrentSession(); } } /* ------------------------------------------------------ */ package net.example.com.dao; import net.example.com.entity.Country; public interface CountryDao extends GenericDao&lt;Country&gt; { public Country findByName(String name); public Country findByCode(String code); } /* ------------------------------------------------------ */ package net.exam…
has answer: http://stackoverflow.com/a/26288806
has answer: http://stackoverflow.com/a/26288766
has answer: http://stackoverflow.com/a/26288564
tagged with: dao
score: 9
has answer: http://stackoverflow.com/a/32165630
tagged with: generics
favorite count: 0
answer count: 5
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/26287748
has comment: http://stackoverflow.com/comment/41247170
tagged with: xamarin
answer count: 1
has body: I can't locate my JDK. What I've done is changed the default location because I saw it as one of solution to "non working SDK manager" as it said java path should not contain spaces soo i created a new map on j: disk and moved the java directory and also changed the JAVA_HOME variable each time i moved the jdk. Since it wasn't working that way either i tried to change it all back to old "Program Files" path but then i got to this problem, I've been trying to resolve this for past few days for like 6 hours a day and I am all out of the options, please don't redirect me to the "similar" post cause i tried googling for everything.I am using Xamarin IDE and win7 -32bit. I also tried: - reinstalling SDK manager wich worked for like 5 mins ,I could have use it but then after I've updated some of the SDK packages he was gone. -installing jdk 1.8.0_20 and 1.8.0_39 -using the CMD
favorite count: 0
tagged with: sdk
has answer: http://stackoverflow.com/a/26288033
has comment: http://stackoverflow.com/comment/41247623
tagged with: android
has comment: http://stackoverflow.com/comment/41247547
has comment: http://stackoverflow.com/comment/41247332
downvote count: 0
has comment: http://stackoverflow.com/comment/41247655
has title: can not locate JDK
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41247841
has comment: http://stackoverflow.com/comment/41247803
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41247709
has comment: http://stackoverflow.com/comment/41247283
type: Question
upvote count: 1

http://stackoverflow.com/a/26272035
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26271800
type: Answer
score: 2
has body: You need to add the @Creatable annotation to ConnectionPool (org.eclipse.e4.core.di.annotations.Creatable): @Singleton @Creatable public class ConnectionPool You could also use an OSGi service for the service. It is also possible to create the service in an AddOn or in the the application LifeCycle class. You can also use a ContextFunction to create a service.
upvote count: 2
answers question: http://stackoverflow.com/q/26271800

http://stackoverflow.com/q/26233403
has answer: http://stackoverflow.com/a/26233708
accepted answer: http://stackoverflow.com/a/26233708
has title: XJC: Generate subpackages for complexTypes
tagged with: xsd
type: AnsweredQuestion
tagged with: ant
tagged with: java
tagged with: jaxb
type: Question
tagged with: xjc
score: 0
has body: is it Possible to generate extra subpackages per complexType when generating Javaclasses with XJC2Task? I have a problem generating from a xsd where i have a complexType named Traveller which has an element named "ElementNumber". But also a single complexType named TravellerElementNumber. When generating i recieve the Error "Two declarations cause a collision in the ObjectFactory class. Is there any way to fix this issue without changing the xsd? Best Regards, Sti
answer count: 1

http://stackoverflow.com/comment/41292697
comment on: http://stackoverflow.com/q/26312985
type: QuestionComment
type: Comment
score: 1
has text: What happens when you do `new BigDecimal(0.7).add(new BigDecimal(0.1))`? Your current `BigDecimal` code wouldn't work because `d + 0.1` is still a regular `double` addition which gives you the floating point anomaly. *Btw it's spelt weird not weired.*

http://stackoverflow.com/a/26337893
score: 1
has comment: http://stackoverflow.com/comment/48937410
has comment: http://stackoverflow.com/comment/41402102
has comment: http://stackoverflow.com/comment/48960152
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41418236
type: Answer
has body: You use an obsolete version (1.5.2) of Java3D, this version is no longer maintained since a few years. Please uninstall it and install the latest version (1.6.0). Follow my instructions here.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26333045
answers question: http://stackoverflow.com/q/26333045

http://stackoverflow.com/a/26229555
has comment: http://stackoverflow.com/comment/41204645
has body: The standard while loop uses around 50% of cpu so it isnt wise having many while loops at once. So what i designed to combat that is a waitBlock that waits a specific amount of time using an inputStream that blocks until there is an inputStream, and so if the waitBlock waits 0001 millisecond then the loop will run 1000 times a second, so although the cpu usage will be basically 0% it has speed limitations. Whith the memory usage from what i understand, if you are using sockets etc. And you dont close sockets and you keep recreating them,the memory usage just builds and builds. Although I might be able to help more if i know what you have done in your code.
score: 0
answers question: http://stackoverflow.com/q/26229431
type: Answer
has comment: http://stackoverflow.com/comment/41158991
has comment: http://stackoverflow.com/comment/41139966

http://stackoverflow.com/q/26272423
type: AnsweredQuestion
tagged with: java
type: Question
has title: Converting relative address to absolute address using HttpClient in java
score: 0
has comment: http://stackoverflow.com/comment/44232115
has comment: http://stackoverflow.com/comment/44232149
answer count: 1
accepted answer: http://stackoverflow.com/a/26272558
has body: I get the web page content by passing URL to HttpGet() method. This page content will be having relative paths of images,javascripts, href etc. I have written a custom code where I am finding relative address and get the corresponding absolute address and using replace function I convert all the relative address of web page content to absolute address.But,it results in performance issue. I am looking for a functionality that converts all relative address to absolute address of a web page at once without using my custom code.
tagged with: apache-httpclient-4.x
has answer: http://stackoverflow.com/a/26272558
has comment: http://stackoverflow.com/comment/41218519

http://stackoverflow.com/q/26246368
upvote count: 1
accepted answer: http://stackoverflow.com/a/26246533
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41171189
type: Question
tagged with: jakarta-ee
tagged with: jpa
downvote count: 0
tagged with: persistence
has answer: http://stackoverflow.com/a/26246533
has title: JPA EntityManager not being injected in Java EE app
has comment: http://stackoverflow.com/comment/41171230
answer count: 1
has comment: http://stackoverflow.com/comment/41171341
has body: I am receiving a NullPointerException with the following code and configuration, and I am not sure why. I would appreciate some help in debugging this issue. File persistence.xml: org.hibernate.ejb.HibernatePersistence com.adism.domain.Ad <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/adism" /> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" /> <property name="hibernate.connection.username" value="root" /> <property name="hibernate.connection.password" value="" /> Entity Class: @Entity @Table(name = "ads") public class Ad { private Integer adId; private String adTitle; public Ad(){} @Id @Column(name="adid") @GeneratedValue public Integer getAdId(){ return adId; } public void setAdId(Integer adId){ this.adId = adId; } @Column(name="adtitle") public String getAdTitle(){ return this.adTitle; } public void setAdTitle(String title){ this.adTitle = title; } } DAO Implementation: public class AdDaoImpl implements AdDao{ @PersistenceContext public EntityManager entityManager; @Override public void save(Ad ad){ entityManager.persist(ad); } } When I run following code in JSP, I get NullPointerException Ad ad = new Ad(); ad.setAdId(1000); ad.setAdTitle("JPA pure"); AdDao newDao = new AdDaoImpl(); newDao.save(ad);
favorite count: 0

http://stackoverflow.com/a/26294767
answers question: http://stackoverflow.com/q/26294582
type: Answer
score: 1
upvote count: 1
has body: This should work. You have to define the correct path to your desktop. For instance for me it's : C:\Users\Tsou\Desktop\ public static void newFileCreator(String filename){ File ob = new File("**C:\\Users\\Tsou\\Desktop\\**"+filename + ".txt"); boolean filecreated = false; ... }
downvote count: 0

http://stackoverflow.com/a/26333092
has body: Class B extends Class A. So all functionality of Class A will be inherited in Class B. Class B extends A{} Now you want Class C, D, E to extend functionality of Class A and B Which can be done by simply extending Class B instead of Class A Class C extends B{} Class D extends B{} Class E extends B{}
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26332999

http://stackoverflow.com/a/26272576
score: 0
answers question: http://stackoverflow.com/q/26272479
type: Answer
has body: Only Class1 does not mean anything to JVM, So you can either use as System.out.println(Class1.class); or System.out.println(new Class());

http://stackoverflow.com/a/32248125
has comment: http://stackoverflow.com/comment/107744690
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/107730061
answers question: http://stackoverflow.com/q/26340688
has comment: http://stackoverflow.com/comment/107739164
downvote count: 0
type: Answer
has body: Doing this with the JDK's Stream API only isn't really straightforward as other answers have shown. This article explains how you can achieve the SQL semantics of GROUP BY in Java 8 (with standard aggregate functions) and by using jOOλ, a library that extends Stream for these use-cases. Write: import static org.jooq.lambda.tuple.Tuple.tuple; import java.util.List; import java.util.stream.Collectors; import org.jooq.lambda.Seq; import org.jooq.lambda.tuple.Tuple; // ... List&lt;Foo&gt; list = // FROM Foo Seq.of( new Foo(1, "P1", 300, 400), new Foo(2, "P2", 600, 400), new Foo(3, "P3", 30, 20), new Foo(3, "P3", 70, 20), new Foo(1, "P1", 360, 40), new Foo(4, "P4", 320, 200), new Foo(4, "P4", 500, 900)) // GROUP BY f1, f2 .groupBy( x -&gt; tuple(x.f1, x.f2), // SELECT SUM(f3), SUM(f4) Tuple.collectors( Collectors.summingInt(x -&gt; x.f3), Collectors.summingInt(x -&gt; x.f4) ) ) // Transform the Map&lt;Tuple2&lt;Integer, String&gt;, Tuple2&lt;Integer, Integer&gt;&gt; type to List&lt;Foo&gt; .entrySet() .stream() .map(e -&gt; new Foo(e.getKey().v1, e.getKey().v2, e.getValue().v1, e.getValue().v2)) .collect(Collectors.toList()); Calling System.out.println(list); Will then yield [Foo [f1=1, f2=P1, f3=660, f4=440], Foo [f1=2, f2=P2, f3=600, f4=400], Foo [f1=3, f2=P3, f3=100, f4=40], Foo [f1=4, f2=P4, f3=820, f4=1100]]
has comment: http://stackoverflow.com/comment/107720563

http://stackoverflow.com/q/26280720
type: Question
has comment: http://stackoverflow.com/comment/41264187
has comment: http://stackoverflow.com/comment/41266160
score: 0
tagged with: initialization
has comment: http://stackoverflow.com/comment/41266736
has comment: http://stackoverflow.com/comment/41266400
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41242217
tagged with: jdbc
has body: I am wondering how this tag works. The main question here is when you have something like : &lt;jdbc:initialize-database data-source="dataSource"&gt; &lt;jdbc:script location="/path/to/myFirstFile"/&gt; &lt;jdbc:script location="/totally/different/path/to/myOtherFile"/&gt; &lt;/jdbc:initialize-database&gt; How are myFirstFile and myOtherFile interpreted ? What treatment is applied ? What kind of files can I use ? For a practical example if I use a Cassandra data-source do I have to give cql files ? How will all this thing work-out ? Is it a call to the system ? Will it use an API ? Through which pipe will all this information be processed ? If I wanted to debug it to get a grasp on this procedure what should I monitor ? Thanks in advance.
tagged with: spring-jdbc
has comment: http://stackoverflow.com/comment/41265615
answer count: 0
has title: How does jdbc:initialize-database work underneath the lid?
tagged with: java

http://stackoverflow.com/a/26242638
has body: Add the following line to your server.xml For more info refer this
type: Answer
answers question: http://stackoverflow.com/q/26242303
score: 0

http://stackoverflow.com/comment/41095347
comment on: http://stackoverflow.com/a/26196865
type: AnswerComment
score: 0
type: Comment
has text: I would say close enough. Thanks for explenation.

http://stackoverflow.com/comment/41298357
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26315997
has text: Youre assigning the instance variables (which default to `null`, `0` and `false` respectively) to the local variables instead of the other way around. Read: [Assignment](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op1.html)

http://stackoverflow.com/comment/41291016
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26311816
type: Comment
has text: The `InputStream` itself null, even if I give the full path

http://stackoverflow.com/q/26309639
answer count: 1
tagged with: ide
has title: How to make linefeed symbol disappear on Eclipse
score: 0
has body: I tried to make the little flag-shaped symbol(later I figured, this symbol stands for linefeed) disappear, how do I do that ?
type: Question
type: AnsweredQuestion
tagged with: text-editor
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/26309672
accepted answer: http://stackoverflow.com/a/26309672

http://stackoverflow.com/a/26343428
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/26343362
type: Answer
answers question: http://stackoverflow.com/q/26343362
has body: The interface allows for implementations with a limited size. It does not require implementations to have a size bound by forcing implementations to have a setSize method. See for instance ArrayBlockingQueue(int capacity). So if we continue to add/offer the element into queue, the queue will be extended automatically. No, a Queue implementation is not required to grow automatically.
has comment: http://stackoverflow.com/comment/41352490
upvote count: 4
has comment: http://stackoverflow.com/comment/41349336
type: AcceptedAnswer

search
tags question: http://stackoverflow.com/q/26300843
tags question: http://stackoverflow.com/q/26345075
tags question: http://stackoverflow.com/q/26346470
tags question: http://stackoverflow.com/q/26262824
type: Tag
tags question: http://stackoverflow.com/q/26303445
tags question: http://stackoverflow.com/q/26308699
tags question: http://stackoverflow.com/q/26292631
tags question: http://stackoverflow.com/q/26320753
tags question: http://stackoverflow.com/q/26246834
tags question: http://stackoverflow.com/q/26277994
tags question: http://stackoverflow.com/q/26276688
tags question: http://stackoverflow.com/q/26282615
tags question: http://stackoverflow.com/q/26266832
tags question: http://stackoverflow.com/q/26216984
tags question: http://stackoverflow.com/q/26244911
tag name: search

http://stackoverflow.com/comment/41191738
type: QuestionComment
comment on: http://stackoverflow.com/q/26258197
score: 5
has text: You cannot prevent that. A user can always cast first to the rawtype and then to whatever is required. Generics have their limitations and rawtypes always break them.
type: Comment

http://stackoverflow.com/q/26208296
has title: I'm having an "Error: Syntax error on token(s), misplaced construct(s)". Where is my error?
has comment: http://stackoverflow.com/comment/41099476
type: Question
has answer: http://stackoverflow.com/a/26208339
downvote count: 6
answer count: 3
has answer: http://stackoverflow.com/a/26208347
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/41099460
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26208357
has body: import java.util.Scanner; public class LetterGrade { public static void main(String[] args) { char grade; String input; Scanner keyboard = new Scanner(System.in); System.out.println("Enter grade awarded"); input = keyboard.nextLine(); grade = input.charAt(0); switch (grade) { case 'A': System.out.println("Grade was between " + 89.5 - 100); break; case 'B': System.out.println("Grade was between " + 79.5 - 89.45); break; case 'C': System.out.println("Grade was between " + 69.5 - 79.49); break; case 'D': System.out.println("Grade was between " + 59.5 - 69.49); break; case 'F': System.out.println("Grade was below " + 59.5); break; System.out.println("Invalid grade inputted "); } } } 4 errors found: File: C:\Users\Raj\Downloads\Java\LetterGrade.java [line: 19] Error: The operator - is undefined for the argument type(s) java.lang.String, int File: C:\Users\Raj\Downloads\Java\LetterGrade.java [line: 22] Error: The operator - is undefined for the argument type(s) java.lang.String, double File: C:\Users\Raj\Downloads\Java\LetterGrade.java [line: 25] Error: The operator - is undefined for the argument type(s) java.lang.String, double I fixed the big errors i had, sorry about that. I really wasn't thinking straight and I understand i need to read more, which i will be doing tonight, but I'm have a different error now.
upvote count: 0
has comment: http://stackoverflow.com/comment/41099441
has comment: http://stackoverflow.com/comment/41099457
tagged with: java

http://stackoverflow.com/q/26293067
tagged with: java
tagged with: ubuntu
has answer: http://stackoverflow.com/a/26293093
has answer: http://stackoverflow.com/a/26293166
type: Question
upvote count: 1
has title: schedule a job in unix by crontab
linked to: http://stackoverflow.com/q/25894558
tagged with: shell
has answer: http://stackoverflow.com/a/26295341
accepted answer: http://stackoverflow.com/a/26295341
favorite count: 0
has body: I have created a simple java program for printing "Hello world". code is as follows public class Hello { public static void main(String[] args) { System.out.println("Hello world!"); } } Class has been compiled already and it is in the same directory. In same directory I have created a shell file named temp.sh which contains command java Hello now if I execute this shell file then java program is being executed successfully. I have written a cronjob to execute it every minute * * * * * /home/ashutosh/Documents/javaPractice/temp.sh &gt;&gt; /var/log/myjob.log 2&gt;&amp;1 now in my logs it is showing could not load main class java i don't know what is the problem. I have tried by giving absolute path of the java file but nothing helped. Help me. Thanks
possible better answer: http://stackoverflow.com/a/26293242
answer count: 5
tagged with: cron
has answer: http://stackoverflow.com/a/26293127
tagged with: unix
has comment: http://stackoverflow.com/comment/41256486
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26293242
score: 1

http://stackoverflow.com/comment/41089410
type: QuestionComment
has text: @Alex K thanks for adapting to English
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26202716

http://stackoverflow.com/comment/41236880
type: Comment
has text: I don't think it needs to be heuristic. The JVM could iterate objects, based on the node size information in each object header. Or it could record the address of the first object header in each card (or in a sequence of cards) and iterate based on that.
type: AnswerComment
comment on: http://stackoverflow.com/a/26281953
score: 0

http://stackoverflow.com/a/26209435
has comment: http://stackoverflow.com/comment/41101815
has body: Anything after ? is part of the query string. In a Servlet, each key value pair in the query string becomes a request parameters. If you have access to the HttpServletRequest, you can access them with HttpServletRequest#getParameter(String). For example request.getParameter("myId");
has comment: http://stackoverflow.com/comment/41101903
has comment: http://stackoverflow.com/comment/41102272
has comment: http://stackoverflow.com/comment/41101852
has comment: http://stackoverflow.com/comment/41101971
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41102081
has comment: http://stackoverflow.com/comment/41101784
answers question: http://stackoverflow.com/q/26209418
has comment: http://stackoverflow.com/comment/41102060
type: Answer
accepted answer of: http://stackoverflow.com/q/26209418
has comment: http://stackoverflow.com/comment/41101982
downvote count: 0
score: 1

http://stackoverflow.com/q/26326255
type: AnsweredQuestion
has title: Parsing links for href value using JSoup works for a single link, but not for an array of links
tagged with: java
tagged with: jsoup
answer count: 2
has body: I have managed to successfully grab the href links using JSoup. I have also managed to grab the relative value and absolute value of a href for a single link. As shown below: //works perfectly, website: bbc.co.uk Document document = Jsoup.connect(url).get(); Element link = document.select("a").last(); String relHref = testlink.attr("href"); String absHref = testlink.attr("abs:href"); System.out.println(relHref); System.out.println(absHref); //output: relHref: /help/web/links/ absHref: http://www.bbc.co.uk/help/web/links/ I can even use Element link = document.select("a").first(); and this also works. However, when I try and add this in a loop to iterate through all of the grabbed links and print out each link, it doesn't give me the expected results. Here is my code: //not working Elements links = document.select("a"); for(int i=0; i<links.size(); i++){ String relHref = links.attr("href"); String absHref = links.attr("abs:href"); System.out.println(relHref); System.out.println(absHref); } //output http://m.bbc.co.uk http://m.bbc.co.uk http://m.bbc.co.uk .... I know the links array of type Elements has the correct data, and if I try and print the elements in the links array it displays all of the href tags i.e. for (Element link : links) { System.out.println(link); } //output 116 links: mobile site Skip to content Accessibility Help .... But how do I get the relHref and absHref for an array to work? Instead my code just prints out the first link over and over again. I've been going at this for hours, so I'm probably making a silly mistake somewhere but help is appreciated! Thanks.
accepted answer: http://stackoverflow.com/a/26326304
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/26326301
upvote count: 1
tagged with: html-parsing
has answer: http://stackoverflow.com/a/26326304
downvote count: 1
possible better answer: http://stackoverflow.com/a/26326301
type: Question

http://stackoverflow.com/q/26230445
answer count: 1
tagged with: jsp
tagged with: string
has answer: http://stackoverflow.com/a/26230653
type: AnsweredQuestion
has body: I have a question: I have this jsp client that requires the entry of a string that indicates the path of a file: <%@page contentType="text/html" pageEncoding="UTF-8"%> JSP Page Enter NameFile (Excel): Now, When I click on "Submit", I have this page JSP: <%@page import="java.io.ByteArrayOutputStream"%> <%@page import="java.io.FileInputStream"%> <%@page import="java.io.File"%> <%@page contentType="text/plain" pageEncoding="UTF-8"%> JSP Page Action <%-- start web service invocation --%> <% String filename = request.getParameter("filename"); File file = new File (filename); FileInputStream fis = new FileInputStream(file); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; for (int readNum; (readNum = fis.read(buf)) != -1;) { bos.write(buf, 0, readNum); //no doubt here is 0 } byte[] bi = bos.toByteArray(); try { ws.MyWS_Service service = new ws.MyWS_Service(); ws.MyWS port = service.getMyWSPort(); // TODO initialize WS operation arguments here byte[] inputFile = bi; // TODO process result here java.lang.String result = port.mywsmethod(inputFile); out.println(result); } catch (Exception ex) { // TODO handle custom exceptions here } %> <%-- end web service invocation --%> Now, if I insert C:\prova.xls in a PC remote, I get this error: 07-Oct-2014 08:55:10.194 SEVERE [http-apr-8080-exec-41] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [jsp] in context with path [/myWS_Client] threw exception [An exception occurred processing JSP page /action1.jsp at line 27 25: 26: File file = new File (filename); 27: FileInputStream fis = new FileInputStream(filename); 28: ByteArrayOutputStream bos = new ByteArrayOutputStream(); Stacktrace:] with root cause java.io.FileNotFoundException: C:\prova.xls (Impossibile trovare il file specificato) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:146) at java.io.FileInputStream.<init>(FileInputStream.java:101) at org.apach…
tagged with: web-services
has title: Error when I read file on JSP page using PC remote
type: Question
accepted answer: http://stackoverflow.com/a/26230653
tagged with: java
score: 0
tagged with: fileinputstream

http://stackoverflow.com/comment/41261953
comment on: http://stackoverflow.com/q/26295445
has text: @Tom, thanks, but I saw this post before, and I have a different situation. I need to use exists roles (I will select them from list), and not create a new role every time, when I create a new user.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41296075
score: 0
type: Comment
type: QuestionComment
has text: you need OCR. Just notice that open source OCR usually performs poorly.
comment on: http://stackoverflow.com/q/26314978

http://stackoverflow.com/a/28509599
score: 1
answers question: http://stackoverflow.com/q/26200849
type: Answer
upvote count: 1
has body: This answer is for beginners with Service Bus, like me. First thing is to have Unpartitioned queue/topic for AMQP as partitioning is not supported like other answer said. We need to uncheck 'Enable Partitioning' while creating the queue from Azure Portal. By default entities are enabled with Partitioning in service bus. Coming to the problem, I had the same problem when I was trying to use Java Client as Listener to the Queue using Qpid implementation of JMS with AMQP as in the example. The problem was that the Queue was not configured even though the ServiceBus was, in the Azure Portal. Make sure you have added right configuration to your queue in the portal with right permissions and policy names, if you are planning to use different policyNames for sending-to/listening-from queue (See if this is helpful). The policyName OF THE QUEUE NOT SERVICE BUS, is the one to be used for SAS Authentication equivalent to username in ACS and primary/secondary key is equivalent to password in ACS in the config(servicebus.properties) file. Try using Primary key first. If you get authentication error, then you can try the secondary key. If you have special characters in the key, like I had forwarded slash(/), replace it with corresponding UTF-8 value.So I had to use %2F to replace / in the key, in the config file. That cleared my problems. Hope this helps!! PTR(PointsToRemember): It is not suggested to use created from code to use for AMQP as in the current usecase. When you create a queue from code using Service Bus Java API, it is created with the partitioning enabled and no end point created FOR THE QUEUE. So, you'll end up with two exceptions, -- No end point created, as in the question of this context. --Once you go to portal configure it right in portal and in your config file, then you'd get 'AMQP not supported over Partitioned Entities' (You know this already!). So you have to go back and create a queue in portal again disabling partitioning and configure it. Kind of doubl…
downvote count: 0

http://stackoverflow.com/q/26319923
tagged with: java
type: Question
score: 0
has title: Zxing cant find my barcode in image
has comment: http://stackoverflow.com/comment/41305142
answer count: 0
type: UnansweredQuestion
has body: Well, i have a paper with some information and 3 barcode. The user will scan (with a scan device) this paper and submit in our software. Our software should recognized this image and extract the barcodes from it. I'm using ZXING library but i just got "NotFoundException" because any readable barcode is found. This is my image: This is my code: LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Reader reader = new MultiFormatReader(); Result result = reader.decode(bitmap); logger.debug(result.getText()); How can i solve this problem ? I can't say to customer crop the paper before scan. EDIT 1: I tried crop the image and didn't work too. My image croped: EDIT 2: I'm using Code39 format in barcode, so i tried use Code39Reader class from ZXing but i got the some problem
tagged with: zxing
has comment: http://stackoverflow.com/comment/41305236
has comment: http://stackoverflow.com/comment/41305272

http://stackoverflow.com/a/26384827
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26325201
type: Answer
score: 2
has body: If you are using EclipseLink MOXy as your JAXB (JSR-222) provider then you can leverage our @XmlVariableNode extension for this use case (see: http://blog.bdoughan.com/2013/06/moxys-xmlvariablenode-json-schema.html): Java Model Characteristics We will leverage the @XmlVariableNode extension here. This annotation specifies a field/property from the reference class to be used as the element name. import java.util.List; import javax.xml.bind.annotation.*; import org.eclipse.persistence.oxm.annotations.XmlVariableNode; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Characteristics { @XmlVariableNode("characteristic") private List&lt;Characteristic&gt; characteristics; } Characteristic We need to mark the characteristic field/property as @XmlTransient so it won't appear as a child element. import javax.xml.bind.annotation.*; @XmlAccessorType(XmlAccessType.FIELD) public class Characteristic { @XmlTransient private String characteristic; @XmlValue private String value; } jaxb.properties To specify MOXy as your JAXB provider you need to have EclipseLink on your classpath and include a file called jaxb.properties with the following content in the same package as your domain model (see: http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html). javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory Demo Code Demo Here is some demo code that will read/write the desired XML. Note how the standard JAXB APIs are used. import java.io.File; import javax.xml.bind.*; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Characteristics.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); File xml = new File("input.xml"); Characteristics characteristics = (Characteristics) unmarshaller.unmarshal(xml); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(characteristics, System.…

http://stackoverflow.com/comment/41094987
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26205865
type: Comment
has text: of course it makes sence now. everytime i pressed the button the object was created new, which of course lost its previous information. the size was the same but the position due to i++ switched

http://stackoverflow.com/comment/41091304
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26196217
has text: @Dici javac "TestSSData.java" (in directory: /home/testingwarhead/Documents/RC/Projecto/Java/t/centralServer) TestSSData.java:7: error: cannot find symbol StorageServerData SSd; ^ symbol: class StorageServerData location: class TestFileData

http://stackoverflow.com/comment/41222091
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26274500
type: AnswerComment
has text: You need to create the `Hobby` in the loop as well, or modifying one employee's hobby will change them all.

http://stackoverflow.com/q/26293749
tagged with: spring-mvc
type: UnansweredQuestion
tagged with: java
type: Question
has title: Junit for controller is compiling but showing errors
has comment: http://stackoverflow.com/comment/41257408
score: 0
has body: I am using an opensource project petclininc which follows Spring MVC pattern to write Junit test case using spring mocking service. I started with a stand alone controller @Controller @SessionAttributes("visit") public class VisitController { private final ClinicService clinicService; @Autowired public VisitController(ClinicService clinicService) { this.clinicService = clinicService; } @InitBinder public void setAllowedFields(WebDataBinder dataBinder) { dataBinder.setDisallowedFields("id"); } @RequestMapping(value = "/owners/*/pets/{petId}/visits/new", method = RequestMethod.GET) public String initNewVisitForm(@PathVariable("petId") int petId, Map&lt;String, Object&gt; model) { Pet pet = this.clinicService.findPetById(petId); Visit visit = new Visit(); pet.addVisit(visit); model.put("visit", visit); return "pets/createOrUpdateVisitForm"; } @RequestMapping(value = "/owners/{ownerId}/pets/{petId}/visits/new", method = RequestMethod.POST) public String processNewVisitForm(@Valid Visit visit, BindingResult result, SessionStatus status) { if (result.hasErrors()) { return "pets/createOrUpdateVisitForm"; } else { this.clinicService.saveVisit(visit); status.setComplete(); return "redirect:/owners/{ownerId}"; } } @RequestMapping(value = "/owners/*/pets/{petId}/visits", method = RequestMethod.GET) public ModelAndView showVisits(@PathVariable int petId) { ModelAndView mav = new ModelAndView("visitList"); mav.addObject("visits", this.clinicService.findPetById(petId).getVisits()); return mav; } } and my junit test case : package org.springframework.samples.petclinic.web; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mock…
has answer: http://stackoverflow.com/a/26294386
tagged with: mockito
answer count: 1
tagged with: junit
tagged with: springmockito
has comment: http://stackoverflow.com/comment/41257378
has comment: http://stackoverflow.com/comment/41257579

http://stackoverflow.com/comment/41241305
score: 0
type: QuestionComment
has text: @DavidConrad yes, there's \u0004.
type: Comment
comment on: http://stackoverflow.com/q/26284707

http://stackoverflow.com/q/26296579
has answer: http://stackoverflow.com/a/26404490
linked to: http://stackoverflow.com/q/24380857
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/26404490
has comment: http://stackoverflow.com/comment/41265678
has comment: http://stackoverflow.com/comment/41262686
has comment: http://stackoverflow.com/comment/41262852
has title: NoSuchMethodError ClassTypeInformation.from
has comment: http://stackoverflow.com/comment/41269234
tagged with: maven
tagged with: spring
tagged with: nosuchmethoderror
type: Question
type: AnsweredQuestion
tagged with: spring-boot
has body: I have the following dependencies org.springframework spring-web 4.0.7.RELEASE org.springframework spring-webmvc 4.0.7.RELEASE org.springframework.boot spring-boot 1.1.7.RELEASE org.springframework.boot spring-boot-starter-web 1.1.7.RELEASE org.slf4j log4j-over-slf4j org.springframework.data spring-data-commons 1.9.0.RELEASE org.springframework.data spring-data-commons-core 1.4.1.RELEASE however I am getting the following stack trace: Caused by: java.lang.NoSuchMethodError: org.springframework.data.util.ClassTypeInformation.from(Ljava/lang/Class;)Lorg/springframework/data/util/TypeInformation; at org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper.<clinit>(DefaultMongoTypeMapper.java:49) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.<init>(MappingMongoConverter.java:110) at org.springframework.data.mongodb.core.MongoTemplate.getDefaultMongoConverter(MongoTemplate.java:1896) at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:209) at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:194) at org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration.mongoTemplate(MongoDataAutoConfiguration.java:75) at org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration$$EnhancerBySpringCGLIB$$7ba1d827.CGLIB$mongoTemplate$1(<generated>) at org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration$$EnhancerBySpringCGLIB$$7ba1d827$$FastClassBySpringCGLIB$$5c3e7e1e.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312) at org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration$$EnhancerBySpringCGLIB$$7ba1d827.mongoTemplate(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Nativ…
has comment: http://stackoverflow.com/comment/41265577
tagged with: java

http://stackoverflow.com/comment/41325784
type: QuestionComment
has text: my teacher doesn't explain stuff very well.
comment on: http://stackoverflow.com/q/26320139
score: 0
type: Comment

http://stackoverflow.com/q/26198057
linked to: http://stackoverflow.com/q/5805960
tagged with: java
has comment: http://stackoverflow.com/comment/41080982
has comment: http://stackoverflow.com/comment/70696628
tagged with: intellij-plugin
tagged with: intellij-idea
has body: How can I programmatically invoke intellij's java source code formatter on an arbitrary source file on disk? I don't mind writing a plugin to do this but if there is a way to invoke the formatter from command line that would be great! Thanks
has comment: http://stackoverflow.com/comment/41107705
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/36294730
has comment: http://stackoverflow.com/comment/70700149
has comment: http://stackoverflow.com/comment/41080954
has comment: http://stackoverflow.com/comment/41082212
accepted answer: http://stackoverflow.com/a/36294730
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
has title: Invoke intellij code formatter programmatically on java files

http://stackoverflow.com/comment/41203619
comment on: http://stackoverflow.com/q/26263610
type: QuestionComment
type: Comment
has text: It's basically browser setting. What browser you are using?
score: 0

http://stackoverflow.com/q/26220182
has answer: http://stackoverflow.com/a/26220477
accepted answer: http://stackoverflow.com/a/26220477
has title: What version of SpringRouteBuilder has log and onException members?
type: Question
answer count: 1
score: 0
has body: I've gotten a Maven project from someone and tried to build it. At first it did not have a definition for SpringRouteBuilder, so I went to findJar and got apache-camel-1.3.0.jar. The system started seeing the class, but is still complaining about log member and onException method. Which JAR should I use?
tagged with: maven
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41133628
has text: I am working on a homework were the skeleton of the code extends Canvas. The reason i want it outside the paint method is because i would like to let's say draw a circle when a specific method is called or a rectangle when a different method is called instead. I don't want to have some crazy flagging and the repaint and have the paint method choose what to draw from the flag.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26226164
type: Comment

http://stackoverflow.com/a/45543179
answers question: http://stackoverflow.com/q/26202566
has body: I also meet the same question as you, and I solved it through moving the annotation to the front of corresponding get method.
type: Answer
score: 0

http://stackoverflow.com/comment/41257517
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26293781
has text: If you need it (and from the code it look like it), yes you'll have to pass the session as a parameter, or keep it somewhere the methods can look it up.
type: AnswerComment

http://stackoverflow.com/comment/41301703
comment on: http://stackoverflow.com/a/26307981
has text: Thanks for the info. I am basically using UCanAccess as a driver so I can connect to user's DB's, grab some data from their DB (like 2 fields but could be selecting multiple fields). Some DBs MIGHT be big, some not, it's the user that is using them, but we aren't using the full db, just grabbing some data and that is all. After the application is shut down, it is still running (but this might be due to the fact JavaFX for some reason still runs even after being shut down[old error] so I need to see about overriding @STOP. Do you have a recommended heap size that would be safe for these use
score: 0
type: AnswerComment
type: Comment

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

http://stackoverflow.com/comment/41308500
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26321711
has text: if the user enter a character the error pops up... i want it to handle the error
score: 0

http://stackoverflow.com/q/26254056
score: 0
answer count: 1
tagged with: outputstream
has comment: http://stackoverflow.com/comment/41184834
has title: output stream is saving only half of 16 bits
has answer: http://stackoverflow.com/a/26254218
accepted answer: http://stackoverflow.com/a/26254218
tagged with: save
has body: This is what I've got: Main: buff.clearColor((short)0x00ffff00); - - - - - - Buffer: DataOutputStream dataOutputStream = new DataOutputStream(out); for (int i : colorBuffer) { dataOutputStream.writeShort(i); } void clearColor(short c) { for(int i=0; i&lt;width*height; i++) { colorBuffer [i] = c; } } And in file is saved only half of 0x00ffff00, this one: ff00 ... ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00 ff00 ...
has comment: http://stackoverflow.com/comment/41185012
type: AnsweredQuestion
tagged with: 16-bit
tagged with: java
type: Question

http://stackoverflow.com/comment/41193075
score: 0
type: AnswerComment
type: Comment
has text: I'm still not sure how I can change the db name created though - the default appears to be "test" - maybe this is a default in mongodb?
comment on: http://stackoverflow.com/a/26258418

http://stackoverflow.com/comment/41332202
has text: I just doubled checked and I do have both the support library and repository installed
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26333441

http://stackoverflow.com/comment/41179796
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26250660
has text: Because the EditText is saved right back into Pref once I hit the back button negating the onClick method

http://stackoverflow.com/comment/41175659
type: AnswerComment
comment on: http://stackoverflow.com/a/26248871
score: 0
type: Comment
has text: I'm new to java programming language, didn't know how to do that, thank you big time!

http://stackoverflow.com/comment/41338063
type: AnswerComment
type: Comment
has text: Thank you for your insights. What I did was to create a wrapper class that extends `EditorPanePrinter` so I can obtain the `pageIndex` and update the dialog to show the page currently printed.
comment on: http://stackoverflow.com/a/26333828
score: 0

http://stackoverflow.com/a/26246097
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26226713
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26226713
type: Answer
has body: This error came about because the certificate I had installed on my server was a primary cert with no chain. I concatenated the secondary cert with the primary into a single file, installed on the server, and Android accepted the SSL connection. A lot of resources I saw talked about writing a custom trust manager etc. I would try to test your cert chain first and correct it before doing a bunch of that other stuff.

http://stackoverflow.com/a/26275348
score: 0
has body: I'd call file.createNewFile() after mkdirs()
type: Answer
answers question: http://stackoverflow.com/q/26275256

http://stackoverflow.com/comment/41307594
type: Comment
comment on: http://stackoverflow.com/a/26321162
has text: I changed my code and made the i into a j for my exams. It loops to the second person now, but once it I enter my exam scores for the second person it loops into a 3rd student. Even though I only input for 2 students. I hope this makes sense.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26315609
duplicate of: http://stackoverflow.com/q/5887709
favorite count: 0
has answer: http://stackoverflow.com/a/26315649
has body: This is the question that i got. Enter 2 integer (x and y) and print random integer between x and y. I want to know why my code does not print the random integer. I am still a beginner in java, any help would be nice. Thank you. import java.util.*; class Random_integer { public static void main(String[] args) { Random randomNum = new Random(); Scanner input = new Scanner(System.in); int integer1, integer2; System.out.print("Enter two integer : \n "); System.out.print("\n Integer 1 : "); integer1 = input.nextInt(); System.out.print("\n Integer 2 :"); integer2 = input.nextInt(); randomNum = new Random(integer1, integer2); System.out.print("\n Random number : " +randomNum); } }
accepted answer: http://stackoverflow.com/a/26315786
answer count: 4
linked to: http://stackoverflow.com/q/5887709
has comment: http://stackoverflow.com/comment/41297157
type: AnsweredQuestion
score: 2
duplicate of: http://stackoverflow.com/q/363681
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/26315643
has answer: http://stackoverflow.com/a/26315786
linked to: http://stackoverflow.com/q/363681
has title: Random integer in Java
type: Question
possible better answer: http://stackoverflow.com/a/26315649
has answer: http://stackoverflow.com/a/26315650
upvote count: 4

http://stackoverflow.com/a/26291218
type: Answer
has body: The way to "populate var with the output from myProg" is this (in the DOS script): for /F "delims=" %%a in ('java myProg') do set "var=%%a" Note that the Java program must "output" the value you want to assign to var, that is, it must show that value in the screen (via Stdout).
answers question: http://stackoverflow.com/q/26290805
score: 0

http://stackoverflow.com/comment/41272188
type: Comment
has text: For my understanding are you saying using a concrete `ImageReader` is not safe, but using `ImageIO.read()` is safe?
comment on: http://stackoverflow.com/a/26300361
type: AnswerComment
score: 0

http://stackoverflow.com/a/26322729
score: 4
answers question: http://stackoverflow.com/q/26322696
type: Answer
has body: Because Thread.currentThread().getName() gets you the name of the currently-running thread, but getName() resolves to st.getName(), and st is always your first thread instance. Why does getName() resolve to st.getName()? Because: During construction of your second through fourth threads, you pass the first thread in as an argument and save it in the instance member st. The run method of your threads calls st.show(), so they're always calling show on the first thread. (If you ever started the first thread, you'd get an NPE there, since the first thread's st member is never given a non-null value.) Within show, this is therefore st (the first thread). Unqualified instance method calls use this as their instance, and this is the first thread.
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26322696
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26244911
tagged with: search
type: Question
downvote count: 0
answer count: 1
has body: So i'm currently trying to search for strings that have the comma , in it, while allowing spaces in between. For example, a ,,,, , ,, , , ,, b c d will have the entirety between a and b be highlighted, but not between b and c, or c and d. currently, I have regex like this: ([]\\,+[\s]?)+ that highlights all spaces and commas, but it will even highlight the spaces between b and c, and c and d. How do i make it so that it only highlights where there are commas? also, this specific regex does not work in Java. Where do I have to escape character to make it functional in Java as well?
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26245024
accepted answer: http://stackoverflow.com/a/26245024
tagged with: regex
has title: Regex in java that parses strings that only contain a specific character while allowing spaces
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/41077951
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26196444
has text: And what is the error? Please post the full compiler error.
score: 0

http://stackoverflow.com/comment/41264122
comment on: http://stackoverflow.com/q/26297312
has text: http://stackoverflow.com/questions/14194119/how-get-user-profile-information-facebook-android visit this, it may useful to you and let we see
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26199476
has comment: http://stackoverflow.com/comment/41083335
has comment: http://stackoverflow.com/comment/41083370
has body: It expects you to initialize it. You can initialize it to null if you don't have any initial values for it. Like; Move oppMove = null;
score: 0
answers question: http://stackoverflow.com/q/26199458
type: Answer

http://stackoverflow.com/comment/41185697
type: Comment
has text: @StéphaneGROSSMANN see [this answer](http://stackoverflow.com/a/22960073) for the hint.. If it doesn't help yes you can open new question.
comment on: http://stackoverflow.com/a/26230057
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41269085
comment on: http://stackoverflow.com/q/26276040
score: 0
type: Comment
type: QuestionComment
has text: @tmarwen yes it is portlet

http://stackoverflow.com/comment/41330914
has text: @Krishna How does that going to help out?I'll read the stream only when I get status as `HTTP_OK`.
score: 0
comment on: http://stackoverflow.com/q/26332041
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26224822
tagged with: calendar
type: Question
has title: javaFX show calendar value in tableview
tagged with: java
tagged with: gregorian-calendar
score: 0
tagged with: tableview
answer count: 1
has answer: http://stackoverflow.com/a/26227005
has body: I have the following problem. I'm making a assignment for school, we need to show a gregoriancalendar value in a tableview. this is my code for the table TableColumn geboortedatum = new TableColumn("Geboortedatum"); geboortedatum.setCellValueFactory(new PropertyValueFactory&lt;Persoon, SimpleDateFormat&gt;("gebDat")); When I actually run this I get the following value in my tableview no matter what. java.util.GregorianCalendar[time=-23574157200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startyear=0,startMode=2,startMonth=2,startDay=-1,startTime=360000 and it goes on like that. anyone who has a simple solution for me? I'm probably missing something really easy here.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26227005
tagged with: javafx

http://stackoverflow.com/a/26242736
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26242674
answers question: http://stackoverflow.com/q/26242674
has body: By specification the + operator returns an int and that's why you need to do a cast. (1) says that b1 + b2 cannot be assigned to byte, because the range of the int is wider than the range of the byte.
type: Answer
upvote count: 2

http://stackoverflow.com/q/26272102
score: 2
answer count: 0
tagged with: activemq-classic
tagged with: java
has title: ActiveMQ shuts down on startup with "TERM Trapped"
type: Question
tagged with: java-service-wrapper
has comment: http://stackoverflow.com/comment/81831734
downvote count: 0
has comment: http://stackoverflow.com/comment/81841588
favorite count: 0
tagged with: jenkins
upvote count: 2
type: UnansweredQuestion
has body: I'm currently using the java service wrapper to start my ActiveMQ (5.10) service running on Ubuntu 14.04.1 LTS. Every now and then when my Jenkins instance runs the last step in my deploy script cd /app/apache-activemq-5.10.0/bin/linux-x86-64; ./activemq restart the wrapper will try to start up, then immediately shutdown with the following log entries. STATUS | wrapper | 2014/10/09 08:15:09 | --&gt; Wrapper Started as Daemon STATUS | wrapper | 2014/10/09 08:15:09 | Launching a JVM... STATUS | wrapper | 2014/10/09 08:15:09 | TERM trapped. Shutting down. WARN | wrapper | 2014/10/09 08:15:09 | JVM exited unexpectedly while stopping the application. STATUS | wrapper | 2014/10/09 08:15:09 | &lt;-- Wrapper Stopped I haven't got a clue why this is happening. Ideas anyone?

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/26274602
type: Tag

http://stackoverflow.com/a/26232982
score: 1
answers question: http://stackoverflow.com/q/26232863
has comment: http://stackoverflow.com/comment/41147115
accepted answer of: http://stackoverflow.com/q/26232863
has comment: http://stackoverflow.com/comment/41145595
has comment: http://stackoverflow.com/comment/41147975
has body: You can use the following solution with regex (not the prettiest though). String input = "0nd0-cathay bank (federal saving)"; // case-sensitive Pattern: // | group 1: first letter // | | group 2: any other character if applicable // | | | word boundary Pattern p = Pattern.compile("([a-z])(.*?)\\b"); // Pattern for all capital letters // Pattern p = Pattern.compile("([A-Z])(.*?)\\b"); // initializing StringBuffer for appending StringBuffer sb = new StringBuffer(); Matcher m = p.matcher(input); // iterating over matches while (m.find()) { // appending replacement: // | 1st letter capitalized // | | concatenated with... // | | | any other character // | | | within word boundaries m.appendReplacement(sb, m.group(1).toUpperCase().concat(m.group(2))); // Replacement for all capital letters // m.appendReplacement(sb, m.group(1).concat(m.group(2).toLowerCase())); } // appending tail if any m.appendTail(sb); System.out.println(sb.toString()); Output 0Nd0-Cathay Bank (Federal Saving) Notes This will capitalize the first alphabetic character in all words, even if words do not start with an alphabetic character. For instance, 0nd0 becomes 0Nd0. If you don't want this edge case after all, prepend a word boundary (\\b) to the Pattern.
has comment: http://stackoverflow.com/comment/41147238
upvote count: 1
has comment: http://stackoverflow.com/comment/41147514
has comment: http://stackoverflow.com/comment/41146056
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41146231
type: Answer
has comment: http://stackoverflow.com/comment/41146692
has comment: http://stackoverflow.com/comment/41146106
has comment: http://stackoverflow.com/comment/41145691
has comment: http://stackoverflow.com/comment/41146662
has comment: http://stackoverflow.com/comment/41145635

http://stackoverflow.com/q/26241106
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/26241184
accepted answer: http://stackoverflow.com/a/26241184
has comment: http://stackoverflow.com/comment/41160868
type: AnsweredQuestion
has title: Java can't override method used in constructor: The method setupAnimationFrames() of type Slime must override or implement a supertype method
tagged with: oop
score: 1
tagged with: java
tagged with: overriding
has body: I'm having problems overriding a method inherited from a parent class in Java. An extract from my parent class: public Character(String spriteLabel, float frameTime, float speed, float x, float y) { // Setup font and nameplate this.setupAnimationFrames(); .... this.currentFrame = downFrames[0]; } private void setupAnimationFrames() { ... } In my child class, I'm trying: public class Slime extends Character { @Override private void setupAnimationFrames() { ... } public Slime() { super("...", 0.15f, 2,727,300); } } However, Eclipse is telling me: The method setupAnimationFrames() of type Slime must override or implement a supertype method I've checked and the project/workspace properties are set to use Java 1.6, which appears to be a common cause of this error. Why won't Java let me override the method?
type: Question
upvote count: 1
answer count: 1
tagged with: inheritance

http://stackoverflow.com/a/53115498
has comment: http://stackoverflow.com/comment/122234282
type: Answer
score: 3
downvote count: 2
answers question: http://stackoverflow.com/q/26256720
has body: I am using Java Spring &amp; in that, I am implementing like : Class Level: import com.fasterxml.jackson.annotation.JsonInclude; @JsonInclude(JsonInclude.Include.NON_NULL) public class Student { String name; //getter-setter } You can also implement it on elements level of class : Elements Level: import com.fasterxml.jackson.annotation.JsonInclude; @JsonInclude(JsonInclude.Include.NON_NULL) public class Student { String name; @JsonInclude(JsonInclude.Include.NON_NULL) String address; //getter-setter }
upvote count: 5

http://stackoverflow.com/comment/41094258
score: 0
has text: My guess is that it is yet to early for you to write java code. Keep learning and stay closer to given example codes. Then try to work with working examples. Walk slowly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26205579

http://stackoverflow.com/comment/41195438
comment on: http://stackoverflow.com/q/26260086
has text: I'm doing this as an exercise.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26215097
has comment: http://stackoverflow.com/comment/41112013
answer count: 1
has answer: http://stackoverflow.com/a/26223746
tagged with: java
has title: How do I write an integer value to a csv file using opencsv
type: AnsweredQuestion
score: 2
has body: This is my code for writing a csv file CSVWriter writer = new CSVWriter(new FileWriter("test.csv",false)); String [] details = new String[]{"00000002","0","0","0","0","type_detils","01","1","-1","0.0","0.0","CST"}; writer.writeNext(details); I want to write this value format in csv: 00000002,0,0,0,0,"type_detils",01,1,-1,0.0,0.0,"CST" But when I look in the file it's like this: "00000002","0","0","0","0","type_detils","01","1","-1","0.0","0.0","CST" How can I change the string value to an integer during the file write using opencsv?
downvote count: 0
accepted answer: http://stackoverflow.com/a/26223746
favorite count: 0
has comment: http://stackoverflow.com/comment/41112294
type: Question
tagged with: opencsv
upvote count: 2

http://stackoverflow.com/comment/41328550
has text: Huh, it works for me when I export it to a jar, just not in my IDE (Intellij Idea). I guess it's not a Java problem after all.
comment on: http://stackoverflow.com/q/26332251
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26265950
has comment: http://stackoverflow.com/comment/41244309
has comment: http://stackoverflow.com/comment/41220778
score: 0
has title: SINGLE_TABLE inheritance strategy discriminating based on parent table
has comment: http://stackoverflow.com/comment/41220510
tagged with: jpa
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: hibernate
tagged with: orm
type: Question
has body: I am using a SINGLE_TABLE inheritance strategy for a Child Class. I have a Parent class which as a @OneToMany relationship to the Child class. With any SINGLE_TABLE inheritance, there needs to be a way to tell Hibernate the difference between the 2 Child subclasses. Examples I've seen so far are based upon columns from the Child table. But for me, I want to differentiate between the 2 Children based on a value from the Parent table. Namely, a column in the Parent table must be equal to a column in the Child table for one type of Child, and the rest not equal. Is this possible?

http://stackoverflow.com/q/26283138
upvote count: 9
has title: VisualVM: Ideal Heap Memory Usage Graph
has answer: http://stackoverflow.com/a/26283367
tagged with: visualvm
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/41238400
has body: I am monitoring my Java application (written in JDK 1.7) using VisualVM. Following is the graph that shows heap memory usage for the duration that this application ran. Looking at this graph ones see that there are a lot of spikes in it. These spikes indicate creation of objects by the application. Once the application is done with them it destroys them using gc (implicitly called in this case). Also , here is a screenshot of memory profiler when the application is still running To me the up and down nature of the graph indicates efficient usage of java objects. Is this inference right ? What is the ideal nature of the heap usage graph that one should aim for ? Are there any other ways that I can improve on the heap memory usage by my application ?
has comment: http://stackoverflow.com/comment/41238533
has answer: http://stackoverflow.com/a/26283594
accepted answer: http://stackoverflow.com/a/26283594
has comment: http://stackoverflow.com/comment/41238637
type: AnsweredQuestion
tagged with: java
score: 9
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/41242663
possible better answer: http://stackoverflow.com/a/26283367
has comment: http://stackoverflow.com/comment/41238011
answer count: 2
has comment: http://stackoverflow.com/comment/41239428
linked to: http://stackoverflow.com/q/1393486
downvote count: 0
has comment: http://stackoverflow.com/comment/41238264
favorite count: 0

http://stackoverflow.com/q/26341713
tagged with: java
has body: when I run sample IBM Bluemix Liberty for Java application https://github.com/ibmjstart/bluemix-java-postgresql-uploader.git following error: -----&gt; Downloaded app package (1.9M) -----&gt; Downloaded app buildpack cache (4.0K) OK /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:101:in build_pack': Unable to detect a supported application type (RuntimeError) from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:74:inblock in compile_with_timeout' from /usr/lib/ruby/1.9.1/timeout.rb:68:in timeout' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:73:incompile_with_timeout' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:54:in block in stage_application' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:inchdir' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:in stage_application' from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in' FAILED Server error, status code: 400, error code: 170001, message: Staging error: cannot get instances since staging failed TIP: use 'cf logs jpu-henryhan --recent' for more information
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26341714
has title: Error when push Liberty for Java application in IBM Bluemix
tagged with: ibm-cloud
tagged with: cloud
answer count: 3
has answer: http://stackoverflow.com/a/29613985
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/29627886
type: UnansweredQuestion
tagged with: websphere-liberty
score: 1

http://stackoverflow.com/comment/41234775
type: QuestionComment
has text: Question already asked here: http://forum.jogamp.org/keyReleased-keyPressed-problem-td4033288.html Please provide a unit test and fill a bug report.
comment on: http://stackoverflow.com/q/26274602
score: 0
type: Comment

access-control
tag name: access-control
type: Tag
tags question: http://stackoverflow.com/q/26329793

http://stackoverflow.com/q/26327165
has answer: http://stackoverflow.com/a/26516294
type: Question
has body: Consider this entity @Entity public class User { @Id private String id; private String firstName; private String lastName; private String nickName; @ElementCollection private final List<String> emails = new ArrayList<>(); @OneToMany private final List<Address> addresses = new ArrayList<>(); @OneToMany private final List<Phone> phones = new ArrayList<>(); public User(@Nonnull final String firstName, @Nonnull final String lastName) { id = UUID.randomUUID().toString(); this.firstName = firstName; this.lastName = lastName; } public User() { // required by JPA } public String getId() { return id; } @Nonnull public String getFirstName() { return firstName; } @Nonnull public String getLastName() { return lastName; } @Nonnull public String getNickName() { return nickName; } public void setNickName(@Nonnull final String nickName) { this.nickName = nickName; } @Nonnull public List<String> getEmails() { return Collections.unmodifiableList(emails); } @Nonnull public List<Address> getAddresses() { return Collections.unmodifiableList(addresses); } @Nonnull public List<Phone> getPhones() { return Collections.unmodifiableList(phones); } public void addAddress(@Nonnull final Address address) { addresses.add(address); } public void addPhone(@Nonnull final Phone phone) { phones.add(phone); } public void addEmail(@Nonnull final String email) { emails.add(email); } // likewise remove address, phones, emails could be added } I am now creating a liquibase changeset for this table and don't know how to model @ElementCollection private final List<String> emails = new ArrayList<>(); @OneToMany private final List<Address> addresses = new ArrayList<>(); @OneToMany private final List<Phone> phones = new ArrayList<>(); Can someone please help? My current (incomplete) changeset looks like Add User Table <createTable tableName="user"> <constraints nullable="false" unique="true"/> <constraints nullable="false"/> <constraints nullable="false"/>
answer count: 1
tagged with: jpa
favorite count: 0
upvote count: 1
downvote count: 0
type: UnansweredQuestion
tagged with: liquibase
score: 1
tagged with: java
has title: Liquibase: How to model collection and relations when creating table?

http://stackoverflow.com/comment/41356662
has text: See my edit on the original question for the full solution that worked for me, thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26346558
type: Comment

http://stackoverflow.com/q/26288080
accepted answer: http://stackoverflow.com/a/26288197
type: AnsweredQuestion
tagged with: call
tagged with: java
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/26288546
has comment: http://stackoverflow.com/comment/41247787
has answer: http://stackoverflow.com/a/26288152
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/26288152
has body: I want to invoke this method to get the median from an array. The method is declared as public double getMedian(double[]list){//code}. I tried calling the method as getMedian(double,list) but I got an error. What would be the right way to call the method? Here is the complete method: public double getMedian(double[] list) { // calculate the length of the entries // create an iterator int factor = list.length - 1; double[] first = new double[(int) ((double) factor / 2)]; double[] last = new double[first.length]; double[] middleNumbers = new double[1]; for (int i = 0; i &lt; first.length; i++) { first[i] = list[i]; } for (int i = list.length; i &gt; last.length; i--) { last[i] = list[i]; } for (int i = 0; i &lt;= list.length; i++) { if (list[i] != first[i] || list[i] != last[i]) middleNumbers[i] = list[i]; } if (list.length % 2 == 0) { double total = middleNumbers[0] + middleNumbers[1]; return total / 2; } else { System.out.println(middleNumbers); return middleNumbers[0]; } }
has answer: http://stackoverflow.com/a/26288197
has title: How do you invoke a method with the signature "public double getMedian(double[]list) {//code}"

http://stackoverflow.com/q/26297193
answer count: 2
has title: How to connect to mysql with eclipse in android
tagged with: android
has answer: http://stackoverflow.com/a/26297281
has body: I am trying to connect to mysql database in android eclipse and am using also mysql-connector-java-3.1.12-bin . But it shows me the message: failure due to underlying exception. And it doesn't connect yet I am using the same thing to connect in netbeans to my Java programs . Any help will be appreciated. package com.bookapp; import java.sql.SQLException; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import android.app.Activity; import android.content.Intent; public class PersonalInfo extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.personalinfo); try { StudentDA stud= new StudentDA(); for (String jshdjsd: stud.GetAllUniversities()) { Toast tt=Toast.makeText(PersonalInfo.this, jshdjsd,Toast.LENGTH_LONG); tt.show(); } //for eastud.GetAllUniversities())); } catch(SQLException ss) { Toast tt=Toast.makeText(PersonalInfo.this, "You have an Error "+ss.getMessage(),Toast.LENGTH_LONG); tt.show(); } //create reference to layout widget/control Button btnNext=(Button) findViewById(R.id.btnNext); //create reference to textbox final EditText txtStudNo,txtName,txtSurname; // text box final Spinner cmbGender=(Spinner) findViewById(R.id.cmbGender); // combo box txtStudNo=(EditText) findViewById(R.id.txtStudentNo); txtName=(EditText) findViewById(R.id.txtName); txtSurname=(EditText) findViewById(R.id.txtSurname); //set the button onclick event listener btnNext.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub if (txtStudNo.getText().toString().equals("")) { Toast tt=Toast.makeText(PersonalInfo.this, "Please Enter Student No", Toast.LENGTH_LONG); tt.show(); } else if (txtName.getText().toString().equals("")) { Toast tt=Toast.makeText(PersonalInfo.this, "Please Enter …
type: UnansweredQuestion
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/41263517
has answer: http://stackoverflow.com/a/26297847
score: 0

http://stackoverflow.com/q/26273545
has body: that's my selector for list:(item_selector.xml) <item android:state_selected="true" android:drawable="@color/orange" /> <item android:state_focused="true" android:drawable="@color/orange" /> <item android:state_pressed="true" android:drawable="@color/orange" /> <item android:drawable="@color/transparent" /> that's my row of list(row_item.xml) <ImageView android:id="@+id/item_icon" android:layout_width="30dp" android:layout_height="30dp" android:layout_centerHorizontal="true" android:paddingTop="5dp" android:paddingBottom="2dp" android:src="@drawable/ic_launcher"/> <TextView android:id="@+id/item_title" style="@style/DrawerItemTextStyle" android:textColor="@color/text_drawer_item_selector" android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/item_icon" /> I want to change android:state_pressed="true" android:drawable="@color/orange" to other color dynamically. My goal, to make pressed color for each row different. Is it possible to do?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41220499
has answer: http://stackoverflow.com/a/26273794
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26273654
downvote count: 0
has title: How to change pressed color to other color of selector dynamically?
score: 4
tagged with: selector
linked to: http://stackoverflow.com/q/11242735
has comment: http://stackoverflow.com/comment/41220544
accepted answer: http://stackoverflow.com/a/26273794
has answer: http://stackoverflow.com/a/26276673
favorite count: 0
has answer: http://stackoverflow.com/a/70025792
tagged with: android
possible better answer: http://stackoverflow.com/a/26276673
answer count: 4

http://stackoverflow.com/q/26343537
tagged with: mockito
has body: I want millis to return specified value. public long myMethod(){ DateTime nowDateTime = new DateTime(DateTimeZone.UTC); long millis = nowDateTime.getMillis(); System.out.println(millis); } I tried this with no luck. @RunWith(PowerMockRunner.class) @PrepareForTest({ DateTime.class }) @PowerMockIgnore({ "javax.crypto.*", "javax.management*" }) ... ... public void testMyMethod(){ DateTime nowDateTime = PowerMockito.mock(DateTime.class); Mockito.when(nowDateTime.getMillis()).thenReturn(10L); } How can I fix this?
has answer: http://stackoverflow.com/a/26344048
score: 16
has comment: http://stackoverflow.com/comment/41348837
accepted answer: http://stackoverflow.com/a/26344048
answer count: 1
downvote count: 0
favorite count: 0
tagged with: powermock
upvote count: 16
type: AnsweredQuestion
tagged with: java
has title: Mocking Joda DateTime method using Mockito
type: Question

gregorian-calendar
tags question: http://stackoverflow.com/q/26246030
type: Tag
tags question: http://stackoverflow.com/q/26342841
tags question: http://stackoverflow.com/q/26224822
tag name: gregorian-calendar

http://stackoverflow.com/a/26314573
type: AcceptedAnswer
downvote count: 0
upvote count: 39
type: Answer
score: 39
answers question: http://stackoverflow.com/q/26314386
has body: The request was failing because I wasn't setting the region for the client before making the request. The default region is probably US East and my table is setup in EU West. This fixed it: import com.amazonaws.regions.Region; import com.amazonaws.regions.Regions; client.setRegion(Region.getRegion(Regions.EU_WEST_1));
accepted answer of: http://stackoverflow.com/q/26314386

http://stackoverflow.com/a/26306913
type: Answer
has comment: http://stackoverflow.com/comment/41282004
upvote count: 1
has comment: http://stackoverflow.com/comment/41281775
answers question: http://stackoverflow.com/q/26306828
accepted answer of: http://stackoverflow.com/q/26306828
has body: I suspect the problem is the &amp;#xA;&amp;#xA; in your XML. That's U+000A, or "line feed" (twice). You can validate that this is the problem by taking the XML out of it entirely. See what this does: System.out.println("Line 1\nLine2\nLine 3"); Depending on your console, that may appear on multiple lines. That's what I'd expect to happen to your string from the XML as well. My guess is either you only looked at the line starting with the start of your attribute text, or your console doesn't support multiline output. Either way, the quick test above should give you an idea of what to expect.
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/41299626
has text: Of course you could check for the presence of these characters. The point being that this is an alternative to looping through the `String`. Which one is prefer would depend on the situation it is to be used. In the case of a simple `Hello World` case at this, it doesn't really matter. But then again, looping the a `char` array is not ideal with languages where a single character might be encoded in multiple `char`s.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26316727
type: AnswerComment

http://stackoverflow.com/a/26349365
type: AcceptedAnswer
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26348917
type: Answer
has body: This is because you have the tags inside the column output. You need to put outside the for loop containing the columns: while (rs.next()) { pw.println("&lt;tr&gt;"); for (int i=1; i&lt;n; i++) { pw.println("&lt;td&gt; ... pw.println("&lt;/tr&gt;"); }
score: 2
answers question: http://stackoverflow.com/q/26348917

http://stackoverflow.com/comment/41123811
comment on: http://stackoverflow.com/q/26221027
score: 0
type: Comment
type: QuestionComment
has text: Also try looking into IDE logs!

http://stackoverflow.com/comment/41331722
comment on: http://stackoverflow.com/q/26333819
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it)

http://stackoverflow.com/q/26253683
type: Question
has comment: http://stackoverflow.com/comment/41186054
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41193122
has comment: http://stackoverflow.com/comment/41184338
has title: Java 8 Stream termination
has comment: http://stackoverflow.com/comment/41189183
linked to: http://stackoverflow.com/q/20746429
answer count: 0
upvote count: 2
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/20746429
tagged with: java-8
score: 2
has body: Is there a way I can terminate a Stream (apart from .limit(long)). What I'm really looking for is a kind of .until(Predicate&lt;T&gt;). Method filter is obviously not usable here. Example: Stream.iterate(service.first(), service::next) .until(item -&gt; item.isTerminator()) This example might not make sense, but shows the concept I'm looking for. Is it even possible to do something like that?
tagged with: java
has comment: http://stackoverflow.com/comment/41187843

http://stackoverflow.com/comment/41196035
score: 0
type: AnswerComment
type: Comment
has text: Swing components have a repaint() and revalidate() methods. You can make a call to revalidate and then to repaint to refresh that component.
comment on: http://stackoverflow.com/a/26260372

http://stackoverflow.com/q/26325739
has body: I have created a simple Spring web service using Gradle. This is my Application.java code. @EnableAutoConfiguration @EnableWebMvc @Configuration @ComponentScan public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } This is my TestController.java code: @Controller public class TestController { @RequestMapping(value="/test", method=RequestMethod.GET) public @ResponseBody String test() { return "hello"; } } When I launch the application and try to access it through a browser, it asks me for an username and a password. The problem is that I have not implemented any authentication mechanism and I have no idea how to access the application. How can I turn off the authentication?
tagged with: java
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/41315876
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/41315842
has comment: http://stackoverflow.com/comment/41315906
has title: How can I turn off Spring Security?
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/69322039
tagged with: spring
score: 2

http://stackoverflow.com/comment/41126797
score: 0
has text: avoid `AbsoluteLayout`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26221812

http://stackoverflow.com/comment/41252937
score: 0
type: Comment
has text: upvoting this one over the other one because of the explanation provided
type: AnswerComment
comment on: http://stackoverflow.com/a/26291092

http://stackoverflow.com/a/26337161
has comment: http://stackoverflow.com/comment/41417830
score: 0
has comment: http://stackoverflow.com/comment/41337644
type: Answer
has comment: http://stackoverflow.com/comment/41337737
answers question: http://stackoverflow.com/q/26337068
has body: You also need to create User object and set the user object in a Record object using the below code record.setUser(userObj); and user foreign key will be automatically saved in database.
has comment: http://stackoverflow.com/comment/41340872

http://stackoverflow.com/q/26279019
has title: How to send packet in both FileRegion and ChannelBuffer type together
type: UnansweredQuestion
score: 0
tagged with: netty
tagged with: java
has answer: http://stackoverflow.com/a/26291097
type: Question
has body: public class Response{ public int packetLength; public int cmd; public int seqId; public FileRegion fileRegion; //file content public String filename; public int begin; public int end; public String otherExtra; public void messageReceived(ChannelHandlerContext ctx, MessageEvent e){ if(e.getMessage() instanceof Request){ Request request = Request(e.getMessage()); Channel ch = e.getChannel(); Response response = new Response(); response.cmd = 111; response.seqId = 111; response.begin = 0; response.end = 256; response.fileRegion = new DefaultFileRegion(GetFile().getChannel(),response.begin, response.end); response.filename = "test"; response.otherExtra = "service" ch.write(response); } } } I need to use zero-copy (os level) to send data in a field of a network packet. netty support FileRegion and ChannelBuffer in these two types of data transmission. But now I want these two kinds of types of data together to form a packet. How to solve Or how to write the above code encoder function?
tagged with: zero-copy
answer count: 1

http://stackoverflow.com/comment/41245118
comment on: http://stackoverflow.com/a/26286784
score: 0
type: AnswerComment
has text: Thanks, that was it! Definitely flew right past me.
type: Comment

synchronized
tags question: http://stackoverflow.com/q/26243671
type: Tag
tag name: synchronized
tags question: http://stackoverflow.com/q/26311103
tags question: http://stackoverflow.com/q/26201449
tags question: http://stackoverflow.com/q/26322696
tags question: http://stackoverflow.com/q/26310150

http://stackoverflow.com/q/26231046
tagged with: java
has comment: http://stackoverflow.com/comment/41142638
type: Question
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/25552
favorite count: 0
tagged with: heap-memory
score: -2
has comment: http://stackoverflow.com/comment/41142551
tagged with: jvm
has body: I need to measure memory usage some sort of method. I can get Heap and nonHeap Memory size using mxBean.getHeapMemoryUsage and mxBean.getNonHeapMemoryUsage. My question is how do we caclulate memory usage in specific method execution? (Only consider HeapMemory or both)
type: UnansweredQuestion
downvote count: 2
has title: How is the Java measure memory usage given method?
has answer: http://stackoverflow.com/a/26231216
has comment: http://stackoverflow.com/comment/41144878

http://stackoverflow.com/comment/41088177
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26201221
score: 0
has text: well i am running the server from the command prompt and looked up for how to debug but couldn't find anything i haven't wrote server side before so i don't really know how can i do it can you suggest a good method for debugging @KorayTugay

http://stackoverflow.com/comment/41107984
has text: You can set the parent class loader for your custom class loader to the System Class Loader. That will make it part of the class loader hierarchy. I have implemented a similar thing; but i am not sure you are explaining your problem precisely
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26206487

http://stackoverflow.com/q/26272767
has title: How to persist a custom map with Hibernate/JPA?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26272976
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/26273005
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/3174379
has comment: http://stackoverflow.com/comment/41224956
score: 2
type: AnsweredQuestion
has body: I am trying to persist a sub-classed HashMap in a database using Hibernate and JPA annotations. import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.MapKeyColumn; import javax.persistence.Table; @Entity @Table(name = "module") public class Module { @Id @GeneratedValue @Column(name = "id") private int id; @Column(name = "name") private String name; @Column(name = "description") private String description; @Column(name = "version") private String version; @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "module_parameter") @MapKeyColumn(name = "key") @Column(name = "value") private Parameters params = new Parameters(); // Getters &amp; setters } This gives me the following exception when trying to store parameters: org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: Module.params When I change the declaration to private Map&lt;String, String&gt; params = new Parameters(); public Parameters getParams() { return (Parameters) params; } I get the following output: Hibernate: select module0_.id as id1_0_, module0_.description as descript2_0_, module0_.name as name3_0_, module0_.version as version4_0_ from module module0_ Hibernate: select params0_.Module_id as Module_i1_0_0_, params0_.value as value2_1_0_, params0_.key as key3_0_ from module_parameter params0_ where params0_.Module_id=? Exception in thread "main" java.lang.ClassCastException: org.hibernate.collection.internal.PersistentMap cannot be cast to Parameters If I change it to private Map&lt;String, String&gt; params = new HashMap&lt;&gt;(); everything works fine. So how can I tell Hibernate about Parameters being a collection?
accepted answer: http://stackoverflow.com/a/26273005
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26272976

http://stackoverflow.com/q/26266382
accepted answer: http://stackoverflow.com/a/26266455
has body: Thanks for your time. I am following https://parse.com/tutorials/parse-query-adapter and extending it into tabbed views. The original code was: public class ListFragment extends Fragment { private ParseQueryAdapter&lt;ParseObject&gt; mainAdapter; private ListView listView; public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState ) { View rootView = inflater.inflate(R.layout.fragment_list, container, false ); mainAdapter = new ParseQueryAdapter&lt;ParseObject&gt;( this.getActivity(), "Todo" ); mainAdapter.setTextKey("title"); mainAdapter.setImageKey("image"); // Initialize ListView and set initial view to mainAdapter listView = (ListView) rootView.findViewById(R.id.list); Log.d("First","Output"); // This will show on logcat listView.setAdapter(mainAdapter); Log.d("Second","Output"); // This is not shown on logcat mainAdapter.loadObjects(); return rootView; } } It compiles but crashes on a null pointer seemingly either in listView or mainAdapter and I don't know what has changed to cause this?
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has title: ListView Null Pointer in Tabbed Design
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26266455
tagged with: android
tagged with: android-activity
tagged with: parse-platform

http://stackoverflow.com/q/26209418
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26209435
accepted answer: http://stackoverflow.com/a/26209435
type: Question
has body: How do I give data from one servlet to the next?
tagged with: servlets
score: 0
answer count: 1
has title: Java Servlet Appending to StringBuffer Unrecognized HTML code

variables
tag name: variables
tags question: http://stackoverflow.com/q/26332527
tags question: http://stackoverflow.com/q/26327320
tags question: http://stackoverflow.com/q/26228233
tags question: http://stackoverflow.com/q/26319574
type: Tag
tags question: http://stackoverflow.com/q/26289814
tags question: http://stackoverflow.com/q/26242674
tags question: http://stackoverflow.com/q/26247547
tags question: http://stackoverflow.com/q/26329654
tags question: http://stackoverflow.com/q/26225406
tags question: http://stackoverflow.com/q/26331221
tags question: http://stackoverflow.com/q/26200885
tags question: http://stackoverflow.com/q/26244616
tags question: http://stackoverflow.com/q/26222844
tags question: http://stackoverflow.com/q/26243294
tags question: http://stackoverflow.com/q/26306568
tags question: http://stackoverflow.com/q/26265001
tags question: http://stackoverflow.com/q/26248527
tags question: http://stackoverflow.com/q/26256496
tags question: http://stackoverflow.com/q/26313329
tags question: http://stackoverflow.com/q/26218301
tags question: http://stackoverflow.com/q/26346992
tags question: http://stackoverflow.com/q/26249181
tags question: http://stackoverflow.com/q/26324204

http://stackoverflow.com/comment/41173503
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/26247715
has text: Short answer: you can't. Long answer: Workarounds depend on what you want to do.
type: Comment

http://stackoverflow.com/comment/41217030
has text: what do you mean crashing? Its a program not a physical server. You probably are getting a NullPointerException at .intValue() call. We call it an exception not a crash.
comment on: http://stackoverflow.com/q/26271449
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41307417
type: Comment
has text: Thanks for your answer, the build pattern is a better way! You also think the interface should be generic, but how do you think [Spring-data-jpa](http://docs.spring.io/spring-data/jpa/docs/1.7.0.RELEASE/reference/html/#jpa.query-methods.query-creation)? Spring data jpa support the interface like "findByEmailAddressAndLastname", does the "EmailAddressAndLastname" generic? So I wander which is better.
comment on: http://stackoverflow.com/a/26313596
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41079768
type: Comment
type: QuestionComment
score: 0
has text: in your code change = new questionchanger(); System.out.println("2"); int x = change.getNumber1(); you are creating a **NEW** `questionchanger` object, and immediately calling `getNumber1()` on it, which returns the initial value of `question1select` which is 0. May be you intended to use the existing object ?
comment on: http://stackoverflow.com/q/26197338

http://stackoverflow.com/q/26195035
tagged with: hashmap
has comment: http://stackoverflow.com/comment/41092469
has answer: http://stackoverflow.com/a/26199279
has comment: http://stackoverflow.com/comment/41092413
score: 0
has body: I have been trying without any luck to make a list of all points in a model. When i execute this HashList&lt;Point&gt; points=new HashList&lt;Point&gt;(16); //add +y side points.add(new Point(-5.0,5.0,-5.0)); points.add(new Point(-5.0,5.0,5.0)); points.add(new Point(5.0,5.0,5.0)); points.add(new Point(-5.0,5.0,-5.0)); points.add(new Point(5.0,5.0,5.0)); points.add(new Point(5.0,5.0,-5.0)); //add -x side points.add(new Point(-5.0,5.0,-5.0)); points.add(new Point(-5.0,-5.0,-5.0)); points.add(new Point(-5.0,-5.0,5.0)); points.add(new Point(-5.0,5.0,-5.0)); points.add(new Point(-5.0,-5.0,5.0)); points.add(new Point(-5.0,5.0,5.0)); int length=points.length(); //equals 12, 6 expected Point a=new Point(-5.0,5.0,-5.0); Point b=new Point(-5.0,5.0,-5.0); int aHashCode=a.hashCode(); //-737148544 int bHashCode=b.hashCode(); //-737148544 boolean equals=a.equals(b); //true points containts 12 points which is the number I started with. I want all duplicates found which should result in only 6 points in table. if (map.containsKey(e)) { in HashList for some reason never gets executed. Any ideas? HashList: package dataTypes; import java.util.ArrayList; import java.util.HashMap; public class HashList&lt;E&gt; { private HashMap&lt;E,Integer&gt; map; private ArrayList&lt;E&gt; data; private int count=0; public HashList() { map=new HashMap&lt;E,Integer&gt;(); data=new ArrayList&lt;E&gt;(); } public HashList(int size) { map=new HashMap&lt;E,Integer&gt;(size); data=new ArrayList&lt;E&gt;(size); } public int add(E e) { //returns key if (map.containsKey(e)) { return map.get(e); } else { map.put(e, count); data.add(count,e); return count++; } } public int getKey(E e) { return map.get(e); } public E get(int key) { return data.get(key); } public int length() { return count; } } Point: package geometry3D; /** * 3D point location or vector * * @author Matthew Cornelisse * @version 2014-09-02-004500 */ public class Point { // instance variables - replace the example below with your own public doub…
answer count: 3
has comment: http://stackoverflow.com/comment/41082283
has comment: http://stackoverflow.com/comment/41075426
has comment: http://stackoverflow.com/comment/41075876
accepted answer: http://stackoverflow.com/a/26199279
has answer: http://stackoverflow.com/a/26195141
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41075461
has comment: http://stackoverflow.com/comment/41075795
has title: HashMap adding all items even when duplicate
has comment: http://stackoverflow.com/comment/41082945
tagged with: java
possible better answer: http://stackoverflow.com/a/26195141
has comment: http://stackoverflow.com/comment/41082229
has answer: http://stackoverflow.com/a/26195235
has comment: http://stackoverflow.com/comment/41075424
type: Question

http://stackoverflow.com/comment/111281013
type: QuestionComment
comment on: http://stackoverflow.com/q/26245139
score: 0
has text: Check this video tutorial: https://youtu.be/UZwiKdrm768 I felt it helpful. Hope that helps you too.
type: Comment

http://stackoverflow.com/comment/41177882
type: Comment
has text: [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) would be a start, it limits the re-usability of your components and you're not actually adding any functionality to the base class. Generally speaking, `CardLayout` is one of the best choice when dealing with multiple views. It's useful when you deal with navigable views (where the user can move between them) and non-navigable views, where you control the navigation
type: AnswerComment
comment on: http://stackoverflow.com/a/26249226
score: 0

http://stackoverflow.com/comment/41307880
score: 0
comment on: http://stackoverflow.com/q/26321269
type: QuestionComment
type: Comment
has text: What run-time error are you getting? Post it with a complete stack trace?

http://stackoverflow.com/comment/41087347
has text: what do yo mean by CUT? I am just trying to make sure I can add a book.
comment on: http://stackoverflow.com/q/26201709
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26222355
has comment: http://stackoverflow.com/comment/41126380
type: Question
upvote count: 4
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26223278
favorite count: 0
has answer: http://stackoverflow.com/a/26223278
tagged with: terminal
accepted answer: http://stackoverflow.com/a/26224404
tagged with: ssh
tagged with: macos
has body: I am using java 1.7.0_67 on mac osx 10.7.5. Here is my hello world gui: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class helloWorld extends JFrame { helloWorld(String title) { this.setSize(500,500); setTitle(title); } public static void main(String[] args) { helloWorld window = new helloWorld("Helloworld"); window.setVisible(true); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } This runs just fine when i open a mac terminal and type java helloWorld. However, when I ssh into my mac from another host, set my DISPLAY env variable, and run, I get the following exception: Exception in thread "main" java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. at java.awt.GraphicsEnvironment.checkedHeadless(GraphicsEnvironment.java:207) at java.awt.Window.&lt;init&gt;(Window.java:535) at java.awt.Frame.&lt;init&gt;(Frame.java:420) at java.awt.Frame.&lt;init&gt;(Frame.java:385) at javax.swing.JFrame.&lt;init&gt;(JFrame.java:180) at helloWorld.&lt;init&gt;(helloWorld.java:8) at helloWorld.main(helloWorld.java:14) This used to work on Java 1.6, from what I've been able to research this appears to be a purposeful break. Any ideas how I can get my gui to display after ssh-ing in from a remote host? I don't want to use X11 (would prefer native gui rendering).
has comment: http://stackoverflow.com/comment/41127784
has comment: http://stackoverflow.com/comment/41147485
has comment: http://stackoverflow.com/comment/41127824
linked to: http://stackoverflow.com/q/662421
has comment: http://stackoverflow.com/comment/41126484
has comment: http://stackoverflow.com/comment/41140688
score: 4
type: AnsweredQuestion
has title: How to run a java GUI on mac osx after ssh
tagged with: java
has answer: http://stackoverflow.com/a/26224404
has comment: http://stackoverflow.com/comment/41126485

http://stackoverflow.com/a/26250775
accepted answer of: http://stackoverflow.com/q/26247746
has comment: http://stackoverflow.com/comment/41199966
has body: This only answers part of your question, but here's why increasing your heap will lead to OutOfMemeoryError: As you can see from the stacktrace, JavaFX is using a DirectByteBuffer for its processing - so the data is not stored in the heap but in native memory. By increasing your (fixed) heap-size you reduce the amount of free memory your OS can offer as native memory. E.g. on windows using a 32-bit Java-VM the addressable memory-range is 4GB, 2GB are reserved for the OS leaving 2GB for the java-application. With -Xms1000m -Xmx1000m another GB is reserved for heap leaving 1GB for the VM-code, stack, Non-heap-memory (like PermGen etc.) and what's left of his final GB can be used as native memory.
upvote count: 5
has comment: http://stackoverflow.com/comment/41221186
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26247746
has comment: http://stackoverflow.com/comment/41221053

http://stackoverflow.com/comment/41190490
comment on: http://stackoverflow.com/a/26257532
type: Comment
has text: That is a proper lambda expression, so yes, the above applies. The process would be similar if you passed in `System.out::println`, except that no synthetic method would be needed; the delegate would simply call directly into `println`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41317615
score: 0
type: AnswerComment
has text: Can you edit your answer and put in the detail that `ConfigureMenu`'s `getSubMenuOptions(final ConfigureSubMenu subMenu)` method needs to have a return type of `List<? extends Enumerable>`? I don't want anyone to have to read these comments to find that detail.
comment on: http://stackoverflow.com/a/26315983
type: Comment

http://stackoverflow.com/comment/41085995
type: QuestionComment
has text: `-1` means the item isn't being found in the list. Double check the values of your variables.
comment on: http://stackoverflow.com/q/26200987
score: 0
type: Comment

http://stackoverflow.com/a/41691949
downvote count: 1
has body: You can use the library: https://github.com/vivchar/RendererRecyclerViewAdapter mRecyclerViewAdapter = new RendererRecyclerViewAdapter(); /* Included from library */ mRecyclerViewAdapter.registerRenderer(new SomeViewRenderer(SomeModel.TYPE, this)); mRecyclerViewAdapter.registerRenderer(...); /* You can use several types of cells */ For each item, you should to implement a ViewRenderer, ViewHolder, SomeModel: ViewHolder - it is a simple view holder of recycler view. SomeModel - it is your model with ItemModel interface public class SomeViewRenderer extends ViewRenderer&lt;SomeModel, SomeViewHolder&gt; { public SomeViewRenderer(final int type, final Context context) { super(type, context); } @Override public void bindView(@NonNull final SomeModel model, @NonNull final SomeViewHolder holder) { holder.mTitle.setText(model.getTitle()); } @NonNull @Override public SomeViewHolder createViewHolder(@Nullable final ViewGroup parent) { return new SomeViewHolder(LayoutInflater.from(getContext()).inflate(R.layout.some_item, parent, false)); } } For more details you can look at the documentation.
answers question: http://stackoverflow.com/q/26245139
type: Answer
score: 2
upvote count: 3

http://stackoverflow.com/comment/41351271
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26344855
type: QuestionComment
has text: @JonSkeet yes i want to get the current time of new york. if it is between that range i want to perform some task

http://stackoverflow.com/comment/41264366
type: Comment
has text: perfect it works i add an EDIT section for the solution
comment on: http://stackoverflow.com/a/26296790
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41110154
score: 0
type: Comment
type: QuestionComment
has text: What kind of UI are you referring to? is it web based or swing based?
comment on: http://stackoverflow.com/q/26211965

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/26258461
type: Tag

http://stackoverflow.com/a/26279296
has comment: http://stackoverflow.com/comment/41320900
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41320669
has body: You can create a utility method that looks like this: public static int nextValidInt(Scanner s) { while (!s.hasNextInt()) System.out.println(s.next() + " is not a valid number. Try again:"); return s.nextInt(); } and then, instead of startRange = input.nextInt() you do startRange = nextValidInt(input); If you want to deal with the "exit" alternative, I'd recommend something like this: public static int getInt(Scanner s) throws EOFException { while (true) { if (s.hasNextInt()) return s.nextInt(); String next = s.next(); if (next.equals("exit")) throw new EOFException(); System.out.println(next + " is not a valid number. Try again:"); } } and then wrap the whole program in try { ... ... ... } catch (EOFException e) { // User typed "exit" System.out.println("Bye!"); } } // End of main. Btw, the rest of your code looks great. I've tried it and it works like a charm :-)
has comment: http://stackoverflow.com/comment/41320637
type: Answer
has comment: http://stackoverflow.com/comment/41324682
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26279208
answers question: http://stackoverflow.com/q/26279208
has comment: http://stackoverflow.com/comment/41293099
score: 3

http://stackoverflow.com/q/26265845
has answer: http://stackoverflow.com/a/26267754
accepted answer: http://stackoverflow.com/a/26267754
has comment: http://stackoverflow.com/comment/41206978
has comment: http://stackoverflow.com/comment/41208500
score: -1
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41207894
has title: Convert matlab to java
has comment: http://stackoverflow.com/comment/41206623
has body: i am new in java programming.I need to convert my matlab code to basic java codes not complex like just using loops and array, i tried several times but i failed.Thanks for helping.Here is my code. x = [1,2,3,4,5,6,7]; x = perms(x); i = 0; c=1; for m=1:1:5040; for n=1:1:6; if(x(c,n) == (x(c,(n+1))-1)) i = i+1; break end end c=c+1; end Answer : 2119
tagged with: matlab
has comment: http://stackoverflow.com/comment/41207238
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41206564
tagged with: java
has comment: http://stackoverflow.com/comment/41208138
has comment: http://stackoverflow.com/comment/41206879
type: Question

http://stackoverflow.com/comment/41207262
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26266195
has text: For your purposes, is arithmetic O(1)?

http://stackoverflow.com/q/26294118
accepted answer: http://stackoverflow.com/a/26294202
tagged with: java
tagged with: hibernate
upvote count: 1
answer count: 1
tagged with: locking
has answer: http://stackoverflow.com/a/26294202
has body: Hibernate has PESSIMISTIC locking mechanism that can be used to lock a db row. session.lock(Object object, LockMode lockMode) . Lets say i lock a object : 1)session.lock(myObject.LockMODE.READ) 2)session.lock(myObject,LockMODE.UPGRADE) 3)session.lock(myObject.LockMODE.UPGRADE_NOWAIT) If some other thread also issues the above statments 1, what will happend to it? Will that thread simply block?OR will it get some kind of exception?Something like CannotAcquireLock exception? I would like to understand the behavior for 1,2,3 . If a thread acquires a lock and then dies what happens?Is the lock released automatically?Or is the record locked forever? session.lock(myObject,LOCKMODE.SOME_LOCK_MODE) //thread dies . (lets say JVM is killed)
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has title: locking a object using hiberante session.load
type: Question
tagged with: oracle-database

http://stackoverflow.com/comment/41199927
has text: Ah I understand now and see where I was going wrong. Thank you very much for your help.
comment on: http://stackoverflow.com/a/26262442
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26234953
accepted answer of: http://stackoverflow.com/q/26234792
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26234792
downvote count: 0
has comment: http://stackoverflow.com/comment/41181892
has comment: http://stackoverflow.com/comment/76494746
has body: Add Arrays.toString(yourArray) if you want to add the representation of your String array. If it's a multiple-dimension array (e.g. a String[][]), then add Arrays.deepToString(yourArray) to your StringBuilder. Adding the array itself will add the default String representation. Finally, if you need control over how you represent your array to String, you'll need to iterate the elements yourself and add them to the StringBuilder in a customized format. Edit As a side-note, to make this work with arrays of custom Objects, you'll probably want to override the Object.toString method, otherwise your elements will be printed with the default String representation of Object (i.e. this).
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/76337747
upvote count: 6
has comment: http://stackoverflow.com/comment/76337226
has comment: http://stackoverflow.com/comment/76380045
has comment: http://stackoverflow.com/comment/76377254

http://stackoverflow.com/comment/41282770
type: QuestionComment
comment on: http://stackoverflow.com/q/26307395
has text: I second that! Seen @chrylis post, there is a way to answer this question clearly.
score: 0
type: Comment

spring-data-rest
tags question: http://stackoverflow.com/q/26289174
tag name: spring-data-rest
type: Tag
tags question: http://stackoverflow.com/q/26259474
tags question: http://stackoverflow.com/q/26255313
tags question: http://stackoverflow.com/q/26296252
tags question: http://stackoverflow.com/q/26249506
tags question: http://stackoverflow.com/q/26322985

http://stackoverflow.com/q/26339002
tagged with: acceleo
type: AnsweredQuestion
has body: I tried to use Acceleo to translate a model to a text in an Eclipse plugin. The model is fine and the loaded Acceleo module looks fine as well. Still, acceleo does not generate anything. Here is my code: AcceleoService as = new AcceleoService(new PreviewStrategy()); URI alfToSpecSharpTemplate; try { alfToSpecSharpTemplate = getTemplateURI("my-valid-uri", new Path("/path/to/generate.emtl")); } catch (IOException e) { e.printStackTrace(); return null; } as.addListener(new IAcceleoTextGenerationListener() {/* print every method name on call */}); ResourceSet mtlSet = new ResourceSetImpl(); final Resource mtlRessource = mtlSet.getResource(alfToSpecSharpTemplate, true); final Module module = (Module) mtlRessource.getContents().get(0); List&lt;Object&gt; arguments = new ArrayList&lt;Object&gt;(); Map&lt;String, String&gt; result = as.doGenerate(module, "generateElement", myModel, arguments, null, new BasicMonitor()); System.out.println("Generation: " + as.hasGenerationOccurred()); The IAcceleoTextGenerationListener prints that listensToGenerationEnd() is called and nothing else. The loaded module looks fine in debug. It has the generateElement-template. The generate.mtl looks like this: [comment encoding = UTF-8 /] [module generate('http://www.eclipse.org/papyrus/alf/Alf')] [template public generateElement(test : Test) post (trim())] [file('expr.specs', true)] [test.block.generateElement() /] [/file] [/template] My problem is that nothing is generated, i.e. result is an empty map. Also "Generation: false" is printed to console. Especially no error is printed. Anyone have any idea on what is going wrong? I had it working once but I can't get it to work any more.
tagged with: java
tagged with: eclipse
type: Question
score: 0
has title: Nothing is generated and no error although model and module are loaded
answer count: 1
accepted answer: http://stackoverflow.com/a/26341217
has answer: http://stackoverflow.com/a/26341217

http://stackoverflow.com/a/26289289
answers question: http://stackoverflow.com/q/26288988
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41251153
score: 2
has body: Add on the dispose method Gdx.input.setInputProcessor(null); and will be fixed
has comment: http://stackoverflow.com/comment/41278880
downvote count: 0

http://stackoverflow.com/comment/41264163
type: AnswerComment
type: Comment
has text: @DmitryGinzburg explanation added as per your suggestion.
comment on: http://stackoverflow.com/a/26297394
score: 0

http://stackoverflow.com/q/26337269
accepted answer: http://stackoverflow.com/a/26337338
tagged with: java
has answer: http://stackoverflow.com/a/26337328
has answer: http://stackoverflow.com/a/26337470
has body: I've got an ArrayList with Objects in it. The Objects have a String name and a String style and an int strength. I would like to sort by name in my ArrayList then list it to the standard output. How can I do this with a method called NameComparator?
has answer: http://stackoverflow.com/a/26337330
answer count: 7
possible better answer: http://stackoverflow.com/a/26337328
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/26337338
has answer: http://stackoverflow.com/a/26337366
has title: How can I sort an ArrayList with Objects that have a name and "strenght"? (Java)
score: -1
has answer: http://stackoverflow.com/a/26337331
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/26337426
downvote count: 3
type: Question

http://stackoverflow.com/comment/41110862
comment on: http://stackoverflow.com/a/26214091
has text: Thanks icza, I like the simple way. That worked fine.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26334701
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: unicode-string
type: Question
tagged with: jakarta-mail
has body: I am trying to read mail threw JavaScript and done successfully. Now issue is that when the inline image is present into the mail at that time format of the mail add one zero width space using "=E2=80=8B" this character and I cannot read this properly. I got ? in place of this code which is create bug for my application how I can remove this ? mark and how I can decode =E2=80=8B this code using Java Message Content :- &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;div dir="ltr"&gt; &lt;img src="/account/images/companydata/indies/inlineemailattach/1413183522383_subaru_hd_logo_wallpapers.png" height="264" width="440" /&gt; 12 27 &lt;br /&gt;? &lt;br /&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; In above output we can see the ? after br tag. How can I decode this?
downvote count: 0
tagged with: unicode
has answer: http://stackoverflow.com/a/26346915
answer count: 1
favorite count: 0
has title: How to convert unicode charater during mail reading using Java Mail?

http://stackoverflow.com/comment/41186327
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26254690
score: 0
has text: Thank you. It is no longer crashing but now no shapes are displaying.

http://stackoverflow.com/comment/41258948
comment on: http://stackoverflow.com/q/26286716
score: 0
type: Comment
type: QuestionComment
has text: Firstly, you never contacted me. Secondly, your error description is "weird" as well: that isn't odd, your pc seems to be possessed. Anyway, a good description should include the jdbc url parameters you're using. Are you using memory=false?(that could explane a file generation, not your error). Are you using lockmdb=true? If not, "those reference files" are not created by ucanaccess.

http://stackoverflow.com/comment/41225436
has text: Try doing the for-loop on paper.
type: Comment
comment on: http://stackoverflow.com/q/26276457
score: 4
type: QuestionComment

http://stackoverflow.com/a/26220094
downvote count: 0
answers question: http://stackoverflow.com/q/26220026
type: Answer
score: 1
has body: Refactor it to a while loop, might make it more understandable for you: v = destination; //for loop initialization while (v != source){ //for loop termination condition //for loop body u = parent[v]; residualGraph[u][v] -= pathFlow; residualGraph[v][u] += pathFlow; v = parent[v]; //for loop "increment" }
upvote count: 1

http://stackoverflow.com/comment/41241993
type: Comment
comment on: http://stackoverflow.com/a/26275516
has text: Can you provide me with an example of what you mean with one of the buttons e.g. back_button? I wrote this out in InstantiateItem but I am still getting a nullpointer when I setOnClickListener in main activity: ImageView back_button = (ImageView) findViewById(R.id.back_nav_arrow); back_button.setImageResource(R.drawable.ic_action_back);
type: AnswerComment
score: 0

http://stackoverflow.com/a/26346410
has comment: http://stackoverflow.com/comment/41355505
type: Answer
has body: I checked your code for receiving messages and it seems to be OK. Do you implement registering device to GCM as on: https://developer.android.com/google/gcm/client.html#sample-register
has comment: http://stackoverflow.com/comment/41354373
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26346110
has comment: http://stackoverflow.com/comment/41354288
downvote count: 0

http://stackoverflow.com/q/26221624
has title: Issue with setting up hibernate with Dropwizard 0.7.1. "Unable to create a hibernate session on 0.7.1"
accepted answer: http://stackoverflow.com/a/26222566
linked to: http://stackoverflow.com/q/23320927
score: 1
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
downvote count: 0
tagged with: dropwizard
has answer: http://stackoverflow.com/a/26222566
favorite count: 0
has body: I am unable to create hibernate session in 0.7.1. I know I am not creating hibernate session right. But cant figure out where am I going wrong. Any help will be appreciated. ERROR: ! org.hibernate.HibernateException: No session currently bound to execution context ! at org.hibernate.context.internal.ManagedSessionContext.currentSession(ManagedSessionContext.java:75) ~[userengine-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] ! at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014) ~[userengine-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] The Application file: public class UserEngineApplication extends Application&lt;UserEngineConfiguration&gt;{ public static void main(String[] args) throws Exception { new UserEngineApplication().run(args); } private final HibernateBundle&lt;UserEngineConfiguration&gt; hibernateBundle = new HibernateBundle&lt;UserEngineConfiguration&gt;(Persons.class) { @Override public DataSourceFactory getDataSourceFactory (UserEngineConfiguration configuration) { return configuration.getDataSourceFactory(); } }; @Override public void initialize(Bootstrap&lt;UserEngineConfiguration&gt; bootstrap) { bootstrap.addBundle(hibernateBundle); } @Override public void run(UserEngineConfiguration configuration, Environment environment) throws Exception { final PersonDAO personsdao = new PersonDAO(hibernateBundle.getSessionFactory()); environment.jersey().register(new PersonsResource(personsdao)); } } The Configuration file: public class UserEngineConfiguration extends Configuration { @Valid @NotNull @JsonProperty private DataSourceFactory database = new DataSourceFactory(); @JsonProperty("database") public DataSourceFactory getDataSourceFactory() { return database; } @JsonProperty("database") public void setDataSourceFactory(DataSourceFactory dataSourceFactory) { this.database = dataSourceFactory; } } YAML file: database: driverClass: org.postgresql.Driver user: user password: pass url: jdbc:postgresql://localhost:5432/Tryout Some links that …
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/41154854
type: Comment
has text: Edited and added example how to submit a form with Javascript.
comment on: http://stackoverflow.com/a/26237828
type: AnswerComment
score: 0

http://stackoverflow.com/a/26312934
has comment: http://stackoverflow.com/comment/41292367
answers question: http://stackoverflow.com/q/26312862
has body: Yes, you want to submit a FutureTask rather than a Runnable. (A FutureTask is a Runnable, so you don't need to change anything else.) If you create a FutureTask then you can have another thread invoke its .get() method, which will block until the task is complete, and it will return the result. (The cleanest way will be to get rid of your getSomeResults() method entirely, and just use the get() method of FutureTask; but there's nothing to stop you leaving your code more or less as it is, and just using get() as a way of blocking, if you want to try that first to check it's all working.)
score: 0
has comment: http://stackoverflow.com/comment/41292437
type: Answer

http://stackoverflow.com/comment/41356275
type: Comment
score: 0
type: AnswerComment
has text: Ok tried that and get a 17K file. But when I open in Excel only column headers and it truncates file to 4k. This after I did as suggested wrote once after all rows created. I am guessing what you are saying is write the book once, period. I did the write of the columns, writebook, then started rows. SO I now will go back and change. Not sure how this is going to work with 20MB of data.Thanks Rob
comment on: http://stackoverflow.com/a/26324972

http://stackoverflow.com/a/26243708
has comment: http://stackoverflow.com/comment/41166295
answers question: http://stackoverflow.com/q/26243654
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: You are exactly right, you overwrite the file. If you open it with an FileOutputStream it will start from the beginning. You can either keep the stream open or use the append mode by specifying true after the file (name). BufferedOutputStream out = new BufferedOutputStream( new GZIPOutputStream( new FileOutputStream(newFile, true) ) ); With the GZIPOutputStream you have quite some overhead if you open a new stream on each line, but it is defined to work this way. (Again: keeping it open also helps with this).
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26243654

http://stackoverflow.com/comment/41092271
type: QuestionComment
comment on: http://stackoverflow.com/q/26204556
score: 5
has text: If you need to access members that aren't in `Vehicle`, you shouldn't be storing an array of `Vehicle`.
type: Comment

http://stackoverflow.com/comment/41095114
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26205661
has text: Part of the reason I wanted to use a map is more experimentation, but if it doesn't work out I'll definitely give <Pair<T, T>> a try, it also sounds interesting. However, my problem actually requires a bit more than just the storing the values based on the key. I'm doing the knights tour problem so the potential moves, based on the key, can't have X or Y be under 0 or greater than 8 (I hate that Enter automatically submits) Anyway, now that I have a list of all possible moves, I still have the 2D array to keep track of the next potential moves. But I have modify the professor's code so it's

http://stackoverflow.com/q/26218065
has answer: http://stackoverflow.com/a/26218225
tagged with: java
has comment: http://stackoverflow.com/comment/41117992
has answer: http://stackoverflow.com/a/26218101
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/41117896
accepted answer: http://stackoverflow.com/a/26218225
possible better answer: http://stackoverflow.com/a/26218101
type: Question
type: AnsweredQuestion
has title: In intelliJ 13 ultimate, how do you increase the compiler maximum heap size?
has comment: http://stackoverflow.com/comment/41117654
has body: I recently upgraded to IntelliJ IDEA 13 from 11. There used to be a box under setting/java compiler where you could over ride the compiler maximum heap size. It is no longer there. This is stopping me from compiling my project do to a "GC overhead limit exceeded." Can someone tell me where this option is or a viable alternative? Any and all information would be helpful. Thanks.
has comment: http://stackoverflow.com/comment/41117617
score: 0
answer count: 2

http://stackoverflow.com/comment/41096143
type: Comment
comment on: http://stackoverflow.com/a/26206500
type: AnswerComment
score: 0
has text: So what are you saying? when two different keys has the same value. that value is actually being duplicated in the memory? or??

http://stackoverflow.com/q/26208502
has answer: http://stackoverflow.com/a/26208540
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41099917
tagged with: java
has title: how to open a second jframe from a current one?
linked to: http://stackoverflow.com/q/9554636
type: AnsweredQuestion
tagged with: multiple-instances
upvote count: 0
accepted answer: http://stackoverflow.com/a/26208540
favorite count: 0
has comment: http://stackoverflow.com/comment/41099892
type: Question
has comment: http://stackoverflow.com/comment/41100009
has body: my current program takes in text from some JTextFields and adds it to a file to keep track of medications. What i want to do, is add another button to the bottom of the program that will open a second jframe to display the medications that are already documented, but all attempts have been brutally unsuccessful. Below is the code that i am currently working with. Much Thanks. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; @SuppressWarnings({ "serial" }) public class MedGUITest extends JFrame { private JLabel medName; private JLabel medTime; private JLabel medDose; private JLabel finished; private JTextField textFieldMed; private JTextField textFieldTime; private JTextField textFieldDose; private JButton submitButton; private JButton meds; public MedGUITest(){ setLayout(new FlowLayout()); medName = new JLabel("Type Medication Here:"); add(medName); textFieldMed = new JTextField("",15); add(textFieldMed); medDose = new JLabel("Type Medication Dose:"); add(medDose); textFieldDose = new JTextField("",15); add(textFieldDose); medTime = new JLabel("Type Medication Time:"); add(medTime); textFieldTime = new JTextField("",15); add(textFieldTime); submitButton = new JButton("Click Here to Add"); event e = new event(); submitButton.addActionListener(e); add(submitButton); meds = new JButton("Click Here to see meds"); event2 r = new event2(); meds.addActionListener(r); add(meds); finished = new JLabel(""); add(finished); } public class event implements ActionListener { public void actionPerformed(ActionEvent e){ String medName = textFieldMed.getText(); String medDose = textFieldDose.getText(); String medTime = textFieldTime.getText(); File med = new File("med.txt"); try(PrintWriter out= new PrintWriter(new FileWriter(med,true))) { out.println("Medication: " + medName + " " +"Dosage: "+ medDose + " Mg"+ " " +"Time of day: "+ medTime); finished.setText("Your…
score: -1
tagged with: jframe
tagged with: swing

http://stackoverflow.com/q/26332703
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41329106
answer count: 1
downvote count: 0
score: 1
tagged with: string
linked to: http://stackoverflow.com/q/513832
has title: Program Cannot Discern What The String Is
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26332737
has body: I am trying to make a game where you unscramble words. But I cannot seem to get it to properly check if the user's guess is equal to the actual answer. It seems to no matter what have the actual word not equal to the users guess, also while your here. Is there any other way to pause my code and wait for a users input other than having a while loop? import javax.swing.JOptionPane; public class Loop extends CreateWindow{ private static final long serialVersionUID = 1L; public static boolean running = true; public static void GameStart(){ if(running){ int wordNum = 0; for (int i=0;i&lt;=9;i++){ field.setText(""); setScrambledWord(i); while(enter == false){ System.out.println(userAnswer); System.out.println(enter); System.out.println(score); } userAnswer = area.getText(); if(userAnswer == normalWords[wordNum]){ JOptionPane.showMessageDialog(null, "legos", userAnswer, JOptionPane.OK_OPTION); }else if(userAnswer != normalWords[wordNum]){ JOptionPane.showMessageDialog(null, "sogel", userAnswer, JOptionPane.OK_OPTION); } area.setText(""); enter = false; wordNum++; } } } public static void main(String[] args){ new CreateWindow(); running = true; GameStart(); } } import java.awt.BorderLayout; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; public class CreateWindow extends JFrame { private static final long serialVersionUID = 1L; JPanel panel = new JPanel(); public static int score = 0; static JTextArea area = new JTextArea(10,40); static JTextField field = new JTextField(40); JButton button = new JButton("Press to Enter Answer"); public static boolean enter; public static String userAnswer; public static String[] normalWords = { "yellow", "alphabet", "tangent", "elephant", "amusement", "cat", "eerie", "wonder", "shadows" }; public static String[] scrambledWords = { "lloeyw", "lphaabte…

http://stackoverflow.com/comment/41231954
type: Comment
type: QuestionComment
has text: In order to avoid duplicated answers, you can **[see my answer here](http://stackoverflow.com/questions/26228523/should-unit-tests-ensure-a-specific-method-was-called-to-arrive-at-the-result/26232511#26232511)** about similar question.
comment on: http://stackoverflow.com/q/26279787
score: 0

http://stackoverflow.com/comment/41322555
type: QuestionComment
comment on: http://stackoverflow.com/q/26329105
has text: is there a way to do that without arrays. we havent covered those in class yet
score: 0
type: Comment

http://stackoverflow.com/q/26291404
type: UnansweredQuestion
has title: XML deserialization is extremely slow - Apache Axis 1.4
tagged with: http://stackoverflow.com/tag/xml
type: Question
has body: I have intermitten issue after invoking web service thru Axis, deserialization of xml is really slow. Response of xml is small &lt; 5kb. Below screenshot of elapses times for all methods during deserialization. I'm using JDK 1.7, Axis 1.4 and Xerces 2.11.0. Can someone enlighten me ?
tagged with: java
has answer: http://stackoverflow.com/a/26302408
score: 0
tagged with: axis
answer count: 1
tagged with: deserialization
tagged with: xml-deserialization

http://stackoverflow.com/comment/41187820
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26255971
has text: if there isn't anything different in the 3rd client, then there's no reason for it to systematically not to work
score: 0

http://stackoverflow.com/q/26335688
has comment: http://stackoverflow.com/comment/41346334
has body: We have a multi-project setup where a common module is shared among applications. Each module has it's own code and test cases and the libraries are picked up from an internal Maven repository. The dependencies are logically related as follows Shared depends on Internal App A depends on Shared App B depends on Shared The physical structure is as follows - App_a - src ( Code for `App a` &amp; `Shared` module ) - etc - test - unit - src - build.gradle - settings.gradle - modules - Shared - build.gradle - settings.gradle - Internal - src - build.gradle - App_b - build.gradle - settings.gradle Internal, Shared, App A, App B, etc all have independent gradle scripts with the sub-projects defined in settings.gradle for each top level project ( Shared, App A, App B, etc). The Gradle scripts for this setup were recently created and everything works just fine from the command line. I recently updated the Gradle scripts to work with Eclipse. Eclipse imports the projects correctly and is able to create projects for the sub projects as well. I am able to run all the gradle tasks from the Gradle Tasks view successfully (including ones from the eclipse plugin), but for some reason Eclipse is not using the dependent libraries and shows compilation errors. I am unable to run the applications or run JUnit tests via Eclipse because of this. In Eclipse The project dependencies appear to be setup correctly i.e. Shared depends on Internal, App A depends on Shared, etc. The library tab for each project seems to be correct as well. It has a folder called Gradle Dependencies which when expanded shows the list of libraries configured in build.gradle. I tried searching around but didn't find any solution. Any help on this would be appreciated. My setup is as follows Java: 1.8 Eclipse: Luna Gradle: 2.1 Gradle IDE: 3.6.0.201405280533-M1 Update on 17th Oct 2014: I have managed to make progress. I had to comment out a few things, but overall a big improvement. The build script for each module set…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41351257
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has title: Imported gradle projects not compiling within Eclipse
answer count: 0
tagged with: java
upvote count: 1
tagged with: gradle
type: Question

http://stackoverflow.com/comment/41223175
score: 0
has text: Everything is possible, what you're talking about sounds like composition (see link in my answer). But composition is more for an *HAS-A* relationship. Do you think a `Dog` *HAS-AN* `Animal`, or *IS-AN* `Animal`? *IS-A* makes more sense here, that's why you should use inheritance, and thus you can't create a Dog from an existing plain Animal.
type: Comment
comment on: http://stackoverflow.com/a/26275014
type: AnswerComment

http://stackoverflow.com/comment/41232403
type: QuestionComment
type: Comment
has text: 'If' is not 'if' , it isn't a strange error!
score: 1
comment on: http://stackoverflow.com/q/26280216

http://stackoverflow.com/comment/41161104
score: 0
has text: Just a guess - could you try using `adapter.add(edit.getText().toString())` instead of `list.add(...)` in `TabLibrary.java`? Also this won't lead to errors - so posting the error will help us give you better solution than wild guesses.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26240912

http://stackoverflow.com/comment/41296103
score: 0
comment on: http://stackoverflow.com/q/26315088
type: Comment
type: QuestionComment
has text: What are the "units" exactly? The number of courses?

http://stackoverflow.com/q/26232468
tagged with: java
has answer: http://stackoverflow.com/a/26233234
type: Question
accepted answer: http://stackoverflow.com/a/26233234
tagged with: command-line-arguments
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/69748845
linked to: http://stackoverflow.com/q/15080244
has body: I have written a Java application, that analyzes some data from within a zip file. I can pass the filename as command line argument to the application (java -jar myapp.jar fileToAnalyze.zip) and it does what it is supposed to do. Unfortunately it is somehow complicated to call the application via command line. I would like to simply drag the ZIP file to the jar and let it start. I have absolutely no idea how to do this. Could you please give some hints? Thanks in advance.
has title: Drag&Drop file to jar file (in Windows Explorer)
has answer: http://stackoverflow.com/a/69748845
tagged with: drag-and-drop
type: AnsweredQuestion

http://stackoverflow.com/a/26341434
score: 2
accepted answer of: http://stackoverflow.com/q/26340335
downvote count: 0
upvote count: 2
has body: Try new Date(1407315600 * 1000) The Java date requires milliseconds, the C++ timestamp you have looks like it is in seconds. In general, the C++ time_t functions give the time in seconds since the epoch. To get the time in milliseconds in C++ (compared to Java), please refer to this. C++11 If C++11 is available on the platform, the chrono::high_resolution_clock could be used to obtain a higher resolution (note; the clock may be an alias for one of the other clocks or an implementation defined clock). #include &lt;iostream&gt; #include &lt;chrono&gt; int main() { using namespace std; using namespace std::chrono; milliseconds ms; ms = duration_cast&lt;milliseconds&gt;(high_resolution_clock::now().time_since_epoch()); cout &lt;&lt; ms.count() &lt;&lt; endl; }
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26340335

http://stackoverflow.com/q/26256720
answer count: 6
has title: @JsonInclude(Include.NON_NULL) not working as expected
accepted answer: http://stackoverflow.com/a/26257344
has answer: http://stackoverflow.com/a/50818886
downvote count: 0
has answer: http://stackoverflow.com/a/63069778
favorite count: 0
possible better answer: http://stackoverflow.com/a/69674432
has answer: http://stackoverflow.com/a/74447319
has answer: http://stackoverflow.com/a/69674432
has answer: http://stackoverflow.com/a/26257344
type: AnsweredQuestion
score: 23
has answer: http://stackoverflow.com/a/53115498
tagged with: web-services
has comment: http://stackoverflow.com/comment/63852569
upvote count: 23
has body: I have added @JsonInclude(Include.NON_NULL) annotation on Response class. @JsonInclude(Include.NON_NULL) public class Response { @JsonProperty private String message; // getter-setters } If the value is null the property does not include in JSON But still I am getting this property as a NULL. { "message": null } What can be the reason ? Am I missing anything ?
type: Question
tagged with: java

http://stackoverflow.com/q/26249030
favorite count: 0
tagged with: rx-java
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/44401425
tagged with: reactive-programming
has title: RxJava Fetching Observables In Parallel
score: 56
has answer: http://stackoverflow.com/a/26250237
upvote count: 56
type: AnsweredQuestion
tagged with: java
tagged with: observable
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/28161636
has comment: http://stackoverflow.com/comment/44426442
accepted answer: http://stackoverflow.com/a/26250237
has answer: http://stackoverflow.com/a/28161636
downvote count: 0
has body: I need some help in implementing parallel asynchronous calls in RxJava. I have picked up a simple use case wherein the FIRST call fetches (rather searches) a list of products (Tile) to be displayed. The subsequent calls go out and fetch (A) REVIEWS and (B) PRODUCT IMAGES After several attempts I got to this place. 1 Observable&lt;Tile&gt; searchTile = searchServiceClient.getSearchResults(searchTerm); 2 List&lt;Tile&gt; allTiles = new ArrayList&lt;Tile&gt;(); 3 ClientResponse response = new ClientResponse(); 4 searchTile.parallel(oTile -&gt; { 5 return oTile.flatMap(t -&gt; { 6 Observable&lt;Reviews&gt; reviews = reviewsServiceClient.getSellerReviews(t.getSellerId()); 7 Observable&lt;String&gt; imageUrl = reviewsServiceClient.getProductImage(t.getProductId()); 8 return Observable.zip(reviews, imageUrl, (r, u) -&gt; { 9 t.setReviews(r); 10 t.setImageUrl(u); 11 return t; 12 }); 13 }); 14 }).subscribe(e -&gt; { 15 allTiles.add((Tile) e); 16 }); Line 1: goes out and fetches the product (Tile) to be displayed Line 4: We take the list of the Observable and SHARD it to fetch reviews and imageUrls Lie 6,7: Fetch the Observable review and Observable url Line 8: Finally the 2 observables are zipped up to return an updated Observable Line 15: finally line 15 collates all the individual products to be displayed in a collection which can be returned back to the calling layer While the Observable has been sharded and in our tests run over 4 different threads; fetching of reviews and images seems to be one after another. I suspect that the zip step on line 8 is basically causing the sequential invocation of the the 2 observables (reviews and url). Does this group have any suggestion to parallely fetch reiews and image urls. In essence the waterfall chart attached above should look more vertically stacked. The calls to reviews and images should be in parallel thanks anand raman

http://stackoverflow.com/q/26346248
has body: I used RSA algorithm to encrypt and decrypt. When I encrypt a string, it's working properly. When I decrypt, I get an error. Below, I post my code. public final String modulusString =".............."; public final String publicExponentString = "AQAB"; /* Encryption */ byte[] modulebytes = Base64.decode(modulusString); byte[] exponentbytes = Base64.decode(publicExponentString); BigInteger module = new BigInteger(1,modulebytes); BigInteger publicexponent = new BigInteger(1,exponentbytes); RSAPublicKeySpec rsaPubKey = new RSAPublicKeySpec(module, publicexponent); KeyFactory fact = KeyFactory.getInstance("RSA"); PublicKey pubKey = fact.generatePublic(rsaPubKey); Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] plainBytes = EncryptionValue.getBytes("UTF-8"); byte[] cipherData = cipher.doFinal( plainBytes ); String encryptedString = Base64.encode(cipherData); return encryptedString; /* Decryption */ byte[] modulebytes = Base64.decode(modulusString); byte[] exponentbytes = Base64.decode(publicExponentString); BigInteger modulus = new BigInteger(1, modulebytes ); BigInteger exponent = new BigInteger(1, exponentbytes); RSAPrivateKeySpec rsaPrivKey = new RSAPrivateKeySpec(modulus, exponent); KeyFactory fact = KeyFactory.getInstance("RSA"); PrivateKey privKey = fact.generatePrivate(rsaPrivKey); Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(Cipher.DECRYPT_MODE, privKey); byte[] base64String = Base64.decode(DecryptionValue); byte[] plainBytes = new String(base64String).getBytes("UTF-8"); plainBytes = cipher.update(plainBytes); byte[] values = cipher.doFinal(plainBytes); return new String(values, "UTF-8"); Exception in thread "main" javax.crypto.BadPaddingException: Decryption error at sun.security.rsa.RSAPadding.unpadV15(RSAPadding.java:380) at sun.security.rsa.RSAPadding.unpad(RSAPadding.java:291) at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:363) at com.sun.crypto.provider.RSACi…
type: UnansweredQuestion
upvote count: 1
has title: Why do I get a BadPaddingException from RSA decryption?
tagged with: badpaddingexception
score: 1
tagged with: java
tagged with: rsa
type: Question
has answer: http://stackoverflow.com/a/26346417
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26310454
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26373977
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41403903
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41325450
favorite count: 0
has title: Create JSON data NVD3 Chart using Java
tagged with: nvd3.js
has comment: http://stackoverflow.com/comment/41324624
has comment: http://stackoverflow.com/comment/41336082
has comment: http://stackoverflow.com/comment/41322794
has answer: http://stackoverflow.com/a/26373765
has body: I working on NVD3 chart where need to create JSON data for chart as below: [{ "key" : "North America" , "values" : [ [ 1025409600000 , 23.041422681023] , [ 1028088000000 , 19.854291255832] ] }, { "key" : "Africa" , "values" : [ [ 1025409600000 , 23.041422681023] , [ 1028088000000 , 19.854291255832] ] }, { "key" : "South America" , "values" : [ [ 1025409600000 , 23.041422681023] , [ 1028088000000 , 19.854291255832] ] }] Would somebody please help me create above JSON data using Java as I am trying to create this structure since last 3 hours not successful yet. Here is the Plunker link: Stacked Area Chart NVD3 Here is the live JSON data example which I want to create in JAVA: JSON example data

http://stackoverflow.com/comment/98562910
type: Comment
has text: All that done except rpm-maven-plugin has no explicit version and I still get the error every time :-(
comment on: http://stackoverflow.com/a/40811390
type: AnswerComment
score: 0

awk
tag name: awk
type: Tag
tags question: http://stackoverflow.com/q/26211696

http://stackoverflow.com/q/26263376
downvote count: 0
favorite count: 0
has title: Should stacks be made from arrays or linked list java?
answer count: 3
has body: I have to write a stack for class and while I understand the concept of how a stack works, I wasn't told if they are made using an array or a linked list or something else? How are most stacks created?
has comment: http://stackoverflow.com/comment/41202593
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26264631
upvote count: 1
has answer: http://stackoverflow.com/a/26263440
has comment: http://stackoverflow.com/comment/41202126
score: 1
tagged with: stack
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26263525

http://stackoverflow.com/comment/41182103
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26252554
has text: I don't see anything JMX related in that bean also i doubt static methods are available in the JMX console.
score: 0

http://stackoverflow.com/q/26334994
has title: Vaadin + Spring Integration: Null Pointer exception
has answer: http://stackoverflow.com/a/26335197
tagged with: java
tagged with: hibernate
tagged with: vaadin
type: Question
has comment: http://stackoverflow.com/comment/41334440
has comment: http://stackoverflow.com/comment/41333825
score: 0
has comment: http://stackoverflow.com/comment/41334424
has body: I have a Vaadin web application with UI class like this: @SuppressWarnings("serial") @Theme("mytheme") public class LogsUI extends UI { LogsView logsViewer = new LogsView(); @WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = LogsUI.class) public static class Servlet extends VaadinServlet { } @Override protected void init(VaadinRequest request) { Panel panel = new Panel(); panel.setContent(logsViewer); panel.setSizeFull(); setContent(panel); } } As u can see i add use setContent to add LogsView class which is a view - it is a fragment of declaration: @SuppressWarnings("serial") public class LogsView extends CustomComponent implements View { //some variables, buttons, components etc ProcessDao processDao; //sample method void sampleMethod(){ processDao = new ProcesDao; processDao.getAllprocesses(); //just sample, no matter about logic } } My ProcessDao class: public class ProcessDao { @Autowired ApplicationConfiguration applicationConfiguration; public ProcessDao() { } public List&lt;ProcessEntity&gt; getAllProcess(){ System.out.println("TEST:" + applicationConfiguration); //entity manager and other stuffs return processList; } } As u can see i did System.out.println() to check if im getting applicationConfiguration object. Im getting null. This is main problem. this is my ApplicationConfiguration class: @Configuration @EnableTransactionManagement @ComponentScan(basePackages = {"com.sample.project"}) @PropertySource({"classpath:jpa.postgresql.properties", "classpath:hibernate.properties"}) @EnableJpaRepositories(basePackages = {"com.sample.project.repo"}) public class ApplicationConfiguration extends WebMvcConfigurerAdapter { @Value("${javax.persistence.jdbc.driver}") private String driverClassName; @Value("${javax.persistence.jdbc.url}") private String databaseUrl; @Value("${javax.persistence.jdbc.user}") private String databaseUser; @Value("${javax.persistence.jdbc.password}") private String databasePassword; @V…
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/41333458
has comment: http://stackoverflow.com/comment/41334557
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41334878
tagged with: spring

http://stackoverflow.com/q/26209888
accepted answer: http://stackoverflow.com/a/26210319
answer count: 1
has comment: http://stackoverflow.com/comment/41102660
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26210319
has comment: http://stackoverflow.com/comment/41102644
has comment: http://stackoverflow.com/comment/41103117
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41103062
tagged with: java
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/41102645
has body: *Edited : My question was proposed wrong a caused many issues. donatePet() should simply just add an object to a list. All that was necessary was to take an object and store it in an arraylist. Input : Cat, CatName5, 2, Brown, rawr, 2 Cat, Kitty, 7, Yellow, a kitty cat, 6 Dog, DogName3, 120, Grey, This is a dog, 3 Ex: public static void donatePet(List&lt;Pets&gt; petList, Pets p) { petList.add(p); } donatePet() would then be in the "test" class. (The class that will be accessing the inherited classes.) The casting that was done by the answerer is done so that you can access methods belonging to the Pet class.
score: -1
has title: Creating a method that adds an object in Java
has comment: http://stackoverflow.com/comment/41103153
tagged with: arraylist

http://stackoverflow.com/a/26295260
score: 1
answers question: http://stackoverflow.com/q/26295102
downvote count: 0
type: Answer
has body: This should do it. 1 - Create a getter for the array. public int[] getArray() { return data; } 2 - Display the array BinaryArray searchArray = new BinaryArray( 15 ); // create the Object for(int i:searchArray.getArray()){ System.out.println( i ); }
upvote count: 1

http://stackoverflow.com/q/26327430
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/66354999
has comment: http://stackoverflow.com/comment/41318916
has body: I have an image inside my jar which I am trying to load, but getResourceAsStream() always returns null. Directory structure: com/thesimpzone/watch_pugs/watch_pugs/{all my class files} META-INF/MANIFEST.MF resources/generic/mouse.png Content.java: public abstract class Content { protected Map&lt;String, BufferedImage&gt; images = new HashMap&lt;String, BufferedImage&gt;(); protected String prefix; public Content(String prefix){ this.prefix = prefix; } protected void loadImage(String name){ System.out.println(name); System.out.println(prefix); String path = (prefix + name); System.out.println(path); String identifier = name.substring(0, name.lastIndexOf(".")); try{ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(path); images.put(identifier, ImageIO.read(in)); }catch(IOException | ClassCastException e){ throw new RuntimeException("Image " + identifier + " at " + path + " could not be loaded."); } } [...] } GenericContent.java: public class GenericContent extends Content { public GenericContent(){ super("resources/generic/"); this.loadContent(); } @Override public void loadContent() { loadImage("mouse.png"); } } StackTrace: mouse.png resources/generic/ resources/generic/mouse.png Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1348) at com.thesimpzone.watch_pugs.watch_pugs.content.Content.loadImage(Content.java:29) at com.thesimpzone.watch_pugs.watch_pugs.content.GenericContent.loadContent(GenericContent.java:17) at com.thesimpzone.watch_pugs.watch_pugs.content.GenericContent.&lt;init&gt;(GenericContent.java:12) at com.thesimpzone.watch_pugs.watch_pugs.Canvas.&lt;init&gt;(Canvas.java:45) at com.thesimpzone.watch_pugs.watch_pugs.Framework.&lt;init&gt;(Framework.java:75) at com.thesimpzone.watch_pugs.watch_pugs.Window.&lt;init&gt;(Window.java:50) at com.thesimpzone.watch_pugs.watch_pugs.Window.&lt;init&gt;(Window.java:26) at com.thesimpzone.watch_pugs.…
answer count: 2
has answer: http://stackoverflow.com/a/66354999
accepted answer: http://stackoverflow.com/a/26327638
has title: Why is getResourceAsStream returning null?
favorite count: 0
has comment: http://stackoverflow.com/comment/41319460
has comment: http://stackoverflow.com/comment/41318937
upvote count: 2
has answer: http://stackoverflow.com/a/26327638
tagged with: getresource
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/41351178
type: Comment
type: QuestionComment
score: 1
has text: These libraries provide what you need but your question is like *please do this work for me, I'm too lazy to do it*. Instead, provide your attempt to accomplish your question and we'll help you.
comment on: http://stackoverflow.com/q/26344756

http://stackoverflow.com/q/26325303
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/30524966
type: Question
has answer: http://stackoverflow.com/a/26335176
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/41315718
upvote count: 3
tagged with: android
has answer: http://stackoverflow.com/a/30524966
has title: Run com.google.example.games.bc and fails
tagged with: android-studio
has comment: http://stackoverflow.com/comment/41315720
has body: I try to run the ButtonClick example of google, and I get this exception: 10-12 15:50:22.744 7085-7085/com.google.example.games.bc E/﹕ Device driver API match Device driver API version: 23 User space API version: 23 10-12 15:50:22.744 7085-7085/com.google.example.games.bc E/﹕ mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct 9 21:05:57 KST 2013 10-12 15:50:23.049 7085-7085/com.google.example.games.bc E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information. at com.google.android.gms.internal.id$h.b(Unknown Source) at com.google.android.gms.internal.id$h.e(Unknown Source) at com.google.android.gms.internal.id$b.fv(Unknown Source) at com.google.android.gms.internal.id$a.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5419) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) at dalvik.system.NativeStart.main(Native Method) I changed nothing from the Git project (by Google). Any clue? Thanks in advance.
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/26335176

http://stackoverflow.com/comment/41266935
comment on: http://stackoverflow.com/a/26299030
type: AnswerComment
score: 0
type: Comment
has text: If this could be the solution, tgkprog's runtime suggestion could also be. Even not "internal" util, the *API of my library itself* slightly differs between versions of Java. Read the comments to the question.

http://stackoverflow.com/comment/41143729
type: Comment
comment on: http://stackoverflow.com/a/26231344
score: 0
type: AnswerComment
has text: Thanks @cowls; will try it out. But in such an approach 'id' in @TestAnnotation would not really be of any significance, right? So please correct me if am missing something but looks like i cannot make it work, the way i imagined it to be.

http://stackoverflow.com/comment/41273648
type: Comment
type: QuestionComment
score: 8
has text: *"Someone know how to do this?"* - Yes. Lots of people know. And if you write the program, you will know too! Hint: you will learn more about Java if you write this program yourself. (You will learn more by just trying ...)
comment on: http://stackoverflow.com/q/26302471

http://stackoverflow.com/comment/41264869
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26297560
has text: Ok, now it works fine for apps == 16, but you want sometimes increasing first row and sometimes decreasing... **depends on what?** However you can switch the flag to true or false to change first row orientation.
type: AnswerComment

http://stackoverflow.com/q/26272009
tagged with: database
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26273484
has title: How to deal with a bean containing @Id @GeneratedVaule in Vaadin?
has body: I'm trying to make a form that will send data to the database in Vaadin. Bean Person.java is a typical JavaBean: import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Person implements Serializable { @Id @GeneratedValue private Long id; private String firstName; private String lastName; public Person(Long id, String firstName, String lastName) { this.id = id; this.firstName = firstName; this.lastName = lastName; } public Person() { } -- getters and setters -- The Vaadin FieldGroup looks like this: FieldGroup fieldGroup = new BeanFieldGroup&lt;Person&gt;(Person.class); // from the tutorial: "We need an item data source before we create the fields to be able to // find the properties, otherwise we have to specify them by hand" fieldGroup.setItemDataSource(new BeanItem&lt;Person&gt;(new Person(1L, "John", "Doe"))); for (Object propertyId : fieldGroup.getBoundPropertyIds()) { layout.addComponent(fieldGroup.buildAndBind(propertyId)); } There is nothing on the page. Nothing is generated, no form fields. Am I missing something? I'm completely new to Vaadin to be honest. On the second hand, I'm wondering how to deal with the ID field. It is generated automatically, so the user shall have NO impact on this vaule... I'm lost.
tagged with: vaadin7
type: AnsweredQuestion
tagged with: java
tagged with: vaadin
has answer: http://stackoverflow.com/a/26273484
type: Question
tagged with: jpa

http://stackoverflow.com/a/26310439
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41288403
type: Answer
has body: since strings are immutable in java and I can't just set it to null and change it when I need to. Sure you can. If you are initializing a String reference to null and then assigning to it a different String, you are not changing any String, you are just changing the String reference. However, as is I'm getting an error on the next to last line that strTitle may not have been initialized. String strTitle = null; will solve your problem.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26310423
has comment: http://stackoverflow.com/comment/41288271
answers question: http://stackoverflow.com/q/26310423
has comment: http://stackoverflow.com/comment/41288254
upvote count: 1

http://stackoverflow.com/q/26212323
has comment: http://stackoverflow.com/comment/41107184
downvote count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/41107545
tagged with: jquery
has comment: http://stackoverflow.com/comment/41109252
tagged with: ajax
has comment: http://stackoverflow.com/comment/41108774
has title: Can I access a url with dynamic port through ajax call?
has comment: http://stackoverflow.com/comment/41107324
has comment: http://stackoverflow.com/comment/41107378
favorite count: 0
has body: Consider the following code.. $.ajax({ url: "http://***.*.*.*:9001/jolokia/*", dataType:"json", async: false }).responseText; Can I access a url with dynamic port? Such as, if the port keeps on changing dynamically can the ajax call get the data from that url?
answer count: 0
has comment: http://stackoverflow.com/comment/41107520
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41108055
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41107424
type: Question

http://stackoverflow.com/comment/41237384
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/26282820
has text: I have no idea what you are asking.
type: Comment

http://stackoverflow.com/q/26347882
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26353445
possible better answer: http://stackoverflow.com/a/26353015
answer count: 2
has title: Cannot find symbol error when adding android support lib v4 in intellij
has answer: http://stackoverflow.com/a/26353015
tagged with: intellij-idea
score: 0
has comment: http://stackoverflow.com/comment/41356667
accepted answer: http://stackoverflow.com/a/26353445
has comment: http://stackoverflow.com/comment/41356640
tagged with: android
type: AnsweredQuestion
has body: I am trying to add android support lib v4 into my project. The problem I am facing is the project is not able to find the support lib. I just downloaded API20 and API 19 plus support files and this doesn't seem to work for me. The error message I am getting is here: My project structure looks like this: My libs folder is like this: I tried removing this and adding it again.. I even tried removing the entire sdk and doing it all again but still getting errors in v4 support lib. I am not sure what I am missing here.

arrays
tags question: http://stackoverflow.com/q/26201630
tags question: http://stackoverflow.com/q/26248670
tags question: http://stackoverflow.com/q/26292472
tags question: http://stackoverflow.com/q/26248593
tags question: http://stackoverflow.com/q/26237242
tags question: http://stackoverflow.com/q/26303062
tags question: http://stackoverflow.com/q/26247846
tags question: http://stackoverflow.com/q/26333486
tags question: http://stackoverflow.com/q/26318048
tags question: http://stackoverflow.com/q/26329082
tags question: http://stackoverflow.com/q/26203041
tags question: http://stackoverflow.com/q/26321024
tags question: http://stackoverflow.com/q/26207923
tags question: http://stackoverflow.com/q/26198814
type: Tag
tags question: http://stackoverflow.com/q/26241168
tags question: http://stackoverflow.com/q/26213286
tags question: http://stackoverflow.com/q/26196992
tags question: http://stackoverflow.com/q/26221243
tags question: http://stackoverflow.com/q/26285770
tags question: http://stackoverflow.com/q/26230460
tags question: http://stackoverflow.com/q/26200055
tags question: http://stackoverflow.com/q/26346475
tags question: http://stackoverflow.com/q/26220344
tags question: http://stackoverflow.com/q/26290929
tags question: http://stackoverflow.com/q/26209730
tags question: http://stackoverflow.com/q/26321128
tags question: http://stackoverflow.com/q/26212317
tags question: http://stackoverflow.com/q/26223646
tags question: http://stackoverflow.com/q/26205399
tags question: http://stackoverflow.com/q/26327998
tags question: http://stackoverflow.com/q/26219008
tags question: http://stackoverflow.com/q/26339360
tags question: http://stackoverflow.com/q/26322804
tags question: http://stackoverflow.com/q/26199417
tags question: http://stackoverflow.com/q/26288284
tags question: http://stackoverflow.com/q/26312114
tags question: http://stackoverflow.com/q/26200851
tags question: http://stackoverflow.com/q/26282468
tags question: http://stackoverflow.com/q/26290904
tags question: http://stackoverflow.com/q/26203382
tags question: http://stackoverflow.com/q/26196109
tags question: http://stackoverflow.com/q/26196126
tags question: http://stackoverflow.com/q/26312336
tags question: http://stackoverflow.com/q/26319579
tags question: http://stackoverflow.com/q/26266431
tags question: http://stackoverflow.com/q/26318848
tags question: http://stackoverflow.com/q/26270294
tags question: http://stackoverflow.com/q/26292491
tags question: http://stackoverflow.com/q/26290394
tags question: http://stackoverflow.com/q/26219118
tags question: http://stackoverflow.com/q/26341449
tags question: http://stackoverflow.com/q/26310775
tags question: http://stackoverflow.com/q/26319764
tags question: http://stackoverflow.com/q/26205587
tags question: http://stackoverflow.com/q/26293855
tags question: http://stackoverflow.com/q/26213112
tags question: http://stackoverflow.com/q/26304924
tags question: http://stackoverflow.com/q/26199950
tags question: http://stackoverflow.com/q/26205954
tags question: http://stackoverflow.com/q/26208557
tags question: http://stackoverflow.com/q/26293330
tags question: http://stackoverflow.com/q/26304587
tags question: http://stackoverflow.com/q/26334813
tags question: http://stackoverflow.com/q/26309850
tags question: http://stackoverflow.com/q/26351874
tags question: http://stackoverflow.com/q/26257746
tags question: http://stackoverflow.com/q/26217837
tags question: http://stackoverflow.com/q/26240449
tags question: http://stackoverflow.com/q/26319497
tags question: http://stackoverflow.com/q/26330581
tags question: http://stackoverflow.com/q/26327156
tags question: http://stackoverflow.com/q/26280509
tags question: http://stackoverflow.com/q/26327329
tags question: http://stackoverflow.com/q/26329169
tags question: http://stackoverflow.com/q/26318693
tags question: http://stackoverflow.com/q/26323093
tags question: http://stackoverflow.com/q/26227804
tags question: http://stackoverflow.com/q/26269795
tags question: http://stackoverflow.com/q/26242176

http://stackoverflow.com/comment/41157101
has text: that code does not compile, KILOMETER_IN_METERS is a long. you would need to cast it to an int first.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26238791
type: Comment

http://stackoverflow.com/a/34151342
upvote count: 4
has comment: http://stackoverflow.com/comment/56049741
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/26246839
has body: I had a same problem which I just resolved, by understanding how Android Studio indexes files, As you know Building an Android App is quite complicated process. So Android studio has some internal references which it keeps getting updated on change of every file that you have created. I arrived at this post while searching for the solution, This is how I got this problem I usually wont create an activity under the main project package, I create sub packages to organize files as per the design pattern that I use, for eg If my APP name is com.example.testingaravind then inside that I usually create packages such as activites, services, models, managers etc ... So today I just created an activity first and then moved that activity into activites package via Android Studio, I started facing the same issue what you have described, Below was my source code public class BootstrapActivity extends ActionBarActivity { private static final String TAG = "BootstrapActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bootstrap); } public void startServiceOnClickHandler(View view) { Intent intent = new Intent(BootstrapActivity.this , AnalyzerService.class); startService(intent); } } In the method startServiceOnClickHandler it was showing an error saying, "Cannot resolve constructor Intent" I searched a lot in google and found that When I move a file from one package to other package, my manifest file wont get updated, in the manifest we mention the activity name and its package path in my case it should be android:name=".activities.BootstrapActivity" But it was android:name=".BootstrapActivity" Because of this, Android studio was unaware that a class called BootstrapActivity exists inside the activities folder, This seems to be a bug in the way how android studio works. Android Studio has to update manifestfile when I move the activity class file from one package to another package. I am post…
type: Answer

http://stackoverflow.com/comment/41256906
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26293423
has text: @AvinashRaj : i have posted my whole code.
type: Comment

http://stackoverflow.com/comment/41184135
type: Comment
comment on: http://stackoverflow.com/a/26253490
has text: ok will have another look; at least your config is more concise now :-)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41202135
comment on: http://stackoverflow.com/a/26263444
has text: Your recommendation #1 was close, I figured it out shortly after posting the question (after fighting with it for hours). It was the "applicationID" set in build.gradle. It was set as the non-misspelled version of the package name. #2 is not an issue, since this is still in development. I haven't signed an APK to send to the Google Store.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26208381
favorite count: 0
duplicate of: http://stackoverflow.com/q/288861
tagged with: junit
has body: I was writing the Junit code below in eclipse kepler. I pressed the shortcut ctrl+shift+o to automatically import all the packages that are needed by this code. The shortcut only imported Test and gave me an error in assertEquals - The method assertEquals(int, int) is undefined for the type FootballTeamTest import org.junit.Test; public class FootballTeamTest { @Test public void constructorShouldSetGamesWon() { FootballTeam team = new FootballTeam(3); assertEquals(3, team.getGamesWon()); } } This was fixed by adding an import import static org.junit.Assert.*;. Why does eclipse not do this import automatically ? Related post - What is a good use case for static import of methods? Go to the answer for Junit4 in that question. Amazing.
answer count: 0
has title: Eclipse import shortcut does not work as expected
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/420791
upvote count: 1
score: 1
tagged with: java
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/288861
downvote count: 0

http://stackoverflow.com/q/26328040
tagged with: fxml
has comment: http://stackoverflow.com/comment/47311181
has body: I'm using IntelliJ IDEA 13.1.5, I used to work with Eclipse. I'm working on JavaFX application, I try to load FXML file within my MainApp class using getClass().getResource(). I read the documentation and I try several idea, at the end I have null. This is the hierarchy : dz.bilaldjago.homekode.MainApp.java dz.bilaldjago.homekode.view.RootLayout.FXML This is the code snippet I used: FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("view/RootLayout.fxml")); I tried other solution such giving the url from the root and using the classLoader the result is the same. Any idea please
linked to: http://stackoverflow.com/q/4301329
tagged with: javafx
has answer: http://stackoverflow.com/a/70503248
downvote count: 1
has answer: http://stackoverflow.com/a/61801947
score: 46
type: Question
has answer: http://stackoverflow.com/a/68032147
has answer: http://stackoverflow.com/a/65173942
tagged with: java
has answer: http://stackoverflow.com/a/48354194
has answer: http://stackoverflow.com/a/71254595
upvote count: 47
has answer: http://stackoverflow.com/a/57745716
tagged with: intellij-idea
has title: IntelliJ IDEA - getClass().getResource("...") return null
has answer: http://stackoverflow.com/a/47907347
has answer: http://stackoverflow.com/a/47906849
has answer: http://stackoverflow.com/a/78779533
answer count: 17
favorite count: 0
has answer: http://stackoverflow.com/a/69314521
has answer: http://stackoverflow.com/a/26328171
has answer: http://stackoverflow.com/a/60129397
has answer: http://stackoverflow.com/a/71401400
has comment: http://stackoverflow.com/comment/135976499
has answer: http://stackoverflow.com/a/67366018
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40065607
has answer: http://stackoverflow.com/a/79055857

wamp
tag name: wamp
tags question: http://stackoverflow.com/q/26212709
tags question: http://stackoverflow.com/q/26327722
type: Tag

http://stackoverflow.com/q/26232450
has comment: http://stackoverflow.com/comment/41202558
score: 0
has comment: http://stackoverflow.com/comment/41162855
type: UnansweredQuestion
tagged with: maven
tagged with: java-8
has comment: http://stackoverflow.com/comment/41178603
has title: JDK8u20 compilation error with provided dependency
answer count: 0
tagged with: java
type: Question
has body: I use maven (3.2.1) to build our project. My project depends on some propretiary libraries that we have in local maven repo. Those libraries are declared with provided scope (because we don't need them in distribution). Our dependencies depends, of course, on some other libs, e.g. apache-scxml lib, but our code don't do anything with any class from apache-scxml. And in JDK8u20 we cannot build our system anymore, it fails with exception: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project &lt;myproject&gt;: Compilation failure [ERROR] &lt;myclass&gt;.java:[47,45] error: cannot access SCXMLListener But project builds completely fine with JDK8u5 and JDK8u11. I tried to find some info and only thing I found is here: https://issues.jboss.org/browse/FORGE-2019 but I don't think its the same, or at least I cannot understand it. Can someone explain to me what can be the reason that it compiles with JDK8u11 and not with u20?

http://stackoverflow.com/q/26339226
tagged with: android
has comment: http://stackoverflow.com/comment/41349369
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41343024
type: Question
has body: I have a problem, I have this structure in parse.com in "VerificationCode" db: When someone inserts a code in my app, it automatically adds in the "attachedUser" column the id of the user who is stored locally and I call it "ParseInstallObject.codigo2" and I get the id of the user for example to see it in a textview, etc. The problem is that I want to check if the user id exists in parse or not; and if it exists do something or if not exist do another thing. I used a code that I see in the documentation of parse.com but it always shows that the code exists. This is my code: ParseQuery&lt;ParseObject&gt; query2 = ParseQuery.getQuery("VerificationCode"); query2.whereEqualTo("attachedUser", ParseInstallObject.codigo2); query2.findInBackground(new FindCallback&lt;ParseObject&gt;() { public void done(List&lt;ParseObject&gt; scoreList, ParseException e) { if (e == null) { comprobar.setText("exist"); comprobar2.setText("exist"); } else { comprobar.setText("no exist"); comprobar2.setText("no exist"); } } }); How can I see if the user has a valid code or not?
score: 0
has comment: http://stackoverflow.com/comment/41349268
has title: How to get if a code exist in parse.com?
has answer: http://stackoverflow.com/a/26343849
accepted answer: http://stackoverflow.com/a/26343849
has comment: http://stackoverflow.com/comment/41349861
answer count: 1
has comment: http://stackoverflow.com/comment/41349176
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/41342401

http://stackoverflow.com/comment/41372233
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26349106
type: Comment
has text: Oh. I'm afraid that your question is not focusing your problem.Anyway, using the component I've recommended you you only have to give a Set<Pair<String,String> with headerName and value.. that's all. If you want to do it manually, change addHeader for setHeader. For instance: request.setHeader("Content-Type", "text/x-gwt-rpc; charset=UTF-8"); I hardly ever use headers different from "Content-Type", "application/json", but it's up to you!

http://stackoverflow.com/q/26339237
has comment: http://stackoverflow.com/comment/41347793
has answer: http://stackoverflow.com/a/26339439
accepted answer: http://stackoverflow.com/a/26339439
has answer: http://stackoverflow.com/a/26341945
score: 28
has body: This question might sound weird to Java people but if you try to explain this, it would be great. In these days I am clearing some of Java's very basic concept. So I come to Inheritance and Interface topic of Java. While reading this I found that Java does not support Multiple Inheritance and also understood that, what I am not able to understand that why everywhere Diamond figure issue(At least 4 class to create diamond) is discussed to explain this behavior, Can't we understand this issue using 3 classes only. Say, I have class A and class B, these two classes are different (they are not child class of common class) but they have one common method and they look like :- class A { void add(int a, int b) { } } class B { void add(int a, int b) { } } Ok,Now say if Java supports Multiple inheritance and if there is one class which is the subclass of A and B like this :- class C extends A,B{ //If this was possible @Override void add(int a, int b) { // TODO Auto-generated method stub super.add(a, b); //Which version of this, from A or B ? } } then compiler will not be able to find which method to call whether from A or B and that is why Java does not support Multiple Inheritance. So is there any thing wrong with this concept ? When I read about this topic I was able to understand Diamond issue, but I am not able to understand why people are not giving example with three class (If this is valid one, because we used only 3 classes to demonstrate issue so its easy to understand by comparing it to Diamond issue.) Let me know whether this example does not fit to explain issue or this can also be referred to understand issue. Edit: I got one close vote here stating that question is not clear. Here is main question :- Can I understand Why "Java does not support Multiple Inheritance" with 3 classes only as described above or I must need to have 4 classes (Diamond structure) to understand the issue.
favorite count: 0
has comment: http://stackoverflow.com/comment/41340967
has answer: http://stackoverflow.com/a/26339505
tagged with: diamond-problem
has comment: http://stackoverflow.com/comment/41350499
has answer: http://stackoverflow.com/a/26367444
has comment: http://stackoverflow.com/comment/41349204
possible better answer: http://stackoverflow.com/a/26339505
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26339511
type: Question
has title: Why is the diamond case with its common ancestor used to explain Java multiple inheritance issue, instead of two unrelated parent classes?
tagged with: java
answer count: 6
has comment: http://stackoverflow.com/comment/41340928
linked to: http://stackoverflow.com/q/22591499
has comment: http://stackoverflow.com/comment/41341396
has answer: http://stackoverflow.com/a/26339359
downvote count: 1
has comment: http://stackoverflow.com/comment/41342491
upvote count: 29
tagged with: multiple-inheritance
has comment: http://stackoverflow.com/comment/41341147

http://stackoverflow.com/a/26318688
score: 16
answers question: http://stackoverflow.com/q/26318341
has comment: http://stackoverflow.com/comment/41304940
has comment: http://stackoverflow.com/comment/41302783
downvote count: 2
has comment: http://stackoverflow.com/comment/41312211
has comment: http://stackoverflow.com/comment/41304396
has comment: http://stackoverflow.com/comment/41304138
has comment: http://stackoverflow.com/comment/41304205
has comment: http://stackoverflow.com/comment/41312200
upvote count: 18
type: Answer
has body: This should be a question to James Gosling, I suppose. The initial design of Java was about OOP and simplicity, not about speed. If you have a better idea of how multidimensional arrays should work, there are several ways of bringing it to life: Submit a JDK Enhancement Proposal. Develop a new JSR through Java Community Process. Propose a new Project. UPD. Of course, you are not the first to question the problems of Java arrays design. For instance, projects Sumatra and Panama would also benefit from true multidimensional arrays. "Arrays 2.0" is John Rose's talk on this subject at JVM Language Summit 2012.
has comment: http://stackoverflow.com/comment/41304158
has comment: http://stackoverflow.com/comment/41312163
has comment: http://stackoverflow.com/comment/41304160

http://stackoverflow.com/a/26271908
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26270290
answers question: http://stackoverflow.com/q/26270290
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: In Java, a zero byte expressed as a string is "\0" not "0". If you correct your example as follows, the results match: String data = "secretdata"; String key = "secret\0\0\0\0\0\0\0\0\0\0"; String iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; In the case of the IV, it's probably just easier to write: byte[] iv = new byte[&lt;block size&gt;]; In the final line of your code, you access sun.misc.BASE64Encoder(). Accessing anything that starts with sun.* is frowned upon, since these are internal classes. Consider instead using: return DatatypeConverter.printBase64Binary(encrypted);

http://stackoverflow.com/comment/41148236
type: Comment
has text: @AvinashRaj - please explain. How / why does that avoid backtracking?
comment on: http://stackoverflow.com/q/26234329
score: 0
type: QuestionComment

http://stackoverflow.com/a/26302303
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26301260
downvote count: 0
has body: Looks like you should be able to do: MediaType guavaMediaType = MediaType.parse(restletMediaType.getName());

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/26305332
tag name: csv
tags question: http://stackoverflow.com/q/26339339
tags question: http://stackoverflow.com/q/26204604
tags question: http://stackoverflow.com/q/26285086
tags question: http://stackoverflow.com/q/26203191
tags question: http://stackoverflow.com/q/26265389
tags question: http://stackoverflow.com/q/26199598
tags question: http://stackoverflow.com/q/26338420
tags question: http://stackoverflow.com/q/26323583
tags question: http://stackoverflow.com/q/26231952
tags question: http://stackoverflow.com/q/26351126

http://stackoverflow.com/q/26290440
type: Question
tagged with: android-fragments
tagged with: java
has body: I've started coding a small app using Android Studio's pre-defined tabbed Layout with Fragments (SectionsPagerAdapter, ViewPager). I've got a task running in the MainActivity.class main/Ui thread which at one point shows a dialog with the onClick method @Override public void onClick(DialogInterface dialog, int which) { category = eventsToDisplay.get(which); averageFragment.category = category; dialog.dismiss(); } But I can't get the averageFragment.category = category; assignment to work. In the MainActivity's onCreate method I call averageFragment = (AverageFragment) getSupportFragmentManager().findFragmentByTag(AverageFragment.tag); but this gives me a NullPointerException. I have already tried the following solutions (most of which are from this website): getSupportFragmentManager().findFragmentById(R.id.fragment_average) getSupportFragmentManager().findFragmentByTag(AverageFragment.tag) &lt;-- basically a static variable created upon instantiating the fragment. mSectionsPageAdapter.getItem(1) all of which give me either a NPE or IllegalStateException.FragmentNotAttachedToView. Other relevant code: public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { // getItem is called to instantiate the fragment for the given page. switch (position) { case 0: return InspectionFragment.newInstance(position + 1); case 1: return AverageFragment.newInstance(position + 1); case 2: return RegulationsFragment.newInstance(position + 1); } return null; } @Override public int getCount() { // Show 3 total pages. return 3; } @Override public CharSequence getPageTitle(int position) { Locale l = Locale.getDefault(); switch (position) { case 0: return getString(R.string.title_section1).toUpperCase(l); case 1: return getString(R.string.title_section2).toUpperCase(l); case 2: return getString(R.string.title_section3).toUpperCase(l); } return null; } } Any ideas on how to…
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26290710
tagged with: android
has title: Android: Access a fragment instance from MainActivity
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26290710

http://stackoverflow.com/comment/41236048
comment on: http://stackoverflow.com/q/26236488
type: Comment
type: QuestionComment
has text: @EngineerDollery it's not my project, I've to maintain only! I've edited my question, now the parent project reference the correct subproject (Foo).
score: 0

http://stackoverflow.com/q/26270795
has comment: http://stackoverflow.com/comment/41215714
has title: Remove White color strip on the left side of bar in stacked bar chart in JasperReports
has body: Can anybody help me to Remove White color strip on the left side of bar in stacked bar chart in JasperReports please. Need solution as soon as possible and bars are on exactly on the line please click this url for screen shot . Please see this the customizer class i am using to set properties for stacked bar chart in iReport. public void customize(JFreeChart chart, JRChart jasperChart) { BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); CategoryItemLabelGenerator generator = new StandardCategoryItemLabelGenerator(); /* Remove Bar Border*/ renderer.setDrawBarOutline(false); //Spaces between bars renderer.setItemMargin(0.05); renderer.setSeriesPaint(0, Color.red); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinesVisible(false); CategoryAxis axis = plot.getDomainAxis(); axis.setLowerMargin(0.02); axis.setUpperMargin(0.02); } I have used "old" look StandardBarPainter to remove the white strip but it is unable to set setBarPainter it is showing The method setBarPainter(StandardBarPainter) is undefined for the type BarRenderer. i am new to java plase help please find the below image to fix the error.
upvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/7076305
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: jfreechart
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/41342150

http://stackoverflow.com/comment/41346173
comment on: http://stackoverflow.com/a/26332400
type: Comment
has text: @Chax If you copy-paste my code does it work for you? If so, your modification broke it and you will need to understand why.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26329334
has comment: http://stackoverflow.com/comment/41340810
has body: I found some syntax errors in the code. Firstly, if possible use proper name for saving an image. Here I have taken a string filename and assigned the value test.jpg (You can change this as per your requirement). In the setHeader line, I found two syntax errors. There was an extra / and " String filename = "test.jpg"; byte[] data = getImageData(path,imageName); response.setHeader("Cache-Control", "no-store"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", -1); response.setHeader("Content-Disposition", "attachment;fileName=" + filename); response.setContentLength(data.length); response.setContentType("application/octet-stream"); responseOutputStream = response.getOutputStream(); responseOutputStream.write(data, 0, data == null ? 0: data.length); responseOutputStream.flush();
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41352232
answers question: http://stackoverflow.com/q/26328487

http://stackoverflow.com/a/26222983
upvote count: 3
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41127569
answers question: http://stackoverflow.com/q/26222864
has body: You could make it easier to understand by writing it like this: /** * Computes the intersection of two Lists of Strings, returning it as a new ArrayList of Strings * * @param list1 one of the Lists from which to compute an intersection * @param list2 one of the Lists from which to compute an intersection * * @return a new ArrayList of Strings containing the intersection of list1 and list2 */ public ArrayList&lt;String&gt; intersection( List&lt;String&gt; list1, List&lt;String&gt; list2) { ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(list1); result.retainAll(list2); return result; }
type: Answer

http://stackoverflow.com/a/26344942
upvote count: 1
has comment: http://stackoverflow.com/comment/41358229
downvote count: 1
has comment: http://stackoverflow.com/comment/41358157
has comment: http://stackoverflow.com/comment/41357971
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26286055
has comment: http://stackoverflow.com/comment/41357564
answers question: http://stackoverflow.com/q/26286055
has body: The solution involved right-clicking on various folders in the eclipse project, choosing Build Path.. and then using trial and error to select either Use as Source Folder, Configure Build Path, or Remove from Build Path for various folders in an attempt to recreate the build path required by the project's architecture. Some of the concepts in lexicore's answer were helpful, but ultimately required manual build path changes in eclipse before the app could marshal without throwing errors. There must be a way for the architecture of hyperjaxb to be evolved so that these manual steps are not required. I would imagine that changing the pom to define the build path properly would be a short term solution. JAXB allows generated code to be imported into eclipse without all these manual configuration requirements, perhaps because the code in the JAXB jars may be agnostic with respect to directory structure.
score: 0

http://stackoverflow.com/comment/41298064
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26315574
has text: `task("lol")` should work just fine. At any rate, I'm not really sure what problem you're trying to solve via this question.
score: 0

http://stackoverflow.com/comment/41185625
type: Comment
has text: @Pan Bydlak: I added the solution for the “very simple problem” which will work as long as you don’t extend the problem definition. After all, it’s not bad to be able to compare the simple but not scalable solution of a simple problem with the more complex but potentially scalable solution. Btw. additional classes like the `Tree` helper class can become utilities in the future which you will use without thinking about it just as you use collection classes today…
comment on: http://stackoverflow.com/a/26241860
type: AnswerComment
score: 0

linux
tags question: http://stackoverflow.com/q/26256393
tags question: http://stackoverflow.com/q/26258521
tags question: http://stackoverflow.com/q/26265478
tags question: http://stackoverflow.com/q/26276619
tags question: http://stackoverflow.com/q/26343636
tags question: http://stackoverflow.com/q/26228993
tags question: http://stackoverflow.com/q/26304648
tags question: http://stackoverflow.com/q/26275190
tags question: http://stackoverflow.com/q/26231314
tags question: http://stackoverflow.com/q/26253838
tags question: http://stackoverflow.com/q/26316124
tags question: http://stackoverflow.com/q/26350096
type: Tag
tags question: http://stackoverflow.com/q/26323987
tags question: http://stackoverflow.com/q/26257642
tags question: http://stackoverflow.com/q/26217127
tags question: http://stackoverflow.com/q/26331712
tags question: http://stackoverflow.com/q/26274105
tags question: http://stackoverflow.com/q/26237484
tags question: http://stackoverflow.com/q/26236815
tags question: http://stackoverflow.com/q/26289412
tags question: http://stackoverflow.com/q/26335236
tags question: http://stackoverflow.com/q/26316020
tags question: http://stackoverflow.com/q/26298935
tag name: linux
tags question: http://stackoverflow.com/q/26256473
tags question: http://stackoverflow.com/q/26215929
tags question: http://stackoverflow.com/q/26348468
tags question: http://stackoverflow.com/q/26259342
tags question: http://stackoverflow.com/q/26301029
tags question: http://stackoverflow.com/q/26219438
tags question: http://stackoverflow.com/q/26264131
tags question: http://stackoverflow.com/q/26219266
tags question: http://stackoverflow.com/q/26335119
tags question: http://stackoverflow.com/q/26285133
tags question: http://stackoverflow.com/q/26227839
tags question: http://stackoverflow.com/q/26318872
tags question: http://stackoverflow.com/q/26245868
tags question: http://stackoverflow.com/q/26352535
tags question: http://stackoverflow.com/q/26343377

http://stackoverflow.com/comment/42316895
comment on: http://stackoverflow.com/a/26878514
has text: I am fairly new guy to spring, but i think what you have suggested is fair enough.Can you please define significance difference between these three approaches and their appropriate use case ?Will appreciate it !
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26267034
has title: Woodstox Stax2 XML W3C Schema validation - unique constraint issue
score: 0
tagged with: stax
tagged with: xsd
type: UnansweredQuestion
tagged with: xsd-validation
has answer: http://stackoverflow.com/a/26284392
tagged with: woodstox
tagged with: java
has comment: http://stackoverflow.com/comment/41230915
type: Question
answer count: 1
has body: I've been trying to improve performance of XML validation against an XSD schema, in particular with respect to XSD unique constraints, and decided to give a try to Woodstox. I pretty much follow this example, to the extent that I change the XMLValidationSchema.SCHEMA_ID_DTD into XMLValidationSchema.SCHEMA_ID_W3C_SCHEMA. The problem I experience, though, is that the Woodstox validator finds an XML valid even if the XML violates a unique constraint. Switching back in my java code to the "regular" javax.xml.validation.Schema, javax.xml.stream.XMLStreamReader, and javax.xml.validation.Validator the uniqueness constraint violation is detected properly. Also, I can confirm that the Woodstox validator does something, since, e.g., I can see it saying 'XML invalid' if, e.g., I have a negative number where a positive one is XSD-expected in the XML. Might that be that the tools I've been using until now are fine with respect to uniqueness checks on unqualified elements, whereas Woodstox is not? It's the only idea that comes to my mind... Also, is anyone in the position to confirm that Woodstox would perform better than Xerces based tools (pretty much everything existing in Java?) validating the unique constraints? Any help greatly appreciated!

eclipselink
tags question: http://stackoverflow.com/q/26254142
type: Tag
tags question: http://stackoverflow.com/q/26288936
tags question: http://stackoverflow.com/q/26299288
tags question: http://stackoverflow.com/q/26329901
tags question: http://stackoverflow.com/q/26244510
tags question: http://stackoverflow.com/q/26336419
tags question: http://stackoverflow.com/q/26266384
tag name: eclipselink
tags question: http://stackoverflow.com/q/26237855

http://stackoverflow.com/a/26292207
type: Answer
has comment: http://stackoverflow.com/comment/41255023
answers question: http://stackoverflow.com/q/26291835
has comment: http://stackoverflow.com/comment/41255112
score: 0
has body: For getting updates make use of the LocationListener interface you have implemented instead of using if (locationManager != null) { location = locationManager .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (location != null) { latitude = location.getLatitude(); longitude = location.getLongitude(); } } do the following in your onLocationChanged() @Override public void onLocationChanged(Location location) { latitude = location.getLatitude(); longitude = location.getLongitude(); } This makes sure that when a new location update is available it is stored in your respective variables. PS: For getting location updates in the background, make sure that your service is not terminated when the app is closed. You could also make use of SharedPreferences if you want to persist changes even when the phone is restarted.
has comment: http://stackoverflow.com/comment/41254898

http://stackoverflow.com/comment/41619884
comment on: http://stackoverflow.com/q/26285133
type: Comment
type: QuestionComment
score: 0
has text: @bestsss thanks. I haven't tried on a local machine. Will give it a shot.

http://stackoverflow.com/comment/55552565
has text: @yqritc I have used the library you have mentioned here , I am getting problem with multiple DataBinders , I have posted a question on Stackoverflow .Here is the link http://stackoverflow.com/questions/33894351/manage-multiple-view-types-recyclerview . Help me plz.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29394173
type: Comment

http://stackoverflow.com/q/26327722
favorite count: 0
has title: JSOUP and Android Emulator - unable to resolve host
tagged with: android
tagged with: wamp
has comment: http://stackoverflow.com/comment/41322177
has comment: http://stackoverflow.com/comment/41319545
upvote count: 1
has answer: http://stackoverflow.com/a/26329132
type: AnsweredQuestion
score: 1
tagged with: java
has body: I have virtual host on my Windows 8 - http://test.localhost to my localhost on wamp and test site. If i use this address in browsers then all working well. If i use this in jsoup and my android apps: Document doc = Jsoup.connect("http://test.localhost").post(); Then I have warning: java.net.UnknownHostException: Unable to resolve host "test.localhost": No address associated with hostname How can I connect by jsoup with my localhost and Android emulator? EDIT: URLs from Internet, for example stackoverflow.com etc working fine. I would like connect emulator with my localhost.
type: Question
tagged with: jsoup
tagged with: apache
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26329132

http://stackoverflow.com/comment/41106698
score: 3
comment on: http://stackoverflow.com/q/26212079
has text: "How much freakin stuff do I need to write on this in ordet o make a post." More freakin stuff than this. Just dumping code does not make a question. We are no debugging service.
type: Comment
type: QuestionComment

galaxy
type: Tag
tag name: galaxy
tags question: http://stackoverflow.com/q/26304170

http://stackoverflow.com/comment/41231391
has text: You probably want to add `break;` after printing `Goodbye` to exit the for-loop and terminate the program.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26279208

http://stackoverflow.com/q/26276835
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26277195
has answer: http://stackoverflow.com/a/26277255
score: 0
tagged with: layout
has answer: http://stackoverflow.com/a/26277084
has body: I have a progressbar in drawable. I want it to fill slowly whenset progress is done. That is it I should be able to see it filling, not in a flash. Also I have a texview inside that progressbar, I want that textview to keep revolving and as soon as the set progress filling completes, the textview should stop revolving and display progress. Here is my code: Layout: <ProgressBar android:id="@+id/circularProgressBar" style="?android:attr/progressBarStyleHorizontal" android:layout_width="150dip" android:layout_height="150dip" android:layout_centerInParent="true" android:indeterminate="false" android:max="100" android:progress="0" android:progressDrawable="@drawable/progressbar" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="47sp" android:textStyle="bold" android:textColor="@color/Theme" /> </RelativeLayout> progressbar.xml <solid android:color="@color/Red" /> <solid android:color="@color/Theme" /> Also, I have a textview inside this progressbar, I want it to keep rotating until the progress is done. How to do that, I have an animation for that but it is not working. Here is the code: rotate.xml android:duration="4000" android:fromdegrees="0" android:pivotx="50%" android:pivoty="50%" android:todegrees="360" android:toyscale="0.0" It gives warnings like this: Unexpected text found in layout file: "android:fromdegrees="0" android:pivotx="50%" android:pivoty="50%" android:todegrees="360" android:to..."
accepted answer: http://stackoverflow.com/a/26277770
tagged with: progress-bar
has title: How to make progress bar fill slowly
answer count: 5
possible better answer: http://stackoverflow.com/a/26277255
tagged with: android
tagged with: animation
has answer: http://stackoverflow.com/a/26277770
has answer: http://stackoverflow.com/a/31724727

http://stackoverflow.com/q/26305703
tagged with: data-structures
has comment: http://stackoverflow.com/comment/41280168
has answer: http://stackoverflow.com/a/26306258
has title: How to use AbstractList
has comment: http://stackoverflow.com/comment/41279946
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41279604
accepted answer: http://stackoverflow.com/a/26306258
has comment: http://stackoverflow.com/comment/41279738
has body: I am newer to Java just started it a while back. I am trying to make chat messenger (Client-Server) and I need a data structure in which I can store online users (One socket and one String containing Username). Now I did a lot of research and thought AbstractList could help me decently, but I faced a problem rather quickly public class Collections &lt;E&gt; extends AbstractList&lt;E&gt; { private int size; private E[] list; public Collections() { size = 0; list = new E[50]; } @Override public E get(int index) { return list[index]; } @Override public boolean add(E element) { return false; } @Override public int size() { return list.length; } public static void main(String[] args) { Collections &lt;String&gt;obj = new Collections(); obj.add(new String("1")); obj.add(new String("5")); System.out.println("Size = " + obj.size()); } } This is my code and frankly I couldn't get a way around the add function... I tried using list = new E[50]; but that gives generic initialization error. In short I have no idea how to initialize the list object. So now I have Three questions: Is my approach to creating a list of all the clients on Server good? What should I do with the add() function? Why are there '' twice in the first line? Obviously it is a template but wouldn't you need it only once? Obviously you need it both places so what is the first one for and what is the second one for? (The Tutorial I learnt from didn't quiet explain it)
has comment: http://stackoverflow.com/comment/41281549
type: Question
possible better answer: http://stackoverflow.com/a/26305852
answer count: 2
has answer: http://stackoverflow.com/a/26305852
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41279623

http://stackoverflow.com/q/26234338
tagged with: web-services
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30262900
tagged with: java
has title: How to send a message from java restful server to gcm server
type: Question
has body: I have a java restful webservice (1) and an Android application that consumes this (2). A third application is responsible for entering data into the database via the webservice. I want that when the third application enter new data in my db, the webservice notifies the android application by GCM. My Android application is able to receive the reg-Id GCM. (I have the project created in google developers etc, server api key..) I tried this: when the third app accesses the URI to enter data byPOST, sending the message to the google servers. DOES NOT WORK @POST @Override @Consumes({"application/xml", "application/json"}) public void create(Usuarios entity) { String deviceId=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...; Sender sender = new Sender("AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXX"); Message message = new Message.Builder() .addData("message", "this is the message") .addData("other-parameter", "some value") .build(); Result result = sender.send(message, deviceId, 3); super.create(entity); } I have also tried to create a servlet. But does not work @WebServlet(name = "NewServlet_1", urlPatterns = {"/NewServlet_1"}) public class NewServlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { out.println(" "); out.println(" "); out.println(" "); out.println(" Servlet NewServlet "); out.println(" "); out.println(" "); out.println(" Servlet NewServlet at " + request.getContextPath() + " "); out.println(" "); out.println(" "); } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Sender sender = new Sender("AIzaSyBNFur3sFJpMujkVYW9rzEq3udI0khRCOI"); …
score: 0
accepted answer: http://stackoverflow.com/a/30262900
answer count: 1
tagged with: jax-rs
tagged with: google-cloud-messaging

http://stackoverflow.com/a/26326243
type: Answer
upvote count: 1
has body: I believe at some point you will have to go through each username and determine and perform the validation on that item to know if it should be rejected. If I am understanding correctly you have an application that accepts your data and needs to validate it. That application makes a web service call to another application that has the data store? If you have control over the web service API between the two applications you might consider changing to allow multiple records to be sent at a time. That would reduce the number of connections being made between the two applications. As to to whether or not doing this the way you describe, or the way I suggest would make a significant different in performance I can't say. There are too many factors involved to really be sure until you actually use it.
answers question: http://stackoverflow.com/q/26325202
downvote count: 0
has comment: http://stackoverflow.com/comment/41321739
score: 1

http://stackoverflow.com/q/26335815
answer count: 2
has body: I am using the log4j.properties in My Selenium Package. Every Time I run the Module the below 3 Lines are always been added in the Console and the Applications.log file. log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. For Reference, below is the log4j.properties Code: #Application Logs log4j.logger.devpinoyLogger = DEBUG,dest1 log4j.appender.dest1=org.apache.log4j.RollingFileAppender log4j.appender.dest1.maxFileSize= 5000KB log4j.appender.dest1.maxBackupIndex=3 log4j.appender.dest1.layout=org.apache.log4j.PatternLayout log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/YYYY HH:mm:ss} %m%n log4j.appender.dest1.File=D:\\Automation\\src\\Logs\\Application.log #do not append the old file .Create a new log File everytime log4j.appender.dest1.Append=false Please let me know what needs to be change in order to remove the 3 lines of Warnings from the console output and Application logs.
downvote count: 0
possible better answer: http://stackoverflow.com/a/36396450
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/36396450
has answer: http://stackoverflow.com/a/26338343
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26338343
has title: Need to Remove Log File Warning in Selenium

http://stackoverflow.com/comment/41255134
type: AnswerComment
has text: I have updated my code with the line.length change and the for loop suggested, i have also added the output which still seems to be incorrect as the actual sum of the first row should be 46. Am i missing something?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26292380

http://stackoverflow.com/comment/41161295
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26241288
score: 0
has text: `if the score is more than twenty then visible button level2buka` then if condition should be `if(rs.getSkor() > 20)`

http://stackoverflow.com/a/26280482
score: 0
answers question: http://stackoverflow.com/q/26280411
type: Answer
has body: If you need to know the reason why double acts like that the look at this To format your double you can do it by String.format("%.2f", floatValue); Note this formats it till 2 places. You can also use DecimalFormat. One way to use it: DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(2); System.out.println(df.format(decimalNumber)); Another one is to construct it using the #.## format.

http://stackoverflow.com/a/26337982
has comment: http://stackoverflow.com/comment/41339121
score: 1
has body: import java.io.IOException; import java.io.PrintWriter; public class PrimeNumbers { public static void main(String args[]) throws IOException { PrintWriter primeNumbersWriter = new PrintWriter("PrimeNumber.txt"); for (int i = 0; i &lt; 100; i++) { // You didn't do anything with the return value of isPrime() if (isPrime(i)) { primeNumbersWriter.println("Prime numbers are: " + i); } } // Please close writers after using them primeNumbersWriter.close(); } public static boolean isPrime(int prime) { // Do not use the number to check for prime as loop variable, also it's // sufficient to iterate till the square root of the number to check for (int number = 2; number &lt; Math.sqrt(prime); number++) { if (prime % number == 0) { return false; } } // You didn't always return a value, it won't let you compile otherwise return true; } }
answers question: http://stackoverflow.com/q/26337833
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/41338871
type: Answer

http://stackoverflow.com/comment/41259692
comment on: http://stackoverflow.com/a/26293781
score: 0
type: AnswerComment
has text: If I use a single session to update into multiple tables and if the data amount is huge, is there any chance for the session getting overflowed ?
type: Comment

http://stackoverflow.com/q/26214138
has comment: http://stackoverflow.com/comment/41110345
has comment: http://stackoverflow.com/comment/43413015
has comment: http://stackoverflow.com/comment/41110313
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/41110252
tagged with: memory
upvote count: 0
has title: Copy(Not shallow or Deep) for structure in C/C++/Java equivalent. Copy to variable which is pointing to exactly the same memory for all members
tagged with: pointers
favorite count: 0
has body: Making copy of a variable for structure (having a pointer pointing to some variable, say, float and a normal variable integer) in C. Not shallow or deep Copy. but copy into a variable which is pointing to exactly the same memory. Consider this code: typedef struct { char *name; int value; } Node; void main() { Node n1, n2, n3; char name[] = "This is the name"; n1 = (Node){ name, 1337 }; // HERE n2 and n1 will contain name pointing to same memory location // But for value, they will have different memory location n2 = n1; // Here n1 and n3 are referring to different memory locations for both name and value n3.value = n1.value; n3.name = strdup(n1.name); } But I want some copy which is pointing to the same memory location for both name and value. Is there a way in C or equivalent Java code or C++? If it is in some other language please give your own example.
has answer: http://stackoverflow.com/a/26214207
type: Question
has answer: http://stackoverflow.com/a/26216271
score: -1
tagged with: c++
tagged with: java
answer count: 2
downvote count: 1

http://stackoverflow.com/comment/41229092
comment on: http://stackoverflow.com/a/26277671
score: 0
type: AnswerComment
type: Comment
has text: Well I use CRXDE Eclipse so I don't need to register activator. My Activator will always be active. I'll try this and let you know.

http://stackoverflow.com/comment/41344363
type: QuestionComment
comment on: http://stackoverflow.com/q/26341050
has text: Have you seen the `switch` statement? it might help you here.
score: 0
type: Comment

http://stackoverflow.com/comment/41289332
has text: "... finds the smaller rectangle." Reading is important.
type: QuestionComment
comment on: http://stackoverflow.com/q/26311076
type: Comment
score: 1

http://stackoverflow.com/q/26196008
favorite count: 0
tagged with: nullpointerexception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41077118
has body: I want to introduce information about cars and keep it in a file. My problem is that when I introduce datas it show me has occurred a NullPointerException where I use "seek" to place the pointer where I want. I have a Java Class that I use to ask the user what opcion he want to use, for the moment only to add car's data; and other where I want to write car's data in the File that I create in the same package Tema1AccesoAleatiroFicheros; import java.io.IOException; import java.util.Scanner; public class Vista { public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); Controlador coche=new Controlador(); System.out.println("Eliga opción:"); System.out.println("1-Ingresar coche:"); System.out.println("2-Modificar registro:"); System.out.println("3-Salir."); int opcion=sc.nextInt(); Controlador.crearFichero(); while (opcion!=3) { switch(opcion) { case 1: añadir(); break; case 2: modificar(); break; } System.out.println("Eliga opción:"); System.out.println("1-Ingresar coche:"); System.out.println("2-Modificar registro:"); System.out.println("3-Salir."); opcion=sc.nextInt(); } } public static void añadir () { Scanner sc=new Scanner(System.in); String[] array=new String[7]; System.out.println("Introduzca código:"); String cod=sc.next(); System.out.println("Introduzca marca:"); String marca=sc.next(); System.out.println("Introduzca modelo:"); String modelo=sc.next(); System.out.println("Introduzca matricula:"); String matricula=sc.next(); System.out.println("Introduzca potencia en caballos:"); int potencia=sc.nextInt(); System.out.println("Introduzca número de plazas:"); int plazas=sc.nextInt(); System.out.println("Introduzca número de puertas:"); int puertas=sc.nextInt(); array[0]=cod; array[1]=marca; array[2]=modelo; array[3]=matricula; array[4]=Integer.toString(potencia); array[5]=Integer.toString(plazas); array[6]=Integer.toString(puertas); // array[3]=new String(cod); // array[1]=new String(marca); // array[2]=new String(modelo); /…
tagged with: seek
upvote count: 1
downvote count: 1
type: Question
has title: NullPointerException using RandomAccesssFile at seek
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26196189
tagged with: randomaccessfile

http://stackoverflow.com/comment/108234878
type: Comment
has text: I believe you meant to say `boxes[i] = new JCheckBox(food[i]);`
comment on: http://stackoverflow.com/a/26241660
score: 0
type: AnswerComment

http://stackoverflow.com/a/26251618
has body: Since you are using 0.9.* version of socket.io, to broadcast messages you need to use io.sockets.emit. The shortcut io.emit was introduced in 1.0 version. Change : io.emit('tiklama', data); to io.sockets.emit('tiklama', data); Migration from 0.9 doc says: Shortcuts In general there are some new shortcuts for common things. The old versions should still work, but shortcuts are nice. Broadcasting to all clients in default namespace Previously: io.sockets.emit('eventname', 'eventdata'); Now: io.emit('eventname', 'eventdata'); Neat. Note that in both cases, these messages reach all clients connected to the default ‘/’ namespace, but not clients in other namespaces.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26207380
type: Answer
accepted answer of: http://stackoverflow.com/q/26207380
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/41089439
type: Comment
type: QuestionComment
has text: Lazy question. Read the javadoc.
score: 2
comment on: http://stackoverflow.com/q/26202774

http://stackoverflow.com/q/26249339
tagged with: sockets
has answer: http://stackoverflow.com/a/26249826
has comment: http://stackoverflow.com/comment/41176701
type: UnansweredQuestion
has title: Why in java socket, we can't send message continuously?
type: Question
tagged with: java
has body: This is my rough program. I have two clients one server I want to get the result Test1 Test2 ... ... but it only give me Test1... I tried to add a reply method in server and a receive method. Just like I note below, the problem solved. The result is like Test1 Test1 Test2 Test2 Test1 Test2 Why I must add this reply method? Server: ByteBuffer readBuffer = ByteBuffer.allocate(1024); ByteBuffer writeBuffer = ByteBuffer.allocate(1024); while ( keys.hasNext() ) { SelectionKey key = (SelectionKey)keys.next(); keys.remove(); if (!key.isValid()) continue; if (key.isReadable()) { SocketChannel nsc = (SocketChannel) key.channel(); // clear buffer for reading readBuffer.clear(); int nBytes = nsc.read(readBuffer); DataInputStream ist = new DataInputStream ( new ByteArrayInputStream(readBuffer.array())); String info = ist.readUTF(); switch (info) { case TAKE: System.out.println("Test1"); /*writeBuffer.clear(); writeBuffer.putInt(1); writeBuffer.flip(); nsc.write(writeBuffer);*/ // the reply method break; case BUN: System.out.println("Test2"); break; } } } Client: DataOutputStream out = new DataOutputStream(sock.getOutputStream()); DataInputStream in = new DataInputStream(sock.getInputStream()); do { try { out.writeUTF("TAKE "); //in.readInt(); the receive method out.writeUTF("BUN "); Thread.sleep(id + 1); } catch (IOException ioe) { sock.close(); throw ioe; } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } while (true);
answer count: 1
score: 0

http://stackoverflow.com/comment/41107075
has text: @This_isWater If you fixed your code as I suggested, you won't get this exception.
type: Comment
comment on: http://stackoverflow.com/a/26209766
score: 0
type: AnswerComment

http://stackoverflow.com/q/26256393
tagged with: garbage-collection
score: 11
has body: We have an application that spawns new JVMs and executes code on behalf of our users. Sometimes those run out of memory, and in that case behave in very different ways. Sometimes they throw an OutOfMemoryError, sometimes they freeze. I can detect the latter by a very lightweight background thread that stops to send heartbeat signals when running low on memory. In that case, we kill the JVM, but we can never be absolutely sure what the real reason for failing to receive the heartbeat was. (It could as well have been a network issue or a segmentation fault.) What is the best way to reliably detect out of memory conditions in a JVM? In theory, the -XX:OnOutOfMemoryError option looks promising, but it is effectively unusable due to this bug: https://bugs.openjdk.java.net/browse/JDK-8027434 Catching an OutOfMemoryError is actually not a good alternative for well-known reasons (e.g. you never know where it happens), though it does work in many cases. The cases that remain are those where the JVM freezes and does not throw an OutOfMemoryError. I'm still sure the memory is the reason for this issue. Are there any alternatives or workarounds? Garbage collection settings to make the JVM terminate itself rather than freezing? EDIT: I'm in full control of both the forking and the forked JVM as well as the code being executed within those, both are running on Linux, and it's ok to use OS specific utilities if that helps.
type: AnsweredQuestion
has title: What is the best way to handle out of memory conditions in Java?
tagged with: java
tagged with: process
has comment: http://stackoverflow.com/comment/41259256
has comment: http://stackoverflow.com/comment/41201878
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/81576078
upvote count: 12
linked to: http://stackoverflow.com/q/8728866
has answer: http://stackoverflow.com/a/26270037
has answer: http://stackoverflow.com/a/27149402
answer count: 3
has comment: http://stackoverflow.com/comment/41201679
possible better answer: http://stackoverflow.com/a/26270088
has comment: http://stackoverflow.com/comment/41200961
favorite count: 0
accepted answer: http://stackoverflow.com/a/27149402
has answer: http://stackoverflow.com/a/26270088
tagged with: linux
tagged with: out-of-memory

http://stackoverflow.com/comment/41256184
type: AnswerComment
has text: I understand that now, unfortunately the way the program is structured it isn't possible to just remove that if block, as if the file has 0 entries the arrays should not be initialized and instead the user should be thrown back to the menu and told to retry with a valid file.
type: Comment
comment on: http://stackoverflow.com/a/26293108
score: 0

http://stackoverflow.com/q/26340553
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26362962
has comment: http://stackoverflow.com/comment/41345002
has comment: http://stackoverflow.com/comment/41343950
has comment: http://stackoverflow.com/comment/41354942
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/41347669
has title: How do i know if a mouse click is done on a custom component in a panel?
tagged with: mouseevent
score: 0
answer count: 3
tagged with: click
has comment: http://stackoverflow.com/comment/41355050
has answer: http://stackoverflow.com/a/26345686
has answer: http://stackoverflow.com/a/26340597
has body: I have a JPanel and some custom components in it. There are lots of such panels in the Frame. I need to know if a mouse click is on a custom component(which take for example is a JLabel)..... I wrote the following code to achieve this: public object getxxx(MouseEvent pEvent) { Point localPoint = SwingUtilities.convertPoint(pEvent.getComponent(), pEvent.getPoint(), aPanel ); if (SwingUtilities.getLocalBounds(aPanel).contains(localPoint)) // This is where im facing problem, its always false in never goes in… { ///if clicked on the aPanel then do something } } The if condition is always false, even if i click on the desired panel

http://stackoverflow.com/a/26266301
has comment: http://stackoverflow.com/comment/41207827
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26266195
has body: Try double input = ... double output = Math.pow(10, Math.ceil(Math.log10(input))); You can cast your output to an integer then. The operations amount is constant so O(1) is guaranteed for a single input.

dependencies
tags question: http://stackoverflow.com/q/26290831
tags question: http://stackoverflow.com/q/26237564
tags question: http://stackoverflow.com/q/26310027
type: Tag
tag name: dependencies

http://stackoverflow.com/q/26211612
type: Question
accepted answer: http://stackoverflow.com/a/26211645
score: 0
has comment: http://stackoverflow.com/comment/41106113
has comment: http://stackoverflow.com/comment/41105977
answer count: 1
tagged with: javabeans
has comment: http://stackoverflow.com/comment/41106072
has title: Bean to bean values
has body: I have received some help on how beans work, so far i have an xml: <?xml version="1.0" encoding="UTF-8"?> <property name="service" ref="currentDateService"/> A simple method to obtain the current date: public class CurrentDateServiceImpl implements CurrentDateService { public LocalDate getCurrentDate() { return LocalDate.now() ; } } And i am currently working on formating the current date i receive: public class CurrentDateServiceFormatImpl implements CurrentDateServiceFormat{ private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy"); CurrentDateService service; public String formatCurrentDate(){ return service.getCurrentDate().format(formatter); } public void setService(CurrentDateService service){ this.service = service; } } My test is: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "file:src/main/resources/META-INF/application-context.xml" }) public class CurrentDateServiceImplTest { @Autowired CurrentDateService service; CurrentDateServiceFormat service2; @Test public void test() { LocalDate date = LocalDate.now(); System.out.println(service); System.out.println(service2); LocalDate date2 = service.getCurrentDate(); assertEquals(date, date2); } } But the service2 i get printed out is null, thus im unable to run service2.formatCurrentDate, what am i doing wrong?
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26211645
tagged with: java

http://stackoverflow.com/a/26296258
has comment: http://stackoverflow.com/comment/41472312
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41447798
type: Answer
accepted answer of: http://stackoverflow.com/q/26290096
has comment: http://stackoverflow.com/comment/41301361
answers question: http://stackoverflow.com/q/26290096
upvote count: 1
has body: I wouldn't suggest to use such low level threading. This sounds like exact match for some batching framework. I would Suggest to take a look at Spring Batch or Java EE 7 batching. If you are planning to maintain and extend such batch application, initial learning curve will be payed back 10 times.

http://stackoverflow.com/a/26268015
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41210951
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26267953
has body: First, you have a typo in your if statement: sentence.charAt(posotion) should be sentence.charAt(position) Then, you are assigning rather than testing equality: if (sentence.charAt(position) = letter) { should be if (sentence.charAt(position) == letter) { Next, you are comparing a char with a string in that if statement. There are several ways to solve this, one way is (assuming letter has at least one character): if (sentence.charAt(position) == letter.charAt(0)) { And lastly, you probably don't what to check past the end of the string so: for (position=0; position&lt;=sentence.length(); position++) { should be for (position=0; position&lt;sentence.length(); position++) {
answers question: http://stackoverflow.com/q/26267953
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41210869
has comment: http://stackoverflow.com/comment/41211072
has comment: http://stackoverflow.com/comment/41210805

http://stackoverflow.com/a/26221816
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26221738
has comment: http://stackoverflow.com/comment/41131902
has comment: http://stackoverflow.com/comment/41125118
has comment: http://stackoverflow.com/comment/41125116
upvote count: 1
has body: The best way to do this is to invert control and have onState be implemented by the subclass rather than the callbacks class. Something like this: class Example { public State currentState; } interface State{ public void doOnState(); } abstract class StateCallbacks { public void onState(State state){ state.doOnState(); } }
has comment: http://stackoverflow.com/comment/41128195
type: Answer

http://stackoverflow.com/comment/41325392
has text: Actually, after playing around with it, it would seem that the dipsoseMethod is not set to clear
type: Comment
comment on: http://stackoverflow.com/q/26330550
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41149604
comment on: http://stackoverflow.com/a/26234073
type: AnswerComment
score: 0
type: Comment
has text: I'm not sure what you mean. Do you want to get all JsonModel objects from the array? You can get them all individually in a for-loop over the array.

http://stackoverflow.com/comment/41130233
comment on: http://stackoverflow.com/q/26223673
score: 0
type: Comment
type: QuestionComment
has text: @MarcB, if you want to talk like a Mathematician, then don't use "modulo" as the name of an operation. Use it as a modifier for the "congruency" operator: "3 is congruent to 1 modulo 2", or `3≡1 (mod) 2`

http://stackoverflow.com/q/26199822
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: bpmn
has title: Generate Missing Bpmn Diagram Elements
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26215562
tagged with: eclipse-plugin
favorite count: 0
type: UnansweredQuestion
has body: There are bpmn files without diagram elements. Eclipse Bpmn Plugin can generate them. Java solution to generate missing elements is needed. Can I somehow reuse eclipse bpmn plugin? I've downloaded sources, but could not find a way to do that. Probably there are other frameworks? I tried to use camunda, downloaded its editor, but it seems it does not support this feature.

http://stackoverflow.com/comment/41247424
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26287814
score: 0
has text: I'm using Eclipse. @MattBall yes the ListLinks class has the main. --Susie, It's not giving me the option of running as a Java application.

http://stackoverflow.com/comment/41314148
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26324810
has text: Well it is for testing other software in my lab, not for putting it out on the market to annoy people.
score: 0

http://stackoverflow.com/comment/41190449
type: Comment
comment on: http://stackoverflow.com/a/26257532
has text: its the same if I write `s -> System.out.println(s)`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41085814
has text: Please tag the programming language you intended.
score: 1
comment on: http://stackoverflow.com/q/26200885
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26196212
tagged with: package
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26196345
tagged with: class
score: 0
answer count: 2
has title: Calling a public class inside a public class, from a different package
has body: Here is my problem: I setup 4 classes (All public) like this: Package main --Class Tuna Package second --Class Apple ----Class InsideApple --Class Orange Code for each one: public class Tuna { public static void main(String[] args){ Orange orange = new Orange(); orange.callApple(); Apple apple = new Apple(); System.out.println("A call from orange"); apple.callApple(); apple.insideApple.callInsideApple(); // This line will crash it -- Why? } } public class Apple{ public void callApple(){ System.out.println("Here is Apple!"); } InsideApple insideApple = new InsideApple(); public class InsideApple{ public void callInsideApple(){ System.out.println("Here is Inside Apple!"); } } } public class Orange{ Apple apple = new Apple(); public void callApple(){ System.out.println("A call from orange"); apple.callApple(); apple.insideApple.callInsideApple(); } } As you see the 4th class (InsideApple) is a public class inside class (Apple) When i try to call a method inside class (InsideApple) from class (Orange) i got no problem. But when i try to do it from class (Tuna) its says that there is no instacne for class (InsideApple) inside class (Apple) What can i do to prevent this? I know if i put all the classes in a single package it will be fixed. But thats a dumb way to fix it i think. Do you guys have any better iders?
possible better answer: http://stackoverflow.com/a/26196278
has answer: http://stackoverflow.com/a/26196278
has answer: http://stackoverflow.com/a/26196345

http://stackoverflow.com/comment/41444163
has text: @oillio: Yes, we're aware of that. But simply making everything a long by default wouldn't be what many of the jOOQ users really want. We'll think about this - in the mean time, you can have the jOOQ code generator [rewrite data types for you](http://www.jooq.org/doc/latest/manual/code-generation/data-type-rewrites/)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26335301
type: Comment

http://stackoverflow.com/q/26274597
accepted answer: http://stackoverflow.com/a/26275005
tagged with: ant
tagged with: svn
has title: Generating a jar on svn using jenkins integration of ant project
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26275095
possible better answer: http://stackoverflow.com/a/26275095
has body: I have created a java project and generated a ant build file for the project. The ant file basically consist of code to generated jar from the java files. I project is stored in svn. So I am using the subversion option to mention the repository url. What i want is after successful build in jenkins the jar file should get geneated in svn location where the project is currently present. After building the project in jenkins is can see the build is successful but the jar is not getting generated on the svn repository. Please help me configure jenkins in such a way that after build jar files gets generated on svn location.
tagged with: jenkins
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26275005

http://stackoverflow.com/comment/41192706
type: Comment
has text: I really dont understand the difference, except subclasses being able to change states, this will not be required in my implementation as the databases will come from different customers etc, So the easiest would be to have one class on top, and have other classes extend that class and override, why is this not to prefer?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26257295

http://stackoverflow.com/q/26250868
favorite count: 0
has answer: http://stackoverflow.com/a/26251046
accepted answer: http://stackoverflow.com/a/26251046
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41179206
has title: Comparator in java 8
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26250973
has body: Recently I've updated Java to version 8, but I have problem with Comparator (in 7 version everything worked perfectly): lastplace = Collections.max(place, new Comparator&lt;Place&gt;() { public int compare(Place o1, Place o2) { return (o1.getDateFrom() .compareTo(o2.getDateFrom())); } }); Now Comparator needs to inherit other methods (thenComparingInt, thenComparingLong etc.), but I don't need them How to solve this in few lines of code ?
has answer: http://stackoverflow.com/a/26250973
type: Question
tagged with: comparator
answer count: 2
downvote count: 0

http://stackoverflow.com/q/26250773
answer count: 1
downvote count: 0
favorite count: 0
tagged with: media-player
tagged with: android
has comment: http://stackoverflow.com/comment/50035402
has comment: http://stackoverflow.com/comment/41291999
accepted answer: http://stackoverflow.com/a/31684111
score: 1
has comment: http://stackoverflow.com/comment/54311058
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41290308
has title: IJKplayer craches on play some video
tagged with: java
has body: I use IjkPlayer. Most of the videos that I tried played ok, But one type cause the app to crashes and show this A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x2c in tid 13026 I think it because the video has no sound. this is the details of the video Duration: 00:51:17.40, start: 0.000000, bitrate: N/A Stream #0:0(heb): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 1024x768, 491 kb/s, 15 tbr, 1k tbn, 1k tbc If someone knows how to fix this I will very appreciate this.
type: Question
has comment: http://stackoverflow.com/comment/41291990
has answer: http://stackoverflow.com/a/31684111

http://stackoverflow.com/a/26204216
has comment: http://stackoverflow.com/comment/41091689
has body: Your Comparator is comparing two Strings. That's probably why the list is not sorted correctly. The "diff" string should be parsed as an integer (or float) to compare it. If your objects always have the same structure, I would advise to create a List of a custom object (where the diff is an integer representing the number of kilometers) instead of using a List of Maps. In that case, you could make your custom object implement Comparable. Something like : public class MyCustomObject implements Comparable&lt;MyCustomObject&gt; { private String mNum; private String mUsername; private String mStartPoliPro; private String mFinalPoliPro; private int mDiff; @Override public int compareTo(MyCustomObject another) { return mDiff - another.getDiff(); } public String getNum() { return mNum; } public void setNum(String num) { mNum = num; } public String getUsername() { return mUsername; } public void setUsername(String username) { mUsername = username; } public String getStartPoliPro() { return mStartPoliPro; } public void setStartPoliPro(String startPoliPro) { mStartPoliPro = startPoliPro; } public String getFinalPoliPro() { return mFinalPoliPro; } public void setFinalPoliPro(String finalPoliPro) { mFinalPoliPro = finalPoliPro; } public int getDiff() { return mDiff; } public void setDiff(int diff) { mDiff = diff; } } and then simply call List&lt;MyCustomObject&gt; myList = // create your object list Collections.sort(myList);
upvote count: 1
answers question: http://stackoverflow.com/q/26203803
downvote count: 1
has comment: http://stackoverflow.com/comment/41091919
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41091784
has comment: http://stackoverflow.com/comment/41091874

http://stackoverflow.com/comment/41331717
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26334195
has text: I changed where I was initializing, but it's still throwing the same error.

http://stackoverflow.com/comment/41278320
comment on: http://stackoverflow.com/a/26303748
has text: Thank you for following up and answering fully. Your ArrayList suggestion works well for what I need to do. I can successfully call a method to retrieve values by typing: 'building.get(0).getValue()' However, I do have a question. What syntax would I use to call a setValue method on the object in the ArrayList? I'm having a ton of trouble with that.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41239077
comment on: http://stackoverflow.com/a/26283124
type: Comment
has text: OK, *technically*. But I don't think that's what OP meant by "method".
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41324669
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26330218
has text: @Arizoo Well it highlights classes that can be imported, and if you do so with the ALT+ENTER shortcut it will jump to the next class that can be imported.

http://stackoverflow.com/comment/41171882
type: Comment
score: 1
has text: @Tim I knew there was a dependency beforehand. But say if it is a different project the `NoClassDefFoundError` should point you in the correct direction.
type: AnswerComment
comment on: http://stackoverflow.com/a/26246712

http://stackoverflow.com/comment/41274579
score: 2
has text: Have you tried _debugging_ your app?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26303062

http://stackoverflow.com/q/26224975
has answer: http://stackoverflow.com/a/26225126
score: 0
has body: I have a Java class that i would like to import into my Jython script. Unfortunately, eclipse won't let me create a Java class inside my Jython project.In the window, where you create and name your Java class, I get a message at the top (alongside a red cross) saying, "Source folder is not a Java project" when I type the name of the would be class. How do I rectify this? I need the Java Class to call C code using the JNI (declaring the native method,loading and then calling it). Thank You !!!!!!!
linked to: http://stackoverflow.com/q/3596098
accepted answer: http://stackoverflow.com/a/27521883
has title: Integrating a Java Class into a PyDev Project (Jython) in Eclipse
has answer: http://stackoverflow.com/a/27521883
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
tagged with: pydev
possible better answer: http://stackoverflow.com/a/26225126
tagged with: jython

http://stackoverflow.com/comment/41136428
has text: Yes but that is not the problem it can be a suggestion for good practice. Also you don't need to set false every time you can just set true in negation condition ... Please check the edit for the correct negation !
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26227621
type: Comment

http://stackoverflow.com/comment/41163358
type: Comment
comment on: http://stackoverflow.com/a/26242262
score: 0
type: AnswerComment
has text: +1, judging by the OP's comments, iterating backwards is what they are looking for.

http://stackoverflow.com/comment/48984624
has text: @gogu from what package do you import JSONObject?
type: Comment
comment on: http://stackoverflow.com/a/26298811
score: 0
type: AnswerComment

http://stackoverflow.com/q/26318693
has comment: http://stackoverflow.com/comment/41303439
has body: In java, if you have two arrays with identical contents, but they were separately constructed, array1 == array2 will be false because equals does a reference check and their references are different. But is it guaranteed they'll always have different references? For example public class TestArrayReferences { private static final String[] SENTINEL_ARRAY_1 = new String[0]; private static final String[] SENTINEL_ARRAY_2 = new String[0]; public static boolean testArrays() { return SENTINEL_ARRAY_1 == SENTINEL_ARRAY_2; } } If I call testArrays, I'm returned false, but is it guaranteed to always be false? Namely, is the JVM permitted to detect that SENTINEL_ARRAY_1 and SENTINEL_ARRAY_2 will always be identical and therefore have them reference the same array?
tagged with: arrays
has answer: http://stackoverflow.com/a/26318707
has comment: http://stackoverflow.com/comment/41303325
answer count: 3
has answer: http://stackoverflow.com/a/26319072
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41303538
has title: Can separate but identical arrays EVER be equal by reference
possible better answer: http://stackoverflow.com/a/26318751
has answer: http://stackoverflow.com/a/26318751
upvote count: 1
accepted answer: http://stackoverflow.com/a/26318707
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41302799
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41303029
type: Question

http://stackoverflow.com/a/26347018
has body: I guess you need to check out the BigInteger of the java API. That might be able to store your results of those much big numbers. Read the documentation, http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26346992
score: 4

http://stackoverflow.com/comment/41081283
comment on: http://stackoverflow.com/q/26198212
has text: The WindStorm class here doesn't compile. So most likely, what you're running is actually an earlier version of it, which was left in your target directory.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41331592
type: Comment
has text: @user2875021 : Fine. It's GOOD to see you have solved the problem. SO is always there to help you.
comment on: http://stackoverflow.com/a/26333225
type: AnswerComment
score: 0

javafx
tags question: http://stackoverflow.com/q/26341744
tags question: http://stackoverflow.com/q/26269940
type: Tag
tags question: http://stackoverflow.com/q/26241524
tags question: http://stackoverflow.com/q/26211609
tags question: http://stackoverflow.com/q/26284415
tags question: http://stackoverflow.com/q/26211648
tags question: http://stackoverflow.com/q/26328692
tags question: http://stackoverflow.com/q/26302119
tags question: http://stackoverflow.com/q/26263152
tags question: http://stackoverflow.com/q/26322735
tags question: http://stackoverflow.com/q/26227786
tags question: http://stackoverflow.com/q/26236173
tags question: http://stackoverflow.com/q/26195243
tags question: http://stackoverflow.com/q/26259093
tags question: http://stackoverflow.com/q/26237972
tags question: http://stackoverflow.com/q/26244583
tags question: http://stackoverflow.com/q/26277041
tags question: http://stackoverflow.com/q/26196809
tags question: http://stackoverflow.com/q/26328040
tags question: http://stackoverflow.com/q/26315710
tags question: http://stackoverflow.com/q/26209959
tag name: javafx
tags question: http://stackoverflow.com/q/26270960
tags question: http://stackoverflow.com/q/26246319
tags question: http://stackoverflow.com/q/26203674
tags question: http://stackoverflow.com/q/26341152
tags question: http://stackoverflow.com/q/26278698
tags question: http://stackoverflow.com/q/26202586
tags question: http://stackoverflow.com/q/26247746
tags question: http://stackoverflow.com/q/26272991
tags question: http://stackoverflow.com/q/26243900
tags question: http://stackoverflow.com/q/26231345
tags question: http://stackoverflow.com/q/26196404
tags question: http://stackoverflow.com/q/26204712
tags question: http://stackoverflow.com/q/26243551
tags question: http://stackoverflow.com/q/26235019
tags question: http://stackoverflow.com/q/26341410
tags question: http://stackoverflow.com/q/26305827
tags question: http://stackoverflow.com/q/26312647
tags question: http://stackoverflow.com/q/26344172
tags question: http://stackoverflow.com/q/26264844
tags question: http://stackoverflow.com/q/26264131
tags question: http://stackoverflow.com/q/26335806
tags question: http://stackoverflow.com/q/26244590
tags question: http://stackoverflow.com/q/26212005
tags question: http://stackoverflow.com/q/26323071
tags question: http://stackoverflow.com/q/26324898
tags question: http://stackoverflow.com/q/26260138
tags question: http://stackoverflow.com/q/26224822
tags question: http://stackoverflow.com/q/26330348
tags question: http://stackoverflow.com/q/26338373
tags question: http://stackoverflow.com/q/26254354
tags question: http://stackoverflow.com/q/26283633
tags question: http://stackoverflow.com/q/26258787
tags question: http://stackoverflow.com/q/26233554
tags question: http://stackoverflow.com/q/26283775
tags question: http://stackoverflow.com/q/26303111
tags question: http://stackoverflow.com/q/26329342
tags question: http://stackoverflow.com/q/26196382
tags question: http://stackoverflow.com/q/26325403
tags question: http://stackoverflow.com/q/26291999
tags question: http://stackoverflow.com/q/26334720
tags question: http://stackoverflow.com/q/26252121

http://stackoverflow.com/comment/41159482
comment on: http://stackoverflow.com/q/26240401
score: 1
has text: You need to think about iy in OO way. Do not think about files. Think about classes and objects
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26248516
has body: Here is one way to do it. You pass in your value n twice. The reason is that you use n1 to print from 1 to n, and you then use n2 to print from n to 1. You also pass in a boolean flag that you make true once you switch the printing order. Further more, you use n2 to reverse the value of n1 when printing such that: n1 = 5, print 1 n1 = 4, print 2 // .... This is done by the formula n2 + 1 - n1 as demonstrated bellow. Since you said in the comments that you cannot use loops, I made the printing of dots into another recursive function. Here is the result: public static void printDots(int val, int condition) { if(val &lt; condition - 1) { System.out.print("."); printDots(val + 1, condition); } } public static void Esc(int n1, int n2, boolean reverse) { int val = (n2 + 1 - n1); // this gives 1 for n, 2 for n-1, 3 for n-2 etc. if (n1 &gt; 1 &amp;&amp; !reverse) { // print from 1 to n printDots(0, val); // print dots System.out.println(val); Esc(n1 - 1, n2, reverse); } else if (n1 &lt;= n2) { // print from n to 1 reverse = true; printDots(0, val); // print dots System.out.println(val); Esc(n1 + 1, n2, reverse); } } public static void main(String args[]) { Esc(5, 5, false); } If you want to use the exact method signature you stated in your question, you can wrap the method I gave you above inside your method: void Esc(int n) { Esc(5, 5, false); } And then call Esc(5) from your main(). You can name the methods the same because java supports method overloading Here is a running example Output: 1 .2 ..3 ...4 ....5 ...4 ..3 .2 1
type: Answer
has comment: http://stackoverflow.com/comment/41175329
score: -1
has comment: http://stackoverflow.com/comment/41175450
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/41175054
answers question: http://stackoverflow.com/q/26248252
has comment: http://stackoverflow.com/comment/41223658
accepted answer of: http://stackoverflow.com/q/26248252
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41175195

http://stackoverflow.com/comment/41213128
has text: Please edit your question to include a [complete example](http://stackoverflow.com/help/mcve) that exhibits the problem you describe; post a [screenshot](http://meta.stackoverflow.com/questions/99734/how-do-i-create-a-screenshot-to-illustrate-a-post) to [imgur](http://imgur.com) and cite a link.
comment on: http://stackoverflow.com/q/26267378
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41077159
comment on: http://stackoverflow.com/a/26195599
type: AnswerComment
type: Comment
has text: @user2946713 The first question you should always ask when you get a compiler error is "What did **I** do wrong?"
score: 1

http://stackoverflow.com/a/26257136
accepted answer of: http://stackoverflow.com/q/26255998
answers question: http://stackoverflow.com/q/26255998
has body: Ok, so I figured it out. Apparently this was much more of an IntelliJ issue than it was of a classpath issue. So IntelliJ automatically adds the full JDK (including all jars in /jre/lib) to the classpath - first, before all the Maven dependencies. So that caused my project to be going weird: I had a netscape.javascript.JSObject in jfxrt.jar, in plugin.jar and in my Maven plugin (these jars were added in this order). The first JSObject that was found was the one in jfxrt.jar, which caused the problem. It worked in Eclipse as there, I could alter the classpath order and had added my Maven plugin BEFORE the JDK - so the order became java-plugin.jar (first one, correct JSObject class), jfxrt.jar, plugin.jar. It would have worked when I'd use an older JDK - this jfxrt.jar was only added in JDK7. It works on Jenkins, if I still have my java-plugin.jar from Maven, because Jenkins does not automatically add the JDK libraries (only the core). That was how I cleared it out: I removed my own java.plugin.jar and replaced it by a dependency on plugin.jar. com.sun.jdk plugin ${version.java-plugin} jar system ${java.home}/lib/plugin.jar I still had the problem in IntelliJ, but arrived to remove the jfxrt.jar from the imported JDK libraries in IntelliJ itself - which does change the .iml file but of course not anything that would be of use for Jenkins. (You can edit these settings by right clicking on the External Libraries > < 1.7> folder in the Project Browser, and then clicking Open Library Settings). Once jfxrt.jar was removed, everything worked. I reasoned that this wouldn't change anything in Jenkins, but on the other hand, then the problem maybe wouldn't even exist on Jenkins. So I simply tried and commited my code to SVN to build it on Jenkins. Magically, it works now on Jenkins too. I tried and removed my dependency on plugin.jar, then I get the classical "could not find symbol" compilation error on Jenkins - while I don't get that error in IntelliJ, due to the automatical…
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/26293654
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41258171
score: 1
has body: There is a difference between CPU caching and memory caching. This JCache would cache things in memory so you don't have to get it from an expensive resource like disk or over the network. So CPUs have caches built into them so that they can avoid going to memory. CPUs commonly have three levels of cache and store around 8MB. CPU caching is not something you have to worry about because it is taken care of for you. If something isn't in the CPU cache then it has to go fetch it out of memory. Caching in memory is to avoid going to disk or even slower resources as I mentioned earlier. This mechanism programs have control over. So if you want to avoid continously asking your DB for some object you can store it memory and keep returning the same object. This saves quite a bit of performance. As Thomas mentioned JCache adds the functionality to be able to provide caching across JVMs. From what I understand this means that different Java programs can share the same cache.
has comment: http://stackoverflow.com/comment/41257720
downvote count: 0
answers question: http://stackoverflow.com/q/26293573
accepted answer of: http://stackoverflow.com/q/26293573
type: AcceptedAnswer

http://stackoverflow.com/comment/41076674
type: Comment
type: AnswerComment
has text: Hey Emanuele! Sadly this does not help. I get the same error.
comment on: http://stackoverflow.com/a/26194890
score: 0

http://stackoverflow.com/comment/41341153
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26279086
type: QuestionComment
has text: Hey Guys, I missed a step in our system. The xml file above is preprocessed before the XSL-Transformation. In this preprocessed file the line above is processed to `<Creator><xmlns:xsi>http://www.w3.org/2001/XMLSchema-instance</xmlns:xsi> Device_t `. This causes the error.

http://stackoverflow.com/comment/41256537
score: 2
comment on: http://stackoverflow.com/q/26293330
has text: Arrays are zero-based in Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26244616
downvote count: 1
type: Question
answer count: 2
tagged with: variables
accepted answer: http://stackoverflow.com/a/26244663
score: 0
has answer: http://stackoverflow.com/a/26244749
favorite count: 0
possible better answer: http://stackoverflow.com/a/26244749
upvote count: 1
has body: import java.util.Scanner; public class TripCost { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String destination; String hotel; int days = 3; double mealCost; double regularMeal = 31.00; double highCostMeal = 52.00; double gasPrice = 3.29; double miles; double airfare; double hotelCost; double budgetel = 76.00; double holidayInn = 109.00; double sheraton = 138.00; double hyatt = 215.00; System.out.println("Here are the places you may go for vacation:"); System.out.println("--------------------------------------------"); System.out.println(" 1. Niagra Falls"); System.out.println(" 2. Chicago"); System.out.println(" 3. San Francisco"); System.out.println(" 4. Las Vegas"); System.out.println(" 5. St. Louis"); System.out.println("--------------------------------------------"); System.out.print("Please select the number of the destination: "); int destinationChoice = keyboard.nextInt(); if (destinationChoice == 1) { miles = 257.00; airfare = 0; mealCost = regularMeal; destination = "Niagra Falls"; } else if (destinationChoice == 2) { miles = 303.00; airfare = 0; mealCost = highCostMeal; destination = "Chicago"; } else if (destinationChoice == 3) { miles = 0; airfare = 630.00; mealCost = highCostMeal; destination = "San Francisco"; } else if (destinationChoice == 4) { miles = 0; airfare = 415.00; mealCost = highCostMeal; destination = "Las Vegas"; } else if (destinationChoice == 5) { mealCost = regularMeal; destination = "St. Louis"; System.out.print("Would you like to drive or fly? "); String transportation = keyboard.next(); if (transportation.equalsIgnoreCase("drive")) { miles = 551.00; airfare = 0; } else if (transportation.equalsIgnoreCase("fly")) { miles = 0; airfare = 290.00; } else { System.out.print("Invalid selection"); System.exit(1); } } else { System.out.print("Invalid destination"); System.exit(1); } System.out.println("These are the hotels with vacancies:"); System.out.println("------------------------------------"); …
has title: How do I get the variables I set in the if statements to carry over to the rest of my code?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26244663
tagged with: if-statement
tagged with: java

http://stackoverflow.com/comment/41203903
comment on: http://stackoverflow.com/a/26263907
has text: Command is not an inner class--that is just how I copy and pasted it from Eclipse (new class, new tab). sorry
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26350230
score: 5
has comment: http://stackoverflow.com/comment/72212087
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/73548158
accepted answer of: http://stackoverflow.com/q/26349911
type: Answer
has body: My research tells me that jconn3.jar and jconn4.jar are part of Sybase jConnect. In order to download (at least) the latest version of jConnect, you need to "register" an account ... and maybe do other stuff like a click-through license. (I'm not giving them my email address just to find out.) Based on that, I suspect that the copy of jconn3.jar you can see in Maven Central is unauthorized, and should not be there. My advice would be to: Register for an account on the Sybase site. Download the JAR. Add a copy of the JAR with a minimal POM file to either your local repo, or your private institutional repo. Don't export it without reading the jConnect license carefully first to check that it is permitted. If you are providing your software to 3rd parties, then check what the jConnect license says about this first. If you intend to make your software available in a public Maven repo, you may need provide instructions on how downstream projects should deal with the jconn.jar problem. The other approach might be to ask Sybase / SAP for permission to upload the JAR to Maven Central. (I don't rate your chances though. The fact that they have put the downloads behind a "signup" wall suggests that they want to track who is using jConnect for "business reasons". Convincing them to change their strategy could be difficult.) UPDATE - According to @Hlex's 2015 research (see below), the software is available for free from the SAP Store. However, you still need to sign up for an account.
answers question: http://stackoverflow.com/q/26349911

http://stackoverflow.com/comment/41239288
score: 0
type: Comment
type: QuestionComment
has text: I tried it in java using intellij an could not reproduce it...
comment on: http://stackoverflow.com/q/26283733

http://stackoverflow.com/comment/41141427
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26230197
has text: Yes, this isn't production... this is a review of [Item 23 Effective Java](http://www.oracle.com/technetwork/articles/java/bloch-effective-08-qa-140880.html) Don't use raw types...
type: Comment

http://stackoverflow.com/q/26241324
downvote count: 1
has title: How to extract values from a hidden table using xpath in selenium webdriver (java)
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/26241933
answer count: 2
has body: I want to extract the values from the "From" drop down of http://www.makemytrip.com/flights/ and then compare it with a particular search string to find if the string exist in the values from the drop down. But I am unable to extract the values as these fields are hidden. It is an autocomplete dropdown. The html part of the drop down Top Domestic Cities New Delhi, India (DEL) New Delhi, India (DEL) Mumbai, India (BOM) Bangalore, India (BLR) ...... I tried : WebDriver driver; List<WebElement> li = driver.findElements( By.xpath("//div/div[2]/ul[2]/li/a")); This gives me a no such element exception as the first li element under ul[2] does not have a 'a' element under it. I want to get the 'a' element starting from the second li element.
upvote count: 0
has answer: http://stackoverflow.com/a/26249670
favorite count: 0
tagged with: xpath
type: UnansweredQuestion
tagged with: selenium

http://stackoverflow.com/comment/41080997
has text: what method? And yes all the files are in the same folder, I'm not a complete idiot
comment on: http://stackoverflow.com/a/26197509
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41184948
type: Comment
comment on: http://stackoverflow.com/a/26254218
has text: `write(i)` only writes the bottom byte of `i`.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26315916
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41308136
has comment: http://stackoverflow.com/comment/41297799
answer count: 2
has comment: http://stackoverflow.com/comment/41323575
possible better answer: http://stackoverflow.com/a/26316008
has body: I am trying to model a menuing system that can have menus which contain sub-menus. I wanted a generified interface for retrieving options from menus and from sub-menus via their parent menus and I am having trouble designing it while keeping it type-safe, flexible and free of compile-time 'incompatible types' errors. I tried to achieve my goal by using Java generics to specify a Menu interface for simple menus and a ParentMenu interface for parent menus which use generic type parameters for method parameters and return types. I have a third Enumerable interface for representing the options available on a particular menu. The classes which implement the Enumerable interface are all enum classes that enumerate the options on a menu. A parent menu can hold numerous sub-menus, and I want a generified single method that allows a client of the parent menu class to get the options for any one of its sub-menus. A parent menu concrete class has a method with a signature that specifies a return value of List&lt;Enumerable&gt;. I want to be able to return a List&lt;MenuOption&gt; where MenuOption implements the Enumerable interface. However, I get an error which says that the List&lt;MenuOption&gt; I want to return is incompatible with a List&lt;Enumerable&gt;. The basic Menu interface: package example; import java.util.List; public interface Menu&lt;T&gt; { public List&lt;T&gt; getOptions(); } The ParentMenu interface: package example; import java.util.List; public interface ParentMenu&lt;T,U&gt; { public List&lt;T&gt; getSubMenuOptions(U subMenu); } The `Enumerable interface: package example; public interface Enumerable { public String getName(); } Here is an implementation of the Menu interface: package example; import java.util.*; public class SimpleMenu implements Menu&lt;MenuOption&gt; { private final Map&lt;MenuOption, String&gt; menuLinks; public SimpleMenu() { menuLinks = new HashMap&lt;&gt;(); for(MenuOption option : MenuOption.values()) { //Totally arbitrary mapping…
has comment: http://stackoverflow.com/comment/41297975
has title: How to use Java Generics so that List<InterfaceImpl> can be returned for a method that has return type List<Interface>
has answer: http://stackoverflow.com/a/26316008
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/26315983
has comment: http://stackoverflow.com/comment/41303454
tagged with: generics
has comment: http://stackoverflow.com/comment/41325714
has comment: http://stackoverflow.com/comment/41318757
has comment: http://stackoverflow.com/comment/41317509
has comment: http://stackoverflow.com/comment/41299810
upvote count: 1
has comment: http://stackoverflow.com/comment/41324346
has comment: http://stackoverflow.com/comment/41297930
type: AnsweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/41297801
tagged with: java
has answer: http://stackoverflow.com/a/26315983

http://stackoverflow.com/q/26254465
answer count: 1
has body: I want to fetch the input tag items from the webpage using Selenium Webdriver. Here is the html code : Username: Password: Till now what i have done is : WebDriver driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.get(adminURL); List<WebElement> listElements = driver.findElements(By.xpath("//td[@class='listData']")); System.out.println(listElements.size()); // gives the element size 2 which is valid. for(WebElement el:listElements){ el.findElement(By.xpath("//input[text()='username']")); //didnot find the element } System.out.println(" Title of the page is : "+driver.getTitle()); I am fetching the elements using xpath. But it didnot fetch the element with input type and text username. It throws this exception : Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//input[text()='username']"} Command duration or timeout: 113 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:58' System info: host: 'DS-7071BC8FD7AA', ip: '10.112.94.126', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_60' Session ID: c1b5d8b8-43db-4157-8ab6-32286116d89a Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=WINDOWS, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, webStorageEnabled=true, nativeEvents=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=32.0.3}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Construc…
type: AnsweredQuestion
tagged with: xpath
has answer: http://stackoverflow.com/a/26254681
tagged with: java
accepted answer: http://stackoverflow.com/a/26254681
tagged with: selenium
has comment: http://stackoverflow.com/comment/41185115
type: Question
has title: Finding input tags in the webpage using Webdriver with driver.findElements throwing exception. Why?
has comment: http://stackoverflow.com/comment/41185353
score: 0

http://stackoverflow.com/a/26374422
score: 0
type: AcceptedAnswer
type: Answer
has body: According to a JetBrains employee, this is because the slave instance is launched with the environment given by an external script that's ran. Plugins in the parent process should not call System.getenv() and instead use the EnvironmentUtil.
accepted answer of: http://stackoverflow.com/q/26320583
answers question: http://stackoverflow.com/q/26320583

http://stackoverflow.com/a/26205281
has body: Finally found the issue: when I was resizing my FrameBuffer, I missed to update the renderbuffer size, so the renderbuffer still was 800x600 but the screen was 1300 x 900
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26204802

http://stackoverflow.com/q/26342444
has answer: http://stackoverflow.com/a/33087603
tagged with: android
answer count: 18
has answer: http://stackoverflow.com/a/27436387
has answer: http://stackoverflow.com/a/31430824
has answer: http://stackoverflow.com/a/26713987
accepted answer: http://stackoverflow.com/a/26713987
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35146779
has answer: http://stackoverflow.com/a/29227287
has answer: http://stackoverflow.com/a/31924537
has answer: http://stackoverflow.com/a/36444654
tagged with: java
has answer: http://stackoverflow.com/a/35673142
type: Question
has answer: http://stackoverflow.com/a/40087890
score: 59
has answer: http://stackoverflow.com/a/34563328
has answer: http://stackoverflow.com/a/26483423
linked to: http://stackoverflow.com/q/8059719
has answer: http://stackoverflow.com/a/30552070
upvote count: 59
possible better answer: http://stackoverflow.com/a/29227287
has title: multiple dex files define landroid/support/annotation/AnimRes
has answer: http://stackoverflow.com/a/33486175
has answer: http://stackoverflow.com/a/32059386
downvote count: 0
has body: The moment I added the android support annotations to my dependencies compile 'com.android.support:support-annotations:20.0.0' I got this error: Error Code: 2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287) at com.android.dx.command.dexer.Main.run(Main.java:230) at com.android.dx.command.dexer.Main.main(Main.java:199) at com.android.dx.command.Main.main(Main.java:103) build.gradle android { compileSdkVersion 19 buildToolsVersion '20.0.0' defaultConfig { minSdkVersion 10 targetSdkVersion 19 } } dependencies { compile 'com.android.support:support-v4:19.0.0' compile 'com.crashlytics.android:crashlytics:1.+' compile 'com.android.support:support-annotations:20.0.0' } Anybody else experienced this issue? I have tried the solutions from here.
has answer: http://stackoverflow.com/a/27809512
favorite count: 0
linked to: http://stackoverflow.com/q/24224186
has answer: http://stackoverflow.com/a/41002192
has answer: http://stackoverflow.com/a/43089197

http://stackoverflow.com/q/26201144
linked to: http://stackoverflow.com/q/6255106
tagged with: repaint
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41086311
has comment: http://stackoverflow.com/comment/41086290
type: Question
has title: java awt textfield update
has comment: http://stackoverflow.com/comment/41099874
has comment: http://stackoverflow.com/comment/41099882
has comment: http://stackoverflow.com/comment/41087366
score: 0
has body: I have an issue with my java application. I already read some questions here and none of them helped me. The issue is that I am trying to change text in my textbox which is defined this way: public java.awt.TextField param1; After that I want to load parametre from xml file (I am able to get parametre value), then set it in the textfield. BP_evolution.gui.param1.setText(xsr.getText()); //xsr is XMLStreamReader BP_evolution.gui.param1.repaint(); Where am I wrong with my code, please? Thanks for the answer! Martin
has comment: http://stackoverflow.com/comment/41087348
tagged with: user-interface
tagged with: awt
type: UnansweredQuestion

http://stackoverflow.com/q/26273226
accepted answer: http://stackoverflow.com/a/26273320
type: Question
has comment: http://stackoverflow.com/comment/41220239
has comment: http://stackoverflow.com/comment/41220027
score: -1
has answer: http://stackoverflow.com/a/26273320
tagged with: date
has comment: http://stackoverflow.com/comment/41220096
has body: String dateFromDb = "04-OCT-14 03.47.24.342000000 PM"; SimpleDateFormat datetimeFormatter1 = new SimpleDateFormat("MMM dd,yyyy HH:mm:ss",Locale.ENGLISH); Date Date1 = datetimeFormatter1.parse(dateFromDb); Timestamp fromTS1 = new Timestamp(Date1.getTime()); While converting this exception is thrown: java.text.ParseException: Unparseable date: "04-OCT-14 03.47.24.342000000 PM" at java.text.DateFormat.parse(DateFormat.java:337) Can anyone help?
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41220031
favorite count: 0
has title: Convert String "04-OCT-14 03.47.24.342000000 PM" to java.util.Date
tagged with: datetime
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41219895
upvote count: 0
tagged with: java

http://stackoverflow.com/a/26298435
type: Answer
has body: In Java 8 you can use the Stream API for this long count = IntStream.range(0, n).filter(e -&gt; e % 2 == 0).count();
score: 0
answers question: http://stackoverflow.com/q/26298234

http://stackoverflow.com/a/26325540
upvote count: 1
has body: Try this, first you finish up showing whatever ad you want and finally call finish, this will close the application. This code willl take care of the back key exit scenario. @Override public void onBackPressed() { //Do your stuff finish(); return; }
downvote count: 0
has comment: http://stackoverflow.com/comment/41316788
type: Answer
answers question: http://stackoverflow.com/q/26325504
score: 1

http://stackoverflow.com/a/26375967
downvote count: 6
has body: One problem is that you are trying to instantiate the Arraylist by specifying the generic type in the list, but not using the same type in the Arraylist. Use : List ls = new ArrayList(); Also please provide a default constructor for LocalFoo
score: -5
has comment: http://stackoverflow.com/comment/41416772
has comment: http://stackoverflow.com/comment/41433651
upvote count: 1
has comment: http://stackoverflow.com/comment/41553815
answers question: http://stackoverflow.com/q/26258412
type: Answer

http://stackoverflow.com/comment/51701417
type: QuestionComment
has text: Honestly, I don't think anyone thought of it. Since other parts of the project uses Spring, it was either that, or something out of the box with jersey.
comment on: http://stackoverflow.com/q/26230642
score: 0
type: Comment

http://stackoverflow.com/q/26224059
has title: Go through Array in O(logn) running time?
has body: Is it possible to go through a boolean array to find a false value in O(logn) running time? The array's indices run from 0 to n-1. If it is, how would we do it in java? Pseudo code is fine.
tagged with: java
tagged with: pseudocode
type: Question
has answer: http://stackoverflow.com/a/26224131
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41129635
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26224074
has comment: http://stackoverflow.com/comment/41129672
has comment: http://stackoverflow.com/comment/41129532
tagged with: big-o
has answer: http://stackoverflow.com/a/26224114
has comment: http://stackoverflow.com/comment/41129644
has comment: http://stackoverflow.com/comment/41129594
type: UnansweredQuestion

http://stackoverflow.com/q/26308035
has answer: http://stackoverflow.com/a/26314292
has answer: http://stackoverflow.com/a/37439444
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41347078
upvote count: 52
tagged with: spring
has answer: http://stackoverflow.com/a/30387174
score: 52
has comment: http://stackoverflow.com/comment/41313316
type: UnansweredQuestion
tagged with: java
tagged with: spring-data
has body: I'm trying to connect each @Repositories to different DataSource(s) with Spring Boot and Spring Data JPA. I used the following, http://xantorohara.blogspot.com/2013/11/spring-boot-jdbc-with-multiple.html, as a referrence. Here is the code I am using in an attempt to implement a similar solution using Spring Data JPA. CustomerDbConfig.java(First data source connection) @Configuration @EnableJpaRepositories( entityManagerFactoryRef = "orderEntityManager", transactionManagerRef = "orderTransactionManager", basePackages = {"com.mm.repository.customer"}) public class CustomerDbConfig { @Bean(name = "customerEntityManager") public LocalContainerEntityManagerFactoryBean entityManagerFactory(){ LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] {"com.mm.domain.customer"}); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalJpaProperties()); em.setPersistenceUnitName("customerPersistence"); em.setPackagesToScan("com.mm.domain.customer"); return em; } Properties additionalJpaProperties(){ Properties properties = new Properties(); properties.setProperty("hibernate.hbm2ddl.auto", "create-drop"); properties.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); properties.setProperty("hibernate.show_sql", "true"); return properties; } @Bean public DataSource dataSource(){ return DataSourceBuilder.create() .url("jdbc:h2:mem:customer:H2") .driverClassName("org.h2.Driver") .username("sa") .password("") .build(); } @Bean(name = "customerTransactionManager") public PlatformTransactionManager transactionManager(EntityManagerFactory emf){ JpaTransactionManager transactionManager = new JpaTransactionManager(); transactionManager.setEntityManagerFactory(emf); return transactionManager; } } CustomerDbConfig.java (Second data source) @Configuration @EnableJpaRepositories( entityManagerFacto…
has title: Spring Boot, Spring Data JPA with multiple DataSources
type: Question
tagged with: spring-boot
has answer: http://stackoverflow.com/a/57587843
answer count: 6
has comment: http://stackoverflow.com/comment/41292689
has answer: http://stackoverflow.com/a/33822664
has answer: http://stackoverflow.com/a/36174148

http://stackoverflow.com/comment/45329188
type: Comment
comment on: http://stackoverflow.com/a/26328555
score: 46
type: AnswerComment
has text: What would you have done differently if your intention *had* been to introduce a general-purpose Maybe or Some type? Is there a way in which Optional doesn't fit the bill for one, or is it just that introducing Optionals all over a new API would make it non-Java-ish?

http://stackoverflow.com/comment/41159405
type: Comment
comment on: http://stackoverflow.com/q/26206261
type: QuestionComment
has text: I don't know Hibernate well, I was thinking of a different provider. JPA inheritance isn't what you want for this, as querying on a root requires JPA to give you back all subclass instances, and it will corrupt your cache. You will probably need a new ShortQuestion class with Question still marked as a MappedSuperclass. As long as you don't modify ShortQuestion instances, it doesn't matter if they are marked read-only somehow in the provider.
score: 0

http://stackoverflow.com/q/26254259
type: Question
tagged with: intellij-idea
has body: I have Gradle project. I'm trying to configure Tomcat Server deployment configuration under IntelliJ IDEA 13. I would like to build the project before the deployment automatically. I do not see Gradle in the "Before launch" section. I added gradle build there as an "External tool", but I'm wondering if there is any better way to achieve this. Any clues?
score: 0
answer count: 1
tagged with: tomcat
type: UnansweredQuestion
tagged with: intellij-13
has answer: http://stackoverflow.com/a/27819968
has title: How to setup Tomcat Server configuration in IntelliJ IDEA 13 to build Gradle project before deployment?
tagged with: java
tagged with: gradle

http://stackoverflow.com/a/55837151
score: 1
upvote count: 1
has body: import io.undertow.Handlers; import io.undertow.Undertow; import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; import io.undertow.server.handlers.BlockingHandler; public static void main(String[] args) { Undertow server = Undertow.builder() .addHttpListener(8087, "xx.xx.xx.xx") .setHandler(Handlers.pathTemplate().add("/webhook", new BlockingHandler(new ItemHandler()))) .build(); server.start(); } static class ItemHandler implements HttpHandler { @Override public void handleRequest(HttpServerExchange exchange) throws Exception { exchange.getInputStream()); } }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26203748

http://stackoverflow.com/q/26214517
has comment: http://stackoverflow.com/comment/41130908
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41112996
has comment: http://stackoverflow.com/comment/41111102
downvote count: 1
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26225979
has body: I have an app (A),from Google play, that has a server (Activity), I know the port number that used by this server. How to close that port from my app (B)!. Closing that port will close the server and that is my end target! Edit: I tried to kill the app using the follwoing, but the server still running, so I was thinking to close the port which cause to close the server! ActivityManager am = (ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE); am.killBackgroundProcesses(PackageName);
has title: Android-How to close an open port in android?
type: Question
upvote count: 0
tagged with: kill
answer count: 1
has comment: http://stackoverflow.com/comment/41141353
favorite count: 0
has comment: http://stackoverflow.com/comment/41130963
has comment: http://stackoverflow.com/comment/41131014
tagged with: port
tagged with: android

http://stackoverflow.com/q/26218732
tagged with: hazelcast
upvote count: 3
has answer: http://stackoverflow.com/a/26653164
answer count: 1
favorite count: 0
has body: Currently am using Hazelcast and persistence database as Hbase, So far I have 10 maps, for each map am using a map store, So Am using 10 mapstore classes (i.e) In all the 10 classes am implementing the MapStore. It creates a complexity in maintenance. So What I did is, I kept a generic map store and implemented the same class for all the maps, It has the ability to accept it, To make it clear, I did something like Map1 - com.test.GenericMapStore Map2 - com.test.GenericMapStore Map3 - com.test.GenericMapStore ... Map10 - com.test.GenericMapStore It gets mapped as above, But for the methods in store, storeAll, loadAllKeys, loadAll am able to check the instance of object and find the mapName ---- Not a good way But for methods like delete, deleteAll, load - I dont have any clue to find the mapName, Pls tell me like any way to use a singleMapStore for all the maps??? So I need a map store implementation where, for all methods in mapstore, I need the PARAM called mapName to be passed, So In case, If I have common Implementation, I can make use of it just by using MAP NAME param in all the methods, Example : Store(String key, Object object, String mapName), StoreAll(Map, String mapName), delete(String key, String mapName) delete(Collections keys, String mapName) ... If there is a way already available, Pls do let me know... Thanks hazelcast team,,, You ppl are doing the great job... Much Apprecaiated... Thanks and Regards, Harry
tagged with: hbase
tagged with: dictionary
has title: Is there a possibility to keep a single map store and use for multiple maps in hazelcast
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41119538
type: Question
accepted answer: http://stackoverflow.com/a/26653164

http://stackoverflow.com/comment/41352541
score: 1
type: Comment
has text: Check the post http://stackoverflow.com/questions/23559259/error-while-running-cucumber-in-junit
type: QuestionComment
comment on: http://stackoverflow.com/q/26345371

http://stackoverflow.com/comment/41357958
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26347990
type: Comment
has text: My guess is that the analyzer misinterprets the code and believes that `(float)` binds to the whole expression.

http://stackoverflow.com/comment/41111925
type: Comment
comment on: http://stackoverflow.com/a/26215102
score: 0
type: AnswerComment
has text: Is it same as `++currentIndex`?

spring-boot
tags question: http://stackoverflow.com/q/26303704
tags question: http://stackoverflow.com/q/26257967
type: Tag
tags question: http://stackoverflow.com/q/26202567
tags question: http://stackoverflow.com/q/26284103
tags question: http://stackoverflow.com/q/26213050
tags question: http://stackoverflow.com/q/26280319
tags question: http://stackoverflow.com/q/26319412
tags question: http://stackoverflow.com/q/26325739
tags question: http://stackoverflow.com/q/26324084
tags question: http://stackoverflow.com/q/26332051
tags question: http://stackoverflow.com/q/26308035
tags question: http://stackoverflow.com/q/26328943
tags question: http://stackoverflow.com/q/26286736
tags question: http://stackoverflow.com/q/26259783
tags question: http://stackoverflow.com/q/26206988
tags question: http://stackoverflow.com/q/26329300
tags question: http://stackoverflow.com/q/26236811
tags question: http://stackoverflow.com/q/26296579
tag name: spring-boot
tags question: http://stackoverflow.com/q/26242492
tags question: http://stackoverflow.com/q/26330519
tags question: http://stackoverflow.com/q/26238505
tags question: http://stackoverflow.com/q/26324918
tags question: http://stackoverflow.com/q/26315635
tags question: http://stackoverflow.com/q/26351278
tags question: http://stackoverflow.com/q/26236039
tags question: http://stackoverflow.com/q/26285609
tags question: http://stackoverflow.com/q/26259870
tags question: http://stackoverflow.com/q/26302753

http://stackoverflow.com/a/26293348
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26293330
has body: This line is causing the error. for(int i=1; i&lt;=temperatures.length + 1; i++) Your i in the loop should start from 0 as arrays in Java start from the 0th index.. Also your loop should go till i This will navigate smoothly for 7 times. Try this for(int i=0; i &lt; temperatures.length; i++)
downvote count: 0

http://stackoverflow.com/q/26350970
answer count: 1
tagged with: tomcat
tagged with: slf4j
score: 0
has answer: http://stackoverflow.com/a/26394978
accepted answer: http://stackoverflow.com/a/26394978
tagged with: logging
has title: Tomcat log is not created when the application and server are started through eclipse
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has body: I'm using slf4j with the following configuration ${CATALINA_HOME}/logs/GO.log %date %-5level [%thread] - [%logger] - %msg%n <appender-ref ref="stdout"/> <appender-ref ref="FILE"/> If I start tomcat using startup.bat I can see the GO.log and the catalina.{date}.log get generated. If I start tomcat from Eclipse no luck. I tried defining CATALINA_HOME in my env. variables to no avail. I get this error 14:26:54,179 |-ERROR in ch.qos.logback.core.FileAppender[FILE] - openFile(CATALINA_HOME_IS_UNDEFINED/logs/GO.log,true) call failed. java.io.FileNotFoundException: CATALINA_HOME_IS_UNDEFINED\logs\GLOBE_ONE.log (The system cannot find the path specified) at java.io.FileNotFoundException: CATALINA_HOME_IS_UNDEFINED\logs\GO.log (The system cannot find the path specified) at at java.io.FileOutputStream.open(Native Method) at at java.io.FileOutputStream.<init>(FileOutputStream.java:206) How can I start the Tomcat through Eclipse in a "correct" manner which would allow me to log to the GO.log file?

http://stackoverflow.com/comment/41277811
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26304819
has text: Pretty sure it's a problem with the code.

http://stackoverflow.com/comment/41363656
type: QuestionComment
comment on: http://stackoverflow.com/q/26351423
score: 1
has text: I moved the instantiation, and setting total money from inside the StandFragment class' onCreateView() method seems to work for me. So I guess problem solved, thanks!
type: Comment

http://stackoverflow.com/a/26208357
has comment: http://stackoverflow.com/comment/41100138
has comment: http://stackoverflow.com/comment/41100484
has comment: http://stackoverflow.com/comment/41099587
score: 0
has body: There should not be a semi-colon at the end of line 13. (The "switch" line). Once you have fixed that, you will then see that the syntax of the "case" clauses is wrong. And "any other character" is nonsense from the Java perspective. (I'm surprised that the Java compiler didn't throw a house-brick at you!) I'm not sure what's wrong with what I'm doing. You are trying to write Java without bothering to learn it properly. That is wrong on many levels. I recommend that you read the Oracle Java Tutorial. For this example, read the Switch Statement page.
type: Answer
has comment: http://stackoverflow.com/comment/41100536
answers question: http://stackoverflow.com/q/26208296

http://stackoverflow.com/comment/41294684
has text: Respect the Java naming conventions in Java code, even if the JSON fields do not respect it. See http://fasterxml.github.io/jackson-annotations/javadoc/2.4/com/fasterxml/jackson/annotation/JsonProperty.html
comment on: http://stackoverflow.com/q/26314283
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/26204667
type: Answer
has body: arrayVehicle[0] is a variable of type Vehicle. So, even if it references an object of type Truck, the compiler doesn't know that. The only thing the compiler knows is that arrayVehicle[0] is a Vehicle. So it doesn't let you access a method that is not defined in the Vehicle class. To access a method defined in Truck, you need a variable of type Truck: Vehicle[] arrayVehicle = new Vehicle[1]; Truck truck = new Truck("AAA333"); arrayVehicle[0] = truck; truck.setPma(...);
has comment: http://stackoverflow.com/comment/41094981
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26204556
accepted answer of: http://stackoverflow.com/q/26204556

http://stackoverflow.com/q/26224236
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41129976
has comment: http://stackoverflow.com/comment/41130018
favorite count: 0
has body: I've implemented it successfully with count, the book I'm using to learn just shows the code but without any proper explanation. I've tried doing some search on google but can't find a material explaining it. All what I've understood that Front and Rear points will assume the same location if the array is empty or full, so we are using an extra slot in the array "to do some sort of checking I don't understand to get it done". Does anybody have a tutorial on this? I'm sorry if this comes as waiting for someone to feed me information, but I truly cannot find anything.
has title: Circular Queue using arrays with no count approach. (java)
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26224400
score: -1

http://stackoverflow.com/a/26324502
has body: Actually all the trick is not related to generics even you snippet showcase it. It related to overriden methods, toString() is defined in the super super class Object and overriden in the String class, that are evalutated at runtime using the actual object type and not its reference, i.e when calling: Object o = new String("hello"); o.toString(); // Here at runtime, the JVM will call the "hello" toString method and not the Object one. In you code, you have called: al.add("Hello World"); The above line do the following: Creates a new String object with Hello World as a literal and add it to the string pool. Makes the first element in the list (element at index 0) reference that object (that is a String one). Now when calling System.out.print(al.get(0));: The first element of the list, which is an Object reference to a String object, got his toString() method called and which as already said will evalute to the object real type and not the refence type, i.e. you will have String#toString method called.
has comment: http://stackoverflow.com/comment/41315200
downvote count: 0
has comment: http://stackoverflow.com/comment/41338768
has comment: http://stackoverflow.com/comment/41340201
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26323777
answers question: http://stackoverflow.com/q/26323777
has comment: http://stackoverflow.com/comment/41316333
type: Answer

http://stackoverflow.com/comment/41171471
score: 0
type: Comment
has text: I get a null pointer exception from calling both the x and y values of the center of the circle.
type: AnswerComment
comment on: http://stackoverflow.com/a/26246350

http://stackoverflow.com/q/26301874
has comment: http://stackoverflow.com/comment/41272361
type: Question
score: -1
has title: JAVA, Quarterly Interest with for loop
has comment: http://stackoverflow.com/comment/41272598
has answer: http://stackoverflow.com/a/26302479
tagged with: for-loop
answer count: 1
tagged with: banking
has comment: http://stackoverflow.com/comment/41296158
favorite count: 0
has comment: http://stackoverflow.com/comment/41273039
has comment: http://stackoverflow.com/comment/41272453
has comment: http://stackoverflow.com/comment/41272490
type: UnansweredQuestion
has body: import java.io.*; import java.util.*; public class DonaldsonDuaneMidtermActivity3A { public static void main (String[] args) { Scanner keyboard = new Scanner(System.in); float annualRate = 0.0F; float quarterlyRate = 0.0F; double principal = 0.0; double interest = 0.0; double finalAmount = 0.0; byte quarter = 0; int year = 0; annualRate = 0.05F; System.out.print("Enter the year: "); year = Integer.parseInt(keyboard.nextLine()); System.out.print("Enter the initial principal: "); principal = Double.parseDouble(keyboard.nextLine()); System.out.printf("%s%.2f%n", "Principal = ", principal); System.out.printf("%s%.2f%c%n", "Interest Rate = ", annualRate * 100, '%'); System.out.printf("%6s%8s%16s%30s%n", "Year", "Quarter", "Interest Earned", &gt;"Amount at end of quarter"); quarterlyRate = annualRate / 4; quarter = 1; interest = principal * quarterlyRate; finalAmount = principal + interest; System.out.printf("%6s%8d%16.2f%30.2f%n", year, quarter, interest, finalAmount); principal = finalAmount; quarter = 2; interest = principal * quarterlyRate; finalAmount = principal + interest; System.out.printf("%6s%8d%16.2f%30.2f%n", year, quarter, interest, finalAmount); principal = finalAmount; quarter = 3; interest = principal * quarterlyRate; finalAmount = principal + interest; System.out.printf("%6s%8d%16.2f%30.2f%n", year, quarter, interest, finalAmount); principal = finalAmount; quarter = 4; interest = principal * quarterlyRate; finalAmount = principal + interest; System.out.printf("%6s%8d%16.2f%30.2f%n", year, quarter, interest, finalAmount); System.exit(0);`enter code here` } } First post, please be kind, I have searched for similar programs but did not see any like this one. I will assume that I need to put more in the for loop than just my 4 different quarters to iterate through them. I also need to output something to the screen which will be exactly the same as the program without the for loop. I have played with it some and cant get everything to print.out as required. T…
has comment: http://stackoverflow.com/comment/41272842
has comment: http://stackoverflow.com/comment/41272398
has comment: http://stackoverflow.com/comment/41295288
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41272633
upvote count: 1

http://stackoverflow.com/comment/90366461
score: 0
type: Comment
has text: If you classes are under test package this solution doesnt work, but it must work if you put @service on implementation. If it doesnt work. can you put the code?.
comment on: http://stackoverflow.com/a/51669658
type: AnswerComment

http://stackoverflow.com/a/26256070
has body: public static boolean isListOfStringArraysContainsString(List&lt;String[]&gt; arrayList, String s) { for (String[] arr : arrayList) { for (String string : arr) { if ((string != null) &amp;&amp; (string.equals(s))) { return true; } } } return false; } Provided code do exactly what you are asking about, but solution provided by @assylias is proper
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26255862
type: Answer
has comment: http://stackoverflow.com/comment/41188176
score: 4

http://stackoverflow.com/comment/41174110
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26227999
has text: Yes the transporta returns null exception, u have email? If u want i can send the project on your email
type: AnswerComment

http://stackoverflow.com/a/26402719
score: 15
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26216088
accepted answer of: http://stackoverflow.com/q/26216088
type: Answer
has comment: http://stackoverflow.com/comment/52597732
downvote count: 1
upvote count: 16
has body: In setUpNavDrawer mDrawerLayout.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); Also @Override public void onBackPressed() { if (mDrawerLayout.isOpen()) mDrawerLayout.close(); else super.onBackPressed(); }
has comment: http://stackoverflow.com/comment/46553699

http://stackoverflow.com/comment/41168436
comment on: http://stackoverflow.com/q/26244877
score: 2
has text: Why do people use bitwise operators in general? Or for the solution to the problem? Or are you wondering exactly what's going on with this code?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26282934
tagged with: web-services
type: Question
tagged with: peoplesoft
has body: We are working on a POC to integration from a custom Java application to integrate to the Student PeopleSoft authenticated/secure REST web services. The Liferay Portal and Student Peoplesoft are integrated with the Oracle IdM SSO on the Web tier. We are developing server side Java plugin code (Liferay) to connect to the PeopleSoft authenticated/secure REST web services. The PeopleSoft authenticated/secure REST web services need a username / password or a token in the basic authorization headers for the connection to be successful. Has anyone done this before? The challenge we are running into is that java code does not have access to the credentials for the student or a valid token for the backend PIA where the web services are hosted on the Integration Broker. Any insight on this would be very valuable. Background on Platform/architecture: Java: Liferay Portal as the Java platform. Domain – example.liferay.com. We are hoping to develop a Liferay Java Portlet plugin. However, this could be any Java platform/application. Integrated to Oracle IdM SSO ERP: Student PeopleSoft – authenticated REST web services hosted on a separate backend PIA not integrated to the Oracle IdM SSO. Integrated to Oracle IdM SSO on another Web facing PIA. Domains - student.frontend.com, student.backend.com. SSO: Oracle IdM Thanks for all the help!
linked to: http://stackoverflow.com/q/27385311
tagged with: liferay
upvote count: 1
answer count: 1
has title: Authenticated REST Web services integration from Java
favorite count: 0
has answer: http://stackoverflow.com/a/32508762
accepted answer: http://stackoverflow.com/a/32508762
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: authentication

http://stackoverflow.com/comment/41323880
has text: I've tried this and what else was suggested and it will work for other .exe I try to execute, but still not python.exe. I don't know if it's something specific to python.exe or what.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26321383
type: Comment

http://stackoverflow.com/comment/41331798
score: 0
comment on: http://stackoverflow.com/a/26334197
type: AnswerComment
has text: @Raistlin getting same Error check your LogCat again.
type: Comment

spring-security
tags question: http://stackoverflow.com/q/26348877
tags question: http://stackoverflow.com/q/26256358
tags question: http://stackoverflow.com/q/26238887
tags question: http://stackoverflow.com/q/26340695
tags question: http://stackoverflow.com/q/26256831
type: Tag
tags question: http://stackoverflow.com/q/26313059
tags question: http://stackoverflow.com/q/26328647
tags question: http://stackoverflow.com/q/26194696
tags question: http://stackoverflow.com/q/26260697
tags question: http://stackoverflow.com/q/26307747
tags question: http://stackoverflow.com/q/26297490
tags question: http://stackoverflow.com/q/26336676
tags question: http://stackoverflow.com/q/26281583
tags question: http://stackoverflow.com/q/26258461
tags question: http://stackoverflow.com/q/26329564
tags question: http://stackoverflow.com/q/26285609
tags question: http://stackoverflow.com/q/26263715
tags question: http://stackoverflow.com/q/26229058
tags question: http://stackoverflow.com/q/26336205
tags question: http://stackoverflow.com/q/26336440
tags question: http://stackoverflow.com/q/26281189
tags question: http://stackoverflow.com/q/26202567
tags question: http://stackoverflow.com/q/26343666
tags question: http://stackoverflow.com/q/26260101
tags question: http://stackoverflow.com/q/26335941
tags question: http://stackoverflow.com/q/26215500
tags question: http://stackoverflow.com/q/26272641
tag name: spring-security
tags question: http://stackoverflow.com/q/26346853
tags question: http://stackoverflow.com/q/26280689
tags question: http://stackoverflow.com/q/26332051
tags question: http://stackoverflow.com/q/26330148

http://stackoverflow.com/comment/41290576
has text: What is definition of a sentence?
type: QuestionComment
comment on: http://stackoverflow.com/q/26311845
score: 4
type: Comment

http://stackoverflow.com/a/26291019
has comment: http://stackoverflow.com/comment/41252815
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41252839
answers question: http://stackoverflow.com/q/26290929
upvote count: 1
has comment: http://stackoverflow.com/comment/41252949
downvote count: 1
has comment: http://stackoverflow.com/comment/41317824
has body: I think this is basic OOP problem: Polynomial should be parent class of Term (or Polynomial is an interface) interface Polynomial { double getExp(); } class Term implements Polynomial { private double coeff; private double exp; public Term (double e,double c){ coeff=c; exp=e; } @overide public double getExp(){ return exp; } }

http://stackoverflow.com/a/26276648
upvote count: 1
has body: The @Column annotation is defined on the fields, not on the class. So you must query annotation values from the private fields: String columnName = getAnnotationValue(PROVINCE.class.getDeclaredField("provinceCode"), Column.class, "name"); To be able to pass Field objects to your method, change the type of your classType parameter from Class to AnnotatedElement. Then you can pass classes, fields, parameters or methods: public static String getAnnotationValue(AnnotatedElement element, Class annotationType, String attributeName) { ... }
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26276386
type: Answer

http://stackoverflow.com/comment/41192009
type: QuestionComment
comment on: http://stackoverflow.com/q/26258348
score: 0
has text: you have to configure smtp in your tomcat server.xml, did you do that?
type: Comment

http://stackoverflow.com/comment/41295425
score: 1
has text: Or replace the last `else if` by `else`
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26314730

http://stackoverflow.com/comment/41245055
comment on: http://stackoverflow.com/a/26285958
type: Comment
score: 0
has text: @KazuoKatiushi Stack overflow means the recursion doesn't stop. I can't see any obvious bug just looking at the code. You should try to add some debug prints or run the method with a debugger, and see how the value of Pi changes with each recursive call.
type: AnswerComment

http://stackoverflow.com/q/26263506
has comment: http://stackoverflow.com/comment/41202728
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41202327
has title: Parsing kml files using Java in eclipse
has body: I am pretty new to Java and I'm not entirely sure how to go about reading KML files in Java. I mainly need it to spit out coordinates to be used to compare your location to another. I'm wondering whether this code gives me KML from XML or reads the KML/XML and converts it into Java. Currently I get errors including: Exception in thread "main" java.lang.Error: Unresolved compilation problems: PlaceMark cannot be resolved to a type PlaceMark cannot be resolved to a type LookAt cannot be resolved to a type LookAt cannot be resolved to a type Point cannot be resolved to a type Point cannot be resolved to a type Polygon cannot be resolved to a type Polygon cannot be resolved to a type Coordinates cannot be resolved to a type Coordinates cannot be resolved to a type Coordinates cannot be resolved to a type Coordinates cannot be resolved to a type Coordinates cannot be resolved to a type Coordinates cannot be resolved to a type NetworkLink cannot be resolved to a type NetworkLink cannot be resolved to a type at org.eclipse.stem.ui.ge.kml.KmlDoc.main(KmlDoc.java:385) package org.eclipse.stem.ui.ge.kml; /******************************************************************************* * Copyright (c) 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ import java.io.FileOutputStream; import java.io.OutputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.D…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41203273
has comment: http://stackoverflow.com/comment/41202111
has answer: http://stackoverflow.com/a/26263996
has comment: http://stackoverflow.com/comment/41206592
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/41202453
has comment: http://stackoverflow.com/comment/41204150
tagged with: kml
has comment: http://stackoverflow.com/comment/41202068
accepted answer: http://stackoverflow.com/a/26263996
has comment: http://stackoverflow.com/comment/41202128
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41203588

http://stackoverflow.com/comment/41185465
has text: note my update to the answer ... mappedBy is missing? Also you only need to define the join table from one side when it is a M-N
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26253124

http://stackoverflow.com/comment/41090622
type: Comment
has text: Well How do i make the string the value after the timer has finished
comment on: http://stackoverflow.com/a/26202163
type: AnswerComment
score: 0

flashlight
tags question: http://stackoverflow.com/q/26202403
type: Tag
tag name: flashlight

http://stackoverflow.com/comment/41201279
has text: @Mohammad Thank you sir.. I appricated so much. Eid Mubarak. ^^
comment on: http://stackoverflow.com/a/26263041
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/77960449
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/40642204
score: 2
has text: I guess this is essentially the same thing as the accepted answer - not having JDK you wouldn't have tools.jar either.

http://stackoverflow.com/comment/41125960
has text: That didn't work either, so it made me think that the problem had to be somewhere else, so I checked again and that's where i realized... the server was being executed from a non-ascii path, so I moved the project and now it works like a charm.
comment on: http://stackoverflow.com/a/26221905
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26226522
score: 3
has comment: http://stackoverflow.com/comment/41139594
duplicate of: http://stackoverflow.com/q/15624667
upvote count: 3
has body: I have installed Java 8 on a Mac (OS 10.9.5) and it now appears in System Preferences. However, when I type the following in the command line: java -version it shows that I am using version 6: java version "1.6.0_65" How can I make version 8 the default?
tagged with: java
linked to: http://stackoverflow.com/q/15624667
has title: How do I make Java 8 the default on a Mac?
type: Question
has comment: http://stackoverflow.com/comment/41134125
has comment: http://stackoverflow.com/comment/41134187
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26226562
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41259286
score: 0
type: Comment
type: QuestionComment
has text: make sure you have `R.id.itemListView` in `activity_main`
comment on: http://stackoverflow.com/q/26294834

http://stackoverflow.com/q/26251486
downvote count: 0
answer count: 1
tagged with: polymorphism
has answer: http://stackoverflow.com/a/26263739
favorite count: 0
type: UnansweredQuestion
has body: I need to deserializa a Json like this: { "arrayObj1":[ { "type":"t1", "value":[ { "value1":"a" }, { "value2":"b" } ], "otherInfo":"abc" } ] } Thats how i try to do it: public class ClassA{ private ArrayObj1[] arrayObj1;} Then... public class ArrayObj1 extends Value{ private String type; private Value [] value; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "type") @JsonSubTypes(value={ @JsonSubTypes.Type(value = T1.class, name = "t1") }) public void setValue (Value [] value){ this.value = value; } } and... public abstract class Value {} This is the error iv got: com.fasterxml.jackson.databind.JsonMappingException: Unexpected token (START_OBJECT), expected START_ARRAY: need JSON Array to contain As.WRAPPER_ARRAY type information for class ... etc How to handle this? Thanks. EDIT: This is how i deserialize: public ClassA getObj (String jsonString) { ClassA obj = null; try { obj = new ObjectMapper().readValue(jsonString, ClassA.class); } catch (IOException e) { e.printStackTrace(); } return obj; } Full error is: com.fasterxml.jackson.databind.JsonMappingException: Unexpected token (START_OBJECT), expected START_ARRAY: need JSON Array to contain As.WRAPPER_ARRAY type information for class .Value at [Source: java.io.StringReader@4317b868; line: 1, column: 496] (through reference chain: .ClassA["arrayObj1"]->.ArrayObj1["value"])
has title: Jackson Polymorphic Deserialization expected START_ARRAY
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41180274
upvote count: 5
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41180306
tagged with: jackson
score: 5

http://stackoverflow.com/q/26288637
downvote count: 0
has body: I'm looking at the following netty example - a simple echo client and server. When the server bidns to the port, we're waiting for the bind to be complete by calling sync(). After this, the channel is being closed as follows: ChannelFuture f = b.bind(PORT).sync(); // Wait until the server socket is closed. f.channel().closeFuture().sync(); Question: Why close the channel? Will this not close the channel that accepts connections?
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: netty
has comment: http://stackoverflow.com/comment/42535925
answer count: 0
has comment: http://stackoverflow.com/comment/41250112
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41311067
has title: Closing ChannelFuture after bind
has comment: http://stackoverflow.com/comment/41249197
score: 2

http://stackoverflow.com/q/26337866
has body: I have this project structure: /src /main /java /resources /test /java /resources /it /java /resources test for unit tests and it for integration tests. I'm using build-helper-maven-plugin to add additional test sources/resources to the classpath for later use maven-surfire-plugin for run unit tests and maven-failsafe-plugin for integration tests. Plugin config as belows: org.codehaus.mojo build-helper-maven-plugin 1.9.1 add-integration-test-sources generate-test-sources add-test-source src/it/java add-integration-test-resources generate-test-resources add-test-resource /src/it/resources This works fine for the test-sources (they are coppied correctly to /target/test-classes) but doesn't copy test-resources. I've tried different combinations of : use <resource> instead , use an specific file instead a directory...but neither works. Stacktrace with the error: Caused by: org.apache.maven.plugin.PluginConfigurationException: Unable to parse configuration of mojo org.codehaus.mojo:build-helper-maven-plugin:1.9.1:add-test-resource for parameter directory: Cannot configure instance of org.apache.maven.model.Resource from src/it/resources at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:597) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:529) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) PROVISIONALLY, I've fixed it adding the integration tests resources to maven configuration: ... src/it/resources But I would prefer to have centralized all classpath modifications under build-helper-maven-plugin. Can anyone post example with a correct config? Thanks in advance.
has title: build-helper-maven-plugin add-test-resource error
type: AnsweredQuestion
downvote count: 0
tagged with: maven-plugin
favorite count: 0
tagged with: build-helper-maven-plugin
has answer: http://stackoverflow.com/a/26339938
score: 19
type: Question
tagged with: maven
upvote count: 19
tagged with: java
tagged with: integration-testing
answer count: 1
accepted answer: http://stackoverflow.com/a/26339938

http://stackoverflow.com/comment/41270455
score: 0
type: AnswerComment
has text: But what about the break statement? Assume at i = 3, we have found our target. So far we have iterated 3 times, the J loop will iterate 97 times, then break! We have only iterated 100 times which would be equal to N.
type: Comment
comment on: http://stackoverflow.com/a/26288233

http://stackoverflow.com/q/26336437
tagged with: exception
has comment: http://stackoverflow.com/comment/41335857
has answer: http://stackoverflow.com/a/26336710
answer count: 5
type: UnansweredQuestion
has title: Java exception handling get console error message
has answer: http://stackoverflow.com/a/26341739
has body: I want to get error message using java when exception are generated. now I have java code with following scenario: method first(){ try{ second(); }catch(Exception e){ System.out.println("Error:&gt; "+e) } } method second(){ try{ my code }catch(Exception e){ throw new Exception("Exception generate in second method",e); } } now when the first method execute then I get only "Exception generate in second method" message but there is some other message printed on console by java so how to get that console error message. Note: I have already try with e.getMessage(); and e.printStackTrace();
has answer: http://stackoverflow.com/a/26336553
type: Question
has answer: http://stackoverflow.com/a/26336673
tagged with: java
has comment: http://stackoverflow.com/comment/41335924
has answer: http://stackoverflow.com/a/26337148
has comment: http://stackoverflow.com/comment/41336162
has comment: http://stackoverflow.com/comment/41344930
score: 0
has comment: http://stackoverflow.com/comment/41344790

http://stackoverflow.com/comment/41199999
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26262125
type: Comment
has text: @aioobe yes it will result in `ConcurrentModificationException`

http://stackoverflow.com/comment/102080017
comment on: http://stackoverflow.com/a/26304440
type: AnswerComment
score: 5
has text: @AlmirCampos nevertheless, I find the answer useful. I ask myself: does this answer help me, and will it help others on SO? For me, the answer is 'yes'.
type: Comment

http://stackoverflow.com/q/26199370
has comment: http://stackoverflow.com/comment/61672212
has answer: http://stackoverflow.com/a/26199454
has comment: http://stackoverflow.com/comment/41083112
has body: So in this code, I am trying to have the user enter in a year and a month (first 3 letters) and then determine how many days that specific month contains. Because of the difficulty involving leap years, I am having trouble with coding the part where the user enters "Feb" as a month. When I tested it, it said: "Feb 2002 has 29 days" "Feb 2002 has 28 days" How do I make it so that it shows only 29 days? public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a year: "); int year= input.nextInt(); input.nextLine(); System.out.println("Enter a month (first 3 letters with the first letter in uppercase): "); String month = input.nextLine(); // leap year logic starts here if (year % 4 == 0 || "Feb".equals(month)) { System.out.println( month + year + "has 29 days"); } else if (year % 4 &gt; 0 || "Feb".equals(month)) { System.out.println( month + year + "has 28 days"); } else if("Jan".equals(month) || "Mar".equals(month) || "May".equals(month) || "July".equals(month) || "Aug".equals(month) || "Oct".equals(month) || "Dec".equals(month)) { System.out.println(month + year + "has 31 days"); } else if ("Apr".equals(month)|| "Jun".equals(month) || "Sep".equals(month) || "Nov".equals(month)) { System.out.println(month + year + "has 30 days"); }
type: AnsweredQuestion
tagged with: if-statement
tagged with: java
has title: Multiple If Statements for leap year logic, how to structure them?
has comment: http://stackoverflow.com/comment/41083307
type: Question
possible better answer: http://stackoverflow.com/a/26199454
answer count: 2
has comment: http://stackoverflow.com/comment/41083125
score: 0
has answer: http://stackoverflow.com/a/26199400
accepted answer: http://stackoverflow.com/a/26199400

http://stackoverflow.com/a/26234221
score: 2
has comment: http://stackoverflow.com/comment/41158687
downvote count: 0
has comment: http://stackoverflow.com/comment/41147670
has body: As things stand, you've used A as a raw type in your definition of C: C&lt;T2 extends A&gt; That's a bad idea, and you can't expect to get information about the type parameters in this context because you haven't specified any. There is no T to find. In your definition of A, the type T is just a parameter. Until you use a specific A with a particular class as a parameter, T doesn't refer to anything. When you define C, you have to say what flavour of A you're extending, or, in other words, specify a real type. What you're doing is a bit like asking what the value of x is in f(x) = x+1. Until you invoke f with some particular argument, x is just a label.
upvote count: 2
answers question: http://stackoverflow.com/q/26234063
type: Answer

http://stackoverflow.com/comment/41282203
comment on: http://stackoverflow.com/q/26306882
has text: I added an edit, but the question was more towards how to ignore transparent pixels, sorry
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41341004
score: 5
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26339360
has text: why do you want to insert numbers as string in an arraylist

http://stackoverflow.com/comment/41314161
score: 1
has text: @MarkoTopolnik I said "nearly" half a century because I was thinking of C in 1972, though really the same technique would have been used in other languages before then so really it would be more than half a century, though I'm not sure just when having object-size handled for you (like C, in Java you only have to do `row*cols + col`, not `(row*cols + col) * size_el`) so I won't push the claim past "nearly half a century".
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26319371

http://stackoverflow.com/q/26199209
has comment: http://stackoverflow.com/comment/41083012
tagged with: java
type: Question
has title: Finding Sides/Angles of a triangle
score: 0
tagged with: trigonometry
answer count: 1
tagged with: geometry
has answer: http://stackoverflow.com/a/26199249
has body: I'm attempting to find the angles/sides of a triangle based on points that are scanned in. So, sides are calculated, then angles. My side lengths seem to be correct, however I keep getting the wrong value for the angle. The values being used for the formula are supposed to be "height = 3" and "sideA = 3.16." Now, if I input those values directly, I get the correct result.. If I use my height and sideA variables, I get an incorrect result even though those are outputting the correct values. Value with input of "3/3.16" = .949763------------------------------------------------------------------------------- Value with input of "height/sideA" = .74999 EDIT: Point values are "(0.0,0.0) (4.0,0.0) (3.0,3.0)" public class Triangle { private double sideA; private double sideB; private double sideC; private double height; private double x1; private double y1; private double x2; private double y2; private double x3; private double y3; public void setX1( double x){ x1 = x; } public void setY1( double y){ y1 = y; } public void setX2( double x){ x2 = x; } public void setY2( double y){ y2 = y; } public void setX3( double x){ x3 = x; } public void setY3(double y){ y3 = y; } public void setHeight(){ height = (x3 - x1); } public double getHeight() { return height; } public void setLengthC(){ sideA = Math.sqrt( Math.pow((x2 - x1), 2.0) + Math.pow((y2 - y1), 2.0)); } public double getLengthC(){ return sideA; } public double getAngleA() { double sine = Math.asin(Math.sin(height/sideA)); return sine; } } And here is the tester class. import java.util.*; public class TriangleTester { public static void main(String [] args){ Scanner scan = new Scanner(System.in); Triangle test = new Triangle(); System.out.print("Please enter a value for X1: "); test.setX1(scan.nextDouble()); System.out.print("Please enter a value for Y1: "); test.setY1(scan.nextDouble()); System.out.print("Please enter a value for X2: "); test.setX2(scan.nextDouble()); System.out.print("Please enter a value for Y2: "); te…
type: UnansweredQuestion

http://stackoverflow.com/a/26335196
has comment: http://stackoverflow.com/comment/41336689
has body: Change your java permission. read thisenter link description here
has comment: http://stackoverflow.com/comment/41338316
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26335119

http://stackoverflow.com/comment/41075556
type: QuestionComment
comment on: http://stackoverflow.com/q/26194945
has text: You can declare static classes inside other classes which gives you a similar behavior to declaring multiple top-level classes. http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
score: 0
type: Comment

http://stackoverflow.com/q/26294438
has body: I have to upgrade vaadin6 application to vaadin7. The problem that I meet now is the interface com.vaadin.terminal.ParameterHandler. It doesn't exist in vaadin7 API. In vaadin6 this interface contains the function void handleParameters(Map). In addition the function com.vaadin.ui.Window.addParameterHandler(ParameterHandler) isn't known in vaadin7. So it seems that there's a new mechanism of handling parameters in vaadin7. Does someone know this new mechanism please?
type: Question
has comment: http://stackoverflow.com/comment/41271922
tagged with: vaadin7
favorite count: 0
has comment: http://stackoverflow.com/comment/41266086
upvote count: 1
has comment: http://stackoverflow.com/comment/41269073
tagged with: java
tagged with: vaadin
has title: What is the replacement of `ParameterHandler` from Vaadin6 for Vaadin7
has comment: http://stackoverflow.com/comment/41272027
linked to: http://stackoverflow.com/q/16493773
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/44342093
has text: Random tip: When you're tossing input, you don't need to save it to a variable. Just call the method without assigning it to anything, and it will do the same thing, without the memory allocation/deallocation overhead.
comment on: http://stackoverflow.com/q/26349502
score: 0
type: QuestionComment
type: Comment

opencv
type: Tag
tags question: http://stackoverflow.com/q/26233010
tags question: http://stackoverflow.com/q/26201161
tag name: opencv
tags question: http://stackoverflow.com/q/26341237
tags question: http://stackoverflow.com/q/26282608

http://stackoverflow.com/a/26200045
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/26199994
upvote count: 1
answers question: http://stackoverflow.com/q/26199994
has body: I'm writing an API and would like to throw an IOException. That is just fine. Go ahead and do it. I was taught that we should always wrap exceptions in custom exceptions in APIs. If someone taught you that, they are just plain wrong. It is generally considered best practice to use (e.g. throw) standard exceptions where they are applicable. For example: 9) Use Standard Exceptions Our ninth Java best practice advise on using standard and inbuilt Java Exceptions. Using standard Exception instead of creating own Exception every now and then is much better in terms of maintenance and consistency. Reusing standard exception makes code more readable, because most of Java developers are familiar with standard RuntimeException from JDK like, IllegalStateException, IllegalArgumentException or NullPointerException, and they will immediately be able to know purpose of Exception, instead of looking out another place on code or docs to find out purpose of user defined Exceptions. Reference: http://javarevisited.blogspot.com.au/2013/03/0-exception-handling-best-practices-in-Java-Programming.html
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/42914473
upvote count: 3
has body: That's what you should do: You have to implement Receiver and then sequencer = MidiSystem.getSequencer(); sequencer.open(); transmitter = sequencer.getTransmitter(); transmitter.setReceiver(this); and after that, the next method will be triggered every time an event occurs: @Override public void send(MidiMessage message, long timeStamp) { if(message instanceof ShortMessage) { ShortMessage sm = (ShortMessage) message; int channel = sm.getChannel(); if (sm.getCommand() == NOTE_ON) { int key = sm.getData1(); int velocity = sm.getData2(); Note note = new Note(key); System.out.println(note); } else if (sm.getCommand() == NOTE_OFF) { int key = sm.getData1(); int velocity = sm.getData2(); Note note = new Note(key); System.out.println(note); } else { System.out.println("Command:" + sm.getCommand()); } } } and if you want, you can use this class too: public class Note { private static final String[] NOTE_NAMES = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}; private String name; private int key; private int octave; public Note(int key) { this.key = key; this.octave = (key / 12)-1; int note = key % 12; this.name = NOTE_NAMES[note]; } @Override public boolean equals(Object obj) { return obj instanceof Note &amp;&amp; this.key == ((Note) obj).key; } @Override public String toString() { return "Note -&gt; " + this.name + this.octave + " key=" + this.key; } }
score: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26266411

http://stackoverflow.com/comment/41347264
comment on: http://stackoverflow.com/q/26342520
type: QuestionComment
has text: Is **radius** your custom way to say **circle**?
score: 0
type: Comment

http://stackoverflow.com/q/26218257
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26218585
score: 0
tagged with: java
type: Question
tagged with: gwt
tagged with: http://stackoverflow.com/tag/json
has title: Parsing JSON array using Autobean
tagged with: autobean
has answer: http://stackoverflow.com/a/26218585
answer count: 1
has body: I have a JSON which I'd like to parse using Autobean. I'm getting NullPointerException in the for loop, probably persons.getPersons() AppAutoBeanFactory factory = GWT.create(AppAutoBeanFactory.class); AutoBean&lt;PersonsWrapper&gt; bean =AutoBeanCodex.decode(factory, PersonsWrapper.class, "{\"persons\": " + strResponse + "}"); IPersons persons = bean.as().getPersons(); for (IPerson person : persons.getPersons()) { ... } my AppAutoBeanFactory looks like this: interface AppAutoBeanFactory extends AutoBeanFactory { AutoBean&lt;IPerson&gt; person(); AutoBean&lt;IPersons&gt; ipersons(); AutoBean&lt;PersonsWrapper&gt; persons(); } The JSON (variable strResponse) looks like this: [ { "name":"John", "surname":"Blue", "records":[10.5, 12.5, 18.6] }, { "name":"Steven", "surname":"Green", "records":[11.5, 15.5, 14.6] } ] I've made these interfaces: public interface PersonsWrapper { IPersons getPersons(); } public interface IPersons { void setPersons(List&lt;IPerson&gt; persons); List&lt;IPerson&gt; getPersons(); } public interface IPerson { String getName(); void setName(String name); String getSurname(); void setSurname(String surname); } How can I make it work? And how to add the records array to IPerson?

http://stackoverflow.com/a/26197830
has comment: http://stackoverflow.com/comment/41080458
has comment: http://stackoverflow.com/comment/41080621
has comment: http://stackoverflow.com/comment/41080547
upvote count: 2
has body: It's one of the most basic things in programming - the while loop. The while loop keeps executing as long as its condition is truthy. So, since the condition in your code is true, it will run forever because there's nothing else to stop the loop. Hopefully this will help you understand it: var condition = true; var i = 5; do{ i--; // decrement the value of i console.log('i is now', i); if (i == 0) condition = false; } while (condition); console.log('loop ended'); See it here: http://jsfiddle.net/9cr0yqp6/
type: Answer
answers question: http://stackoverflow.com/q/26197815
has comment: http://stackoverflow.com/comment/41080652
has comment: http://stackoverflow.com/comment/41080527
has comment: http://stackoverflow.com/comment/41080585
has comment: http://stackoverflow.com/comment/41080417
has comment: http://stackoverflow.com/comment/41080428
has comment: http://stackoverflow.com/comment/41080500
has comment: http://stackoverflow.com/comment/41080407
has comment: http://stackoverflow.com/comment/41080495
has comment: http://stackoverflow.com/comment/41080405
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41080663

http://stackoverflow.com/a/26209657
downvote count: 0
has body: You have a bracket in the wrong place. It should be int MAX = (plaintext.length()-1)/columns+1
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26209631
upvote count: 1

http://stackoverflow.com/a/26296476
upvote count: 8
type: Answer
has body: You can generate one jar for each Java version (6, 7, 8) from a single pom.xml file. All the relevant work takes place in the maven-compiler-plugin:compile mojo. The trick is to execute the mojo 3 times, each time writing the resulting file to a different outputFileName. This will cause the compiler to run multiple times, each time using different versions and spitting an appropriately named file. org.apache.maven.plugins maven-compiler-plugin 3.1 compile-1.6 compile compile 1.6 1.6 ${env.JAVA_HOME_6}/bin/javac mylib-1.6.jar com.mycompany ABC 1.0 compile-1.7 compile compile 1.7 1.7 ${env.JAVA_HOME_7}/bin/javac mylib-1.7.jar com.mycompany XYZ 2.0 Hope that helps. EDIT RE: additional requirement that each run compile against different sources. See edits to pom snippet above. Each execution can define its own dependencies library list. So JDK6 build depends on ABC.jar but JDK7 depends on XYZ.jar.
has comment: http://stackoverflow.com/comment/41462743
downvote count: 0
answers question: http://stackoverflow.com/q/26195252
has comment: http://stackoverflow.com/comment/41262352
score: 8

http://stackoverflow.com/q/26278856
favorite count: 0
tagged with: google-app-engine
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/95331621
tagged with: google-api
accepted answer: http://stackoverflow.com/a/32853413
tagged with: maven
upvote count: 1
has body: I am using Google + API to search for people using the following statement. Plus plus = new Plus.Builder(httpTransport, jsonFactory, null). setApplicationName("AppName").setGoogleClientRequestInitializer(new PlusRequestInitializer(API_KEY)).build(); Plus.People.Search searchPeople = plus.people().search(personName).setMaxResults(1L); PeopleFeed peopleFeed = searchPeople.execute(); I put the dependencies for the library in pom.xml so that it can be build when maven executed com.google.apis google-api-services-plus v1-rev64-1.13.2-beta But I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/appengine/api/urlfetch/ResponseTooLargeException at com.google.api.client.extensions.appengine.http.urlfetch.UrlFetchTransport.buildGetRequest(UrlFetchTransport.java:61) at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:867) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:399) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449) at com.google.PeopleSearch.googleAccountSearch(PeopleSearch.java:52) at com.google.Search.main(Search.java:128) Caused by: java.lang.ClassNotFoundException: com.google.appengine.api.urlfetch.ResponseTooLargeException 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) Any suggestions?
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41292200
has title: NoClassDefFoundError: com/google/appengine/api/urlfetch/ResponseTooLargeException
tagged with: google-api-java-client
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/32853413

http://stackoverflow.com/comment/41108763
type: Comment
has text: No, i mean, i dont see bouncycastle, habe you installed it? Because you need to have, as far, as i know from older java versions.
comment on: http://stackoverflow.com/q/26212422
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41140623
has text: put a `Log` or `SOP` before `new JSONAsyncTask().execute(fourth);` and check what is your `fourth` string.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26230042

http://stackoverflow.com/q/26297409
downvote count: 0
tagged with: java
tagged with: itext
has body: I am developing android application requirement to create tables in pdf, using itextpdf5.3.4. I am having problem related to table in pdf. I am creating 25 records in one table at absolute position.if am having more than 25 records means creating one more table in new page. If I am having two tables, the text in first table which is getting dark font. Below I am pasting my code: Document document = new Document(); try { File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/report.pdf"); initializeFonts(); Font hedder_font= new Font(bfBold, 8); Font content_font = new Font(bf, 8); Font color_font = new Font(bf, 8); color_font.setColor(new BaseColor(0,172,237)); PdfWriter docWriter= PdfWriter.getInstance(document, new FileOutputStream(file)); docWriter.setRgbTransparencyBlending(true); BaseReportBuilder event = new BaseReportBuilder(); docWriter.setPageEvent(event); document.open(); PdfContentByte cb = docWriter.getDirectContent(); if (list.size() &gt; 0) { createHeadings(cb,25,620,"Details",10,bfBold); } //list all the products sold to the customer float[] columnWidths = {0.5f,3f, 1f, 1f,1f}; //create PDF table with the given widths PdfPTable table = new PdfPTable(columnWidths); // set table width a percentage of the page width table.setTotalWidth(500f); PdfPCell cell = new PdfPCell(new Phrase("Sr",hedder_font)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); cell = new PdfPCell(new Phrase("Item ",hedder_font)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("Date",hedder_font)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); cell = new PdfPCell(new Phrase("id",hedder_font)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); cell = new PdfPCell(new Phrase("Amount",hedder_font)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); table.setHeaderRows(1); if (list.size() &gt; 25) { int value =630; fo…
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/41268364
has comment: http://stackoverflow.com/comment/41265654
has comment: http://stackoverflow.com/comment/41265771
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
has title: First table font colour getting dark using itext in pdf
has comment: http://stackoverflow.com/comment/41268601
has comment: http://stackoverflow.com/comment/41267758
score: 2
has comment: http://stackoverflow.com/comment/41266966

http://stackoverflow.com/a/26297394
has comment: http://stackoverflow.com/comment/41263856
downvote count: 0
has comment: http://stackoverflow.com/comment/41263973
score: 5
answers question: http://stackoverflow.com/q/26297243
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26297243
has comment: http://stackoverflow.com/comment/41263923
has comment: http://stackoverflow.com/comment/41264163
has body: Like lateralus said, Strings are immutable, so you can't change these. However, having said that, you can use the replaceAll to return a modified version of the String, for example in this case: String input = "_HTML_1__BODY_1__FORM_1__INPUT_3_"; String output = input.replaceAll("_(\\d+)_", "[$1]").replaceAll("_", "/"); // output = /HTML[1]/BODY[1]/FORM[1]/INPUT[3] Edit As for an explanation of the regex used in this case: This method uses two separate regular expressions to return a modified String. Firstly, "_(\\d+)_", looks for numbers surrounded by two underscore characters _, \\d is a regex short hand for any digit. The surrounding brackets (...) capture the number, so that we can reference it in the replacement string. When we make the first replacement, we replace with [$1], in here $1 refers back to the first captured group, i.e. the digit captured, and surrounds it in square brackets [...]. The underscores are also removed, as these were captured in the expression, if not in the group. The second replaceAll call simply replaces all remaining underscore characters with a /.
upvote count: 5
type: Answer

http://stackoverflow.com/comment/41171906
has text: @LouisWasserman Yes!! Please make this an answer. Actually I probably should have created two questions - the second specifcally about Double and you get awarded both. I may do that ..
comment on: http://stackoverflow.com/a/26246580
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/26263406
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 4
has body: seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int i, boolean b) { iv1.setBackgroundColor(Color.argb(0xFF, i, i, 200)); } Depending on what color you want, set the max on the seekbar to 255 and you can play around with the numbers to get your desired color at a gradual change. Also great reference when trying to find the color http://www.tayloredmktg.com/rgb/
accepted answer of: http://stackoverflow.com/q/26261089
answers question: http://stackoverflow.com/q/26261089

http://stackoverflow.com/comment/41363188
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26351203
type: QuestionComment
has text: Swing GUI objects should be constructed and manipulated _only_ on the [event dispatch thread](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html).

http://stackoverflow.com/comment/41213412
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26262208
type: Comment
has text: @CodeMed lexicore is the guy to get to help you (he is the author of hyperjaxb3). I will help if I can.

http://stackoverflow.com/comment/41244870
has text: `getWidth` and `getHeight` give you the screen size in pixels. Setting the camera's width and height sets up the viewable area of your world, but the units can be anything you like, like Xoppa said. If you're using box2D, then meters is a good choice. The 800x480 you set will be stretched to fit the screen, no matter the size and aspect ratio of the device. So if you just choose fixed values like this, it will look distorted on some devices. Look at the libgdx documentation on Viewports, which handles this issue.
comment on: http://stackoverflow.com/q/26285419
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26333354
has body: I am a newbie in servlets. I am getting below sevlets exception. My web.xml code. LoginServlets LoginServlet LoginServlet LoginServlet /login index.html index.htm index.jsp default.html default.htm default.jsp Html form calling this servlet. UserName Password Exception I am getting. javax.servlet.ServletException: Error instantiating servlet class LoginServlet org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Unknown Source) root cause. java.lang.ClassNotFoundException: LoginServlet org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint…
has comment: http://stackoverflow.com/comment/41330332
tagged with: java
tagged with: servletexception
upvote count: 1
tagged with: servlets
has title: Servlet Exception when try to run servlet
downvote count: 0
has answer: http://stackoverflow.com/a/26333740
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41330846
tagged with: classnotfoundexception
score: 1
has answer: http://stackoverflow.com/a/26333816
favorite count: 0
has comment: http://stackoverflow.com/comment/41330334
type: Question
answer count: 2

http://stackoverflow.com/comment/41093422
has text: Why are you adding the results to `hashMapTemp` instead of just saying `for (String key : finalHashMap.get("j"))`?
comment on: http://stackoverflow.com/q/26205145
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26643388
has comment: http://stackoverflow.com/comment/41931781
has comment: http://stackoverflow.com/comment/63015511
has body: Try using this snippet: Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.chicken);//your image ByteArrayOutputStream bYtE = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, bYtE); bmp.recycle(); byte[] byteArray = bYtE.toByteArray(); String imageFile = Base64.encodeToString(byteArray, Base64.DEFAULT); and for retrieving public Bitmap stringToBitMap(String encodedString){ try { byte [] encodeByte=Base64.decode(encodedString,Base64.DEFAULT); Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length); return bitmap; } catch(Exception e) { e.getMessage(); return null; } }
score: 12
upvote count: 12
answers question: http://stackoverflow.com/q/26292969
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26292969
type: Answer

http://stackoverflow.com/q/26334524
type: AnsweredQuestion
has body: I am working on a project to implement large scale indexing on twitter data for search optimization using Apache Lucene. Lucene provides inverted index to filter out the blocks which match the specified selection criteria. To implement this project, how should I go about it - Should I install the Cloudera vm and proceed? or Should I deploy Hadoop from Apache on Ubuntu platform? The reason I am asking this is because I am not able to confirm if Cloudera already uses Lucene to optimize search. Please advise.
has answer: http://stackoverflow.com/a/26336148
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26336148
tagged with: java
tagged with: lucene
has title: Search optimization using Apache Lucene
tagged with: hadoop
tagged with: cloudera

http://stackoverflow.com/q/26260090
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26260202
upvote count: 3
tagged with: java
has body: Java program to alphanumeric sorting objects please let me know how could i can get the expected result Expected output : B2 D1 D2 D14 E2 Actual output : B2 D1 D14 D2 E2 ==================================== List&lt;Name&gt; lst = new ArrayList&lt;&gt;(); lst.add(new Name("D",1)); lst.add(new Name("D",14)); lst.add(new Name("D",2)); lst.add(new Name("E",2)); lst.add(new Name("B",2)); Collections.sort(lst, new Comparator&lt;Name&gt;() { @Override public int compare(Name n1, Name n2) { // TODO Auto-generated method stub String o1=n1.getNm()+n1.getSeatnum(); String o2=n2.getNm()+n2.getSeatnum(); return o1.compareTo(o2); } }); for (Name name : lst) { System.out.println(name.getNm()+name.getSeatnum()); } ================================= public class Name { private String nm; private int seatnum; public int getSeatnum() { return seatnum; } public void setSeatnum(int seatnum) { this.seatnum = seatnum; } public Name(String nm) { super(); this.nm = nm; } public Name(String nm, int seatnum) { super(); this.nm = nm; this.seatnum = seatnum; } public String getNm() { return nm; } public void setNm(String nm) { this.nm = nm; } }
type: Question
possible better answer: http://stackoverflow.com/a/26260188
tagged with: algorithm
has answer: http://stackoverflow.com/a/26260188
accepted answer: http://stackoverflow.com/a/26260202
has title: Java program to alphanumeric sorting objects
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26260460

http://stackoverflow.com/q/26309498
has body: For some reason, my program seems to keep crashing because it's reading a token wrong.On line 362 and 363, where it reads token[i], no matter what happens it seems to read it as a '(' character, even though it's clearly not. If I input something like a 100*(5+5) , it will call recursion after i = 2 on 0*(5+5) instead of correctly going to i=4 and calling it on (5+5). Any help debugging would be great! package apps; import java.io.IOException; import java.util.ArrayList; import java.util.NoSuchElementException; import java.util.Scanner; import java.util.StringTokenizer; import structures.Stack; public class Expression { /** * Expression to be evaluated */ String expr; /** * Scalar symbols in the expression */ ArrayList&lt;ScalarSymbol&gt; scalars; /** * Array symbols in the expression */ ArrayList&lt;ArraySymbol&gt; arrays; /** * Positions of opening brackets */ ArrayList&lt;Integer&gt; openingBracketIndex; /** * Positions of closing brackets */ ArrayList&lt;Integer&gt; closingBracketIndex; /** * String containing all delimiters (characters other than variables and constants), * to be used with StringTokenizer */ public static final String delims = " \t*+-/()[]"; /** * Initializes this Expression object with an input expression. Sets all other * fields to null. * * @param expr Expression */ public Expression(String expr) { this.expr = expr; scalars = null; arrays = null; openingBracketIndex = null; closingBracketIndex = null; } /** * Matches parentheses and square brackets. Populates the openingBracketIndex and * closingBracketIndex array lists in such a way that closingBracketIndex[i] is * the position of the bracket in the expression that closes an opening bracket * at position openingBracketIndex[i]. For example, if the expression is: * &lt;pre&gt; * (a+(b-c))*(d+A[4]) * &lt;/pre&gt; * then the method would return true, and the array lists would be set to: * &lt;pre&gt; * openingBracketIndex: [0 3 10 14] * closingBracketIndex: [8 7 17 16] * &lt;/pe&gt; * * See the…
answer count: 0
has comment: http://stackoverflow.com/comment/41286592
type: UnansweredQuestion
tagged with: loops
type: Question
tagged with: debugging
tagged with: java
score: 0
has title: Value being read incorrectly during for loop
has comment: http://stackoverflow.com/comment/41286763

http://stackoverflow.com/comment/41105561
type: Comment
type: QuestionComment
has text: if (_entryEnd != null && _entryStart != null){ if(_entryEnd.before(_entryStart)) _entryEnd = _entryStart; }
comment on: http://stackoverflow.com/q/26211083
score: 0

http://stackoverflow.com/a/26214854
type: Answer
answers question: http://stackoverflow.com/q/26213813
has body: If you are hitting on a unique Id column.... int maxID = 0; Statement s2 = con.createStatement(); s2.execute("SELECT MAX(UniqueId) FROM MyTable"); ResultSet rs2 = s2.getResultSet(); if (rs2.next()) { maxID = rs2.getInt(1); } If you are hitting on any other non-key column.... int maxID = 0; Statement s2 = con.createStatement(); s2.execute("SELECT MAX(ColumnValue) FROM MyTable"); ResultSet rs2 = s2.getResultSet(); while (rs2.next()) { maxID = rs2.getInt(1); }
score: 0

http://stackoverflow.com/q/26241109
tagged with: rest
has title: Http 500 error while returning object
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41176184
has comment: http://stackoverflow.com/comment/41176720
score: 1
tagged with: java
tagged with: http
has comment: http://stackoverflow.com/comment/41160943
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41161422
has body: I have developed a REST service by wrapping another REST service inside it. My method looks like below, @GET @Produces("text/plain") @Path("/projects/{projectId}/") public Project getProject(@PathParam("projectId") String projectId) { resourceUrl = resourceUrl + "getProject?projectId="; Project project = null; String output = null; try { httpClient = new DefaultHttpClient(); //HttpGet getRequest = new HttpGet(resourceUrl+"projectId="+projectId); HttpGet getRequest = new HttpGet( "https://appserver.dev.cloud.wso2.com/services/t/madusanka/projecttrackerdb-default-SNAPSHOT/getProject?projectId=" + projectId); //"https://appserver.dev.cloud.wso2.com/services/t/madusanka/projecttrackerdb-default-SNAPSHOT/getProject?projectId=" getRequest.addHeader("accept", "application/xml"); HttpResponse response = httpClient.execute(getRequest); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { throw new RuntimeException("Failed with HTTP error code : " + statusCode); } HttpEntity httpEntity = response.getEntity(); //output = EntityUtils.toString(httpEntity); JAXBContext jaxbContext = JAXBContext.newInstance(Project.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); project = (Project) unmarshaller.unmarshal(new StringReader(output)); //Verify the populated object //System.out.println(project.getTeamId()); //System.out.println(project.getProjectName()); //System.out.println(project.getProjectManager());*/ //output = project.getProjectName().toString(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } finally { //Important: Close the connect httpClient.getConnectionManager().shutdown(); } return project; } It gives me following error while executing. But it works fine when I return EntityUtils.toString(httpEntity); Error : Apache Tomcat/7.0.34 - Error report HTTP Status 500 - org.apache.cxf.interceptor.Fault type Exception repo…
has comment: http://stackoverflow.com/comment/41166324
has comment: http://stackoverflow.com/comment/41179359
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/26269575
duplicate of: http://stackoverflow.com/q/529085
tagged with: list
answer count: 0
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/41230402
has comment: http://stackoverflow.com/comment/41248151
tagged with: java
has title: How do I pass dynamic number of lists to a varargs method?
score: 0
tagged with: mockito
has body: I'm trying to write a reusable method for unit tests to be able to mock the behaviour for a certain class which returns a List&lt;String&gt;, so that I can call this mockInstansiate method to set up the mock. How do I pass in multiple lists for the thenReturn() method? I know I could do .thenReturn().thenReturn().thenReturn etc, but I was hoping to be able to make this dynamic as I won't know how many lists I will have. The error I am getting is: Cannot create a generic array of ArrayList&lt;String&gt; Code: private void mockInstansiate (List&lt;String&gt; wheels) { Machine machine = mock(Machine.class); List&lt;List&lt;String&gt;&gt; results = new ArrayList&lt;List&lt;String&gt;&gt;(); for(String wheel : wheels) { List&lt;String&gt; result = new ArrayList&lt;String&gt;(); result.add(wheel); results.add(result); } List&lt;String&gt; wheel1 = results.remove(0); /* Issue here, I'm trying to create an array of List&lt;String&gt; to pass * into the second part of thenReturn() */ List&lt;String&gt;[] otherLists = new ArrayList&lt;String&gt;[9]; when(machine.getLists()).thenReturn(wheel1, results.toArray(otherLists)); } class Machine { public List&lt;String&gt; getLists() { // Doesn't matter what's here, it's being mocked out } }
tagged with: variadic-functions
linked to: http://stackoverflow.com/q/529085
type: UnansweredQuestion

autobean
tag name: autobean
type: Tag
tags question: http://stackoverflow.com/q/26218257

reflection
tags question: http://stackoverflow.com/q/26309156
tags question: http://stackoverflow.com/q/26288877
tags question: http://stackoverflow.com/q/26319574
tags question: http://stackoverflow.com/q/26324832
tags question: http://stackoverflow.com/q/26334424
tags question: http://stackoverflow.com/q/26277986
tags question: http://stackoverflow.com/q/26223723
tags question: http://stackoverflow.com/q/26315527
tags question: http://stackoverflow.com/q/26267037
tags question: http://stackoverflow.com/q/26242860
type: Tag
tags question: http://stackoverflow.com/q/26338018
tags question: http://stackoverflow.com/q/26341012
tags question: http://stackoverflow.com/q/26253900
tags question: http://stackoverflow.com/q/26274844
tags question: http://stackoverflow.com/q/26298292
tags question: http://stackoverflow.com/q/26206700
tags question: http://stackoverflow.com/q/26269716
tags question: http://stackoverflow.com/q/26205465
tags question: http://stackoverflow.com/q/26329197
tag name: reflection
tags question: http://stackoverflow.com/q/26242320
tags question: http://stackoverflow.com/q/26197645
tags question: http://stackoverflow.com/q/26218722
tags question: http://stackoverflow.com/q/26315205
tags question: http://stackoverflow.com/q/26282522
tags question: http://stackoverflow.com/q/26339471

http://stackoverflow.com/comment/41173395
has text: While the answer from John B is bang on, I suggest you to have a look at this for further understanding - http://javareferencegv.blogspot.com/2014/10/overriding-equals-and-hashcode-for-pojo.html
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26242832

http://stackoverflow.com/a/26334978
score: 0
has comment: http://stackoverflow.com/comment/41333891
type: Answer
has body: Dunno you just want to add a color as stroke to the background then you can do like this If you are using color then you can create an xml file in the drawable in the res of your project and create a drawable like this Image.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;stroke android:width="2dp" android:color="#007cea" /&gt; &lt;padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /&gt; &lt;solid android:color="#007cea" /&gt; &lt;corners android:radius="4dp" /&gt; &lt;/shape&gt; And to your imageview you can call the xml file as android:background="@drawable/login_button" In the xml file you specify like this &lt;stroke android:width="2dp" android:color="#007cea" /&gt; the android:color="#007cea" defines which color you want to give as border
answers question: http://stackoverflow.com/q/26334837

http://stackoverflow.com/comment/41389650
score: 0
comment on: http://stackoverflow.com/q/26353658
type: Comment
type: QuestionComment
has text: I think it's fine to leave this question open. The question in its edited form is different enough from the original.

http://stackoverflow.com/q/26194617
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26194890
tagged with: realm
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I could provide some code, but basically i get this exception at a this.realm = Realm.getInstance(context); Of course context is not null. Any ideas? StackTrace: Caused by: io.realm.exceptions.RealmException: Could not find the generated ValidationList class at io.realm.Realm.createAndValidate(Realm.java:203) at io.realm.Realm.create(Realm.java:181) at io.realm.Realm.getInstance(Realm.java:159) at io.realm.Realm.getInstance(Realm.java:128) at com.ithurts.robertharkai.baseproject.realm.realmObjects.RealmHelper.&lt;init&gt;(RealmHelper.java:28) at com.ithurts.robertharkai.baseproject.activites.MainActivity.succesfulLoginEvent(MainActivity.java:123) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.squareup.otto.EventHandler.handleEvent(EventHandler.java:89) at com.squareup.otto.Bus.dispatch(Bus.java:384) at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:367) at com.squareup.otto.Bus.post(Bus.java:336) at com.ithurts.robertharkai.baseproject.providers.MainThreadBusProvider.post(MainThreadBusProvider.java:42) at com.ithurts.robertharkai.baseproject.tasks.LogInUserTask.onPostExecute(LogInUserTask.java:50) at com.ithurts.robertharkai.baseproject.tasks.LogInUserTask.onPostExecute(LogInUserTask.java:18) at android.os.AsyncTask.finish(AsyncTask.java:631) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) 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:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method) Application build.gradle: http://pastebin.com/PmS2WnGk Project build:gra…
has title: Getting io.realm.exceptions.RealmException: Could not find the generated ValidationList class when trying to get a Realm object
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26194890

http://stackoverflow.com/q/26328877
has comment: http://stackoverflow.com/comment/41321898
has comment: http://stackoverflow.com/comment/41321727
score: -3
downvote count: 3
has comment: http://stackoverflow.com/comment/41321713
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41321851
has body: I need to make two Java classes(Dog, DogApp). The class Dog needs to be able to set and get name, breed, color, weight, height, and length. The class also must have a bark statement at the end with variable name included. I have the class Dog made, but in the DogApp class I'm getting syntax errors on the getName, getBreed, getColor, getWeight, getHeight, and getLength lines. What am I doing wrong? any help would be greatly appreciated, and I do realize versions of this question exhist but not the same. Dog class: public class Dog { private static Object sc; private String name; private String breed; private String color; private double weight; private double height; private double length; public Dog() { name = null; breed = null; color = null; weight = 0; height = 0; length = 0; } public static Object getSc() { return sc; } public static void setSc(Object sc) { Dog.sc = sc; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getBreed() { return breed; } public void setBreed(String breed) { this.breed = breed; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } public double getLength() { return length; } public void setLength(double length) { this.length = length; } public String Bark(String bark) { bark = (name + " says woof."); return bark; } } ****** DogApp: import java.util.Scanner; public class DogApp { private static String name; private static String breed; private static String color; private static double weight; private static double height; private static double length; private static String bark; public static void main(String args[]) { // display a welcome message Scanner sc = new Scanner(System.in); String choice = "y"; while (cho…
has answer: http://stackoverflow.com/a/26328945
has comment: http://stackoverflow.com/comment/41321887
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Dog class DogApp

http://stackoverflow.com/q/26336658
has body: I get the below exception while running maven command mvn --version mvn --version Exception in thread "main" java.lang.NoClassDefFoundError: Xms256m Caused by: java.lang.ClassNotFoundException: Xms256m at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: Xms256m. Program will exit. 'cmd' is not recognized as an internal or external command, operable program or batch file. What can be the reason. I have set the below maven Environment variables M2_HOME M2 MAVEN_OPTS
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: maven-3
favorite count: 0
has comment: http://stackoverflow.com/comment/63441725
has comment: http://stackoverflow.com/comment/41336423
type: Question
has comment: http://stackoverflow.com/comment/41336384
has title: Maven : NoClassDefFoundError Xms256m while running Maven Command
tagged with: maven-2
has comment: http://stackoverflow.com/comment/41336397
has comment: http://stackoverflow.com/comment/41336316
upvote count: 2
has comment: http://stackoverflow.com/comment/41336641
tagged with: maven
downvote count: 1
tagged with: java

http://stackoverflow.com/q/26229536
has body: I use DcmSnd tool for pushing compressed CT files in remote Dicom server.The problem is while retriving uncompressed files from same Server using DcmQr I get all files but in form of images and it gives me failure status for all files. 10:27:00,357 INFO [FsmImpl] sending [pc-1] 1:C_FIND_RSP with Dataset class: 1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND status: ff01 And After that it start decompression of all files 10:27:01,692 INFO [FsmImpl] received A-RELEASE-RQ 10:27:01,692 INFO [FsmImpl] sending A-RELEASE-RP 10:27:01,693 INFO [ServerImpl] handle - Socket[addr=/192.168.1.121,port=54491,localport=11112] 10:27:01,695 INFO [FsmImpl] Socket[addr=/192.168.1.121,port=54491,localport=11112] 10:27:01,696 INFO [FsmImpl] received AAssociateRQ appCtxName: 1.2.840.10008.3.1.1.1/DICOM Application Context Name implClass: 1.2.40.0.13.1.1 implVersion: dcm4che-2.0 calledAET: DCM4CHEE callingAET: DCM4CHEE maxPDULen: 16384 asyncOpsWindow: maxOpsInvoked=1, maxOpsPerformed=0 pc-1: as=1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND ts=1.2.840.10008.1.2/Implicit VR Little Endian pc-3: as=1.2.840.10008.5.1.4.1.2.2.3/Study Root Query/Retrieve Information Model - GET ts=1.2.840.10008.1.2/Implicit VR Little Endian pc-5: as=1.2.840.10008.5.1.4.1.1.2/CT Image Storage ts=1.2.840.10008.1.2/Implicit VR Little Endian pc-7: as=1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND ts=1.2.840.10008.1.2.1/Explicit VR Little Endian pc-9: as=1.2.840.10008.5.1.4.1.2.2.3/Study Root Query/Retrieve Information Model - GET ts=1.2.840.10008.1.2.1/Explicit VR Little Endian pc-11: as=1.2.840.10008.5.1.4.1.1.2/CT Image Storage ts=1.2.840.10008.1.2.1/Explicit VR Little Endian RoleSelection[sop=1.2.840.10008.5.1.4.1.1.2/CT Image Storage, scu=false, scp=true] ExtNegotiation[sop=1.2.840.10008.5.1.4.1.2.2.1/Study Root Query/Retrieve Information Model - FIND, info=00\00\00] ExtNegotiation[sop=1.2.840.10008.5.1.4.1.2.2.3/Study…
score: 0
answer count: 2
tagged with: dicom
has title: How do i push compressed CT files in remote dicom server?
has answer: http://stackoverflow.com/a/26312568
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26385879
tagged with: java
tagged with: dcm4che
type: Question

http://stackoverflow.com/comment/41093185
score: 0
type: AnswerComment
has text: where did you get this from
type: Comment
comment on: http://stackoverflow.com/a/26205040

http://stackoverflow.com/comment/41145014
type: Comment
comment on: http://stackoverflow.com/q/26232064
type: QuestionComment
has text: I am new in AngularJs so i don't have experience to make good choice with this technology
score: 0

http://stackoverflow.com/q/26333803
tagged with: hbase
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: hadoop
score: 5
has answer: http://stackoverflow.com/a/26631856
upvote count: 5
has title: How to run HBase in distributed mode on windows without cygwin?
answer count: 1
tagged with: hdfs
has comment: http://stackoverflow.com/comment/41759660
has comment: http://stackoverflow.com/comment/41757060
tagged with: windows
downvote count: 0
has body: I have configured HBase and integrated with HDFS on windows successfully. I using HBase version 0.98.6.1-hadoop2 and Hadoop version 2.5.1 Followed HBase quick start tutorial. If i run HBase normally (without hbase.cluster.distributed property) then it works fine. Otherwise it shows This is not implemented yet. Stay tuned. How do i start HBase in cluster distributed mode on windows without cygwin?
has comment: http://stackoverflow.com/comment/41709677
favorite count: 0

http://stackoverflow.com/comment/41195330
score: 0
type: Comment
type: QuestionComment
has text: why don't you use ImageIO.read()?
comment on: http://stackoverflow.com/q/26260086

http://stackoverflow.com/a/26223740
type: Answer
has body: Your question does not provide enough detail to answer clearly. Depending upon your design / end-goals, there are three concepts you should take a look at and understand: Interfaces Abstract Classes Reflection An Interface will define the methods that classes that implement the interface must provide. Each class that implements the interface must provide the code for the method. An Abstract Class will provide a single implementation of the behavior that you are looking for. Reflection is an advanced concept. I would recommend you stay away from it at this time - but you should be aware of it. Given your example code, you may want to use an Abstract Class. Designed properly, you can increase flexibility/reuse by defining an interface, implementing that interface with an Abstract Class and then extending that Abstract Class as needed. Every class that extends the Abstract will pick up the default implementation you provided in the Abstract class definition; the Interface will make it easy for you to extend in the future.
score: 0
answers question: http://stackoverflow.com/q/26223518

http://stackoverflow.com/a/26309035
has body: The main advantage of static is that you dont have to create an object to access that variable. You just have to call that variable by Classname.variablename (Classname is the name of class in which that variable was present) System.out.print(Prizes.prizes[1]);
answers question: http://stackoverflow.com/q/26308965
score: 0
type: Answer

http://stackoverflow.com/comment/41360658
type: AnswerComment
comment on: http://stackoverflow.com/a/26348779
type: Comment
has text: Sorry somehow the rest of the context file did not get pated in. It is wrapped in the context tags.
score: 0

http://stackoverflow.com/comment/41337570
has text: You call `copyFiles` recursively so you calling `done` too early
comment on: http://stackoverflow.com/q/26335659
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26196473
upvote count: 1
answers question: http://stackoverflow.com/q/26196444
score: 1
has body: In your example, I don't see any need to use generics. Your method can simply return A : public static A getObject(String input){ if(input.indexOf("b") != -1){ return new B(); } if(input.indexOf("c") != -1){ return new C(); } return null; }
downvote count: 0
type: Answer

http://stackoverflow.com/q/26326810
has comment: http://stackoverflow.com/comment/41330943
has comment: http://stackoverflow.com/comment/41330996
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41317998
upvote count: 1
has comment: http://stackoverflow.com/comment/41318213
type: Question
tagged with: jakarta-ee
score: -1
tagged with: servlets
has body: I have one webapp (abc.war) deployed on tomcat and there is an image folder , under this several images lying and I can access these images by URL: xx.xx/abc/image/hello.jpg This project is running live but I am not able to get how these images are retrieved. Now I have another REST based project deployed in tomcat and i want similar behaviour e.g xx.xx/hellorest/images/anil.jpg, but right now I am not able to access using above URL. Need help how this can possible. I don't want to use any Servlet to read and write the Image.
answer count: 1
has comment: http://stackoverflow.com/comment/41333531
tagged with: tomcat
has answer: http://stackoverflow.com/a/26383179
favorite count: 0
has title: How can I access image by calling URL from a webapp
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41318171

http://stackoverflow.com/q/26344299
tagged with: quartz-scheduler
type: Question
has comment: http://stackoverflow.com/comment/41380925
has body: I'm using Hibernate and Spring (in mode OpenSessionInView) in a webapp. I've introduced Quartz for scheduling Job for checks. To be able to inject beans into the Job I make use of the following approach: https://gist.github.com/jelies/5085593 A job in my app is like: @Service public class SampleJob implements Job { @Autowired private SampleBusiness sampleBusiness; @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { for(Student student : sampleBusiness.getStudents()) { System.out.println(student.getName()); } } } When the webapp starts, and at the first execution of the Job the result is: Tom Bruce Steven The result is ok. After that I change in the webapp the name of "Tom" in "Tommy". On the next execution of the Job the result is: Tom Bruce Steven Why Hibernate session holds the old data? I think I have to attach to the Job an Interceptor like I do for my other beans, but I'm not able to attach it to the Job. Thanks
downvote count: 0
has comment: http://stackoverflow.com/comment/41379047
answer count: 1
has comment: http://stackoverflow.com/comment/41380978
has comment: http://stackoverflow.com/comment/41380300
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
has title: Quartz job integrated in Spring does not refresh Hibernate Session
score: 2
has answer: http://stackoverflow.com/a/26361892
tagged with: java
tagged with: hibernate

web-services
type: Tag
tags question: http://stackoverflow.com/q/26282934
tags question: http://stackoverflow.com/q/26223648
tags question: http://stackoverflow.com/q/26307572
tags question: http://stackoverflow.com/q/26274653
tags question: http://stackoverflow.com/q/26257866
tags question: http://stackoverflow.com/q/26252200
tags question: http://stackoverflow.com/q/26207416
tags question: http://stackoverflow.com/q/26235884
tags question: http://stackoverflow.com/q/26300711
tags question: http://stackoverflow.com/q/26267689
tags question: http://stackoverflow.com/q/26250443
tags question: http://stackoverflow.com/q/26352044
tags question: http://stackoverflow.com/q/26348746
tags question: http://stackoverflow.com/q/26200120
tags question: http://stackoverflow.com/q/26296090
tags question: http://stackoverflow.com/q/26274133
tags question: http://stackoverflow.com/q/26345628
tags question: http://stackoverflow.com/q/26207329
tags question: http://stackoverflow.com/q/26234338
tags question: http://stackoverflow.com/q/26284249
tags question: http://stackoverflow.com/q/26252932
tags question: http://stackoverflow.com/q/26303506
tags question: http://stackoverflow.com/q/26256720
tags question: http://stackoverflow.com/q/26281534
tags question: http://stackoverflow.com/q/26245055
tags question: http://stackoverflow.com/q/26339317
tags question: http://stackoverflow.com/q/26239326
tags question: http://stackoverflow.com/q/26245935
tags question: http://stackoverflow.com/q/26307772
tags question: http://stackoverflow.com/q/26315118
tags question: http://stackoverflow.com/q/26322871
tags question: http://stackoverflow.com/q/26305363
tags question: http://stackoverflow.com/q/26307571
tags question: http://stackoverflow.com/q/26305288
tags question: http://stackoverflow.com/q/26237403
tags question: http://stackoverflow.com/q/26250238
tags question: http://stackoverflow.com/q/26352391
tags question: http://stackoverflow.com/q/26327602
tags question: http://stackoverflow.com/q/26201964
tags question: http://stackoverflow.com/q/26277370
tags question: http://stackoverflow.com/q/26274807
tags question: http://stackoverflow.com/q/26229969
tags question: http://stackoverflow.com/q/26226864
tags question: http://stackoverflow.com/q/26253839
tags question: http://stackoverflow.com/q/26320372
tags question: http://stackoverflow.com/q/26205817
tag name: web-services
tags question: http://stackoverflow.com/q/26264016
tags question: http://stackoverflow.com/q/26244467
tags question: http://stackoverflow.com/q/26248323
tags question: http://stackoverflow.com/q/26285698
tags question: http://stackoverflow.com/q/26336065
tags question: http://stackoverflow.com/q/26238815
tags question: http://stackoverflow.com/q/26280099
tags question: http://stackoverflow.com/q/26327251
tags question: http://stackoverflow.com/q/26288116
tags question: http://stackoverflow.com/q/26238131
tags question: http://stackoverflow.com/q/26230445
tags question: http://stackoverflow.com/q/26352055
tags question: http://stackoverflow.com/q/26290423
tags question: http://stackoverflow.com/q/26214916
tags question: http://stackoverflow.com/q/26256183

http://stackoverflow.com/comment/41118552
type: AnswerComment
comment on: http://stackoverflow.com/a/26218335
type: Comment
has text: @gikarasojo kinene see if it's clear now, I updated the answer.
score: 0

http://stackoverflow.com/q/26319473
score: 1
favorite count: 0
has title: how to add a (big)difference between to dates to another date
type: Question
tagged with: maximo
accepted answer: http://stackoverflow.com/a/26321084
has answer: http://stackoverflow.com/a/26320857
has body: In a Jython script I want to move a date with the same amount an another date is changed. So in my script I get two variables: scheduledDate and scheduledDate_previous Both are java Date objects. I want to apply the difference to another Date: reservationDate The problem is that with big differences, I get a 'cannot convert to integer'-error on the calendar.add() function. Here's my code: from java.util import Date form java.util import Calendar myDiff = int(scheduledDate.getTime() - scheduledDate_previous.getTime()) reservationCal = Calendar.getInstance() reservationCal.setTime(reservationDate) reservationCal.add(Calendar.MILLISECOND, myDiff) reservationDate = reservationCal.getTime() If the difference between two dates becomes to large, the myDiff is no longer an Int, but a Big Int (note that it can also be a negative number!) So I tried something like this: reservationCal.add(Calendar.MINUTE, int(myDiff / 60000) ) I don't need that insane presicion anyway. But this didn't work all the time. EDIT It would result in a 'add(): second arg cant be coerced to an int'-error Which seemed fair since if you had a weird difference the division could result in a float. So I tried this: from java.lang import Math reservationCal.add(Calendar.MINUTE, int(math.floor(myDiff / 60000))) I still get an error like: TypeError: unsupported operant type(s) for: 'java.math.BigInterger' and 'int' The weird thing is that I don't get this error when I change the date a few days. It happens when I change it 3 months. User are able to change the date and time. They need to change it within a few years. due to compatibility issues the machine is still on java 32 bit 1.6.0_25. It uses jython 2.5.2 Is there a solution or do I need different approuch?
possible better answer: http://stackoverflow.com/a/26320857
answer count: 2
upvote count: 1
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/26321084
type: AnsweredQuestion
tagged with: jython
downvote count: 0

http://stackoverflow.com/q/26353521
answer count: 1
has comment: http://stackoverflow.com/comment/41367176
has comment: http://stackoverflow.com/comment/41374160
has comment: http://stackoverflow.com/comment/41367228
has answer: http://stackoverflow.com/a/26381999
has comment: http://stackoverflow.com/comment/41366938
score: 0
tagged with: applet
has body: I am working on project where I would like to draw multiple text to applet on different locations in applet. I am already able to draw a single text. But I can't figure it out how to draw or add another text to applet. When I draw the second one, first one gets removed. Here is the code: /** * Constructor */ public DrawText() { super(); } public void init(IHandler handler) { super.init(handler); mHandler = handler; try { if (font == null) { AddFont myFont = new AddFont(); font = myFont.createFont(); } } catch (Exception e) { e.printStackTrace(); } } @Override public void paint(Graphics g) { if (g instanceof Graphics2D) { try { super.paintComponents(g); Graphics2D g2 = (Graphics2D) g; System.out.println("Izrisujem tekst 16"); SetTitle(g2); } catch (Exception e) { e.printStackTrace(); } } } private void SetTitle(Graphics2D g) { if (_SetTitleText != null) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Font FontNew; if (_SetTitleSize &gt; 0) { FontNew = font.deriveFont(Font.PLAIN, _SetTitleSize); } else { FontNew = font.deriveFont(Font.PLAIN, 26); } if (_SetTitleColor != null) { String[] TitleColorArr = getRGB(_SetTitleColor); Color TitleColor = new Color(Integer.parseInt(TitleColorArr[0]), Integer.parseInt(TitleColorArr[1]), Integer.parseInt(TitleColorArr[2])); g.setColor(TitleColor); } g.setFont(FontNew); g.drawString(_SetTitleText, _SetTitleX, _SetTitleY); } } Thanks for help in advance. Regards, Igor -------------------------------------------------> UPDATE I have update code to draw in JPanel but still no cigar //Main class public void init(IHandler handler) { super.init(handler); mHandler = handler; myPanel = new MainJP(); myPanel.setVisible(true); this.add(myPanel); } JPanel: @Override public void paintComponent(Graphics g) { super.paintComponent(g); System.out.println("paintComponent"); SetTitle(g); } public void SetTitle(Graphics g) { System.out.println("SetTitle"); if (_TitleText != null) { Font FontNew; if (_TitleSiz…
has comment: http://stackoverflow.com/comment/41371558
has comment: http://stackoverflow.com/comment/41372266
has comment: http://stackoverflow.com/comment/41372595
has title: Add drawing to Java applet
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41418430
tagged with: swing
has comment: http://stackoverflow.com/comment/41366992
has comment: http://stackoverflow.com/comment/41366748
tagged with: java
has comment: http://stackoverflow.com/comment/41368384
linked to: http://stackoverflow.com/q/3256269
has comment: http://stackoverflow.com/comment/41366764
type: Question

object
tags question: http://stackoverflow.com/q/26203927
tags question: http://stackoverflow.com/q/26325781
tags question: http://stackoverflow.com/q/26331096
tags question: http://stackoverflow.com/q/26199587
tag name: object
tags question: http://stackoverflow.com/q/26292472
tags question: http://stackoverflow.com/q/26291823
tags question: http://stackoverflow.com/q/26329746
tags question: http://stackoverflow.com/q/26320816
tags question: http://stackoverflow.com/q/26327156
tags question: http://stackoverflow.com/q/26295102
tags question: http://stackoverflow.com/q/26330246
tags question: http://stackoverflow.com/q/26263054
tags question: http://stackoverflow.com/q/26302409
tags question: http://stackoverflow.com/q/26283436
tags question: http://stackoverflow.com/q/26266643
tags question: http://stackoverflow.com/q/26234419
tags question: http://stackoverflow.com/q/26209888
tags question: http://stackoverflow.com/q/26303456
tags question: http://stackoverflow.com/q/26310054
tags question: http://stackoverflow.com/q/26241322
tags question: http://stackoverflow.com/q/26326541
tags question: http://stackoverflow.com/q/26347196
tags question: http://stackoverflow.com/q/26216745
tags question: http://stackoverflow.com/q/26201282
tags question: http://stackoverflow.com/q/26261825
tags question: http://stackoverflow.com/q/26351526
tags question: http://stackoverflow.com/q/26241596
tags question: http://stackoverflow.com/q/26321598
tags question: http://stackoverflow.com/q/26216958
tags question: http://stackoverflow.com/q/26262137
tags question: http://stackoverflow.com/q/26275865
type: Tag
tags question: http://stackoverflow.com/q/26344913
tags question: http://stackoverflow.com/q/26321396
tags question: http://stackoverflow.com/q/26329911
tags question: http://stackoverflow.com/q/26265164
tags question: http://stackoverflow.com/q/26290929
tags question: http://stackoverflow.com/q/26247579
tags question: http://stackoverflow.com/q/26351050
tags question: http://stackoverflow.com/q/26283000
tags question: http://stackoverflow.com/q/26275907
tags question: http://stackoverflow.com/q/26253664

http://stackoverflow.com/a/26282005
answers question: http://stackoverflow.com/q/26281891
has body: You cannot iterate over an ArrayList and modify it at the same time, without an Iterator Do like this : for(Iterator&lt;T&gt; i = a.iterator(); i.hasNext();) { if (i.next().equals(e.value)) { i.remove(); } } BTW, your b ArrayList is useless.
has comment: http://stackoverflow.com/comment/41235698
score: 0
type: Answer

http://stackoverflow.com/comment/41361297
type: QuestionComment
has text: Stepping through this with a debugger would have told you immediately what was happening.
score: 2
comment on: http://stackoverflow.com/q/26350390
type: Comment

http://stackoverflow.com/q/26327269
has comment: http://stackoverflow.com/comment/41318955
answer count: 2
has title: Fragment is always null in oncreate even with setRetainInstance(true)
score: 0
has comment: http://stackoverflow.com/comment/41318708
tagged with: android-studio
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26327463
has answer: http://stackoverflow.com/a/26327724
has body: I wanted to have some data persistent, and I followed Developer Guide Here and created a data Fragment class, to save all my data. In onCreate I'm using following logic to determine if Data Fragment is null or not (also described in developers guide): find the retained fragment on activity restarts FragmentManager fm = getFragmentManager(); dataFragment = (DataFragment) fm.findFragmentByTag(“data”); // create the fragment and data the first time if (dataFragment == null) { // add the fragment dataFragment = new DataFragment(); fm.beginTransaction().add(dataFragment, “data”).commit(); // load the data from the web dataFragment.setData(loadMyData()); } else { //loading data from dataRestoreFragment } super.onCreate(savedInstanceState); but dataFrag is always NULL, even after oriention change ! what is wrong here ? EDIT: The datafragment code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // retain this fragment setRetainInstance(true); } I have to mention, if I check for the datafrag after super.onCreate(savedInstanceState); it will work and return the correct fragment, but the problem is, My another fragment which is ListFragment, its adaptor will get called before restoring data, so that I can not load data into that Fragment, and the fragment will not have data and cause the app to crash ! and If place the code before super.onCreate(savedInstanceState), it would be executed before Listfragment adaptor but it is null ! so how can I fix this ?
tagged with: android-fragments
tagged with: java
type: Question

http://stackoverflow.com/q/26225999
type: Question
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26227851
tagged with: jboss7.x
tagged with: jpa-2.0
has title: LazyInitializationException with active transaction and connection open
linked to: http://stackoverflow.com/q/9318127
upvote count: 1
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has body: I know this has been asked many times (already cheched most of the post here and in other sites), but I dont get to solve my problem. My setup is: jpa 2 + hibernate 4 + spring 4 + primefaces + jboss eap 7 The problem: I got a lazy collection into another bean, but when I get to call the .size() method on the bean, it throws the "LazyInitializationException: failed to lazily initialize a collection of role: com.pe.controlLines.data.model.Activity.activityRisks, could not initialize proxy - no Session" Im sure i got an active transaction following this LazyInitializationException Within a @Transactional Method and http://blog.timmattison.com/archives/2012/04/19/tips-for-debugging-springs-transactional-annotation/ so I'm 100% sure theres a transaction running at the time. My entity clases: @Entity public class Company { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long companyId; @Column private String name; @OneToOne(cascade={CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE}) private Activity companieActivities; @OneToMany private Collection<SourceSupervision> sourceSupervisions; and the nested class @Entity @Indexed public class Activity { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long activityId; @ManyToOne @JoinColumn(name="parentActivityId") private Activity parent; @Column @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO) @Analyzer(definition = "searchtokenanalyzer") private String name; @Column @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO) @Analyzer(definition = "searchtokenanalyzer") private String description; @OneToMany(cascade={CascadeType.PERSIST, CascadeType.REFRESH}) private Collection<ActivityRisk> activityRisks = new ArrayList<ActivityRisk>(); @ManyToMany(cascade={CascadeType.PERSIST, CascadeType.REFRESH}) private Collection<Word> words; @ManyToMany private Collection<Rol> rolesForActivity; the bussines delegate is anotated like this (the bussines is called from the page contr…
has answer: http://stackoverflow.com/a/26227851

http://stackoverflow.com/comment/41200653
has text: `matrix4.setToOrtho2D` puts the camera at (0,0,0). But when you cast your vertex position to a 3D vector with `vec3(v, 1.0)` you are setting its Z position to 1 so you are effectively putting the mesh behind the camera where it can't be seen. By the way, your fragment shader has a typo for `mediump`.
comment on: http://stackoverflow.com/q/26202253
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41102475
type: Comment
comment on: http://stackoverflow.com/a/26209756
score: 1
has text: `Domino.end1` won't compile, since `end1` is most likely not a static member (otherwise this method has no point).
type: AnswerComment

http://stackoverflow.com/comment/41266486
comment on: http://stackoverflow.com/q/26298770
score: 0
type: Comment
type: QuestionComment
has text: I have tried no arguments. When changing the code to "addWindowListener();", the compiler says required: WindowListener, found: no arguments. When changing the code to "addWindowListener(new Wallboard());", the compiler says "incompatible types: Wallboard cannot be converted to WindowListener addWindowListener(new Wallboard());"

http://stackoverflow.com/comment/41311575
score: 0
has text: @Sniper And another one points that there is a model by Swing for `JSpinner`, also possible to use
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26323390

http://stackoverflow.com/comment/41130983
comment on: http://stackoverflow.com/a/26224705
has text: I edited the code displayed. There were no reason for the instance variables I believe. The local variables both had private removed, however it says the variables may have not been initialized. Any advice on this issue?
score: 0
type: AnswerComment
type: Comment

header
type: Tag
tags question: http://stackoverflow.com/q/26265456
tags question: http://stackoverflow.com/q/26243148
tags question: http://stackoverflow.com/q/26331959
tag name: header
tags question: http://stackoverflow.com/q/26212844

http://stackoverflow.com/a/26252566
downvote count: 0
upvote count: 2
type: Answer
has body: Please try the following code SVNCommitClient commitClient = ourClientManager.getCommitClient(); commitClient.setIgnoreExternals(false); SVNNodeKind nodeKind = null; try { nodeKind = repository.checkPath("", -1); } catch (SVNException ex) { Logger.getLogger(Reassignscreen.class.getName()).log(Level.SEVERE, null, ex); } if (nodeKind == SVNNodeKind.NONE) { System.err.println("There is no entry at '" + url + "'."); commitClient.doMkDir(new SVNURL[]{SVNURL.parseURIDecoded(url)}, "New Folder"); } It will work use it
score: 2
answers question: http://stackoverflow.com/q/26252525

http://stackoverflow.com/a/26376525
has comment: http://stackoverflow.com/comment/41424235
has body: So autowiring the ApplicationContext into an @Configuration AppConfig class does work and is actually being autowired. Using it directly in an @Bean method seems to produce a circular autowiring situation. And a StackOverflowError :-( The solution is to apply a 'post construct pattern' with @PostConstruct ... Solution in code: @Configuration public class AppConfig { @Autowired private ApplicationContext applicationContext; @Bean public Marshaller marshaller() { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); marshaller.setContextPath("com.company.app.jaxb"); return marshaller; } @PostConstruct public void initMarshaller() { marshaller().setSchema(applicationContext.getResource("classpath:/xsd/schema.xsd")); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26281863

http://stackoverflow.com/comment/41366855
type: Comment
has text: @subhrajyoti Majumder, If i divide the list, how can i check for duplicate? The duplicate object may be in the another divided list
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26353571

http://stackoverflow.com/comment/41181708
has text: did you really use the indexing variable as the "counter"... this is broken.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26252423
type: AnswerComment

http://stackoverflow.com/comment/41166217
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26243677
has text: are you sure that's exactly how the word appears in the db? whitespace'll throw it off. e.g. `where uword='[space]foo'` matchines completely differntly from `where uword='foo'`

http://stackoverflow.com/a/26344883
answers question: http://stackoverflow.com/q/26344617
score: 0
type: Answer
has body: MethodA() and methodB() is called sequencially so if the lock is there in methodA() until and unless the lock is clear the thread will be in blocked state.

http://stackoverflow.com/comment/41081055
comment on: http://stackoverflow.com/q/26198213
type: Comment
type: QuestionComment
score: 2
has text: This site works better when you ask a question.

http://stackoverflow.com/comment/41228609
comment on: http://stackoverflow.com/q/26211079
score: 0
type: Comment
type: QuestionComment
has text: Im learning as im going, so I thought thats how it was supposed to be implemented. But using fragments just cleared everything up! thanks

http://stackoverflow.com/q/26329639
favorite count: 0
tagged with: while-loop
tagged with: input
upvote count: 1
possible better answer: http://stackoverflow.com/a/26329729
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26329729
score: 1
tagged with: java
tagged with: eclipse
has body: I need to Write a Java application which takes a number as input from the user and validates the input to ensure it is between 1 and 10. If the input is not in the correct range the application should use a loop to continue asking the user for input until a value in the correct range has been entered. Here's the code I have so far: import java.util.Scanner; class Number { public static void main(String args[]) { int j = 0; int J = 0; Scanner input = new Scanner(System.in); System.out.println("Enter a number between 1 and 10: "); J = input.nextInt(); while(J &gt; 10){ j = input.nextInt();//read input from user System.out.println(); if (j &gt;=1 &amp;&amp; j &lt;=10 ) { System.out.println("Validated input: " + j); input.close(); }//end if statement else { System.out.println("Enter a number between 1 and 10"); j = input.nextInt(); }//end else statement }//end while loop }//end main method }//end class I can get the code to work without the while loop but obviously it doesn't run continuously, with what I have done the question appears and you enter a number twice before the question appears again and there is an error with the validation message. So my question is: "How do I get the while loop to run correctly, I probably haven't it wrote correctly so could someone help me please" I'm using eclipse
type: Question
has answer: http://stackoverflow.com/a/26329734
answer count: 2
has title: How to run a continuous loop until a value in the correct range has been entered
downvote count: 0
accepted answer: http://stackoverflow.com/a/26329734

http://stackoverflow.com/comment/41133330
type: AnswerComment
type: Comment
score: 1
has text: Hmm, I see what you're saying about "capacity", but I'd argue it's the correct term. For collections that grow and shrink, it gets used for how much can be stored without a resize operation taking place internally; for a fixed size collection, though, there's no resizing possible. Here *capacity* still fits the same usage: it's how much fits in without needing an (impossible) resizing operation.
comment on: http://stackoverflow.com/a/26226027

http://stackoverflow.com/comment/41356102
comment on: http://stackoverflow.com/q/26347480
type: QuestionComment
type: Comment
score: 2
has text: Allow me to Google for you: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=regex%20negative%20number

http://stackoverflow.com/comment/41120034
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26219266
has text: Android != Java, Android has just java syntax, however code is compiled to byte code (java) and to dalvik bytecode (android).
score: 0

http://stackoverflow.com/comment/41079605
score: 1
type: AnswerComment
has text: The OP needs to compile all his classes before running it. You are compiling 1 class file. It won't find the rest of the class files as they are not compiled.
comment on: http://stackoverflow.com/a/26197448
type: Comment

http://stackoverflow.com/a/26297218
accepted answer of: http://stackoverflow.com/q/26297180
answers question: http://stackoverflow.com/q/26297180
type: Answer
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/79939293
score: 12
has body: Instead of providing my own description i may ask you to read about it for example here: http://en.wikipedia.org/wiki/Variable_shadowing. Once you understood the shadowing of variables i recommend you proceed reading about overlaying/ shadowed methods and visibility in general to get a full understanding of such terms. Actually since the question was asked in Terms of Java here is a mini-example: public class Shadow { private int myIntVar = 0; public void shadowTheVar(){ // since it has the same name as above object instance field, it shadows above // field inside this method int myIntVar = 5; // If we simply refer to 'myIntVar' the one of this method is found // (shadowing a seond one with the same name) System.out.println(myIntVar); // If we want to refer to the shadowed myIntVar from this class we need to // refer to it like this: System.out.println(this.myIntVar); } public static void main(String[] args){ new Shadow().shadowTheVar(); } }
type: AcceptedAnswer

http://stackoverflow.com/comment/41291253
comment on: http://stackoverflow.com/a/26311257
type: AnswerComment
score: 0
type: Comment
has text: Hope the add comments and explanation would help you understand what I want to say.

http://stackoverflow.com/a/60433293
upvote count: 10
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26252591
has body: In the same spirit than @Vegard (lightweight): Install the wanted JDKs with Homebrew Put this jdk bash function and a default in your .profile jdk() { version=$1 export JAVA_HOME=$(/usr/libexec/java_home -v"$version"); java -version } export JAVA_HOME=$(/usr/libexec/java_home -v11); # Your default version and then, to switch your jdk, you can do jdk 9 jdk 11 jdk 13 Based on https://github.com/AdoptOpenJDK/homebrew-openjdk.
score: 10

http://stackoverflow.com/a/26216492
downvote count: 0
type: Answer
has body: anyVararg is a parameterized method. Try: Alpha alphaMock = Mockito.mock(Alpha.class); when(alphaMock.test(Matchers.&lt;String&gt; anyVararg())).thenReturn("success");
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26216122
accepted answer of: http://stackoverflow.com/q/26216122
type: AcceptedAnswer

http://stackoverflow.com/q/26339155
favorite count: 0
has comment: http://stackoverflow.com/comment/41349132
has comment: http://stackoverflow.com/comment/41349757
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26341989
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41341178
has title: Creating a connection with Java ODBC results in a java.sql.SQLException: Invalid Cursor Type exception
score: 7
tagged with: java
upvote count: 7
has body: I am trying to create a Java program that accesses a ODBC datasource. Using the following code... Connection conn; try { Driver d = (Driver)Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance(); DriverManager.registerDriver(d); String URL = "jdbc:odbc:AR System ODBC Data Source"; conn = DriverManager.getConnection(URL); } catch (SQLException | InstantiationException | IllegalAccessException | ClassNotFoundException e) { Logger.error(this, e); } Statement s = null; ResultSet rs = null; try { s = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = s.executeQuery("select count(*) as rows from table"); if (rs.next()) { System.out.print("Count of all rows is " + rs.getInt("rows")); } } catch (SQLException e) { e.printStackTrace(); } finally { DBUtils.safelyClose(s, rs); } ...I get the following Exception: java.sql.SQLException: The result set type is not supported. at sun.jdbc.odbc.JdbcOdbcStatement.initialize(Unknown Source) at sun.jdbc.odbc.JdbcOdbcConnection.createStatement(Unknown Source) at sun.jdbc.odbc.JdbcOdbcConnection.createStatement(Unknown Source) at com.csc.remedyarchiver.data.input.ODBCConnection.main(ODBCConnection.java:38) Originally, when I was attempting to resolve this on my own, I was using the empty argument createStatement() call but this lead to the above exception (hence is why I used the TYPE_FORWARD_ONLY result set type but still the same result): Is there anything else I can try with this or does this need a different approach?
has comment: http://stackoverflow.com/comment/41340833
has comment: http://stackoverflow.com/comment/41342931
type: Question
has comment: http://stackoverflow.com/comment/41340897
has comment: http://stackoverflow.com/comment/41341199
has comment: http://stackoverflow.com/comment/41340994
has answer: http://stackoverflow.com/a/26535443
tagged with: odbc
answer count: 3
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/27114684
has comment: http://stackoverflow.com/comment/41340863
has comment: http://stackoverflow.com/comment/41341431

http://stackoverflow.com/comment/41138052
type: QuestionComment
comment on: http://stackoverflow.com/q/26228445
score: 0
has text: It's a hair more complicate than simply String.equals vs. == if *autoboxing* is considered (whoops, there is another search term!)
type: Comment

http://stackoverflow.com/comment/41292508
score: 0
type: Comment
has text: @user4056620 As I wrote, it's perfectly fine.
type: AnswerComment
comment on: http://stackoverflow.com/a/26312952

http://stackoverflow.com/q/26332148
has comment: http://stackoverflow.com/comment/41344278
score: 0
has title: Getting java.lang.NullPointerException Error When Trying To Parse from Google Alert Feed
has body: I already made an Android RSS Feed App from Google Alerts Source. After I compiled and running only showing blank screen but not crash. You can check out what's wrong from my scripts like below: From ListRSSItemsActivity.java: import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ImageButton; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; public class ListRSSItemsActivity extends ListActivity { // Progress Dialog private ProgressDialog pDialog; // Array list for list view ArrayList&lt;HashMap&lt;String, String&gt;&gt; rssItemList = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); RSSParser rssParser = new RSSParser(); // button add new website ImageButton btnAddSite; List&lt;RSSItem&gt; rssItems = new ArrayList&lt;RSSItem&gt;(); RSSFeed rssFeed; private static String TAG_TITLE = "title"; private static String TAG_LINK = "link"; private static String TAG_DESRIPTION = "description"; private static String TAG_PUB_DATE = "pubDate"; private static String TAG_GUID = "guid"; // not used private String urlString = "http://www.google.com/alerts/feeds/01662123773360489091/16526224428036307178"; @Override public void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); setContentView(R.layout.rss_item_list); String str = urlString; new loadRSSFeed().execute(str); getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; paramAdapterView, View paramView, int paramInt, long paramLong) { Intent localIntent = new Intent(ListRSSItemsActivity.this.getApplicationContext(), DisPlayWebPageAc…
tagged with: android
tagged with: android-asynctask
tagged with: rss
type: UnansweredQuestion
tagged with: google-alerts
has comment: http://stackoverflow.com/comment/41329468
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26334966
answer count: 1

http://stackoverflow.com/comment/41278026
has text: @azurefrog Thanks i changed that and it worked, again i just copy and pasted it from the text book so i wasn't sure what was up
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26304819
type: Comment

http://stackoverflow.com/q/26283965
tagged with: excel
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26284584
tagged with: java
tagged with: jira
type: Question
has body: I am having troubles with an Excel File uploaded into a Webwork Action class in my JIRA plugin. I am using apache.poi to manipulate the Excel file as follows: public class ExcelWebworkAction extends JiraWebActionSupport { private static final long serialVersionUID = -7589391189615316463L; private static final Logger log = LoggerFactory.getLogger(ExcelWebworkAction.class); @Override public String doExecute() throws Exception { MultiPartRequestWrapper wrapper = (MultiPartRequestWrapper)ServletActionContext.getRequest(); File file = wrapper.getFile("fileField"); FileInputStream filestrem = new FileInputStream(file.getPath()); HSSFWorkbook workbook = null; try { workbook = new HSSFWorkbook(filestrem); } catch (IOException e) { e.printStackTrace(); } HSSFSheet sheet = workbook.getSheetAt(0); Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { Row row = rowIterator.next(); Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); } } filestrem.close(); return super.doExecute(); //returns SUCCESS } } When the code gets to the line: workbook = new HSSFWorkbook(filestrem); I am kicked out of the class to a class called ActionSupport from JIRA, but with no errors or stacktraces to guide me. Am I missing something? It there something wrong? :( Thanks in advance for any insights on this issue.
accepted answer: http://stackoverflow.com/a/26284584
score: 0
answer count: 1
has title: Why does a Webwork method in my plugin fall back into JIRA's ActionSupport class?
tagged with: jira-plugin
tagged with: jira-rest-api

http://stackoverflow.com/q/26287852
tagged with: java
has title: Java: Hashtable stores multiple items with same hash in one bucket
has body: Problem Description While reading Oracle documentation about Hashtable I found that "in the case of a "hash collision", a single bucket stores multiple entries, which must be searched sequentially", so I try to find method which will return me items sequentially, if I have two items with the same hash, but can't find in the documentation. In order to reproduce this situation I try to write a simple code, which you can find below. Oracle Documentation about Hashtable An instance of Hashtable has two parameters that affect its performance: initial capacity and load factor. The capacity is the number of buckets in the hash table, and the initial capacity is simply the capacity at the time the hash table is created. Note that the hash table is open: in the case of a "hash collision", a single bucket stores multiple entries, which must be searched sequentially. The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. The initial capacity and load factor parameters are merely hints to the implementation. The exact details as to when and whether the rehash method is invoked are implementation-dependent. Simple Code class Key { public final int mID; public Key(int id) { mID = id; } @Override public int hashCode() { if(mID == 1 || mID == 2) { System.out.println("Have same hashCode()"); return 5673654; } return super.hashCode(); } }; public class HashtableTest { public static void main(String... args) { Hashtable<Key, String> dict = new Hashtable<Key, String>(); dict.put(new Key(1), "One"); dict.put(new Key(2), "Two"); System.out.println(dict.size()); // Prints 2 System.out.println(dict.get(new Key(1))); // Prints null } }; In the code above I try to add to the Hashtable two items which have same hashcode (anyway I think that they have :) ), so for that I create my Key class and override it's hashCode method, but this was useless as I can't even get item from the Hashtable and I think that items are not added se…
possible better answer: http://stackoverflow.com/a/26288180
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26288180
answer count: 3
has answer: http://stackoverflow.com/a/26287894
tagged with: hashtable
favorite count: 0
has answer: http://stackoverflow.com/a/30025076
upvote count: 1
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26287894

http://stackoverflow.com/comment/41204659
has text: I've added images of the errors. It's both vaadin and javax classes.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26264218
type: Comment

http://stackoverflow.com/comment/41257908
type: QuestionComment
comment on: http://stackoverflow.com/q/26294044
score: 0
has text: You should do some debugging to find out what's going on.
type: Comment

http://stackoverflow.com/comment/41178973
type: Comment
comment on: http://stackoverflow.com/q/26250498
has text: @AirCode the exception is prettya explanatory, the problem is that your file is not present in the working directory, either create a file or copy it from other location to location where `MyInfo.txt` is located (should be in your workspace\projectName directory)
score: 0
type: QuestionComment

http://stackoverflow.com/q/26312521
tagged with: http://stackoverflow.com/tag/json
tagged with: fasterxml
tagged with: jackson
has body: I am using Guava TreeMultiset in one of my classes for a field that needs to be serialized/deserialized into a sorted multiset. I am using a custom comparator to construct the TreeMultiset: private SortedMultiset&lt;UserFavCatsNode&gt; ms = TreeMultiset.create(new customComparator()); Serialization seems to be working fine, but deserialization fails as Jackson does not have access to the custom comparator to construct a TreeMuliset instance. How do I pass the comparator instance while deserializing? I initially searched and found two options: Implement the Comparable interface. This works, but imposing custom ordering on the class itself is unsatisfactory. I tried to get around by writing a wrapper class based on a post (http://jackson-users.ning.com/forum/topics/de-serialize-treeset-by-first-defining-a-comparator), and calling this using the @JsonDeserialize annotation public Constructor(@JsonDeserialize(as = CustomTreeMultiset.class) field) { // } This strategy fails because Guava TreeMultiset is final and I cannot implement CustomTreeMultiset that extends it to provide a wrapper deserialization class. Is there a better solution than infuse custom ordering logic into the class?
has comment: http://stackoverflow.com/comment/41313251
downvote count: 0
has title: Deserialing Guava class with custom comparator using Jackson
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/76415915
tagged with: guava
answer count: 0
upvote count: 3
tagged with: java
type: Question
score: 3

http://stackoverflow.com/a/43195918
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26324918
has body: I ran into the similar problem before using Spring Boot and Angularjs. So you have your code: get view1 in the event you click on the tag, and the URL on the web browser displays something like http://localhost:8080/#!/demo/view1/ NOTICE: The /#!/ that appears in the url means you are in (Hashbang in HTML5 Mode) or just (Hashbang mode). AngularJS ngRoute routing operates in three modes: Hashbang Mode HTML5 Mode Hashbang in HTML5 This answer provides great info on the modes. Angularjs routing ...and for more on Hashbang mode look here Be aware that you can configure the routing mode by using $locationProvider e.g.$locationProvider.html5Mode(true); for HTML5 config or $locationProvider.hashPrefix('!'); for Hashbang (#!). Depending on the mode you will need to adjust your URLs <a href="/demo/view" like so... For Hashbang & Hashbang in HTML5 use For HTML5 should be fine, but you might need to specify the url base such as : .... .... or disable in the $locationProvider.html5Mode({ enabled: true, requireBase: false //disabled attribute }); Finally, be aware of where your templateUrl: points to {templateUrl: 'view1.html', controller: 'view1controller'}) and {templateUrl: 'view2.html',controller: 'view2controller'}) Where they are currently pointing in your code for a (Spring Boot default config) placing your view1.html and view2.html directly below the static folder should work such as:

http://stackoverflow.com/q/26248948
type: Question
has answer: http://stackoverflow.com/a/26248991
has title: Why is casting double to char allowed in Java?
has comment: http://stackoverflow.com/comment/41176469
tagged with: casting
possible better answer: http://stackoverflow.com/a/26248991
score: 12
tagged with: char
has answer: http://stackoverflow.com/a/26248978
has answer: http://stackoverflow.com/a/26249015
favorite count: 0
upvote count: 12
tagged with: double
has body: Why is char c = (char)65.8; allowed in Java? Shouldn't it throw an error since 65.8 is not an exact Unicode value? I understand that the double is truncated to an integer, in this case, 65, but it seems like bad design to me to allow the programmer to make such a cast.
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41175969
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26248979
accepted answer: http://stackoverflow.com/a/26248979

http://stackoverflow.com/a/26327569
has comment: http://stackoverflow.com/comment/41319283
has comment: http://stackoverflow.com/comment/41319430
score: 0
has body: "Less-secure apps" means connections that do not use OAuth2. Because they store your password, they're less secure. You can either switch to AOuth2 or allow that access.
type: Answer
answers question: http://stackoverflow.com/q/26327448

http://stackoverflow.com/q/26340787
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41343856
has comment: http://stackoverflow.com/comment/41343831
upvote count: 1
has answer: http://stackoverflow.com/a/26341210
has comment: http://stackoverflow.com/comment/41343843
type: Question
has comment: http://stackoverflow.com/comment/41343835
has comment: http://stackoverflow.com/comment/41343773
score: -1
has body: I have a programming assignment where I am asked to write a class named Account with various methods etc. and a test program. I have completed it all but somethings wrong but I cannot figure what it is. Can annyone help me? The program won't compile. import java.util.Date; public class Account { private int id = 0; private double balance = 0; private double annualInterestRate = 0; private static Date dateCreated = new Date(); Account(){ id = 0; balance = 0; annualInterestRate = 0; dateCreated = new java.util.Date(); } Account(int newId, double newBalance, double newAnnualInterestRate){ id = newId; balance = newBalance; annualInterestRate = newAnnualInterestRate; } public int getId(int id){ return id; } public int setId(int newId){ return newId; } public double getBalance(double balance){ return balance; } public double setBalance(double newBalance){ return newBalance; } public double getAnnualInterestRate(double newAnnualInterestRate){ return newAnnualInterestRate; } public double setAnnualInterestRate(double newAnnualInterestRate){ return newAnnualInterestRate; } public Date getDateCreated(Date getDateCreated){ return dateCreated; } public double getMonthlyInterestRate(){ return balance * annualInterestRate / 12; } public double getMonthlyInterest(double getMonthlyInterestRate){ return balance * getMonthlyInterestRate; } public double withdraw(double amount){ return balance - (balance - amount); } public double deposit(double amount){ return (balance + amount) - balance; } } public class testAccount { public static void main(String[] args) { Account account = new Account(1122, 20000, 4.5); account.setId(1122); account.setBalance(20000); account.setAnnualInterestRate(4.5); account.withdraw(2500); account.deposit(3000); account.dateCreated(); System.out.println("Balance is: " + account.balance); } }
has comment: http://stackoverflow.com/comment/41343826
answer count: 3
has comment: http://stackoverflow.com/comment/41347692
favorite count: 0
has comment: http://stackoverflow.com/comment/41343788
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26340975
has answer: http://stackoverflow.com/a/26340862
has title: Compile error when running simple program

http://stackoverflow.com/comment/41329788
type: AnswerComment
comment on: http://stackoverflow.com/a/26332842
has text: Are you giving a space in-between the letter and number?
type: Comment
score: 0

http://stackoverflow.com/a/26270899
downvote count: 0
answers question: http://stackoverflow.com/q/26270880
type: Answer
score: 3
has body: When autoCommit is false (c.setAutoCommit(false);), you must manually commit the transaction... Add... c.commit() After pstmt.executeUpdate(); You code also has a flaw, in that if some kind of error occurs during the preparation or execution of the statement, both the Connection and PreparedStatement could be left open, causing a resource leak If you're using Java 7+ you can use the try-with-resources feature, for example... try { Class.forName("org.sqlite.JDBC"); try (Connection c = DriverManager.getConnection("jdbc:sqlite:WalkerTechCars.db")) { c.setAutoCommit(false); System.out.println("Opened database successfully"); String query = "UPDATE CUSTOMERS2 set ADDRESS = ? where PHONE = ? "; try (PreparedStatement pstmt = c.prepareStatement(query)) { pstmt.setString(1, "1"); // set input parameter 1 pstmt.setString(2, "DOES THIS WORK"); // set input parameter 2 pstmt.executeUpdate(); // execute update statement c.commit(); } } catch (SQLException exp) { exp.printStackTrace(); } } catch (ClassNotFoundException exp) { exp.printStackTrace(); System.out.println("Failed to load driver"); } This will ensure that regardless of how you leave the try block the resource will be closed. You might also consider taking a look at the JDBC(TM) Database Access
upvote count: 3

http://stackoverflow.com/comment/41357266
comment on: http://stackoverflow.com/q/26348140
has text: calendar uses timezone
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/41330608
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26333014
has text: when i tried the above way I got NPE in onresume and onpause methods.
type: AnswerComment

http://stackoverflow.com/comment/41288219
score: 0
type: AnswerComment
has text: @ajb I am not sure if you misunderstood the question asked, but I never intended to use "both" methods in the same class. I just wanted to know how I could "re-write" the first method differently using a different signature. As for declaring two methods in the same class, I know it is not permissible in Java as you stated before.
type: Comment
comment on: http://stackoverflow.com/a/26307759

http://stackoverflow.com/q/26337906
has comment: http://stackoverflow.com/comment/41338954
downvote count: 2
has answer: http://stackoverflow.com/a/26338988
tagged with: quicksort
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26338988
tagged with: algorithm
has body: First time poster, sorry if I break any etiquette. I'm studying for my Data structures and algorithms midterm and I have a practice problem I don't really understand. Suppose you are given a sorted list of N elements followed by f(N) randomly-order elements. How would you sort the entire list if f(N) = O(1)? How would you sort the entire list if f(N) = O(log N)? We have gone over lots of sorting algorithms but the exam focuses on Insertion, Quick and Merge Sort. I don't really understand what it means by if F(N) = O(log N). Is that using Big oh notation to say that the most amount of random elements on the end would be either a constant or log(N) in each respect case. Thanks for any insight. Edited: Fixed my obvious mistake in terms of Big Oh notation, not sure where to go from here though.
tagged with: java
has comment: http://stackoverflow.com/comment/41338985
has comment: http://stackoverflow.com/comment/41338509
type: Question
has comment: http://stackoverflow.com/comment/41339287
answer count: 1
tagged with: mergesort
tagged with: sorting
has comment: http://stackoverflow.com/comment/41338874
has comment: http://stackoverflow.com/comment/41338940
favorite count: 0
has comment: http://stackoverflow.com/comment/41338669
score: 0
has title: Sorting algorithm implementation
has comment: http://stackoverflow.com/comment/41339208
has comment: http://stackoverflow.com/comment/41338728
has comment: http://stackoverflow.com/comment/41339131
upvote count: 2

http://stackoverflow.com/comment/41291056
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26311816
has text: Are you creating the input stream like InputStream in = this.getClass().getClassLoader().getResourceAsStream(fullpath); ?
score: 0

http://stackoverflow.com/a/26304806
answers question: http://stackoverflow.com/q/26303405
has body: I've found a way, but strangely, it's over twice as slow as the direct deserialize-add-reserialze method with a list of 500 POJOs that have three fields each, and it only gets worse with more objects. ObjectMapper mapper = new ObjectMapper(); JsonParser parser = mapper.getJsonFactory().createJsonParser(input); JsonGenerator gen = mapper.getJsonFactory().createJsonGenerator(output, JsonEncoding.UTF8); gen.writeStartArray(); parser.nextToken(); while (parser.nextToken() == JsonToken.START_OBJECT) { //gen.writeTree(parser.readValueAsTree()); //parser.skipChildren(); //EDIT: This is much faster as the only method in the loop: gen.copyCurrentStructure(parser); } gen.writeTree(mapper.valueToTree(/*new Object to add*/); gen.writeEndArray(); gen.close(); parser.close(); Even if I don't get each object as a tree and instead move them iteratively as fields/values, it's a bit faster, but still considerably slower than the alternative. Is this to be expected or is there a better way to handle it as streaming data rather than the bulk JSON-to-Java-to-JSON method? EDIT: AHA! Found that the JsonGenerator can directly copy the current structure from a JsonParser withcopyCurrentStructure(JsonParser). Using this in the while loop is faster and now outruns the bruteforce method by a considerable amount.
downvote count: 0
has comment: http://stackoverflow.com/comment/41284475
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/41360903
has text: no that won't help, but maybe it would be better just for existing cells to add new textedits? Would it be killing for phone?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26350041
type: Comment

http://stackoverflow.com/a/78376371
answers question: http://stackoverflow.com/q/26318569
score: 0
has body: In my case it turns out that there is an exception / error for the thenReturn part when(serviceA.methodX(y)).thenReturn(TestUtil.createMockData(-1)); The TestUtil.createMockData(-1) failed to use reflection to create the return mock data, if we do it like this doReturn(TestUtil.createMockData(-1)).when(serviceA).methodX(y); The error is easier to spot
type: Answer

http://stackoverflow.com/comment/41298475
type: Comment
comment on: http://stackoverflow.com/a/26315119
type: AnswerComment
has text: If you're having issues with Toast.makeText... you may have to instantiate Toast (like Toast toast = new Toast(); and then issue the toast.makeText line (with lower case t).
score: 0

http://stackoverflow.com/q/26282450
upvote count: 3
has answer: http://stackoverflow.com/a/26303537
answer count: 1
favorite count: 0
has body: I'm dealing with the development of a Java EE project that involves several tools such as jBPM, Hibernate, Resteasy, ect. In order to manage dependencies, I'm using Maven: my pom.xml is available here. Now, I'd like to use inside that project QueryDSL 3.4.3 that depends on Google Guava 14.0.1: unfortunately, something imports as dependency Google Collections 1.0 that generates a conflict with Google Guava 14.0.1. Is it possible to understand where Google Collections is from? Is there a way to resolve this issue safety? (Now, I'm just removing Google Collections's jar from the deployment folder) Update By using the command mvn dependency:tree, I found that Google Collections 1.0 comes from: org.jboss.shrinkwrap.resolver shrinkwrap-resolver-impl-maven Now, I've just to understand if it will work well also by excluding google-collections. See also: http://grepcode.com/.../shrinkwrap-resolver-impl-maven/2.1.1/
has title: Cross dependency issue with Google Collection and Google Guava on Shrinkwrap-resolver
tagged with: maven
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: jakarta-ee
score: 3
has comment: http://stackoverflow.com/comment/41236968
accepted answer: http://stackoverflow.com/a/26303537
has comment: http://stackoverflow.com/comment/41238958

http://stackoverflow.com/q/26220902
upvote count: 7
type: Question
has body: I'm looking at some of the code in the Android butterknife library and found this snippet here: private static final List&lt;Class&lt;? extends Annotation&gt;&gt; LISTENERS = Arrays.asList(// OnCheckedChanged.class, // OnClick.class, // OnEditorAction.class, // OnFocusChange.class, // OnItemClick.class, // OnItemLongClick.class, // OnItemSelected.class, // OnLongClick.class, // OnPageChange.class, // OnTextChanged.class, // OnTouch.class // ); I found this a bit peculiar to have what looks like just empty comments after each line, but no comment text. It reminded me a little of line continuation in C macros, but I have never come across this before in java. Does this actually accomplish anything / is there some convention here where this is used?
downvote count: 0
has title: Empty trailing comments? Do they do/mean anything?
has comment: http://stackoverflow.com/comment/41123521
answer count: 1
has answer: http://stackoverflow.com/a/26221048
favorite count: 0
has comment: http://stackoverflow.com/comment/41123449
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26221048
score: 7
tagged with: java

http://stackoverflow.com/comment/41097230
type: QuestionComment
comment on: http://stackoverflow.com/q/26206261
has text: Is it possible to get that kind of a result using some other kind of inheritance strategy?
score: 0
type: Comment

http://stackoverflow.com/comment/41342931
type: Comment
has text: @PiumiWandana - Yeah, that gave the same exception.
comment on: http://stackoverflow.com/q/26339155
score: 0
type: QuestionComment

http://stackoverflow.com/a/26371685
type: Answer
has comment: http://stackoverflow.com/comment/41563486
has comment: http://stackoverflow.com/comment/41701034
upvote count: 1
answers question: http://stackoverflow.com/q/26316909
score: 1
has comment: http://stackoverflow.com/comment/41400269
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41703206
downvote count: 0
has body: Your analysis is entirely correct. The Android plugin indeed specifies all -injars and -libraryjars for you, and I don't think there is a way to override it. Your best option probably remains -dontwarn. You could also split your library in a common jar and a Java-6-only jar.
has comment: http://stackoverflow.com/comment/41554686
accepted answer of: http://stackoverflow.com/q/26316909

http://stackoverflow.com/q/26203222
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26205234
type: Question
has answer: http://stackoverflow.com/a/26205234
tagged with: http://stackoverflow.com/tag/json
tagged with: javascript
score: 0
answer count: 1
tagged with: jquery
has body: I have the restful webservices call from the Jquery ajax and getting the response in json object. Jquery HTML: $.ajax({ url: "mcrs/object/api/Lighting", type: "POST", traditional: true, dataType: "json", contentType: "application/x-www-form-urlencoded", async: "false", data:JSON.stringify(postdata), success: function (ResData) { }, error: function (error, data) { console.log(error); } }); } }); And writing the response object for the restful webservices in java @POST @Path("api/{subsystem}") @Produces("application/json") public Response changeStatus(@PathParam("subsystem") String subsystem, /*@FormParam("result")*/ String result) { } I got the response below and which is correct changeStatus:88 - Reponse OutboundJaxrsResponse{status=200, reason=OK, hasEntity=true, closed=false, buffered=false} Depending upon the reponse need to update the status whether the value is on/off in the label tag. str = ' Status : ' + '' + onoffStat + ''; How can I achieve this in ajax and want to have the refreshing the div tag for every 2 seconds. Please help me.
tagged with: ajax
has comment: http://stackoverflow.com/comment/41090819
has title: Need to get the response and to have change in ajax jquery GUI

http://stackoverflow.com/q/26229174
answer count: 2
possible better answer: http://stackoverflow.com/a/26246014
score: 0
tagged with: java
tagged with: eclipse
has title: Open Eclipse plugin view like a modal window
accepted answer: http://stackoverflow.com/a/26291942
has body: I have developed an eclipse RCP plugin, which is intended to run as an Eclipse application, and can be extracted as an standalone Eclipse product. Now, i want to reuse the same, by adding it as an plugin, so that i can be accessed from within eclipse. I am able to install the same into my eclipse workspace and can see the view via Window > Show View. However the view opens into the area below the editor (along with Console view), instead of opening as a standalone window. Please point me towards a way, by which the View opens in a separate window, just like the 'Search' window. The view extends 'ViewPart' and uses composites. Relevant bits from Plugin.xml below:
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26246014
tagged with: eclipse-plugin
type: Question
has answer: http://stackoverflow.com/a/26291942

http://stackoverflow.com/comment/76577337
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26319364
type: Comment
has text: Awesome. The funny thing is, when I do the direct method call and debug slowly, then it works. The Attribute of CGLIB$BOUND will get the value true, but somehow it takes a little time. When I use the direct method call and stop before training (when ...), then I see the value is first false, and becomes later true. When it is false and training starts, then this exception occures.

http://stackoverflow.com/q/26295525
has title: How do I ensure that all Threads are stopped before main Thread is stopped?
has answer: http://stackoverflow.com/a/26295630
score: 1
tagged with: java
tagged with: multithreading
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26295556
possible better answer: http://stackoverflow.com/a/26295560
has body: This is my program in which a thread is started under the main method public class ThreadTest { public static void main(String args[]) throws InterruptedException { Thread mainThread = Thread.currentThread(); Thread t1 = new Thread() { public void run() { while (true) { System.out.println("Hi"); } } }; // t1.setDaemon(true); t1.start(); } } How do I ensure that before the main thread is stopped all its child Threads are stopped? I don't want to use the Daemon option. Is this possible?
has comment: http://stackoverflow.com/comment/41260521
has answer: http://stackoverflow.com/a/26295556
has comment: http://stackoverflow.com/comment/41262621
downvote count: 0
has answer: http://stackoverflow.com/a/26295559
favorite count: 0
has answer: http://stackoverflow.com/a/26295560
answer count: 5
has answer: http://stackoverflow.com/a/26295625
type: AnsweredQuestion

http://stackoverflow.com/a/26267683
type: Answer
has body: while your way of creating a random may not be the most efficient -- the least invasive change to your code would be to simply wrap your while in a for loop ... you can add the results to an Array, or a List to access them later. Random randNumList = new Random(); //do this only once - no need to re-create it you can re-use it for(int i=0; i&lt;asManyAsYouWantPlusOne; i++){ randNum = 0; //important! reset here or you will end up with all the same random numbers ... while( !(randNum&gt;=15 &amp;&amp; randNum&lt;=32)&amp;&amp; !(randNum&gt;=212 &amp;&amp; randNum&lt;=229)) { randNum = randNumList.nextInt(251); } //add to list, or array here ... System.out.println(randNum); }
has comment: http://stackoverflow.com/comment/41210058
has comment: http://stackoverflow.com/comment/41210556
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26267598
has comment: http://stackoverflow.com/comment/41211552
answers question: http://stackoverflow.com/q/26267598

http://stackoverflow.com/a/26273854
score: -1
answers question: http://stackoverflow.com/q/26273252
upvote count: 0
has body: problem about finding element without some attribute is solved here: https://stackoverflow.com/a/18774549/2131257 and for find all elements is used method driver.findElements(By.id("element_id")) which return list of elements instead of driver.findElement(By.id("element_id")) which return only one element. Hope it helps.
type: Answer
downvote count: 1

http://stackoverflow.com/q/26209381
accepted answer: http://stackoverflow.com/a/26220837
upvote count: 2
type: AnsweredQuestion
tagged with: java
tagged with: thread-safety
type: Question
answer count: 2
tagged with: google-cloud-datastore
has answer: http://stackoverflow.com/a/26220837
downvote count: 0
possible better answer: http://stackoverflow.com/a/26209458
has body: Here is there Java example: https://cloud.google.com/datastore/docs/getstarted/start_java/ Is it advisable to create one static datastore object as shown here: datastore = DatastoreFactory.get().create(DatastoreHelper.getOptionsfromEnv() .dataset(datasetId).build()); And then reuse it across multiple threads calling methods like: LookupResponse lresp = datastore.lookup(lreq.build()); datastore.commit(creq.build()); Or should a new datastore be created on each thread? Thanks!
has answer: http://stackoverflow.com/a/26209458
has title: Is the Google Cloud Datastore Java API threadsafe?
score: 2
favorite count: 0

http://stackoverflow.com/a/26338334
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41340376
has comment: http://stackoverflow.com/comment/41339935
upvote count: 2
has body: Each enum has a method values() so You can do like that: for(YourEnum type : values()){ if(/*is Equal to Your descriptionText*/){ return type; } } throw new IllegalArgumentException("No such BailiffPaymentStatus:"+dbRepresentation);
has comment: http://stackoverflow.com/comment/41340229
has comment: http://stackoverflow.com/comment/41340478
has comment: http://stackoverflow.com/comment/41340167
has comment: http://stackoverflow.com/comment/41339348
type: Answer
answers question: http://stackoverflow.com/q/26338237

http://stackoverflow.com/q/26266284
downvote count: 0
tagged with: awt
answer count: 3
has answer: http://stackoverflow.com/a/26267148
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has body: I am making Pac-Man and I'm having trouble with drawing graphics on a frame, when i draw my point image it looks like a game of snake, i tried putting my drawing methods for background and char both in the render method, but than my point image flickers What it currently looks like, feel free to ignore the random face it was an inside joke. Also this is my very first game so any tips on structure, pointers on what I am doing right (if anything) and what I'm doing wrong, and general tips would be extremely helpful! Also I am aware that i have a couple unused methods Code: package game; import graphics.map; import java.awt.BorderLayout; import java.awt.Canvas; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JFrame; public class main extends Canvas implements Runnable{ private static final long serialVersionUID = 1L; //not sure why it wanted me to do this, maybe ask bender, or just google it later public static boolean running = false; public static int HEIGHT = 800; public static int WIDTH = 600; public static int posX = 50; public static int posY = 50; public static final String name = "Pac Man Alpha 1.4"; private static final double speed = 1.2; public input input; static BufferedImage background = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);; static BufferedImage pacman = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);; static BufferedImage settingsBackground = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);; static BufferedImage level1 = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);; static BufferedImage level2 = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26267275
linked to: http://stackoverflow.com/q/10508042
has title: Java - Pac-Man - GUI - Drawing Graphics issue, and general tips for an aspiring programmer
type: Question
tagged with: canvas
has answer: http://stackoverflow.com/a/26267180

http://stackoverflow.com/comment/41242539
type: AnswerComment
score: 0
type: Comment
has text: @MirroredFate I tried to change it to your suggestion. You and I were editing at the same time. Sorry! I am editing my response like a firestorm, right now (trying to flesh it out). Refresh your browser and the change should be there (?). Your distinction is an important one. Voted you up on your comment so you'd get credit for the change.
comment on: http://stackoverflow.com/a/26285256

http://stackoverflow.com/q/26279248
tagged with: java
has comment: http://stackoverflow.com/comment/41231019
type: Question
has comment: http://stackoverflow.com/comment/41230740
has comment: http://stackoverflow.com/comment/41232505
linked to: http://stackoverflow.com/q/12834887
has comment: http://stackoverflow.com/comment/41267462
tagged with: eclipse
upvote count: 3
tagged with: eclipse-plugin
favorite count: 0
linked to: http://stackoverflow.com/q/11126857
has body: I have created an eclipse plugin where the user right clicks the method in the package explorer. It will generate a file with the method body. Currently my output is public int add(int x,int y){ int z=x+y; return z; } I am using SourceMethod for getting the method content. The code is as follows. public void methodGenerator(SourceMethod methodname){ String methodcontent=methodname.getSource(); filegenerator = new FileWriter(FilePath); writer = new BufferedWriter(filegenerator); writer.write(methodcontent); } Here I am using org.eclipse.jdt.internal.core.SourceMethod to get the method content. Now i need to get the line numbers. So how I can get the line numbers of the method ? I have gone through How to get the line number of a method? here we can get only the starting line no. My requirement is the generated file content should be as follows: 14.public int add(int x,int y){ 15. int z=x+y; 16. return z; 17.} Please give me some suggestions. Am very much in need of this logic. Please help me out!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41231499
score: 3
answer count: 0
downvote count: 0
has title: How to get the line numbers of a method and its body by using our own eclipse plugin?
has comment: http://stackoverflow.com/comment/41237946

http://stackoverflow.com/a/26246533
has comment: http://stackoverflow.com/comment/41171972
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41171497
has comment: http://stackoverflow.com/comment/41186021
has comment: http://stackoverflow.com/comment/41192825
has body: If you just do AdDao newDao = new AdDaoImpl(); your container will not known where to inject the EntityManager. If you are using JBoss or Glassfish (or someother kind of EJB Containner) you need to declare AdDao as EJB: @Stateless public class AdDao () {} And you will use it in your servlet like: @EJB public AdDao ejb; PS.: I would not inject a DAO in a controller. The best is to use other classes between both, but if you are new to this kind of technology start with it. If you are using a solution without JPA you can do something like: private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("YOUR_PERSISTENCE_UNIT"); // store it in your class public void yourMethod(){ final EntityManager entityManager = entityManagerFactory.createEntityManager(); entityManager.getTransaction().begin(); // do your stuff here entityManager.getTransaction().commit(); entityManager.close(); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41171433
accepted answer of: http://stackoverflow.com/q/26246368
answers question: http://stackoverflow.com/q/26246368
has comment: http://stackoverflow.com/comment/41171505
has comment: http://stackoverflow.com/comment/41182297
type: Answer

http://stackoverflow.com/comment/41282610
has text: What do you mean *exactly* by "empty string error"? I'd expect an exception because you've tried to cast a `java.util.Date` to `java.sql.Date`. Mind you, your code wouldn't compile to start with because of the `"?,?"` part... your SQL isn't a valid string literal, basically. (It's not clear why you've got quotes there at all...)
type: Comment
comment on: http://stackoverflow.com/q/26307347
type: QuestionComment
score: 0

http://stackoverflow.com/q/26300813
has comment: http://stackoverflow.com/comment/41361463
answer count: 1
has comment: http://stackoverflow.com/comment/42709460
tagged with: android
has body: I've just moved one of my Android projects over to Gradle, and as per recommendations inside the IDE and online I've moved all the configurations (min/max sdk, version name/code etc) into the build.gradle file. Now a bug has been reported from a customer that where he could usually see the version name and code inside the product there is nothing. After checking it out I've found out that the usual way of extracting those values has stopped working after I removed the android:versionCode="" and android:versionName="" tags from AndroidManifest.xml. I have verified that it works when these values are there. Now I've been trying to search for a way of extracting these same values to use in code, but I have not found any reference to this behaviour else where (this not working like this). The code I used to use to get the values was to simply extract them from the PackageManager as so try { PackageInfo pInfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0); return pInfo.versionName + " Build " + pInfo.versionCode; } catch(PackageManager.NameNotFoundException e){ e.printStackTrace(); } All hints, tips or solutions appreciated.
has title: Unable to get version name in code after moving to Gradle
has comment: http://stackoverflow.com/comment/41371303
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41388631
score: 0
has answer: http://stackoverflow.com/a/26300960
tagged with: java
has comment: http://stackoverflow.com/comment/41351811
linked to: http://stackoverflow.com/q/12383918
tagged with: gradle
type: Question
accepted answer: http://stackoverflow.com/a/26300960
has comment: http://stackoverflow.com/comment/41348483
has comment: http://stackoverflow.com/comment/41350031

http://stackoverflow.com/comment/41245443
comment on: http://stackoverflow.com/q/26286736
score: 1
has text: I don't believe your code. In particular, you're "overriding" a method that that code can't possibly override. I suspect a self-call issue; post real code.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26251423
has answer: http://stackoverflow.com/a/26275461
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41221604
favorite count: 0
type: UnansweredQuestion
tagged with: rdd
has title: Hadoop Spark: How to make distinct of elements in JavaRDD?
has comment: http://stackoverflow.com/comment/41194255
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I want to store distinct of some JavaRDD collection to a file in Spark? By using distinct() method of RDD, I couldn’t achieve the same. My guess is RDD treats each element as a individual instance. How can we achieve the distinct in this case. Following is code snippet, Can anyone please help? public static void main(String[] args) { SparkConf conf = new SparkConf().setAppName("Xml Spark Demo"); JavaSparkContext sc = new JavaSparkContext(conf); JavaSQLContext sqlContext = new org.apache.spark.sql.api.java.JavaSQLContext( sc); // Load a text file and convert each line to a JavaBean. JavaRDD&lt;String&gt; dataFromFile = sc.textFile( "/home/kedarnath/Rentals/inputData/temp-01.xml").map( new ParseAgentFromXml()); //Need distinct values here dataFromFile.distinct().saveAsTextFile("/home/kedarnath/Rentals/testOutputDistinct.txt"); } Thanks in advance, ~Kedar
has comment: http://stackoverflow.com/comment/41194677
has comment: http://stackoverflow.com/comment/41222715
tagged with: apache-spark

http://stackoverflow.com/q/26287883
has answer: http://stackoverflow.com/a/26288729
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41248432
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/41247967
accepted answer: http://stackoverflow.com/a/26288729
downvote count: 0
answer count: 1
has body: I have searched through similar questions here on Stack Overflow, however, I can't seem to make this work. I have a java program that must use ProcessBuilder to load a C executable file. The file just accepts a string through the CLI and converts it to upper case. The java program creates a system process with ProcessBuilder to manage this executable, and must send the string and receive the converted one to print it in the CLI. This is the code for uppercases.c: #include &lt;stdio.h&gt; int main(int argc, char *argv[]) { char text[1024]; scanf("%s", &amp;text[0]); int i; for(i = 0; i &lt; strlen(text); i++) { text[i] = toupper(text[i]); } printf("%s\n", text); return 0; } I compiled it using $ gcc uppercases.c -o uppercases And ran it with $ ./uppercases Everything works fine. Now this is the code for Uppercase.java. I have to create an OutputStream to send the string to the C executable (uppercases), and then I create an InputStream to save its output and print it to the CLI: public class Uppercase { public static void main(String[] command) { String textIn, textOut; Scanner reader = new Scanner(System.in); // This is what we want to send System.out.println("Write something: "); textIn = reader.nextLine(); try { // Here I create a process to handle "uppercases" Process process = new ProcessBuilder(command).start(); OutputStream os = process.getOutputStream(); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os)); // According to me, this will send the string to "uppercases" bw.write(textIn); bw.flush(); // This is to read the output of "uppercases" InputStream is = process.getInputStream(); BufferedReader br = new BufferedReader (new InputStreamReader(is)); while ((textOut = br.readLine()) != null) { System.out.println(textOut); } os.close(); is.close(); } catch (IOException e) { System.out.println("I/O error:" + e.getMessage()); } catch (Exception e) { System.out.println("Error:" + e.getMessage()); } } } To compile, I type: $ javac Uppercase.java And…
has comment: http://stackoverflow.com/comment/41247948
has title: Java program using ProcessBuilder with input and output streams doesn't work
favorite count: 0
has comment: http://stackoverflow.com/comment/41247397
tagged with: processbuilder
score: 3
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/q/26263945
has comment: http://stackoverflow.com/comment/41202831
accepted answer: http://stackoverflow.com/a/26264021
type: Question
has body: Hi I wish to get a users age from a form and convert that String to an int and use elsewhere in a java class The .jsp snippet looks like this &lt;% String str = request.getParameter("age"); int convertInt = Integer.parseInt(str); %&gt; &lt;% myProgram.comAvgerage(convertInt);%&gt; however i am getting HTTP Status 500 - java.lang.NumberFormatException: null I think this is because the form is being created in a UI class first thus the fields are null ? Is this the fault and can i fix this thanks
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/41203071
tagged with: getparameter
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26264021
tagged with: jsp
has title: Why is a null value provided to my JSP snippet from the form submission?

http://stackoverflow.com/q/26294146
type: Question
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/26294623
tagged with: spring-form
linked to: http://stackoverflow.com/q/42198050
answer count: 1
has body: Here is form.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%> Add Student <form:form action="addStudent" commandName="addStudent" method="post"> <form:label path="name">Name:</form:label> <form:input path="name"/> <form:label path="email">Email:</form:label> <form:input path="email"/> <form:label path="age">Age:</form:label> <form:input path="age"/> </form:form> Here is controller method @RequestMapping(value="/addStudent", method=RequestMethod.POST) public String addStudent(@ModelAttribute("addStudent") Student student) { System.out.println("Saving Info..."); System.out.println("Name: "+student.getName()); System.out.println("Email: "+student.getEmail()); System.out.println("Age: "+student.getAge()); return "form"; } Here is Student model public class Student { private String name; private String email; private int age; private int id; public Student() { super(); } } I guess there is no need for web.xml or dispatcher-servlet.xml . Every thing is correctly binded, I mean commandName is right in jsp. ModelAttribute is correct in controller then why contol is not reaching controller? :( Please help. I have already wasted half of the day on this. PS:I am new to Spring and stackoverflow. EDIT: after suggestions, my code look like this: controller method: public String addStudent(@ModelAttribute("student") Student student, BindingResult result) { jsp form: <form:form action="addStudent" commandName="student" method="post"> EDIT: resolved it myself added this method for modelattibute @ModelAttribute("student") public Student getForm() { return new Student(); }
tagged with: jsp
duplicate of: http://stackoverflow.com/q/42198050
has title: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'addStudent' available as request attribute
score: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/26345917
tagged with: wildfly-8
tagged with: jboss
has title: a4j:repeat changes behaviour?
score: 0
answer count: 1
tagged with: richfaces
type: AnsweredQuestion
has body: I have a strange effect with a4j:repeat when using rich:toolbar in RichFaces. In my little example I just place a couple of icons on the toolbar. If I do it manually, they are all separately placed into &lt;td&gt;...&lt;/td&gt;. But if let them generate by a list using a4j:repeat, they will all be placed together within one &lt;td&gt;...&lt;/td&gt;. The result of this is that those placed manually are more far from each other in the view. Those who were generated, stick together. I believe the difference is, that the rich:toolbarGroup thinks of the a4j:repeat as one object, and of the manually placed ones as serveral objects. I tried out with c:forEach as well, but I get exactly the same effect. Does anyone know how to define the a4j:repeat objects as separate? Or if it is another problem, how to solve it?
tagged with: java
tagged with: wildfly
has answer: http://stackoverflow.com/a/26359371
type: Question
accepted answer: http://stackoverflow.com/a/26359371

http://stackoverflow.com/a/36821171
score: 3
upvote count: 3
has body: You can use the below class it has most of the methods you want. /** * Class representing square matrix of given size. * It has methods to rotate by 90, 180 and 270 * And also to transpose and flip on either axis. * * I have used both space efficient methods in transpose and flip * And simple but more space usage for rotation. * * This is using builder pattern hence, you can keep on applying * methods say rotate90().rotate90() to get 180 turn. * */ public class Matrix { private int[][] matrix; final int size; public Matrix(final int size) { this.size = size; matrix = new int[size][size]; for (int i=0;i&lt;size;i++) for (int j=0;j&lt;size;j++) matrix[i][j] = i*size + j; } public Matrix rotate90() { int[][] temp = new int[size][size]; for (int i=0;i&lt;size;i++) for (int j=0;j&lt;size;j++) temp[i][j] = matrix[size-1-j][i]; matrix = temp; return this; } public Matrix rotate180() { int[][] temp = new int[size][size]; for (int i=0;i&lt;size;i++) for (int j=0;j&lt;size;j++) temp[i][j] = matrix[size-1-i][size-1-j]; matrix = temp; return this; } public Matrix rotate270() { int[][] temp = new int[size][size]; for (int i=0;i&lt;size;i++) for (int j=0;j&lt;size;j++) temp[i][j] = matrix[j][size-1-i]; matrix = temp; return this; } public Matrix transpose() { for (int i=0; i&lt;size-1; i++) { for (int j=i+1; j&lt;size; j++) { int tmp = matrix[i][j]; matrix[i][j] = matrix[j][i]; matrix[j][i] = tmp; } } return this; } public Matrix flipVertical() { for (int i=0; i&lt;size; i++) { for (int j=0; j&lt;size/2; j++) { int tmp = matrix[i][size-1-j]; matrix[i][size-1-j] = matrix[i][j]; matrix[i][j] = tmp; } } return this; } public Matrix flipHorizontal() { for (int i=0; i&lt;size/2; i++) { for (int j=0; j&lt;size; j++) { int tmp = matrix[size-1-i][j]; matrix[size-1-i][j] = matrix[i][j]; matrix[i][j] = tmp; } } return this; } @Override public String toString() { StringBuilder sb = new StringBuilder(); for (int i=0;i&lt;size;i++) { for (int j=0;j&lt;size;j++) { sb.append("|"); sb.append(mat…
answers question: http://stackoverflow.com/q/26197466
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41361395
score: 0
type: AnswerComment
has text: Thanks for pointing that out! I'll fix it up...
comment on: http://stackoverflow.com/a/26349909
type: Comment

http://stackoverflow.com/a/26248269
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26244430
answers question: http://stackoverflow.com/q/26244430
has body: "It's important for me to have this pictures in two diffrent classes becous i need to connect this images with the other properties" You may be going about this incorrectly, trying to make each of these classes a JPanel. I mean, technically you could make it happen with a JLayeredPane. But I would go about it differently. First to handle your "other properties", you could use an interface to combine the objects you want to draw. Just have a define draw method in the interface. public interface Drawable { void draw(Graphics g); } Then you can have a main panel to do the drawing. This panel will hold a List or Map of Drawable objects; a List if access after adding them is not important, and a Map if you need easy access to them after you add. For instance. public class DrawingPanel extends JPanel { List&lt;Drawable&gt; drawList; // Map&lt;String, Drawable&gt; drawMap; public void addToDrawList(Drawable drawable) { drawList.add(drawable); repaint(); } // public void addToDrawMap(String key, Drawable drawable) { // drawMap.put(key, drawable); // repaint(); // } protected void paintComponent(Graphics g) { super.paintComponent(g); for(Drawable drawable : drawList){ drawable.draw(g); } // for (Drawable drawable : drawMap.values()) { // drawable.draw(g); // } } } Now you can just make any class you want implements Drawable, and just add an instance of that class to the drawList or drawMap. This way everything is all drawn onto the same surface. For example class HelloDrawable implements Drawable { @Override public void draw(Graphics g) { g.drawString("Hello", 100, 100); } } class WorldDrawable implements Drawable { @Override public void draw(Graphics g) { g.drawString("World", 150, 100); } } public class Main { public static void main(String[] args) { JFrame frame = new JFrame(); DrawingPanel panel = new DrawingPanel(); panel.addToDrawList(new HelloDrawable()); panel.addToDrawList(new WorldDrawable()); // panel.addToDrawMap("Hello", new HelloDrawable()); } }
upvote count: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26207758
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26207500
answers question: http://stackoverflow.com/q/26207500
score: 0
upvote count: 1
type: Answer
downvote count: 1
has body: This example can help clarify Big-O notation and algorithm efficiency Quora: Big-O Notation explained by Gayle McDowell For the case of 1.4.6 a, the outer loop occurs with O(log n) and the inner loop occurs a menial number of times compared to that so the entire function would be O(log N).

http://stackoverflow.com/a/26199472
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41083356
has body: Change this line: Move oppMove; // Opponent's best reply to Move oppMove = null; // Opponent's best reply
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26199458

http://stackoverflow.com/comment/41183368
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26248635
type: Comment
has text: agree, I'm see, I'm winner, todays price is - palete of the most idiotic comments in one thread

http://stackoverflow.com/comment/41107333
comment on: http://stackoverflow.com/a/26212366
type: Comment
score: 0
has text: You can insert Object in ArrayList, you can also insert String array in ArrayList. so it will work like a 2D string Array and you wont need to set the size in advance.
type: AnswerComment

http://stackoverflow.com/a/26241738
type: Answer
has body: As microsby0 said, you could probably split the raw words into arrays. I don't believe there is an easy way to directly convert a raw word into a class name ((Circle)"Circle" doesn't work and is what I believe is confusing you). You should read each array into certain parameters and process them: /*somewhere else in code:*/ shapeArray[i] = convert(array[0],array[1],...)//where i is some incremental value in a loop Shape convert(String s, int someNumber,...) { Shape c; switch(s) { case "Circle": c = new Circle(...); break; case "Square" ... break; //and so on } //more application logic return c; } Convert can return a shape which you can assign to an array of shapes. You can always use function(method) 'overloading' to handle different inputs.
answers question: http://stackoverflow.com/q/26241322
score: 0

http://stackoverflow.com/a/26243606
type: Answer
upvote count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/41165981
accepted answer of: http://stackoverflow.com/q/26243517
answers question: http://stackoverflow.com/q/26243517
score: -1
type: AcceptedAnswer
has body: public static void main (String args[]){ int leapYear = 2001; // initialize leapYear variable to 2001 while (leapYear &lt;= 2100){ for (int x = 0; x &lt; 10; x++){ // print ten leap years per line if (leapYear &gt; 2100){ // if leapYear is over 2100, stop printing break; } System.out.print(leapYear + " "); leapYear = leapYear + 4; }// end of for loop System.out.println(" "); int x = 0; } // end of if statement }// end of main method

http://stackoverflow.com/a/37486000
answers question: http://stackoverflow.com/q/26199515
score: 0
has body: As wks said, Firstly, a Java array object has a built-in length, but a C pointer value itself does not contain the upper-bound. C usually use conventions like zero-terminated strings, or passing two arguments (ptr, len). Secondly, a Java array has to be populated before using (i.e. not lazy). This implies loading all pointers to the array, which may be inefficient. This also needs to be done with a known array length. As soon, as void const** and void** parameters are equivalent to array of unknown size, you should use jnr.ffi.byref.PointerByReference for these parameters as shown here: public int call(Pointer a, PointerByReference b, PointerByReference c); Then the usage of your method should be like this: Pointer a = new Pointer.wrap(Runtime.getSystemRuntime(), variable); PointerByReference b = new PointerByReference(); PointerByReference c = new PointerByReference(); call(a, b, c); Pointer bValue = b.getValue(); To manage data further you should know exactly what kind of data you are dealing with.
type: Answer

http://stackoverflow.com/comment/41319283
type: AnswerComment
has text: But if i write an application to check the inbox of all mails i have,do i have to change settings of all the mails i am giving in the app?Cant i make any changes in the program so that it will become more secured?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26327569

http://stackoverflow.com/a/26326915
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26322985
has comment: http://stackoverflow.com/comment/41330389
has body: Fetch in @ManyToOne annotation is optional so why to care about this. @ManyToOne annotation defines a single-valued association to another entity class that has many-to-one multiplicity. So try following scenario. @ManyToOne @JoinColumn(name="childTable_id", nullable = false, referencedColumnName="id") If you want to work that with lazy initialization so Try this, @ManyToOne(fetch=FetchType.Lazy) @JoinColumn(name="childTable_id", nullable = false, referencedColumnName="id")

http://stackoverflow.com/q/26275605
has comment: http://stackoverflow.com/comment/41224348
has body: So, I have a method that is looping through and returning these numbers automatically : 6527.6 6755.6 7009.9 7384.7 7775.9 8170.7 8382.6 8598.8 8867.6 9208.2 9531.8 9821.7 10041.6 10007.2 9847.0 10036.3 10263.5 10449.7 10699.7 I would like to average the first number to the second number, the second to the third number, and so on. What ways should I go about doing this? Adding all these doubles to an array? Or is there a way to get a running total in order to do this? The problem I'm having is that I can only seem to get all or none of these doubles, not specific ones. So the output would be the results of something like (6527.6+6755.6)/2, (6755.6+7009.9)/2, and so on. Just printing them, nothing else. Edit : Code from the parser here : http://pastebin.com/V6yvntcP
possible better answer: http://stackoverflow.com/a/26276684
has comment: http://stackoverflow.com/comment/41223988
has comment: http://stackoverflow.com/comment/41224006
has answer: http://stackoverflow.com/a/26275890
has comment: http://stackoverflow.com/comment/41224076
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41224338
has comment: http://stackoverflow.com/comment/41224349
has comment: http://stackoverflow.com/comment/41224128
tagged with: java
has title: Averaging multiple results of a method?
tagged with: methods
tagged with: average
accepted answer: http://stackoverflow.com/a/26275890
type: Question
has answer: http://stackoverflow.com/a/26276684
score: 0
answer count: 2

http://stackoverflow.com/comment/41165759
has text: then use writeValue if you need null Long
score: 0
comment on: http://stackoverflow.com/q/26227095
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41209808
has text: Answered [here](http://stackoverflow.com/a/26267512/230513).
score: 0
comment on: http://stackoverflow.com/q/26260233
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26446234
has body: I think you are getting yuv420sp instead of yuv420p. This would explain the horizontal bars in the image. Semi Planar formats interleave the U and V planes. // 420p to 420sp int frameSize = width * height; int qFrameSize = frameSize / 4; for (int i = 0; i &lt; (qFrameSize); i++) { input[frameSize + i*2] = (input[frameSize + qFrameSize + i]); input[frameSize + i*2 + 1] = (input[frameSize + i]); }
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26304859
score: 1
upvote count: 1

http://stackoverflow.com/comment/41246221
type: QuestionComment
has text: Check the pom what dependancy jar it needs add that to the class path or your repo and then try the import....
score: 0
comment on: http://stackoverflow.com/q/26287337
type: Comment

http://stackoverflow.com/comment/41354432
type: QuestionComment
comment on: http://stackoverflow.com/q/26346330
score: 0
has text: Is `"aaafoo------ccc---ddd"` also correct string?
type: Comment

http://stackoverflow.com/comment/41086030
has text: Please create an actual test-case. Otherwise all we can do is guess.
comment on: http://stackoverflow.com/q/26200987
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/41168373
type: QuestionComment
type: Comment
score: 2
has text: In addition to the correct answer, seeing a static in an Activity should make you instinctively fell unwell (see `code smells`) and passing `this`, or `Context` or anything else which references an `Activity` to an object you cannot directly control the lifetime of, and **guarantee** that it is, at most, as long as the `Activity`, should make you vomit on the spot.
comment on: http://stackoverflow.com/q/26244593

http://stackoverflow.com/comment/41341379
type: Comment
has text: I recommend the book "Design Patterns and Contracts", where the GoF Design Patterns are explored in Eiffel, which does allow multiple inheritance. The authors use multiple inheritance quite naturally in several cases. It is just hard to think about cubes when your mind is flat.
comment on: http://stackoverflow.com/a/26339359
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41247295
type: QuestionComment
comment on: http://stackoverflow.com/q/26287814
score: 0
has text: what ide are you using ? The ListLinks class has the main..
type: Comment

http://stackoverflow.com/comment/41349204
comment on: http://stackoverflow.com/q/26339237
score: 1
has text: I have always wondered this myself. It seems like a very complex example when your 3 class version is sufficient to demonstrate the problem.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26345686
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26340553
upvote count: 1
type: Answer
has body: You can add the MouseListener to your panel. Then you can use the findComponentAt(...) method of the Container class to return the component that was clicked.

http://stackoverflow.com/comment/41102359
comment on: http://stackoverflow.com/q/26209730
has text: Giving the answer on an interview test would be cheating. I would point you in the right direction by asking you to look at pos. It is a matrix, but what is the size of the matrix? That might help you understand the issue.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26349225
accepted answer of: http://stackoverflow.com/q/26349126
has comment: http://stackoverflow.com/comment/41359742
type: Answer
has comment: http://stackoverflow.com/comment/41359521
score: 0
has body: The (IMO, straightforward, but I suspect ugly) way would look like this: if (!tmpDir.setWritable(true, false)) { throw new IOException(); } I asked the question because it seemed like there might be a cleaner, or better way.
has comment: http://stackoverflow.com/comment/41359453
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26349126

http://stackoverflow.com/q/26352476
upvote count: 1
type: Question
tagged with: spring-jmx
has comment: http://stackoverflow.com/comment/41374709
tagged with: arraylist
has title: How to add listener to JMX to update?
downvote count: 0
favorite count: 0
tagged with: listener
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41367690
tagged with: jmx
has body: Consider the following JMX code: public class UserJMXBeanExpose { private UserJMXBeanImpl userJMXBean; @Required public void setUserJMXBean(UserJMXBeanImpl userJMXBean) { this.userJMXBean = userJMXBean; } public void init() throws MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException, MalformedObjectNameException { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); ObjectName objectName = new ObjectName("MineStar:type=UserJMXBeanExpose,name=Statistics"); MineStarMBean impl = new MineStarMBean(); impl.addProperty(new PropertyAdapter("User", "User List", "java.lang.String") { public Object getValue() { if (userJMXBean == null) return 0; return userJMXBean.getUserAttributes(); } }); server.registerMBean(impl, objectName); } } And this code: public class UserJMXBeanImpl implements UserJMXBean { private List&lt;User&gt; userList = new ArrayList&lt;&gt;(); public void addUser(User user){ userList.add(user); } public List&lt;User&gt; getUserList() { return userList; } public void setUserList(List&lt;User&gt; userList) { this.userList = userList; } public String[] getUserAttributes(){ for(User user : this.getUserList()){ return new String[]{user.getUserId(),user.getRoles()}; } return null; } } How can I add a listener to JMX so that it updates the values of getUserAttributes() with the newly added user by UserJMXBeanImpl class? I need to update my jmx information when each new user is added to the impl class. Or how can we add listener so that it can notify the UserJMXBeanExpose to expose its data whenever a new user is added to impl class?
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/26231587
has answer: http://stackoverflow.com/a/26231783
tagged with: static
type: Question
has answer: http://stackoverflow.com/a/26231613
has answer: http://stackoverflow.com/a/26231630
has comment: http://stackoverflow.com/comment/41143550
has body: class A // Normal Class { static int i; // Static int variable int j; // Normal int variable } Suppose I create two objects namely A1, A2. Do both objects have separate memory allocated for the variable i or the common, Permgen space What would be the size of A1, A2? If suppose the size of int is assumed as 2 bytes.
tagged with: memory-management
has title: Static variable memory allocation
has answer: http://stackoverflow.com/a/26231765
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26231679
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41143358
has comment: http://stackoverflow.com/comment/41143260
linked to: http://stackoverflow.com/q/4640989

http://stackoverflow.com/a/26216118
accepted answer of: http://stackoverflow.com/q/26214041
answers question: http://stackoverflow.com/q/26214041
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41114098
downvote count: 0
has comment: http://stackoverflow.com/comment/41113863
has comment: http://stackoverflow.com/comment/41113950
score: 1
has comment: http://stackoverflow.com/comment/41114031
has body: You should use the most efficient primitive type for your cipher. So if you primarily use 64 bit instructions, please go for long. If you use primarity 32 bit instructions then int is probably the best type. I'll let you guess the types for 16 and 8 bit operations. Note that you should not present this interface directly to the outside world. Instead you should use an interface based on byte arrays (just like, e.g. Cipher). You don't want to confront your users with a ton of grief with regards to big endian, signed/unsigned etc. Besides that, ciphers are usually defined for messages of a specific size in bits or bytes. Certainly do not use BitSet. It's a horrible (unbounded) interface with many peculiarities. It is absolutely not fit for this kind of operations.
has comment: http://stackoverflow.com/comment/41113878

http://stackoverflow.com/comment/118243232
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26313288
score: 1
has text: With something like this, it is better to have an opt-in philosophy, vs a forced upon you one. But to the question, it (like all code bases) could have bugs in it (hopefully not). https://www.google.com/search?q=rewriteBatchedStatements+bug+site:bugs.mysql.com

http://stackoverflow.com/a/26349092
downvote count: 0
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26349006
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41359224
has comment: http://stackoverflow.com/comment/41359157
type: Answer
answers question: http://stackoverflow.com/q/26349006
has body: No, it's not bad, and I recommend you always do it on any class you'll reasonably extend over time. For example in our iOS projects we always start with a UIViewController subclass called ViewControllerBase that does nothing but extend Apple's base class (the same can be said for Activity on Android). When we need to add something in later that should apply to every view controller (analytics perhaps), it's easy to do. Fortunately, even if you have a lot of classes in your code it's easy to inject your custom base class with a simple search and replace across your codebase. Do be careful though as once you have a class that's in everything, small changes can of course have broad and possibly unexpected effects. Be sure to test thoroughly! EDIT: Regarding subclassing everything, I'd say no. You quickly reach a point of diminishing returns on your time and utility. A common view controller base is pretty standard, as for buttons and so on probably not so much. It depends entirely on what you want to do that you think might need custom functionality. If you want to log every user action, then maybe you do want to subclass every control, but in that case it might be better to just log touch events. At the end of the day though, are you really going to parse all the data that gets generated? Probably not. So make sure you have a solid use case before you go crazy subclassing.

http://stackoverflow.com/a/26197635
answers question: http://stackoverflow.com/q/26197411
has body: Some hypotheses: Broken Android SDK + tools installation. -- Can you open the Android SDK Manager and the emulator outside Eclipse? Consider reinstalling the SDK from scratch. Eclipse can't find the Android SDK + tools installation. -- Check the ADT preferences in Windows > Preferences > Android. See this screen shot. Broken ADT plug-in or its state. -- Try uninstalling ADT then reinstalling it. Broken Eclipse installation. -- Consider reinstalling it from scratch. This could be a good time to update to the latest Eclipse (Luna). Actually, this is a good time to try Android Studio. Right now your relative cost of switching is particularly low. Android Studio will take getting used to but it's slicker, does more work for you, and is the focus of Google's Android tool development. Android Studio is in beta testing but it's stable and usable. Do watch the video What's new in Android development tools from Google I/O 2014. See Google's notes on Troubleshooting ADT Installation. There are more tips for fixing the ADT installation, e.g. Eclipse Indigo Android ADT - install OK, no "Android" option in Preferences and New Project but you can rule out most of those ideas since it used to work for you. Maybe the fix on this Ubuntu forum post is relevant. There, an Ubuntu upgrade broke ADT because of the needed GEF plugin.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41080198
has comment: http://stackoverflow.com/comment/41080523
downvote count: 0
score: 1

http://stackoverflow.com/q/26320455
has comment: http://stackoverflow.com/comment/41306951
has comment: http://stackoverflow.com/comment/41306173
type: Question
linked to: http://stackoverflow.com/q/1062960
has title: Is there a way to specify extended class via generics?
has comment: http://stackoverflow.com/comment/41306218
has comment: http://stackoverflow.com/comment/41320864
score: 0
has body: I'm trying to build a container type called ListNamed, which is essentially a list, but one that allows element lookups by name, where multiple elements can have the same name, and in which case the lookup would return the first element found with a matching name (that's why I can't use a HashMap -> order matters, and keys are not-unique). My initial version, which works: public class ListNamed&lt;T extends Named&gt; extends ArrayList&lt;T&gt;{ public T get(String name){ for (T x: this){ if (x.getName().equals(name)){ return x; } } return null; } } However, there are cases where I would like to specify a different implementation of List - Instead of ArrayList, there are cases where I would like to use LinkedList. So, is there a way to specify the extended implementation via generics, or will I have to create separate classes (ArrayListNamed, LinkedListNamed)?
tagged with: generics
has comment: http://stackoverflow.com/comment/41306150
has comment: http://stackoverflow.com/comment/41307041
type: UnansweredQuestion
answer count: 0
tagged with: java

http://stackoverflow.com/comment/41081497
has text: @DavidWallace Well, as fine as `int a = 5; if (a == 5) { a = 5; }`. Valid but rather pointless.
type: Comment
comment on: http://stackoverflow.com/q/26198364
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41189094
has text: did you add the bluecove-gpl jar to your classpath ?
comment on: http://stackoverflow.com/q/26256473
type: Comment
type: QuestionComment
score: 1

contains
tags question: http://stackoverflow.com/q/26255862
tags question: http://stackoverflow.com/q/26196856
tags question: http://stackoverflow.com/q/26329571
tag name: contains
tags question: http://stackoverflow.com/q/26345075
type: Tag
tags question: http://stackoverflow.com/q/26246086
tags question: http://stackoverflow.com/q/26329746
tags question: http://stackoverflow.com/q/26288122

http://stackoverflow.com/q/26294834
has comment: http://stackoverflow.com/comment/41259694
accepted answer: http://stackoverflow.com/a/26300270
has comment: http://stackoverflow.com/comment/41260222
tagged with: nullpointerexception
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41263907
type: Question
has comment: http://stackoverflow.com/comment/41260110
tagged with: android
score: -2
has answer: http://stackoverflow.com/a/26300270
has body: I get the error java.lang.NullPointerException, and I have no clue what to do or how to fix it. I have 3 fragments creating up a tabhost, and inside fragment b there will be the list view of all the items. MainActivity import android.app.ActionBar; import android.app.FragmentTransaction; import android.content.Context; import android.content.res.Resources; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; import tk.delacour.tabdemo.fragments.FragmentB; import tk.delacour.tabdemo.fragments.FragmentPageAdapter; public class MainActivity extends FragmentActivity implements ActionBar.TabListener { ActionBar actionBar; ViewPager viewPager; FragmentPageAdapter ft; private Bundle savedInstanceState; ListView listView; FragmentB baseAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewPager = (ViewPager) findViewById(R.id.pager); ft = new FragmentPageAdapter(getSupportFragmentManager()); viewPager.setAdapter(ft); actionBar = getActionBar(); assert actionBar != null; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.addTab(actionBar.newTab().setText("Home").setTabListener(this)); actionBar.addTab(actionBar.newTab().setText("Shop").setTabListener(this)); actionBar.addTab(actionBar.newTab().setText("Contact").setTabListener(this)); listView = (ListView) findViewById(R.id.itemListView); listView.setAdapter(new Adapter(this)); //Error Here..... viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i2) { } @Override public void onPageSelected(int i) { actionBar.setSelectedNa…
has comment: http://stackoverflow.com/comment/41259286
has comment: http://stackoverflow.com/comment/41293364
tagged with: android-fragments
tagged with: java
downvote count: 2
has title: Android Linking adapter crashing ERROR : java.lang.NullPointerException
answer count: 1

http://stackoverflow.com/a/26244588
accepted answer of: http://stackoverflow.com/q/26244512
answers question: http://stackoverflow.com/q/26244512
has comment: http://stackoverflow.com/comment/49538894
has comment: http://stackoverflow.com/comment/49538117
score: 30
has comment: http://stackoverflow.com/comment/132490046
has comment: http://stackoverflow.com/comment/124636251
has comment: http://stackoverflow.com/comment/49538944
has body: The android.provider.Settings.Secure.ANDROID_ID is a constant that can be used in android.provider.Settings.Secure.getString(ContentResolver resolver, String name). By default it is set to 'android_id' since that's the name of the property containing the actual Android ID. Use this code to get the actual id: String androidId = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);
type: AcceptedAnswer
downvote count: 0
upvote count: 30
type: Answer
has comment: http://stackoverflow.com/comment/49539036

http://stackoverflow.com/comment/136578612
has text: No it doesn't. It means no Excel to bridge *to.* You could still bridge to other COM components if they're installed.
comment on: http://stackoverflow.com/a/73000549
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/26306229
score: 4
has comment: http://stackoverflow.com/comment/47846379
has comment: http://stackoverflow.com/comment/41280783
has comment: http://stackoverflow.com/comment/123410050
type: Answer
answers question: http://stackoverflow.com/q/26306135
upvote count: 4
has body: as Braj mentioned you can try reader.toCharArray() and to then you can easily use the loop char[] array = reader.toCharArray(); for (char ch : array) { System.out.println (ch); }
downvote count: 0

http://stackoverflow.com/comment/41363204
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26351456
has text: Please edit your answer with what exactly is going wrong with it (what you expect and what is actually happening). In the mean time, you need to pass two strings, one as a model string, and the other as a accumulator string. Right now you are resetting the accumulator every time.

http://stackoverflow.com/comment/41251081
type: QuestionComment
comment on: http://stackoverflow.com/q/26290005
has text: I didn't declare `A` or `B`. They are part of a library that I am using. I guess `A` constructs `B` during its construction stage.
score: 0
type: Comment

http://stackoverflow.com/comment/41166767
comment on: http://stackoverflow.com/a/26238975
has text: @blue-sky. I remember having a similar problem awhile back. I cannot remember how I solved it, I will do some digging for you tomorrow. However if I recall correctly it all changed when Akka added clustering, which I have not used in anger yet.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26330581
has title: Java RGB Manipulation with Bitmaps
tagged with: rgb
has body: This question may be a little confusing, but here we go! So, I watched Notch coding a game, and he did something interesting. He made a bitmap class, where he stored each pixel in an array. (int array). Then I got the idea of toying around with bitmaps myself, and then I got the idea of manipulation/changing the R, G and B of the bitmap. So, the way I tried to do it was like this: int rmod = 100; int gmod = 100; int bmod = 100; for (int i = 0; i &lt; 64*64; i++) { int color = testBitmap.pixels[i]; int r = color &gt;&gt; 16; int g = color &gt;&gt; 8; int b = color; r = (r/100)*rmod; g = (g/100)*gmod; b = (b/100)*bmod; testBitmap.pixels[i] = r+b+g; } So yeah, the idea is that rmod, gmod and bmod works like the % of R G B. So, when they are all at 100, the bitmap is displayed normally is the idea. And then, say, if you change rmod to 150, the R will be 50% "stronger". Now, I know that I'm doing some things wrong here. I think that int r, g and b is correct. (even though I don't really understand what ">>" do. I know that it shifts bytes or something, but I don't really get it.) After getting the r g and b, I then get 1% of them, and multiply them with the percent declared in rmod, gmod and bmod. Then, I believe I'm doing something totally wrong at the line where I set the new RGB of the current pixel. (testBitmap.pixels[i] = r+g+b;) Not really sure how to do this. If anyone could try to explain how the ">>" works and, why it works in this situation, and also how to be able to manipulate the RGB via rmod, gmod and bmod, I would be so happy! It may be that I have provided too little info, so if you need to see the classes etc, I can post them here too! Thank you!
type: Question
score: 0
answer count: 1
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26330723
tagged with: colors
has answer: http://stackoverflow.com/a/26330723
tagged with: bitmap
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26253784
has comment: http://stackoverflow.com/comment/41184854
has comment: http://stackoverflow.com/comment/41184380
upvote count: 3
has comment: http://stackoverflow.com/comment/41184587
has comment: http://stackoverflow.com/comment/41365059
score: 3
has comment: http://stackoverflow.com/comment/41342194
has comment: http://stackoverflow.com/comment/41185241
has comment: http://stackoverflow.com/comment/41185103
type: AcceptedAnswer
downvote count: 0
has body: I was able to achieve that with the following &lt;style type="text/css"&gt;&lt;%@ include file="/css/bootstrap.css" %&gt; &lt;/style&gt; where bootstrap.css was my css file and the folder structure was similar. Try that once.
accepted answer of: http://stackoverflow.com/q/26253643
has comment: http://stackoverflow.com/comment/41184774
answers question: http://stackoverflow.com/q/26253643
type: Answer

http://stackoverflow.com/comment/41151999
comment on: http://stackoverflow.com/a/26236313
has text: `return (top == 0) && (top == -1);` always yields false; `||` would be wrong too: a "hack" repair.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41470212
comment on: http://stackoverflow.com/a/26333874
type: AnswerComment
type: Comment
has text: now I get a different error. I just tried implementing what you had provided. I will write up a new question if you have a chance to look at it and link it here.
score: 0

http://stackoverflow.com/comment/41089205
type: QuestionComment
has text: The code is precisely as "safe" or "unsafe" as you make it. It can be written to be totally paranoid, totally unchecked, or can contain some basic checks to catch most usage errors. That's up to you.
comment on: http://stackoverflow.com/q/26202756
score: 0
type: Comment

http://stackoverflow.com/comment/41104388
comment on: http://stackoverflow.com/q/26210641
type: QuestionComment
has text: I would worry less about missed instructions, and more about correctness if I were you. Your test will succeed whether or not a NullPointerException is thrown. That said, you didn't even posted the code under test, so how could we know which instructions could be missed?
score: 0
type: Comment

http://stackoverflow.com/a/26247999
score: 1
has body: Your = comparison is wrong. If you want to make sure two strings have the same value, you need to use the String equals method. '=' is an assignment operator if (a=b) {} doesn't compile, and '==' checks if two variables are pointing to the same thing. if (a==b) {} won't always succeed (see example below). The String equals method always looks at the actual value represented by a String. String a = "1"; String b = "12".substring(0,1); a == b // false a.equals(b) // true Now with that out of the way - there are lots of ways you can get the exit condition. If you want to do it all in one statement, you can change i&lt;=3 in your while condition i++ &lt;= 3. My preference is to separate the two conditions like this do { ... if (password.equals(password2)) { break; } } while (i++ &lt;= 3);
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26247375
type: Answer
answers question: http://stackoverflow.com/q/26247375
downvote count: 0

http://stackoverflow.com/comment/41304688
comment on: http://stackoverflow.com/a/26315229
type: AnswerComment
has text: Thanks for the response. My bad I should have mentioned I need this for oauth 1.0. But the sample code is using oauth 2 :(
score: 0
type: Comment

http://stackoverflow.com/a/26381999
answers question: http://stackoverflow.com/q/26353521
type: Answer
score: 0
has body: I have used different approach. I am adding my text to array and draw it all over again when new item added to list. } else if (property == DRAW) { if (property == DRAW) { myTekstItem = new Tekst(_SetText, _SetTextBold, _SetTextItalic, _SetX, _SetY, _SetColor, _SetSize); int i = 0; if (TekstList.size() &gt; 0) { for (Tekst TekstObj : TekstList) { if (TekstObj.Tekst == _SetText &amp;&amp; TekstObj.X == _SetX &amp;&amp; TekstObj.Y == _SetY &amp;&amp; TekstObj.Color == _SetColor &amp;&amp; TekstObj.Size == _SetSize) { i++; } } } if (i == 0) { TekstList.add(myTekstItem); } this.repaint(); _SetTextBold = false; _SetTextItalic = false; } public void paint(Graphics g) { if (g instanceof Graphics2D) { try { Graphics2D g2 = (Graphics2D) g; for (Tekst TekstObj : TekstList) { SetText(g2, TekstObj.Tekst, TekstObj.Bold, TekstObj.Italic, TekstObj.X, TekstObj.Y, TekstObj.Color, TekstObj.Size); } } catch (Exception ex) { System.err.println(ex.getMessage()); } } } private void SetText(Graphics2D g, String pText, boolean pBold, boolean pItalic, int pX, int pY, String pColor, int pSize) { if (pText != null) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Font FontNew; if (pSize &gt; 0) { FontNew = font.deriveFont(Font.PLAIN, pSize); } else { FontNew = font.deriveFont(Font.PLAIN, 26); } if (pBold) { FontNew = font.deriveFont(Font.BOLD, FontNew.getSize()); } if (pItalic) { FontNew = font.deriveFont(Font.ITALIC, FontNew.getSize()); } if (pBold == false &amp;&amp; pItalic == false) { FontNew = font.deriveFont(Font.PLAIN, FontNew.getSize()); } if (pColor != null) { String[] TitleColorArr = getRGB(_SetColor); Color TitleColor = new Color(Integer.parseInt(TitleColorArr[0]), Integer.parseInt(TitleColorArr[1]), Integer.parseInt(TitleColorArr[2])); g.setColor(TitleColor); } g.setFont(FontNew); g.drawString(pText, pX, pY); } }

http://stackoverflow.com/a/26339300
type: Answer
answers question: http://stackoverflow.com/q/26339217
upvote count: 1
has body: Try adding &lt;beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="annotated"&gt; in beans.xml file
downvote count: 1
score: 0

http://stackoverflow.com/comment/41276786
score: 0
comment on: http://stackoverflow.com/q/26304224
type: QuestionComment
type: Comment
has text: Why does XPath not help?

http://stackoverflow.com/comment/41305493
has text: Ah, ok. I added the sum=0 to the beginning of the loop as you directed. Now what happens is after I enter the first students scores, it gives me the correct letter grade and message but then won't allow me to enter the next student's name (it jumps right to entering the next student's scores instead). Any idea why that happens?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26320101

http://stackoverflow.com/comment/41090157
type: Comment
type: QuestionComment
has text: I read about import static which helps me to write direct print.. but why is it not advisable to use import static..as a first time learner I am finding it difficult why not to use import static ?
comment on: http://stackoverflow.com/q/26203319
score: 0

http://stackoverflow.com/a/26234290
type: Answer
answers question: http://stackoverflow.com/q/26233948
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26233948
score: 1
has body: It's OK to return Response instead of actual entity, because the JSON it's converted to will be the same in both cases in the HTTP response, although in first case it is converted implicitly, while in 2nd you do it manually. So your snippet is correct, I believe.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26201466
has answer: http://stackoverflow.com/a/26618560
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/41086984
upvote count: 7
type: Question
downvote count: 0
answer count: 2
tagged with: shell
favorite count: 0
has body: I try to add a new custom command to the spring boot remote shell without success. In the documentation is only a groovy example available but I like to use Java do create a new command. http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-remote-shell.html I also check the CRaSH documentation: http://www.crashub.org/1.3/reference.html#_java_commands I put my class under package commands and crash.commands but I don't see my new command if I connect to the shell via ssh and type help. Any idea what I'm doing wrong? Here is my Java Code: package commands; import org.crsh.cli.Command; import org.crsh.cli.Usage; import org.crsh.command.BaseCommand; import org.springframework.stereotype.Component; @Component public class hello extends BaseCommand { @Command @Usage("Say Hello") public String test() { return "HELLO"; } }
type: UnansweredQuestion
has title: spring boot remote shell custom command
tagged with: spring
has answer: http://stackoverflow.com/a/29893250

http://stackoverflow.com/q/26235884
upvote count: 1
type: Question
has title: Execute the script in command line or in Rest client
has comment: http://stackoverflow.com/comment/45598065
has answer: http://stackoverflow.com/a/28648892
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26236230
type: UnansweredQuestion
tagged with: architecture
tagged with: python
tagged with: web-services
has body: I have a java web application that needs to make use of a python script. The web application will give the script a file as input and take some text as output. I have two options: Wrap the python script with HTTP and call it from the web application as a REST service Simply execute command line from the web application Which option should I take and why? This script won't be used by any other application.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41151137

http://stackoverflow.com/q/26270503
score: 1
has answer: http://stackoverflow.com/a/26270539
has comment: http://stackoverflow.com/comment/41215301
favorite count: 0
has title: Leap year boolean/get days in this month int (28 - 31)
accepted answer: http://stackoverflow.com/a/26270542
has comment: http://stackoverflow.com/comment/41218242
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41215101
has body: public static boolean isLeapYear(int year) { if ((year % 4) != 0) return false; else if ((year % 400) == 0) return true; else if ((year % 100) == 0) return false; else return true; } public int getDaysInThisMonth() { if (month == APRIL || month == JUNE || month == SEPTEMBER || month == NOVEMBER) return 30; else if (month == FEBRUARY || isLeapYear == false) return 28; if (isLeapYear == true) return 29; else return 31; } SEPTEMBER-DECEMBER are all defined as constants 1-12, working as intended. My problem here is that I'm getting error codes when trying to compile. symbol: variable isLeapYear location: class Date Date.java:68: error: cannot find symbol if (isLeapYear == true) ^ symbol: variable isLeapYear location: class Date 2 errors So why can't it find isLeapYear when it's directly above it? All of the code above the stuff I've posted works as intended.
upvote count: 1
has comment: http://stackoverflow.com/comment/41215619
type: Question
has comment: http://stackoverflow.com/comment/41215093
has answer: http://stackoverflow.com/a/26270542
tagged with: boolean
answer count: 2
possible better answer: http://stackoverflow.com/a/26270539
downvote count: 0

http://stackoverflow.com/q/26305288
tagged with: java
has title: Creating a WebService in Java with JCO3
tagged with: eclipse
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26320186
has body: Hi people im trying to implement a webService in java wich uses JCO3 library. i have exported as a WAR into webapps FOLDER on a server, but when i try tu run on a Server(Tomcat 7) on windows 7 32 bits. It's a web dynamic project. And i use a sap library called (sapjco3.jar, this jar brings a sapjco3.dll). and also a json-simple-1.1.1.jar. appears the nexts error: INFORMACIÓN: Starting Servlet Engine: Apache Tomcat/7.0.56 oct 10, 2014 2:30:34 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized INFORMACIÓN: WSSERVLET12: JAX-WS context listener initializing oct 10, 2014 2:30:34 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized GRAVE: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoClassDefFoundError: com/sap/conn/jco/AbapException java.lang.NoClassDefFoundError: com/sap/conn/jco/AbapException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.getImplementorClass(DeploymentDescriptorParser.java:528) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:207) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:133) at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:97) 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$StartChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.…
tagged with: tomcat7
tagged with: web-services
tagged with: jco
type: Question

http://stackoverflow.com/comment/41356152
type: QuestionComment
comment on: http://stackoverflow.com/q/26347361
has text: I'm thinking that this may be a Java/video card issue.
score: 0
type: Comment

http://stackoverflow.com/comment/41843587
comment on: http://stackoverflow.com/a/26244663
score: 0
type: AnswerComment
has text: sorry about not marking correct initially, I am not familiar with this site. I rectified that for you!
type: Comment

http://stackoverflow.com/comment/41240702
has text: I'm trying to create a list then store to the array CM then clear the list and reuse it again in the loop.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26284445

http://stackoverflow.com/a/26346346
type: Answer
has body: The n in your case is a null, since you're getting the value from the user. So it won't create the array as a finite array. They're all nulls. Try to initialize the number first from the user and then initialize the array.
score: 0
answers question: http://stackoverflow.com/q/26346305

http://stackoverflow.com/comment/41171493
type: AnswerComment
comment on: http://stackoverflow.com/a/26246350
score: 0
type: Comment
has text: @GravityCheck then the center of the circle is null or the circle you are passing to the method itself is null. Use a debugger to figure out why it is null.

http://stackoverflow.com/comment/65689644
has text: @BillK: If you know each map has exactly one entry, then that's a different question really, and one that makes more sense.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26230225

http://stackoverflow.com/comment/41269988
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26290839
has text: I also highly recommend you to use sqlite database, but its your call.
score: 0

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/26214751
type: Tag

http://stackoverflow.com/a/26254559
accepted answer of: http://stackoverflow.com/q/26254464
has body: It's because converting a number from int to short may fail (overflow) as it's a narrowing primitive conversion. In theory the compiler could recognise that the argument is a constant expression and it could determine whether the conversion is valid at compile time. But it doesn't. A cleaner way is: Short s = 42; //autoboxing is done here assertEquals(obj.getValue(), s ); The reason the above works is that the rules for variable assignment are different. Here the compiler does indeed check whether the constant expression can be converted to short without overflow. In addition, if the expression is a constant expression (§15.28) of type byte, short, char, or int: A narrowing primitive conversion may be used if the type of the variable is byte, short, or char, and the value of the constant expression is representable in the type of the variable. A narrowing primitive conversion followed by a boxing conversion may be used if the type of the variable is: Byte and the value of the constant expression is representable in the type byte. Short and the value of the constant expression is representable in the type short. Character and the value of the constant expression is representable in the type char. The case in bold applies here.
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/26254464
score: 8

http://stackoverflow.com/comment/41175752
has text: Because my object extends another object in which the equals() method is more complex than the default equals().
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26248807

http://stackoverflow.com/q/26267881
favorite count: 0
has body: I am working on a program that needs to import a jar that has classes both in the default package (root of the jar) and in packages. So far I have this code and it works so i can import the ones in default but it fails when trying to import ones on packages. import sys import os sys.path.append(os.getcwd() + "/versions/1.7.2.jar") If I run import a (a is a class as this is a Obfuscated jar.) it imports but if I run import net.minecraft.server.MinecraftServer it does not work it says No Module named net. Which I know the class and all packages around it is there so any help?
has answer: http://stackoverflow.com/a/47090867
has title: Can't Import packaged class files from a jar in jython when it contains classes in the default package
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
answer count: 1
tagged with: jython-2.7

http://stackoverflow.com/q/26315922
has comment: http://stackoverflow.com/comment/41299217
tagged with: java
has title: My custom listview scrolls back to first element instantly when scrolling up. How to prevent that and make a smooth scrolling
has comment: http://stackoverflow.com/comment/41298336
has comment: http://stackoverflow.com/comment/41298728
type: Question
tagged with: listview
has comment: http://stackoverflow.com/comment/41298745
score: 0
answer count: 1
tagged with: user-interface
tagged with: adapter
has answer: http://stackoverflow.com/a/26316526
type: UnansweredQuestion
has body: I am trying to create a custom listview like this: https://i.sstatic.net/l8ZOc.png Currently I managed to create it but there is a problem. For example when there are 8 items, it loads the first 4, then loads the remiaining items as you scroll down. When scrolling down, it works fine. However, when scrolling back up from bottom, at the middle of list, it instantly moves to top, skipping 2-3-4. items. Then you can scroll down normally again, but when scrolling up, it instantly goes to top of the list. How can i prevent this from happening? Here is my code: public class MyActivity extends Activity implements AdapterView.OnItemClickListener { String headers[]; String image_urls[]; List&lt;MyMenuItem&gt; menuItems; ListView mylistview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); menuItems = new ArrayList&lt;MyMenuItem&gt;(); headers = getResources().getStringArray(R.array.header_names); image_urls = getResources().getStringArray(R.array.image_urls); for (int i = 0; i &lt; headers.length; i++) { MyMenuItem item = new MyMenuItem(headers[i], image_urls[i]); menuItems.add(item); } mylistview = (ListView) findViewById(R.id.list); MenuAdapter adapter = new MenuAdapter(this, menuItems); mylistview.setAdapter(adapter); mylistview.setOnItemClickListener(this); } } public class MyMenuItem { private String item_header; private String item_image_url; public MyMenuItem(String item_header, String item_image_url){ this.item_header=item_header; this.item_image_url=item_image_url; } public String getItem_header(){ return item_header; } public void setItem_header(String item_header){ this.item_header=item_header; } public String getItem_image_url(){ return item_image_url; } public void setItem_image_url(String item_image_url){ this.item_image_url=item_image_url; } } public class MenuAdapter extends BaseAdapter{ Context context; List&lt;MyMenuItem&gt; menuItems; MenuAdapter(Context context, List&l…
tagged with: android

http://stackoverflow.com/comment/41177362
has text: You are mixing spring versions... DOn't. YOu are mixing jars from 2.0.8, 4.0.6 and 4.1.0. Remove all the non 4.1.0 jars or make sure that you use the 4.1.0 equivalent of those.
comment on: http://stackoverflow.com/q/26244219
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41242340
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26285287
type: AnswerComment
has text: I use CountDownTimer, but it didn't work if my was app minimize. But it work if my app finished. And onResum didn't work for me.

http://stackoverflow.com/a/26320639
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41307020
has comment: http://stackoverflow.com/comment/41307068
accepted answer of: http://stackoverflow.com/q/26320490
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26320490
has body: It sounds like you are trying to decide between Spring AOP and AspectJ, but you're assuming that Spring AOP requires XML-based configuration. It doesn't. You can use AspectJ annotations for both Spring AOP and AspectJ: package com.example.app; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.beans.factory.annotation.Autowired; @Aspect public class NotificationAspect { @Autowired private NotificationGateway notificationGateway; @Pointcut("execution(* com.example.app.ItemDeleter.delete(com.example.app.Item))") private void deleteItemOps() { } @AfterReturning(pointcut = "deleteItemOps() &amp;&amp; args(item)") public void notifyDelete(Item item) { notificationGateway.notify(item, ConfigManagementEvent.OP_DELETE); } } So if you're trying to compare Spring AOP and AspectJ, it's more sensible to compare AspectJ to annotation-based Spring AOP. Spring AOP is generally simpler (you don't need the AspectJ compiler); hence the reference docs recommend Spring AOP over AspectJ unless you need more exotic pointcuts. UPDATE: Responding to the OP's comment below, we can use XML configuration to advise specific methods: &lt;aop:config&gt; &lt;aop:pointcut id="deleteItemOps" expression="execution(* com.example.app.ItemDeleter.delete(com.example.app.Item))" /&gt; &lt;aop:advisor advice-ref="notificationAdvice" pointcut-ref="deleteItemOps() &amp;&amp; args(item)" /&gt; &lt;/aop:config&gt; If you want to embed the pointcut right in the &lt;aop:advisor&gt;, you can do that too: &lt;aop:config&gt; &lt;aop:advisor advice-ref="notificationAdvice" pointcut="execution(* com.example.app.ItemDeleter.delete(com.example.app.Item)) &amp;&amp; args(item)" /&gt; &lt;/aop:config&gt; (I haven't checked the &amp;&amp; args(item) part of the XML configuration, but I think that's OK for the example I gave. If it doesn't work, try removing it and feel free to edit the answer accordingly.)
has comment: http://stackoverflow.com/comment/41306871
has comment: http://stackoverflow.com/comment/41306764

http://stackoverflow.com/a/26312730
has body: Here is what I tried String patt = ".*?SUM\\s+.*?"; Pattern regex = Pattern.compile(patt); String[] test = {"THE SUM OF TWO", "HOT SUMMER", "SUM IN SUMMER"}; for (String s: test) { if(regex.matcher(s).matches()){ System.out.println(true); } else { System.out.println(false); } } Output: true false true
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26312576

http://stackoverflow.com/comment/41335987
type: AnswerComment
comment on: http://stackoverflow.com/a/26336431
score: 0
type: Comment
has text: @bugybunny Thank you! All I needed :) @Trengot I check if file exists with `if(new File(path).exists()){}`

http://stackoverflow.com/q/26323930
tagged with: dependency-injection
accepted answer: http://stackoverflow.com/a/26324980
tagged with: java
has body: I want to use a DI framework (e.g. Spring or GUICE) do I have to wrap any Service-object with an interface in order to DI framework to work? When I write UT, can I combine a mocking framework with it (e.g. mockito)? Are there any things I should pay attention to when combining mock FW and DI FW ? I'm a bit confused because the DI FW is meant also to change the implementation from PROD to fake one. No?
has title: how to combine mock and DI in java?
tagged with: mocking
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26324980
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/41312722

http://stackoverflow.com/comment/41301525
score: 0
type: QuestionComment
has text: It sounds like you don't have write permissions in the relevant place.
type: Comment
comment on: http://stackoverflow.com/q/26317936

http://stackoverflow.com/a/26230510
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: What you've got there is an instance initializer, as described by section 8.6 of the JLS. It's executed before the body of any constructor when an instance is created - just like field initializers.
accepted answer of: http://stackoverflow.com/q/26230456
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/26230456

http://stackoverflow.com/comment/41270660
has text: I was trying to stay away from JList because of how I wanted to present the list, but after some consideration I'm going to change it over to a JList. Thanks for the quick responses!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26288671

http://stackoverflow.com/comment/41327655
has text: Where is the image stored (relative to your project)? What path did you supply `ImageIO.read`?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26331843

http://stackoverflow.com/a/26266667
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/41208380
has body: You can do it in O(n) like this. Map&lt;Long, Set&lt;MyObject&gt;&gt; keyToObjectMap = new HashMap&lt;&gt;(); for (MyObject o : objects) { Set&lt;MyObject&gt; set = ketToObjectMap.get(o.getKey()); if (set == null) keyToObjectMap.put(o.getKey(), set = new HashSet&lt;&gt;()); set.add(o); } In Java 8 you can do Map&lt;Long, Set&lt;MyObject&gt;&gt; map = objects.stream() .collect(Collectors.groupingBy(MyObject::getKey, Collectors.toSet()));
has comment: http://stackoverflow.com/comment/41208338
has comment: http://stackoverflow.com/comment/41212567
answers question: http://stackoverflow.com/q/26266431
upvote count: 4
has comment: http://stackoverflow.com/comment/41208374
downvote count: 0

http://stackoverflow.com/a/29969278
has body: You can log the request/response before and after convertion to/from objects. This is not as trivial as you might expect, the key is to implement some interface like so: public class PrettyPrinterLoggingFilter implements ContainerRequestFilter, ContainerResponseFilter, WriterInterceptor { .. } and plug into the existing infrastructure. I've written a small library that does this, for a working example.
answers question: http://stackoverflow.com/q/26250443
score: 0
type: Answer

http://stackoverflow.com/q/26316622
type: Question
type: AnsweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/26316733
score: 0
has comment: http://stackoverflow.com/comment/41299291
answer count: 1
accepted answer: http://stackoverflow.com/a/26316733
tagged with: android
has body: I need to pass this to my Android app so I will get null pointer stacktraces: -XX:-OmitStackTraceInFastThrow (From other stackoverflow question) This guide shows how to do it, BUT the arguments tab is NOT there for an android app, only normal java apps: http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Flaunchers%2Farguments.htm So how do I do it for Android apps or should I do something completely different?
has title: How to pass JVM arguments in eclipse for Android programs?
tagged with: java

http://stackoverflow.com/comment/41245640
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26244878
type: AnswerComment
has text: For the median method; What if the arrays is a hash set? Will it ignore it and still run the method?

http://stackoverflow.com/q/26286698
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26286784
tagged with: string
tagged with: jlabel
possible better answer: http://stackoverflow.com/a/26286936
has body: I'm trying to populate a jLabel with text from a global String in NetBeans, but every time I try to print anything other than a String literal, it prints nothing. I've tried directly printing the String, and my most recent attempt used a get() method. Here's the code so far, I'm populating the label on line 73: public class ChatWindow extends javax.swing.JFrame { private Integer userID; private String otherPerson = ""; /** * Creates new form ChatWindow * @param id */ public ChatWindow(int id) { initComponents(); userID = id; otherPerson = userID.toString(); this.setVisible(true); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); otherPersonLabel = new javax.swing.JLabel(); menuBar = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); openMenuItem = new javax.swing.JMenuItem(); saveMenuItem = new javax.swing.JMenuItem(); saveAsMenuItem = new javax.swing.JMenuItem(); exitMenuItem = new javax.swing.JMenuItem(); editMenu = new javax.swing.JMenu(); cutMenuItem = new javax.swing.JMenuItem(); copyMenuItem = new javax.swing.JMenuItem(); pasteMenuItem = new javax.swing.JMenuItem(); deleteMenuItem = new javax.swing.JMenuItem(); helpMenu = new javax.swing.JMenu(); contentsMenuItem = new javax.swing.JMenuItem(); aboutMenuItem = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jTextArea1.setBackground(new java.awt.Color(248, 248, 248)); jTextArea1.setColumns(20); jTextArea1.setRows(5); jTextArea1.setText("ContactName: FloopyNoops\nYou: Yes, f…
has answer: http://stackoverflow.com/a/26286936
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26286784
has title: jLabel won't print from String
has comment: http://stackoverflow.com/comment/41245078
tagged with: swing
type: Question

http://stackoverflow.com/comment/41411856
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26361582
has text: Bingo! Spring service got Autowired but another issue occured. BroadcasterFactory cannot be autowired/inject this time. Error: No qualifying bean of type [org.atmosphere.cpr.BroadcasterFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}

http://stackoverflow.com/a/26239408
upvote count: 1
has comment: http://stackoverflow.com/comment/41158625
has comment: http://stackoverflow.com/comment/41159221
has body: Following on from my comment on your question - you can move your network code into an IntentService and simply start that from your BroadcastReceiver. All of the work in an IntentService is handled by a worker thread running the onHandleIntent(...) method so it's safe to do network tasks in there. The IntentService: public class MyIntentService extends IntentService { // You must have a parameter-less ctor for an IntentService public MyIntentService() { super("MyIntentService"); } public MyIntentService(String name) { super(name); } @Override protected void onHandleIntent(Intent intent) { // This method is run on a separate worker thread so it's // safe to put all of your network code here } } Copy everything you currently have in the BroadcastReceiver onReceive(...) method into the onHandleIntent(...) method of your IntentService and replace it with code to start the service as follows... public class TimeAlarm extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { Intent i = new Intent(context, MyIntentService.class); context.startService(i); } }
has comment: http://stackoverflow.com/comment/41158466
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41158072
has comment: http://stackoverflow.com/comment/41159753
has comment: http://stackoverflow.com/comment/41158092
type: Answer
has comment: http://stackoverflow.com/comment/41159321
accepted answer of: http://stackoverflow.com/q/26238354
has comment: http://stackoverflow.com/comment/41159267
score: 1
answers question: http://stackoverflow.com/q/26238354

http://stackoverflow.com/comment/41226899
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26277305
has text: There are essentially unlimited possibilities. Personally I'd approach it somewhat differently, because a car could *also* pull a trailer. See where I'm headed?

http://stackoverflow.com/comment/41146811
has text: @miki, Any other solution to resolve this??
type: QuestionComment
comment on: http://stackoverflow.com/q/26231324
score: 0
type: Comment

http://stackoverflow.com/q/26209456
has title: How to convert a String to a Date object for hours, minutes, and seconds
has comment: http://stackoverflow.com/comment/41101889
has body: I am trying to convert a user-inputted String into hours, minutes, and seconds stored inside a Date object. Some code was borrowed from StackOverflow that uses a SimpleDateFormat object to parse the user input, but when it tries I get a ParseException. System.out.println("Enter the start time of the event(hh:mm:ss): "); String input = sc.next(); SimpleDateFormat f = new SimpleDateFormat("kk-mm-ss"); Date start = new Date(); try { start = f.parse(input); } catch (ParseException e) { System.out.println("ERROR: Failed to parse start time."); e.printStackTrace(); } Exception java.text.ParseException: Unparseable date: "01:02:03" at java.text.DateFormat.parse(Unknown Source) at Main.createDialog(Main.java:78) at Main.displayMenu(Main.java:44) at Main.main(Main.java:26)
accepted answer: http://stackoverflow.com/a/26209476
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: date
type: Question
has comment: http://stackoverflow.com/comment/41101829
has comment: http://stackoverflow.com/comment/41101804
has comment: http://stackoverflow.com/comment/41101907
has answer: http://stackoverflow.com/a/26209476
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41101879
linked to: http://stackoverflow.com/q/6510724
score: 0

http://stackoverflow.com/a/26249525
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26249410
answers question: http://stackoverflow.com/q/26249410
has body: This is only possible in API 17 and later. Just use getRealMetrics(metrics) instead of calling getMetrics(). (Or you can call getRealSize(Point) if all you need is the size.) For an approach to use with earlier API levels, see this thread.
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26348835
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26350954
has body: I was developing an Android app and in one of the sections, I pass data using an Intent from a DatePicker dialog fragment back to the fragment that created it using getTargetFragment().onActivityResult(int targetRequestCode, int resultCode, Intent intent). I am adding three integers (date, month and year) extracted from the Calendar fragment to the intent being passed. And then I read this intent within the onActivityResult() method of the fragment that created it. Everything works as it should and all is fine and dandy and the world is a perfect place to live in. While I was trying to debug a silly error that I had made, I noticed something interesting. When I expand the content of the intent, I find that my data is in a bundle as expected. But I see that there is another object within the intent called android.util.ArrayMap with size 3. This size seems to correspond to the number of data that I put in the intent (I tested it by adding additional dummy parameters). when I expand the contents of the ArrayMap, I see that it throws a ClassNotFoundException. Why would it do this. The key type is String and the value type is Integer (I am putting an int but I don't think it matters as I added in String for key and value and it still threw the exception). I expanded the ArrayMap details but it did not seem to make sense. My questions are: Why is this ClassNotFoundException happening? What is the need for the ArrayMap in the first place?
score: 2
downvote count: 0
favorite count: 0
has title: ClassNotFoundException in android.util.ArrayMap inside Intent
type: Question
tagged with: android
tagged with: android-intent
upvote count: 2
tagged with: java

http://stackoverflow.com/a/26240454
downvote count: 0
answers question: http://stackoverflow.com/q/26240401
accepted answer of: http://stackoverflow.com/q/26240401
upvote count: 2
has comment: http://stackoverflow.com/comment/41159935
type: AcceptedAnswer
has body: You cannot split a single class into several different source files. Each source file in Java corresponds to exactly one class. (A class can contain its own inner classes, but that's an unnecessary distraction at your stage!) You can arrange things so that a member of one class is visible to members of other classes, by giving it the public or default access modifier. See In Java, difference between default, public, protected, and private
has comment: http://stackoverflow.com/comment/41159794
type: Answer
has comment: http://stackoverflow.com/comment/41159885
score: 2
has comment: http://stackoverflow.com/comment/41159726

http://stackoverflow.com/comment/41354504
type: QuestionComment
comment on: http://stackoverflow.com/q/26346284
score: 0
has text: @LouisWasserman Or create a separate class that contains the same functionality without the state (which is probably what you want to keep "private" in the first place). Using assertions and/or code coverage could also alleviate issues.
type: Comment

http://stackoverflow.com/comment/41302779
has text: The code you posted won't even compile, you need to use `Integer[]` instead of `int[]`
comment on: http://stackoverflow.com/q/26318691
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41309477
type: QuestionComment
comment on: http://stackoverflow.com/q/26318868
has text: it throws in "rs = statement.executeQuery(expession)" line
score: 0
type: Comment

http://stackoverflow.com/q/26325171
has answer: http://stackoverflow.com/a/26325908
accepted answer: http://stackoverflow.com/a/26325908
favorite count: 0
has body: I have Delete the node in circularly linked list in java . Deleting a Node in the beginning , middle and ending a node . How to sort out this problem public class Node { int element; Node next; } Now there is another class All Methods of add and display are working correctly in a circular list but my remove method is having problem public class MyLinkedList { Node head; void remove(int e){ Node tNode = head; Node pNode = head; if (head.element == e) while(tNode.next!=head) tNode.next=head.next.next; else { while (tNode != head &amp;&amp; tNode.element != e) { pNode=tNode.next; } if (tNode != head) pNode.next = tNode.next; } } }
has title: How To Delete A Node In Circular Linked List
has comment: http://stackoverflow.com/comment/41314945
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41314727
tagged with: java
downvote count: 2
type: Question
tagged with: circular-list
upvote count: 0
score: -2
answer count: 1

http://stackoverflow.com/q/26316674
answer count: 6
tagged with: string
has answer: http://stackoverflow.com/a/26316956
has answer: http://stackoverflow.com/a/26316721
has answer: http://stackoverflow.com/a/26316831
accepted answer: http://stackoverflow.com/a/26316727
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/26316749
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26316749
has body: I want to swap two letters in a string. For example, if input is W and H then all the occurrences of W in string should be replaced by H and all the occurrences of H should be replaced by W. String WelloHorld will become HelloWorld. I know how to replace single char: str = str.replace('W', 'H'); But I am not able to figure out how to swap characters.
score: 10
has title: Swap two letters in a string
upvote count: 10
has answer: http://stackoverflow.com/a/26316727
has answer: http://stackoverflow.com/a/26316843
type: Question
downvote count: 0

http://stackoverflow.com/a/26288443
type: Answer
answers question: http://stackoverflow.com/q/26288215
has body: Your leap year algorithm looks backwards. if (year is not divisible by 4) then (it is a common year) else if (year is not divisible by 100) then (it is a leap year) else if (year is not divisible by 400) then (it is a common year) else (it is a leap year) You may also want to cast to a double in your "if( fine > X)" statements , that way you aren't converting from double to int and risking round off errors.
score: 0

http://stackoverflow.com/a/26272261
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41256460
has comment: http://stackoverflow.com/comment/41249637
answers question: http://stackoverflow.com/q/26271379
has body: This is a rather interesting "This can not happen" scenario. From the comments I would guess that the code actually compiled has an error in the inner for-loop. You need to find which file you are actually compiling. Try adding random System.out.println("Got HERE!"); to your code and see if any of them are actually printed. Because the code you show should not be able to give that exception.

http://stackoverflow.com/a/26283382
type: Answer
accepted answer of: http://stackoverflow.com/q/26283239
answers question: http://stackoverflow.com/q/26283239
has body: You can use the doubleValue() method on both numbers and then compare the double values. If you need a higher precision for integers, you can implement this as sepcial case. If you have objects that are not an instance of Number (e.g. Object or String containing a "number"), then you should throw all your code away and start from scratch, honestly.
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/41349441
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26343583
has text: this solution allows me to avoid checking status for null (which status.equals("IN") could throw). thanks.
type: AnswerComment

http://stackoverflow.com/comment/41277466
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26300135
has text: It very important to have valid cert to sign applet and valid web site cert. Otherwise your customers will have lot of annoying warnings.
type: Comment

http://stackoverflow.com/comment/41165689
type: AnswerComment
has text: Thank you. That did work. I also just found this StringBuilder buffer = new StringBuilder(); String line; while ((line = inFromClient.readLine()) != null) { buffer.append(line); } System.out.println("buffer.toString = " + buffer.toString()); Which also works, however, the json message seems to have a lot of extra characters and seems to be mixed up. I am new at working with JSON. Maybe that is normal or I need double quotes around it. I am actually sending times and ip addresses and values. Do numbers require special formatting with JSON?
type: Comment
comment on: http://stackoverflow.com/a/26242991
score: 0

http://stackoverflow.com/comment/41140647
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26230042
score: 0
has text: Try using `fourth = first.concat(second).concat(third);`

border
tags question: http://stackoverflow.com/q/26297638
tag name: border
tags question: http://stackoverflow.com/q/26209549
tags question: http://stackoverflow.com/q/26270276
type: Tag

http://stackoverflow.com/comment/41228984
comment on: http://stackoverflow.com/q/26278453
score: 0
type: Comment
has text: instead of `paint` use `paintComponent` method, use `@Override` annotation.
type: QuestionComment

http://stackoverflow.com/comment/41181159
type: QuestionComment
comment on: http://stackoverflow.com/q/26252125
has text: Don't use Regex to parse HTML / XML.
score: 4
type: Comment

http://stackoverflow.com/a/26198289
has body: You can use HTML (I revised this to account for your two columns) (NOTE: you'd get a better result with a JScrollPane in a JFrame) try this: String[] numbers = SSPparagraphs.text().toString().split(" "); String[] numbers1 = SBPparagraphs.text().toString().split(" "); //generate table and column heads String formattedText = new String(" "); formattedText += " SSP SBP "; //populate table with data in two columns //will account for differing amounts of data between SBP and SSP int x = 0; while (x < numbers.length || x < numbers1.length) { formattedText += " "; if (x < numbers.length) { formattedText += numbers[x]; } else { formattedText += " "; } formattedText += " "; if (x < numbers1.length) { formattedText += numbers1[x]; } else { formattedText += " "; } formattedText += " "; x++; } formattedText += " ";
has comment: http://stackoverflow.com/comment/41087062
has comment: http://stackoverflow.com/comment/41472484
has comment: http://stackoverflow.com/comment/41091262
score: 1
has comment: http://stackoverflow.com/comment/41086542
upvote count: 1
has comment: http://stackoverflow.com/comment/41089610
has comment: http://stackoverflow.com/comment/41089774
has comment: http://stackoverflow.com/comment/41089746
has comment: http://stackoverflow.com/comment/41098337
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26197957
has comment: http://stackoverflow.com/comment/41098417
type: Answer
answers question: http://stackoverflow.com/q/26197957
has comment: http://stackoverflow.com/comment/41097766

http://stackoverflow.com/comment/41192685
type: AnswerComment
has text: btw shouldn't your IDE catch this kind of stuff ?
score: 0
comment on: http://stackoverflow.com/a/26253513
type: Comment

http://stackoverflow.com/comment/41225812
type: AnswerComment
type: Comment
has text: Thank you! I added a bunch of "read(string) and write(string)" methods to the socket, and added a file log capability but had to make sure the streams close properly when disconnected (also logging disconnect time too), but most importantly I needed this to embed a single StreamWriter and Reader per socket as discussed here: [link](http://stackoverflow.com/questions/26271145/is-it-safe-to-use-multiple-outputstream-for-the-same-socket/26272164#26272164)
comment on: http://stackoverflow.com/a/26275798
score: 0

http://stackoverflow.com/comment/41352793
type: AnswerComment
comment on: http://stackoverflow.com/a/26344914
type: Comment
has text: Sorry, but no. The problem seems to lie in checkPrizes(), As the code will run when no prizes are won.
score: 0

http://stackoverflow.com/a/26327055
has body: Believe you need a CallableStatement (which by the way is a subclass of PreparedStatement) and that you need to use 'registerOutParameter'. See if this example helps.
type: Answer
has comment: http://stackoverflow.com/comment/41318463
has comment: http://stackoverflow.com/comment/41318736
upvote count: 3
has comment: http://stackoverflow.com/comment/41318861
score: 3
has comment: http://stackoverflow.com/comment/41354200
answers question: http://stackoverflow.com/q/26326955
downvote count: 0
has comment: http://stackoverflow.com/comment/41354465

http://stackoverflow.com/comment/41340435
comment on: http://stackoverflow.com/q/26336205
score: 0
has text: Have you configured an AuthenticationManager?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26349364
type: UnansweredQuestion
has title: Java and OpenGL Hiding cube faces not seen
has comment: http://stackoverflow.com/comment/41359657
tagged with: opengl
tagged with: java
type: Question
score: 0
tagged with: 3d
has comment: http://stackoverflow.com/comment/41394880
has body: I have made a OpenGL 3D Render engine in Java that uses vbo's and such for optimization. Now I'm trying to take it further by hiding faces not seen by the user. I'm confused though, I have so far tried doing things like scan to see if blocks were adjacent. Then I decided whether to render or not. This is not working at all, the blocks don't even render now. Whats an efficient way of doing this, or does anyone know a good article to read up on?
has comment: http://stackoverflow.com/comment/41402001
answer count: 0

http://stackoverflow.com/q/26249493
has comment: http://stackoverflow.com/comment/41176868
tagged with: android-fragments
has title: Activity has been destroyed on fragmenttransaction.commit
tagged with: java
has comment: http://stackoverflow.com/comment/41176993
has body: My project structure is as follows: I have an activity calling a fragment. My goal is to be able to simply switch fragments from 1 to another. I created a new class to handle my Clicks which is displayed below. I successfully enter my 1 case because it appears in my logcat. My issue comes after when For some reason I cannot switch Fragments. The Fragment I am trying to switch to is chatbox. I am now trying to get the hang of fragments so any help will do. I can post my Activity class if necessary as well. Thank You. 10-08 00:43:43.706 32310-32310/com.layoutpractice E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.layoutpractice, PID: 32310 java.lang.IllegalStateException: Activity has been destroyed at android.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1347) at android.app.BackStackRecord.commitInternal(BackStackRecord.java:597) at android.app.BackStackRecord.commit(BackStackRecord.java:575) at com.layoutpractice.ClickityClickClick.addFragments(ClickityClickClick.java:43) at com.layoutpractice.ClickityClickClick.onClick(ClickityClickClick.java:33) at android.view.View.performClick(View.java:4456) at android.view.View$PerformClick.run(View.java:18482) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5097) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) Below is my onClickListener Class: /** * Created by Programmer 552 on 10/7/2014. */ public class ClickityClickClick implements View.OnClickListener { public static String DEBUG = "Debug"; private LetsPutInAChatBox activity = new LetsPutInAChatBox(); private ChatFragment chatty = new ChatFragment(); private int test; public ClickityClickClick(int test) { this.test = test; } @Override public void on…
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41210241
tagged with: android
tagged with: fragment
has comment: http://stackoverflow.com/comment/41179602
tagged with: commit
has comment: http://stackoverflow.com/comment/41176805
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41210206
has answer: http://stackoverflow.com/a/28334644

http://stackoverflow.com/a/26335855
score: 1
has body: the logger has level ERROR, it won't overwrite the appender's threshold. Log messages with &gt;= ERROR will be accepted by the logger, since you have defined level as ERROR. Then your logger has only one appender defined, with threshold fatal, which means the appender will handle logs with level &gt;=fatal. that's why error level logs won't be saved in your log file. when you changed the threshold &lt;= logger's level, all logs accepted by your logger will be handled by the appender. That's why it "worked" if you change the threshold into error.
type: Answer
answers question: http://stackoverflow.com/q/26335733
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26335733
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27521883
has body: So what nefo_x suggested is correct. You need to create a new Java project that will contain your Java class. Then import the Java package as you would a python module. But there are a few things to watch out for in eclipse to make it work. I list the whole process below: Your Java class (or classes) should not be in the default package. You need to create a new package and make/put your java class files there. Export the package as a jar file to some place on your computer. Add the jar file (located at some place on your computer) to your python path. Import the package by writing "import PackageName". The problem for me was that I had my java class in the default package. That does not work due to some naming issues. Anyhow, hope that this helps.
upvote count: 1
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26224975
answers question: http://stackoverflow.com/q/26224975
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26304268
type: Answer
has body: public static void main (String [] args) { Scanner kb = new Scanner(System.in); //Allows input from keyboard int iNum1; //Holds user input for number 1 int iNum2; //Holds user input for number 2 int iSelection; //Holds menu selection System.out.print("\nPlease enter the first integer: "); iNum1 = kb.nextInt(); System.out.print("\nPlease enter the second integer: "); iNum2 = kb.nextInt(); System.out.println("\n\t M E N U "); System.out.println("\n1&gt;Sum up two integers" + "\n2&gt;Find the difference of two integers" + "\n3&gt;Find the average of two integers" + "\n4&gt;Find the product of two integers" + "\n5&gt;Find the quotient of two integers"); iSelection = kb.nextInt(); doAction(iNum1,iNum2,iSelection); } private static void doAction(int iNum1, int iNum2, int iSelection) { switch (iSelection) { case 1: sumTwoNumbers(iNum1, iNum2); break; case 2: subTwoNumbers(iNum1, iNum2); break; case 3: avgTwoNumbers(iNum1, iNum2); break; case 4: multiTwoNumbers(iNum1, iNum2); break; case 5: divTwoNumbers(iNum1, iNum2); } } private static int sumTwoNumbers(int iNum1, int iNum2) { int iSum; //Holds sum of iNum1 and iNum2 iSum = iNum1 + iNum2; System.out.println(iSum); return iSum; //End sumTwoNumbers(int,int) } private static int subTwoNumbers(int iNum1, int iNum2) { int iSub; //Holds difference of iNum1 and iNum2 iSub = iNum1 - iNum2; System.out.println(iSub); return iSub; //End subTwoNumbers(int,int) } private static double avgTwoNumbers(int iNum1, int iNum2) { double dAvg; //Holds average of iNum1 and iNum2 dAvg = (iNum1 + iNum2) / 2; System.out.println(dAvg); return dAvg; //End avgTwoNumbers(int,int) } private static int multiTwoNumbers(int iNum1, int iNum2) { int iMulti; //Holds product of iNum1 and iNum2 iMulti = iNum1 * iNum2; System.out.println(iMulti); return iMulti; //End multiTwoNumbers(int,int) } private static int divTwoNumbers(int iNum1, int iNum2) { int iDiv; //Holds quotient of iNum1 and iNum2 iDiv = iNum1/iNum2; System.out.println(iDiv); return iDiv; //End di…
answers question: http://stackoverflow.com/q/26304185
has comment: http://stackoverflow.com/comment/41276960
has comment: http://stackoverflow.com/comment/41277695
score: 0

http://stackoverflow.com/comment/41119057
type: QuestionComment
comment on: http://stackoverflow.com/q/26218631
score: 1
has text: I think you are using the wrong class loader. System class loader won't (generally) see your web app classes, but only deals with core Java classes like java.lang.*, java.util.*, etc.
type: Comment

http://stackoverflow.com/q/26274244
type: Question
tagged with: weblogic
score: 0
has comment: http://stackoverflow.com/comment/41254645
has comment: http://stackoverflow.com/comment/41236151
answer count: 0
tagged with: weblogic-10.x
type: UnansweredQuestion
has title: Weblogic upgrade wizard - security provider
has body: I am upgrading weblogic 10.3.5 to 12.1.1, and to d so, I am using weblogic upgrade wizard. I started with upgrading security providers using command - java -classpath /localdata/weblogic/server/lib/weblogic.jar weblogic.Upgrade -type securityproviders But it displays "Upgrading old security providers to new 10.3 providers", while I am running it from weblogic 12.1.1 and want to upgrade to this version. Logs printed are : Calling Wizard framework for upgrade: args2: [-mode=gui, -file=wcf/plugin_gui_wizard.xml, -log=stdout, -p:plugin:plugin.executionPlan.file=weblogic/upgrade/upgradesecurityproviders/execplan.xml, -p:plugin:I18N_PLUGIN=weblogic/upgrade/i18n_upgrade, -p:plugin:TARGET_VERSION=12.1.1.0] I cross verified, on which version I am running upgrade wizard using java -classpath /localdata/weblogic/server/lib/weblogic.jar weblogic.version and it shows, WebLogic Server 12.1.1.0 Wed Dec 7 08:40:57 PST 2011 1445491 Snapshot is : And snapshot from doc provided by Oracle (where it shows 12.1 wizard) is : Note : If I proceed and select source directory as 10.3 mbeantypes and destination directory as 12.1 mbeantypes, wizard shows error as below for all jars (not showing all line) : Not upgrading commo.dtd because either this is an out-of-the-box Oracle security provider JAR or this security provider JAR is already upgraded or this is not a valid archive file (may not be a .jar). No security provider JARs have been upgraded. and similar for other jars too. Any idea what I would have missed? Am i following wrong approach?
tagged with: weblogic12c
tagged with: java

http://stackoverflow.com/comment/41331690
comment on: http://stackoverflow.com/a/26334232
type: AnswerComment
has text: OP wants to split by "Caused by" and "WARNING" substrings at once. Your solution splits the string by only "Caused by" substring.
type: Comment
score: 3

http://stackoverflow.com/q/26203191
score: 0
has comment: http://stackoverflow.com/comment/41120105
answer count: 1
tagged with: http://stackoverflow.com/tag/csv
tagged with: android
has answer: http://stackoverflow.com/a/26204245
accepted answer: http://stackoverflow.com/a/26204245
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41091108
tagged with: java
has title: parse huge csv for using as key and value
type: Question
has body: i have to parse a huge csv which contains 3 values per line. At first i get the csv of the assets folder and read it line by line. while ((line = reader.readLine()) != null) { String[] string = line.split(","); ... } Now i want to read the values effectually, to use them later. I need the first to values as a pair. Each pair pertains the last value in the same line. for example : 1,2,3 4,5,6 ... results: pair = [1,2]; pairValue = 3; ... but i need all values of the .csv to work with them later as pair and as single (for calculation) so which method is the best to work with this data? Maybe an &lt;ArrayList&gt; or a HashMap like Map &lt;String,String&gt; map = new HashMap&lt;String,String&gt;(); //add items map.put(pair,value); //get items String valueOfKeys =(String) map.get(pair); I hope one of you understand me and can help.
has comment: http://stackoverflow.com/comment/41093121

http://stackoverflow.com/q/26251199
downvote count: 0
tagged with: tomcat
favorite count: 0
tagged with: cdi
linked to: http://stackoverflow.com/q/31169422
tagged with: weld
score: 2
answer count: 0
upvote count: 2
has body: I am using Tomcat 7 + weld-servlet-2.2.3 and weld errors are occuring too frequently. Errors like: WELD-000335: Context is already active and WELD-000341 - Unable to load current conversations from the associated request are occuring intermittently. I am using three filters: org.jboss.weld.servlet.ConversationFilter and org.apache.catalina.filters.SetCharacterEncodingFilter. Please let me know how to resolve these errors with Tomcat.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/46247796
tagged with: java
type: Question
has title: Tomcat Weld error - WELD-000341 - Unable to load current conversations from the associated request

http://stackoverflow.com/q/26215096
tagged with: rmi
tagged with: java
has body: On server side, Route is the remote interface and i am binding 3 remote objects into one registry. Would this be possible to use? try { Route c = new Journey("Cork", "Dublin", "2:44"); Route g = new Journey("Galway", "Dublin", "2:44"); Route b = new Journey("Bray", "Dublin", "0:44"); Route stub1 = (Route) UnicastRemoteObject.exportObject(c,0); Route stub2 = (Route) UnicastRemoteObject.exportObject(g,0); Route stub3 = (Route) UnicastRemoteObject.exportObject(b,0); Registry registry = LocateRegistry.createRegistry(1109); registry.bind("Cork", stub1); registry.bind("Galway", stub2); registry.bind("Bray", stub3); System.out.println("Routes are registered."); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } Allow the client to book a journey. You should not be able to double book a reservation. This application should have a minimum of 3 journeys to choose from. Each journey should be allowed to have 3 bookings
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/41113595
downvote count: 5
has comment: http://stackoverflow.com/comment/41112121
answer count: 1
favorite count: 0
has title: JAVA RMI Can i register multiple remote objects into one registry with different name?
score: -3
has answer: http://stackoverflow.com/a/26230041
accepted answer: http://stackoverflow.com/a/26230041
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41112004

http://stackoverflow.com/comment/41169875
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26237233
score: 1
has text: @Mofe-hendyEjegi: that statement above alone is reason why you need to read up on OOPs. The **last** thing you should do is to make variables static in this situation. Do so, and your code becomes very difficult to test and extend.

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/26237444
tags question: http://stackoverflow.com/q/26263303
tags question: http://stackoverflow.com/q/26335025
tags question: http://stackoverflow.com/q/26262762
tags question: http://stackoverflow.com/q/26299965
tags question: http://stackoverflow.com/q/26343631
type: Tag
tags question: http://stackoverflow.com/q/26305917
tag name: pdf
tags question: http://stackoverflow.com/q/26301781
tags question: http://stackoverflow.com/q/26258313
tags question: http://stackoverflow.com/q/26256546
tags question: http://stackoverflow.com/q/26351052
tags question: http://stackoverflow.com/q/26256061
tags question: http://stackoverflow.com/q/26229838
tags question: http://stackoverflow.com/q/26308278

http://stackoverflow.com/a/26247367
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26247222
answers question: http://stackoverflow.com/q/26247222
has body: Try this regex: "\\("+ NB1 +","+ NB2 +",([^)]*)\\)" You need the quantifier (*) inside the capture group parentheses. Also, you want to match the decimal point, so you can't use \\d; you could use [\\d,] or what I suggest (everything up to the closing parentheses).

http://stackoverflow.com/comment/41218107
comment on: http://stackoverflow.com/q/26272084
type: QuestionComment
has text: What is the problem. Do you have an error or it does not do anything?
score: 0
type: Comment

http://stackoverflow.com/comment/41435786
type: AnswerComment
has text: All files are common. As you see, the difference is negligable, API is changed, but the implementation code could be completely the same. That is why I don't want to copy-paste files and support these versions separately, as I wrote in the question body from the very beginning.
comment on: http://stackoverflow.com/a/26385740
type: Comment
score: 0

http://stackoverflow.com/comment/41266054
has text: just returning the favour
type: AnswerComment
comment on: http://stackoverflow.com/a/26298378
type: Comment
score: 0

http://stackoverflow.com/comment/41109815
type: QuestionComment
comment on: http://stackoverflow.com/q/26211684
type: Comment
has text: Your right if you need to remove an item during iteration use the remove method of the map. Its must be overloaded to let the main cache know and to not fail itself.
score: 0

http://stackoverflow.com/comment/41232864
has text: Thanks for the quick reply.. I understand your arguments. What im trying to do is make the camera function as a module. What are my options for doing so ?
comment on: http://stackoverflow.com/a/26280117
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41191204
type: Comment
has text: I see. Careful with AsyncTask, since some of its processing methods run on a thread and its post-processing methods run on the calling thread. As always you are not allowed to pass Realm related objects among threads.
type: AnswerComment
comment on: http://stackoverflow.com/a/26256708
score: 0

http://stackoverflow.com/a/26344668
has body: Try calling from within the UI thread as so: public void setText(final String newText) { Platform.runLater(new Runnable() { @Override public void run() { btn.setText(newText); } }); } Anytime you want to make changes to an element of the UI, it must be done from within the UI thread. Platform.runLater(new Runnable()); will do just that. This prevents blocking, and other strange obscure UI-related bugs and exceptions from occurring. Hint: what you have read/seen with the Platform.runLater being called in the startup of the app, and on timers is usually a way to load most of the UI immediately, then fill in the other parts after a second or two (the timer) so that not to block at startup. But Platform.runLater is not only for startup, it's for any time you need to change/use/interact-with a UI element.
type: Answer
has comment: http://stackoverflow.com/comment/41351284
has comment: http://stackoverflow.com/comment/41351131
answers question: http://stackoverflow.com/q/26344172
score: 0
has comment: http://stackoverflow.com/comment/41351616

http://stackoverflow.com/q/26276179
score: 6
has answer: http://stackoverflow.com/a/26280178
answer count: 3
linked to: http://stackoverflow.com/q/24567553
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41225080
has title: Upload image in spring mvc
has body: I am using spring 4 and hibernate 4 to upload and retrieve image to and from database. I have converted multipart image into byte array and stored in database. My query is how to retrieve that image from database and display the byte array in jsp without storing it in local system.
has answer: http://stackoverflow.com/a/26279504
upvote count: 6
has comment: http://stackoverflow.com/comment/41225228
tagged with: spring-mvc
tagged with: model-view-controller
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26278032
linked to: http://stackoverflow.com/q/17384928
possible better answer: http://stackoverflow.com/a/26279504
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41225170
accepted answer: http://stackoverflow.com/a/26278032
type: Question
has comment: http://stackoverflow.com/comment/41224993
tagged with: jsp

http://stackoverflow.com/q/26234900
type: Question
has title: HQL order by case
has comment: http://stackoverflow.com/comment/41148901
has answer: http://stackoverflow.com/a/26236027
has body: I have a Entity : class User{ Long id; String group_name; User head; } I have to get ordered users in order : order by group_name, if user is head then first (head means than head.id = id). I make HQL Query : select u from User u order by u.group_name, case when u = head then 0 else 1; But it's not working; In result I would like to have : (group_name : user) g1 John (head) g1 James g1 Adam g2 Brian (head) g2 Martin How to make correct HQL query ?
score: 0
tagged with: java
tagged with: hibernate
answer count: 2
has answer: http://stackoverflow.com/a/26235053
tagged with: hql
has comment: http://stackoverflow.com/comment/41149232
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9262413
has comment: http://stackoverflow.com/comment/41225912

http://stackoverflow.com/q/26270881
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26271205
accepted answer: http://stackoverflow.com/a/26271205
has body: I have created a messaging app that can be set as the default SMS app in KitKat (Android 4.4). This app listens for and catches specific messages, then raises an event after receiving them. The problem is that messages I don't need to catch are not appearing in the native messaging app's inbox. How can I display those messages in the native messaging app on the device while having my app as the default?
score: 0
tagged with: android-4.4-kitkat
answer count: 1
favorite count: 0
tagged with: sms
tagged with: android
has title: Display received messages in the default SMS app and the native messaging app
upvote count: 1
linked to: http://stackoverflow.com/q/3757229
type: AnsweredQuestion

http://stackoverflow.com/a/26353643
answers question: http://stackoverflow.com/q/26353581
type: Answer
score: 2
upvote count: 2
has body: Download aspectjrt.jar and add it to your classpath.
downvote count: 0

http://stackoverflow.com/comment/41305282
comment on: http://stackoverflow.com/q/26319866
score: 0
type: Comment
type: QuestionComment
has text: @AndrewThompson I can't use any other technology (HTML5 Canvas, Flash etc) because they have too much limitations (for example I can't catch mouse and I can't use special keyboard shortcuts like Ctrl+R. Etc.

http://stackoverflow.com/comment/41300798
has text: I doubt that yourkit's categorization is arbitrary. They surely mean *something* with those distinctions.
type: Comment
comment on: http://stackoverflow.com/a/26254400
score: 0
type: AnswerComment

http://stackoverflow.com/q/26270960
has comment: http://stackoverflow.com/comment/41217518
accepted answer: http://stackoverflow.com/a/26293415
type: Question
possible better answer: http://stackoverflow.com/a/26282912
has comment: http://stackoverflow.com/comment/41237328
answer count: 2
tagged with: intellij-idea
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26293415
upvote count: 2
tagged with: multithreading
has title: JavaFX: Exception on thread is not logged to System output
has body: In my JavaFX 8 app, I have a thread that runs a loop and occasionally updates the UI. Somewhere in this thread, there's an exception causing me grief. Finding it wouldn't be a problem, except exceptions on worker threads don't seem to be logged to System output the same as those on the main program thread. What I mean is, when I run the program, if something breaks in main(), IntelliJ prints the exception message and a stack trace to the Run view (standard out, AFAIC). On the other hand, if something breaks in my thread, I don't get the same verbose output. In fact, most of the time, I don't get anything at all - just a mysteriously non-functioning program. Is there another step I need to take to capture errors in worker threads? Is my environment misconfigured? This makes debugging next to impossible - any help appreciated!
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26282912
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/41216126

http://stackoverflow.com/q/26232694
tagged with: eclipse
has title: How to post an SWT key event containing just a keyboard character (no modifiers)?
type: Question
answer count: 1
downvote count: 0
tagged with: events
tagged with: keyboard
favorite count: 0
type: UnansweredQuestion
tagged with: swt
has body: Is it possible to post a Key event which contains the character as it should be received by the focused widget? I want to make a simple pop-up keyboard which generates Key events and I would like to make the pop-up keyboard completely independent of the physical keyboard regarding key mapping. What I currently see is, that when I set the character to '(' without generating shift events, I get an '8' (I have a German keyboard where '(' is Shift+8). I assume that on a different keyboard the '(' will appear as something else again. Is there any way to by-pass the mapping? My current code: private void postKey(Key key) { if(shift) { Event ke = new Event(); ke.type = SWT.KeyDown; ke.keyCode = SWT.SHIFT; refWidget.getDisplay().post(ke); } Event ke = new Event(); ke.type = SWT.KeyDown; ke.character = shift ? key.shifted[0] : key.normal[0]; refWidget.getDisplay().post(ke); ke.type = SWT.KeyUp; refWidget.getDisplay().post(ke); if(shift) { Event ev = new Event(); ev.type = SWT.KeyUp; ev.keyCode = SWT.SHIFT; refWidget.getDisplay().post(ev); } }
has answer: http://stackoverflow.com/a/26234328
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/69044802
comment on: http://stackoverflow.com/a/29195815
score: 0
type: AnswerComment
type: Comment
has text: @SammyKumar I think java8 isn't listed because 8 is what you get by default when you just use `brew cask install java`

http://stackoverflow.com/q/26210109
tagged with: java
has title: running "mvn appfuse:gen" does nothing
has body: I'm Using Oracle db alongside the Appfuse ,but it does nothing when using command above (mvn appfuse:gen).for example, it's expected to generate a PersonDao/PersonDaoHibernate class in the dao folder if we use the command . but nothing's happened. Meanwhile, I'v visited the following Pages: http://static.appfuse.org/plugins/appfuse-maven-plugin/gen-model-mojo.html http://static.appfuse.org/plugins/appfuse-maven-plugin but couldn't reconstruct it's content in practice. Does anybody can show a tutorial that basically explain the details ,please (Say, from generating the pojos .. to jsp files)?
answer count: 1
score: 0
tagged with: appfuse
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/26221229
type: Question

project
tags question: http://stackoverflow.com/q/26199458
type: Tag
tags question: http://stackoverflow.com/q/26241218
tag name: project

http://stackoverflow.com/q/26255237
tagged with: spring
type: Question
tagged with: jakarta-ee
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/26256247
answer count: 1
score: 0
has title: Spring MVC Multiselect, selected values are not coming back when saving
has body: Can you see what is the reason why the selected values are not coming back when saved? JSP &lt;form:select class="multiselect" multiple="true" path="conversionPixels"&gt; &lt;form:options path="conversionPixels" items="${CONVERSION_PIXELS.getItems()}" itemValue="uniqueCode" itemLabel="displayName" /&gt; &lt;/form:select&gt; Controller class for MVC, showing the save method here @Controller public class EditController extends BaseController { @RequestMapping(method = RequestMethod.POST, value = "/edit/save.htm") public RedirectView save(@ModelAttribute("package") Package package, BindingResult bindingResult, RedirectAttributes redirectAttributes, HttpSession session) { if (!bindingResult.hasErrors()) { if(package.getConversionPixels()!=null){ for (Object o : package.getConversionPixels()) { logger.debug("*****************EditController Save other type "+o.getClass()); WadConversionPixels w= (WadConversionPixels)o; logger.debug("****************** w.getId()"+w.getId()); logger.debug("****************** w.getConversionPixel().getId()"+w.getConversionPixel().getId()); } } } else { ErrorMessageCollector errors = new BindValidateErrorCollector( bindingResult); MessageDisplayHelper.addDisplayMessagesToRedirect(errors, redirectAttributes); return new RedirectView("/edit/display.htm", true); } } @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new TextPropertyEditor()); binder.registerCustomEditor(CostMethodLookupItem.class, new LookupItemPropertyEditor(CostMethodLookupTableCode.COST_METHOD, lookupTableService)); //binder.registerCustomEditor(ConversionPixelsLookupItem.class, new LookupItemPropertyEditor(ConversionPixelsLookupTableCode.CONVERSION_PIXELS, lookupTableService)); //binder.registerCustomEditor(ConversionPixelsLookupItem.class, new LookupItemPropertyEditor(ConversionPixelLookupTableCode.CONVERSION_PIXEL, lookupTableService)); binder.setDisallowedFields(new String[] {"conversionPixels"}); binder.registerCustomEdit…
tagged with: jsp-tags
type: UnansweredQuestion

http://stackoverflow.com/q/26268530
has title: Understanding Piece of Java code
has body: While working with some code base, I am trying to understand piece of code so as can work and customize it , I am able to understand almost 90% of the code flow. Here is the overall flow Code is being used to generate 15 digit code (alphanumeric), first 3 digits are customer provided. Initially code is generating 16 digit alphanumeric number and storing it in the cache. Customer can generated any number of code by specifying quantity. all customer generated codes are being generated from the 16 digit number (point 2). All code generated have numbers/ alphabets from that 16 digit alphanumeric number. When some one try to use those codes, system is trying to validate if the provided code is valid or not. I am struck at the logic used to determine if the provided code is valid or not, here is that piece of code, I am generating 6 code as a sample, in this case alphanumeric code being generated and stored in the cache is initial-alphabet : M9W6K3TENDGSFAL4 Code generated based on initial-alphabet are myList=[123-MK93-ES6D-36F3, 123-MK93-EFTW-D3LG, 123-MK93-EALK-TGLD, 123-MK93-ELKK-DN6S, 123-MK93-E4D9-3A6T, 123-MK93-EMTW-LNME] protected int getVoucherNumber(String voucherCode){ int voucherNumberPos = voucherCode.length() - 12; String voucherNumberHex = voucherCode.substring(voucherNumberPos, voucherNumberPos + 6); int firstByte = getIntFromHexByte(voucherNumberHex.substring(0, 2), 0); int secondByte = getIntFromHexByte(voucherNumberHex.substring(2, 4), 1); int thirdByte = getIntFromHexByte(voucherNumberHex.substring(4, 6), 7); return firstByte &lt;&lt; 16 | secondByte &lt;&lt; 8 | thirdByte; } private int getIntFromHexByte(String value, int offset){ return (getIntFromHexNibble(value.charAt(0), offset) &lt;&lt; 4) + getIntFromHexNibble(value.charAt(1), offset + 4); } private int getIntFromHexNibble(char value, int offset){ int pos = getAlphabet().indexOf(value); if (pos == -1) {// nothing found} pos -= offset; while (pos &lt; 0) { pos += 16; } return pos % 16; } Here is t…
has answer: http://stackoverflow.com/a/26268531
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41211540
tagged with: java
accepted answer: http://stackoverflow.com/a/26268531
has comment: http://stackoverflow.com/comment/41212684
tagged with: logic
type: Question
type: AnsweredQuestion

imdb
tags question: http://stackoverflow.com/q/26284573
type: Tag
tag name: imdb

http://stackoverflow.com/q/26327826
has comment: http://stackoverflow.com/comment/41320223
linked to: http://stackoverflow.com/q/8354048
linked to: http://stackoverflow.com/q/19813760
score: 0
has comment: http://stackoverflow.com/comment/41319710
has comment: http://stackoverflow.com/comment/41320176
has comment: http://stackoverflow.com/comment/41320392
type: UnansweredQuestion
has body: I'm trying to read a text file into a one single string with the following code: try { Scanner input = new Scanner (new File ("data.txt")); while (input.hasNextLine()) { string += input.nextLine(); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } This works when the file is really small. My file is around 20 kB and it just doesn't read. I don't get any errors. What should I do? I need to read it into ONE string.
has comment: http://stackoverflow.com/comment/41321152
answer count: 0
has title: Read into a string (Java)
duplicate of: http://stackoverflow.com/q/19813760
tagged with: java
type: Question

http://stackoverflow.com/q/26332199
tagged with: topdown
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26356382
has body: I am writing a RPG game similar to the style of Pokemon (top down view). I am now working on the issue of collision detection. I am wanting to create the collision detection based on rectangles. The problem is that i am having difficulty drawing the rectangle around the animation that i have previously set. I have searched Google and YouTube for a answer/tutorial of how to handle this problem yet found nothing. Player.class public class Player { public Vector2 position; private float moveSpeed; private SpriteBatch batch; //animation public Animation an; private Texture tex; public TextureRegion currentFrame; private TextureRegion[][] frames; private float frameTime; public Player(Vector2 position){ this.position = position; moveSpeed = 5f; createPlayer(); } public void createPlayer(){ tex = new Texture("Sprites/image.png"); frames = TextureRegion.split(tex, tex.getWidth()/3, tex.getHeight()/4); an = new Animation(0.10f, frames[0]); } public void render(float delta){ handleInput(); frameTime += delta; currentFrame = an.getKeyFrame(frameTime, true); } public void handleInput(){ if(Gdx.input.isKeyPressed(Keys.UP)){ an = new Animation(0.10f, frames[3]); position.y += moveSpeed; } if(Gdx.input.isKeyPressed(Keys.DOWN)){ an = new Animation(0.10f, frames[0]); position.y -= moveSpeed; } if(Gdx.input.isKeyPressed(Keys.LEFT)){ an = new Animation(0.10f, frames[1]); position.x -= moveSpeed; } if(Gdx.input.isKeyPressed(Keys.RIGHT)){ an = new Animation(0.10f, frames[2]); position.x += moveSpeed; } if(!Gdx.input.isKeyPressed(Keys.ANY_KEY)){ an = new Animation(0.10f, frames[0]); } } public void dispose(){ batch.dispose(); } public float getX(){ return position.x; } public float getY(){ return position.y; } public int getWidth(){ return 32; } public int getHeight(){ return 32; } } WorldRenderer.class public class WorldRenderer { private OrthogonalTiledMapRenderer renderer; public OrthographicCamera camera; private Player player; //Tilemap private TiledMapTileLayer collision; private …
tagged with: collision
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26356382
type: Question
tagged with: libgdx
has title: libgdx animation inside of a rectangle - collison detection - rectangles

http://stackoverflow.com/comment/41169437
comment on: http://stackoverflow.com/a/26245103
type: Comment
has text: @JonSkeet Yes, I call toString() when I use `new String(pairs.getKey().toString());` But `pairs.getKey()` doesn't work without toString =(
type: AnswerComment
score: 0

http://stackoverflow.com/q/26301781
has comment: http://stackoverflow.com/comment/41272217
tagged with: servlets
type: Question
has title: response.sendRedirect from a servlet redirects to a pdf which should get downloaded
answer count: 1
has comment: http://stackoverflow.com/comment/41272216
has comment: http://stackoverflow.com/comment/41272920
has comment: http://stackoverflow.com/comment/41274953
upvote count: 1
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/41274193
accepted answer: http://stackoverflow.com/a/26301821
has body: Can you please help me 1)how to open the pdf in a new browser tab or window. (OR) 2) The pdf should get downloaded directly to the local system. This is the code i am using, response.reset(); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment;filename=\""+"zseriessection9.pdf"+"\""); response.sendRedirect(contextPath +"/zseriessection9.pdf");
favorite count: 0
has comment: http://stackoverflow.com/comment/41275970
has answer: http://stackoverflow.com/a/26301821
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

libgdx
tags question: http://stackoverflow.com/q/26332131
tags question: http://stackoverflow.com/q/26269141
tags question: http://stackoverflow.com/q/26229446
tags question: http://stackoverflow.com/q/26274121
tags question: http://stackoverflow.com/q/26196058
tags question: http://stackoverflow.com/q/26197002
tags question: http://stackoverflow.com/q/26195511
tags question: http://stackoverflow.com/q/26265997
tags question: http://stackoverflow.com/q/26291034
tags question: http://stackoverflow.com/q/26332199
tag name: libgdx
tags question: http://stackoverflow.com/q/26215729
tags question: http://stackoverflow.com/q/26292075
tags question: http://stackoverflow.com/q/26213792
tags question: http://stackoverflow.com/q/26262750
tags question: http://stackoverflow.com/q/26339601
tags question: http://stackoverflow.com/q/26205031
tags question: http://stackoverflow.com/q/26330445
tags question: http://stackoverflow.com/q/26319769
tags question: http://stackoverflow.com/q/26236689
tags question: http://stackoverflow.com/q/26348442
tags question: http://stackoverflow.com/q/26224806
tags question: http://stackoverflow.com/q/26202622
tags question: http://stackoverflow.com/q/26207370
tags question: http://stackoverflow.com/q/26238427
type: Tag
tags question: http://stackoverflow.com/q/26203545
tags question: http://stackoverflow.com/q/26270401
tags question: http://stackoverflow.com/q/26215493
tags question: http://stackoverflow.com/q/26197071
tags question: http://stackoverflow.com/q/26266092
tags question: http://stackoverflow.com/q/26248510
tags question: http://stackoverflow.com/q/26295200
tags question: http://stackoverflow.com/q/26288988
tags question: http://stackoverflow.com/q/26197443
tags question: http://stackoverflow.com/q/26241333
tags question: http://stackoverflow.com/q/26351888
tags question: http://stackoverflow.com/q/26308018
tags question: http://stackoverflow.com/q/26202253
tags question: http://stackoverflow.com/q/26335077
tags question: http://stackoverflow.com/q/26289852
tags question: http://stackoverflow.com/q/26212711
tags question: http://stackoverflow.com/q/26237351
tags question: http://stackoverflow.com/q/26329746
tags question: http://stackoverflow.com/q/26202716
tags question: http://stackoverflow.com/q/26237723
tags question: http://stackoverflow.com/q/26331179
tags question: http://stackoverflow.com/q/26341948
tags question: http://stackoverflow.com/q/26206715
tags question: http://stackoverflow.com/q/26260747
tags question: http://stackoverflow.com/q/26329559
tags question: http://stackoverflow.com/q/26325386
tags question: http://stackoverflow.com/q/26285419
tags question: http://stackoverflow.com/q/26281614
tags question: http://stackoverflow.com/q/26323772
tags question: http://stackoverflow.com/q/26267737

http://stackoverflow.com/comment/41235974
type: QuestionComment
has text: Come back to Eclipse or go with Android Studio
comment on: http://stackoverflow.com/q/26282126
score: 0
type: Comment

http://stackoverflow.com/a/26208878
type: Answer
has comment: http://stackoverflow.com/comment/41100641
answers question: http://stackoverflow.com/q/26208840
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/41100653
has body: It is safe to ignore that warning, and I would never close() a scanner that is wrapping the global System.in
downvote count: 0

http://stackoverflow.com/q/26326867
favorite count: 0
has comment: http://stackoverflow.com/comment/41320348
tagged with: drawing
type: AnsweredQuestion
has title: How to create graphical objects in Java without using any library?
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/41318472
tagged with: java
has comment: http://stackoverflow.com/comment/41317883
score: -1
downvote count: 2
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26327020
accepted answer: http://stackoverflow.com/a/26327020
has body: How to create 2D graphical objects in Java without using any library? I can not find a complete basics tutorial on creating objects in Java without using any graphics library.

http://stackoverflow.com/a/26255945
has body: As you have mentioned in your problem, the token consists letters, numbers and underscores. To break your given string in the token, you can use ^[\w\d_]+ regular expression. Using java code below, you can match your token and find the index of your token which will be 21 as you have expected. public static void main(String[] args) throws Exception { String expr = "rent_office+eb+water+rent+eb_office"; Pattern pattern = Pattern.compile("[\\w\\d_]+"); Matcher matcher = pattern.matcher(expr); while (matcher.find()) { if (matcher.group().equals("rent")) { System.out.println("start index : " + matcher.start()); System.out.println("end index : " + matcher.end()); System.out.println("string : " + matcher.group()); System.out.println("------------------------------"); } } } And here is the output: start index : 21 end index : 25 string : rent ------------------------------
score: 0
answers question: http://stackoverflow.com/q/26255464
type: Answer

http://stackoverflow.com/comment/41361028
score: 0
type: AnswerComment
has text: If you are passing Strings, you will need to parse those to get the Date object first. You can use the simpledateformat for that:)
type: Comment
comment on: http://stackoverflow.com/a/26349252

http://stackoverflow.com/q/26201709
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41087347
downvote count: 1
has comment: http://stackoverflow.com/comment/41087561
type: Question
has comment: http://stackoverflow.com/comment/41087530
has comment: http://stackoverflow.com/comment/41087565
tagged with: mockito
accepted answer: http://stackoverflow.com/a/26202019
has comment: http://stackoverflow.com/comment/41087303
has comment: http://stackoverflow.com/comment/41087516
has comment: http://stackoverflow.com/comment/41087793
has body: I am new to Mockito, following this and am trying to find out what verify method does. It seems it is used to make sure the selected method is called once. I have the following code, and by looking at the code I can find out I am calling addBook method twice so why should I use verify? I mean in any case it is easy to make sure a method is called oncem so why should we use verify method? String isbn = mockedBookDAL.addBook(book1); assertNotNull(isbn); isbn = mockedBookDAL.addBook(book1); assertNotNull(isbn); verify(mockedBookDAL).addBook(book1); assertEquals(book1.getIsbn(), isbn);
has comment: http://stackoverflow.com/comment/41087559
answer count: 1
tagged with: junit
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/12539365
upvote count: 2
has title: When do we need to use verify method of Mockito?
has comment: http://stackoverflow.com/comment/41087646
has comment: http://stackoverflow.com/comment/41087368
has answer: http://stackoverflow.com/a/26202019

http://stackoverflow.com/comment/41289803
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26311039
type: AnswerComment
has text: You need to add this value check where you are getting repeat values.

http://stackoverflow.com/q/26317162
has body: I need to return the strings that are betwee stars in the following string String str = "/articles/0,7340,4464361,00.htm?=95.Food-11294.Pasta*20140122*12*"; Matcher matcher = Pattern.compile("\\*(\\d+)\\*").matcher(str); while (matcher.find()) System.out.println(matcher.group()); I expect in return to get the following groups: 20140122 and 12 However, *20140122* is returned. How can I return 20140122 and 12 (without the stars)?
has answer: http://stackoverflow.com/a/26317190
type: AnsweredQuestion
has title: Regex doesn't find groups
type: Question
possible better answer: http://stackoverflow.com/a/26317198
tagged with: regex
has answer: http://stackoverflow.com/a/26317198
accepted answer: http://stackoverflow.com/a/26317190
score: 0
tagged with: java
answer count: 2

http://stackoverflow.com/comment/41116199
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26216967
has text: is your maven build using the same java as you are using within your ide?

http://stackoverflow.com/comment/41186288
type: Comment
type: QuestionComment
has text: You cannot. Fetching data without object name is allowed only in array
score: 0
comment on: http://stackoverflow.com/q/26255089

http://stackoverflow.com/a/26256031
upvote count: 2
answers question: http://stackoverflow.com/q/26254893
has body: I'm not sure what ldapConnection is. Is it from unboundid? Either way from the look of the method the third parameter is your LDAP search filter. You can simply change this filter to be the following: (objectClass=user) So the method call would be: SearchResult searchResult = ldapConnection.search( "CN=XX,DC=XX,DC=XX", SearchScope.SUB, "(objectClass=user)"); The SearchResult will then contain all users found under CN=XX,DC=XX,DC=XX. If it is from unboundid, then you can add in a 4th parameter to define that you only want the sAMAccountName ldap attribute to be returned for each result. So this would be: SearchResult searchResult = ldapConnection.search( "CN=XX,DC=XX,DC=XX", SearchScope.SUB, "(objectClass=user)", "sAMAccountName"); For more details on LDAP search filters see the following resource: http://docs.oracle.com/cd/E19528-01/819-0997/gdxpo/index.html
type: Answer
has comment: http://stackoverflow.com/comment/41187850
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41191582

http://stackoverflow.com/q/26239835
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41158872
has answer: http://stackoverflow.com/a/26246116
type: Question
has title: Extracting some nodes from XML Files
has comment: http://stackoverflow.com/comment/41159318
score: 1
tagged with: java
upvote count: 1
downvote count: 0
answer count: 1
favorite count: 0
has body: I need to extract some nodes from an XML file formatted in this way: <collection sentiment="negativo"> ... ... ... blabla english Now assume that there are other elemente that have spanish in the same XML file. I need to create two separate XML files. The first one with ALL THE NODES having the child english (let's call it eng.xml) and the second one having spanish (let's call it spa.xml) Here is my JAVA code: public void getEnglishRows() throws IOException{ OutputStreamWriter f = new OutputStreamWriter(new FileOutputStream("C:/eclipse/neg_eng.xml")); BufferedWriter buff; NodeList current_row = doc.getElementsByTagName("comment"); //Mette in una lista tutti i nodi row (che contengono a loro volta degli elementi) NodeList tmp; Node nodo = null; buff = new BufferedWriter(f); for(int i=0;i< current_row.getLength();i++){ tmp = current_row.item(i).getChildNodes(); for(int k=0;k<tmp.getLength();k++){ nodo = tmp.item(k); if("english".equals(nodo.getTextContent())) System.out.println("IF ENGLISH"); buff.write(current_row.item(i).getNodeValue()); } } buff.close(); } I don't know if I was clear, I hope so. So I've ONE Xml files with LOTS of . I've to extract from this ALL the that have english and write the node (with it's childs) to another XML file. Same behaviour for spanish . The output of eng.xml is: ... ... ... blabla english The output of spa.xml is: ... ... ... blabla spanish I hope I'm clear. My problem is that I can extract the text of all nodes, but it does not mantain the XML tags!! Please help me!
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/26207666
tagged with: java-7
favorite count: 0
has body: I wrote the following code: void backupFileAttributes(Path path, BufferedWriter writer) throws IOException { try { if (Files.isReadable(path)) { DirectoryStream&lt;Path&gt; stream = Files.newDirectoryStream(path); for (Path entry : stream) { BasicFileAttributes attr = Files.readAttributes(entry, BasicFileAttributes.class); if (Files.isDirectory(entry)) { writer.append((getFileData(entry, attr))); writer.newLine(); backupFileAttributes(entry, writer); } writer.append(getFileData(entry, attr)); writer.newLine(); } } else { System.out.println("Could not read directory: " + path.toAbsolutePath()); } } catch (java.nio.file.AccessDeniedException e) { System.out.println("Access was denied on path: " + path.toAbsolutePath()); } } However, the line DirectoryStream&lt;Path&gt; stream = Files.newDirectoryStream(path); Throws AccessDeniedException on Windows XP when used on C:\. I need Java 7 utilities using Path.
upvote count: 1
accepted answer: http://stackoverflow.com/a/26207667
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: access-denied
tagged with: windows-xp
has title: Files.newDirectoryStream() throws AccessDeniedException on root in Windows XP
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26207667

http://stackoverflow.com/a/26222120
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/41126561
answers question: http://stackoverflow.com/q/26221821
has comment: http://stackoverflow.com/comment/41126507
has comment: http://stackoverflow.com/comment/41137299
upvote count: 3
type: Answer
has body: Have you tried using the VisualVM eclipse launcher ? This will automatically launch visual VM for you. The only change is when you run your main class in eclipse, is to change the configuration to use the VisualVM launcher like this.

http://stackoverflow.com/comment/41327625
has text: clear the buffer after reading a single line using `readLine()`
comment on: http://stackoverflow.com/q/26331932
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26241395
has answer: http://stackoverflow.com/a/26585440
upvote count: 12
has title: What is the best practice for putting classes under package names in Android
has comment: http://stackoverflow.com/comment/41165182
has answer: http://stackoverflow.com/a/26594458
downvote count: 2
has answer: http://stackoverflow.com/a/26520403
type: AnsweredQuestion
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/28963287
type: Question
has answer: http://stackoverflow.com/a/26481221
accepted answer: http://stackoverflow.com/a/26481221
possible better answer: http://stackoverflow.com/a/26594458
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/26592291
tagged with: package
has body: Android Studio 0.8.11 Hello, I have just completed a test on Android which was to build an app that takes a live news feed, and display them. However, the instructor was very critical as I put all my classes under one package. I am just wondering what is the best practice for packaging classes. For my particular test I have the following classes under this package name: com.viewsys.ncon My classes were these: DBHelper &lt;-- database creating and ugprading DetailActivity &lt;-- activity that add the NconDetailFragment NconContract &lt;-- properties of the database schema columns, table name NconDetailFragment &lt;-- detail fragment NconListFragment &lt;-- list fragment NconViewPager &lt;-- just the view pager JsonNewsFeed &lt;-- class that downloads and parses the json format MainActivity &lt;-- Main activity NewsFeed &lt;-- class of properties getters/setters for news feed NewsFeedDB &lt;-- simple array list to store all the object from the sqlite3 DB SplashActivity &lt;-- activity that add the splashFragment and the NconListFragment SplashFragment &lt;-- splash fragment Utilities &lt;-- just some simple utility functions Many thanks for any suggestions,
tagged with: android

http://stackoverflow.com/q/26314918
has title: What constitutes the condition "a server is up"
has comment: http://stackoverflow.com/comment/41295823
tagged with: sockets
accepted answer: http://stackoverflow.com/a/26342125
has body: I'm looking for verification on the following: In order to find out whether a server is up, I'm supposed to establish a TCP connection to the host:port combination of the server given to me. And in that case, "if a connection is established, then the service is up, otherwise - if the connection is refused, the service is down". So, should i be satisfied that the server is up when getRemoteSocketAddress() of Socket returns an object and not null? That is, does the following code always print the accurate info to the console? Socket clientSocket = new Socket(hostName, port); System.out.println("To console: The server is " + (clientSocket.getRemoteSocketAddress()==null?"down.":"up.") ); To me, it does. However, i haven't practical info on these things and won't make sure without a second opinion. Note: I'm aware that, the server being up doesn't necessarily mean that it is accepting and processing requests. That goes by exchanging some greetings to see/hear one another on who's who and go from there based on the protocol in between. However, these aren't relevant on this one. TIA
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26316627
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/41299508
possible better answer: http://stackoverflow.com/a/26316627
type: Question
has answer: http://stackoverflow.com/a/26342125
score: 0
answer count: 2

http://stackoverflow.com/q/26204196
accepted answer: http://stackoverflow.com/a/26204368
score: 1
tagged with: java
upvote count: 1
has body: When I use the project as public class HomeActivity extends Activity implements OnClickListener and inside that I use getContentResolver it show me the error The method getContentResolver() is undefined for the type new View.OnClickListener(){} But when I use public class HomeActivity extends ActionBarActivity it works for me , but how I can handle it in public class HomeActivity extends Activity implements OnClickListener Code : public class HomeActivity extends Activity implements OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); btnEdit = (Button) findViewById(R.id.btn_edit); btnEdit.setOnClickListener(this); btnGallery = (Button) findViewById(R.id.btn_gallery); btnGallery.setOnClickListener(this); } @Override public void onClick(View view) { Intent intent; switch (view.getId()) { case R.id.btn_edit: intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, REQUEST_IMAGE); // startActivityForResult( // Intent.createChooser(intent, "Select Photo"), // MyConstants.TAKE_PHOTO); break; } } @Override public void onBackPressed() { super.onBackPressed(); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) {return;} if (requestCode == REQUEST_IMAGE) { final Uri uri = data.getData(); Button button= (Button) findViewById(R.id.btn_camera); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { InputStream is = this.getContentResolver().openInputStream(uri); final Bitmap bmInImg = BitmapFactory.decodeStream(is); } catch (IOException e) { e.printStackTrace(); } } }); } }
type: Question
answer count: 2
has title: Undefined for the type new View.OnClickListener(){}
has answer: http://stackoverflow.com/a/26204368
possible better answer: http://stackoverflow.com/a/26204475
downvote count: 0
has answer: http://stackoverflow.com/a/26204475
favorite count: 0
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/26198711
score: 0
has comment: http://stackoverflow.com/comment/41081990
has comment: http://stackoverflow.com/comment/41081993
answers question: http://stackoverflow.com/q/26198670
has comment: http://stackoverflow.com/comment/41082490
has body: Hints: Use Scanner to break up each line into the components. Create a class to hold the information in each row. Use arrays if you know beforehand how many elements there will be in the array, and use lists (e.g. ArrayList) if you don't. Once you have populated the data structure, then doing the arithmetic and printing the results is simple programming. These hints answer most of your questions. But I'm not going to code up your homework for you.
type: Answer

http://stackoverflow.com/comment/41209541
has text: That's right. Just give names to the parameters, and put code in the braces.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26267419
score: 1

http://stackoverflow.com/comment/41245078
comment on: http://stackoverflow.com/q/26286698
type: QuestionComment
type: Comment
has text: That's a lot of unrelated code for you to expect a volunteer to wade through. For better help sooner, please post a [Minimal, Complete, Verifiable Example](http://stackoverflow.com/help/mcve) that demonstrates the problem.
score: 0

http://stackoverflow.com/a/26327660
answers question: http://stackoverflow.com/q/26327579
has comment: http://stackoverflow.com/comment/41319450
has comment: http://stackoverflow.com/comment/41319581
downvote count: 0
score: 1
has body: First, you must initialize the array by setting all its elements to "?": String[][] board = new String [9][9]; for (int r = 0; r&lt;board.length;r++){ for (int c = 0; c &lt;board.length;c++){ board[r][c] = "?"; } } Then you can print it: for (int r = 0; r&lt;board.length;r++){ for (int c = 0; c &lt;board.length;c++){ System.out.print (board[r][c] + " "); } System.out.println(); }
upvote count: 1
type: Answer

http://stackoverflow.com/comment/41129201
comment on: http://stackoverflow.com/q/26222844
has text: Yes, it's called "arity".
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26288818
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25880331
accepted answer: http://stackoverflow.com/a/26289686
tagged with: java-stream
tagged with: java
linked to: http://stackoverflow.com/q/26290716
type: Question
has body: Firstly, I'm a JavaScript programmer, and fairly new to Java8 and trying the new functional feature. Since I expertise JS coding, I implemented my own JS lazy-functional library for proof of concept. https://github.com/kenokabe/spacetime Using the library, I could write Infinite sequence of Natural numbers and Fibonacci as below: JavaScript var spacetime = require('./spacetime'); var _ = spacetime.lazy(); var natural = _(function(n) //memoized automatically { return n; // Natural numbers is defined as the `n`th number becomes `n` }); var natural10 = _(natural) .take(10) .compute(function(x) { console.log(x); }); //wrap a recursive function to memoize // must be at the definition in the same scope var fib = _(function(n) { if (n &lt;= 1) return 1; // as the Fib definition in Math else return fib(n - 2) + fib(n - 1); // as the Fib definition in Math }); var fib10 = _(fib) .take(10) .compute(function(x) { console.log(x); }); Clear enough. The point is that I can define Natural/Fibonacci infinite sequence as the math definition as it is, then later compute the required part of the infinite sequence with lazy-evaluation. So, now I wonder if I can do the same manner with Java8. For natural sequence, I had post another Question here. Infinite sequence of Natural numbers with Java8 generator One of the way to define Natural sequence is to use iterator of Java8: Java8 IntStream natural = IntStream.iterate(0, i -&gt; i + 1); natural .limit(10) .forEach(System.out::println); I observe IntStream natural = IntStream.iterate(0, i -&gt; i + 1); is a fair definition of natural numbers in math sense. However, I wonder if it's possible to define it as I did before, that is, JavaScript var natural = _(function(n) //memoized automatically { return n; // Natural numbers is defined as the `n`th number becomes `n` }); because this looks more concise. Unfortunately, the answers suggest it's probably not possible even we use generate. In addition, IntStream.iterate does not fit for Fibonacc…
score: 5
upvote count: 5
has title: Infinite Fibonacci Sequence with Memoized in Java 8
tagged with: javascript
has answer: http://stackoverflow.com/a/26289686
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/26277330
favorite count: 0
linked to: http://stackoverflow.com/q/21650155
has comment: http://stackoverflow.com/comment/43532582
tagged with: lambda
tagged with: java-8

http://stackoverflow.com/q/26277807
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
tagged with: hazelcast
favorite count: 0
has answer: http://stackoverflow.com/a/26279654
accepted answer: http://stackoverflow.com/a/26279654
tagged with: executorservice
has title: Hazelcast Executor Service behavior after some node goes down
has body: I have a question regarding the behavior that Hazelcast Executor Service would take when some node goes down. Executor config: ExecutorConfig ecfg = new ExecutorConfig(); ecfg.setPoolSize(24); ecfg.setName("exec"); config.addExecutorConfig(ecfg); I'm using Hazelcast 3.3.1 in 4 nodes and each node adds new Tasks to the Executor Service. Adding a task: IExecutorService exec = hazelcastInstance.getExecutorService("exec"); exec.execute(new Task()) Supposing that all nodes have pending tasks, what would happen if one node goes down? The tasks of this node would be redistributed or would be lost?
type: AnsweredQuestion

http://stackoverflow.com/q/26209527
accepted answer: http://stackoverflow.com/a/26211086
tagged with: multithreading
tagged with: spring
type: Question
tagged with: spring-integration
has answer: http://stackoverflow.com/a/26211086
tagged with: java
answer count: 1
has title: Send message from multiple channels, in different threads, to a single channel in Spring Integration
score: 0
has body: I have a system which accepts data from multiple sources. The client(a third party client which I have no control) handles all the data source in a thread pool. I can register callbacks and the callback will be triggered from different threads. I am using gateway to send data to separate channels. After processing each channel, I wanted to transform each to a message on to a single channel. This is because most of the processing are same for the data coming from different sources. Following is a sample xml &lt;gateway default-request-channel="a" /&gt; &lt;channel id='a'/&gt; &lt;gateway default-request-channel="b" /&gt; &lt;channel id='b'/&gt; &lt;!-- inputs to a and b can be from different threads --&gt; &lt;channel id='c' /&gt; &lt;transformer input-channel="a" output-channel="c" /&gt; &lt;transformer input-channel="b" output-channel="c" /&gt; &lt;outbound-channel-adapter channel="c" /&gt; When the two transformers output to the same channel, will there be any concurrency issues as transformers are operating on different threads? Is it possible to have only one thread handling channel 'c'? Otherwise, what is the recommended practice in handling multiple threads in the same channel?
type: AnsweredQuestion

http://stackoverflow.com/comment/41306149
comment on: http://stackoverflow.com/q/26320424
type: QuestionComment
has text: Here is what we have to do http://gyazo.com/e4d2af76dbb9704a620f6d65f59b547f
score: 0
type: Comment

http://stackoverflow.com/q/26345505
has title: Maven. error code 400
has comment: http://stackoverflow.com/comment/41353894
tagged with: maven
type: Question
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/26346349
has comment: http://stackoverflow.com/comment/41355599
has comment: http://stackoverflow.com/comment/41352602
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41353753
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/26346349
has body: i get error code 400 if i run Maven in my project. Problem appears when i run appengine:update maven. I am newbie it this thing, and I have no idea how to solve it. Console code is : [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building helloworld 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] &gt;&gt;&gt; appengine-maven-plugin:1.9.4:update (default-cli) @ helloworld &gt;&gt;&gt; [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Laurynas\Documents\ud859-master\Lesson_2\000_Hello_Endpoints\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- appengine-maven-plugin:1.9.4:endpoints_get_discovery_doc (default) @ helloworld --- [INFO] [INFO] Google App Engine Java SDK - get endpoints discovery doc... [INFO] Using Class Name:com.google.training.helloworld.HelloWorldEndpoints [INFO] Executing endpoints Command=[get-discovery-doc, -cp, C:\Users\Laurynas\Documents\ud859-master\Lesson_2\000_Hello_Endpoints\target\helloworld-1.0-SNAPSHOT\WEB-INF\classes;C:\Users\Laurynas\Documents\ud859-master\Lesson_2\000_Hello_Endpoints\target/classes;C:\Users\Laurynas\.m2\repository\com\google\appengine\appengine-api-1.0-sdk\1.9.4\appengine-api-1.0-sdk-1.9.4.jar;C:\Users\Laurynas\.m2\repository\com\google\appengine\appengine-endpoints\1.9.4\appengine-endpoints-1.9.4.jar;C:\Users\Laurynas\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar, -o, C:\Users\Laurynas\Documents\ud859-master\Lesson_2\000_Hello_Endpoints\target/generated-sour…
type: AnsweredQuestion

http://stackoverflow.com/a/26325622
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26325536
type: Answer
answers question: http://stackoverflow.com/q/26325536
has body: I assume you want to have the reliability for your renderfarm, so data that is sent to the user contains the exact quality he or she expects, without anything weird that occurs because a packet is missing. You definitely don't want frames being skipped or sloppy. So I would suppose TCP-IP is the better choice here. Also see: When is it appropriate to use UDP instead of TCP? http://www.cyberciti.biz/faq/key-differences-between-tcp-and-udp-protocols/
score: 2

http://stackoverflow.com/comment/41273767
type: AnswerComment
score: 0
has text: Thanks, but can you tell me how it's an array and not a List?
type: Comment
comment on: http://stackoverflow.com/a/26302658

algorithm
tags question: http://stackoverflow.com/q/26335034
tags question: http://stackoverflow.com/q/26232887
tags question: http://stackoverflow.com/q/26269753
tag name: algorithm
tags question: http://stackoverflow.com/q/26270689
tags question: http://stackoverflow.com/q/26207500
tags question: http://stackoverflow.com/q/26294044
tags question: http://stackoverflow.com/q/26314606
tags question: http://stackoverflow.com/q/26270371
tags question: http://stackoverflow.com/q/26224417
tags question: http://stackoverflow.com/q/26207923
tags question: http://stackoverflow.com/q/26217999
tags question: http://stackoverflow.com/q/26273304
tags question: http://stackoverflow.com/q/26243952
tags question: http://stackoverflow.com/q/26318208
tags question: http://stackoverflow.com/q/26225593
tags question: http://stackoverflow.com/q/26317394
tags question: http://stackoverflow.com/q/26324042
tags question: http://stackoverflow.com/q/26330627
tags question: http://stackoverflow.com/q/26315089
tags question: http://stackoverflow.com/q/26314553
tags question: http://stackoverflow.com/q/26198564
tags question: http://stackoverflow.com/q/26314978
tags question: http://stackoverflow.com/q/26282468
tags question: http://stackoverflow.com/q/26209842
tags question: http://stackoverflow.com/q/26251564
tags question: http://stackoverflow.com/q/26294637
tags question: http://stackoverflow.com/q/26247602
tags question: http://stackoverflow.com/q/26333377
tags question: http://stackoverflow.com/q/26228432
tags question: http://stackoverflow.com/q/26273546
tags question: http://stackoverflow.com/q/26257237
tags question: http://stackoverflow.com/q/26328808
tags question: http://stackoverflow.com/q/26224059
tags question: http://stackoverflow.com/q/26331724
type: Tag
tags question: http://stackoverflow.com/q/26311358
tags question: http://stackoverflow.com/q/26315022
tags question: http://stackoverflow.com/q/26291418
tags question: http://stackoverflow.com/q/26197389
tags question: http://stackoverflow.com/q/26272931
tags question: http://stackoverflow.com/q/26244877
tags question: http://stackoverflow.com/q/26337906
tags question: http://stackoverflow.com/q/26282820
tags question: http://stackoverflow.com/q/26226176
tags question: http://stackoverflow.com/q/26207057
tags question: http://stackoverflow.com/q/26325071
tags question: http://stackoverflow.com/q/26261892
tags question: http://stackoverflow.com/q/26324421
tags question: http://stackoverflow.com/q/26307395
tags question: http://stackoverflow.com/q/26250274
tags question: http://stackoverflow.com/q/26197745
tags question: http://stackoverflow.com/q/26201990
tags question: http://stackoverflow.com/q/26320975
tags question: http://stackoverflow.com/q/26262279
tags question: http://stackoverflow.com/q/26330692
tags question: http://stackoverflow.com/q/26242347
tags question: http://stackoverflow.com/q/26325865
tags question: http://stackoverflow.com/q/26299990
tags question: http://stackoverflow.com/q/26260090

http://stackoverflow.com/a/26321725
answers question: http://stackoverflow.com/q/26321711
has comment: http://stackoverflow.com/comment/41308844
has comment: http://stackoverflow.com/comment/41308811
has comment: http://stackoverflow.com/comment/41308667
has comment: http://stackoverflow.com/comment/41308696
has comment: http://stackoverflow.com/comment/41308715
score: 0
has body: Use a try block: boolean again = true; int n1; while (again) { try { System.out.println("Enter first number"); input.nextInt(); again=false; } catch(InputMismatchException ime) { // do nothing! } } What happens here is pretty simple: if we get an exception, then "again" is not set to true and we go back around in the loop. If we get out of the try block without an exception, then again is toggled and we go merrily on our way.
has comment: http://stackoverflow.com/comment/41308611
has comment: http://stackoverflow.com/comment/41308822
has comment: http://stackoverflow.com/comment/41308820
type: Answer
has comment: http://stackoverflow.com/comment/41308743

http://stackoverflow.com/comment/41867162
has text: Better to give this suggestion as comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26629234
type: Comment

http://stackoverflow.com/q/26277330
tagged with: java-8
has title: Infinite sequence of Natural numbers with Java8 generator
has body: I defined natural for Infinite sequence (Stream) of Natural numbers with Java8 iterator. IntStream natural = IntStream.iterate(0, i -&gt; i + 1); natural .limit(10) .forEach(System.out::println); Now, I want to define it with Java8 generator. static Stream generate(Supplier s) What would be the simplest way? Thanks.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41227004
possible better answer: http://stackoverflow.com/a/26278329
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/31438166
tagged with: iterator
has comment: http://stackoverflow.com/comment/41227371
upvote count: 23
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26278329
has comment: http://stackoverflow.com/comment/41227455
has comment: http://stackoverflow.com/comment/41227231
tagged with: generator
has answer: http://stackoverflow.com/a/26277712
downvote count: 0
accepted answer: http://stackoverflow.com/a/26277712
score: 23

http://stackoverflow.com/comment/41187579
has text: I would check what it read and wheter it add something whis `System.out.` so you can see where the fail is
type: AnswerComment
comment on: http://stackoverflow.com/a/26232102
score: 0
type: Comment

http://stackoverflow.com/q/26350390
answer count: 2
has body: For some reason this is outputting a numerical value of around 16348. When the first and last dates value are 0110 and 0201 respectively. How come I am not getting a day value? import java.util.Scanner; import java.util.Calendar; import java.util.Date; import java.text.SimpleDateFormat; public class Project3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String firstDate = input.next(), lastDate = input.next(); try { Date date1 = new SimpleDateFormat("MMdd").parse(firstDate); Date date2 = new SimpleDateFormat("MMdd").parse(lastDate); System.out.println(Project3.days(date1, date2)); } catch (Exception e) { // } } public static long days(Date startDate, Date endDate) { Calendar start = Calendar.getInstance(); start.setTime(startDate); Calendar end = Calendar.getInstance(); long daysBetween = 0; while(start.before(end)) { start.add(Calendar.DAY_OF_MONTH, 1); daysBetween++; } return daysBetween; } }
possible better answer: http://stackoverflow.com/a/43015247
has comment: http://stackoverflow.com/comment/41361237
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/43015247
tagged with: days
accepted answer: http://stackoverflow.com/a/26350399
score: 0
favorite count: 0
tagged with: calendar
has title: Days between two Dates
has answer: http://stackoverflow.com/a/26350399
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41361695
has comment: http://stackoverflow.com/comment/41361297
upvote count: 1
tagged with: date
linked to: http://stackoverflow.com/q/12851934
downvote count: 1
type: Question

http://stackoverflow.com/q/26207404
favorite count: 0
type: UnansweredQuestion
has title: Java JAR-file could not be launched, Mac
has body: I'm simply trying to open a JAR file on my Mac running 10.9.5. But can't seem to get it open. I have tried litteraly everything, but I have this error code from console: Class JavaLaunchHelper is implemented in both /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java and /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/./libjli.dylib. One of the two will be used. Which one is undefined. One guy said that there are conflict between two files. I just want to open it, have not made anything. Developer wont get back to me. Can some on you guys check out the jar file? Thanks in advance! Need help :(
tagged with: java
has comment: http://stackoverflow.com/comment/41097859
downvote count: 1
type: Question
score: -1
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/18794573
tagged with: macos
has answer: http://stackoverflow.com/a/26207468

http://stackoverflow.com/q/26318712
type: Question
has comment: http://stackoverflow.com/comment/41302879
has title: content from a spinner to a text view
tagged with: android-spinner
has comment: http://stackoverflow.com/comment/41302990
score: 0
tagged with: android
answer count: 1
tagged with: textview
has body: I have a spinner and I would like the item selected by the spinner to go into a text view beside it. Here's my code so far: public class MainActivity extends Activity { Spinner sp1; TextView txt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sp1 = (Spinner) findViewById(R.id.spinner1); txt = (TextView) findViewById(R.id.textView1); sp1.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected( AdapterView&lt;?&gt; parent, View view, int position, long id) { String val = sp1.getSelectedItem().toString(); txt.setText(val); } public void onNothingSelected(AdapterView&lt;?&gt; parent) { } }); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26321783
tagged with: java

http://stackoverflow.com/comment/41227147
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26277193
score: 0
has text: Convert Both time Utc and means Device time and Server time on the basis of that we have to find difference that we have to display in text view

http://stackoverflow.com/a/26260076
type: Answer
answers question: http://stackoverflow.com/q/26259745
score: 1
upvote count: 1
downvote count: 0
has body: I am not sure in which context you try to do this. If you are in a Spring application or something else it might be a bit different to what I describe here. If you are in the context of a Servlet you could just facilitate the Java ClassLoader or to be more precise the class loader of your runtime environment in your case most likely an application server such as Tomcat or Glassfish to get a stream to read the JAR file e.g. InputStream in = getServletContext().getResourceAsStream("/WEB-INF/lib/yourlib.jar"); You will get an InputStream that you can use to read the file. You can then use the Apache Commons FileUtils to copy the Stream to another file. File outputFile = File.createTempFile("temp-file-name", ".jar"); FileUtils.copyInputStreamToFile(in, outputFile); In the example above I put code that writes to a temporary directory. I cannot answer which application server will actually allow you to write to arbitrary filesystem locations and which one will not. So I assume that writing to a temporary directory should be allowed in every environment. For your last step. Actually extracting the JAR file I would like to refer you to this post which is an excellent explanation of how to extract JAR/ZIP files from Java code. How to write a Java program which can extract a JAR file and store its data in specified directory (location)? Of course you will need to adapt the examples given there to again write your files to a location where you are positive you can actually write.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26259745

http://stackoverflow.com/a/26322619
type: Answer
has comment: http://stackoverflow.com/comment/41322559
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26322496
answers question: http://stackoverflow.com/q/26322496
has body: Well, I am supposing that you are doing this from inside a different thread (Of course. Why else you would need to call runOnUiThread specifically?) My 2 cent is that have you considered using AsyncTask for handing UI change after/before your background operation starts? This will clear things a bit for you and that's a better/proper way of handling your interacition between UI/Non-UI thread.

http://stackoverflow.com/comment/41264991
has text: Perhaps something like [Google's Protocol Buffers](https://developers.google.com/protocol-buffers/) could be interesting in that context. It provides implementations for several languages.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26297905
score: 2

http://stackoverflow.com/comment/41089296
has text: @Truman'sworld - Also, with that tool you can examine the constructors for several classes. In the `<init>` methods (which is how constructors are identified) you will always see an `invokespecial` of the superclass `<init>` method, either because the programmer did a `super` call in the constructor, or because, lacking such a call, the compiler supplied one implicitly.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26202240
type: AnswerComment

http://stackoverflow.com/a/26223237
score: 5
has body: The easiest way to check for palindromes is to invert the string and compare it with the original string.
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26223199

http://stackoverflow.com/comment/41254194
type: Comment
type: QuestionComment
has text: Look at your Adapter instantiation. The arrays for the data keys and the View IDs are different sizes.
comment on: http://stackoverflow.com/q/26291887
score: 0

http://stackoverflow.com/comment/41391324
comment on: http://stackoverflow.com/a/26352728
type: AnswerComment
score: 0
type: Comment
has text: I must have misunderstood what the OP was asking. I thought he/she was explicitly calling containsKey(k) and then put(k, v). What you said is exactly what putIfAbsent(k, v) actually does.

http://stackoverflow.com/a/26317048
has body: It seems you Sunday to Saturday variables are never used and do not store days as String anyway but a String representation of the corresponding integer. Therefore, you will never be able to print "Tuesday" instead of "2" because you simply print the variable 'day', which is the scanned integer. You should store a map and get the String representation from its integer value. Here is an example: import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class FindFutureDay { private static Map&lt;Integer, String&gt; weekDays = new HashMap&lt;Integer, String&gt;(); static { weekDays.put(0, "Sunday"); weekDays.put(1, "Monday"); weekDays.put(2, "Tuesday"); weekDays.put(3, "Wednesday"); weekDays.put(4, "Thursday"); weekDays.put(5, "Friday"); weekDays.put(6, "Saturday"); } public static void main(String[] args) { //Variable int day, next, future; //Create scanner Scanner input = new Scanner(System.in); //Input day System.out.println("Enter day today: "); day = input.nextInt(); //Input number of days later System.out.println("Number of days later: "); next = input.nextInt(); //Close scanner input.close(); //Compute future day future = (day + next) % 7; //Select result to display System.out.println("Today is " + weekDays.get(day) + " and " + next + " day later is " + weekDays.get(future) + "."); } } Hope it helps.
type: Answer
answers question: http://stackoverflow.com/q/26316745
score: 0

http://stackoverflow.com/q/26329911
type: Question
has answer: http://stackoverflow.com/a/26330077
tagged with: validation
answer count: 1
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/41323871
accepted answer: http://stackoverflow.com/a/26330077
has comment: http://stackoverflow.com/comment/41324103
tagged with: object
type: AnsweredQuestion
tagged with: java
has body: What I'm assigned to do is create an object-oriented validator. The user is prompted to input an integer, and the application validates it. The end result will display on the console as follows (first 3 inputs being invalid, 4th being valid): Welcome to the Validation Tester application Int Test Enter an integer between -100 and 100: X Error! Invalid integer value. Try again. Enter an integer between -100 and 100: -101 Error! Number must be greater than -101 Enter an integer between -100 and 100: 101 Error! Number must be less than 101 Enter an integer between -100 and 100: 100 I've been assigned to create a validation class before but never in the way I'm being asked to now. Before, I've been able to pass the sc and the prompt to the Validation class and have the methods process them accordingly. For example: //MAIN Scanner sc = new Scanner(System.in); int x = Validator.getInt(sc, "Enter an integer: ", 0, 1000); //VALIDATION CLASS public class Validator{ public static int getInt(Scanner sc, String prompt) { int i = 0; boolean isValid = false; while (isValid == false) { System.out.print(prompt); if (sc.hasNextInt()) { i = sc.nextInt(); isValid = true; } else { System.out.println("Error! Invalid integer value. Try again."); } sc.nextLine(); // discard any other data entered on the line } return i; } public static int getInt(Scanner sc, String prompt, int min, int max) { int i = 0; boolean isValid = false; while (isValid == false) { i = getInt(sc, prompt); if (i &lt;= min) System.out.println( "Error! Number must be greater than " + min + "."); else if (i &gt;= max) System.out.println( "Error! Number must be less than " + max + "."); else isValid = true; } return i; } Done as above, I understand what is happening. However now I'm assigned get the same results using similar methods but this time the sc has its own constructor. public class OOValidator { public OOValidator(Scanner sc){} public int getInt(String prompt){} public int getIntWithinRange(String prompt, int mi…
has title: Need help creating an object oriented validation class

http://stackoverflow.com/comment/41362686
type: QuestionComment
comment on: http://stackoverflow.com/q/26351203
has text: Have you specified the main class so that the manifest can be updated?
score: 0
type: Comment

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/26301883
tags question: http://stackoverflow.com/q/26250364
tags question: http://stackoverflow.com/q/26269584
tags question: http://stackoverflow.com/q/26262806
tags question: http://stackoverflow.com/q/26302922
type: Tag

http://stackoverflow.com/comment/41284309
comment on: http://stackoverflow.com/q/26308113
type: Comment
type: QuestionComment
has text: Is `name` coming from client HTTP request? Perhaps, there's no such `name` in your data provider, so `list` is empty? Other option is that `DataAccess` isn't working properly for some reason.
score: 0

http://stackoverflow.com/q/26286305
has comment: http://stackoverflow.com/comment/41259522
favorite count: 0
linked to: http://stackoverflow.com/q/15289352
tagged with: javac
type: UnansweredQuestion
score: 2
has title: run java file with user input in Sublime Text
answer count: 0
upvote count: 2
tagged with: sublimetext2
tagged with: java
type: Question
has body: I'm trying to run a java file with a users input, but I always get this error: "Exception in thread "main" java.util.NoSuchElementException" before the user can enter something.. I know it's normally not possible to input stuff when compiling and running a java file in Sublime Text, but does somebody knows a workaround? Now I already have this (JavaC.sublime-build) in my Packages - Java directory from Sublime Text so I can compile and run with cmd B but input something is impossible.. { "cmd": ["javac \"$file_name\" &amp;&amp; java \"$file_base_name\""], "shell": true, "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java" } (I'm working on OS X)
downvote count: 0
has comment: http://stackoverflow.com/comment/41244289
tagged with: macos

http://stackoverflow.com/comment/41304822
type: QuestionComment
comment on: http://stackoverflow.com/q/26318341
has text: @chiastic-security: It's a good question, but it doesn't really fit the mould of an SO question. I flagged it for migration to programmers, where I think it might meet a warmer reception.
type: Comment
score: 0

http://stackoverflow.com/a/26352800
type: Answer
answers question: http://stackoverflow.com/q/26352609
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41367087
accepted answer of: http://stackoverflow.com/q/26352609
score: 0
has body: Try this way,hope this will help you to solve your problem. The Z at the end is usually the timezone offset. If you you don't need it maybe you can drop it on both sides. SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); try{ Date d = df1.parse("2014-10-13T10:41:22.863+8:00"); System.out.println("new date format " + df2.format(d)); }catch(Exception e){ e.printStackTrace(); }

http://stackoverflow.com/comment/41316028
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26325877
type: Comment
has text: @SwissPhil02: I'm not getting that exception, but when I run your program, I get a visual mess. How are you trying to run your applet?

http://stackoverflow.com/a/26246242
accepted answer of: http://stackoverflow.com/q/26246086
has body: I would suggest using a HashMap instead. HashMaps contain a set of keys and values instead of one value like array lists. In this case, you should have the names of the ingredients as the key and the amount as the value. HashMap, however, does not have a containsAll method, but you can get a set of the keys(ingredients) and then call Set.containsAll. HashMap&lt;String, Integer&gt; array1 = new HashMap&lt;String, Integer&gt;(); ArrayList&lt;String&gt; array2 = new ArrayList&lt;String&gt;(); array1.put("Avocados", 3); array1.put("Tomatoes", 3); //etc. array1.keySet().containsAll(array2);
answers question: http://stackoverflow.com/q/26246086
downvote count: 0
has comment: http://stackoverflow.com/comment/41172028
has comment: http://stackoverflow.com/comment/41171099
has comment: http://stackoverflow.com/comment/41171175
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41171307
has comment: http://stackoverflow.com/comment/41171757
has comment: http://stackoverflow.com/comment/41171823
type: Answer

http://stackoverflow.com/a/26325525
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/57167856
score: 2
has body: I will begin with a preliminary remark about how DefaultServlet works. According to Servlet 3.0 specifications, containers generally provide a default servlet, that has lowest priority and serves static context. The mapping / is the implicit mapping for this default servlet. Now for the solutions : Map spring controllers to a sub-hierarchy That is the easiest solution : you map Spring DispatcherServlet to /pages, or to /pages and /api for example. The default servlet will then serve all other URLs (including root). To serve root controller, you can map a controller to /home (for example) and have a /index.jsp containing &lt;jsp:forward page="/home"/&gt; - this is a method of current use in other frameworks using extension mapping such as Struts (*.do for old Struts1). Drawbacks : having url stating with /pages is not very nice. Map resources to a sub-hierarchy This solution is highly used in the referenced pages. Spring DispatcherServlet is mapped to /* and so gets all the requests (unless a more specific mapping exists). To serve static resources, you just declare a ResourceHttpRequestHandler, using in XML : &lt;mvc:resources mapping="/resources/**" location="/public-resources/"/&gt; or in java configuration : @Configuration @EnableWebMvc public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/public-resources/"); } } This works very fine, and you can map a Spring controller to / directly. Drawbacks : you cannot serve static resources that would be directly under root context. Map DispatcherServlet as the default servlet Mapping Spring DispatcherServlet to / is in fact replacing the default servlet from the container to process all not already processed URLs. With this mapping, Spring can fallback to the original default servlet for URLs not mapped to controllers. For that to work, you have to configure a DefaultServletH…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26325524
downvote count: 0
answers question: http://stackoverflow.com/q/26325524

http://stackoverflow.com/a/26219333
has comment: http://stackoverflow.com/comment/41121549
upvote count: 2
type: AcceptedAnswer
has body: You can only post "as Page", not "as App". You need a Page Access Token and you need to use the /page-id/feed endpoint to post. Links with information and example code: https://developers.facebook.com/docs/facebook-login/access-tokens/ https://developers.facebook.com/docs/graph-api/reference/v2.1/page/feed/ http://www.devils-heaven.com/facebook-access-tokens/ http://www.devils-heaven.com/extended-page-access-tokens-curl/
accepted answer of: http://stackoverflow.com/q/26219104
type: Answer
answers question: http://stackoverflow.com/q/26219104
has comment: http://stackoverflow.com/comment/41122678
score: 2
downvote count: 0

http://stackoverflow.com/comment/41239992
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26279029
has text: connection pool character encoding fails because in java, utf-8mb4 is just UTF-8. I think it is the connection which is not set to the right collation. Why don't you try to execute a `SET NAMES 'utf8mb4'` query during initialization of the context (or just before your `where .. like` query for testing purposes)?

http://stackoverflow.com/comment/77280011
type: Comment
has text: The 'some reason' is that an instance of an inner class retains a reference to the enclosing object, in this case an instance of `Main`, which isn't `Serializable`.
comment on: http://stackoverflow.com/a/26330168
score: 0
type: AnswerComment

http://stackoverflow.com/a/26300614
type: Answer
has comment: http://stackoverflow.com/comment/41271281
has comment: http://stackoverflow.com/comment/41334504
accepted answer of: http://stackoverflow.com/q/26300395
upvote count: 1
answers question: http://stackoverflow.com/q/26300395
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41270367
has comment: http://stackoverflow.com/comment/41336209
has body: You can pass components to the JOptionPane and they will be displayed properly. So for example if you create a JCheckBox and pass it to the JOptionPane, after the dialog is closed, you can examine the state of the check box and store it anywhere you'd like to. Next time you want to display the dialog, before passing the check box, set its state to the one you stored last time. For example (just for demonstration purposes): final JFrame f = new JFrame("Checkbox test"); f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); f.addWindowListener(new WindowAdapter() { // I store the checkbox state here in a boolean variable: boolean save; @Override public void windowClosing(WindowEvent e) { // Now user wants to close the application, ask confirmation: // We create a check box with the initial value of the stored state: JCheckBox cb = new JCheckBox("Save settings before Exit", save); int res = JOptionPane.showConfirmDialog(null, new Object[] {"Are you sure you want to Exit?", cb}, "Exit?", JOptionPane.OK_CANCEL_OPTION); // Dialog closed, you can save the sate of the check box save = cb.isSelected(); if (res == JOptionPane.OK_OPTION) { if (save) { // Settings can be saved here. } // And exit (by disposing the only frame) f.dispose(); } } }); f.getContentPane().add(new JLabel("Try to close the application")); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true);

http://stackoverflow.com/comment/41272398
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26301874
has text: You've got code, you've got output, but you don't exactly have a question here. What are you asking?

http://stackoverflow.com/q/26298822
tagged with: split
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26298857
has comment: http://stackoverflow.com/comment/41266680
tagged with: string
has answer: http://stackoverflow.com/a/26299119
accepted answer: http://stackoverflow.com/a/26299119
has answer: http://stackoverflow.com/a/26299376
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41266532
has title: split a string in java algorithm
tagged with: java
possible better answer: http://stackoverflow.com/a/26298857
has comment: http://stackoverflow.com/comment/41266498
has body: I have the below string : FIELD,KEY,0,AREA,2,3,4 I need to pick out the values of key and area and convert them to integer array .. e.g. key = {0}; area = {2,3,4} How could I achieve this?
type: Question

http://stackoverflow.com/q/26302561
linked to: http://stackoverflow.com/q/18231685
tagged with: user-interface
has comment: http://stackoverflow.com/comment/41273704
has comment: http://stackoverflow.com/comment/41286790
has comment: http://stackoverflow.com/comment/41273613
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9749851
has title: Using Rectangle to Check Intersection of Images
tagged with: rectangles
tagged with: java
linked to: http://stackoverflow.com/q/13825515
type: Question
score: 0
has body: So, I am instructed to: "Modify the Sprite class by implementing the "overlaps" function to return true if any portion of the Sprite passed in as an argument overlaps the current Sprite. You will need to use the x and y coordinates as well as the size of the Sprites." I was advised to use Rectangles to make this work and check for an intersection. However, I'm not sure if what I have is the correct way to do this: (It's implemented in the boolean overlaps method) As always, thanks so much for your time. import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import javax.imageio.ImageIO; import java.io.File; import java.io.IOException; import java.util.Random; abstract class Sprite { private int x; private int y; private int size; private int w; private int h; private int xSlope; private int ySlope; private Image image; private static Random rand; public Sprite(int xIn, int yIn, int width, int height, String imagePath, int imageSize) { if (rand == null) { rand = new Random(); } size = imageSize; setImage(imagePath); x = xIn; y = yIn; w = width; h = height; xSlope = rand.nextInt(11) - 5; ySlope = rand.nextInt(11) - 5; } public int getX() { return x; } public int getY() { return y; } public int getSize() { return size; } public void setSize(int s) { size = s; } public void setX(int xIn) { x = xIn; } public void setY(int yIn) { y = yIn; } public void setImage(String imagePath) { try { image = ImageIO.read(new File(imagePath)); } catch (IOException ioe) { System.out.println("Unable to load image file."); } } public Image getImage() { return image; } public boolean overlaps(Sprite s) { int locX = this.getX(); int locY = this.getY(); int overX = s.getX(); int overY = s.getY(); Rectangle R1 = new Rectangle(locX, locY, this.w, this.h); Rectangle R2 = new Rectangle(overX, overY, s.w, s.h ); boolean intersects = R1.intersects(R2); return intersects; } public void update(Graphics g) { g.drawImage(getImage(), x, y, getSize(), getSize(), null); } public void …

http://stackoverflow.com/q/26353471
has comment: http://stackoverflow.com/comment/41452167
has comment: http://stackoverflow.com/comment/41542128
has comment: http://stackoverflow.com/comment/41384856
has comment: http://stackoverflow.com/comment/41464791
has comment: http://stackoverflow.com/comment/41517924
answer count: 0
type: UnansweredQuestion
tagged with: java
has title: Deployment Issue in Weblogic 10.3 which targets to the Managed Server
type: Question
tagged with: weblogic
has comment: http://stackoverflow.com/comment/41517916
score: 0
has body: I am using Weblogic 10.3.I created a managed server along with machine.It is running well. I try to deploy the application in weblogic I deployed which points to running managed Server but the deployment gets fails. I am getting error has "" org/antlr/runtime/RecognitionException "". Please help me to resolve this issue. Thanks in advance.

http://stackoverflow.com/a/26225200
has comment: http://stackoverflow.com/comment/41138954
answers question: http://stackoverflow.com/q/26225141
has comment: http://stackoverflow.com/comment/41183649
has body: Is there a possibility to communicate with this new process, e.g. sending request, chaing fields...? You can communicate with the process through the Process object returned by Runtime.exec. Just use Process.getInputStream/.getOutputStream. If you want to invoke methods on the other Java process you could look into RMI ("Remote method invocation"). Another option is of course sockets. See this related answer. There's no straight forward platform independent way of changing fields of the other Java process. If I kill the process, will the shutdownhook still be executed before the process is killed? Depends on how you kill it, but typically, yes, the shutdown hooks will be executed.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41167745
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26225141
type: Answer
has comment: http://stackoverflow.com/comment/41148340
has comment: http://stackoverflow.com/comment/41186216
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41139004
has comment: http://stackoverflow.com/comment/41346005
has comment: http://stackoverflow.com/comment/41143696
has comment: http://stackoverflow.com/comment/41345935
has comment: http://stackoverflow.com/comment/41310883
has comment: http://stackoverflow.com/comment/41310962
has comment: http://stackoverflow.com/comment/41134333
has comment: http://stackoverflow.com/comment/41169922

http://stackoverflow.com/comment/41088054
type: Comment
type: QuestionComment
has text: There is only one instance, i.e. one object. The object, however, is made of two parts, one with the stuff coming from the parent, and another with the stuff it brings itself. Don't see any need for Oracle to write a paper about this, though.
score: 2
comment on: http://stackoverflow.com/q/26202179

http://stackoverflow.com/comment/41340601
type: Comment
score: 2
has text: Also try `grape -V resolve group artifact version` for more informations
type: QuestionComment
comment on: http://stackoverflow.com/q/26338996

http://stackoverflow.com/comment/41269765
type: QuestionComment
has text: I mean you can create connectors for two different IP:port endpoints, but manage key/cert pairs within a single keystore file. See keyAlias parameter in SSL Support section of [tomcat docs](http://tomcat.apache.org/tomcat-7.0-doc/config/http.html)
score: 0
comment on: http://stackoverflow.com/q/26279314
type: Comment

http://stackoverflow.com/q/26212337
has answer: http://stackoverflow.com/a/26212440
tagged with: java
downvote count: 5
has answer: http://stackoverflow.com/a/26212405
has answer: http://stackoverflow.com/a/26212456
type: Question
has comment: http://stackoverflow.com/comment/41107263
has comment: http://stackoverflow.com/comment/41107202
has comment: http://stackoverflow.com/comment/41107135
favorite count: 0
has comment: http://stackoverflow.com/comment/41107181
has comment: http://stackoverflow.com/comment/41107162
accepted answer: http://stackoverflow.com/a/26212440
has title: Java - shorter code for multiple or statements
answer count: 4
has comment: http://stackoverflow.com/comment/41107243
upvote count: 2
score: -3
has body: Check if int is (1, 3, 8, 7 ) int a= 1; if (a==1 || a==3 || a==8 ....) { doAdd(); } It is possible to shorten the "if-statement" to something like: if (a==1 || 3 || 8 ...) Without using an array, just interested of writing this with fewer code. First Version (for reference only): // Count vowels (a, o, e ,u, i ) [...] String a= 'o'; if (a=='a' || a=='o' || a=='e' ....) { doAdd(); } [...] It is possible to shorten the "if-statement" to something like: if (a=='a' || 'o' || 'e' ...) I know this is no valid java, but I want to know if there is another way to do this (without looping through a "vowels-array").
has comment: http://stackoverflow.com/comment/41107362
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26212408
tagged with: if-statement
possible better answer: http://stackoverflow.com/a/26212405

http://stackoverflow.com/comment/41190006
comment on: http://stackoverflow.com/q/26257237
type: QuestionComment
score: 1
has text: Show code for next() method...that is probably what is taking so long.
type: Comment

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/26303111
type: Tag

http://stackoverflow.com/comment/41079741
type: QuestionComment
has text: Please post a [clear and concise, minimal example](http://stackoverflow.com/help/how-to-ask) of the problem you're having. Further, please post the **exact** error you're receiving. I've never heard of a compiler telling you which constructs to use.
score: 1
comment on: http://stackoverflow.com/q/26197495
type: Comment

http://stackoverflow.com/a/26212775
answers question: http://stackoverflow.com/q/26200324
upvote count: 12
score: 12
downvote count: 0
has body: If you used Spring AOP to manage transaction, and the configuration and annotation is used right, the default effect is the transaction would be rolled back when the runtime exception occurs. If you managed transaction manually, you can roll back transaction like this: EntityManager em = createEntityManager(); try { em.getTransaction().begin(); // Do something with the EntityManager such as persist(), merge() or remove() em.getTransaction().commit(); } catch(Exception e) { em.getTransaction().rollback(); } em.close(); See more at: http://en.wikibooks.org/wiki/Java_Persistence/Transactions http://www.developerscrappad.com/547/java/java-ee/ejb3-x-jpa-when-to-use-rollback-and-setrollbackonly/#sthash.jx3XlK5m.dpuf
type: Answer

http://stackoverflow.com/q/26305189
has body: I want to try to make this kind of output but my code is having some errors. Would it be best to use an if/else statement below, or use another loop? Here is my desired output: Do you wish to continue >> Y Please enter the integer >> 2 table 2 1 x 2 = 2 2 x 2 = 4 ... 12 x 2 = 24 Do you want to continue >> T Here is my current code: import java.util.Scanner; public class tugas6 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int pilihan; int i, j; System.out.println("Do you want to continue >>"); pilihan = input.nextInt(); if (pilihan == y) System.out.println("Please enter the integer >>"); Scanner in = new Scanner(System.in); j = in .nextInt(); System.out.println("table" + j); for (i = 1; i <= 12; i++) System.out.println(+i + "*" + j + " = " + (i * j)); else(pilihan == t) System.out.println("Thank you"); } } Thank You.
answer count: 3
downvote count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/26305439
has answer: http://stackoverflow.com/a/26305699
has comment: http://stackoverflow.com/comment/41278552
has title: Java times table
upvote count: 0
has answer: http://stackoverflow.com/a/26305258
type: UnansweredQuestion
score: -3
tagged with: loops
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/41278527
tagged with: java

http://stackoverflow.com/q/26350096
type: Question
has comment: http://stackoverflow.com/comment/41361058
score: 0
tagged with: linux
accepted answer: http://stackoverflow.com/a/26351206
has body: Take a look at the following commands: $ sudo ln -fs /usr/share/zoneinfo/US/Pacific localtime $ date Mon Oct 13 15:29:02 PDT 2014 $ sudo ln -fs /usr/share/zoneinfo/US/Hawaii localtime $ date Mon Oct 13 12:29:20 HST 2014 That is all well and good. Now I have some software written in java that needs to know how many minutes until midnight so it can perform some maintenance. Here is the code I came up with: // Time to perform maintenance String rawTime = "23:59"; int hours = Integer.parseInt(rawTime.substring(0, 2)); int minutes = Integer.parseInt(rawTime.substring(3, 5)); // Get current Time Calendar c = Calendar.getInstance(); long now = c.getTimeInMillis(); Date dateNow = new Date(now); System.out.println(new Date(now)); // Get midnight c.set(Calendar.HOUR_OF_DAY, hours); c.set(Calendar.MINUTE, minutes); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); Date midnight = new Date(c.getTimeInMillis()); // Get Difference System.out.println(String.format("Calc minutes from %s to %s", dateNow, midnight)); long result = ((midnight.getTime()/60000) - (dateNow.getTime()/60000)); System.out.println((int) result); Output when linux is set to Hawaii time zone: Calc minutes from Mon Oct 13 15:36:51 PDT 2014 to Mon Oct 13 23:59:00 PDT 2014 Result: 503 As you can see, I'm not getting the correct time... I'm getting PDT instead of HST. I'm not that concerned with why toString() of a date returns PDT since it is time zone independent but I am concerned with how I should calculate this? Let's just start with '11:59' calculate how many minutes until '11:59' for whatever linux thinks the time is...I am open to a solution where I set the linux time in a different fashion. Thanks! this should be this hard...
answer count: 1
has title: Calulate minutes until midnight in Java in a linux environment
has comment: http://stackoverflow.com/comment/41360823
tagged with: calendar
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41360907
has answer: http://stackoverflow.com/a/26351206
tagged with: java
linked to: http://stackoverflow.com/q/7026182
has comment: http://stackoverflow.com/comment/41388299
tagged with: date
has comment: http://stackoverflow.com/comment/41360966

http://stackoverflow.com/comment/41355026
comment on: http://stackoverflow.com/q/26343509
score: 0
type: Comment
type: QuestionComment
has text: it obviously has a certain directory structure, what i am trying to demonstrate in the question is that the jar file can't be downloaded using basic http auth... whereas it's possible to download the same thing when the repo in public

http://stackoverflow.com/comment/41360217
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26327724
has text: I ended up making all of my fragments setRetainInstance(true), and now I'm able to use the app in landscape mode as well, but I couldn't make using only one frag for data
score: 0

http://stackoverflow.com/q/26205587
tagged with: java
downvote count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/26205639
has comment: http://stackoverflow.com/comment/41094379
has answer: http://stackoverflow.com/a/26205639
type: AnsweredQuestion
has body: So here I am again with another problem. You'll understand what i mean as soon as you read my code and output. I'm trying to print my Array's numbers and their occurrences. !!!I can't use any of import codes unfortunately...!!! int[] fr = new int[Bag.length]; for( int i = 0; i &lt; Bag.length; i++ ) fr[i]++; for( int i = 0; i &lt; fr.length; i++ ) { if( fr[i] &gt; 0 ) System.out.println( "The number " + Bag[i] + " occurs " + fr[i] + " time(s).");}} If i add 5, 6 and 5 to my array; ( I created my Add operation btw so at first my array is 0 and then getting bigger ) Output : The number 5 occurs 1 time(s). The number 6 occurs 1 time(s). The number 5 occurs 1 time(s). My Add operation btw is : int[] Bag = new int[0]; String name = scanner.next(); if (name.equals("A")){ int number = scanner.nextInt(); NewBag[NewBag.length - 1] = number; for(int i = 0; i &lt; Bag.length; i++){ NewBag[i] = Bag[i];} Bag = NewBag; System.out.println(number + " added to Bag.");}
score: -1
type: Question
answer count: 3
linked to: http://stackoverflow.com/q/13106906
has answer: http://stackoverflow.com/a/26205651
has comment: http://stackoverflow.com/comment/41094519
tagged with: arrays
favorite count: 0
has title: My code is writing occurrences separately
has comment: http://stackoverflow.com/comment/41094281
accepted answer: http://stackoverflow.com/a/26205651
has comment: http://stackoverflow.com/comment/41094331
has answer: http://stackoverflow.com/a/26205699

http://stackoverflow.com/q/26337744
type: UnansweredQuestion
tagged with: package
has comment: http://stackoverflow.com/comment/41338253
tagged with: java
has title: How to create package folders with javac command
type: Question
has comment: http://stackoverflow.com/comment/41339078
has answer: http://stackoverflow.com/a/26338144
has comment: http://stackoverflow.com/comment/41339543
score: 0
has body: I am compiling java file with command prompt with some package name come.test. But while running with java command it gives no class definition error. If I compile with IDE it is running because folders are created like com\test How can I get those folders if I compile with javac command.
answer count: 1
tagged with: cmd

http://stackoverflow.com/comment/41331420
type: QuestionComment
type: Comment
has text: Why don't You use something like Http Components, so You dont have to do what others have done before? ;)
score: 0
comment on: http://stackoverflow.com/q/26333941

http://stackoverflow.com/q/26286746
has answer: http://stackoverflow.com/a/26286928
score: 0
has comment: http://stackoverflow.com/comment/41245404
has comment: http://stackoverflow.com/comment/41245299
answer count: 1
has comment: http://stackoverflow.com/comment/41245234
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41245377
has title: Stack Overflow Error (Java)
has body: So my code is printing out estimations of Pi using a for and while loop and a recursive method. It's all working except my compiler is saying there's a stack overflow error for the if statement in my recursive method. public static final double REAL_PI = 3.14159;//PI is the value Mr.B gave us on the handout public static double Pi = 0; //Pi is the value of Pi that this program calculates public static int m = 0; public static int c = 0; public static void main (String [] args) { Algorithm(); //calls on method of calculating pi System.out.println("Calculated pi: " + Pi); //prints out pi countDigits(Pi); //calls on countdigits method System.out.println("Number of digits: " + c); //has the computer print out the count because that's how many digits are the same While(); Recursive(1, 0.0); //calls on estimate digits method } public static double Algorithm() //should return a double (pi) { for(m=1; m&lt;=100000; m++) { Pi += 4*(Math.pow(-1, m-1)/((2*m)-1));//Math.pow uses math package to calculate a power to use the algorithm } return Pi; } public static int countDigits (double Pi) { int a = (int) Pi; //the int cast makes Pi and REAL_PI into integers so the program can compare each digit separately int b = (int) REAL_PI; int c = 0; int count = 0; while(a == b)//if m less then or equal to 100,000 then while loop runs { count ++; a = (int) (Pi*(Math.pow(10,count))); //if a=b then the computer will multiply Pi and REAL_PI by 10 b = (int) (REAL_PI*(Math.pow(10,count))); /*when you input a and b * while loop compares them * if a = b then loop continues until a doesn't equal b and loop ends */ } c = count; //gives c the value of the count so it can be used outside the method return count; } public static double While() { int m = 1; Pi = 0.0; while (countDigits(Pi) &lt; 6) { Pi += 4*(Math.pow(-1, m-1)/((2*m)-1)); m++; } Pi = (int)(Pi * 1000000); Pi = (double)(Pi/1000000); System.out.println("Pi using while loop: " + Pi); return Pi; } public static double Recursive(int m,double …
has comment: http://stackoverflow.com/comment/41245254
tagged with: recursion
has comment: http://stackoverflow.com/comment/41245437
tagged with: java
tagged with: pi
type: Question
has comment: http://stackoverflow.com/comment/41245093
has comment: http://stackoverflow.com/comment/41245179
has comment: http://stackoverflow.com/comment/41245066

http://stackoverflow.com/comment/41220436
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26273567
type: QuestionComment
has text: http://stackoverflow.com/questions/9066218/casting-an-object-of-a-superclass-into-an-object-of-a-subclass-creates-a-new-obj

http://stackoverflow.com/q/26249437
type: Question
has answer: http://stackoverflow.com/a/26249502
tagged with: jsp
has title: Resolve a URL request containing .jsp in Spring
accepted answer: http://stackoverflow.com/a/26250427
score: 0
possible better answer: http://stackoverflow.com/a/26249502
answer count: 3
has answer: http://stackoverflow.com/a/28582317
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: I have created a Spring Web MVC project. I want to handle request with with .jsp in the url such that all request with .jsp in the URL are handled by the same controller. Following is the url pattern I am using in web.xml project / The annotation in the Controller looks like this @RequestMapping("/welcome") With this I am able to resolve URL of the form http://localhost:8080/project/welcome But not this one : http://localhost:8080/project/welcome.jsp
has answer: http://stackoverflow.com/a/26250427
tagged with: java

http://stackoverflow.com/comment/41208151
has text: Not a solution I'm particularly excited about.
comment on: http://stackoverflow.com/a/26266534
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26213908
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41109889
has comment: http://stackoverflow.com/comment/41113468
upvote count: 1
score: 1
tagged with: java
has title: Cannot convert type in Iterable implementation in Java
type: Question
tagged with: iterator
has answer: http://stackoverflow.com/a/26213962
answer count: 1
tagged with: mismatch
has comment: http://stackoverflow.com/comment/41109804
tagged with: iterable
tagged with: types
downvote count: 0
has body: I have the error: Type mismatch: cannot convert from element type Object to Card with the following code: Deck Removal .... for (Card c : Removal) d.removeCard(c); This is the iterator method in my deck class: @Override public Iterator&lt;Card&gt; iterator() { return deck.iterator(); } The underlying structure for the deck is Vector&lt;Card&gt;. My iterator is returning type Card. Why is it telling me it's Object in the for loop? I can do the following and then the error would go away but that's quite stupid since I'm already supposed to return Cards instead of Objects. Deck Removal .... for (Object c : Removal) d.removeCard((Card)c); Thanks

http://stackoverflow.com/q/26321598
tagged with: java
type: Question
tagged with: object
tagged with: jpanel
has body: I'm creating a text based city management game and using JTabbedPanes inside a JFrame. The JTabbedPane has 4 main JPanels inside it to display (1)city population, (2) economic class breakdown, (3) social class breakdown, and (4) overall approval rating. These JPanels have many other JPanels inside them to display content. I will have approval rating calculated in the class "ApprovalRating" but for the moment used 46 as a place holder: public class ApprovalRating { ApprovalRating(){ int rating; } public void getRating() { int rating = 46; } However I cannot seem to create an object that will be able to access the class or methods I need: StaticsticsTab(){ avgApprove = new JPanel(); ApprovalRating() t1 = new ApprovalRating();// this line doesn't work int myRating = t1.getRating();// t1 hasn't been created so this line won't work either JLabel rating = new JLabel(""+myRating); } (I've left out the majority of my StatisticsTab Class but I can post the whole thing if you feel like it would help. The rest is just creating JPanels and associated elements: JLabels etc.) Here is my main method: public class Main { public static void main(String[] args) { final int WIDTH = 500; final int HEIGHT = 600; JFrame frame = new JFrame("City Manager"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(WIDTH,HEIGHT); frame.setLocationRelativeTo(null); JTabbedPane tp = new JTabbedPane(); tp.addTab("Statistics", new StatisticsTab());//Accesses JPanels made in this tab; frame.getContentPane().add(tp); frame.setResizable(false); frame.setVisible(true); } } Thanks so much to anyone that can help!
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/26321673
answer count: 1
tagged with: jtabbedpane
type: UnansweredQuestion
has title: How do I create an object in a JTabbedPane that accesses a class outside of the JTabbedPane?

http://stackoverflow.com/comment/41250378
type: AnswerComment
score: 0
type: Comment
has text: I have already tried firing the same request from a SOAPUI client and it works perfect. So i don't think it would be issue with the certificate itself. I am just figuring out on how to do the same from Jmeter.
comment on: http://stackoverflow.com/a/26288770

http://stackoverflow.com/q/26201842
has comment: http://stackoverflow.com/comment/41088578
type: UnansweredQuestion
has body: I am making a project in netbeans whose GUI I am creating using swing. I wanted to change the panels present in the frame when a button is clicked. For this to be achieved I am creating a class named Global which looks like this : public class Global { public static void changePane (final JPanel p) { MainFrame f = new MainFrame(); changePane(f, p); } public static void changePane(final JFrame f,final JPanel p){ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { f.getContentPane().removeAll(); f.setContentPane(p); f.repaint(); f.setVisible(true); } }); } } So there is a MainFrame class which has the main method which looks like: public static void main (String args[]) { Global.changePane(new MainPanel()); } And in the MainFrame there are few buttons / menuitems. The action performed method looks as follows private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) { Global.changePane(new addworkload()); } So when I am trying to replace the panel in the frame a new window opens. I want to prevent this from happening i.e. i want the panel to be replaced in the same window. Please help.
tagged with: swing
answer count: 0
tagged with: java
type: Question
has title: New window opening while changing JPanel present in the JFrame on Click of Button
score: 0
has comment: http://stackoverflow.com/comment/41087551

http://stackoverflow.com/a/26324786
answers question: http://stackoverflow.com/q/26324764
type: Answer
score: 1
has body: You haven't set the listener. Use this: ActionBar.Tab tab = actionBar.newTab(); tab.setText(R.string.hello_world); tab.setTabListener(this) actionBar.addTab(tab);
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/26269009
tagged with: listview
has title: BaseAdapter gets me only the first position in ListView Android
has comment: http://stackoverflow.com/comment/41212568
type: AnsweredQuestion
tagged with: baseadapter
tagged with: adapter
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26269388
type: Question
tagged with: android
has body: I've a major isse with an adapter to show every single row item in a ListView and I only get the first value of the index position. I've an array of comments from a webservice in android. It's an array inside an array. The main JSONArray it's "noticias" with has a lot of the previews jsonobject. Now: "comments" it's another array. This is my ContenidoNews.java class. I pass the "comment" array in a intent from the previews Activity: public class ContenidoNews extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener{ private ActionBar bar; String tituloDetail; String fullDetail; String imagenDetail; String permalink; String author; String authorimg; String dayofmonth; String month; String views; String totalcomments; String arraycomments; private SquareImageView mainPic; private CircularImageView authorpic; private TextView authors; private TextView contentTxt; private ScrollView scollMain; private TextView mainTxt; private Animation animSlideDown; private RelativeLayout relativeAnim; private RelativeLayout namereceipt; private Typeface texto; private Button btnshare; // Universal Image Loader private DisplayImageOptions options; private ImageLoader il = ImageLoader.getInstance(); private DisplayImageOptions opts; private File cacheDir; private String imgauthor; private TextView tvday; private TextView tvmonth; private Typeface textofat; private LinearLayout datestv; private WebView webview; private ArrayList links; private String urlscap; private String newstring; private String copyfull; private String youtube; private YouTubePlayerView youTubePlayerView; private String youtubeb; private String youtubec; private String youtubed; private TextView tvtotal; private TextView tvvisitas; private String youtubee; private String youtubef; private JSONArray arrayComment; ArrayList&lt;HashMap&lt;String, String&gt;&gt; arrayofcomments; private ListView listcomment; private ListAdapter adapter; private TextView numbcomment; private TextView tvcomment; static …
upvote count: 2
tagged with: java
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26269388

http://stackoverflow.com/q/26250994
has answer: http://stackoverflow.com/a/26261261
tagged with: many-to-many
tagged with: java
has body: I have many-to-many relation between Project and Document which is mapped that way: @LoadFetchGroup("documents") @ManyToMany(targetEntity = entity.Document.class, mappedBy = "projects", cascade = CascadeType.ALL) private List&lt;Document&gt; docs = new LinkedList&lt;Documents&gt;(); @ManyToMany(targetEntity = Project.class, cascade = CascadeType.ALL) @JoinTable(name = "Project2Doc", joinColumns = @JoinColumn(name = "DOCID", columnDefinition = "int", nullable = false), inverseJoinColumns = @JoinColumn(name = "PROJECTID", columnDefinition = "int")) private List&lt;Project&gt; projects = new LinkedList&lt;Project&gt;(); When I run the JUnit test, I get the NullPointerException from within the OpenJPA engine. This is the stack trace: org.apache.openjpa.persistence.PersistenceException: null at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1027) at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:926) at com.ibm.ws.persistence.kernel.WsJpaBrokerImpl.find(WsJpaBrokerImpl.java:188) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1033) at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.load(WsJpaJDBCStoreManager.java:143) at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280) at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2381) at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:274) at org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:60) at org.apache.openjpa.kernel.QueryImpl$PackingResultObjectProvider.getResultObject(QueryImpl.java:2075) at org.apache.openjpa.lib.rop.EagerResultList.(EagerResultList.java:36) at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1251) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1007) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794) at org.apa…
has title: NullPointerException in JDBCStoreManager.setInverseRelation when mapping @ManyToMany relation - finding out what's wrong?
upvote count: 0
tagged with: jpa
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -3
tagged with: openjpa
downvote count: 3
type: Question

http://stackoverflow.com/a/40621885
has body: The creators of the maven-webstart-plugin have accidentally inverted the meaning of the flag useUniqueVersions. When set to true it produces jars of the form -SNAPSHOT.jar and when set to false (the default) it produces jars of the form --.jar I found that setting the useUniqueVersions flag to true in the maven pom configuration produced my desired results. I needed it like this because when deployed with the datestamp version of the snapshots when trying to launch it I was getting a "Resource not found" error when it tried to get the snapshot jar it was trying to launch. Presumably this means that the servlet code itself is not set up to handle the different naming on disk, despite the fact that the specific datestamp version number does end up in the jnlp itself.
answers question: http://stackoverflow.com/q/26218820
score: 0
type: Answer

http://stackoverflow.com/comment/41265400
comment on: http://stackoverflow.com/a/26298195
has text: I have never tried, but browsing through the [configuration options](http://mojo.codehaus.org/jaxb2-maven-plugin/xjc-mojo.html), I don't see anything that leads me to believe this is possible. That's just from me skimming the guide. For all I know, it _may_ be possible. I mean theoretically you could use an absolute path from the project A, but I think that defeats the purpose of what you're trying to accomplish
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26218909
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26218950
has title: void type not allowed here in servlet
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26218943
has body: This is my java class : public String year, title,detail; public League(String year,String title,String detail) { this.year=year; this.title=title; this.detail=detail; } public void getTitle() { System.out.println(""+year+""+title+""+detail+""); } This is my servlet: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); //Creats the set of league leagueList=new LinkedList(); leagueList.add(new League("2003","Spring","Soccer League(Spring`03)")); leagueList.add(new League("2003","Summer","Summer Soccer Fest")); leagueList.add(new League("2003","Fall","Fall Soccer League")); leagueList.add(new League("2004","Spring","Summer Soccer Fest")); leagueList.add(new League("2004","Summer","Soccer League(Spring`03)")); leagueList.add(new League("2004","Fall","Fall Soccer League")); } This is my processRequest() method out.println("&lt;ul&gt;"); Iterator items=leagueList.iterator(); while(items.hasNext()){ out.println("&lt;li&gt;"+League.getTitle()+"&lt;/li&gt;"); } out.println("&lt;/ul&gt;"); Error is: League.getTitle(); //void type not allowed

http://stackoverflow.com/comment/41238462
type: Comment
score: 0
has text: For the time being our XML documents are edited and reviewed directly. Having another namespace and prefix there sometimes makes it more difficult, especially for people with less know how. JAXB also adds to the configuration file being too hard to read. We're in the process of switching the creation and editing of this file to be done solely by our application, but until then we'll unfortunately have to take this into consideration.
comment on: http://stackoverflow.com/a/26275991
type: AnswerComment

http://stackoverflow.com/comment/41241184
type: Comment
has text: I've read it several times it makes no sense what you are trying to do.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26284686

http://stackoverflow.com/q/26217654
has answer: http://stackoverflow.com/a/26221333
type: UnansweredQuestion
tagged with: spring
tagged with: parameters
tagged with: java
type: Question
has title: Specify the return type as a parameter for a function with generics
tagged with: jackson
score: 0
has body: I am struggling with generic parameters with function scope. Following is my function. public &lt;RES, REQ&gt; RES makePostRequest(String postRequest, REQ requestBody, Class&lt;RES&gt; type) { Response&lt;type&gt; resp = restTemplate.postForObject(postRequest, requestBody, Response.class); return resp.getBody(); } Jackson , the json library that does the deserialization needs the return type to be specified. Otherwise the response is not converted to the correct type. However, Response&lt;type&gt; is invalid. How does one take the RES as a parameter and specify it within Response&lt;RES&gt;? Note: I do not want to use restTemplate.exchange. I do not want to set all the http headers and create an http entity. I just want to specify the generic type through a parameter. Any help appreciated.
answer count: 1
tagged with: generics

http://stackoverflow.com/q/26200822
score: 1
tagged with: math
tagged with: java
type: Question
answer count: 1
tagged with: rounding-error
tagged with: floating-accuracy
upvote count: 1
accepted answer: http://stackoverflow.com/a/26200841
has title: Python and java package for floating point accuracy
has comment: http://stackoverflow.com/comment/41122878
favorite count: 0
has answer: http://stackoverflow.com/a/26200841
linked to: http://stackoverflow.com/q/20354423
has comment: http://stackoverflow.com/comment/41089137
tagged with: python
has body: During writing a program in python (the same in Java) I faced the following problem which I know it's because of rounding error. a = 0.3 b = 0.6; print(a+b) #returns 0.8999999999999999 which makes a+b==0.9 false I was wondering is there any package in python (and Java) which can make life easier for such situation and instead of defining an error bound in the application and checking it by yourself just import the package and it takes care of the rest. (like what happened to division in future package: http://legacy.python.org/dev/peps/pep-0238/) EDIT: So far(July 2016) as I know it's only Decimal class that you can use it. The problem is that I don't like the way that we should define every time Decimal class instead of just assigning the value for variable. I was just looking for a package that after importing , it takes care of the numbers and converted them to decimal automatically( like what happens in future package that after importing it takes care of division operation). anyhow I think the best solution for this problem so far is using Decimal in python and BigDecimal class in Java
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/41208671
type: Comment
comment on: http://stackoverflow.com/q/26264520
type: QuestionComment
has text: @nitind Use case is very obvious as I mentioned earlier. Actually The project I am working is legacy and quite big codebase. I need to work on a GUI method which update server / database. Now I don't know which method to change as I don't know where flow will hit server. Note : I know I can use profiler or stack trace but I am looking for some eclipse breakpoint solution.
score: 0

http://stackoverflow.com/a/26304550
answers question: http://stackoverflow.com/q/26302102
score: 3
accepted answer of: http://stackoverflow.com/q/26302102
upvote count: 3
has body: use the problem archive to find out which SRM or tournament the class was used in. http://community.topcoder.com/tc?module=ProblemArchive this will show you the top submissions from each of the acceptable programming languages. You can also use the summary button if you know which SRM the class is from but this does not guarantee that the solution you view is correct if the problem was an old one.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26250427
has body: That's a very uncommon requirement for a spring MVC controller, but spring is a very versatile tool. You can try this (untested ...) : @RequestMapping("/{name}.jsp") public ModelAndView jspHandler(@PathVariable("name") String name) { ... The controller will get all *.jsp requests and you will find in name variable the real name by which it has been called
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26249437
accepted answer of: http://stackoverflow.com/q/26249437
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/26419360
accepted answer of: http://stackoverflow.com/q/26345602
answers question: http://stackoverflow.com/q/26345602
type: Answer
has body: The first solution it's to create a temporary file and call the standard new ExifInterface(tempFile). I don't like it for inefficient Other solution is given here, but you have to make your APK bigger, by adding 3rd party code. The solution I've personally chosen is to rotate the image when it is captured to a temporary file, and then save it in a blog field of a Sqlite database. Then at view time, I don't need to handle the rotation, and the problem of not being able to read the EXIF headers, as I don't have a file.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26336520
tagged with: java
has comment: http://stackoverflow.com/comment/72109138
tagged with: mysql
has answer: http://stackoverflow.com/a/63621385
type: Question
has answer: http://stackoverflow.com/a/71250864
has answer: http://stackoverflow.com/a/26336586
has comment: http://stackoverflow.com/comment/41336047
accepted answer: http://stackoverflow.com/a/26336586
linked to: http://stackoverflow.com/q/804514
has title: java.sql.SQLException: Field 'supplier_id' doesn't have a default value
upvote count: 21
tagged with: sql
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/49276010
possible better answer: http://stackoverflow.com/a/26336624
has answer: http://stackoverflow.com/a/26336624
has body: I got an error message from this： java.sql.SQLException: Field 'supplier_id' doesn't have a default value 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:3277) at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1402) at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1317) Everyone can help me ? my database fields are not empty . but i want to get this results: insert into xxx(name,password)values('xxx','xxx'); and insert into xxx(name,password,man)values('xxx','xxx','xxx'); both success (both of that in client is success ,but in java code is error,error code at top title), instead of insert into xxx(name,password)values('xxx','xxx') is false; my mysql jar is mysql-connector-java-5.0.8
has answer: http://stackoverflow.com/a/37288980
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26336587
downvote count: 0
score: 21

http://stackoverflow.com/q/26288215
has answer: http://stackoverflow.com/a/26288715
answer count: 4
upvote count: 0
type: UnansweredQuestion
has title: Having trouble with a library book class java assignment
has answer: http://stackoverflow.com/a/35161816
tagged with: methods
has answer: http://stackoverflow.com/a/26288443
type: Question
has body: I have an assignment where I was given a pre-written driver program for a Date class and a LibraryBook class, and I have to write the classes so that they pass a bunch of checks in the driver program. My problem comes with one of the checks where it sees if I will be charged for returning a book on time. Obviously I should be charged $0 but for some reason my program says $15. Here's the method for calculating the fine: public double getFineAmount(Date dateReturned){ double fine; Date dueDate = this.getDueDate(); if(dateReturned.isOnOrBefore(dueDate)){ fine = 0.00; } else{ if(this.isFiction){ fine = 1.2 * dueDate.getDaysUntil(dateReturned); if(fine &gt; 15){ fine = 15.00; } } else{ fine = 1.5 * dueDate.getDaysUntil(dateReturned); if(fine &gt; 20){ fine = 20.00; } } } return fine; } When the date the book is borrowed is Feb. 10th, 2012 and the due date is March 2nd, 2012 for some reason the isOnOrBefore method returns false. Here is the isOnOrBefore method: public boolean isOnOrBefore(Date other){ boolean onOrBefore; Scanner sc = new Scanner(other.toString()).useDelimiter("-"); int otherDay = sc.nextInt(); int otherMonth = sc.nextInt(); int otherYear = sc.nextInt(); if(otherYear &gt;= this.year){ if(otherMonth &gt;= this.month){ if(otherDay &gt;= this.day){ onOrBefore = true; } else{ onOrBefore = false; } } else{ onOrBefore = false; } } else{ onOrBefore = false; } return onOrBefore; } I believe the problem is caused by a leap year but I don't see what's causing the error. Here's the code to detect a leap year in case it helps public boolean isLeapYear(){ boolean leapYear; if(this.year % 100 == 0){ if(this.year % 400 == 0){ leapYear = true; } else{ leapYear = false; } } else{ if(this.year % 4 == 0){ leapYear = true; } else{ leapYear = false; } } return leapYear; } I can post more of the code if needed.
tagged with: if-statement
tagged with: java
score: -1
downvote count: 1
tagged with: nested
has answer: http://stackoverflow.com/a/26288713
favorite count: 0

http://stackoverflow.com/a/26257038
accepted answer of: http://stackoverflow.com/q/26256558
answers question: http://stackoverflow.com/q/26256558
has body: You cannot create more than one JVM from the same process: As of JDK/JRE 1.2 , creation of multiple VMs in a single process is not supported. You may be able to attach your current thread to the existing JVM though using AttachCurrentThread function. See the docs for the Invocation API. The equivalent document in Java 15 simply states: Creation of multiple VMs in a single process is not supported. You will need a pointer to the JavaVM object. See if JNI_GetCreatedJavaVMs() can help you, I'm not sure if this is per-process (in which case it will only ever be a single element list) or per machine. In either case the JavaVM will have to be the one that the library is using or you probably will not be doing what you want. If you can access that then you should be able to make invocations on other objects in your Java application, but make sure that it is thread-safe.
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41153530
comment on: http://stackoverflow.com/a/26233035
type: AnswerComment
score: 0
type: Comment
has text: Hi maheeka, thank you for response. This set of codes actually works. But just wondering, if a key exists in a hashmap, does adding the same key to the hashmap overwrite the current key? Thanks!

http://stackoverflow.com/comment/41348156
comment on: http://stackoverflow.com/q/26342786
score: 0
type: Comment
type: QuestionComment
has text: java.io.IOException: Stream closed

http://stackoverflow.com/comment/41148132
has text: Not only that it will work, you can even create itemId, itemName and the rest as arrays. This way you can store everything from text file into array.
comment on: http://stackoverflow.com/a/26234401
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26249709
type: Question
has answer: http://stackoverflow.com/a/26249725
answer count: 1
has body: This is fine... public class someClass { private Set&lt;Element&gt; pre; public void someMethod() { pre.add(new Element()); } } But this isn't... public class someClass { public void someMethod() { Set&lt;Element&gt; pre; pre.add(new Element()); } } What's the correct syntax for the latter case without just turning it into the former?
tagged with: initialization
favorite count: 0
has title: How do I initialize a Set in Java?
upvote count: 8
linked to: http://stackoverflow.com/q/19041165
duplicate of: http://stackoverflow.com/q/19041165
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41177232
score: 7
tagged with: java
tagged with: set
tagged with: collections
has comment: http://stackoverflow.com/comment/41177143
downvote count: 1

http://stackoverflow.com/q/26297670
possible better answer: http://stackoverflow.com/a/26304443
upvote count: 5
answer count: 3
tagged with: dropwizard
has answer: http://stackoverflow.com/a/26354759
accepted answer: http://stackoverflow.com/a/26354759
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26304443
has answer: http://stackoverflow.com/a/31405835
type: AnsweredQuestion
has body: Does anyone know how to get the same information, about what paths are used, like at the start of dw application. I mean the output after this line: io.dropwizard.jersey.DropwizardResourceConfig: The following paths were found for the configured resources: GET /path/of/res/test (this.is.the.class.package.info.MyRessource) POST /path/of/res/test2 (this.is.the.class.package.info.MyRessource2) I have to check if specific path exists.
tagged with: java
has title: Dropwizard Path: Get all paths in app
type: Question
score: 5

http://stackoverflow.com/comment/41266690
score: 0
type: Comment
has text: How about you add that code to your question then? Plus further examples that show the possible alternations that you mentioned.
type: AnswerComment
comment on: http://stackoverflow.com/a/26298857

http://stackoverflow.com/comment/41235042
score: 2
has text: http://stackoverflow.com/questions/3083781/start-and-end-date-of-a-current-month check the 2nd answer
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26281417

http://stackoverflow.com/q/26234720
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I try to use Spring Batch in JSR 352 mode in Websphere. (Websphere 8.0, Spring Batch 3.0.1) As far as I understand the documentation, spring should handle the transactions, i.e. begin a transaction before calling the ItemReader of a step, committing the transactions after calling the ItemWriter, etc. However, in my case no transaction is active when the ItemReader is called (userTransaction.getStatus() == 6). My code works if I start the transaction myself in the itemReader, but my understanding is that I shouldn't have to do that. I suspect the problem is in the way I set up my batch. This is a sample code that shows the problem: META_INF/batch.xml: <?xml version="1.0" encoding="UTF-8"?> <tx:jta-transaction-manager /> META-INF/batch-jobs/samplebatch3.xml: <?xml version="1.0" encoding="UTF-8"?> <reader ref="my.jbatchtest.samplebatch3.SampleReader" /> <processor ref="my.jbatchtest.samplebatch3.SampleProcessor"/> <writer ref="my.jbatchtest.samplebatch3.SampleWriter" /> The ItemReader: package my.jbatchtest.samplebatch3; import java.io.Serializable; import javax.batch.api.chunk.ItemReader; import javax.naming.InitialContext; import javax.transaction.UserTransaction; import org.xadisk.connector.outbound.XADiskConnectionFactory; public class SampleReader implements ItemReader { private UserTransaction utx; public SampleReader() { // TODO Auto-generated constructor stub } @Override public void open(Serializable checkpoint) throws Exception { utx = (UserTransaction) new InitialContext().lookup("jta/usertransaction"); System.out.println("Status before begin:"+utx.getStatus()); utx.begin(); System.out.println("Status after begin:"+utx.getStatus()); } @Override public void close() throws Exception { // TODO Auto-generated method stub } @Override public Object readItem() throws Exception { // TODO Auto-generated method stub return null; } @Override public Serializable checkpointInfo() throws Exception { // TODO Auto-generated method stub return null; } } The debugging output f…
tagged with: websphere-8
tagged with: spring-batch
has answer: http://stackoverflow.com/a/28029931
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26252253
has answer: http://stackoverflow.com/a/26252253
has title: JSR 352 Spring Batch: Transaction Management
has answer: http://stackoverflow.com/a/27789994
accepted answer: http://stackoverflow.com/a/28029931
type: AnsweredQuestion

http://stackoverflow.com/comment/41187533
type: QuestionComment
has text: thats really significant difference textfield and JTextComponents, for plain (JTexField/Area) is valid answer by @MadProgrammer for rest is different, and type by type
comment on: http://stackoverflow.com/q/26255534
score: 0
type: Comment

http://stackoverflow.com/comment/41247372
comment on: http://stackoverflow.com/q/26287842
type: Comment
type: QuestionComment
score: 0
has text: Well i tried making a method where i could send a message to the server like this - public void msgServer(String a, String b) { but i couldn't figure out how to make it send the message to the server.

http://stackoverflow.com/a/26286928
downvote count: 0
has body: The problem is that the Leibniz series for computing π converges EXTREMELY slowly. Using your program, I found that after 3663 iterations (when I killed the program), the values looked like this: pi=3.141865802997432 pi=3.1413195787723875 pi=3.1418656538577117 pi=3.1413197278306884 Still only 3 decimal places, and it is going to take a long time even to be accurate to 4. The stack is not big enough to hold so many recursive calls, and eventually it will overflow.
type: Answer
answers question: http://stackoverflow.com/q/26286746
upvote count: 5
score: 5

http://stackoverflow.com/q/26284573
has answer: http://stackoverflow.com/a/26284759
score: 1
tagged with: java
has title: Read IMDb cast for a title
type: Question
has body: So I am a VERY beginner-level Java developer - really, I am still in the process of learning Java. Don't have experience or training with other languages yet. For a purely personal project that no one else would ever see or touch, I am trying to write a program that, given a particular title, will read cast info from IMDb. I would like to pull the IMDb nm codes for each person in the cast, and, ideally, their names as well (but the nm codes are more important). (Every person in IMDb has a nm code used in their URL - e.g., http://www.imdb.com/name/nm0000620/ is the IMDb page for Mickey Rourke; so his unique IMDb ID is nm0000620.) I would ultimately like to export that data into a spreadsheet, but I'm not too worried about that step for now. I will NEVER be building this into any type of web or smartphone interface. I just want the data, and would like to write a Java program to get it to save me time in looking it up myself, title by title. I found info on the web about generally reading text from a URL and was playing with that, but hit a wall when testing it. Then I started Googling specifically about IMDb, and am finding lots of info, but a lot of it is not easy for me to understand or decipher, the newbie that I am. I have both Eclipse and BlueJ installed and do my work in those. Now, I fully understand and accept that (1) I may just have to spend more time researching and understanding the available options on my own, from my web search results; and (2) I may need to further my own Java learning and development before I can feasibly finish working on this project. If that's the case, so be it, I will move on and trudge through, no biggie. (I also understand that IMDb has its own rules and licenses in place about reading its data. I will work with some other database (OMDb, or Rotten Tomatoes, or something) if I need to, I just prefer IMDb because that's what I've been using so far (in a more manual way, not in Java).) However, if there is already some Java code …
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: imdb

http://stackoverflow.com/a/26829344
has body: The following code checks for the availability of a front camera: private Camera openFrontFacingCameraGingerbread() { int cameraCount = 0; Camera cam = null; Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); cameraCount = Camera.getNumberOfCameras(); for (int camIdx = 0; camIdx &lt; cameraCount; camIdx++) { Camera.getCameraInfo(camIdx, cameraInfo); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { try { cam = Camera.open(camIdx); } catch (RuntimeException e) { Log.e(TAG, "Camera failed to open: " + e.getLocalizedMessage()); } } } return cam; } Then add the following permissions in the AndroidManifest.xml file: &lt;uses-permission android:name="android.permission.CAMERA" /&gt; &lt;uses-feature android:name="android.hardware.camera" android:required="false" /&gt; &lt;uses-feature android:name="android.hardware.camera.front" android:required="false" /&gt; Note: This feature is available in Gingerbread(2.3) and Up Android Version. I recommend using surfaceView like in this example to implement a working flashlight. Hope this helps :)
has comment: http://stackoverflow.com/comment/42226070
has comment: http://stackoverflow.com/comment/42225990
has comment: http://stackoverflow.com/comment/42226129
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/42226348
downvote count: 1
has comment: http://stackoverflow.com/comment/42226172
type: Answer
answers question: http://stackoverflow.com/q/26202403
has comment: http://stackoverflow.com/comment/42226032

http://stackoverflow.com/a/33121698
type: Answer
answers question: http://stackoverflow.com/q/26223723
has body: You're making life way too hard for yourself. Java already does reflection for you. class Parent { // class content } class ChildA extends Parent { // class content } class ChildB extends Parent { // class content } Parent firstInstance = new ChildA(); Parent secondInstance = new ChildB(); Class typeOfFirst = firstInstance.getClass(); Class typeOfSecond = secondInstance.getClass(); As for your null pointer error, in Java (Unlike c++ for example) you have to explicitly initialise every variable with new. Just having private T model; doesn't create an instance of it.
score: 0

http://stackoverflow.com/comment/41286155
has text: @Pshemo Both valid points. I edited my answer and credited the edits to you.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26308927
type: Comment

http://stackoverflow.com/a/26252602
has body: items_array is a List&lt;String&gt;, so as you call Arrays.asList(items_array), which you call on arrays normaly you will get a List of your List List&lt;List&lt;String&gt;&gt;, this wont work ;D Try using a foreach loop to search your list, or if you use java 8 use .stream() e.g. items_array.stream().filter(o -&gt; o.mLastID == receive_lastid).findFirst().get() And read some about clean code maybe, your public vars + getters seem strange to me. edit: or just use contains()....
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26252506
score: 1
upvote count: 1

http://stackoverflow.com/a/26265036
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41205282
has comment: http://stackoverflow.com/comment/41205148
upvote count: 2
has body: This will do what you want: String[] words = str.split("\\s+"); StringBuilder temp = new StringBuilder(); for (String word : words) temp.append(word).append("\0");
downvote count: 0
has comment: http://stackoverflow.com/comment/41206305
answers question: http://stackoverflow.com/q/26264985

http://stackoverflow.com/q/26316918
has comment: http://stackoverflow.com/comment/41300053
score: 0
has comment: http://stackoverflow.com/comment/41300018
has comment: http://stackoverflow.com/comment/41300131
has title: Straighten-Out 2's Complement
tagged with: integer
type: UnansweredQuestion
has body: If I have a byte[] of length n, containing the 2's complement representation of some n-byte integer, how do I get a byte[] of same length with a "straight" representation of the number? Is this even possible, given how there are more negative than positive integers representable with 2's complements? By "straight" representation I mean something that will continuously map the integer range to some range of bytes, without jumps, holes, etc. e.g. for the 1-byte integer -128, the two's complement representation is 1000 0000 for the 1-byte integer -1, the two's complement representation is 1111 1111 for the 1-byte integer 0, the two's complement representation is 0000 0000 for the 1-byte integer 1, the two's complement representation is 0000 0001 for the 1-byte integer 127, the two's complement representation is 0111 1111 What I'm looking for is something to convert above values into something like this: for the 1-byte integer -128, the "straight" representation would be 0000 0000 for the 1-byte integer -1, the "straight" representation would be 0111 1111 for the 1-byte integer 0, the "straight" representation would be 1000 0000 for the 1-byte integer 1, the "straight" representation would be 1000 0001 for the 1-byte integer 127, the "straight" representation would be 1111 1111 Is there any proper name for what I've dubbed "straight" representation here? I'd prefer Java in the solutions, but any other easily/intuitively understandable language or pseudocode is ok too. (Is there anything special to be wary of in this conversion, since Java doesn't have unsigned bytes?)
tagged with: bit-manipulation
has comment: http://stackoverflow.com/comment/41300190
answer count: 0
tagged with: twos-complement
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41300074

http://stackoverflow.com/q/26282487
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41240541
tagged with: java
has comment: http://stackoverflow.com/comment/41240196
has body: i'm trying to display a CSV file in HTML form, I decided to use CSVToTable jquery but if there's an easier way to do it please let me know. I read that i cannot just ask user to pick their file and then render it, i have to first load the file to the server, so I added a jsp page to get the file and i wrote an Struts Action class to get the file. loadFile.jsp: &lt;form name="myForm" method="POST" action="/importAction.do" enctype="multipart/form-data"&gt; &lt;input id='fileId' type='file' name='attachmentFile' value='' maxlength='255'/&gt; &lt;input type="submit" value="Submit"/&gt; &lt;/form&gt; My importAction Action class: public ActionForward doAction(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { //how do i get the file and output this to the jsp? return mapping.findForward("renderCSV"); } I also have a target JSP with the following: renderCSV.jsp: &lt;div id="CSVTable"&gt;&lt;/div&gt; &lt;script&gt; $(function() { $('#CSVTable').CSVToTable('test.csv'); }); &lt;/script&gt; So the two questions from the above code is: 1) How do I retrieve this file from the JSP in my java class to pass it to the JSP that will render it? 2) In the renderCSV.jsp How do I pass the file I got in my action class into CSVToTable? right now i have 'test.csv' as a placeholder. I'm open to other sugestions too. Thanks in advance for the help.
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26285372
has title: How to convert CSV to HTML table from java
tagged with: javascript
tagged with: struts
score: 0
answer count: 1
tagged with: jquery

http://stackoverflow.com/comment/41353812
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26329714
has text: I figured it out, I had a bracket in the wrong place!
type: Comment

jaxb
tags question: http://stackoverflow.com/q/26206436
tags question: http://stackoverflow.com/q/26298935
tags question: http://stackoverflow.com/q/26334733
tags question: http://stackoverflow.com/q/26271526
tags question: http://stackoverflow.com/q/26338989
tags question: http://stackoverflow.com/q/26234254
tags question: http://stackoverflow.com/q/26261495
tags question: http://stackoverflow.com/q/26233403
tags question: http://stackoverflow.com/q/26250443
tags question: http://stackoverflow.com/q/26286055
tags question: http://stackoverflow.com/q/26267272
tags question: http://stackoverflow.com/q/26303506
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/26306894
tags question: http://stackoverflow.com/q/26330281
tags question: http://stackoverflow.com/q/26296654
tags question: http://stackoverflow.com/q/26348480
tags question: http://stackoverflow.com/q/26212541
tags question: http://stackoverflow.com/q/26195350
tags question: http://stackoverflow.com/q/26325201
tags question: http://stackoverflow.com/q/26342919
tags question: http://stackoverflow.com/q/26232916
tags question: http://stackoverflow.com/q/26274407
tags question: http://stackoverflow.com/q/26301505

http://stackoverflow.com/a/26209464
score: 3
downvote count: 0
has body: Imagine that you have this piece of code: double x = pi/6; double y = sin(x); y would then be 0.5. Now suppose that x is cast as an integer as follows: int x = pi/6; double y = sin(x); In this case x would be truncated to 0, and then the sin(0) would be taken, i.e. y = 0. This is the primary reason why implicit conversion from double to int is not implemented in a lot of strong-typed languages. The conversion of int to double actually increases the amount of information in the type, and can thus always be done safely.
answers question: http://stackoverflow.com/q/26209405
upvote count: 3
type: Answer

http://stackoverflow.com/q/26291265
answer count: 1
has answer: http://stackoverflow.com/a/26291390
score: 0
has title: Fetching annotations field from Method class
tagged with: android
has body: I'm trying to fetch the annotations field from Method class in Android Sdk 19 and jdk 1.7. But the code below is throwing NoSuchFieldException. But I could find the exact field in Method.java file. Field field = Method.class.getDeclaredField("annotations");
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/q/26317766
type: Question
has title: When is the Swing UI thread created?
answer count: 1
downvote count: 0
has body: When, in the process of running a Swing program, is the UI thread (event-dispatch thread, EDT) first spawned? Presumably any given JVM could do whatever it wants (for example, always spawning the EDT at start-up, whether or not it's ever used), but as a practical matter when is the EDT typically created? Does it get created when SwingUtilities.invokeLater() is first called? When a JPanel is first instantiated? And if the event pump is started separately from creating the EDT, when does that typically happen?
favorite count: 0
has answer: http://stackoverflow.com/a/26319685
tagged with: event-dispatch-thread
tagged with: swing
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26319685

http://stackoverflow.com/q/26200371
score: 2
tagged with: java
has body: i have a class, Bitmap,which simply contains a pixel array of rgba values, I've searched all over the internet for an answer to no avail. How could i create a function called, say; private int[] pixels; private int width; private int height; /** *Rotates this image around (x, y) by theta degrees */ public void rotate(int theta, int x, int y){ // Code to rotate 1D array here }
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/41089498
has title: How do i programatically rotate a bitmap image stored as a 1D array?
answer count: 2
has comment: http://stackoverflow.com/comment/41089432
has comment: http://stackoverflow.com/comment/41089316
favorite count: 0
has comment: http://stackoverflow.com/comment/41085708
has comment: http://stackoverflow.com/comment/41084986
has answer: http://stackoverflow.com/a/26200764
has comment: http://stackoverflow.com/comment/41084984
has answer: http://stackoverflow.com/a/26202982
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41085105
tagged with: bitmap

http://stackoverflow.com/comment/41254701
has text: Why do you want to use switch?
comment on: http://stackoverflow.com/q/26292266
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41166594
has text: Hello Serge, I changed the "namespace, method, soap action", and not resolved, remains the exception in method ".call ()"
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26227999
type: AnswerComment

http://stackoverflow.com/q/26281958
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/26282109
score: 0
answer count: 1
has body: It is common practice to map the same entity twice or even thrice, every time with a subset of columns needed for processing. I have found that with Hibernate 3.5.1, every time a @ManyToOne or a @OneToMany exists in two entities mapping the same table, the foreign key is created twice. This has no impact on MySQL and SQL Server, but Oracle refuses the second creation statement. Here is an example: @Entity @javax.persistence.SequenceGenerator(name = "SEQ_STORE", sequenceName = "SEQ_ENTITY") @Table(name = "ENTITIES") class Entity { //All columns //And then..... @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "BRIDGE_TABLE", joinColumns = { @JoinColumn(name = "ENTITY_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") }) @OrderBy("id DESC") private Set&lt;Role&gt; roles = new HashSet&lt;Roles&gt;(); } @Entity @javax.persistence.SequenceGenerator(name = "SEQ_STORE", sequenceName = "SEQ_ENTITY") @Table(name = "ENTITIES") class EntityListItem { //Only a subset of the previous columns //And then..... @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "BRIDGE_TABLE", joinColumns = { @JoinColumn(name = "ENTITY_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") }) @OrderBy("id DESC") private Set&lt;Role&gt; roles = new HashSet&lt;Roles&gt;(); } Currently, Role is designed not to be navigable to Entity (otherwise I guess there will be 4 foreign keys). Here are the statement being issued by Hibernate: create table BRIDGE_TABLE (ENTITY_ID number(19,0) not null, ROLE_ID varchar2(60 char) not null, primary key (ENTITY_ID, ROLE_ID)); //Creates the table alter table BRIDGE_TABLE add constraint FK47CFB9F0B068EF3F foreign key (ENTITY_ID) references ENTITIES; alter table BRIDGE_TABLE add constraint FK47CFB9F0B068EF3F foreign key (ENTITY_ID) references ENTITIES; I'm not sure whether this is a Hibernate bug. We cannot currently move to Hibernate 4. Can be this fixed via code or does it need a new Hibernate version?
accepted answer: http://stackoverflow.com/a/26282109
type: AnsweredQuestion
has title: Double-foreign-key in Hibernate when mapping the same entity twice

http://stackoverflow.com/comment/41245692
score: 0
type: Comment
type: QuestionComment
has text: How your java parameters are set up? I mean such options like: -Xms -Xmx and so on.
comment on: http://stackoverflow.com/q/26285133

http://stackoverflow.com/q/26210993
score: 1
tagged with: java
tagged with: servlets
type: Question
answer count: 2
has title: How to call GET/POST method programatically using spring
favorite count: 0
has comment: http://stackoverflow.com/comment/41104846
has comment: http://stackoverflow.com/comment/41104723
has answer: http://stackoverflow.com/a/26211836
has comment: http://stackoverflow.com/comment/41104964
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26212333
has comment: http://stackoverflow.com/comment/41105259
tagged with: spring
downvote count: 1
has comment: http://stackoverflow.com/comment/41104878
has body: I want to call GET/POST method programatically from within the java class using Spring. I have done this stuff in Servlet class before but I am not clear how to do this with spring. I went through some related tutorials but I am still not cleared. Can any one please explain how to do this? Thanks.
has comment: http://stackoverflow.com/comment/41105127
tagged with: spring-mvc

http://stackoverflow.com/comment/41229348
score: 0
has text: I gave this question a down-vote, since I feel this strays beyond the type of theoretical questions that are welcome here into the *not useful* category. I think we all agree such code won't be written "for real", so having various people chew over it for a while to see what it means doesn't seem like a great idea.
type: Comment
comment on: http://stackoverflow.com/q/26278452
type: QuestionComment

http://stackoverflow.com/a/26277233
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26275503
downvote count: 0
answers question: http://stackoverflow.com/q/26275503
has body: The agent jar is run once when you call loadAgent. The agentmain method of the agent class specified by the Agent-Class attribute in the JAR manifest is invoked. The class is actually loaded once, except if you have done some optimization to unload classes. So if you call loadAgent multiple time on the same jar, the classes would not be reloaded but the Agent_OnAttach (agentmain) might be called multiple time. Actually it's platform specific and depends on the JVM implementation. The loadAgent method calls loadAgentLibrary which calls Agent_OnAttach which is platform specific References : VirtualMachine API java.lang.instrument JVMTI HotSpotVirtualMachine#loadAgent(String, String) source code (The HotSpot implementation of com.sun.tools.attach.VirtualMachine), take a look in hierarchy tab to see the BSD, Linux, Solaris and Windows implementation. These classes end up calling native methods. You can find them if you download openJDK source for example for windows, it will use jdk\src\windows\native\sun\tools\attach\WindowsVirtualMachine.c file

http://stackoverflow.com/a/26318095
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26317982
type: Answer
has body: I believe you were to make an enum for the 3 possible toppings and then treat them as an enum instead of as a string. this way to "iilegal" values can be given to your constructors (for example "asdasd" as a topping which you clearly don't want to get). you should search up enum and read about it if you have no idea when I'm talking about but in general the very basic syntax is: enum E { A, B, C } then I can use it as a type (just like int, String etc). for example: public void foo(E e) { //do something } and this function will only get a variable of type E as a parameter, which can be either A, B or C which we have defined. you got the methods you need to implement interface (that means - their name, parameters, and return value type). use these as your code structure and implement the code according to it. And on a side node, making class data members public is very bad practice is most cases. Allways make them private unless you are 100% sure of what you're doing. Making then privates prevent unwanted and unmonitored changes to your instance variables

http://stackoverflow.com/a/26341603
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26332051
downvote count: 1
type: AcceptedAnswer
score: 0
has body: According to the statement by Dave Syer in the recent version of spring boot the best way to configure the spring security is with Java configuration. I needed an SHA-256 encoder, but I haven't find any simple and good solution for implementing one. You just need to configure the jdbcAuthentication with the passwordEncoder. This is really really simple: @EnableWebSecurity public class SpringSecurityConfigurer extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login").setViewName("login"); } @Bean public ApplicationSecurity applicationSecurity() { return new ApplicationSecurity(); } @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter { @Autowired private SecurityProperties security; @Autowired private DataSource dataSource; @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/css/**").permitAll().anyRequest().fullyAuthenticated() .and().formLogin().loginPage("/login").failureUrl("/login?error").permitAll() .and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/login"); } PasswordEncoder sha256PasswordEncoder = new PasswordEncoder() { @Override public String encode(CharSequence rawPassword) { return Hashing.sha256().hashString(rawPassword, Charsets.UTF_8).toString(); } @Override public boolean matches(CharSequence rawPassword, String encodedPassword) { return encodedPassword.equals(Hashing.sha256().hashString(rawPassword, Charsets.UTF_8).toString()); } }; @Override public void configure(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication() .dataSource(this.dataSource) .passwordEncoder(sha256PasswordEncoder); } } }
answers question: http://stackoverflow.com/q/26332051

http://stackoverflow.com/q/26203175
tagged with: eclipse-jdt
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26204139
accepted answer: http://stackoverflow.com/a/26204139
tagged with: eclipse-plugin
upvote count: 1
answer count: 1
favorite count: 0
has title: Eclipse Plug-in: Content Assist Proposal Info with HTML Format
has body: I'm extending eclipse jdt's content assist, and I wrote a class that implements IJavaCompletionProposalComputer, and my code is like the following: final static String[] fgProposals = { "A", "B" }; final static String[] fgInfo = { "A_info", "B_info" }; @Override public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) { ICompletionProposal[] result = new ICompletionProposal[fgProposals.length]; for (int i= 0; i < fgProposals.length; i++) { IContextInformation info = new ContextInformation("AA", "BB"); result[i]= new CompletionProposal( fgProposals[i], context.getInvocationOffset(), 0, fgProposals[i].length(), null, fgProposals[i], info, fgInfo[i]); } return Arrays.asList(result); } However, the additional info (the window at the right of the selected proposal) ignores html tags and just shows plain text. My question is the same as this topic: HTML Formatting in Editor ContentAssit I've read this, but I can't understand the explanation they said. Could anyone tell me how to solve this question with a clearer explanation? A simple code snippet will help a lot!! Thanks.
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/41282170
comment on: http://stackoverflow.com/a/26306888
has text: @benz: I mean the other way around, converting the ordinal number to number. Have edited my post.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26344640
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/41350835
has answer: http://stackoverflow.com/a/26344704
type: Question
has title: Eclipse reading wrong import on start up
has comment: http://stackoverflow.com/comment/41350947
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/41350909
possible better answer: http://stackoverflow.com/a/26344920
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26344920
accepted answer: http://stackoverflow.com/a/26344704
has body: When ever I started Eclipse a maven project called always has an error - Its kinda hard to explain - see the image
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41350865

http://stackoverflow.com/a/26256309
has comment: http://stackoverflow.com/comment/41188972
score: 0
has body: You can convert Bitmap to String with Base64 Try this ... public String convertBitmapToString(final Bitmap pBitmap){ final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); pBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); final byte [] bytes = byteArrayOutputStream.toByteArray(); final String string = Base64.encodeToString(bytes, Base64.DEFAULT); return string; } Or if you can't use base64, try this try { String s = new String(baos.toByteArray(), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
answers question: http://stackoverflow.com/q/26255670
type: Answer

http://stackoverflow.com/a/26256521
has body: I'd suggest using Eclipse and the JDT, creating a plugin that piggy-backs onto them to do this using the AST...
answers question: http://stackoverflow.com/q/26256496
downvote count: 0
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41188821

http://stackoverflow.com/q/26225141
has comment: http://stackoverflow.com/comment/41132695
answer count: 1
tagged with: runtime.exec
tagged with: java
accepted answer: http://stackoverflow.com/a/26225200
linked to: http://stackoverflow.com/q/26100501
downvote count: 0
has title: Java Runtime.exec communictation possible?
type: AnsweredQuestion
has body: I have a main java program which should launch other java programs in an own process using Runtime.exec(), e.g. Runtime.exec("java -jar myapp.jar"); Is there a possibility to communicate with this new process, e.g. sending request, chaing fields...? How can I shutdown this new created process? I think I get an handler back and thus can kill the process. But is there a nicer way? If I kill the process, will the shutdownhook still be executed before the process is killed? Runtime.getRuntime().addShutdownHook
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26225200
has comment: http://stackoverflow.com/comment/41132683
type: Question
tagged with: process
upvote count: 1

http://stackoverflow.com/q/26340890
type: Question
tagged with: java
has title: gradle set external classpath
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26340999
has body: I'd like to share the classpath created by gradle with an external application (VIM) by exporting the classpath to $CLASSPATH. I've tried doing this in the shell via calling gradle and setting the variable but there is a bunch of extra output that makes this cumbersome. I've also looked at shelling commands via the gradle script but this seems to create a new shell instance and therefore doesn't affect env variables of the current shell. Does anyone have any experience accomplishing this? Thanks for the help! I think an example would help to clarify: task classpath { classpathcmd = "export CLASSPATH=" + sourceSets.test.runtimeClasspath.asPath // Prints too much extra text println classpathcmd // Executes command in another shell instance so the variable is "lost" exec { executable = "sh" args = classpathcmd } // Stracktrace because of file not found exception exec { commandLine classpathcmd } }
has answer: http://stackoverflow.com/a/26340999
type: AnsweredQuestion
tagged with: gradle
tagged with: classpath

http://stackoverflow.com/comment/41310566
has text: And what did prevent you from posting that important information inside the question?
comment on: http://stackoverflow.com/q/26322827
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41120541
has text: The reason I mentioned that is that in Table 4, just below the statements that the OP mentioned, the caption talks of "bits reserved for future use". So Sun/Oracle definitely think of future use cases when designing their specifications.
comment on: http://stackoverflow.com/a/26215441
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26304301
tagged with: filenet
has answer: http://stackoverflow.com/a/26321324
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41330654
upvote count: 1
tagged with: filenet-p8
score: 1
tagged with: java
tagged with: jboss
type: Question
has title: JBoss Heap Space issue Due to Image Uploads
downvote count: 0
answer count: 1
has body: We have a web application in which users are uploading hundreds of images via the web. The application then takes these images and moves them off to storage (in FileNet). The issue we are seeing is that the heap space is eventually filling up and the application is crashing. It seems for some reason these images are not being cleaned up via Garbage Collection even though they aren't being referenced anymore. We have used AppDynamics on our Jboss servers to monitor and check for memory leaks. So far, we haven't found any. Any suggestions on what we should be looking for in addition?
favorite count: 0

http://stackoverflow.com/comment/41367523
comment on: http://stackoverflow.com/a/26331052
has text: So, after much mucking about, I was finally about inspect you Gifs `disposalMethod` and it's set to `restoreToPrevious` where as the Gif in my anser is set to `restoreToBackgroundColor`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41201717
score: 2
has text: +1. However, playing devil's advocate, I think the correct answer would actually be "Either 3 or 4, depending on implementation". Although the JLS states primitive values between -128 and 127 must always be interned and thus the same object, it also states "Ideally, boxing a given primitive value p, would always yield an identical reference." So a given compliant JVM implementation could easily cause those `Long` values to be the same object, and in this case only three actual objects would be eligible for collection!
comment on: http://stackoverflow.com/a/26263361
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26345131
has answer: http://stackoverflow.com/a/26346130
has answer: http://stackoverflow.com/a/26345372
has answer: http://stackoverflow.com/a/61973506
has comment: http://stackoverflow.com/comment/41351806
type: UnansweredQuestion
tagged with: error-handling
has answer: http://stackoverflow.com/a/28390489
has title: Eclipse IDE - Error: Build path specifies execution environment Java SE 1.7
tagged with: java
has answer: http://stackoverflow.com/a/33474849
tagged with: eclipse
type: Question
upvote count: 27
downvote count: 0
has answer: http://stackoverflow.com/a/53906545
linked to: http://stackoverflow.com/q/23135863
has body: In Eclipse, I am getting an error: Build path specifies execution environment Java SE 1.7. There are no JREs installed in the workspace that are strictly compatible with this environment.
has answer: http://stackoverflow.com/a/45521924
score: 27
answer count: 11
favorite count: 0
has answer: http://stackoverflow.com/a/53115294
has answer: http://stackoverflow.com/a/76187653
has answer: http://stackoverflow.com/a/71353710
has comment: http://stackoverflow.com/comment/41351816
has answer: http://stackoverflow.com/a/68628726

http://stackoverflow.com/a/26222825
answers question: http://stackoverflow.com/q/26222698
has body: Without Java 8, you do have to use loops. using addAll(..) does get rid of one of them though. public ArrayList&lt;Integer&gt; getList(){ ArrayList&lt;Integer&gt; result = new ArrayList&lt;Integer&gt;(); for(ArrayList&lt;Integer&gt; i : list_){ result.addAll(i); } return result; } Also, generic types such as ArrayList must be object types, hence Integer, not int.
accepted answer of: http://stackoverflow.com/q/26222698
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41190178
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/26196010
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26195268
accepted answer of: http://stackoverflow.com/q/26195268
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41078447
upvote count: 1
has body: I am printing current Date and Time for you using java.util.Date : import java.util.Date; //importing this package just to use Date() public class StackOverflowQ { public interface CallBackInt{ String doJob(String str); } public static void main(String[] args) { CallBackInt variable = new CallBackInt(){ //using the interface public String doJob(String str) { //doJob method from interface return (str + new Date().toString()); //used .toString() as return type of doJob is String } }; while (true) { //infinite loop System.out.println(variable.doJob("Current Date Instance is: ")); try { Thread.sleep(60*1000); //time is in miliseconds and 60*1000 mili sec=60 seconds = 1 minute } catch (InterruptedException e) { //if there are any Exception thrown, this will catch it and help you ! e.printStackTrace(); } } } } And, thread is a thread of execution in any program. Any process that is currently in execution can be treated as a thread. So, here in this program Thread.sleep refers to the current thread (which is main() method currently). So it pauses the main() thread for 60 seconds and resumes it after the pause and then again prints the current Date.
has comment: http://stackoverflow.com/comment/41078248
has comment: http://stackoverflow.com/comment/41078829
has comment: http://stackoverflow.com/comment/41078852

http://stackoverflow.com/comment/41310767
comment on: http://stackoverflow.com/a/26322957
score: 0
type: AnswerComment
has text: where do you see a 20 by 2 matrix? the first item in each par represents the row number, the second value in each pair represents the column number.
type: Comment

http://stackoverflow.com/a/26265720
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41206570
type: AcceptedAnswer
has body: During Session flush the DML operation order is: inserts updates deletions of collections elements inserts of the collection elements deletes So, even if you remove the element and add a new one, the insert will run before the delete, hence throwing the constraint violation exception. To make it work, you need to manually flush, after the remove and before you add the new element back into the children collection: a.removeChild(b); session.flush(); a.addChild(ba); The remove/addChild are utilities setting both sides of the bi-directional association, if that's the case in your domain model.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26265539
has comment: http://stackoverflow.com/comment/41214643
answers question: http://stackoverflow.com/q/26265539
type: Answer

http://stackoverflow.com/q/26289879
has comment: http://stackoverflow.com/comment/41251010
answer count: 1
downvote count: 0
tagged with: clock
favorite count: 0
has title: Looking up the system clock -- Java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26289956
has body: From within my thread, I'm supposed to one thing every x seconds. Eg. let x=3, and it should do that thing at seconds 1, 4, 7, ... . Making the thread wait() for x seconds wouldn't do-- because it may be interrupted for other thing(s) to do during this x second period and thus can't keep track of the time passing in between the way it is supposed to. So, the thread should come up with an efficient way of getting itself know that x seconds has passed on the clock. What's the efficient way of doing that? The only way I have now is keep checking the system clock to find out whether it's second 1, or 4, or 7, i.e. second i where i%3==1. However, this is too wasteful and isn't any good. What's the best way of doing this? TIA. //==================== EDIT: I think it would me a method that looks up the system clock and interrupts me at every interval. Does Java have a method like this somewhere?
tagged with: multithreading
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41251083
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26289956

http://stackoverflow.com/q/26229803
favorite count: 0
has answer: http://stackoverflow.com/a/26229831
has title: Getting control back to main program in java while using thread
score: 2
upvote count: 2
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26229831
type: AnsweredQuestion
tagged with: java
has body: I'm invoking thread.In that thread there is while(true) condition because of that I'm not able to execute next thread. Snippet is here ASubscriber aSubscriber=new ASubscriber(); aSubscriber.run(); System.out.println("Starting Subscriber Thread"); BSubscriber bSubscriber=new BSubscriber(); bSubscriber.run(); In each of run method of ASubscriber and Bsubscriber has below Code : @Override public void run() { while (true) { //I'm going some task } }
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/a/26222982
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41127509
score: 3
accepted answer of: http://stackoverflow.com/q/26222842
downvote count: 0
answers question: http://stackoverflow.com/q/26222842
has body: Scanner.next() reads content of the input string word by word (i.e. "i", "think", "therefore", "i", "am") but you are counting the outer loop letter by letter (with respect to the input string). So the next() call throws an exception when the input string is exhausted, after the fifth iteration.
has comment: http://stackoverflow.com/comment/41127612
upvote count: 3

http://stackoverflow.com/a/57005745
has comment: http://stackoverflow.com/comment/114609813
has body: I managed to implement this with overriding of findAll method and adding to it annotation @EntityGraph: public interface BookRepository extends JpaSpecificationExecutor&lt;Book&gt; { @Override @EntityGraph(attributePaths = {"book.author"}) List&lt;Book&gt; findAll(Specification&lt;Book&gt; spec); }
upvote count: 20
has comment: http://stackoverflow.com/comment/115425262
score: 20
has comment: http://stackoverflow.com/comment/115380417
has comment: http://stackoverflow.com/comment/121077294
downvote count: 0
has comment: http://stackoverflow.com/comment/136258288
answers question: http://stackoverflow.com/q/26291143
type: Answer

http://stackoverflow.com/comment/41206628
score: 0
type: AnswerComment
type: Comment
has text: ok thanks for the help any links to a java tutorial or should I just buy a book?
comment on: http://stackoverflow.com/a/26263996

http://stackoverflow.com/a/26290906
answers question: http://stackoverflow.com/q/26290852
upvote count: 1
type: Answer
has body: Create a displayImage for the label. When the new image is loaded, paint it to the display image and repaint the label.
downvote count: 0
score: 1

http://stackoverflow.com/comment/41263064
type: Comment
type: QuestionComment
has text: @Mubin if you mean ts $tomcathome/lib no it does not contain any spring jars. the lib folder of the deployed application does contain spring jars as it should, but in the version spring-web-4.1.0.RELEASE. so it should i think
score: 0
comment on: http://stackoverflow.com/q/26294212

http://stackoverflow.com/comment/41192063
comment on: http://stackoverflow.com/q/26258271
type: Comment
type: QuestionComment
has text: read up on the concept of C format strings, it looks like that's what's confusing you ?
score: 2

http://stackoverflow.com/q/26279024
type: Question
tagged with: debugging
has body: I have a java project that dynamically loads in a compiled class. I want to then step through this class in debug mode, but I can't since Eclipse doesn't know about the source code. Is there any way I can achieve this?
tagged with: xdebug
tagged with: eclipse
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26279387
has title: Eclipse: Add Source to dynamically added class
tagged with: classloader
has answer: http://stackoverflow.com/a/26279159
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26279159
tagged with: java
has answer: http://stackoverflow.com/a/26279387

http://stackoverflow.com/comment/41285396
type: QuestionComment
has text: By "trying restrict user from being able to display a number in the EditText", do you mean you don't want the user to be able to enter numbers into the field? It would help if you could clear that up.
score: 1
comment on: http://stackoverflow.com/q/26308781
type: Comment

http://stackoverflow.com/a/26357249
type: Answer
score: 6
answers question: http://stackoverflow.com/q/26330232
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26330232
has body: Since you are writing an Android app, you can use RxAndroid. Here is an example, Observable.just(1).flatMap(new Func1&lt;Integer, Observable&lt;Integer&gt;&gt;() { @Override public Observable&lt;Integer&gt; call(Integer initialValue) { return ViewObservable.clicks(button, false) .subscribeOn(AndroidSchedulers.mainThread()) .scan(initialValue, new Func2&lt;Integer, View, Integer&gt;() { @Override public Integer call(Integer integer, View v) { return integer + 1; } }); } }).subscribe(new Observer&lt;Integer&gt;() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { e.printStackTrace(); } @Override public void onNext(Integer integer) { System.out.println(integer); } }); I'm not sure if it's what you want. Maybe you only need: ViewObservable.clicks(button, false) .subscribeOn(AndroidSchedulers.mainThread()) .scan(1, new Func2&lt;Integer, View, Integer&gt;() { @Override public Integer call(Integer integer, View v) { return integer + 1; } }).subscribe(new Observer&lt;Integer&gt;() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { e.printStackTrace(); } @Override public void onNext(Integer integer) { System.out.println(integer); } });
type: AcceptedAnswer
upvote count: 6

http://stackoverflow.com/q/26285825
score: -1
accepted answer: http://stackoverflow.com/a/26307252
possible better answer: http://stackoverflow.com/a/26286111
has body: How do I access a file in my war directory from a servlet. For example: public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { // how do I load /war/html/page.html } That file path is relative to my project root.
has answer: http://stackoverflow.com/a/26286111
favorite count: 0
has title: How do I access a resource in my WAR directory with Jetty?
tagged with: jetty
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26307252
tagged with: java
downvote count: 1
tagged with: servlets
type: Question
answer count: 2
upvote count: 0

http://stackoverflow.com/comment/41082447
comment on: http://stackoverflow.com/q/26198978
score: 0
type: Comment
type: QuestionComment
has text: @Fumu7 Hmm so the default constructor would create a new BasicRobot, but to create another type of robot, that type of robot would need to be created first and then passed into the constructor?

http://stackoverflow.com/a/26303170
answers question: http://stackoverflow.com/q/26281121
downvote count: 0
has body: In case anyone comes across this and needs some sort of solution, I've done this for now to get it working. Does the job but it's not really what I was after. @Root public class Images { @ElementListUnion({ @ElementList(entry = "fanart", type = FanArt.class, inline = true), @ElementList(entry = "boxart", type = BoxArt.class, inline = true), @ElementList(entry = "screenshot", type = ScreenShot.class, inline = true), @ElementList(entry = "banner", type = Banner.class, inline = true), @ElementList(entry = "clearlogo", type = ClearLogo.class, inline = true) }) private List&lt;Object&gt; images; private List&lt;FanArt&gt; fanarts; private List&lt;BoxArt&gt; boxarts; private List&lt;ScreenShot&gt; screenshots; private List&lt;Banner&gt; banners; private List&lt;ClearLogo&gt; clearlogos; public List&lt;FanArt&gt; getFanarts() { if (fanarts == null) { fanarts = new ArrayList&lt;FanArt&gt;(); for (Object image : images) { if (image instanceof FanArt) { fanarts.add((FanArt) image); } } } return fanarts; } public List&lt;BoxArt&gt; getBoxarts() { if (boxarts == null) { boxarts = new ArrayList&lt;BoxArt&gt;(); for (Object image : images) { if (image instanceof BoxArt) { boxarts.add((BoxArt) boxarts); } } } return boxarts; } public List&lt;ScreenShot&gt; getScreenshots() { if (screenshots == null) { screenshots = new ArrayList&lt;ScreenShot&gt;(); for (Object image : images) { if (image instanceof ScreenShot) { screenshots.add((ScreenShot) image); } } } return screenshots; } public List&lt;Banner&gt; getBanners() { if (banners == null) { banners = new ArrayList&lt;Banner&gt;(); for (Object image : images) { if (image instanceof Banner) { banners.add((Banner) image); } } } return banners; } public List&lt;ClearLogo&gt; getClearLogos() { if (clearlogos == null) { clearlogos = new ArrayList&lt;ClearLogo&gt;(); for (Object image : images) { if (image instanceof ClearLogo) { clearlogos.add((ClearLogo) image); } } } return clearlogos; } }
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/41079940
comment on: http://stackoverflow.com/q/26197411
type: Comment
type: QuestionComment
has text: click `Windows -> Preferences -> Android` make sure `SDK Location` is properly set
score: 0

http://stackoverflow.com/a/26289614
accepted answer of: http://stackoverflow.com/q/26288671
type: AcceptedAnswer
downvote count: 0
has body: Consider using a JList rather than creating you own component of labels, this has a lot of neat functionality that will just make your life simpler, like drag and drop... Have a look at How to Use Lists for more details. Drag and Drop is quite a complex API and can be quite confusing to begin with, which isn't helped by the inclusion of the "Transfer API" which just adds to the confusion. Having said that, the "Transfer API" is exactly what you're look for in this case... import java.awt.EventQueue; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import javax.activation.ActivationDataFlavor; import javax.swing.DefaultListModel; import javax.swing.DropMode; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JScrollPane; import javax.swing.TransferHandler; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class DragList { public static void main(String[] args) { new DragList(); } public DragList() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } DefaultListModel&lt;String&gt; listModel = new DefaultListModel&lt;&gt;(); listModel.addElement("Clara Holmes"); listModel.addElement("Bill Moss"); listModel.addElement("Della Reeves"); listModel.addElement("Lloyd Gross"); listModel.addElement("Cecilia Floyd"); listModel.addElement("Delia Cummings"); listModel.addElement("Tommy Benson"); listModel.addElement("Kirk Casey"); listModel.addElement("Chester Manning"); listModel.addElement("Elsa Chapman…
type: Answer
has comment: http://stackoverflow.com/comment/41270723
upvote count: 1
answers question: http://stackoverflow.com/q/26288671
score: 1

http://stackoverflow.com/a/26315360
type: Answer
has body: I think you are doing programming methodology course of Stanford university and having your assignment on Karel. Nice to see this. Coming back to your problem, for this case, you can use a counter to check how many beepers are present (initially set to Zero, just increment the counter if you pick a beeper). Pick beepers until all are picked up. Then, finally check if the counter is divisible by 2 or not to check its even or odd.
answers question: http://stackoverflow.com/q/26315283
score: 0

http://stackoverflow.com/comment/41261348
type: Comment
has text: I would guess that the compiler will be allowed to do quite a lot of special work behind the scenes to make string switches performant. I would probably find a way to lock down their `intern` values so you could achieve a case switch in perhaps one or maybe two lookups.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26289314

http://stackoverflow.com/q/26202481
favorite count: 0
has body: I have main activity in which I have a button that has intent to GooglePlus activity. Here is my code of GooglePlus.java up to onCreateView(): import java.io.InputStream; import android.app.Activity; import android.content.Intent; import android.content.IntentSender.SendIntentException; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.SignInButton; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.common.api.Status; import com.google.android.gms.plus.Plus; import com.google.android.gms.plus.model.people.Person; public class GooglePlus extends Activity implements OnClickListener, ConnectionCallbacks, OnConnectionFailedListener { private static final int RC_SIGN_IN = 0; // Logcat tag private static final String TAG = "MainActivity"; // Profile pic image size in pixels private static final int PROFILE_PIC_SIZE = 400; // Google client to interact with Google API private GoogleApiClient mGoogleApiClient; /** * A flag indicating that a PendingIntent is in progress and prevents us * from starting further intents. */ private boolean mIntentInProgress; private boolean mSignInClicked; private ConnectionResult mConnectionResult; private SignInButton btnSignIn; private Button btnSignOut, btnRevokeAccess; private ImageView imgProfilePic; private TextVi…
tagged with: android
has comment: http://stackoverflow.com/comment/41088600
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41088624
type: Question
has title: integration with Google plus: initializing google plus API client client is not working
has answer: http://stackoverflow.com/a/26202660
answer count: 2
has answer: http://stackoverflow.com/a/31283632
downvote count: 0
tagged with: google-plus

mysql
tags question: http://stackoverflow.com/q/26212005
tags question: http://stackoverflow.com/q/26279029
tags question: http://stackoverflow.com/q/26327642
tags question: http://stackoverflow.com/q/26301360
tag name: mysql
tags question: http://stackoverflow.com/q/26338086
tags question: http://stackoverflow.com/q/26200476
tags question: http://stackoverflow.com/q/26327664
tags question: http://stackoverflow.com/q/26307760
tags question: http://stackoverflow.com/q/26319640
tags question: http://stackoverflow.com/q/26337156
tags question: http://stackoverflow.com/q/26313045
tags question: http://stackoverflow.com/q/26242677
tags question: http://stackoverflow.com/q/26333077
tags question: http://stackoverflow.com/q/26327816
tags question: http://stackoverflow.com/q/26238391
tags question: http://stackoverflow.com/q/26297193
tags question: http://stackoverflow.com/q/26329976
tags question: http://stackoverflow.com/q/26261324
tags question: http://stackoverflow.com/q/26259772
tags question: http://stackoverflow.com/q/26229014
tags question: http://stackoverflow.com/q/26202709
tags question: http://stackoverflow.com/q/26336520
tags question: http://stackoverflow.com/q/26236804
tags question: http://stackoverflow.com/q/26327475
tags question: http://stackoverflow.com/q/26316602
tags question: http://stackoverflow.com/q/26198617
tags question: http://stackoverflow.com/q/26350269
tags question: http://stackoverflow.com/q/26273097
tags question: http://stackoverflow.com/q/26336875
tags question: http://stackoverflow.com/q/26341084
tags question: http://stackoverflow.com/q/26229660
tags question: http://stackoverflow.com/q/26209844
tags question: http://stackoverflow.com/q/26284330
tags question: http://stackoverflow.com/q/26257530
tags question: http://stackoverflow.com/q/26256408
tags question: http://stackoverflow.com/q/26251327
tags question: http://stackoverflow.com/q/26263186
tags question: http://stackoverflow.com/q/26253448
tags question: http://stackoverflow.com/q/26227752
type: Tag
tags question: http://stackoverflow.com/q/26289183
tags question: http://stackoverflow.com/q/26336963
tags question: http://stackoverflow.com/q/26203952
tags question: http://stackoverflow.com/q/26344915
tags question: http://stackoverflow.com/q/26219052
tags question: http://stackoverflow.com/q/26337667
tags question: http://stackoverflow.com/q/26261906
tags question: http://stackoverflow.com/q/26239083
tags question: http://stackoverflow.com/q/26284945
tags question: http://stackoverflow.com/q/26325325
tags question: http://stackoverflow.com/q/26262017
tags question: http://stackoverflow.com/q/26223959
tags question: http://stackoverflow.com/q/26200178
tags question: http://stackoverflow.com/q/26250141
tags question: http://stackoverflow.com/q/26314769
tags question: http://stackoverflow.com/q/26223909
tags question: http://stackoverflow.com/q/26200579
tags question: http://stackoverflow.com/q/26201125
tags question: http://stackoverflow.com/q/26322286
tags question: http://stackoverflow.com/q/26318868
tags question: http://stackoverflow.com/q/26327227
tags question: http://stackoverflow.com/q/26299050
tags question: http://stackoverflow.com/q/26290623
tags question: http://stackoverflow.com/q/26230758
tags question: http://stackoverflow.com/q/26310866
tags question: http://stackoverflow.com/q/26329901
tags question: http://stackoverflow.com/q/26234485
tags question: http://stackoverflow.com/q/26198654
tags question: http://stackoverflow.com/q/26260301
tags question: http://stackoverflow.com/q/26343277
tags question: http://stackoverflow.com/q/26275852

http://stackoverflow.com/comment/41109990
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26213795
has text: @sol4me I am confused let suppose if method return type is void then how it would work ?
type: Comment

http://stackoverflow.com/q/26260233
type: UnansweredQuestion
has body: I'm a little confused with multi threading in Java, I have a GUI which I created a thread for and another project which acts as a server and is used to receive data from other data sources which is on a separate thread. The server's thread calls a method in one of the views on the GUI thread and updates a status, however the GUI doesn't update. How can I setup this architecture correctly. Here's what I have: public static void main(String[] args) { //Connections Runnable r2 = new Runnable() { @Override public void run() { App.connectToServer(); } }; //Launch main window Runnable r1 = new Runnable() { @Override public void run() { //Installs theme WebLookAndFeel.install(); //Launches main window BootWindow myMainWindow = new BootWindow(); } }; Thread thr1 = new Thread(r1); Thread thr2 = new Thread(r2); thr1.start(); thr2.start(); } //Server connections private static void connectToServer() { System.out.println("Connecting to the eTrade Manager Server.."); etmServer server = new etmServer(); server.connectEtmServer(); }
score: 0
tagged with: java
tagged with: multithreading
tagged with: swing
has comment: http://stackoverflow.com/comment/41195616
has answer: http://stackoverflow.com/a/26260372
type: Question
linked to: http://stackoverflow.com/q/26261731
has comment: http://stackoverflow.com/comment/41195622
duplicate of: http://stackoverflow.com/q/26261731
answer count: 1
has title: Updating GUI thread from another thread
has comment: http://stackoverflow.com/comment/41209808

http://stackoverflow.com/a/26241720
type: Answer
downvote count: 0
has body: Parser can't do anything with exception, so that's an exceptional situation for a parser and it can't produce any expectable result. Someone from the outside should handle it. In particular, it should not return null as it will result in bunch of null-checks in calling code (which you can easily forget to put, or due to the lack of documentation on your implementation I just don't know whether I have to check for null without seeing the code). This is one of the problems that exceptions in Java were intended to solve. By declaring checked-exception in method signature, you're enforcing users of your parser to deal with fact that value might not come.
upvote count: 8
answers question: http://stackoverflow.com/q/26241655
accepted answer of: http://stackoverflow.com/q/26241655
type: AcceptedAnswer
score: 8

http://stackoverflow.com/a/26272143
accepted answer of: http://stackoverflow.com/q/26256420
answers question: http://stackoverflow.com/q/26256420
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41219394
type: Answer
has comment: http://stackoverflow.com/comment/43651323
score: 0
has body: As the Options() class stores the options in Maps internally, it does not keep any ordering. That means you need to provide your own order as you already found out. To get the ordering, you can put the keys in a List upfront to have an index of required order for each element: final List&lt;String&gt; optionKeys = new ArrayList&lt;&gt;(); optionKeys.add("sbx"); optionKeys.add("CSWConfig"); optionKeys.add("stripInfo"); optionKeys.add("modelSources"); optionKeys.add("catchArchive"); optionKeys.add("swSupplierName"); optionKeys.add("modelsSWExchnage"); Then in the Comparator you can compare by index in this list: @Override public int compare(Object o1, Object o2) { Option op1=(Option) o1; Option op2=(Option) o2; return Integer.compare(optionKeys.indexOf(op1.getLongOpt()), optionKeys.indexOf(op1.getLongOpt())); }

http://stackoverflow.com/a/26276533
has comment: http://stackoverflow.com/comment/41260396
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26275097
accepted answer of: http://stackoverflow.com/q/26275097
has body: There are al least 4 options: a) From the code, that is accessing UserJMXBean: String searchName="Hubert"; String searchRole="Admin"; UserJMXBean bean = new UserJMXBeanImpl(); for(User user : bean.getUserList()){ if(user.getName().equals(searchName) &amp;&amp; user.getRole().equals(searchRole)){ //do something with your user String userID = user.getID(); } } b) Add a new method to your UserJMXBeanImpl and the UserJMXImplBean and return the user instance: public User findUser(String name, String role){ for(User user : this.getUserList()){ if(user.getName().equals(name) &amp;&amp; user.getRole().equals(role)){ return user; } } return null; } c) Add a new method to your UserJMXBeanImpl and the UserJMXImplBean and return the required attributes: public String[] getUserAttributes(String name, String role){ for(User user : this.getUserList()){ if(user.getName().equals(name) &amp;&amp; user.getRole().equals(role)){ return new String[]{user.getID(), user.getRole(), user.getEmail()} } } return null; } d) You can overload the existing method and return a size-1-list: public List&lt;User&gt; getUserList(String name, String role) { for(User user : this.getUserList()){ if(user.getName().equals(name) &amp;&amp; user.getRole().equals(role)){ List&lt;User&gt; list = new ArrayList&lt;&gt;(1); list.add(user); return list; } } return Collections.emptyList(); }

http://stackoverflow.com/comment/41240967
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26284445
has text: @CodeChimp I think the second array indicates the index of non-zero values in the initial array.
type: QuestionComment

http://stackoverflow.com/q/26292729
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/41255576
has comment: http://stackoverflow.com/comment/41255674
has comment: http://stackoverflow.com/comment/41257454
has comment: http://stackoverflow.com/comment/41255618
has comment: http://stackoverflow.com/comment/41256004
score: 0
has comment: http://stackoverflow.com/comment/41255771
has answer: http://stackoverflow.com/a/37951023
answer count: 1
has title: Timer schedule Caused by: java.lang.IllegalArgumentException
has comment: http://stackoverflow.com/comment/41255661
tagged with: timer
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41255556
has body: getting, Timer Schedule Caused by: java.lang.IllegalArgumentException I am using image and period objects in JSON, period object controls the duration of image to be visible, but I am getting Caused by: java.lang.IllegalArgumentException my json objects look like this: { "image": "http://localhost/image_01.jpg", "period": "15000" } May I know where i am doing mistake and where i have to make changes, to get it done soon ... Here is my complete code: public class MainActivity extends Activity { ArrayList&lt;String&gt; actorsList; ViewFlipper viewFlipper; int period = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewFlipper = (ViewFlipper) findViewById(R.id.flipper); actorsList = new ArrayList&lt;String&gt;(); // execute AsyncTask new JSONAsyncTask().execute("http://localhost/images.txt"); // handler to set duration and to upate animation final Handler mHandler = new Handler(); // Create runnable for posting final Runnable mUpdateResults = new Runnable() { public void run() { viewFlipper.showNext(); // showNext() method } }; int delay = 500; Timer timer = new Timer(); // here i am getting error timer.scheduleAtFixedRate(new TimerTask() { public void run() { mHandler.post(mUpdateResults); } }, delay, period); } } Logcat 10-10 05:22:09.196: E/AndroidRuntime(537): FATAL EXCEPTION: main 10-10 05:22:09.196: E/AndroidRuntime(537): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wingnity.jsonparsingtutorial/com.wingnity.jsonparsingtutorial.MainActivity}: java.lang.IllegalArgumentException 10-10 05:22:09.196: E/AndroidRuntime(537): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955) 10-10 05:22:09.196: E/AndroidRuntime(537): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) 10-10 05:22:09.196: E/AndroidRuntime(537): at android.app.ActivityThread.access$600(ActivityThread.java:122) 10-10 05:22:09.196: E/And…
has comment: http://stackoverflow.com/comment/41255604

http://stackoverflow.com/q/26260533
answer count: 1
has title: Changing color character text of a JLabel?
accepted answer: http://stackoverflow.com/a/26260745
tagged with: jlabel
tagged with: http://stackoverflow.com/tag/html
has body: I'm trying changing color character text of a JLabel. I have a JLabel with text: "JLABEL" and I want change only color character "L". After to change, I want display text "JLABEL" with character "L" changed. How can I do this ? I'm trying this: private void characterFormat(){ jlabel.setText("JLABEL"); char[] t = jlabel.getText().toCharArray(); String txtFormat = ""; for(int x = 0; x < t.length; x++){ if(t[x] == 'L'){ txtFormat += String.format(" %s ", t[x]); } } jlabel.setText(txtFormat); }
type: AnsweredQuestion
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26260745
score: 0

http://stackoverflow.com/q/26279339
has title: ajax POST cannot send data to servelet
has answer: http://stackoverflow.com/a/26280336
tagged with: servlets
tagged with: ajax
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26280336
has body: I am working on a simple tomcat web application. The client side just send the username data in json to server side and server side return if this username is already registered. Here is my code. ajax part: var udata = new Array(); udata.push({ name: uname}); $.ajax({ url: '/TestProj/Controller?action=checkuname', type: 'POST', dataType: 'json', data: udata, //contentType:'application/json, charset=utf-8', success: function(data){ checkstatus = data.status; }, error: function(x,y,z){ console.log(JSON.stringify(x)); } }); servlet part: I am using a controller to dispatch the request to checkname servlet. String username = request.getParameter("name"); if (checkuser(username)){ status = "false"; }else{ status = "true"; } response.setContentType("application/json"); PrintWriter o = response.getWriter(); o.println("{\"status\":\""+status+"\"}"); //o.println("{\"status\":\""+username+"\"}"); I try print out the content of "status" and "username", but they are both null. Does it mean that I did not successfully send out the data via ajax to servlet. I may mess up the json data part. Any help will be appreciated. Updated: I change the ajax part to this and it works. Can someone let me know how to do it in the json way? ajax part: var udata = new Array(); udata.push({ name: uname}); $.ajax({ url: '/TestProj/Controller?action=checkuname&amp;uname='+uname, type: 'POST', dataType: 'json', data: udata, //contentType:'application/json, charset=utf-8', success: function(data){ checkstatus = data.status; }, error: function(x,y,z){ console.log(JSON.stringify(x)); } });
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/41193122
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26253683
has text: No Streams are not simply a representation of an old style collection. See Stream.iterate(), which is an infinite stream of objects. You can convert into a collection using a collector at the end, that's true, but in between it will never be a collection. Your code is nice, but builds up a static, in-memory collection of elements as a stream, does not delegate fetching to the upstream (as limit(long) method does).
score: 0

boolean
tags question: http://stackoverflow.com/q/26270503
tags question: http://stackoverflow.com/q/26240250
tags question: http://stackoverflow.com/q/26330975
tags question: http://stackoverflow.com/q/26313437
tags question: http://stackoverflow.com/q/26313957
tags question: http://stackoverflow.com/q/26349852
tag name: boolean
tags question: http://stackoverflow.com/q/26233251
tags question: http://stackoverflow.com/q/26271347
tags question: http://stackoverflow.com/q/26310033
type: Tag
tags question: http://stackoverflow.com/q/26205034

http://stackoverflow.com/q/26197081
has answer: http://stackoverflow.com/a/26200909
tagged with: rpc
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26200909
type: Question
has title: JGroups RPC - Concurrent invocation from same source
tagged with: jgroups
score: 0
has body: We are currently investigating JGroups in a multi-node environment for internal communication and member discovery. We are heavily relying on RPC, from event transmission to service consumption among the nodes are done via RPC, so JGroups RpcDispatcher is our preferred option. But we have found that, concurrent remote method invocations through RpcDospatcher are performed in FIFO order when the invoker is same JVM. This behavior is stated in JGroups documentation too, we found. Is there any way (or configuration parameter) to make RpcDispatcher invoking remote methods concurrently from the same JVM? Thanks!
answer count: 1

http://stackoverflow.com/q/26214546
answer count: 2
has comment: http://stackoverflow.com/comment/41111213
has answer: http://stackoverflow.com/a/26214684
favorite count: 0
has comment: http://stackoverflow.com/comment/41111088
has comment: http://stackoverflow.com/comment/41111477
has comment: http://stackoverflow.com/comment/41111130
has body: WARNING: Please keep in mind that this question is plain wrong - it makes a wrong assumption because I have misinterpreted a poorly written tutorial (a book actually) on C++. For case you are curious, this is the original contents: In C++ marking a method as virtual causes the objects to use more memory - for every additional virtual method the memory for a pointer (4 - 8 bytes) more. How does Java deals with this, where all methods by default are virtual?
has comment: http://stackoverflow.com/comment/41111239
possible better answer: http://stackoverflow.com/a/26214684
has comment: http://stackoverflow.com/comment/41111174
linked to: http://stackoverflow.com/q/1626290
tagged with: c++
has comment: http://stackoverflow.com/comment/41111334
tagged with: virtual
has answer: http://stackoverflow.com/a/26214804
upvote count: 1
downvote count: 6
type: AnsweredQuestion
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/41114686
tagged with: memory
has comment: http://stackoverflow.com/comment/41111125
type: Question
accepted answer: http://stackoverflow.com/a/26214804
has title: Virtual methods memory usage Java vs C++

keytool
tags question: http://stackoverflow.com/q/26278053
tags question: http://stackoverflow.com/q/26320874
type: Tag
tag name: keytool

http://stackoverflow.com/comment/42897730
type: Comment
has text: Well yes that is true if you are implementing a new `AsyncTask`, but if you already subclassed `AsyncTask` like the `RequestTask` in your answer suggests than you could break any functionality that was already implemented in the `RequestTask`. That is what I meant in my previous comment.
type: AnswerComment
comment on: http://stackoverflow.com/a/26203208
score: 0

http://stackoverflow.com/a/26196976
type: Answer
has body: I've had an issue like this before, but don't know if it's the same to yours since you didn't post your logcat. If you're getting a "Service not available" error in your logcat there is a bug with Geocoder. https://stackoverflow.com/a/4045287/687245. If so someone has provided a work around to query it via a GET call to Geocode. This is a workaround for me to get latitude and longitude from Geocode. Someone else posted this code on Stackoverflow, and all credit is given to him. All you have to do is change it to query via latitude and longitude instead of a string query and retrieve the postal code instead of lat lng. public void updateLocationByQuery(final String query) { if (mRunning) return; new AsyncTask&lt;Void, Void, LatLng&gt;() { protected void onPreExecute() { mRunning = true; }; @Override protected LatLng doInBackground(Void... params) { LatLng p = null; Geocoder geoCoder = new Geocoder(getActivity(), Locale.getDefault()); try { List&lt;Address&gt; addresses = geoCoder.getFromLocationName( query, 1); if (addresses.size() &gt; 0) { p = new LatLng(addresses.get(0).getLatitude(), addresses.get(0).getLongitude()); } else { Toast.makeText(getActivity(), "Unable to find location by query: " + query, Toast.LENGTH_LONG).show(); } } catch (Exception ignored) { // after a while, Geocoder start to trhow // "Service not availalbe" exception. really weird since it // was working before (same device, same Android version // etc.. ignored.printStackTrace(); } if (p != null) // i.e., Geocoder succeed { return p; } else // i.e., Geocoder failed { return fetchLocUsingGoogleMap(query); } } // Geocoder failed :-( // Our B Plan : Google Map private LatLng fetchLocUsingGoogleMap(String query) { double lng = 0, lat = 0; query = query.replace("\n", " ").replace(" ", "%20"); String googleMapUrl = "http://maps.google.com/maps/api/geocode/json?address=" + query + "&amp;ka&amp;sensor=false"; try { JSONObject googleMapResponse = new JSONObject( ANDROID_HTTP_CLIENT.execute(new HttpGet(…
answers question: http://stackoverflow.com/q/26196508
score: 0

http://stackoverflow.com/q/26352604
has answer: http://stackoverflow.com/a/26352865
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41365313
type: Question
has body: I do have the clear function but still the value is not clear. May i know how to solve this problem ? public class abc extends MenuActivity implements OnClickListener{ EditText et3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.safebox_flow); et3 = (EditText)findViewById(R.id.EditText02); et3.setText(String.valueOf('0')); et3.setOnClickListener(this); } @Override public void onClick(View v){ //Also here check the edittext02 id thats set in the xml layout if(v.getId() == R.id.EditText02){ et3.setText(""); } } } I have to double click it only can clear.
possible better answer: http://stackoverflow.com/a/26352625
has title: clear text view value while onclick is performed
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26352625
has answer: http://stackoverflow.com/a/26352631
tagged with: android
accepted answer: http://stackoverflow.com/a/26352865
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41077157
type: Comment
has text: I see that you've edited the question to ask about the "roots" of interrupts. I've edited my answer to include a list of classes that generate one from scratch.
type: QuestionComment
comment on: http://stackoverflow.com/q/26195726
score: 0

http://stackoverflow.com/q/26216181
accepted answer: http://stackoverflow.com/a/26216238
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/26216310
has answer: http://stackoverflow.com/a/26216310
type: Question
has title: could not find file: hibernate.cgf.xml
score: 0
has comment: http://stackoverflow.com/comment/41114015
answer count: 3
has answer: http://stackoverflow.com/a/26216238
has body: I read many posts, but no one suits my issue. I put hibernate.cgf.xml under the "src" folder of eclipse, according to what I learnt by reading some example on the internet. But when I run my application, I stil get the error "could not find file: hibernate.cgf.xml" This is my web application this is the class the start the application public class TestHibernateInsert { public static void main(String[] args) { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); //Add new Employee object EmployeeEntity emp = new EmployeeEntity(); emp.setEmail("lokesh@mail.com"); emp.setNome("Nome"); emp.setCognome("Cognome"); emp.setPassword("Password"); //Save the employee in database session.save(emp); //Commit the transaction session.getTransaction().commit(); HibernateUtil.shutdown(); } } this is the SessionFactory class public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml return new AnnotationConfiguration().configure(new File("hibernate.cgf.xml")).buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void shutdown() { // Close caches and connection pools getSessionFactory().close(); } } this is the persistent object class Entity @Table(name = "utente") public class EmployeeEntity implements Serializable{ private static final long serialVersionUID = -1798070786993154676L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", unique = true, nullable = false) private Integer id; @Column(name = "email", unique = true, nullable = false, length = 100) private String email; @Column(name = "nome", unique =…
tagged with: spring
has answer: http://stackoverflow.com/a/26216402
type: AnsweredQuestion

http://stackoverflow.com/comment/41235675
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26281343
has text: google "java synchronized"
score: 0

http://stackoverflow.com/a/26304139
answers question: http://stackoverflow.com/q/26299776
has body: Solved it this is the result. @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + IME_TABLICE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_TIME + " INTEGER , " + KEY_SCORE + " INTEGER )"
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26299776

http://stackoverflow.com/a/26345951
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26332768
type: Answer
accepted answer of: http://stackoverflow.com/q/26332768
has body: Another solution is if you are using spring-plugin to create an action bean by Spring, and configure dependency to be injected &lt;bean id="getEmp" class="controller.GetEmp" scope="request"&gt; &lt;property name="myDao" ref="myDao" /&gt; &lt;/bean&gt; In the struts.xml you should have something &lt;action name="getEmp" class="getEmp" method="getEmpname"/&gt; Read more about Struts2-Spring usage and explanation.
upvote count: 1
score: 1

saas
tags question: http://stackoverflow.com/q/26239850
type: Tag
tag name: saas

http://stackoverflow.com/q/26218291
score: 0
has answer: http://stackoverflow.com/a/26218485
linked to: http://stackoverflow.com/q/1359817
has answer: http://stackoverflow.com/a/26218483
has answer: http://stackoverflow.com/a/26218493
linked to: http://stackoverflow.com/q/153724
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26218451
has answer: http://stackoverflow.com/a/26218475
has comment: http://stackoverflow.com/comment/41118117
tagged with: rounding
has comment: http://stackoverflow.com/comment/41118131
tagged with: java
has title: How to round my output in a tax program [Java]?
type: Question
tagged with: decimal
duplicate of: http://stackoverflow.com/q/153724
has body: I need my output to float to only 2 decimal places as the output is money. For example if I run: Enter 1 if you are single. Enter 2 if you are married 1 Enter your taxable income 27060.34 Federal Income Tax:$4060.3435 I need the federal income tax to output $4060.34 instead of $4060.3435 My code: import static org.junit.Assert.*; import java.util.Scanner; import org.junit.Test; public class IRS { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter 1 if you are single. Enter 2 if you are married"); int martialstatus = scan.nextInt(); if (martialstatus == 1) { Scanner scan2 = new Scanner(System.in); System.out.println("Enter your taxable income"); double income = scan2.nextDouble(); if ((income &gt; 0) &amp;&amp; (income &lt;= 27050.00)) { System.out.println("Federal Income Tax:$" + (income * .15)); } if ((income &gt; 27050.00) &amp;&amp; (income &lt;= 65550.00)) { System.out.println("Federal Income Tax:$" + (4057.50 + (.275 * (income - 27050)))); } if ((income &gt; 65550.00) &amp;&amp; (income &lt;= 136750.00)) { System.out.println("Federal Income Tax:$" + (14645.00 + (.305 * (income - 65550.00)))); } if ((income &gt; 136750.00) &amp;&amp; (income &lt;= 297350.00)) { System.out.println("Federal Income Tax:$" + (36361.00 + (.355 * (income - 136750.00)))); } if (income &gt; 297350.00) { System.out.println("Federal Income Tax:$" + (93374.00 + (.391 * (income - 297350.00)))); } } else if (martialstatus == 2) { Scanner scan3 = new Scanner(System.in); System.out.println("Enter your taxable income"); double income2 = scan3.nextDouble(); if (income2 &lt;= 45200.00) { System.out.println("Federal Income Tax:$" + (.15 * income2)); } if ((income2 &gt; 45200.00) &amp;&amp; (income2 &lt;= 109250.00)) { System.out.println("Federal Income Tax:$" + (6780.00 + (.275 * (income2 - 45200)))); } if ((income2 &gt; 109250.00) &amp;&amp; (income2 &lt;= 166500.00)) { System.out.println("Federal Income Tax:$" + (24393.75 + (.305 * (income2 …
answer count: 6
has answer: http://stackoverflow.com/a/26218508

http://stackoverflow.com/q/26220161
has body: I'm trying to make a log in screen which has 10 buttons 0-10 and only accepts 4 digits. I have stored some variables called PIN0-PIN03 which holds a int value. I want the user to enter 4 digit pin and if it matches the values stored in the variables PIN0-PIN03 a name will appear. I have done the button and everything I just need help with this ENTER button the code I used for the ENTER button is: int pin = 0000; int PIN0 = 1234; // if user enters this value the program will start executing the if statments. int PIN1 = 2345; int PIN2 = 3456; int PIN3 = 4567;\\ if (pin == PIN0){ System.out.println("Hi Muhannad"); if (pin == PIN0){ // if user enters PIN0 it will display the below message System.out.println("Hi Muhannad"); } if( pin == PIN1){ System.out.println("Hi Mo"); } if( pin == PIN2){ System.out.println("Hi Mahir"); } if( pin == PIN3){ System.out.println("Hi Gawi"); } if(pin != PIN0 || pin != PIN1 || pin != PIN2 || pin != PIN3){ System.out.println("Incorrect pin try again!"); // if user enters anything that doesn't match any of the variables values the "Incorrect pin try again" will apear. } I'm I doing this right? please help this is a project I started in my own time to create an app similar to banking apps. Code for the buttons: private void buttonOneActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource() == buttonOne){ if(jTextField1.getText().length() &lt; 4){ if(clearField == 1){ jTextField1.setText("0"); clearField = 0; } else{ jTextField1.setText(jTextField1.getText() + "1"); } } } } private void buttonTwoActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource() == buttonTwo){ if(jTextField1.getText().length() &lt; 4){ if(clearField == 1){ jTextField1.setText("2"); clearField = 0; } else{ jTextField1.setText(jTextField1.getText() + "2"); } } } } private void buttonThreeActionPerformed(java.awt.event.ActionEvent evt) { if(evt.getSource() == buttonThree){ if(jTextField1.getText().length() &lt; 4){ if(clearField == 1){ jTextField1.setT…
has comment: http://stackoverflow.com/comment/41122366
has comment: http://stackoverflow.com/comment/41122112
has comment: http://stackoverflow.com/comment/41135390
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/41123802
has comment: http://stackoverflow.com/comment/41122052
has comment: http://stackoverflow.com/comment/41121885
has comment: http://stackoverflow.com/comment/41122067
tagged with: java
has comment: http://stackoverflow.com/comment/41121977
has comment: http://stackoverflow.com/comment/41135563
type: Question
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/26227500
has comment: http://stackoverflow.com/comment/41122251
score: 0
has comment: http://stackoverflow.com/comment/41122882
has title: Making a ENTER button for my banking app

http://stackoverflow.com/q/26243333
type: Question
score: -2
has comment: http://stackoverflow.com/comment/41165748
tagged with: arraylist
has body: I'm looking for some guidance on how to find duplicate entries in a arrayList that is populated from a .txt file line by line. The .txt file lines are as follows: 9700874,6187,13-MAR-12,5503.78 ,5503.78 ,99950,4657,0045,4426920621,111000012,YS,9700874, 7531245,58195,13-MAR-12,5464.55 ,5464.55 ,99950,4661,0023,0041800591,275071288,S,7531245, 9319794,53402,13-MAR-12,5461.01 ,5461.01 ,741828,7098,0025,592245,082900911,S,7543539, A , B , C , D , E , F , G , H , I , J ,K, L , I want my program to read in the file, line by line, and send the current line to another method. Before this, I would like to check to make sure I do not have a line similar in the .txt file. Lines are compared only on fields A, D and F for similarities. I don't have much but here is my code anyhow, grabbing line by line. ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); while ((line = br.readLine()) != null) { currentline = line; //check if currentline(sec A D F) have been proccessed already, if yes skip line, //if no send to method proccess(currentline); list.add(line); } String[] fileLines = list.toArray(new String[0]); br.close();
has comment: http://stackoverflow.com/comment/41165779
answer count: 1
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/26243513
favorite count: 0
has comment: http://stackoverflow.com/comment/41165533
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41165528
upvote count: 0
tagged with: java
downvote count: 2
has title: Java ArrayList, Finding Duplicates, in a section of a String

http://stackoverflow.com/comment/41356460
type: Comment
type: QuestionComment
has text: If you're worried about other people on your class sharing your code, don't post your code on a public site on the internet. Trying to edit out the answers of everyone involved after you get your answer to avoid anyone else from learning the same things you did is against SO policy. Besides even then people can see the source code by looking at edit history.
comment on: http://stackoverflow.com/q/26305386
score: 9

http://stackoverflow.com/a/27939016
answers question: http://stackoverflow.com/q/26307382
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26307382
has comment: http://stackoverflow.com/comment/44324482
type: Answer
score: 1
upvote count: 1
has body: Sorry, I want to use comment instead of answer, but I don't have enough reputation... What I found on ES Explore or other same app, they seemed not only use JCIFS , but also use nanoHTTPD... They transfer the nas file to samba file, then use nanoHTTPD as a Streaming server to serve the multimedia files... There got many sample on the web, here a discussion => How to serve a file on sdcard using NanoHTTPD (inside Android) Hope this can help you...

http://stackoverflow.com/comment/41331766
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26334195
type: Comment
has text: are you still getting NPE? Did you put initialization code above using all this controls and below setcontentview?

executable-jar
tags question: http://stackoverflow.com/q/26210800
tags question: http://stackoverflow.com/q/26278733
tags question: http://stackoverflow.com/q/26230711
tag name: executable-jar
type: Tag
tags question: http://stackoverflow.com/q/26228911
tags question: http://stackoverflow.com/q/26351203
tags question: http://stackoverflow.com/q/26203676

http://stackoverflow.com/comment/41564663
score: 0
type: Comment
type: QuestionComment
has text: I am not sure I understand what you are trying to do.
comment on: http://stackoverflow.com/q/26259980

http://stackoverflow.com/q/26245561
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41252026
answer count: 4
score: 2
tagged with: performance
downvote count: 0
has body: I have a case where I have "property maps" one each attached to a very large collection of objects. I am only interested in the overhead of the map itself not of the attached keys and values. Many have a small number of properties ie: &lt; 5, and many none. For empty maps I use a singleton "empty instance" as an optimization. For speed it seems that at a count of &lt;= 5, TreeMap seems equal or better than HashMap for retrieval and "auto trims" when nodes are removed. I would think a HashMap uses for each entry the memory overhead of the hash/handle array including memory above the load factor full of null entry handles, and the object overhead and handle storage for the key and the value in the "Entry[+internal fields if any]". Also I would think a TreeMap uses only the per Entry Object overhead + key,value,prev,next handle fields in the entry for the list, and the smallest possible a binary search of an array - One array object (trimmed to size) full of just the handles for the keys and the values. Has anyone really checked the accurate full overhead of each of the Java map types? For my bazillions of objects with properties it would make a significant difference in the 1 to 5 property case without impacting speed of access.
tagged with: java
has answer: http://stackoverflow.com/a/26268036
has answer: http://stackoverflow.com/a/26252363
tagged with: memory
type: Question
has comment: http://stackoverflow.com/comment/41169678
has answer: http://stackoverflow.com/a/26252014
has answer: http://stackoverflow.com/a/26245892
has title: What is the relative memory overhead per mapped value of the different Java map types
has comment: http://stackoverflow.com/comment/41169727
upvote count: 2
has comment: http://stackoverflow.com/comment/41170012

http://stackoverflow.com/a/26321943
has body: In your .bash_profile, place the correct version of Java that you want to use - in this case, 7 - into your $JAVA_HOME bash variable. The way to do this is through the use of the libexec tool provided with Mac. export $JAVA_HOME=`/usr/libexec/java_home -v 1.7`
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26321871

http://stackoverflow.com/q/26306066
has comment: http://stackoverflow.com/comment/41280520
has answer: http://stackoverflow.com/a/26306329
upvote count: 1
has body: My Program reads a file into a byte array and then tries to carve out a bmp image from the file. The problem is I am getting an out of bounds error. { public static void main( String[] args ) { FileInputStream fileInputStream=null; File file = new File("C:/thumbcache_32.db"); byte[] bFile = new byte[(int) file.length()]; System.out.println("Byte array size: " + file.length()); try { //convert file into array of bytes fileInputStream = new FileInputStream(file); fileInputStream.read(bFile); fileInputStream.close(); //convert array of bytes into file FileOutputStream fileOuputStream = new FileOutputStream("C:/Users/zak/Desktop/thumb final/Carved_image.bmp"); fileOuputStream.write(bFile,1573278,1577427); fileOuputStream.close(); System.out.println("Done"); }catch(Exception e){ e.printStackTrace(); } } } The size of the byte array one the file is loaded into is "3145728" and I am trying to copy bytes "1573278" to "1577427". As you can see these bytes are within bounds of the byte array so im unsure why I am getting this error output of program when run Byte array size: 3145728 java.lang.IndexOutOfBoundsException at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(Unknown Source) at Byte_copy.main(Byte_copy.java:28)
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41280820
tagged with: java
tagged with: indexoutofboundsexception
has title: FileOutputStream.writeBytes out of bounds
accepted answer: http://stackoverflow.com/a/26306329
answer count: 1
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/26247934
score: 0
type: UnansweredQuestion
tagged with: war
has body: I have jars in the main webapp of a WAR. They are being deployed as the dependencies of a Java Web Start app client, along with a JNLP. I get a lot of class loader exceptions in Glassfish when I try to deploy it. Is there a way to tell the WAR to ignore those jars? Or even better, to have the JNLP work with a zip of the dependencies? (If I zip them, it deploys fine).
tagged with: java
has answer: http://stackoverflow.com/a/26248601
type: Question
has title: How can I include jars in my WAR to be deployed to Glassfish?
answer count: 1
tagged with: jar
tagged with: java-web-start
tagged with: glassfish

http://stackoverflow.com/comment/41198205
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26260288
has text: Have you tried `android:gravity(bottom | center_horizontal)` on your TextView? That seems to be the straightforward solution right out of the Javadoc

http://stackoverflow.com/a/26287899
downvote count: 0
has body: You are calling worldMap.put, which modifies the Hash Map, while an iteration (for(String key : worldMap.keySet()) is in progress. The keyset might change while iterating over the keyset. This causes the exception.
type: Answer
answers question: http://stackoverflow.com/q/26287801
score: 1
upvote count: 1

http://stackoverflow.com/comment/41334030
comment on: http://stackoverflow.com/q/26330234
score: 0
type: Comment
type: QuestionComment
has text: It is not a problem of annotations, it is a problem of class objects.

http://stackoverflow.com/q/26264492
has title: StaleElementReferenceException: stale element reference:
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/26264639
type: Question
linked to: http://stackoverflow.com/q/16166261
accepted answer: http://stackoverflow.com/a/26264639
has comment: http://stackoverflow.com/comment/41203798
answer count: 1
has body: I need to access the folderId's from the code: { "folderType": 3, "createdDate": "02.09.2014 11:57:28.UTC", "modifiedDate": "02.09.2014 11:57:28.UTC", "folderName": "Enterprise", "folderId": "baebc0fb-38cb-4300-9bd1-9b98fa622e4a", "widgetType": null, "enterpriseId": "366fc1f1-670d-41bc-905e-bc80accd2537", "parentFolderId": "", } { "folderType": 3, "createdDate": "02.09.2014 11:57:28.UTC", "modifiedDate": "02.09.2014 11:57:28.UTC", "folderName": "Enter", "folderId": "6671ca49-9637-488e-9a0e-f7dbf415a542", "widgetType": null, "enterpriseId": "366fc1f1-670d-41bc-905e-bc80accd2537", "parentFolderId": "", } I need to access the folderId of 'Enterprise' and 'Enter' folder. This is my code: String s1= driver.findElement(By.xpath("//span[. = '\"Enterprise\"']/ancestor::pre/following-sibling::pre[1]/span[2]")).getText(); String s2=driver.findElement(By.xpath("//span[. = '\"Enter\"']/ancestor::pre/following-sibling::pre[1]/span[2]")).getText(); I want to print the values of String s1 and s2 without the cotes. I can access the 'Enterprise' folderId but unable to access the 'Enter' folderId. As 'Enter' folderId is newly created folder. For every field present between the cotes, following is the GENERAL FORAMT HTML code: "folderName": "Enter", "folderId": "6671ca49-9637-488e-9a0e-f7dbf415a542", I can select the Enter folderId using the chrome Developer Tools like this: $x("//span[. = '\"Enter\"']/ancestor::pre/following-sibling::pre[1]/span[2]") [​"6671ca49-9637-488e-9a0e-f7dbf415a542"​​] Actual Output in the eclipse: Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document (Session info: chrome=37.0.2062.124)
has comment: http://stackoverflow.com/comment/41203868
tagged with: xpath

http://stackoverflow.com/q/26262002
has comment: http://stackoverflow.com/comment/41199550
has answer: http://stackoverflow.com/a/26262119
has comment: http://stackoverflow.com/comment/41199173
downvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41200157
possible better answer: http://stackoverflow.com/a/26262119
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/41199148
has comment: http://stackoverflow.com/comment/41199112
has answer: http://stackoverflow.com/a/26264126
type: Question
has comment: http://stackoverflow.com/comment/41200061
has body: I'm working on a Java project and for some reason I cannot understand why my code isn't going past a for loop. float gain = 0; float loss = 0; for(int i = this.currentLine - 14; i &lt; this.currentLine; i ++){ StockLine pd = (StockLine) this.rows.get(i); gain += pd.getGain(); loss += pd.getLoss(); System.out.println(i); } System.out.println("WHY ISN'T THIS BEING PRINTED"); If I was to remove this three line it works as expected: StockLine pd = (StockLine) this.rows.get(i); gain += pd.getGain(); loss += pd.getLoss(); this.rows is an ArrayList with a large number of Objects (StockLine). About 200 elements. Does Java have limit on the number of objects an ArrayList can hold? The code is compiled and executed successfully with no warnings or errors. So I have no idea about what is going on here. Any assistance would be greatly appreciated. Thank you in advance. Ahmad EDIT: Thanks for the quick reply everyone. Below is the current class. The only other portion of the project is reading a file line-by-line and calling the file() method below. The method getGain() and getLoss() just returns a float. This is the class ReadStock or this package nyc.amin; import java.util.ArrayList; public class ReadStock implements ReadFileInterface { private int currentLine = 0; private ArrayList rows = new ArrayList(); @Override public void file(String line) { if(this.currentLine == 0){ this.currentLine ++; return; } String[] row = line.split(","); StockLine currentDay = new StockLine(); currentDay.setDate(row[0]); currentDay.setTime(row[1]); currentDay.setOpen(row[2]); currentDay.setHigh(row[3]); currentDay.setLow(row[4]); currentDay.setClose(row[5]); currentDay.setVolume(row[6]); if(this.currentLine &gt;= 2){ StockLine previousDay = (StockLine) this.rows.get(this.rows.size() - 1); currentDay.setGainOrLoss(currentDay.getClose() - previousDay.getClose()); if(this.currentLine == 15){ float gain = 0; float loss = 0; for(int i = this.currentLine - 14; i &lt; this.currentLine; i ++){ StockLine…
answer count: 2
tagged with: for-loop
upvote count: 0
accepted answer: http://stackoverflow.com/a/26264126
favorite count: 0
has title: Java Stuck in For Loop
has comment: http://stackoverflow.com/comment/41199064

http://stackoverflow.com/comment/41245317
comment on: http://stackoverflow.com/a/26286784
type: AnswerComment
has text: For some reason, I thought ChatWindow was an inner class. Edited post? Insufficient caffeine? We'll never know...
type: Comment
score: 0

size
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/26331920

http://stackoverflow.com/a/26357364
has comment: http://stackoverflow.com/comment/41387986
type: Answer
answers question: http://stackoverflow.com/q/26299835
has body: If you're using Spring, try adding this before any other bean: <property name="defaultPersistenceUnitName" value="my-default-PU" />
score: 0

http://stackoverflow.com/comment/41321427
has text: I won't give you the answer directly, try making all of your object's methods do one task. If you need to write more methods, then do it. But an object's method should only ever produce one output. After writing that code, you can include any conditionals in the main method. For example, having a do while loop in the main method to play the game while the answer is yes. You can ask for yes at the end of the loop.
comment on: http://stackoverflow.com/a/26322310
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41225782
type: AnswerComment
comment on: http://stackoverflow.com/a/26275878
score: 0
has text: i simply want to get input from a form and use it as an int
type: Comment

http://stackoverflow.com/q/26317675
tagged with: java
possible better answer: http://stackoverflow.com/a/26317767
has answer: http://stackoverflow.com/a/26317767
has comment: http://stackoverflow.com/comment/41301009
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26317683
favorite count: 0
type: Question
has title: Java Lists - identifier expected
has comment: http://stackoverflow.com/comment/41301589
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26317683
upvote count: 1
downvote count: 1
has body: I tried to create a program with a linked list. package com.delta.memory; import java.util.ArrayList; /** * Lists */ public class Lists { ArrayList&lt;String&gt; DaysOfTheWeek = new ArrayList&lt;String&gt;(); DaysOfTheWeek.add("Sunday"); DaysOfTheWeek.add("Tuesday"); DaysOfTheWeek.add("Wednesday"); DaysOfTheWeek.add("Thursday"); DaysOfTheWeek.add(1, "Monday"); } But it gives the following compilation errors: Error:(11, 22) error: &lt;identifier&gt; expected Error:(11, 23) error: illegal start of type And also a warning: Cannot resolve symbol 'add' Please help.

http://stackoverflow.com/q/26351045
answer count: 2
has comment: http://stackoverflow.com/comment/41362519
tagged with: java
downvote count: 2
upvote count: 1
has body: My assignment is to output decimals to binaries. An example would be inputting 100 and then the binary output would be 1100100. My code: import java.util.Scanner; public class Dec2Bin { public static void main(String[] args){ System.out.println("Welcome to Decimal Number to Binary Converter"); System.out.println(""); Scanner s = new Scanner(System.in); System.out.println("Enter a decimal number (-1 to end):"); int input = s.nextInt(); for ( ; ; ){ if (input &lt; 0) break; String bi = ""; while(input != 0){ bi = ((input % 2) + bi); input = input / 2; } System.out.println("The binary number is:" + bi); } } } Right now my program gets stuck in an infinite loop and the binary number prints out to be 0010011. I cannot figure out how to stop the infinite loop and reverse my binary number so it is correct.
has title: How to make my program output binaries in reverse
has answer: http://stackoverflow.com/a/26351275
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26351202
accepted answer: http://stackoverflow.com/a/26351275
has answer: http://stackoverflow.com/a/26351202
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/41362458
type: Question

http://stackoverflow.com/q/26234329
score: -1
has answer: http://stackoverflow.com/a/26234796
accepted answer: http://stackoverflow.com/a/26234796
has body: I'm using an application that takes udp packets containing logs from a game server and uses them to glean information on what is going on with the server - it does this via regex matching. However, I'm running into an issue that if the program is receiving enough packets at once the cpu usage goes up quiet a bit - after looking at a thread dump this appears to be due to the regex matching.. Here's an example of two of the patterns: Pattern pattern = Pattern.compile(".*World triggered \"Game_Over\" reason \"(.+)\""); Pattern chatPattern = Pattern.compile("\"(.+)&lt;([0-9]+)&gt;&lt;\\[(U:[0-9]:[0-9]+)\\]&gt;&lt;(Blue|Red)&gt;\" say \"(.+)\""); Then it creates a matcher based on said patterns and the log line it is given and checks matches. It does this for 5 different patterns each time it recieves a packet - How can I optimize this to lower the cpu usage?
has title: Optimizing Java Regex Matching
has comment: http://stackoverflow.com/comment/41147860
answer count: 1
favorite count: 0
tagged with: regex
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41148236
downvote count: 1
has comment: http://stackoverflow.com/comment/41148509
type: Question
upvote count: 0

http://stackoverflow.com/comment/41221823
type: QuestionComment
has text: You could make `fTemp` a member of the class.
comment on: http://stackoverflow.com/q/26273372
score: 0
type: Comment

http://stackoverflow.com/a/60339512
has body: I am late for this but i want put some more solution relevant to this. @GetMapping public ResponseEntity&lt;List&lt;JSONObject&gt;&gt; getRole() { return ResponseEntity.ok(service.getRole()); }
has comment: http://stackoverflow.com/comment/121355859
downvote count: 4
answers question: http://stackoverflow.com/q/26320106
score: -3
upvote count: 1
type: Answer

http://stackoverflow.com/a/26249601
score: 1
has body: Issue was with version mismatch of plugins installed in sonarqube. I deleted jars for all plugins except java. This solved the issue. I figured it out from sonar.log Thanks
has comment: http://stackoverflow.com/comment/57508548
accepted answer of: http://stackoverflow.com/q/26233595
answers question: http://stackoverflow.com/q/26233595
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/26336065
downvote count: 0
has answer: http://stackoverflow.com/a/26336257
tagged with: rest
answer count: 3
has comment: http://stackoverflow.com/comment/41335263
tagged with: jax-rs
has answer: http://stackoverflow.com/a/26336255
favorite count: 0
has body: What are the best practices regarding the method types in JAX-RS ? I am interested in the following methods: GET, POST, PUT and DELETE. My possible approaches: GET - always return a response. @GET @Path("/path/{something}") public T getT() { ... return t; // t - instance of T } POST @POST @Path("/path") public T/void createOrUpdate() { ... return t; // t - instance of T } Q: Is it better to return the entire created resource or just an "ACK response" or to have a void method? What about a POST that is used as GET (when we want to avoid the URL length limitation)? PUT @PUT @Path("/path") public T/void createOrUpdate() { ... return t; // t - instance of T } Q: Is it better to have a void method or a response for the created/updated resource or different responses for creation / update or just an ACK response ? DELETE @DELETE @Path("/path/{something}") public T/void deleteT() { ... return t; // t - instance of T } Q: Is is better to have a void method or to return the deleted resource or to return an ACK response ? Is it ok to always have T = javax.ws.rs.core.Response (when T is used)? I saw that: Lars Vogel uses GET - T, POST - void, PUT - T, DELETE - void Oracle uses GET - T, POST - T/void, DELETE - void
has title: Best practices for method types in JAX-RS
type: UnansweredQuestion
tagged with: web-services
upvote count: 7
has comment: http://stackoverflow.com/comment/41335414
has answer: http://stackoverflow.com/a/26337381
score: 7
tagged with: java
tagged with: methods
type: Question

http://stackoverflow.com/comment/41310427
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26322210
has text: To be able to draw in the center of a page and scroll all around it

http://stackoverflow.com/q/26258412
has body: Given the following code: package com.gmail.oksandum.test; import java.util.ArrayList; import java.util.List; public class Test { public static void main(String[] args) { } public void foo() { class LocalFoo { LocalFoo(String in) { //Some logic } } List&lt;String&gt; ls = new ArrayList&lt;&gt;(); ls.stream().map(LocalFoo::new); //Line 21 } } my IDE gives me no errors. That is, until I try to build the project and run it. When I do that it gives me a compiler error that looks like this: Error:(21, 24) java: incompatible types: cannot infer type-variable(s) R (argument mismatch; invalid constructor reference cannot access constructor LocalFoo(java.lang.String) an enclosing instance of type com.gmail.oksandum.test.Test is not in scope) Now, I figured, given the error message, that this wouldn't happen if foo() were static. And quite right, this only happens if foo() is an instance method. And it only happens if LocalFoo is a local class in the instance method, and only if a constructor reference is used (i.e never a regular method reference). What's more, if I change line 21 into ls.stream().map(str -&gt; new LocalFoo(str)); the compiler suddenly gives no error. So to recap. If I try to use a constructor reference on a local class declared within an instance method, the compiler complains about not being able to access the constructor, about which I am confused. If someone could shed some light on why this happens it would be appreciated. Thanks.
has comment: http://stackoverflow.com/comment/41202827
has comment: http://stackoverflow.com/comment/55933791
upvote count: 29
favorite count: 0
has answer: http://stackoverflow.com/a/33982812
tagged with: method-reference
score: 29
tagged with: lambda
tagged with: java-8
accepted answer: http://stackoverflow.com/a/33982812
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41197345
has comment: http://stackoverflow.com/comment/41203152
possible better answer: http://stackoverflow.com/a/26375967
has comment: http://stackoverflow.com/comment/41194976
type: Question
has comment: http://stackoverflow.com/comment/41389988
has title: Invalid constructor reference when using local class?
answer count: 2
has answer: http://stackoverflow.com/a/26375967
tagged with: constructor-reference
downvote count: 0
has comment: http://stackoverflow.com/comment/41194581
has comment: http://stackoverflow.com/comment/41196951
has comment: http://stackoverflow.com/comment/41399049

http://stackoverflow.com/comment/41157381
score: 0
has text: Yes, I dont have clear idea on when the session gets started. But the uniqueEmailJobDetail is triggered by a cronTrigger that resides in quartzScheduler, I dont know if this is what you've asked. Sir, can you be available on some chat room?
type: Comment
comment on: http://stackoverflow.com/q/26236729
type: QuestionComment

http://stackoverflow.com/comment/41328631
comment on: http://stackoverflow.com/q/26332464
type: QuestionComment
has text: "javac -cp ./junit.jar:hamcrest-core.jar Tests.java" or "java -cp ./junit.jar:hamcrest-core.jar org.junit.runner.JUnitCore Tests"
score: 0
type: Comment

http://stackoverflow.com/q/26287802
has title: Servlet not redirecting to jsp properly
has answer: http://stackoverflow.com/a/26288212
tagged with: servlets
score: 0
answer count: 1
tagged with: jsp
type: UnansweredQuestion
has body: I have an Ajax call to a servlet on the $(document).ready function. After all operations made, the servlet tries to redirect the request and response to a page: try { request.getServletContext().getRequestDispatcher("/index.jsp").forward(request,response); return; } catch (ServletException| IOException e1) { e1.printStackTrace(); } The servlet is running, cause I can see everything on the log, but on my jsp page all the attributes are null. On the servlet: request.setAttribute("test", 1); On the index.jsp: ${test} It prints nothing. Can anybody help?
tagged with: java
type: Question

http://stackoverflow.com/q/26243740
has comment: http://stackoverflow.com/comment/41166335
has comment: http://stackoverflow.com/comment/41166308
favorite count: 0
has comment: http://stackoverflow.com/comment/41166367
has answer: http://stackoverflow.com/a/26243844
has comment: http://stackoverflow.com/comment/41166398
upvote count: 2
type: UnansweredQuestion
downvote count: 2
answer count: 4
linked to: http://stackoverflow.com/q/8229473
linked to: http://stackoverflow.com/q/17812454
tagged with: java
tagged with: duplicates
has answer: http://stackoverflow.com/a/26243967
type: Question
has comment: http://stackoverflow.com/comment/41166383
tagged with: hashmap
has comment: http://stackoverflow.com/comment/41166299
has comment: http://stackoverflow.com/comment/41166289
has title: Java - how to remove duplicating entries from HashMap?
has comment: http://stackoverflow.com/comment/41166309
has answer: http://stackoverflow.com/a/26243824
has body: I have a HashMap in Java: HashMap&lt;String, Integer&gt; meh = new HashMap&lt;String, Integer&gt;();` meh.put("one", 1); meh.put("one", 1); meh.put("one", 1); meh.put("two", 1); meh.put("two", 2); meh.put("three", 3); What I need is to remove duplicating entries ("one", 1) [when both key and value duplicate]. I searched and found only 'how to remove duplicating keys/values'. Can anyone help?
has answer: http://stackoverflow.com/a/26243964
score: 0

http://stackoverflow.com/comment/41082954
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26199220
score: 0
has text: @LesterMurillo I assumed that `Camera.UpdateCameraAxis();` or this `for(int xx=Math.max(` changed some paint state. Couldn't tell without incomplete code. Maybe I'm wrong

http://stackoverflow.com/q/26234923
tagged with: ejb
has body: Is it acceptable to use types from the java.io and java.nio packages to access the file system and manipulate files in EJB?
has title: Is it acceptable to access the file system in EJB?
has answer: http://stackoverflow.com/a/26235027
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/1357667
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/26235027
tagged with: ejb-3.2
tagged with: java
tagged with: java-ee-7
answer count: 1

http://stackoverflow.com/a/26290527
score: 7
has body: Your main method does not match the signature of a standard main method, that normally starts a Java application. Yours has way too many parameters and should have only one parameter, an array of String. So you must change this: // incorrect main method signature public static void main(String[] args, int CurMoney, String[] inputStocks, int[] StockMoney) { to this: // correct main method signature public static void main(String[] args) { and get all the information needed in some way, perhaps from a file?
upvote count: 7
type: Answer
answers question: http://stackoverflow.com/q/26290520
has comment: http://stackoverflow.com/comment/41252296
downvote count: 0

http://stackoverflow.com/comment/41320456
type: QuestionComment
comment on: http://stackoverflow.com/q/26328217
has text: I cannot give you a complete answer but I can guarantee you that it has no consequence on performance, and most probably no consequence on anything
score: 0
type: Comment

http://stackoverflow.com/q/26237972
tagged with: scene
tagged with: java
tagged with: javafx
tagged with: children
has answer: http://stackoverflow.com/a/26238583
has title: How to get the elements on a scene JavaFX/Add objects to Scene dynamically
type: Question
answer count: 1
has body: I have a scene - I want to pull all of the elements on that scene. Basically, this is what I'm trying to create: A window with a button at the top that, when clicked, will "spawn" a new block on the screen that is draggable/interactable in other ways. I already have this down with blocks that I add in the code. But I want to make this dynamic, and for that, I need to be able to loop through all the objects on my scene, and I need to know how to add objects dynamically to the scene. So, to make this clearer - I have two questions. How do I add a rectangle or a circle or anything for that matter dynamically on the press of a button? How do I pull a list of all things on the scene. If I add rectangles, I want to be able to do something like scene.getElements() and have it return a list of elements on that scene so I can loop through them and check stuff about them. My code: final Circle circle = new Circle(200, 150, 50, Color.BLUEVIOLET); final Rectangle rectangle = new Rectangle(); rectangle.setX(50); rectangle.setY(50); rectangle.setWidth(200); rectangle.setHeight(100); rectangle.setFill(Color.CORNFLOWERBLUE); final Circle pizzaCrust = new Circle(SCENE_WIDTH/2, SCENE_HEIGHT/2, SCENE_WIDTH/2-150, Color.TAN); final Circle pizzaInside = new Circle(SCENE_WIDTH/2, SCENE_HEIGHT/2, SCENE_WIDTH/2-160, Color.LIGHTYELLOW); final Group group = new Group(pizzaCrust, pizzaInside, rectangle, circle); final Scene scene = new Scene(group, SCENE_WIDTH, SCENE_HEIGHT, Color.WHITE);
score: 0
accepted answer: http://stackoverflow.com/a/26238583
type: AnsweredQuestion

http://stackoverflow.com/comment/41263310
has text: What is `XStream2` and does the deserialization work if you use a normal `XStream` instead?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26296622

http://stackoverflow.com/q/26279448
tagged with: java
has body: I'm trying to set the SharedPrefencesin my onPostExecute method but I get NullPointerException in my error log. I've tried to put it doInBackground() but that blocks my result to be returned. So this is the code My Task class public class LoginTask extends AsyncTask&lt;Void, Void, String&gt; { private final String mEmail; private final String mPassword; private SharedPreferences sharedpreferences; private final String MyPREFERENCES = "session" ; String url = **** LoginTask(String email, String password) { mEmail = email; mPassword = password; } @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public String doInBackground(Void... params) { // TODO: attempt authentication against a network service. try { // Simulate network access. Thread.sleep(2000); } catch (InterruptedException e) { return "false"; } ArrayList&lt;BasicNameValuePair&gt; nameValuePairs = new ArrayList&lt;BasicNameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("email", mEmail)); nameValuePairs.add(new BasicNameValuePair("password", mPassword)); //Prepare the Post query try { HttpClient clientHttp = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = clientHttp.execute(httppost); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); String line = reader.readLine(); sb.append(line + "\n"); is.close(); String result = sb.toString(); System.out.println(result); return result; }catch (Exception e){ return null; } } @Override protected void onPostExecute(final String res) { try { jObj = new JSONObject(res); } catch (JSONException e) { e.printStackTrace(); } try { if (jObj.getString("code").equals("1")) { SharedPreferences.Editor e = sharedpreferences.edit(); e.putString(MyPREFERENCES,"active"); e.commit(); Intent myIntent = new Intent(getActivity(…
has answer: http://stackoverflow.com/a/26279656
tagged with: sharedpreferences
type: Question
has answer: http://stackoverflow.com/a/26279589
score: -1
has comment: http://stackoverflow.com/comment/41230931
has comment: http://stackoverflow.com/comment/41231004
has answer: http://stackoverflow.com/a/26279594
has comment: http://stackoverflow.com/comment/41230981
has comment: http://stackoverflow.com/comment/41231061
tagged with: android
downvote count: 1
favorite count: 0
upvote count: 0
accepted answer: http://stackoverflow.com/a/26279641
answer count: 5
has answer: http://stackoverflow.com/a/26279629
has comment: http://stackoverflow.com/comment/41231418
possible better answer: http://stackoverflow.com/a/26279589
has title: Getting NullPointerException while setting SharedPreferences
has comment: http://stackoverflow.com/comment/41230886
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26279641

http://stackoverflow.com/comment/41173787
comment on: http://stackoverflow.com/q/26247428
score: 0
has text: Where's your code? Specifically, where do you declare DrawingPanel and then try to instantiate it? The people who supply answers on Stack Overflow have, collectively, millenia of programming experience. To my knowledge, however, not a single one of us has psychic abilities that allow us to see your code without you first posting it.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41129735
has text: I appreciate the help :) I didn't think to use the % operator
type: AnswerComment
comment on: http://stackoverflow.com/a/26224089
score: 0
type: Comment

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/26229758
tags question: http://stackoverflow.com/q/26229536

http://stackoverflow.com/comment/41330824
comment on: http://stackoverflow.com/q/26333625
score: 0
type: Comment
type: QuestionComment
has text: That's what I was actually thinking about when I mentioned the ID using the current date, but it wouldn't be a meaningful ID unless I change that long value to a date in the form of YYYYMMDD.

http://stackoverflow.com/comment/41082407
type: Comment
has text: Now i got it i set up the while loop to start before all the equations and that worked thanks for that
comment on: http://stackoverflow.com/a/26198927
type: AnswerComment
score: 0

http://stackoverflow.com/a/26288033
answers question: http://stackoverflow.com/q/26287748
has comment: http://stackoverflow.com/comment/41248309
has comment: http://stackoverflow.com/comment/41248242
has comment: http://stackoverflow.com/comment/41248842
has body: Uninstall everything Java: Run "Control Panel" ⇒ Program and Features ⇒ Un-install programs begin with "Java", such as "Java SE Development Kit" and "Java SE Runtime". If you are not sure whether you have older version(s) of JDK, check! Install Java Goto Java SE download site @ http://www.oracle.com/technetwork/java/javase/downloads/index.html. Under "Java SE 8ux", click the "Download" button under "JDK". Check "Accept License Agreement". Choose your operating platform, e.g., Windows x86 for 32-bit Windows OS or Windows x64 for 64-bit Windows OS. You can check whether your Windows OS is 32-bit or 64-bit via "Control Panel" ⇒ System ⇒ Under the "System Type". Full instructions can be found here: https://www3.ntu.edu.sg/home/ehchua/programming/howto/JDK_Howto.html Install Android SDK The Android SDK contains all the tools and frameworks needed for developing an Android application. There are a number of steps needed to install it correctly, which are described below: http://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/ Install Xamarin After all the building blocks have been installed, it’s time for us to install our IDE. When using Windows you have a choice of IDE – Xamarin Studio or Visual Studio, we recommend having both. In this section we will look at installing Xamarin Studio. Xamarin Studio is an open-source Integrated Development Environment (IDE) designed for building Mono-based applications. Xamarin should pick up your only JDK if everything installed properly.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41257373

http://stackoverflow.com/a/26273613
has body: Try Spring MVC Internationalization In Spring MVC application, comes with few “LocaleResolver” to support the internationalization or multiple languages features,just maintance *.properties file spring tutorial here
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26273222

jconnect
tags question: http://stackoverflow.com/q/26349911
type: Tag
tag name: jconnect

php
tags question: http://stackoverflow.com/q/26249169
tags question: http://stackoverflow.com/q/26209789
tags question: http://stackoverflow.com/q/26321331
tags question: http://stackoverflow.com/q/26314029
tags question: http://stackoverflow.com/q/26289203
tags question: http://stackoverflow.com/q/26235957
tags question: http://stackoverflow.com/q/26281917
tag name: php
tags question: http://stackoverflow.com/q/26274251
tags question: http://stackoverflow.com/q/26229445
tags question: http://stackoverflow.com/q/26325896
tags question: http://stackoverflow.com/q/26290456
tags question: http://stackoverflow.com/q/26294079
tags question: http://stackoverflow.com/q/26211420
tags question: http://stackoverflow.com/q/26322095
tags question: http://stackoverflow.com/q/26238354
tags question: http://stackoverflow.com/q/26212709
tags question: http://stackoverflow.com/q/26270290
tags question: http://stackoverflow.com/q/26227671
tags question: http://stackoverflow.com/q/26231023
tags question: http://stackoverflow.com/q/26327251
tags question: http://stackoverflow.com/q/26312987
tags question: http://stackoverflow.com/q/26274133
tags question: http://stackoverflow.com/q/26299730
type: Tag

http://stackoverflow.com/q/26264947
linked to: http://stackoverflow.com/q/1480398
has comment: http://stackoverflow.com/comment/41206637
has comment: http://stackoverflow.com/comment/41205866
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41206221
tagged with: file-io
answer count: 3
has comment: http://stackoverflow.com/comment/41204834
has answer: http://stackoverflow.com/a/26264989
has title: NullPointerException when using a file as a input
has comment: http://stackoverflow.com/comment/41206013
has comment: http://stackoverflow.com/comment/41204798
has body: I was given a ready code sample for an assignemt but I can't get it to work. Love when this happens! package kth.id2010.lab.lab04; import edu.princeton.cs.introcs.In; import java.net.URL; public class Driver { public static void main(String[] args) { URL url = Driver.class.getResource("kap1.txt"); In input = new In(url);//this is where the nullPointer is pointing while(!input.isEmpty()){ String line = input.readLine().trim(); String[] words = line.split(" "); for (String word : words) { System.out.println(word); } } } } and here is the full exception that gets printed out. Exception in thread "main" java.lang.NullPointerException at edu.princeton.cs.introcs.In.(In.java:105) at kth.id2010.lab.lab04.Driver.main(Driver.java:12) I'm using maven
tagged with: maven
has comment: http://stackoverflow.com/comment/41204740
has answer: http://stackoverflow.com/a/26265978
has comment: http://stackoverflow.com/comment/41205789
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/4716503
possible better answer: http://stackoverflow.com/a/26264989
type: Question
has answer: http://stackoverflow.com/a/26279999
accepted answer: http://stackoverflow.com/a/26279999
has comment: http://stackoverflow.com/comment/41204850
has comment: http://stackoverflow.com/comment/41204898

http://stackoverflow.com/a/26314344
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26313820
has body: It sounds like you are looking for a Splitter. The idea of this EIP is to decompose a message into a set of smaller messages that can be processed individually. Given that the content may differ from one of these smaller messages to the next, it sounds like the recipient of your splitter may be a content-based route.

http://stackoverflow.com/q/26237723
has comment: http://stackoverflow.com/comment/41160628
tagged with: 3d
tagged with: libgdx
has comment: http://stackoverflow.com/comment/41155353
tagged with: flush
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: LIBGDX- More than 16/32 Textures, is flush a good idea?
answer count: 0
downvote count: 0
tagged with: opengl
score: 1
tagged with: java
has body: I'm creating a simple 3D game in LibGDX, together with my own shaders. I'm new to OpenGL so that is why I'm posting this question. Everything is working correctly for now, but only when I use openGL's flush() after each draw. camera.update(); modelBatch.begin(camera); body_texture.bind(0); modelBatch.render(modelInstance_body, characterShader); modelBatch.flush(); //If I don't flush, the bind function uses the weapon texture for both (I understand this part). But is this the way I really should draw things in OpenGL? weapon_texture.bind(0); modelBatch.render(modelInstance_weapon, characterShader); modelBatch.end(); As my comment states, is this the way I should draw things in OpenGL? The way I'm thinking about openGL's draw part is: Bind textures (Up to 16 and/or 32 units). Draw the textures with the shader. flush(), so the textures are drawn in the right order. If there's more textures, start over (bind -> draw -> flush). end(), Draws everything and the process restarts. Correct me is this is the wrong way of thinking.
type: Question

http://stackoverflow.com/comment/41088186
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26201221
has text: import to server code to eclipse or netbeans, no other easy way

http://stackoverflow.com/comment/41195272
type: QuestionComment
has text: I develop in java, but I think it's better to develop each piece of code independently, when possible.
comment on: http://stackoverflow.com/q/26259870
score: 0
type: Comment

http://stackoverflow.com/q/26323987
has answer: http://stackoverflow.com/a/26325950
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
tagged with: linux
has title: Java grph library: Exception on toools.os.OperatingSystem.getLocalOS()
type: UnansweredQuestion
has body: I'm using grph library for a university project (www.i3s.unice.fr/~hogie/grph/) but i have a problem only on Linux with that library, when i create a new Graph object, i receive the following exception: Exception in thread "main" java.lang.ExceptionInInitializerError at org.elendev.wesproject.graph.GraphFactory.main(GraphFactory.java:19) Caused by: java.lang.NullPointerException at toools.os.OperatingSystem.getLocalOS(OperatingSystem.java:47) at grph.Grph.setCompilationDirectory(Grph.java:353) at grph.Grph.&lt;clinit&gt;(Grph.java:246) ... 1 more I tried to call directly getLocalOS function, with: System.out.println(toools.os.OperatingSystem.getLocalOS()); and i receive the same exception. I cannot find information about that library, and the project launched on a macbook works perfectly. The operating system i'm currently using is gentoo linux 32bit. And the jdk version is: 1.7.0_65 Any idea of what could be the problem?
tagged with: java
type: Question

http://stackoverflow.com/q/26314705
tagged with: jpanel
tagged with: loops
has title: Add JLabel Array to JPanel
type: Question
tagged with: arrays
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41295368
tagged with: jlabel
type: UnansweredQuestion
has body: I created a JPanel Grid and now I want add Array of image Slices to Grid with loop in last line I have error. public static final int WIDTH = 1024; public static final int HEIGHT = 640; private static final int GRID_ROWS = 20; private static final int GRID_COLS = 20; private static final int GAP = 1; private static final Dimension LAYERED_PANE_SIZE = new Dimension(WIDTH, HEIGHT); private static final Dimension LABEL_SIZE = new Dimension(60, 40); private GridLayout gridlayout = new GridLayout(GRID_ROWS, GRID_COLS, GAP, GAP); private JPanel backingPanel = new JPanel(gridlayout); private JPanel[][] panelGrid = new JPanel[GRID_ROWS][GRID_COLS]; private JLabel redLabel = new JLabel("Red", SwingConstants.CENTER); private JLabel blueLabel = new JLabel("Blue", SwingConstants.CENTER); // code in constructor backingPanel.setSize(LAYERED_PANE_SIZE); backingPanel.setLocation(2 * GAP, 2 * GAP); backingPanel.setBackground(Color.black); for (int row = 0; row &lt; GRID_ROWS; row++) { for (int col = 0; col &lt; GRID_COLS; col++) { panelGrid[row][col] = new JPanel(new GridBagLayout()); backingPanel.add(panelGrid[row][col]); } } setLayout(new GridLayout(GRID_ROWS, GRID_COLS)); BufferedImage bi = null; try { bi = ImageIO.read(new File("assets/image.jpg")); } catch (IOException e) { e.printStackTrace(); } for (int r = 0; r &lt; GRID_ROWS; r++) { for (int c = 0; c &lt; GRID_COLS; c++) { int w = bi.getWidth() / GRID_ROWS; int h = bi.getHeight() / GRID_COLS; BufferedImage b = bi.getSubimage(c * w, r * h, w, h); list.add(new JLabel(new ImageIcon(b))); panelGrid[r][c] = new JPanel(new GridBagLayout()); backingPanel.add(panelGrid[r][c]); panelGrid[r][c].add(list.get(r)); } }
tagged with: java
has answer: http://stackoverflow.com/a/26314737

http://stackoverflow.com/a/26321188
accepted answer of: http://stackoverflow.com/q/26321062
has comment: http://stackoverflow.com/comment/41308233
downvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41325727
score: 2
has comment: http://stackoverflow.com/comment/41308959
has comment: http://stackoverflow.com/comment/41325740
answers question: http://stackoverflow.com/q/26321062
has comment: http://stackoverflow.com/comment/41310316
upvote count: 4
has comment: http://stackoverflow.com/comment/41309112
has body: Here is the code you should use then: import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Test { public static void main(String[] args) { System.setProperty("https.protocols", "TLSv1,SSLv3,SSLv2Hello"); System.setProperty("javax.net.debug", "all"); try{ String httpsURL = "https://sikuani.udea.edu.co:4443"; URL myurl = new URL(httpsURL); HttpURLConnection con = (HttpURLConnection)myurl.openConnection(); InputStream ins = con.getInputStream(); InputStreamReader isr = new InputStreamReader(ins); BufferedReader in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); } in.close(); } catch(Exception ex){ } } } Leave the debug on so you can see what is happening. I changed the code as per the comments I got back. There was no nee to add the lines I added. Also, you can use HttpURLConnection instead of HttpsURLConnection since it extends it. Adding 'SSLv2Hello' fixes the problem. I think this should work - try it out now.
has comment: http://stackoverflow.com/comment/41318344
type: AcceptedAnswer

http://stackoverflow.com/comment/41363571
type: QuestionComment
has text: Where do you initialize `hand`? I can't find any code that leads me to believe that `hand` is anything other than null... Sounds like a recipe for a NPE.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26351644

http://stackoverflow.com/a/26288201
has comment: http://stackoverflow.com/comment/41248770
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26288099
answers question: http://stackoverflow.com/q/26288099
has body: Your renderer is returning a JLabel (itself) that hasn't had anything set on it. Instead, extend DefaultTableCellRenderer: public class MyCellRenderer extends DefaultTableCellRenderer { @override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) { SimpleTableModel mymodel = (SimpleTableModel) jxtableListar.getModel(); ModelProtocolo actualModel= (ModelProtocolo ) mymodel.getProtocolo(rowIndex) ; JLabel label = (JLabel) super.getTableCellRendererComponent(/* pass in all params */); label.setText(/*whatever the text should be*/); label.setBackground(/*whatever the color should be*/); return label; } }
type: AcceptedAnswer

http://stackoverflow.com/comment/41165068
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26237233
has text: okay then, thanks. Maybe it's 'cuz of my referencing that i've been having issues transferring field variables subject to changes, forcing me to make them static. Thanks, i guess i need to read more.

http://stackoverflow.com/q/26319513
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: post
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41305609
answer count: 0
has body: I understand Java but am completely inexperienced with connecting to web applications. How would I take the following HTTP POST request and make it JSON? The overall purpose is to send information from a Java application to an online Ruby on Rails SQLite3 database. import java.io.*; import java.net.*; public class HTTPPostRequestWithSocket { public void sendRequest() { try { String params = URLEncoder.encode("param1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8"); params += "&amp;" + URLEncoder.encode("param2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8"); String hostname = "nameofthewebsite.com"; int port = 80; InetAddress addr = InetAddress.getByName(hostname); Socket socket = new Socket(addr, port); String path = "/nameofapp"; // Send headers BufferedWriter wr = new BufferedWriter(new OutputStreamWriter( socket.getOutputStream(), "UTF8")); wr.write("POST " + path + " HTTP/1.0rn"); wr.write("Content-Length: " + params.length() + "rn"); wr.write("Content-Type: application/x-www-form-urlencodedrn"); wr.write("rn"); // Send parameters wr.write(params); wr.flush(); // Get response BufferedReader rd = new BufferedReader(new InputStreamReader( socket.getInputStream())); String line; while ((line = rd.readLine()) != null) { System.out.println(line); } wr.close(); rd.close(); socket.close(); // Should this be closed at this point? } catch (Exception e) { e.printStackTrace(); } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41305077
tagged with: http
has comment: http://stackoverflow.com/comment/41305238
has title: How to make HTTP POST request using JSON?

http://stackoverflow.com/q/26314570
has title: ActiveMQ JMSXGroupId messages struck up in broker
has comment: http://stackoverflow.com/comment/41483143
has comment: http://stackoverflow.com/comment/41502113
has comment: http://stackoverflow.com/comment/41372070
tagged with: consumer
has comment: http://stackoverflow.com/comment/41365795
upvote count: 2
tagged with: activemq-classic
has comment: http://stackoverflow.com/comment/41365898
has comment: http://stackoverflow.com/comment/41427068
tagged with: java
has comment: http://stackoverflow.com/comment/41934310
has comment: http://stackoverflow.com/comment/41388816
has comment: http://stackoverflow.com/comment/41443498
has body: I am using 3 network of ActiveMQ brokers in my application. To maintain the order in consuming messages i used JMSXGroupId. i have configured the network of brokers using the following configuration. like this i have configured for all the 3 brokers, My policy entry is as follows <policyEntry queue=">" producerFlowControl="false" memoryLimit="5mb" queuePrefetch="1"> I am having 3 consumers in 3 different JVM, the endpoints configured with concurrentConsumers=5. the broker URL for the consumers are configured as follows. Consumer-1 : failover:(tcp://host1.name:61616, tcp://host2.name:61616, tcp://host3.name:61616) ?randomize=false &priorityBackup=true Consumer-2 : failover:(tcp://host2.name:61616, tcp://host3.name:61616, tcp://host1.name:61616) ?randomize=false &priorityBackup=true Consumer-3 : failover:(tcp://host3.name:61616, tcp://host1.name:61616, tcp://host2.name:61616) ?randomize=false &priorityBackup=true Use Case: I use to publish 3000 messages every 15 mins. for each and every message the JMSXGroupId is different & unique one. The last 2 messages will have the same JMSXGroupId. Issue: In consumer side the ~95% of messages consumed properly and ~5% of messages will struck up in broker (Pending in broker). Note: The consumer will take 1000ms to process the message. Messages will start to be in broker in the 4th or 5th iteration of message publish. If we increase the maxPageSize from default value 200 to 1000. then the struck up starts @12th or 15th iteration. Could any one help me to fix this problem... if you need more detail about this please comment will share you. ADDITIONAL DETAIL Messages are persist not transacted I have 5 consumers (each broker has own 5 real consumers and 2 forwarding consumers) The brokers and consumers not restarted during the test But the Publisher, start the process and publish the messages then it will be down, then after 15 mins its again start and publish The publisher connect the broker with DNS and the consumers are connected…
type: UnansweredQuestion
tagged with: caching
has comment: http://stackoverflow.com/comment/41896821
has comment: http://stackoverflow.com/comment/41934346
has comment: http://stackoverflow.com/comment/41354522
has comment: http://stackoverflow.com/comment/41502181
has comment: http://stackoverflow.com/comment/41406289
has comment: http://stackoverflow.com/comment/41465962
score: 2
has comment: http://stackoverflow.com/comment/41934266
answer count: 0
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41354544
type: Question
has comment: http://stackoverflow.com/comment/41388968

http://stackoverflow.com/q/26310297
has answer: http://stackoverflow.com/a/26310588
accepted answer: http://stackoverflow.com/a/26310588
tagged with: selector
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has body: I am running a long time selector test on the windows7 system on the eclipse console.After 12 hours, so much select.open have been done seccessfully times by times, it,the 'selector.open()', suddenly throws the following excetption: java.io.IOException: Unable to establish loopback connection at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:125) at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:69) at java.security.AccessController.doPrivileged(Native Method) at sun.nio.ch.PipeImpl.&lt;init&gt;(PipeImpl.java:141) at sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50) at java.nio.channels.Pipe.open(Pipe.java:150) at sun.nio.ch.WindowsSelectorImpl.&lt;init&gt;(WindowsSelectorImpl.java:126) at sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44) at java.nio.channels.Selector.open(Selector.java:227) at cn.scut.chiu.weibocrawler.job.JobManager.initIO(JobManager.java:55) at cn.scut.chiu.weibocrawler.job.JobManager.&lt;init&gt;(JobManager.java:50) at cn.scut.chiu.weibocrawler.distributed.worker.Worker.doCommandJob(Worker.java:80) at cn.scut.chiu.weibocrawler.distributed.NodeBase.writeOp(NodeBase.java:186) at cn.scut.chiu.weibocrawler.distributed.NodeBase.selectOp(NodeBase.java:87) at cn.scut.chiu.weibocrawler.distributed.worker.Worker.run(Worker.java:63) at java.lang.Thread.run(Thread.java:722) Caused by: java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:344) at sun.nio.ch.Net.bind(Net.java:336) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:199) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67) at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:91) ... 15 more And my question is that what has happened to the program? And how to fix it?
favorite count: 0
has title: java.io.IOException: Unable to establish loopback connection java.net.BindException Address already in use: bind
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/26230847
answers question: http://stackoverflow.com/q/26230204
has body: There you go: it's pretty simple : File fout = new File("xxx.txt"); //File Name if (!fout.isFile()) // IF CANNOT FIND FILE { OptionPane.showMessageDialog(null, "Can't find: xxx.txt - is not an existing file"); System.out.println("xxx.txt - Parameter is not an existing file"); return; } BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fout),"UTF-8")); String line = null; int lineCount = 0; while ((line = br.readLine()) != null) { if (line.length()&gt;1) // checks if he line is full and/or not blank { line.trim(); lineCount++; } } br.close(); //closing the BufferedReader String[] tempArray = new String[lineCount]; //declare an array with the line number of the file. Hope this helps :) Dave.
score: 0
type: Answer

http://stackoverflow.com/comment/41333308
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26334898
has text: Please provide method `firePropertyChange`.

http://stackoverflow.com/comment/41242848
type: QuestionComment
comment on: http://stackoverflow.com/q/26285483
score: 0
has text: I edited it to add a bit more
type: Comment

http://stackoverflow.com/q/26195929
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/41078424
answer count: 1
accepted answer: http://stackoverflow.com/a/26196864
score: 0
tagged with: android
tagged with: android-activity
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/41077969
has comment: http://stackoverflow.com/comment/41078358
has comment: http://stackoverflow.com/comment/41078256
has answer: http://stackoverflow.com/a/26196864
type: AnsweredQuestion
tagged with: java
has body: Good day, I am using Parse Push Notification, and below are my difficulties: In brief, I would like to "merge" these two conditions: query.whereEqualTo("Gender", userLookingGender); pushQuery.whereEqualTo("the gender column of the ParseQuery", the user gender of the ParseQuery column); In other words, I would like to send out a message to the user that falls within that gender. The gender column along with the genders are found in the parse query called "User". Update: userLookingGender is the following: String userLookingGender = ParseUser.getCurrentUser().getString( "Looking_Gender"); If you need any clarification let me know. Update 2: I use one condition, gender, to make easier to understand. Now Imagine if I had multiple condition, and is trying to send a push message only the recipient who fulfill all of the below criteria, and where upon button click it would take them to particular activity page. ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("User"); query.whereNotEqualTo("objectId", ParseUser.getCurrentUser() .getObjectId()); // users with Gender = currentUser.Looking_Gender query.whereEqualTo("Gender", userLookingGender); // users with Looking_Gender = currentUser.Gender query.whereEqualTo("Looking_Gender", userGender); query.setLimit(1) ; ParseGeoPoint point = ParseUser.getCurrentUser().getParseGeoPoint("location"); query.whereWithinKilometers("location", point, mMax_Distance.doubleValue()); query.whereEqualTo("ActivityName", activityName); query.whereGreaterThanOrEqualTo("UserAge", minimumAge); query.whereLessThanOrEqualTo("UserAge", maximumAge); Update 3: Android Code ParseCloud.callFunctionInBackground("sendPushToNearbyAndMatching", new HashMap&lt;String, Object&gt;(), new FunctionCallback&lt;String&gt;() { public void done(String result, ParseException e) { if (e == null) { // success } } }); Parse Cloud JavaScript code (found in cloud/main.js) The owner column in this case is users // Use Parse.Cloud.define to define as many cloud functio…
has title: Push Notification condition

http://stackoverflow.com/a/30607179
type: Answer
has body: ok old stuff but anyway. i started to use Realm in android now and i'm still checking it out but for past experiences using OO databases since transactions can be cancelled the more transactions you do the bigger the footprint you will leave, in order to cancel a copy of the state must exist but you are commiting right, from my experience the prob is that some databases do not discard the transactions right away after commiting but this is behind the scene stuff (i cannot confirm this, just talking about previous experiences that i had with other OO databases where you could config these settings) another thing that i noticed in both codes here is that none closes the instance and so (also speculating) maybe the Realm of each commited transaction is not being able to get GC again just speculating hope it helps
answers question: http://stackoverflow.com/q/26254881
score: 0

http://stackoverflow.com/q/26325781
tagged with: methods
possible better answer: http://stackoverflow.com/a/26325821
has comment: http://stackoverflow.com/comment/41316761
answer count: 2
has answer: http://stackoverflow.com/a/26325821
linked to: http://stackoverflow.com/q/3988788
has answer: http://stackoverflow.com/a/26326109
score: 0
has comment: http://stackoverflow.com/comment/41316415
has comment: http://stackoverflow.com/comment/41316079
has comment: http://stackoverflow.com/comment/41316021
has comment: http://stackoverflow.com/comment/41315859
accepted answer: http://stackoverflow.com/a/26326109
has title: Passing An Object Across Classes
has body: Extremely simple question from an extremely simple high-school java student. I've gathered user input and created an object "AccountOne". I must pass AccountOne into class printcode and use the printaccount method to print "myaccount.name, myaccount.address, myaccount.type, myaccount.balance". My teacher has been trying to explain inheritance and she's just losing me more and more with each day. From what I understood, object myaccount of type AccountOne should now "have" myaccount.name, myaccount.address, myaccount.type, myaccount.balance" within itself. And because I passed the object into the method, the method inherits whatever is in the object. Ergo, method printaccount should be able to find symbols "myaccount, my account.name, myaccount.address, myaccount.type, myaccount.balance". I've researched and everything doesn't make sense to me, it all appears to be about way more advanced stuff that I haven't even begun to grasp yet. If there's a duplicate question please point me to it. When compiling i get 10+ errors saying "not a statement" or "cannot find symbol myaccount". At this point i'll just take the zero, I'm beyond frustrated. It's most likely something stupidly simple that i keep glancing over. I've tried defining the variables within printcode before the main statement. Defined variables in AccountOne. Attempted to research different ways of define a method and couldn't find anything that made sense to me. import java.util.Scanner; public class AccountOne { public String name; public String address; public String type; public double balance; public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); System.out.print("Enter Name "); String name=keyboard.nextLine(); System.out.println(); System.out.print("Enter Address "); String address=keyboard.nextLine(); System.out.println(); System.out.print("Enter type "); String type=keyboard.nextLine(); System.out.println(); System.out.print("Enter Balance "); double balance=keyboard.nextD…
type: Question
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41315900
tagged with: java
has comment: http://stackoverflow.com/comment/41316460

http://stackoverflow.com/q/26272931
answer count: 1
tagged with: string
score: 0
has title: Is this brute-force algorithm NP-hard?
has answer: http://stackoverflow.com/a/45361826
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41219752
has comment: http://stackoverflow.com/comment/41223284
type: Question
tagged with: np
tagged with: algorithm
tagged with: java
has body: Here's a brute-force algorithm we're using in a project management system for extracting keywords from abstracts. What is the time complexity of that brute force algorithm? Is it NP-hard, NP-complete, in NP, or in P? This is the algorithm: public static int search(String pattern, String text) { int M = pattern.length(); int N = text.length(); for (int i = 0; i &lt; N - M; i++) { int j; for (j = 0; j &lt; M; j++) { if (text.charAt(i+j) != pattern.charAt(j)) { break; } } if (j == M) { return i; } } return -1; }
has comment: http://stackoverflow.com/comment/41219509
tagged with: time-complexity

http://stackoverflow.com/q/26206738
tagged with: dictionary
has title: Java Map: Using value object's attribute as key, bad practice?
has comment: http://stackoverflow.com/comment/41097150
upvote count: 3
has comment: http://stackoverflow.com/comment/41096670
has comment: http://stackoverflow.com/comment/61069350
type: Question
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/26207026
tagged with: java
has body: Is it bad practice to use an object's attribute as the key for a map entry? Every time I do it, it feels wrong. For example: class Foo { String name; String bar; } And then use a Map like this: Foo foo = new Foo(); foo.name = "foo bar"; foo.bar = "blaaaa"; Map&lt;String, Foo&gt; foos = new HashMap&lt;&gt;(); foos.add(foo.name, foo); It feels kind of wrong.
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26207026

http://stackoverflow.com/comment/41120799
has text: you are using the same color for all..
comment on: http://stackoverflow.com/q/26219597
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41215710
type: AnswerComment
comment on: http://stackoverflow.com/a/26263690
score: 0
type: Comment
has text: But every time, when i changed some line in that common code then i have to builds jar once again and have to add in different modules separately.

http://stackoverflow.com/q/26282012
accepted answer: http://stackoverflow.com/a/26284602
linked to: http://stackoverflow.com/q/8039041
has comment: http://stackoverflow.com/comment/41236386
has title: Hibernate entity life cycle and session life cycle inside a Spring transaction
linked to: http://stackoverflow.com/q/10173331
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: jpa-2.0
favorite count: 0
has answer: http://stackoverflow.com/a/26284602
type: Question
answer count: 2
has body: Im having some trouble understanding the way spring handles the hibernate entities, and does the lazy loading process. So for this case we have to entities @Entity public class EntityA{ @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @ManyToMany(cascade={CascadeType.PERSIST, CascadeType.REFRESH}) private Collection<EntityB> bss= new ArrayList<EntityB>(); and the agregated entity @Entity public class EntityB{ @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @ManyToMany(mappedBy="bss") private Collection<EntityA> ass= new ArrayList<EntityA>(); then I have a simple business class marked as transactional: @Component @Scope("session") @Transactional(propagation=Propagation.TRIED_EVERY_SINGLE_ONE) public class GenericTestBean { private EntityA entityA; @Autowired private IGenericDAO genericDAO; public GenericTestBean() { System.out.println("bean creado!"); } public void testQuery() { entityA= genericDAO.get(EntityA.class, 1l); System.out.println(TransactionIndicatingUtil.getTransactionStatus(true)); System.out.println("is element atached? :" + genericDAO.isAtached(entityA)); //this.loadData(); } public void loadData(){ System.out.println(TransactionIndicatingUtil.getTransactionStatus(true)); System.out.println("is element atached? :" + genericDAO.isAtached(currentCompany)); System.out.println(entityA.getBss.size()); } } and a Simple test class @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "applicationContext.xml" }) @WebAppConfiguration public class EntityQueryTest { // @Autowired // private SessionFactory sessionFactory; @Autowired GenericTestBean genericTestBean; @Test public void consultarCompania(){ genericTestBean.testQuery(); genericTestBean.loadData(); } what Im guessin that should happen is: 1. GenericTestBean gets instantiated 2. testQuery is called from outside the proxy starting the transaction 2. loadData is called, the proxy sees the active transaction, and takes the existent resources 3. …
tagged with: spring
has comment: http://stackoverflow.com/comment/41236724
possible better answer: http://stackoverflow.com/a/26283352
has answer: http://stackoverflow.com/a/26283352
tagged with: java
tagged with: hibernate
upvote count: 1

http://stackoverflow.com/q/26270294
possible better answer: http://stackoverflow.com/a/26270422
has answer: http://stackoverflow.com/a/26270422
type: Question
has comment: http://stackoverflow.com/comment/41214789
tagged with: bitmap
has answer: http://stackoverflow.com/a/26270430
has answer: http://stackoverflow.com/a/26270416
score: 0
tagged with: java
has title: Bitmap image coming out warped
answer count: 3
has comment: http://stackoverflow.com/comment/41214817
accepted answer: http://stackoverflow.com/a/26270416
has body: // load pixels into an image this.image = new BufferedImage(this.width, this.height, BufferedImage.TYPE_INT_RGB); // get actual image data for easier pixel loading byte[] iData = new byte[this.size - 54]; for(int i = 0; i &lt; this.size - 54; i++) { iData[i] = this.data[i+54]; } // start from bottom row for(int y = this.height-1; y &gt;= 0; y--) { for(int x = 0; x &lt; this.width; x++) { int index = (this.width*y + x) * 3; int b = iData[index]; int g = iData[index+1]; int r = iData[index+2]; //System.out.format("R: %s\nG: %s\nB: %s\n\n", r, g, b); // merge rgb values to single int int rgb = ((r&amp;0x0ff)&lt;&lt;16)|((g&amp;0x0ff)&lt;&lt;8)|(b&amp;0x0ff); // build image from bottom up this.image.setRGB(x, this.height-1-y, rgb); } } I'm reading RGB values from a Bitmap. My iData byte array is correct, as I've checked it against a hex editor. However, when I run this loop, my output image is warped (see picture). I've been wracking my brain for hours trying to fix this, why is it happening? Input image is a canadian flag. output image:
has comment: http://stackoverflow.com/comment/41214719
tagged with: arrays
has comment: http://stackoverflow.com/comment/41214790
tagged with: rgb
type: AnsweredQuestion

http://stackoverflow.com/comment/41233763
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26280958
has text: @BoristheSpider I've included that hint.
type: AnswerComment

http://stackoverflow.com/q/26280879
downvote count: 0
has comment: http://stackoverflow.com/comment/41234849
favorite count: 0
linked to: http://stackoverflow.com/q/22259733
tagged with: ocpjp
has comment: http://stackoverflow.com/comment/41233949
tagged with: regex
duplicate of: http://stackoverflow.com/q/22259733
type: AnsweredQuestion
has title: How does string.split("\\S") work
has answer: http://stackoverflow.com/a/26281437
has answer: http://stackoverflow.com/a/26281152
accepted answer: http://stackoverflow.com/a/26281152
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41234730
possible better answer: http://stackoverflow.com/a/26281367
has body: I was doing a question out of the book oracle_certified_professional_java_se_7_programmer_exams_1z0-804_and_1z0-805 by Ganesh and Sharma. One question is: Consider the following program and predict the output: class Test { public static void main(String args[]) { String test = "I am preparing for OCPJP"; String[] tokens = test.split("\\S"); System.out.println(tokens.length); } } a) 0 b) 5 c) 12 d) 16 Now I understand that \S is a regex means treat non-space chars as the delimiters. But I was puzzled as to how the regex expression does its matching and what are the actual tokens produced by split. I added code to print out the tokens as follows for (String str: tokens){ System.out.println("&lt;" + str + "&gt;"); } and I got the following output 16 &lt;&gt; &lt; &gt; &lt;&gt; &lt; &gt; &lt;&gt; &lt;&gt; &lt;&gt; &lt;&gt; &lt;&gt; &lt;&gt; &lt;&gt; &lt;&gt; &lt; &gt; &lt;&gt; &lt;&gt; &lt; &gt; So a lot of empty string tokens. I just do not understand this. I would have thought along the lines that if delimiters are non space chars that in the above text then all alphabetic chars serve as delimiters so maybe there should be 21 tokens if we are matching tokens that result in empty strings too. I just don't understand how Java's regex engine is working this out. Are there any regex gurus out there who can shed light on this code for me?
score: 15
has answer: http://stackoverflow.com/a/26281367
has comment: http://stackoverflow.com/comment/41234616
upvote count: 15
answer count: 3

http://stackoverflow.com/comment/41344502
comment on: http://stackoverflow.com/a/26341090
type: Comment
has text: If I put the code in the loop and i input choice, it chooses the same object numberOfShips times. I need to be able to choose different Ship objects
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41294679
type: Comment
type: QuestionComment
has text: @Zhuinden Formatting is ok, but please don't remove other changes
comment on: http://stackoverflow.com/q/26314300
score: 0

http://stackoverflow.com/q/26330126
has title: How to stop infinite loop for UPC check code
score: 0
has answer: http://stackoverflow.com/a/26330252
tagged with: barcode
tagged with: infinite
type: UnansweredQuestion
has body: my code has an infinite loop and I cannot seem to break it. Also, when inserting a blank line, I am told that there is an index error. Please help! The first step of checking a valid UPC is adding the odd position digits and multiplying by three, then you add that number to the sum of the even position digits. Then compute the remainder when divided by 10. If the remainder is not zero, subtract this remainder from 10 to get the check digit. If the remainder is zero, then the check digit should be 0. public static void main(String[] args) { Scanner in = new Scanner (System.in); System.out.println("Enter a UPC (enter a blank line to quit): "); String enterUPC = in.nextLine(); int length = enterUPC.length(); int checkDigit=0; char char1, char2, char3, char4, char5, char6, char7, char8, char9, char10, char11, char12; int num1, num2, num3, num4, num5, num6, num7, num8, num9, num10, num11, num12; char1 = enterUPC.charAt(0); num1 = Character.getNumericValue(char1); char2 = enterUPC.charAt(1); num2 = Character.getNumericValue(char2); char3 = enterUPC.charAt(2); num3 = Character.getNumericValue(char3); char4 = enterUPC.charAt(3); num4 = Character.getNumericValue(char4); char5 = enterUPC.charAt(4); num5 = Character.getNumericValue(char5); char6 = enterUPC.charAt(5); num6 = Character.getNumericValue(char6); char7 = enterUPC.charAt(6); num7 = Character.getNumericValue(char7); char8 = enterUPC.charAt(7); num8 = Character.getNumericValue(char8); char9 = enterUPC.charAt(8); num9 = Character.getNumericValue(char9); char10 = enterUPC.charAt(9); num10 = Character.getNumericValue(char10); char11 = enterUPC.charAt(10); num11 = Character.getNumericValue(char11); char12 = enterUPC.charAt(11); num12 = Character.getNumericValue(char12); while(length &gt; 0) { //Algorithm Step One and Algorithm Step Two int stepOne = (num1 + num3 + num5 + num7 + num9 + num11) * 3; int stepTwo = stepOne + (num2 + num4 + num6 + num8 + num10); while (length == 12) { //Algorithm Step Three if(stepTwo%10!=0) { c…
has answer: http://stackoverflow.com/a/26330192
tagged with: java
tagged with: loops
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41324186

http://stackoverflow.com/comment/89736010
comment on: http://stackoverflow.com/a/26252993
type: AnswerComment
type: Comment
score: 2
has text: This should be the accepted answer, much simpler than installing extraneous software, especially if you're using a corporate managed Mac where there are restrictions on software that can be installed.

atomic
type: Tag
tag name: atomic
tags question: http://stackoverflow.com/q/26215371

http://stackoverflow.com/q/26239026
answer count: 1
has comment: http://stackoverflow.com/comment/41157056
has title: Opening and appending files
has body: I need to open an existing file for appending and create new file for appending if it doesn't exist. I tried PrintWriter function but it always create a new file and deletes the old. So could you help me? What should I use for that? UPD: That's what I already tried writer = new PrintWriter(System.getProperty("db.file"), "UTF-8"); writer.println("The first line");
tagged with: append
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41157018
tagged with: java
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/26239139
accepted answer: http://stackoverflow.com/a/26239139
score: 0

http://stackoverflow.com/a/26281393
has comment: http://stackoverflow.com/comment/41235308
answers question: http://stackoverflow.com/q/26280689
has comment: http://stackoverflow.com/comment/41242841
score: 0
has body: When there is an authentication failure, the exception is stored in the model using the name SPRING_SECURITY_LAST_EXCEPTION. You can display the exception message on your login page, following example is from a Velocity view: #if ($SPRING_SECURITY_LAST_EXCEPTION) &lt;p class="error"&gt;${SPRING_SECURITY_LAST_EXCEPTION.message}&lt;/p&gt; #end
type: Answer

http://stackoverflow.com/comment/41323837
has text: You could for example test if the file with the name `filename` was created successfully if your method did his work.
score: 0
comment on: http://stackoverflow.com/q/26329883
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41106755
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26211755
has text: yes of course, I forgot it. It's a bit misleading that 2014-10-06 13:00:00 works as it should. Thank you!

http://stackoverflow.com/q/26293330
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/41256537
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/26293361
has answer: http://stackoverflow.com/a/26293941
has title: Array indexing issues
score: 0
has answer: http://stackoverflow.com/a/26293346
answer count: 5
possible better answer: http://stackoverflow.com/a/26293346
has answer: http://stackoverflow.com/a/26293348
accepted answer: http://stackoverflow.com/a/26293941
has body: I am trying to use a for loop to create 7 instances of a class. I can go through the loop 7 times, but once I press enter I get an ArrayIndexOutOfBound error. My code is as follows: Data[] temperatures = new Data[7]; for(int i=1; i&lt;=temperatures.length + 1; i++) { System.out.println("Please enter the temperature for day " + i); temperatures[i] = new Data(input.nextDouble()); }
has answer: http://stackoverflow.com/a/26293354
type: AnsweredQuestion

http://stackoverflow.com/comment/98233954
has text: I've noticed that this solution only works when both databases are mapped to the same JDBC Driver. However, won't work when you've two different data sources connecting to two different Drivers. EG: one Driver using MariaDB Driver, & the other one using the ibm DB2Driver...
comment on: http://stackoverflow.com/a/33822664
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/41159697
type: Comment
has text: Also should add, it's at a risk of being closed because of the fact of how unclear it is.
comment on: http://stackoverflow.com/q/26240303
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41256828
comment on: http://stackoverflow.com/q/26293423
has text: could you post your full code?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26349232
has comment: http://stackoverflow.com/comment/41359441
type: Question
has title: accessing Arraylist containing JPanels holding JFormattedTextFields (setText & getText)?
has comment: http://stackoverflow.com/comment/41359627
tagged with: arraylist
score: 0
answer count: 0
type: UnansweredQuestion
has body: So I have around 6 or so JFormattedTextfields inside a JPanel, and a couple dozen of these JPanels. I can put each JPanel in it's own component array using: Component[] layer1 = LayerPanel1.getComponents(); etc.. which gives me an array of the JFormattedTextfields in that panel. I can also put the component arrays in an ArrayList using: layerSet_components.add(layer1); etc.. What I need to know is how to setText the text of a particular JFormattedTextfield inside the ArrayList and to also getText of a particular JFormattedTextfield.
has comment: http://stackoverflow.com/comment/41359274
has comment: http://stackoverflow.com/comment/41359914
tagged with: java
tagged with: jpanel

http://stackoverflow.com/comment/41329929
type: Comment
has text: oh wow that's all I needed. The logic makes since though. Add a comma only when next line is found. Thank you.
comment on: http://stackoverflow.com/a/26333159
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41240915
has text: There are plenty examples about this on the net. I can only provide the keywords to search for a tutorial: *`<programming language>` rest services tutorial*. For example: *java rest services tutorial*, *c# rest services tutorial*, and on.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26284578

http://stackoverflow.com/comment/41307020
type: AnswerComment
score: 0
type: Comment
has text: Thanks, will do, I suspect that the above solution will require a different advisor tag for each pointcut/method where the advice would be applied?
comment on: http://stackoverflow.com/a/26320639

base64
tags question: http://stackoverflow.com/q/26236015
tags question: http://stackoverflow.com/q/26299965
tag name: base64
tags question: http://stackoverflow.com/q/26300695
tags question: http://stackoverflow.com/q/26233912
tags question: http://stackoverflow.com/q/26295558
tags question: http://stackoverflow.com/q/26220002
tags question: http://stackoverflow.com/q/26275738
tags question: http://stackoverflow.com/q/26302917
type: Tag

http://stackoverflow.com/a/26216198
has body: When you create and add panels to your resultPanel which has GridLayout, the child panels are created with FlowLayout. Those child panels have 5 pixel horizontal and vertical gaps. Create those like this: JPanel markUpPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); The FlowLayout class has a constructor where you can specify the horizontal and veritcal gaps, pass 0 pixel to those. If you don't specify them, the default is 5 pixel.
answers question: http://stackoverflow.com/q/26216039
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26216039
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/41090179
type: QuestionComment
has text: JDK 1.8.0_20, yesterday I had it on Ubuntu 14.04, today: Windows 8.1 Pro. I changed the path format for the Windows kind: "C:\\Users\\Insanovation\\Downloads\\F.mp3".
comment on: http://stackoverflow.com/q/26196809
score: 0
type: Comment

http://stackoverflow.com/comment/41313622
type: Comment
type: AnswerComment
has text: Unless you provide your singleton with multiple map for the different value types there is no way, because there is only one instance of your Singleton not one instance per type variable instance. The problem is not getting the single line version running. The problem is that the singleton is a class and not a template.
score: 0
comment on: http://stackoverflow.com/a/26323752

http://stackoverflow.com/q/26241367
favorite count: 0
has comment: http://stackoverflow.com/comment/41161582
downvote count: 0
has comment: http://stackoverflow.com/comment/41161706
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41161628
tagged with: output
linked to: http://stackoverflow.com/q/11936327
has body: I have this code and I'm trying to format the output as shown below, but when I start the program and reach to printf, it stops and gives error Exception in thread "main" java.util.IllegalFormatConversionException: f != java.lang.String variables: itemcode=integer selecteditems=string perkg=double userkg=string quantity-integer dry=string total=double Note: those are changeable variables into for loop. System.out.printf("%-4d %-13s %8.2f %8.2f %-8d %-10s %8.2f %n", itemcode, selecteditems, per_kg, userkg, quantity, dry, total);
has comment: http://stackoverflow.com/comment/41161664
type: Question
has comment: http://stackoverflow.com/comment/41161511
has comment: http://stackoverflow.com/comment/41161707
has comment: http://stackoverflow.com/comment/41161656
accepted answer: http://stackoverflow.com/a/26241499
answer count: 1
has comment: http://stackoverflow.com/comment/41161634
has title: formatting output in java using printf
upvote count: 1
has answer: http://stackoverflow.com/a/26241499

http://stackoverflow.com/comment/41198801
score: 0
comment on: http://stackoverflow.com/a/26261617
has text: @Zhaonan see my comment in response to your edit. `==` will work with _some_ numbers, and that has always been the case. It will not work in all cases. It has nothing to do with the Java version.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41308575
has text: See also [*What's Java Hybrid—Applet + Application?*](http://stackoverflow.com/q/12449889/230513).
score: 2
comment on: http://stackoverflow.com/q/26319866
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26346060
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/55531903
type: Question
has answer: http://stackoverflow.com/a/50109710
has answer: http://stackoverflow.com/a/26346341
accepted answer: http://stackoverflow.com/a/26346341
linked to: http://stackoverflow.com/q/9598166
has title: javax.json: Add new JsonNumber to existing JsonObject
upvote count: 19
has body: I want to add properties to an existing instance of JsonObject. If this property is boolean, this is quite easy: JsonObject jo = ....; jo.put("booleanProperty", JsonValue.TRUE); However, I also want to add a JsonNumber but I couldn't find a way to create an instance of JsonNumber. Here's what I could do: JsonObjectBuilder job = Json.createObjectBuilder(); JsonNumber jn = job.add("number", 42).build().getJsonNumber("number"); jo.put("numberProperty", jn); But I couldn't think of a more dirty way to accomplish my task. So - is there are more direct, cleaner approach to add a JsonNumber to an existing instance of JsonObject?
has comment: http://stackoverflow.com/comment/41355363
favorite count: 0
has answer: http://stackoverflow.com/a/79077919
has comment: http://stackoverflow.com/comment/41354478
score: 19
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/55531903
downvote count: 0

http://stackoverflow.com/a/26250312
type: Answer
has comment: http://stackoverflow.com/comment/41178462
answers question: http://stackoverflow.com/q/26250274
has comment: http://stackoverflow.com/comment/41178131
has comment: http://stackoverflow.com/comment/41178485
score: 1
accepted answer of: http://stackoverflow.com/q/26250274
downvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41178122
has comment: http://stackoverflow.com/comment/41178114
upvote count: 2
has body: For all lengths: Here is one solution that is based on the idea of the book "Cracking the Coding Interview" (P54): /** * List permutation of a string * * @param s the input string * @return the list of permutation */ public static ArrayList<String> permutation(String s) { // The result ArrayList<String> res = new ArrayList<String>(); // If input string's length is 1, return {s} if (s.length() == 1) { res.add(s); } else if (s.length() > 1) { int lastIndex = s.length() - 1; // Find out the last character String last = s.substring(lastIndex); // Rest of the string String rest = s.substring(0, lastIndex); // Perform permutation on the rest string and // merge with the last character res = merge(permutation(rest), last); } return res; } /** * @param list a result of permutation, e.g. {"ab", "ba"} * @param c the last character * @return a merged new list, e.g. {"cab", "acb" ... } */ public static ArrayList<String> merge(ArrayList<String> list, String c) { ArrayList<String> res = new ArrayList<String>(); // Loop through all the string in the list for (String s : list) { // For each string, insert the last character to all possible postions // and add them to the new list for (int i = 0; i <= s.length(); ++i) { String ps = new StringBuffer(s).insert(i, c).toString(); res.add(ps); } } return res; } Running output of string "abcd": Step 1: Merge [a] and b: [ba, ab] Step 2: Merge [ba, ab] and c: [cba, bca, bac, cab, acb, abc] Step 3: Merge [cba, bca, bac, cab, acb, abc] and d: [dcba, cdba, cbda, cbad, dbca, bdca, bcda, bcad, dbac, bdac, badc, bacd, dcab, cdab, cadb, cabd, dacb, adcb, acdb, acbd, dabc, adbc, abdc, abcd] (OR) for fixed size Use recursion. Try each of the letters in turn as the first letter and then find all the permutations of the remaining letters using a recursive call. The base case is when the input is an empty string the only permutation is the empty string. public static void permutation(String str) { permutation("", str); } private static void permutation…

http://stackoverflow.com/comment/41352972
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26302673
has text: number of buckets. This is a little off topic, but the load factor is by default 75%. Also, off topic again, this is why you want to set an initial capacity that is reflected with the number of total elements you think will be in the map, because it gets increasingly expensive to refactor the map as the number of elements stored gets larger and larger. You want to set the initial capacity just over the maximum number of elements you think will be stored to alleviate this cost later on.
score: 0

http://stackoverflow.com/comment/41147394
has text: You are trying to give the JVM more memory than you have.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26233595

http://stackoverflow.com/comment/41211443
comment on: http://stackoverflow.com/q/26268447
type: Comment
type: QuestionComment
score: 5
has text: Welcome to Stack Overflow. Please show us the code that's giving you trouble.

http://stackoverflow.com/q/26308354
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26308442
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/81279598
tagged with: java
has comment: http://stackoverflow.com/comment/41284744
has body: I am working on a project, in which I must graph both horizontal and vertical error bars. Most libraries I have found graph only vertical bars. Is there any way you know to graph horizontal error bars?
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/81073756
tagged with: graph
tagged with: graphics
type: UnansweredQuestion
has title: How can I graph horizontal error bars in java?

http://stackoverflow.com/comment/41317819
type: QuestionComment
comment on: http://stackoverflow.com/q/26317019
score: 1
has text: You are trying to cast a non-activity Context to an Activity. You need to call finish() on the instance of Activity, not the broadcast receiver's Context.
type: Comment

http://stackoverflow.com/comment/41192552
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26251798
has text: I applied Thread.sleep() and it worked but it didn't with implicit wait. don't know if this is the right way to implement or not.

http://stackoverflow.com/comment/41330019
score: 0
type: Comment
type: QuestionComment
has text: I tried creating it in API 19, still same errors and I tried updating the library like the tutorial in the link above. I downloaded the android support library and repository
comment on: http://stackoverflow.com/q/26332090

http://stackoverflow.com/a/26200681
answers question: http://stackoverflow.com/q/26200618
upvote count: 1
type: Answer
has body: I think that mostly depends whether you want the document to open in java or not. If you want it that way you can parse the document, then while going through your objects in your document, find those URL references, download the images (neither by an API or implement your own API) and present it to the user. I can't think of other way of making that happen.
downvote count: 0
score: 1

http://stackoverflow.com/q/26266384
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/26267983
favorite count: 0
score: 8
upvote count: 8
has title: Functions and Operators not working in Eclipselink
has body: I have this problem, REPLACE function is not working with eclipselink version 2.5.2. Here is my code: String sSql = " SELECT e FROM br.com.megasoft.protocolo.entity.Assunto e WHERE ( REPLACE(REPLACE(REPLACE( UPPER(e.titulo), '/', ''), '-', ''), '.', '') LIKE UPPER('A') )"; TypedQuery&lt;?&gt; query = getEntityManager().createQuery(sSql, Class.forName(this.tabela)); And the second parameter has the value of: class br.com.megasoft.protocolo.entity.Assunto It gives this exception: Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.JPQLException Exception Description: Syntax error parsing [ FROM br.com.megasoft.protocolo.entity.Assunto e WHERE ( REPLACE(REPLACE(REPLACE( UPPER(e.titulo), '/', ''), '-', ''), '.', '') LIKE UPPER( :valorPesq10) ) ]. [54, 150] The expression is not a valid conditional expression. at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:155) at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:334) at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:278) at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:163) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:142) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:116) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.&lt;init&gt;(EJBQueryImpl.java:102) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.&lt;init&gt;(EJBQueryImpl.java:86) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1603) ... 50 more It works completely fine when I'm using Hibernate. When I run simple SQL, without REPLACE, it works fine. Obs: Eclipselink 2.5.2 is using JPA 2.1. I'm using Tomcat8, Eclipse Kepler.
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26278541
has answer: http://stackoverflow.com/a/26267983
accepted answer: http://stackoverflow.com/a/26278541
has answer: http://stackoverflow.com/a/26271724
answer count: 3
tagged with: eclipselink

http://stackoverflow.com/a/26349761
has comment: http://stackoverflow.com/comment/41367141
type: Answer
answers question: http://stackoverflow.com/q/26347044
has comment: http://stackoverflow.com/comment/41361332
accepted answer of: http://stackoverflow.com/q/26347044
has body: For simple case you can use HttpSessionListener as follows: @WebListener public class MySessionListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent se) { // new session created - add your singleton Foo f = new Foo(); se.getSession().setAttribute("Foo", f); // if you need id you can use - se.getSession().getId(); } public void sessionDestroyed(HttpSessionEvent se) { // session destroyed - do cleanup Foo f = (Foo) se.getSession().getAttribute("Foo"); f.destroy(); // your object cleanup method } } If you need to run it in the cluster with session replication, your class should be small and Serializable, otherwise you would need to implement your Map solution and HttpSessionActivationListener to restore its state on other JVM.
has comment: http://stackoverflow.com/comment/41360562
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41137764
comment on: http://stackoverflow.com/q/26228271
type: Comment
type: QuestionComment
has text: That already looks like a string to me :)
score: 2

http://stackoverflow.com/a/26285112
score: 0
has body: The first for loop starts at 1 and ends at limit 5. The inner loop starts at 0 and goes to the current count. So for the first iteration the inner loop will go from 0 to 1. This will print count 1 time which count is 1. The second time through the outer loop the counter will be 2 so the inner loop will loop from 0 to 2. It will print 2 twice. The 3rd time through count will be 3. The inner loop will loop from 0 to 3 and print 3 3 times. Etc... This is nested looping.
type: Answer
answers question: http://stackoverflow.com/q/26285018

http://stackoverflow.com/comment/41332944
type: QuestionComment
has text: @HotLicks Generally permission checks go through the `SecurityManager` which then forwards them on to the `AccessController` class. `AccessController.doPrivileged` cannot elevate permissions above that of the calling class. (There are separate rules for handling `DomainCombiner` and `Subject`.)
comment on: http://stackoverflow.com/q/26329793
score: 0
type: Comment

http://stackoverflow.com/comment/129079776
has text: In my own experience: J-Ogg, while it works fine to read data from files (using `FileStream`), it is totally borked when you try to read from a InputStream with `BasicStream`. However `VorbisJava` doesn't have the same issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/26285277
type: Comment
score: 0

http://stackoverflow.com/a/26291592
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26291446
has body: Maybe you should use "\\" as the argument,not "\". Very glad to help you! public static void main(String[] args) { String test ="\\ipAddress\\FolderA\\InnerFolderA\\abc.mp4"; String parts[] = test.split("\\\\"); String part0 = parts[0]; String part1 = parts[1]; String part2 = parts[2]; System.out.println(part1); }
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/26338025
tagged with: java
has answer: http://stackoverflow.com/a/26338112
has answer: http://stackoverflow.com/a/26338251
type: Question
has comment: http://stackoverflow.com/comment/41338721
has answer: http://stackoverflow.com/a/26340489
possible better answer: http://stackoverflow.com/a/26338164
has comment: http://stackoverflow.com/comment/41342588
answer count: 6
tagged with: number-formatting
has answer: http://stackoverflow.com/a/26338164
has title: How to format this string
score: 0
has answer: http://stackoverflow.com/a/26338348
linked to: http://stackoverflow.com/q/5323502
has body: I have an amount Long amount=83000; I need to format it to $83.000, how to do this ? NumberFormat formatter = NumberFormat.getCurrencyInstance(new Locale("en", "US")); String moneyString = formatter.format(amount); System.out.println(moneyString); I am getting $83000.00 but i want my point before 3 last digit
has comment: http://stackoverflow.com/comment/41338756
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26338158
accepted answer: http://stackoverflow.com/a/26338348
has comment: http://stackoverflow.com/comment/41342735

http://stackoverflow.com/q/26219099
tagged with: javabeans
has title: How to persist two entities with JPA
type: AnsweredQuestion
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/41120226
favorite count: 0
has comment: http://stackoverflow.com/comment/41121258
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26220097
linked to: http://stackoverflow.com/q/6389056
has body: I am using the JPA in my webapp and I can't figure out how to persist two new entities that relate to each other. Here an example: These are the two entities +-----------------+ +--------------------+ | Consumer | | ProfilePicture | +-----------------+ +--------------------+ | id (PK) |---| consumerId (PPK+FK)| | userName | | url | +-----------------+ +--------------------+ The Consumer has an id and some other values. The ProfilePicture uses the Consumer's id as it's own primary key and as foreign key. (Since a ProfilePicture will not exist without a Consumer and not every Consumer has a ProfilePicture) I used NetBeans to generate the entity classes and the session beans (facades). This is how they look like in short Consumer.java @Entity @Table(name = "Consumer") @NamedQueries({...}) public class Consumer implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false) @NotNull @Size(min = 1, max = 50) @Column(name = "userName") private String userName; @OneToOne(cascade = CascadeType.ALL, mappedBy = "consumer") private ProfilePicture profilePicture; /* and all the basic getters and setters */ (...) } ProfilePicture.java @Entity @Table(name = "ProfilePicture") @XmlRootElement @NamedQueries({...}) public class ProfilePicture implements Serializable { @Id @Basic(optional = false) @NotNull @Column(name = "consumerId") private Integer consumerId; @Basic(optional = false) @NotNull @Size(min = 1, max = 255) @Column(name = "url") private String url; @JoinColumn(name = "consumerId", referencedColumnName = "id", insertable = false, updatable = false) @OneToOne(optional = false) private Consumer consumer; /* and all the basic getters and setters */ (...) } So when I want to create a Consumer with his ProfilePicture I thought I would do it like this: ProfilePicture profilePicture = new ProfilePicture("http://www.url.to/picture.jpg"); // create the picture object Consum…
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/26219448
tagged with: jpa
possible better answer: http://stackoverflow.com/a/26219448
accepted answer: http://stackoverflow.com/a/26220097

http://stackoverflow.com/comment/41156529
has text: So it's as easy as doing a for through the arraylist and System.out.println(shapes); (where shape is the name of my arraylist)??
comment on: http://stackoverflow.com/a/26238805
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/41324261
score: 1
has text: @rents "in non-enum classes a static variable can't access non static variables." You probably meant "static methods cannot access non-static variables", right? That's the trick: it's variables `A`, `B`, and `C` that are static, but each of these variables points to a first-class object, which has instance variables, can have instance methods, and so on.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26326331

http://stackoverflow.com/a/26267822
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/41210348
answers question: http://stackoverflow.com/q/26267790
score: 4
has body: Your toString() method isn't returning a String, public String toString() { return counter; } should be something like public String toString() { return String.valueOf(counter); } Finally, you appear to have an extra closing brace (at the end) in your code as posted.

http://stackoverflow.com/q/26197495
downvote count: 2
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41079772
has comment: http://stackoverflow.com/comment/41079741
upvote count: 0
tagged with: java
has body: I am having trouble using my if and else if statements for my personal project. My program seems to work fine in the first lines when asking the user for input, but there is a problem in the code. My compiler is asking me to use a switch method. I've also encountered a problem where the compiler tells me I can't convert String to double, which is something I have already found using the search. I know this might be a lot to ask but I would really appreciate your help. /** * This application executes number of gallons purchased, car wash if the * customer desires. * There will be four options, Regular, Premium, Super, * or None. A car wash is $1.25 if purchased with $10.00 or more. If it is * anything equal or below $9.99 then the car wash fee is $3.00. * Regular per gallon is $2.89 * Premium per gallon is $3.09 * Super per gallon is $3.39 * * * @author Christian Guerra */ package finalflight; //The line below is preparing the system to ask the user for inputs import java.util.Scanner; public class ExxonCarServices { public static void main(String[] args) { String gasType; String carWash; String gasPrice; String numGallons; double gasRegular = 2.89; double gasPremium = 3.09; double gasSuper = 3.39; double gasNone = 0; Scanner keyboard = new Scanner(System.in); System.out.print("Hello which type of gas would you like today? " + "Please make the selection Regular, Premium, Super, or None" + " "); gasType = keyboard.nextLine(); System.out.print("How many gallons would you like?" + " "); numGallons = keyboard.nextLine(); System.out.print("Would you like to add a professional car wash cleaning today?" + " " + "Please select Yes or No" + " "); carWash = keyboard.nextLine(); if (gasType.equals("Regular")) { gasRegular = Regular; } else if (gasType.equals ("Premium")) { gasPremium = Premium; } else if (gasType.equals("Super")) { gasSuper = Super; } else { gasNone = 0; } if (numGallons * gasPrice &lt;10) { carWash = 3; } else { carWash = 1.25; } } }
has title: How to to use if and else statements properly?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26197548
score: -2
has answer: http://stackoverflow.com/a/26197553
tagged with: string
tagged with: sorting

http://stackoverflow.com/q/26210704
has answer: http://stackoverflow.com/a/47155453
tagged with: arrays
downvote count: 0
tagged with: kotlin
has body: I have a some problem in annotations: Entity Table(uniqueConstraints = array(UniqueConstraint(columnNames = array("key", "userid")))) public class ... In this case I get the following error: Type inference failed. Expected type mismatch: found: kotlin.Array required: kotlin.String There is no problems with uniqueConstraints = array(...) but Idea shows me error in columnNames = array(...) I using hibernate-jpa-2.1-api-1.0.0.Final.jar Workaround: Instead uniqueConstraints I using composite key (@javax.persistence.IdClass)
answer count: 3
has title: kotlin: some problems with arrays in annotations
tagged with: jpa-2.0
favorite count: 0
has answer: http://stackoverflow.com/a/26224983
score: 6
upvote count: 6
possible better answer: http://stackoverflow.com/a/47000044
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47000044
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26224983
type: Question

http://stackoverflow.com/q/26334898
has comment: http://stackoverflow.com/comment/41333308
has body: Below is my code regarding property change. If I use this code, public void propertyChange(PropertyChangeEvent evt) will be called properly. public void setWeekDate(Date weekDate) { firePropertyChange("weekDate", this.weekDate, this.weekDate = weekDate); } But if I use below code public void propertyChange(PropertyChangeEvent evt) will not be called. public void setWeekDate(Date weekDate) { this.weekDate = weekDate; firePropertyChange("weekDate", this.weekDate, weekDate); } could anyone tell me whats wrong with the above code?
tagged with: propertychangelistener
has title: property change lister does not invoke the method propertychangeevent
type: UnansweredQuestion
upvote count: 1
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/41333842
has answer: http://stackoverflow.com/a/26335215
type: Question
answer count: 1
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/41099743
type: QuestionComment
has text: so you know your issues. first how to store in the array, and second how to write in file. So try to google them and learn them. if you are stuck in some place, let's us know. you must learn how to research
comment on: http://stackoverflow.com/q/26208436
score: 0
type: Comment

http://stackoverflow.com/comment/41276870
score: 0
has text: A little observation... instead of subclassing the `Thread` class it may be a better idea to implement the `Runnable` interface. See [here](http://docs.oracle.com/javase/tutorial/essential/concurrency/runthread.html)
type: QuestionComment
comment on: http://stackoverflow.com/q/26287508
type: Comment

http://stackoverflow.com/q/26290933
favorite count: 0
has title: How to make a Log that links to a specific line in the source in Intellij IDEAS / Android Studio?
tagged with: android
has comment: http://stackoverflow.com/comment/41253227
has answer: http://stackoverflow.com/a/26291292
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/41253205
has comment: http://stackoverflow.com/comment/41253135
upvote count: 1
has body: So when an error occurred during runtime, the log always show a link to the specific error and you can click on it to be taken there directly. I'm looking to exploit this function for my own use (since finding where the log is generated across multiple files can be a pain). Of course you can just put the source in the log key but if I'm able to link it just the way Android Studio / Intellij IDEAS does it with the error output, that would be MASSIVELY helpful. Thanks.
answer count: 1

http://stackoverflow.com/comment/41370591
score: 1
type: AnswerComment
type: Comment
has text: Ah that's it, that seemed to work. Thanks again for introducing me to OpenTTD, just started playing. Good memories of the original.
comment on: http://stackoverflow.com/a/26351266

http://stackoverflow.com/comment/41155951
type: QuestionComment
comment on: http://stackoverflow.com/q/26223801
score: 0
has text: @ChrisA.: Can you tell me the reason why you down voted this question. I posted it after trying many different things, did my research what else do you expect from a posted question. Can someone put light on this??
type: Comment

http://stackoverflow.com/q/26232082
tagged with: mtom
has comment: http://stackoverflow.com/comment/44752667
tagged with: memory
type: Question
has body: I have a question on how to stream large MTOM attachment response at the client side from memory to an Oracle database without any temporary disk usage. I already have a working implementation which does following things in sequence: 1) Parsing of entire MTOM response (used xercesImpl to avoid OutOfMemory error) 2) Saving the parsed data to CSV file on disk 3) Reading CSV row by row in a loop and do 3a and 3b in each iteration until all the records are consumed:- 3a) Additional processing on CSV row data in memory. 3b) Loading the processed row data from memory to an Oracle database. The above implementation is working fine but it's not very efficient since we are getting the entire response in memory before saving it to disk and then again start reading records back from disk to memory before loading into a database. I want to avoid the entire disk usage flow which means no CSV file or any interim temporary file. I have tried the StreamingAttachmentFeature with both eager and lazy parsing along with StreamingDataHandler but it was creating a temporary file on disk and saved the entire response in it. Thanks in advance for your help.
downvote count: 0
has comment: http://stackoverflow.com/comment/41179541
has title: Streaming large SOAP response in Java from memory to database without any interim disk usage
favorite count: 0
tagged with: soap
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: streaming
score: 2
tagged with: java

http://stackoverflow.com/comment/41372887
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26339012
score: 0
has text: Where's the code to talk to your database then? I don't see any JDBC calls or similar... Looks like you've missed out the key part of your code!

http://stackoverflow.com/q/26344172
upvote count: 2
has answer: http://stackoverflow.com/a/26344785
tagged with: java
tagged with: javafx
tagged with: swing
has comment: http://stackoverflow.com/comment/41354713
has body: I am trying to learn JavaFX and convert a swing application to JavaFX. What I want to do is use JavaFX to display the progress of a program. What I was previously doing in Swing was first creating a JFrame with a custom JComponent. Then have my main program call a method of the custom JComponent that would change the colour of a shape within the JComponent and repaint(). The below gives an idea of the kind of thing I want to achieve in JavaFX: //Run JavaFX in a new thread and continue with the main program. public class Test_Main{ public static void main(String[] args) { Test test = new Test(); Thread t = new Thread(test); t.start(); //Main Program JOptionPane.showMessageDialog(null, "Click 'OK' to continue.", "Pausing", JOptionPane.INFORMATION_MESSAGE); //Update Progress test.setText("Hello World!"); } } I currently have this as my runnable. public class Test extends Application implements Runnable{ Button btn; @Override public void run() { launch(); } @Override public void start(Stage stage) throws Exception { StackPane stack = new StackPane(); btn = new Button(); btn.setText("Testing"); stack.getChildren().add(btn); Scene scene = new Scene(stack, 300, 250); stage.setTitle("Welcome to JavaFX!"); stage.setScene(scene); stage.show(); } public void setText(String newText){ btn.setText(newText); } } Everything runs fine until I try to update the text of the button in which I get a NullPointerException. I guess this has something to do with the JavaFX application thread. I cannot find anything on the net though which describes how to update things externally. I see a lot of mention about Platform.runLater and Task but these are usually nested in the start method and run on timers. UPDATE: Just to clarify I am hoping to achieve something like this: public class Test_Main{ public static void main(String[] args) { final boolean displayProgress = Boolean.parseBoolean(args[0]); Test test = null; if(displayProgress){ //only create JavaFX application if necessary test = new T…
has comment: http://stackoverflow.com/comment/41354477
type: Question
has comment: http://stackoverflow.com/comment/41359825
has title: How can I externally update a JavaFX scene?
has answer: http://stackoverflow.com/a/26344668
accepted answer: http://stackoverflow.com/a/26344785
answer count: 3
possible better answer: http://stackoverflow.com/a/33157609
has comment: http://stackoverflow.com/comment/41359658
downvote count: 0
has answer: http://stackoverflow.com/a/33157609
has comment: http://stackoverflow.com/comment/41361306
favorite count: 0
has comment: http://stackoverflow.com/comment/41355399
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/26311579
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26311469
answers question: http://stackoverflow.com/q/26311469
has comment: http://stackoverflow.com/comment/41294229
has comment: http://stackoverflow.com/comment/41294466
type: AcceptedAnswer
downvote count: 0
has body: CoverFlowView.java import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Camera; import android.graphics.Matrix; import android.util.AttributeSet; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.Transformation; import android.widget.FrameLayout; import android.widget.HorizontalScrollView; import android.widget.ImageView; import android.widget.LinearLayout; public class CoverFlowView extends LinearLayout { public static class Config { public int COVER_SPACING = 60; public int CENTER_COVER_OFFSET = 130; public float SIDE_COVER_ANGLE = 40; public int SIDE_COVER_ZPOSITION = 120; public float REFLECTION_FRACTION = 0.15f; public long FOCUS_ANIMATION_DURATION = 200; public int COVER_BUFFER = 6; public long BLUR_ANIMATION_DURATION = 120; public int DROP_SHADOW_RADIUS = 15; public boolean HORIZONTAL_SCROLLBAR_ENABLED = false; public boolean FADING_EDGES_ENABLED = true; public float IMAGE_SCALE_X = 1; public float IMAGE_SCALE_Y = 1; public long LONG_CLICK_DURATION = 2000; } Config mConfig = new Config(); WeakReference&lt;DataSource&gt; mDataSource; WeakReference&lt;Listener&gt; mListener; Set&lt;CoverFlowItem&gt; mOffscreenCovers = new HashSet&lt;CoverFlowItem&gt;(); Map&lt;Integer, CoverFlowItem&gt; mOnscreenCovers = new HashMap&lt;Integer, CoverFlowItem&gt;(); Map&lt;Integer, Bitmap&gt; mCoverImages = new HashMap&lt;Integer, Bitmap&gt;(); Map&lt;Integer, Integer&gt; mCoverImageHeights = new HashMap&lt;Integer, Integer&gt;(); Bitmap mDefaultBitmap; int mDefaultBitmapHeight; float mDefaultImageHeight; ScrollView mScrollView; ViewGroup mItemContainer; Thread mLongClickThread; boolean mCancelNextClick; int mLowerVisibleCov…
has comment: http://stackoverflow.com/comment/41329695
type: Answer
has comment: http://stackoverflow.com/comment/42823213
score: 2
has comment: http://stackoverflow.com/comment/67352193

http://stackoverflow.com/comment/41109956
type: Comment
has text: Use `DelegatingStyledCellLabelProvider` for columns that require styling, `ColumnLabelProvider` for those that do not. Both extend `CellLabelProvider`.
comment on: http://stackoverflow.com/a/26212127
score: 1
type: AnswerComment

http://stackoverflow.com/a/26254218
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26254056
type: Answer
has body: writeShort(i) writes a short right? And a short is only 2 bytes.... and you need 4, dont you? actually (short)0x00ffff00 already cuts it. Use int e.g.
score: 1
has comment: http://stackoverflow.com/comment/41184948
has comment: http://stackoverflow.com/comment/41184721
has comment: http://stackoverflow.com/comment/41184861
answers question: http://stackoverflow.com/q/26254056

http://stackoverflow.com/comment/41086430
score: 0
comment on: http://stackoverflow.com/q/26201186
type: QuestionComment
type: Comment
has text: It's a good idea but I would also like to create a platform independent installer as well.

http://stackoverflow.com/comment/129355595
type: Comment
comment on: http://stackoverflow.com/a/26252885
has text: The tutorial link is dead btw. use https://www.digitalocean.com/community/tutorials/spring-mvc-interceptor-example-handlerinterceptor-handlerinterceptoradapter instead. However, the contents of the linked tutorial should not be used, as the HandlerInterceptorAdaptor is deprecated
score: 3
type: AnswerComment

http://stackoverflow.com/comment/41255464
type: AnswerComment
type: Comment
has text: @Amit,I changed string to content
comment on: http://stackoverflow.com/a/26292683
score: 1

http://stackoverflow.com/comment/58209979
has text: Thanks for sharing this code. I already upvoted this answer, it's working quite well. The only issue I spotted is that the shadow isn't fitting, when tall letters (like 'g', 'j') are used. Do you have any idea how to fix this? It seems that the TextBounds arent correct when these letters are used.
type: Comment
comment on: http://stackoverflow.com/a/26407222
score: 0
type: AnswerComment

http://stackoverflow.com/a/42371417
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/26347706
has body: Here is how I've got it working with Haskell: signature body nonce path secret = convertToBase Base64 hmacsha512 where sha256 = convert (hash $ nonce `append` body :: Digest SHA256) hmacsha512 = hmac secretd (path `append` sha256) :: HMAC SHA512 secretd = fromRight $ convertFromBase Base64 secret :: ByteString So you need to: get SHA256 hash of nonce + body, i.e. SHA256("1487687774151000nonce=1487687774151000") append raw bytes of digest to path (result would be unprintable, example path for balance method is "/0/private/Balance"), get HMAC SHA512 digest using base64-decoded secret, encode to Base64.
upvote count: 7

http://stackoverflow.com/q/26213254
has comment: http://stackoverflow.com/comment/41110766
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26240539
tagged with: maven
has body: We have a multi-module Maven project: project-war depends on project-api. I have imported the modules into IntelliJ, and I would like to use tomcat7:run to run run the project-war application in Tomcat. I do so, the application runs fine. I make a change to project-api, stop Tomcat, restart Tomcat. The project-war application runs again fine, but the changes to project-api are not reflected as expected. How to get the transitive changes from my workspace to be reflected when running tomcat7:run? I've tried "Resolve Workspace artifacts". It didn't help. In fact, I don't get this setting at all. I've tried "Before launch:" "Make". It does what appears to be a build (compile) but it didn't help either. I think what I"m looking for is pretty much what m2e/Eclipse calls workspace resolution. Can't get it to work in IntelliJ. Your help much appreciated!
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26240539
tagged with: intellij-idea
has title: Maven tomcat7:run for multi-module project in IntelliJ
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41149807
has comment: http://stackoverflow.com/comment/41118225
has comment: http://stackoverflow.com/comment/72656620

http://stackoverflow.com/a/26348573
answers question: http://stackoverflow.com/q/26348246
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: Note that DatastoreHelper looks at environment variables rather than system properties. The easiest way to create the Datastore object is to set three environment variables: export DATASTORE_DATASET=&lt;dataset&gt; export DATASTORE_SERVICE_ACCOUNT=&lt;service-account&gt; export DATASTORE_PRIVATE_KEY_FILE=&lt;path-to-private-key-file&gt; and then in code call: Datastore datastore = DatastoreFactory.get().getDatastoreFromEnv(); If you need to set or override some of the options programmatically, you can do something like: Datastore datastore = DatastoreFactory.get().create(DatastoreHelper.getOptionsfromEnv() .dataset("&lt;dataset&gt;") .build())

http://stackoverflow.com/comment/41164649
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26239773
has text: try using the `equals` method. Not sure if `env->IsSameObject(o,STATUS_ONE)` calls that or not

http://stackoverflow.com/q/26249451
tagged with: square-bracket
has comment: http://stackoverflow.com/comment/41210528
has body: I'm doing homework for my data structures class and ran into a snag at a certain point. Basically, I have an expression like (varx + vary*varz[(vara+varb[(a+b)*33])])/55 and I have to store the variables in the equation in either of two arraylists, scalar (for simple variables) or arrays (for variables with arrays). In this example, variables like varx or vary would go into the scalar array and varz would be an array because it has a bracket following it right after in the expression. I know StringTokenizer makes the scalar variables easy to track when I use the code.. StringTokenizer st = new StringTokenizer(expr, " \t*+-/()[]"); However, this doesn't really work for being able to tell what the arrays variable is since it also erases the brackets since the answer that would return if I were to print it is while(st.hasMoreTokens()){ System.out.println(st.nextToken()); } and it would print varx vary varz vara varb a b 33 55 How would I be able to check for a bracket after each variable to tell if it should go in the scalar arraylist or the arrays arraylist? Thanks for the help!
answer count: 0
has title: StringTokenizing an expression with brackets in Java
tagged with: java
tagged with: stringtokenizer
type: Question
has comment: http://stackoverflow.com/comment/41176715
has comment: http://stackoverflow.com/comment/41176776
tagged with: arrays
has comment: http://stackoverflow.com/comment/41177888
tagged with: scalar
score: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26334868
score: 0
answers question: http://stackoverflow.com/q/26329564
type: Answer
has body: Instead of .access("hasRole('ROLE_USER')"), try .access("permitAll"). Note that for request mappings that doesn't have a @PreAuthorize, everyone will be given access.

alignment
tags question: http://stackoverflow.com/q/26308859
tags question: http://stackoverflow.com/q/26321367
tag name: alignment
type: Tag
tags question: http://stackoverflow.com/q/26226895

http://stackoverflow.com/a/26209289
accepted answer of: http://stackoverflow.com/q/26209158
type: AcceptedAnswer
upvote count: 2
has comment: http://stackoverflow.com/comment/41101443
type: Answer
answers question: http://stackoverflow.com/q/26209158
score: 2
has body: // Get the last name as entered by the user String lastName = name.substring(name.indexOf(" ") + 1); // Upcase the first character, then append the remaining characters lastName = Character.toUpperCase(lastName.charAt(0)) + lastName.substring(1);
downvote count: 0

http://stackoverflow.com/comment/41284299
has text: @JarrodRoberson Having used this solution in a number of case, it doesn't overhead under heavy load. It may be an unnecessary complication, but that depends on the use case.
comment on: http://stackoverflow.com/a/26296967
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41230931
type: Comment
type: QuestionComment
has text: You need to post the code from where you are calling onPostExecute and not just onPostExecute method... I feel that the variable res in onPostExecute you are passing it as null.
comment on: http://stackoverflow.com/q/26279448
score: 0

http://stackoverflow.com/q/26259764
tagged with: http-post
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/41199531
has comment: http://stackoverflow.com/comment/41195083
upvote count: 2
type: UnansweredQuestion
has body: I am new to HttpClient and I'm trying to get the prices of players in the fifa ultimate team web app. Using Developer Tools, i managed to find the Post Method yielding the prices of the player. Searching for a specific player gives the following URL request. https://utas.s2.fut.ea.com/ut/game/fifa15/transfermarket?maskedDefId=20801&amp;start=0&amp;num=16&amp;type=player When I'm viewing the response of the method, I can see all the player prices currently on the market in Developer Tools. So I tried to code it in Java to get those prices, but my output is nothing like the response given in Developer Tools. This is my code: HttpClient client = new DefaultHttpClient(); String url = "https://utas.s2.fut.ea.com/ut/game/fifa15/transfermarket?maskedDefId=20801&amp;start=0&amp;num=16&amp;type=player"; HttpPost loginPost = new HttpPost(url); loginPost.setHeader("Host", "utas.s2.fut.ea.com"); loginPost.setHeader("Connection", "keep-alive"); loginPost.setHeader("Content-Lenght", "1"); loginPost.setHeader("Cache-Control", "max-age=0"); loginPost.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); loginPost.setHeader("Origin", "https://www.easports.com"); loginPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36"); loginPost.setHeader("Content-Type", "application/json"); loginPost.setHeader("Accept", "application/json"); loginPost.setHeader("X-UT-SID", "23c19a93-32ac-4f52-9aab-21c6be112ede"); loginPost.setHeader("X-UT-Embed-Error", "true"); loginPost.setHeader("X-UT-PHISHING-TOKEN", "8649502695209937021"); loginPost.setHeader("X-HTTP-Method-Override", "GET"); loginPost.setHeader("Referer", "https://www.easports.com/iframe/fut15/bundles/futweb/web/flash/FifaUltimateTeam.swf?cl=144469"); loginPost.setHeader("Accept-Encoding", "gzip,deflate"); loginPost.setHeader("Accept-Language", "nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4"); loginPost.setHeader("Cookie"…
tagged with: java
type: Question
has title: Java HttpClient get response from Post method
has answer: http://stackoverflow.com/a/26274212
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41200582
tagged with: apache-httpclient-4.x

http://stackoverflow.com/q/26334481
tagged with: java
has comment: http://stackoverflow.com/comment/41345463
score: 0
has comment: http://stackoverflow.com/comment/41365342
has body: I'm trying to play a local file as live stream. This is how mrl = "movie.ts"; mediaPlayer.setRepeat(true); mediaPlayer .playMedia( mrl, ":sout=#duplicate{dst=std{access=http,mux=ts,dst=127.0.0.1:5555/}", "--repeat", ":sout-keep", "--loop"); The streaming is successfull but does not loop. What am I missing?
tagged with: vlcj
tagged with: http-live-streaming
has comment: http://stackoverflow.com/comment/41337786
has comment: http://stackoverflow.com/comment/41370651
answer count: 0
type: UnansweredQuestion
tagged with: live-streaming
has title: Loop vlcj live streaming over http from local file
tagged with: vlc
type: Question
has comment: http://stackoverflow.com/comment/41343877

http://stackoverflow.com/a/26200791
has comment: http://stackoverflow.com/comment/41085749
has comment: http://stackoverflow.com/comment/41086455
has comment: http://stackoverflow.com/comment/41085898
has comment: http://stackoverflow.com/comment/41085717
type: Answer
has body: You are missing a constructor. If this : void starter(){ Scanner input=new Scanner(System.in); System.out.println("Enter all the required data"); FirstName=input.nextLine(); LastName=input.nextLine(); Gender=input.nextLine(); DOB=input.nextInt(); MOB=input.nextInt(); YOB=input.nextInt(); } is meant as a constructor then its wrong. Even though a constructor is a void method, it is not declared like that. Change it to: public Starter(){ Scanner input=new Scanner(System.in); System.out.println("Enter all the required data"); FirstName=input.nextLine(); LastName=input.nextLine(); Gender=input.nextLine(); DOB=input.nextInt(); MOB=input.nextInt(); YOB=input.nextInt(); } Update 1 These methods: getvalues2.getFirstName(); getvalues2.getLastName(); getvalues2.getGender(); getvalues2.getDOB(); getvalues2.getMOB(); getvalues2.getYOB(); getvalues2.getYears(); return a value. That doesn't mean they have to print it.. Try system.out.println(getvalues2.getFirstName()); system.out.println(getvalues2.getLastName()); ....//etc Update 2 also why it is giving The total years of that person is 21613 in output This is happening because of this: System.out.printf("The total years of that person is %d%d%d",TotalYear,TotalMonth,TotalDay); %d%d%d means that printf expects 3 ints as arguements and will place then next to each other. I think this will make more sense to you: `%d%d%d` output `123` `%d %d %d` output `1 2 3` `%d-%d-%d` output `1-2-3` So you can change it appropriatelly. Update 3 public void BMI1(){ System.out.println("Enter the value of Height and Weight"); Scanner input1=new Scanner(System.in); Height=input1.nextFloat(); Weight=input1.nextFloat(); BMI1=Weight/(Height*Height); System.out.println("The BMI value is :\t"+BMI1); } From your comment i am assuming that your porgramm is hanging here. This method is expecting you to input 2 floats before printing out something. So if you don't enter something it won't get the to the System.out.println("The BMI value is :\t"+BMI1);
has comment: http://stackoverflow.com/comment/41086221
score: 2
has comment: http://stackoverflow.com/comment/41086069
has comment: http://stackoverflow.com/comment/41085943
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26200763
has comment: http://stackoverflow.com/comment/41086526
has comment: http://stackoverflow.com/comment/41086404
answers question: http://stackoverflow.com/q/26200763
has comment: http://stackoverflow.com/comment/41086654
has comment: http://stackoverflow.com/comment/41086077
has comment: http://stackoverflow.com/comment/41085831
has comment: http://stackoverflow.com/comment/41086355
has comment: http://stackoverflow.com/comment/41085694
has comment: http://stackoverflow.com/comment/41086140
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26226713
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26227358
upvote count: 1
has answer: http://stackoverflow.com/a/26246097
type: Question
possible better answer: http://stackoverflow.com/a/26227358
tagged with: ssl
linked to: http://stackoverflow.com/q/5879894
answer count: 2
linked to: http://stackoverflow.com/q/24886771
accepted answer: http://stackoverflow.com/a/26246097
downvote count: 0
has title: Moved SSL cert - now getting java.security.cer.CertPathValidatorException
favorite count: 0
has body: I recently moved my backend (rails) to Digital Ocean. I installed my ssl cert (signed by a CA) there and browsers recognize and display accordingly in the web app. I went to do some work on and my Android client - only to get this exception from Volley: 10-06 16:57:20.448: D/Error.Response(10668): com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. I'm not sure how to handle this. When I had the cert installed at Heroku initially I didn't see this - only after moving the cert. How do I fix this?
tagged with: android

http://stackoverflow.com/comment/41297461
type: Comment
comment on: http://stackoverflow.com/q/26315782
score: 3
has text: Please read up on [two's complement](http://en.wikipedia.org/wiki/Two%27s_complement).
type: QuestionComment

http://stackoverflow.com/q/26305101
tagged with: java
has comment: http://stackoverflow.com/comment/41278786
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41278549
has comment: http://stackoverflow.com/comment/41279087
tagged with: string
has body: I am trying to add values to a string and then send it to the next activity. Here is the only relevant part of the code. adding() is the id of the button which appends values to the String msg and sendMessage() sends the msg altogether. When I just send a dummy value, the message is being passed, even when I add something like 1,2,3,4,5 at once instead of adding, it goes. But when I try to add, append and then send, it gives me an "Unfortunately stopped" error. I tried couple of tweaks, but still the same error. How to fix this? public void adding(View view){ EditText et1=(EditText) findViewById(R.id.editText1); msg=msg+","+et1.getText().toString(); TextView tv1=(TextView) findViewById(R.id.textView1); tv1.setText(msg); et1.setText(""); } public void sendMessage(View view){ Intent intent=new Intent(this,Next.class); msg+=","; intent.putExtra("message", msg); startActivity(intent); } EDIT: Activity Code- package com.example.newlist; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends ActionBarActivity { String msg=""; int count=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void adding(Vie…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26305720
has title: How to append to a String and send through intents in Android?
tagged with: android
has answer: http://stackoverflow.com/a/26305835
tagged with: android-intent
has comment: http://stackoverflow.com/comment/41278601
has comment: http://stackoverflow.com/comment/41279101
has comment: http://stackoverflow.com/comment/41278834

http://stackoverflow.com/q/26317842
score: -2
answer count: 1
has body: public class SomeQueens { static Stack&lt;Integer&gt; s= new Stack&lt;Integer&gt;(); static int Solved = 0; static int current = 0; public static int solve(int n) { // n is 8 while(current &lt; n) { // should I use current &lt; n instead for (int i = current; i &lt; n; i++) { if(validPosition(i)) { s.push(i); current = 0; } } if(!validPosition(current)) { if(s.empty()) { break; } if(!s.empty()) { s.pop(); current++; } } if(s.size() == n) { s.pop(); current++; printSolution(s);// this is a method, but it shouldn't matter for this Solved++; } } return Solved; } public static boolean validPosition(int column) { for( int row = 0; row &lt; s.size(); row++) if(s.get(row) == column || ((column - s.get(row)) == (s.size() - row)) || ((s.get(row) - column) == (s.size() - row)) ) return false; // there's a conflict return true; // no conflict; } //it's called by int num = solve(n); //sop("There're" + num + "sols to the" + n "queens prob"); This is a subsection of my program for NQueens, but I seem to always get: There are 0 solutions to the 8-queens problem. I tried debugging with system.out.prints in the main method, which led me to guess that there would be something wrong in my boolean method, but I don't think it's doing anything wrong. I'm unsure if my while statement is incorrect or if the break inside the while loop is initialized before anything is even done. Thanks for the help and guidance and I'm sorry if my program and explanation makes no sense
favorite count: 0
has comment: http://stackoverflow.com/comment/41301793
has comment: http://stackoverflow.com/comment/41301437
tagged with: backtracking
upvote count: 0
has answer: http://stackoverflow.com/a/26318240
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41301482
tagged with: n-queens
tagged with: java
has title: Getting every combination of Queens?
type: Question
downvote count: 2

http://stackoverflow.com/comment/41213771
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26269749
has text: Hi Thanks for such a fast response! I am trying to call the constructor of inst class so shouldn't I pass the object of inst? Please advise.

http://stackoverflow.com/comment/41387986
type: Comment
score: 0
type: AnswerComment
has text: Not using Spring. However, sure someone else profits! Thanks.
comment on: http://stackoverflow.com/a/26357364

http://stackoverflow.com/a/26308604
answers question: http://stackoverflow.com/q/26307065
type: Answer
has comment: http://stackoverflow.com/comment/41303688
has comment: http://stackoverflow.com/comment/41303585
has body: You should write into channel context your thread-safe implementation of ChunkedStream in netty IO thread, where request arrives. Also you should provide server updates via this object from game thread. See stream's package documentation. Especially ChunkedWriteHandler and ChunkedStream.
has comment: http://stackoverflow.com/comment/41304027
has comment: http://stackoverflow.com/comment/41303833
has comment: http://stackoverflow.com/comment/41303183
has comment: http://stackoverflow.com/comment/41299180
score: 0

http://stackoverflow.com/a/26308103
answers question: http://stackoverflow.com/q/26305416
upvote count: 7
has body: Jetty 9.2.0 is the first version of Jetty to support annotation and class scanning for JDK8. There was an update to the asm library we use, along with some api changes to support the new JDK8 bytecode scanning. You'll want to upgrade.
downvote count: 0
type: Answer
score: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26305416

http://stackoverflow.com/q/26309481
has body: I currently have 3 classes - DictionaryApp, BSTSet and BSTNode - both the BSTSet and BSTNode have contains methods. public class BSTSet &lt;E extends Comparable&lt;E&gt;&gt; extends AbstractSet &lt;E&gt; { // the root of the supporting binary search tree private BSTNode&lt;E&gt; root; // number of elements in the set private int count = 0; public boolean isEmpty() { return count == 0; } public boolean contains(E item) throws ClassCastException { if(root == null) return false; return root.contains(item); } public boolean add(E item) { if (item == null) throw new IllegalArgumentException("Null cannot be added to a BSTSet"); if(contains(item))return false; if(root == null){ root = new BSTNode(item); count++; return true; }else{ root.add(item); count++; return true; } } } public class BSTNode &lt;E extends Comparable&lt;E&gt;&gt; { private E value; private BSTNode&lt;E&gt; left; public BSTNode&lt;E&gt; right; public BSTNode(E value) { this.value = value; } public E getValue() { return value; } public BSTNode&lt;E&gt; getLeft() { return left; } public BSTNode&lt;E&gt; getRight() { return right; } public boolean contains(E item) { if(item.compareTo(value) == 0) return true; if(left != null) left.contains(item); if(right != null) right.contains(item); // no matching node was found return false; } public boolean add(E item) { if(item.compareTo(value) &lt; 0) {left = new BSTNode(item); return true;} if(item.compareTo(value) &gt; 0) {right = new BSTNode(item); return true;} return false; } } My issues is that the contains method in the BSTNode class never returns true and I can't understand why. If you would like to see anymore of my code or need anymore information please feel free to ask.
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41286586
answer count: 1
favorite count: 0
tagged with: binary-search-tree
has answer: http://stackoverflow.com/a/26309531
accepted answer: http://stackoverflow.com/a/26309531
score: 2
has title: Implementing a Binary Search Tree - Contains method
type: AnsweredQuestion

http://stackoverflow.com/a/26291323
answers question: http://stackoverflow.com/q/26291247
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: Unless I'm missing something (and without a switch), you could build an array of int scores and iterate that array of scores. That is something like int [] scores = new int[] { ones(dice_values), twos(dice_values), threes(dice_values), fours(dice_values), fives(dice_values), sixes(dice_values), sevens(dice_values), eights(dice_values), nines(dice_values), tens(dice_values), elevens(dice_values), twelves(dice_values), thirteens(dice_values) }; for (int each_score : scores) { total_score += each_score; end_scores += String.valueOf(each_score) + " "; }

http://stackoverflow.com/q/26209545
tagged with: interface
possible better answer: http://stackoverflow.com/a/26209584
type: Question
tagged with: tree
has answer: http://stackoverflow.com/a/26209808
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26209584
tagged with: java
has body: Well I have a fairly simple question I just can't seem to find my way around... For a class, I have to implement an interface for a binary tree that has a method like: public List&lt;Node&lt;E&gt;&gt; listAll(); we are required to have a class called MyNode.java, which is what I use to make my tree with. So to list all children I thought I would do this: public List&lt;Node&lt;E&gt;&gt; listAll(){ List&lt;Node&lt;E&gt;&gt; childList = new ArrayList&lt;&gt;(); MyNode&lt;E&gt; thisNode = this.l; while(thisNode!= null){ childList.add(thisNode); thisNode = thisNode.l; } return childList; } and to do something like set a child public void setChild(Node&lt;E&gt; child){ E elem = child.getElement(); MyNode&lt;E&gt; newNode = new MyNode(elem); this.l = newNode; } So my question is: am I going about this correctly? If I try to create a Node, I can't because my nodes are called MyNodes but when I try to create a list of MyNodes and return them it gives me an error because I am not following the interface.. When I try to make the method accept MyNode instead of Node it says I am not following the interface. A little more clarification below.. I currently am using the implements declaration to implement the Node.java interface.. When I am writing the method that is specified by my interface as: public void setChild(Node&lt;E&gt; child); then I am currently fleshing out the method like so: public void setChild(Node&lt;E&gt; child) { E elem = child.getElement(); MyNode&lt;E&gt; newNode = new MyNode&lt;E&gt;(elem); MyNode&lt;E&gt; transNode = this.l; if(transNode!=null){ while(transNode.r!=null){ transNode = transNode.r; } transNode = newNode; } else transNode = newNode; } you can see how I am getting the element from input child and creating a new MyNode out of it to put as the new child instead of just injecting Node into my tree.. Is this wrong? I can't seem to get another way to work...
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26209737
accepted answer: http://stackoverflow.com/a/26209808
has title: Using an Interface in Java

http://stackoverflow.com/q/26249271
has comment: http://stackoverflow.com/comment/41176415
score: -1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/41176380
answer count: 1
favorite count: 0
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41176393
has body: i want to create an online examination project.while i click next it should display next data in textarea.but the problem is when i click on submit button it displays last data from database. while(rs.next()) printing the last value in textbox. import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.*; import javax.swing.*; import java.sql.*; import java.awt.*; import java.util.*; class Abc extends JFrame implements ActionListener{ JLabel l1,l2,l3,l4; JButton b1,b2; JTextArea j1,j2; JCheckBox c1,c2,c3,c4; ButtonGroup group=new ButtonGroup(); JPanel panel2; Abc(){ j1=new JTextArea(); j2=new JTextArea(); c1=new JCheckBox(); c2=new JCheckBox(); c3=new JCheckBox(); c4=new JCheckBox(); j1.setEditable(false); c1.setSelected(false); c2.setSelected(false); c3.setSelected(false); c4.setSelected(false); group.add(c1); group.add(c2); group.add(c3); group.add(c4); Connection conn=null; try{ Class.forName("oracle.jdbc.driver.OracleDriver"); conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","java"); System.out.println("Dc is obtained"); } catch(Exception e2){ System.out.println("conne"+e2.getMessage()); } try{ String sq="select * from questionans"; Statement st=conn.createStatement(); ResultSet rs=st.executeQuery(sq); System.out.println("------------------------------------------"); if(rs.next()) { j1.setText(rs.getString(2)); c1.setText(rs.getString(3)); c2.setText(rs.getString(4)); c3.setText(rs.getString(5)); c4.setText(rs.getString(6)); } System.out.println("-------------------------------------------"); } catch(Exception e1){ System.out.println("query" +e1.getMessage()); } finally{ try { conn.close(); } catch(Exception e) { System.out.println("close conn"+e.getMessage()); } } b1=new JButton("REGISTER"); b2=new JButton("SUBMIT"); panel2=new JPanel(new GridLayout(4,1)); panel2.add(b1); panel2.add(j1); panel2.add(c1); panel2.add(c2); panel2.add(c3); panel2.add(c4); panel2.add(b2); add(panel…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41176385
has answer: http://stackoverflow.com/a/26249366
downvote count: 1
has title: why while(rs.next()) displaying the last value in textbox
tagged with: java

http://stackoverflow.com/comment/41234267
comment on: http://stackoverflow.com/a/26281077
type: AnswerComment
has text: so it's not possible with InputStreamReader right? actually i have to do a kind of encryption, adding to every single char a random number and then if i sub this same number from the encrypted file, it has to be again the same with the original one. i did that using bytes but i'm not able to do that with characters, when i cannot even read them properly
score: 0
type: Comment

http://stackoverflow.com/q/26236804
has title: Java - MySQL-StoredProcedure not executed
type: Question
accepted answer: http://stackoverflow.com/a/26249928
tagged with: mysql
upvote count: 1
answer count: 1
tagged with: stored-procedures
tagged with: java
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26249928
score: 1
has body: I call a few stored procedures from within my java class. Only one of these stored procedures seems not to be called, but no exception is thrown. The stored procedure looks like this: CREATE PROCEDURE `insertLoggingMessage` (IN userName VARCHAR(50), IN softwareId VARCHAR(100), IN operationName VARCHAR(100), IN msg VARCHAR(1000), IN lvl VARCHAR(10)) BEGIN SELECT id INTO @userId FROM benutzer WHERE name = userName; INSERT INTO logging (benutzer_id, software_id, operation_name, message, level) VALUES (@userId, softwareId, operationName, msg, lvl); END The java code, that runs the query, looks like this: private void logToDatabase(Authentication auth, String operationName, String message, LoggingLevel level) { String software = getSoftwareId(auth); String query = "CALL insertLoggingMessage(?, ?, ?, ?, ?)"; try { connect(this.dataSource); CallableStatement statement = this.conn.prepareCall(query); statement.setString(1, auth.getUserName()); setNullableStringParameter(statement, software, 2); statement.setString(3, operationName); setNullableStringParameter(statement, message, 4); statement.setString(5, level.name()); statement.execute(); disconnect(); } catch (Exception exc) { logToFile(auth, "logToDatabase", exc, level); } } The code is executed without an exception. When I call the stored procedure via HeidiSQL, it works fine. So why is the stored procedure not executed via the CallableStatement? I'm really desperate now.
favorite count: 0

http://stackoverflow.com/comment/41132855
type: QuestionComment
has text: It would really help if you'd post a short but complete program demonstrating the problem. There's a lot of stuff here that's unlikely to be relevant, but it would be *very* useful if we could actually reproduce it for ourselves.
comment on: http://stackoverflow.com/q/26225850
score: 0
type: Comment

http://stackoverflow.com/comment/41295430
score: 0
comment on: http://stackoverflow.com/q/26314437
type: QuestionComment
type: Comment
has text: Thank you very much, you're my savior, now it's back to work perfectly.

http://stackoverflow.com/comment/41109695
has text: The question is not clear at all.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26213216
type: Comment

http://stackoverflow.com/q/26199171
type: Question
has comment: http://stackoverflow.com/comment/41083529
tagged with: java
tagged with: compilation
has title: Compile and run java classes in different packages with multiple jar libraries
has comment: http://stackoverflow.com/comment/41083089
has comment: http://stackoverflow.com/comment/41082897
has body: I have a project including two packages and several classes in each. There are also two jar libraries (json-simple-1.1.1.jar and guava-10.0.1.jar) included through the "Project Properties --> Build path" window. I can run the project in Eclipse, but I want to compile and run them on the server (using command line). So I moved the whole project folder (Let me say Proj1) to the server. I want to compile these classes on the server. Then, run one of those classes (let me say Class1.java). I have tried the following command to compile all java files in all folders: javac -classpath ./guava-10.0.1.jar;./json_simple-1.1.1.jar -sourcepath src -d src ./src/**/*.java But got error: javac: no source files Usage: javac &lt;options&gt; &lt;source files&gt; use -help for a list of possible options -bash: ./json_simple-1.1.1.jar: No such file or directory When I remove the second jar file from the command, I get a lot of errors from the lines of the classes that are working with json (meaning that it knows my source files!). Please guide me how to compile them in command line and run Class1.java.
score: 0
tagged with: command-line
has comment: http://stackoverflow.com/comment/41082807
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41082921
has comment: http://stackoverflow.com/comment/41082777
has comment: http://stackoverflow.com/comment/41083042

http://stackoverflow.com/comment/115425262
type: Comment
score: 0
comment on: http://stackoverflow.com/a/57005745
has text: it works for me even with the `@NamedEntityGraph`. Can you post an example of your case?
type: AnswerComment

http://stackoverflow.com/q/26292885
has answer: http://stackoverflow.com/a/26293867
has title: How build hadoop sources under windows?
tagged with: java
type: Question
tagged with: hadoop
score: 5
has body: Trying to build hadoop from sources under windows 7 x64. According to instructions Hadoop2OnWindows and BUILDING I cloned hadoop sources from git, checkout to origin/branch-2.5 (SHA-1: fa3bb675a728105d69614f53abe4339958550adf) Then from windows console I run: set Platform=x64 clean install -Pdist,native-win -DskipTests -Dtar And get error - [ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.5.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: 'protoc --version' did not return a version -&gt; [Help 1] Any ideas how to resolve this?
has answer: http://stackoverflow.com/a/26293563
upvote count: 5
answer count: 2
tagged with: apache
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/q/26241168
tagged with: setbackground
tagged with: java
score: -1
tagged with: random
has title: Make random JTextField Yellow
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/41161829
favorite count: 0
accepted answer: http://stackoverflow.com/a/26241200
has body: I have 9 textfields in my design that are named box1,box2 etc. I want to make one of these yellow. So i did put the names of the textfields in an array and tried to use the Random function to pick one of these names. But it doesnt work. String[] boxes = new String[]{"box1", "box2", "box3", "box4", "box5", "box6", "box7", "box8", "box9"}; Random rand = new Random(); int randomint = rand.nextInt(9); String thatBox = boxes[randomint]; thatBox.setBackground(Color.yellow);
has comment: http://stackoverflow.com/comment/41161016
has comment: http://stackoverflow.com/comment/41161683
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26241200
downvote count: 2
has comment: http://stackoverflow.com/comment/41161916
upvote count: 1
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/41161741
type: Question

http://stackoverflow.com/comment/41081424
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26198364
has text: Or define the equals method of the class to meet your requirements.
type: Comment

http://stackoverflow.com/q/26270689
tagged with: java
has comment: http://stackoverflow.com/comment/41215473
has comment: http://stackoverflow.com/comment/41219246
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41215751
downvote count: 0
has answer: http://stackoverflow.com/a/26272940
has comment: http://stackoverflow.com/comment/41215799
tagged with: sorting
favorite count: 0
type: Question
has title: What is the best way to get a sorted list (of finite length) from a large set of input
has body: So let's say I have 100 million Comparable's as streaming input and I want to output the top 100 of that input (in order--which is trivial I figure if you can find the top 100). I'm assuming that some sort of insertion sort would be best, but what is the best way to accomplish that (if it is even the best way)? The constraints are that you definitely see each object, one at a time (and I definitely cannot put the entire set into memory). I was thinking of two possible solutions: 1) A simple linked list. So as the first 100 objects come in they will be sorted (takes O(n) time--but n = 100). Then as each successive object comes in, it will be inserted correctly (again O(n), n = 100, time), and if inserted, it will kick out the tail (otherwise the linked list will be unchanged if it's above the maximum value). 2) Use a heap. I figure I can keep a heap, insert into the heap, then discard the root node (the top of the heap) if the size of the heap is above my maximum number of elements (100 in my case). This should mean O(lg(n)) runtime, right? Since both the insertion of an element and deletion of the root is O(lg(n)), right? Are there any good libraries for a heap in Java? I really don't want to have to code my own heap structure. p.s. If you're wondering why I'm doing this, it's for fantasy football purposes. I have a program which finds the maximum projected points of a set of players under the constraint of a salaray cap (it's a brute force algorithm). In fact that's another question entirely, which is how to solve a knapsack problem where you must have a set number of different types of items (i.e. 1 QB, 3 WRs, 2 RBs, 1 TE, 1 K, and 1 Defense). So I have a large set (1,234) of teams which give a minimum projected amount of points, but now I'm trying to find groups of teams which have a wide range of different players. I figure that a group of three teams is reasonable to solve (via brute force): 1,234 choose 3 = 312,419,184 (which, by my calculations will take abou…
score: 1
has comment: http://stackoverflow.com/comment/41215567
accepted answer: http://stackoverflow.com/a/26272940
has comment: http://stackoverflow.com/comment/41215859
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41215899
tagged with: algorithm

http://stackoverflow.com/comment/41339543
comment on: http://stackoverflow.com/q/26337744
score: 0
type: Comment
type: QuestionComment
has text: With cmd prompt, you can compile like this C:\Users\dharisis\Desktop\Dharisi\src\com\ics\test\javac TestPackage.java. Note that Eclipse has created "src" folder for your source files, so don't forget it. Then after you can run C:\Users\dharisis\Desktop\Dharisi\src\com\ics\test\java TestPackage.

http://stackoverflow.com/a/26241940
has comment: http://stackoverflow.com/comment/41164859
score: 1
has comment: http://stackoverflow.com/comment/41163333
upvote count: 1
has comment: http://stackoverflow.com/comment/41163516
has body: You need to go a different way cause the messages it already. <?xml version='1.0' encoding='UTF-8'?> 4.0.0 org.testng testng 6.8.8 org.testng testng test org.apache.maven.plugins maven-failsafe-plugin 2.17 /home/adam/coberturaint/reporting/src/test/resources/testng/it-test.xml Apart from that you need to call maven like this: mvn verify to run the integration-test phase. If you call Maven like this: mvn cobertura:cobertura-integration You have no life cycle which will not run the integration tests. You should prevent using absolute paths in your pom file as you do with your suite file. The question is on the other hand why you need a suite file. In TestNG usually you don't need one.
downvote count: 0
answers question: http://stackoverflow.com/q/26233462
has comment: http://stackoverflow.com/comment/41164913
has comment: http://stackoverflow.com/comment/41162947
type: Answer

http://stackoverflow.com/comment/41183693
score: 0
has text: Wait. So you're actually *forbidden* to follow good practice by your employer?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26252703

http://stackoverflow.com/comment/41177622
score: 0
type: AnswerComment
has text: I unzip the apk , and the .so files seems to be located inside the libs folder. I have been struggling with this issue since a while, and is extremly confused. If I send you the project, would it be too much too ask to quickly look at it?
type: Comment
comment on: http://stackoverflow.com/a/26249531

http://stackoverflow.com/a/26273529
has body: Java uses Unicode/UTF-16 for strings, not ASCII. If want to restrict your method to processing characters in the ASCII range, it should throw an exception when it encounters one outside that range. If you want a sequence of "character codes" (aka codepoints), you have to use the String.codePointAt() at method. Because String holds a counted sequences of UTF-16 code-units and there might be one or two code-units per codepoint, you only know that String.length() is an upper bound of the number of codepoints in advance. public class Q1E { int[] stringToCodes(String s) { int[] codepoints = new int[s.length()]; // there might be fewer int count = 0; for(int cp, i = 0; i &lt; s.length(); i += Character.charCount(cp)) { cp = s.codePointAt(i); // for debugging, output in Unicode stylized format System.out.println(String.format( cp &lt; 0x10000 ? "U+%04X" : "U+%05X", cp)); codepoints[count++] = cp; } int[] array = java.util.Arrays.copyOf(codepoints, count); return array; } } Try it with this Wikipedia link on an English word: stringToCodes("http://en.wikipedia.org/wiki/Résumé");
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26270406
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41298234
comment on: http://stackoverflow.com/a/26315701
score: 0
type: AnswerComment
type: Comment
has text: i try this: ANT_HOME (C:\Program Files\apache-ant-1.9.4-bin\apache-ant-1.9.4) PATH (C:\Program Files\apache-ant-1.9.4-bin\apache-ant-1.9.4\bin) but it show cannot locate javac.exe using PATH environment variable.

http://stackoverflow.com/comment/64402731
comment on: http://stackoverflow.com/a/26252993
has text: Thanks for this one. I just wanted to mention that I've managed to do this by installing jdk7 after jdk8 (there is no need to uninstall jdk8).
type: AnswerComment
score: 4
type: Comment

http://stackoverflow.com/comment/41203913
type: Comment
comment on: http://stackoverflow.com/q/26263624
has text: Command is not an inner class--its just how it copied from Eclipse.
score: 0
type: QuestionComment

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/26344590
tag name: maven-jaxb2-plugin

http://stackoverflow.com/a/26206342
has body: If you need to return a few fields, you can also select them and use the new operator: TypedQuery&lt;Sample&gt; query = entityManager.createQuery("select new com.acme.sample.Sample(e.fieldA, e.fieldB) from AnsweredQuestion e", Sample.class); return query.setParameter( ... ).getResultList(); JPA implementation will look for a Sample constructor (the path must be complete) and invoke it while transforming the result. It is pretty handy (at the cost of creating new classes to represent the result) to avoid returning everything the database has to return :)
has comment: http://stackoverflow.com/comment/41159598
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41097232
type: Answer
has comment: http://stackoverflow.com/comment/41113174
answers question: http://stackoverflow.com/q/26206261
upvote count: 2
has comment: http://stackoverflow.com/comment/41100156
has comment: http://stackoverflow.com/comment/41097009
has comment: http://stackoverflow.com/comment/41125902
has comment: http://stackoverflow.com/comment/41169105

http://stackoverflow.com/comment/41165176
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26242911
has text: i.e. my catch statement returns "Error"

http://stackoverflow.com/q/26266020
downvote count: 0
has comment: http://stackoverflow.com/comment/41207099
favorite count: 0
has body: I am having trouble with Java Pattern and Matcher. I've included a very simplified example of what I'm trying to do. I had expected the pattern ".\b" to find the last character of the first word (or "4" in the example), but as I step through the code, m.find() always returns false. What am I missing here? Why does the following Java code always print out "Not Found"? Pattern p = Pattern.compile(".\b"); Matcher m = p.matcher("102939384 is a word"); int ixEndWord = 0; if (m.find()) { ixEndWord = m.end(); System.out.println("Found: " + ixEndWord); } else { System.out.println("Not Found"); }
tagged with: regex
has title: Java Pattern / Matcher not finding word break
has answer: http://stackoverflow.com/a/26266165
upvote count: 1
possible better answer: http://stackoverflow.com/a/26266175
has comment: http://stackoverflow.com/comment/41206824
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26266175
accepted answer: http://stackoverflow.com/a/26266165
score: 1
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/1480284

http://stackoverflow.com/comment/41291624
type: Comment
type: QuestionComment
has text: I need to debug the program and cannot find the other bugs within the program. I am not a good debugger.
comment on: http://stackoverflow.com/q/26312475
score: 0

http://stackoverflow.com/q/26252824
answer count: 1
has title: Java: what's the difference between the sv and sv_SE locale?
tagged with: parsing
favorite count: 0
accepted answer: http://stackoverflow.com/a/26253271
tagged with: double
has body: I tried to parse a string (-0,3) to a double in java using Swedish locale using this code: String DoubleString = "-0,3" NumberFormat swedishNumberFormat = NumberFormat.getInstance(new Locale("sv")); System.out.println(swedishNumberFormat.parse(doubleString).doubleValue()); When I tried with the sv_SE locale the result was -3.0, which, obviously, is incorrect. I then, after a lot of headache changed the locale to sv (as in the example above) and then the result was correct, -0,3. According to http://www.localeplanet.com/java/sv/index.html and http://www.localeplanet.com/java/sv-SE/index.html the decimal separator (Decimalavgränsare) in both cases is comma (,) so why this difference? (I tried to tag this with some tags related to Sweden such as sv_SE but I didn't have enough reputation points to add new tags. Feel free to add tags if you can.)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26253271
tagged with: java
score: 9
type: Question
upvote count: 9
tagged with: locale
downvote count: 0

http://stackoverflow.com/comment/41264893
comment on: http://stackoverflow.com/a/26295267
score: 0
type: AnswerComment
has text: I've test your example, yes I got your order.Summarazing : transformation order depends on access from transformed list because transformation is lazy.
type: Comment

http://stackoverflow.com/q/26197105
has comment: http://stackoverflow.com/comment/41079069
score: -3
has answer: http://stackoverflow.com/a/26197138
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26197128
downvote count: 3
has comment: http://stackoverflow.com/comment/41079106
has answer: http://stackoverflow.com/a/26197128
type: Question
has body: Hello I am a beginner and I am trying to print a value to 1 decimal place using printf in java; however I am getting an error at the time of conversion. Here is the line of the error. System.out.printf( " us Ratio = %.1f us/compare \n " , elapsedTime/1000 );
accepted answer: http://stackoverflow.com/a/26197138
has title: why is printf causing my program to crash
answer count: 2
upvote count: 0
favorite count: 0

http://stackoverflow.com/a/26205902
has body: Yes, in fact, not just characters, but entire strings too. For example public class SOQ4 { public static void main(String[] args) { String example = "Hello there my friend"; if(example.startsWith("Hell")) { System.out.println("It can do full words"); } if(example.startsWith("H")) { System.out.println("And it can also do letters"); } if(example.endsWith("end")) { System.out.println("Don't forget the end!"); } if(example.endsWith("d")) { System.out.print("Don't forget to upvote! ;)"); } } } I recommend you use the API, here's a link to it http://docs.oracle.com/javase/7/docs/api/java/lang/String.html
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26205883
type: Answer
upvote count: 1

http://stackoverflow.com/q/26308071
answer count: 0
type: UnansweredQuestion
tagged with: sdk
tagged with: android
has comment: http://stackoverflow.com/comment/41284137
has title: Android SDK: Cannot find Java, version of the file is not compatible
type: Question
score: 0
has body: I've installed Android standalone tools on Windows 7 32-bit, but when I am trying to run the android utility on the command line, the following error report is shown: No suitable Java found. In order to properly use the ADT, you need a version of JDK installed (...) I have Java properly installed in C:\Program Files\Java\JDK, and my JAVA_HOME is set to this path. (C:\Progra~1 - for ANT), PATH includes C:\Program Files\Java\JDK ) I have read on here in other posts that android utility simply starts find_java.exe, so when I start the program directly, I had this error: The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher. It just seems like the SDK manager installs wrong (64-bit? I am not an expert on that, but the error seems like that) of Java finder for some reason. Has anyone encountered a similar kind of error? What could some reasons for that be? Thank you in advance
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/41283999

http://stackoverflow.com/q/26220214
type: UnansweredQuestion
has body: I've been spending a lot of time with java process error files i.e hs_err_pid*.log. In these files is a section titled Dynamic libraries that shows all the dlls that were currently loaded by the process at the time it failed. Is is possible to programmatically get access to this information during normal running conditions?
has title: Get list of dlls loaded by Java process
tagged with: dll
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/29078462
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/77164510
score: 2
has answer: http://stackoverflow.com/a/29077661
upvote count: 2

http://stackoverflow.com/a/26315198
answers question: http://stackoverflow.com/q/26315088
score: 0
type: Answer
has body: Make a list of EntrollmentDTO instead of list of String EntrollmentDTO.java class EntrollmentDTO { private String id; private String subId; private String subName; // Getters &amp; Setters } Make a List of EntrollmentDTO as, ArrayList&lt;EntrollmentDTO&gt; entrollmentList = new ArrayList&lt;EntrollmentDTO&gt;(); And add details as, EntrollmentDTO entrollmentDTO = new EntrollmentDTO(); entrollmentDTO.setId("A25"); // set all values entrollmentList.add(entrollmentDTO); By this you can easily access needed values from the list.

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/26226989
tags question: http://stackoverflow.com/q/26197745
type: Tag

communication
tag name: communication
tags question: http://stackoverflow.com/q/26274506
type: Tag
tags question: http://stackoverflow.com/q/26220316

http://stackoverflow.com/comment/41143997
type: Comment
comment on: http://stackoverflow.com/a/26230763
type: AnswerComment
has text: Sorry for the blunder.
score: 0

http://stackoverflow.com/comment/41145263
has text: Yes, I'm using same environment in my IDE and maven build.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26216967
score: 0

http://stackoverflow.com/q/26298059
tagged with: svn
answer count: 1
accepted answer: http://stackoverflow.com/a/26397860
has title: mvn appfuse:full-source not working because of subversion
has body: I am new for maven. I have appfuse maven project and it is embedded. I wanted to make it as full-source, but it gave me following error: Failed to execute goal org.appfuse.plugins:appfuse-maven-plugin:3.0.0:full-source (default-cli) on project OOS: svn: PROPFIND request failed on '/svn/appfuse~svn/tags/APPFUSE_3.0.0/data/common/src' I have searched solution for this and found this information and applied that solution given in the site: adding https://svn.java.net/svn/appfuse~svn/ inside of appfuse configuration tag. After adding this line to my pom.xml file, i have tried to run mvn appfuse:full-source, but it gave me the same error. full stack is here: [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.mycompany:OOS:war:1.0-SNAPSHOT [WARNING] 'dependencies.dependency.exclusions.exclusion.artifactId' for org.springmodules:spring-modules-validation:jar with value '*' does not match a valid id pattern. @ line 363, column 33 [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] ------------------------------------------------------------------------ [INFO] Building AppFuse Spring MVC Application 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- appfuse-maven-plugin:3.0.0:full-source (default-cli) @ OOS --- [INFO] [AppFuse] Installing source from data-common module... [ERROR] 175002 : svn: PROPFIND request failed on '/svn/appfuse~svn/tags/APPFUSE_3.0.0/data/common/src' [ERROR] 175002 : svn: svn.java.net: Name or service not known [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.743s [I…
tagged with: maven
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26397860
type: Question

http://stackoverflow.com/a/26324822
score: 3
has comment: http://stackoverflow.com/comment/41315217
has comment: http://stackoverflow.com/comment/41314627
accepted answer of: http://stackoverflow.com/q/26324736
has body: You don't really give enough information, but what you give looks like BorderLayout to me -- image in the NORTH section, GridLayout in the CENTER, and a panel with your Label, TextField, and Button in the SOUTH. The CENTER will shrink and grow with the size of the frame. The bottom panel appears to have a BoxLayout with y-axis, and you can set x-axis centering on each component.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26324736
type: Answer
has comment: http://stackoverflow.com/comment/41315171
upvote count: 3
has comment: http://stackoverflow.com/comment/41315135

http://stackoverflow.com/comment/41275358
has text: Yes, example will be great.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26301075

http://stackoverflow.com/comment/41324124
type: Comment
has text: Actually, this answers my question completely, but the other answer was a little "nicer".
comment on: http://stackoverflow.com/a/26329857
score: 0
type: AnswerComment

jsoup
tags question: http://stackoverflow.com/q/26242100
tags question: http://stackoverflow.com/q/26326255
tags question: http://stackoverflow.com/q/26327722
tags question: http://stackoverflow.com/q/26253617
tags question: http://stackoverflow.com/q/26281903
tags question: http://stackoverflow.com/q/26287814
tags question: http://stackoverflow.com/q/26316277
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/26346698
tags question: http://stackoverflow.com/q/26210775
tags question: http://stackoverflow.com/q/26283317
tags question: http://stackoverflow.com/q/26302376

http://stackoverflow.com/q/26316478
score: 0
answer count: 1
has body: code: public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the BookName:"); String bookName = br.readLine(); System.out.println("Book Id is: " +bookInfo(bookName).getBookAvail().get(0).getBookID().toString()); System.out.println("Book Name is: " +bookInfo(bookName).getBookAvail().get(0).getBookName().toString()); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the StudentID:"); String studentID = br.readLine(); System.out.println("Student Information is: " +studentInfo(studentID)); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } private static ArrayOfBookAvail bookInfo(java.lang.String bookName) { org.tempuri.BookService service = new org.tempuri.BookService(); org.tempuri.IBookService port = service.getBasicHttpBindingIBookService(); return port.bookInfo(bookName); } private static ArrayOfStudInfo studentInfo(java.lang.String studentID) { org.tempuri.BookService service = new org.tempuri.BookService(); org.tempuri.IBookService port = service.getBasicHttpBindingIBookService(); return port.studentInfo(studentID); } } and the output which i am getting is: Enter the BookName: Core Servlets and JavaServer Pages, Volume 2:Advanced Technologies Book Id is: javax.xml.bind.JAXBElement@196da649 Enter the StudentID: 13MCAL058 Student Information is: org.datacontract.schemas._2004._07.lms.ArrayOfStudInfo@2b08bc5a please help to get the proper output. Thank you in advance.
has comment: http://stackoverflow.com/comment/41299142
type: UnansweredQuestion
has title: I am trying to consume a java web service from .NET. i am not getting proper output
tagged with: java
has comment: http://stackoverflow.com/comment/41309215
tagged with: java-client
type: Question
has comment: http://stackoverflow.com/comment/41309319
has answer: http://stackoverflow.com/a/26316677

http://stackoverflow.com/comment/41112889
type: QuestionComment
has text: Thanks icza, also realized this just a second ago. Makes the code just more bulky. I edited the question.
comment on: http://stackoverflow.com/q/26215365
score: 0
type: Comment

http://stackoverflow.com/comment/41088020
type: Comment
comment on: http://stackoverflow.com/a/26198550
type: AnswerComment
has text: Like a counter from 1-26 just with letters insted of numbers?
score: 0

http://stackoverflow.com/q/26246094
possible better answer: http://stackoverflow.com/a/26246331
has answer: http://stackoverflow.com/a/26246331
has comment: http://stackoverflow.com/comment/41170933
has answer: http://stackoverflow.com/a/26246421
tagged with: android-relativelayout
tagged with: android
linked to: http://stackoverflow.com/q/2784081
has comment: http://stackoverflow.com/comment/41170916
has comment: http://stackoverflow.com/comment/41170703
tagged with: spinner
has comment: http://stackoverflow.com/comment/41170988
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41171007
linked to: http://stackoverflow.com/q/16119841
accepted answer: http://stackoverflow.com/a/26246421
type: Question
tagged with: java
has body: I am trying to add a spinner dynamically to a RelativeLayout but I am having problems. This is my code. And in my class: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RelativeLayout rl = (RelativeLayout) findViewById(R.id.Relativ); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,1); adapter.add("1"); adapter.add("2"); adapter.add("3"); adapter.add("4"); adapter.add("5"); Spinner list = new Spinner(this); list.setAdapter(adapter); rl.addView(list); } But it does't run. I would like to know what is wrong in my code and how I can fix it. I have tryed with RelativeLayout params in the RelativeLayout.addView and it doesn't run. Thank you.
has title: Add a Spinner to a RelativeLayout dynamically
score: 0
answer count: 2

http://stackoverflow.com/a/69048211
answers question: http://stackoverflow.com/q/26318569
has body: AbcService abcService = mock(AbcService.class); Check the syntax: doThrow(new RunTimeException()).when(abcService).add(any(), any()) Common Mistake as seen below: A. doThrow(new RunTimeException()).when(abcService.add(any(), any())) Similarly, check for when().thenReturn(), so on.
has comment: http://stackoverflow.com/comment/139941554
score: 12
upvote count: 12
downvote count: 0
type: Answer

http://stackoverflow.com/q/26257530
has comment: http://stackoverflow.com/comment/41190462
has title: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41190518
has answer: http://stackoverflow.com/a/26257656
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41191047
linked to: http://stackoverflow.com/q/2353141
tagged with: mysql
has body: I am getting java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in my dynamic web application even though I have set build path correctly in Eclipse for mysql connector. I am pretty sure that I have set built path correctly. I doubled checked that. I ran through so many same kind of questions in stackoverflow. All of them suggest to set build path in Eclipse. My question is, are there any other ways that can generate java.lang.ClassNotFoundException: com.mysql.jdbc.Driver error? If so , how to solve that? Thank you!
tagged with: eclipse
type: Question
duplicate of: http://stackoverflow.com/q/2353141
downvote count: 0
has comment: http://stackoverflow.com/comment/41190990
accepted answer: http://stackoverflow.com/a/26257656
answer count: 1
has comment: http://stackoverflow.com/comment/41190546
has comment: http://stackoverflow.com/comment/41190475
favorite count: 0
tagged with: jdbc
upvote count: 1

http://stackoverflow.com/comment/41151216
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26236108
has text: You should include the entire class. In particular the constructor, the initialization of `top` and `stack` and the `push` method.

http://stackoverflow.com/q/26277424
answer count: 3
tagged with: regex
has comment: http://stackoverflow.com/comment/41231658
tagged with: xpath
possible better answer: http://stackoverflow.com/a/26279646
has answer: http://stackoverflow.com/a/26279646
has answer: http://stackoverflow.com/a/26283780
has comment: http://stackoverflow.com/comment/41231475
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41227875
has title: Selenium WebDriver, Java: how to determine if a page is fully loaded by comparing two elements?
has comment: http://stackoverflow.com/comment/41231543
tagged with: java
has answer: http://stackoverflow.com/a/26295766
tagged with: selenium
has comment: http://stackoverflow.com/comment/41230917
type: Question
accepted answer: http://stackoverflow.com/a/26295766
has body: Background I am using Selenium WebDriver/Java to scrape a table. The table I am interested in is divided into many separate pages (= one must click a link to see the next page). At the bottom of the table is an incomplete numerical index (The whole table is 170+ pages. When you are on one of the first 20 pages, the index contains links to page 1-20, when you are on page 21-40 the index contains links to page 21-40 etc) where you can click on a specific number to load that page. The whole index is in one cell, like this 1 2...20. There are also links to First, Previous page, Next and Last page. The number of/link to the current page has a specific class (CurrentPage). I browse through each of these pages by clicking Next and here is the problem: how do I verify that the table has finished loading when I go to the next page? Usually in this project, to verify that a page is fully loaded before Selenium proceeds I use something like this code: webDriverBackedSelenium.click(xpathToSomeLink); new WebDriverWait(driver, normalTimeout).until(ExpectedConditions.presenceOfElementLocated(By.xpath(xpathToSomeElemen))); Now to my problem/the question: I have been unable to write an XPath that I can use in the code above. I guess that what I need is to, after Selenium clicks a link, look at the content of an A-tag that has the class CurrentPage and verify that it has changed (+1) compared to before the click. I found what looked like a good example of how to write XPaths that target the content of a tag here http://manual.calibre-ebook.com/xpath.html#selecting-by-tag-content but when I run their example //h:h2[re:test(., 'chapter|section', 'i')] in Firebug/Firepath I just receive an error message that the XPath is invalid. Why? What is wrong with their example? And how do I write an XPath I that can distinguish between these two situations (first case I am on page 21, in the second example I am on page 22): 21 22 21 22 A final note: I am using Selenium to scrape data from a websi…
score: 0

http://stackoverflow.com/q/26246176
type: Question
has comment: http://stackoverflow.com/comment/41232715
has title: get filenames' list using Spring RestTemplate
answer count: 1
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27926866
has body: Using Spring RestTemplate for the first time. Is there an easy way to get the list of filenames contained in a remote directory using Spring RestTemplate ? TO get a specific file (filename), I would do sth like @Autowired private RestTemplate restTemplate; (...) String fileUrl = "https://myrepo.com/filename.xml"; HttpHeaders httpHeaders = restTemplate.headForHeaders(fileUrl); FileDTO fileDTO = parseHttpHeaders(httpHeaders); But this time I simply would want the list of filenames contained in the directory url "https://myrepo.com/" . Which of the methods in the RestTemplate API woudld allow me to do so ?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41174744
tagged with: resttemplate

jax-rs
tags question: http://stackoverflow.com/q/26233948
tags question: http://stackoverflow.com/q/26334733
tags question: http://stackoverflow.com/q/26307772
tags question: http://stackoverflow.com/q/26275771
tags question: http://stackoverflow.com/q/26318850
tags question: http://stackoverflow.com/q/26307735
tags question: http://stackoverflow.com/q/26290423
tags question: http://stackoverflow.com/q/26207252
tags question: http://stackoverflow.com/q/26336065
tags question: http://stackoverflow.com/q/26288116
tags question: http://stackoverflow.com/q/26206466
tags question: http://stackoverflow.com/q/26252932
type: Tag
tags question: http://stackoverflow.com/q/26229869
tags question: http://stackoverflow.com/q/26353274
tags question: http://stackoverflow.com/q/26212844
tags question: http://stackoverflow.com/q/26234338
tag name: jax-rs

http://stackoverflow.com/q/26223470
tagged with: http-post
has body: I use the following function in java to connect to my php script in a server. The script queries for an image (BLOB), encodes it (base64) and sends it back in JSON format. The problem is that I can get some of the encoded data but not all of them. Should I use any headers on my httpRequest? What am I doing wrong? Here is my java function: public JSONObject makeHttpRequest(String url, String method, List&lt;NameValuePair&gt; params) { // Making HTTP request try { // request method is POST // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader( new InputStreamReader(is, "UTF-8"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); json = sb.toString(); System.out.println("Print1: "+json); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); return null; } // try parse the string to a JSON object try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); return null; } System.out.println("Print2: "+jObj.toString()); // return JSON String return jObj; } Here is my PHP code showing the JSON structure: $response = array( "success" =&gt; 0, "message" =&gt; "", "data" =&gt; ""); $stmt-&gt;bindColumn(1, $binary, PDO::PARAM_LOB); $stmt-&gt;bindColumn(2, $professorName); $stmt-&gt;fetch(PDO::FETCH_BOUND); $pic = base64_encode($binary); $data = array( "photo" =&gt; $pic, "professorName" =&gt; $professorName ); $response[…
answer count: 0
type: UnansweredQuestion
tagged with: android
has title: POST httpRequest doesn't fetch all data
has comment: http://stackoverflow.com/comment/41182128
tagged with: java
has comment: http://stackoverflow.com/comment/41130277
has comment: http://stackoverflow.com/comment/41128461
type: Question
tagged with: http-headers
score: 0

http://stackoverflow.com/comment/41368062
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26353607
has text: You're looking at the doc for the plugin used to create an **application** (hence the name "application plugin"). By definition, a Java application needs a main class. If you're building a library, you have no reason to use this plugin.
score: 4

http://stackoverflow.com/comment/41358719
type: QuestionComment
score: 1
has text: Joda-Time is what you want
comment on: http://stackoverflow.com/q/26348895
type: Comment

http://stackoverflow.com/a/27130039
has comment: http://stackoverflow.com/comment/60239204
downvote count: 0
answers question: http://stackoverflow.com/q/26272072
type: Answer
has body: nstead of using the maven bundled with netbeans install maven on your pc and have netbeans refer to it. Then edit the /conf/settings file with your proxy configuration: true yourproxy 8080 Then put wagon-http-lightweight-2.2.jar in your maven /lib/ext directory.
score: 3
upvote count: 3

arraylist
tags question: http://stackoverflow.com/q/26238045
tags question: http://stackoverflow.com/q/26226989
tags question: http://stackoverflow.com/q/26225215
tags question: http://stackoverflow.com/q/26318848
tags question: http://stackoverflow.com/q/26285896
tags question: http://stackoverflow.com/q/26246086
tags question: http://stackoverflow.com/q/26234419
tags question: http://stackoverflow.com/q/26245054
tags question: http://stackoverflow.com/q/26250673
tags question: http://stackoverflow.com/q/26329974
tags question: http://stackoverflow.com/q/26352476
tags question: http://stackoverflow.com/q/26305827
tags question: http://stackoverflow.com/q/26305590
tags question: http://stackoverflow.com/q/26258888
tags question: http://stackoverflow.com/q/26269776
tags question: http://stackoverflow.com/q/26198185
tags question: http://stackoverflow.com/q/26351563
tags question: http://stackoverflow.com/q/26257237
tags question: http://stackoverflow.com/q/26305329
tags question: http://stackoverflow.com/q/26281891
tags question: http://stackoverflow.com/q/26340926
tags question: http://stackoverflow.com/q/26210938
tags question: http://stackoverflow.com/q/26206823
tags question: http://stackoverflow.com/q/26285305
tags question: http://stackoverflow.com/q/26211934
tags question: http://stackoverflow.com/q/26242176
tags question: http://stackoverflow.com/q/26268300
tags question: http://stackoverflow.com/q/26228276
tags question: http://stackoverflow.com/q/26277282
tags question: http://stackoverflow.com/q/26349569
tags question: http://stackoverflow.com/q/26227283
tags question: http://stackoverflow.com/q/26245020
tags question: http://stackoverflow.com/q/26313329
tags question: http://stackoverflow.com/q/26237994
tags question: http://stackoverflow.com/q/26232691
tags question: http://stackoverflow.com/q/26238760
tags question: http://stackoverflow.com/q/26217741
tags question: http://stackoverflow.com/q/26209888
tags question: http://stackoverflow.com/q/26263614
tags question: http://stackoverflow.com/q/26307682
tags question: http://stackoverflow.com/q/26352858
tags question: http://stackoverflow.com/q/26303519
tags question: http://stackoverflow.com/q/26269799
tags question: http://stackoverflow.com/q/26293075
tags question: http://stackoverflow.com/q/26351526
tags question: http://stackoverflow.com/q/26321999
tags question: http://stackoverflow.com/q/26291941
tags question: http://stackoverflow.com/q/26222864
tags question: http://stackoverflow.com/q/26350360
tags question: http://stackoverflow.com/q/26333027
tags question: http://stackoverflow.com/q/26243333
tags question: http://stackoverflow.com/q/26271992
tags question: http://stackoverflow.com/q/26315088
tags question: http://stackoverflow.com/q/26330840
tags question: http://stackoverflow.com/q/26269995
tags question: http://stackoverflow.com/q/26199738
tags question: http://stackoverflow.com/q/26353630
tags question: http://stackoverflow.com/q/26305377
tags question: http://stackoverflow.com/q/26229607
tags question: http://stackoverflow.com/q/26204604
tags question: http://stackoverflow.com/q/26314300
tags question: http://stackoverflow.com/q/26255862
tags question: http://stackoverflow.com/q/26206484
tags question: http://stackoverflow.com/q/26331716
tags question: http://stackoverflow.com/q/26273304
tags question: http://stackoverflow.com/q/26279694
tags question: http://stackoverflow.com/q/26329571
tags question: http://stackoverflow.com/q/26259980
tags question: http://stackoverflow.com/q/26314634
tags question: http://stackoverflow.com/q/26310805
tags question: http://stackoverflow.com/q/26328020
tags question: http://stackoverflow.com/q/26224099
tags question: http://stackoverflow.com/q/26253678
tags question: http://stackoverflow.com/q/26272508
tags question: http://stackoverflow.com/q/26311338
tags question: http://stackoverflow.com/q/26222698
tags question: http://stackoverflow.com/q/26199181
tags question: http://stackoverflow.com/q/26291071
tags question: http://stackoverflow.com/q/26342645
tags question: http://stackoverflow.com/q/26285105

tcp
type: Tag
tags question: http://stackoverflow.com/q/26285861
tags question: http://stackoverflow.com/q/26349076
tags question: http://stackoverflow.com/q/26255223
tags question: http://stackoverflow.com/q/26284419
tags question: http://stackoverflow.com/q/26222850
tags question: http://stackoverflow.com/q/26314918
tag name: tcp
tags question: http://stackoverflow.com/q/26234216

http://stackoverflow.com/q/26215690
has title: Insufficient System resources exist to complete the requested services
has comment: http://stackoverflow.com/comment/41113082
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26215820
answer count: 2
has answer: http://stackoverflow.com/a/26215814
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41113233
has body: Getting the above error when trying to download large data using HttpGet String uri = ""; getMethod = executeGet(uri); httpClient.executeMethod(getMethod); InputStream istream = getMethod.getResponseBodyAsStream(); byte[] data = IOUtils.toByteArray(istream); FileUtils.writeByteArraytoFile(new File("xxx.zip"),data)
tagged with: fileutils
type: Question

http://stackoverflow.com/q/26213444
linked to: http://stackoverflow.com/q/9678785
tagged with: imageview
linked to: http://stackoverflow.com/q/15171654
has title: How to set height of the imageView programatically?
score: 0
answer count: 3
has body: I want to set the height of the image view programatically in gridview. I used below code- imageview.getLayoutParams().height = height; This is working fine in android version 4.3 and higher but not working in android version 4.2 and below. I can't find the issue. Any help please. ImageView in xml- &lt;ImageView android:id="@+id/item_image" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="centerCrop" android:background="@drawable/top_radius" /&gt;
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26213534
has answer: http://stackoverflow.com/a/26213538
type: UnansweredQuestion
tagged with: android
tagged with: layoutparams
tagged with: java
has comment: http://stackoverflow.com/comment/41109636
has answer: http://stackoverflow.com/a/26213993
has comment: http://stackoverflow.com/comment/41109825
type: Question

http://stackoverflow.com/comment/41380721
has text: I don't know it that's what you meant but implementing two interfaces is not multiple inheritance.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26339505
type: AnswerComment

http://stackoverflow.com/comment/41608716
type: Comment
type: QuestionComment
score: 0
has text: In chart class I am trying to obtain date values to be used for X-axis. addHappyData method is used to add values to the Y-axis. For the X-axis I would need dates from dateDataFromDb however I can not figure out how to modify in aChartEngine X-axis marks.
comment on: http://stackoverflow.com/q/26259980

http://stackoverflow.com/comment/41290174
has text: Thank you, RC. I just changed it to smtp. It just worked. You are my life saver. I am curious to know that the same configuration just worked before upgrade. How is that happening? Do you know about it.Please post a one liner answer. I will accept it. Thanks, Have a great day.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26311568
type: QuestionComment

http://stackoverflow.com/comment/41235704
type: Comment
comment on: http://stackoverflow.com/a/26271536
has text: I am running into a problem with this. When I click on the row, it works as expected but when I click on the checkbox, I does not remove the focus from the previously clicked row and hence it changes the state of that row along with the new row that I am clicking. Is there a way I can remove the focus from the previously selected row and change it to the row whose checkbox I am clicking?
type: AnswerComment
score: 0

http://stackoverflow.com/a/26266517
has comment: http://stackoverflow.com/comment/41207865
type: Answer
has comment: http://stackoverflow.com/comment/41208122
has body: If search performance is so important, you should just use hash of hash instead of hash of list. By the way it is not o(nn) since your outer hash has constant cost.
answers question: http://stackoverflow.com/q/26266431
score: 0

http://stackoverflow.com/q/26301752
favorite count: 0
possible better answer: http://stackoverflow.com/a/26301785
has answer: http://stackoverflow.com/a/26301785
has answer: http://stackoverflow.com/a/26301862
has comment: http://stackoverflow.com/comment/41272117
has title: Thread constructor behaviour in Java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41272110
tagged with: java
accepted answer: http://stackoverflow.com/a/26301862
has answer: http://stackoverflow.com/a/26301923
downvote count: 1
type: Question
upvote count: 0
has body: public class Test extends Thread { public void run() { System.out.println("done"); } public static void main(String[] args) { Thread t = new Thread(new Program33()); t.start(); } } //java.lang.Thread class does not have any constructor that takes a Thread as an argument, then why does this program runs successfully.
score: -1
answer count: 3
has comment: http://stackoverflow.com/comment/41272321

http://stackoverflow.com/comment/41166112
has text: Thanks a lot for your response. I tried with above changes, but, got the following exception: 1. java.lang.IllegalArgumentException: HTTP entity may not be null at org.apache.http.util.EntityUtils.toString(EntityUtils.java:110)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26243322

http://stackoverflow.com/q/26255089
has body: Please check this code sample. HttpEntity getResponseEntity = getResponse.getEntity(); String message = EntityUtils.toString(getResponseEntity,"UTF-8"); //message = {"EntryPointJsonResult":"{\"NextTransactionUrl\":null,\"TraceId\":null,\"IsAuthorizationRequired\":false,\"IsError\":false,\"ErrorCode\":null,\"ErrorMessage\":null}"} JSONObject object = new JSONObject(message); String objectString = object.getString("EntryPointJsonResult"); //objectString = {\"NextTransactionUrl\":null,\"TraceId\":null,\"IsAuthorizationRequired\":false,\"IsError\":false,\"ErrorCode\":null,\"ErrorMessage\":null} That's the question : I want to get the "objectString" without "EntryPointJsonResult". Cause this information is different at the another response. So how can I get the "objectString" without specific key like "EntryPointJsonResult"
possible better answer: http://stackoverflow.com/a/26255376
answer count: 2
has answer: http://stackoverflow.com/a/26255376
downvote count: 0
score: 7
favorite count: 0
has answer: http://stackoverflow.com/a/26255338
tagged with: android
has comment: http://stackoverflow.com/comment/41186288
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41186365
accepted answer: http://stackoverflow.com/a/26255338
upvote count: 7
type: Question
has title: How to get String from JSONObject without Specific Name

http://stackoverflow.com/comment/41079109
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26197101
has text: show us the complete code...
score: 0

http://stackoverflow.com/q/26313045
answer count: 1
has body: I have a strange problem with joining 2 tables. In java the query does not work, it prints only one row with repetition but in MySQL query it works fine. I need this data to write in a json file. How can I fix this problem? Please help. Note: For the table look up see the link: Need to join 2 tables but except some rows in another table in MySQL Here is my code: import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import org.json.JSONObject; import org.json.simple.JSONArray; public class ShowData { public void Display(){ try{ DBConnect2 dc = new DBConnect2(); PreparedStatement ps = null; ResultSet rs = null; Statement st= null; BufferedWriter wr1 = new BufferedWriter(new FileWriter(new File("E:/workspace/Test/input/display.json"))); String query5 = "SELECT DISTINCT k.source, k.target, k.frequency FROM links k " + "LEFT JOIN logs g ON g.id = k.id " + "WHERE IFNULL(status, '') != 'Delete Edge' " + "AND 'Bush' IN( k.source, k.target )"; ps = dc.getCon().prepareStatement(query5); rs = ps.executeQuery(); JSONObject obj = new JSONObject(); JSONObject obj1 = new JSONObject(); JSONArray list = new JSONArray(); while(rs.next()){ obj1.put("source", rs.getString("source")); obj1.put("target", rs.getString("target")); obj1.put("frequency", rs.getInt("frequency")); list.add(obj1); } obj.put("links", list); wr1.write(obj.toString() + "\n"); wr1.flush(); System.out.println("Done"); } catch (Exception e) { e.printStackTrace(); } } public static void main(final String[] args){ ShowData sw = new ShowData(); sw.Display(); } }
accepted answer: http://stackoverflow.com/a/26313149
has comment: http://stackoverflow.com/comment/41292602
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41292598
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
type: Question
has title: In Java the query does not work but in MySQL it works fine, how can I fixed this?
has answer: http://stackoverflow.com/a/26313149
score: 0
linked to: http://stackoverflow.com/q/26278784
linked to: http://stackoverflow.com/q/24826029

http://stackoverflow.com/comment/41187345
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26255833
has text: variable name must not contain '.`(dot)

http://stackoverflow.com/comment/41715007
comment on: http://stackoverflow.com/a/26348112
type: Comment
has text: Sure, what exactly isn't working? Using ByteBuffer you should be able to convert between byte[] and any primitive array.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26350442
type: Question
has comment: http://stackoverflow.com/comment/41364060
tagged with: jakarta-ee
has body: In spring, I can use the application context to create beans dynamically. Searching for some code to do something similar in java enterprise, I ran across the following snippet of code: public class BeanManagingUtils { private BeanManager beanManager; public BeanManagingUtils() { try { InitialContext initialContext = new InitialContext(); beanManager = (BeanManager) initialContext.lookup("java:comp/BeanManager"); } catch (NamingException e) { //log.error("Couldn't get BeanManager through JNDI"); e.printStackTrace(); } } @SuppressWarnings("unchecked") public &lt;T&gt; T getContextualInstance(final Class&lt;T&gt; type) { T result = null; Bean&lt;T&gt; bean = (Bean&lt;T&gt;) beanManager.resolve(beanManager.getBeans(type)); if (bean != null) { CreationalContext&lt;T&gt; context = beanManager.createCreationalContext(bean); if (context != null) { result = (T) beanManager.getReference(bean, type, context); } } return result; } } By calling getContextualInstance with a class, I can get it (sort of) to generate a bean, but I've no idea what sort of a bean it's generating, eg whether it's a stateless ejb, a stateful ejb, a managed bean, etc. It seems to create it happily if the bean in question is not annotated at all, and gives an error if I annotate the bean with '@Stateful'. I don't understand the documentation on BeanManager here http://docs.oracle.com/javaee/6/api/javax/enterprise/inject/spi/BeanManager.html Can anyone shed any light on what it is doing and what kind of beans it creates, or point me to fuller documentation? Many thanks!
score: 0
has comment: http://stackoverflow.com/comment/41407686
has comment: http://stackoverflow.com/comment/41378370
has title: What exactly does the BeanManager in java enterprise do?
type: UnansweredQuestion
answer count: 0
tagged with: java

http://stackoverflow.com/comment/41310048
type: AnswerComment
score: 0
type: Comment
has text: Surely, but it is a separate question, isn't it ?
comment on: http://stackoverflow.com/a/26322629

http://stackoverflow.com/comment/41314945
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26325171
has text: it is not removing a node not in the beginning , middle and end i am just messed up !
score: 0

http://stackoverflow.com/q/26343846
has body: Please find below my log4.xml configuration for rolling file appender <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> <priority value="DEBUG"/> <appender-ref ref="instrumentationAppender" /> <appender-ref ref="debugAppender" /> <appender-ref ref="errorAppender" /> The issue is instrumentationAppender,debugAppender and errorAppender are refered by com.practice pakaage as defined in above category. In all the appenders maxFileSize is 100kb and configured for Test.log file. The issue Test.log file does not get rollover after 100kb of size. All logs just get appended to same Test.log file. How do configure RollingAppender based on size? Thanks in advance for the help.
has title: log4j.xml Rolling Appender based on size
answer count: 2
downvote count: 0
tagged with: log4j
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/26736873
has answer: http://stackoverflow.com/a/26736873
tagged with: logging
has answer: http://stackoverflow.com/a/26358982
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26358982
tagged with: log4j2
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/q/26196856
type: Question
answer count: 2
tagged with: contains
upvote count: 1
has answer: http://stackoverflow.com/a/26196887
possible better answer: http://stackoverflow.com/a/26196878
favorite count: 0
has answer: http://stackoverflow.com/a/26196878
has comment: http://stackoverflow.com/comment/41078641
has title: String contains() function with Scanner in Java
tagged with: java.util.scanner
downvote count: 5
has body: System.out.println("Enter a string:"); Scanner sc = new Scanner(System.in); String str = sc.nextLine(); if (str.contains("\n")) { System.out.println("yes"); } to the above piece of code the input string one\ntwo does not print "yes" but the below code prints "yes" String str = "one\ntwo"; if (str.contains("\n")) { System.out.println("yes"); } Could anyone suggest the reason for such a result?
score: -4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41078582
tagged with: java
accepted answer: http://stackoverflow.com/a/26196887

split
tags question: http://stackoverflow.com/q/26338491
tags question: http://stackoverflow.com/q/26291446
tags question: http://stackoverflow.com/q/26275985
tag name: split
tags question: http://stackoverflow.com/q/26298822
tags question: http://stackoverflow.com/q/26294182
type: Tag

aspectj
tags question: http://stackoverflow.com/q/26270028
tags question: http://stackoverflow.com/q/26251068
tag name: aspectj
tags question: http://stackoverflow.com/q/26258158
tags question: http://stackoverflow.com/q/26329373
tags question: http://stackoverflow.com/q/26353581
tags question: http://stackoverflow.com/q/26292385
tags question: http://stackoverflow.com/q/26232991
type: Tag
tags question: http://stackoverflow.com/q/26274584
tags question: http://stackoverflow.com/q/26334380
tags question: http://stackoverflow.com/q/26320490
tags question: http://stackoverflow.com/q/26235583
tags question: http://stackoverflow.com/q/26297274

http://stackoverflow.com/a/26224382
has body: Chrome comes with some awesome built-in CPU and heap profiling tools. Firefox now has its own built-in CPU profiler, and Firebug has a different one. IE (at least 10, and I think 9) has a built in CPU profiler, though it has been a long time since I dug too far into there. Memory is historically a difficult thing to track in browsers, not least because old IE versions just won't die, and leak just from looking at them funny. If you are facing one of those memory leaks, a different plan of attack is required. But if you suspect you are dealing with a leak in your own application code, Chrome's dev tools can help! Compile in PRETTY (or DETAILED if you have an extremely wide screen), and bring up your app in Chrome with the developer tools open. In the Profiles tab, there are three kinds of profile to capture, two about memory. I typically prefer the Take Heap Snapshot, and take a 'before' and 'after' look at whatever action I believe to be leaking memory, but the Record Heap Allocations view will give you another way to consider the memory usage of your application. Start by picking a supposedly 'stable' state of your memory usage - turn the app on, use it for a bit, make sure all the various singletons etc are instantiated, and probably do whatever action you suspect as causing a problem, once. Once you are at a point which you can back to (memory-wise, at least if the leak was fixed), take a snapshot, do the behavior that leaks, return to the 'stable' state, and take another snapshot. Only take one step when checking for leaks, more on this in a bit. With the two snapshots, you can compare objects allocated and freed - we're mostly interested in cases where more objects were created than deleted, ideally where zero were deleted. If you find N objects are deleted but N+1 are created, then make sure N is veeeery small before digging in - it is often possible to fix a leak only by going after individual objects, tracing them back to their actual leaked source, fixing i…
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26217769

http://stackoverflow.com/comment/41346894
comment on: http://stackoverflow.com/a/26341881
score: 0
type: AnswerComment
type: Comment
has text: Brilliant guide, I noticed that this seems to be quite a common issue, hopefully this will clear it up for many. I took the second option as it seems much simpler to achieve, but I will also have a blast at option3 anyhow. It seems logical, but what you describe above will also apply to all resources, is this correct? Thanks anyway, works a charm.

http://stackoverflow.com/q/26311237
tagged with: openbravo
has body: Some days back I installed Openbravo ERP 3 and it was working fine. I had installed two modules: i. Loyalty Management 1.6.0 ii. POS Synchronization WebService 1.2.5 Today I uninstalled the above modules and did a rebuild. After that I restarted the Openbravo Appliance through VMware player. After restarting Openbravo ERP is giving "HTTP Status 500 -" error. The entire error is as follows: HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.openbravo.base.exception.OBException: Exception thrown Exception thrown Truncated class file org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:63) org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:103) root cause org.openbravo.base.exception.OBException: Exception thrown Truncated class file org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:56) org.openbravo.client.kernel.KernelFilter.doFilter(KernelFilter.java:71) org.openbravo.dal.core.DalRequestFilter$1.doAction(DalRequestFilter.java:81) org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:46) org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:103) root cause java.lang.ClassFormatError: Truncated class file java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClass(ClassLoader.java:643) java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) java.net.URLClassLoader.defineClass(URLClassLoader.java:277) java.net.URLClassLoader.access$000(URLClassLoader.java:73) java.net.URLClassLoader$1.run(URLClassLoader.java:212) java.security.AccessController.doPrivileged(Native Method) java.net.URLClassLoader.findClass(URLClassLoader.java:205) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66) org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:628) org.apache.ja…
has answer: http://stackoverflow.com/a/26321873
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/26321873
answer count: 1
score: 1
tagged with: erp
favorite count: 0
has title: HTTP Status 500 error in Openbravo ERP 3

http://stackoverflow.com/comment/41357644
type: QuestionComment
score: 0
has text: I hope everyone noticed all the edits I made to fill in the gaps pointed out in comments above.
comment on: http://stackoverflow.com/q/26347801
type: Comment

http://stackoverflow.com/comment/41213826
has text: Ah! Thank you so much for setting me straight, I missed the most important statement from your answer. "The parameterTypes parameter is an array of Class objects that identify the constructor's formal parameter types, in declared order"
comment on: http://stackoverflow.com/a/26269749
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41384350
has text: Thanks. I will remember to indicate java
comment on: http://stackoverflow.com/a/26359758
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/26200851
tagged with: java
tagged with: jtable
tagged with: sql
tagged with: arrays
answer count: 1
favorite count: 0
has title: I'm getting a cannot format given object as number exception when I run this code. Not sure what's wrong
score: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26200902
downvote count: 1
has body: I'm new to Java and am running this code to display the contents of one table in my database(logs). The function getData converts the ResultSet into a 2D string array and returns it. This funtion is working fine for all the other queries. Also in my database TimeStamp is of Time Stamp type. Is that creating the problem? package stock; public class ViewTrans extends javax.swing.JFrame { public ViewTrans() { initComponents(); Login l=new Login(); String uname=l.getUsername(); dbconnect db=new dbconnect(); String str[][]=db.getData("select SName,Amount,Value,TimeStamp,Operation,Brokerage from logs where UserName='"+uname+"'"); for(int i=0;i&lt;10;i++) { for(int j=0;j&lt;5;j++) { ltable.setValueAt(str[i][j],i,j); } } } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); ltable = new javax.swing.JTable(); homebutton = new javax.swing.JButton(); viewaccbutton = new javax.swing.JButton(); viewcurrstockbutton = new javax.swing.JButton(); ebutton = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); ltable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null} }, new String [] { "Company Name", "No of Shares", "Value of Share", "TimeStamp", "Operation", "Brokerage" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.Integer.class, java.lang.Double.class, java.lang.Object.class, java.lang.String.class, java.lang.Double.class }; public Class getColumnClass(int columnInde…
type: Question

http://stackoverflow.com/a/39207776
type: Answer
upvote count: 1
score: 1
has body: This ended up being do to the request cache getting in the way during our series of post login redirects. Add the following to our java security config fixed the issue. public HttpSecurity configureHttp(HttpSecurity http, IntranetSecurityAccessDeniedHandler intranetSecurityAccessDeniedHandler) throws Exception { http .requestCache().requestCache(new NullRequestCache()).and()}
answers question: http://stackoverflow.com/q/26238887
accepted answer of: http://stackoverflow.com/q/26238887
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41381679
has text: Thanks Shazin, the sample application doesn't declare this in a bean configuration but it still works. See my comment to DaveSyer above...the problem is really that the NotNull annotation doesn't do anything.
score: 0
comment on: http://stackoverflow.com/a/26351859
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41170180
has text: @Joehot200 Is the camera different for each tree or are all the calculation which use that the same each time?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26238226

http://stackoverflow.com/a/26318240
score: 1
has body: Here is why you instantly get a zero: s.push(0); while(s.size() &gt; n) // n is 8 { //... } return Solved; When the program arrives at the while-condition s has a size of one and n is 8. This will instantly fail and cause the method to return a zero. But that's not the only problem with the algorithm. You should seriously rethink it.
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41304393
answers question: http://stackoverflow.com/q/26317842

jframe
tags question: http://stackoverflow.com/q/26320880
tags question: http://stackoverflow.com/q/26351203
tags question: http://stackoverflow.com/q/26326113
tags question: http://stackoverflow.com/q/26283199
tag name: jframe
tags question: http://stackoverflow.com/q/26226895
tags question: http://stackoverflow.com/q/26208723
tags question: http://stackoverflow.com/q/26227046
tags question: http://stackoverflow.com/q/26327429
tags question: http://stackoverflow.com/q/26278453
tags question: http://stackoverflow.com/q/26199534
tags question: http://stackoverflow.com/q/26218630
tags question: http://stackoverflow.com/q/26208502
tags question: http://stackoverflow.com/q/26195014
tags question: http://stackoverflow.com/q/26318474
tags question: http://stackoverflow.com/q/26268559
tags question: http://stackoverflow.com/q/26236213
tags question: http://stackoverflow.com/q/26326806
tags question: http://stackoverflow.com/q/26319646
tags question: http://stackoverflow.com/q/26268845
tags question: http://stackoverflow.com/q/26332251
tags question: http://stackoverflow.com/q/26298973
tags question: http://stackoverflow.com/q/26224397
tags question: http://stackoverflow.com/q/26220192
tags question: http://stackoverflow.com/q/26205164
type: Tag
tags question: http://stackoverflow.com/q/26228358
tags question: http://stackoverflow.com/q/26288962

http://stackoverflow.com/a/26293108
answers question: http://stackoverflow.com/q/26292825
type: Answer
has comment: http://stackoverflow.com/comment/41256184
score: 0
has body: The issue is the if condition: if(entries!=0){ If entries is zero, you never initialize the arrays. This is what the compiler is complaining about. The easiest fix is to just remove the if while keeping the initializations: time = new String[entries]; latitude = new double[entries]; ... Allocating zero-size arrays is perfectly fine in Java. For a discussion, see Why does Java allow arrays of size 0? To make the code more compact, you can even merge the declaration with initialization: String[] time = new String[entries]; double[] latitude = new double[entries]; ...

tokenize
tags question: http://stackoverflow.com/q/26328418
tag name: tokenize
type: Tag

http://stackoverflow.com/q/26248165
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26248226
score: 2
tagged with: java
type: Question
answer count: 2
has body: I would like to use the ArrayList constructor: ArrayList(Collection&lt;? extends E&gt; c) as follows. List&lt;Integer&gt; li = new ArrayList&lt;&gt;(); List&lt;Number&gt; ln = new ArrayList&lt;&gt;(li); // won't compile.. Type mismatch: cannot convert from ArrayList&lt;Integer&gt; to List&lt;Number&gt; I don't understand the compiler error. However, the following compiles fine. List&lt;Number&gt; ln = new ArrayList&lt;Number&gt;(li); What am I missing? Using java 7
has answer: http://stackoverflow.com/a/26248265
downvote count: 0
has comment: http://stackoverflow.com/comment/41174728
favorite count: 0
has title: ArrayList type inference

http://stackoverflow.com/q/26318608
favorite count: 0
has title: Java Null Pointer Exception when reading from text file
type: UnansweredQuestion
has body: I am having trouble reading from a text file and i keep getting the error "java null pointer exception" My read file class is public class readfile { private Scanner x; public void openfile() { try { x = new Scanner(new File("test2.txt")); } catch(Exception e) { System.out.println("error"); } } public void readfile() { while(x.hasNext()) { String a = x.next(); String b = x.next(); String c = x.next(); System.out.printf("%s %s %s",a,b,c); } } and my main class to call these methods is public class InputOut { public static void main(String[] args) { readfile r = new readfile(); r.openfile(); r.readfile(); r.closeFile(); } } i get the error when i call the readfile exception so i believe i might not be opening it correctly? I saved the file in the directory where the program is run and has the follwoing format 50 issac billy 432 bryan darren 443 rob zombie did i miss something to read files here. I imported the java.io*; class and the java.util class as well. Error occurs at public void readfile()
has comment: http://stackoverflow.com/comment/41302668
tagged with: java
has comment: http://stackoverflow.com/comment/41302644
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41302722
has comment: http://stackoverflow.com/comment/41302633
score: -1
tagged with: nullpointerexception
tagged with: file-io
upvote count: 0
has answer: http://stackoverflow.com/a/26318686
answer count: 1
has comment: http://stackoverflow.com/comment/41302649

http://stackoverflow.com/q/26339052
has body: I want to create a connection pool for my Oracle database but I want this connection pool to be created when my Web App is deployed in my Tomcat Server. What I 've seen until now is loads of examples on how to create connection pooling in tomcat using JNDI and by defining the resource in the context.xml. That means (If I got this right) that even id you undeploy your app the pool remains in the server with open connections. Is there any way to define the connection pool in the Web App rather than in tomcat server? Thanks
has comment: http://stackoverflow.com/comment/41342331
type: AnsweredQuestion
tagged with: connection-pooling
tagged with: java
tagged with: web-applications
type: Question
tagged with: jndi
has answer: http://stackoverflow.com/a/26339554
has answer: http://stackoverflow.com/a/26339836
tagged with: tomcat
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26339554
has title: How to create a Connection Pool in Web App rather than in tomcat
accepted answer: http://stackoverflow.com/a/26339836

http://stackoverflow.com/comment/41266417
comment on: http://stackoverflow.com/a/26298378
score: 0
has text: I mean don't have the perception that I copied you.
type: Comment
type: AnswerComment

intellij-idea
tags question: http://stackoverflow.com/q/26290933
tags question: http://stackoverflow.com/q/26326674
tags question: http://stackoverflow.com/q/26264218
tags question: http://stackoverflow.com/q/26213727
tags question: http://stackoverflow.com/q/26320583
tags question: http://stackoverflow.com/q/26198057
tags question: http://stackoverflow.com/q/26347882
tags question: http://stackoverflow.com/q/26266147
type: Tag
tags question: http://stackoverflow.com/q/26209743
tags question: http://stackoverflow.com/q/26236488
tag name: intellij-idea
tags question: http://stackoverflow.com/q/26262940
tags question: http://stackoverflow.com/q/26213254
tags question: http://stackoverflow.com/q/26341563
tags question: http://stackoverflow.com/q/26219804
tags question: http://stackoverflow.com/q/26290831
tags question: http://stackoverflow.com/q/26347576
tags question: http://stackoverflow.com/q/26325851
tags question: http://stackoverflow.com/q/26328040
tags question: http://stackoverflow.com/q/26254259
tags question: http://stackoverflow.com/q/26285020
tags question: http://stackoverflow.com/q/26225836
tags question: http://stackoverflow.com/q/26335464
tags question: http://stackoverflow.com/q/26270960
tags question: http://stackoverflow.com/q/26352197
tags question: http://stackoverflow.com/q/26349636
tags question: http://stackoverflow.com/q/26274105
tags question: http://stackoverflow.com/q/26285000
tags question: http://stackoverflow.com/q/26226374
tags question: http://stackoverflow.com/q/26341346
tags question: http://stackoverflow.com/q/26259870
tags question: http://stackoverflow.com/q/26225989
tags question: http://stackoverflow.com/q/26218065
tags question: http://stackoverflow.com/q/26314117

http://stackoverflow.com/comment/140073830
type: Comment
comment on: http://stackoverflow.com/a/29195815
score: 0
has text: Copying this helpful comment from user @TaoufikMohdit: When running `jenv add <>`, if you get an error like this : `ln: ~/.jenv/versions/openjdk64-11.0.8: No such file or directory`, then it means `.jenv/versions` folder is missing; creating one (`mkdir ~/.jenv/versions`), then re-running `jenv add <>` should solve the problem
type: AnswerComment

http://stackoverflow.com/comment/41263815
score: 0
type: AnswerComment
has text: It's better not to use `+=`, when you're constructing `String` in many steps, here you should use `StringBuffer` or `StringBuilder`, or, easily regular expression replace, as @PeterK suggested.
type: Comment
comment on: http://stackoverflow.com/a/26297389

http://stackoverflow.com/q/26306147
possible better answer: http://stackoverflow.com/a/26306235
has answer: http://stackoverflow.com/a/26306235
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41280464
tagged with: java
has answer: http://stackoverflow.com/a/66885131
has answer: http://stackoverflow.com/a/26306213
upvote count: 1
has body: I have the following two classes Animal Class class Animal { Map&lt;String, A&gt; data = new HashMap &lt;String, A&gt;(); public void setValue(HashMap&lt;String, ?&gt; val) { this.data = val; } public Map getValue() { return this.data; } } Dog Class class Dog extends Animal { public void index() { Map&lt;String, A&gt; map = new HashMap&lt;String, A&gt;(); map.put("name", "Tommy"); map.put("favfood", "milk"); // want to pass Lists, Integers also setValue(map); } } As you can see from the above code I am trying to set some values with keys in index method, but I am getting error warnings from eclipse in both two files. Error Messages are: In Dog Class File: Multiple markers at this line - A cannot be resolved to a type - A cannot be resolved to a type In Animal Class File : Multiple markers at this line - A cannot be resolved to a type - A cannot be resolved to a type - Incorrect number of arguments for type Map&lt;K,V&gt;; it cannot be parameterized with arguments &lt;HashMap&lt;String,A&gt;&gt; The data type of the keys in HashMap will always be a String but the data types of values would be random, hence I am trying to use Generics. Coming from PHP background I still haven't been able to grasp the concept of Java Generics. Could you please tell me where is the mistake in my code?
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26306533
has comment: http://stackoverflow.com/comment/41280362
has answer: http://stackoverflow.com/a/26306494
answer count: 6
accepted answer: http://stackoverflow.com/a/26306533
score: 0
has answer: http://stackoverflow.com/a/26306530
tagged with: generics
has title: getter setter for Hashmap using generics
favorite count: 0
has comment: http://stackoverflow.com/comment/41280330

distinct
tag name: distinct
type: Tag
tags question: http://stackoverflow.com/q/26334244

http://stackoverflow.com/comment/41361713
type: QuestionComment
type: Comment
score: 0
has text: @Tim I am changing things around but not I get `com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'username'@'%' to database 'db1' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526)` I think I am getting confused to what are the correct credentials... it's driving me crazy
comment on: http://stackoverflow.com/q/26350269

http://stackoverflow.com/a/39203783
answers question: http://stackoverflow.com/q/26207948
has body: Work like a charm: Client class @Table(name = "Client") public class Client extends Model{} Contract class @Table(name = "Contract") public class Contract extends Model{} Relation between Client and Contract @Table(name = "ClientContract") public class ClientContract extends Model { @Column(name = "Client", onDelete = Column.ForeignKeyAction.CASCADE) public Client client; @Column(name = "Contract", onDelete = Column.ForeignKeyAction.CASCADE) public Contract contract; } Database helper public class DBHelper { public List&lt;Contract&gt; getRelatedContracts(Client client) { List&lt;Contract&gt; contracts = null; if (client != null &amp;&amp; client.isCreated()) { contracts = new Select() .from(Contract.class) .innerJoin(ClientContract.class).on("ClientContract.Contract = Contract.id") .where("ClientContract.Client = ?", client.getId()) .execute(); } return contracts; } public List&lt;Client&gt; getRelatedClients(Contract contract) { List&lt;Client&gt; clients = null; if (contract != null &amp;&amp; contract.isCreated()) { clients = new Select() .from(Client.class) .innerJoin(ClientContract.class).on("ClientContract.Client = Client.id") .where("ClientContract.Contract = ?", contract.getId()) .execute(); } return clients; } // get relation public ClientContract getClientContract(Client client, Contract contract) { ClientContract clientContract = null; if (client != null &amp;&amp; contract != null &amp;&amp; client.isCreated() &amp;&amp; contract.isCreated()) { clientContract = new Select().from(ClientContract.class) .where("Client = ?", client.getId()) .where("Contract = ?", contract.getId()) .executeSingle(); } return clientContract; } // add relation public ClientContract addClientContract(Client client, Contract contract) { ClientContract clientContract = getClientContract(client, contract); if (client != null &amp;&amp; contract != null &amp;&amp; clientContract == null) { if (client.getId() == null) client.save(); if (contract.getId() == null) contract.save(); cli…
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/41317721
has text: But now I am getting this exception: `javax.net.ssl.SSLHandshakeException: no cipher suites in common`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26322818
type: AnswerComment

http://stackoverflow.com/comment/41184338
score: 1
has text: [Seems not](http://stackoverflow.com/questions/20746429/java-8-limit-infinite-stream-by-a-predicate), however interesting.
type: Comment
comment on: http://stackoverflow.com/q/26253683
type: QuestionComment

http://stackoverflow.com/q/26317820
has body: Why is the order of the output different everytime I run this program? Is it due to more than one thread attempting to access a shared resource at the same time. So therefore the it will be random the way the threads are executed? My output java MyThreadExample Hello from thread 1 Hello from thread 3 Hello from thread 4 Hello from thread 2 java MyThreadExample Hello from thread 1 Hello from thread 3 Hello from thread 2 Hello from thread 4 java MyThreadExample Hello from thread 1 Hello from thread 4 Hello from thread 3 Hello from thread 2 code: import java.io.*; import java.lang.*; class MyThreadExample { public static void main(String[] args) { HelloThread ht1 = new HelloThread(1); HelloThread ht2 = new HelloThread(2); HelloThread ht3 = new HelloThread(3); HelloThread ht4 = new HelloThread(4); ht1.start(); ht2.start(); ht3.start(); ht4.start(); } } class HelloThread extends Thread { int threadID; HelloThread(int threadID) { this.threadID = threadID; } public void run() { System.out.println("Hello from thread " + this.threadID); } } // end Thread
has answer: http://stackoverflow.com/a/26317850
has title: Why is the order of the output different everytime I run this program?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41301342
has comment: http://stackoverflow.com/comment/41301307
tagged with: operating-system
answer count: 1
favorite count: 0
upvote count: 2
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26317850
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/26229631
has answer: http://stackoverflow.com/a/26229656
has body: In the following loop : while (j &lt;= number / 2) What is the need for the number to be divided by 2? Does it affect the running time to build the program or something?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26229652
score: 0
tagged with: java
has title: Displaying Prime Number Through Looping
tagged with: loops
has comment: http://stackoverflow.com/comment/41139988
type: Question
answer count: 2

http://stackoverflow.com/comment/41217868
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26262237
has text: yes. [groupId: com.mchange, artifactId: c3p0, version: 0.9.5-pre9]
type: Comment

http://stackoverflow.com/a/26333069
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26332999
has body: If Class B extends A. Then you can make Classes (C,D and E) extends class B instead of A. By this the three classes (C, D and E) can use the public functionality(attributes and methods) available in both classes B and A (inheritance hierarchy).

http://stackoverflow.com/q/26196272
has comment: http://stackoverflow.com/comment/41087709
has comment: http://stackoverflow.com/comment/41077902
downvote count: 0
answer count: 1
favorite count: 0
tagged with: int
tagged with: android
has title: Why isnt my integer coming up as 0 instead of the value i set in a count down timer?
tagged with: timer
has body: Below in the code, I have an integer called ship1 and its value is set to 5 in a count down timer object. I want to put this int value into a string array but when I do and when I print the first line of the string array into a text view, ship1AddSpend (the integer) comes up as zero. Why isnt the value changing to 5? can someone help? final TimerClass Timer2 = (TimerClass) new TimerClass(500,1000) { final public int OnFinish() { ship1AddSpend = 5; this.start(); return ship1AddSpend; } }.start(); int ship1AddSpend; final String[] shipDesc = { "10 Planets Every 5 Secs \n" + ship1AddSpend + "$", "50 Planets Every 5 Secs \n", "100 Planets Every 5 Secs \n 1500$", "500 Planets Every 4 Secs \n 3000$", "1000 Planets Every 4 Secs \n 7500$", "5000 Planets Every 4 Secs \n 15000$", "10000 Planets Every 3 Secs \n 50000$", "30000 Planets Every 3 Secs \n 100000$", "60000 Planets Every 3 Secs \n 500000$", "100000 Planets Every 1 Secs \n 1000000$"};
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41077678
has answer: http://stackoverflow.com/a/26205247
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/41365294
comment on: http://stackoverflow.com/a/26352705
score: 0
type: AnswerComment
type: Comment
has text: Thanks for reply.This fails in case: I disconnect first, and run program, after that I connect again, and this program still say it can not connect (It work fine if we stay connect, and run program). I already check the version (same in window and linux)

http://stackoverflow.com/comment/41117322
type: Comment
comment on: http://stackoverflow.com/a/26217902
has text: @biziclop my code is equivalent to the original. But if you need the actual class of some object then you need a reference to that object.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26288962
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26289003
type: Question
has title: How can I show a String for only a few seconds in Java?
answer count: 2
has body: I would like to show a String for only 5 secs on the center of my JFrame. How can I do it?
score: 0
has answer: http://stackoverflow.com/a/26289009
accepted answer: http://stackoverflow.com/a/26289009
has comment: http://stackoverflow.com/comment/41249273
has answer: http://stackoverflow.com/a/26289003
has comment: http://stackoverflow.com/comment/41249289
tagged with: string
favorite count: 0
upvote count: 2
tagged with: jframe
downvote count: 2
has comment: http://stackoverflow.com/comment/41249530

http://stackoverflow.com/comment/41292906
comment on: http://stackoverflow.com/q/26313217
score: 0
type: Comment
has text: @MysticMagic the bundle is created and initialized in the parent class.
type: QuestionComment

http://stackoverflow.com/a/26301862
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41272516
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26301752
has body: Thread class have constructor that takes Runnable public Thread(Runnable target) and Thread implements Runnable. You can see http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#Thread(java.lang.Runnable,%20java.lang.String)
has comment: http://stackoverflow.com/comment/41272423
answers question: http://stackoverflow.com/q/26301752
upvote count: 2
has comment: http://stackoverflow.com/comment/41272311

http://stackoverflow.com/q/26209714
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26209731
accepted answer: http://stackoverflow.com/a/26209731
has answer: http://stackoverflow.com/a/26209756
has title: How to compare two pairs of integers in two separate objects?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26209756
tagged with: java
tagged with: methods
has body: I have a program in progress that creates two "dominoes", of randomly generated integers end1 and end2. [end1 | end2] is the output of the "domino". I am trying to write a method that checks to see whether two Dominoes are the same. I want this method, equals(), to compare this Domino to the Domino passed as a parameter. For example [4|2] would be equal to [2|4]. I'm not sure how to compare the integers in two objects that are created in a different class. I'm sorry if this isn't clear, I will be happy to answer any questions to help. Thanks so much! so far, I have public boolean equals(Domino d) { return (this.end1 &amp;&amp; this.end2 == Domino.end1 &amp;&amp; Domino.end2 ? true : false); } Clearly, this is very wrong syntactically, but conceptually, it's what I am looking for.
type: Question

http://stackoverflow.com/a/26220713
has comment: http://stackoverflow.com/comment/41131649
has comment: http://stackoverflow.com/comment/41136123
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41123488
accepted answer of: http://stackoverflow.com/q/26220437
type: Answer
answers question: http://stackoverflow.com/q/26220437
has comment: http://stackoverflow.com/comment/41151654
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41151170
has comment: http://stackoverflow.com/comment/41123231
has body: Faster would be: int count=1000000000; while (count--!=0) ; Note that this uses a different structure for the loop (only one read of count) and it uses a local variable instead of an instance field. Using a local variable is faster because it resides in a known location on the stack, and takes only one operation for the JVM to retrieve it, whereas for an instance field, the JVM needs to look up this instance, and then load in the right field. For most purposes, the difference this extra step takes is utterly trivial, but your loop is so tight (i.e., content free) that the extra step is highly significant. You might even do better with long count=1000000000L; since this might well be a 64-bit JVM. (As far as the other app goes, it might be using JNI (native code), in which case nothing you do will compete. I doubt it, though.)
has comment: http://stackoverflow.com/comment/41123466
has comment: http://stackoverflow.com/comment/41131326
upvote count: 2

http://stackoverflow.com/comment/41206788
type: QuestionComment
has text: No. The error actually comes from `for(File file : customFiles)` which means that customFiles is null.
comment on: http://stackoverflow.com/q/26265109
score: 0
type: Comment

http://stackoverflow.com/q/26211083
tagged with: crash-dumps
answer count: 1
has comment: http://stackoverflow.com/comment/41114246
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26211278
has comment: http://stackoverflow.com/comment/41112502
has comment: http://stackoverflow.com/comment/41106171
tagged with: eclipse
has title: How to read Android crash log?
has comment: http://stackoverflow.com/comment/41105155
downvote count: 0
score: 1
favorite count: 0
tagged with: nullpointerexception
type: Question
has body: I have published my first Android app on the Google Play store a few days ago. Now a crash log is available in the Developer Console and I am trying to find out what caused the crash. Although I un-obfuscated the stack trace I have difficulties to understand the crash log: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.MyApp/com.example.MyApp.UI.AddressEditor.AddressEditorActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.example.MyApp.UI.AddressEditor.AddressEditorActivity.void setEntryStart(java.util.Date)(Unknown Source) void setCategory(com.example.MyApp.Common.Model.BookingDetail) void loadViewModel(android.os.Bundle) void putAddresDetailUUID(java.lang.String,com.example.MyApp.Common.Model.AddressDetail,android.os.Bundle) void putDate(java.lang.String,java.util.Date,android.os.Bundle) void doSave(com.example.MyApp.UI.AddressEditor.AddressEditorActivity$OnEditorTaskCompleteListener) void saveRecurringTemplate(boolean,boolean,boolean,com.example.MyApp.UI.AddressEditor.AddressEditorActivity$OnEditorTaskCompleteListener) void closeEditor(boolean,boolean,boolean) void access$0(com.example.MyApp.UI.AddressEditor.AddressEditorActivity) void access$5(com.e…
tagged with: android
has comment: http://stackoverflow.com/comment/41105561
has comment: http://stackoverflow.com/comment/41105485
tagged with: java
has comment: http://stackoverflow.com/comment/41105169
upvote count: 1

http://stackoverflow.com/q/26216417
tagged with: selenium
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26217050
has comment: http://stackoverflow.com/comment/41115567
answer count: 1
downvote count: 0
has title: selectFrame is failing in Dojo pages when using selenium
favorite count: 0
linked to: http://stackoverflow.com/q/10879206
has body: I am trying to select a frame in a dojo page with the selenium method shown below is failing driver.switchTo().frame(target); I have passed title attribute as my target value. For the target i do not have id or name attributes, how could i pass the target value for the below element. &lt;iframe frameborder="0" title="Universal Line Template Configuration" style="width:100%;height:100%;" src="/ucmadmin/ccmadmin-latest?name=universalLineTemplate&amp;key=a91ffd45-a34f-bc90-c159-1bef9e7c9921&amp;permission=3"&gt; When i check by clicking a button in a dojo page, the selenium IDE is showing two operations for a single click, as shown below click id=g_btnExpandAll_label click name=g_btnExpandAll Is anything to be done apart from the line driver.switchTo().frame(target);?
accepted answer: http://stackoverflow.com/a/26217050
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/41154473
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26234709
has text: yes, like expected, i can read the comment.

http://stackoverflow.com/comment/41251912
comment on: http://stackoverflow.com/a/26252014
type: AnswerComment
score: 0
type: Comment
has text: apparently not everything I have read indicates even booleans can take up the space of an "int" because objects keep all the fields aligned and if you only have one byte on an object and all the others are handles or ints the byte will be padded to at least an int. Some VMs may be smart enough to pack small primitives together if there is more than one. As far as I know only arrays pack them all in all the time. Of course this would be VM dependent.

http://stackoverflow.com/comment/41332883
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26334564
type: Comment
has text: From `1467-1-23` number - How do you make out that `146` is one number and 7 is another. Is the format fixed? For ex, I can say `146` is actually 3 numbers - `1`, `4` and `6`.

jasper-reports
tags question: http://stackoverflow.com/q/26194916
tags question: http://stackoverflow.com/q/26218559
tags question: http://stackoverflow.com/q/26278451
tags question: http://stackoverflow.com/q/26270795
tags question: http://stackoverflow.com/q/26277737
tag name: jasper-reports
tags question: http://stackoverflow.com/q/26322172
tags question: http://stackoverflow.com/q/26265542
tags question: http://stackoverflow.com/q/26258203
type: Tag
tags question: http://stackoverflow.com/q/26210407

http://stackoverflow.com/q/26250127
has answer: http://stackoverflow.com/a/26250250
score: 0
tagged with: java
has body: I want to replace all special characters with whitespace but I am unable to replace x : String search = "640×20141007151608@#$%$20141008104817.jpeg"; String newSearch = search.replaceAll("[\\p{Punct}&amp;&amp;[^_]]", ""); System.out.println(newSearch); output : 640×2014100715160820141008104817jpeg
has comment: http://stackoverflow.com/comment/41177832
has comment: http://stackoverflow.com/comment/41177736
type: Question
has title: Unable to replace String containing special characters
has comment: http://stackoverflow.com/comment/41177863
has comment: http://stackoverflow.com/comment/41178099
answer count: 2
has comment: http://stackoverflow.com/comment/41177769
has answer: http://stackoverflow.com/a/26250228
type: UnansweredQuestion
tagged with: regex
has comment: http://stackoverflow.com/comment/41177898

google-app-engine
tags question: http://stackoverflow.com/q/26345505
tag name: google-app-engine
type: Tag
tags question: http://stackoverflow.com/q/26242602
tags question: http://stackoverflow.com/q/26240043
tags question: http://stackoverflow.com/q/26266102
tags question: http://stackoverflow.com/q/26247006
tags question: http://stackoverflow.com/q/26337923
tags question: http://stackoverflow.com/q/26196562
tags question: http://stackoverflow.com/q/26259418
tags question: http://stackoverflow.com/q/26264414
tags question: http://stackoverflow.com/q/26282518
tags question: http://stackoverflow.com/q/26272620
tags question: http://stackoverflow.com/q/26224443
tags question: http://stackoverflow.com/q/26335464
tags question: http://stackoverflow.com/q/26196848
tags question: http://stackoverflow.com/q/26206050
tags question: http://stackoverflow.com/q/26305806
tags question: http://stackoverflow.com/q/26347952
tags question: http://stackoverflow.com/q/26202242
tags question: http://stackoverflow.com/q/26290723
tags question: http://stackoverflow.com/q/26344832
tags question: http://stackoverflow.com/q/26340444
tags question: http://stackoverflow.com/q/26246364
tags question: http://stackoverflow.com/q/26198053
tags question: http://stackoverflow.com/q/26244018
tags question: http://stackoverflow.com/q/26236083
tags question: http://stackoverflow.com/q/26270889
tags question: http://stackoverflow.com/q/26278856
tags question: http://stackoverflow.com/q/26305391
tags question: http://stackoverflow.com/q/26200485
tags question: http://stackoverflow.com/q/26342264

http://stackoverflow.com/a/26225976
score: 3
upvote count: 3
has body: Yes, two constructors. One should take a size argument; the other should take no arguments, and should defer to the other using this(32); to get a default size of 32. By the way, LinkedBlockingDeque would be the way of implementing this using standard JDK classes. Also, you might want to change terminology. Usually capacity would be the word for the maximum number of elements the stack can hold, and size would be the number of elements currently on the stack.
answers question: http://stackoverflow.com/q/26225898
downvote count: 0
type: Answer

http://stackoverflow.com/q/26317464
has comment: http://stackoverflow.com/comment/41301023
has comment: http://stackoverflow.com/comment/41300766
type: UnansweredQuestion
has body: I'm trying to translate English into the fake language of the Swedish chef. The language rules in priority order are as follows: Replace all occurrences of “AN” with “UN”. Replace all occurrences of “AU” with “OO”. Replace all occurrences of “A” not at the end of a word with “E”. Replace all occurrences of “OW” with “OO”. Replace all occurrences of “O” with “U”. Replace the first occurrence of “I” other than at the start of a word with “EE”. Replace all occurrences of “EN” at the end of a word with “EE”. Replace all occurrences of “E” at the end of a word with “E-A”. Replace all occurrences of “E” at the start of a word with “I”. Replace all occurrences of “U” with “OO”. AUTHOR should be translated OOTHOR, but my code translates it to UUTHOR. This is because my code is following the 5th rule (the one for when there is an "OO"). So, how do I get the fifth parameter to apply only when it sees a single "O" and not an "OO"? This is my code: String entry; String entry6; String entry7; String entry8; String entry9; String entry11; String entry10; String end; System.out.println("WELCOME TO THE SWEDISH CHEF TRANSLATOR!"); Scanner scan = new Scanner(System.in); System.out.print("Please enter a phrase in english: "); entry = scan.next(); String entry1 = entry; int length = entry1.length(); String entry4; System.out.println("1: " + entry1); // AN TO UN String entry2 = entry.replace("AN", "UN"); System.out.println("2: " + entry2); // AU TO OO String entry3 = entry2.replace("AU", "OO"); System.out.println("3: " + entry3); // A TO E String lastL = entry3.substring(length - 1, length); int index2 = lastL.indexOf("A"); if (index2 &lt; 0) { entry4 = entry3.replace("A", "E"); } else { String beg = entry3.substring(0, length - 1); String replacedA = beg.replace("A", "E"); System.out.print(replacedA); entry4 = lastL; } System.out.println("4: " + entry4); // OW TO OO String entry5 = entry4.replace("OW", "OO"); System.out.println("5: " + entry5); // O TO U entry6 = entry5.replace("O", "U…
has comment: http://stackoverflow.com/comment/41300941
has answer: http://stackoverflow.com/a/26317706
tagged with: java
has comment: http://stackoverflow.com/comment/41307191
type: Question
has comment: http://stackoverflow.com/comment/41301060
has comment: http://stackoverflow.com/comment/41301170
tagged with: if-statement
score: 4
tagged with: replace
upvote count: 4
has title: Converting user input to gibberish muppet talk
answer count: 3
has comment: http://stackoverflow.com/comment/41301413
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/26317582
has answer: http://stackoverflow.com/a/29438795
has comment: http://stackoverflow.com/comment/41300679
tagged with: str-replace
favorite count: 0

http://stackoverflow.com/a/26337338
upvote count: 1
has body: You need to implement a Comparator: public class NameComparator implements Comparator&lt;MyClass&gt; { @Override public int compare (MyClass c1, MyClass c2) { return c1.getName().compareTo(c2.getName()); } } Then, you can use it in conjuction with Collections.sort(List): List&lt;MyClass&gt; list = &lt;initialize and fill with data&gt;; Collections.sort(list, new NameComparator());
answers question: http://stackoverflow.com/q/26337269
score: 1
accepted answer of: http://stackoverflow.com/q/26337269
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26207620
score: 1
upvote count: 1
has body: The simplest way to solve this is to use multiple elements always. Just remove code related to single elements.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26203247
accepted answer of: http://stackoverflow.com/q/26203247
type: Answer

http://stackoverflow.com/q/26247746
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has title: Bizarre JavaFX8 OutOfMemoryError - FadeTransition
has answer: http://stackoverflow.com/a/26250775
tagged with: fade
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/41173717
has body: After hours upon hours of trying to track down a memory bug in my application, I have managed to reduce it to some very bizarre behaviour in a simple JFX program: Take the following simple example, which gradually fades a rectangle onto a transparent canvas: public class Test extends Application { @Override public void start(Stage primaryStage) { primaryStage.initStyle(StageStyle.TRANSPARENT); int width = 1920; int height = 1080; Rectangle rect = new Rectangle(width, height); rect.setFill(Color.SALMON); rect.setOpacity(0); StackPane scenePane = new StackPane(); scenePane.getChildren().add(rect); primaryStage.setScene(new Scene(scenePane)); primaryStage.setWidth(width); primaryStage.setHeight(height); primaryStage.show(); FadeTransition ft = new FadeTransition(Duration.millis(10000), rect); ft.setToValue(1); ft.play(); } public static void main(String[] args) { launch(args); } } When run with the VM args -Xms100m -Xmx100m, this works no problem at all. However, when I give the VM substantially more memory (such as -Xms1000m -Xmx1000m) it very quickly falls over: java.lang.OutOfMemoryError at sun.misc.Unsafe.allocateMemory(Native Method) at java.nio.DirectByteBuffer.&lt;init&gt;(DirectByteBuffer.java:127) at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311) at com.sun.prism.impl.BufferUtil.newByteBuffer(BufferUtil.java:90) at com.sun.prism.impl.BufferUtil.newIntBuffer(BufferUtil.java:121) at com.sun.javafx.tk.quantum.UploadingPainter.run(UploadingPainter.java:148) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125) at java.lang.Thread.run(Thread.java:745) More than o…
answer count: 1
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/41173738
tagged with: javafx-8
accepted answer: http://stackoverflow.com/a/26250775
tagged with: memory-leaks
favorite count: 0

http://stackoverflow.com/comment/41116279
has text: So does your db include the source code or/and the bytecode?
score: 0
comment on: http://stackoverflow.com/q/26217266
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26332393
has body: Something like this should work: int value = 0; for (int i = 0; ; i++) { if (i%5 == 0) { value++; } } Explanation: The loop has no end, because it doesn't have a condition The value variable is incremented only every 5 iterations We enforce that restriction by asking whether i is exactly divided by 5 Be aware that I'm not taking into account the fact that ints are finite and at some point they will overflow. For truly "infinite" values (limited only by the memory available in your machine), we would have to use arbitrary precision values, BigInteger will come in handy for that.
has comment: http://stackoverflow.com/comment/41328846
score: 6
has comment: http://stackoverflow.com/comment/41328652
accepted answer of: http://stackoverflow.com/q/26332364
answers question: http://stackoverflow.com/q/26332364
has comment: http://stackoverflow.com/comment/41328552
has comment: http://stackoverflow.com/comment/41328693
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41328518
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41328787
upvote count: 6

http://stackoverflow.com/comment/43782408
type: AnswerComment
comment on: http://stackoverflow.com/a/26315029
score: 0
type: Comment
has text: Tesser-act ocr to perform perfectly convert other type of scanned document. it's very nice job to convert to text file.

http://stackoverflow.com/comment/41336749
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26336879
has text: can you post some code

http://stackoverflow.com/comment/41264201
has text: Hi, check this for some code: http://www.codeshare.io/OwcIc . I couldn't get it all in a comment.
comment on: http://stackoverflow.com/a/26296088
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26335050
has body: res.setContentType("text/html; charset=UTF-8"); PrintWriter out = new PrintWriter( new OutputStreamWriter(res.getOutputStream(), "UTF8"), true); also you can check encoding type String encoding = request.getCharacterEncoding(); if ((encoding != null) &amp;&amp; (encoding.equalsIgnoreCase("utf-8"))) { response.setContentType("text/html; charset=utf-8"); }
type: Answer
accepted answer of: http://stackoverflow.com/q/26334988
answers question: http://stackoverflow.com/q/26334988
score: 9
upvote count: 9
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41333355
downvote count: 0

http://stackoverflow.com/comment/41612388
comment on: http://stackoverflow.com/q/26337629
has text: Looking around on Internet I did't find any good solution, I think that java EE have some problem with SQLite so I am solving making the connection by hand with this: http://www.codejava.net/java-se/jdbc/connect-to-sqlite-via-jdbc
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26342764
downvote count: 0
has body: Ok, found what was wrong. In my case I've added lib folder to WEB-INF (Project Structure->Artifacts, then in "Available Elements" select all of them, right click and select "Put into /WEB-INF/lib").
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26341346
upvote count: 1

http://stackoverflow.com/q/26217283
answer count: 1
has answer: http://stackoverflow.com/a/26217429
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: heap-memory
has title: What reason to specify InitialHeapSize more than 1m?
tagged with: java
has body: I understand why to specify MaxHeapSize - it is upper limit which can be allocated by JVM. Is there any reason to specify InitialHeapSize more than, say 1m (or even 1k)? Anyway once an application allocated that memory amount JVM will extend it.
upvote count: 1

http://stackoverflow.com/comment/84291545
score: 0
comment on: http://stackoverflow.com/a/26302673
type: Comment
has text: @ArunRaaj The first snippet I copied and pasted was right from the `java.lang.Object` documentation which dictates the contract.
type: AnswerComment

http://stackoverflow.com/comment/112654449
type: Comment
has text: How am I going to query the sum for the value?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26230227

http://stackoverflow.com/comment/41145581
type: Comment
type: QuestionComment
score: 0
has text: I explained about possibly using binary search near the end of the question, advice?
comment on: http://stackoverflow.com/q/26232887

http://stackoverflow.com/q/26326679
tagged with: forgot-password
has answer: http://stackoverflow.com/a/27764000
has comment: http://stackoverflow.com/comment/43938800
tagged with: android-keystore
has comment: http://stackoverflow.com/comment/43938779
type: Question
has title: Android Keystore password error "UnrecoverableKeyException"
type: AnsweredQuestion
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/27764000
has body: I was trying to release another version of my app when I entered my keystore and alias password and had the error "UnrecoverableKeyException: Cannot recover key". People have said this means that the alias password is different to the keystore password; my alias password is different to the keystore password but I cannot change the alias password to be the same as the keystore password without the same error occurring. How can I do this?
tagged with: security
score: 0
tagged with: android

http://stackoverflow.com/q/26268506
has comment: http://stackoverflow.com/comment/41211560
has answer: http://stackoverflow.com/a/26464787
upvote count: 1
has comment: http://stackoverflow.com/comment/41211528
has comment: http://stackoverflow.com/comment/41211589
type: AnsweredQuestion
tagged with: oop
has title: Create an attribute without encapsulation
has body: Simple question about oop. Let's pretend I have a class with an attribute in it. public class Person { // Attributes private int age; } If I remove the encapsulation of my attribute age, will it still be private? or something else? Thanks
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26464787
type: Question
downvote count: 0
answer count: 1
tagged with: encapsulation
has comment: http://stackoverflow.com/comment/41236966
favorite count: 0

http://stackoverflow.com/a/26336788
answers question: http://stackoverflow.com/q/26335959
score: 15
downvote count: 0
type: Answer
upvote count: 15
has body: In this second case, there is overhead in runtime, because the two type must be checked and in case that casting is not feasible, JVM must throw a ClassCastException. Not necessarily, it is very likely that for a simple case like this the JIT will be able to figure out that the cast will always work and will optimise the check away. Running a microbenchmark confirms the assumption: Benchmark Mode Samples Score Error Units c.a.p.SO26335959.cast avgt 5 3.177 ± 0.060 ns/op c.a.p.SO26335959.noCast avgt 5 3.174 ± 0.108 ns/op In more complicated situations, branch prediction will work in your favour too. Bottom line, as usual: measure, don't guess!

http://stackoverflow.com/comment/41153120
score: 0
comment on: http://stackoverflow.com/q/26234709
type: Comment
type: QuestionComment
has text: I can't reproduce your problem with Eclipse Kepler. Maybe this is a bug in eclipse.

http://stackoverflow.com/q/26261731
has comment: http://stackoverflow.com/comment/41198897
tagged with: java
has comment: http://stackoverflow.com/comment/41198951
has comment: http://stackoverflow.com/comment/41199295
type: Question
has answer: http://stackoverflow.com/a/26267512
has comment: http://stackoverflow.com/comment/41199006
score: 0
has comment: http://stackoverflow.com/comment/41198652
answer count: 1
has body: I have 2 threads, one is a thread that runs the "server" for my app, and the other is the event dispatcher for the GUI as shown: public static void main(String[] args) { //Connections Runnable r2 = new Runnable() { @Override public void run() { App.connectToServer(); } }; //Launch main window SwingUtilities.invokeLater(new Runnable() { public void run() { //Installs theme WebLookAndFeel.install(); //Launches main window BootWindow myMainWindow = new BootWindow(); } }); Thread thr2 = new Thread(r2); thr2.start(); } //Get instance public static App getInstance() { if ( instance == null ) { // Creating window instance instance = new App(); } return instance; } //Server connections private static void connectToServer() { System.out.println("Connecting to the eTrade Manager Server.."); etmServer server = new etmServer(); server.connectEtmServer(); } In the app's server thread there's a method that listens to new messages that come from a server, this method then calls the updateStatus method in a class that's in the GUI's thread and tries to update a panel's background color: Method that's listening: @Override public void ProcessSystemStatus(SystemStatusUpdateWrapper systemUpdate) { System.out.println("----System Update----"); System.out.println("Connection ID: " + systemUpdate.getConnectionId()); System.out.println("System Status: " + systemUpdate.getSystemStatus()); System.out.println("Risk State: " + systemUpdate.getRiskState()); System.out.println("---------End---------"); Summary smryWindow = new Summary(); smryWindow.updateStatus("Qtime", systemUpdate.getSystemStatus()); } update method in the GUI thread public void updateStatus(String panelName, String status) { if(panelName == "Qtime") { if(status == "ENABLED") { qtimeStatusPanel.setBackground(Color.GREEN); try { qtimeStatusPanel.validate(); qtimeStatusPanel.repaint(); } catch (Exception ex) { System.err.println(ex.getMessage()); } } else { qtimeStatusPanel.setBackground(Color.RED); } } } When the updateStatus ge…
linked to: http://stackoverflow.com/q/13339411
has comment: http://stackoverflow.com/comment/41199355
linked to: http://stackoverflow.com/q/3244400
has title: Thread updating GUI on dispatcher thread causes exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41198733
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41199539
tagged with: swing

http://stackoverflow.com/a/26208008
has comment: http://stackoverflow.com/comment/41098907
type: Answer
has body: If I change the cast of (Student) to (StudentCourse) I get the following error... The cast should actually be to (List&lt;StudentCourse&gt;), but the real problem is in the logic of your model here. You are calling executeSingle(), but you really want multiple StudentCourse objects so that you get every Student-Course relationship for the Course. Your students() and courses() methods don't make much sense, since one StudentCourse object only has one Student and one Course. I would do it like so instead: List&lt;StudentCourse&gt; enrolments = new Select().from(StudentCourse.class).where("course = ?",selectedCourse.getId()).execute(); List&lt;Student&gt; studentsInCourse = new ArrayList&lt;Student&gt;(); for(StudentCourse enrolment:enrolments) studentsInCourse.add(enrolment.student);
has comment: http://stackoverflow.com/comment/41099014
has comment: http://stackoverflow.com/comment/41098973
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41099016
answers question: http://stackoverflow.com/q/26207948
downvote count: 0

http://stackoverflow.com/a/26206684
score: 1
answers question: http://stackoverflow.com/q/26204538
downvote count: 0
has body: Is this a build file created by copy-n-pasting from another build file? First issue You have a compile target that depends on another non-existent target called "retrieve" &lt;target name="compile" depends="retrieve" description="Compiles source code"&gt; &lt;mkdir dir="${dir.classes}"/&gt; &lt;javac destdir="${dir.classes}" debug="true" target="1.6"&gt; &lt;classpath refid="classpath"/&gt; &lt;src path="${dir.src}"/&gt; &lt;/javac&gt; &lt;/target&gt; When using ivy it's quite common to have a target that first resolves (downloading if necessary) 3rd party jar dependencies. This is necessary in order to compile your code. Second issue Your second error is thrown by the following part of your build: &lt;path id="classpath"&gt; &lt;fileset dir="${dir.lib}" includes="*.jar"/&gt; &lt;fileset dir="${dir.ivy.lib}/default" includes="*.jar"/&gt; &lt;!--&lt;pathelement path="${dir.repos}/edu.stanford/BaselineNLProcessor/521/jars/baseline-nlprocessor-2010-06-22-521.jar" /&gt;--&gt; &lt;/path&gt; The code is expecting to find jars in the ${dir.ivy.lib}/default directory. Presumably this happens as part of the missing retrieve task. Working example using ivy Hope this helps. How to avoid copying dependencies with Ivy Class not found with Ant, Ivy and JUnit - error in build.xml?
type: Answer
upvote count: 1

http://stackoverflow.com/q/26231241
has answer: http://stackoverflow.com/a/26282364
has title: @ExceptionHandler local vs global
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26231401
tagged with: exception
tagged with: spring
has body: I am going to introduce the global handler on my web application: @ControllerAdvice public class GlobalControllerExceptionHandler { @ExceptionHandler(CustomRuntimeException.class) public @ResponseBody ImmutableMap&lt;?, String&gt; handleNullResponseException(CustomRuntimeException e) { return ImmutableMap.of(e.getClass(), e.getMessage()); } } But the issue is that legacy code contains a few controllers with local handlers like this: @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ExceptionHandler(Exception.class) public @ResponseBody ExceptionDetails handleException(Exception e) { return handleException(e); } And when controller throws CustomRuntimeException it handles by local one not global. In order to fix it I can add to each of these controllers local handlers similar to global. But as for me it is not a good one. The question: Is it possible to redirect handling custom exceptions to the global handler?
tagged with: spring-mvc
type: UnansweredQuestion
tagged with: java
type: Question

rest
tags question: http://stackoverflow.com/q/26212104
tags question: http://stackoverflow.com/q/26319332
tags question: http://stackoverflow.com/q/26248022
tags question: http://stackoverflow.com/q/26232097
tags question: http://stackoverflow.com/q/26336440
tags question: http://stackoverflow.com/q/26323171
tags question: http://stackoverflow.com/q/26340527
tags question: http://stackoverflow.com/q/26291457
tags question: http://stackoverflow.com/q/26257883
tags question: http://stackoverflow.com/q/26197645
tags question: http://stackoverflow.com/q/26334733
tags question: http://stackoverflow.com/q/26307772
tags question: http://stackoverflow.com/q/26271526
tags question: http://stackoverflow.com/q/26300907
tags question: http://stackoverflow.com/q/26275771
tags question: http://stackoverflow.com/q/26318850
tags question: http://stackoverflow.com/q/26256948
tags question: http://stackoverflow.com/q/26290423
tags question: http://stackoverflow.com/q/26197421
tags question: http://stackoverflow.com/q/26271383
tags question: http://stackoverflow.com/q/26274460
tags question: http://stackoverflow.com/q/26345062
tags question: http://stackoverflow.com/q/26207252
tags question: http://stackoverflow.com/q/26307584
tags question: http://stackoverflow.com/q/26207554
tags question: http://stackoverflow.com/q/26213216
tags question: http://stackoverflow.com/q/26308464
tags question: http://stackoverflow.com/q/26252526
tags question: http://stackoverflow.com/q/26304965
tags question: http://stackoverflow.com/q/26205860
tags question: http://stackoverflow.com/q/26241109
tags question: http://stackoverflow.com/q/26290513
tags question: http://stackoverflow.com/q/26283993
tags question: http://stackoverflow.com/q/26336065
tags question: http://stackoverflow.com/q/26353274
tags question: http://stackoverflow.com/q/26260101
tags question: http://stackoverflow.com/q/26238131
tags question: http://stackoverflow.com/q/26224248
tags question: http://stackoverflow.com/q/26240603
tags question: http://stackoverflow.com/q/26250443
tags question: http://stackoverflow.com/q/26352310
tags question: http://stackoverflow.com/q/26347408
tags question: http://stackoverflow.com/q/26326810
tags question: http://stackoverflow.com/q/26243415
tags question: http://stackoverflow.com/q/26252932
tags question: http://stackoverflow.com/q/26303506
tags question: http://stackoverflow.com/q/26251855
tags question: http://stackoverflow.com/q/26286491
type: Tag
tags question: http://stackoverflow.com/q/26221151
tags question: http://stackoverflow.com/q/26288986
tags question: http://stackoverflow.com/q/26274653
tags question: http://stackoverflow.com/q/26229869
tags question: http://stackoverflow.com/q/26300711
tags question: http://stackoverflow.com/q/26338673
tags question: http://stackoverflow.com/q/26342060
tag name: rest
tags question: http://stackoverflow.com/q/26320106
tags question: http://stackoverflow.com/q/26236811
tags question: http://stackoverflow.com/q/26266126
tags question: http://stackoverflow.com/q/26287186
tags question: http://stackoverflow.com/q/26305363
tags question: http://stackoverflow.com/q/26334813
tags question: http://stackoverflow.com/q/26266102

http://stackoverflow.com/comment/74384180
comment on: http://stackoverflow.com/a/26280143
has text: From jQuery doc - `The POST method is used if data is provided as an object; otherwise, GET is assumed.`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26199340
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26210010
has title: get value from row in html and use it in jsp
has body: I have a jsp with a table like this: ID Name Adress //here is a loop filling the table ${id} ${name} ${adress} So I want to use the id from the table in the modal (it's a popup dialog) for getting some information, but I can't get the value of the row that the user is pressing. Any help would be helpful.
score: 0
answer count: 1
tagged with: jsp

http://stackoverflow.com/comment/41078969
has text: @JBNizet Well, repetitively using `n % 10` to check whether `n % 9 == 0` is a somewhat questionable procedure… (@Tim: Hint: What would `n / 10` be?)
comment on: http://stackoverflow.com/q/26197029
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26262481
score: 1
has body: Your app is Targeted on Android version having API 17 but your app is supported to GB(GingerBread 2.3.x) By mentioning the minimum API level to 10 your app is supposed to be run in 2.3.x . And as long as you keep using support libary all features can be utilized on GB such as Fragments,ActionBar Tip: To utilize all the features without getting any pain in head use the latest Compiler eg: API 20 and target to those devices which are currently runnung(API 19)
answers question: http://stackoverflow.com/q/26262128
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/26262198
has comment: http://stackoverflow.com/comment/41199780
answers question: http://stackoverflow.com/q/26262089
score: 0
has comment: http://stackoverflow.com/comment/41200095
has comment: http://stackoverflow.com/comment/41199954
has comment: http://stackoverflow.com/comment/41199900
has body: Something like this. I just edited it to avoid ConcurrentModificationException and also moved declaration of index into the for loop. public InventoryItem deleteInventoryItem(String descriptionIn) { InventoryItem returnItem = null; InventoryItem i = null; for (int j = 0; j &lt; iList.size(); j++) { boolean result = false; i = iList.get(j); if (i.getDescription().toLowerCase().startsWith(descriptionIn.toLowerCase())) { returnItem = i; iList.remove(j); j--; } } return returnItem; }
type: Answer

http://stackoverflow.com/a/26216196
has comment: http://stackoverflow.com/comment/41114135
score: 2
has comment: http://stackoverflow.com/comment/41114397
downvote count: 0
has comment: http://stackoverflow.com/comment/41114275
has comment: http://stackoverflow.com/comment/41114349
answers question: http://stackoverflow.com/q/26216112
has body: You can use SimpleDateFormat to parse or format the date as dd/MM/yyyy. Sample code: SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); String dateString = "30/02/2014"; // form date string in above format String formattedDate = sdf.format(sdf.parse(dateString)); if (formattedDate.equals(dateString)) { System.out.println("valid date"); } else { System.out.println("Invalid date"); // It's an invalid date }
upvote count: 2
has comment: http://stackoverflow.com/comment/41114219
has comment: http://stackoverflow.com/comment/41114169
type: Answer

http://stackoverflow.com/q/26325486
upvote count: 2
has answer: http://stackoverflow.com/a/26325513
type: UnansweredQuestion
has body: I'm just asking if is thread-safe to use I precise that "doSomething()" is thread-safe.
has title: Thread - Enhanced for - java
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26325559
has answer: http://stackoverflow.com/a/26325528
answer count: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26331333
type: Answer
has comment: http://stackoverflow.com/comment/41326659
has comment: http://stackoverflow.com/comment/41326683
has comment: http://stackoverflow.com/comment/41326643
has body: You could store variables where one counts odd numbers and one counts even numbers. If the number is odd, increment the odd numbers variable. If even, increment the even numbers variable. Use the % operator to get the remainder of the input divided by 2. int oddNumbers = 0; int evenNumbers = 0; if(numbers % 2 == 1){ oddNumbers++; } else if(numbers % 2 == 0){ evenNumbers++; }
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41326669
answers question: http://stackoverflow.com/q/26331268
has comment: http://stackoverflow.com/comment/41326600
accepted answer of: http://stackoverflow.com/q/26331268

http://stackoverflow.com/a/26210319
has comment: http://stackoverflow.com/comment/41104471
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Call the createPetType(). In that case, store the reference of each lineArray. For example createPetType, //change method signature as per your requirement private void createPetType(String[] lineArray) { //now, based on the assumption that lineArray[0] element will always have the type of Pet in it. if ("Dog".equalIgnoreCase(lineArray[0])) { //create Dog class instance //once you have the appropriate Pet instance //call donatePet method to donate //similarly for Cat and Other class } } Now, inside donatePet() - if you want to do something specific to the Pet type use instanceof. For example - donatePet(Pet p) { if (p instanceof Dog) { //if you are here, it means the Pet type passed to your method is of type 'Dog' //do whatever you want to do here //to cast Pet to Dog Dog g = (Dog) p; //call the methods relevant to 'g' type //add these instances to a list which will help you with listAvailablePets() } }
type: Answer
has comment: http://stackoverflow.com/comment/41104863
has comment: http://stackoverflow.com/comment/41103862
accepted answer of: http://stackoverflow.com/q/26209888
score: 2
answers question: http://stackoverflow.com/q/26209888
has comment: http://stackoverflow.com/comment/41104028
has comment: http://stackoverflow.com/comment/41104250

http://stackoverflow.com/comment/41130261
type: Comment
has text: Not sure there is no getter here.
comment on: http://stackoverflow.com/a/26224351
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41306787
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26320753
has text: Assuming the input works properly you should do s.code.equals(codeNo[i]) instead of s.equals(codeNo[i]). You are now comparing the subject object.
type: Comment

http://stackoverflow.com/comment/41346078
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26341947
has text: There are 11 500 instances .
type: AnswerComment

http://stackoverflow.com/comment/41175926
has text: Where would char go for the widening and narrowing casts?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26248979
type: Comment

http://stackoverflow.com/comment/41232275
type: QuestionComment
score: 0
has text: Generally, JVM crashes are JVM bugs (unless your DDS provider is using JNI). Can you try another JRE? Which DDS provider does this occur with?
comment on: http://stackoverflow.com/q/26278422
type: Comment

http://stackoverflow.com/a/26229990
type: Answer
answers question: http://stackoverflow.com/q/26229933
has body: It depends on if you want to actual numeric value of the char or the ascii value or somthing similar //Get numeric value int toInt(char c) { return Character.getNumericValue(c); } //Get ascii value int toInt(char c) { return (int)c; }
score: 0

http://stackoverflow.com/q/26347234
score: 0
tagged with: java
tagged with: android-cursor
has answer: http://stackoverflow.com/a/26348005
has comment: http://stackoverflow.com/comment/41355552
type: Question
has comment: http://stackoverflow.com/comment/41356778
has comment: http://stackoverflow.com/comment/41356226
has body: I was wondering if there is a easy way to fill ListView with Cursor, like you can do with EditText: final EditText visnavn=(EditText)findViewById(R.id.visnavn); DBAdapter db; Cursor cur = db.findall(); if(cur.moveToFirst()){ do{ visnavn.append(cur.getString(0)); visnavn.append(" "); visnavn.append(cur.getString(1)); visnavn.append("\n"); }while(cur.moveToNext()); } cur.close(); I've tried something like this, with no luck: Cursor c = db.findAll(); ListView list = (ListView)findViewById(R.id.list); if(c.moveToFirst()){ do{ list.add(c.getString(0)); list.add(" "); list.add(c.getString(1)); }while(c.moveToNext()); } c.close();
has comment: http://stackoverflow.com/comment/41357414
tagged with: android-listview
answer count: 1
has title: Is there an easy way to populate a ListView with Cursor?
type: UnansweredQuestion
tagged with: android
tagged with: android-sqlite
has comment: http://stackoverflow.com/comment/41356254

http://stackoverflow.com/a/26203886
answers question: http://stackoverflow.com/q/26202307
type: Answer
has body: Here is some standalone example code using RandomAccessFile to remove lines without opening a new file, which seems to work for me. (In-place copying is required though.) public static void main(String[] args) { try { // prepare test file String path = "/tmp/test.txt"; writeTestLines(path, 999999); // mode "rws": read + write synchronous RandomAccessFile raf = new RandomAccessFile(path, "rws"); int bufSize = 1 &lt;&lt; 20; // 1 MiB Scanner s = new Scanner(new BufferedInputStream(new FileInputStream(raf.getFD()), bufSize)); PrintWriter pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream(raf.getFD()), bufSize)); long writeOffset = 0; for (int nr = 1;; nr++) { if (!s.hasNextLine()) break; String line = s.nextLine(); if (nr != 2 &amp;&amp; !line.contains("00")) { // switch to writing: save read offset, seek write offset long readOffset = raf.getFilePointer(); raf.seek(writeOffset); pw.println(line); // switch to reading: save write offset, seek read offset writeOffset = raf.getFilePointer(); raf.seek(readOffset); } } // write buffered output and truncate file raf.seek(writeOffset); pw.flush(); raf.setLength(raf.getFilePointer()); pw.close(); s.close(); raf.close(); } catch (Exception ex) { ex.printStackTrace(System.err); } } public static void writeTestLines(String path, int n) throws IOException { PrintWriter pw = new PrintWriter(path); for (int i = 1; i &lt;= n; i++) pw.println("line " + i); pw.close(); } Note that this code assumes that line endings read by the Scanner are the same as produced by PrintWriter (e.g. not just a single LineFeed on Windows). Note that above code could be optimized to not rewrite any unchanged file head - e.g. by just tracking the write offset first and then switching to a "normal" PrintWriter.
score: 0

http://stackoverflow.com/comment/41179445
score: 0
comment on: http://stackoverflow.com/a/26251057
type: Comment
type: AnswerComment
has text: I dint understand. Can you explain little more?

http://stackoverflow.com/a/26306884
upvote count: 2
has comment: http://stackoverflow.com/comment/41281952
has body: You say that your firewalls are turned off on both machines, but you also have to make sure that you connect to your public IP. The IP that your server reports is probably the LAN IP that you've received from your router through DHCP You also have to make sure that your router is configured to forward connections to port 4031 of your public IP to the IP of your server (and not to some other machine on your local network). Finally, there's a small risk that your ISP forbids setting up servers at home. In this case they may be so evil that they block incoming connections.
has comment: http://stackoverflow.com/comment/116248445
answers question: http://stackoverflow.com/q/26306856
has comment: http://stackoverflow.com/comment/41283493
has comment: http://stackoverflow.com/comment/41282784
has comment: http://stackoverflow.com/comment/41282801
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/26352946
has title: System.out.println() vs Hibernate.initialize(proxy)
has answer: http://stackoverflow.com/a/26354740
accepted answer: http://stackoverflow.com/a/26354740
has answer: http://stackoverflow.com/a/26353144
answer count: 2
upvote count: 1
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26353144
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has body: How can we solve this error correctly? org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: I have a hard time to understand and solve this exception. In my application, I need to retrieve a list of objects which are mapped to multiple tables. I try to for(SampleItem item : list) { // Hibernate.initialize(every item's field) } But is keep getting the above error. I can simply solve this problem by 1 like of the code: System.out.println(list) So I wonder which is better approach (pros and cons) to solve this exception. I personally think Hibernate.initialize() would be a better option; but not sure why (since hibernate introduce this function, probably)?
type: Question

http://stackoverflow.com/comment/41157897
score: 1
has text: @talex if it is a junit jar then it must be version 3, OP imports packages of version 4
comment on: http://stackoverflow.com/q/26239192
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26348917
score: 1
tagged with: java
type: Question
tagged with: database
tagged with: servlets
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41358992
accepted answer: http://stackoverflow.com/a/26349365
tagged with: http://stackoverflow.com/tag/html
tagged with: jdbc
has title: Dynamic table size with java servlet
type: AnsweredQuestion
has body: I have a little problem when I'd like to view selected data in a table in browser. I made it for one table (with 3 columns) but I'd like to make it for all tables, with a different number of columns, how to give a dynamical size to this table in my browser? pw.println(" "); while(rs.next()) { pw.println(" "+rs.getInt(1)+" "+rs.getString(2)+" "+ " "+rs.getString(3)+" "); } pw.println(" "); pw.close(); I tried to do like this: while(rs.next()) { for(int i=1; i<n; i++){pw.println(" "+rs.getString(i)+" ");} } where n is number of columns(I'll count it), but the result is just first row in vertical order: It's supposed to be |1 |first_n | last_n | but it's : 1 first_n List item
has answer: http://stackoverflow.com/a/26349365
downvote count: 0

http://stackoverflow.com/a/26319967
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26319804
type: Answer
score: 3
upvote count: 3
has body: In Java, that might look something like - public static void main(String[] args) { try { Process p = Runtime.getRuntime().exec("/bin/ls"); final InputStream is = p.getInputStream(); Thread t = new Thread(new Runnable() { public void run() { InputStreamReader isr = new InputStreamReader(is); int ch; try { while ((ch = isr.read()) != -1) { System.out.print((char) ch); } } catch (IOException e) { e.printStackTrace(); } } }); t.start(); p.waitFor(); t.join(); System.out.println("Child Complete"); } catch (Exception e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/41305903
has comment: http://stackoverflow.com/comment/41305890
answers question: http://stackoverflow.com/q/26319804

http://stackoverflow.com/q/26315574
has comment: http://stackoverflow.com/comment/41297629
upvote count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41297484
has title: Task definition/definition in gradle
has comment: http://stackoverflow.com/comment/41297603
has comment: http://stackoverflow.com/comment/41297497
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41298064
tagged with: java
tagged with: gradle
has body: In a gradle build script when we declare a task as follows: task lol lol &lt;&lt; { prinln "lol's action!" } and execute it as gradle -q lol it works fine. My question is why does lol task instance is already created and NullPointerException is not caused? Does declarartion task lol declare and define task simultaneously?
has comment: http://stackoverflow.com/comment/41297902
type: Question
has answer: http://stackoverflow.com/a/26316466
accepted answer: http://stackoverflow.com/a/26316466
has comment: http://stackoverflow.com/comment/41297889
has comment: http://stackoverflow.com/comment/41297526
has comment: http://stackoverflow.com/comment/41297642
has comment: http://stackoverflow.com/comment/41297363
answer count: 1
has comment: http://stackoverflow.com/comment/41300196
score: 0
has comment: http://stackoverflow.com/comment/41297759
has comment: http://stackoverflow.com/comment/41297923
tagged with: nullpointerexception
tagged with: groovy

http://stackoverflow.com/a/26225932
has body: Given that adjacencies is an array of Edges, then you can only populate adjacencies with objects of type Edge. v1.adjacencies= new Edge[]{ed}; This line is trying to populate adjacencies with a List object, not an Edge object. Since the variable ed cannot be cast from a List to an Edge, you are getting a Type Mismatch error. Instead, you will need to take your List and convert it into an array of Edges. Or you can make adjacencies a List object instead of an array.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26225584

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/26286716
type: Tag

http://stackoverflow.com/comment/41187850
has text: You were right about my answer, I forgot to filter the object class. Good answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26256031
type: Comment

jar
tags question: http://stackoverflow.com/q/26230711
tags question: http://stackoverflow.com/q/26198324
tags question: http://stackoverflow.com/q/26314404
tags question: http://stackoverflow.com/q/26227628
tags question: http://stackoverflow.com/q/26250128
tags question: http://stackoverflow.com/q/26290410
tags question: http://stackoverflow.com/q/26280291
tags question: http://stackoverflow.com/q/26298932
tags question: http://stackoverflow.com/q/26218820
tags question: http://stackoverflow.com/q/26263867
tags question: http://stackoverflow.com/q/26247934
tags question: http://stackoverflow.com/q/26260831
tags question: http://stackoverflow.com/q/26291318
tags question: http://stackoverflow.com/q/26352227
tags question: http://stackoverflow.com/q/26251193
tags question: http://stackoverflow.com/q/26338794
type: Tag
tags question: http://stackoverflow.com/q/26296753
tags question: http://stackoverflow.com/q/26219534
tags question: http://stackoverflow.com/q/26251911
tags question: http://stackoverflow.com/q/26228911
tags question: http://stackoverflow.com/q/26282832
tags question: http://stackoverflow.com/q/26343477
tags question: http://stackoverflow.com/q/26225821
tag name: jar
tags question: http://stackoverflow.com/q/26295087
tags question: http://stackoverflow.com/q/26205255
tags question: http://stackoverflow.com/q/26330234
tags question: http://stackoverflow.com/q/26252658
tags question: http://stackoverflow.com/q/26340990
tags question: http://stackoverflow.com/q/26352483
tags question: http://stackoverflow.com/q/26350192
tags question: http://stackoverflow.com/q/26331984
tags question: http://stackoverflow.com/q/26315205
tags question: http://stackoverflow.com/q/26245621
tags question: http://stackoverflow.com/q/26351365
tags question: http://stackoverflow.com/q/26210800
tags question: http://stackoverflow.com/q/26310027
tags question: http://stackoverflow.com/q/26273499
tags question: http://stackoverflow.com/q/26338387
tags question: http://stackoverflow.com/q/26247885
tags question: http://stackoverflow.com/q/26255998
tags question: http://stackoverflow.com/q/26315936

http://stackoverflow.com/comment/43349835
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26566285
has text: I agree that Class.forName(..) could be used. But i don't what this to be informed to every users of the project. I decided to expose a static method CustomUnits.valueOf() which would in turn use Unit.valueOf(). Ensuring that the Custom class is loaded and initialized.
type: AnswerComment

http://stackoverflow.com/a/26245620
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26245468
has comment: http://stackoverflow.com/comment/41169841
has comment: http://stackoverflow.com/comment/41169762
answers question: http://stackoverflow.com/q/26245468
has body: Yes, it does mean that System.in will be closed. Test case: import java.util.*; public class CloseScanner { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); scanner.close(); System.in.read(); } } This code terminates with $ java CloseScanner Exception in thread "main" java.io.IOException: Stream closed at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:162) at java.io.BufferedInputStream.fill(BufferedInputStream.java:206) at java.io.BufferedInputStream.read(BufferedInputStream.java:254) at CloseScanner.main(CloseScanner.java:7) Once closed, you won't be able to use System.in for the rest of your program. The fact that close() is passed through is nice because it means you don't have to maintain a separate reference to the input stream so that you can close it later, for example: scanner = new Scanner(foo.somethingThatMakesAnInputStream()); You can do that and call .close() on the scanner to close the underlying stream. In most cases you won't want to close System.in, so you won't want to call .close() in that case.
upvote count: 10
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41170000
has comment: http://stackoverflow.com/comment/41169780
has comment: http://stackoverflow.com/comment/41169798
score: 10

http://stackoverflow.com/comment/41265820
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26298402
score: 0
has text: Please reduce this to a short but complete example. I suspect 90% of the code and 90% of the JSON is irrelevant to the problem.

loops
tags question: http://stackoverflow.com/q/26330246
tags question: http://stackoverflow.com/q/26309498
tags question: http://stackoverflow.com/q/26242345
tags question: http://stackoverflow.com/q/26291247
tags question: http://stackoverflow.com/q/26318575
tags question: http://stackoverflow.com/q/26205883
tags question: http://stackoverflow.com/q/26220026
tags question: http://stackoverflow.com/q/26267117
tags question: http://stackoverflow.com/q/26290811
tags question: http://stackoverflow.com/q/26267953
tags question: http://stackoverflow.com/q/26321606
tags question: http://stackoverflow.com/q/26209942
tags question: http://stackoverflow.com/q/26302476
tags question: http://stackoverflow.com/q/26330070
tags question: http://stackoverflow.com/q/26291498
tags question: http://stackoverflow.com/q/26304064
type: Tag
tags question: http://stackoverflow.com/q/26333915
tags question: http://stackoverflow.com/q/26228233
tags question: http://stackoverflow.com/q/26314705
tags question: http://stackoverflow.com/q/26268879
tags question: http://stackoverflow.com/q/26249027
tags question: http://stackoverflow.com/q/26224075
tags question: http://stackoverflow.com/q/26330852
tags question: http://stackoverflow.com/q/26305189
tags question: http://stackoverflow.com/q/26229631
tags question: http://stackoverflow.com/q/26326707
tags question: http://stackoverflow.com/q/26197966
tags question: http://stackoverflow.com/q/26319764
tags question: http://stackoverflow.com/q/26246071
tags question: http://stackoverflow.com/q/26270371
tags question: http://stackoverflow.com/q/26330126
tags question: http://stackoverflow.com/q/26227067
tag name: loops
tags question: http://stackoverflow.com/q/26295071
tags question: http://stackoverflow.com/q/26205399
tags question: http://stackoverflow.com/q/26332364
tags question: http://stackoverflow.com/q/26351902
tags question: http://stackoverflow.com/q/26233251
tags question: http://stackoverflow.com/q/26235427
tags question: http://stackoverflow.com/q/26318047
tags question: http://stackoverflow.com/q/26222918
tags question: http://stackoverflow.com/q/26313906
tags question: http://stackoverflow.com/q/26227602
tags question: http://stackoverflow.com/q/26300351
tags question: http://stackoverflow.com/q/26329076
tags question: http://stackoverflow.com/q/26199856
tags question: http://stackoverflow.com/q/26240303
tags question: http://stackoverflow.com/q/26276457
tags question: http://stackoverflow.com/q/26220667

http://stackoverflow.com/a/26262468
score: 1
upvote count: 1
has body: I think this method is trying to do too much. It's strange for it to read new input and call itself recursively -- I would have expected its caller to use a loop to solicit guesses from the player and call this method (which would not recurse) instead. The method might indicate by a return value whether the user had won. Additionally, the code seems overly complex. For instance, what's the point of guessArray, which you instantiate and initialize but never use for anything? Furthermore, it's strange that you use arrays of Strings instead of arrays of chars, since all your Strings seem to contain a single character each. (That might actually be appropriate if you are looking to accommodate surrogate pairs, but such a consideration seems a little out of character for the level of the task.) In any event, the reason the recursive calls to your method see only the first letter guessed is that that's what you pass to them. The getGuesses() method does nothing to modify the local letter variable (nor can it do), and the method itself just passes along whatever was passed to it.
has comment: http://stackoverflow.com/comment/41200119
downvote count: 0
answers question: http://stackoverflow.com/q/26262247
type: Answer

http://stackoverflow.com/comment/62693642
has text: Thanks 4 answering my question, then i don't really know how 2 use selector, and by this question, I have chosen 'one thread and one Selector' which work well 4 my job!
comment on: http://stackoverflow.com/a/26310588
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41225851
type: QuestionComment
comment on: http://stackoverflow.com/q/26269940
score: 0
has text: Listen to MOUSE_ENTERED MouseEvent.
type: Comment

shell
tags question: http://stackoverflow.com/q/26223801
tags question: http://stackoverflow.com/q/26296136
tags question: http://stackoverflow.com/q/26293067
tags question: http://stackoverflow.com/q/26335236
tags question: http://stackoverflow.com/q/26318872
tags question: http://stackoverflow.com/q/26201466
tag name: shell
tags question: http://stackoverflow.com/q/26248676
tags question: http://stackoverflow.com/q/26304648
tags question: http://stackoverflow.com/q/26231170
type: Tag
tags question: http://stackoverflow.com/q/26347576

getparameter
tag name: getparameter
tags question: http://stackoverflow.com/q/26303845
type: Tag
tags question: http://stackoverflow.com/q/26275655
tags question: http://stackoverflow.com/q/26263945

http://stackoverflow.com/q/26346366
type: Question
has comment: http://stackoverflow.com/comment/41354693
tagged with: java
has title: How to get a multiple files
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26346458
has answer: http://stackoverflow.com/a/26346661
tagged with: args
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26346454
has comment: http://stackoverflow.com/comment/41354043
tagged with: command-line
has body: I have lots of txt files that are labeled as different years for example 1900.txt 1901.txt....2013.txt . My code will take the year that someone would enter into the command line and the .txt version of it. The problem it that I am trying to get all the files of the decade of the year that was entered on the command line. Example if I put 1986 in the command line I want it to get all the files of that decade, 1980.txt, 1981.txt... 1989.txt. but I don't know how i would get them. public static void main(String args[]) { String line = ""; // string var to hold entire line if (args.length &lt; 1) { System.out.println("\nYou forgot to put a Year on the command line."); System.out.println(); System.exit(1); }; String inFile = args[0]; // file name off command line String year = inFile;

http://stackoverflow.com/a/26323388
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41312717
score: 0
has body: It looks like you're trying to make an adjacency matrix... I.e. The first line in your file says 0 1 2 So, this would mean node 0 is connected to node 1 &amp; node 2. It matches with what your teacher has given also: {0,1}, {0,2}, So, in the final 2D array edges, it should be represented like so (1s in the indexes to which node 0 is connected to): edges[0] = {0, 1, 1, 0, 0, 0, 0, 0}; Dici's response is absolutely correct in this matter - it's the count variable's location that is creating a problem. Place int count = 0; outside the while loop, and use readLine() instead of read(), and you should get an adjacency matrix representation of that data. The only problem is that the teacher's representation &amp; the one you're trying to produce here are different. So, consequently, the later logic which processes these inputs will also vary. One program will run with what your teacher has provided, but won't run with the matrices you've created. ---------------------------EDIT--------------------------- In response to the comment, IMO, you'll need to go through the file twice - first to get the number of edges (in this case 20), then to fill your edges array with the actual values. import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class TestSocialGraph { public static void main(String args[]) { int[][] edges; File input = new File("GraphInput.txt"); try { Scanner reader = new Scanner(input); reader.nextLine();// Skips the first line (nameList) int count = 0; // Count the total number of 2 element arrays while (reader.hasNextLine()) { String passer = reader.nextLine(); count += passer.split(" ").length - 1; } reader.close(); edges = new int[count][]; int i = 0; reader = new Scanner(input); reader.nextLine();// Skips the first line (nameList) while (reader.hasNextLine()) { String passer = reader.nextLine(); String[] split = passer.split(" "); for (int j = 1; j &lt; split.length; j++) { edges[i + j - 1] = new int[2]; edges[i + j - 1]…
accepted answer of: http://stackoverflow.com/q/26322804
type: Answer
answers question: http://stackoverflow.com/q/26322804
has comment: http://stackoverflow.com/comment/41319533

http://stackoverflow.com/q/26281165
score: 0
answer count: 1
has title: All holo effects disappeared on redownloading sdk?
tagged with: android
has comment: http://stackoverflow.com/comment/41234100
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41234387
has body: I was making an android app in eclipse, using some Holo elements in the UI. It worked fine. Then I deleted the eclipse and sdk folder, and redownloaded it. Didn't touch the app at all in the interim. Now all the holo effects are gone, as you can see in the pictures below. How can I fix this? Thanks. Before: After: Here is my styles.xml:
has comment: http://stackoverflow.com/comment/41234403
has answer: http://stackoverflow.com/a/26281413
accepted answer: http://stackoverflow.com/a/26281413
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41234233
tagged with: java
has comment: http://stackoverflow.com/comment/41235253
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/41141350
has text: Yep I tested it and when I System.out.print(arrayl);. It shows 1234.One last thing, does this mean the elements are still 0 or will they contain 1234? Thanks
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26230204
score: 0

http://stackoverflow.com/comment/91372830
has text: @cesards you made me to go refresh my knowledge again on polymorphism lol.... Java isn't bad
score: 1
comment on: http://stackoverflow.com/a/29394173
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41223052
has text: firstly you should change "private List<User> userList = new ArrayList<>();" to "private List<User> userList = new ArrayList<User>();"
type: QuestionComment
comment on: http://stackoverflow.com/q/26275097
type: Comment
score: 2

http://stackoverflow.com/comment/41329753
type: Comment
type: QuestionComment
has text: TO be honest your question is not clear to me. Please provide us what did you input? What do you expect?
score: 2
comment on: http://stackoverflow.com/q/26333070

http://stackoverflow.com/a/26340027
score: 0
type: Answer
has body: please have a look to this tutorial from Oracle: http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html And the following code //Locale DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US); dfs.setDecimalSeparator('.'); dfs.setGroupingSeparator(','); DecimalFormat df = new DecimalFormat("###,###,###,###.000", dfs); return df.format(amount);
answers question: http://stackoverflow.com/q/26339819

http://stackoverflow.com/comment/41228047
has text: no they are not in it. There is no `lib` folder inside `WEB-INF`
comment on: http://stackoverflow.com/q/26277850
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26287557
accepted answer: http://stackoverflow.com/a/26287635
has body: I have a NullPointerException when I try to do something like that : class A { public A() { aMethod(); } public void aMethod() { //Some stuff } } class B extends A { List&lt;String&gt; list = new ArrayList&lt;String&gt; public B() { super(); } @Override public void aMethod() { super.aMethod(); list.add("Something"); //NullPointerException } } I can't instantiate the list before call super in the constructor, and I think it's not proper to instantiate it into the "aMethod".
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41246857
type: Question
has title: How to use a member into an override method called in the super constructor
has answer: http://stackoverflow.com/a/26287635
tagged with: overriding
tagged with: inheritance
score: 0
tagged with: nullpointerexception
answer count: 1

http://stackoverflow.com/a/27866408
has body: By the time the App Engine Java framework calls your code in contextDestroyed(ServletContextEvent) it has already torn down the connection to the backend services, including memcache. So unfortunately you cannot use a ServletContextListener to perform memcache operations on shutdown.
score: 0
answers question: http://stackoverflow.com/q/26272620
type: Answer

http://stackoverflow.com/a/26268398
has comment: http://stackoverflow.com/comment/41211594
answers question: http://stackoverflow.com/q/26268356
downvote count: 0
has comment: http://stackoverflow.com/comment/41211414
type: Answer
has body: Since it's an assignment, I won't write out the code, but an alternative solution is: Split the string on the , token (using String.split()) For each member of the resulting split array: Trim the leading and trailing spaces from the member If the trimmed member is an integer (I'll let you figure out how to determine that): It doesn't meet the criteria you specified Else: It's possible that the token could meet your criteria (of containing multiple integers and spaces but no commas. There are several ways you could determine this: do a split on " "; use a while loop, or maybe something else. I'll let you figure that out.
upvote count: 1
score: 1

http://stackoverflow.com/comment/41268226
type: Comment
score: 2
has text: Aside from the fact that you're not probably compiling your code in Java 8, you're also calling non-static method getNamesWithCriteria from static context.
comment on: http://stackoverflow.com/q/26299556
type: QuestionComment

http://stackoverflow.com/comment/69454737
type: AnswerComment
score: 0
type: Comment
has text: @Dormouse I don't think so cause the the internal keyword in package naming the class loader doesn't export those classes in that package when you create a Jar. You can use it in the same jar You wont be able to use it where the jar is imported.
comment on: http://stackoverflow.com/a/26302175

http://stackoverflow.com/a/26333147
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26330519
has body: I suspect the spring-data-cassandra (or other) dependency has a parent that covers all sorts of other dbs and they got pulled. You can probably exclude those you know not needed using tag org.springframework.data spring-data-cassandra 1.1.0.RELEASE .. ..
type: Answer

http://stackoverflow.com/comment/41317081
comment on: http://stackoverflow.com/q/26324079
has text: That seems like an entry from the "local_access_log" file, the errors are logged in the "catalina.out" file, which should be in the same folder. "catalina.out" is a text file, you can open it with notepad.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26263093
answer count: 1
score: 0
has title: javax.servlet.UnavailableException: EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap - running Struts 1.3.5 on Jetty 9.2.2
has body: I am in the process of migrating from jetty 8.1.5 to 9.2.2. Our app uses Spring and We support some of the old struts controllers. We use struts 1.3.5. When I start the server, I keep getting the following exception. Does this mean, I need to migrate struts as well? Is there another solution to fix this? I tried on java 7 and 8. Same thing happens. Please suggest. javax.servlet.UnavailableException: EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap at org.apache.struts.action.ActionServlet.init(ActionServlet.java:399) at javax.servlet.GenericServlet.init(GenericServlet.java:244) at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:600) at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:462) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:742) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1667) at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:172) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerCollection.hand…
type: UnansweredQuestion
tagged with: jetty
tagged with: struts-1
has comment: http://stackoverflow.com/comment/41202143
has answer: http://stackoverflow.com/a/26263633
tagged with: java
tagged with: jetty-9
tagged with: struts
type: Question

struts2
tags question: http://stackoverflow.com/q/26300711
tags question: http://stackoverflow.com/q/26274360
tags question: http://stackoverflow.com/q/26291223
tags question: http://stackoverflow.com/q/26324558
tags question: http://stackoverflow.com/q/26332768
tags question: http://stackoverflow.com/q/26235071
tag name: struts2
tags question: http://stackoverflow.com/q/26331985
tags question: http://stackoverflow.com/q/26282910
tags question: http://stackoverflow.com/q/26257975
tags question: http://stackoverflow.com/q/26238149
tags question: http://stackoverflow.com/q/26328028
tags question: http://stackoverflow.com/q/26338086
tags question: http://stackoverflow.com/q/26343306
tags question: http://stackoverflow.com/q/26279561
type: Tag
tags question: http://stackoverflow.com/q/26335957

unix
tags question: http://stackoverflow.com/q/26296991
tags question: http://stackoverflow.com/q/26211696
tags question: http://stackoverflow.com/q/26248676
tags question: http://stackoverflow.com/q/26293067
tags question: http://stackoverflow.com/q/26318872
type: Tag
tags question: http://stackoverflow.com/q/26197834
tag name: unix
tags question: http://stackoverflow.com/q/26335236
tags question: http://stackoverflow.com/q/26235809

http://stackoverflow.com/comment/41262082
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26296201
score: 0
has text: @PredragMaric we cannot assume that the client visits the web app with cookie support disabled - clients may want to use cookies on other pages

http://stackoverflow.com/q/26202567
has answer: http://stackoverflow.com/a/26307757
tagged with: java
possible better answer: http://stackoverflow.com/a/26204834
type: Question
downvote count: 0
tagged with: spring-security
has body: Good day. I am using Spring security in context of Spring boot auto-configured application. My goal is to set up basic auth in such way that standard browser's basic auth form is not shown on 401. From the Google I found out that to achieve it I need to change the default "WWW-Authenticate" header to something different than "Basic xxxxx". To do that, I declared a filter: @Bean @Order(Integer.MAX_VALUE) public Filter customAuthFilter() { return new Filter() { @Override public void init(FilterConfig fc) throws ServletException { } @Override public void doFilter(ServletRequest sreq, ServletResponse sresp, FilterChain fc) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) sreq; HttpServletResponse resp = (HttpServletResponse) sresp; fc.doFilter(req, resp); log.info("filter"); log.info("status " + resp.getStatus()); if(resp.getStatus() == 401) { resp.setHeader("WWW-Authenticate", "Client-driven"); } } @Override public void destroy() { } }; From the logs I see that my filter successfully recognized by the application and takes participation in processing responses (I see the log messages from doFilter). But the actual response, received by browser, still contains the standard 'WWW-Authenticate' header. It seems that someone overrides my header, by I don't have a clue who it is exactly. Could someone give an advice please?
accepted answer: http://stackoverflow.com/a/26307757
answer count: 3
upvote count: 6
favorite count: 0
score: 6
tagged with: spring
has answer: http://stackoverflow.com/a/26204834
type: AnsweredQuestion
tagged with: spring-boot
has title: Spring boot + Spring Security: how to suppress the basic auth form
has answer: http://stackoverflow.com/a/46334374

http://stackoverflow.com/q/26219534
upvote count: 6
favorite count: 0
has body: This is what I'm trying to do: FileSystem fs1 = FileSystems.newFileSystem(Paths.get("f1.jar"), null); FileSystem fs2 = FileSystems.newFileSystem(fs1.getPath("/f2.jar"), null); but I get a java.nio.file.ProviderNotFoundException thrown by FileSystems.newFileSystem() on the second line. What am I doing wrong? Thanks!
possible better answer: http://stackoverflow.com/a/71201938
score: 6
tagged with: java-8
has answer: http://stackoverflow.com/a/26220333
type: AnsweredQuestion
has title: get FileSystems of a jar inside another jar
tagged with: java
has answer: http://stackoverflow.com/a/68421517
has comment: http://stackoverflow.com/comment/41120664
type: Question
downvote count: 0
tagged with: jar
accepted answer: http://stackoverflow.com/a/26220333
has comment: http://stackoverflow.com/comment/41120949
answer count: 3
has answer: http://stackoverflow.com/a/71201938
has comment: http://stackoverflow.com/comment/41164855

http://stackoverflow.com/q/26211107
tagged with: java
has comment: http://stackoverflow.com/comment/62655246
has answer: http://stackoverflow.com/a/26211605
score: 2
has comment: http://stackoverflow.com/comment/41105042
has comment: http://stackoverflow.com/comment/41104976
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/4303160
tagged with: android
has body: I want to display a clickable URL in the message of android so i need your suggestion how to do that? I used Linkify but it is used for only text view but i want it in the StringBuilder. StringBuilder shareMsgBuilder = new StringBuilder("google.com");
upvote count: 2
type: UnansweredQuestion
type: Question
has title: show clickable URL in message using StringBuilder java
tagged with: stringbuilder

http://stackoverflow.com/comment/41225684
score: 0
type: Comment
has text: @Justin I fear I'm at the limit of what I can do to help. The only thing I can advise you with is to upgrade your JDBC driver. Maybe it has a bug, or it does not support deletion. If that doesn't help you are probably restricted to running a SQL `DELETE` statement. In general, you are best to come with a SET based solution to your problem and void `CURSOR`s. Good luck.
type: AnswerComment
comment on: http://stackoverflow.com/a/26273138

http://stackoverflow.com/comment/41309886
comment on: http://stackoverflow.com/q/26322494
has text: @Winestone Corrected it, I mistyped it
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41210348
type: AnswerComment
comment on: http://stackoverflow.com/a/26267822
score: 0
type: Comment
has text: Thank you I either missed that in the book or it was not covered yet

http://stackoverflow.com/comment/41148517
comment on: http://stackoverflow.com/q/26234112
has text: So why do you write this? And by the way, why should `ResponseProcessor<List<Dashboard>> responseProcessor = ResponseProcessorFactory.newResponseProcessor();` return you a `ResponseProcessor<List<String>>`?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41233145
type: QuestionComment
has text: someting like this: localhost:8080/index || localhost:8080/index/somePage || i mean without this "faces" and project name. and why when i start my project the url is short and than when i want back to the start form is longer.
comment on: http://stackoverflow.com/q/26278831
score: 0
type: Comment

http://stackoverflow.com/comment/41358979
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26348966
has text: The reason why is because I am working on a project and I can't assume that my professor has the API. Also this inquiry is only a small part of the project. I am stumbled on it and just needed help.
type: Comment

http://stackoverflow.com/a/26194828
answers question: http://stackoverflow.com/q/26194803
accepted answer of: http://stackoverflow.com/q/26194803
type: AcceptedAnswer
score: 0
has body: You increment size and then call isEmpty() (which checks whether size is zero) to decide how to add the item: size++ ; if (isEmpty( )) {
type: Answer

http://stackoverflow.com/a/26294005
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
has body: Well, a frequently asked question when a developer is going to extends View. onMeasure() is your opportunity to tell Android how big you want your custom view to be dependent the layout constraints provided by the parent. I will suggest first go through this. I want to highlight a very specific para from this specific article. Drawing the layout is a two pass process: a measure pass and a layout pass. The measuring pass is implemented in measure(int, int) and is a top-down traversal of the View tree. Each View pushes dimension specifications down the tree during the recursion. At the end of the measure pass, every View has stored its measurements. The second pass happens in layout(int, int, int, int) and is also top-down. During this pass each parent is responsible for positioning all of its children using the sizes computed in the measure pass. After reading this it is very easy to understand that whenever your layout is visible on screen. It will from root node (means parent to child) and whenever your view is going to draw it will check available space and trigger onMeasure with required specification. I think this answer will help. Sorry, forget to answer your question after going through the source code of LinearLayout you will find a private method: private void forceUniformWidth(int count, int heightMeasureSpec) { ... } which will force your widthmode to EXACTLY. See 509 line in this code.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26293705
answers question: http://stackoverflow.com/q/26293705

http://stackoverflow.com/comment/41356364
has text: Do you know of any other solutions that don't require conversion to images? I'd just like something where I can render a pdf that a user can edit in a browser. Does that make sense? - I CAN do it, by converting the pdf to an image and overlaying a canvas, I just thought that there should be a better way of accomplish something that I'd imagine to be at least sort-of common...
score: 0
comment on: http://stackoverflow.com/q/26343631
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26243546
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/41177744
upvote count: 1
answers question: http://stackoverflow.com/q/26228276
has body: Here's another way to compute this with Java 8 features, but with streams this time. (scaffolding from @William Price's answer) List&lt;String&gt; states = Arrays.asList( "Utah", "Nevada", "California", "Oregon", "Utah", "California", "Nevada", "Nevada", "Oregon", "California" ); List&lt;Integer&gt; values = Arrays.asList(5, 6, 12, 8, 9, 10, 4, 4, 17, 6); assert states.size() == values.size(); Map&lt;String, List&lt;Integer&gt;&gt; collated = IntStream.range(0, states.size()).boxed().collect( Collectors.groupingBy(states::get, LinkedHashMap::new, Collectors.mapping(values::get, Collectors.toList()))); collated.forEach((k,v) -&gt; System.out.printf("%s %s%n", k, v)); Working with multiple input sources can be awkward in streams, but using a stream of indices is perfect for this "corresponding-list" case. groupingBy classifies the indices by their value in the states list, mapping maps the indices to their value in the values list, and toList, well, collects them into a list. Using LinkedHashMap preserves the order of insertion.
downvote count: 0

http://stackoverflow.com/a/26265693
has comment: http://stackoverflow.com/comment/41206599
has comment: http://stackoverflow.com/comment/41206509
score: 1
accepted answer of: http://stackoverflow.com/q/26265666
type: Answer
upvote count: 1
has body: What you are doing is fine, but the warning is given because you only assign to word and never read from it. Try just leaving out the assignment and using just inputFile.next() instead with simply not saving the result.
answers question: http://stackoverflow.com/q/26265666
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41206541

http://stackoverflow.com/q/26346490
type: Question
has answer: http://stackoverflow.com/a/26346562
has body: I can't figure out why my bundle SavedInstanceState is not saving when the application closes. Chances are it's just something stupid that I didn't know about though! The main activity doesn't have much in it, just a page adapter for transitioning screens, because that is a major part of what I'm going to try to make. Most of the code right now is in my StandFragment.java, it's the first page that shows up when you open the app. That's where the save state and that sort of thing is. MainActivity: public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } private class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int pos){ switch(pos){ case 0: return StandFragment.newInstance("STAND"); case 1: return CartFragment.newInstance("CART"); case 2: return ThirdFragment.newInstance("THIRD"); case 3: return ThirdFragment.newInstance("FOURTH"); case 4: return ThirdFragment.newInstance("FIFTH"); default: return ThirdFragment.newInstance("Default"); } } @Override public int getCount(){ return 5; } } } StandFragment: public class StandFragment extends Fragment{ private int totalMoney; private int moneyPerSec; private int moneyPerClick; Handler handleCounter = new Handler(); TextView counter; TextView perSecCounter; Button buttonMoney; Button buttonMoneyPerSec; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ View v = inflater.inflate(R.layout.stand_frag, container, false); super.onCreate(savedInstanceState); buttonMoney = (Button)v.findViewById(R.id.buttonMoney); buttonMoneyPerSec = (Button)v.findViewById(R.id.buttonMoneyPerSec); counter = (TextView)v.findViewById(R.id.tvMo…
has title: InstanceState not saving
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26346653
possible better answer: http://stackoverflow.com/a/26346562
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26346653
tagged with: java

http://stackoverflow.com/a/26204833
score: 3
has body: You also need to set the viewport to the size of your window or framebuffer. (see glViewport). Initially, the viewport will be set to the size of the drawable when the context is fisrt bound to, but it will never be implicitely updated at all.
upvote count: 3
has comment: http://stackoverflow.com/comment/41092863
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26204802

http://stackoverflow.com/comment/41202189
type: Comment
comment on: http://stackoverflow.com/a/26263444
has text: Ah yes, I think they recently changed `applicationName` to `applicationID` in a recent update to Android Studio.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26205559
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26205568
type: Question
has answer: http://stackoverflow.com/a/26205596
has body: I'm trying to build a N x N matrix that will print with 0's and 1's. It shows no errors in the code, but when I run my code I get Exception in thread "main" java.lang.NumberFormatException: null I have no idea how to fix it. public class LargestRowColumn { public static void printMatrix (int n){ for (int i = 1; i &lt;= n; i++) { for (int j = 1; j &lt;= n; j++) { System.out.println((int)(Math.random() * 2)+ " "); } System.out.println("\n"); } } public static void main(String[] args) { System.out.println("Enter a number"); String Matrix = null; int n = Integer.parseInt(Matrix); System.out.print(n); } }
has title: What does Exception in thread "main" java.lang.NumberFormatException: null mean?
downvote count: 4
answer count: 3
favorite count: 0
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/26205735

http://stackoverflow.com/q/26245621
downvote count: 1
has comment: http://stackoverflow.com/comment/41171513
tagged with: rar
has title: How to execute a .RAR file
tagged with: java
has comment: http://stackoverflow.com/comment/41170081
type: Question
score: 0
has body: I downloaded an application which was in .RAR file. I am having trouble executing the application. I have tried two ways of executing it. First Attempt: After viewing the rar contents, I figured out that it has proper manifest file (Stating the main class to execute), so i should change the file name to .jar and try executing it. I did that and ran the following command: java -jar filename.jar And received the following error: Invalid or corrupt jarfile filename.jar Second Attempt: I decided to extract the file and try it manually. I extracted the file on my desktop and it created the specified folder structure. And then I ran this command java -cp .:./Users/My/Desktop/ExtractedFolder/ MainClassName.class And received the following error: Could not find or load main class MainClassName How do I execute this application? P.S: ExtractedFolder is the folder which was created after unzipping the file. It has heirarchy like ExtractedFolder |_ META-INF |__|__MANIFEST.MF |__org |__|__folder_1 |__|__|__folder_2 |__|__|__|__folder_3 |__|__|__|__|__MainClassName.class |__|__|__|__|__OtherClass.class |__|__|__|__|__|__UtilFolder |__util_1 |__|__SubUtil
tagged with: jar
favorite count: 0
tagged with: macos
tagged with: command-line
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/26335034
favorite count: 0
has comment: http://stackoverflow.com/comment/41350350
has answer: http://stackoverflow.com/a/26337349
has comment: http://stackoverflow.com/comment/41335552
type: UnansweredQuestion
has title: Java How to solve scheduling a calendar
has comment: http://stackoverflow.com/comment/41334549
has answer: http://stackoverflow.com/a/26335369
score: 3
upvote count: 3
tagged with: java
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/41333866
answer count: 2
tagged with: algorithm
downvote count: 0
has comment: http://stackoverflow.com/comment/41333569
has comment: http://stackoverflow.com/comment/41333856
has comment: http://stackoverflow.com/comment/139469287
has body: I feel like this is an old and well-known problem but I couldn't find anything on it after searching for a while, i'm probably missing a keyword. Can anyone give me some help/pointers to this problem? We want to create a calendar schedule where we have 1 person working in each month of the year. There are 12 people and each person picks and ranks their 3 choices of months in a year they want to work. We have to create the most optimal schedule where each person is assigned to a different month in the year. For example, david greg bob first choice dec dec mar second choice feb march may third choice april feb apr Ignoring the other 9 people, the optimal schedule for these 3 will be: david in feb, greg in dec, bob in march. There is a points system we can use to decide the order: 3 points for each volunteer assigned his or her first choice 2 points for each volunteer assigned his or her second choice 1 point for each volunteer assigned his or her third choice 0 points for each volunteer not assigned any of his or her choices This also must be done using an unsorted list. Any help is appreciated thanks!
has comment: http://stackoverflow.com/comment/41333322

http://stackoverflow.com/comment/41384985
comment on: http://stackoverflow.com/q/26343477
score: 0
type: Comment
type: QuestionComment
has text: Oh btw, I was unable to dynamically load a JAR in Android. You need to convert it to DEX (using ´dx´ tool) or APK (compiling as usual).

bufferedreader
tags question: http://stackoverflow.com/q/26263678
tags question: http://stackoverflow.com/q/26342786
tags question: http://stackoverflow.com/q/26320156
tags question: http://stackoverflow.com/q/26213837
tags question: http://stackoverflow.com/q/26201221
tags question: http://stackoverflow.com/q/26243333
tags question: http://stackoverflow.com/q/26349875
tag name: bufferedreader
tags question: http://stackoverflow.com/q/26221532
tags question: http://stackoverflow.com/q/26327964
type: Tag

http://stackoverflow.com/comment/41241135
comment on: http://stackoverflow.com/q/26284707
has text: '\u000' is not the same as "\\\\u0000", the former is a single character and the latter is a String with more than a single character in it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26273431
favorite count: 0
possible better answer: http://stackoverflow.com/a/26273514
has answer: http://stackoverflow.com/a/26273514
tagged with: integer
has answer: http://stackoverflow.com/a/26273461
upvote count: 1
type: AnsweredQuestion
has body: i am fairly new to java, i have some code which isn't quite working properly and i am not sure why so any help would be appreciated. I am trying to read integers from a text file and store them in an array. Here is my code : Scanner keyboard = new Scanner(System.in); File file = new File ("Grades.txt"); FileReader input = new FileReader(file); BufferedReader in = new BufferedReader(input); int [] id = new int [500]; String s = in.readLine(); String s1 = s.substring(0,5); while (s != null){ int i = 0; id[i] = Integer.parseInt(s1); System.out.println(id[i]); s = in.readLine(); } in.close(); The problem i am having is that it only stores the first integer from the text file and displays the same integer for the following lines. Here is my output : 57363 57363 57363 57363 57363 57363 57363 Also here is the layout of the text file i am reading : 57363 Joy Ryder D D C P H H C D 72992 Laura Norder H H H D D H H H 71258 Eileen Over C F C D C C C P 70541 Ben Dover F F F P C C C F 46485 Justin Time F C F C D P D H 61391 Anna Conda D D F D D F D D 88985 Bob Down P F P F P F P P
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26273461
has title: Read and store integers in array
answer count: 2
tagged with: arrays
downvote count: 0

http://stackoverflow.com/q/26322534
type: Question
has answer: http://stackoverflow.com/a/26326185
has title: Use TAB to change selection and focus in a JSplitPane (from one JTable to another)
has body: I have a very simple GUI using 2 JTables in a SplitPane and I want to use TAB to remove selection in one JTable and move focus and select the first row of the other JTable. The gui is just each JTable in its own ScrollPane. Both ScrollPanes in the SplitPane and the SplitPane is in my class which extends JFrame. The way I went about it was: table_LEFT.getInputMap().put(KeyStroke.getKeyStroke("TAB"), "doSomething"); table_LEFT.getActionMap().put("doSomething", new myAction(table_RIGHT)); This will register the key TAB to myAction which extends AbstractAction. In AbstractAction I have to override the 'actionPerformed(ActionEven ae)' method. The problem is I cannot access the other table (in this case the 'table_RIGHT' from the ae event. I have to go through the containers to the top where the property of myClass is the other table. This seems very cumbersome and wrong + plus I managed to select a row in table_RIGHT, but don't give it focus ... . Am I going about this right?
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41311451
tagged with: java
tagged with: swing

http://stackoverflow.com/comment/41366501
type: Comment
comment on: http://stackoverflow.com/q/26352981
has text: I'm not sure that the date picker is for JGoodies...
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41323433
comment on: http://stackoverflow.com/q/26329661
type: QuestionComment
type: Comment
has text: Added my Tests, the first test passes perfectly fine but the second fails and I am unsure why. I have default values of 0 set if they are not set in the constructor so that is what I am testing for in my equals method for the other 2 parameter.
score: 0

http://stackoverflow.com/q/26316177
has answer: http://stackoverflow.com/a/26316253
accepted answer: http://stackoverflow.com/a/26316253
score: 0
answer count: 1
tagged with: text
type: AnsweredQuestion
has title: adding/sorting with hasmaps
has body: I have been given a text file with for a winter Olympic event. It contains team, name of competitor and score. FRAMae Berenice MEITE 455.455 CHNKexin ZHANG 454.584 UKRNatalia POPOVA 453.443 GERNathalie WEINZIERL 452.162 RUSEvgeny PLYUSHCHENKO 191.399 CANPatrick CHAN 189.718 CHNHan YAN 185.527 CHNCheng &amp; Hao 271.018 ITAStefania &amp; Ondrej 270.317 USAMarissa &amp; Simon 264.256 GERMaylin &amp; Daniel 260.825 FRAFlorent AMODIO 179.936 GERPeter LIEBERS 179.615 ect.... The only digit that maters is the last digit in the number. for each team, I need to sum their total points together and display the top 5 teams. Code so far: public class project2 { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub String[] array = new String[41]; String[] info = new String [41]; String[] stats = new String[41]; String[] team = new String[41]; //.txt file location FileInput fileIn = new FileInput(); fileIn.openFile("C:\\Users\\O\\Desktop\\turn in\\team.txt"); int i=0; String line = fileIn.readLine(); array[i] = line; i++; while (line != null) { line = fileIn.readLine(); array[i] = line; i++; } //Splitting up Info/ Score into two arrays for (int j =0; j&lt; 40; j++){ team[j] = array[j].substring (0, 3).trim (); info[j] = array[j].substring (3, 30).trim (); stats[j] = array[j].substring (36).trim (); } double[] statsDub = new double[41]; for (int k =1; k &lt; 40; k++){ statsDub[k] = Double.parseDouble(stats[k]); } Map&lt;String,Double&gt; totalScore = new HashMap&lt;&gt;(); for (int j =0; j&lt; 40; j++){ totalScore.put(team[j], statsDub[j]); } // Get a set of the entries Set set = totalScore.entrySet(); // Get an iterator Iterator i1 = set.iterator(); // Display elements while(i1.hasNext()) { Map.Entry me = (Map.Entry)i1.next(); System.out.print(me.getKey() + ": "); System.out.println(me.getValue()); } Prints out: GER: 5.0 USA: 7.0 ITA: 6.0 RUS: 8.0 CHN: 1.0 JPN: 8.0 FRA: 7.0 CAN: 6.0 UKR: 2.0 GBR: 1.0 This is printing out only one score fo…
type: Question
tagged with: hashmap
tagged with: java

http://stackoverflow.com/q/26246668
type: Question
has answer: http://stackoverflow.com/a/26246712
score: 10
has title: "Exception in thread "main" java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing"
answer count: 1
tagged with: junit
downvote count: 0
accepted answer: http://stackoverflow.com/a/26246712
has body: On my Ubuntu, I run an java executable, with error about some package I didn't explicitly use in my code. What might be the solution? Thanks. $ java -cp .:/home/tim/program_files/programming/java/junit-4.11.jar MyTest Exception in thread "main" java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at org.junit.runner.Computer.getSuite(Computer.java:28) at org.junit.runner.Request.classes(Request.java:75) at org.junit.runner.JUnitCore.run(JUnitCore.java:128) at org.junit.runner.JUnitCore.runClasses(JUnitCore.java:73) at MyTest.main(MyTest.java:13) Caused by: java.lang.ClassNotFoundException: org.hamcrest.SelfDescribing at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 17 more
favorite count: 0
type: AnsweredQuestion
tagged with: java
upvote count: 10

http://stackoverflow.com/comment/41192458
has text: @OctavianRox the above would actually return whatever the attribute 'value' is equal too. Not what you want but helpful to know anyway.
type: AnswerComment
comment on: http://stackoverflow.com/a/26238970
type: Comment
score: 1

otto
tag name: otto
type: Tag
tags question: http://stackoverflow.com/q/26203767

http://stackoverflow.com/comment/41149924
has text: You are asking logic? I think you should try it by own.
comment on: http://stackoverflow.com/q/26235427
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41278017
comment on: http://stackoverflow.com/a/26288233
type: AnswerComment
has text: @Rika If `arr[i]` is never greater than `x`, the inner loop will never be started, so the time would be O(N). I edited the original post to improve the formatting, and also the OP added a missing `{`, so that may make it easier to see what's going on. That may make it clearer that the code is actually O(N), since there is no case in which the inner `for` is started more than once, except possibly for cases in which it terminates immediately.
score: 0
type: Comment

http://stackoverflow.com/q/26314634
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26314656
tagged with: arrays
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/26314666
has comment: http://stackoverflow.com/comment/41295314
has answer: http://stackoverflow.com/a/26314666
has answer: http://stackoverflow.com/a/26314656
type: AnsweredQuestion
tagged with: java
has body: Like the title says, I am trying to instantiate an ArrayList with type of a class that I want to be an array. Probably I did not explain it correctly in technical terms, so let's just look at a pseudo code: List&lt;TestClass[5]&gt; lTestList = new ArrayList&lt;TestClass[5]&gt;(); Where should I specify the size of the TestClass type array? Apologies if my explanation does not make much sense as I am still learning.
has title: Create an ArrayList with type of an object array

http://stackoverflow.com/q/26279513
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41231174
score: 0
has comment: http://stackoverflow.com/comment/41231008
has comment: http://stackoverflow.com/comment/41230972
tagged with: user-interface
has body: I have a desktop GUI program written in Java by a third party vendor. This program has a number of frames and controls on them. Now I have a requirement to start my Java program when the user clicks on a specific button on a specific frame of that Java program. Is that possible anyway? I am working on Windows 7 with JDK 7 u17. (There is a scripting language called AutoIt which provides this kind of functionality but I can not use it as it is reported as False-Positive virus by my anti-virus software, i.e. Quick Heal.) Thanks in advance.
tagged with: jvm
has title: Starting my Java program for an event of the other
has comment: http://stackoverflow.com/comment/41258482

http://stackoverflow.com/q/26249667
has comment: http://stackoverflow.com/comment/41200373
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: vector
has body: I'm self-teaching Java GUIs and am trying to implement an older text-based program I made into something with an actual menu. In using WindowBuilder on Eclipse for formatting and internet resources to help, but I've hit a bit of a roadblock. I've got a one-dimensional vector that can hold any number of strings. I'd like to display it in a table, but I'm not quite sure if I'm doing it right. All of my back-end stuff works fine, I'm just really struggling with the GUI. Any tips/corrections/resources you're willing to offer are greatly appreciated! I've been bumbling around for hours and I fear I've hit a wall. To be honest I'm having trouble testing the GUI within WindowBuilder as well, but that's another story. The relevant code in my GUI class is as follows: Vector&lt;String&gt; demo = new Vector&lt;String&gt;(); //nonsense elements just for the sake of debugging demo.addElement("Line1"); demo.addElement("Line2"); demo.addElement("Line3"); demo.addElement("Line4"); demo.addElement("Line5"); demo.addElement("Line6"); table = new Table(this, SWT.BORDER | SWT.FULL_SELECTION); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); table.setHeaderVisible(true); table.setLinesVisible(true); TableItem item; for(int i = 0; i &lt; demo.size(); i++) { // Create a new TableItem for each line in the vector (each row) item = new TableItem(table, SWT.NONE); for (int j = 1; j &lt;= demo.size(); j++) { // Populate the item item.setText(j - 1, demo.get(j)); } }
tagged with: user-interface
has comment: http://stackoverflow.com/comment/41178560
score: 0
has answer: http://stackoverflow.com/a/26263272
answer count: 1
linked to: http://stackoverflow.com/q/1386275
accepted answer: http://stackoverflow.com/a/26263272
has comment: http://stackoverflow.com/comment/41183842
tagged with: swt
has title: Populating SWT Table with Vector of Strings

http://stackoverflow.com/comment/138728660
comment on: http://stackoverflow.com/a/51904159
score: 0
type: AnswerComment
has text: "will NOT work if you have a jar file in current path". That's because in Java world jars are like 'virtual' directories themselves, and these need to 'mounted', of sorts. It will work for non-jar paths, but every jar needs to be added separately. The classpath search mechanism doesn't traverse from normal dirs into jars automagically. (That would create semantic complications. The package path/prefix gets reset to 'root' [i.e. empty string] whenever a jar is entered.)
type: Comment

http://stackoverflow.com/q/26288068
has comment: http://stackoverflow.com/comment/41248056
has comment: http://stackoverflow.com/comment/41277910
tagged with: java
has body: Here's the code for orderedInsertion for an array: public void orderedInsert(int x){ int i =0; for(i=0;i&lt;count;i++) if(arr[i]&gt;x) break; for(int j=count-1;j&gt;=i;j--) arr[j+1] = arr[j]; arr[i]=x; count++;} If instead of using a break right after the IF statement, I did implement the second for loop ( the one with j variable immediately as follows: EDITED CODE: public void orderedInsert(int x) { boolean flag = false; int i =0; for (i=0; i&lt;count; i++) { if (arr[i]&gt;x) { for (int j=count-1; j&gt;=i; j--) { arr[j+1] = arr[j]; arr[i] = x; count++; flag = true; } if (flag) break; } } } Would both algorithms run in O(N)? This is what makes sense to me, but my instructor said "if you see two nested loops, this means it runs O(N^2). What makes sense to me is that even in the worst case scenario we will only traverse N times.
type: Question
has comment: http://stackoverflow.com/comment/41250426
has title: Big O Notation for sorted insertion
linked to: http://stackoverflow.com/q/8261895
has comment: http://stackoverflow.com/comment/41270708
has answer: http://stackoverflow.com/a/26288233
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41247839
has comment: http://stackoverflow.com/comment/41247861
type: UnansweredQuestion

http://stackoverflow.com/a/26323140
answers question: http://stackoverflow.com/q/26320127
type: Answer
score: 11
upvote count: 11
has body: With PowerMock you can mock constructors. See example I'm not with an IDE right now, but would be something like this: UserQueries userQueries = PowerMockito.mock(UserQueries.class); PowerMockito.whenNew(UserQueries.class).withArguments(Mockito.any(CrudService.class)).thenReturn(userQueries); You need to run your test with PowerMockRunner (add these annotations to your test class): @RunWith(PowerMockRunner.class) @PrepareForTest(UserQueries .class) If you cannot use PowerMock, you have to inject a factory, as it says @Briggo answer. Hope it helps
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/134187893
accepted answer of: http://stackoverflow.com/q/26320127

http://stackoverflow.com/a/26248989
score: 1
answers question: http://stackoverflow.com/q/26248786
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41177540
type: Answer
has body: You have to Use Shared Prefrences only. Save username and password in prefrences if it accepted by Parse User like this: mPrefs = getApplicationContext().getSharedPreferences("cumulus",MODE_PRIVATE); uname = username.getText().toString(); pass = password.getText().toString(); ParseUser.logInInBackground(uname, pass, new LogInCallback() { @Override public void done(ParseUser user, com.parse.ParseException e) { // TODO Auto-generated method stub if (user != null) { // If user exist and authenticated, send user to Welcome.class if(getFirstRun()){ //user.getObjectId(); Editor ed = mPrefs.edit(); ed.putString("user", uname); ed.putString("pass", pass); ed.putString("id", user.getObjectId()); ed.commit(); //userid=user.getObjectId(); new GetData().execute(); }else{ Editor ed = mPrefs.edit(); ed.putString("user", uname); ed.putString("pass", pass); ed.putString("id", user.getObjectId()); ed.commit(); //userid=user.getObjectId(); Intent intent = new Intent(SignInActivity.this,MainActivity.class); startActivity(intent); finish(); } } else { Toast.makeText( getApplicationContext(), "Error: "+e.getMessage(), Toast.LENGTH_LONG).show(); } } }); public boolean getFirstRun() { return mPrefs.getBoolean("firstRun", true); } public void setRunned() { SharedPreferences.Editor edit = mPrefs.edit(); edit.putBoolean("firstRun", false); edit.commit(); } Hope this will help you.

http://stackoverflow.com/q/26303062
downvote count: 1
tagged with: arrays
duplicate of: http://stackoverflow.com/q/5554734
favorite count: 0
has comment: http://stackoverflow.com/comment/41274977
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/41274694
upvote count: 0
type: UnansweredQuestion
has title: Array index out of bounds java heap
has comment: http://stackoverflow.com/comment/41274750
has answer: http://stackoverflow.com/a/26303252
has answer: http://stackoverflow.com/a/26304124
tagged with: java
has comment: http://stackoverflow.com/comment/41274668
score: -1
has body: I know this is an amaetuer error, i understand what it means but i dont understand why i cant fix it. Ive been trying everything. Im trying to take an array of type T and switch its values around so it correctly corresponds to the rules of a heap, where the parent is always greater than the 2 children. The error is in my while loop please dont be harsh if its something easily fixable. ive been struggling heavily and cant seem to find an answer. public class myheap&lt;T extends Comparable&lt;T&gt;&gt; extends heap&lt;T&gt; { // constructors of the subclass should be written this way: public myheap(int max) { super(max); } public myheap(T[] A) {super(A);} public void buildheap(T[] Arr){ int size = Arr.length; int startsize = (size-1)/2; for(int i=startsize;i&gt;0;i--){ int l = left(i); int r = right(i); T temp = null; while((Arr[r]!=null) &amp;&amp; Arr[i].compareTo(Arr[r])&lt;0){ if (Arr[l].compareTo(Arr[r])&gt;0){ temp = Arr[l]; Arr[l] = Arr[i]; Arr[i] = temp; }//if left is greater than right else //then right must be greater than parent temp = Arr[r]; Arr[r] = Arr[i]; Arr[i] = temp; }//whileloop if((Arr[r]==null) &amp;&amp; Arr[i].compareTo(Arr[l])&lt;0) temp = Arr[l]; Arr[l] = Arr[i]; Arr[i] = temp; }//for }//buildheap public static void main(String[] args){ String[] array = {"SH","AH","AB","YA","AY","AA","AB","LM","LL","LO"}; myheap&lt;String&gt; New = new myheap&lt;String&gt;(array.length); for(int i=0;i&lt;array.length;i++){ New.insert(array[i]); }//insert New.buildheap(array); New.drawheap(); for(int i=0;i&lt;array.length;i++){ System.out.println(New.deletemax() + " "); }//for System.out.println(); } //main } Heap superclass that myheap is extending /* Polymorphic priority heaps, largest value on top. Heap axiom. The value at every node cannot be smaller than the values at each of its children nodes. Use internal array to implement heap "tree", with index 0 representing the root. Given node index i, left(i)= 2*i+1 and right(i)=2*i+2, while parent(i) = (i-1)/2.…
type: Question
has comment: http://stackoverflow.com/comment/41274579
answer count: 2
linked to: http://stackoverflow.com/q/5554734

http://stackoverflow.com/q/26336343
tagged with: stanford-nlp
upvote count: 1
has body: I am trying to execute stanford corenlp package to get coreference resolution. Here is the command given for coref execution: java -cp &lt;jars_in_corenlp&gt; -Xmx8g edu.stanford.nlp.dcoref.SieveCoreferenceSystem -props &lt;properties file&gt; I executed like this - java - cp "*" -Xmx2g edu.stanford.nlp.dcoref.SieveCoreferenceSystem -props annotators = pos, lemma, ner, parse dcoref.postprocessing = true dcoref.maxdist = -1 -file input.txt java - cp "*" -Xmx2g edu.stanford.nlp.dcoref.SieveCoreferenceSystem -props annotators = pos, lemma, ner, parse dcoref.postprocessing = true dcoref.maxdist = -1 input.txt gives error - Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. This way it works, but it loads all jar files, which takes additional time, I want to execute with minimal execution time. java -cp "*" -Xmx2g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,dcoref -file input.txt
has title: Executing stanford corenlp coreference resolution
favorite count: 0
type: UnansweredQuestion
tagged with: nlp
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/26321977
type: Answer
has body: Be careful, you claimed that your variable was initialized on line 2 but that's not the case. The variable is declared here, but never initialized(outside of the if statements). An IDE might tell you that age is unitialized, even if it's obvious that this function would run fine. The issue is that there's a possibility of it being uninitialized if both if statements weren't entered. The solution in Erwin's answer is correct, you'll need to write an else instead of another if statement.
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26321919

http://stackoverflow.com/comment/41256514
score: 0
has text: i tried your code also without changing anything.. but it shows the same error which i have mentioned previously.
type: AnswerComment
comment on: http://stackoverflow.com/a/26292553
type: Comment

http://stackoverflow.com/comment/41374153
has text: May be, you should use axis handlers in order to visualize all the soap content, in order to get the token.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26245055

http://stackoverflow.com/q/26212413
has answer: http://stackoverflow.com/a/26212749
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41108361
tagged with: eclipse
type: Question
has title: Eclipse treat a directory as a subproject
upvote count: 2
has body: I imported a maven project which had several sub projects into eclipse using maven plugin for eclipse. Later I wanted to add another sub project to this imported project. What I did was creating a new maven project through eclipse in the default eclipse workspace and moving the created project to the desired location of the original project. My problem is, even though eclipse treats previous sub projects as projects, newly added project is just shown as a folder, not a sub project. So I cannot add any classes to newly added sub project through eclipse. Here is my project structure. It can be seen that even though some folders are shown in blue and some in yellow. The yellow ones are the ones that are not treated as projects. Can someone help me to make eclipse identify these projects as projects. Thanks
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/41107669
score: 2

http://stackoverflow.com/q/26304858
has body: I want to parallelize the following code snipped using a parallelStream: boolean anyTrue() { for (Element e : setOfE) { if (eval(e)) { return true; } } return false; } Will the following work on parallel streams and use regular short-circuit evaluation? setOfE.parallelStream().map(e -&gt; eval(e)).reduce(false, (a,b) -&gt; a || b))
tagged with: lambda
tagged with: java-8
tagged with: parallel-processing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26305019
tagged with: java-stream
tagged with: java
upvote count: 73
has answer: http://stackoverflow.com/a/65369995
type: Question
accepted answer: http://stackoverflow.com/a/26305019
answer count: 3
downvote count: 0
score: 73
favorite count: 0
possible better answer: http://stackoverflow.com/a/26304929
has title: Stream of boolean values, is any true?
has answer: http://stackoverflow.com/a/26304929

http://stackoverflow.com/comment/41082572
comment on: http://stackoverflow.com/q/26199008
score: 0
type: QuestionComment
type: Comment
has text: Also, the game LOGIC and game DRAWING work in the same moment, so when the JFrame isn't maximized or (resizing) the game works Perfect! but when it isnt the game draw runs faster than game logic causing flickering, I dont khown if there's a way to Override resize method to avoid it to call repaint, and thanks for the help n.n

http://stackoverflow.com/q/26315130
tagged with: maven
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has title: An internal error occurred during: "Creating maven-archetype-webapp"
type: Question
accepted answer: http://stackoverflow.com/a/26315406
has answer: http://stackoverflow.com/a/28151940
possible better answer: http://stackoverflow.com/a/28151940
has comment: http://stackoverflow.com/comment/41296388
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41296361
favorite count: 0
has answer: http://stackoverflow.com/a/26315406
has body: I am new to maven, and when I new--->create a new maven project with maven-archetype-webapp, it failed! Can somebody help? I tried several times, and it also failed. And if I create a project that is archetype-quick-start , no error will occurs. ps: I have java 8 and tomcat 7 installed. Please help!

http://stackoverflow.com/q/26285155
has comment: http://stackoverflow.com/comment/41242584
answer count: 1
has comment: http://stackoverflow.com/comment/41242625
accepted answer: http://stackoverflow.com/a/26285204
has comment: http://stackoverflow.com/comment/41242450
has body: I am interested in following question: Collections.reverse() vs Lists.reverse() which one is faster?
has title: Collections.reverse() vs Lists.reverse() which one is faster?
favorite count: 0
upvote count: 8
downvote count: 2
score: 6
type: AnsweredQuestion
tagged with: guava
tagged with: java
has answer: http://stackoverflow.com/a/26285204
has comment: http://stackoverflow.com/comment/41241953
type: Question

http://stackoverflow.com/a/26279641
answers question: http://stackoverflow.com/q/26279448
type: Answer
has comment: http://stackoverflow.com/comment/41231948
accepted answer of: http://stackoverflow.com/q/26279448
upvote count: 1
has comment: http://stackoverflow.com/comment/41232348
score: 1
has comment: http://stackoverflow.com/comment/41231789
has body: sharedpreferences is null. You declare it here private SharedPreferences sharedpreferences; but you never initialize it (give it a value) before trying to use it here SharedPreferences.Editor e = sharedpreferences.edit(); Before that line, you need something like sharedpreferences = getSharedPreferences("myPref", 0); but for this you will need a Context. So, if this is a separate class then you will need to pass the Context of the Activity to the AsyncTask constructor. So, you will need to make a class variable like Context mContext; then change your constructor to LoginTask(String email, String password, Context c) { mEmail = email; mPassword = password; mContext = c; } Then when calling this task, pass the activity context along with the email and password with this or ActivityName.this, or something else depending on how/where it is called. Now, when you initialize your SharedPreference object it will be sharedpreferences = mContext.getSharedPreferences("myPref", 0);
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41231842
downvote count: 0
has comment: http://stackoverflow.com/comment/41231514
has comment: http://stackoverflow.com/comment/41232148

http://stackoverflow.com/comment/41209819
has text: You use math the same way you would turn a number into a String. Using a combination of `%` and `/` The difference is that sometime you use `10` and sometime you use `6` depending on whether the digit has 10 or 6 possible values. BTW If you don't want GMT, you will need to adjust for the time zone.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26208940
score: 0

http://stackoverflow.com/comment/41309012
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26321551
type: Comment
has text: I'm not sure myself ... which is why my answer is "vague" on that point :-). The optimal solution depends on the precise invariants of the balanced tree that you are implementing.

http://stackoverflow.com/a/26269334
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26269193
downvote count: 0
has body: In class WeatherRecord: First import the class if they are in different package else this statement is not requires Import &lt;path&gt;.ClassName Then, just referene or call your object like: Date d; TempratureRange tr; d = new Date(); tr = new TempratureRange; //this can be done in Single Line also like : // Date d = new Date(); But in your code you are not required to create an object to call function of Date and TempratureRange. As both of the Classes contain Static Function , you cannot call the thoes function by creating object. Date.date(date,month,year); // this is enough to call those static function Have clear concept on Object and Static functions. Click me

http://stackoverflow.com/q/26202709
accepted answer: http://stackoverflow.com/a/26204982
score: 0
has answer: http://stackoverflow.com/a/26204982
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: mysql
has title: Hibernate wrong query generation
has body: The query Query query = session.createQuery("from DeptLocations"); List<?> list = query.list(); DeptLocations dept = (DeptLocations)list.get(0); The error org.hibernate.exception.SQLGrammarException: 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 '.dept_locations deptlocati0_' at line 1 The table Create Table Dept_Locations ( Locno NUMERIC(2), Locname Varchar(10), primary key (Locno) ); The mapping <?xml version="1.0"?> <column name="Locno" precision="2" scale="0" /> <generator class="assigned" /> <column name="Locname" length="10" /> <column name="LOC" precision="2" scale="0" /> <one-to-many class="pojos.Dept" /> The pojo package pojos; import java.util.HashSet; import java.util.Set; /** * DeptLocations generated by hbm2java */ public class DeptLocations implements java.io.Serializable { private byte locno; private String locname; private Set depts = new HashSet(0); public DeptLocations() { } public DeptLocations(byte locno) { this.locno = locno; } public DeptLocations(byte locno, String locname, Set depts) { this.locno = locno; this.locname = locname; this.depts = depts; } public byte getLocno() { return this.locno; } public void setLocno(byte locno) { this.locno = locno; } public String getLocname() { return this.locname; } public void setLocname(String locname) { this.locname = locname; } public Set getDepts() { return this.depts; } public void setDepts(Set depts) { this.depts = depts; } } The configuration <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> com.mysql.jdbc.Driver ***** jdbc:mysql://localhost:3306/qr root qr org.hibernate.dialect.MySQLDialect <mapping resource="/pojos/Dept.hbm.xml"/> <mapping resource="/pojos/DeptLocations.hbm.xml"/> <mapping resource="/pojos/Emp.hbm.xml"/> </hibernate-configuration> The reverse xml <?xml version="1.0" encoding="UTF-8"?> <hibernate-reverse-engineering> <table-filter match-catalog="qr" match-name="dept"/> <table-fil…
type: Question
answer count: 1

http://stackoverflow.com/comment/41341210
type: Comment
comment on: http://stackoverflow.com/a/26280864
type: AnswerComment
has text: thanks for your answer but your approach seems to fail to handle cases like: `m%C3%A1ty%C3%A1s,matthias`. Anyway the solution of @anubhava seems to work smoothly so I can proceed.
score: 0

http://stackoverflow.com/a/26342878
type: Answer
answers question: http://stackoverflow.com/q/26342060
score: 0
has body: Are you sure your quatities object have two square brackets "quantities":[[{"idno1":2},{"idno2":4}]]? Then this means its an array or array of map. Then you could create obejct like class Attribute{ int id; @JsonProperty("order_id") int orderId; String status; List&lt;List&lt;Map&lt;String, Integer&gt;&gt;&gt; quantities; //Getters &amp; Setters } class Event { @JsonProperty("event_date") Date eventDate; String company; @JsonProperty("entity_id") int entityId; Attribute attributes; //Getters &amp; Setters } Now for your json you could straight away parse like String json = "{\"event_date\":\"2014-10-10T19:18:04+05:30\",\"company\":\"b2c\",\"entity_id\":7,\"attributes\":{\"id\":7,\"order_id\":43,\"status\":\"dispatched\",\"quantities\":[[{\"idno1\":2},{\"idno2\":4}]]}}"; ObjectMapper mapper = new ObjectMapper(); Event eventObj = mapper.readValue(json, Event.class); System.out.println(eventObj); If you dont want that extra bracket you can change your quantities object to List&lt;Map&lt;String, Integer&gt;&gt; quantities or even reduce to Map&lt;String, Integer&gt; quantities

http://stackoverflow.com/q/26230042
has comment: http://stackoverflow.com/comment/41140739
has comment: http://stackoverflow.com/comment/41140627
tagged with: android-asynctask
score: 2
possible better answer: http://stackoverflow.com/a/26230136
has body: I am using four Strings in my code. The first String contains "http://", the second String contains user host URL (entered by user), the third contains "/musics/a.mp3" and the fourth String contains complete URL, by combining the previous Strings, like this: String fourth = first+second+third; Then I'm using the fourth String in AsyncTask's execute, like this: new JSONAsyncTask().execute(fourth); And I'm getting the error below. Log: 10-07 06:17:15.934: E/AndroidRuntime(1194): FATAL EXCEPTION: AsyncTask #1 10-07 06:17:15.934: E/AndroidRuntime(1194): java.lang.RuntimeException: An error occured while executing doInBackground() 10-07 06:17:15.934: E/AndroidRuntime(1194): at android.os.AsyncTask$3.done(AsyncTask.java:278) 10-07 06:17:15.934: E/AndroidRuntime(1194): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) 10-07 06:17:15.934: E/AndroidRuntime(1194): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) 10-07 06:17:15.934: E/AndroidRuntime(1194): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) 10-07 06:17:15.934: E/AndroidRuntime(1194): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 10-07 06:17:15.934: E/AndroidRuntime(1194): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208) 10-07 06:17:15.934: E/AndroidRuntime(1194): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 10-07 06:17:15.934: E/AndroidRuntime(1194): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 10-07 06:17:15.934: E/AndroidRuntime(1194): at java.lang.Thread.run(Thread.java:856) 10-07 06:17:15.934: E/AndroidRuntime(1194): Caused by: java.lang.IllegalArgumentException: Host name may not be null 10-07 06:17:15.934: E/AndroidRuntime(1194): at org.apache.http.HttpHost.&lt;init&gt;(HttpHost.java:83) 10-07 06:17:15.934: E/AndroidRuntime(1194): at org.apache.http.impl.client.AbstractHttpClient.determineTarget(AbstractHttpClient.java:497) 10-07 06:1…
accepted answer: http://stackoverflow.com/a/26230097
upvote count: 2
has comment: http://stackoverflow.com/comment/41140674
tagged with: android-async-http
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41140623
tagged with: java
has comment: http://stackoverflow.com/comment/41140620
has title: Caused by: java.lang.IllegalArgumentException: Host name may not be null
has comment: http://stackoverflow.com/comment/41140648
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41140647
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26230136
has answer: http://stackoverflow.com/a/26230097
tagged with: android

http://stackoverflow.com/q/26256486
tagged with: java
possible better answer: http://stackoverflow.com/a/26256556
tagged with: methods
has answer: http://stackoverflow.com/a/26256663
has answer: http://stackoverflow.com/a/26256556
has title: Class asking for unimplemented methods for inherited abstract
type: Question
has body: I have these 3 classes which is supposed to work together to create a game. But I'm getting an error in one of them where it wants me to add unimplemented methods. The class which is creating the error is called Game and looks like this. package org.game.main; import java.awt.Graphics2D; public class Game extends Window { public static void main(String[] args) { Window window = new Game(); window.run(1.0 / 60.0); System.exit(0); } public Game() { // call game constructor super("Test Game", 640, 480); } public void gameStartup() { } public void gameUpdate(double delta) { } public void gameDraw(Graphics2D g) { } public void gameShutdown() { } } It wants me to implement the method called Update() from the Window class. The Window class looks like this. package org.game.main; import java.awt.Canvas; import java.awt.Color; import java.awt.Frame; import java.awt.Graphics2D; import java.awt.image.BufferStrategy; import org.game.input.*; /** * Game that creates a window and handles input. * @author Eric */ public abstract class Window extends GameLoop { private Frame frame; private Canvas canvas; private BufferStrategy buffer; private Keyboard keyboard; private Mouse mouse; private MouseWheel mouseWheel; /** * Creates a new game window. * * @param title title of the window. * @param width width of the window. * @param height height of the window. */ public Window(String title, int width, int height) { /*Log.debug("Game", "Creating game " + title + " (" + width + ", " + height + ")");*/ // create frame and canvas frame = new Frame(title); frame.setResizable(false); canvas = new Canvas(); canvas.setIgnoreRepaint(true); frame.add(canvas); // resize canvas and make the window visible canvas.setSize(width, height); frame.pack(); frame.setVisible(true); // create buffer strategy canvas.createBufferStrategy(2); buffer = canvas.getBufferStrategy(); // create our input classess and add them to the canvas keyboard = new Keyboard(); mouse = new Mouse(); mouseWheel = new MouseWheel(); …
score: 0
tagged with: abstract
has answer: http://stackoverflow.com/a/26256530
has answer: http://stackoverflow.com/a/26256879
tagged with: inherited
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26256530

http://stackoverflow.com/comment/41203938
has text: @MikeStrobel Thank you, your answer seems most complete. Reading through it I have a feeling, that the current impl. of lambda is indeed **just** a class (not necessarily inner, not necessarily static) that calls a synthetic method, only that the class is being "generated" on-the-fly (not during compile time). Is this correct or do I misunderstand you? Also, when the class is once generated, it is probably instantiated: does this happen for each invocation of the lambda, or is the instance kept somewhere?
type: Comment
comment on: http://stackoverflow.com/a/26257532
score: 1
type: AnswerComment

http://stackoverflow.com/comment/41305086
type: QuestionComment
comment on: http://stackoverflow.com/q/26316970
score: 0
type: Comment
has text: Instead of `GridBagLayout`, consider using `GridLayout` for rows and columns.

http://stackoverflow.com/a/26204639
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/41092378
answers question: http://stackoverflow.com/q/26204556
has body: You should put setPMA in the vehicle class. public class Vehicle { private String enrollment; public Vehicle (String enrollment){ this.enrollment = enrollment; } private void setPMA(double pma) { this.pma = pma; } Doing in this, you can access the setPMA in any sub-class.
score: -1
upvote count: 0

http://stackoverflow.com/q/26268507
has comment: http://stackoverflow.com/comment/41211533
has answer: http://stackoverflow.com/a/26268859
score: 0
tagged with: wrapper
has comment: http://stackoverflow.com/comment/41211795
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41211758
has title: Do custom wrapper classes take more/less space than Java wrapper classes?
has comment: http://stackoverflow.com/comment/41211556
type: Question
has body: Public class A { int a; } vs. java.lang.Integer Or Longs, Doubles, etc. Do they take the same amount of memory? Or more/less? If I'm not missing anything the answer should be same...
has comment: http://stackoverflow.com/comment/41211634
has comment: http://stackoverflow.com/comment/41211562
tagged with: java
tagged with: memory
has comment: http://stackoverflow.com/comment/41211576

import
type: Tag
tags question: http://stackoverflow.com/q/26268988
tag name: import
tags question: http://stackoverflow.com/q/26241186
tags question: http://stackoverflow.com/q/26269468
tags question: http://stackoverflow.com/q/26291970
tags question: http://stackoverflow.com/q/26226374
tags question: http://stackoverflow.com/q/26276147
tags question: http://stackoverflow.com/q/26225989
tags question: http://stackoverflow.com/q/26272926
tags question: http://stackoverflow.com/q/26276944

http://stackoverflow.com/a/26344642
score: 6
accepted answer of: http://stackoverflow.com/q/26344617
has body: From what I understood, thread2 will then skip the synchronized lock, exit methodA(), and start methodB No, thread2 will block, ie. stop execution, until the other thread has completed methodA and released the lock. It will then resume execution, acquire the lock, and execute the method.
answers question: http://stackoverflow.com/q/26344617
upvote count: 6
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41351020
type: Answer

http://stackoverflow.com/comment/41106782
type: QuestionComment
has text: "Editor does not contain a main type"
type: Comment
comment on: http://stackoverflow.com/q/26212079
score: 0

http://stackoverflow.com/comment/41302533
has text: Thanks, I moved the declaration of the sum variable outside the loop but it still seems to be coming out as 0 no matter what I enter.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26318112
type: AnswerComment

http://stackoverflow.com/a/26220499
has comment: http://stackoverflow.com/comment/41123568
has comment: http://stackoverflow.com/comment/41122941
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41122723
answers question: http://stackoverflow.com/q/26220344
has comment: http://stackoverflow.com/comment/41122589
accepted answer of: http://stackoverflow.com/q/26220344
type: Answer
has comment: http://stackoverflow.com/comment/41124051
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41122714
has comment: http://stackoverflow.com/comment/41122592
has body: Here is what is going on. Your array contains: [5, 6, 6, 7] You are going step by step printing "X occurs Y times" once per array element. Because the array contains two 6 element, you end up printing the output twice. One way to correct this problem is to do this: for (int m = 0; m &lt; Bag.length; m++) { boolean Seen = false; for (int n = 0 ; n &lt; m - 1 ; n++) { if (Bag[m] == Bag[n]) { Seen = true; break; } } if (Seen) { continue; } int occurrence = 0; for (int n = 0 ; n &lt; Bag.length ; n++) { if (Bag[m] == Bag[n]) { occurrence++; } } if (occurrence &gt; 1) { System.out.println(Bag[m] + " occurs " + occurrence + " times"); } else { System.out.println(Bag[m] + " occurs " + occurrence + " time"); } } The first time around you run into 6 it'll get added into Seen. The second time around, it'll already be inside Seen so the print statement will be skipped.

http://stackoverflow.com/comment/41351582
type: QuestionComment
has text: On a side note, are you using BigDecimal or another arbitrary precision construct to store your values? 0.10, for instance, cannot be stored exactly with a `float` or `double`.
score: 2
comment on: http://stackoverflow.com/q/26345033
type: Comment

http://stackoverflow.com/a/26320793
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26320756
has body: Based on fact that you used ( and ) to create groups I assume that you know that parenthesis are special characters in regex. But do you know that special characters do not match its literals in text? Notice that (.*) will not require matched text to start and end with parenthesis. To let special characters match its literals you need to escape them. You can do it in many ways, like: by adding \ before them (which needs to be written in String as "\\"), or in cases of most special characters you can surround them with [ ] to create character class representing only one character - the special one. Similarly | is special character in regex which represents OR operator so you also need to escape it. Another thing is that .+? despite being reluctant, in | (.+?) will start matching from first | found, which means it can also accept other | until (musician) will be found. In other words such regex would found this aprt music works | with | composer | James Hetfield (musician) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ So to prevent accepting other pipes (|) between the one you accept and (musician) instead of . use [^|] - character class which accepts any character except |. So try with this pattern: final Pattern pattern = Pattern.compile("\\| ([^|]+) \\(musician\\)"); UPDATE: If it is possible that part which should be matched by your regex will not have | before it (lets say it is at start of your text) then you can simply make \\| part optional by surrounding it with parenthesis and adding ? after it to make this part optional. You can also place it in non-capturing-group which will let ([^|]+) still be group with index 1 which will let your code stay the same (you will not have to change matcher.gorup(1) to matcher.group(2)). So you can try with final Pattern pattern = Pattern.compile("(?:\\| )?([^|]+) \\(musician\\)");
answers question: http://stackoverflow.com/q/26320756
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41306883
type: Answer
upvote count: 5

http://stackoverflow.com/a/26288760
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41269567
has body: You should use existing libs. For example, yFiles.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26288428
type: Answer
answers question: http://stackoverflow.com/q/26288428
upvote count: 2

http://stackoverflow.com/comment/41292099
type: AnswerComment
type: Comment
score: 0
has text: @jarrodroberson we are working a system where this reduces the memory usage from 2.5 GB per thread to 1 GB per thread. This means that a 30 GB heap on a 32 GB machine can handle 30 threads of work instead of 12. It 32 cpus.
comment on: http://stackoverflow.com/a/26296967

http://stackoverflow.com/a/26310116
has comment: http://stackoverflow.com/comment/41287768
has comment: http://stackoverflow.com/comment/41293946
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26310032
accepted answer of: http://stackoverflow.com/q/26310032
has body: You must have to handle the exception where ever you call this method. for example: public class JavaTutorialsCorner { public void testMethod() throws SampleException { try { // some logic } catch (IOException e) { throw new SampleException("Other IOException", e); } } } If you call this method somewhere else you must catch the thrown exception or re-throw it again public class JavaTutorialsCornerWeb { public void testMethodnew() { try { JavaTutorialsCorner jtc = new JavaTutorialsCorner(); jtc.testMethod(); } catch (SampleException sx) { sx.printStackTrace(); } } }
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/26272479
has comment: http://stackoverflow.com/comment/41218610
has body: I know that this has been asked a million times before but I still can't figure out a solution to my problem based on the previous solutions. Most of the questions I saw involved classes spawning multiple files, and environment variables and weird stuff like that that a beginner like myself can't comprehend. I have a very simple test setup to try to understand the problem. class Class1{ } public class testClasses{ public static void main(String[] args){ System.out.print(Class1); } } (obviously in a file called testClasses.java). It gives me an error, saying cannot find symbol referring to Class1. What on earth is going on in Java, that makes it unable to recognize Class1?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26272494
has answer: http://stackoverflow.com/a/26272524
possible better answer: http://stackoverflow.com/a/26272494
has answer: http://stackoverflow.com/a/26272532
has title: Java cannot find symbol for my own class
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26272524
has answer: http://stackoverflow.com/a/26272576
type: Question

http://stackoverflow.com/a/26290761
type: Answer
has body: Thank you for the replies, when i checked a log file, i got to know that the path of one of the file was wrong and i fixed that. Now it is working properly.
downvote count: 2
score: -2
upvote count: 0
has comment: http://stackoverflow.com/comment/52623541
answers question: http://stackoverflow.com/q/26274132

http://stackoverflow.com/comment/41113090
type: AnswerComment
comment on: http://stackoverflow.com/a/26214784
score: 0
type: Comment
has text: Still nothing even with invokeAndWait().7 I realy don't get it, that's the whole code of my application in the question above.

http://stackoverflow.com/comment/56342371
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26320693
type: Comment
has text: just downloaded log4j2-5, and still can't figure out how to send system.out to file

http://stackoverflow.com/comment/41087918
comment on: http://stackoverflow.com/q/26201827
type: QuestionComment
score: 0
has text: I do not understand anything what you are saying. If you say `How can I send the number to the server beforehand...` then i suppose that that you are talking about your client. `if i send them together` .You are again speaking about your client?
type: Comment

http://stackoverflow.com/comment/41394192
comment on: http://stackoverflow.com/q/26334698
score: 1
type: Comment
type: QuestionComment
has text: Then you should probably just keep track of the "current max" and update that every time you update the multiset; trying to track the reverse mapping is not likely to pay for itself.

http://stackoverflow.com/q/26230992
favorite count: 0
has answer: http://stackoverflow.com/a/26231632
tagged with: angularjs
has title: Dispatcher Servlet and AngularJs Router
has comment: http://stackoverflow.com/comment/41142380
tagged with: spring
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/26231632
type: Question
has comment: http://stackoverflow.com/comment/41142338
answer count: 1
downvote count: 0
tagged with: jsp
has body: I am trying to write a very simple application using Spring & AngularJs to understand the concept. I am struggling to understand that how dispatcher servlet is behaving in this case. JSP Pages Location Project -> WebContent -> WEB-INF -> pages hello.jsp view1.jsp view2.jsp Dispatcher Servlet <mvc:annotation-driven /> <context:component-scan base-package="com.job.controller" /> <mvc:resources mapping="include/**" location="/include/" /> <mvc:resources mapping="app/**" location="/app/" /> /WEB-INF/pages/ .jsp HelloController @Controller public class HelloController { @RequestMapping(value="/welcome", method = RequestMethod.GET) public String printWelcome(ModelMap model) { model.addAttribute("message", "First Try for Sprinv MVC, Angular JS and BootStrap"); return "hello"; } } hello.jsp - just AngularJs router code. var moduleConfig = function($routeProvider){ $routeProvider.when('/', { controller: 'SimpleController', templateUrl: 'view1.jsp' }) .when('/second', { controller: 'FirstController', templateUrl: 'view2.jsp' }) .otherwise( { redirectTo: '/'} ); }; myAppName.config(moduleConfig); Call http://localhost:8080/job/welcome This brings the hello.jsp up and try to call templateUrl: 'view1.jsp' and I get this error: GET http://localhost:8080/job/view1.jsp 404 (Not Found) I have tried all combinations but can not map request to appropriate jsps. I am sure I am doing some fundamental mistake here. Please point out.

http://stackoverflow.com/comment/41278434
has text: You have something else going on in the browser page. Chrome is only going to connect on the port in your URL, presumably port 8080. These other connections are being spun off by something else. An extention, JavaScript logic, etc.
comment on: http://stackoverflow.com/q/26303738
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41233585
comment on: http://stackoverflow.com/a/26280641
has text: Java will not understand pointers from `c` or `c++`. `Java` is cross-platform, whearat `c++` is `32bit` or `64bit`. JNI is a porting-interface, not a design-interface. Thats why `c++`-Types are compleatly different to `java`-Types: You need to translate them.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26197945
favorite count: 0
has comment: http://stackoverflow.com/comment/41080637
type: Question
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/26197955
has answer: http://stackoverflow.com/a/26197955
has title: Java Program - Write a program that calculates the area of a circle using a method called circleArea
tagged with: java
has answer: http://stackoverflow.com/a/26197956
has comment: http://stackoverflow.com/comment/41172326
has comment: http://stackoverflow.com/comment/41080702
downvote count: 0
has body: This is the code that I came up with so far: package circlearea2; import java.util.Scanner; public class CircleArea2 { public static void main(String[] args) { double a; double c; System.out.println("Enter the radius: "); Scanner scan = new Scanner(System.in); a = scan.nextDouble(); c = areaCalc(a); System.out.println("Circle Area is: " + c); } public static double areaCalc(double n1) { double min; min = (n1 * n1 * 3.14); return min; } } The problem is fixed. Thanks everyone! I really appreciate your help.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26197956
has comment: http://stackoverflow.com/comment/41080916
score: 1
has comment: http://stackoverflow.com/comment/41080628

http://stackoverflow.com/comment/41198324
has text: [This site](http://floating-point-gui.de/) is often cited as "Goldberg's paper in digestible form."
comment on: http://stackoverflow.com/a/26261617
score: 4
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26280216
favorite count: 0
has comment: http://stackoverflow.com/comment/41232554
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26280353
has answer: http://stackoverflow.com/a/26280362
has comment: http://stackoverflow.com/comment/41232318
tagged with: java
has comment: http://stackoverflow.com/comment/41232383
type: Question
has answer: http://stackoverflow.com/a/26280239
has title: ';' expected in after if
tagged with: if-statement
has comment: http://stackoverflow.com/comment/41232403
score: 0
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/41232379
downvote count: 1
has body: I get this strange errors: Ex2.java:8: error: ';' expected If (IMC &lt;= 15.0){ ^ Ex2.java:11: error: ';' expected If (IMC &lt;= 19.0) ^ Ex2.java:15: error: ';' expected If (IMC &lt;= 25.0) ^ Ex2.java:19: error: ';' expected If (IMC &lt;= 30.0) ^ Ex2.java:23: error: ';' expected If (IMC &lt;=40.0) ^ Ex2.java:27: error: ';' expected If (IMC &lt;=90.0) I asked some of my friends and they have no idea why this is happening here, take my code. public class Ex2 { public static void main(String[] args) { double peso = 80; double altura = 1.88; double IMC = (peso / (altura * altura)); System.out.print("IMC:"); System.out.println(IMC); If (IMC &amp;lt;= 15.0){ System.out.println ("Muito abaixo do peso ideal"); } If (IMC &amp;lt;= 19.0) { System.out.println ("Abaixo do peso ideal"); } If (IMC &amp;lt;= 25.0) { System.out.println ("Peso Normal"); } If (IMC &amp;lt;= 30.0) { System.out.println ("Acima do peso ideal"); } If (IMC &amp;lt;=40.0) { System.out.println ("Obeso"); } If (IMC &amp;lt;=90.0) { System.out.println ("Muito Obeso"); } } }

http://stackoverflow.com/comment/44849120
has text: Sure, I have added this to the 2.3.22 Manual.
comment on: http://stackoverflow.com/a/26304894
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26344048
accepted answer of: http://stackoverflow.com/q/26343537
has body: Just use the org.joda.time.DateTimeUtils#setCurrentMillisFixed method of JodaTime which was designed to fix new DateTime() to a different time than the current time. To return to the normal time use org.joda.time.DateTimeUtils#setCurrentMillisSystem afterwards. No mocking needed. @Test public void test() { DateTimeUtils.setCurrentMillisFixed(10L); // .. your code } @After public void cleanup() { // Make sure to cleanup afterwards DateTimeUtils.setCurrentMillisSystem() }
has comment: http://stackoverflow.com/comment/41350208
answers question: http://stackoverflow.com/q/26343537
score: 47
upvote count: 47
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41397725

http://stackoverflow.com/a/26306203
accepted answer of: http://stackoverflow.com/q/26304224
type: AcceptedAnswer
type: Answer
has body: You can easily accomplish this task with CSS. The formula is: element[attribute='attribute-value'] So if you have, You can find it using: By.cssSelector("a[href='mysite.com']"); this works using any attribute possible. This page here gives good information on how to formulate effective css selectors, and matching their attributes: http://ddavison.io/2014/02/18/effective-css-selectors
has comment: http://stackoverflow.com/comment/83930859
upvote count: 118
downvote count: 1
answers question: http://stackoverflow.com/q/26304224
score: 117

ssl
tags question: http://stackoverflow.com/q/26321062
tags question: http://stackoverflow.com/q/26318083
type: Tag
tags question: http://stackoverflow.com/q/26282849
tags question: http://stackoverflow.com/q/26278277
tag name: ssl
tags question: http://stackoverflow.com/q/26324079
tags question: http://stackoverflow.com/q/26320874
tags question: http://stackoverflow.com/q/26349076
tags question: http://stackoverflow.com/q/26255616
tags question: http://stackoverflow.com/q/26282066
tags question: http://stackoverflow.com/q/26283426
tags question: http://stackoverflow.com/q/26286491
tags question: http://stackoverflow.com/q/26226713
tags question: http://stackoverflow.com/q/26289412
tags question: http://stackoverflow.com/q/26196408
tags question: http://stackoverflow.com/q/26320624

http://stackoverflow.com/comment/41130827
comment on: http://stackoverflow.com/q/26224677
score: 0
has text: What should be happen what do you mean to draw continuously?
type: Comment
type: QuestionComment

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/26295437
tags question: http://stackoverflow.com/q/26206455
tags question: http://stackoverflow.com/q/26260120
tags question: http://stackoverflow.com/q/26218932
tags question: http://stackoverflow.com/q/26287514

http://stackoverflow.com/q/26317685
answer count: 1
has answer: http://stackoverflow.com/a/26317821
tagged with: java
tagged with: servlets
tagged with: illegalstateexception
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/83478879
accepted answer: http://stackoverflow.com/a/26317821
type: Question
has body: This is from book Professional Java For Web The first time you call getParameter, getParameterMap, getParameterNames, or getParameterValues on a request object, the web container determines whether the request contains post variables, and if it does it reads and parses those post variables by obtaining the request’s InputStream. The InputStream of a request can be read only once. If you call getInputStream or getReader on a request containing post variables and then later attempt to retrieve parameters in that request, the attempt to retrieve the parameters results in an IllegalStateException. And this is my test code: @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name = req.getParameter("name"); System.out.println(name); ServletInputStream inputStream = req.getInputStream(); int read = inputStream.read(); System.out.println(read); } And when I hit the Servlet with ?name=test I get: test -1 Is there something I am missing? How can I reproduce this Exception?
has title: IllegalStateException In Servlet
upvote count: 1

http://stackoverflow.com/q/26332509
has comment: http://stackoverflow.com/comment/41328673
has title: Why can't this class find this array?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41328796
has comment: http://stackoverflow.com/comment/41328687
score: 1
tagged with: java
downvote count: 1
has body: I have an array which works in the first class (ColoredWordsExperiment), while the second class, (ButtonHandler), cannot find it. The strange thing is that if I, in the ButtonHandler class, substitute coloredWords.labels[i] or let's say "coloredWords.labels[1]" for simply coloredWords.labels1, while in the first class I declare JLabel labels1 = new JLabel; it works. That's basically what I initially had but since I have 12 labels I decided to use an array instead. The problem now is that the class ButtonHandler cannot find the variable "coloredWords.labels[i]". This is the code (I left out unimportant stuff otherwise the code would be quite long): public class ColoredWordsExperiment { ButtonHandler buttonHandler; ColoredWordsExperiment(){ JLabel[] labels = new JLabel[12]; for (i = 0; i &lt; 12; i++) { labels[i] = new JLabel("Press Button"); labels[i].setPreferredSize(new Dimension(90,40)); labels[i].setOpaque(true); labels[i].setBackground(Color.white); labels[i].setHorizontalAlignment(SwingConstants.CENTER); labelContainer.add(labels[i]); } button1 = new JButton("Matching"); buttonHandler = new ButtonHandler(this); button1.addActionListener(buttonHandler); } public static void main(String[] arg) { new ColoredWordsExperiment(); } } - class ButtonHandler implements ActionListener { ColoredWordsExperiment coloredWords; public ButtonHandler(ColoredWordsExperiment coloredWords) { this.coloredWords = coloredWords; } @Override public void actionPerformed(ActionEvent e){ if (e.getActionCommand().equals("Matching")) { for (i = 0; i &lt; 12; i++) { coloredWords.labels[i].setText("Text changed"); } } }
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/41328814
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/26332523
accepted answer: http://stackoverflow.com/a/26332523
favorite count: 0

http://stackoverflow.com/comment/41099650
score: 0
type: AnswerComment
type: Comment
has text: Maybe, I'm doing it wrong, but I've created the "helloworld" subdir and moved the .class file into it, but I get the same error.
comment on: http://stackoverflow.com/a/26207418

http://stackoverflow.com/comment/41118292
has text: @leventov Can you make it more clear for me?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26209968

http://stackoverflow.com/comment/41129619
comment on: http://stackoverflow.com/a/26223822
has text: Sorry I meant ActiveRecord.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41140890
score: 1
comment on: http://stackoverflow.com/q/26230204
type: QuestionComment
type: Comment
has text: Yes, you could read the whole file first to count the lines, create the array, then loop again reading in the data.

http://stackoverflow.com/comment/41291249
type: QuestionComment
comment on: http://stackoverflow.com/q/26300755
score: 0
has text: You've also misspelt "protocol".
type: Comment

http://stackoverflow.com/comment/41152204
type: AnswerComment
comment on: http://stackoverflow.com/a/26235530
type: Comment
score: 0
has text: Additionally, if you locate the Drop Down entry this way, using Xpath, then you only need one line to switch to the new value - just perform a click() on this Xpath. Unfortunately I cannot extract your Xpath because I miss the code.

http://stackoverflow.com/a/26232186
has comment: http://stackoverflow.com/comment/41154497
has comment: http://stackoverflow.com/comment/41147917
score: 0
has comment: http://stackoverflow.com/comment/41147085
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41147372
has body: No, it is not ok. SQL doesn't work with ordered sets, SQL is working (mainly) with unordered sets. That means, that every query, query result, subquery and such are an unordered set of records. Yes, this is because these sets are theoretically exactly the sets which you could learn from in high school. If you do a GROUP BY, a JOIN, or any similar, a previous ORDER BY will be invalidated. Why? Because every such keyword is working with unordered sets. This is also the cause, why only the last SQL query can have an ORDER BY. If somehow this internal ordering works, it is only a randomly behaviour of some SQL servers (old MySQL versions were especially curious in such solutions). What you wanted, is GROUP-in the records by two columns (published and language) ORDERING the needed records by this two columns as well. So: SELECT b FROM Book b WHERE author=?1 AND info.status=published ORDER BY published, language ...or such. If I could decipher what do you want, probably even a group by were unneeded. If you extend your question, what is your goal, I will extend my answer with the query. Extension #1: It can't be done with basic SQL, which it requires windowing functions. An SQL query which does what you want: SELECT *, ROW_NUMBER() OVER (ts PARTITION BY author, lang ORDER BY ts) AS tsn FROM Book b LEFT JOIN info i ON b.info_id=i.id WHERE tsn=1 Anyways, you should look for the ROW_NUMBER() SQL function, and probably you won't need GROUP BY. I furhter don't have any clue how could it be ported to hql (hibernate query language), but I will do a little bit of research around this soon. Extension #2: Mysql doesn't have windowing function or anything which made SQL useful. In ancient times it was because they had not enough programmer and wanted a fast system, not a smart. Currently, it is because MySQL is owned by Oracle and they want a free concurrent to their SQL server. Anyways, MySQL is bad, and on longterm, especially if you are enough good for Java, I suggest you use som…
has comment: http://stackoverflow.com/comment/41148018
answers question: http://stackoverflow.com/q/26231817
has comment: http://stackoverflow.com/comment/41147608
accepted answer of: http://stackoverflow.com/q/26231817
type: Answer
has comment: http://stackoverflow.com/comment/41144742
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41147243

http://stackoverflow.com/comment/41322381
has text: That's right, but I'll just change the test to `a.equals(b)` to fix it. Thanks for noticing that !
score: 0
comment on: http://stackoverflow.com/a/26327379
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41351464
type: QuestionComment
has text: It says: Cannot make a static reference to the non-static method getAssets() from the type ContextWrapper. The problem is a context with that getAssets method.
comment on: http://stackoverflow.com/q/26344679
score: 0
type: Comment

http://stackoverflow.com/a/26341245
type: AcceptedAnswer
has body: Before you call SHAppBarMessage(ABM_SETPOS) you have to initialize a new AppBar calling SHAppBarMessage(ABM_NEW)as show below. private void appbarNew() { APPBARDATA data = new APPBARDATA.ByReference(); data.cbSize.setValue(data.size()); int WM_USER = 0x0400; data.hWnd = hWndGlobal; data.uCallbackMessage.setValue(WM_USER + 1); UINT_PTR result = Shell32.INSTANCE.SHAppBarMessage(new DWORD(ShellAPI.ABM_NEW), data); System.out.println("result: " + result); } At the end don't forget to remove the new AppBar calling SHAppBarMessage(ABM_REMOVE) Related docs from Microsoft Dev Center
answers question: http://stackoverflow.com/q/26301979
type: Answer
accepted answer of: http://stackoverflow.com/q/26301979
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41346721
upvote count: 2
has comment: http://stackoverflow.com/comment/41346791

http://stackoverflow.com/comment/41232148
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26279641
has text: The problem is that the account is quickly closed :/ thanks anyway

http://stackoverflow.com/q/26332817
favorite count: 0
has answer: http://stackoverflow.com/a/26332842
has comment: http://stackoverflow.com/comment/41329697
type: UnansweredQuestion
tagged with: input
has body: I am trying to create a program that prompts the user to enter a name (1 of three options x,y,or z) and a certain variable (that is less than 10). If both of these inputs are true it will print out the name and the number as : (" you choose x times 2") I am stuck because I'm new to the java scanner class (and java) and don't know how to configure the code with if statements checking two factors. Help? My code so far: I know a lot of it wrong: import java.util.Scanner; public class ScannerAndKeyboard { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Welcome"); System.out.print( "Enter your name: " ); String name = s.nextLine(); System.out.println( "Hello " + name + "!" ); System.out.print("Please Enter letter and number: " ); if(s.nextLine().equals(X) &amp;&amp; s.nextInt() &lt;= 10) System.out.println( "You choose x10"); } }
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26333321
has title: How to use Java User Input Scanner with multiple loops
answer count: 2
has comment: http://stackoverflow.com/comment/41329615

http://stackoverflow.com/comment/41133730
comment on: http://stackoverflow.com/a/26223292
type: Comment
has text: This solves the problem for building the single table I gave, but I have other tables with with relations. In particular, I have a CSV files for what I call "Entries" (as in a car show), where each entry has an Owner and one or more Cars. I want to have the Cars in one table and Owners in another, with a link table called Entries. I'm building these 3 tables all inside a single loop, sweeping through the Entries.csv file. In this situation I can't skip executeBatch() in the Owner & Car tables because if they aren't done I won't have the foreign keys for inserting into the Entries table.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41352064
type: Comment
type: QuestionComment
has text: Posted my comment as an actual answer.
comment on: http://stackoverflow.com/q/26343666
score: 0

http://stackoverflow.com/comment/41138162
type: AnswerComment
comment on: http://stackoverflow.com/a/26228427
type: Comment
score: 1
has text: Start by doing a Google search for the class names that are unfamiliar to you. Read the Javadoc for those API classes and their methods, if you're still confused, read them again.

http://stackoverflow.com/q/26311686
linked to: http://stackoverflow.com/q/6832445
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16594613
tagged with: java
has comment: http://stackoverflow.com/comment/41293810
has answer: http://stackoverflow.com/a/26338600
has comment: http://stackoverflow.com/comment/41293740
type: Question
answer count: 2
tagged with: pbkdf2
favorite count: 0
has body: In order to hash passwords securely, which algorithm should I use? BCrypt or PBKDF2WithHmacSHA1? Which is more secure? PBKDF2WithHmacSHA1 is built into Java while BCrypt is available via jBCrypt library (which has mostly received positive reviews). Also if I go with BCrypt should I limit my user's password entry to 55 characters only (since that is the limit of BCrypt)? It would be helpful if you are Java specific. Do note that I would go for the option that makes the passwords more secure and brute-forcing more difficult.
has title: BCrypt vs PBKDF2WithHmacSHA1
tagged with: security
accepted answer: http://stackoverflow.com/a/26338600
has answer: http://stackoverflow.com/a/26315583
tagged with: jbcrypt
score: 2
has comment: http://stackoverflow.com/comment/41293602
upvote count: 3
tagged with: bcrypt
possible better answer: http://stackoverflow.com/a/26315583
downvote count: 1

http://stackoverflow.com/a/26340487
upvote count: 2
type: AcceptedAnswer
has body: You have to add c to the context m1. Also, Calender is unknown, too, but you could just use c instead (ugly, but works). Finally, note that add returns void, i.e. it modifies c in-place. Try this: System.out.println(c.getTime()); m1.put("c", c); MVEL.eval("c.add(c.DAY_OF_MONTH, 4)", m1); System.out.println(c.getTime()); Output: Thu Oct 02 00:00:00 CEST 2014 Mon Oct 06 00:00:00 CEST 2014
type: Answer
answers question: http://stackoverflow.com/q/26340300
accepted answer of: http://stackoverflow.com/q/26340300
score: 2
has comment: http://stackoverflow.com/comment/43893460
downvote count: 0

http://stackoverflow.com/a/26286093
score: 6
answers question: http://stackoverflow.com/q/26286067
upvote count: 6
has body: The semi-colon terminates the if block, remove it if (GPA &gt; 3.8); // &lt;-- here should be if (GPA &gt; 3.8)
type: Answer
downvote count: 0

http://stackoverflow.com/a/26304545
has comment: http://stackoverflow.com/comment/41277531
accepted answer of: http://stackoverflow.com/q/26304185
type: Answer
answers question: http://stackoverflow.com/q/26304185
score: 0
has body: Pass the numbers as parameters to the menu() method: public static void main (String [] args) { Scanner kb = new Scanner(System.in); //Allows input from keyboard int iMenu; //Holds menu System.out.print ("\n\nPress ENTER to continue"); kb.nextLine(); int iNum1; //Holds user input for number 1 int iNum2; //Holds user input for number 2 System.out.print("\nPlease enter the first integer: "); iNum1 = kb.nextInt(); System.out.print("\nPlease enter the second integer: "); iNum2 = kb.nextInt(); iMenu = menu(iNum1, iNum2); //Calls menu method } public static int menu(int iNum1, int iNum2) { /* rest of the menu code */ }
type: AcceptedAnswer

http://stackoverflow.com/comment/41345752
has text: I am looking for the theoretical running time of this method. Lots of methods in Java have amortized runtime limits, and also have exceptions. Why is this any different?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26341531

http://stackoverflow.com/q/26228445
favorite count: 0
has comment: http://stackoverflow.com/comment/41137897
linked to: http://stackoverflow.com/q/513832
duplicate of: http://stackoverflow.com/q/767372
has body: On reading many articles I could figure out that == compares if the two operands are referring to same object. How does it work with primitive data types. Does it compare the values of the operand? Does == work differently for primitive data types and classes ? Kindly clarify
duplicate of: http://stackoverflow.com/q/513832
tagged with: operators
has comment: http://stackoverflow.com/comment/41137868
accepted answer: http://stackoverflow.com/a/26228581
has comment: http://stackoverflow.com/comment/41137972
has title: == and .equals() in java
upvote count: 1
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/41137910
tagged with: java
has answer: http://stackoverflow.com/a/26228481
type: Question
has answer: http://stackoverflow.com/a/26228476
answer count: 3
possible better answer: http://stackoverflow.com/a/26228481
has comment: http://stackoverflow.com/comment/41138052
has answer: http://stackoverflow.com/a/26228581
downvote count: 0
linked to: http://stackoverflow.com/q/767372

http://stackoverflow.com/a/26784509
score: 0
has body: This is a bug in Eclipse Juno version, fixed in a patch and later releases. The bug is documented here: "WAR export from IDE always includes java source - ignoring 'export source files'". This is similar to a prior question.
type: Answer
answers question: http://stackoverflow.com/q/26304477

http://stackoverflow.com/comment/50658006
comment on: http://stackoverflow.com/a/26271986
type: AnswerComment
score: 0
type: Comment
has text: Done Like this... static { Runtime.getRuntime().addShutdownHook ( new Thread() { public void run() { server.shutdown(); } } ); }

http://stackoverflow.com/comment/41079525
has text: You can accept an answer by clicking on tick when you found any answer useful or best when there are more then 1 useful answers. This way the answerer will gain 15 reputations and you will gain 2. (Just to let you know if you are unaware) @KutloSekwamote
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26197287

http://stackoverflow.com/a/26331052
has body: Okay, so after much mucking about, I was able to, finally, change the disposal method for the frame to restoreToBackgroundColor. Basically, what this means is that the animation is not an incremental change, but a complete frame replacement... import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class AnimatedGifTest1 { public static void main(String[] args) { new AnimatedGifTest1(); } public AnimatedGifTest1() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } catch (UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new PaintPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class PaintPane extends JPanel { private ImageIcon image; public PaintPane() { image = new ImageIcon(getClass().getResource("/ertcM02.gif")); Timer timer = new Timer(40, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { repaint(); } }); timer.start(); } @Override public Dimension getPreferredSize() { return image == null ? new Dimension(200, 200) : new Dimension(image.getIconWidth(), image.getIconHeight()); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // This is very important! int x = (getWidth() - image.getIconWidth()) / 2; int y = (getHeight() - image.getIconHeight()) / 2; image.paintIcon(this, g, x, y); } } } Updated... So, I w…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26330550
type: Answer
answers question: http://stackoverflow.com/q/26330550
has comment: http://stackoverflow.com/comment/41366723
upvote count: 7
has comment: http://stackoverflow.com/comment/41326099
has comment: http://stackoverflow.com/comment/41325942
has comment: http://stackoverflow.com/comment/41367523
score: 7
has comment: http://stackoverflow.com/comment/41366619
has comment: http://stackoverflow.com/comment/41326037
has comment: http://stackoverflow.com/comment/41325969
has comment: http://stackoverflow.com/comment/41366448

http://stackoverflow.com/comment/41248623
type: QuestionComment
has text: Use Composition and have EatMuffin be part of a different class. You then can inject the desired behavior with dependency injection. To @user2418306, How is multiple inheritance part of the question?
comment on: http://stackoverflow.com/q/26288566
score: 0
type: Comment

http://stackoverflow.com/comment/41334139
type: AnswerComment
comment on: http://stackoverflow.com/a/26298573
has text: "Adding a cache on top of EHCache which doesn't expire" sounds like disabling expiring in EHCache completely -> you'll end up with a cache that always grows. Either I am or you are missing something important :-) How big is the database? If it's < 100GB, buy enough RAM to keep almost all of it in RAM all the time. RAM is **cheap**. To put in perspective: If you work in this for a week, you could have already bought RAM for $7000 and just made the cache bigger without changing anything else.
score: 0
type: Comment

http://stackoverflow.com/a/26322845
accepted answer of: http://stackoverflow.com/q/26322502
answers question: http://stackoverflow.com/q/26322502
score: 0
has body: a cannot be resolved to a variable Syntax error on token ",", . expected Syntax error on token "-", -- expected a cannot be resolved to a variable b cannot be resolved to a variable You are getting these errors on this line (which appears twice in the code) : Arrays.sort(order, (a, b) -&gt; Character.compare(S.charAt(a), S.charAt(b))); ^^ ^ ^ ^ The reason must be that you are not compiling the code in Java 8. Lambda expressions require Java 8.
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/comment/41324285
comment on: http://stackoverflow.com/a/26328748
type: AnswerComment
has text: My fragment has just the setContentView() method, nothing more, and my Fragment's corresponding layout is the portion of code that I edited in the answer. It used to work like this but I don't know why it throws me an exception, I'm frustrated.
score: 0
type: Comment

http://stackoverflow.com/q/26223116
score: 7
has answer: http://stackoverflow.com/a/26223227
upvote count: 7
answer count: 1
tagged with: java
has body: Would anyone care to elaborate how the HikariCP handles connections in the pool? How do you put a new connection in the pool, and how can you call on it / retrieve it later? This is my current code: HikariConfig config = new HikariConfig(); config.setMaximumPoolSize(100); config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); config.addDataSourceProperty("serverName", "localhost"); config.addDataSourceProperty("port", "8889"); config.addDataSourceProperty("databaseName", "XXX"); config.addDataSourceProperty("user", "XXX"); config.addDataSourceProperty("password", "XXX"); System.out.print("qq"); HikariDataSource ds = new HikariDataSource(config); ds.setConnectionTimeout(800);
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26223227
downvote count: 0
has title: How to create new connections and retrieve them later in HikariCP
favorite count: 0
tagged with: hikaricp
type: Question

http://stackoverflow.com/q/26315205
has title: How to get as a stream any class loaded from a jar not in the classpath?
upvote count: 1
has body: I have a web-app which I want to work roughly as follows: Someone uploads a jar (say myjar.jar) along with the name of class to analyze (say test.Test). The exact purpose of analysis is irrelevant so assume that the web-app does some static analysis on it. I am able to upload the jar and load the class in Java using the hacks described here and here (MultiClassLoader). If I know the methods inside the class, I can invoke them using reflection. Following assumes a method with signature foo(String) Class c = jarLoader.loadClass("test.Test", true); Object instance = c.newInstance(); Method foo = instance.getClass().getDeclaredMethod("foo", new Class[]{String.class}); // foo takes one para String foo.setAccessible(true); foo.invoke(instance, (Object) "hello"); Now, suppose, I need to find out what methods are there inside test.Test. To do this, I use the ASM framework, which needs the class as a stream. This is where I am running into a problem. I am unable to do getResourceAsStream or its equivalents. This is what I tried: Type t = org.objectweb.asm.Type.getType(c); // uses asm library String url = t.getInternalName() + ".class"; c.getClassLoader().getResourceAsStream(url); // gives null Same problem if I use: c.getClassLoader().getResourceAsStream(c.getSimpleName() + ".class"); etc. What is the right way to get resource as stream, where the resource is a class file loaded from a jar NOT in the class path. Note that the entire thing is done via a web-app. EDIT: Getting methods is just an example. What I really want is to get the class as a stream. I need to use ASM because it gives me other information (such as parameter names), which I cannot get via getDeclaredMethods or getMethods.
tagged with: jar
favorite count: 0
has answer: http://stackoverflow.com/a/26316644
has answer: http://stackoverflow.com/a/26315370
downvote count: 0
tagged with: reflection
tagged with: classloader
type: UnansweredQuestion
tagged with: urlclassloader
score: 1
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/41237328
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26270960
has text: @SamuelÅslund You are correct. I tried adding a try/catch to the thread task and started seeing exceptions. With some more searching I found that this is the default behavior for certain Runnables. I'm not clear on why it works this way, but at least now I can continue to debug. Thank you!

instance
tags question: http://stackoverflow.com/q/26273567
type: Tag
tag name: instance
tags question: http://stackoverflow.com/q/26337169

http://stackoverflow.com/a/41691016
upvote count: 2
has comment: http://stackoverflow.com/comment/72096652
downvote count: 0
answers question: http://stackoverflow.com/q/26236562
type: Answer
score: 2
has body: Thanks to responses on this forum, I was finally able to make it working. On windows 10; I carried out following steps to make it working: Download freeTTS libraries and include them in my Java project in eclipse. Download mbr301d.zip, extract it in a folder named mbrola within my project Download mbrola database for us1, us2, us3 and en1 from http://www.tcts.fpms.ac.be/synthesis/mbrola/mbrcopybin.html extract the voice DB zips downloaded in previous step directly in mbrola folder - don't change names of the folders. include following code pieces to use it: System.setProperty("mbrola.base", "ABSOLUTE_PATH_TO_mbrola_directory_ending_with_/"); voiceManager = VoiceManager.getInstance(); voice = voiceManager.getVoice("mbrola_us1"); Note: if your voice DB folder name is us1; then you should add it above as "mbrola_us1"; if it is en1, then it should be "mbrola_en1". This actually has done the trick for me.

http://stackoverflow.com/a/26330851
has comment: http://stackoverflow.com/comment/41325692
has comment: http://stackoverflow.com/comment/41325699
score: 0
answers question: http://stackoverflow.com/q/26330779
has body: You could use Arrays#asList instead of new ArrayList().add(item), however that returns a fixed size list which may not be what you want. Another way would be to use Map#computeIfAbsent like this to create and add a new list of the type you want to the map and then add the item to the list when it is returned. Product item = new Product(); Map&lt;String, List&lt;Product&gt;&gt; rMap = new HashMap&lt;&gt;(); rMap.computeIfAbsent("key", s -&gt; new ArrayList&lt;&gt;()).add(item);
has comment: http://stackoverflow.com/comment/41325673
type: Answer

http://stackoverflow.com/q/26196848
tagged with: google-cloud-platform
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/27695444
tagged with: java
has title: AppIdentityCredential And AppEngineDataStoreFactory
type: Question
score: 5
tagged with: google-api-java-client
tagged with: google-cloud-datastore
upvote count: 5
answer count: 1
downvote count: 0
has body: I don't understand why I can't save AppIdentityCredential with AppEngineDataStoreFactory AppEngineDataStoreFactory newFactory = new AppEngineDataStoreFactory(); AppIdentityCredential credential = new AppIdentityCredential.Builder(SCOPES).build() //line with error if (newFactory.getDataStore(StoredCredential.DEFAULT_DATA_STORE_ID) .set(userId, new StoredCredential(credential))) { return credential; } return null; AppIdentityCredential is not serializable and StoredCredential accept only Credential object... What's the logic???? Cédric

http://stackoverflow.com/comment/41233399
type: Comment
comment on: http://stackoverflow.com/a/26273960
type: AnswerComment
has text: actually i've control on the jar, but i would like to keep it as it is. As "my logger config file" what are you refering to?
score: 0

http://stackoverflow.com/comment/41188641
comment on: http://stackoverflow.com/a/26246527
has text: No, of course it's not going to work - you never specify the Locale. I tried it and I get: "Parameter value [Some Value] did not match expected type [com.test.LocalizedValue (n/a)];"
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26326609
tagged with: duplicates
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26326701
tagged with: arrays
has answer: http://stackoverflow.com/a/26326701
tagged with: hashset
has title: Validating against duplicate user entries when using sets
has answer: http://stackoverflow.com/a/26326685
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41317387
tagged with: set
has body: I am currently studying Java and have being using normal arrays so far. Next semester we will be using data structures like ArrayList etc, but i decided to read ahead. I have read that for storing data that can not be a duplicate, Sets were the data structure of choice, but in the code below the user can still enter a duplicate entry? Can any body explain the process to me and perhaps a solution to my problem? public class Lotto { private static final int INPUT_SIZE = 6; private static final int MIN_NUMBER_POSSIBLE = 0; private static final int MAX_NUMBER_POSSIBLE = 25; private Set&lt;Integer&gt; userNumbers = new HashSet&lt;Integer&gt;(); private Set&lt;Integer&gt; randomNumbers = new HashSet&lt;Integer&gt;(); public static void main(String[] args) { Lotto c = new Lotto(); c.generateRandomNumbers(); System.out.println("Pick " + INPUT_SIZE + " numbers from " + MIN_NUMBER_POSSIBLE + " to " + MAX_NUMBER_POSSIBLE + "."); c.readUserNumbers(); if (c.doUserNumbersMatchRandomNumbers()) { System.out.println("You win :) !"); } else { System.out.println("Sorry you failed :( !"); c.showRandomNumbersToUser(); } } private void generateRandomNumbers() { Random random = new Random(); for (int i = 0; i &lt; INPUT_SIZE; i++) { randomNumbers.add(random.nextInt(MAX_NUMBER_POSSIBLE)); } } private void showRandomNumbersToUser() { System.out.println("\nRandom numbers where : "); for (Integer randomNumber : randomNumbers) { System.out.println(randomNumber + "\t"); } } private void readUserNumbers() { Scanner input = new Scanner(System.in); int inputSize = 1; while (input.hasNextInt() &amp;&amp; inputSize &lt; INPUT_SIZE) { int numberChoosen = input.nextInt(); if (numberChoosen &lt; MIN_NUMBER_POSSIBLE || numberChoosen &gt; MAX_NUMBER_POSSIBLE) { System.out.println("Your number must be in " + MIN_NUMBER_POSSIBLE + " - " + MAX_NUMBER_POSSIBLE + " range."); } else { userNumbers.add(numberChoosen); inputSize++; } } } private boolean doUserNumbersMatchRandomNumbers() { for (Integer userNumber …
has comment: http://stackoverflow.com/comment/41317426
type: Question
accepted answer: http://stackoverflow.com/a/26326685
has comment: http://stackoverflow.com/comment/41317457
tagged with: java

http://stackoverflow.com/a/26226960
type: Answer
has body: Make the rectangle class private and each public class usually needs to be in its own compilable file. Also the constructor that youy have defined takes int but you are passing String Consider using Integer.parse (input1);
answers question: http://stackoverflow.com/q/26226936
score: 0

http://stackoverflow.com/comment/41331794
comment on: http://stackoverflow.com/q/26334225
score: 1
has text: Don't use a ListActivity. It's just a regular Activity with some niceties tacked on that you could instead implement yourself.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41157171
has text: It's good practice to use brackets `{}`, even when you don't need them.
comment on: http://stackoverflow.com/q/26238982
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26272453
answers question: http://stackoverflow.com/q/26272100
has body: As it stated in Javadoc: The rename operation might not be able to move a file from one filesystem to another. You could use Files.copy(InputStream in, Path target, CopyOption... options) from java.nio.file to achieve this.
score: 0
type: Answer

http://stackoverflow.com/comment/41163468
comment on: http://stackoverflow.com/q/26242347
type: QuestionComment
has text: first check if there is a left child.. node.getParent()!=null && node.getParent().left()!=null
type: Comment
score: 2

http://stackoverflow.com/q/26256408
has body: I am creating a daily attendance system for employees using Java and Mysql as the DBMS.Firstly the application shows login form by which each employee is going to fill his/her username and password.If she does not have,she is going to register then she will get the access.So what i need during registration for the one who registered as the administrator to have different GUI after login compared to the GUI faced by other users.You can see the code below what i can add to the login button private void loginActionPerformed(java.awt.event.ActionEvent evt) { String username=tx.getText(); String password=tx2.getText(); if(username.equals("") || password.equals("") || (username.equals("") && password.equals(""))) { login.setEnabled(false); JOptionPane.showMessageDialog(null," PLEASE ENTER BOTH USERNAME AND PASSWORD "); login.setEnabled(true); this.setVisible(true); } else { String sql= "select * from empdetails where EmpId=? and Password=?"; try { st=con.prepareStatement(sql); st.setString(1,tx.getText()); st.setString(2,md5(tx2.getText())); rs = st.executeQuery(); if(rs.next()) { JOptionPane.showMessageDialog(null," SUCCESSFULLY LOGGED IN. "); dispose(); } else { JOptionPane.showMessageDialog(null," INVALID USERNAME AND PASSWORD. "); } } catch(SQLException e) { JOptionPane.showMessageDialog(null,"ERROR TO DATABASE VALUES RETRIEVAL"); } } } Also can I get help in administrator GUI she can click a button and get the stored values in mysql through the print view and other button show to save them in PDF format.And in what way i can have the system time shown during login of each employee in the company.
score: 1
has title: How to make administrator and other normal users access different GUI in Java to MySQL connection when they press the same login button?
tagged with: java
tagged with: mysql
type: Question
upvote count: 1
answer count: 1
tagged with: user-interface
downvote count: 0
has answer: http://stackoverflow.com/a/26288756
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26305852
score: 0
has comment: http://stackoverflow.com/comment/41280581
answers question: http://stackoverflow.com/q/26305703
has comment: http://stackoverflow.com/comment/41281746
has comment: http://stackoverflow.com/comment/41279967
type: Answer
has body: Your code has some design issues which I think stem from the fact that you are a beginner: There is no need to extend AbstractList&lt;E&gt; unless you really require some special type of list. You can simply use a concrete implementation of List&lt;T&gt; like LinkedList&lt;T&gt; or ArrayList&lt;T&gt;. Your code has a design problem. Your server is not a list. But this is what your code says, since your main class is extending AbstractList&lt;E&gt;. Instead, your server should be using a list. So the correct approach is to use an internal List&lt;T&gt; instance that keeps track of your clients. Your approach is fundamentally wrong, so I would suggest reading up on some beginner texts on Java and Object-Oriented Programming in general. From your code it seems like you have some misconceptions as to what OOP actualy is.

http://stackoverflow.com/comment/41142763
type: Comment
has text: looks like there is a compile error. But i can't see it in the output.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26230711

http://stackoverflow.com/q/26205860
upvote count: 1
tagged with: java-ee-6
has body: I've got a Java EE application which uses restful urls (JAX-RS), something like this: @GET @Path("/test/{id}") public void foo(.... What I need to do is add some of these urls on runtime. Probably something in this direction: @Inject RestfulController rC; void myMethod(){ rC.registerPath( GET, "/xxx/" + var1 + "/{asfd}", listener); } I found a very similar question without an answer here: https://stackoverflow.com/questions/12488031/develop-a-dynamic-rest-web-server-using-java-ee#comment41094132_12488031 Is there any way to register new URLs at runtime? Edit: For my use case it would be enough that I could set the urls (and listeners) once at startup. There is no need to change them afterwards. The only point is that they can't be hard-coded for example with @Path.
tagged with: rest
has title: Dynamic RESTful urls OR add RESTful listener at runtime
downvote count: 0
tagged with: dynamic
answer count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
tagged with: jakarta-ee
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41141345
has comment: http://stackoverflow.com/comment/41145361
has comment: http://stackoverflow.com/comment/41148341

http://stackoverflow.com/a/26210577
answers question: http://stackoverflow.com/q/26210530
has comment: http://stackoverflow.com/comment/43082950
has body: Repleace Collections.sort(fruits, "some compator object"); with: Collections.sort(fruits, new Comparator&lt;Fruit&gt;() { @Override public int compare(Fruit o1, Fruit o2) { if (o1.getFruitName() != null &amp;&amp; o1.getFruitName().equalsIgnoreCase("orange")){ return -1; } if (o2.getFruitName() != null &amp;&amp; o2.getFruitName().equalsIgnoreCase("orange")){ return 1; } return o1.getFruitName().compareTo(o2.getFruitName()); } });
downvote count: 0
has comment: http://stackoverflow.com/comment/41111905
has comment: http://stackoverflow.com/comment/41104413
has comment: http://stackoverflow.com/comment/41104334
has comment: http://stackoverflow.com/comment/41104143
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/41308546
comment on: http://stackoverflow.com/q/26232767
has text: I solved it by separating my multi-threading and cometD
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/132204449
type: Comment
comment on: http://stackoverflow.com/a/26268235
has text: I didn't realise that, I was opening BufferReader using US_ASCII but my file was in UTF-8. When I changed it to UTF-8, it works perfectly.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26383567
score: 0
has body: As I understand Apache CXF doesn't have such thing like in Spring MVC, but you have ability to process such thing with the help of ResourceComparator. Look this link for additional info This is my comparator(simple copy-past from link above) public class UrlComparator extends OperationResourceInfoComparator implements ResourceComparator { public UrlComparator() { super( null, null ); } @Override public int compare( ClassResourceInfo classResourceInfo, ClassResourceInfo classResourceInfo2, Message message ) { return 0; } @Override public int compare( OperationResourceInfo operationResourceInfo, OperationResourceInfo operationResourceInfo2, Message message ) { // Check if CXF can make a decision int cxfResult = super.compare(operationResourceInfo, operationResourceInfo2); if (cxfResult != 0) return cxfResult; int op1Counter = getMatchingRate(operationResourceInfo, message); int op2Counter = getMatchingRate(operationResourceInfo2, message); return op1Counter == op2Counter ? 0 : op1Counter&lt; op2Counter ? 1 : -1; } /** * This method calculates a number indicating a good or bad match between * values provided within the request and expected method parameters. A * higher number means a better match. * * @param operation * The operation to be rated, based on contained parameterInfo * values. * @param message * A message containing query from user request * @return A positive or negative number, indicating a good match between * query and method */ protected int getMatchingRate(OperationResourceInfo operation, Message message) { List&lt;Parameter&gt; params = operation.getParameters(); if (params == null || params.size() == 0) return 0; // Get Request QueryParams Set&lt;String&gt; qParams = getParams((String) message.get(Message.QUERY_STRING)); int rate = 0; for (Parameter p : params) { switch (p.getType()) { case QUERY: if (qParams.contains(p.getName())) rate += 2; else if (p.getDefaultValue() == null) rate -= 1; break; // optionally support other parameter types such as …
type: Answer
accepted answer of: http://stackoverflow.com/q/26345062
answers question: http://stackoverflow.com/q/26345062
type: AcceptedAnswer

http://stackoverflow.com/q/26252875
has body: I have three 'long' variables: start, end &amp; testtime. long start = 1412801340000 //(means 10/8/14 4:49 PM in UTC time) long end= 1412808540000 //(means 10/8/14 6:49 PM in UTC time) long testtime = 1447195740000 //(means 11/10/15 5:49 PM in UTC time) I want to test whether the TIME OF DAY (do not care about the date, month &amp; year at all) in testtime is between start and end or not. How can I do this? Basically, I just want to extract the Time of Day from each of the long variables, and then check if testtime falls in between *start" &amp; end.
answer count: 5
tagged with: time
tagged with: android
accepted answer: http://stackoverflow.com/a/26253013
has title: how to convert milliseconds to Time of day?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/48717529
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/6476065
tagged with: java
tagged with: milliseconds
linked to: http://stackoverflow.com/q/8237193
has answer: http://stackoverflow.com/a/26252948
score: 0
has answer: http://stackoverflow.com/a/26292347
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/26252931
duplicate of: http://stackoverflow.com/q/8237193
possible better answer: http://stackoverflow.com/a/26252948
has answer: http://stackoverflow.com/a/26253013
favorite count: 0
has comment: http://stackoverflow.com/comment/84433909

http://stackoverflow.com/a/26339612
has comment: http://stackoverflow.com/comment/41343398
answers question: http://stackoverflow.com/q/26337927
has comment: http://stackoverflow.com/comment/41345074
score: 0
type: Answer
has body: CR (unlucky 13) as end marker of binary data might be a bit dangerous. More dangerous seems how the text and bytes became written: the text must be written as bytes in some encoding. But considering that, one could wrap the FileInputStream in your own ByteLogInputStream, and there hold the reading state: /** * An InputStream converting bytes between ASCII "))" and CR to hexadecimal. * Typically wrapped as: * &lt;pre&gt; * try (BufferedReader in = new BufferedReader( * new InputStreamReader( * new ByteLogInputStream( * new FileInputStream(file), "UTF-8"))) { * ... * } * &lt;/pre&gt; */ public class ByteLogInputStream extends InputStream { private enum State { TEXT, AFTER_RIGHT_PARENT, BINARY } private final InputStream in; private State state = State.TEXT; private int nextHexDigit = 0; public ByteLogInputStream(InputStream in) { this.in = in; } @Override public int read() throws IOException { if (nextHexDigit != 0) { int hex = nextHexDigit; nextHexDigit = 0; return hex; } int ch = in.read(); if (ch != -1) { switch (state) { case TEXT: if (ch == ')') { state = State.AFTER_RIGHT_PARENT; } break; case AFTER_RIGHT_PARENT: if (ch == ')') { state = State.BINARY; } break; case BINARY: if (ch == '\r') { state = State.TEXT; } else { String hex2 = String.format("%02X", ch); ch = hex2.charAt(0); nextHexDigit = hex2.charAt(1); } break; } } return ch; } } As one binary byte results in two hexadecimal digits, you need to buffer a nextHexDigit for the next digit. I did not override available (to account for a possible nextHexDigit). If you want to check whether \r\n follows, one should use a PushBackReader. I did use an InputStream, as you did not specify the encoding.

http://stackoverflow.com/comment/41161989
type: Comment
comment on: http://stackoverflow.com/a/26239528
score: 0
type: AnswerComment
has text: What I am trying to do is exactly what they describe here in "4. Real world usage" http://www.cowtowncoder.com/blog/archives/2012/04/entry_471.html

http://stackoverflow.com/q/26205399
type: UnansweredQuestion
score: -3
has body: I understand that arrays are used to store values but when they are used with for loops I loose track of what is happening. I know that the output is 100 because I ran it in the terminal but what I need to understand is that how did it get 100 from using the for loops and the arrays because I'm not sure if it uses all three values or just the first one. Thanks in advance Here is the problem: public class arrays { public static void main (String[] args) { int[] a1 = {1, 1, 3}; mystery(a1); } public static void mystery(int[] a) { for (int i = 1; i &lt; a.length - 1; i++) { a[i] = (a[i - 1] + a[i + 1]) /2; } } }
answer count: 4
has answer: http://stackoverflow.com/a/26205884
has comment: http://stackoverflow.com/comment/41093950
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26205612
has title: How exactly do arrays and for loops work together?
tagged with: loops
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/26205445
has answer: http://stackoverflow.com/a/26205794
tagged with: for-loop
upvote count: 0
favorite count: 0

http://stackoverflow.com/comment/41153402
has text: Is it a unique thread, or are there others like it? If there are others like it, then maybe you could compare the total memory usage vs. the total memory usage when running with one less thread.
comment on: http://stackoverflow.com/a/26233845
type: AnswerComment
type: Comment
score: 1

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/26321808
tags question: http://stackoverflow.com/q/26269658
type: Tag
tags question: http://stackoverflow.com/q/26229140

http://stackoverflow.com/comment/41082537
score: 0
type: Comment
type: QuestionComment
has text: In which case, I must say that you are probably using the wrong language. Java does a lot of things on the back end that will not be within your control (legally) to change. I will do a little more research so I can give you a definitive answer, but my guess is, there is no way to do what you are asking...
comment on: http://stackoverflow.com/q/26199008

http://stackoverflow.com/q/26299466
has comment: http://stackoverflow.com/comment/51813635
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/26299641
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41329058
linked to: http://stackoverflow.com/q/31794431
tagged with: spring
has title: How to get more than 20 friends in Spring Social Twitter?
score: 2
tagged with: java
tagged with: twitter
type: Question
has comment: http://stackoverflow.com/comment/41268123
answer count: 2
has comment: http://stackoverflow.com/comment/41268022
downvote count: 0
tagged with: spring-social-twitter
has body: I am using Spring Social Twitter to retrieve a friend's name of a user. Here is my code. @Controller @RequestMapping("/") public class HelloController { private Twitter twitter; private ConnectionRepository connectionRepository; @Inject public HelloController(Twitter twitter, ConnectionRepository connectionRepository) { this.twitter = twitter; this.connectionRepository = connectionRepository; } @RequestMapping(method=RequestMethod.GET) public String helloTwitter(Model model) { if (connectionRepository.findPrimaryConnection(Twitter.class) == null) { return "redirect:/connect/twitter"; } model.addAttribute(twitter.userOperations().getUserProfile()); CursoredList&lt;TwitterProfile&gt; friends = twitter.friendOperations().getFriends(); model.addAttribute("friends", friends); for ( TwitterProfile frnd : friends) { System.out.println(frnd.getName()); } return "hello"; } } But it retrieves only 20 friends. How could I get all the friends? (Say if I have 1000 friends)
has answer: http://stackoverflow.com/a/37124954
tagged with: spring-social
has comment: http://stackoverflow.com/comment/41267885

http://stackoverflow.com/a/27611984
downvote count: 0
score: 1
has body: TypeTools, or any generic type resolution in Java, always required that the type arguments be captured in a type definition. What you're attempting to do will work fine so long as MapperImpl is subclassed so that the value of T and S are captured in a type definition. Ex: public class FooMapper extends MapperImpl&lt;Foo, ArrayList&lt;String, Object&gt;&gt; {}
upvote count: 1
answers question: http://stackoverflow.com/q/26222214
type: Answer

http://stackoverflow.com/q/26295682
has title: Spring 3 different input binding on tomcat 7 and tomcat 8
type: Question
has comment: http://stackoverflow.com/comment/41260876
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41260897
linked to: http://stackoverflow.com/q/8809098
has body: I have got simple form (this is the renderend form with values) &lt;form&gt; &lt;input id="addrId" type="hidden" value="1,173"/&gt; &lt;/form&gt; backed by object like this public class FormObject { BigDecimal addrId; //getters and setters } On tomcat 7 (debian stable) submitting this form raises an error because Spring doesn't resolve value 1,173 as BigDecimal value. On Tomcat 6 and on Tomcat 8 ( on different server ) this works normally. Can I force Spring to render value without the group separator ? Or this may be caused by container or host, JDK setting?
has comment: http://stackoverflow.com/comment/41260963
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/41262072
tagged with: spring
tagged with: spring-mvc
tagged with: java

http://stackoverflow.com/comment/41216266
comment on: http://stackoverflow.com/q/26270950
score: 0
type: Comment
type: QuestionComment
has text: Part of a [Strategy](https://en.wikipedia.org/wiki/Strategy_pattern) or maybe [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection)?

http://stackoverflow.com/comment/41335035
score: 0
comment on: http://stackoverflow.com/a/26335476
type: AnswerComment
type: Comment
has text: TY for response but the problem is that I am taking data from database which are stored as .gif file.

http://stackoverflow.com/comment/41173381
type: Comment
comment on: http://stackoverflow.com/q/26247562
score: 0
has text: ... And? Is there a question here?
type: QuestionComment

http://stackoverflow.com/comment/41200797
comment on: http://stackoverflow.com/q/26252703
has text: @Tensibai Language isn't mandatory, but preferable, because I have worked with both of these languages.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26272078
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41217932
has body: I'm automating a web application. For that automation writing code in JAVA in Eclipse. I have the XML as follows: <?xml version="1.0"?> https://XXX XX XX <id_r>reports</id_r> <id_e>extranet</id_e> <id_pr>ext-pr</id_pr> <id_1>ext-pr-backlog-age</id_1> <id_2>ext-timetoassign-prs</id_2> <id_3>ext-timetodeliver-prs</id_3> <id_4>ext-timetoresolve-prs</id_4> <id_5>ext-new-prs</id_5> But My problem in the code is Log.info("Clicking on Reports link"); if(existsElement("id_r")==true){ String id_r = a.readXML("kpi","id_r"); System.out.println(id_r); WebElement menuHoverLink = driver.findElement(By.id(id_r)); System.out.println(id_r); actions.moveToElement(menuHoverLink).perform(); Thread.sleep(6000); } else{ Log.info("element not present"); System.out.println("element not present -- so it entered the else loop"); } It is not reading the KPI part from the XML and it it is not clicking in the browser application. If i put these two lines String id_r = a.readXML("kpi","id_r"); System.out.println(id_r); Outside the If part it is reading from the XML and printing but My case it should read and it should click in the browser application.
answer count: 0
has title: How to read the values from the xml using Java?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41217936
downvote count: 0
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
has comment: http://stackoverflow.com/comment/41218047

http://stackoverflow.com/comment/41301211
has text: What a great answer thanks so much! So likely the error I was getting was caused by the values I was passing to the offset pushing the buffer position too far forward? Also, I noticed you allocated 10 to the FloatBuffer which makes perfect sense. The value I used was taken from
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26317407

http://stackoverflow.com/q/26306568
has answer: http://stackoverflow.com/a/26306663
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/26306641
has title: Undefined Variable for my calculator
type: Question
has comment: http://stackoverflow.com/comment/41281021
has answer: http://stackoverflow.com/a/26306658
tagged with: variables
has answer: http://stackoverflow.com/a/26306649
score: 0
upvote count: 1
has body: import java.util.Scanner; public class SolverTester { public static void main(String[] args) { String symbolSubtract; String symbolMultiply; String symbolAddition; String symbolDivide; Scanner sc = new Scanner(System.in); System.out.println("Enter your equation: "); int numberFirst = sc.nextInt(); if(sc.findInLine("-").equals("-")) { symbolSubtract = sc.findInLine("-"); } else if(sc.findInLine("*").equals("*")) { symbolMultiply = sc.findInLine("*"); } else if(sc.findInLine("+").equals("+")) { symbolAddition = sc.findInLine("+"); } else if(sc.findInLine("/").equals("/")) { symbolDivide = sc.findInLine("/"); } int numberSecond = sc.nextInt(); Solver s = new Solver(numberFirst, numberSecond); if(symbolSubtract.equals("-")) { s.subtraction(); System.out.println(s.getAnswer()); } else if(symbolMultiply.equals("*")) { s.multiplication(); System.out.println(s.getAnswer()); } else if(symbolDivide.equals("/")) { s.division(); System.out.println(s.getAnswer()); } else if(symbolAddition.equals("+")) { s.addition(); System.out.println(s.getAnswer()); } } } My error is "variable "symbolSubtract" has not been initialized". The main class is not relevant because the error is involving local variables. NOTE: This is not a homework assignment... I am just doing it for fun.
downvote count: 1
has comment: http://stackoverflow.com/comment/41281029
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41281056

http://stackoverflow.com/comment/41322732
type: Comment
comment on: http://stackoverflow.com/q/26329370
type: QuestionComment
has text: Don't edit your question like that. It makes the answers obsolete. If you're having other problems, ask another question or make your edits below the existing code with issues.
score: 2

http://stackoverflow.com/comment/41203238
type: QuestionComment
has text: First suggestion would be to use a up-to-date version of [rpm-maven-plugin](http://mojo.codehaus.org/rpm-maven-plugin/). Furhtermore why not creating RPM's on the appropriate platforms (like Linux) instead of Windows 7.
comment on: http://stackoverflow.com/q/26253926
score: 0
type: Comment

http://stackoverflow.com/a/26197253
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26197034
answers question: http://stackoverflow.com/q/26197034
upvote count: 1
type: AcceptedAnswer
has body: There is no way to do this in Java as proposed - Java does not supported algebraic data types. Java Generic type restrictions must unify to a single type just as expressions in Java must unify to a single type - eg. it is invalid for the same reason as trying to use1: {ArrayList | HashSet} collection = ..; However, since they both these types unify at Collection then the following is valid: Collection collection = createArrayListOrHashSetAndReturnACollection(); Now, depending on need there are two general ways in which is task may be handled, both going back to the above limitations: The types in question can extend (or better, inherit) from a common type and can then unify around that type. This may involve modification of the types in question as required. A different type (backed by an interface, probably using composition) can be created that acts as a proxy for the Thing/SomethingElse types. The generic restriction now unifies on this new type/interface. Remove the type restriction and unify around Object; this is the least refined unification of every non-primitive type in Java. 1 While this is not a restriction of "OOP", generics/templates, or static type-systems in general, this is how Java works: nope, can't do that.

http://stackoverflow.com/q/26208601
has title: Calendar returns wrong month and year Java
downvote count: 3
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/41100109
has body: Calendar now = null; now.getInstance(); System.out.println(now.getInstance()); System.out.println(now.ERA); System.out.println(now.YEAR); System.out.println(now.MONTH); System.out.println(now.WEEK_OF_YEAR); System.out.println(now.WEEK_OF_MONTH); System.out.println(now.DAY_OF_MONTH); System.out.println(now.DAY_OF_YEAR); System.out.println(now.DAY_OF_WEEK); System.out.println(now.DAY_OF_WEEK_IN_MONTH); Program outputs (important information is in caps and on the new line): java.util.GregorianCalendar[time=1412554865330,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2014,MONTH=9,WEEK_OF_YEAR=41,WEEK_OF_MONTH=2,DAY_OF_MONTH=5,DAY_OF_YEAR=278,DAY_OF_WEEK=1,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=5,HOUR_OF_DAY=17,MINUTE=21,SECOND=5,MILLISECOND=330,ZONE_OFFSET=-28800000,DST_OFFSET=3600000] 0 1 2 3 4 5 6 7 8 (0-8 are on new lines) I'm really loss here and am not sure why java decided play this awful prank on me.
tagged with: java
score: -1
tagged with: date
has answer: http://stackoverflow.com/a/26208942
answer count: 3
accepted answer: http://stackoverflow.com/a/26208636
linked to: http://stackoverflow.com/q/4978000
favorite count: 0
has answer: http://stackoverflow.com/a/26209245
has answer: http://stackoverflow.com/a/26208636
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26208942
upvote count: 2
has comment: http://stackoverflow.com/comment/41100141

http://stackoverflow.com/comment/41315160
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26325201
has text: Where's [Blaise Doughan](http://www.bdoughan.com/#my-linkedin) when you need him?

inheritance
tags question: http://stackoverflow.com/q/26279674
tags question: http://stackoverflow.com/q/26285305
tags question: http://stackoverflow.com/q/26236683
tags question: http://stackoverflow.com/q/26282385
tags question: http://stackoverflow.com/q/26319629
tags question: http://stackoverflow.com/q/26212415
tags question: http://stackoverflow.com/q/26323492
tags question: http://stackoverflow.com/q/26347467
tag name: inheritance
tags question: http://stackoverflow.com/q/26280873
tags question: http://stackoverflow.com/q/26206190
tags question: http://stackoverflow.com/q/26288566
tags question: http://stackoverflow.com/q/26326545
tags question: http://stackoverflow.com/q/26196524
tags question: http://stackoverflow.com/q/26341527
tags question: http://stackoverflow.com/q/26274532
tags question: http://stackoverflow.com/q/26263482
tags question: http://stackoverflow.com/q/26303692
tags question: http://stackoverflow.com/q/26201407
tags question: http://stackoverflow.com/q/26302471
tags question: http://stackoverflow.com/q/26319021
type: Tag
tags question: http://stackoverflow.com/q/26261480
tags question: http://stackoverflow.com/q/26196444
tags question: http://stackoverflow.com/q/26290647
tags question: http://stackoverflow.com/q/26287557
tags question: http://stackoverflow.com/q/26241106
tags question: http://stackoverflow.com/q/26332999
tags question: http://stackoverflow.com/q/26274844
tags question: http://stackoverflow.com/q/26263054
tags question: http://stackoverflow.com/q/26195553
tags question: http://stackoverflow.com/q/26238760
tags question: http://stackoverflow.com/q/26202179
tags question: http://stackoverflow.com/q/26216812
tags question: http://stackoverflow.com/q/26274632
tags question: http://stackoverflow.com/q/26220799

http://stackoverflow.com/q/26228395
possible better answer: http://stackoverflow.com/a/26228479
score: -2
has comment: http://stackoverflow.com/comment/41137774
has answer: http://stackoverflow.com/a/26228529
has comment: http://stackoverflow.com/comment/41137808
has answer: http://stackoverflow.com/a/26228409
has title: How can I get the first three digits and compare for output?
answer count: 3
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41137907
has comment: http://stackoverflow.com/comment/41137898
has answer: http://stackoverflow.com/a/26228479
type: AnsweredQuestion
tagged with: java
downvote count: 2
tagged with: switch-statement
type: Question
accepted answer: http://stackoverflow.com/a/26228409
has body: The code is running, the problem is I can not get an exact output. I want to get the person's phone number and take the first three digits, and compare this with the exact telco. So far I got this: import java.util.Scanner; public class lab03_ex03 { public static void main(String args[]) { int number; int n=3; Scanner input=new Scanner(System.in); System.out.print("Please enter your phone number: "); number=input.nextInt(); int b=Integer.parseInt((""+number).substring(0,n)); if(b==013) { String me="TM"; } switch(me) { case "TM": System.out.println("Answer: The phone number is a TM number."); break; case "Celcom": System.out.println("Answer: The phone number is a Celcom number."); break; case "DiGi": System.out.println("Answer: The phone number is a DiGi number."); break; case "Maxis": System.out.println("Answer: The phone number is a Maxis number."); break; // default: // System.out.println("Its look like unvalid number :( . Please check again"); } } } In this example, if the person inputs 013456789, then it will only take 013 and will say it is a DIGI number. But when I try to do it, it shows nothing. What am I doing wrong?

http://stackoverflow.com/comment/41081799
type: QuestionComment
comment on: http://stackoverflow.com/q/26198564
has text: Just wondering. Can you make folder-a read only for a certain amount of time and then make it rw ?
score: 0
type: Comment

http://stackoverflow.com/a/26274707
has comment: http://stackoverflow.com/comment/41222457
answers question: http://stackoverflow.com/q/26274632
has comment: http://stackoverflow.com/comment/41222495
has comment: http://stackoverflow.com/comment/41222381
score: 4
has comment: http://stackoverflow.com/comment/41222555
has comment: http://stackoverflow.com/comment/41222428
has comment: http://stackoverflow.com/comment/41222243
has comment: http://stackoverflow.com/comment/41222293
has comment: http://stackoverflow.com/comment/41222606
has comment: http://stackoverflow.com/comment/41222515
has comment: http://stackoverflow.com/comment/41222336
has comment: http://stackoverflow.com/comment/41222288
has body: What you are trying to do is impossible: you cannot re-initialize super. However there are alternatives (assuming you cannot modify getNewBaby): Enclose your down-casting in a try / catch statement and catch a ClassCastException Use instanceof to check on the actual type, whether it's Animal, Dog, Cat, etc. and base your logic on that Best choice declare methods in Animal that can be overridden on all child classes, thus de-coupling implementation Edit Here are a couple of additional topics - a bit off/broad, but might help you with your design. Java inheritance and casting The factory pattern in Java Java generics
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/41222405
downvote count: 0

http://stackoverflow.com/a/33946927
has body: Here is another way to do it with the things that appeared in Java 8: private void countWords(final Path file) throws IOException { Arrays.stream(new String(Files.readAllBytes(file), StandardCharsets.UTF_8).split("\\W+")) .collect(Collectors.groupingBy(Function.&lt;String&gt;identity(), TreeMap::new, counting())).entrySet() .forEach(System.out::println); } So what is it doing? It reads a text file completely into memory, into a byte array to be more precise: Files.readAllBytes(file). This method turned up in Java 7 and allows methods of loading files very fast, however for the price that the file will be completely in memory, costing a lot of memory. For speed however this is a good appraoch. The byte[] is converted to a String: new String(Files.readAllBytes(file), StandardCharsets.UTF_8) while assuming that the file is UTF8 encoded. Change at your own need. The price is a full memory copy of the already huge piece of data in memory. It may be faster to work with a memory mapped file instead. The string is split at non-Word charcaters: ...split("\\W+") which creates an array of strings with all your words. We create a stream from that array: Arrays.stream(...). This by itself does not do very much, but we can do a lot of fun things with the stream We group all the words together: Collectors.groupingBy(Function.&lt;String&gt;identity(), TreeMap::new, counting()). This means: We want to group the words by the word themselves (identity()). We could also e.g. lowercase the string here first if you want grouping to be case insensitive. This will end up to be the key in a map. As a result for storng the grouped values we want a TreeMap (TreeMap::new). TreeMaps are sorted by their key, so we can easily output in alphabetical order in the end. If you do not need sorting you could also use a HashMap here. As value for each group we want to have the number of occurances of each word (counting()). In background that means that for each word we add to a group we increase the co…
type: Answer
upvote count: 7
has comment: http://stackoverflow.com/comment/55658723
score: 7
downvote count: 0
answers question: http://stackoverflow.com/q/26282009
has comment: http://stackoverflow.com/comment/55724167

http://stackoverflow.com/a/26303092
accepted answer of: http://stackoverflow.com/q/26300828
has body: That specific sentence of the book seems to be incorrect. The Java Language Specification has more reasonable clause explaining this issue (which I think is the part referred by the book). When interfaces are involved, more than one method declaration may be overridden by a single overriding declaration. In this case, the overriding declaration must have a throws clause that is compatible with all the overridden declarations (§9.4.1). So in this case, one that is compatible with both declarations would be @Override public void x() { } In both declarations had common exceptions they could have included in the declaration. interface I1 { public void x() throws I1Exception, I2Exception; } interface I2 { public void x() throws I2Exception; } then @Override public void x() throws I2Exception { } Or alternatively in your example, if you had something like class I1Exception extends I2Exception { } class I2Exception extends Exception { } Then a compatible method declaration could be written as @Override public void x() throws I1Exception { }
answers question: http://stackoverflow.com/q/26300828
downvote count: 0
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/q/26258715
has body: I wonder if this is a somewhat awkward way of thinking, but I couldn't really find any hint on the internet to my idea. Maybe I just did not phrase my question right, but anyhow, this is what I would like to do: I have a complex application written in java with spring and quartz and a whole load of dependencies. The application is run inside an apache tomcat servlet container. Now I know, I can create a war file and deploy that to the productive server machine (after our internal IT has installed and configured the tomcat on that machine), but I would like to do this a bit different. I would like maven to create a pre-packaged tomcat application server with all dependencies and configuration settings AND my application. In effect, all that would need to be done on the productive system is, copy the package (or zip or tar.gz or whatever is needed) to the server, unpack it in a directory of my or their choice and fire up this local isolated tomcat. It would only run my application (which poses enough load on the machine anyway) and I could even go so far and deploy a second variant, say for a different customer in the directory next to the first one. Neither of both could interfere with each other, even if they use different versions with different dependencies. Is it possible to do that? Is it a desirable approach or am I on the completely wrong track here? What I think would be a benefit of this approach (despite the thing with incompatible dependencies or settings between two or more different installations) is, that I can hand the whole package over to our administration guys and they can simply deploy it to a server without the need to configure anything in the tomcat after installing it and so on. Any hint???
upvote count: 3
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: installation-package
has title: java maven how to create app with bundled tomcat
score: 3
tagged with: java
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/10393404
answer count: 1
has answer: http://stackoverflow.com/a/26272016
has comment: http://stackoverflow.com/comment/41203023
tagged with: tomcat

http://stackoverflow.com/a/26215276
score: 4
has comment: http://stackoverflow.com/comment/41115695
answers question: http://stackoverflow.com/q/26215086
type: Answer
upvote count: 4
downvote count: 0
has body: If all you want is a grid of images, and having them selectable, consider using a JList, filling it with appropriate ImageIcons, and giving it a ListSelectionListener. In the Listener you can close the enclosing dialog when a selection has been made. You state: Try and implement myJList.setModel(), but i cant get it to just take my Map&lt;> and show thumbnails. (overcomplicates!) You need to use your Map to populate your ListModel, and set that Model to the JList's model. For example: import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dialog.ModalityType; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @SuppressWarnings("serial") public class ImageGridPanel extends JPanel { public static final String PATH = "http://images-2.drive.com.au/2011/"; public static final String[] CARS = { "04/15/2308961/giulietta_1024-80x80.jpg", "11/18/2781958/audi-a1-sportback_600-80x80.jpg", "12/23/2856762/fiat-500-80x80.jpg", "01/12/2129944/Honda-Civic-Sedan-concept-1_600-80x80.jpg", "12/23/2856581/mini-roadster-80x80.jpg", "12/23/2856571/hyundai-veloster-80x80.jpg", "12/23/2856771/hyundai-i30-80x80.jpg", "12/23/2856580/mini-coupe-80x80.jpg" }; private DefaultListModel&lt;Car&gt; carModel = new DefaultListModel&lt;&gt;(); final JTextField textField = new JTextField(20); public ImageGridPanel() { for (String carPath : CARS) { String path = PATH + carPath; try { URL imgUrl = new URL(path); BufferedImage img = ImageIO.read(imgUrl); ImageIcon icon = new ImageIcon(img); String name = carPath.substring(carPath.lastIndexOf("/")); name = name.substring(1, name.lastIndexOf("-")); carModel.addElement(new Car(name, icon)); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } } ShowGridAction showAction = new ShowGridAction("…

http://stackoverflow.com/a/26225803
answers question: http://stackoverflow.com/q/26210298
accepted answer of: http://stackoverflow.com/q/26210298
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/51709115
type: Answer
has body: I personally have no experience using Hadoop, however if you "look" at the stack trace it appears to be a runtime Exception in org.apache.hadoop.util.ReflectionUtils.setJobConf... private static void setJobConf(Object theObject, Configuration conf) { 75 //If JobConf and JobConfigurable are in classpath, AND 76 //theObject is of type JobConfigurable AND 77 //conf is of type JobConf then 78 //invoke configure on theObject 79 try { 80 Class&lt;?&gt; jobConfClass = 81 conf.getClassByName("org.apache.hadoop.mapred.JobConf"); 82 Class&lt;?&gt; jobConfigurableClass = 83 conf.getClassByName("org.apache.hadoop.mapred.JobConfigurable"); 84 if (jobConfClass.isAssignableFrom(conf.getClass()) &amp;&amp; 85 jobConfigurableClass.isAssignableFrom(theObject.getClass())) { 86 Method configureMethod = 87 jobConfigurableClass.getMethod("configure", jobConfClass); 88 configureMethod.invoke(theObject, conf); 89 } 90 } catch (ClassNotFoundException e) { 91 //JobConf/JobConfigurable not in classpath. no need to configure 92 } catch (Exception e) { 93 throw new RuntimeException("Error in configuring object", e); 94 } 95 } Clearly, both JobConf and JobConfigurable classes are in the classpath (otherwise it would have fallen thru the CNFE catch block) so another Exception has occurred... it appears as though the nested exception is java.lang.reflect.InvocationTargetException which suggests there was a problem with the 'invoke' at line 88 above. So, trying to invoke the 'configure' method on the target job instance with the config passed in is failing. The InvocationTargetException has probably wrappered the actual causal exception so you need to somehow catch the RuntimeException at the top level then e.getCause().getCause().printStackTrace() to find out why the invocation of the configure method failed.
downvote count: 0
score: 1

http://stackoverflow.com/q/26305033
tagged with: glassfish
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26305159
has body: Here is the problem. I get the sessionId with: request.getRequestedSessionId(); However when site is opening first time it returns null. Only starting with second visit it returns session id. But I need to know from first time. Can I get it?
has answer: http://stackoverflow.com/a/26305159
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jakarta-ee
has title: GlassFish session id when first time site is loading
tagged with: session

http://stackoverflow.com/a/26239703
has body: When you say: As per my understanding, when thread one is started it acquires a lock on the push method. that is not quite right, in that the lock isn't just on the push method. The lock that the push method uses is on the instance of MyStack2 that push is called on. The methods pop and toString use the same lock as push. When a thread calls any of these methods on an object, it has to wait until it can acquire the lock. A thread in the middle of calling push will block another thread from calling pop. The threads are calling different methods to access the same data structure, using the same lock for all the methods that access the structure prevents the threads from accessing the data structure concurrently. Once a thread gives up the lock on exiting a synchronized method the scheduler decides which thread gets the lock next. Your threads are acquiring locks and letting them go multiple times, every time a lock is released there is a decision for the scheduler to make. You can't make any assumptions about which will get picked, it can be any of them. Output from multiple threads is typically jumbled up.
upvote count: 2
has comment: http://stackoverflow.com/comment/41164858
has comment: http://stackoverflow.com/comment/41164777
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26237662
downvote count: 0

http://stackoverflow.com/a/26315302
score: 1
has body: Example: int number1 = 1; int number2 = 2; if (number1 % 2 == 0) { // You won't get here } if (number2 % 2 == 0) { // You will get here } The "%" is called modulo, and it returns the remaining of the division. 3 % 2, the remaining of 3/2 is 1, so you know it's odd 4 % 2, the remaining of 4/2 is 0, so you know it's even
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26315283
downvote count: 0

http://stackoverflow.com/a/26238466
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41155932
has comment: http://stackoverflow.com/comment/41156036
has comment: http://stackoverflow.com/comment/41157159
has body: There is no problem with your code, i tested it and it's working fine. You probably have a conflicting Thread class, if there are any classes called Thread in your project remove or rename them, and try again.
answers question: http://stackoverflow.com/q/26238275
downvote count: 0
has comment: http://stackoverflow.com/comment/41156063
has comment: http://stackoverflow.com/comment/41156131
type: Answer

http://stackoverflow.com/comment/41315171
type: AnswerComment
comment on: http://stackoverflow.com/a/26324822
has text: Put the GridLayout in a JPanel, and put the JPanel in a ScrollPanel
type: Comment
score: 1

rjdbc
tags question: http://stackoverflow.com/q/26327475
type: Tag
tag name: rjdbc

http://stackoverflow.com/a/26331295
has body: Assuming these methods are public, then in Java 8, you should be able to use a functional interface (in this trivial example it would be a java.util.function.IntSupplier) and pass a reference to these methods as a lambda expression. Something like (compilation not tested): public int[] getMyValues(IntSupplier supplier) { int[] values = new int[10]; for (int i = 0; i &lt; 10; i++) { int[i] = supplier.getAsInt() } return values; } Called using: int[] values = someobject.getMyValues(someobject::getValues1) This is more or less using those methods as strategies without the need to make an actual interface and multiple implementations: the strategy interface is the functional interface itself and the method references generate the implementation. EDIT: if you can't use Java 8, then you can just define your own interface with just 1 method that returns the int. The calling just becomes longer because of the lack of support for method references: int[] values = someobject.getMyValues(new MyIntProducer() { public int getValue() { return someobject.getValues1(); }; } Note that the someobject local variable will need to be made final for this to work.
has comment: http://stackoverflow.com/comment/41371316
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/41352714
upvote count: 3
answers question: http://stackoverflow.com/q/26331153
downvote count: 0
has comment: http://stackoverflow.com/comment/41326407

http://stackoverflow.com/comment/41136178
comment on: http://stackoverflow.com/a/26227419
has text: Thank you I will definitely take this into consideration, I'll have to learn ProcessBuilder but I'm sure that it isn't the worst thing in the world or the hardest thing to learn. Again thank you for your answer
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/26337801
downvote count: 0
score: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/41338886
type: AnsweredQuestion
tagged with: java
has body: I am working with FlowLayout Manager in my JPanel. I have many Label and TextField/JComboBox combinations. like When JPanel is resized I have set FlowLayout on my JPanel and whenever the panel is resized then instead of taking components one by one to next row, I want it to take my Label+Textfield together to next row. Is it possible to make of group or something like that so my each Label+Textfield are considered as single component and when the panel is resized both of these Components come down together. One way I know is that put my every label+textfield in every seperate JPanel and then putting these JPanels in my main FlowLayout JPanel but then I will have to do alot of work therefore wanted to know if there is some option in java for this?
type: Question
has title: Group 2 components in FlowLayout in Java
upvote count: 1
tagged with: layout
answer count: 1
has comment: http://stackoverflow.com/comment/41338685
tagged with: layout-manager
favorite count: 0
accepted answer: http://stackoverflow.com/a/26338615
linked to: http://stackoverflow.com/q/21658144
has answer: http://stackoverflow.com/a/26338615

http://stackoverflow.com/a/26335830
has body: stringToReplace.replaceAll("Universit[^a]", "Universita")
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26335747

http://stackoverflow.com/comment/41279942
type: Comment
has text: You're going to have to read all 3 files regardless. Is your issue with how to relate all 3 files together?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26305927

undertow
type: Tag
tag name: undertow
tags question: http://stackoverflow.com/q/26260032
tags question: http://stackoverflow.com/q/26203748

http://stackoverflow.com/a/26230026
has body: You can split the string by the character &amp; to get the parameters, and split each parameter with the = to get the parameter name and parameter value. And now look for the parameter name "sectionId", and cut the first 2 characters of its value to get the number, and you can use Integer.parseInt() if you need it as an int. Note that this solution is flexible enough to process all parameters, not just the one you're currently interested in: String s = "chapterId=c_1&amp;sectionId=s_24666&amp;isHL=1&amp;cssFileName=haynes"; String[] params = s.split("&amp;"); for (String param : params) { String[] nameValue = param.split("="); if ("sectionId".equals(nameValue[0])) { int number = Integer.parseInt(nameValue[1].substring(2)); System.out.println(number); // Prints 24666 // If you don't care about other parameters, this will skip the rest: break; } } Note: You might want to put Integer.parseInt() into a try-catch block in case an invalid number would be passed from the client: try { int number = Integer.parseInt(nameValue[1].substring(2)); } catch (Exception e) { // Invalid parameter value, not the expected format! }
downvote count: 0
answers question: http://stackoverflow.com/q/26229857
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/26253209
has comment: http://stackoverflow.com/comment/41185403
type: Answer
has comment: http://stackoverflow.com/comment/41183887
has comment: http://stackoverflow.com/comment/41185334
has comment: http://stackoverflow.com/comment/41185413
has comment: http://stackoverflow.com/comment/41244231
answers question: http://stackoverflow.com/q/26249944
score: 0
has comment: http://stackoverflow.com/comment/41186734
has body: Here is the working solution. Thanks to the inputs from MadProgrammer. had to add a PropertyChangeSupport to keep check on when the inProgress Property has changed. package progressbarPoc; import java.awt.DisplayMode; import java.awt.GridBagLayout; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import javax.swing.JFrame; import javax.swing.JProgressBar; public class MainFrame extends JFrame{ public PropertyChangeSupport propertChangeSupport; public boolean inProgress; private JProgressBar bar; public Communicator diplayFacade; private PropertyChangeListener listener; public MainFrame() { this.setSize(500, 500); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diplayFacade = new Communicator(); diplayFacade.frame = this; bar = new JProgressBar(); setLayout(new GridBagLayout()); add(bar); addProgressListener(); propertChangeSupport = new PropertyChangeSupport(this); addListener(); bar.addPropertyChangeListener(listener); this.addPropertyChangeListener(listener); } public void addPropertyChangeListener(PropertyChangeListener listener) { this.propertChangeSupport.addPropertyChangeListener(listener); } public void fireProperty(boolean oldValue , boolean newValue){ this.propertChangeSupport.firePropertyChange("inProgress", oldValue, newValue); } public void addProgressListener(){ System.out.println("Here"); } public static void main(String[] args) { MainFrame frame = new MainFrame(); frame.diplayFacade.methodCalled(); } public void addListener(){ listener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { addPropertyChangeListener(this); if(true == inProgress){ System.out.println("Property change check none" + true); bar.setIndeterminate(true); } else if(false ==inProgress){ System.out.println("Property change check none" + false); bar.setIndeterminate(false); } } }; } } And the Communicator class package progressbarPoc; impor…
has comment: http://stackoverflow.com/comment/41185648

javabeans
tags question: http://stackoverflow.com/q/26210390
tags question: http://stackoverflow.com/q/26296313
tags question: http://stackoverflow.com/q/26256948
tags question: http://stackoverflow.com/q/26248857
tags question: http://stackoverflow.com/q/26312211
type: Tag
tags question: http://stackoverflow.com/q/26310859
tags question: http://stackoverflow.com/q/26211612
tags question: http://stackoverflow.com/q/26219099
tag name: javabeans
tags question: http://stackoverflow.com/q/26201797

http://stackoverflow.com/comment/41340928
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26339237
score: 0
has text: Please *cite* a place where four classes are used to support the case against diamond inheritance. At the moment your question is based on unsupported assertion.

http://stackoverflow.com/q/26213813
has comment: http://stackoverflow.com/comment/41111392
has answer: http://stackoverflow.com/a/26214854
has comment: http://stackoverflow.com/comment/41109679
has comment: http://stackoverflow.com/comment/41109747
type: Question
tagged with: java
has title: PostgreSQL MAX aggregate function applied to strings and Java resultset
score: 0
tagged with: max
answer count: 1
tagged with: string
has body: I have a PostgreSQL table "t" with a column "c" which type is "character varying(32)". Values in this column look like this: "2014100605". I am using the "MAX()" aggregate function to retrieve the maximum value in this column. SELECT MAX(c) AS max FROM t; In Java, if I prepare the query above, get a "resultSet" object and send it the getString("max") message, I get max = null. If I send it the getInt("max") method instead, I get the result I'm expecting, something like "2014100605". Is this normal behavior? Am I really allowed to do this or am I getting the expected result randomly? Is "MAX()" actually using the lexicographical order? A bit of Java code: s_preparedSqlQuery = "SELECT MAX(quotinv_nro) AS quotinv_nro_max " + "FROM imw_quotation_invoice " + "WHERE quotinv_type = ? " + "AND quotinv_nro LIKE '" + s_quotinvDate + "%'"; preparedStatement = m_connection.prepareStatement(s_preparedSqlQuery); preparedStatement.setString(1, s_quotinvType); resultSet = preparedStatement.executeQuery(); if(resultSet != null) { if(resultSet.next()) { // s_quotinvNroMax = resultSet.getString("quotinv_nro_max"); n_quotinvNroMax = resultSet.getInt("quotinv_nro_max"); // if(s_quotinvNroMax == null) if(n_quotinvNroMax == 0) { n_nbQuotinvsThisSameDate = 0; return n_nbQuotinvsThisSameDate; } else { s_quotinvNroMax = Integer.toString(n_quotinvNroMax); n_length = s_quotinvDate.length(); s_currentMaxNro = s_quotinvNroMax.substring(n_length - 1); n_nbQuotinvsThisSameDate = Integer.valueOf(s_currentMaxNro); } } }
has comment: http://stackoverflow.com/comment/41111407
tagged with: postgresql
has comment: http://stackoverflow.com/comment/41111433
type: UnansweredQuestion
tagged with: aggregate-functions
has comment: http://stackoverflow.com/comment/41115859
has comment: http://stackoverflow.com/comment/41112278
has comment: http://stackoverflow.com/comment/41111550

http://stackoverflow.com/comment/41270167
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26300711
has text: What exactly do you think is bad approach? Maybe share links to that docs you are mentioning.

http://stackoverflow.com/comment/41152872
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26236763
has text: That is not *changing* the number of arguments, that is *adding* another method with a different number of arguments.
type: AnswerComment

http://stackoverflow.com/a/26238488
has body: As pointed out by Dmitry Bychenko in the comments, parameters are passed via the constructor, When the construction of an object depends upon those mandatory parameters. The other parameters are generally set once the object has been constructed. Take the example of the constructor of the File class, File f = new File("filepath"); Here filepath is a parameter without which a File object cannot be constructed, since it needs to refer to a location where the file resides. And its attributes such as readable, can be set through the setters, and come into picture only after the file reference has been constructed successfully. f.setReadable(arg0) Since in your example, the Photo class doesn't depend upon any of its parameter values for its construction, a parameterized constructor is not necessary.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26238381
score: 2
downvote count: 0

http://stackoverflow.com/a/26230505
answers question: http://stackoverflow.com/q/26230170
type: AcceptedAnswer
has body: Yes, there is MultiFileUploadField, but note that it allows you to select some files only one by one. (open dialog->choose file->press 'open'->open dialog->choose file...). Working example here. Click "source code" link to see...source code. There is also HTML5 solution, which allows you to select multiple files at once. Here it is, the last one. Note that it won't work in html version &lt; 5. And no, you can't fetch parent folder path, because of security issue. (it's not about wicket, this is about web development).
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26230170
upvote count: 2

jitsi
type: Tag
tag name: jitsi
tags question: http://stackoverflow.com/q/26251017

http://stackoverflow.com/comment/41311037
type: Comment
comment on: http://stackoverflow.com/a/26323013
has text: Yes I want Dialog to always be in focus. by `super(parent);` I am getting this feature. I want Dialog box should be always above on frame i.e. I can interact with frame while Dialog box is visible.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26196706
downvote count: 0
type: UnansweredQuestion
has body: I am following a book to learn about java game programming and I got stuck here. The book is called "Beginning Java SE 6 Game Programming, Third Edition" by Jonathan S, Harbour. I need help in this specific part of the code where loading the bitmap image and getting it to load. All I get is a black Screen. I am unclear specifically on the part where it says string filename and .getResource(filename). I am still learning. I got the image of a castle here, http://www.reinerstilesets.de/2d-grafiken/2d-buildings/ and its this one specifically http://www.reinerstilesets.de/thumbs_t/ts%20062.jpg Please help, thank you. And if you can explain it a bit as I really want to learn this. Heres the code, //DrawImage program import java.awt.*; import java.util.*; import javax.swing.*; import java.net.*; public class DrawImage extends JFrame { private Image image; public static void main(String[] args) { new DrawImage(); } public DrawImage() { super("DrawImage"); setSize(600,600); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Toolkit tk = Toolkit.getDefaultToolkit(); image = tk.getImage(getURL("castle.png")); } private URL getURL(String filename){ URL url = null; try{ url = this.getClass().getResource(filename); } catch (Exception e){} return url; } public void paint(Graphics g) { //create an instance of Graphics2D Graphics2D g2d = (Graphics2D) g; //fill the background with black g2d.setColor(Color.BLACK); g2d.fillRect(0, 0, getSize().width, getSize().height); //draw the image g2d.drawImage(image, 0, 40, this); } }
has answer: http://stackoverflow.com/a/26196964
has comment: http://stackoverflow.com/comment/41078774
has comment: http://stackoverflow.com/comment/41078806
score: 1
has comment: http://stackoverflow.com/comment/41078463
has comment: http://stackoverflow.com/comment/41078535
favorite count: 0
has comment: http://stackoverflow.com/comment/41079592
has comment: http://stackoverflow.com/comment/41079612
type: Question
upvote count: 1
has title: How to load and draw images using Java? Programming bitmapped graphics
tagged with: bitmap
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41079056
has comment: http://stackoverflow.com/comment/41078687

http://stackoverflow.com/comment/41256795
type: QuestionComment
has text: Hi Juru, I have combined them all together, can you help me to set it up?
score: 0
comment on: http://stackoverflow.com/q/26293264
type: Comment

http://stackoverflow.com/a/70153082
type: Answer
answers question: http://stackoverflow.com/q/26236045
has body: Check this github repo, I think it does exactly that: https://github.com/spite/ccapture.js/
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/124011782

http://stackoverflow.com/q/26281220
has comment: http://stackoverflow.com/comment/41234845
linked to: http://stackoverflow.com/q/7056749
has title: Scanner nextLine issue in Java
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41234200
accepted answer: http://stackoverflow.com/a/26281554
tagged with: java
has comment: http://stackoverflow.com/comment/41234202
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26281303
has answer: http://stackoverflow.com/a/26281554
downvote count: 0
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/26281303
has comment: http://stackoverflow.com/comment/41234226
tagged with: java.util.scanner
duplicate of: http://stackoverflow.com/q/7056749
has comment: http://stackoverflow.com/comment/41234288
has body: Just one question: why I must type answer = in.nextLine(); twice? If this line is single the program doesn't work as expected. Without second line the program doesn't ask you to enter a string. public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String answer = "Yes"; while (answer.equals("Yes")) { System.out.println("Enter name and rating:"); String name = in.nextLine(); int rating = 0; if (in.hasNextInt()) { rating = in.nextInt(); } else { System.out.println("Error. Exit."); return; } System.out.println("Name: " + name); System.out.println("Rating: " + rating); ECTS ects = new ECTS(); rating = ects.checkRating(rating); System.out.println("Enter \"Yes\" to continue: "); answer = in.nextLine(); answer = in.nextLine(); } System.out.println("Bye!"); in.close(); } }

http://stackoverflow.com/q/26291887
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41254194
has comment: http://stackoverflow.com/comment/41254196
has answer: http://stackoverflow.com/a/26292148
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26291918
has body: i have problem when im trying to show data in list view from my database the error is "FATAL EXCEPTION: main java.lang.ArrayIndexOutOfBoundsException: length=4; index=4" . i dont understand what is it. i hope somebody can help me thanks this is my code public class FragmentMaintain extends Fragment { ListView list; TextView mid; TextView pid; TextView status; TextView description; TextView note; ArrayList&lt;HashMap&lt;String, String&gt;&gt; oslist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); //URL to get JSON Array private static String url = "http://10.0.2.2/skripsi/json/testing.php"; //JSON Node Names private static final String TAG_OS = "maintenance"; private static final String TAG_MID = "mid"; private static final String TAG_PID = "pid"; private static final String TAG_STATUS = "status"; private static final String TAG_DESCRIPTION = "description"; private static final String TAG_NOTE = "note"; JSONArray maintenance = null; Button Addnotedata; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d("ZZZ", "ada di oncreateView maintain"); super.onCreate(savedInstanceState); View rootView = inflater.inflate(R.layout.fragment_maintain, container, false); new JSONParse().execute(); return rootView; } private class JSONParse extends AsyncTask&lt;String, String, JSONObject&gt; { private ProgressDialog pDialog; @Override protected void onPreExecute() { super.onPreExecute(); mid = (TextView) getActivity().findViewById(R.id.mid); pid = (TextView) getActivity().findViewById(R.id.pid); status = (TextView) getActivity().findViewById(R.id.status); description = (TextView) getActivity().findViewById(R.id.description); note = (TextView) getActivity().findViewById(R.id.note); pDialog = new ProgressDialog(getActivity()); pDialog.setMessage("Getting Data ..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected JSONObject doInBackground(String... args) { //Stri…
has answer: http://stackoverflow.com/a/26291918
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26291976
accepted answer: http://stackoverflow.com/a/26292148
has title: FATAL EXCEPTION: main java.lang.ArrayIndexOutOfBoundsException:
has comment: http://stackoverflow.com/comment/41254273
tagged with: listview
answer count: 3
has comment: http://stackoverflow.com/comment/41254451

http://stackoverflow.com/q/26343979
tagged with: eclipse
type: Question
tagged with: ant
score: 0
has answer: http://stackoverflow.com/a/26364231
answer count: 1
has body: I have imported a java servlet project to maintain into Eclipse (Helios) and made my amendments. But when I drag the Build.xml file to the Ant view and attempt to build the project I receive the error; "Variable references non-existent resource: ${workspace_loc:/projectname/lib/jsch-0.1.50.jar}" The only place I can find this resource is going to this location in Eclipse; Window >> Preferences >> Ant >> Runtime. Then on the Classpath tab it is under the "Global Entries" How do I resolve this please?
linked to: http://stackoverflow.com/q/19160620
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26364231
has title: Eclipse Build file has non existent resource
tagged with: java

http://stackoverflow.com/comment/41114601
type: QuestionComment
type: Comment
has text: Is your treetable variable instencied before as TreeTable?
comment on: http://stackoverflow.com/q/26216407
score: 0

http://stackoverflow.com/comment/41250105
score: 0
comment on: http://stackoverflow.com/q/26289256
type: QuestionComment
has text: actually it should have been just "name" the other was a test.. Anyways from the objectdb site they would do the queries without the paramater, but with the parameter it seems I can select 1 entry in my table. I am looking for the method in which to use my name to select the others but then grab the data for that one name aka lets say Bob. From entry Bob of name I get the refName and imageName associated with Bob.
type: Comment

http://stackoverflow.com/q/26299424
type: AnsweredQuestion
has body: I've installed gradle 2.0 on Ubuntu 14.04, and I want to run a little Web Application with Gradle, but when I build the Gradle project on Eclipse Luna (I've installed Gradle integration plugin for Eclipse 4.4) and I type "gradle tasks" on a terminal it doesn't show the task "jettyEclipse" to run the servlet. Here my build.gradle: buildscript { repositories { jcenter() } dependencies { classpath (group: 'com.sahlbach.gradle', name: 'gradle-jetty-eclipse-plugin', version: '1.9.2') } } apply plugin: 'java' apply plugin: 'war' apply plugin: 'jettyEclipse' apply plugin: 'eclipse' apply plugin: 'eclipse-wtp' repositories { mavenCentral() } dependencies { providedCompile 'javax.servlet:javax.servlet-api:3.0.1' } Here the compilation output: [sts] ----------------------------------------------------- [sts] Starting Gradle build for the following tasks: [sts] :cleanEclipse [sts] :eclipse [sts] ----------------------------------------------------- :cleanEclipseClasspath :cleanEclipseJdt :cleanEclipseProject :cleanEclipseWtpComponent :cleanEclipseWtpFacet :cleanEclipseWtp :cleanEclipse :eclipseClasspath :eclipseJdt :eclipseProject :eclipseWtpComponent :eclipseWtpFacet :eclipseWtp :eclipse BUILD SUCCESSFUL Total time: 1.14 secs [sts] ----------------------------------------------------- [sts] Build finished succesfully! [sts] Time taken: 0 min, 1 sec [sts] ----------------------------------------------------- And here my "gradle tasks" output: :tasks ------------------------------------------------------------ All tasks runnable from root project ------------------------------------------------------------ Build Setup tasks ----------------- init - Initializes a new Gradle build. [incubating] wrapper - Generates Gradle wrapper files. [incubating] Help tasks ---------- dependencies - Displays all dependencies declared in root project 'me'. dependencyInsight - Displays the insight into a specific dependency in root project 'me'. help - Displays a help message projects - Displays …
tagged with: java
tagged with: eclipse
tagged with: gradle
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41268032
has title: Gradle integration with Eclipse
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41273620
has answer: http://stackoverflow.com/a/26306636
tagged with: build.gradle
accepted answer: http://stackoverflow.com/a/26306636
favorite count: 0
tagged with: gradle-eclipse

http://stackoverflow.com/q/26271943
has answer: http://stackoverflow.com/a/26272176
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26272176
has answer: http://stackoverflow.com/a/26273210
upvote count: 1
has title: JSP: Pass Special Characters in response.setHeader?
type: Question
has answer: http://stackoverflow.com/a/26293854
score: 1
tagged with: java
answer count: 3
downvote count: 0
tagged with: jsp
has body: I am getting stuck in a basic JSP Operation. I want to a new line so i have added \n in the end but it throws me an exception. If i remove \n everything works fine Exception java.lang.IllegalArgumentException: Invalid LF not followed by whitespace Class File StringBuilder junitLog = new StringBuilder(); junitLog.append("The class that is being executed : " + description.getClassName() +"\n"); junitLog.append("Number of testcases to execute : " + description.testCount()+"\n"); /** * @return the junitLog */ public StringBuilder getJunitLog() { return junitLog; } /** * @param junitLog the junitLog to set */ public void setJunitLog(StringBuilder junitLog) { this.junitLog = junitLog; } JSP:- response.setHeader("finalJUNITReport",""+ junitListener.getJunitLog());
accepted answer: http://stackoverflow.com/a/26293854
favorite count: 0

android-fragments
tags question: http://stackoverflow.com/q/26294230
tags question: http://stackoverflow.com/q/26249493
tags question: http://stackoverflow.com/q/26290440
tags question: http://stackoverflow.com/q/26327269
tags question: http://stackoverflow.com/q/26198016
tags question: http://stackoverflow.com/q/26301883
tags question: http://stackoverflow.com/q/26266382
type: Tag
tags question: http://stackoverflow.com/q/26260174
tags question: http://stackoverflow.com/q/26310869
tags question: http://stackoverflow.com/q/26200529
tags question: http://stackoverflow.com/q/26208229
tags question: http://stackoverflow.com/q/26297235
tags question: http://stackoverflow.com/q/26325179
tags question: http://stackoverflow.com/q/26347217
tags question: http://stackoverflow.com/q/26314406
tags question: http://stackoverflow.com/q/26322236
tags question: http://stackoverflow.com/q/26290430
tags question: http://stackoverflow.com/q/26236644
tags question: http://stackoverflow.com/q/26296672
tags question: http://stackoverflow.com/q/26199525
tags question: http://stackoverflow.com/q/26259983
tags question: http://stackoverflow.com/q/26250549
tags question: http://stackoverflow.com/q/26335000
tags question: http://stackoverflow.com/q/26338328
tags question: http://stackoverflow.com/q/26263543
tags question: http://stackoverflow.com/q/26257590
tags question: http://stackoverflow.com/q/26248578
tags question: http://stackoverflow.com/q/26216059
tags question: http://stackoverflow.com/q/26315093
tags question: http://stackoverflow.com/q/26334292
tags question: http://stackoverflow.com/q/26313923
tags question: http://stackoverflow.com/q/26274506
tags question: http://stackoverflow.com/q/26303545
tags question: http://stackoverflow.com/q/26237095
tags question: http://stackoverflow.com/q/26211079
tag name: android-fragments
tags question: http://stackoverflow.com/q/26323209
tags question: http://stackoverflow.com/q/26350779
tags question: http://stackoverflow.com/q/26310823
tags question: http://stackoverflow.com/q/26294834
tags question: http://stackoverflow.com/q/26340398
tags question: http://stackoverflow.com/q/26233227

connection-pooling
tags question: http://stackoverflow.com/q/26343026
tags question: http://stackoverflow.com/q/26339052
tags question: http://stackoverflow.com/q/26263211
tags question: http://stackoverflow.com/q/26295075
type: Tag
tag name: connection-pooling
tags question: http://stackoverflow.com/q/26280832

http://stackoverflow.com/comment/41162286
comment on: http://stackoverflow.com/a/26241084
type: AnswerComment
has text: @n1con Worklight has something called Hybrid Apps, basically you write your app in JAVA, HTML, CSS and Javascript. Checkout some of the modules for hybrid apps here. [link](http://www.ibm.com/developerworks/mobile/worklight/getting-started.html) by the way, you can download worklight free of charge. Cordova has similar functionality for hybrid apps
score: 0
type: Comment

http://stackoverflow.com/comment/41118931
score: 0
has text: Please clarify what you mean. Have you looked at `ExecutorService`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26218722

http://stackoverflow.com/q/26210641
has title: Code coverage Missed instructions on testing exceptions
has comment: http://stackoverflow.com/comment/41104388
has answer: http://stackoverflow.com/a/26210725
has body: @Test public void testNullPointerException() { thrown = false; IntList list = null; IntList sublist = new IntList(null); IntList newList = new IntList(2, 2, 4); try { actual = OrderedIntListUtility.replaceAll(list, sublist, newList); } catch(NullPointerException e) { thrown = true; } } Java code coverage tells that I have some missed instructions in this particular test. I don't know where are the missed instructions here. Please help. Thank you.
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: code-coverage
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/41277196
type: QuestionComment
has text: Becoz i am using the ruuner class from that jar...is there any issue for that.
type: Comment
comment on: http://stackoverflow.com/q/26295798
score: 0

http://stackoverflow.com/q/26302471
score: -2
tagged with: java
tagged with: encapsulation
tagged with: inheritance
has comment: http://stackoverflow.com/comment/41273648
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41273784
upvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/1913863
tagged with: instanceof
has body: I have a question about Java. I have a class Say.java that has some methods, like sayHello(), saySomething(), sayBye(), ... I have other classes too. I have a class Person, and two subclasses of Person: Senior and Junior. My job to do is the following: I have to set the Say.java class to be private, and create a public class SayFactory.java, with a method called getInstance. Then, to create a new instance of the Say.java class, I have to call my getInstance method with one argument: an instance of either Senior.java or Junior.java. If I create an instance of Say.java using a Senior.java object, I must be able to access all of the methods of Say.java. But if I do the same thing with Junior.java, I should be able to access all of Say.java's methods EXCEPT saySomething(). Can someone please explain how to do this and how it works? Apologies by the way - I'm from Spain so my English isn't that great. If you don't understand the question, let me know and I'll try to write it out more clearly.
has comment: http://stackoverflow.com/comment/41273476
has answer: http://stackoverflow.com/a/26303508
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41273718
downvote count: 2
has answer: http://stackoverflow.com/a/26302758
has title: Control access in methods

http://stackoverflow.com/a/26340336
answers question: http://stackoverflow.com/q/26339971
score: 0
has body: If I understoond well you're doing like this: For every contact in your adress book do: Continue to check the mail until the reply for the contact I'm checking hasn't arrived. (check for replies in order 1 by 1) But you want the other way around: Continue to check the mail until a reply arrives: Check who sent the reply and update the table. You can achieve this with a simple while loop and a lookup map: Map&lt;String, Integer&gt; replies = new HashMap&lt;String, Integer&gt;(); for (int j = 0; j &lt; v.size(); j++) replies.put(((Member)v.getElementAt(j)).getPhoneNo(), j); //Save a reference to the phone number AND its index in "v". MailReader mR2 = new MailReader(); String host = "pop.gmail.com"; String mailStoreType = "pop3"; String username = "********@gmail.com"; String password = "********"; while(!replies.isEmpty()){ MailReader.check(host, mailStoreType, username, password); //Is this correct? Why are you using a static method? What's the purpose of mR2? String phoneToCheck = MailReader.getPhone(); //You have to implement this if it's not present if (replies.containsKey(phoneToCheck)) { newFrame.addNotify(); System.out.println("IT WORKED"); model.setValueAt(MailReader.getReply(phoneToCheck), replies.get(phoneToCheck), 3); model.fireTableDataChanged(); replies.remove(phoneToCheck); } } EDIT If your v object doesn't resemble your table structure, you can get the phone numbers directly from the table (assuming it's filled): for(int i = 0; i &lt; model.getRowCount(); i++){ replies.put((String)model.getValueAt(i,3), i); //Assuming 3 is phone number column } EDIT 2 Maybe my explanation wasn't good enough. In your modification you altered the Map structure for your needs, but you make it useless. A Map is a structure used to hold a Key-Value pair. In your case (my suggestion) is used to hold a String and an Integer. The string represents the phone number, while the integer represent its position in the table. So if we have a table like: ------------+--------------- | …
type: Answer
has comment: http://stackoverflow.com/comment/41383757
has comment: http://stackoverflow.com/comment/41349411
has comment: http://stackoverflow.com/comment/41349497
has comment: http://stackoverflow.com/comment/41384872
has comment: http://stackoverflow.com/comment/41383190
has comment: http://stackoverflow.com/comment/41383824

http://stackoverflow.com/comment/41228780
comment on: http://stackoverflow.com/a/26278332
has text: i am able to do this but how i will conver Device time in UTC basically i have to find
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26287842
has answer: http://stackoverflow.com/a/26288236
favorite count: 0
has comment: http://stackoverflow.com/comment/41247316
type: Question
has title: Java Message sent from client to server
has comment: http://stackoverflow.com/comment/41247372
has comment: http://stackoverflow.com/comment/41248081
has answer: http://stackoverflow.com/a/26288268
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/41248028
tagged with: java
type: UnansweredQuestion
score: 2
has body: I'm using a socket to connect my client with the server, I need a way so that when somebody tries to login on the client with an account, it sends the username and password to the server, and checks if the account exists. I just need to know how to make it send the message to the server when they press login. i tried this to make it send a message to the server public static void sendmsg(String a, String b) { try { String host = "127.0.0.1"; int port = 43655; InetAddress address = InetAddress.getByName(host); socket = new Socket(address, port); //Send the message to the server OutputStream os = socket.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(os); BufferedWriter bw = new BufferedWriter(osw); String sendMessage = a; bw.write(sendMessage); bw.flush(); System.out.println("Message sent to the server : "+sendMessage); //Get the return message from the server InputStream is = socket.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String message = br.readLine(); System.out.println("Message received from the server : " +message); } catch (Exception exception) { exception.printStackTrace(); } finally { //Closing the socket try { socket.close(); } catch(Exception e) { e.printStackTrace(); } } }
downvote count: 0
has comment: http://stackoverflow.com/comment/41248523

http://stackoverflow.com/comment/41079837
type: Comment
comment on: http://stackoverflow.com/q/26197320
has text: This is your clue that there is a problem. The GCD of 36 and 20 is definitely not 36.
score: 0
type: QuestionComment

http://stackoverflow.com/a/26225738
score: 2
accepted answer of: http://stackoverflow.com/q/26225532
downvote count: 0
answers question: http://stackoverflow.com/q/26225532
upvote count: 2
has body: The TextOutputFormat seems to rely on the toString method from the writable (see line 80). Implement a reasonable override of toString on your CompositeWritable class,for example you could call to string on the contained items and append them together with a separator.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/27659154
answers question: http://stackoverflow.com/q/26324832
score: 0
type: AcceptedAnswer
has body: The only solution is to wait for This Issue to be closed, until I thing there is no luck with Pegdown and Java 8.
type: Answer
accepted answer of: http://stackoverflow.com/q/26324832

regex
tags question: http://stackoverflow.com/q/26288956
tags question: http://stackoverflow.com/q/26306700
tags question: http://stackoverflow.com/q/26329339
tags question: http://stackoverflow.com/q/26225593
tags question: http://stackoverflow.com/q/26311845
tags question: http://stackoverflow.com/q/26235585
tags question: http://stackoverflow.com/q/26312576
tags question: http://stackoverflow.com/q/26346330
tags question: http://stackoverflow.com/q/26243075
tags question: http://stackoverflow.com/q/26280802
tags question: http://stackoverflow.com/q/26287801
tags question: http://stackoverflow.com/q/26255464
tags question: http://stackoverflow.com/q/26268847
tag name: regex
tags question: http://stackoverflow.com/q/26247222
tags question: http://stackoverflow.com/q/26212101
tags question: http://stackoverflow.com/q/26351815
tags question: http://stackoverflow.com/q/26289173
tags question: http://stackoverflow.com/q/26220216
tags question: http://stackoverflow.com/q/26276239
tags question: http://stackoverflow.com/q/26234329
tags question: http://stackoverflow.com/q/26347480
tags question: http://stackoverflow.com/q/26275985
tags question: http://stackoverflow.com/q/26350856
tags question: http://stackoverflow.com/q/26265752
tags question: http://stackoverflow.com/q/26271262
tags question: http://stackoverflow.com/q/26336067
tags question: http://stackoverflow.com/q/26223835
tags question: http://stackoverflow.com/q/26274251
tags question: http://stackoverflow.com/q/26253503
tags question: http://stackoverflow.com/q/26257883
tags question: http://stackoverflow.com/q/26252703
tags question: http://stackoverflow.com/q/26268356
tags question: http://stackoverflow.com/q/26213882
tags question: http://stackoverflow.com/q/26241630
tags question: http://stackoverflow.com/q/26251585
tags question: http://stackoverflow.com/q/26264188
tags question: http://stackoverflow.com/q/26269799
tags question: http://stackoverflow.com/q/26250127
tags question: http://stackoverflow.com/q/26316674
tags question: http://stackoverflow.com/q/26327740
tags question: http://stackoverflow.com/q/26266020
tags question: http://stackoverflow.com/q/26219171
tags question: http://stackoverflow.com/q/26346212
tags question: http://stackoverflow.com/q/26272652
tags question: http://stackoverflow.com/q/26244911
tags question: http://stackoverflow.com/q/26312646
tags question: http://stackoverflow.com/q/26229445
tags question: http://stackoverflow.com/q/26323771
tags question: http://stackoverflow.com/q/26317127
tags question: http://stackoverflow.com/q/26252125
tags question: http://stackoverflow.com/q/26317162
tags question: http://stackoverflow.com/q/26293423
tags question: http://stackoverflow.com/q/26292736
tags question: http://stackoverflow.com/q/26352610
tags question: http://stackoverflow.com/q/26225235
tags question: http://stackoverflow.com/q/26218899
tags question: http://stackoverflow.com/q/26280879
tags question: http://stackoverflow.com/q/26246380
tags question: http://stackoverflow.com/q/26207255
tags question: http://stackoverflow.com/q/26324186
tags question: http://stackoverflow.com/q/26263624
tags question: http://stackoverflow.com/q/26320622
tags question: http://stackoverflow.com/q/26320756
tags question: http://stackoverflow.com/q/26240607
tags question: http://stackoverflow.com/q/26309561
type: Tag
tags question: http://stackoverflow.com/q/26277424
tags question: http://stackoverflow.com/q/26339066
tags question: http://stackoverflow.com/q/26267627
tags question: http://stackoverflow.com/q/26328647

http://stackoverflow.com/q/26284804
tagged with: rollingfileappender
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26425442
has comment: http://stackoverflow.com/comment/41358128
score: 5
tagged with: tomcat7
tagged with: log4j2
tagged with: logging
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41473485
has title: Log4j2: Property substitution works incorrectly for filePattern in RollingFile appender
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26425442
upvote count: 5
downvote count: 0
has body: I am trying to configure RollingFile appender in tomcat 7.0.23 with log4j2(2.0.2) with 10 log files. I am using in the filePattern the ${sys:catalina.base}, it doesn't work and log files are placed in tomcat/bin/${sys:catalina.base}/ directory. The interesting part is that the first log file (without a number) is created ok, under tomcat/logs - which means it succeeds to map the filename attribute to a real path. When I replace ${sys:catalina.base} with filePattern="C:/apache-tomcat-7.0.23/logs/app.%i.log" it works. <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="%d %-5p [%X{REQ_ID}] [%c{1}] %m%n"/> <PatternLayout pattern="%d %-5p [%X{REQ_ID}] [%c{1}] %m%n"/> <SizeBasedTriggeringPolicy size="10 MB" /> <DefaultRolloverStrategy max="10"/> <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE" /> Meaning that the filePattern is not interpreted properly. How do I overcome this without having to specify the log directory statically? Thanks for the help

http://stackoverflow.com/q/26342962
has comment: http://stackoverflow.com/comment/41368569
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26343544
has title: Create a Java/Java EE routine to send mails
has comment: http://stackoverflow.com/comment/41372281
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41372241
has comment: http://stackoverflow.com/comment/41350385
has answer: http://stackoverflow.com/a/26343158
has comment: http://stackoverflow.com/comment/41371805
type: UnansweredQuestion
has body: For an account management system, i need to send an email to the users in database which have XX days remaining for their subscription. The idea is to create a function in my Java EE code (the application in written in Java/Java EE with VAADIN 7.2 framework) which checks remaining time of each users, and sends an email if the remaining time is XX days with my MailEngine() class; The problem is that i don't know how to create a daemon like that in Java/Java EE, or call a function everyday at 12:00 PM for example. The solution can be to create a Java App witch is called by crontab everyday but the best solution is to do it in my Java EE application, then it'll be fully customizable (change mail body/ title in the web interfaces, for admins who are not developers). EDIT: I tested this code sent by joseripla import javax.ejb.Schedule; import javax.ejb.Singleton; @Singleton public class MarketingMailEngine { int count = 0; //Print to log every 5 seconds @Schedule(second="*/5", minute="*", hour="*", persistent=true) public void print() { System.out.println(count); count++; } } But it only prints 0, even if i wait for some minutes (it should do it every 5 secs).

http://stackoverflow.com/comment/41180991
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26251703
has text: Is there inheritance? Is currentSelections part of a base class, or what do you mean with "parameter of my object Question?" Another constructor?
score: 0

http://stackoverflow.com/q/26242345
accepted answer: http://stackoverflow.com/a/26242392
score: 1
has answer: http://stackoverflow.com/a/26242387
tagged with: java
tagged with: loops
upvote count: 1
type: Question
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/26242392
downvote count: 0
favorite count: 0
tagged with: while-loop
has title: Why doesn't my bouncy ball program stop after the 5th bounce?
has body: I nested a for loop inside a while to keep track of the time. And the while loop keeps track of the bounces if a certain condition is met. As long as that condition is met the for loop will keep counting. But once the condition is met the loop is suppose to stop. However, it continues regardless of the condition inside the while loop. /* * @Author Lawton C Mizel * @Version 1.0, 07 October 2014 * * A program that simulates a ball bouncing by computing * its height in feet and each "second" as time passes on * a simulated clock. * */ public class bouncyballs001 { public static void main(String[] args) { // create and connect scanner object Scanner keyboard = new Scanner(System.in); //introduce program System.out.println("Welcome to the bouncing ball program!"); //prompts the user System.out.println("Please enter the initial velocity: "); double vel = keyboard.nextInt(); //initial variables double height = 0; int bounce = 0; while (bounce &lt; 5) { for (int time = 0; time &lt;= 30; time++) //counter { if (time &gt;= 0) { height = height + vel; vel = vel - 32.0; } if (height &lt; 0) { height = height * -0.5; vel = vel * -0.5; System.out.println("BOUNCE!"); bounce++; } System.out.println("time: " + time + " " + "height: " + height); } } } }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26242387

http://stackoverflow.com/q/26228432
has body: I am doing exercises on codility. I have spent two days on this problem with no improvement in my score. I get 100% on my correctness score, but fail some performance tests because it returns the wrong answer (not because of time or space complexity). My wrong results are always less than the expected answer. Can anyone think of a case where I need to add a stone that I am missing? This is the prompt: You are going to build a stone wall. The wall should be straight and N meters long, and its thickness should be constant; however, it should have different heights in different places. The height of the wall is specified by a zero-indexed array H of N positive integers. H[I] is the height of the wall from I to I+1 meters to the right of its left end. In particular, H[0] is the height of the wall's left end and H[N−1] is the height of the wall's right end. The wall should be built of cuboid stone blocks (that is, all sides of such blocks are rectangular). Your task is to compute the minimum number of blocks needed to build the wall. Write a function that, given a zero-indexed array H of N positive integers specifying the height of the wall, returns the minimum number of blocks needed to build it. class Solution { public int solution(int[] H); } For example, given array H containing N = 9 integers: H[0] = 8 H[1] = 8 H[2] = 5 H[3] = 7 H[4] = 9 H[5] = 8 H[6] = 7 H[7] = 4 H[8] = 8 The function should return 7. The figure shows one possible arrangement of seven blocks. Assume that: N is an integer within the range [1..100,000]; Each element of array H is an integer within the range [1..1,000,000,000]. Complexity: Expected worst-case time complexity is \$O(N)\$; Expected worst-case space complexity is \$O(N)\$, beyond input storage (not counting the storage required for input arguments). Elements of input arrays can be modified. This is my solution: import java.util.*; class Solution { public int solution(int[] H) { // write your code in Java SE 8 LinkedList&lt;Integer&gt; st…
has answer: http://stackoverflow.com/a/63703081
has answer: http://stackoverflow.com/a/65669537
has answer: http://stackoverflow.com/a/26231218
tagged with: algorithm
upvote count: 5
tagged with: java
has title: manhattan skyline cover failing some test cases
has answer: http://stackoverflow.com/a/33200164
has answer: http://stackoverflow.com/a/34985090
has answer: http://stackoverflow.com/a/32003561
has answer: http://stackoverflow.com/a/65458803
type: AnsweredQuestion
answer count: 12
downvote count: 0
has answer: http://stackoverflow.com/a/35890271
has answer: http://stackoverflow.com/a/79015129
has comment: http://stackoverflow.com/comment/131518043
favorite count: 0
accepted answer: http://stackoverflow.com/a/26231218
possible better answer: http://stackoverflow.com/a/27277531
type: Question
has comment: http://stackoverflow.com/comment/41137876
has comment: http://stackoverflow.com/comment/41137912
score: 5
has answer: http://stackoverflow.com/a/27277531
has answer: http://stackoverflow.com/a/61969353
has answer: http://stackoverflow.com/a/51630057

http://stackoverflow.com/q/26326955
tagged with: java
tagged with: hibernate
downvote count: 1
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/29642629
has title: SQL Procedure call from mybatis
tagged with: mybatis
has comment: http://stackoverflow.com/comment/41318381
favorite count: 0
tagged with: ibatis
accepted answer: http://stackoverflow.com/a/29642629
tagged with: oracle-database
possible better answer: http://stackoverflow.com/a/26327055
has body: All, I am trying to call a SQL procedure from Java user Mybatis, But i am getting "java.sql.SQLException: Missing IN or OUT parameter at index:: 1". Googling this doesnt give me the right answers. Below is my code what i wrote. I am using mybatis first time, Can anyone please guide me. Mepper.xml :--- &lt;select id="addHardwareList" statementType="CALLABLE" parameterType="java.util.HashMap"&gt; { call P_HW_SW_CRUD.SAVE_HARDWARE_INVENTORY( #{pDataIn,javaType=Object,jdbcType=ARRAY,jdbcTypeName=TAB_IDESK_HW_INFO,mode=IN,typeHandler=com.tristar.idesk.mybatis.mapper.HardwareInventoryHandler} #{pMsgCodeOut,javaType=Long,jdbcType=DECIMAL,mode=OUT} ) } &lt;/select&gt; Here is where i setup my MAP -- public void addUpdateInventory(JsonNode jsonNode) { Map&lt;String, ?&gt; inventoryMap = getMapFromJSONAddUpdate(jsonNode); HashMap&lt;String,Object&gt; returnMap = new HashMap&lt;String,Object&gt;(); Long pErrodCodeOut = null; String pErrorMsg = null; returnMap.put("pDataIn", (List&lt;HardwareInventoryBean&gt;) inventoryMap.get("beanHardwareList")); returnMap.put("pErrorCodeOut", pErrodCodeOut); //returnMap.put("pErrodMsgOut", pErrorMsg); hardwareInventoryMapper.addHardwareList(returnMap); } I also implemented a custom type handler to map my java bean attributes to oracleType Object. public class HardwareInventoryHandler implements TypeHandler{ public void setParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException { try{ //new RecLoaderService().getJSONObj("REC_ICAST_CLAIMANT_INFO", "TAB_ICAST_CLAIMANT_INFO", jsonObject, i, ps); System.out.println(parameter); List&lt;HardwareInventoryBean&gt; hwInventoryList = (List&lt;HardwareInventoryBean&gt;) parameter; System.out.println("Parameter Here --"+parameter); StructDescriptor structDescriptor = StructDescriptor.createDescriptor(InventoryConstants.HW_DB_REC_TYPE_NAME, ps.getConnection()); STRUCT[] structs = null; structs = new STRUCT[hwInventoryList.size()]; for (int index = 0; index &lt; hwIn…
has answer: http://stackoverflow.com/a/26327055
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/41334746
type: QuestionComment
has text: What you want to do is easily solved by junit. However, why wouldnt Class.forName work for you when it is already in the classpath?
score: 0
comment on: http://stackoverflow.com/q/26330234
type: Comment

http://stackoverflow.com/q/26237774
has comment: http://stackoverflow.com/comment/41195885
has comment: http://stackoverflow.com/comment/41192733
has answer: http://stackoverflow.com/a/26249411
tagged with: selenium-webdriver
tagged with: java
has answer: http://stackoverflow.com/a/26238970
type: Question
has comment: http://stackoverflow.com/comment/41196000
has body: I was thinking if there is an except in selenium my research yielded me with no results. I want to get whatever is present in body tag but not in a division tag where id = "main' . Is it possible in selenium? EDIT: I know how to get content if I know exactly what I am searching for. But in this scenario, I just want all the text not in any tag Here is an html sample &lt;head&gt;&lt;/head&gt; &lt;body&gt; Text I want &lt;div id ="main"&gt;&lt;/div&gt; &lt;/body&gt;
has comment: http://stackoverflow.com/comment/41190864
has comment: http://stackoverflow.com/comment/41195184
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41181643
has title: Except condition in selenium
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/a/26338970
answers question: http://stackoverflow.com/q/26338947
has body: Use paranthesis: System.out.println("mylog : " + (Val!=null ? "Not Null" :"Is Null")); Otherwise it gets interpreted as: whatToCheck = "mylog: " + val System.out.println(whatToCheck !=null ? "Not Null" : "Is Null" which evaluates to something like "mylog: null" or "mylog: abc". And that is always a non-null String.
upvote count: 7
score: 7
downvote count: 0
type: Answer

http://stackoverflow.com/q/26256546
type: Question
has answer: http://stackoverflow.com/a/37168604
has comment: http://stackoverflow.com/comment/41231142
has title: How to insert an PDPage within another PDPage with pdfbox
possible better answer: http://stackoverflow.com/a/37168604
accepted answer: http://stackoverflow.com/a/26299557
answer count: 3
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/26309525
favorite count: 0
has body: I use different tools like processing to create vector plots. These plots are written as single or multi-page pdfs. I would like to include these plots in a single report-like pdf using pdfbox. My current workflow includes these pdfs as images with the following pseudo code PDDocument inFile = PDDocument.load(file); PDPage firstPage = (PDPage) inFile.getDocumentCatalog().getAllPages().get(0); BufferedImage image = firstPage.convertToImage(BufferedImage.TYPE_INT_RGB, 300); PDXObjectImage ximage = new PDPixelMap(document, image); PDPageContentStream contentStream = new PDPageContentStream(document, page); contentStream.drawXObject(ximage, 0, 0, ximage.getWidth(), ximage.getHeight()); contentStream.close(); While this works it looses the benefits of the vector file formats, espectially file/size vs. printing qualitity. Is it possible to use pdfbox to include other pdf pages as embedded objects within a page (Not added as a separate page)? Could I e.g. use a PDStream? I would prefer a solution like pdflatex is able to embed pdf figures into a new pdf document. What other Java libraries can you recommend for that task?
score: 6
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41190578
has answer: http://stackoverflow.com/a/26299557
tagged with: java
upvote count: 7
tagged with: pdfbox

http://stackoverflow.com/comment/41152439
type: Comment
has text: @Juru thanks for the heads up. How about now? I added a ready() check.
comment on: http://stackoverflow.com/a/26236667
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41119644
type: Comment
has text: The "that allocates blocks of memory on demand" it seems to me like a List or a Map.
comment on: http://stackoverflow.com/a/26215032
type: AnswerComment
score: 0

http://stackoverflow.com/q/26310033
tagged with: validation
tagged with: string
score: 0
linked to: http://stackoverflow.com/q/513832
answer count: 5
has answer: http://stackoverflow.com/a/26310131
has answer: http://stackoverflow.com/a/26310065
possible better answer: http://stackoverflow.com/a/26310071
has answer: http://stackoverflow.com/a/26310071
type: AnsweredQuestion
has body: I have tried plenty of times to get this to work. I want to make it so if a user inputs anything other than what is meant to be input, then it gives them an error message and prompts them to input a new answer. However, every time I attempt this, it displays an error message (my error message) no matter what I input, even if it's correct. Help? import java.util.Random; import java.util.Scanner; public class RandomSelect { public static void main(String[] args) { String [] arr = {"rock", "paper", "scissors"}; Random random = new Random(); Scanner scan = new Scanner(System.in); System.out.println("Please select: rock, paper, or scissors?"); String myChoice = scan.nextLine(); boolean myChoiceIsntCorrect = false; if ((!myChoice.equalsIgnoreCase("rock")) || (!myChoice.equalsIgnoreCase("paper")) || (!myChoice.equalsIgnoreCase("scissors"))) { myChoiceIsntCorrect = true; } while ( myChoiceIsntCorrect == true ) { System.out.println("Your input wasn't either rock, paper, or scissors. Please select one of the 3."); myChoice = scan.nextLine(); } int select = random.nextInt(arr.length); System.out.println("Computer selected " + arr[select] + "."); if (arr[select] == "rock" &amp;&amp; myChoice.equalsIgnoreCase("paper")) System.out.println("You win!"); if (arr[select] == "rock" &amp;&amp; myChoice.equalsIgnoreCase("scissors")) System.out.println("You lose!"); if (arr[select] == "rock" &amp;&amp; myChoice.equalsIgnoreCase(arr[select])) System.out.println("It's a tie!"); if (arr[select] == "paper" &amp;&amp; myChoice.equalsIgnoreCase("rock")) System.out.println("You lose!"); if (arr[select] == "paper" &amp;&amp; myChoice.equalsIgnoreCase("scissors")) System.out.println("You win!"); if (arr[select] == "paper" &amp;&amp; myChoice.equalsIgnoreCase(arr[select])) System.out.println("It's a tie!"); if (arr[select] == "scissors" &amp;&amp; myChoice.equalsIgnoreCase("paper")) System.out.println("You lose!"); if (arr[select] == "scissors" &amp;&amp; myChoice.equalsIgnoreCase("rock")) System.…
has answer: http://stackoverflow.com/a/26310125
tagged with: java
accepted answer: http://stackoverflow.com/a/26310065
has title: Input validation in Java
has answer: http://stackoverflow.com/a/26310154
type: Question
tagged with: boolean

http://stackoverflow.com/q/26283676
has comment: http://stackoverflow.com/comment/41239224
has comment: http://stackoverflow.com/comment/41239054
type: AnsweredQuestion
has body: I have a standard Java application that reads configuration properties at start-up time, which work fine. However, I would like to update the configuration properties at execution time without compiling the code each time. How would I go about doing that. e.g code: Properties py = new Properties(); InputStream ins; String prepName = "config.properties"; ins = getClass().getClassLoader().getResourceAsStream(prepName); if (ins == null) { System.err.println("Couldn't find the file!"); return "Error"; } py.load(ins); String message = py.getProperty("msg"); resources/config.properties msg=testMessage If I want to change message dynamically, how would I do it?
has comment: http://stackoverflow.com/comment/41239822
tagged with: java
has answer: http://stackoverflow.com/a/26284026
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/26283725
answer count: 2
has answer: http://stackoverflow.com/a/26283725
has title: How to configure Java configuration properties at execution time?
accepted answer: http://stackoverflow.com/a/26284026

http://stackoverflow.com/a/26301045
has comment: http://stackoverflow.com/comment/41330148
answers question: http://stackoverflow.com/q/26290891
has comment: http://stackoverflow.com/comment/41272655
type: Answer
accepted answer of: http://stackoverflow.com/q/26290891
score: 2
upvote count: 2
has body: To answer your question, Yes same function interpret() is called again and again but they are not of the same class. Hence it is not actually recursive function. Used wiki code to explain the Interpreter pattern, but you need to go to and fro to wiki page to understand the whole picture, http://en.wikipedia.org/wiki/Interpreter_pattern Interpreter pattern is the one in which each and every variable and the operator in the given expression is represented as a separate class, and then the evaluation happens on the objects of these classes. Expression - class, expression - ((y+z)-x) In the case of the wiki example which you pointed out, when you call the constructor of Evaluator in the main(), only expression will be constructed (again its another Expression object) and saved in the syntaxTree reference variable of Evaluator. To give a gist of whats happening there with expression: x y z + - First variables x,y,z will be stored as such in the expressionStack variable When you encounter +, (y+z) will be pushed into the expressionStack After - token, ((y+z)-x) Expression object will be in the expressionStack (check the push and pop which is happening for the operator in Evaluator) so once the constructor of Evaluator is done, you will have Expression object whose implementation is again an Expression denoted as ((y+z)-x). Now comes the interesting part in main(), you are substituting values for the variable (x,y,z) using Number class and it happens in this order, main () sentence.interpret(variables); &nbsp; Evaluator.syntaxTree.interpret(variables); Variable.interpret(variables) // Here the actual values(5,10,42) gets substituted for x, y, z. and then the Expression is evaluated. If you see interpret() of Variables class, it is slightly different where it gets the corresponding Number object of the variable, using the context passed. This is the actual substitution of variables to numbers using the context object passed in main(). This in turn calls the interpret() of N…
has comment: http://stackoverflow.com/comment/41319296
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26211466
tagged with: jasypt
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: encryption
has answer: http://stackoverflow.com/a/26214325
tagged with: java
type: Question
score: 2
downvote count: 0
has body: Hi I have a Java application. I want to use Jasypt to encrypt and decrypt the passwords with random salt generated based on size and algorithm. This is what I want to achieve. Create a random salt. Encrypt the password with the salt. Save the salt and encrypted password for the user. I want the salt size, algorithm to be given as input. The reason why I want decryption is that, I have some configuration files created for the application and some values are passwords that I want to save as encrypted in the file and decrypt it when I want to use it. I have this Java class which creates salt and then creates the hash code and I could use it for validating user (I can save salt and hascode instead of encrypted password.). I changed it some and created a method to create random salt in that example. But there is no decryption method. That's why I choose Jasypt. But I havn't seen any proper example of how to use it. I tried following and always it returns same salt. public static void main(String[] args) { RandomSaltGenerator saltGenerator = new RandomSaltGenerator(); byte[] salt = saltGenerator.generateSalt(24); System.out.println(salt); } Can anybody provide a proper example or how to use it in my own way? I want to achieve what Jasypt have mentioned in their article. But there are no codes available.
answer count: 1
has title: Password Encryption and Decryption with Jasypt and random salt

http://stackoverflow.com/a/26280178
answers question: http://stackoverflow.com/q/26276179
type: Answer
score: 0
has body: You can do it without problem. You have to set up a controller that will send the image when a browser requests it. But here, the controller does not put it in a Model to give it to a view, but directly generate the HTTP response. Then in your JSP, you simply indicates the relevant URL. Here is a (partial) example of what it could be : @RequestMapping(value = "/img/{imgid}") public void getFile(HttpServletRequest request, @PathVariable(value = "imgid") long imgid, HttpServletResponse response) throws IOException { contentType = "img/png"; //or what you need response.setContentType(contentType); // find the image bytes into into byte[] imgBytes response.setContentLength((int) imgBytes.length); response.setStatus(HttpServletResponse.SC_OK); OutputStream os = response.getOutputStream(); os.write(imgBytes); }

http://stackoverflow.com/comment/41315067
has text: @user2485710: There's no such thing in C++. You cannot "not have RTTI" and still have C++.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26325334
score: 4

http://stackoverflow.com/comment/41317998
has text: "there is an image folder": where? What is `xx.xx`? How about... putting the images in the war file, inside a folder named `images` (assuming xx.xx is a host name and hellorest is the contest path of your webapp)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26326810

http://stackoverflow.com/comment/41094421
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26205669
type: AnswerComment
has text: So how would I go about closing the program then? Also, it's not just not being able to close the program. I can't even run other operations inside the event! Nothing is passing through the event.

http://stackoverflow.com/a/45705138
score: 65
has comment: http://stackoverflow.com/comment/136813970
type: Answer
answers question: http://stackoverflow.com/q/26230225
has body: Java 8 way of doing, String firstKey = map.keySet().stream().findFirst().get();
has comment: http://stackoverflow.com/comment/116748414
downvote count: 1
upvote count: 66
has comment: http://stackoverflow.com/comment/101907603

http://stackoverflow.com/a/33756603
downvote count: 2
has comment: http://stackoverflow.com/comment/68903071
has comment: http://stackoverflow.com/comment/72839468
upvote count: 65
has comment: http://stackoverflow.com/comment/77181518
type: Answer
has comment: http://stackoverflow.com/comment/72647411
has comment: http://stackoverflow.com/comment/55280781
has comment: http://stackoverflow.com/comment/75709555
has comment: http://stackoverflow.com/comment/97158135
answers question: http://stackoverflow.com/q/26207252
has comment: http://stackoverflow.com/comment/77023412
has body: You've to create empty constructor because JAX-RS initializes the classes... Your constructor must have no arguments: @XmlRootElement public class Student implements Serializable { public String first_name; public String last_name; public String getFirst_name() { return first_name; } public void setFirst_name(String first_name) { this.first_name = first_name; } public String getLast_name() { return last_name; } public void setLast_name(String last_name) { this.last_name = last_name; } public Student() { first_name = "Fahad"; last_name = "Mullaji"; } public Student() { } }
has comment: http://stackoverflow.com/comment/75703883
score: 63

http://stackoverflow.com/comment/41091559
type: Comment
has text: "It's not printing" - does it run? Do you get an error? Maybe be a bit more specific?
comment on: http://stackoverflow.com/q/26204152
score: 0
type: QuestionComment

http://stackoverflow.com/q/26230524
tagged with: jboss7.x
has title: Most of the Jboss threads in state = BLOCKED
has comment: http://stackoverflow.com/comment/41169039
favorite count: 0
tagged with: blocked-threads
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41142525
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41141967
type: Question
has body: Most of our jboss threads lie in the BLOCKED state and the thread count of jboss never comes down. Want to understand how to bring the thread count down and why are these many threads in BLOCKED state. We have 380 of 450 threads in BLOCKED state. Used the below to find out the states awk '/state / { print $5}' &lt; tdump-231.log | sort | uniq -c 384 BLOCKED) 68 IN_NATIVE) Thread 31554: (state = BLOCKED) - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise) - java.lang.Object.wait() @bci=2, line=485 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$Worker.await() @bci=8, line=885 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$Worker.run() @bci=11, line=911 (Compiled frame) - java.lang.Thread.run() @bci=11, line=662 (Interpreted frame) Thread 31553: (state = BLOCKED) - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise) - java.lang.Object.wait() @bci=2, line=485 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$Worker.await() @bci=8, line=885 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$Worker.run() @bci=11, line=911 (Compiled frame) - java.lang.Thread.run() @bci=11, line=662 (Interpreted frame) Thread 31552: (state = BLOCKED) - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise) - java.lang.Object.wait() @bci=2, line=485 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$Worker.await() @bci=8, line=885 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$Worker.run() @bci=11, line=911 (Compiled frame) - java.lang.Thread.run() @bci=11, line=662 (Interpreted frame) Thread 31551: (state = BLOCKED) - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise) - java.lang.Object.wait() @bci=2, line=485 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$Worker.await() @bci=8, line=885 (Compiled frame) - org.apache.tomcat.util.net.JIoEndpoint$Worker.run() @bci=11, line=911 (Compiled frame) - java.lang.Thre…
has comment: http://stackoverflow.com/comment/41142260
upvote count: 1
has comment: http://stackoverflow.com/comment/43067735
tagged with: jstack
has comment: http://stackoverflow.com/comment/41142241

http://stackoverflow.com/comment/41292542
type: Comment
type: QuestionComment
score: 0
has text: here you can find an explanation: http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this
comment on: http://stackoverflow.com/q/26308018

http://stackoverflow.com/a/26243371
score: 0
has body: It basically depends on how you wanna use them and what considerations would you have (size, data type,..etc). I would recommend going throw Oracle's docs.
type: Answer
answers question: http://stackoverflow.com/q/26243294

http://stackoverflow.com/q/26288774
has answer: http://stackoverflow.com/a/26288852
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41257059
has body: I am implementing the Comparable interface, and using it to compare the names of sports teams. I noticed that this was the simplest implementation of the compareTo method. I was wondering why the method compareTo refers to itself in the body of the method. Isn't that some sort of never-ending recursion? How can you implement a method by defining it as itself? public int compareTo(Team x) { return teamName.compareTo(x.teamName); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26288809
tagged with: recursion
tagged with: java
has comment: http://stackoverflow.com/comment/41249652
type: Question
has answer: http://stackoverflow.com/a/26288885
has title: Is the compareTo method (in the Comparable interface) recursive?

http://stackoverflow.com/q/26284705
has comment: http://stackoverflow.com/comment/41241075
has comment: http://stackoverflow.com/comment/41241024
downvote count: 5
has comment: http://stackoverflow.com/comment/41241469
has answer: http://stackoverflow.com/a/26284806
accepted answer: http://stackoverflow.com/a/26284806
has comment: http://stackoverflow.com/comment/41241168
has comment: http://stackoverflow.com/comment/41241156
type: AnsweredQuestion
tagged with: java
has title: How i can change numbers to chars?
type: Question
score: -2
has answer: http://stackoverflow.com/a/26284807
has body: i have a java code below,i need to get same result with characters instead of numbers.(1,2,3,4,5,6,7) => (a,b,c,d,e,f,g) ,How i can change the code,thank you. int[] numbers = { 1, 2, 3, 4, 5, 6, 7 }; int len = numbers.length; int numberOfPer = 0; for (int i = 0; i &lt; len; i++) { for (int j = 0; j &lt; len; j++) { for (int k = 0; k &lt; len; k++) { for (int l = 0; l &lt; len; l++) { for (int m = 0; m &lt; len; m++) { for (int n = 0; n &lt; len; n++) { for (int o = 0; o &lt; len; o++) { if ((i != j) &amp;&amp; (i != k) &amp;&amp; (i != l) &amp;&amp; (i != m) &amp;&amp; (i != n) &amp;&amp; (i != o) &amp;&amp; (j != k) &amp;&amp; (j != l) &amp;&amp; (j != m) &amp;&amp; (j != n) &amp;&amp; (j != o) &amp;&amp; (k != l) &amp;&amp; (k != m) &amp;&amp; (k != n) &amp;&amp; (k != o) &amp;&amp; (l != m) &amp;&amp; (l != n) &amp;&amp; (l != o) &amp;&amp; (m != n) &amp;&amp; (m != o) &amp;&amp; n != o &amp;&amp; (j - i != 1) &amp;&amp; (k - j != 1) &amp;&amp; (l - k != 1) &amp;&amp; (m - l != 1) &amp;&amp; (n - m != 1) &amp;&amp; (o - n != 1) &amp;&amp; (j - i != -1) &amp;&amp; (k - j != -1) &amp;&amp; (l - k != -1) &amp;&amp; (m - l != -1) &amp;&amp; (n - m != -1) &amp;&amp; (o - n != -1)) { System.out.println(numbers[i] + "" + numbers[j] + "" + numbers[k] + "" + numbers[l] + "" + numbers[m] + "" + numbers[n] + "" + numbers[o]); numberOfPer++; } } } } } } } } System.out.println("Number of codes: " + numberOfPer);
favorite count: 0
possible better answer: http://stackoverflow.com/a/26284797
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/26284797

http://stackoverflow.com/a/26262445
answers question: http://stackoverflow.com/q/26261892
type: Answer
upvote count: 3
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41200477
has body: Thanks Garis M Suero for your suggestion after which i got answer int[] a = { 11, 2, 7, 6, 13,17, 8, 9, 3, 5, 12 }; Arrays.sort(a); List&lt;List&lt;Integer&gt;&gt; listMain = new ArrayList&lt;List&lt;Integer&gt;&gt;(); List&lt;Integer&gt; temp = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; a.length; i++) { if ((i + 1&lt;a.length)&amp;&amp;( a[i] + 1==a[i + 1])) { temp.add(a[i]); } else { temp.add(a[i]); listMain.add(temp); temp = new ArrayList&lt;&gt;(); } } for (List&lt;Integer&gt; lstI : listMain) { for (Integer i : lstI) { System.out.println(i); } System.out.println("================"); }

http://stackoverflow.com/q/26344756
accepted answer: http://stackoverflow.com/a/26344851
has comment: http://stackoverflow.com/comment/41351451
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/57349989
type: AnsweredQuestion
has title: Is there a generic way of parsing Json in Java?
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/42876893
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41351075
tagged with: gson
has comment: http://stackoverflow.com/comment/41351178
has answer: http://stackoverflow.com/a/26344851
has answer: http://stackoverflow.com/a/42876893
downvote count: 1
has comment: http://stackoverflow.com/comment/41351400
type: Question
has comment: http://stackoverflow.com/comment/41351103
has answer: http://stackoverflow.com/a/26345108
has body: I have tried with gson and Jackson parsers unfortunately I couldn't achieve what I wanted to. { "rateName": "My Special Rate", "adjustments": [ { "adjustmentType": "LOAN_AMOUNT_GREATER_THAN_550K", "rate": 0.75 }, { "adjustmentType": "AMORTIZATION_TERM_LESS_THAN_30_YEARS", "rate": -0.2 } ], "errorTypes": [], "premiumTaxs": [], "renewalPremiums": [], "totalInitialRate": 1.95, "optimumPricing": false, "miPricingVO": null, "rateCardId": "BALS_NR", "ratingInfoBaseRate": 1.4 } Above is the Json I want to parse. I want to create generic methods using which I can access a value by name easily. For example: getName(rateName) - Should return 'My Special Rate' getNameFromArray(adjustmentType, adjustments) - Should return 'LOAN_AMOUNT_GREATER_THAN_550K' Is there a way to do this? It should be generic so that this can be applied on any Json file. Additional info: I tried using Gson, but this parses the whole file and throws an error if it finds an array. JsonReader j = new JsonReader(new FileReader("Path of Json")); j.beginObject(); while (j.hasNext()) { String name = j.nextName(); if (name.equals("rateName")) { System.out.println(j.nextString()); } System.out.println(name); } I tried with jackson and encountered the same as Gson. JsonFactory jfactory = new JsonFactory(); JsonParser jParser = jfactory.createJsonParser("Path of Json"); while (jParser.nextToken() != JsonToken.END_OBJECT) { System.out.println(jParser.getCurrentName());; }
tagged with: jackson
score: 4
has comment: http://stackoverflow.com/comment/41351140
has comment: http://stackoverflow.com/comment/41351164

http://stackoverflow.com/a/28084498
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/26274132
has body: I think this error your getting because you are not made your servlet class as public. The object of your servlet class should be visible to the container because container creating object for your servlet class.
type: Answer
has comment: http://stackoverflow.com/comment/60403831
upvote count: 0

http://stackoverflow.com/a/26334046
answers question: http://stackoverflow.com/q/26333970
has body: Create a class that contains a long variable and a String array. Use this object collection to store the result. See code snippet below Class Result{ private long key; private String[] value; public Result(long key, String[] value){ this.key = key; this value = value; } //getter setter goes here } modified code below long[] mylong= {1,3,5,6,7}; List&lt;Result&gt; result = new ArrayList&lt;Result&gt;(); Dbadapter finaldb = new Dbadapter(this); for(int i=0; i&lt;mylong.length; i++) { finaldb.open(); String[] string_array = finaldb.getArray(mylong[i]); result.add(new Result(mylong[i]),string_array )); finaldb.close(); You can use the List for further operations
type: Answer
score: 0

http://stackoverflow.com/q/26234048
has comment: http://stackoverflow.com/comment/41147416
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41147451
has comment: http://stackoverflow.com/comment/41147606
type: Question
has title: Font Awsome on JButton
has comment: http://stackoverflow.com/comment/41149069
linked to: http://stackoverflow.com/q/9639894
has answer: http://stackoverflow.com/a/26235416
linked to: http://stackoverflow.com/q/5808195
has answer: http://stackoverflow.com/a/26235355
answer count: 2
possible better answer: http://stackoverflow.com/a/26235416
downvote count: 0
has body: I am trying to display font awesome icons on a JButton. I did the following Font font = null; try { font = Font.createFont(Font.TRUETYPE_FONT, new File("../icons/fontawesome-webfont.ttf")); font = font.deriveFont(18f); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(font); } catch ( FontFormatException ex ){ex.printStackTrace();} catch ( IOException ex ){ex.printStackTrace();} private JButton save_btn = new JButton(); save_btn.setFont(font); save_btn.setText("\uf0c7"); save_btn.setPreferredSize( buttonDimension ); But everything I get is If I use the font with a JTextArea, it works fine : JTextArea t = new JTextArea(); t.setRows( 2); t.setColumns( 12); t.setFont( font ); t.setText( "\uF0F3 \uF1EC \uf0f3 \uf1ec"); buttonPanel.add(t); I get
favorite count: 0
upvote count: 2
tagged with: swing
accepted answer: http://stackoverflow.com/a/26235355
has comment: http://stackoverflow.com/comment/41147490

http://stackoverflow.com/a/26227034
has comment: http://stackoverflow.com/comment/61787068
has comment: http://stackoverflow.com/comment/41161285
has comment: http://stackoverflow.com/comment/41160910
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41161122
has body: Use if (!isInEditMode()) before your init() in CircleImageView. There is multiple posts talking about this issue like this one. EDIT: I am not sure you used the tip like this, please provide an example of what you have tried if it is the case.
answers question: http://stackoverflow.com/q/26226534
type: Answer
accepted answer of: http://stackoverflow.com/q/26226534
has comment: http://stackoverflow.com/comment/41161455
score: 3
downvote count: 0
upvote count: 3

http://stackoverflow.com/comment/41111334
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26214546
has text: You've either misunderstood the book, or the book is wrong (perhaps not intentionally, as proofreading is too often left to laymen). Can you provide a quote?
score: 0

http://stackoverflow.com/comment/41335991
type: Comment
comment on: http://stackoverflow.com/a/26335197
type: AnswerComment
has text: @ilovkatie Your `ProcessDao` should look something like this: `@Repository public class ProcessDao implements IProcessDao {...`
score: 0

http://stackoverflow.com/comment/41364354
comment on: http://stackoverflow.com/a/26352247
has text: Okay, that read backwards to me. `SwingUtilities.invokeLater` won't tend to make a lot of differences, other than allowing the EDT some time to breath, but if the OP is running the loop in the EDT, they'd be screwed anyway. A `SwingWorker` would be a better choice...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41160341
type: Comment
comment on: http://stackoverflow.com/a/26233514
has text: And that will turn it into an array of split strings?? So each number will be a separate string correct? Sorry I am really new to all of this and am not sure how to comment with my code in the right format on this site either.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26195268
type: AnsweredQuestion
has body: I am a newbie to Java.I am trying to learn callback in Java.I found a lot of results by googling.But i need some simple example that can explain the use of callback implementation in Java.I wish it should be something like a timer that print some message after every one minute.
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26196010
has comment: http://stackoverflow.com/comment/41075971
accepted answer: http://stackoverflow.com/a/26196010
has comment: http://stackoverflow.com/comment/41075919
possible better answer: http://stackoverflow.com/a/26197641
has comment: http://stackoverflow.com/comment/41079879
answer count: 2
has comment: http://stackoverflow.com/comment/41076654
has answer: http://stackoverflow.com/a/26197641
has title: How to create a callback in Java
downvote count: 0
tagged with: callback
favorite count: 0
has comment: http://stackoverflow.com/comment/41075807

http://stackoverflow.com/q/26299388
tagged with: encapsulation
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/41267676
has body: I know why my problem is occurring but i'm unsure on how to deal with it. So I have 3 classes, 1 of these holds my getters &amp; setters. In one class I am setting the values, in the other I am getting the values. When I get the values they are returned null. This is obviously because the two instances of the getter/setter object I created in the classes are separate from one another. What i'm trying to find out is how I can set the values in one class and get them in another without having two separate instances of the getter/setter class. My wording is terrible so here's a more visual explanation: Class 1 Encapsulation encap = new Encapsulation(); encap.setValue(10); Class 2 Encapsulation encap = new Encapsulation(); encap.getValue(); //I want this to return 10 Class 3 (Encapsulation) private int value; public void setValue(int value){ this.value = value; } public int getValue(){ return value }
favorite count: 0
has comment: http://stackoverflow.com/comment/41267666
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/26299518
has answer: http://stackoverflow.com/a/26299498
has comment: http://stackoverflow.com/comment/41268026
has answer: http://stackoverflow.com/a/26299584
has comment: http://stackoverflow.com/comment/41267647
has comment: http://stackoverflow.com/comment/41267834
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/26299518
answer count: 3
upvote count: 4
has title: Getters returning null
tagged with: null
has comment: http://stackoverflow.com/comment/41267920
accepted answer: http://stackoverflow.com/a/26299498

http://stackoverflow.com/q/26324603
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/53331492
has comment: http://stackoverflow.com/comment/41314103
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/41313943
answer count: 2
downvote count: 0
upvote count: 6
has answer: http://stackoverflow.com/a/26324689
accepted answer: http://stackoverflow.com/a/26324689
has comment: http://stackoverflow.com/comment/41314001
has comment: http://stackoverflow.com/comment/41315095
possible better answer: http://stackoverflow.com/a/53331492
has title: JDBC returns an empty ResultSet (rs.isBeforeFirst() == true) although the table isn't empty
tagged with: sql
tagged with: sqlite
tagged with: jdbc
favorite count: 0
score: 6
type: Question
has body: I am trying to complete a DB access method for my Web Service. The service and the DB access methods work fine for all other tables in the DB, but this one particular method does not. When I query the DB, the ResultSet always returns empty (meaning isBeforeFirst() == true). After many tries I cut my query to a simple SELECT * FROM VIDEOS to see if the problem is some difference between the data I entered and the data I use in my query, but even this simple query to select all items in the table didn't return any result. This is the method I use to pull info from the DB: public static Object[] getVideo(String phonenum, String timeStamp) { Connection c = null; Statement stmt = null; Object[] result = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:lineappDB.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); stmt = c.createStatement(); String query = String.format("SELECT * FROM VIDEOS"); ResultSet rs = stmt.executeQuery(query); // If no data was found if (rs.isBeforeFirst()) { rs.close(); stmt.close(); c.close(); return null; } else { result = new Object[6]; while (rs.next()) { result[0] = rs.getInt(1); result[1] = rs.getString(2); result[2] = rs.getString(3); result[3] = rs.getString(4); result[4] = rs.getString(5); result[5] = rs.getInt(6); } } rs.close(); stmt.close(); c.close(); } catch (Exception e) { try { if (!c.isClosed()) { c.commit(); c.close(); } } catch (Exception ex) { System.err.println(ex.getClass().getName() + ": " + ex.getMessage()); return null; } System.err.println(e.getClass().getName() + ": " + e.getMessage()); return null; } System.out.println(String.format("Succesfully pulled from DB - %s %s", result[1], result[2])); return result; } Any help will be very appreciated. CLARIFICATION EDIT: The method is part of a web service that pulls a path of a certain video from the DB, to be sent to a client. The videos are uploaded by clients and are then stored in the filesystem, and …

http://stackoverflow.com/a/26347555
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41359553
has body: You can load additional class files with the help of a classloader, and then use reflection to instantiate them and invoke methods. (Or if the class implements an interface you've already loaded in your application, you can just invoke the methods of that interface directly, without using reflection.) Note that to use a classloader, you need a class file. If all you have is a Java file, you'll need to use a compiler to transform it into a class file before you load it with the classloader.
has comment: http://stackoverflow.com/comment/41356321
score: 1
has comment: http://stackoverflow.com/comment/41356391
has comment: http://stackoverflow.com/comment/41360332
has comment: http://stackoverflow.com/comment/41358135
has comment: http://stackoverflow.com/comment/41357620
has comment: http://stackoverflow.com/comment/41358175
downvote count: 0
has comment: http://stackoverflow.com/comment/41359921
has comment: http://stackoverflow.com/comment/41357957
answers question: http://stackoverflow.com/q/26347388
has comment: http://stackoverflow.com/comment/41359984

http://stackoverflow.com/a/26211659
has body: You can use a for loop fot the input. It would good sense to define the scanner in the for loop because you only need the scanner in the loop, but java syntax makes the result ugly, so define it before the loop: double total = 0.0; int count = 0; System.out.println("Please enter the homework scores (negative to end):"); Scanner scanner = new Scanner(System.in); for (double score = scanner.nextDouble(); score &gt; 0; score = scanner.nextDouble()) { total += score; count ++; scanner.next(); // you need this to clear the newline from the buffer } double average = total / count;
has comment: http://stackoverflow.com/comment/41253517
answers question: http://stackoverflow.com/q/26210697
type: Answer
score: 0

http://stackoverflow.com/q/26220437
tagged with: performance
tagged with: java
has body: Recently I developed a billion counter application to measure phone's performance. I used the following code to measure taken to count to a billion. Start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { t1 = System.currentTimeMillis(); count = 1000000000; while (count != 0){ --count; } t2 = System.currentTimeMillis(); tf = (t2-t1)/1000; CountDisp.setText(""+tf); } }); My phone took (approx)75 seconds to count to a billion using this code. But when I measured the time from another application downloaded from Google Play Store , my phone took 37 seconds to count to a billion. How can I make my code as fast as possible? Or is there an another way of doing this? NOTE:- Both the applications took same time to count to a million, (approx)0.110 seconds
type: Question
has comment: http://stackoverflow.com/comment/41122784
has comment: http://stackoverflow.com/comment/41142921
has comment: http://stackoverflow.com/comment/41123032
has comment: http://stackoverflow.com/comment/41123141
has comment: http://stackoverflow.com/comment/41127493
has comment: http://stackoverflow.com/comment/41122533
has comment: http://stackoverflow.com/comment/41122947
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41123031
has title: Performance-Billion Counter
has answer: http://stackoverflow.com/a/26220713
accepted answer: http://stackoverflow.com/a/26220713
tagged with: android
has comment: http://stackoverflow.com/comment/41143185
type: AnsweredQuestion

http://stackoverflow.com/q/26275484
linked to: http://stackoverflow.com/q/5730532
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26275501
tagged with: apache
has body: I am developing a web application using Java. From my index page I need to upload a file with some other fields such as some texts and numbers using input tags. this is my jsp file. -Select- Mobile Phones Automobile Computers Title: Photo: Description: Price: I found some articles which use Apache commons, but in all of that, I can get only the image. All the other values get set to null. The article I followed is this. I need to know how to get other values as well. (In this case category, title, photo etc.) How can I do that? Thank you! EDIT: This is my servlet. import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import com.im.dao.PostAdDao; import com.im.dao.PostAdDaoImpl; import com.im.entities.Advertiesment; @WebServlet("/postAd") @MultipartConfig public class PostAdServlet extends HttpServlet { private static final long serialVersionUID = 1L; private final String UPLOAD_DIRECTORY = "C:/uploadss"; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Advertiesment ad = new Advertiesment(); PostAdDao pad = new PostAdDaoImpl(); PrintWriter out = response.getWriter(); String name = null; if(ServletFileUpload.isMultipartContent(request)){ try { List<FileItem> multiparts = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); for(FileItem item : multiparts){ if(item.isFormField()){ String cat = request.getParameter("category"); System.out.println("INFO: Category : "+cat); if( cat != null ){ ad.setCategory(ca…
tagged with: servlets
downvote count: 0
answer count: 1
tagged with: jsp
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26275501
has title: uploading files using jsp and servlet
type: AnsweredQuestion
tagged with: apache-commons
tagged with: java

http://stackoverflow.com/q/26324902
upvote count: 1
type: Question
tagged with: data-structures
has title: BinaryTree ADP implementation in Java - How does the insert work?
has body: I have problems understanding the BinaryTree ADT, especially the Insertion method. Most implementations I find in the internet, have two parameters, first an existing node and second the data that is to be inserted and work like "If the data is smaller than the nodes data, either add it as a left node or call insert recursively for the left node, otherwise do the same on the right side. Is that comparison really necessary for a normal binary tree (not a search binaryTree)? Cause I want to implement a generic tree, the values might not be that easily comparable. Tree Interface public interface IBinaryTree&lt;E&gt; { public IBinaryTreeNode&lt;E&gt; getRoot(); public Boolean isEmpty(); public void insert(E data); } TreeNode Interface public interface IBinaryTreeNode&lt;E&gt; { public IBinaryTreeNode&lt;E&gt; getLeftNode(); public IBinaryTreeNode&lt;E&gt; getRightNode(); public E getData(); public void setData(E data); public void setLeftNode(IBinaryTreeNode&lt;E&gt; node); public void setRightNode(IBinaryTreeNode&lt;E&gt; node); public IBinaryTreeNode&lt;E&gt; inorderFind(E data); public IBinaryTreeNode&lt;E&gt; preorderFind(E data); public IBinaryTreeNode&lt;E&gt; postorderFind(E data); } TreeNode Implementation public class BinaryTreeNode&lt;E&gt; implements IBinaryTreeNode&lt;E&gt; { private IBinaryTreeNode&lt;E&gt; left; private IBinaryTreeNode&lt;E&gt; right; E data; @Override public IBinaryTreeNode&lt;E&gt; getLeftNode() { return left; } @Override public IBinaryTreeNode&lt;E&gt; getRightNode() { return right; } @Override public E getData() { return data; } @Override public void setData(E data) { this.data = data; } @Override public void setLeftNode(IBinaryTreeNode&lt;E&gt; node) { left = node; } @Override public void setRightNode(IBinaryTreeNode&lt;E&gt; node) { right = node; } // Inorder search (Left tree --&gt; Node --&gt; Right tree) @Override public IBinaryTreeNode&lt;E&gt; inorderFind(E data) { if(left != null){ IBinaryTreeNode&lt;E&gt; leftResult = this.lef…
has comment: http://stackoverflow.com/comment/68566044
downvote count: 0
favorite count: 0
tagged with: binary-tree
type: UnansweredQuestion
tagged with: abstract-data-type
tagged with: tree
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/26235767
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26234436
has body: @OneToMany annotation defines a many-valued association with one-to-many multiplicity. If the collection is defined using generics to specify the element type, the associated target entity type need not be specified; otherwise the target entity class must be specified @JoinColumn is used to specify a mapped column for joining an entity association.
downvote count: 0
type: Answer

http://stackoverflow.com/a/26295567
has comment: http://stackoverflow.com/comment/41340548
type: Answer
has comment: http://stackoverflow.com/comment/41340629
has body: It is pretty much clear if you read your (own) stack trace carefully: Caused by: java.lang.RuntimeException: BAD URI: file://f:/Play/activator-1.2.10-minimal You are trying to access a file via an URI which is malformed. A correct URI would be either file:/f:/Play/activator-1.2.10-minimal or file:///f:/Play/activator-1.2.10-minimal (see also this answer).
answers question: http://stackoverflow.com/q/26295166
score: 0

http://stackoverflow.com/comment/41287568
has text: sampleException will be thrown out to the outer try block.. Else the caller of this code.. In case of Main.. It will be thrown to the JVM.. Btw.. Removing oracle tag.. As it is only for DBMS..
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26310032

http://stackoverflow.com/q/26282747
has answer: http://stackoverflow.com/a/26283227
accepted answer: http://stackoverflow.com/a/26283227
tagged with: spring-mvc
type: AnsweredQuestion
has body: Hi i have the following code that is executed when i submit form: @ActionMapping(params = "ConController=showPayment") public void showPayment(ActionResponse response, @ModelAttribute("conPayForm") ConsiPayForm consiForm, Model model) { PaymentDetailsResponse paymentDetailsResponse = stand.getDet(); ViewDet view = stand.getView(); ... PaymentDetails paymentDetails = paymentDetailsResponse.getPayDetails(); .... model.addAttribute("paymentDetails", paymentDetails); } } The bean is: ViewDet.class List &lt;String&gt; colours; List &lt;String&gt; design; ... Once showPayment method is completed view.jsp is displayed and i am using jstl in the jsp. I have a view button in the jsp, and basically I want to add a check in the view.jsp that if colours and design are empty then hide the view button. Any idea how to do it from the controller please?
possible better answer: http://stackoverflow.com/a/26283368
type: Question
tagged with: java
score: 0
answer count: 2
tagged with: jstl
has title: Spring mvc how to add a variable in controller and use it as a condition in jsp
tagged with: jsp
has answer: http://stackoverflow.com/a/26283368

http://stackoverflow.com/a/26331964
score: 2
downvote count: 0
has body: Did you remember to import java.awt.Toolkit? Besides, this is a really bad way to do this, this will expand under the "extra" content that many OSs have on the screen (the TaskBar on Windows for example), and will be displayed underneath it. Instead, you could use JFrame#setExtendedState and pass it JFrame. MAXIMIZED_BOTH which maximise the window so it fills the entire application viewable area. Now, if you REALLY want the window to occupy the ENTIRE screen, you're going to have take a look at Full screen exclusive mode, which will bring it's own issues If you want to know the "viewable" size of a screen (that is the area which application windows should appear within), you could use something like... Rectangle bounds = new Rectangle(0, 0, 0, 0); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); gd = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gd.getDefaultConfiguration(); bounds = gc.getBounds(); Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc); bounds.x += insets.left; bounds.y += insets.top; bounds.width -= (insets.left + insets.right); bounds.height -= (insets.top + insets.bottom); Which will return the viewable space of the desktop minus all the system stuff...
answers question: http://stackoverflow.com/q/26331920
upvote count: 2
type: Answer

http://stackoverflow.com/q/26336683
upvote count: 3
has answer: http://stackoverflow.com/a/26336787
has title: What is the meaning of daimond bracket in java generics containg two types List<car>
has body: Whats is List&lt;Car&lt;U&gt;&gt;?,what is the meaning of two parameters inside the List?Am new to generics and this the example code i picked it online...Explain pls! package generics; import java.util.ArrayList; import java.util.List; class Car&lt;T&gt;{ private T t; public T getT() { return t; } public void setT(T t) { this.t = t; } } public class CarList{ public static &lt;U&gt; void addCar(U u, List&lt;Car&lt;U&gt;&gt; cars){ //Whats is List&lt;Car&lt;U&gt;&gt;?,what is the meaning of two parameters inside the List? Car&lt;U&gt; car=new Car&lt;&gt;(); car.setT(u); //Could someone expalin the above code cars.add(car); } public static void main(String[] args) { ArrayList&lt;Car&lt;String&gt;&gt; carlist=new ArrayList&lt;&gt;(); CarList.addCar("Audi", carlist); } }
downvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/26338464
possible better answer: http://stackoverflow.com/a/26336787
score: 1
has comment: http://stackoverflow.com/comment/41336755
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/41336338
favorite count: 0
has answer: http://stackoverflow.com/a/26338464
tagged with: generics
type: AnsweredQuestion

http://stackoverflow.com/a/26271657
has body: As per the above JSON structure, your Java objects will look like this: public class OutermostClass{ private Hardware hardware; private String name; private Set&lt;Network&gt; network = new HashSet&lt;Network&gt;; } public class Hardware { private int cores; private int cpu; } public class Network { private String interface_name; private String interface_ip; private String interface_mac }
type: Answer
answers question: http://stackoverflow.com/q/26271526
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/87330889
upvote count: 2

http://stackoverflow.com/comment/41340325
comment on: http://stackoverflow.com/q/26338535
score: 0
type: Comment
type: QuestionComment
has text: Are you using any OR mapper to access your tables?

http://stackoverflow.com/q/26288331
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41271604
has body: I was trying to implement the functionality of transferring local files to a network drive using jcifs library but upon running the program on the command line I was receiving following exception: Exception in thread "main" java.lang.NullPointerException jcifs.smb.ServerMessageBlock.writeString(ServerMessageBlock.java: 202) To understand the error I tried debugging the code on eclipse and while doing so at line: NtlmPasswordAuthentication authentication = new NtlmPasswordAuthentication("xxxxxx.xx.com",username,password); I received an exception stating ClassNotFoundException. But I have the jcifs.jar in the build path. A quick google search for 'ntlmpasswordauthentication' classnotfoundexception landed me on two threads with same issue but no resolution. Please let me know how can I resolve this. Thank you Here is the whole function, just in case needed: private static void TransferFiles() { File transfer_files = new File (sourcepath); File[] files = transfer_files.listFiles(); String username = properties.getProperty("user"); String password = properties.getProperty("password"); String source = sourcepath; SmbFileOutputStream outputStream = null; FileInputStream inputStream = null; SmbFile copyFile = null; byte[] buffer = new byte[16*1024*1024]; int length = 0; jcifs.smb.NtlmPasswordAuthentication authentication = new NtlmPasswordAuthentication("xxxxxxx",username,password); try { copyFile = new SmbFile(destinationpath,authentication); } catch (MalformedURLException e) { e.printStackTrace(); } try { outputStream = new SmbFileOutputStream(copyFile); } catch (SmbException | MalformedURLException | UnknownHostException e) { e.printStackTrace(); } try { inputStream = new FileInputStream(sourceFile); } catch (FileNotFoundException e1) { e1.printStackTrace(); } try { while((length = inputStream.read(buffer))&gt;0) { outputStream.write(buffer, 0, length); } } catch (IOException e) { e.printStackTrace(); } try { inputStream.close(); outputStream.close(); } catch (IOExceptio…
has title: Using jcifs for copying files to network drive
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41248637
tagged with: jcifs
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/41080099
score: 0
has text: can you do a Log.e("urltest", items.get(position).getLink())` to see the full url you pass to `decodeStream`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26197643

http://stackoverflow.com/q/26222817
has answer: http://stackoverflow.com/a/26223292
score: 1
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/4355046
has answer: http://stackoverflow.com/a/38015292
tagged with: sqlite
downvote count: 0
favorite count: 0
has title: java sqlite autocommit slow
has body: Background: I'm working with Java in Netbeans. I'm reading rows from a CSV file and inserting them into a SQLite database. Very basic stuff I would think. From examples found at this site and elsewhere I've constructed the following code. It works but I'm surprised to see how slow it is. It takes 3.95 seconds to load 46 lines into the db! Using the Netbeans Profiler I can see it's the autoCommit() that's taking the bulk of the time, 3.7 seconds. What am I doing wrong? Or, is this just the penalty for using SQLite instead of MySQL? public static void LoadJCNAClassesTable(Connection aConn, String strPath) throws SQLException{ String [] nextLine; String strDivision; String strClass; String strNotes; String strDescription; Statement stat = aConn.createStatement(); stat.executeUpdate("drop table if exists JCNAClasses;"); String q = "create table JCNAClasses ('ID' INTEGER PRIMARY KEY AUTOINCREMENT, 'division' TEXT NOT NULL, 'class' TEXT NOT NULL UNIQUE, 'description' TEXT NOT NULL, 'note' TEXT NOT NULL, 'node' INTEGER NOT NULL);"; stat.executeUpdate(q); CSVReader reader; int iLine; String JCNAClassesCSV = strPath + "\\JCNAClassesCsv.txt" ; try { reader = new CSVReader(new FileReader(JCNAClassesCSV )); iLine = 0; while ((nextLine = reader.readNext()) != null) { // nextLine[] is an array of values from the line // System.out.println(nextLine[0] + nextLine[1] ); if (iLine &gt; 0){ strDivision = nextLine[0]; strClass = nextLine[1]; strDescription= nextLine[2]; strNotes= nextLine[3]; PreparedStatement prep = aConn.prepareStatement( "insert into JCNAClasses ('division', 'class', 'description', 'note', 'node') values ( ?, ?, ?, ?, ?);"); prep.setString(1, strDivision); // note that the comma seems not to be a problem prep.setString(2,strClass); prep.setString(3,strDescription); prep.setString(4,strNotes); prep.setInt(5,iLine); prep.addBatch(); aConn.setAutoCommit(false); prep.executeBatch(); aConn.setAutoCommit(true); } iLine++; } } catch (FileNotFoundException ex) { Logger.getL…
type: UnansweredQuestion
upvote count: 1
tagged with: autocommit

http://stackoverflow.com/a/26314378
downvote count: 0
has comment: http://stackoverflow.com/comment/41295121
has body: If you have configured eclipse for Perl, then following steps will be helpful. In file menu, there is an option Import.Go there and from the opened dialog box, choose, Perl project. After selecting, you will get a dialog box where you need to select the project folder from the local directory structure and the folder where you want to import the project.
has comment: http://stackoverflow.com/comment/41295007
accepted answer of: http://stackoverflow.com/q/26314264
answers question: http://stackoverflow.com/q/26314264
upvote count: 2
has comment: http://stackoverflow.com/comment/41295201
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41295456
has comment: http://stackoverflow.com/comment/41295339
has comment: http://stackoverflow.com/comment/41295299
has comment: http://stackoverflow.com/comment/41295275
type: Answer
has comment: http://stackoverflow.com/comment/41294902
has comment: http://stackoverflow.com/comment/41296022
score: 2

http://stackoverflow.com/comment/41240642
score: 1
has text: you mean apart from putting it in META-INF from the root of the CLASSPATH? that's really all there is to know
comment on: http://stackoverflow.com/q/26283850
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26334961
score: 0
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/41333302
tagged with: log4j2
type: Question
tagged with: aop
has answer: http://stackoverflow.com/a/26337453
has body: I am having a fairly large legacy (swing) application and currently brainstorming and evaluating the strategies to add logging in it. Key point is that it's fairly large (like I said above) and thinking what could be the strategy to do it quickly and completely (100% coverage for argument sake) (let's say logging is no customer facing core business functionality, so let's say not getting paid for it) So the two strategies as such are - Do use log4j2 add the debug statements, add appenders, file rolling rules, add dynamic on/off and change of log levels etc and thus do it the way it ideally should be done. Use AOP to define endpoints and advices declaratively/programmaticly. Device such elaborate rules, add in the rest of the part (appenders, rolling rules etc.) and thus wont be touching each and every file and adding a revision just for that. The second strategy is what I want to explore if someone has experience with, if somebody has gone that route. The cons I can think of - No standard / convention in apps, would be 99% impossible to define endpoints completely Sphagetti and unmaintainable code in AOP module above, largely a result of the above problem Adding same and matching set to logging to future classes. Can you guys suggest me wither ways
answer count: 1
favorite count: 0
has title: Logging in Java application where none exist originally
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41334382

http://stackoverflow.com/q/26317535
score: 0
tagged with: java
tagged with: hibernate
tagged with: jpa
type: UnansweredQuestion
has body: I'm trying to get data with grouping from the database using Spring JPA, my classes are : Employee.java @Entity @Table(name = "employee") public class Employee implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column(nullable=false, unique=true) private String name; @Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime") @Column(name="date_of_birth") private LocalDateTime dateOfBirth; private Double salary; @Column(name="marital_status") private String maritalStatus; @DateTimeFormat(pattern="MM/dd/yyyy") @Column(name="date_of_hire") @Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime") private LocalDateTime dateOfHire; private String title; @ManyToOne() @JoinColumn(name="dpartment_id") private Department department; //security additions @Column(nullable=false) private String password; @OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL) @JoinColumn(name="employee_id") private Set&lt;Role&gt; roles = new HashSet&lt;&gt;(); } Department.java @Entity @Table(name = "department") public class Department implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column(nullable=false, unique=true) private String name; @OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL) @JoinColumn(name="department_id") private Set&lt;Employee&gt; employees = new HashSet&lt;Employee&gt;(); @OneToOne() @JoinColumn(name="manager_id",nullable=true) private Employee manager; } I'm trying to get the data from the sql query : select Dep.id, Dep.name as department_name , sum(emp.salary) as total_salaries, count(emp.id) as employee_count, dep.manager_id from employee emp inner join department dep on emp.department_id = dep.id group by dep.id I have tried the using query= EntityManager .createQuery("select new com.me.domain.DepartmentSummary( d, sum(e.salary), count(e.id) ) " + " from Department d inner JOIN d.employees e group by d.id "); List items = …
type: Question
tagged with: sql
has comment: http://stackoverflow.com/comment/41300792
has title: Spring JPA join tables with grouping
tagged with: spring
answer count: 1
has answer: http://stackoverflow.com/a/26329960

http://stackoverflow.com/q/26227679
score: 0
has body: Im trying to load a file from someone's computer and just put it into a label as an icon. When I try to run it I get a NullPointer error. It breaks when I get to the setIcon code /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { TheChooser frame = new TheChooser(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public TheChooser() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JButton searchButton = new JButton("Search Picture"); searchButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg"); fc.setFileFilter(filter); int response = fc.showOpenDialog(null); try{ if (response == JFileChooser.APPROVE_OPTION) { String pathName = fc.getSelectedFile().getPath(); JOptionPane.showMessageDialog(null, pathName); ImageIcon icon = new ImageIcon(pathName); picPanel.setIcon(icon); } else { JOptionPane.showMessageDialog(null, "Feel Free to Look Later"); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); searchButton.setBounds(141, 11, 139, 23); contentPane.add(searchButton); JLabel picPanel = new JLabel(""); picPanel.setIcon(null); picPanel.setBounds(10, 58, 414, 192); contentPane.add(picPanel); } What about this is not working? I tried to do the fix down below but I still get a long list of errors java.lang.NullPointerException at chooser.TheChooser$2.mouseClicked(TheChooser.java:70) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at…
answer count: 1
has title: Using JFileChooser to load an Image into a JLabel Icon
tagged with: jlabel
tagged with: imageicon
type: UnansweredQuestion
tagged with: swing
tagged with: jfilechooser
tagged with: java
has answer: http://stackoverflow.com/a/26227983
has comment: http://stackoverflow.com/comment/41137116
type: Question

http://stackoverflow.com/comment/41114511
has text: Yes, it's Java. I changed it, sorry. I tweaked the code so it now reads: **bold**selectionSort(userArray); for (i = 0; i < userArray.length; i++) { System.out.println(Integer.toString(min)) + " " + Double.toString(userArray[]) + " " + (Integer.toString(max));**bold** It does not like the fact that I'm trying to convert the array to a string. I have no idea how to fix that.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26216220
type: AnswerComment

http://stackoverflow.com/comment/41288023
comment on: http://stackoverflow.com/a/26309180
has text: Your help was tremendous, and I truly appreciate your support. I am just having an issue resolving the limitation of items on the list for this is how I declare the list - messagesList = (ListView) findViewById(R.id.listMessages); messageAdapter = new MessageAdapter(this);\
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26248851
has comment: http://stackoverflow.com/comment/41176093
has body: I'm studying linked lists. With some help from the book Cracking the Coding Interview, I created the following code to create a linked lists, add elements to its end and print the elements. However when I run the code, it returns just "null" instead of printing the list i.e. "Sanchez". "Ozil" and "Welbeck". Help? public class CreateLinkedList{ static class Node{ String PlayerName; Node next = null; //Constructor Node(String PName){ PlayerName = PName; } //Method to insert a Node void InsertNodeAtEnd(String PlayerName){ Node transition = new Node(PlayerName); Node n = this; while(n.next != null){ n = n.next; } n.next = transition; } //Method to print all elements of linked list void PrintList(){ Node n = this; while (n.next != null){ System.out.println(n.PlayerName + "\n"); n = n.next; } } } public static void main(String[] args) { Node first = new Node("Sanchez"); first.InsertNodeAtEnd("Ozil"); first.InsertNodeAtEnd("Welbeck"); first.PrintList(); } }
has comment: http://stackoverflow.com/comment/41175831
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26249311
has answer: http://stackoverflow.com/a/26249121
tagged with: java
tagged with: methods
possible better answer: http://stackoverflow.com/a/26248923
type: Question
has answer: http://stackoverflow.com/a/26248923
has answer: http://stackoverflow.com/a/26248907
tagged with: class
score: 0
accepted answer: http://stackoverflow.com/a/26248907
has title: Java - Traversing a linked list only returns null
tagged with: system.out
answer count: 4
tagged with: linked-list

http://stackoverflow.com/comment/41239592
type: AnswerComment
has text: This setup is almost identical to what I have going. I just simplified for purposes of my question. MyServer (brains with connectionHandler thread), every connection spawns MyCommandHandler thread with input/output streams to client. When MyServer and MyCommandHandler were competing over the same DataOutputStream I got my issues, now with wrapping the WriteUTF() calls in synchronized, hopefully I won't see it anymore. Appreciate your 2 cents(positive affirmation)!! :D
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26270983

http://stackoverflow.com/q/26272508
score: 4
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/26272588
has body: "Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0" is the main error I get when I compile this method: public static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; createSparseArray(int len, double den) { int counter = 0; ArrayList&lt;Integer&gt; placeHolder = new ArrayList&lt;Integer&gt;(); for (int j = 0; j &lt; len; j++) { double randomNumber = Math.random(); if (randomNumber &lt; den) { counter++; placeHolder.add(j); } } ArrayList&lt;ArrayList&lt;Integer&gt;&gt; list = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); for (int k = 0; k &lt; counter; k++) { for (int m = 0; m &lt; 2; m++) { list.get(0).set(placeHolder.get(k), (int) (Math.random() * (99999) + 1)); } } return list; } How can I fix this?
has answer: http://stackoverflow.com/a/60593550
has title: "Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0" with ArrayList?
type: UnansweredQuestion
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/39849827
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26272621
has comment: http://stackoverflow.com/comment/41218698
downvote count: 0

http://stackoverflow.com/q/26319903
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26320101
answer count: 2
has title: Java GradeCalculator - While loop not working correctly
has answer: http://stackoverflow.com/a/26320078
score: 0
tagged with: while-loop
possible better answer: http://stackoverflow.com/a/26320078
accepted answer: http://stackoverflow.com/a/26320101
has body: I'm writing a program where a user enters a number of students in a class, the number of exams taken in the class, then enters each student's names and exam scores. The program then calculates that student's grade and assigns them a corresponding letter grade. Then finally, it adds their scores to a classSum, calculates the average class score and displays it. This is what I have so far: public class GradeCalculator { public static void main(String[] args) { int classSum = 0; // variable used to hold sum of entire classes exams int classExams = 0; // variable used to hold number of exams taken by whole class Scanner s = new Scanner(System.in); System.out.println("Welcome to Gradecalculator!"); System.out.println("Please enter the number of students:"); int students = s.nextInt(); System.out.println("Please enter the number of exams:"); int exams = s.nextInt(); int i = 0; int studentnumber = 1; int sum = 0; while (i &lt; students) { // loop until it matches number of students entered above i++; sum = 0; System.out.println("Enter student " + studentnumber++ + "'s name :"); String studentname = s.next(); System.out.println("Enter exam scores :"); int input = 0; for (; input &lt; exams; input++) { int n = s.nextInt(); sum+=n; if (n &lt; 0) { System.out.println("Invalid exam scores, reenter: "); //if one of the scores entered is negative, display message } } double average = sum/exams; // assign letter grade based on average of exams if (average &lt;= 100 &amp;&amp; average &gt;= 90) { System.out.println("Letter grade: A"); System.out.println(studentname + " gets 4 stars! ****"); } if (average &lt;= 89 &amp;&amp; average &gt;= 80) { System.out.println("Letter grade: B"); System.out.println(studentname + " gets 3 stars! ***"); } if (average &lt;= 79 &amp;&amp; average &gt;= 70) { System.out.println("Letter grade: C"); System.out.println(studentname + " gets 2 stars! **"); } if (average &lt;= 69 &amp;&amp; average &gt;= 60) { System.out.println("Letter grade: D"); System.o…
has comment: http://stackoverflow.com/comment/41305190
type: AnsweredQuestion

http://stackoverflow.com/q/26197645
has title: Is there a way to use (JAX-RS) Jersey reflection api to access methods given a path as an argument?
tagged with: java
type: Question
tagged with: jersey
has body: Jersey must handle internal mappings to resources such that if given a url (/root/my/resource) will call the appropriate class/method annotated to handle the request. I have been searching the api looking for a way to get a class instance (and the correct method) that a given path points to. Is this possible? For example: Class&lt;?&gt; clazz = SomeJerseyMethodToGetClass('/root/my/resource'); I found something similar in this post: Find a list of all Jersey resource methods in my app? but in this case, I would need to know the handling class beforehand. Any thoughts? Thanks in advance.
upvote count: 3
tagged with: rest
favorite count: 0
type: UnansweredQuestion
tagged with: annotations
linked to: http://stackoverflow.com/q/13484350
score: 3
answer count: 0
downvote count: 0
tagged with: reflection

http://stackoverflow.com/comment/41168154
has text: immediately after the execute, can you add `Log.e("resp.length", ""+response.getEntity().getContentLength());` - what does this show.
type: Comment
comment on: http://stackoverflow.com/a/26242381
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41226499
type: QuestionComment
type: Comment
has text: Thanks for reply I tried but still it is not working !
comment on: http://stackoverflow.com/q/26276874
score: 0

http://stackoverflow.com/comment/41231625
type: QuestionComment
comment on: http://stackoverflow.com/q/26279805
has text: Can you please post your full exception from logcat.
score: 0
type: Comment

http://stackoverflow.com/comment/41217448
score: 0
type: Comment
has text: You must know that I have no chance to get to the controller and even JSR bean validation. The 400 Bad Request is trigerred probably by Spring converter, which launches before JSR validation
comment on: http://stackoverflow.com/a/26258865
type: AnswerComment

http://stackoverflow.com/q/26281417
linked to: http://stackoverflow.com/q/3083781
downvote count: 0
has title: How to get the month start and end date for the ISO year using Joda time library in Java
score: 1
has comment: http://stackoverflow.com/comment/41235042
has answer: http://stackoverflow.com/a/34348799
has answer: http://stackoverflow.com/a/26281717
favorite count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: java
has body: For a specific month and year,I want to get the month start and end date for the ISO year using Joda time library in Java. Like say for example, I have month as March and year 2014, SO I want to know the starting and end date for the month March in ISO year. Apart from joda-time library, Is there also any other way to get the same thing.
tagged with: jodatime
answer count: 2

http://stackoverflow.com/q/26203319
has title: How to use of print("HelloWorld") instead of System.out.println("Hello World");
favorite count: 0
has comment: http://stackoverflow.com/comment/41090157
has comment: http://stackoverflow.com/comment/41090076
has answer: http://stackoverflow.com/a/26203350
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41090281
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26203374
has comment: http://stackoverflow.com/comment/41090079
downvote count: 1
linked to: http://stackoverflow.com/q/3320764
type: Question
duplicate of: http://stackoverflow.com/q/3320764
has body: I want to know how can I use just: Print("statement") instead of a full path like: System.out.println("Statement"); What lib do I have to import to do this?
has comment: http://stackoverflow.com/comment/41090204
has comment: http://stackoverflow.com/comment/41090718
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41091412

http://stackoverflow.com/comment/41234103
type: AnswerComment
score: 0
type: Comment
has text: Thanks this helped alot. Having an example and explanation helped. At least you didn't point me to an article. Much appreciated.
comment on: http://stackoverflow.com/a/26280705

named-query
type: Tag
tag name: named-query
tags question: http://stackoverflow.com/q/26329976

http://stackoverflow.com/comment/41096827
type: Comment
has text: @rayman: a *HashMap* is a mapping between a *Hashed* key, and a value. The value never gets hashed, only the key is. The uniqueness only affects keys.
comment on: http://stackoverflow.com/a/26206500
score: 0
type: AnswerComment

structr
tags question: http://stackoverflow.com/q/26336938
tag name: structr
type: Tag

http://stackoverflow.com/a/26239025
has body: There seems to be a feature in the akka library to solve this. Did not use it on my own, but sound's promissing: after[T] Documentation about it here If the Future is completed Successfully, the actor can send itselfe a poison pill. self ! PoisonPill
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26238816
type: Answer

http://stackoverflow.com/comment/41279557
type: AnswerComment
comment on: http://stackoverflow.com/a/26305717
type: Comment
has text: He should either have a getName() or a toString(). I had to pick one, and getName() seamed the logic choice ;)
score: 1

sharepoint
tags question: http://stackoverflow.com/q/26265456
tag name: sharepoint
tags question: http://stackoverflow.com/q/26280656
type: Tag

http://stackoverflow.com/q/26255670
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41201451
favorite count: 0
has body: I'm trying to convert a Bitmap to String that I can include in my multipart HTTP request, I have to construct the request body manually and my problem is that when I convert the Bitmap to byte array and then from byte array to String I seem to lose the integrity of the file structure. How can I convert the Bitmap to String without damaging the file structure? Bitmap imageBitmap = BitmapFactory.decodeFile(data.getData()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); imageBitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); String s = new String(baos.toByteArray());
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: bitmap
has comment: http://stackoverflow.com/comment/41200899
has comment: http://stackoverflow.com/comment/41200429
score: 1
tagged with: java
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/41203398
has comment: http://stackoverflow.com/comment/41200146
has answer: http://stackoverflow.com/a/26256309
has title: Android - Converting Bitmap to string to be included in multipart request
has comment: http://stackoverflow.com/comment/41200392
has comment: http://stackoverflow.com/comment/41201129
tagged with: multipart
has comment: http://stackoverflow.com/comment/41203521
has comment: http://stackoverflow.com/comment/41203715

http://stackoverflow.com/q/26242674
downvote count: 1
duplicate of: http://stackoverflow.com/q/17917719
has comment: http://stackoverflow.com/comment/41164194
has answer: http://stackoverflow.com/a/26242736
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26242736
tagged with: java
has comment: http://stackoverflow.com/comment/41164112
linked to: http://stackoverflow.com/q/17917719
type: Question
tagged with: casting
upvote count: 1
has title: Java variables casting
answer count: 1
tagged with: variables
favorite count: 0
score: 0
has body: I have a questions about casting variables in java. I have the following code byte b1 = 6; byte b2 = 5; byte bsum; bsum = (b1 + b2); // (1) What the code needs to be in order to work is: byte b1 = 6; byte b2 = 5; byte bsum; bsum = (byte)(b1 + b2); // (2) Why in the (1) case eclipse says cannot convert from int to byte ? why does b1 + b2 goes to int when byte variables can take up to 127 ? I am confused.. Thanks for your time!
tagged with: byte
has comment: http://stackoverflow.com/comment/41164123

http://stackoverflow.com/comment/41193388
has text: true .. i came out with the wording a little too strong. Because people would rarely need to override `start()`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26258852

http://stackoverflow.com/q/26207851
score: 0
type: Question
has answer: http://stackoverflow.com/a/26207903
tagged with: java
answer count: 1
tagged with: sorting
has body: I have the following code in an note taking app. The notes are sorted by keys. TreeSet puts the oldest first. I would like to do the contrary. Which class to use? //retrieve data, map unordered data collection with a key and a value Map&lt;String, ?&gt; notesMap = notePrefs.getAll(); //get a list of all the keys of the notes, keySet-return all Keys without order, TreeSet-sorts data SortedSet&lt;String&gt; keys =new TreeSet&lt;String&gt;(notesMap.keySet());
has title: If TreeSet arranges data from oldest to newest which class orders them from newest to oldest
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/26235530
has body: In Python the solution will look like this: driver.find_element_by_class_name("filterboxCol2").click() Select(driver.find_element_by_class_name("filterboxCol2")).select_by_visible_text("Maatwerk") driver.find_element_by_css_selector("option[value=\"1\"]").click() You can try to use the "class name" instead of the "name" and see if it will pass. I do not have Selenium in Java but the equivalent should look similar to this (using also the "name" type): driver.findElement(By.name("kiesMaatregelPanel:maatregel")).click(); new Select(driver.findElement(By.name("kiesMaatregelPanel:maatregel"))) .selectByVisibleText("Maatwerk"); driver.findElement(By.cssSelector("option[value=\"1\"]")).click();
has comment: http://stackoverflow.com/comment/41152204
downvote count: 0
has comment: http://stackoverflow.com/comment/41150997
type: Answer
has comment: http://stackoverflow.com/comment/41151907
has comment: http://stackoverflow.com/comment/41369275
score: 1
has comment: http://stackoverflow.com/comment/41151580
has comment: http://stackoverflow.com/comment/41150737
upvote count: 1
has comment: http://stackoverflow.com/comment/41150589
has comment: http://stackoverflow.com/comment/41151746
answers question: http://stackoverflow.com/q/26235231

http://stackoverflow.com/a/26303707
score: 0
has body: Make InnerClass static public class SecondClass { public static class InnerClass{ } }
answers question: http://stackoverflow.com/q/26303569
type: Answer

http://stackoverflow.com/q/26318048
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/41301730
tagged with: arrays
score: 0
tagged with: nullpointerexception
answer count: 1
accepted answer: http://stackoverflow.com/a/26318204
has title: How can I create a JTextField array?
linked to: http://stackoverflow.com/q/16195134
has answer: http://stackoverflow.com/a/26318204
tagged with: swing
type: AnsweredQuestion
has body: I want to add many text fields for my project and decided to just use arrays because all those 22 text fields have the same attributes. I had tried JTextField txtFld[] = new JTextField[5];. it has no parameter errors but when I try to run my program, this shows up in the console Exception in thread "main" java.lang.NullPointerException I don't want to use JTextField txtFld[] = new JTextField[]{ new JTextField(10), ... ... ... // repeat the same code about 20 times }; Because it takes up so many lines and the text fields are of the same type anyway. All I want to do is an array of text fields with the same length and just use mainPanel(txtFld[0]); ... mainPanel(txtFld[21]); Is it possible to create a text field array in just a single line of code?
tagged with: java
has comment: http://stackoverflow.com/comment/41301816

http://stackoverflow.com/comment/41171751
comment on: http://stackoverflow.com/q/26246568
type: Comment
type: QuestionComment
score: 0
has text: @HotLicks Added motivation info.

http://stackoverflow.com/q/26327195
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41326451
has title: How to pass an array from C to Java over JNI without making a copy
type: Question
has body: in C I have int left = ..., top = ..., width = ..., height = ...; void *pixels = GetScreenshot(left, top, width, height); // use JNI to call SaveImageToGallery ::free(pixels); in Java I have public void SaveImageToGallery(int[] pixels, int width, int height) { // ... } How do I pass pixels to Java function SaveImageToGallery using JNI without making a copy of them?
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/41318599
upvote count: 1
tagged with: android
linked to: http://stackoverflow.com/q/3944717
favorite count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41153010
comment on: http://stackoverflow.com/q/26236756
has text: @Warmaster: my point exactly. in the original `sendTextMessage` function is the code for actually sending the sms. This is the code you want to use to send the SMS. Or, add a new function in `SmsManager` to do that part for you.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41150700
comment on: http://stackoverflow.com/q/26235583
has text: From ur point,what I understand is " AOP is manual way of using break points"..correct me if I am wrong
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26279036
score: 1
answers question: http://stackoverflow.com/q/26274751
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 1
has body: Try something like exclude { it.file.absolutePath.startsWith("$projectDir/srcB/a/b/") } (use backslashes on Windows).
accepted answer of: http://stackoverflow.com/q/26274751

http://stackoverflow.com/q/26267858
upvote count: 1
downvote count: 0
has title: hiding your password in java class file for a test case
favorite count: 0
tagged with: information-hiding
answer count: 4
has answer: http://stackoverflow.com/a/26267924
tagged with: jenkins
type: UnansweredQuestion
has body: I am trying to write a selenium test case which will be put on company jenkins server where all the employee will have access to every java files I create. public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://somesite.com"); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); WebElement userName=driver.findElement(By.xpath(".//*[@id='username']")); userName.clear(); userName.sendKeys("someName@somecompany.com"); WebElement password=driver.findElement(By.xpath(".//*[@id='password']")); passwordclear(); password.sendKeys("password"); password.submit(); driver.quit(); What I want to do is not show the "password" there, I don't want other employees to see my password. Is there any way I can do that?
tagged with: selenium
has answer: http://stackoverflow.com/a/26280794
tagged with: testing
score: 1
has answer: http://stackoverflow.com/a/26267990
tagged with: java
linked to: http://stackoverflow.com/q/26099005
has answer: http://stackoverflow.com/a/59793120
type: Question

http://stackoverflow.com/q/26275401
tagged with: java
has title: Executing long-running task from Tapestry using already existing EJB service
has body: I have the following situation. I have my web site written in Tapestry. On one of the pages, I'm required to generate a fairly large Excel or PDF document (around 20 MB). Now, since the entire process takes time, I'm asking my user to wait a bit. However, when I tried to test the upper limits, I noticed that my entire application (not just the web part) freezes, because the generation eats up all the resources and the rest of the website and application becomes unresponsive. Here is the flow how I've been doing it so far. User clicks a button to request the file on the page Data is being fetched from database (this part is quite fast) Data is passed to a Tapestry service which prepares it (nothing fancy, also fast) Prepared data is sent to EJB service which creates and deploys a visitor which creates the excel/pdf file The InputStream of the created file is passed all the way up to Tapestry which wraps it in StreamResponse and offers the download What would be an appropriate way to handle this problem? Could I perhaps use Tapestry's ParallelExecutor from some Tapestry service of mine in a manner like this? Future&lt;InputStream&gt; future = executor.invoke(new Invokable&lt;InputStream&gt;() { ... }); My main objective is that the application and website keep running, that they do not freeze. Thank you in advance.
type: Question
accepted answer: http://stackoverflow.com/a/26275859
answer count: 1
tagged with: tapestry
score: 0
tagged with: executorservice
tagged with: long-running-processes
has answer: http://stackoverflow.com/a/26275859
tagged with: excel
type: AnsweredQuestion

http://stackoverflow.com/comment/41078730
has text: It's not "a bit drastic"; it's absurd.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26195555

http://stackoverflow.com/comment/41255811
comment on: http://stackoverflow.com/a/26287489
score: 0
type: AnswerComment
type: Comment
has text: Nop, it is a good way. (Actually the second option I posted in the answer).

http://stackoverflow.com/a/26330571
score: 0
has comment: http://stackoverflow.com/comment/41325670
has comment: http://stackoverflow.com/comment/41325674
has body: for (int x=0;x&lt;10;x++) { System.out.println("Please enter contractName"); contractName = input.nextLine(); System.out.println("Please enter mins"); mins = input.nextInt(); if(mins &gt; 60 &amp;&amp; mins &lt; 7200) break; } Use 'break' to break out of a loop. Also, the for loop just replaces each variable each time, making it store only the values on x = 9. If you want every value for mins and contractName, use arrays. I don't understand your symbol out of scope error, can you paste your error output?
type: Answer
answers question: http://stackoverflow.com/q/26330246

http://stackoverflow.com/a/26242727
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
answers question: http://stackoverflow.com/q/26242677
has body: The executeQuery() method is only for executing select statements. For insert, update, and delete statements, you should use the executeUpdate() method. Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26242677

listview
tags question: http://stackoverflow.com/q/26262710
tags question: http://stackoverflow.com/q/26310885
tags question: http://stackoverflow.com/q/26309893
tags question: http://stackoverflow.com/q/26240912
tags question: http://stackoverflow.com/q/26314098
tags question: http://stackoverflow.com/q/26269009
tag name: listview
tags question: http://stackoverflow.com/q/26322236
tags question: http://stackoverflow.com/q/26269584
tags question: http://stackoverflow.com/q/26271473
tags question: http://stackoverflow.com/q/26210489
tags question: http://stackoverflow.com/q/26330670
tags question: http://stackoverflow.com/q/26231952
tags question: http://stackoverflow.com/q/26195799
tags question: http://stackoverflow.com/q/26291887
tags question: http://stackoverflow.com/q/26202931
tags question: http://stackoverflow.com/q/26309586
tags question: http://stackoverflow.com/q/26315922
tags question: http://stackoverflow.com/q/26268902
tags question: http://stackoverflow.com/q/26206849
type: Tag

http://stackoverflow.com/comment/41200649
has text: Why can't you use an iterator? (Updated my answer.)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26262125

http://stackoverflow.com/q/26324212
tagged with: android
has title: Why does a ListView need an adapter assigned to it
has comment: http://stackoverflow.com/comment/41312963
favorite count: 0
possible better answer: http://stackoverflow.com/a/26324238
score: -4
linked to: http://stackoverflow.com/q/3674951
has comment: http://stackoverflow.com/comment/41312979
downvote count: 4
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/26324253
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26324253
has answer: http://stackoverflow.com/a/26324238
has body: I know a list view needs an adapter, but WHY what is the purpose of it, and can it show lists without an adapter ?

http://stackoverflow.com/comment/41087792
has text: `How can I send the number to the server beforehand i send the message?` What is the problem? You first send the phone number then the message.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26201827
type: QuestionComment

http://stackoverflow.com/a/26319639
score: 0
has comment: http://stackoverflow.com/comment/41305003
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26319569
type: Answer
accepted answer of: http://stackoverflow.com/q/26319569
has body: if (input.hasNext()) people = input.nextInt(); else people = default_value; The hasNext() method returns false if there's no more input to read, and true otherwise.

http://stackoverflow.com/a/26348512
upvote count: 1
answers question: http://stackoverflow.com/q/26348468
type: Answer
has body: The syntax is this: export VAR='value' So use export JAVA_HOME='/usr/lib/jvm/java-7-openjdk-i386/bin'
downvote count: 0
score: 1

http://stackoverflow.com/comment/41082391
type: QuestionComment
comment on: http://stackoverflow.com/q/26198978
score: 0
has text: You don't want to use `this.robot = robot;`?
type: Comment

simplecaptcha
tags question: http://stackoverflow.com/q/26301029
type: Tag
tag name: simplecaptcha

http://stackoverflow.com/a/26308086
has comment: http://stackoverflow.com/comment/41369089
has comment: http://stackoverflow.com/comment/41356166
has body: I can suggest to you OnlyOnceTrigger: @Bean public Trigger onlyOnceTrigger() { return new Trigger() { private final AtomicBoolean invoked = new AtomicBoolean(); @Override public Date nextExecutionTime(TriggerContext triggerContext) { return this.invoked.getAndSet(true) ? null : new Date(); } }; } Which should be injected to your &lt;int:poller&gt; of that adapter. However you should take care about some barrier for the entire application if you say that it is standalone one and you really shouldn't lose process before you decide to close the app. One of those good choice is CountDownLatch with 1 count as a bean. You should wait on it from your main before System.exit(0) or just use the last one in the end of your process: &lt;outbound-channel-adapter expression="T(System).exit(0)"/&gt; However you should think more if it really is suitable for your to run the adapter only once and if that max-messages-per-poll="1" is really good option. There may be no messages in the mail box, so onlyOnceTrigger may finish without good result for you and your app has strained into the void...
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26306739
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26306739
score: 2

http://stackoverflow.com/a/26277587
answers question: http://stackoverflow.com/q/26277370
downvote count: 0
score: 1
type: Answer
has body: Interesting question. After a little research i found this project on github which seems to fulfill your needs. https://github.com/reficio/soap-ws Here is some sample code from the github site which seems very easy and straightforward. Consume a Web-Serivce in 60 seconds Let's consume the CurrencyConverter Web-Service. Thanks to the fluent builders the API is straigtforward and intuitive. Does it need any explanation? Welcome to soap-ws :) Wsdl wsdl = Wsdl.parse("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"); SoapBuilder builder = wsdl.binding() .localPart("CurrencyConvertorSoap") .find(); SoapOperation operation = builder.operation() .soapAction("http://www.webserviceX.NET/ConversionRate") .find(); Request request = builder.buildInputMessage(operation) SoapClient client = SoapClient.builder() .endpointUrl("http://www.webservicex.net/CurrencyConvertor.asmx") .build(); String response = client.post(request);
upvote count: 1

http://stackoverflow.com/a/27582766
downvote count: 0
type: Answer
has body: EDIT 2: Sorry, I still didn't understand what you are asking. This is the actual answer - only read the other sections for interest. This docs page explains how you can extract the entities that are in your client-side Android "-Collection" generated class. You need to call .getItems(), not a named function like "getDatapointList()". Under "About Supported Return Types": Lists of serializable types Actually, what Endpoints generates is a new “Collection” JSON class that is similar to every other client model class. For example, if you have an object in your model that is represented by Lobster.java, and you want to return a List, the library will have a LobsterCollection.java. You can retrieve the list of Lobsters in your client by calling getItems(). EDIT: terribly sorry, I admit I skimmed your question and my brain parsed java. Python answer first: PYTHON You should become familiar with Message objects and their Fields. You cannot simply return a python object. Message objects contain multiple Field values that are used to translate the object into a JSON object for transfer over the API HTTP request. To return a Message object from your Endpoints function that has a list of multiple Message objects (each of which wraps a StringField and a DateTimeField, for example), the Message class defining the this return type should have a MessageField in it, which allows you to put Messages (such as the type we created that contains a StringField and a DateTimeField) inside other Messages (our return type). In addition, on this field, you will need to set repeated=True, as you can see in the following snippet: # REPEATED IN MESSAGE FIELD IN ORDER CLASS class Lot(messages.Message): price = messages.IntegerField(1, required=True) quantity = messages.IntegerField(2, required=True) class Order(messages.Message): symbol = messages.StringField(1, required=True) total_quantity = messages.IntegerField(2, required=True) trade_type = messages.EnumField(TradeType, 3, required=True) lo…
upvote count: 1
answers question: http://stackoverflow.com/q/26247006
score: 1
has comment: http://stackoverflow.com/comment/43609043

http://stackoverflow.com/comment/41112996
type: Comment
score: 0
has text: Why don't you just close the server/app? It will close the port also i think.
comment on: http://stackoverflow.com/q/26214517
type: QuestionComment

http://stackoverflow.com/a/26224491
answers question: http://stackoverflow.com/q/26210236
type: Answer
has comment: http://stackoverflow.com/comment/41132830
has comment: http://stackoverflow.com/comment/41133708
score: 2
has comment: http://stackoverflow.com/comment/41133450
upvote count: 2
has body: Okay, so instead of trying to figure out the relationship of the polygon to the button, which would take a quite a bit of work and would involve you having to be able to pre-calculate the required amount of space that the button AND the polygon would require, it would be simpler to "cheat" and make use of an appropriate layout manager to do the work for you... You should also not rely on "magic" numbers and should rely on what is actually known at runtime, such as the actual width and height of the component import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class PolyTest { public static void main(String[] args) { new PolyTest(); } public PolyTest() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } catch (UnsupportedLookAndFeelException ex) { } JButton btn = new JButton("A Button"); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridBagLayout()); frame.add(btn, gbc); frame.add(new PolyPane(), gbc); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class PolyPane extends JPanel { @Override public Dimension getPreferredSize() { return new Dimension(100, 100); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); g2d.translate(5, 5); int width = getWidth()…
has comment: http://stackoverflow.com/comment/41133103
downvote count: 0

http://stackoverflow.com/a/26335858
upvote count: 2
has body: thank you guys, the answer is : @NamedQuery(name = "event_find", query = "from Event where location.address like concat('%', :address, '%') or :address like concat('%', location.address, '%')")
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26329976
answers question: http://stackoverflow.com/q/26329976

http://stackoverflow.com/comment/41332250
type: AnswerComment
comment on: http://stackoverflow.com/a/26334463
type: Comment
score: 1
has text: +1 for your awesome explanation even my mother can understand it :)

http://stackoverflow.com/comment/41397911
type: Comment
comment on: http://stackoverflow.com/a/26352302
has text: MadProgrammer - I implemented the DecryptWorker Class and it never executes doInBackground(), it just returns which I don't understand. I'm using jre 1.7 65. I played around with it and explicitly called doInBackground() from the constructor. That obviously ran but I got the same results as before (all output was displayed at the end).I should also mention that I'm using a logging class that I wrote that writes to a file and standardOut. Even before, the logs were updated in a timely manner but not the JScrollPane. Thanks for helping out this 'crusty old UNIX/c guy'.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41217787
type: Comment
comment on: http://stackoverflow.com/a/26271205
score: 0
type: AnswerComment
has text: As the default, your app is responsible for handling everything that the native app would have. You'll have to create a Notification with the desired icons, text, sound, etc. There really isn't a way to pass it off to the native app, since it pretty much disables itself when it's not the default.

http://stackoverflow.com/comment/67289122
type: AnswerComment
comment on: http://stackoverflow.com/a/33822664
type: Comment
has text: How do you reference this? I've gotten this far however I don't know how to "summon" the second data source via JPA. I figured it would be either in the entity annotation or Query parameter or something.
score: 6

http://stackoverflow.com/comment/41169801
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26245237
has text: Thanks @Joakim, after looking around it seems that there are a number of jar file dependancies required to get the jasper jsp support to work inside jetty. I was hoping there would just be one jar file to download to keep my project lightweight and portable, but I couldn't find one. Finally decided jsp support wasn't worth the extra weight.
score: 0

http://stackoverflow.com/a/26284468
has body: Wrap it with a BufferedReader and start reading the data from it: StringBuilder sb = new StringBuilder(); try (BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()))) { String line; while ( (line = br.readLine()) != null) { sb.append(line).append(System.lineSeparator()); } String content = sb.toString(); //as example, you can see the content in console output System.out.println(content); } Once you have it as a String, parse it with a library like Gson or Jackson.
accepted answer of: http://stackoverflow.com/q/26284419
score: 7
answers question: http://stackoverflow.com/q/26284419
downvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/113956035
type: Answer
upvote count: 8

http://stackoverflow.com/q/26204601
upvote count: 1
answer count: 1
favorite count: 0
tagged with: themes
has title: Android: change application theme in java
tagged with: android
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26205101
type: Question
score: 1
tagged with: java
has body: I'm trying to build a multiTheme application. I want set theme of whole of application in java code. It can be set in XML in this way in Manifest file: &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/myTheme" &gt; I store the selected theme ID in SharedPreferences. I have tried the following code in my launcher activity: getApplicationContext().setTheme(R.style.mainTheme2); setContentView(R.layout.activity_action_selection); /////////////////////////////////////////////////////////////////// getApplication().setTheme(R.style.mainTheme2); setContentView(R.layout.activity_action_selection) ; //////////////////////////////////////////////////////////////////// setTheme(R.style.mainTheme2); setContentView(R.layout.activity_action_selection) ; The last code change the activity theme, but not the application theme! others does not change anything! How can i change the application theme in java codes?!

http://stackoverflow.com/comment/41272536
has text: If you see the Method.java file , "annotations" is a byte[] type field. I'm confused why I'm unable to fetch it. To be precise I'm trying a hack, trying to get this field and update annotation of a method during run-time. Method.class.getAnnotations() will only let you know the list of Annotations and not update them.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26291390

http://stackoverflow.com/q/26297041
has answer: http://stackoverflow.com/a/26297276
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2081932
has answer: http://stackoverflow.com/a/26297153
tagged with: java
downvote count: 2
upvote count: 1
has body: I've been told that there are differences between a+=b; and a=a+b; which can result in only one of those being legal depending on the type declerations. Does anyone have an example of this?
accepted answer: http://stackoverflow.com/a/26297276
has comment: http://stackoverflow.com/comment/41263506
type: Question
has comment: http://stackoverflow.com/comment/41263275
score: -1
duplicate of: http://stackoverflow.com/q/2081932
answer count: 3
possible better answer: http://stackoverflow.com/a/26297283
tagged with: types
has answer: http://stackoverflow.com/a/26297283
linked to: http://stackoverflow.com/q/19957085
favorite count: 0
tagged with: operators
has title: Difference between a+=b and a=a+b in Java

http://stackoverflow.com/a/26269356
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41213447
has comment: http://stackoverflow.com/comment/41214883
has body: The type inference engine in Java 8 has been improved, and (I assume) is now able to determine that the C type does not extend Another. In Java 7 the type inference system wasn't able to, or didn't bother determining that the Another type was missing, and gave the programmer the benefit of the doubt (at compile time). You will still pay for the transgression at runtime if you call methods on the Another interface at runtime in Java 7. For example, this code: import java.util.EnumSet; public class Main { static enum Foo { BAR } public static void main(String[] args) { Enum foo = Foo.BAR; tryCompile(EnumSet.of(foo)); } static &lt;C extends Enum&lt;C&gt; &amp; Another&gt; void tryCompile(Iterable&lt;C&gt; i) { i.iterator().next().doSomething(); } static interface Another { void doSomething(); } } Will produce this error at runtime: Exception in thread "main" java.lang.ClassCastException: Main$Foo cannot be cast to Main$Another at Main.tryCompile(Main.java:16) at Main.main(Main.java:12) Even though the Java 7 compiler will compile the code, it still gives warnings about raw types and unchecked invocations which should alert you to something being amiss. Here is a pretty straightforward example not using an enum, but modeled on the definition of Enum that exhibits the same problem. Compiles with warnings in Java 7, but not in Java 8: import java.util.Collections; import java.util.List; public class Main { static class Foo&lt;T extends Foo&lt;T&gt;&gt; { } static class FooA extends Foo&lt;FooA&gt; { } public static &lt;T extends Foo&lt;T&gt;&gt; List&lt;T&gt; fooList(T e) { return Collections.singletonList(e); } public static void main(String[] args) { Foo foo = new FooA(); tryCompile(fooList(foo)); } static &lt;C extends Enum&lt;C&gt; &amp; Another&gt; void tryCompile(Iterable&lt;C&gt; i) { i.iterator().next().doSomething(); } static interface Another { void doSomething(); } } So it isn't an Enum specific issue, but it may be because of the recursive types involved.
downvote count: 0
answers question: http://stackoverflow.com/q/26269055

http://stackoverflow.com/a/26217751
answers question: http://stackoverflow.com/q/26217105
score: 0
has body: Collection&lt;Collection&lt;Integer&gt;&gt; ints = new ArrayList&lt;&gt;(); Collections.addAll(ints, Arrays.asList(149), Arrays.asList(141, 143), Arrays.asList(11), Arrays.asList(11, 22)); // Java 8 List&lt;Integer&gt; flattenedUniqueInts = ints.stream() .flatMap(x -&gt; x.stream()).sorted().distinct() .collect(Collectors.toList()); // Java 7, optimally using Set. Set&lt;Integer&gt; result = new HashSet&lt;&gt;(); for (Collection&lt;Integer&gt; sub : ints) { Collections.addAll(sub); } Two solutions, one for java 8, one for java 7. In Java 8 one could be content with an IntStream result, using flatMapToInt without collect; using int instead of Integer. And maybe experiment with parallel.
type: Answer

http://stackoverflow.com/q/26231001
upvote count: 1
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26231198
type: Question
answer count: 1
score: -1
has title: Get the Support Library of a previous revision
has comment: http://stackoverflow.com/comment/41142307
has body: My IDE is Eclipse. Due to THIS problem I would need to mount the Android Support Library revision 19 (instead of the current revision 20) for my project. Where can I find it?
tagged with: android-support-library
favorite count: 0
linked to: http://stackoverflow.com/q/26216088
has answer: http://stackoverflow.com/a/26231198
tagged with: android
downvote count: 2

http://stackoverflow.com/q/26336052
has answer: http://stackoverflow.com/a/26336146
tagged with: ajax
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26336146
has body: I have some a java portlet application which calls a restful service. I have struck a problem where it looks like I am coming across a threadsafe issue. I have a servlet specifically used for Ajax calls. This servlet is called from myultiple locations at the same time. It looks like my application is getting confused because the Ajax servlet is receiving multiple requests from different locations at the same time. I didn't think that this would be a problem. Can someone help me understand the issue and secondly suggest a way to fix/improve? I think I will struggle to put a code snippet here because it will be too large to demonstrate the issue. But basically the pattern is that I fire some 2 ajax requests from javascript to a servlet at the same time with different parameters. The handling of the servlet request is different based ont he different parameters passed in. But they both call the same java static methods to handle creating json objects. And it's those static methods that look like they are getting confused. When I'm printing debug messages in the static methods the static methods show the debug info from the first call and then the static methods start showing debug info from the second call before the first is finished. thanks for the help and sorry for no code snippet (probably too long)
type: AnsweredQuestion
has title: java ajax method getting confused when called by multiple sources
tagged with: java
tagged with: servlets
type: Question

http://stackoverflow.com/a/26337882
has comment: http://stackoverflow.com/comment/41338473
has body: Your condition for returning true in isPrime - if (i == j) - can never be met, since it's inside a loop whose condition is j &lt; i. Instead, just return true after the loop. If the loop ends without returning false, you know for sure that the input number is prime. Your code that uses isPrime is not checking the value returned by this method. You must check it in order to decide whether to write the number to the output file.
downvote count: 0
has comment: http://stackoverflow.com/comment/41338549
has comment: http://stackoverflow.com/comment/41338536
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26337833

http://stackoverflow.com/comment/41265879
type: QuestionComment
has text: @SamuelÅslund: Thanks for your help.. I have searched for it but didn't got this link..
type: Comment
comment on: http://stackoverflow.com/q/26271464
score: 0

http://stackoverflow.com/q/26244752
has answer: http://stackoverflow.com/a/26244879
has comment: http://stackoverflow.com/comment/41168197
has comment: http://stackoverflow.com/comment/41168647
linked to: http://stackoverflow.com/q/7121188
tagged with: java
has title: Get median from array
upvote count: 1
downvote count: 1
has body: I am trying to get the median length from my array. I am using the following code but I get errors. I do not know why I get these errors. int middleSlot = list.length/2; list[middleSlot];
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26244878
tagged with: median
score: 0
answer count: 2
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/41168240
has comment: http://stackoverflow.com/comment/41250087
has comment: http://stackoverflow.com/comment/41168249
possible better answer: http://stackoverflow.com/a/26244879
accepted answer: http://stackoverflow.com/a/26244878
has comment: http://stackoverflow.com/comment/41168302

http://stackoverflow.com/comment/41612932
type: Comment
type: QuestionComment
has text: in fact I just want to know if there are some syntax that can replace these lines in a short loop or whatever. So, it looks like there doesn't exist this kind of syntax in java?
comment on: http://stackoverflow.com/q/26277156
score: 0

http://stackoverflow.com/comment/41093788
type: Comment
type: AnswerComment
has text: Java Methods aren't pass-by-reference, but a reference won't help, you would need a pointer
score: 0
comment on: http://stackoverflow.com/a/26205331

http://stackoverflow.com/comment/41103018
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26208150
type: AnswerComment
has text: well, that just a variable assignment but I'm adding it to my answer.

http://stackoverflow.com/q/26342175
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41349184
score: 1
tagged with: java
has title: Java NIO blocking/non-blocking issue when downloading from Google Cloud Storage
tagged with: nio
tagged with: google-cloud-storage
type: Question
has body: I tried downloading from Google Cloud Storage Storage.Objects.Get get = storage.objects().get(BUCKET_NAME, fileName); Log.i("Downloader", "Media File verified"); BufferedInputStream bufferedInputStream = new BufferedInputStream(get.executeMediaAsInputStream()); Log.i("Downloader", "InputStreamCreated"); ReadableByteChannel readableByteChannel = Channels.newChannel(bufferedInputStream); Log.i("Downloader", "Channel Created"); return ((SelectableChannel) readableByteChannel).configureBlocking(false); When I try to register this with a selector, nothing happens. It simply hangs. Help please
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41347751
has answer: http://stackoverflow.com/a/26434338
favorite count: 0
has comment: http://stackoverflow.com/comment/41346578
upvote count: 1
accepted answer: http://stackoverflow.com/a/26434338

http://stackoverflow.com/comment/41286789
type: QuestionComment
score: 0
has text: I just want to MATCH the AND's outside, and replace them with something else.
comment on: http://stackoverflow.com/q/26309561
type: Comment

http://stackoverflow.com/q/26253510
type: Question
has body: I'm using the zxing library to provide qrcodes and scanning to an application however I'm stuck on an issue. When attempting to scan, I've tried several methods. The recommended: IntentIntegrator integrator = new IntentIntegrator(this); integrator.initiateScan(); or the Intent method: Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); this.startActivityForResult(intent, 0); Both appear to work fine as the Scan app or choose the app to handle the intent dialog appears. However, after scanning, the app immediately closes. No errors and no results. Just bye-bye. method to catch the result, note the Log.d immediately after super() is never displayed. @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.d(LOG_TAG, "resultcode = " + resultCode); switch (requestCode) { case IntentIntegrator.REQUEST_CODE: IntentResult scanResult = IntentIntegrator.parseActivityResult( requestCode, resultCode, data); if (scanResult == null) { return; } final String result = scanResult.getContents(); // Your result if (result != null) { Log.d(LOG_TAG, "Your result is: " + result); } break; default: } } I've seen references in some tutorials explaining how to implement zxing make entries in the AndroidManifest.xml. Seen below: &lt;activity android:name="com.google.zxing.client.android.CaptureActivity" android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN"/&gt; &lt;category android:name="android.intent.category.DEFAULT"/&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="com.google.zxing.client.android.SCAN"/&gt; &lt;category android:name="android.intent.category.DEFAULT"/&gt; &lt;/intent-filter&gt; …
has title: scan qrcode closing app instead of providing result
accepted answer: http://stackoverflow.com/a/26253894
has answer: http://stackoverflow.com/a/37762510
tagged with: barcode-scanner
has answer: http://stackoverflow.com/a/26253894
score: 0
possible better answer: http://stackoverflow.com/a/26253844
tagged with: android
has answer: http://stackoverflow.com/a/26253844
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: zxing
has answer: http://stackoverflow.com/a/26462265
tagged with: android-intent

http://stackoverflow.com/a/27432930
type: Answer
answers question: http://stackoverflow.com/q/26232087
has body: also you can try JBBP library for Java and describe structure in its format and just parse and remap your data block from C to Java
score: 0

http://stackoverflow.com/comment/41159650
type: QuestionComment
has text: Yeah this is very confusing. I have no idea what you're trying to do here. Do you have a data structure and you're trying to navigate through it? Or are you trying to create a data structure AND navigate through it?
comment on: http://stackoverflow.com/q/26240303
score: 0
type: Comment

http://stackoverflow.com/a/26335215
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26334898
has body: In the second instance, you provide the same value twice. I'm guessing firePropertyChange does nothing if the value didn't actually change. Try this: public void setWeekDate(Date weekDate) { Date oldValue = this.weekDate; this.weekDate = weekDate; firePropertyChange("weekDate", oldValue, this.weekDate); }
has comment: http://stackoverflow.com/comment/41334336
has comment: http://stackoverflow.com/comment/41333989
upvote count: 2
has comment: http://stackoverflow.com/comment/41352486
has comment: http://stackoverflow.com/comment/41333959

http://stackoverflow.com/q/26348480
linked to: http://stackoverflow.com/q/26347415
tagged with: hbm2ddl
score: 0
answer count: 1
has body: I am setting up hyperjaxb to run in eclipse using this tutorial. So far, I have gotten it to marshal and unmarshal, but it does not yet trigger hbm2ddl to create the tables in the database, and it is not clear where in the eclipse directory structure I should locate the Main.java and TestFunctions.java classes that I created to run the code from the tutorial link above. How can I alter my eclipse configuration to enable these things to happen? Here is my main.java: package maintest; public class Main { public static void main(String[] args) { TestFunctions mf = new TestFunctions(); try {mf.setUp();} catch (Exception e) {e.printStackTrace();} mf.unmarshal(); mf.setUpPersistence(); Long id = mf.saveToDatabase(); System.out.println("hjid is: "+id); mf.loadFromDatabase(id); mf.marshal(); } } You can read the more lengthy code from TestFunctions.java by clicking on this link. Note that the file sharing site mistakenly center-justifies the code, despite the fact that the code is left-justified on my machine. persistence.properties is: hibernate.dialect=org.hibernate.dialect.MySQLDialect hibernate.connection.driver_class=com.mysql.jdbc.Driver hibernate.connection.username=someusername hibernate.connection.password=somepassword hibernate.connection.url=jdbc:mysql://localhost/sometestdatabase hibernate.hbm2ddl.auto=create-drop hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider hibernate.jdbc.batch_size=0 I am currently getting the following stack trace when I right click Main.java and click run as.. java application: Exception in thread "main" java.lang.NoClassDefFoundError: maintest/TestFunctions at maintest.Main.main(Main.java:7) Caused by: java.lang.ClassNotFoundException: maintest.TestFunctions at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launche…
tagged with: hyperjaxb
type: UnansweredQuestion
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/26349641
tagged with: eclipse
type: Question
has title: persisting hyperjaxb-generated entities to mysql from eclipse
linked to: http://stackoverflow.com/q/26366556

http://stackoverflow.com/q/26351192
tagged with: database
has title: Calling an Oracle Stored Procedure in Java
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26353294
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41362762
tagged with: oracle-database
type: AnsweredQuestion
tagged with: sys-refcursor
tagged with: stored-procedures
accepted answer: http://stackoverflow.com/a/26353294
tagged with: java
upvote count: 1
has body: Here's how I'm able to execute my stored procedure through SqlDeveloper var p refcursor; exec DMG.Getstudentids(12342343,:p); print p; Output P ----------- STUDENT_ID ----------- 23432425 54353455 Now I'm trying execute the stored procedure the same way but in Java. Here's my code and I'm missing something about the input/output parameters or their datatypes. Connection connection = DriverManager.getConnection(url, user, pass); CallableStatement cs = connection.prepareCall("{call DMG.Getstudentids(?,?)}"); cs.setFloat(1, 12342343); cs.registerOutParameter(2, Types.OTHER); cs.execute(); List&lt;Integer&gt; result = (List&lt;Integer&gt;) cs.getArray(2); I get the following error java.sql.SQLException: Invalid column type: 1111 I think I'm missing something fundamental here. Anyone see where I'm failing? Thanks.
type: Question

http://stackoverflow.com/comment/41242625
score: 0
comment on: http://stackoverflow.com/q/26285155
type: Comment
type: QuestionComment
has text: @ColinDeClue but what if it will be an unknown input? profiling will never replace algorithms and time complexity

http://stackoverflow.com/q/26319332
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26319717
tagged with: rest
favorite count: 0
has body: I have two classes: /* ------------------------------------------------------ */ @Entity @Table(name="ABC") @NamedQuery(name="Abc.findAll", query="SELECT c FROM Abc c") public class Abc implements Serializable { @Id @Column(unique=true, nullable=false) private int id; @ManyToOne @JoinColumn(name="def_id", nullable=false) private Def def; // getters and setters... } /* ------------------------------------------------------ */ @Entity @Table(name = "DEF") @NamedQuery(name = "Def.findAll", query = "SELECT c FROM Def c") public class Def implements Serializable { @Id @Column(unique = true, nullable = false) private int id; @OneToMany(mappedBy = "def") private List&lt;Abc&gt; abc; public Def() { } // getters and setters... } /* ------------------------------------------------------ */ Abc have ManyToOne association with Def. I need to generate HTML table and JSON from class Abc. I have following code in controller: @RequestMapping(value="/page", method=RequestMethod.GET) // HTML table public String getPage(Model model) { List&lt;Abc&gt; abc = AbcManager.findAll(); model.addAttribute("abc", abc); return "abc"; } @RequestMapping(value="/json", method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE) // JSON (REST API) public @ResponseBody List&lt;Abc&gt; getJson() { List&lt;Abc&gt; abc = AbcManager.findAll(); return abc; } If I go to url /page, everything is ok. But if I go to url /json I get this error: Oct 11, 2014 11:01:19 ODP. org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [spring] in context with path [/project] threw exception [Request processing failed; nested exception is org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: net.example.project.entity.Def.nodes, could not initialize proxy - no Session] with root cause org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: net.example.project.entity.Def.nodes, could not initialize prox…
has answer: http://stackoverflow.com/a/26320038
type: UnansweredQuestion
has title: Spring: why normal and @ResponseBody controller generate different code?
upvote count: 1
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/a/26416033
score: 0
answers question: http://stackoverflow.com/q/26288703
type: Answer
has body: The issue is resolved. I was giving only single backspace instead of two backspaces as per java conventions. It works fine with this minor modification.

http://stackoverflow.com/a/26195791
type: Answer
has body: Yes, you can use curly braces ({ }) to specify a block: if ( loan &lt; 1000 ) { // Note the "{" f = (loan * 100 / 1000); System.out.println( "The loan amount is $" + loan ); System.out.println( "The finance charge is $" + f ); System.out.println( "The total cost is $" + (loan + f) ); } // Note the "}"
answers question: http://stackoverflow.com/q/26195769
score: 0

http://stackoverflow.com/comment/41103062
type: QuestionComment
has text: I'm trying to take the input, call donatePet() on each line of input to create Pet objects respective to the input. I need a donatePet() method to do so. Then I need to be able to listAvailablePets, Dogs, Cats, and Other. (If they are net set to adopted)
comment on: http://stackoverflow.com/q/26209888
type: Comment
score: 0

http://stackoverflow.com/q/26278748
has title: java.lang.IllegalArgumentException: Unknown URL file at android.content.ContentResolver.delete
tagged with: android
has comment: http://stackoverflow.com/comment/41229703
score: 0
tagged with: java
has body: Getting the above error builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { if (mImageCaptureUri != null) { //exception at below line getContentResolver().delete(mImageCaptureUri, null,null); mImageCaptureUri = null; } } }); I tried checking if file exists by new File(mImageCaptureUri.getPath()).exists() it exists but still I'm getting the exception as java.lang.IllegalArgumentException: Unknown URL file:///storage/sdcard0/tmp_avatar_1412858553212.jpg at android.content.ContentResolver.delete(ContentResolver.java:984)
answer count: 1
has answer: http://stackoverflow.com/a/26278804
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26278804
type: Question

http://stackoverflow.com/comment/41305302
comment on: http://stackoverflow.com/q/26317394
has text: @MSach: no, i'm not meaning to say that, at all.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26318284
has answer: http://stackoverflow.com/a/28675717
type: Question
answer count: 3
downvote count: 0
has body: Here is the WinRegistry class I am using to readStringValues for a Key and am getting NullPointerException: public class WinRegistry { public static final int HKEY_CURRENT_USER = 0x80000001; public static final int HKEY_LOCAL_MACHINE = 0x80000002; public static final int REG_SUCCESS = 0; public static final int REG_NOTFOUND = 2; public static final int REG_ACCESSDENIED = 5; private static final int KEY_ALL_ACCESS = 0xf003f; private static final int KEY_READ = 0x20019; private static Preferences userRoot = Preferences.userRoot(); private static Preferences systemRoot = Preferences.systemRoot(); private static Class&lt;? extends Preferences&gt; userClass = userRoot.getClass(); private static Method regOpenKey = null; private static Method regCloseKey = null; private static Method regQueryValueEx = null; private static Method regEnumValue = null; private static Method regQueryInfoKey = null; private static Method regEnumKeyEx = null; private static Method regCreateKeyEx = null; private static Method regSetValueEx = null; private static Method regDeleteKey = null; private static Method regDeleteValue = null; static { try { regOpenKey = userClass.getDeclaredMethod("WindowsRegOpenKey", new Class[] { int.class, byte[].class, int.class }); regOpenKey.setAccessible(true); regCloseKey = userClass.getDeclaredMethod("WindowsRegCloseKey", new Class[] { int.class }); regCloseKey.setAccessible(true); regQueryValueEx = userClass.getDeclaredMethod("WindowsRegQueryValueEx", new Class[] { int.class, byte[].class }); regQueryValueEx.setAccessible(true); regEnumValue = userClass.getDeclaredMethod("WindowsRegEnumValue", new Class[] { int.class, int.class, int.class }); regEnumValue.setAccessible(true); regQueryInfoKey = userClass.getDeclaredMethod("WindowsRegQueryInfoKey1", new Class[] { int.class }); regQueryInfoKey.setAccessible(true); regEnumKeyEx = userClass.getDeclaredMethod( "WindowsRegEnumKeyEx", new Class[] { int.class, int.class, int.class }); regEnumKeyEx.setAccessible(true); r…
favorite count: 0
score: 2
upvote count: 2
has title: NullPointer Exception in readStringValues method in WinRegistry class
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26318414
has answer: http://stackoverflow.com/a/62416125
tagged with: java

http://stackoverflow.com/comment/41167304
type: QuestionComment
has text: but, finally, it works??
type: Comment
comment on: http://stackoverflow.com/q/26242890
score: 0

http://stackoverflow.com/comment/41322105
type: Comment
has text: that makes sense. I will know that for next time. Thanks!
type: QuestionComment
comment on: http://stackoverflow.com/q/26329014
score: 0

http://stackoverflow.com/a/26299040
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41267418
has comment: http://stackoverflow.com/comment/41267155
answers question: http://stackoverflow.com/q/26298161
downvote count: 0
upvote count: 2
has body: Since an answer has already been accepted, I figured I'd give a few pointers; public int getSides()//get method { Scanner inputDevice = new Scanner (System.in); System.out.println("If looking for a custom sided die, please enter number of sides now:"); numberOfSides = inputDevice.nextInt(); return numberOfSides; } I recommend not doing IO during getSides() which then has a side-effect of setting the number of sides in your die. instead, have the main method run the "askForSides" method (which contains the scanner). and then pass this argument into a setSides() method. secondly, I recommend that instead of your current constructor which sets the sides to a fixed 6 you replace it with: public Die() //constructor { numberOfSides = 6; } public Die(int sides) { this.numberOfSides = sides; } Even better (well, I like it anyway) is: public Die() //constructor { this(6); } public Die(int sides) { this.numberOfSides = sides; } this way only 1 constructor actually sets the sides, the other simply supplies a default. this makes refactoring easier in the long run. if you have a constructor that takes sides as an argument, you can use that instead of the setSides method :)

http://stackoverflow.com/q/26314732
accepted answer: http://stackoverflow.com/a/26315519
type: Question
has body: Can I enforce child classes to create a enum in them? class Document&lt;T extends Enum&lt;T&gt;&gt;{ Map&lt;T, String&gt; fields; } class TextDocument extends Document&lt;TextDocument.Field&gt;{ public enum Field{ ... } } How can I enforce any implementation of Document to have an enum named Field within it? In the above example, TextDocument can extend Document with some other enum (say GraphDocument.Field) as well which shouldn't be allowed. How can I create this restriction? I need to enforce this rule to subclasses - "You must have your own enum". Is this even possible? By some hacky way? Any ideas?
has comment: http://stackoverflow.com/comment/42553083
score: 0
has comment: http://stackoverflow.com/comment/41295484
has comment: http://stackoverflow.com/comment/42563305
answer count: 1
tagged with: generics
has answer: http://stackoverflow.com/a/26315519
tagged with: subclass
has title: Enforce subclass to declare a enum
type: AnsweredQuestion
tagged with: enums
tagged with: java

http://stackoverflow.com/a/26252993
has comment: http://stackoverflow.com/comment/107039742
has comment: http://stackoverflow.com/comment/125543208
has comment: http://stackoverflow.com/comment/89736010
score: 444
has comment: http://stackoverflow.com/comment/78594775
upvote count: 444
has comment: http://stackoverflow.com/comment/59227701
has comment: http://stackoverflow.com/comment/64402731
has comment: http://stackoverflow.com/comment/107042290
has comment: http://stackoverflow.com/comment/108685557
has comment: http://stackoverflow.com/comment/137965803
has comment: http://stackoverflow.com/comment/85754153
has comment: http://stackoverflow.com/comment/115743319
answers question: http://stackoverflow.com/q/26252591
has comment: http://stackoverflow.com/comment/126909278
downvote count: 0
has body: Uninstall jdk8, install jdk7, then reinstall jdk8. My approach to switching between them (in .profile) : export JAVA_7_HOME=$(/usr/libexec/java_home -v1.7) export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8) export JAVA_9_HOME=$(/usr/libexec/java_home -v9) export JAVA_20_HOME=$(/usr/libexec/java_home -v20) alias java7='export JAVA_HOME=$JAVA_7_HOME' alias java8='export JAVA_HOME=$JAVA_8_HOME' alias java9='export JAVA_HOME=$JAVA_9_HOME' alias java20='export JAVA_HOME=$JAVA_20_HOME' #default java8 export JAVA_HOME=$JAVA_8_HOME Then you can simply type java7 or java8 in a terminal to switch versions. (edit: updated to add Dylans improvement for Java 9)
has comment: http://stackoverflow.com/comment/137164454
has comment: http://stackoverflow.com/comment/95560343
has comment: http://stackoverflow.com/comment/51763052
has comment: http://stackoverflow.com/comment/80276948
has comment: http://stackoverflow.com/comment/137871202
type: Answer

android-asynctask
tags question: http://stackoverflow.com/q/26202568
type: Tag
tags question: http://stackoverflow.com/q/26260174
tags question: http://stackoverflow.com/q/26250054
tags question: http://stackoverflow.com/q/26308665
tags question: http://stackoverflow.com/q/26201327
tag name: android-asynctask
tags question: http://stackoverflow.com/q/26216294
tags question: http://stackoverflow.com/q/26343805
tags question: http://stackoverflow.com/q/26230042
tags question: http://stackoverflow.com/q/26353020
tags question: http://stackoverflow.com/q/26332148
tags question: http://stackoverflow.com/q/26321385
tags question: http://stackoverflow.com/q/26313655
tags question: http://stackoverflow.com/q/26268747
tags question: http://stackoverflow.com/q/26259724
tags question: http://stackoverflow.com/q/26297137

http://stackoverflow.com/comment/41191315
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26257975
has text: Well add an `input` result and show an error message on that page and you will see why.
score: 0

http://stackoverflow.com/q/26276027
has title: Which one is the application server in the given scenario
score: 0
has comment: http://stackoverflow.com/comment/41224772
answer count: 1
has answer: http://stackoverflow.com/a/26276171
tagged with: tomcat
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41224928
has comment: http://stackoverflow.com/comment/41224652
type: Question
has body: I have a web application in Java 8. It is developed using Spring 4, Hibernate 4 and Maven 3 frameworks. I am deploying the application in Tomcat 8. Now I have a stupid doubt. My Web server is Tomcat 8. But what will be the Application Server..??????

duration
tags question: http://stackoverflow.com/q/26330975
tag name: duration
type: Tag

http://stackoverflow.com/a/26238981
downvote count: 0
has body: When you divide two integers, you will always get an integer, rounded down. if you divide distanceInMeter / KILOMETER_IN_METERS and then assign it to a double, it is first divided as integer, before assigned, so you get a rounded down value, cast to an double. Sonar does not complain because of Math.floor - it complains because you casted an integer-division result (which itself is an rounded-down integer) into a double. Most of the time, this is an error (Why deliberately auto-round and immediately cast to a double afterwards)? int distanceInMeter = 505; double result = distanceInMeter / KILOMETER_IN_METERS; System.out.println(result); // 0.0 double result2 = distanceInMeter * 1.0 / KILOMETER_IN_METERS; System.out.println(result2); // 0.505 double result3 = ((double) distanceInMeter) / KILOMETER_IN_METERS; System.out.println(result3); // 0.505 1.0 * distanceInMeter / KILOMETER_IN_METERS ((double)distanceInMeter) / KILOMETER_IN_METERS
answers question: http://stackoverflow.com/q/26238637
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/26340398
has answer: http://stackoverflow.com/a/26340428
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41342950
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/41342961
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/26340424
downvote count: 1
possible better answer: http://stackoverflow.com/a/26340432
has body: I am trying to implement Fragments in my application. The problem occurs when I change tabs (I'm using drawer layout), I get a java.lang.NullPointerException error. I tested the code on the main activity and it worked smoothly. the only problem is when I apply it on fragment. here is the code: import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.*; public class FragW extends Fragment { Spinner spinwatt ; Button calculate; EditText wattEdit; EditText costEdit; TextView resultText; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragw,container,false); calculate = (Button) getView().findViewById(R.id.calculate); wattEdit = (EditText) getView().findViewById(R.id.wattEdit); costEdit = (EditText) getView().findViewById(R.id.costEdit); calculate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { float wattVar = Float.parseFloat(wattEdit.getText().toString()); float costvar = Float.parseFloat(costEdit.getText().toString()); if (spinwatt.getSelectedItem().toString().equals("µW")) wattVar = wattVar * (float) 0.000001; else if (spinwatt.getSelectedItem().toString().equals("mW")) wattVar = wattVar * (float) 0.001; else if (spinwatt.getSelectedItem().toString().equals("kW")) wattVar = wattVar * 1000; String resultvar = Float.toString(costvar * wattVar); resultText.setText(resultvar); } }); spinwatt = (Spinner)getView().findViewById(R.id.spinwatt); ArrayAdapter&lt;CharSequence&gt; wattAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.wattArray, android.R.layout.simple_spinner_item); wattAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinwatt.setAdapter(wattAdapter); return v; } Here is the logCat 10-13 12:27:13.429 2563-2563/az.t…
has answer: http://stackoverflow.com/a/26340432
tagged with: android-fragments
tagged with: java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26340424
has title: java.lang.NullPointerException with android fragment
score: 1
favorite count: 0

http://stackoverflow.com/comment/41299561
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26294656
has text: You can do whatever works for you. But generally a web service provides raw data without formatting so that it might be used in other ways. Assumptions about formatting tend to limit that re-use.

http://stackoverflow.com/q/26282098
has comment: http://stackoverflow.com/comment/41236155
tagged with: java
type: Question
score: 5
has title: tomcat gives 404 after successful war deployment
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has body: Problem: I am relatively new to tomcat, i deployed a war file from the new project i am working on and it deploys fine without any problems, but when i try to run the app it gives 404. I tried : tried to find the appropriate error messages but,no errors seen in eclipse console nor in logs folder in tomcat installation directory. How do i troubleshoot this problem? any help is appreciated.
has answer: http://stackoverflow.com/a/41121496
has comment: http://stackoverflow.com/comment/41236008
has comment: http://stackoverflow.com/comment/41236571
has comment: http://stackoverflow.com/comment/41236002
has comment: http://stackoverflow.com/comment/41247630
has comment: http://stackoverflow.com/comment/41240805
upvote count: 5
type: UnansweredQuestion
tagged with: tomcat7

http://stackoverflow.com/a/26273971
has body: In the while use || to keep both width and height withing bounds. And no, you cannot reread an InputStream. No. Theoretically you could use reset() but internet is sequential I/O: boolen canReset = inputStream.markSupported(); if (canReset) { inputStream.mark(Integer.MAX_VALUE); } ... first read if (canReset) { inputStream.reset(); } ... second read Instead of a boolean flag, catching an IOException on reset would be easier: it might be thrown anyway when the read limit is exceeded for instance. Simply reread. The second time it might come from cache.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26273715

http://stackoverflow.com/comment/41184581
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26253870
has text: In your code there are many annotations missing, but we consider that they exist.
type: QuestionComment

http://stackoverflow.com/comment/41334742
comment on: http://stackoverflow.com/a/26333828
score: 0
type: Comment
has text: Thank you. I get the idea. Can you please post an SSCCE particularly on how I can obtain the `pageIndex` from `Printable`'s `print()` method to the `doInBackground()` method of `SwingWorker`? From what I know, `pj.print()` method from the code above blocks.
type: AnswerComment

http://stackoverflow.com/a/26303770
downvote count: 0
has body: You can declare your reference as List&lt;MyClass&gt;. You'll be able to add anything extending MyClass, including instances of MyClass.
upvote count: 2
answers question: http://stackoverflow.com/q/26303692
type: Answer
score: 2

http://stackoverflow.com/a/26254698
accepted answer of: http://stackoverflow.com/q/26254051
type: Answer
upvote count: 4
downvote count: 0
has body: final URL url = new URL( new URI(urlString).toASCIIString() ); worked for me.
score: 4
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26254051

http://stackoverflow.com/q/26244590
has title: Can you see custom properties in Java Scene Builder with Custom Controls?
has answer: http://stackoverflow.com/a/26247377
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41171514
possible better answer: http://stackoverflow.com/a/44632824
accepted answer: http://stackoverflow.com/a/26247377
favorite count: 0
has answer: http://stackoverflow.com/a/44632824
score: 2
upvote count: 2
has body: If I make a custom control with a Skin, Control and Behavior class, is it possible to show my custom properties in Java Scene Builder? If someone has already done this could you please explain how? I have but properties in both the Skin and Control sub classes without success. Thanks Jec Edit 1: So others can follow along, here is a sample 'Control' class which Scene Builder was able to detect. public class DisplayControl extends Control { private ObjectProperty m_BackgroundColor; public DisplayControl() { m_Skin = new DisplaySkin(this); m_BackgroundColor = new SimpleObjectProperty&lt;&gt;(new Color(0.5, 0.5, 0.5, 1)); setSkin(m_Skin); } public ObjectProperty&lt;Color&gt; backgroundColor() { return m_BackgroundColor; } /** * @return the m_BackgroundColor */ public Color getBackgroundColor() { return m_BackgroundColor.get(); } /** * @param BackgroundColor the BackgroundColor to set */ public void setBackgroundColor(Color backgroundColor) { if (backgroundColor != m_BackgroundColor.get()) { m_BackgroundColor.set(backgroundColor); m_Skin.setBackgroundColor(backgroundColor); } } }
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: scenebuilder
tagged with: javafx

http://stackoverflow.com/comment/41154705
score: 2
comment on: http://stackoverflow.com/q/26236811
has text: It's completely up to you if the custom solution is reusable or not. FWIW: The resposne body is assembled by `DefaultErrorAttributes#getErrorAttributes`. You could inject that class into your `CustomResponseEntityExceptionHandler`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41753532
has text: Interesting; for me, it's the green plus button that flashes.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26545743
type: Comment

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/26218366
tags question: http://stackoverflow.com/q/26296579
tags question: http://stackoverflow.com/q/26265564
tag name: nosuchmethoderror

http://stackoverflow.com/comment/41123350
has text: You need to specify your custom View class in the layout, not a LinearLayout.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26220859
score: 3

http://stackoverflow.com/comment/41266535
comment on: http://stackoverflow.com/q/26298730
type: QuestionComment
type: Comment
has text: why don't you print and check the value of `firstLine[0].trim()`
score: 0

http://stackoverflow.com/q/26352610
tagged with: java
possible better answer: http://stackoverflow.com/a/26352943
type: Question
has answer: http://stackoverflow.com/a/26352943
score: 0
answer count: 2
has title: Regex to check string formatting?
has comment: http://stackoverflow.com/comment/41389451
tagged with: regex
has answer: http://stackoverflow.com/a/26352744
accepted answer: http://stackoverflow.com/a/26352744
type: AnsweredQuestion
has body: I need a regex to match a string formatted like this: 2014-08-06T21:02:16Z,-33.7939310,151.0553090,-0.8 Do I have to use //d for each individual digit? what about the negative numbers?

http://stackoverflow.com/comment/41206861
score: 0
has text: The new stack trace should be a bit different, could you post it ?
comment on: http://stackoverflow.com/q/26242009
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26241562
accepted answer: http://stackoverflow.com/a/26241638
score: 0
has title: Which one is a better choice interface or enum involving the case mentioned below?
type: AnsweredQuestion
tagged with: enums
tagged with: java
has body: Herbert Schildt mentions while there is nothing technically wrong with the approaches, the enumeration is a better choice. Consider the following: Choice 1: //An enumeration of the possible answers. enum Answers { NO, YES, MAYBE, LATER, SOON, NEVER } public class Question { Random rand = new Random(); Answers ask() { int prob = (int) (100 * rand.nextDouble()); if (prob &lt; 15) return Answers.MAYBE; // 15% else if (prob &lt; 30) return Answers.NO; // 15% else if (prob &lt; 60) return Answers.YES; // 30% else if (prob &lt; 75) return Answers.LATER; // 15% else if (prob &lt; 98) return Answers.SOON; // 13%else return Answers.NEVER; // 2% } } public class AskMe { static void answer(Answers result) { switch (result) { case NO: System.out.println("No"); break; case YES: System.out.println("Yes"); break; case MAYBE: System.out.println("Maybe"); break; case LATER: System.out.println("Later"); break; case SOON: System.out.println("Soon"); break; case NEVER: System.out.println("Never"); break; } } public static void main(String args[]) { Question q = new Question(); answer(q.ask()); answer(q.ask()); answer(q.ask()); answer(q.ask()); } } Choice 2: public interface SharedConstants { int NO = 0; int YES = 1; int MAYBE = 2; int LATER = 3; int SOON = 4; int NEVER = 5; } public class Question implements SharedConstants { Random rand = new Random(); int ask() { int prob = (int) (100 * rand.nextDouble()); if (prob &lt; 30) return NO; // 30% else if (prob &lt; 60) return YES; // 30% else if (prob &lt; 75) return LATER; // 15% else if (prob &lt; 98) return SOON; // 13% else return NEVER; // 2% } } public class AskMe implements SharedConstants { static void answer(int result) { switch (result) { case NO: System.out.println("No"); break; case YES: System.out.println("Yes"); break; case MAYBE: System.out.println("Maybe"); break; case LATER: System.out.println("Later"); break; case SOON: System.out.println("Soon"); break; case NEVER: System.out.println("Never"); } } public static void mai…
possible better answer: http://stackoverflow.com/a/26241703
has answer: http://stackoverflow.com/a/26241638
has answer: http://stackoverflow.com/a/26241703
type: Question
answer count: 2

http://stackoverflow.com/a/26248540
accepted answer of: http://stackoverflow.com/q/26248488
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26248488
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: You can use jps command. $ jps -v 34370 Jps -Dapplication.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home -Xms8m 34341 main -XX:+TieredCompilation -Xbootclasspath/a:/usr/local/Cellar/leiningen/2.5.0/libexec/leiningen-2.5.0-standalone.jar -Dfile.encoding=UTF-8 -Dmaven.wagon.http.ssl.easy=false -Dleiningen.original.pwd=/Users/ntalbs/js-workspace/synapeditor_mobile -Dleiningen.script=/usr/local/bin/lein jps will display all java processes. The first column is OS pid. You can check the messages on console, then kill what you want. Perhaps you want to check jps document from Oracle. Also, you can use ps and grep command. $ ps -ef | grep java or $ ps -aux | grep java

http://stackoverflow.com/comment/41466997
type: QuestionComment
has text: See http://stackoverflow.com/help/behavior about greetings on StackOverflow.
comment on: http://stackoverflow.com/q/26216684
score: 0
type: Comment

http://stackoverflow.com/a/26271398
accepted answer of: http://stackoverflow.com/q/26271366
has body: There is nothing special in predefined function over user defined. The only thing is predefined has been written by somebody else for you. It depends on algorithm.
answers question: http://stackoverflow.com/q/26271366
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/41216826
type: Answer

http://stackoverflow.com/q/26290473
tagged with: jvm
tagged with: compiler-optimization
favorite count: 0
has title: Does Hotspot JVM perform redundancy elimination of casts, unboxing and divisions?
accepted answer: http://stackoverflow.com/a/26296041
score: 2
type: AnsweredQuestion
upvote count: 3
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41251997
tagged with: jit
tagged with: java
has body: For example, in this case int x; for (...) { ... some work, y and z not changed x = y / z; ... some code using x } Is JVM (actually JIT compiler) allowed to compute x = y / z once before the for loop and "some work" (with side effects probably or throwing different exceptions), if it couldn't prove that z is non-zero, to throw ArithmeticException at the "right" moment? The same question about casts (which might result to ClassCastException) and unboxing (which might cause NullPointerException), still assuming in the certain case JVM/JIT compiler cannot prove that the object has appropriate class or unboxed value is non-null. Upd. morgano said that this question is devoted to the JVM implementation. In this case, my question is about Hotspot JVM/JIT compiler implementation.
has answer: http://stackoverflow.com/a/26296041
tagged with: jvm-hotspot
answer count: 1

http://stackoverflow.com/comment/41463284
type: Comment
score: 0
type: AnswerComment
has text: @EECOLOR i went ahead and made a testable project for you. When you are working on your positive testcase, the first thing you need to do is eliminate all of the `setClassLoader()` efforts and just work with the standard behavior, don't immediately jump into thinking that managing classloader hierarchies is required (it rarely is).
comment on: http://stackoverflow.com/a/26393921

http://stackoverflow.com/comment/41147757
type: Comment
has text: Really is that method there? The same parameter types? static/non-static and such.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26234217

http://stackoverflow.com/a/26223635
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26223518
upvote count: 3
answers question: http://stackoverflow.com/q/26223518
has body: I think what you are looking for is an interface. You should declare an interface like this: public interface Passable { public List&lt;String&gt; getSingleSyllables(); public List&lt;String&gt; getDoubleSyllables(); // ... } Then, let Something and Another implement them: public class Something implements Passable { // method declarations } Now, change your method to this: private void getWords (Passable c) { singles = c.getSingleSyllables(); doubles = c.getDoubleSyllables(); triples = c.getTripleSyllables(); quadruples = c.getQuadrupleSyllables(); quintuples = c.getQuintupleSyllables(); }

http://stackoverflow.com/q/26272488
possible better answer: http://stackoverflow.com/a/26272541
type: AnsweredQuestion
score: -5
accepted answer: http://stackoverflow.com/a/26273064
linked to: http://stackoverflow.com/q/882420
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26273064
has answer: http://stackoverflow.com/a/26272541
downvote count: 5
has title: Compare date and time in string format
answer count: 2
has body: I have a string with date and time in this format: 9 Oct 2014 07:09:17 GMT Is there an easy way to convert this string into a comparable object, to compare with the current date, or I'll have to implement a comparison processing the string?
upvote count: 0
duplicate of: http://stackoverflow.com/q/882420
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/41357877
comment on: http://stackoverflow.com/q/26347801
score: 0
type: QuestionComment
has text: Your MCVE doesn't have the cast in it, that I can see.
type: Comment

http://stackoverflow.com/comment/41295809
has text: tried that too but didn't work i think the problem is that the code stops because of the slow response time of the service class do you have an idea how can i resolve it?
comment on: http://stackoverflow.com/q/26314734
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41355363
has text: As said in the title, I'm using javax.json. Although this is a high-level set of interfaces and factory classes only and implementations are somewhat independent from that, the answer stays the same: When using javax.json, it's not possible.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26346060

http://stackoverflow.com/q/26256280
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26256435
has title: Issue while setting up spring annotation based transactions
tagged with: spring
tagged with: java
has answer: http://stackoverflow.com/a/26271444
tagged with: jpa
type: UnansweredQuestion
has body: I have an application which used mix of JPA and JDBC. I have successfully done setup for JPA transaction using @Transactional annotation, but I am not able to make it work for JDBC. My configuration looks like: &lt;bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource"&gt; &lt;property name="driverClassName" value="${database.driverClassName}"/&gt; &lt;property name="url" value="${database.url}"/&gt; &lt;property name="username" value="${database.username}"/&gt; &lt;property name="password" value="${database.password}"/&gt; &lt;property name="testOnBorrow" value="true"/&gt; &lt;property name="testOnReturn" value="true"/&gt; &lt;property name="testWhileIdle" value="true"/&gt; &lt;property name="timeBetweenEvictionRunsMillis" value="1800000"/&gt; &lt;property name="numTestsPerEvictionRun" value="3"/&gt; &lt;property name="minEvictableIdleTimeMillis" value="1800000"/&gt; &lt;/bean&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" &gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt; &lt;/bean&gt; &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; &lt;bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"&gt; &lt;property name="persistenceUnitName" value="persistenceUnit"/&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;/bean&gt; &lt;bean class="org.springframework.jdbc.core.JdbcTemplate" id="jdbcTemplate"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;/bean&gt; My code is : @Test @Transactional public void testUpdateSQLwithParam() { Object[] params = { "John","", "trol", "test", "M", "Place", "123456789", "tom@domain.com" }; customQueryDao.insert("PERSON_INSERT_QUERY", params); String sqlConstant = "PERSON_MASTER_UPADTE_QUERY"; params = new Object[]{ "Test", 8 }; customQueryDao.updateSQLwithParam(sqlConstant, params); } My JDBC code uses jdbcTemplate to execute queries…
type: Question
tagged with: jdbc

wear-os
tags question: http://stackoverflow.com/q/26350122
type: Tag
tag name: wear-os

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/26267230
tags question: http://stackoverflow.com/q/26241488
type: Tag
tags question: http://stackoverflow.com/q/26300395
tags question: http://stackoverflow.com/q/26282574

http://stackoverflow.com/comment/41161582
comment on: http://stackoverflow.com/q/26241367
has text: possible duplicate of [Why am I receiving IllegalFormatConversionException in Java for this code?](http://stackoverflow.com/questions/11936327/why-am-i-receiving-illegalformatconversionexception-in-java-for-this-code)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26304418
favorite count: 0
has title: Lucene 4.10.1, IndexWriterConfig initialisation error
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41311792
upvote count: 1
has body: I'm trying to implement a very basic search in pdf functionnality in my app, For this , I'm adding lucene using maven in a new project, and use this code : final String _sdcard = Environment.getExternalStorageDirectory().getPath(); public void pdfIndex(){ try { new File(_sdcard+"/techlist/data/pdfindex").mkdir(); Directory d=new SimpleFSDirectory(new File(_sdcard+"/techlist/data/pdfindex")); Analyzer analyzer=new StandardAnalyzer(); IndexWriterConfig iwc=new IndexWriterConfig(Version.LATEST,new StandardAnalyzer(Version.LATEST)); iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); IndexWriter writer=new IndexWriter(d,iwc); Document document= LucenePDFDocument.getDocument(new File(_sdcard + "/myapp/data/examplefile.pdf")); writer.addDocument(document); writer.close(); }catch (IOException e){ } } All compile fine but when I run this code, I have this error in the logcat output : 10-10 16:39:51.071 1356-1356/? E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.ExceptionInInitializerError at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:125) at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:171) at ludo.testing_maven.MyActivity.pdfIndex(MyActivity.java:38) at ludo.testing_maven.MyActivity.onCreate(MyActivity.java:31) at android.app.Activity.performCreate(Activity.java:5008) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) at android.app.ActivityThread.access$600(ActivityThread.java:130) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at …
type: Question
tagged with: lucene
downvote count: 0

http://stackoverflow.com/q/26249944
has answer: http://stackoverflow.com/a/26253785
linked to: http://stackoverflow.com/q/26218630
tagged with: java
has comment: http://stackoverflow.com/comment/41177634
has comment: http://stackoverflow.com/comment/41177824
has comment: http://stackoverflow.com/comment/41179840
answer count: 2
possible better answer: http://stackoverflow.com/a/26253209
downvote count: 0
has answer: http://stackoverflow.com/a/26253209
has comment: http://stackoverflow.com/comment/41177771
tagged with: progress-bar
favorite count: 0
accepted answer: http://stackoverflow.com/a/26253785
tagged with: propertychangelistener
type: AnsweredQuestion
has body: I have a static boolean variable inProgress in a MainPanel containing a progressbar. A communicator class changes the value of this variable to true false. The propertyListener is as follows @Override public void propertyChange(PropertyChangeEvent evt) { System.out.println("Property change check none"); if(true ==MainPanel.inProgress){ progressInformationPanel.getProgressBar().setIndeterminate(true); progressInformationPanel.getCurrentProcesLabel().setText("Processing..."); } else if(false ==MainPanel.inProgress){ System.out.println("Property change check none" + false); progressInformationPanel.getProgressBar().setIndeterminate(false); progressInformationPanel.getCurrentProcesLabel().setText("Finished...."); } } }); The communicator class is an observer. That is listening to some other class. Now as soon as there is a progress communicator class updates the variable of the MainPanel but the propertyChangeListener does not act. I am not getting idea about why this is happening. Also please see my linked Question here Here is the SSCCE import java.awt.GridBagLayout; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.JFrame; import javax.swing.JProgressBar; public class MainFrame extends JFrame{ public static boolean inProgress = true; private JProgressBar bar; public Communicator diplayFacade; public MainFrame() { this.setSize(500, 500); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diplayFacade = new Communicator(); bar = new JProgressBar(); setLayout(new GridBagLayout()); add(bar); addProgressListener(); } public void addProgressListener(){ bar.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if(true == MainFrame.inProgress){ System.out.println("Property change check none" + true); bar.setIndeterminate(true); } else if(false ==MainFrame.inProgress){ System.out.println("Property change check none" + false); bar.setInd…
score: 1
upvote count: 1
tagged with: observer-pattern
tagged with: swing
has title: ProgressBar properychangeListener not updating in this case
type: Question

http://stackoverflow.com/a/26306941
answers question: http://stackoverflow.com/q/26290371
type: AcceptedAnswer
has body: I found the issue: the problem is that Files is System class. https://github.com/powermock/powermock/wiki/mocksystem
accepted answer of: http://stackoverflow.com/q/26290371
upvote count: 5
type: Answer
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/67131597
has comment: http://stackoverflow.com/comment/67131773

http://stackoverflow.com/q/26260288
has comment: http://stackoverflow.com/comment/41198205
has answer: http://stackoverflow.com/a/26260754
accepted answer: http://stackoverflow.com/a/26260754
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26261889
has body: Summary Adding android:layout_alignParentBottom="true" to the TextView element located in the activity_main.xml positions the textview at the bottom of an Android App. It is also possible to change the TextView position in Android using Java, e.g.: textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 48); textView.setText("hello"); changes the font size of hello. Attempts In order to position hello at the bottom of the application, the list of possible methods was inspected and textView.setBottom(TRIM_MEMORY_BACKGROUND); was chosen. Note: other constants than TRIM_MEMORY_BACKGROUND could be specified, but in order to check the output of setBottom a random constant was chosen. However, it is impossible to run the application as setBottom results in the following error: Once @SuppressLint("NewApi") has been added it is possible to run the Application, but hello is not placed at the bottom. According another Q&amp;A the following code RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); textView.setLayoutParams(params1); should be able to change the position of hello, but this does not work either. Code import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.view.ViewGroup.LayoutParams; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; public class MainActivity extends ActionBarActivity { // @SuppressLint("NewApi") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); TextView textView = new TextView(this); TextView textView2 = new TextView(this); // textView.; RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams( Layout…
score: 0
has title: How to change the position of TextViews in Android using Java?
tagged with: android
has answer: http://stackoverflow.com/a/26261889
linked to: http://stackoverflow.com/q/15586293